import type { IconDefinition } from '@mezzanine-ui/icons'; export declare const dropdownPrefix = "mzn-dropdown"; /** * Dropdown 的非同步內容狀態。 * - `'loading'` — 資料載入中 * - `'empty'` — 無可用選項 */ export type DropdownStatus = 'loading' | 'empty'; /** * Dropdown 的選取模式。 * - `'single'` — 單選模式 * - `'multiple'` — 多選模式 */ export type DropdownMode = 'single' | 'multiple'; /** * Dropdown 的資料結構類型。 * - `'default'` — 扁平列表,選項無子層 * - `'tree'` — 樹狀結構,最多支援三層巢狀 * - `'grouped'` — 群組結構,選項可包含一層子項目 */ export type DropdownType = 'default' | 'tree' | 'grouped'; export type DropdownItemLevel = 0 | 1 | 2; /** * Dropdown 選項的驗證狀態樣式。 * - `'default'` — 預設樣式 * - `'danger'` — 危險/警示樣式 */ export type DropdownItemValidate = 'default' | 'danger'; /** * Dropdown 選項中勾選圖示的顯示位置。 * - `'prefix'` — 顯示於選項左側 * - `'suffix'` — 顯示於選項右側 * - `'none'` — 不顯示勾選圖示 */ export type DropdownCheckPosition = 'prefix' | 'suffix' | 'none'; /** * Dropdown 搜尋輸入框的位置。 * - `'inside'` — 輸入框顯示於下拉選單內部 * - `'outside'` — 輸入框顯示於下拉選單外部(觸發器本身) */ export type DropdownInputPosition = 'inside' | 'outside'; /** * Dropdown 載入指示器的顯示位置。 * - `'full'` — 覆蓋整個下拉選單區域 * - `'bottom'` — 僅顯示於列表底部(載入更多) */ export type DropdownLoadingPosition = 'full' | 'bottom'; /** * Base dropdown option interface */ export interface DropdownOption { /** * The name of the dropdown option. */ name: string; /** * The id of the dropdown option. */ id: string; /** * Whether to show the checkbox. * @default false */ showCheckbox?: boolean; /** * Whether to show the underline. * @default false */ showUnderline?: boolean; /** * The icon of the dropdown option. */ icon?: IconDefinition; /** * The validation type of the dropdown option. */ validate?: DropdownItemValidate; /** * The position of the checkbox. */ checkSite?: DropdownCheckPosition; /** * The children options for tree/grouped structure. * If provided, this option will be rendered as a group with expand/collapse functionality. * Maximum depth: 3 levels (enforced at runtime by truncateArrayDepth) */ children?: DropdownOption[]; /** * The shortcut keys of the dropdown option. */ shortcutKeys?: Array; /** * The shortcut text of the dropdown option. */ shortcutText?: string; } /** * Base option without children */ type DropdownOptionBase = Omit; /** * Flat dropdown option (no children) - for 'default' type */ export type DropdownOptionFlat = DropdownOptionBase; /** * Grouped dropdown option (one level of children) - for 'grouped' type * Children cannot have nested children. */ export interface DropdownOptionGrouped extends DropdownOptionBase { /** * Children options for grouped structure. * Children cannot have nested children. */ children: DropdownOptionFlat[]; } /** * Recursive type helper to limit tree depth to exactly N levels * Level 1: no children * Level 2: children with no nested children * Level 3: children with children that have no nested children */ type DropdownOptionTreeLevel1 = DropdownOptionBase; type DropdownOptionTreeLevel2 = DropdownOptionBase & { children?: DropdownOptionTreeLevel1[]; }; type DropdownOptionTreeLevel3 = DropdownOptionBase & { children?: DropdownOptionTreeLevel2[]; }; /** * Tree dropdown option (nested children up to 3 levels) - for 'tree' type * Maximum depth is enforced at compile time: 3 levels * - Level 1: root options (no children) * - Level 2: options with children (children have no nested children) * - Level 3: options with children that have children (grandchildren have no nested children) */ export type DropdownOptionTree = DropdownOptionTreeLevel3; /** * Type helper to get the appropriate options array type based on dropdown type. * This enforces structure constraints at compile time: * - 'default': flat array (no children allowed) * - 'grouped': array with one level of children (children cannot have children) * - 'tree': array with nested children up to 3 levels */ export type DropdownOptionsByType = T extends 'default' ? DropdownOptionFlat[] : T extends 'grouped' ? DropdownOptionGrouped[] : T extends 'tree' ? DropdownOptionTree[] : DropdownOption[]; export interface DropdownItemSharedProps { disabled?: boolean; mode?: DropdownMode; onSelect?: (option: DropdownOption) => void; type?: DropdownType; value?: string | string[]; } export declare const dropdownClasses: { root: string; inputPosition: (inputPosition: DropdownInputPosition) => string; popperWithPortal: string; list: string; listWrapper: string; listHeader: string; listHeaderInner: string; option: string; optionActive: string; groupLabel: string; status: string; statusText: string; loadingMore: string; action: string; actionTopBar: string; actionTools: string; card: string; cardContainer: string; cardActive: string; cardKeyboardActive: string; cardDisabled: string; cardDanger: string; cardUnderline: string; cardLevel: (level: DropdownItemLevel) => string; cardLeafLevel1: string; cardBody: string; cardTitle: string; cardDescription: string; cardHighlightedText: string; cardPrependContent: string; cardAppendContent: string; }; export {};