import { CommonProps, Refable, type Styleable } from "@trackunit/react-components"; import { MappedOmit } from "@trackunit/shared-utils"; import { FocusEvent, ReactElement, ReactNode } from "react"; import { GroupBase } from "react-select"; import { SelectProps } from "../BaseSelect/useSelect"; import { FormGroupProps } from "../FormGroup/FormGroup"; export type BaseOptionType = { label: string; value: string | number; }; type SelectExposedProps = MappedOmit>, "value" | "label" | "onChange" | "defaultValue" | "onBlur" | "options">; type FormGroupExposedProps = Pick; export interface SelectFieldProps extends CommonProps, FormGroupExposedProps, SelectExposedProps, Refable, Styleable { onBlur?: (event: FocusEvent) => void; /** * The options available for the SelectField. * * @important * @expand */ options: Array; /** * The selected value of the SelectField. * * @important */ value?: TOption["value"]; /** * The default selected value of the SelectField. */ defaultValue?: TOption["value"]; /** * The onChange handler for the SelectField. * * Called when the user picks a different option. It is not called when the `value` prop changes, * since that value is one the parent already holds, and not when the user re-picks the option that * is already selected. It is also forwarded to the hidden native `