@depup/react-aria-components 1.20.0-depup.0 → 1.21.0-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/NavigationTree/package.json +5 -0
  2. package/README.md +2 -2
  3. package/changes.json +1 -1
  4. package/dist/exports/Menu.cjs +1 -0
  5. package/dist/exports/Menu.cjs.map +1 -1
  6. package/dist/exports/Menu.js +2 -2
  7. package/dist/exports/Menu.js.map +1 -1
  8. package/dist/exports/Menu.mjs +2 -2
  9. package/dist/exports/Menu.mjs.map +1 -1
  10. package/dist/exports/NavigationTree.cjs +37 -0
  11. package/dist/exports/NavigationTree.cjs.map +1 -0
  12. package/dist/exports/NavigationTree.js +25 -0
  13. package/dist/exports/NavigationTree.js.map +1 -0
  14. package/dist/exports/NavigationTree.mjs +25 -0
  15. package/dist/exports/NavigationTree.mjs.map +1 -0
  16. package/dist/exports/index.cjs +13 -0
  17. package/dist/exports/index.cjs.map +1 -1
  18. package/dist/exports/index.js +6 -2
  19. package/dist/exports/index.js.map +1 -1
  20. package/dist/exports/index.mjs +6 -2
  21. package/dist/exports/index.mjs.map +1 -1
  22. package/dist/private/Checkbox.cjs.map +1 -1
  23. package/dist/private/Checkbox.js.map +1 -1
  24. package/dist/private/Checkbox.mjs.map +1 -1
  25. package/dist/private/Dialog.cjs +6 -0
  26. package/dist/private/Dialog.cjs.map +1 -1
  27. package/dist/private/Dialog.js +6 -0
  28. package/dist/private/Dialog.js.map +1 -1
  29. package/dist/private/Dialog.mjs +6 -0
  30. package/dist/private/Dialog.mjs.map +1 -1
  31. package/dist/private/GridList.cjs.map +1 -1
  32. package/dist/private/GridList.js.map +1 -1
  33. package/dist/private/GridList.mjs.map +1 -1
  34. package/dist/private/ListBox.cjs.map +1 -1
  35. package/dist/private/ListBox.js.map +1 -1
  36. package/dist/private/ListBox.mjs.map +1 -1
  37. package/dist/private/Menu.cjs +55 -0
  38. package/dist/private/Menu.cjs.map +1 -1
  39. package/dist/private/Menu.js +56 -2
  40. package/dist/private/Menu.js.map +1 -1
  41. package/dist/private/Menu.mjs +56 -2
  42. package/dist/private/Menu.mjs.map +1 -1
  43. package/dist/private/NavigationTree.cjs +272 -0
  44. package/dist/private/NavigationTree.cjs.map +1 -0
  45. package/dist/private/NavigationTree.js +258 -0
  46. package/dist/private/NavigationTree.js.map +1 -0
  47. package/dist/private/NavigationTree.mjs +257 -0
  48. package/dist/private/NavigationTree.mjs.map +1 -0
  49. package/dist/private/RadioGroup.cjs.map +1 -1
  50. package/dist/private/RadioGroup.js.map +1 -1
  51. package/dist/private/RadioGroup.mjs.map +1 -1
  52. package/dist/private/Switch.cjs +8 -2
  53. package/dist/private/Switch.cjs.map +1 -1
  54. package/dist/private/Switch.js +9 -3
  55. package/dist/private/Switch.js.map +1 -1
  56. package/dist/private/Switch.mjs +9 -3
  57. package/dist/private/Switch.mjs.map +1 -1
  58. package/dist/private/Table.cjs.map +1 -1
  59. package/dist/private/Table.js.map +1 -1
  60. package/dist/private/Table.mjs.map +1 -1
  61. package/dist/private/Text.cjs +3 -1
  62. package/dist/private/Text.cjs.map +1 -1
  63. package/dist/private/Text.js +4 -2
  64. package/dist/private/Text.js.map +1 -1
  65. package/dist/private/Text.mjs +4 -2
  66. package/dist/private/Text.mjs.map +1 -1
  67. package/dist/private/TokenField.cjs +30 -2
  68. package/dist/private/TokenField.cjs.map +1 -1
  69. package/dist/private/TokenField.js +30 -2
  70. package/dist/private/TokenField.js.map +1 -1
  71. package/dist/private/TokenField.mjs +30 -2
  72. package/dist/private/TokenField.mjs.map +1 -1
  73. package/dist/private/Tree.cjs.map +1 -1
  74. package/dist/private/Tree.js.map +1 -1
  75. package/dist/private/Tree.mjs.map +1 -1
  76. package/dist/private/TreeDropTargetDelegate.cjs +11 -6
  77. package/dist/private/TreeDropTargetDelegate.cjs.map +1 -1
  78. package/dist/private/TreeDropTargetDelegate.js +11 -6
  79. package/dist/private/TreeDropTargetDelegate.js.map +1 -1
  80. package/dist/private/TreeDropTargetDelegate.mjs +11 -6
  81. package/dist/private/TreeDropTargetDelegate.mjs.map +1 -1
  82. package/dist/types/exports/Menu.d.ts +2 -2
  83. package/dist/types/exports/NavigationTree.d.ts +8 -0
  84. package/dist/types/exports/index.d.ts +7 -3
  85. package/dist/types/src/Breadcrumbs.d.ts +2 -2
  86. package/dist/types/src/Button.d.ts +1 -1
  87. package/dist/types/src/Calendar.d.ts +6 -6
  88. package/dist/types/src/Checkbox.d.ts +8 -8
  89. package/dist/types/src/Collection.d.ts +1 -1
  90. package/dist/types/src/ComboBox.d.ts +2 -2
  91. package/dist/types/src/DateField.d.ts +4 -4
  92. package/dist/types/src/DatePicker.d.ts +2 -2
  93. package/dist/types/src/Dialog.d.ts +2 -2
  94. package/dist/types/src/Disclosure.d.ts +2 -2
  95. package/dist/types/src/GridList.d.ts +6 -6
  96. package/dist/types/src/Group.d.ts +1 -1
  97. package/dist/types/src/Header.d.ts +1 -1
  98. package/dist/types/src/Input.d.ts +1 -1
  99. package/dist/types/src/Label.d.ts +1 -1
  100. package/dist/types/src/Link.d.ts +1 -1
  101. package/dist/types/src/ListBox.d.ts +5 -5
  102. package/dist/types/src/Menu.d.ts +25 -6
  103. package/dist/types/src/Meter.d.ts +1 -1
  104. package/dist/types/src/Modal.d.ts +2 -2
  105. package/dist/types/src/NavigationTree.d.ts +80 -0
  106. package/dist/types/src/NumberField.d.ts +1 -1
  107. package/dist/types/src/OverlayArrow.d.ts +1 -1
  108. package/dist/types/src/Popover.d.ts +1 -1
  109. package/dist/types/src/RadioGroup.d.ts +8 -8
  110. package/dist/types/src/SearchField.d.ts +1 -1
  111. package/dist/types/src/Select.d.ts +2 -2
  112. package/dist/types/src/Separator.d.ts +1 -1
  113. package/dist/types/src/Slider.d.ts +5 -5
  114. package/dist/types/src/Switch.d.ts +7 -7
  115. package/dist/types/src/Table.d.ts +8 -8
  116. package/dist/types/src/Tabs.d.ts +5 -5
  117. package/dist/types/src/TagGroup.d.ts +3 -3
  118. package/dist/types/src/Text.d.ts +1 -1
  119. package/dist/types/src/TextField.d.ts +1 -1
  120. package/dist/types/src/Toast.d.ts +3 -3
  121. package/dist/types/src/ToggleButton.d.ts +1 -1
  122. package/dist/types/src/ToggleButtonGroup.d.ts +1 -1
  123. package/dist/types/src/TokenField.d.ts +2 -2
  124. package/dist/types/src/Toolbar.d.ts +1 -1
  125. package/dist/types/src/Tooltip.d.ts +1 -1
  126. package/dist/types/src/Tree.d.ts +6 -6
  127. package/package.json +8 -7
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqGM,MAAM,0DAAc,CAAA,GAAA,oBAAY,EAAgD;AAChF,MAAM,0DAAmB,CAAA,GAAA,oBAAY,EAAyB;AAC9D,MAAM,0DAA8B,CAAA,GAAA,oBAAY,EAA+B;AACtF,MAAM,8DAA0B,CAAA,GAAA,oBAAY,EAA2B;AAMhE,SAAS,0CAAY,KAAuB;IACjD,IAAI,QAAQ,CAAA,GAAA,0BAAkB,EAAE;IAChC,IAAI,MAAM,CAAA,GAAA,aAAK,EAAqB;IACpC,IAAI,oBAAC,gBAAgB,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qBAAa,EAC/C;QACE,GAAG,KAAK;QACR,MAAM;IACR,GACA,OACA;IAEF,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IAEvB,sDAAsD;IACtD,qFAAqF;IACrF,IAAI,WAAW,CAAA,GAAA,kBAAU;IACzB,IAAI,UACF,OAAO;IAGT,qBACE,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC;gBAAa;oBAAC,GAAG,SAAS;oBAAE,KAAK;gBAAS;aAAE;YAC7C;gBAAC,CAAA,GAAA,wCAAyB;gBAAG;aAAM;YACnC;gBAAC;gBAA6B;aAAM;YACpC;gBACE,CAAA,GAAA,yCAAa;gBACb;oBAC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AE,CAAC,GAAG,CAAA,GAAA,yCAAE,EAAE,GAAG;IAC9C,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAc;QAAC,QAAQ;IAAI;IACzD,OAAO,SAAS,EAAE;IAClB,OAAO,SAAS,OAAO;IAEvB,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,aAAa,eAAe,WAAW;QAChE,KAAK;QACL,iBAAe,OAAO,UAAU,IAAI;QACpC,gBAAc,aAAa;QAC3B,gBAAc,OAAO,SAAS,IAAI;QAClC,sBAAoB,OAAO,cAAc,IAAI;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,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBACE,CAAA,GAAA,yCAAU;gBACV;oBACE,OAAO;wBACL,CAAC,CAAA,GAAA,yCAAW,EAAE,EAAE;wBAChB,OAAO;wBACP,aAAa;oBACf;gBACF;aACD;YACD;gBAAC,CAAA,GAAA,yCAAc;gBAAG;aAAsB;YACxC;gBAAC,CAAA,GAAA,yCAAwB;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 offset: props.trigger === 'contextMenu' ? 0 : undefined\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 // oxlint-disable-next-line react/react-compiler, 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.mjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4GM,MAAM,0DAAc,CAAA,GAAA,oBAAY,EAAgD;AAChF,MAAM,0DAAmB,CAAA,GAAA,oBAAY,EAAyB;AAC9D,MAAM,0DAA8B,CAAA,GAAA,oBAAY,EAA+B;AACtF,MAAM,8DAA0B,CAAA,GAAA,oBAAY,EAA2B;AAMhE,SAAS,0CAAY,KAAuB;IACjD,IAAI,QAAQ,CAAA,GAAA,0BAAkB,EAAE;IAChC,IAAI,MAAM,CAAA,GAAA,aAAK,EAAqB;IACpC,IAAI,oBAAC,gBAAgB,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qBAAa,EAC/C;QACE,GAAG,KAAK;QACR,MAAM;IACR,GACA,OACA;IAEF,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IAEvB,sDAAsD;IACtD,qFAAqF;IACrF,IAAI,WAAW,CAAA,GAAA,kBAAU;IACzB,IAAI,UACF,OAAO;IAGT,qBACE,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC;gBAAa;oBAAC,GAAG,SAAS;oBAAE,KAAK;gBAAS;aAAE;YAC7C;gBAAC,CAAA,GAAA,wCAAyB;gBAAG;aAAM;YACnC;gBAAC;gBAA6B;aAAM;YACpC;gBACE,CAAA,GAAA,yCAAa;gBACb;oBACE,SAAS;oBACT,YAAY;+BACZ;oBACA,WAAW;oBACX,mBAAmB,SAAS,CAAC,kBAAkB;oBAC/C,QAAQ,MAAM,OAAO,KAAK,gBAAgB,IAAI;gBAChD;aACD;SACF;qBACD,gCAAC,CAAA,GAAA,qBAAa;QAAG,GAAG,gBAAgB;QAAE,KAAK;QAAK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B,GAAG,UAAU;QACb,IAAI;QACJ,UAAU,KAAK,QAAQ;QACvB,kBAAkB;QAClB,QAAQ;IACV;IAEA,IAAI,YAAY;QACd,uBAAuB;QACvB,UAAU;IACZ;IAEA,qBACE,gFAGE,gCAAC;QAAI,OAAO;YAAC,UAAU;YAAY,OAAO;YAAG,QAAQ;QAAC;QAAG,OAAO,CAAA,GAAA,iBAAS,EAAE;qBACzE,gCAAC;QACC,eAAY;QACZ,KAAK;QACL,OAAO;YAAC,UAAU;YAAY,QAAQ;YAAG,OAAO;QAAC;SAGpD,aAAa,YAAY,QAAQ,kBAChC,gFAEE,gCAAC,CAAA,GAAA,yCAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,qBAAa,EAAE,OAAO;YAAC,QAAQ;QAAI,IAAI,UAAU;QAC/D,GAAG,WAAW;QACf,MAAK;QACL,KAAK;OACJ,YAAY,QAAQ;AAOjC","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 LoaderNode,\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 StyleProps,\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 {inertValue} from 'react-aria/private/utils/inertValue';\nimport {KeyboardContext} from './Keyboard';\nimport {\n LoadMoreSentinelProps,\n useLoadMoreSentinel\n} from 'react-aria/private/utils/useLoadMoreSentinel';\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 offset: props.trigger === 'contextMenu' ? 0 : undefined\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 menu. */\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 // oxlint-disable-next-line react/react-compiler, 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\nexport interface MenuLoadMoreItemProps\n extends\n Omit<LoadMoreSentinelProps, 'collection' | 'direction'>,\n StyleProps,\n DOMRenderProps<'div', undefined>,\n GlobalDOMAttributes<HTMLDivElement> {\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-MenuLoadingIndicator'\n */\n className?: string;\n /**\n * The load more spinner to render when loading additional items.\n */\n children?: ReactNode;\n /**\n * Whether or not the loading spinner should be rendered or not.\n */\n isLoading?: boolean;\n}\n\nexport const MenuLoadMoreItem = createLeafComponent(\n LoaderNode,\n function MenuLoadingIndicator(\n props: MenuLoadMoreItemProps,\n ref: ForwardedRef<HTMLDivElement>,\n item: Node<object>\n ) {\n let state = useContext(MenuStateContext)!;\n let {isLoading, onLoadMore, scrollOffset, ...otherProps} = props;\n\n let sentinelRef = useRef<HTMLDivElement>(null);\n let memoedLoadMoreProps = useMemo(\n () => ({\n onLoadMore,\n collection: state?.collection,\n sentinelRef,\n scrollOffset\n }),\n [onLoadMore, scrollOffset, state?.collection]\n );\n useLoadMoreSentinel(memoedLoadMoreProps, sentinelRef);\n let renderProps = useRenderProps({\n ...otherProps,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-MenuLoadingIndicator',\n values: undefined\n });\n\n let itemProps = {\n // For Android talkback\n tabIndex: -1\n };\n\n return (\n <>\n {/* Always render the sentinel. For now onus is on the user for styling when using flex + gap (this would introduce a gap even though it doesn't take room) */}\n {/* @ts-ignore - compatibility with React < 19 */}\n <div style={{position: 'relative', width: 0, height: 0}} inert={inertValue(true)}>\n <div\n data-testid=\"loadMoreSentinel\"\n ref={sentinelRef}\n style={{position: 'absolute', height: 1, width: 1}}\n />\n </div>\n {isLoading && renderProps.children && (\n <>\n {/* oxlint-disable jsx-a11y/role-has-required-aria-props -- loader row is not selectable */}\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), itemProps)}\n {...renderProps}\n role=\"menuitem\"\n ref={ref as ForwardedRef<HTMLDivElement>}>\n {renderProps.children}\n </dom.div>\n {/* oxlint-enable jsx-a11y/role-has-required-aria-props */}\n </>\n )}\n </>\n );\n }\n);\n"],"names":[],"version":3,"file":"Menu.mjs.map"}
@@ -0,0 +1,272 @@
1
+ var $048d76b84370f141$exports = require("./utils.cjs");
2
+ var $993df839da838aaa$exports = require("./Link.cjs");
3
+ var $8b1888e80597ea2d$exports = require("./Tree.cjs");
4
+ var $38I3X$reactariaprivateutilsgetScrollParent = require("react-aria/private/utils/getScrollParent");
5
+ var $38I3X$reactariaprivateutilsshadowdomDOMFunctions = require("react-aria/private/utils/shadowdom/DOMFunctions");
6
+ var $38I3X$react = require("react");
7
+ var $38I3X$reactariaprivateutilsscrollIntoView = require("react-aria/private/utils/scrollIntoView");
8
+ var $38I3X$reactariauseObjectRef = require("react-aria/useObjectRef");
9
+
10
+
11
+ function $parcel$interopDefault(a) {
12
+ return a && a.__esModule ? a.default : a;
13
+ }
14
+
15
+ function $parcel$export(e, n, v, s) {
16
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
17
+ }
18
+
19
+ $parcel$export(module.exports, "NavigationTreeContext", function () { return $afbb4be38057f532$export$8e343761409a7fb5; });
20
+ $parcel$export(module.exports, "NavigationTreeItemStateContext", function () { return $afbb4be38057f532$export$b9f1b2079cbb81f1; });
21
+ $parcel$export(module.exports, "NavigationTree", function () { return $afbb4be38057f532$export$6e5dd080808827ae; });
22
+ $parcel$export(module.exports, "NavigationTreeItem", function () { return $afbb4be38057f532$export$4040580f267549f5; });
23
+ $parcel$export(module.exports, "NavigationTreeItemContent", function () { return $afbb4be38057f532$export$e83a20cfc1acabb9; });
24
+ $parcel$export(module.exports, "NavigationTreeSection", function () { return $afbb4be38057f532$export$ab0c034528c794e5; });
25
+ $parcel$export(module.exports, "NavigationTreeHeader", function () { return $afbb4be38057f532$export$ad4480f0a22f5045; });
26
+ /*
27
+ * Copyright 2026 Adobe. All rights reserved.
28
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
29
+ * you may not use this file except in compliance with the License. You may obtain a copy
30
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
31
+ *
32
+ * Unless required by applicable law or agreed to in writing, software distributed under
33
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
34
+ * OF ANY KIND, either express or implied. See the License for the specific language
35
+ * governing permissions and limitations under the License.
36
+ */
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+ const $afbb4be38057f532$export$8e343761409a7fb5 = /*#__PURE__*/ (0, $38I3X$react.createContext)(null);
45
+ const $afbb4be38057f532$var$InternalNavigationTreeContext = /*#__PURE__*/ (0, $38I3X$react.createContext)({});
46
+ const $afbb4be38057f532$var$NavigationTreeItemLinkContext = /*#__PURE__*/ (0, $38I3X$react.createContext)({});
47
+ const $afbb4be38057f532$export$b9f1b2079cbb81f1 = /*#__PURE__*/ (0, $38I3X$react.createContext)({
48
+ isCurrentAncestor: false
49
+ });
50
+ const $afbb4be38057f532$export$6e5dd080808827ae = /*#__PURE__*/ (0, $38I3X$react.forwardRef)(function NavigationTree(props, ref) {
51
+ [props, ref] = (0, $048d76b84370f141$exports.useContextProps)(props, ref, $afbb4be38057f532$export$8e343761409a7fb5);
52
+ let { className: className, style: style, children: children, selectedRoute: selectedRoute, ...rest } = props;
53
+ let syncedRouteRef = (0, $38I3X$react.useRef)(undefined);
54
+ let treeRef = (0, $38I3X$reactariauseObjectRef.useObjectRef)(ref);
55
+ let context = (0, $38I3X$react.useMemo)(()=>({
56
+ selectedRoute: selectedRoute,
57
+ syncedRouteRef: syncedRouteRef,
58
+ treeRef: treeRef
59
+ }), [
60
+ selectedRoute,
61
+ treeRef
62
+ ]);
63
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement($afbb4be38057f532$var$InternalNavigationTreeContext.Provider, {
64
+ value: context
65
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement((0, $8b1888e80597ea2d$exports.Tree), {
66
+ ...rest,
67
+ ref: treeRef,
68
+ className: className ?? 'react-aria-NavigationTree',
69
+ style: style,
70
+ selectionMode: "none",
71
+ keyboardNavigationBehavior: "tab"
72
+ }, children));
73
+ });
74
+ const $afbb4be38057f532$export$4040580f267549f5 = /*#__PURE__*/ (0, $38I3X$react.forwardRef)(function NavigationTreeItem(props, ref) {
75
+ let { href: href, hrefLang: hrefLang, target: target, rel: rel, download: download, ping: ping, referrerPolicy: referrerPolicy, routerOptions: routerOptions, className: className, style: style, render: render, ...rest } = props;
76
+ let { selectedRoute: selectedRoute, treeRef: treeRef } = (0, $38I3X$react.useContext)($afbb4be38057f532$var$InternalNavigationTreeContext);
77
+ let hasLink = href != null && href.length > 0;
78
+ let isCurrent = hasLink && href === selectedRoute;
79
+ let [isLinkFocused, setLinkFocused] = (0, $38I3X$react.useState)(false);
80
+ // Additional render props NavigationTreeItem adds to what TreeItem already provides.
81
+ let getItemRenderProps = (renderProps)=>({
82
+ ...renderProps,
83
+ isCurrent: isCurrent,
84
+ isCurrentAncestor: $afbb4be38057f532$var$hasSelectedDescendant(renderProps.id, renderProps.state, selectedRoute),
85
+ isFocusVisible: renderProps.isFocusVisible || renderProps.isFocusVisibleWithin && isLinkFocused
86
+ });
87
+ let objRef = (0, $38I3X$reactariauseObjectRef.useObjectRef)(ref);
88
+ (0, $38I3X$react.useEffect)(()=>{
89
+ if (isCurrent && objRef.current) {
90
+ let scrollParent = (0, $38I3X$reactariaprivateutilsgetScrollParent.getScrollParent)(objRef.current, true);
91
+ // Only scroll the tree's own scroll container into view — never an outer ancestor such as the
92
+ // page. When the tree isn't its own scroll container the nearest scroll parent is outside the
93
+ // tree, so we skip rather than hijack the surrounding scroll position.
94
+ let treeRoot = treeRef?.current;
95
+ if (treeRoot && (0, $38I3X$reactariaprivateutilsshadowdomDOMFunctions.nodeContains)(treeRoot, scrollParent)) (0, $38I3X$reactariaprivateutilsscrollIntoView.scrollIntoView)(scrollParent, objRef.current, {
96
+ block: 'center'
97
+ });
98
+ }
99
+ }, [
100
+ isCurrent,
101
+ objRef,
102
+ treeRef
103
+ ]);
104
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement($afbb4be38057f532$var$NavigationTreeItemLinkContext.Provider, {
105
+ value: {
106
+ href: href,
107
+ hrefLang: hrefLang,
108
+ target: target,
109
+ rel: rel,
110
+ download: download,
111
+ ping: ping,
112
+ referrerPolicy: referrerPolicy,
113
+ routerOptions: routerOptions,
114
+ isCurrent: isCurrent,
115
+ isLinkFocused: isLinkFocused,
116
+ setLinkFocused: setLinkFocused
117
+ }
118
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement((0, $8b1888e80597ea2d$exports.TreeItem), {
119
+ ...rest,
120
+ ref: objRef,
121
+ href: href,
122
+ focusMode: hasLink ? 'child' : undefined,
123
+ allowsArrowNavigation: true,
124
+ "data-current": isCurrent || undefined,
125
+ className: typeof className === 'function' ? (renderProps)=>className(getItemRenderProps(renderProps)) : className ?? 'react-aria-NavigationTreeItem',
126
+ style: typeof style === 'function' ? (renderProps)=>style(getItemRenderProps(renderProps)) : style,
127
+ render: (domProps, renderProps)=>{
128
+ let values = getItemRenderProps(renderProps);
129
+ let { children: rowChildren, ...domRest } = domProps;
130
+ let dataProps = {
131
+ 'data-focus-visible': values.isFocusVisible || undefined,
132
+ 'data-current-ancestor': values.isCurrentAncestor || undefined
133
+ };
134
+ let content = /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement($afbb4be38057f532$export$b9f1b2079cbb81f1.Provider, {
135
+ value: {
136
+ isCurrentAncestor: values.isCurrentAncestor
137
+ }
138
+ }, rowChildren);
139
+ return typeof render === 'function' ? render({
140
+ ...domRest,
141
+ ...dataProps,
142
+ children: content
143
+ }, values) : /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement((0, $048d76b84370f141$exports.dom).div, {
144
+ ...domRest,
145
+ ...dataProps
146
+ }, content);
147
+ }
148
+ }));
149
+ });
150
+ // The collection key of the item whose href matches `route`, or null.
151
+ function $afbb4be38057f532$var$findKeyForRoute(collection, route) {
152
+ for (let key of collection.getKeys()){
153
+ if (collection.getItem(key)?.props?.href === route) return key;
154
+ }
155
+ return null;
156
+ }
157
+ // Walks up from `key` to the closest ancestor that is actually rendered (all ancestors expanded).
158
+ // Returns `key` unchanged when already visible. A collapsed ancestor hides everything beneath it,
159
+ // so the highest collapsed ancestor is the closest visible row.
160
+ function $afbb4be38057f532$var$closestVisibleKey(collection, expandedKeys, key) {
161
+ let target = key;
162
+ let node = collection.getItem(key);
163
+ while(node?.parentKey != null){
164
+ let parent = collection.getItem(node.parentKey);
165
+ if (parent?.type === 'item' && !expandedKeys.has(node.parentKey)) target = node.parentKey;
166
+ node = parent;
167
+ }
168
+ return target;
169
+ }
170
+ // Moves the tree's focused key to the item matching selectedRoute. Runs when the route or the
171
+ // collection changes; the shared syncedRouteRef dedupes across items so it fires once per change.
172
+ function $afbb4be38057f532$var$useRouteFocusSync({ state: state }) {
173
+ let { selectedRoute: selectedRoute, syncedRouteRef: syncedRouteRef } = (0, $38I3X$react.useContext)($afbb4be38057f532$var$InternalNavigationTreeContext);
174
+ let { collection: collection, selectionManager: selectionManager, expandedKeys: expandedKeys } = state;
175
+ (0, $38I3X$react.useEffect)(()=>{
176
+ if (selectedRoute == null || syncedRouteRef == null || syncedRouteRef.current === selectedRoute) return;
177
+ let key = $afbb4be38057f532$var$findKeyForRoute(collection, selectedRoute);
178
+ if (key != null) {
179
+ key = $afbb4be38057f532$var$closestVisibleKey(collection, expandedKeys, key);
180
+ syncedRouteRef.current = selectedRoute;
181
+ selectionManager.setFocusedKey(key);
182
+ }
183
+ }, [
184
+ selectedRoute,
185
+ collection,
186
+ expandedKeys,
187
+ syncedRouteRef,
188
+ selectionManager
189
+ ]);
190
+ }
191
+ // Cache so each row doesn't have to walk up the tree every time.
192
+ let $afbb4be38057f532$var$selectedAncestorsCache = new WeakMap();
193
+ // The set of collection keys that are ancestors of the item matching `selectedRoute`.
194
+ function $afbb4be38057f532$var$getSelectedAncestors(state, selectedRoute) {
195
+ let { collection: collection } = state;
196
+ let cached = $afbb4be38057f532$var$selectedAncestorsCache.get(collection);
197
+ if (cached && cached.selection === selectedRoute) return cached.ancestors;
198
+ let matchKey = $afbb4be38057f532$var$findKeyForRoute(collection, selectedRoute);
199
+ let ancestors = new Set();
200
+ let node = matchKey != null ? collection.getItem(matchKey) : null;
201
+ while(node?.parentKey != null && !ancestors.has(node.parentKey)){
202
+ ancestors.add(node.parentKey);
203
+ node = collection.getItem(node.parentKey);
204
+ }
205
+ $afbb4be38057f532$var$selectedAncestorsCache.set(collection, {
206
+ selection: selectedRoute,
207
+ ancestors: ancestors
208
+ });
209
+ return ancestors;
210
+ }
211
+ // Whether the row `id` is an ancestor of the item matching `selectedRoute`.
212
+ function $afbb4be38057f532$var$hasSelectedDescendant(id, state, selectedRoute) {
213
+ if (id == null || selectedRoute == null || !state) return false;
214
+ return $afbb4be38057f532$var$getSelectedAncestors(state, selectedRoute).has(id);
215
+ }
216
+ function $afbb4be38057f532$export$e83a20cfc1acabb9(props) {
217
+ let linkCtx = (0, $38I3X$react.useContext)($afbb4be38057f532$var$NavigationTreeItemLinkContext);
218
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement((0, $8b1888e80597ea2d$exports.TreeItemContent), props, (treeRenderProps)=>/*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement($afbb4be38057f532$var$NavigationTreeItemContentInner, {
219
+ treeRenderProps: treeRenderProps,
220
+ linkCtx: linkCtx,
221
+ children: props.children
222
+ }));
223
+ }
224
+ function $afbb4be38057f532$var$NavigationTreeItemContentInner(props) {
225
+ let { treeRenderProps: treeRenderProps, linkCtx: linkCtx, children: children } = props;
226
+ let { isCurrent: isCurrent, isLinkFocused: isLinkFocused, setLinkFocused: setLinkFocused, ...linkProps } = linkCtx;
227
+ let { state: state, isFocusVisible: isFocusVisible, isFocusVisibleWithin: isFocusVisibleWithin, id: id, hasChildItems: hasChildItems } = treeRenderProps;
228
+ let { isCurrentAncestor: isCurrentAncestor } = (0, $38I3X$react.useContext)($afbb4be38057f532$export$b9f1b2079cbb81f1);
229
+ $afbb4be38057f532$var$useRouteFocusSync({
230
+ state: state
231
+ });
232
+ // isFocusVisible follows the link: true when the row itself is keyboard focused, or when a child
233
+ // is keyboard focused and that child is the link (not another button/action).
234
+ let linkFocusVisible = isFocusVisible || isFocusVisibleWithin && !!isLinkFocused;
235
+ let values = {
236
+ ...treeRenderProps,
237
+ isCurrent: !!isCurrent,
238
+ isCurrentAncestor: isCurrentAncestor,
239
+ isFocusVisible: linkFocusVisible
240
+ };
241
+ let renderChildren = typeof children === 'function' ? children(values) : children;
242
+ // Provide onFocusChange so the link reports its focus up to NavigationTreeItem.
243
+ let linkContextValue = {
244
+ ...linkProps,
245
+ 'aria-current': isCurrent ? 'page' : undefined,
246
+ onFocusChange: setLinkFocused,
247
+ onPress: linkProps.href == null && hasChildItems ? ()=>state.toggleKey(id) : undefined
248
+ };
249
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement((0, $048d76b84370f141$exports.Provider), {
250
+ values: [
251
+ [
252
+ (0, $993df839da838aaa$exports.LinkContext),
253
+ linkContextValue
254
+ ]
255
+ ]
256
+ }, renderChildren);
257
+ }
258
+ function $afbb4be38057f532$export$ab0c034528c794e5(props) {
259
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement((0, $8b1888e80597ea2d$exports.TreeSection), {
260
+ className: "react-aria-NavigationTreeSection",
261
+ ...props
262
+ }, props.children);
263
+ }
264
+ function $afbb4be38057f532$export$ad4480f0a22f5045(props) {
265
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($38I3X$react))).createElement((0, $8b1888e80597ea2d$exports.TreeHeader), {
266
+ className: "react-aria-NavigationTreeHeader",
267
+ ...props
268
+ }, props.children);
269
+ }
270
+
271
+
272
+ //# sourceMappingURL=NavigationTree.cjs.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;A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;IAC3C,IAAI,aAAC,SAAS,iBAAE,aAAa,kBAAE,cAAc,EAAE,GAAG,WAAU,GAAG;IAC/D,IAAI,SAAC,KAAK,kBAAE,cAAc,wBAAE,oBAAoB,MAAE,EAAE,iBAAE,aAAa,EAAC,GAAG;IACvE,IAAI,qBAAC,iBAAiB,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE;IAErC,wCAAkB;eAAC;IAAK;IAExB,iGAAiG;IACjG,8EAA8E;IAC9E,IAAI,mBAAmB,kBAAmB,wBAAwB,CAAC,CAAC;IACpE,IAAI,SAA0F;QAC5F,GAAG,eAAe;QAClB,WAAW,CAAC,CAAC;2BACb;QACA,gBAAgB;IAClB;IACA,IAAI,iBAAiB,OAAO,aAAa,aAAa,SAAS,UAAU;IACzE,gFAAgF;IAChF,IAAI,mBAAmB;QACrB,GAAG,SAAS;QACZ,gBAAgB,YAAY,SAAS;QACrC,eAAe;QACf,SAAS,UAAU,IAAI,IAAI,QAAQ,gBAAgB,IAAM,MAAM,SAAS,CAAC,MAAM;IACjF;IACA,qBAAO,0DAAC,CAAA,GAAA,kCAAO;QAAE,QAAQ;YAAC;gBAAC,CAAA,GAAA,qCAAU;gBAAG;aAAiB;SAAC;OAAG;AAC/D;AAOO,SAAS,0CACd,KAAoC;IAEpC,qBACE,0DAAC,CAAA,GAAA,qCAAU;QAAE,WAAU;QAAoC,GAAG,KAAK;OAChE,MAAM,QAAQ;AAGrB;AAOO,SAAS,0CAAqB,KAAgC;IACnE,qBACE,0DAAC,CAAA,GAAA,oCAAS;QAAE,WAAU;QAAmC,GAAG,KAAK;OAC9D,MAAM,QAAQ;AAGrB","sources":["packages/react-aria-components/src/NavigationTree.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 ChildrenOrFunction,\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n StyleRenderProps,\n useContextProps\n} from './utils';\nimport {Collection, forwardRefType, Key, Node, RouterOptions} from '@react-types/shared';\nimport {getScrollParent} from 'react-aria/private/utils/getScrollParent';\nimport {LinkContext} from './Link';\nimport {nodeContains} from 'react-aria/private/utils/shadowdom/DOMFunctions';\nimport React, {\n createContext,\n ForwardedRef,\n forwardRef,\n ReactNode,\n RefObject,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {scrollIntoView} from 'react-aria/private/utils/scrollIntoView';\nimport {\n Tree,\n TreeHeader,\n TreeHeaderProps,\n TreeItem,\n TreeItemContent,\n TreeItemContentRenderProps,\n TreeItemProps,\n TreeItemRenderProps,\n TreeProps,\n TreeRenderProps,\n TreeSection,\n TreeSectionProps\n} from './Tree';\nimport {TreeState} from 'react-stately/useTreeState';\nimport {useObjectRef} from 'react-aria/useObjectRef';\n\nexport const NavigationTreeContext =\n createContext<ContextValue<NavigationTreeProps<any>, HTMLDivElement>>(null);\n\ninterface InternalNavigationTreeContextValue {\n /** The route that is currently selected. */\n selectedRoute?: string | null;\n /** The last route the focused key was synced to; dedupes the focus sync across items. */\n syncedRouteRef?: RefObject<string | undefined>;\n /** The NavigationTree's root element, used to keep current-route scrolling inside the tree. */\n treeRef?: RefObject<HTMLDivElement | null>;\n}\nconst InternalNavigationTreeContext = createContext<InternalNavigationTreeContextValue>({});\n\ninterface NavigationTreeItemLinkContextValue {\n href?: string;\n hrefLang?: string;\n target?: string;\n rel?: string;\n download?: string | boolean;\n ping?: string;\n referrerPolicy?: ReferrerPolicy;\n routerOptions?: RouterOptions;\n isCurrent?: boolean;\n // Whether the item's link (as opposed to another focusable child such as a button) is focused.\n isLinkFocused?: boolean;\n setLinkFocused?: (isFocused: boolean) => void;\n}\nconst NavigationTreeItemLinkContext = createContext<NavigationTreeItemLinkContextValue>({});\n\nexport const NavigationTreeItemStateContext = createContext<{isCurrentAncestor: boolean}>({\n isCurrentAncestor: false\n});\n\nexport interface NavigationTreeRenderProps extends Pick<\n TreeRenderProps,\n 'isEmpty' | 'isFocused' | 'isFocusVisible' | 'state'\n> {}\n\nexport interface NavigationTreeProps<T>\n extends\n Omit<\n TreeProps<T>,\n | 'selectionMode'\n | 'selectionBehavior'\n | 'selectedKeys'\n | 'defaultSelectedKeys'\n | 'onSelectionChange'\n | 'disallowEmptySelection'\n | 'disabledBehavior'\n | 'keyboardNavigationBehavior'\n | 'escapeKeyBehavior'\n | 'shouldSelectOnPressUp'\n | 'dragAndDropHooks'\n | 'renderEmptyState'\n | 'onAction'\n | 'className'\n | 'style'\n | 'render'\n >,\n StyleRenderProps<NavigationTreeRenderProps> {\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-NavigationTree'\n */\n className?: ClassNameOrFunction<NavigationTreeRenderProps>;\n /** The route that is currently selected, matched against each item's `href`. */\n selectedRoute?: string | null;\n}\n\n/**\n * A NavigationTree provides users with a way to navigate a nested, hierarchical set of links.\n */\nexport const NavigationTree = /*#__PURE__*/ (forwardRef as forwardRefType)(function NavigationTree<\n T\n>(props: NavigationTreeProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, NavigationTreeContext);\n let {className, style, children, selectedRoute, ...rest} = props;\n let syncedRouteRef = useRef<string | undefined>(undefined);\n let treeRef = useObjectRef(ref);\n let context = useMemo(() => ({selectedRoute, syncedRouteRef, treeRef}), [selectedRoute, treeRef]);\n\n return (\n <InternalNavigationTreeContext.Provider value={context}>\n <Tree\n {...rest}\n ref={treeRef}\n className={className ?? 'react-aria-NavigationTree'}\n style={style}\n selectionMode=\"none\"\n keyboardNavigationBehavior=\"tab\">\n {children}\n </Tree>\n </InternalNavigationTreeContext.Provider>\n );\n});\n\nexport interface NavigationTreeItemRenderProps extends TreeItemRenderProps {\n /**\n * Whether this item is the current route (its `href` matches the NavigationTree's\n * `selectedRoute`).\n *\n * @selector [data-current]\n */\n isCurrent: boolean;\n /**\n * Whether this item is an ancestor of the current-route item (at any level, regardless of whether\n * it is expanded or collapsed).\n *\n * @selector [data-current-ancestor]\n */\n isCurrentAncestor: boolean;\n}\n\nexport interface NavigationTreeItemProps<T = object>\n extends\n Omit<\n TreeItemProps<T>,\n | 'className'\n | 'style'\n | 'render'\n | 'onAction'\n | 'allowsArrowNavigation'\n | 'focusMode'\n | 'value'\n >,\n StyleRenderProps<NavigationTreeItemRenderProps> {\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-NavigationTreeItem'\n */\n className?: ClassNameOrFunction<NavigationTreeItemRenderProps>;\n /**\n * The content of the side nav item along with any nested children. Supports static nested side\n * nav items or use of a Collection to dynamically render nested side nav items.\n */\n children: ReactNode;\n}\n\n/**\n * A NavigationTreeItem represents an individual item in a NavigationTree.\n */\nexport const NavigationTreeItem = /*#__PURE__*/ (forwardRef as forwardRefType)(\n function NavigationTreeItem<T extends object>(\n props: NavigationTreeItemProps<T>,\n ref: ForwardedRef<HTMLDivElement>\n ) {\n let {\n href,\n hrefLang,\n target,\n rel,\n download,\n ping,\n referrerPolicy,\n routerOptions,\n className,\n style,\n render,\n ...rest\n } = props;\n let {selectedRoute, treeRef} = useContext(InternalNavigationTreeContext);\n let hasLink = href != null && href.length > 0;\n let isCurrent = hasLink && href === selectedRoute;\n let [isLinkFocused, setLinkFocused] = useState(false);\n // Additional render props NavigationTreeItem adds to what TreeItem already provides.\n let getItemRenderProps = <R extends TreeItemRenderProps>(\n renderProps: R\n ): R & {isCurrent: boolean; isCurrentAncestor: boolean} => ({\n ...renderProps,\n isCurrent,\n isCurrentAncestor: hasSelectedDescendant(renderProps.id, renderProps.state, selectedRoute),\n isFocusVisible:\n renderProps.isFocusVisible || (renderProps.isFocusVisibleWithin && isLinkFocused)\n });\n\n let objRef = useObjectRef(ref);\n useEffect(() => {\n if (isCurrent && objRef.current) {\n let scrollParent = getScrollParent(objRef.current, true) as HTMLElement;\n // Only scroll the tree's own scroll container into view — never an outer ancestor such as the\n // page. When the tree isn't its own scroll container the nearest scroll parent is outside the\n // tree, so we skip rather than hijack the surrounding scroll position.\n let treeRoot = treeRef?.current;\n if (treeRoot && nodeContains(treeRoot, scrollParent)) {\n scrollIntoView(scrollParent, objRef.current, {block: 'center'});\n }\n }\n }, [isCurrent, objRef, treeRef]);\n\n return (\n <NavigationTreeItemLinkContext.Provider\n value={{\n href,\n hrefLang,\n target,\n rel,\n download,\n ping,\n referrerPolicy,\n routerOptions,\n isCurrent,\n isLinkFocused,\n setLinkFocused\n }}>\n <TreeItem\n {...rest}\n ref={objRef}\n href={href}\n focusMode={hasLink ? 'child' : undefined}\n allowsArrowNavigation\n data-current={isCurrent || undefined}\n className={\n typeof className === 'function'\n ? renderProps => className(getItemRenderProps(renderProps))\n : (className ?? 'react-aria-NavigationTreeItem')\n }\n style={\n typeof style === 'function'\n ? renderProps => style(getItemRenderProps(renderProps))\n : style\n }\n render={(domProps, renderProps) => {\n let values = getItemRenderProps(renderProps);\n let {children: rowChildren, ...domRest} = domProps;\n let dataProps = {\n 'data-focus-visible': values.isFocusVisible || undefined,\n 'data-current-ancestor': values.isCurrentAncestor || undefined\n };\n let content = (\n <NavigationTreeItemStateContext.Provider\n value={{isCurrentAncestor: values.isCurrentAncestor}}>\n {rowChildren}\n </NavigationTreeItemStateContext.Provider>\n );\n return typeof render === 'function' ? (\n render({...domRest, ...dataProps, children: content}, values)\n ) : (\n <dom.div {...domRest} {...dataProps}>\n {content}\n </dom.div>\n );\n }}\n />\n </NavigationTreeItemLinkContext.Provider>\n );\n }\n);\n\nexport interface NavigationTreeItemContentRenderProps extends NavigationTreeItemRenderProps {}\n\nexport interface NavigationTreeItemContentProps {\n /**\n * The children of the component. A function may be provided to alter the children based on\n * component state.\n */\n children: ChildrenOrFunction<NavigationTreeItemContentRenderProps>;\n}\n\n// The collection key of the item whose href matches `route`, or null.\nfunction findKeyForRoute(collection: Collection<Node<unknown>>, route: string): Key | null {\n for (let key of collection.getKeys()) {\n if (collection.getItem(key)?.props?.href === route) {\n return key;\n }\n }\n return null;\n}\n\n// Walks up from `key` to the closest ancestor that is actually rendered (all ancestors expanded).\n// Returns `key` unchanged when already visible. A collapsed ancestor hides everything beneath it,\n// so the highest collapsed ancestor is the closest visible row.\nfunction closestVisibleKey(\n collection: Collection<Node<unknown>>,\n expandedKeys: Set<Key>,\n key: Key\n): Key {\n let target = key;\n let node = collection.getItem(key);\n while (node?.parentKey != null) {\n let parent = collection.getItem(node.parentKey);\n if (parent?.type === 'item' && !expandedKeys.has(node.parentKey)) {\n target = node.parentKey;\n }\n node = parent;\n }\n return target;\n}\n\n// Moves the tree's focused key to the item matching selectedRoute. Runs when the route or the\n// collection changes; the shared syncedRouteRef dedupes across items so it fires once per change.\nfunction useRouteFocusSync({state}: {state: TreeState<unknown>}): void {\n let {selectedRoute, syncedRouteRef} = useContext(InternalNavigationTreeContext);\n let {collection, selectionManager, expandedKeys} = state;\n useEffect(() => {\n if (\n selectedRoute == null ||\n syncedRouteRef == null ||\n syncedRouteRef.current === selectedRoute\n ) {\n return;\n }\n let key = findKeyForRoute(collection, selectedRoute);\n if (key != null) {\n key = closestVisibleKey(collection, expandedKeys, key);\n syncedRouteRef.current = selectedRoute;\n selectionManager.setFocusedKey(key);\n }\n }, [selectedRoute, collection, expandedKeys, syncedRouteRef, selectionManager]);\n}\n\n// Cache so each row doesn't have to walk up the tree every time.\nlet selectedAncestorsCache = new WeakMap<\n Collection<Node<unknown>>,\n {selection: unknown; ancestors: Set<Key>}\n>();\n\n// The set of collection keys that are ancestors of the item matching `selectedRoute`.\nfunction getSelectedAncestors(state: TreeState<unknown>, selectedRoute: string): Set<Key> {\n let {collection} = state;\n let cached = selectedAncestorsCache.get(collection);\n if (cached && cached.selection === selectedRoute) {\n return cached.ancestors;\n }\n let matchKey = findKeyForRoute(collection, selectedRoute);\n let ancestors = new Set<Key>();\n let node = matchKey != null ? collection.getItem(matchKey) : null;\n while (node?.parentKey != null && !ancestors.has(node.parentKey)) {\n ancestors.add(node.parentKey);\n node = collection.getItem(node.parentKey);\n }\n selectedAncestorsCache.set(collection, {selection: selectedRoute, ancestors});\n return ancestors;\n}\n\n// Whether the row `id` is an ancestor of the item matching `selectedRoute`.\nfunction hasSelectedDescendant(\n id: Key | undefined,\n state: TreeState<unknown>,\n selectedRoute: string | undefined | null\n): boolean {\n if (id == null || selectedRoute == null || !state) {\n return false;\n }\n return getSelectedAncestors(state, selectedRoute).has(id);\n}\n\nexport function NavigationTreeItemContent(props: NavigationTreeItemContentProps): ReactNode {\n let linkCtx = useContext(NavigationTreeItemLinkContext);\n return (\n <TreeItemContent {...props}>\n {(treeRenderProps: TreeItemContentRenderProps & {defaultChildren: ReactNode | undefined}) => (\n <NavigationTreeItemContentInner\n treeRenderProps={treeRenderProps}\n linkCtx={linkCtx}\n children={props.children}\n />\n )}\n </TreeItemContent>\n );\n}\n\ninterface NavigationTreeItemContentInnerProps {\n treeRenderProps: TreeItemContentRenderProps & {defaultChildren: ReactNode | undefined};\n linkCtx: NavigationTreeItemLinkContextValue;\n children: ChildrenOrFunction<NavigationTreeItemContentRenderProps>;\n}\n\nfunction NavigationTreeItemContentInner(props: NavigationTreeItemContentInnerProps): ReactNode {\n let {treeRenderProps, linkCtx, children} = props;\n let {isCurrent, isLinkFocused, setLinkFocused, ...linkProps} = linkCtx;\n let {state, isFocusVisible, isFocusVisibleWithin, id, hasChildItems} = treeRenderProps;\n let {isCurrentAncestor} = useContext(NavigationTreeItemStateContext);\n\n useRouteFocusSync({state});\n\n // isFocusVisible follows the link: true when the row itself is keyboard focused, or when a child\n // is keyboard focused and that child is the link (not another button/action).\n let linkFocusVisible = isFocusVisible || (isFocusVisibleWithin && !!isLinkFocused);\n let values: NavigationTreeItemContentRenderProps & {defaultChildren: ReactNode | undefined} = {\n ...treeRenderProps,\n isCurrent: !!isCurrent,\n isCurrentAncestor,\n isFocusVisible: linkFocusVisible\n };\n let renderChildren = typeof children === 'function' ? children(values) : children;\n // Provide onFocusChange so the link reports its focus up to NavigationTreeItem.\n let linkContextValue = {\n ...linkProps,\n 'aria-current': isCurrent ? 'page' : undefined,\n onFocusChange: setLinkFocused,\n onPress: linkProps.href == null && hasChildItems ? () => state.toggleKey(id) : undefined\n };\n return <Provider values={[[LinkContext, linkContextValue]]}>{renderChildren}</Provider>;\n}\n\nexport interface NavigationTreeSectionProps<T> extends Omit<TreeSectionProps<T>, 'value'> {}\n\n/**\n * A NavigationTreeSection represents a section within a NavigationTree.\n */\nexport function NavigationTreeSection<T extends object>(\n props: NavigationTreeSectionProps<T>\n): ReactNode {\n return (\n <TreeSection className=\"react-aria-NavigationTreeSection\" {...props}>\n {props.children}\n </TreeSection>\n );\n}\n\nexport interface NavigationTreeHeaderProps extends TreeHeaderProps {}\n\n/**\n * A NavigationTreeHeader renders the header of a NavigationTreeSection.\n */\nexport function NavigationTreeHeader(props: NavigationTreeHeaderProps): ReactNode {\n return (\n <TreeHeader className=\"react-aria-NavigationTreeHeader\" {...props}>\n {props.children}\n </TreeHeader>\n );\n}\n"],"names":[],"version":3,"file":"NavigationTree.cjs.map"}