diff --git a/src/components/Listbox/Listbox2.tsx b/src/components/Listbox/Listbox2.tsx index 8dc6f98b..0596002f 100644 --- a/src/components/Listbox/Listbox2.tsx +++ b/src/components/Listbox/Listbox2.tsx @@ -271,12 +271,11 @@ function Listbox({ interface OptionProps { id?: string - className?: string value: any - children?: React.ReactNode label: string - addOnBefore?: ({ active, selected }: any) => React.ReactNode disabled?: boolean + children?: React.ReactNode + addOnBefore?: ({ active, selected }: any) => React.ReactNode } type addOnBefore = { @@ -286,12 +285,11 @@ type addOnBefore = { function SelectOption({ id, - className, value, - children, label, - addOnBefore, disabled = false, + children, + addOnBefore, }: OptionProps) { const __styles = styleHandler('listbox') @@ -308,7 +306,7 @@ function SelectOption({ active ? __styles.option_active : ' ', disabled ? __styles.option_disabled : ' ' )} - onSelect={() => onChange(value)} + onSelect={() => (!disabled ? onChange(value) : {})} >
{addOnBefore && addOnBefore({ active, selected })} diff --git a/src/components/Listbox/SelectStyled.stories.tsx b/src/components/Listbox/SelectStyled.stories.tsx index 94476499..c2eecc09 100644 --- a/src/components/Listbox/SelectStyled.stories.tsx +++ b/src/components/Listbox/SelectStyled.stories.tsx @@ -37,6 +37,20 @@ export const Default = (args: any) => ( ) +export const WithDisabled = (args: any) => ( + + + Option 1 + + + Option 2 + + + Option 3 + + +) + const people = [ { value: 1,