@depup/react-aria-components 1.19.0-depup.27 → 1.20.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 (257) hide show
  1. package/PreviewTrigger/package.json +5 -0
  2. package/README.md +2 -2
  3. package/TokenField/package.json +5 -0
  4. package/changes.json +1 -1
  5. package/dist/exports/GridList.cjs.map +1 -1
  6. package/dist/exports/GridList.js.map +1 -1
  7. package/dist/exports/GridList.mjs.map +1 -1
  8. package/dist/exports/PreviewTrigger.cjs +26 -0
  9. package/dist/exports/PreviewTrigger.cjs.map +1 -0
  10. package/dist/exports/PreviewTrigger.js +21 -0
  11. package/dist/exports/PreviewTrigger.js.map +1 -0
  12. package/dist/exports/PreviewTrigger.mjs +21 -0
  13. package/dist/exports/PreviewTrigger.mjs.map +1 -0
  14. package/dist/exports/TokenField.cjs +31 -0
  15. package/dist/exports/TokenField.cjs.map +1 -0
  16. package/dist/exports/TokenField.js +21 -0
  17. package/dist/exports/TokenField.js.map +1 -0
  18. package/dist/exports/TokenField.mjs +21 -0
  19. package/dist/exports/TokenField.mjs.map +1 -0
  20. package/dist/exports/Tree.cjs.map +1 -1
  21. package/dist/exports/Tree.js.map +1 -1
  22. package/dist/exports/Tree.mjs.map +1 -1
  23. package/dist/exports/index.cjs +12 -0
  24. package/dist/exports/index.cjs.map +1 -1
  25. package/dist/exports/index.js +7 -1
  26. package/dist/exports/index.js.map +1 -1
  27. package/dist/exports/index.mjs +7 -1
  28. package/dist/exports/index.mjs.map +1 -1
  29. package/dist/private/Checkbox.cjs.map +1 -1
  30. package/dist/private/Checkbox.js.map +1 -1
  31. package/dist/private/Checkbox.mjs.map +1 -1
  32. package/dist/private/ComboBox.cjs +21 -2
  33. package/dist/private/ComboBox.cjs.map +1 -1
  34. package/dist/private/ComboBox.js +21 -2
  35. package/dist/private/ComboBox.js.map +1 -1
  36. package/dist/private/ComboBox.mjs +21 -2
  37. package/dist/private/ComboBox.mjs.map +1 -1
  38. package/dist/private/Dialog.cjs +15 -1
  39. package/dist/private/Dialog.cjs.map +1 -1
  40. package/dist/private/Dialog.js +15 -1
  41. package/dist/private/Dialog.js.map +1 -1
  42. package/dist/private/Dialog.mjs +15 -1
  43. package/dist/private/Dialog.mjs.map +1 -1
  44. package/dist/private/DragAndDrop.cjs +1 -0
  45. package/dist/private/DragAndDrop.cjs.map +1 -1
  46. package/dist/private/DragAndDrop.js +1 -0
  47. package/dist/private/DragAndDrop.js.map +1 -1
  48. package/dist/private/DragAndDrop.mjs +1 -0
  49. package/dist/private/DragAndDrop.mjs.map +1 -1
  50. package/dist/private/DropZone.cjs +5 -2
  51. package/dist/private/DropZone.cjs.map +1 -1
  52. package/dist/private/DropZone.js +5 -3
  53. package/dist/private/DropZone.js.map +1 -1
  54. package/dist/private/DropZone.mjs +5 -2
  55. package/dist/private/DropZone.mjs.map +1 -1
  56. package/dist/private/FileTrigger.cjs +1 -0
  57. package/dist/private/FileTrigger.cjs.map +1 -1
  58. package/dist/private/FileTrigger.js +1 -0
  59. package/dist/private/FileTrigger.js.map +1 -1
  60. package/dist/private/FileTrigger.mjs +1 -0
  61. package/dist/private/FileTrigger.mjs.map +1 -1
  62. package/dist/private/GridLayout.cjs +3 -1
  63. package/dist/private/GridLayout.cjs.map +1 -1
  64. package/dist/private/GridLayout.js +3 -1
  65. package/dist/private/GridLayout.js.map +1 -1
  66. package/dist/private/GridLayout.mjs +3 -1
  67. package/dist/private/GridLayout.mjs.map +1 -1
  68. package/dist/private/GridList.cjs +12 -1
  69. package/dist/private/GridList.cjs.map +1 -1
  70. package/dist/private/GridList.js +12 -1
  71. package/dist/private/GridList.js.map +1 -1
  72. package/dist/private/GridList.mjs +12 -1
  73. package/dist/private/GridList.mjs.map +1 -1
  74. package/dist/private/ListBox.cjs +9 -1
  75. package/dist/private/ListBox.cjs.map +1 -1
  76. package/dist/private/ListBox.js +9 -1
  77. package/dist/private/ListBox.js.map +1 -1
  78. package/dist/private/ListBox.mjs +9 -1
  79. package/dist/private/ListBox.mjs.map +1 -1
  80. package/dist/private/Menu.cjs +4 -2
  81. package/dist/private/Menu.cjs.map +1 -1
  82. package/dist/private/Menu.js +4 -2
  83. package/dist/private/Menu.js.map +1 -1
  84. package/dist/private/Menu.mjs +4 -2
  85. package/dist/private/Menu.mjs.map +1 -1
  86. package/dist/private/Meter.cjs +2 -1
  87. package/dist/private/Meter.cjs.map +1 -1
  88. package/dist/private/Meter.js +2 -1
  89. package/dist/private/Meter.js.map +1 -1
  90. package/dist/private/Meter.mjs +2 -1
  91. package/dist/private/Meter.mjs.map +1 -1
  92. package/dist/private/Modal.cjs +2 -0
  93. package/dist/private/Modal.cjs.map +1 -1
  94. package/dist/private/Modal.js +2 -0
  95. package/dist/private/Modal.js.map +1 -1
  96. package/dist/private/Modal.mjs +2 -0
  97. package/dist/private/Modal.mjs.map +1 -1
  98. package/dist/private/Popover.cjs +34 -9
  99. package/dist/private/Popover.cjs.map +1 -1
  100. package/dist/private/Popover.js +34 -9
  101. package/dist/private/Popover.js.map +1 -1
  102. package/dist/private/Popover.mjs +34 -9
  103. package/dist/private/Popover.mjs.map +1 -1
  104. package/dist/private/PreviewTrigger.cjs +88 -0
  105. package/dist/private/PreviewTrigger.cjs.map +1 -0
  106. package/dist/private/PreviewTrigger.js +80 -0
  107. package/dist/private/PreviewTrigger.js.map +1 -0
  108. package/dist/private/PreviewTrigger.mjs +79 -0
  109. package/dist/private/PreviewTrigger.mjs.map +1 -0
  110. package/dist/private/ProgressBar.cjs +6 -1
  111. package/dist/private/ProgressBar.cjs.map +1 -1
  112. package/dist/private/ProgressBar.js +6 -1
  113. package/dist/private/ProgressBar.js.map +1 -1
  114. package/dist/private/ProgressBar.mjs +6 -1
  115. package/dist/private/ProgressBar.mjs.map +1 -1
  116. package/dist/private/Select.cjs.map +1 -1
  117. package/dist/private/Select.js.map +1 -1
  118. package/dist/private/Select.mjs.map +1 -1
  119. package/dist/private/Table.cjs +26 -14
  120. package/dist/private/Table.cjs.map +1 -1
  121. package/dist/private/Table.js +26 -14
  122. package/dist/private/Table.js.map +1 -1
  123. package/dist/private/Table.mjs +26 -14
  124. package/dist/private/Table.mjs.map +1 -1
  125. package/dist/private/TableLayout.cjs +3 -1
  126. package/dist/private/TableLayout.cjs.map +1 -1
  127. package/dist/private/TableLayout.js +3 -1
  128. package/dist/private/TableLayout.js.map +1 -1
  129. package/dist/private/TableLayout.mjs +3 -1
  130. package/dist/private/TableLayout.mjs.map +1 -1
  131. package/dist/private/TagGroup.cjs +1 -0
  132. package/dist/private/TagGroup.cjs.map +1 -1
  133. package/dist/private/TagGroup.js +1 -0
  134. package/dist/private/TagGroup.js.map +1 -1
  135. package/dist/private/TagGroup.mjs +1 -0
  136. package/dist/private/TagGroup.mjs.map +1 -1
  137. package/dist/private/ToggleButton.cjs.map +1 -1
  138. package/dist/private/ToggleButton.js.map +1 -1
  139. package/dist/private/ToggleButton.mjs.map +1 -1
  140. package/dist/private/TokenField.cjs +207 -0
  141. package/dist/private/TokenField.cjs.map +1 -0
  142. package/dist/private/TokenField.js +197 -0
  143. package/dist/private/TokenField.js.map +1 -0
  144. package/dist/private/TokenField.mjs +195 -0
  145. package/dist/private/TokenField.mjs.map +1 -0
  146. package/dist/private/Tooltip.cjs +10 -2
  147. package/dist/private/Tooltip.cjs.map +1 -1
  148. package/dist/private/Tooltip.js +10 -2
  149. package/dist/private/Tooltip.js.map +1 -1
  150. package/dist/private/Tooltip.mjs +10 -2
  151. package/dist/private/Tooltip.mjs.map +1 -1
  152. package/dist/private/Tree.cjs +11 -1
  153. package/dist/private/Tree.cjs.map +1 -1
  154. package/dist/private/Tree.js +11 -1
  155. package/dist/private/Tree.js.map +1 -1
  156. package/dist/private/Tree.mjs +11 -1
  157. package/dist/private/Tree.mjs.map +1 -1
  158. package/dist/private/Virtualizer.cjs +18 -16
  159. package/dist/private/Virtualizer.cjs.map +1 -1
  160. package/dist/private/Virtualizer.js +18 -16
  161. package/dist/private/Virtualizer.js.map +1 -1
  162. package/dist/private/Virtualizer.mjs +18 -16
  163. package/dist/private/Virtualizer.mjs.map +1 -1
  164. package/dist/private/useDragAndDrop.cjs +7 -0
  165. package/dist/private/useDragAndDrop.cjs.map +1 -1
  166. package/dist/private/useDragAndDrop.js +7 -0
  167. package/dist/private/useDragAndDrop.js.map +1 -1
  168. package/dist/private/useDragAndDrop.mjs +7 -0
  169. package/dist/private/useDragAndDrop.mjs.map +1 -1
  170. package/dist/private/utils.cjs.map +1 -1
  171. package/dist/private/utils.js.map +1 -1
  172. package/dist/private/utils.mjs.map +1 -1
  173. package/dist/types/exports/GridList.d.ts +1 -1
  174. package/dist/types/exports/PreviewTrigger.d.ts +3 -0
  175. package/dist/types/exports/TokenField.d.ts +5 -0
  176. package/dist/types/exports/Tree.d.ts +1 -1
  177. package/dist/types/exports/index.d.ts +7 -2
  178. package/dist/types/src/ComboBox.d.ts +4 -1
  179. package/dist/types/src/GridList.d.ts +12 -1
  180. package/dist/types/src/ListBox.d.ts +1 -1
  181. package/dist/types/src/Popover.d.ts +7 -0
  182. package/dist/types/src/PreviewTrigger.d.ts +23 -0
  183. package/dist/types/src/Select.d.ts +1 -1
  184. package/dist/types/src/Table.d.ts +24 -0
  185. package/dist/types/src/TokenField.d.ts +111 -0
  186. package/dist/types/src/Tree.d.ts +7 -5
  187. package/dist/types/src/Virtualizer.d.ts +4 -0
  188. package/dist/types/src/utils.d.ts +19 -5
  189. package/i18n/ar-AE.js +1 -1
  190. package/i18n/ar-AE.mjs +1 -1
  191. package/i18n/bg-BG.js +1 -1
  192. package/i18n/bg-BG.mjs +1 -1
  193. package/i18n/cs-CZ.js +1 -1
  194. package/i18n/cs-CZ.mjs +1 -1
  195. package/i18n/da-DK.js +1 -1
  196. package/i18n/da-DK.mjs +1 -1
  197. package/i18n/de-DE.js +1 -1
  198. package/i18n/de-DE.mjs +1 -1
  199. package/i18n/el-GR.js +1 -1
  200. package/i18n/el-GR.mjs +1 -1
  201. package/i18n/en-US.js +1 -1
  202. package/i18n/en-US.mjs +1 -1
  203. package/i18n/es-ES.js +1 -1
  204. package/i18n/es-ES.mjs +1 -1
  205. package/i18n/et-EE.js +1 -1
  206. package/i18n/et-EE.mjs +1 -1
  207. package/i18n/fi-FI.js +1 -1
  208. package/i18n/fi-FI.mjs +1 -1
  209. package/i18n/fr-FR.js +1 -1
  210. package/i18n/fr-FR.mjs +1 -1
  211. package/i18n/he-IL.js +1 -1
  212. package/i18n/he-IL.mjs +1 -1
  213. package/i18n/hr-HR.js +1 -1
  214. package/i18n/hr-HR.mjs +1 -1
  215. package/i18n/hu-HU.js +1 -1
  216. package/i18n/hu-HU.mjs +1 -1
  217. package/i18n/it-IT.js +1 -1
  218. package/i18n/it-IT.mjs +1 -1
  219. package/i18n/ja-JP.js +1 -1
  220. package/i18n/ja-JP.mjs +1 -1
  221. package/i18n/ko-KR.js +1 -1
  222. package/i18n/ko-KR.mjs +1 -1
  223. package/i18n/lt-LT.js +1 -1
  224. package/i18n/lt-LT.mjs +1 -1
  225. package/i18n/lv-LV.js +1 -1
  226. package/i18n/lv-LV.mjs +1 -1
  227. package/i18n/nb-NO.js +1 -1
  228. package/i18n/nb-NO.mjs +1 -1
  229. package/i18n/nl-NL.js +1 -1
  230. package/i18n/nl-NL.mjs +1 -1
  231. package/i18n/pl-PL.js +1 -1
  232. package/i18n/pl-PL.mjs +1 -1
  233. package/i18n/pt-BR.js +1 -1
  234. package/i18n/pt-BR.mjs +1 -1
  235. package/i18n/pt-PT.js +1 -1
  236. package/i18n/pt-PT.mjs +1 -1
  237. package/i18n/ro-RO.js +1 -1
  238. package/i18n/ro-RO.mjs +1 -1
  239. package/i18n/ru-RU.js +1 -1
  240. package/i18n/ru-RU.mjs +1 -1
  241. package/i18n/sk-SK.js +1 -1
  242. package/i18n/sk-SK.mjs +1 -1
  243. package/i18n/sl-SI.js +1 -1
  244. package/i18n/sl-SI.mjs +1 -1
  245. package/i18n/sr-SP.js +1 -1
  246. package/i18n/sr-SP.mjs +1 -1
  247. package/i18n/sv-SE.js +1 -1
  248. package/i18n/sv-SE.mjs +1 -1
  249. package/i18n/tr-TR.js +1 -1
  250. package/i18n/tr-TR.mjs +1 -1
  251. package/i18n/uk-UA.js +1 -1
  252. package/i18n/uk-UA.mjs +1 -1
  253. package/i18n/zh-CN.js +1 -1
  254. package/i18n/zh-CN.mjs +1 -1
  255. package/i18n/zh-TW.js +1 -1
  256. package/i18n/zh-TW.mjs +1 -1
  257. package/package.json +32 -31
@@ -103,7 +103,8 @@ function $113aa0613e727c6c$export$27d2ad3c5815583e(props) {
103
103
  triggerRef: ref,
104
104
  scrollRef: scrollRef,
105
105
  placement: 'bottom start',
106
- 'aria-labelledby': menuProps['aria-labelledby']
106
+ 'aria-labelledby': menuProps['aria-labelledby'],
107
+ offset: props.trigger === 'contextMenu' ? 0 : undefined
107
108
  }
108
109
  ]
109
110
  ]
@@ -277,7 +278,8 @@ function $113aa0613e727c6c$var$MenuInner({ props: props, collection: collection,
277
278
  $113aa0613e727c6c$var$SelectionManagerContext,
278
279
  state.selectionManager
279
280
  ],
280
- /* Ensure root MenuTriggerState is defined, in case Menu is rendered outside a MenuTrigger. */ /* We assume the context can never change between defined and undefined. */ /* eslint-disable-next-line react-hooks/rules-of-hooks */ [
281
+ /* Ensure root MenuTriggerState is defined, in case Menu is rendered outside a MenuTrigger. */ /* We assume the context can never change between defined and undefined. */ // oxlint-disable-next-line react/react-compiler, react-hooks/rules-of-hooks
282
+ [
281
283
  $113aa0613e727c6c$export$795aec4671cbae19,
282
284
  triggerState !== null && triggerState !== void 0 ? triggerState : (0, $gKmcL$useMenuTriggerState)({})
283
285
  ]
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqGM,MAAM,0DAAc,CAAA,GAAA,oBAAY,EAAgD;AAChF,MAAM,0DAAmB,CAAA,GAAA,oBAAY,EAAyB;AAC9D,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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 }\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.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqGM,MAAM,0DAAc,CAAA,GAAA,oBAAY,EAAgD;AAChF,MAAM,0DAAmB,CAAA,GAAA,oBAAY,EAAyB;AAC9D,MAAM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W;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.js.map"}
@@ -103,7 +103,8 @@ function $49319ee1285aa241$export$27d2ad3c5815583e(props) {
103
103
  triggerRef: ref,
104
104
  scrollRef: scrollRef,
105
105
  placement: 'bottom start',
106
- 'aria-labelledby': menuProps['aria-labelledby']
106
+ 'aria-labelledby': menuProps['aria-labelledby'],
107
+ offset: props.trigger === 'contextMenu' ? 0 : undefined
107
108
  }
108
109
  ]
109
110
  ]
@@ -279,7 +280,8 @@ function $49319ee1285aa241$var$MenuInner({ props: props, collection: collection,
279
280
  $49319ee1285aa241$var$SelectionManagerContext,
280
281
  state.selectionManager
281
282
  ],
282
- /* Ensure root MenuTriggerState is defined, in case Menu is rendered outside a MenuTrigger. */ /* We assume the context can never change between defined and undefined. */ /* eslint-disable-next-line react-hooks/rules-of-hooks */ [
283
+ /* Ensure root MenuTriggerState is defined, in case Menu is rendered outside a MenuTrigger. */ /* We assume the context can never change between defined and undefined. */ // oxlint-disable-next-line react/react-compiler, react-hooks/rules-of-hooks
284
+ [
283
285
  $49319ee1285aa241$export$795aec4671cbae19,
284
286
  triggerState ?? (0, $7xe5e$useMenuTriggerState)({})
285
287
  ]
@@ -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,IAA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AiB,aAAa;YAC7C,mBAAmB,iBAAiB,iBAAiB;YACrD,YAAY,CAAC,CAAC,KAAK,CAAC,gBAAgB;YACpC,QAAQ,KAAK,CAAC,gBAAgB,KAAK;QACrC;IACF;IAEA,IAAI,cAAc,MAAM,IAAI,GAAG,CAAA,GAAA,yCAAE,EAAE,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 }\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.mjs.map"}
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;oBACE,SAAS;oBACT,YAAY;+BACZ;oBACA,WAAW;oBACX,mBAAmB,SAAS,C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AAW,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"}
@@ -39,13 +39,14 @@ const $54e83bc7920648be$export$62e3ae2a4090b879 = /*#__PURE__*/ (0, $9PgQQ$react
39
39
  [props, ref] = (0, $048d76b84370f141$exports.useContextProps)(props, ref, $54e83bc7920648be$export$8b645da15a96b44f);
40
40
  let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100 } = props;
41
41
  value = (0, $9PgQQ$reactstatelyprivateutilsnumber.clamp)(value, minValue, maxValue);
42
+ let range = maxValue - minValue;
42
43
  let [labelRef, label] = (0, $048d76b84370f141$exports.useSlot)(!props['aria-label'] && !props['aria-labelledby']);
43
44
  let { meterProps: meterProps, labelProps: labelProps } = (0, $9PgQQ$reactariauseMeter.useMeter)({
44
45
  ...props,
45
46
  label: label
46
47
  });
47
48
  // Calculate the width of the progress bar as a percentage
48
- let percentage = (value - minValue) / (maxValue - minValue) * 100;
49
+ let percentage = range === 0 ? 0 : (value - minValue) / range * 100;
49
50
  let renderProps = (0, $048d76b84370f141$exports.useRenderProps)({
50
51
  ...props,
51
52
  defaultClassName: 'react-aria-Meter',
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAiDM,MAAM,0DAAe,CAAA,GAAA,0BAAY,EAA4C;AAK7E,MAAM,4CAAsB,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB,SAAS,MACzE,KAAiB,EACjB,GAAiC;IAEjC,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,SAAC,QAAQ,aAAG,WAAW,aAAG,WAAW,KAAI,GAAG;IAChD,QAAQ,CAAA,GAAA,2CAAI,EAAE,OAAO,UAAU;IAE/B,IAAI,CAAC,UAAU,MAAM,GAAG,CAAA,GAAA,iCAAM,EAAE,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,kBAAkB;IACjF,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,iCAAO,EAAE;QAAC,GAAG,KAAK;eAAE;IAAK;IAExD,0DAA0D;IAC1D,IAAI,aAAa,AAAE,CAAA,QAAQ,QAAO,IAAM,CAAA,WAAW,QAAO,IAAM;IAEhE,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;wBACN;YACA,WAAW,UAAU,CAAC,iBAAiB;QACzC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,6CAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAElD,qBACE,0DAAC,CAAA,GAAA,6BAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,qCAAS,EAAE,UAAU,aAAa,WAAW;QACjD,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;qBACpB,0DAAC,CAAA,GAAA,sCAAW,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;YAAE,KAAK;YAAU,aAAa;QAAM;OAC7E,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Meter.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 {AriaMeterProps, useMeter} from 'react-aria/useMeter';\n\nimport {clamp} from 'react-stately/private/utils/number';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps,\n useSlot\n} from './utils';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {createContext, ForwardedRef, forwardRef} from 'react';\n\nexport interface MeterProps\n extends\n Omit<AriaMeterProps, 'label'>,\n RenderProps<MeterRenderProps>,\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-Meter'\n */\n className?: ClassNameOrFunction<MeterRenderProps>;\n}\n\nexport interface MeterRenderProps {\n /**\n * The value as a percentage between the minimum and maximum.\n */\n percentage: number;\n /**\n * A formatted version of the value.\n *\n * @selector [aria-valuetext]\n */\n valueText: string | undefined;\n}\n\nexport const MeterContext = createContext<ContextValue<MeterProps, HTMLDivElement>>(null);\n\n/**\n * A meter represents a quantity within a known range, or a fractional value.\n */\nexport const Meter = /*#__PURE__*/ (forwardRef as forwardRefType)(function Meter(\n props: MeterProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n [props, ref] = useContextProps(props, ref, MeterContext);\n let {value = 0, minValue = 0, maxValue = 100} = props;\n value = clamp(value, minValue, maxValue);\n\n let [labelRef, label] = useSlot(!props['aria-label'] && !props['aria-labelledby']);\n let {meterProps, labelProps} = useMeter({...props, label});\n\n // Calculate the width of the progress bar as a percentage\n let percentage = ((value - minValue) / (maxValue - minValue)) * 100;\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Meter',\n values: {\n percentage,\n valueText: meterProps['aria-valuetext']\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <dom.div\n {...mergeProps(DOMProps, renderProps, meterProps)}\n ref={ref}\n slot={props.slot || undefined}>\n <LabelContext.Provider value={{...labelProps, ref: labelRef, elementType: 'span'}}>\n {renderProps.children}\n </LabelContext.Provider>\n </dom.div>\n );\n});\n"],"names":[],"version":3,"file":"Meter.cjs.map"}
1
+ {"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.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 {AriaMeterProps, useMeter} from 'react-aria/useMeter';\nimport {clamp} from 'react-stately/private/utils/number';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps,\n useSlot\n} from './utils';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {createContext, ForwardedRef, forwardRef} from 'react';\n\nexport interface MeterProps\n extends\n Omit<AriaMeterProps, 'label'>,\n RenderProps<MeterRenderProps>,\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-Meter'\n */\n className?: ClassNameOrFunction<MeterRenderProps>;\n}\n\nexport interface MeterRenderProps {\n /**\n * The value as a percentage between the minimum and maximum.\n */\n percentage: number;\n /**\n * A formatted version of the value.\n *\n * @selector [aria-valuetext]\n */\n valueText: string | undefined;\n}\n\nexport const MeterContext = createContext<ContextValue<MeterProps, HTMLDivElement>>(null);\n\n/**\n * A meter represents a quantity within a known range, or a fractional value.\n */\nexport const Meter = /*#__PURE__*/ (forwardRef as forwardRefType)(function Meter(\n props: MeterProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n [props, ref] = useContextProps(props, ref, MeterContext);\n let {value = 0, minValue = 0, maxValue = 100} = props;\n value = clamp(value, minValue, maxValue);\n let range = maxValue - minValue;\n\n let [labelRef, label] = useSlot(!props['aria-label'] && !props['aria-labelledby']);\n let {meterProps, labelProps} = useMeter({...props, label});\n\n // Calculate the width of the progress bar as a percentage\n let percentage = range === 0 ? 0 : ((value - minValue) / range) * 100;\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Meter',\n values: {\n percentage,\n valueText: meterProps['aria-valuetext']\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <dom.div\n {...mergeProps(DOMProps, renderProps, meterProps)}\n ref={ref}\n slot={props.slot || undefined}>\n <LabelContext.Provider value={{...labelProps, ref: labelRef, elementType: 'span'}}>\n {renderProps.children}\n </LabelContext.Provider>\n </dom.div>\n );\n});\n"],"names":[],"version":3,"file":"Meter.cjs.map"}
@@ -28,13 +28,14 @@ const $4dcc8ca510f2b96b$export$62e3ae2a4090b879 = /*#__PURE__*/ (0, $kCMGV$forwa
28
28
  [props, ref] = (0, $b7b7a92703138c9b$export$29f1550f4b0d4415)(props, ref, $4dcc8ca510f2b96b$export$8b645da15a96b44f);
29
29
  let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100 } = props;
30
30
  value = (0, $kCMGV$clamp)(value, minValue, maxValue);
31
+ let range = maxValue - minValue;
31
32
  let [labelRef, label] = (0, $b7b7a92703138c9b$export$9d4c57ee4c6ffdd8)(!props['aria-label'] && !props['aria-labelledby']);
32
33
  let { meterProps: meterProps, labelProps: labelProps } = (0, $kCMGV$useMeter)({
33
34
  ...props,
34
35
  label: label
35
36
  });
36
37
  // Calculate the width of the progress bar as a percentage
37
- let percentage = (value - minValue) / (maxValue - minValue) * 100;
38
+ let percentage = range === 0 ? 0 : (value - minValue) / range * 100;
38
39
  let renderProps = (0, $b7b7a92703138c9b$export$4d86445c2cf5e3)({
39
40
  ...props,
40
41
  defaultClassName: 'react-aria-Meter',
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;AAAA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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 {AriaMeterProps, useMeter} from 'react-aria/useMeter';\n\nimport {clamp} from 'react-stately/private/utils/number';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps,\n useSlot\n} from './utils';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {createContext, ForwardedRef, forwardRef} from 'react';\n\nexport interface MeterProps\n extends\n Omit<AriaMeterProps, 'label'>,\n RenderProps<MeterRenderProps>,\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-Meter'\n */\n className?: ClassNameOrFunction<MeterRenderProps>;\n}\n\nexport interface MeterRenderProps {\n /**\n * The value as a percentage between the minimum and maximum.\n */\n percentage: number;\n /**\n * A formatted version of the value.\n *\n * @selector [aria-valuetext]\n */\n valueText: string | undefined;\n}\n\nexport const MeterContext = createContext<ContextValue<MeterProps, HTMLDivElement>>(null);\n\n/**\n * A meter represents a quantity within a known range, or a fractional value.\n */\nexport const Meter = /*#__PURE__*/ (forwardRef as forwardRefType)(function Meter(\n props: MeterProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n [props, ref] = useContextProps(props, ref, MeterContext);\n let {value = 0, minValue = 0, maxValue = 100} = props;\n value = clamp(value, minValue, maxValue);\n\n let [labelRef, label] = useSlot(!props['aria-label'] && !props['aria-labelledby']);\n let {meterProps, labelProps} = useMeter({...props, label});\n\n // Calculate the width of the progress bar as a percentage\n let percentage = ((value - minValue) / (maxValue - minValue)) * 100;\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Meter',\n values: {\n percentage,\n valueText: meterProps['aria-valuetext']\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <dom.div\n {...mergeProps(DOMProps, renderProps, meterProps)}\n ref={ref}\n slot={props.slot || undefined}>\n <LabelContext.Provider value={{...labelProps, ref: labelRef, elementType: 'span'}}>\n {renderProps.children}\n </LabelContext.Provider>\n </dom.div>\n );\n});\n"],"names":[],"version":3,"file":"Meter.js.map"}
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAgDM,MAAM,0DAAe,CAAA,GAAA,oBAAY,EAA4C;AAK7E,MAAM,4CAAsB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,MACzE,KAAiB,EACjB,GAAiC;IAEjC,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,SAAC,QAAQ,aAAG,WAAW,aAAG,WAAW,KAAI,GAAG;IAChD,QAAQ,CAAA,GAAA,YAAI,EAAE,OAAO,UAAU;IAC/B,IAAI,QAAQ,WAAW;IAEvB,IAAI,CAAC,UAAU,MAAM,GAAG,CAAA,GAAA,yCAAM,EAAE,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,kBAAkB;IACjF,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAAC,GAAG,KAAK;eAAE;IAAK;IAExD,0DAA0D;IAC1D,IAAI,aAAa,UAAU,IAAI,IAAI,AAAE,CAAA,QAAQ,QAAO,IAAK,QAAS;IAElE,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;wBACN;YACA,WAAW,UAAU,CAAC,iBAAiB;QACzC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAElD,qBACE,gCAAC,CAAA,GAAA,yCAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,aAAa,WAAW;QACjD,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;qBACpB,gCAAC,CAAA,GAAA,yCAAW,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;YAAE,KAAK;YAAU,aAAa;QAAM;OAC7E,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Meter.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 {AriaMeterProps, useMeter} from 'react-aria/useMeter';\nimport {clamp} from 'react-stately/private/utils/number';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps,\n useSlot\n} from './utils';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {createContext, ForwardedRef, forwardRef} from 'react';\n\nexport interface MeterProps\n extends\n Omit<AriaMeterProps, 'label'>,\n RenderProps<MeterRenderProps>,\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-Meter'\n */\n className?: ClassNameOrFunction<MeterRenderProps>;\n}\n\nexport interface MeterRenderProps {\n /**\n * The value as a percentage between the minimum and maximum.\n */\n percentage: number;\n /**\n * A formatted version of the value.\n *\n * @selector [aria-valuetext]\n */\n valueText: string | undefined;\n}\n\nexport const MeterContext = createContext<ContextValue<MeterProps, HTMLDivElement>>(null);\n\n/**\n * A meter represents a quantity within a known range, or a fractional value.\n */\nexport const Meter = /*#__PURE__*/ (forwardRef as forwardRefType)(function Meter(\n props: MeterProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n [props, ref] = useContextProps(props, ref, MeterContext);\n let {value = 0, minValue = 0, maxValue = 100} = props;\n value = clamp(value, minValue, maxValue);\n let range = maxValue - minValue;\n\n let [labelRef, label] = useSlot(!props['aria-label'] && !props['aria-labelledby']);\n let {meterProps, labelProps} = useMeter({...props, label});\n\n // Calculate the width of the progress bar as a percentage\n let percentage = range === 0 ? 0 : ((value - minValue) / range) * 100;\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Meter',\n values: {\n percentage,\n valueText: meterProps['aria-valuetext']\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <dom.div\n {...mergeProps(DOMProps, renderProps, meterProps)}\n ref={ref}\n slot={props.slot || undefined}>\n <LabelContext.Provider value={{...labelProps, ref: labelRef, elementType: 'span'}}>\n {renderProps.children}\n </LabelContext.Provider>\n </dom.div>\n );\n});\n"],"names":[],"version":3,"file":"Meter.js.map"}
@@ -28,13 +28,14 @@ const $8d5785ac9f5d0f19$export$62e3ae2a4090b879 = /*#__PURE__*/ (0, $dVrrg$forwa
28
28
  [props, ref] = (0, $7230ffa83bc0c2cf$export$29f1550f4b0d4415)(props, ref, $8d5785ac9f5d0f19$export$8b645da15a96b44f);
29
29
  let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100 } = props;
30
30
  value = (0, $dVrrg$clamp)(value, minValue, maxValue);
31
+ let range = maxValue - minValue;
31
32
  let [labelRef, label] = (0, $7230ffa83bc0c2cf$export$9d4c57ee4c6ffdd8)(!props['aria-label'] && !props['aria-labelledby']);
32
33
  let { meterProps: meterProps, labelProps: labelProps } = (0, $dVrrg$useMeter)({
33
34
  ...props,
34
35
  label: label
35
36
  });
36
37
  // Calculate the width of the progress bar as a percentage
37
- let percentage = (value - minValue) / (maxValue - minValue) * 100;
38
+ let percentage = range === 0 ? 0 : (value - minValue) / range * 100;
38
39
  let renderProps = (0, $7230ffa83bc0c2cf$export$4d86445c2cf5e3)({
39
40
  ...props,
40
41
  defaultClassName: 'react-aria-Meter',
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAiDM,MAAM,0DAAe,CAAA,GAAA,oBAAY,EAA4C;AAK7E,MAAM,4CAAsB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,MACzE,KAAiB,EACjB,GAAiC;IAEjC,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,SAAC,QAAQ,aAAG,WAAW,aAAG,WAAW,KAAI,GAAG;IAChD,QAAQ,CAAA,GAAA,YAAI,EAAE,OAAO,UAAU;IAE/B,IAAI,CAAC,UAAU,MAAM,GAAG,CAAA,GAAA,yCAAM,EAAE,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,kBAAkB;IACjF,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAAC,GAAG,KAAK;eAAE;IAAK;IAExD,0DAA0D;IAC1D,IAAI,aAAa,AAAE,CAAA,QAAQ,QAAO,IAAM,CAAA,WAAW,QAAO,IAAM;IAEhE,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;wBACN;YACA,WAAW,UAAU,CAAC,iBAAiB;QACzC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAElD,qBACE,gCAAC,CAAA,GAAA,yCAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,aAAa,WAAW;QACjD,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;qBACpB,gCAAC,CAAA,GAAA,yCAAW,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;YAAE,KAAK;YAAU,aAAa;QAAM;OAC7E,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Meter.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 {AriaMeterProps, useMeter} from 'react-aria/useMeter';\n\nimport {clamp} from 'react-stately/private/utils/number';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps,\n useSlot\n} from './utils';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {createContext, ForwardedRef, forwardRef} from 'react';\n\nexport interface MeterProps\n extends\n Omit<AriaMeterProps, 'label'>,\n RenderProps<MeterRenderProps>,\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-Meter'\n */\n className?: ClassNameOrFunction<MeterRenderProps>;\n}\n\nexport interface MeterRenderProps {\n /**\n * The value as a percentage between the minimum and maximum.\n */\n percentage: number;\n /**\n * A formatted version of the value.\n *\n * @selector [aria-valuetext]\n */\n valueText: string | undefined;\n}\n\nexport const MeterContext = createContext<ContextValue<MeterProps, HTMLDivElement>>(null);\n\n/**\n * A meter represents a quantity within a known range, or a fractional value.\n */\nexport const Meter = /*#__PURE__*/ (forwardRef as forwardRefType)(function Meter(\n props: MeterProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n [props, ref] = useContextProps(props, ref, MeterContext);\n let {value = 0, minValue = 0, maxValue = 100} = props;\n value = clamp(value, minValue, maxValue);\n\n let [labelRef, label] = useSlot(!props['aria-label'] && !props['aria-labelledby']);\n let {meterProps, labelProps} = useMeter({...props, label});\n\n // Calculate the width of the progress bar as a percentage\n let percentage = ((value - minValue) / (maxValue - minValue)) * 100;\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Meter',\n values: {\n percentage,\n valueText: meterProps['aria-valuetext']\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <dom.div\n {...mergeProps(DOMProps, renderProps, meterProps)}\n ref={ref}\n slot={props.slot || undefined}>\n <LabelContext.Provider value={{...labelProps, ref: labelRef, elementType: 'span'}}>\n {renderProps.children}\n </LabelContext.Provider>\n </dom.div>\n );\n});\n"],"names":[],"version":3,"file":"Meter.mjs.map"}
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAgDM,MAAM,0DAAe,CAAA,GAAA,oBAAY,EAA4C;AAK7E,MAAM,4CAAsB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,MACzE,KAAiB,EACjB,GAAiC;IAEjC,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,SAAC,QAAQ,aAAG,WAAW,aAAG,WAAW,KAAI,GAAG;IAChD,QAAQ,CAAA,GAAA,YAAI,EAAE,OAAO,UAAU;IAC/B,IAAI,QAAQ,WAAW;IAEvB,IAAI,CAAC,UAAU,MAAM,GAAG,CAAA,GAAA,yCAAM,EAAE,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,kBAAkB;IACjF,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAAC,GAAG,KAAK;eAAE;IAAK;IAExD,0DAA0D;IAC1D,IAAI,aAAa,UAAU,IAAI,IAAI,AAAE,CAAA,QAAQ,QAAO,IAAK,QAAS;IAElE,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;wBACN;YACA,WAAW,UAAU,CAAC,iBAAiB;QACzC;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAElD,qBACE,gCAAC,CAAA,GAAA,yCAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,aAAa,WAAW;QACjD,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;qBACpB,gCAAC,CAAA,GAAA,yCAAW,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;YAAE,KAAK;YAAU,aAAa;QAAM;OAC7E,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Meter.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 {AriaMeterProps, useMeter} from 'react-aria/useMeter';\nimport {clamp} from 'react-stately/private/utils/number';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps,\n useSlot\n} from './utils';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {createContext, ForwardedRef, forwardRef} from 'react';\n\nexport interface MeterProps\n extends\n Omit<AriaMeterProps, 'label'>,\n RenderProps<MeterRenderProps>,\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-Meter'\n */\n className?: ClassNameOrFunction<MeterRenderProps>;\n}\n\nexport interface MeterRenderProps {\n /**\n * The value as a percentage between the minimum and maximum.\n */\n percentage: number;\n /**\n * A formatted version of the value.\n *\n * @selector [aria-valuetext]\n */\n valueText: string | undefined;\n}\n\nexport const MeterContext = createContext<ContextValue<MeterProps, HTMLDivElement>>(null);\n\n/**\n * A meter represents a quantity within a known range, or a fractional value.\n */\nexport const Meter = /*#__PURE__*/ (forwardRef as forwardRefType)(function Meter(\n props: MeterProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n [props, ref] = useContextProps(props, ref, MeterContext);\n let {value = 0, minValue = 0, maxValue = 100} = props;\n value = clamp(value, minValue, maxValue);\n let range = maxValue - minValue;\n\n let [labelRef, label] = useSlot(!props['aria-label'] && !props['aria-labelledby']);\n let {meterProps, labelProps} = useMeter({...props, label});\n\n // Calculate the width of the progress bar as a percentage\n let percentage = range === 0 ? 0 : ((value - minValue) / range) * 100;\n\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Meter',\n values: {\n percentage,\n valueText: meterProps['aria-valuetext']\n }\n });\n\n let DOMProps = filterDOMProps(props, {global: true});\n\n return (\n <dom.div\n {...mergeProps(DOMProps, renderProps, meterProps)}\n ref={ref}\n slot={props.slot || undefined}>\n <LabelContext.Provider value={{...labelProps, ref: labelRef, elementType: 'span'}}>\n {renderProps.children}\n </LabelContext.Provider>\n </dom.div>\n );\n});\n"],"names":[],"version":3,"file":"Meter.mjs.map"}
@@ -147,6 +147,7 @@ function $ea54fd2c37e7023d$var$ModalOverlayInner({ UNSTABLE_portalContainer: UNS
147
147
  '--page-width': pageWidth !== undefined ? pageWidth + 'px' : undefined,
148
148
  '--page-height': pageHeight !== undefined ? pageHeight + 'px' : undefined
149
149
  };
150
+ // oxlint-disable react/react-compiler
150
151
  return /*#__PURE__*/ (0, ($parcel$interopDefault($iQHtX$react))).createElement((0, $iQHtX$reactariaOverlay.Overlay), {
151
152
  isExiting: props.isExiting,
152
153
  portalContainer: UNSTABLE_portalContainer
@@ -176,6 +177,7 @@ function $ea54fd2c37e7023d$var$ModalOverlayInner({ UNSTABLE_portalContainer: UNS
176
177
  ]
177
178
  ]
178
179
  }, renderProps.children)));
180
+ // oxlint-enable react/react-compiler
179
181
  }
180
182
  function $ea54fd2c37e7023d$var$ModalContent(props) {
181
183
  let { modalProps: modalProps, modalRef: modalRef, isExiting: isExiting, isDismissable: isDismissable } = (0, $iQHtX$react.useContext)($ea54fd2c37e7023d$var$InternalModalContext);
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAuEM,MAAM,0DAAe,CAAA,GAAA,0BAAY,EAAmD;AAC3F,MAAM,2DAAuB,CAAA,GAAA,0BAAY,EAAoC;AAwBtE,MAAM,4CAAsB,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB,SAAS,MACzE,KAAwB,EACxB,GAAiC;IAEjC,IAAI,MAAM,CAAA,GAAA,uBAAS,EAAE;IAErB,IAAI,KAAK;QACP,IACE,QAAQ,GAAG,CAAC,QAAQ,KAAK,gBACxB,CAAA,MAAM,YAAY,I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AE9F,IAAI,MAAM,CAAA,GAAA,yCAAW,EAAE;IACvB,IAAI,WAAW,CAAA,GAAA,uDAAgB,EAAE;IACjC,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;YACN,YAAY;uBACZ;mBACA;QACF;IACF;IAEA,qBACE,0DAAC,CAAA,GAAA,6BAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,qCAAS,EAAE,CAAA,GAAA,6CAAa,EAAE,OAAO;YAAC,QAAQ;QAAI,IAAI,WAAW;QAChE,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,YAAY;QAC3B,gBAAc,aAAa;OAC1B,+BAAiB,0DAAC,CAAA,GAAA,qCAAY;QAAE,WAAW,MAAM,KAAK;QACtD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Modal.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 {AriaModalOverlayProps, useModalOverlay} from 'react-aria/useModalOverlay';\n\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {DismissButton, Overlay} from 'react-aria/Overlay';\nimport {DOMAttributes, forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {isScrollable} from 'react-aria/private/utils/isScrollable';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport {\n OverlayTriggerProps,\n OverlayTriggerState,\n useOverlayTriggerState\n} from 'react-stately/useOverlayTriggerState';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useMemo, useRef} from 'react';\nimport {useEnterAnimation, useExitAnimation} from 'react-aria/private/utils/animation';\nimport {useIsSSR} from 'react-aria/SSRProvider';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {useViewportSize} from 'react-aria/private/utils/useViewportSize';\n\nexport interface ModalOverlayProps\n extends\n AriaModalOverlayProps,\n OverlayTriggerProps,\n RenderProps<ModalRenderProps>,\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-ModalOverlay'\n */\n className?: ClassNameOrFunction<ModalRenderProps>;\n /**\n * Whether the modal is currently performing an entry animation.\n */\n isEntering?: boolean;\n /**\n * Whether the modal is currently performing an exit animation.\n */\n isExiting?: boolean;\n /**\n * The container element in which the overlay portal will be placed. This may have unknown\n * behavior depending on where it is portalled to.\n *\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element;\n}\n\ninterface InternalModalContextValue {\n modalProps: DOMAttributes;\n modalRef: RefObject<HTMLDivElement | null>;\n isExiting: boolean;\n isDismissable?: boolean;\n}\n\nexport const ModalContext = createContext<ContextValue<ModalOverlayProps, HTMLDivElement>>(null);\nconst InternalModalContext = createContext<InternalModalContextValue | null>(null);\n\nexport interface ModalRenderProps {\n /**\n * Whether the modal is currently entering. Use this to apply animations.\n *\n * @selector [data-entering]\n */\n isEntering: boolean;\n /**\n * Whether the modal is currently exiting. Use this to apply animations.\n *\n * @selector [data-exiting]\n */\n isExiting: boolean;\n /**\n * State of the modal.\n */\n state: OverlayTriggerState;\n}\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = /*#__PURE__*/ (forwardRef as forwardRefType)(function Modal(\n props: ModalOverlayProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n let ctx = useContext(InternalModalContext);\n\n if (ctx) {\n if (\n process.env.NODE_ENV !== 'production' &&\n (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)\n ) {\n // create a list of props that are passed in but not allowed when using an external ModalOverlay\n const invalidSet = new Set([\n 'isDismissable',\n 'isKeyboardDismissDisabled',\n 'isOpen',\n 'defaultOpen',\n 'onOpenChange',\n 'isEntering',\n 'isExiting',\n 'UNSTABLE_portalContainer',\n 'shouldCloseOnInteractOutside'\n ]);\n const invalidProps = Object.keys(props).filter(key => invalidSet.has(key));\n console.warn(\n `This modal is already wrapped in a ModalOverlay, props [${invalidProps.join(', ')}] should be placed on the ModalOverlay instead.`\n );\n }\n return (\n <ModalContent {...props} modalRef={ref}>\n {props.children}\n </ModalContent>\n );\n }\n\n let {\n isDismissable,\n isKeyboardDismissDisabled,\n isOpen,\n defaultOpen,\n onOpenChange,\n children,\n isEntering,\n isExiting,\n UNSTABLE_portalContainer,\n shouldCloseOnInteractOutside,\n ...otherProps\n } = props;\n\n return (\n <ModalOverlay\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n isEntering={isEntering}\n isExiting={isExiting}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}>\n <ModalContent {...otherProps} modalRef={ref}>\n {children}\n </ModalContent>\n </ModalOverlay>\n );\n});\n\ninterface ModalOverlayInnerProps extends ModalOverlayProps {\n overlayRef: RefObject<HTMLDivElement | null>;\n modalRef: RefObject<HTMLDivElement | null>;\n state: OverlayTriggerState;\n isExiting: boolean;\n}\n\nfunction ModalOverlayWithForwardRef(props: ModalOverlayProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ModalContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state =\n props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n if (state === contextState) {\n if (\n process.env.NODE_ENV !== 'production' &&\n (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)\n ) {\n console.warn(\n 'This modals state is controlled by a trigger, place onOpenChange on the trigger instead.'\n );\n }\n }\n\n let objectRef = useObjectRef(ref);\n let modalRef = useRef<HTMLDivElement>(null);\n let isOverlayExiting = useExitAnimation(objectRef, state.isOpen);\n let isModalExiting = useExitAnimation(modalRef, state.isOpen);\n let isExiting = isOverlayExiting || isModalExiting || props.isExiting || false;\n let isSSR = useIsSSR();\n\n if ((!state.isOpen && !isExiting) || isSSR) {\n return null;\n }\n\n return (\n <ModalOverlayInner\n {...props}\n state={state}\n isExiting={isExiting}\n overlayRef={objectRef}\n modalRef={modalRef}\n />\n );\n}\n\n/**\n * A ModalOverlay is a wrapper for a Modal which allows customizing the backdrop element.\n */\nexport const ModalOverlay = /*#__PURE__*/ (forwardRef as forwardRefType)(\n ModalOverlayWithForwardRef\n);\n\nfunction ModalOverlayInner({UNSTABLE_portalContainer, ...props}: ModalOverlayInnerProps) {\n let modalRef = props.modalRef;\n let {state} = props;\n let {modalProps, underlayProps} = useModalOverlay(props, state, modalRef);\n\n let entering = useEnterAnimation(props.overlayRef) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ModalOverlay',\n values: {\n isEntering: entering,\n isExiting: props.isExiting,\n state\n }\n });\n\n let viewport = useViewportSize();\n let pageWidth: number | undefined = undefined;\n let pageHeight: number | undefined = undefined;\n if (typeof document !== 'undefined') {\n let scrollingElement = isScrollable(document.body)\n ? document.body\n : document.scrollingElement || document.documentElement;\n // Prevent Firefox from adding scrollbars when the page has a fractional width/height.\n let fractionalWidthDifference = scrollingElement.getBoundingClientRect().width % 1;\n let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;\n pageWidth = scrollingElement.scrollWidth - fractionalWidthDifference;\n pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;\n }\n\n let style = {\n ...renderProps.style,\n '--visual-viewport-width': viewport.width + 'px',\n '--visual-viewport-height': viewport.height + 'px',\n '--page-width': pageWidth !== undefined ? pageWidth + 'px' : undefined,\n '--page-height': pageHeight !== undefined ? pageHeight + 'px' : undefined\n };\n\n return (\n <Overlay isExiting={props.isExiting} portalContainer={UNSTABLE_portalContainer}>\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), underlayProps)}\n {...renderProps}\n style={style}\n ref={props.overlayRef}\n data-entering={entering || undefined}\n data-exiting={props.isExiting || undefined}>\n <Provider\n values={[\n [\n InternalModalContext,\n {modalProps, modalRef, isExiting: props.isExiting, isDismissable: props.isDismissable}\n ],\n [OverlayTriggerStateContext, state]\n ]}>\n {renderProps.children}\n </Provider>\n </dom.div>\n </Overlay>\n );\n}\n\ninterface ModalContentProps\n extends RenderProps<ModalRenderProps>, 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-ModalContent'\n */\n className?: ClassNameOrFunction<ModalRenderProps>;\n modalRef: ForwardedRef<HTMLDivElement>;\n}\n\nfunction ModalContent(props: ModalContentProps) {\n let {modalProps, modalRef, isExiting, isDismissable} = useContext(InternalModalContext)!;\n let state = useContext(OverlayTriggerStateContext)!;\n let mergedRefs = useMemo(() => mergeRefs(props.modalRef, modalRef), [props.modalRef, modalRef]);\n\n let ref = useObjectRef(mergedRefs);\n let entering = useEnterAnimation(ref);\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Modal',\n values: {\n isEntering: entering,\n isExiting,\n state\n }\n });\n\n return (\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), modalProps)}\n {...renderProps}\n ref={ref}\n data-entering={entering || undefined}\n data-exiting={isExiting || undefined}>\n {isDismissable && <DismissButton onDismiss={state.close} />}\n {renderProps.children}\n </dom.div>\n );\n}\n"],"names":[],"version":3,"file":"Modal.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAuEM,MAAM,0DAAe,CAAA,GAAA,0BAAY,EAAmD;AAC3F,MAAM,2DAAuB,CAAA,GAAA,0BAAY,EAAoC;AAwBtE,MAAM,4CAAsB,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB,SAAS,MACzE,KAAwB,EACxB,GAAiC;IAEjC,IAAI,MAAM,CAAA,GAAA,uBAAS,EAAE;IAErB,IAAI,KAAK;QACP,IACE,QAAQ,GAAG,CAAC,QAAQ,KAAK,gBACxB,CAAA,MAAM,YAAY,IAAI,MAAM,WAAW,KAAK,aAAa,MAAM,MAAM,KAAK,SAAQ,GACnF;YACA,gGAAgG;YAChG,MAAM,aAAa,IAAI,IAAI;gBACzB;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;aACD;YACD,MAAM,eAAe,OAAO,IAAI,CAAC,OAAO,MAAM,CAAC,CAAA,MAAO,WAAW,GAAG,CAAC;YACrE,QAAQ,IAAI,CACV,CAAC,wDAAwD,EAAE,aAAa,IAAI,CAAC,MAAM,+CAA+C,CAAC;QAEvI;QACA,qBACE,0DAAC;YAAc,GAAG,KAAK;YAAE,UAAU;WAChC,MAAM,QAAQ;IAGrB;IAEA,IAAI,iBACF,aAAa,6BACb,yBAAyB,UACzB,MAAM,eACN,WAAW,gBACX,YAAY,YACZ,QAAQ,cACR,UAAU,aACV,SAAS,4BACT,wBAAwB,gCACxB,4BAA4B,EAC5B,GAAG,YACJ,GAAG;IAEJ,qBACE,0DAAC;QACC,eAAe;QACf,2BAA2B;QAC3B,QAAQ;QACR,aAAa;QACb,cAAc;QACd,YAAY;QACZ,WAAW;QACX,0BAA0B;QAC1B,8BAA8B;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C,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBACE;gBACA;gCAAC;8BAAY;oBAAU,WAAW,MAAM,SAAS;oBAAE,eAAe,MAAM,aAAa;gBAAA;aACtF;YACD;gBAAC,CAAA,GAAA,oDAAyB;gBAAG;aAAM;SACpC;OACA,YAAY,QAAQ;AAK7B,qCAAqC;AACvC;AAcA,SAAS,mCAAa,KAAwB;IAC5C,IAAI,cAAC,UAAU,YAAE,QAAQ,aAAE,SAAS,iBAAE,aAAa,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE;IAClE,IAAI,QAAQ,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,oDAAyB;IAChD,IAAI,aAAa,CAAA,GAAA,oBAAM,EAAE,IAAM,CAAA,GAAA,mCAAQ,EAAE,MAAM,QAAQ,EAAE,WAAW;QAAC,MAAM,QAAQ;QAAE;KAAS;IAE9F,IAAI,MAAM,CAAA,GAAA,yCAAW,EAAE;IACvB,IAAI,WAAW,CAAA,GAAA,uDAAgB,EAAE;IACjC,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;YACN,YAAY;uBACZ;mBACA;QACF;IACF;IAEA,qBACE,0DAAC,CAAA,GAAA,6BAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,qCAAS,EAAE,CAAA,GAAA,6CAAa,EAAE,OAAO;YAAC,QAAQ;QAAI,IAAI,WAAW;QAChE,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,YAAY;QAC3B,gBAAc,aAAa;OAC1B,+BAAiB,0DAAC,CAAA,GAAA,qCAAY;QAAE,WAAW,MAAM,KAAK;QACtD,YAAY,QAAQ;AAG3B","sources":["packages/react-aria-components/src/Modal.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 {AriaModalOverlayProps, useModalOverlay} from 'react-aria/useModalOverlay';\n\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n Provider,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {DismissButton, Overlay} from 'react-aria/Overlay';\nimport {DOMAttributes, forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {isScrollable} from 'react-aria/private/utils/isScrollable';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport {\n OverlayTriggerProps,\n OverlayTriggerState,\n useOverlayTriggerState\n} from 'react-stately/useOverlayTriggerState';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useMemo, useRef} from 'react';\nimport {useEnterAnimation, useExitAnimation} from 'react-aria/private/utils/animation';\nimport {useIsSSR} from 'react-aria/SSRProvider';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {useViewportSize} from 'react-aria/private/utils/useViewportSize';\n\nexport interface ModalOverlayProps\n extends\n AriaModalOverlayProps,\n OverlayTriggerProps,\n RenderProps<ModalRenderProps>,\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-ModalOverlay'\n */\n className?: ClassNameOrFunction<ModalRenderProps>;\n /**\n * Whether the modal is currently performing an entry animation.\n */\n isEntering?: boolean;\n /**\n * Whether the modal is currently performing an exit animation.\n */\n isExiting?: boolean;\n /**\n * The container element in which the overlay portal will be placed. This may have unknown\n * behavior depending on where it is portalled to.\n *\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element;\n}\n\ninterface InternalModalContextValue {\n modalProps: DOMAttributes;\n modalRef: RefObject<HTMLDivElement | null>;\n isExiting: boolean;\n isDismissable?: boolean;\n}\n\nexport const ModalContext = createContext<ContextValue<ModalOverlayProps, HTMLDivElement>>(null);\nconst InternalModalContext = createContext<InternalModalContextValue | null>(null);\n\nexport interface ModalRenderProps {\n /**\n * Whether the modal is currently entering. Use this to apply animations.\n *\n * @selector [data-entering]\n */\n isEntering: boolean;\n /**\n * Whether the modal is currently exiting. Use this to apply animations.\n *\n * @selector [data-exiting]\n */\n isExiting: boolean;\n /**\n * State of the modal.\n */\n state: OverlayTriggerState;\n}\n\n/**\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport const Modal = /*#__PURE__*/ (forwardRef as forwardRefType)(function Modal(\n props: ModalOverlayProps,\n ref: ForwardedRef<HTMLDivElement>\n) {\n let ctx = useContext(InternalModalContext);\n\n if (ctx) {\n if (\n process.env.NODE_ENV !== 'production' &&\n (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)\n ) {\n // create a list of props that are passed in but not allowed when using an external ModalOverlay\n const invalidSet = new Set([\n 'isDismissable',\n 'isKeyboardDismissDisabled',\n 'isOpen',\n 'defaultOpen',\n 'onOpenChange',\n 'isEntering',\n 'isExiting',\n 'UNSTABLE_portalContainer',\n 'shouldCloseOnInteractOutside'\n ]);\n const invalidProps = Object.keys(props).filter(key => invalidSet.has(key));\n console.warn(\n `This modal is already wrapped in a ModalOverlay, props [${invalidProps.join(', ')}] should be placed on the ModalOverlay instead.`\n );\n }\n return (\n <ModalContent {...props} modalRef={ref}>\n {props.children}\n </ModalContent>\n );\n }\n\n let {\n isDismissable,\n isKeyboardDismissDisabled,\n isOpen,\n defaultOpen,\n onOpenChange,\n children,\n isEntering,\n isExiting,\n UNSTABLE_portalContainer,\n shouldCloseOnInteractOutside,\n ...otherProps\n } = props;\n\n return (\n <ModalOverlay\n isDismissable={isDismissable}\n isKeyboardDismissDisabled={isKeyboardDismissDisabled}\n isOpen={isOpen}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n isEntering={isEntering}\n isExiting={isExiting}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer}\n shouldCloseOnInteractOutside={shouldCloseOnInteractOutside}>\n <ModalContent {...otherProps} modalRef={ref}>\n {children}\n </ModalContent>\n </ModalOverlay>\n );\n});\n\ninterface ModalOverlayInnerProps extends ModalOverlayProps {\n overlayRef: RefObject<HTMLDivElement | null>;\n modalRef: RefObject<HTMLDivElement | null>;\n state: OverlayTriggerState;\n isExiting: boolean;\n}\n\nfunction ModalOverlayWithForwardRef(props: ModalOverlayProps, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ModalContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state =\n props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n if (state === contextState) {\n if (\n process.env.NODE_ENV !== 'production' &&\n (props.onOpenChange || props.defaultOpen !== undefined || props.isOpen !== undefined)\n ) {\n console.warn(\n 'This modals state is controlled by a trigger, place onOpenChange on the trigger instead.'\n );\n }\n }\n\n let objectRef = useObjectRef(ref);\n let modalRef = useRef<HTMLDivElement>(null);\n let isOverlayExiting = useExitAnimation(objectRef, state.isOpen);\n let isModalExiting = useExitAnimation(modalRef, state.isOpen);\n let isExiting = isOverlayExiting || isModalExiting || props.isExiting || false;\n let isSSR = useIsSSR();\n\n if ((!state.isOpen && !isExiting) || isSSR) {\n return null;\n }\n\n return (\n <ModalOverlayInner\n {...props}\n state={state}\n isExiting={isExiting}\n overlayRef={objectRef}\n modalRef={modalRef}\n />\n );\n}\n\n/**\n * A ModalOverlay is a wrapper for a Modal which allows customizing the backdrop element.\n */\nexport const ModalOverlay = /*#__PURE__*/ (forwardRef as forwardRefType)(\n ModalOverlayWithForwardRef\n);\n\nfunction ModalOverlayInner({UNSTABLE_portalContainer, ...props}: ModalOverlayInnerProps) {\n let modalRef = props.modalRef;\n let {state} = props;\n let {modalProps, underlayProps} = useModalOverlay(props, state, modalRef);\n\n let entering = useEnterAnimation(props.overlayRef) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-ModalOverlay',\n values: {\n isEntering: entering,\n isExiting: props.isExiting,\n state\n }\n });\n\n let viewport = useViewportSize();\n let pageWidth: number | undefined = undefined;\n let pageHeight: number | undefined = undefined;\n if (typeof document !== 'undefined') {\n let scrollingElement = isScrollable(document.body)\n ? document.body\n : document.scrollingElement || document.documentElement;\n // Prevent Firefox from adding scrollbars when the page has a fractional width/height.\n let fractionalWidthDifference = scrollingElement.getBoundingClientRect().width % 1;\n let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;\n pageWidth = scrollingElement.scrollWidth - fractionalWidthDifference;\n pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;\n }\n\n let style = {\n ...renderProps.style,\n '--visual-viewport-width': viewport.width + 'px',\n '--visual-viewport-height': viewport.height + 'px',\n '--page-width': pageWidth !== undefined ? pageWidth + 'px' : undefined,\n '--page-height': pageHeight !== undefined ? pageHeight + 'px' : undefined\n };\n\n // oxlint-disable react/react-compiler\n return (\n <Overlay isExiting={props.isExiting} portalContainer={UNSTABLE_portalContainer}>\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), underlayProps)}\n {...renderProps}\n style={style}\n ref={props.overlayRef}\n data-entering={entering || undefined}\n data-exiting={props.isExiting || undefined}>\n <Provider\n values={[\n [\n InternalModalContext,\n {modalProps, modalRef, isExiting: props.isExiting, isDismissable: props.isDismissable}\n ],\n [OverlayTriggerStateContext, state]\n ]}>\n {renderProps.children}\n </Provider>\n </dom.div>\n </Overlay>\n );\n // oxlint-enable react/react-compiler\n}\n\ninterface ModalContentProps\n extends RenderProps<ModalRenderProps>, 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-ModalContent'\n */\n className?: ClassNameOrFunction<ModalRenderProps>;\n modalRef: ForwardedRef<HTMLDivElement>;\n}\n\nfunction ModalContent(props: ModalContentProps) {\n let {modalProps, modalRef, isExiting, isDismissable} = useContext(InternalModalContext)!;\n let state = useContext(OverlayTriggerStateContext)!;\n let mergedRefs = useMemo(() => mergeRefs(props.modalRef, modalRef), [props.modalRef, modalRef]);\n\n let ref = useObjectRef(mergedRefs);\n let entering = useEnterAnimation(ref);\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Modal',\n values: {\n isEntering: entering,\n isExiting,\n state\n }\n });\n\n return (\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), modalProps)}\n {...renderProps}\n ref={ref}\n data-entering={entering || undefined}\n data-exiting={isExiting || undefined}>\n {isDismissable && <DismissButton onDismiss={state.close} />}\n {renderProps.children}\n </dom.div>\n );\n}\n"],"names":[],"version":3,"file":"Modal.cjs.map"}
@@ -135,6 +135,7 @@ function $46ccb41fa2c44f44$var$ModalOverlayInner({ UNSTABLE_portalContainer: UNS
135
135
  '--page-width': pageWidth !== undefined ? pageWidth + 'px' : undefined,
136
136
  '--page-height': pageHeight !== undefined ? pageHeight + 'px' : undefined
137
137
  };
138
+ // oxlint-disable react/react-compiler
138
139
  return /*#__PURE__*/ (0, $auKl7$react).createElement((0, $auKl7$Overlay), {
139
140
  isExiting: props.isExiting,
140
141
  portalContainer: UNSTABLE_portalContainer
@@ -164,6 +165,7 @@ function $46ccb41fa2c44f44$var$ModalOverlayInner({ UNSTABLE_portalContainer: UNS
164
165
  ]
165
166
  ]
166
167
  }, renderProps.children)));
168
+ // oxlint-enable react/react-compiler
167
169
  }
168
170
  function $46ccb41fa2c44f44$var$ModalContent(props) {
169
171
  let { modalProps: modalProps, modalRef: modalRef, isExiting: isExiting, isDismissable: isDismissable } = (0, $auKl7$useContext)($46ccb41fa2c44f44$var$InternalModalContext);