UNPKG

goobs-frontend

Version:

A comprehensive React-based libary for building modern web applications

50 lines 2.04 kB
import { default as React } from 'react'; import { FieldStyleOverrides } from '../../Shell'; export interface DropdownOption { value: string | number; icon?: React.ReactNode; _id?: string; } export interface DropdownProps { label: string; options: DropdownOption[]; defaultValue?: string | number; /** * Canonical primitive-value onChange. Receives the resolved * selection value — `option._id` when present, otherwise * `option.value` — as a string. This collapses the previous * synthetic `ChangeEvent<HTMLSelectElement>` into the value-only * shape used by every other Field. Consumers that previously * destructured `e.target.value` simply use `value` directly. */ onChange?: (value: string) => void; onBlur?: React.FocusEventHandler<HTMLButtonElement>; onFocus?: React.FocusEventHandler<HTMLButtonElement>; value?: string | number; showIdColumns?: boolean; helperText?: string; /** Error message rendered below the trigger; sets aria-invalid. */ error?: string | boolean; /** Stable test selector — emitted as `data-field` on the wrapper. */ dataField?: string; /** Stable test selector — emitted as `data-field-name` on the wrapper. */ dataFieldName?: string; /** * Entity field key. Emitted as `data-field-name` (unless `dataFieldName` * is set explicitly) so a single `name="<entityFieldKey>"` gives the stable * test anchor the recommender targets via `[data-field-name="<key>"]`. */ name?: string; styles?: FieldStyleOverrides & { fullWidth?: boolean; }; } /** * Accessible single-select dropdown built on FieldShell, with a combobox * trigger, an absolutely-positioned listbox menu, and full keyboard navigation. * Auto-binds its value by `name` inside a goobs `<Form>` and emits the stable * `[role=combobox]`/`[role=option]` structure tests target. */ declare const Dropdown: React.FC<DropdownProps>; export default Dropdown; //# sourceMappingURL=index.d.ts.map