import * as React from 'react'; import { DefaultComponentProps, OverrideProps, Simplify } from 'mui-ultra/types'; import { SelectOption, UseSelectButtonSlotProps, UseSelectListboxSlotProps } from './useSelect.types'; import PopperUnstyled, { PopperUnstyledProps } from '../PopperUnstyled'; import { SlotComponentProps } from '../utils'; export interface SelectUnstyledComponentsPropsOverrides { } export interface SelectUnstyledCommonProps { /** * If `true`, the select element is focused during the first mount * @default false */ autoFocus?: boolean; children?: React.ReactNode; className?: string; /** * If `true`, the select is disabled. * @default false */ disabled?: boolean; /** * If `true`, the select will be initially open. * @default false */ defaultListboxOpen?: boolean; /** * `id` attribute of the listbox element. * Also used to derive the `id` attributes of options. */ listboxId?: string; /** * Controls the open state of the select's listbox. * @default undefined */ listboxOpen?: boolean; /** * Name of the element. For example used by the server to identify the fields in form submits. * If the name is provided, the component will render a hidden input element that can be submitted to a server. */ name?: string; /** * Callback fired when the component requests to be opened. * Use in controlled mode (see listboxOpen). */ onListboxOpenChange?: (isOpen: boolean) => void; } export interface SelectUnstyledOwnProps extends SelectUnstyledCommonProps { /** * The components used for each slot inside the Select. * Either a string to use a HTML element or a component. * @default {} */ components?: { Root?: React.ElementType; Listbox?: React.ElementType; Popper?: React.ComponentType>; }; /** * The props used for each slot inside the Input. * @default {} */ componentsProps?: { root?: SlotComponentProps<'button', SelectUnstyledComponentsPropsOverrides, SelectUnstyledOwnerState>; listbox?: SlotComponentProps<'button', SelectUnstyledComponentsPropsOverrides, SelectUnstyledOwnerState>; popper?: SlotComponentProps>; }; /** * The default selected value. Use when the component is not controlled. */ defaultValue?: TValue | null; /** * A function to convert the currently selected value to a string. * Used to set a value of a hidden input associated with the select, * so that the selected value can be posted with a form. */ getSerializedValue?: (option: SelectOption | null) => React.InputHTMLAttributes['value']; /** * Callback fired when an option is selected. */ onChange?: (e: React.MouseEvent | React.KeyboardEvent | React.FocusEvent | null, value: TValue | null) => void; /** * A function used to convert the option label to a string. * It's useful when labels are elements and need to be converted to plain text * to enable navigation using character keys on a keyboard. * * @default defaultOptionStringifier */ optionStringifier?: (option: SelectOption) => string; /** * Function that customizes the rendering of the selected value. */ renderValue?: (option: SelectOption | null) => React.ReactNode; /** * The selected value. * Set to `null` to deselect all options. */ value?: TValue | null; } export interface SelectUnstyledTypeMap { props: P & SelectUnstyledOwnProps; defaultComponent: D; } export declare type SelectUnstyledProps['defaultComponent']> = OverrideProps, D> & { component?: D; }; export interface SelectUnstyledType { (props: { /** * The component used for the root node. * Either a string to use a HTML element or a component. */ component: C; } & OverrideProps, C>): JSX.Element | null; (props: DefaultComponentProps>): JSX.Element | null; propTypes?: any; } export interface SelectUnstyledOwnerState extends SelectUnstyledOwnProps { active: boolean; disabled: boolean; focusVisible: boolean; open: boolean; } export declare type SelectUnstyledRootSlotProps = Simplify; }>; export declare type SelectUnstyledListboxSlotProps = Simplify; }>; export declare type SelectUnstyledPopperSlotProps = { anchorEl: PopperUnstyledProps['anchorEl']; children?: PopperUnstyledProps['children']; className?: string; disablePortal: PopperUnstyledProps['disablePortal']; open: boolean; ownerState: SelectUnstyledOwnerState; placement: PopperUnstyledProps['placement']; };