import type { SelectRootProps, SelectRootEmits, SelectContentProps, SelectContentEmits, SelectArrowProps } from 'reka-ui'; import type { AppConfig } from '@nuxt/schema'; import theme from '#build/ui/select'; import type { UseComponentIconsProps } from '../composables/useComponentIcons'; import type { AvatarProps, ChipProps } from '../types'; import type { AcceptableValue, ArrayOrNested, GetItemKeys, GetModelValue, GetModelValueEmits, NestedItem, EmitsToProps, ComponentConfig } from '../types/utils'; type Select = ComponentConfig; interface SelectItemBase { label?: string; /** * @IconifyIcon */ icon?: string; avatar?: AvatarProps; chip?: ChipProps; /** * The item type. * @defaultValue 'item' */ type?: 'label' | 'separator' | 'item'; value?: AcceptableValue | boolean; disabled?: boolean; onSelect?(e?: Event): void; class?: any; ui?: Pick; [key: string]: any; } export type SelectItem = SelectItemBase | AcceptableValue | boolean; export interface SelectProps = ArrayOrNested, VK extends GetItemKeys = 'value', M extends boolean = false> extends Omit, 'dir' | 'multiple' | 'modelValue' | 'defaultValue' | 'by'>, UseComponentIconsProps { id?: string; /** The placeholder text when the select is empty. */ placeholder?: string; /** * @defaultValue 'primary' */ color?: Select['variants']['color']; /** * @defaultValue 'outline' */ variant?: Select['variants']['variant']; /** * @defaultValue 'md' */ size?: Select['variants']['size']; /** * The icon displayed to open the menu. * @defaultValue appConfig.ui.icons.chevronDown * @IconifyIcon */ trailingIcon?: string; /** * The icon displayed when an item is selected. * @defaultValue appConfig.ui.icons.check * @IconifyIcon */ selectedIcon?: string; /** * The content of the menu. * @defaultValue { side: 'bottom', sideOffset: 8, collisionPadding: 8, position: 'popper' } */ content?: Omit & Partial>; /** * Display an arrow alongside the menu. * @defaultValue false */ arrow?: boolean | Omit; /** * Render the menu in a portal. * @defaultValue true */ portal?: boolean | string | HTMLElement; /** * When `items` is an array of objects, select the field to use as the value. * @defaultValue 'value' */ valueKey?: VK; /** * When `items` is an array of objects, select the field to use as the label. * @defaultValue 'label' */ labelKey?: keyof NestedItem; items?: T; /** The value of the Select when initially rendered. Use when you do not need to control the state of the Select. */ defaultValue?: GetModelValue; /** The controlled value of the Select. Can be bind as `v-model`. */ modelValue?: GetModelValue; /** Whether multiple options can be selected or not. */ multiple?: M & boolean; /** Highlight the ring color like a focus state. */ highlight?: boolean; class?: any; ui?: Select['slots']; } export type SelectEmits, VK extends GetItemKeys | undefined, M extends boolean> = Omit & { change: [payload: Event]; blur: [payload: FocusEvent]; focus: [payload: FocusEvent]; } & GetModelValueEmits; type SlotProps = (props: { item: T; index: number; }) => any; export interface SelectSlots = ArrayOrNested, VK extends GetItemKeys | undefined = undefined, M extends boolean = false, T extends NestedItem = NestedItem> { 'leading'(props: { modelValue?: GetModelValue; open: boolean; ui: { [K in keyof Required]: (props?: Record) => string; }; }): any; 'default'(props: { modelValue?: GetModelValue; open: boolean; }): any; 'trailing'(props: { modelValue?: GetModelValue; open: boolean; ui: { [K in keyof Required]: (props?: Record) => string; }; }): any; 'item': SlotProps; 'item-leading': SlotProps; 'item-label': SlotProps; 'item-trailing': SlotProps; 'content-top': (props?: {}) => any; 'content-bottom': (props?: {}) => any; } declare const _default: , VK extends GetItemKeys = "value", M extends boolean = false>(__VLS_props: NonNullable>["props"], __VLS_ctx?: __VLS_PrettifyLocal>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable>["expose"], __VLS_setup?: Promise<{ props: __VLS_PrettifyLocal & Omit<{ readonly onBlur?: ((payload: FocusEvent) => any) | undefined; readonly onChange?: ((payload: Event) => any) | undefined; readonly onFocus?: ((payload: FocusEvent) => any) | undefined; readonly "onUpdate:open"?: ((value: boolean) => any) | undefined; readonly "onUpdate:modelValue"?: ((payload: GetModelValue) => any) | undefined; } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onFocus" | "onBlur" | "onChange" | "onUpdate:open" | "onUpdate:modelValue"> & SelectProps & Partial<{}>> & import("vue").PublicProps; expose(exposed: import("vue").ShallowUnwrapRef<{}>): void; attrs: any; slots: SelectSlots>; emit: ((evt: "blur", payload: FocusEvent) => void) & ((evt: "change", payload: Event) => void) & ((evt: "focus", payload: FocusEvent) => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "update:modelValue", payload: GetModelValue) => void); }>) => import("vue").VNode & { __ctx?: Awaited; }; export default _default; type __VLS_PrettifyLocal = { [K in keyof T]: T[K]; } & {};