import React, { DOMAttributes, Key } from 'react'; import { AriaButtonProps } from 'react-aria'; import { AriaSelectOptions } from '@react-aria/select'; import { SelectState } from '@react-stately/select'; import type { CollectionChildren, Key as SharedKey } from '@react-types/shared'; import { LabelProps as ThemeUILabelProps } from 'theme-ui'; import { Axis, BoxProps, FocusableElement, LabelModeProps, ListBoxProps, PlacementAxis, ReactButtonRef, ReactRef, StyleProps } from '../../types'; import { CustomChangeEventType, FieldControlInputProps } from '../useField/useField'; export interface UseSelectFieldProps extends AriaSelectOptions { children?: CollectionChildren; align?: PlacementAxis; defaultSelectedKey?: string; defaultText?: string; direction?: Axis; disabledKeys?: Iterable; hasNoEmptySelection?: boolean; hasNoStatusIndicator?: boolean; helperText?: string; isDefaultOpen?: boolean; isDisabled?: boolean; isLoading?: boolean; isNotFlippable?: boolean; isOpen?: boolean; isReadOnly?: boolean; isRequired?: boolean; items?: Iterable; label?: string; listboxStyle?: React.CSSProperties; name?: string; placeholder?: string; selectedKey?: string; onKeyUp?: (e: React.KeyboardEvent) => void; onLoadMore?: () => unknown; onOpenChange?: (isOpen: boolean) => unknown; onSelectionChange?: (key: SharedKey | null) => void; controlProps?: ControlProps; scrollBoxProps?: BoxProps; listBoxProps?: ListBoxProps; labelProps?: ThemeUILabelProps; containerProps?: BoxProps; labelMode?: LabelModeProps; onChange?: (value: CustomChangeEventType | React.FormEvent | Key | null) => void | undefined; value?: string | number | undefined; } interface ControlProps extends React.HTMLAttributes { 'data-testid'?: string; defaultValue?: string | number | undefined; onChange?: (value: CustomChangeEventType | React.FormEvent | Key | null) => void | undefined; } export interface UseSelectFieldReturnProps { columnStyleProps: StyleProps; fieldContainerProps: BoxProps; fieldControlInputProps: FieldControlInputProps; fieldControlWrapperProps: BoxProps; fieldLabelProps: ThemeUILabelProps; isLoadingInitial?: boolean; listBoxRef: ReactRef; overlay: React.ReactNode; popoverRef: ReactRef; state: SelectState; triggerProps: AriaButtonProps<'button'>; triggerRef: ReactButtonRef; valueProps: DOMAttributes; } declare const useSelectField: (props: UseSelectFieldProps, ref: ReactRef) => UseSelectFieldReturnProps; export default useSelectField;