import { FloatingContext } from "@floating-ui/react"; import React from "react"; import { ChoiceFieldProps, Option } from "../choicefield"; import "./select.scss"; export type LoadOptionsFn = (inputValue: string) => Promise; /** * Select component, aims to be compatible with native change event and FormData * serialization. * @param children * @param options * @param props * @constructor */ export type SelectProps = Omit & { /** Options for the select. Can be a function for async loading. */ options: Option[] | LoadOptionsFn; /** Can be set to `fit-content` to apply auto sizing based on content width. */ inputSize?: "fit-content"; /** Component to use as icon. */ icon?: React.ReactNode; /** Disabled state */ disabled?: boolean; /** allow selecting more than one option */ multiple?: boolean; /** Whether to apply padding. */ pad?: boolean | "h" | "v"; /** Placeholder text. */ placeholder?: string; /** The size. */ size?: "xl" | "s" | "xs" | "xxs"; /** The variant (style) of the form element. */ variant?: "normal" | "primary" | "secondary" | "accent" | "transparent"; /** Value of the form element */ value?: Option["value"] | Option | Array | null; /** If true, fetch on mount rather than on open */ fetchOnMount?: boolean; /** Minimum characters before async search triggers. */ minSearchChars?: number; /** Debounce for search (ms). */ searchDebounceMs?: number; /** i18n labels */ ariaClearSearch?: string; ariaLoading?: string; ariaRemoveValue?: string; labelClear?: string; labelNoOptions?: string; placeholderSearch?: string; }; /** * Select component, aims to be compatible with native change event and FormData * serialization. * @param options * @param className * @param disabled * @param form * @param hidden * @param icon * @param id * @param inputSize * @param label * @param multiple * @param name * @param pad * @param placeholder * @param required * @param size * @param variant * @param value * @param fetchOnMount * @param minSearchChars * @param searchDebounceMs * @param ariaClearSearch * @param ariaLoading * @param ariaRemoveValue * @param labelClear * @param labelNoOptions * @param placeholderSearch * @param onBlur * @param onChange * @param props * @constructor */ export declare const Select: React.FC; export type SelectDropdownProps = React.PropsWithChildren<{ activeIndex: number | null; context: FloatingContext; floatingStyles: React.CSSProperties; getIndex: (v: string) => number | undefined; isAsync: boolean; open: boolean; options: Option[]; portalRoot: HTMLElement; search: string; selectedValues: string[]; setActiveIndex: (index: number | null) => void; setSearch: (s: string) => void; ariaClearSearch: string; ariaLoading: string; labelNoOptions: string; placeholderSearch: string; handleChange: (event: React.UIEvent, index: number) => void; forwardedRef?: React.ForwardedRef; isLoading?: boolean; }>; export type OptionProps = React.HTMLAttributes & { active?: boolean; forwardedRef?: React.ForwardedRef; selected?: boolean; }; /** * Select option component * Wraps `BaseSelectOption` with `React.forwardRef`. * @private */ export declare const SelectOption: React.ForwardRefExoticComponent & { active?: boolean; forwardedRef?: React.ForwardedRef; selected?: boolean; } & React.RefAttributes>;