fix(SW-1509): fix typing for supporting on selection change prop to be aligned between the two versions
This commit is contained in:
@@ -24,6 +24,7 @@ export function SelectFilter({
|
||||
icon,
|
||||
itemIcon,
|
||||
defaultSelectedKey,
|
||||
onSelectionChange,
|
||||
...props
|
||||
}: SelectFilterProps) {
|
||||
const [focus, setFocus] = useState(false)
|
||||
@@ -36,7 +37,12 @@ export function SelectFilter({
|
||||
name={name}
|
||||
aria-label={label}
|
||||
isDisabled={isDisabled}
|
||||
onSelectionChange={setValue}
|
||||
onSelectionChange={(val) => {
|
||||
setValue(val)
|
||||
if (onSelectionChange) {
|
||||
onSelectionChange(val)
|
||||
}
|
||||
}}
|
||||
onFocus={() => setFocus(true)}
|
||||
onBlur={() => setFocus(false)}
|
||||
defaultSelectedKey={defaultSelectedKey}
|
||||
|
||||
@@ -15,6 +15,7 @@ export interface SelectProps extends ComponentProps<typeof Select> {
|
||||
items: Item[]
|
||||
name: string
|
||||
label: string
|
||||
onSelectionChange?: (key: Key | null) => void
|
||||
}
|
||||
|
||||
export interface SelectItemProps extends ComponentProps<typeof ListBoxItem> {
|
||||
@@ -28,5 +29,6 @@ export interface SelectFilterProps extends ComponentProps<typeof ComboBox> {
|
||||
items: Item[]
|
||||
name: string
|
||||
label: string
|
||||
onSelectionChange?: (key: Key | null) => void
|
||||
enableFiltering: boolean
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user