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AAI;QAC7C,gBAAc,OAAO,SAAS,IAAI;QAClC,iBAAe,OAAO,UAAU,IAAI;QACpC,uBACE,iBAAiB,aAAa,KAAK,SAAS,YAAY,iBAAiB,aAAa;QAExF,oBAAkB,CAAC,CAAC,KAAK,CAAC,gBAAgB,IAAI;QAC9C,aAAW,KAAK,CAAC,gBAAgB,KAAK,UAAU;qBAChD,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBACE,CAAA,GAAA,qCAAU;gBACV;oBACE,OAAO;wBACL,CAAC,CAAA,GAAA,sCAAW,EAAE,EAAE;wBAChB,OAAO;wBACP,aAAa;oBACf;gBACF;aACD;YACD;gBAAC,CAAA,GAAA,yCAAc;gBAAG;aAAsB;YACxC;gBAAC,CAAA,GAAA,mDAAwB;gBAAG;oBAAC,YAAY,OAAO,UAAU;gBAAA;aAAE;SAC7D;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Menu.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n  AriaMenuProps,\n  useMenu,\n  useMenuItem,\n  useMenuSection,\n  useMenuTrigger,\n  useSubmenuTrigger\n} from 'react-aria/useMenu';\nimport {\n  BaseCollection,\n  CollectionNode,\n  ItemNode,\n  SectionNode\n} from 'react-aria/private/collections/BaseCollection';\nimport {\n  MenuTriggerProps as BaseMenuTriggerProps,\n  RootMenuTriggerState,\n  useMenuTriggerState,\n  useSubmenuTriggerState\n} from 'react-stately/useMenuTriggerState';\nimport {\n  ClassNameOrFunction,\n  ContextValue,\n  DEFAULT_SLOT,\n  dom,\n  DOMRenderProps,\n  PossibleLinkDOMRenderProps,\n  Provider,\n  RenderProps,\n  SlotProps,\n  StyleRenderProps,\n  useContextProps,\n  useRenderProps,\n  useSlot,\n  useSlottedContext\n} from './utils';\nimport {Collection} from 'react-aria/Collection';\nimport {\n  CollectionBuilder,\n  createBranchComponent,\n  createLeafComponent\n} from 'react-aria/CollectionBuilder';\nimport {\n  CollectionProps,\n  CollectionRendererContext,\n  ItemRenderProps,\n  SectionContext,\n  SectionProps,\n  usePersistedKeys\n} from './Collection';\nimport {\n  FieldInputContext,\n  SelectableCollectionContext,\n  SelectableCollectionContextValue\n} from './Autocomplete';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {\n  FocusEvents,\n  FocusStrategy,\n  forwardRefType,\n  GlobalDOMAttributes,\n  HoverEvents,\n  Key,\n  LinkDOMProps,\n  MultipleSelection,\n  PressEvents\n} from '@react-types/shared';\nimport {FocusScope} from 'react-aria/FocusScope';\nimport {HeaderContext} from './Header';\nimport {KeyboardContext} from './Keyboard';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {MultipleSelectionState} from 'react-stately/useMultipleSelectionState';\nimport {Node} from '@react-types/shared';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PopoverContext} from './Popover';\nimport {PressResponder} from 'react-aria/private/interactions/PressResponder';\nimport React, {\n  createContext,\n  ForwardedRef,\n  forwardRef,\n  JSX,\n  ReactElement,\n  ReactNode,\n  RefObject,\n  useContext,\n  useMemo,\n  useRef\n} from 'react';\nimport {SelectionIndicatorContext} from './SelectionIndicator';\nimport {SelectionManager} from 'react-stately/private/selection/SelectionManager';\nimport {SeparatorContext} from './Separator';\nimport {SharedElementTransition} from './SharedElementTransition';\nimport {TextContext} from './Text';\nimport {TreeState, useTreeState} from 'react-stately/useTreeState';\nimport {useHover} from 'react-aria/useHover';\nimport {useIsHidden} from 'react-aria/private/collections/Hidden';\nimport {useMultipleSelectionState} from 'react-stately/useMultipleSelectionState';\nimport {useObjectRef} from 'react-aria/useObjectRef';\n\nexport const MenuContext = createContext<ContextValue<MenuProps<any>, HTMLDivElement>>(null);\nexport const MenuStateContext = createContext<TreeState<any> | null>(null);\nexport const RootMenuTriggerStateContext = createContext<RootMenuTriggerState | null>(null);\nconst SelectionManagerContext = createContext<SelectionManager | null>(null);\n\nexport interface MenuTriggerProps extends BaseMenuTriggerProps {\n  children: ReactNode;\n}\n\nexport function MenuTrigger(props: MenuTriggerProps): JSX.Element | null {\n  let state = useMenuTriggerState(props);\n  let ref = useRef<HTMLButtonElement>(null);\n  let {menuTriggerProps, menuProps} = useMenuTrigger(\n    {\n      ...props,\n      type: 'menu'\n    },\n    state,\n    ref\n  );\n  let scrollRef = useRef(null);\n\n  // If within a collection (e.g. Tabs), render nothing.\n  // Not using createHideableComponent for this because that also creates a forwardRef.\n  let isHidden = useIsHidden();\n  if (isHidden) {\n    return null;\n  }\n\n  return (\n    <Provider\n      values={[\n        [MenuContext, {...menuProps, ref: scrollRef}],\n        [OverlayTriggerStateContext, state],\n        [RootMenuTriggerStateContext, state],\n        [\n          PopoverContext,\n          {\n            trigger: 'MenuTrigger',\n            triggerRef: ref,\n            scrollRef,\n            placement: 'bottom start',\n            'aria-labelledby': menuProps['aria-labelledby']\n          }\n        ]\n      ]}>\n      <PressResponder {...menuTriggerProps} ref={ref} isPressed={state.isOpen}>\n        {props.children}\n      </PressResponder>\n    </Provider>\n  );\n}\n\nexport interface SubmenuTriggerProps {\n  /**\n   * The contents of the SubmenuTrigger. The first child should be an Item (the trigger) and the\n   * second child should be the Popover (for the submenu).\n   */\n  children: ReactElement[];\n  /**\n   * The delay time in milliseconds for the submenu to appear after hovering over the trigger.\n   *\n   * @default 200\n   */\n  delay?: number;\n}\n\nconst SubmenuTriggerContext = createContext<{\n  parentMenuRef: RefObject<HTMLElement | null>;\n  shouldUseVirtualFocus?: boolean;\n} | null>(null);\n\nclass SubmenuTriggerNode<T> extends CollectionNode<T> {\n  static readonly type = 'submenutrigger';\n\n  filter(\n    collection: BaseCollection<T>,\n    newCollection: BaseCollection<T>,\n    filterFn: (textValue: string, node: Node<T>) => boolean\n  ): CollectionNode<T> | null {\n    let triggerNode = collection.getItem(this.firstChildKey!);\n    if (triggerNode && filterFn(triggerNode.textValue, this)) {\n      let clone = this.clone();\n      newCollection.addDescendants(clone, collection);\n      return clone;\n    }\n\n    return null;\n  }\n}\n\n/**\n * A submenu trigger is used to wrap a submenu's trigger item and the submenu itself.\n *\n * @version alpha\n */\nexport const SubmenuTrigger = /*#__PURE__*/ createBranchComponent(\n  SubmenuTriggerNode,\n  (props: SubmenuTriggerProps, ref: ForwardedRef<HTMLDivElement>, item) => {\n    let {CollectionBranch} = useContext(CollectionRendererContext);\n    let state = useContext(MenuStateContext)!;\n    let rootMenuTriggerState = useContext(RootMenuTriggerStateContext)!;\n    let submenuTriggerState = useSubmenuTriggerState({triggerKey: item.key}, rootMenuTriggerState);\n    let submenuRef = useRef<HTMLDivElement>(null);\n    let itemRef = useObjectRef(ref);\n    let {parentMenuRef, shouldUseVirtualFocus} = useContext(SubmenuTriggerContext)!;\n    let {submenuTriggerProps, submenuProps, popoverProps} = useSubmenuTrigger(\n      {\n        parentMenuRef,\n        submenuRef,\n        delay: props.delay,\n        shouldUseVirtualFocus\n      },\n      submenuTriggerState,\n      itemRef\n    );\n\n    return (\n      <Provider\n        values={[\n          [MenuItemContext, {...submenuTriggerProps, onAction: undefined, ref: itemRef}],\n          [\n            MenuContext,\n            {\n              ref: submenuRef,\n              ...submenuProps\n            }\n          ],\n          [OverlayTriggerStateContext, submenuTriggerState],\n          [\n            PopoverContext,\n            {\n              trigger: 'SubmenuTrigger',\n              triggerRef: itemRef,\n              placement: 'end top',\n              'aria-labelledby': submenuProps['aria-labelledby'],\n              ...popoverProps\n            }\n          ]\n        ]}>\n        <CollectionBranch collection={state.collection} parent={item} />\n        {props.children[1]}\n      </Provider>\n    );\n  },\n  props => props.children[0]\n);\n\nexport interface MenuRenderProps {\n  /**\n   * Whether the menu has no items and should display its empty state.\n   *\n   * @selector [data-empty]\n   */\n  isEmpty: boolean;\n}\n\nexport interface MenuProps<T>\n  extends\n    Omit<AriaMenuProps<T>, 'children'>,\n    CollectionProps<T>,\n    StyleRenderProps<MenuRenderProps>,\n    SlotProps,\n    GlobalDOMAttributes<HTMLDivElement> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n   * element. A function may be provided to compute the class based on component state.\n   *\n   * @default 'react-aria-Menu'\n   */\n  className?: ClassNameOrFunction<MenuRenderProps>;\n  /** Provides content to display when there are no items in the list. */\n  renderEmptyState?: () => ReactNode;\n  /** Whether the menu should close when the menu item is selected. */\n  shouldCloseOnSelect?: boolean;\n}\n\n/**\n * A menu displays a list of actions or options that a user can choose.\n */\nexport const Menu = /*#__PURE__*/ (forwardRef as forwardRefType)(function Menu<T>(\n  props: MenuProps<T>,\n  ref: ForwardedRef<HTMLDivElement>\n) {\n  [props, ref] = useContextProps(props, ref, MenuContext);\n\n  // Delay rendering the actual menu until we have the collection so that auto focus works properly.\n  return (\n    <CollectionBuilder content={<Collection {...props} />}>\n      {collection => <MenuInner props={props} collection={collection} menuRef={ref} />}\n    </CollectionBuilder>\n  );\n});\n\ninterface MenuInnerProps<T> {\n  // For now we append filter and other autocomplete context props here for typescript, but eventually we can consider exposing these\n  // as top level props for users to use with standalone Menus\n  props: MenuProps<T> & {\n    filter?: SelectableCollectionContextValue<object>['filter'];\n    shouldUseVirtualFocus?: boolean;\n  };\n  collection: BaseCollection<any>;\n  menuRef: RefObject<HTMLElement | null>;\n}\n\nfunction MenuInner<T>({props, collection, menuRef: ref}: MenuInnerProps<T>) {\n  [props, ref] = useContextProps(props, ref, SelectableCollectionContext);\n  let {filter, ...autocompleteMenuProps} = props;\n  let filteredCollection = useMemo(\n    () => (filter ? collection.filter(filter) : collection),\n    [collection, filter]\n  );\n  let state = useTreeState({\n    ...props,\n    collection: filteredCollection,\n    children: undefined\n  });\n  let triggerState = useContext(RootMenuTriggerStateContext);\n  let {isVirtualized, CollectionRoot} = useContext(CollectionRendererContext);\n  let {menuProps} = useMenu(\n    {...props, isVirtualized, onClose: props.onClose || triggerState?.close},\n    state,\n    ref\n  );\n  let renderProps = useRenderProps({\n    ...props,\n    children: undefined,\n    defaultClassName: 'react-aria-Menu',\n    values: {\n      isEmpty: state.collection.size === 0\n    }\n  });\n\n  let emptyState: ReactElement | null = null;\n  if (state.collection.size === 0 && props.renderEmptyState) {\n    emptyState = (\n      <div role=\"menuitem\" style={{display: 'contents'}}>\n        {props.renderEmptyState()}\n      </div>\n    );\n  }\n\n  let DOMProps = filterDOMProps(props, {global: true});\n\n  return (\n    <FocusScope>\n      <dom.div\n        {...mergeProps(DOMProps, renderProps, menuProps)}\n        ref={ref as RefObject<HTMLDivElement>}\n        slot={props.slot || undefined}\n        data-empty={state.collection.size === 0 || undefined}\n        onScroll={props.onScroll}>\n        <Provider\n          values={[\n            [MenuStateContext, state],\n            [SeparatorContext, {elementType: 'div'}],\n            [SectionContext, {name: 'MenuSection', render: MenuSectionInner}],\n            [\n              SubmenuTriggerContext,\n              {\n                parentMenuRef: ref,\n                shouldUseVirtualFocus: autocompleteMenuProps?.shouldUseVirtualFocus\n              }\n            ],\n            [MenuItemContext, {shouldCloseOnSelect: props.shouldCloseOnSelect}],\n            [SelectableCollectionContext, null],\n            [FieldInputContext, null],\n            [SelectionManagerContext, state.selectionManager],\n            /* Ensure root MenuTriggerState is defined, in case Menu is rendered outside a MenuTrigger. */\n            /* We assume the context can never change between defined and undefined. */\n            /* eslint-disable-next-line react-hooks/rules-of-hooks */\n            [RootMenuTriggerStateContext, triggerState ?? useMenuTriggerState({})]\n          ]}>\n          <SharedElementTransition>\n            <CollectionRoot\n              collection={state.collection}\n              persistedKeys={usePersistedKeys(state.selectionManager.focusedKey)}\n              scrollRef={ref}\n            />\n          </SharedElementTransition>\n        </Provider>\n        {emptyState}\n      </dom.div>\n    </FocusScope>\n  );\n}\n\nexport interface MenuSectionProps<T>\n  extends\n    SectionProps<T>,\n    Omit<MultipleSelection, 'disabledKeys'>,\n    DOMRenderProps<'section', undefined> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n   * element.\n   *\n   * @default 'react-aria-MenuSection'\n   */\n  className?: string;\n  /** Whether the menu should close when the menu item is selected. */\n  shouldCloseOnSelect?: boolean;\n}\n\n// A subclass of SelectionManager that forwards focus-related properties to the parent,\n// but has its own local selection state.\nclass GroupSelectionManager extends SelectionManager {\n  private parent: SelectionManager;\n\n  constructor(parent: SelectionManager, state: MultipleSelectionState) {\n    super(parent.collection, state);\n    this.parent = parent;\n  }\n\n  get focusedKey() {\n    return this.parent.focusedKey;\n  }\n\n  get isFocused() {\n    return this.parent.isFocused;\n  }\n\n  setFocusedKey(key: Key | null, childFocusStrategy?: FocusStrategy): void {\n    return this.parent.setFocusedKey(key, childFocusStrategy);\n  }\n\n  setFocused(isFocused: boolean): void {\n    this.parent.setFocused(isFocused);\n  }\n\n  get childFocusStrategy() {\n    return this.parent.childFocusStrategy;\n  }\n}\n\nfunction MenuSectionInner<T>(\n  props: MenuSectionProps<T>,\n  ref: ForwardedRef<HTMLElement>,\n  section: Node<T>,\n  className = 'react-aria-MenuSection'\n) {\n  let state = useContext(MenuStateContext)!;\n  let {CollectionBranch} = useContext(CollectionRendererContext);\n  let [headingRef, heading] = useSlot();\n  let {headingProps, groupProps} = useMenuSection({\n    heading,\n    'aria-label': section.props['aria-label'] ?? undefined\n  });\n  let renderProps = useRenderProps({\n    ...props,\n    id: undefined,\n    children: undefined,\n    defaultClassName: className,\n    className: section.props?.className,\n    style: section.props?.style,\n    values: undefined\n  });\n\n  let parent = useContext(SelectionManagerContext)!;\n  let selectionState = useMultipleSelectionState(props);\n  let manager =\n    props.selectionMode != null ? new GroupSelectionManager(parent, selectionState) : parent;\n\n  let closeOnSelect = useSlottedContext(MenuItemContext)?.shouldCloseOnSelect;\n\n  let DOMProps = filterDOMProps(props as any, {global: true});\n  delete DOMProps.id;\n\n  return (\n    <dom.section {...mergeProps(DOMProps, renderProps, groupProps)} ref={ref}>\n      <Provider\n        values={[\n          [HeaderContext, {...headingProps, ref: headingRef}],\n          [SelectionManagerContext, manager],\n          [MenuItemContext, {shouldCloseOnSelect: props.shouldCloseOnSelect ?? closeOnSelect}]\n        ]}>\n        <CollectionBranch collection={state.collection} parent={section} />\n      </Provider>\n    </dom.section>\n  );\n}\n\n/**\n * A MenuSection represents a section within a Menu.\n */\nexport const MenuSection = /*#__PURE__*/ createBranchComponent(SectionNode, MenuSectionInner);\n\nexport interface MenuItemRenderProps extends ItemRenderProps {\n  /**\n   * Whether the item has a submenu.\n   *\n   * @selector [data-has-submenu]\n   */\n  hasSubmenu: boolean;\n  /**\n   * Whether the item's submenu is open.\n   *\n   * @selector [data-open]\n   */\n  isOpen: boolean;\n}\n\nexport interface MenuItemProps<T = object>\n  extends\n    Omit<RenderProps<MenuItemRenderProps>, 'render'>,\n    PossibleLinkDOMRenderProps<'div', MenuItemRenderProps>,\n    LinkDOMProps,\n    HoverEvents,\n    FocusEvents,\n    PressEvents,\n    Omit<GlobalDOMAttributes<HTMLDivElement>, 'onClick'> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n   * element. A function may be provided to compute the class based on component state.\n   *\n   * @default 'react-aria-MenuItem'\n   */\n  className?: ClassNameOrFunction<MenuItemRenderProps>;\n  /** The unique id of the item. */\n  id?: Key;\n  /**\n   * The object value that this item represents. When using dynamic collections, this is set\n   * automatically.\n   */\n  value?: T;\n  /** A string representation of the item's contents, used for features like typeahead. */\n  textValue?: string;\n  /** An accessibility label for this item. */\n  'aria-label'?: string;\n  /** Whether the item is disabled. */\n  isDisabled?: boolean;\n  /** Handler that is called when the item is selected. */\n  onAction?: () => void;\n  /** Whether the menu should close when the menu item is selected. */\n  shouldCloseOnSelect?: boolean;\n}\n\nconst MenuItemContext = createContext<ContextValue<MenuItemProps, HTMLDivElement>>(null);\n\n/**\n * A MenuItem represents an individual action in a Menu.\n */\nexport const MenuItem = /*#__PURE__*/ createLeafComponent(ItemNode, function MenuItem<\n  T\n>(props: MenuItemProps<T>, forwardedRef: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n  [props, forwardedRef] = useContextProps(props, forwardedRef, MenuItemContext);\n  let id = useSlottedContext(MenuItemContext)?.id as string;\n  let state = useContext(MenuStateContext)!;\n  let ref = useObjectRef<any>(forwardedRef);\n  let selectionManager = useContext(SelectionManagerContext)!;\n  let {isVirtualized} = useContext(CollectionRendererContext);\n  let {menuItemProps, labelProps, descriptionProps, keyboardShortcutProps, ...states} = useMenuItem(\n    {\n      ...props,\n      id,\n      key: item.key,\n      selectionManager,\n      isVirtualized: isVirtualized\n    },\n    state,\n    ref\n  );\n\n  let {hoverProps, isHovered} = useHover({\n    isDisabled: states.isDisabled\n  });\n  let renderProps = useRenderProps<MenuItemRenderProps, any>({\n    ...props,\n    id: undefined,\n    children: item.rendered,\n    defaultClassName: 'react-aria-MenuItem',\n    values: {\n      ...states,\n      isHovered,\n      isFocusVisible: states.isFocusVisible,\n      selectionMode: selectionManager.selectionMode,\n      selectionBehavior: selectionManager.selectionBehavior,\n      hasSubmenu: !!props['aria-haspopup'],\n      isOpen: props['aria-expanded'] === 'true'\n    }\n  });\n\n  let ElementType = props.href ? dom.a : dom.div;\n  let DOMProps = filterDOMProps(props as any, {global: true});\n  delete DOMProps.id;\n  delete DOMProps.onClick;\n\n  return (\n    <ElementType\n      {...mergeProps(DOMProps, renderProps, menuItemProps, hoverProps)}\n      ref={ref}\n      data-disabled={states.isDisabled || undefined}\n      data-hovered={isHovered || undefined}\n      data-focused={states.isFocused || undefined}\n      data-focus-visible={states.isFocusVisible || undefined}\n      data-pressed={states.isPressed || undefined}\n      data-selected={states.isSelected || undefined}\n      data-selection-mode={\n        selectionManager.selectionMode === 'none' ? undefined : selectionManager.selectionMode\n      }\n      data-has-submenu={!!props['aria-haspopup'] || undefined}\n      data-open={props['aria-expanded'] === 'true' || undefined}>\n      <Provider\n        values={[\n          [\n            TextContext,\n            {\n              slots: {\n                [DEFAULT_SLOT]: labelProps,\n                label: labelProps,\n                description: descriptionProps\n              }\n            }\n          ],\n          [KeyboardContext, keyboardShortcutProps],\n          [SelectionIndicatorContext, {isSelected: states.isSelected}]\n        ]}>\n        {renderProps.children}\n      </Provider>\n    </ElementType>\n  );\n});\n"],"names":[],"version":3,"file":"Menu.cjs.map"}