/** * Type definitions for the Menu component. * * All interfaces use the IPrefix convention. Type aliases do not. * This module re-exports relevant types from base-ui and motion * combined with the v0.2.0 SlotOverrides/IBaseConfig pattern. * * @module @mks2508/mks-ui/react/ui/Menu/Menu.types */ import type * as React from 'react'; import type { Menu as MenuPrimitive } from '@base-ui/react/menu'; import type { HTMLMotionProps, Transition } from 'motion/react'; import type { IBaseConfig, SlotOverrides } from '../../../core/types'; import type { IHighlightProps, IHighlightItemProps } from '../../../react-ui/primitives/Highlight'; import type { MenuSlot } from './Menu.styles'; /** * Configuration interface for Menu behavior and animation. * * @example * ```tsx * const config: IMenuConfig = { * animation: { duration: 0.2, easing: 'ease-out' }, * }; * ``` */ export interface IMenuConfig extends IBaseConfig { /** Default motion transition for the popup entrance/exit. */ popupTransition?: Transition; } /** * Internal context carrying the highlighted (focused) item value. * * @example * ```typescript * const ctx: MenuActiveValueContextType = { * highlightedValue: 'edit', * setHighlightedValue: (v) => {}, * }; * ``` */ export type MenuActiveValueContextType = { /** Currently highlighted item value, or null if none. */ highlightedValue: string | null; /** Setter for the highlighted item value. */ setHighlightedValue: (value: string | null) => void; }; /** * Internal context for Menu open/close state. * * @example * ```typescript * const ctx: MenuContextType = { isOpen: true, setIsOpen: (v) => {} }; * ``` */ export type MenuContextType = { /** Whether the menu is open. */ isOpen: boolean | undefined; /** Setter for open state, matching base-ui's onOpenChange signature. */ setIsOpen: IMenuProps['onOpenChange']; }; /** * Props for the root Menu component. * Extends base-ui Menu.Root props with slot overrides and config. * * @example * ```tsx * * ... * * ``` */ export interface IMenuProps extends React.ComponentProps { /** Partial class overrides per slot. */ slots?: SlotOverrides; /** Menu behavior / animation configuration. */ config?: IMenuConfig; } /** * Props for MenuTrigger -- the element that opens the menu. * * @example * ```tsx * Open * ``` */ export interface IMenuTriggerProps extends React.ComponentProps { /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Props for MenuPortal. Wraps AnimatePresence for enter/exit transitions. * The `keepMounted` prop is managed internally. * * @example * ```tsx * * ... * * ``` */ export interface IMenuPortalProps extends Omit, 'keepMounted'> { } /** * Props for MenuGroup -- groups related items with a label. * * @example * ```tsx * * Actions * Edit * * ``` */ export interface IMenuGroupProps extends React.ComponentProps { /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Props for MenuGroupLabel -- the label rendered above a group. * * @example * ```tsx * Section * ``` */ export interface IMenuGroupLabelProps extends React.ComponentProps { /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Props for MenuSubmenu -- a nested menu with its own open state. * * @example * ```tsx * * More... * ... * * ``` */ export interface IMenuSubmenuProps extends React.ComponentProps { } /** * Props for MenuSubmenuTrigger -- the item that opens a submenu. * Combines base-ui's SubmenuTrigger props with motion HTML props. * * @example * ```tsx * More... * ``` */ export interface IMenuSubmenuTriggerProps extends Omit, 'render'>, keyof HTMLMotionProps<'div'>>, HTMLMotionProps<'div'> { /** Whether the trigger is disabled. */ disabled?: boolean; /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Props for MenuHighlight -- animated background that follows the focused item. * Wraps the Highlight primitive with menu-specific defaults. * * @example * ```tsx * * ``` */ export interface IMenuHighlightProps extends Omit { /** Whether to animate on hover. */ animateOnHover?: boolean; /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Props for MenuHighlightItem -- wraps a menu item for highlight tracking. * * @example * ```tsx * * Edit * * ``` */ export interface IMenuHighlightItemProps extends IHighlightItemProps { /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Props for MenuPositioner -- positions the popup relative to the trigger. * * @example * ```tsx * * ... * * ``` */ export interface IMenuPositionerProps extends React.ComponentProps { } /** * Props for MenuPopup -- the visible flyout container. * Combines base-ui Popup with motion HTML props for animated entrance. * * @example * ```tsx * * Edit * * ``` */ export interface IMenuPopupProps extends Omit, 'render'>, keyof HTMLMotionProps<'div'>>, HTMLMotionProps<'div'> { /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Props for MenuItem -- a single actionable row in the menu. * Combines base-ui Item with motion HTML props. * * @example * ```tsx * * Edit * * ``` */ export interface IMenuItemProps extends Omit, 'render'>, keyof HTMLMotionProps<'div'>>, HTMLMotionProps<'div'> { /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Props for MenuCheckboxItem -- a toggleable checkbox menu item. * * @example * ```tsx * * Show Grid * * ``` */ export interface IMenuCheckboxItemProps extends Omit, 'render'> { /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Props for MenuCheckboxItemIndicator -- the check/indeterminate indicator. * Combines base-ui CheckboxItemIndicator with motion HTML props. * * @example * ```tsx * * * * ``` */ export interface IMenuCheckboxItemIndicatorProps extends Omit, 'render'>, keyof HTMLMotionProps<'div'>>, HTMLMotionProps<'div'> { } /** * Props for MenuRadioGroup -- groups radio items for single-selection. * * @example * ```tsx * * Name * Date * * ``` */ export interface IMenuRadioGroupProps extends React.ComponentProps { } /** * Props for MenuRadioItem -- a single option within a radio group. * * @example * ```tsx * Sort by Name * ``` */ export interface IMenuRadioItemProps extends Omit, 'render'> { /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Props for MenuRadioItemIndicator -- the selection indicator dot/icon. * Combines base-ui RadioItemIndicator with motion HTML props. * * @example * ```tsx * * * * ``` */ export interface IMenuRadioItemIndicatorProps extends Omit, 'render'>, keyof HTMLMotionProps<'div'>>, HTMLMotionProps<'div'> { } /** * Props for MenuShortcut -- displays a keyboard shortcut hint. * * @example * ```tsx * Ctrl+C * ``` */ export interface IMenuShortcutProps extends React.ComponentProps<'span'> { /** Partial class overrides per slot. */ slots?: SlotOverrides; } /** * Props for MenuArrow -- the directional arrow/caret of the popup. * * @example * ```tsx * * ``` */ export interface IMenuArrowProps extends React.ComponentProps { } /** * Props for MenuSeparator -- a horizontal divider between items. * * @example * ```tsx * * ``` */ export interface IMenuSeparatorProps extends React.ComponentProps { /** Partial class overrides per slot. */ slots?: SlotOverrides; } //# sourceMappingURL=Menu.types.d.ts.map