diff --git a/inertia/components/common/form/selector.tsx b/inertia/components/common/form/selector.tsx new file mode 100644 index 0000000..49c9f80 --- /dev/null +++ b/inertia/components/common/form/selector.tsx @@ -0,0 +1,79 @@ +import { useTheme } from '@emotion/react'; +import { InputHTMLAttributes, ReactNode, useEffect, useState } from 'react'; +import Select, { + FormatOptionLabelMeta, + GroupBase, + OptionsOrGroups, +} from 'react-select'; +import FormField from '~/components/common/form/_form_field'; + +type Option = { label: string | number; value: string | number }; + +interface SelectorProps + extends Omit, 'onChange'> { + label: string; + name: string; + errors?: string[]; + options: OptionsOrGroups>; + value: number | string; + onChangeCallback?: (value: number | string) => void; + formatOptionLabel?: ( + data: Option, + formatOptionLabelMeta: FormatOptionLabelMeta