Files
twenty/packages/twenty-front/src/modules/ui/field/input/components/SelectInput.tsx
Guillim 0de8140b3a CreateComponentFamilyState -> createComponentFamilyStateV2 (#11546)
Refacto of createComponentFamilyState

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2025-04-14 10:31:30 +02:00

52 lines
1.4 KiB
TypeScript

import { SelectInput as SelectBaseInput } from '@/ui/input/components/SelectInput';
import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList';
import { SelectOption } from 'twenty-ui/input';
type SelectInputProps = {
selectableListComponentInstanceId: string;
selectableItemIdArray: string[];
hotkeyScope: string;
onEnter: (itemId: string) => void;
onOptionSelected: (selectedOption: SelectOption) => void;
options: SelectOption[];
onCancel?: () => void;
defaultOption?: SelectOption | undefined;
onFilterChange?: ((filteredOptions: SelectOption[]) => void) | undefined;
onClear?: (() => void) | undefined;
clearLabel?: string;
};
export const SelectInput = ({
selectableListComponentInstanceId,
selectableItemIdArray,
hotkeyScope,
onEnter,
onOptionSelected,
options,
onCancel,
defaultOption,
onFilterChange,
onClear,
clearLabel,
}: SelectInputProps) => {
return (
<SelectableList
selectableListInstanceId={selectableListComponentInstanceId}
selectableItemIdArray={selectableItemIdArray}
hotkeyScope={hotkeyScope}
onEnter={onEnter}
>
<SelectBaseInput
onOptionSelected={onOptionSelected}
options={options}
onCancel={onCancel}
defaultOption={defaultOption}
onFilterChange={onFilterChange}
onClear={onClear}
clearLabel={clearLabel}
hotkeyScope={hotkeyScope}
/>
</SelectableList>
);
};