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,
|
icon,
|
||||||
itemIcon,
|
itemIcon,
|
||||||
defaultSelectedKey,
|
defaultSelectedKey,
|
||||||
|
onSelectionChange,
|
||||||
...props
|
...props
|
||||||
}: SelectFilterProps) {
|
}: SelectFilterProps) {
|
||||||
const [focus, setFocus] = useState(false)
|
const [focus, setFocus] = useState(false)
|
||||||
@@ -36,7 +37,12 @@ export function SelectFilter({
|
|||||||
name={name}
|
name={name}
|
||||||
aria-label={label}
|
aria-label={label}
|
||||||
isDisabled={isDisabled}
|
isDisabled={isDisabled}
|
||||||
onSelectionChange={setValue}
|
onSelectionChange={(val) => {
|
||||||
|
setValue(val)
|
||||||
|
if (onSelectionChange) {
|
||||||
|
onSelectionChange(val)
|
||||||
|
}
|
||||||
|
}}
|
||||||
onFocus={() => setFocus(true)}
|
onFocus={() => setFocus(true)}
|
||||||
onBlur={() => setFocus(false)}
|
onBlur={() => setFocus(false)}
|
||||||
defaultSelectedKey={defaultSelectedKey}
|
defaultSelectedKey={defaultSelectedKey}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export interface SelectProps extends ComponentProps<typeof Select> {
|
|||||||
items: Item[]
|
items: Item[]
|
||||||
name: string
|
name: string
|
||||||
label: string
|
label: string
|
||||||
|
onSelectionChange?: (key: Key | null) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SelectItemProps extends ComponentProps<typeof ListBoxItem> {
|
export interface SelectItemProps extends ComponentProps<typeof ListBoxItem> {
|
||||||
@@ -28,5 +29,6 @@ export interface SelectFilterProps extends ComponentProps<typeof ComboBox> {
|
|||||||
items: Item[]
|
items: Item[]
|
||||||
name: string
|
name: string
|
||||||
label: string
|
label: string
|
||||||
|
onSelectionChange?: (key: Key | null) => void
|
||||||
enableFiltering: boolean
|
enableFiltering: boolean
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user