fix(SW-1509): fix typing for supporting on selection change prop to be aligned between the two versions

This commit is contained in:
Christian Andolf
2025-04-11 08:58:01 +02:00
parent a93ed00ee5
commit c39a18ab58
2 changed files with 9 additions and 1 deletions

View File

@@ -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}

View File

@@ -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
}