From 24bbb052faef9ce4ead5e1c4eb2f6f53bfa011a5 Mon Sep 17 00:00:00 2001 From: Valerii Sidorenko Date: Fri, 23 Aug 2024 18:18:26 +0200 Subject: [PATCH] fix(Select): pass disabled prop to renderControl, don't change state if disabled (#1766) --- src/components/Select/Select.tsx | 1 + src/components/Select/__stories__/SelectShowcase.tsx | 6 ++++-- src/components/Select/__stories__/constants.ts | 6 ++++-- .../components/SelectControl/SelectControl.tsx | 1 + src/components/Select/types.ts | 1 + src/hooks/useSelect/types.ts | 1 + src/hooks/useSelect/useSelect.ts | 12 +++++++++++- 7 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/components/Select/Select.tsx b/src/components/Select/Select.tsx index 3517f5e0b1..3cad976d43 100644 --- a/src/components/Select/Select.tsx +++ b/src/components/Select/Select.tsx @@ -129,6 +129,7 @@ export const Select = React.forwardRef(function open: propsOpen, onClose, onOpenChange, + disabled, }); React.useEffect(() => { diff --git a/src/components/Select/__stories__/SelectShowcase.tsx b/src/components/Select/__stories__/SelectShowcase.tsx index b4bb839588..9c74af8587 100644 --- a/src/components/Select/__stories__/SelectShowcase.tsx +++ b/src/components/Select/__stories__/SelectShowcase.tsx @@ -266,12 +266,13 @@ export const SelectShowcase = (props: SelectProps) => { selectProps={{ ...props, className: b('user-control'), - renderControl: ({onClick, onKeyDown, ref, renderClear}) => { + renderControl: ({onClick, onKeyDown, ref, renderClear, disabled}) => { return (