import type React from 'react'; import type { KeyboardDetail, MenuActionDetail, MenuChangeDetail, MenuEntry } from './types.js'; export interface MenuRef extends HTMLElement { /** Opens the menu dropdown. */ open(): void; /** Closes the menu dropdown. */ close(): void; } /** * Pass menu entries as the typed `entries` array property, not as children or JSON text. * Each entry's `id` field is emitted in `MenuActionDetail.id` on cx-action — switch on the ID, not the label. * * In React, reach the imperative methods through a ref: * `const api = useRef(null)`, pass `ref={api}`, then `api.current?.open()`. * Available: open(), close(). * * @csspart panel, trigger */ export interface MenuOwnProps { /** * Unique identifier for the element. * @example 'example-id' */ id?: string; /** * Accessible label for the trigger button. * @example 'example' */ triggerLabel?: string; /** * Menu or split-button entry definitions. Each entry has an `id` field — this is what `MenuActionDetail.id` returns in action events. * @example [{ id: 'edit', label: 'Edit', icon: 'pencil' }] */ entries?: MenuEntry[]; /** * Visual style variant. Allowed values: `filled`, `outline`, `ghost`. * @example 'filled' */ variant?: 'filled' | 'outline' | 'ghost'; /** * Corner radius style. Allowed values: `sharp`, `rounded`, `pill`. * @example 'sharp' */ shape?: 'sharp' | 'rounded' | 'pill'; /** * Menu panel width preset. Allowed values: `auto`, `sm`, `md`, `lg`. * @example 'auto' */ width?: 'auto' | 'sm' | 'md' | 'lg'; /** * Component size. Allowed values: `xs`, `sm`, `md`, `lg`, `xl`. * @example 'xs' */ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'; /** * Icon name to display. * @example 'example' */ icon?: string; /** * Disables the component, preventing interaction. * @defaultValue false * @example true */ disabled?: boolean; /** * Fires when the user activates an action item. Detail: `MenuActionDetail`. * @example (event) => console.log(event.detail.id) */ onAction?: (event: CustomEvent) => void; /** * Fires when the committed component value or state changes. Detail: `MenuChangeDetail`. * @example (event) => console.log(event.detail.checked) */ onChange?: (event: CustomEvent) => void; /** * Fires when a key is pressed inside the component. Detail: `KeyboardDetail`. * @example (event) => console.log(event.detail.key) */ onKeydown?: (event: CustomEvent) => void; /** * Fires when a key is released inside the component. Detail: `KeyboardDetail`. * @example (event) => console.log(event.detail.key) */ onKeyup?: (event: CustomEvent) => void; /** CSS class applied to the Custom Element host. * @example 'my-component' */ className?: string; /** Inline styles applied to the Custom Element host. * @example { marginTop: 8 } */ style?: React.CSSProperties; } /** * Props for ``: the component's own API plus every standard DOM * attribute and native React event handler, forwarded verbatim to the * `` host — `id`, `data-*`, `aria-*`, `title`, `tabIndex`, * `slot`, `onMouseEnter`, and the rest. Own props always win over a * same-named DOM attribute. */ export type MenuProps = MenuOwnProps & Omit, keyof MenuOwnProps | 'children' | 'dangerouslySetInnerHTML'>; export declare const Menu: React.ForwardRefExoticComponent, "children" | "dangerouslySetInnerHTML" | keyof MenuOwnProps> & React.RefAttributes>;