import { Accessibility, MenuItemBehaviorProps } from '@fluentui/accessibility'; import { ShorthandConfig } from '@fluentui/react-bindings'; import * as PropTypes from 'prop-types'; import * as React from 'react'; import { UIComponentProps, ChildrenComponentProps, ContentComponentProps } from '../../utils'; import { MenuProps, MenuShorthandKinds } from './Menu'; import { MenuItemIconProps } from './MenuItemIcon'; import { MenuItemContentProps } from './MenuItemContent'; import { MenuItemIndicatorProps } from './MenuItemIndicator'; import { MenuItemWrapperProps } from './MenuItemWrapper'; import { ComponentEventHandler, ShorthandValue, ShorthandCollection } from '../../types'; import { PopperShorthandProps } from '../../utils/positioner'; export interface MenuItemSlotClassNames { submenu: string; } export interface MenuItemProps extends UIComponentProps, ChildrenComponentProps, ContentComponentProps> { /** * Accessibility behavior if overridden by the user. * @available menuItemAsToolbarButtonBehavior, tabBehavior */ accessibility?: Accessibility; /** A menu item can be active. */ active?: boolean; /** A menu item can show it is currently unable to be interacted with. */ disabled?: boolean; /** Name or shorthand for Menu Item Icon */ icon?: ShorthandValue; /** A menu may have just icons. */ iconOnly?: boolean; /** MenuItem index inside Menu. */ index?: number; /** MenuItem position inside Menu (skipping separators). */ itemPosition?: number; /** MenuItem count inside Menu. */ itemsCount?: number; /** * Called on click. * * @param event - React's original SyntheticEvent. * @param data - All props. */ onClick?: ComponentEventHandler; /** * Called after user's focus. * @param event - React's original SyntheticEvent. * @param data - All props. */ onFocus?: ComponentEventHandler; /** * Called after item blur. * @param event - React's original SyntheticEvent. * @param data - All props. */ onBlur?: ComponentEventHandler; /** A menu can adjust its appearance to de-emphasize its contents. */ pills?: boolean; /** * A menu can point to show its relationship to nearby content. * For vertical menu, it can point to the start of the item or to the end. */ pointing?: boolean | 'start' | 'end'; /** The menu item can have primary type. */ primary?: boolean; /** The menu item can have secondary type. */ secondary?: boolean; /** Menu items can by highlighted using underline. */ underlined?: boolean; /** A vertical menu displays elements vertically. */ vertical?: boolean; /** Shorthand for the wrapper component. */ wrapper?: ShorthandValue; /** Shorthand for the submenu. */ menu?: ShorthandValue | ShorthandCollection; /** Indicates if the menu inside the item is open. */ menuOpen?: boolean; /** Default menu open */ defaultMenuOpen?: boolean; /** Callback for setting the current menu item as active element in the menu. */ onActiveChanged?: ComponentEventHandler; /** Indicates whether the menu item is part of submenu. */ inSubmenu?: boolean; /** Shorthand for the submenu indicator. */ indicator?: ShorthandValue; /** * Event for request to change 'open' value. * @param event - React's original SyntheticEvent. * @param data - All props and proposed value. */ onMenuOpenChange?: ComponentEventHandler; } export declare type MenuItemStylesProps = Required> & { isFromKeyboard: boolean; }; export declare type MenuItemState = { isFromKeyboard: boolean; menuOpen: boolean; }; export declare const menuItemClassName = "ui-menu__item"; export declare const menuItemSlotClassNames: MenuItemSlotClassNames; /** * A MenuItem is an actionable item within a Menu. */ export declare const MenuItem: ( = "a">(props: Pick, Exclude, "content" | "vertical" | "icon" | "menu" | "active" | "disabled" | "children" | "as" | "className" | "onFocus" | "onBlur" | "onClick" | "design" | "styles" | "variables" | "accessibility" | "primary" | "secondary" | "index" | "indicator" | "iconOnly" | "inSubmenu" | "underlined" | "pills" | "pointing" | "itemPosition" | "itemsCount" | "wrapper" | "menuOpen" | "defaultMenuOpen" | "onActiveChanged" | "onMenuOpenChange">> & { as?: TExtendedElementType; } & MenuItemProps) => JSX.Element) & { propTypes?: React.WeakValidationMap & { as: React.Requireable any) | (new (props: any, context?: any) => any)>; }; contextTypes?: PropTypes.ValidationMap; defaultProps?: Partial; displayName?: string; readonly __PRIVATE_PROPS?: Pick, HTMLAnchorElement>, "hidden" | "color" | "style" | "title" | "key" | "children" | "aria-label" | "role" | "tabIndex" | "id" | "aria-autocomplete" | "aria-checked" | "aria-current" | "aria-disabled" | "aria-expanded" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-pressed" | "aria-readonly" | "aria-required" | "aria-selected" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "aria-activedescendant" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-describedby" | "aria-details" | "aria-errormessage" | "aria-flowto" | "aria-labelledby" | "aria-owns" | "aria-posinset" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "contextMenu" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "dir" | "draggable" | "lang" | "placeholder" | "slot" | "spellCheck" | "inputMode" | "is" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "aria-atomic" | "aria-busy" | "aria-dropeffect" | "aria-grabbed" | "aria-keyshortcuts" | "aria-placeholder" | "aria-relevant" | "aria-roledescription" | "aria-setsize" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "target" | "type" | "media" | "href" | "hrefLang" | "rel" | "download" | "ping" | "referrerPolicy"> & { ref?: React.Ref; }, "hidden" | "color" | "style" | "title" | "key" | "ref" | "aria-label" | "role" | "tabIndex" | "id" | "aria-autocomplete" | "aria-checked" | "aria-current" | "aria-disabled" | "aria-expanded" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-pressed" | "aria-readonly" | "aria-required" | "aria-selected" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "aria-activedescendant" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-describedby" | "aria-details" | "aria-errormessage" | "aria-flowto" | "aria-labelledby" | "aria-owns" | "aria-posinset" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "contextMenu" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "dir" | "draggable" | "lang" | "placeholder" | "slot" | "spellCheck" | "inputMode" | "is" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "aria-atomic" | "aria-busy" | "aria-dropeffect" | "aria-grabbed" | "aria-keyshortcuts" | "aria-placeholder" | "aria-relevant" | "aria-roledescription" | "aria-setsize" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "target" | "type" | "media" | "href" | "hrefLang" | "rel" | "download" | "ping" | "referrerPolicy"> & { as?: "a"; } & MenuItemProps; } & { shorthandConfig: ShorthandConfig; };