Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/backend.ai-ui/src/components/BAISelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const useStyles = createStyles(({ css, token }) => ({
export interface BAISelectProps<
ValueType = any,
OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,
> extends Omit<SelectProps<ValueType, OptionType>, 'onSearch'> {
> extends Omit<SelectProps<ValueType, OptionType>, 'onSearch' | 'role'> {
ref?: React.RefObject<GetRef<typeof Select<ValueType, OptionType>> | null>;
ghost?: boolean;
autoSelectOption?:
Expand All @@ -108,6 +108,11 @@ export interface BAISelectProps<
footer?: React.ReactNode;
endReached?: () => void; // New prop for endReached
searchAction?: (value: string) => Promise<void>;
// antd v6 made `role` required on SelectProps. We Omit it from the
// extended props and re-add it as optional with a sensible default so
// callers don't have to spell it out at every call site. Override
// (e.g. `role="listbox"`) when a specific ARIA role is needed.
role?: SelectProps<ValueType, OptionType>['role'];
}

function BAISelect<
Expand All @@ -123,6 +128,7 @@ function BAISelect<
footer,
endReached, // Destructure the new prop
searchAction,
role = 'combobox',
...selectProps
}: BAISelectProps<ValueType, OptionType>): React.ReactElement {
const { value, options, onChange } = selectProps;
Expand Down Expand Up @@ -196,6 +202,7 @@ function BAISelect<
<Tooltip title={tooltip}>
<Select<ValueType, OptionType>
{...selectProps}
role={role}
loading={isPending || selectProps.loading}
showSearch={composedShowSearch}
ref={ref}
Expand Down
Loading
Loading