Files
twenty/packages/twenty-front/src/modules/ui/field/input/components/SelectInput.tsx
T
ANIMESH DUTTA 9c8e0f628e Redirect to select option creation when no result (#14460)
fix:Ability to add a new option for a multi-select on the fly 
Issues:#13877

---------

Co-authored-by: ehconitin <nitinkoche03@gmail.com>
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
2025-10-07 14:39:48 +00:00

53 lines
1.5 KiB
TypeScript

import { SelectInput as SelectBaseInput } from '@/ui/input/components/SelectInput';
import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList';
import { type SelectOption } from 'twenty-ui/input';
type SelectInputProps = {
selectableListComponentInstanceId: string;
selectableItemIdArray: string[];
focusId: 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;
onAddSelectOption?: (optionName: string) => void;
};
export const SelectInput = ({
selectableListComponentInstanceId,
selectableItemIdArray,
focusId,
onOptionSelected,
options,
onCancel,
defaultOption,
onFilterChange,
onClear,
clearLabel,
onAddSelectOption,
}: SelectInputProps) => {
return (
<SelectableList
selectableListInstanceId={selectableListComponentInstanceId}
selectableItemIdArray={selectableItemIdArray}
focusId={focusId}
>
<SelectBaseInput
onOptionSelected={onOptionSelected}
options={options}
onCancel={onCancel}
defaultOption={defaultOption}
onFilterChange={onFilterChange}
onClear={onClear}
clearLabel={clearLabel}
focusId={focusId}
onAddSelectOption={onAddSelectOption}
/>
</SelectableList>
);
};