import { ReactNode } from 'react'; import { DropdownItemSharedProps, DropdownLoadingPosition, DropdownOptionsByType, DropdownStatus as DropdownStatusType, DropdownType } from '@mezzanine-ui/core/dropdown/dropdown'; import { type IconDefinition } from '@mezzanine-ui/icons'; import type { PartialOptions } from 'overlayscrollbars'; import { type DropdownActionProps } from './DropdownAction'; export interface DropdownItemProps extends Omit { /** * The action configuration for the dropdown. */ actionConfig?: DropdownActionProps; /** * The active option index for hover/focus state and Enter selection. */ activeIndex: number | null; /** * Keyboard-only active index. When provided, only this index applies the * focus ring (`--keyboard-active`) and active background via `DropdownItemCard`'s `active` prop. * Mouse hover should update `activeIndex` (for Enter selection) but NOT this value. * Falls back to `activeIndex` when not provided (backward-compatible). */ keyboardActiveIndex?: number | null; /** * Controlled set of expanded node IDs for tree type. * When provided, expansion state is managed externally. */ expandedNodes?: Set; /** * Callback to toggle the expansion of a tree node. * Required when `expandedNodes` is provided. */ onToggleExpand?: (id: string) => void; /** * The text to follow. */ followText?: string; /** * Custom content rendered before options (e.g. inline trigger). */ headerContent?: ReactNode; /** * The listbox id for aria usage. */ listboxId: string; /** * The aria-label for the listbox. * If not provided, a default label will be used when there are no options. */ listboxLabel?: string; /** * The max height of the dropdown list. */ maxHeight?: number | string; /** * Override the default `min-width` of the dropdown list. * Accepts a number (pixels) or any valid CSS length string. * Pass `0` to remove the minimum width constraint entirely. * @default spacing token `size-container-tiny` */ minWidth?: number | string; /** * Whether to set the same width as its anchor element. * @default false */ sameWidth?: boolean; /** * Callback when hovering option index changes. */ onHover?: (index: number) => void; /** * Options to render. * The structure is constrained based on the `type` prop: * - '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 (strictly enforced at compile time) */ options: DropdownOptionsByType; /** * The type of the dropdown. * This prop determines the structure of the `options` array: * - '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 */ type?: DropdownType; /** * Whether clicking an option row should toggle checked state in multiple mode. * If not provided, tree parent nodes with checkboxes default to `false`, * while other options default to `true`. */ toggleCheckedOnClick?: boolean; /** * The status of the dropdown (loading or empty). */ status?: DropdownStatusType; /** * The text of the dropdown loading status. */ loadingText?: string; /** * The text of the dropdown empty status. */ emptyText?: string; /** * The icon of the dropdown empty status. */ emptyIcon?: IconDefinition; /** * The position to display the loading status. * Only takes effect when `status === 'loading'`. * @default 'full' */ loadingPosition?: DropdownLoadingPosition; /** * Callback fired when the dropdown list reaches the bottom. * Only fires when `maxHeight` is set and the list is scrollable. */ onReachBottom?: () => void; /** * Callback fired when the dropdown list leaves the bottom. * Only fires when `maxHeight` is set and the list is scrollable. */ onLeaveBottom?: () => void; /** * Callback fired when the dropdown list is scrolled. * Receives the scroll event and computed scroll information. */ onScroll?: (computed: { scrollTop: number; maxScrollTop: number; }, target: HTMLDivElement) => void; /** * Whether to defer the initialization of OverlayScrollbars. * This can improve initial render performance. * @default true */ scrollbarDefer?: boolean | object; /** * Whether to disable the custom scrollbar component. * When false (default), Scrollbar component will be used when maxHeight is set. * When true, falls back to native div scrolling (backward compatible). * @default false */ scrollbarDisabled?: boolean; /** * The maximum width of the scrollable container. * Can be a CSS value string (e.g., '500px', '100%') or a number (treated as pixels). */ scrollbarMaxWidth?: number | string; /** * Additional options to pass to OverlayScrollbars. * @see https://kingsora.github.io/OverlayScrollbars/#!documentation/options */ scrollbarOptions?: PartialOptions; } export default function DropdownItem(props: DropdownItemProps): import("react/jsx-runtime").JSX.Element;