react-aria 3.50.0 → 3.52.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 (1224) hide show
  1. package/dist/exports/index.cjs +16 -0
  2. package/dist/exports/index.cjs.map +1 -1
  3. package/dist/exports/index.js +10 -2
  4. package/dist/exports/index.js.map +1 -1
  5. package/dist/exports/index.mjs +10 -2
  6. package/dist/exports/index.mjs.map +1 -1
  7. package/dist/exports/private/utils/domHelpers.cjs +2 -0
  8. package/dist/exports/private/utils/domHelpers.cjs.map +1 -1
  9. package/dist/exports/private/utils/domHelpers.js +2 -2
  10. package/dist/exports/private/utils/domHelpers.js.map +1 -1
  11. package/dist/exports/private/utils/domHelpers.mjs +2 -2
  12. package/dist/exports/private/utils/domHelpers.mjs.map +1 -1
  13. package/dist/exports/private/utils/platform.cjs +1 -0
  14. package/dist/exports/private/utils/platform.cjs.map +1 -1
  15. package/dist/exports/private/utils/platform.js +2 -2
  16. package/dist/exports/private/utils/platform.js.map +1 -1
  17. package/dist/exports/private/utils/platform.mjs +2 -2
  18. package/dist/exports/private/utils/platform.mjs.map +1 -1
  19. package/dist/exports/private/utils/shadowdom/DOMFunctions.cjs +1 -0
  20. package/dist/exports/private/utils/shadowdom/DOMFunctions.cjs.map +1 -1
  21. package/dist/exports/private/utils/shadowdom/DOMFunctions.js +2 -2
  22. package/dist/exports/private/utils/shadowdom/DOMFunctions.js.map +1 -1
  23. package/dist/exports/private/utils/shadowdom/DOMFunctions.mjs +2 -2
  24. package/dist/exports/private/utils/shadowdom/DOMFunctions.mjs.map +1 -1
  25. package/dist/exports/useContextMenu.cjs +22 -0
  26. package/dist/exports/useContextMenu.cjs.map +1 -0
  27. package/dist/exports/useContextMenu.js +17 -0
  28. package/dist/exports/useContextMenu.js.map +1 -0
  29. package/dist/exports/useContextMenu.mjs +17 -0
  30. package/dist/exports/useContextMenu.mjs.map +1 -0
  31. package/dist/exports/useFocusVisible.cjs +1 -0
  32. package/dist/exports/useFocusVisible.cjs.map +1 -1
  33. package/dist/exports/useFocusVisible.js +2 -2
  34. package/dist/exports/useFocusVisible.js.map +1 -1
  35. package/dist/exports/useFocusVisible.mjs +2 -2
  36. package/dist/exports/useFocusVisible.mjs.map +1 -1
  37. package/dist/exports/usePreviewTrigger.cjs +22 -0
  38. package/dist/exports/usePreviewTrigger.cjs.map +1 -0
  39. package/dist/exports/usePreviewTrigger.js +17 -0
  40. package/dist/exports/usePreviewTrigger.js.map +1 -0
  41. package/dist/exports/usePreviewTrigger.mjs +17 -0
  42. package/dist/exports/usePreviewTrigger.mjs.map +1 -0
  43. package/dist/exports/useTokenField.cjs +27 -0
  44. package/dist/exports/useTokenField.cjs.map +1 -0
  45. package/dist/exports/useTokenField.js +19 -0
  46. package/dist/exports/useTokenField.js.map +1 -0
  47. package/dist/exports/useTokenField.mjs +19 -0
  48. package/dist/exports/useTokenField.mjs.map +1 -0
  49. package/dist/private/actiongroup/useActionGroup.cjs +27 -20
  50. package/dist/private/actiongroup/useActionGroup.cjs.map +1 -1
  51. package/dist/private/actiongroup/useActionGroup.js +27 -20
  52. package/dist/private/actiongroup/useActionGroup.js.map +1 -1
  53. package/dist/private/actiongroup/useActionGroup.mjs +27 -20
  54. package/dist/private/actiongroup/useActionGroup.mjs.map +1 -1
  55. package/dist/private/autocomplete/useAutocomplete.cjs +2 -1
  56. package/dist/private/autocomplete/useAutocomplete.cjs.map +1 -1
  57. package/dist/private/autocomplete/useAutocomplete.js +2 -1
  58. package/dist/private/autocomplete/useAutocomplete.js.map +1 -1
  59. package/dist/private/autocomplete/useAutocomplete.mjs +2 -1
  60. package/dist/private/autocomplete/useAutocomplete.mjs.map +1 -1
  61. package/dist/private/breadcrumbs/useBreadcrumbItem.cjs +2 -0
  62. package/dist/private/breadcrumbs/useBreadcrumbItem.cjs.map +1 -1
  63. package/dist/private/breadcrumbs/useBreadcrumbItem.js +2 -0
  64. package/dist/private/breadcrumbs/useBreadcrumbItem.js.map +1 -1
  65. package/dist/private/breadcrumbs/useBreadcrumbItem.mjs +2 -0
  66. package/dist/private/breadcrumbs/useBreadcrumbItem.mjs.map +1 -1
  67. package/dist/private/button/useButton.cjs +2 -1
  68. package/dist/private/button/useButton.cjs.map +1 -1
  69. package/dist/private/button/useButton.js +2 -1
  70. package/dist/private/button/useButton.js.map +1 -1
  71. package/dist/private/button/useButton.mjs +2 -1
  72. package/dist/private/button/useButton.mjs.map +1 -1
  73. package/dist/private/button/useToggleButtonGroup.cjs +3 -0
  74. package/dist/private/button/useToggleButtonGroup.cjs.map +1 -1
  75. package/dist/private/button/useToggleButtonGroup.js +3 -0
  76. package/dist/private/button/useToggleButtonGroup.js.map +1 -1
  77. package/dist/private/button/useToggleButtonGroup.mjs +3 -0
  78. package/dist/private/button/useToggleButtonGroup.mjs.map +1 -1
  79. package/dist/private/calendar/useCalendarCell.cjs +3 -0
  80. package/dist/private/calendar/useCalendarCell.cjs.map +1 -1
  81. package/dist/private/calendar/useCalendarCell.js +3 -0
  82. package/dist/private/calendar/useCalendarCell.js.map +1 -1
  83. package/dist/private/calendar/useCalendarCell.mjs +3 -0
  84. package/dist/private/calendar/useCalendarCell.mjs.map +1 -1
  85. package/dist/private/calendar/useCalendarGrid.cjs +47 -52
  86. package/dist/private/calendar/useCalendarGrid.cjs.map +1 -1
  87. package/dist/private/calendar/useCalendarGrid.js +47 -52
  88. package/dist/private/calendar/useCalendarGrid.js.map +1 -1
  89. package/dist/private/calendar/useCalendarGrid.mjs +47 -52
  90. package/dist/private/calendar/useCalendarGrid.mjs.map +1 -1
  91. package/dist/private/calendar/useRangeCalendar.cjs +2 -1
  92. package/dist/private/calendar/useRangeCalendar.cjs.map +1 -1
  93. package/dist/private/calendar/useRangeCalendar.js +3 -2
  94. package/dist/private/calendar/useRangeCalendar.js.map +1 -1
  95. package/dist/private/calendar/useRangeCalendar.mjs +3 -2
  96. package/dist/private/calendar/useRangeCalendar.mjs.map +1 -1
  97. package/dist/private/collections/CollectionBuilder.cjs +8 -3
  98. package/dist/private/collections/CollectionBuilder.cjs.map +1 -1
  99. package/dist/private/collections/CollectionBuilder.js +8 -3
  100. package/dist/private/collections/CollectionBuilder.js.map +1 -1
  101. package/dist/private/collections/CollectionBuilder.mjs +8 -3
  102. package/dist/private/collections/CollectionBuilder.mjs.map +1 -1
  103. package/dist/private/collections/Document.cjs +4 -0
  104. package/dist/private/collections/Document.cjs.map +1 -1
  105. package/dist/private/collections/Document.js +4 -0
  106. package/dist/private/collections/Document.js.map +1 -1
  107. package/dist/private/collections/Document.mjs +4 -0
  108. package/dist/private/collections/Document.mjs.map +1 -1
  109. package/dist/private/collections/Hidden.cjs +1 -0
  110. package/dist/private/collections/Hidden.cjs.map +1 -1
  111. package/dist/private/collections/Hidden.js +1 -0
  112. package/dist/private/collections/Hidden.js.map +1 -1
  113. package/dist/private/collections/Hidden.mjs +1 -0
  114. package/dist/private/collections/Hidden.mjs.map +1 -1
  115. package/dist/private/collections/useCachedChildren.cjs +1 -0
  116. package/dist/private/collections/useCachedChildren.cjs.map +1 -1
  117. package/dist/private/collections/useCachedChildren.js +1 -0
  118. package/dist/private/collections/useCachedChildren.js.map +1 -1
  119. package/dist/private/collections/useCachedChildren.mjs +1 -0
  120. package/dist/private/collections/useCachedChildren.mjs.map +1 -1
  121. package/dist/private/color/useColorArea.cjs +31 -34
  122. package/dist/private/color/useColorArea.cjs.map +1 -1
  123. package/dist/private/color/useColorArea.js +31 -34
  124. package/dist/private/color/useColorArea.js.map +1 -1
  125. package/dist/private/color/useColorArea.mjs +31 -34
  126. package/dist/private/color/useColorArea.mjs.map +1 -1
  127. package/dist/private/color/useColorField.cjs +26 -4
  128. package/dist/private/color/useColorField.cjs.map +1 -1
  129. package/dist/private/color/useColorField.js +26 -4
  130. package/dist/private/color/useColorField.js.map +1 -1
  131. package/dist/private/color/useColorField.mjs +26 -4
  132. package/dist/private/color/useColorField.mjs.map +1 -1
  133. package/dist/private/color/useColorSlider.cjs +4 -2
  134. package/dist/private/color/useColorSlider.cjs.map +1 -1
  135. package/dist/private/color/useColorSlider.js +4 -2
  136. package/dist/private/color/useColorSlider.js.map +1 -1
  137. package/dist/private/color/useColorSlider.mjs +4 -2
  138. package/dist/private/color/useColorSlider.mjs.map +1 -1
  139. package/dist/private/color/useColorWheel.cjs +16 -23
  140. package/dist/private/color/useColorWheel.cjs.map +1 -1
  141. package/dist/private/color/useColorWheel.js +16 -23
  142. package/dist/private/color/useColorWheel.js.map +1 -1
  143. package/dist/private/color/useColorWheel.mjs +16 -23
  144. package/dist/private/color/useColorWheel.mjs.map +1 -1
  145. package/dist/private/combobox/useComboBox.cjs +93 -30
  146. package/dist/private/combobox/useComboBox.cjs.map +1 -1
  147. package/dist/private/combobox/useComboBox.js +94 -30
  148. package/dist/private/combobox/useComboBox.js.map +1 -1
  149. package/dist/private/combobox/useComboBox.mjs +93 -30
  150. package/dist/private/combobox/useComboBox.mjs.map +1 -1
  151. package/dist/private/datepicker/useDateField.cjs +3 -6
  152. package/dist/private/datepicker/useDateField.cjs.map +1 -1
  153. package/dist/private/datepicker/useDateField.js +3 -6
  154. package/dist/private/datepicker/useDateField.js.map +1 -1
  155. package/dist/private/datepicker/useDateField.mjs +3 -6
  156. package/dist/private/datepicker/useDateField.mjs.map +1 -1
  157. package/dist/private/datepicker/useDatePickerGroup.cjs +48 -27
  158. package/dist/private/datepicker/useDatePickerGroup.cjs.map +1 -1
  159. package/dist/private/datepicker/useDatePickerGroup.js +49 -28
  160. package/dist/private/datepicker/useDatePickerGroup.js.map +1 -1
  161. package/dist/private/datepicker/useDatePickerGroup.mjs +49 -28
  162. package/dist/private/datepicker/useDatePickerGroup.mjs.map +1 -1
  163. package/dist/private/datepicker/useDateSegment.cjs +21 -16
  164. package/dist/private/datepicker/useDateSegment.cjs.map +1 -1
  165. package/dist/private/datepicker/useDateSegment.js +22 -17
  166. package/dist/private/datepicker/useDateSegment.js.map +1 -1
  167. package/dist/private/datepicker/useDateSegment.mjs +22 -17
  168. package/dist/private/datepicker/useDateSegment.mjs.map +1 -1
  169. package/dist/private/dialog/useDialog.cjs +8 -1
  170. package/dist/private/dialog/useDialog.cjs.map +1 -1
  171. package/dist/private/dialog/useDialog.js +10 -1
  172. package/dist/private/dialog/useDialog.js.map +1 -1
  173. package/dist/private/dialog/useDialog.mjs +8 -1
  174. package/dist/private/dialog/useDialog.mjs.map +1 -1
  175. package/dist/private/dnd/DragManager.cjs +3 -1
  176. package/dist/private/dnd/DragManager.cjs.map +1 -1
  177. package/dist/private/dnd/DragManager.js +3 -1
  178. package/dist/private/dnd/DragManager.js.map +1 -1
  179. package/dist/private/dnd/DragManager.mjs +3 -1
  180. package/dist/private/dnd/DragManager.mjs.map +1 -1
  181. package/dist/private/dnd/useAutoScroll.cjs +3 -1
  182. package/dist/private/dnd/useAutoScroll.cjs.map +1 -1
  183. package/dist/private/dnd/useAutoScroll.js +3 -1
  184. package/dist/private/dnd/useAutoScroll.js.map +1 -1
  185. package/dist/private/dnd/useAutoScroll.mjs +3 -1
  186. package/dist/private/dnd/useAutoScroll.mjs.map +1 -1
  187. package/dist/private/dnd/useDrag.cjs +4 -1
  188. package/dist/private/dnd/useDrag.cjs.map +1 -1
  189. package/dist/private/dnd/useDrag.js +4 -1
  190. package/dist/private/dnd/useDrag.js.map +1 -1
  191. package/dist/private/dnd/useDrag.mjs +4 -1
  192. package/dist/private/dnd/useDrag.mjs.map +1 -1
  193. package/dist/private/dnd/useDraggableItem.cjs +4 -0
  194. package/dist/private/dnd/useDraggableItem.cjs.map +1 -1
  195. package/dist/private/dnd/useDraggableItem.js +4 -0
  196. package/dist/private/dnd/useDraggableItem.js.map +1 -1
  197. package/dist/private/dnd/useDraggableItem.mjs +4 -0
  198. package/dist/private/dnd/useDraggableItem.mjs.map +1 -1
  199. package/dist/private/dnd/useDroppableCollection.cjs +4 -0
  200. package/dist/private/dnd/useDroppableCollection.cjs.map +1 -1
  201. package/dist/private/dnd/useDroppableCollection.js +4 -0
  202. package/dist/private/dnd/useDroppableCollection.js.map +1 -1
  203. package/dist/private/dnd/useDroppableCollection.mjs +4 -0
  204. package/dist/private/dnd/useDroppableCollection.mjs.map +1 -1
  205. package/dist/private/focus/FocusScope.cjs +12 -5
  206. package/dist/private/focus/FocusScope.cjs.map +1 -1
  207. package/dist/private/focus/FocusScope.js +12 -6
  208. package/dist/private/focus/FocusScope.js.map +1 -1
  209. package/dist/private/focus/FocusScope.mjs +12 -5
  210. package/dist/private/focus/FocusScope.mjs.map +1 -1
  211. package/dist/private/focus/useFocusRing.cjs +2 -1
  212. package/dist/private/focus/useFocusRing.cjs.map +1 -1
  213. package/dist/private/focus/useFocusRing.js +2 -1
  214. package/dist/private/focus/useFocusRing.js.map +1 -1
  215. package/dist/private/focus/useFocusRing.mjs +2 -1
  216. package/dist/private/focus/useFocusRing.mjs.map +1 -1
  217. package/dist/private/form/useFormValidation.cjs +6 -0
  218. package/dist/private/form/useFormValidation.cjs.map +1 -1
  219. package/dist/private/form/useFormValidation.js +6 -0
  220. package/dist/private/form/useFormValidation.js.map +1 -1
  221. package/dist/private/form/useFormValidation.mjs +6 -0
  222. package/dist/private/form/useFormValidation.mjs.map +1 -1
  223. package/dist/private/grid/useGrid.cjs +3 -2
  224. package/dist/private/grid/useGrid.cjs.map +1 -1
  225. package/dist/private/grid/useGrid.js +3 -2
  226. package/dist/private/grid/useGrid.js.map +1 -1
  227. package/dist/private/grid/useGrid.mjs +3 -2
  228. package/dist/private/grid/useGrid.mjs.map +1 -1
  229. package/dist/private/grid/useGridCell.cjs +44 -8
  230. package/dist/private/grid/useGridCell.cjs.map +1 -1
  231. package/dist/private/grid/useGridCell.js +44 -8
  232. package/dist/private/grid/useGridCell.js.map +1 -1
  233. package/dist/private/grid/useGridCell.mjs +44 -8
  234. package/dist/private/grid/useGridCell.mjs.map +1 -1
  235. package/dist/private/grid/utils.cjs.map +1 -1
  236. package/dist/private/grid/utils.js.map +1 -1
  237. package/dist/private/grid/utils.mjs.map +1 -1
  238. package/dist/private/gridlist/useGridListItem.cjs +38 -30
  239. package/dist/private/gridlist/useGridListItem.cjs.map +1 -1
  240. package/dist/private/gridlist/useGridListItem.js +38 -30
  241. package/dist/private/gridlist/useGridListItem.js.map +1 -1
  242. package/dist/private/gridlist/useGridListItem.mjs +38 -30
  243. package/dist/private/gridlist/useGridListItem.mjs.map +1 -1
  244. package/dist/private/interactions/PressResponder.cjs +1 -0
  245. package/dist/private/interactions/PressResponder.cjs.map +1 -1
  246. package/dist/private/interactions/PressResponder.js +1 -0
  247. package/dist/private/interactions/PressResponder.js.map +1 -1
  248. package/dist/private/interactions/PressResponder.mjs +1 -0
  249. package/dist/private/interactions/PressResponder.mjs.map +1 -1
  250. package/dist/private/interactions/Pressable.cjs +1 -0
  251. package/dist/private/interactions/Pressable.cjs.map +1 -1
  252. package/dist/private/interactions/Pressable.js +1 -0
  253. package/dist/private/interactions/Pressable.js.map +1 -1
  254. package/dist/private/interactions/Pressable.mjs +1 -0
  255. package/dist/private/interactions/Pressable.mjs.map +1 -1
  256. package/dist/private/interactions/createEventHandler.cjs +3 -2
  257. package/dist/private/interactions/createEventHandler.cjs.map +1 -1
  258. package/dist/private/interactions/createEventHandler.js +3 -2
  259. package/dist/private/interactions/createEventHandler.js.map +1 -1
  260. package/dist/private/interactions/createEventHandler.mjs +3 -2
  261. package/dist/private/interactions/createEventHandler.mjs.map +1 -1
  262. package/dist/private/interactions/createKeyboardShortcutHandler.cjs +130 -0
  263. package/dist/private/interactions/createKeyboardShortcutHandler.cjs.map +1 -0
  264. package/dist/private/interactions/createKeyboardShortcutHandler.js +125 -0
  265. package/dist/private/interactions/createKeyboardShortcutHandler.js.map +1 -0
  266. package/dist/private/interactions/createKeyboardShortcutHandler.mjs +125 -0
  267. package/dist/private/interactions/createKeyboardShortcutHandler.mjs.map +1 -0
  268. package/dist/private/interactions/textSelection.cjs +2 -2
  269. package/dist/private/interactions/textSelection.cjs.map +1 -1
  270. package/dist/private/interactions/textSelection.js +3 -3
  271. package/dist/private/interactions/textSelection.js.map +1 -1
  272. package/dist/private/interactions/textSelection.mjs +3 -3
  273. package/dist/private/interactions/textSelection.mjs.map +1 -1
  274. package/dist/private/interactions/useContextMenu.cjs +104 -0
  275. package/dist/private/interactions/useContextMenu.cjs.map +1 -0
  276. package/dist/private/interactions/useContextMenu.js +99 -0
  277. package/dist/private/interactions/useContextMenu.js.map +1 -0
  278. package/dist/private/interactions/useContextMenu.mjs +99 -0
  279. package/dist/private/interactions/useContextMenu.mjs.map +1 -0
  280. package/dist/private/interactions/useFocusVisible.cjs +17 -5
  281. package/dist/private/interactions/useFocusVisible.cjs.map +1 -1
  282. package/dist/private/interactions/useFocusVisible.js +17 -5
  283. package/dist/private/interactions/useFocusVisible.js.map +1 -1
  284. package/dist/private/interactions/useFocusVisible.mjs +17 -5
  285. package/dist/private/interactions/useFocusVisible.mjs.map +1 -1
  286. package/dist/private/interactions/useFocusable.cjs +1 -0
  287. package/dist/private/interactions/useFocusable.cjs.map +1 -1
  288. package/dist/private/interactions/useFocusable.js +1 -0
  289. package/dist/private/interactions/useFocusable.js.map +1 -1
  290. package/dist/private/interactions/useFocusable.mjs +1 -0
  291. package/dist/private/interactions/useFocusable.mjs.map +1 -1
  292. package/dist/private/interactions/useHover.cjs +2 -1
  293. package/dist/private/interactions/useHover.cjs.map +1 -1
  294. package/dist/private/interactions/useHover.js +2 -1
  295. package/dist/private/interactions/useHover.js.map +1 -1
  296. package/dist/private/interactions/useHover.mjs +2 -1
  297. package/dist/private/interactions/useHover.mjs.map +1 -1
  298. package/dist/private/interactions/useKeyboard.cjs +46 -2
  299. package/dist/private/interactions/useKeyboard.cjs.map +1 -1
  300. package/dist/private/interactions/useKeyboard.js +48 -2
  301. package/dist/private/interactions/useKeyboard.js.map +1 -1
  302. package/dist/private/interactions/useKeyboard.mjs +46 -2
  303. package/dist/private/interactions/useKeyboard.mjs.map +1 -1
  304. package/dist/private/interactions/useLongPress.cjs +22 -22
  305. package/dist/private/interactions/useLongPress.cjs.map +1 -1
  306. package/dist/private/interactions/useLongPress.js +22 -22
  307. package/dist/private/interactions/useLongPress.js.map +1 -1
  308. package/dist/private/interactions/useLongPress.mjs +22 -22
  309. package/dist/private/interactions/useLongPress.mjs.map +1 -1
  310. package/dist/private/interactions/useMove.cjs +1 -8
  311. package/dist/private/interactions/useMove.cjs.map +1 -1
  312. package/dist/private/interactions/useMove.js +1 -8
  313. package/dist/private/interactions/useMove.js.map +1 -1
  314. package/dist/private/interactions/useMove.mjs +1 -8
  315. package/dist/private/interactions/useMove.mjs.map +1 -1
  316. package/dist/private/interactions/usePress.cjs +18 -33
  317. package/dist/private/interactions/usePress.cjs.map +1 -1
  318. package/dist/private/interactions/usePress.js +18 -33
  319. package/dist/private/interactions/usePress.js.map +1 -1
  320. package/dist/private/interactions/usePress.mjs +18 -33
  321. package/dist/private/interactions/usePress.mjs.map +1 -1
  322. package/dist/private/interactions/utils.cjs +24 -14
  323. package/dist/private/interactions/utils.cjs.map +1 -1
  324. package/dist/private/interactions/utils.js +26 -16
  325. package/dist/private/interactions/utils.js.map +1 -1
  326. package/dist/private/interactions/utils.mjs +26 -16
  327. package/dist/private/interactions/utils.mjs.map +1 -1
  328. package/dist/private/intl/combobox/fi-FI.cjs +5 -5
  329. package/dist/private/intl/combobox/fi-FI.cjs.map +1 -1
  330. package/dist/private/intl/combobox/fi-FI.js +5 -5
  331. package/dist/private/intl/combobox/fi-FI.js.map +1 -1
  332. package/dist/private/intl/combobox/fi-FI.mjs +5 -5
  333. package/dist/private/intl/combobox/fi-FI.mjs.map +1 -1
  334. package/dist/private/intl/previewtrigger/ar-AE.cjs +6 -0
  335. package/dist/private/intl/previewtrigger/ar-AE.cjs.map +1 -0
  336. package/dist/private/intl/previewtrigger/ar-AE.js +8 -0
  337. package/dist/private/intl/previewtrigger/ar-AE.js.map +1 -0
  338. package/dist/private/intl/previewtrigger/ar-AE.mjs +8 -0
  339. package/dist/private/intl/previewtrigger/ar-AE.mjs.map +1 -0
  340. package/dist/private/intl/previewtrigger/bg-BG.cjs +6 -0
  341. package/dist/private/intl/previewtrigger/bg-BG.cjs.map +1 -0
  342. package/dist/private/intl/previewtrigger/bg-BG.js +8 -0
  343. package/dist/private/intl/previewtrigger/bg-BG.js.map +1 -0
  344. package/dist/private/intl/previewtrigger/bg-BG.mjs +8 -0
  345. package/dist/private/intl/previewtrigger/bg-BG.mjs.map +1 -0
  346. package/dist/private/intl/previewtrigger/cs-CZ.cjs +6 -0
  347. package/dist/private/intl/previewtrigger/cs-CZ.cjs.map +1 -0
  348. package/dist/private/intl/previewtrigger/cs-CZ.js +8 -0
  349. package/dist/private/intl/previewtrigger/cs-CZ.js.map +1 -0
  350. package/dist/private/intl/previewtrigger/cs-CZ.mjs +8 -0
  351. package/dist/private/intl/previewtrigger/cs-CZ.mjs.map +1 -0
  352. package/dist/private/intl/previewtrigger/da-DK.cjs +6 -0
  353. package/dist/private/intl/previewtrigger/da-DK.cjs.map +1 -0
  354. package/dist/private/intl/previewtrigger/da-DK.js +8 -0
  355. package/dist/private/intl/previewtrigger/da-DK.js.map +1 -0
  356. package/dist/private/intl/previewtrigger/da-DK.mjs +8 -0
  357. package/dist/private/intl/previewtrigger/da-DK.mjs.map +1 -0
  358. package/dist/private/intl/previewtrigger/de-DE.cjs +6 -0
  359. package/dist/private/intl/previewtrigger/de-DE.cjs.map +1 -0
  360. package/dist/private/intl/previewtrigger/de-DE.js +8 -0
  361. package/dist/private/intl/previewtrigger/de-DE.js.map +1 -0
  362. package/dist/private/intl/previewtrigger/de-DE.mjs +8 -0
  363. package/dist/private/intl/previewtrigger/de-DE.mjs.map +1 -0
  364. package/dist/private/intl/previewtrigger/el-GR.cjs +6 -0
  365. package/dist/private/intl/previewtrigger/el-GR.cjs.map +1 -0
  366. package/dist/private/intl/previewtrigger/el-GR.js +8 -0
  367. package/dist/private/intl/previewtrigger/el-GR.js.map +1 -0
  368. package/dist/private/intl/previewtrigger/el-GR.mjs +8 -0
  369. package/dist/private/intl/previewtrigger/el-GR.mjs.map +1 -0
  370. package/dist/private/intl/previewtrigger/en-US.cjs +6 -0
  371. package/dist/private/intl/previewtrigger/en-US.cjs.map +1 -0
  372. package/dist/private/intl/previewtrigger/en-US.js +8 -0
  373. package/dist/private/intl/previewtrigger/en-US.js.map +1 -0
  374. package/dist/private/intl/previewtrigger/en-US.mjs +8 -0
  375. package/dist/private/intl/previewtrigger/en-US.mjs.map +1 -0
  376. package/dist/private/intl/previewtrigger/es-ES.cjs +6 -0
  377. package/dist/private/intl/previewtrigger/es-ES.cjs.map +1 -0
  378. package/dist/private/intl/previewtrigger/es-ES.js +8 -0
  379. package/dist/private/intl/previewtrigger/es-ES.js.map +1 -0
  380. package/dist/private/intl/previewtrigger/es-ES.mjs +8 -0
  381. package/dist/private/intl/previewtrigger/es-ES.mjs.map +1 -0
  382. package/dist/private/intl/previewtrigger/et-EE.cjs +6 -0
  383. package/dist/private/intl/previewtrigger/et-EE.cjs.map +1 -0
  384. package/dist/private/intl/previewtrigger/et-EE.js +8 -0
  385. package/dist/private/intl/previewtrigger/et-EE.js.map +1 -0
  386. package/dist/private/intl/previewtrigger/et-EE.mjs +8 -0
  387. package/dist/private/intl/previewtrigger/et-EE.mjs.map +1 -0
  388. package/dist/private/intl/previewtrigger/fi-FI.cjs +6 -0
  389. package/dist/private/intl/previewtrigger/fi-FI.cjs.map +1 -0
  390. package/dist/private/intl/previewtrigger/fi-FI.js +8 -0
  391. package/dist/private/intl/previewtrigger/fi-FI.js.map +1 -0
  392. package/dist/private/intl/previewtrigger/fi-FI.mjs +8 -0
  393. package/dist/private/intl/previewtrigger/fi-FI.mjs.map +1 -0
  394. package/dist/private/intl/previewtrigger/fr-FR.cjs +6 -0
  395. package/dist/private/intl/previewtrigger/fr-FR.cjs.map +1 -0
  396. package/dist/private/intl/previewtrigger/fr-FR.js +8 -0
  397. package/dist/private/intl/previewtrigger/fr-FR.js.map +1 -0
  398. package/dist/private/intl/previewtrigger/fr-FR.mjs +8 -0
  399. package/dist/private/intl/previewtrigger/fr-FR.mjs.map +1 -0
  400. package/dist/private/intl/previewtrigger/he-IL.cjs +6 -0
  401. package/dist/private/intl/previewtrigger/he-IL.cjs.map +1 -0
  402. package/dist/private/intl/previewtrigger/he-IL.js +8 -0
  403. package/dist/private/intl/previewtrigger/he-IL.js.map +1 -0
  404. package/dist/private/intl/previewtrigger/he-IL.mjs +8 -0
  405. package/dist/private/intl/previewtrigger/he-IL.mjs.map +1 -0
  406. package/dist/private/intl/previewtrigger/hr-HR.cjs +6 -0
  407. package/dist/private/intl/previewtrigger/hr-HR.cjs.map +1 -0
  408. package/dist/private/intl/previewtrigger/hr-HR.js +8 -0
  409. package/dist/private/intl/previewtrigger/hr-HR.js.map +1 -0
  410. package/dist/private/intl/previewtrigger/hr-HR.mjs +8 -0
  411. package/dist/private/intl/previewtrigger/hr-HR.mjs.map +1 -0
  412. package/dist/private/intl/previewtrigger/hu-HU.cjs +6 -0
  413. package/dist/private/intl/previewtrigger/hu-HU.cjs.map +1 -0
  414. package/dist/private/intl/previewtrigger/hu-HU.js +8 -0
  415. package/dist/private/intl/previewtrigger/hu-HU.js.map +1 -0
  416. package/dist/private/intl/previewtrigger/hu-HU.mjs +8 -0
  417. package/dist/private/intl/previewtrigger/hu-HU.mjs.map +1 -0
  418. package/dist/private/intl/previewtrigger/it-IT.cjs +6 -0
  419. package/dist/private/intl/previewtrigger/it-IT.cjs.map +1 -0
  420. package/dist/private/intl/previewtrigger/it-IT.js +8 -0
  421. package/dist/private/intl/previewtrigger/it-IT.js.map +1 -0
  422. package/dist/private/intl/previewtrigger/it-IT.mjs +8 -0
  423. package/dist/private/intl/previewtrigger/it-IT.mjs.map +1 -0
  424. package/dist/private/intl/previewtrigger/ja-JP.cjs +6 -0
  425. package/dist/private/intl/previewtrigger/ja-JP.cjs.map +1 -0
  426. package/dist/private/intl/previewtrigger/ja-JP.js +8 -0
  427. package/dist/private/intl/previewtrigger/ja-JP.js.map +1 -0
  428. package/dist/private/intl/previewtrigger/ja-JP.mjs +8 -0
  429. package/dist/private/intl/previewtrigger/ja-JP.mjs.map +1 -0
  430. package/dist/private/intl/previewtrigger/ko-KR.cjs +6 -0
  431. package/dist/private/intl/previewtrigger/ko-KR.cjs.map +1 -0
  432. package/dist/private/intl/previewtrigger/ko-KR.js +8 -0
  433. package/dist/private/intl/previewtrigger/ko-KR.js.map +1 -0
  434. package/dist/private/intl/previewtrigger/ko-KR.mjs +8 -0
  435. package/dist/private/intl/previewtrigger/ko-KR.mjs.map +1 -0
  436. package/dist/private/intl/previewtrigger/lt-LT.cjs +6 -0
  437. package/dist/private/intl/previewtrigger/lt-LT.cjs.map +1 -0
  438. package/dist/private/intl/previewtrigger/lt-LT.js +8 -0
  439. package/dist/private/intl/previewtrigger/lt-LT.js.map +1 -0
  440. package/dist/private/intl/previewtrigger/lt-LT.mjs +8 -0
  441. package/dist/private/intl/previewtrigger/lt-LT.mjs.map +1 -0
  442. package/dist/private/intl/previewtrigger/lv-LV.cjs +6 -0
  443. package/dist/private/intl/previewtrigger/lv-LV.cjs.map +1 -0
  444. package/dist/private/intl/previewtrigger/lv-LV.js +8 -0
  445. package/dist/private/intl/previewtrigger/lv-LV.js.map +1 -0
  446. package/dist/private/intl/previewtrigger/lv-LV.mjs +8 -0
  447. package/dist/private/intl/previewtrigger/lv-LV.mjs.map +1 -0
  448. package/dist/private/intl/previewtrigger/nb-NO.cjs +6 -0
  449. package/dist/private/intl/previewtrigger/nb-NO.cjs.map +1 -0
  450. package/dist/private/intl/previewtrigger/nb-NO.js +8 -0
  451. package/dist/private/intl/previewtrigger/nb-NO.js.map +1 -0
  452. package/dist/private/intl/previewtrigger/nb-NO.mjs +8 -0
  453. package/dist/private/intl/previewtrigger/nb-NO.mjs.map +1 -0
  454. package/dist/private/intl/previewtrigger/nl-NL.cjs +6 -0
  455. package/dist/private/intl/previewtrigger/nl-NL.cjs.map +1 -0
  456. package/dist/private/intl/previewtrigger/nl-NL.js +8 -0
  457. package/dist/private/intl/previewtrigger/nl-NL.js.map +1 -0
  458. package/dist/private/intl/previewtrigger/nl-NL.mjs +8 -0
  459. package/dist/private/intl/previewtrigger/nl-NL.mjs.map +1 -0
  460. package/dist/private/intl/previewtrigger/pl-PL.cjs +6 -0
  461. package/dist/private/intl/previewtrigger/pl-PL.cjs.map +1 -0
  462. package/dist/private/intl/previewtrigger/pl-PL.js +8 -0
  463. package/dist/private/intl/previewtrigger/pl-PL.js.map +1 -0
  464. package/dist/private/intl/previewtrigger/pl-PL.mjs +8 -0
  465. package/dist/private/intl/previewtrigger/pl-PL.mjs.map +1 -0
  466. package/dist/private/intl/previewtrigger/pt-BR.cjs +6 -0
  467. package/dist/private/intl/previewtrigger/pt-BR.cjs.map +1 -0
  468. package/dist/private/intl/previewtrigger/pt-BR.js +8 -0
  469. package/dist/private/intl/previewtrigger/pt-BR.js.map +1 -0
  470. package/dist/private/intl/previewtrigger/pt-BR.mjs +8 -0
  471. package/dist/private/intl/previewtrigger/pt-BR.mjs.map +1 -0
  472. package/dist/private/intl/previewtrigger/pt-PT.cjs +6 -0
  473. package/dist/private/intl/previewtrigger/pt-PT.cjs.map +1 -0
  474. package/dist/private/intl/previewtrigger/pt-PT.js +8 -0
  475. package/dist/private/intl/previewtrigger/pt-PT.js.map +1 -0
  476. package/dist/private/intl/previewtrigger/pt-PT.mjs +8 -0
  477. package/dist/private/intl/previewtrigger/pt-PT.mjs.map +1 -0
  478. package/dist/private/intl/previewtrigger/ro-RO.cjs +6 -0
  479. package/dist/private/intl/previewtrigger/ro-RO.cjs.map +1 -0
  480. package/dist/private/intl/previewtrigger/ro-RO.js +8 -0
  481. package/dist/private/intl/previewtrigger/ro-RO.js.map +1 -0
  482. package/dist/private/intl/previewtrigger/ro-RO.mjs +8 -0
  483. package/dist/private/intl/previewtrigger/ro-RO.mjs.map +1 -0
  484. package/dist/private/intl/previewtrigger/ru-RU.cjs +6 -0
  485. package/dist/private/intl/previewtrigger/ru-RU.cjs.map +1 -0
  486. package/dist/private/intl/previewtrigger/ru-RU.js +8 -0
  487. package/dist/private/intl/previewtrigger/ru-RU.js.map +1 -0
  488. package/dist/private/intl/previewtrigger/ru-RU.mjs +8 -0
  489. package/dist/private/intl/previewtrigger/ru-RU.mjs.map +1 -0
  490. package/dist/private/intl/previewtrigger/sk-SK.cjs +6 -0
  491. package/dist/private/intl/previewtrigger/sk-SK.cjs.map +1 -0
  492. package/dist/private/intl/previewtrigger/sk-SK.js +8 -0
  493. package/dist/private/intl/previewtrigger/sk-SK.js.map +1 -0
  494. package/dist/private/intl/previewtrigger/sk-SK.mjs +8 -0
  495. package/dist/private/intl/previewtrigger/sk-SK.mjs.map +1 -0
  496. package/dist/private/intl/previewtrigger/sl-SI.cjs +6 -0
  497. package/dist/private/intl/previewtrigger/sl-SI.cjs.map +1 -0
  498. package/dist/private/intl/previewtrigger/sl-SI.js +8 -0
  499. package/dist/private/intl/previewtrigger/sl-SI.js.map +1 -0
  500. package/dist/private/intl/previewtrigger/sl-SI.mjs +8 -0
  501. package/dist/private/intl/previewtrigger/sl-SI.mjs.map +1 -0
  502. package/dist/private/intl/previewtrigger/sr-SP.cjs +6 -0
  503. package/dist/private/intl/previewtrigger/sr-SP.cjs.map +1 -0
  504. package/dist/private/intl/previewtrigger/sr-SP.js +8 -0
  505. package/dist/private/intl/previewtrigger/sr-SP.js.map +1 -0
  506. package/dist/private/intl/previewtrigger/sr-SP.mjs +8 -0
  507. package/dist/private/intl/previewtrigger/sr-SP.mjs.map +1 -0
  508. package/dist/private/intl/previewtrigger/sv-SE.cjs +6 -0
  509. package/dist/private/intl/previewtrigger/sv-SE.cjs.map +1 -0
  510. package/dist/private/intl/previewtrigger/sv-SE.js +8 -0
  511. package/dist/private/intl/previewtrigger/sv-SE.js.map +1 -0
  512. package/dist/private/intl/previewtrigger/sv-SE.mjs +8 -0
  513. package/dist/private/intl/previewtrigger/sv-SE.mjs.map +1 -0
  514. package/dist/private/intl/previewtrigger/tr-TR.cjs +6 -0
  515. package/dist/private/intl/previewtrigger/tr-TR.cjs.map +1 -0
  516. package/dist/private/intl/previewtrigger/tr-TR.js +8 -0
  517. package/dist/private/intl/previewtrigger/tr-TR.js.map +1 -0
  518. package/dist/private/intl/previewtrigger/tr-TR.mjs +8 -0
  519. package/dist/private/intl/previewtrigger/tr-TR.mjs.map +1 -0
  520. package/dist/private/intl/previewtrigger/uk-UA.cjs +6 -0
  521. package/dist/private/intl/previewtrigger/uk-UA.cjs.map +1 -0
  522. package/dist/private/intl/previewtrigger/uk-UA.js +8 -0
  523. package/dist/private/intl/previewtrigger/uk-UA.js.map +1 -0
  524. package/dist/private/intl/previewtrigger/uk-UA.mjs +8 -0
  525. package/dist/private/intl/previewtrigger/uk-UA.mjs.map +1 -0
  526. package/dist/private/intl/previewtrigger/zh-CN.cjs +6 -0
  527. package/dist/private/intl/previewtrigger/zh-CN.cjs.map +1 -0
  528. package/dist/private/intl/previewtrigger/zh-CN.js +8 -0
  529. package/dist/private/intl/previewtrigger/zh-CN.js.map +1 -0
  530. package/dist/private/intl/previewtrigger/zh-CN.mjs +8 -0
  531. package/dist/private/intl/previewtrigger/zh-CN.mjs.map +1 -0
  532. package/dist/private/intl/previewtrigger/zh-TW.cjs +6 -0
  533. package/dist/private/intl/previewtrigger/zh-TW.cjs.map +1 -0
  534. package/dist/private/intl/previewtrigger/zh-TW.js +8 -0
  535. package/dist/private/intl/previewtrigger/zh-TW.js.map +1 -0
  536. package/dist/private/intl/previewtrigger/zh-TW.mjs +8 -0
  537. package/dist/private/intl/previewtrigger/zh-TW.mjs.map +1 -0
  538. package/dist/private/intl/table/ar-AE.cjs +3 -3
  539. package/dist/private/intl/table/ar-AE.cjs.map +1 -1
  540. package/dist/private/intl/table/ar-AE.js +3 -3
  541. package/dist/private/intl/table/ar-AE.js.map +1 -1
  542. package/dist/private/intl/table/ar-AE.mjs +3 -3
  543. package/dist/private/intl/table/ar-AE.mjs.map +1 -1
  544. package/dist/private/intl/table/bg-BG.cjs +3 -3
  545. package/dist/private/intl/table/bg-BG.cjs.map +1 -1
  546. package/dist/private/intl/table/bg-BG.js +3 -3
  547. package/dist/private/intl/table/bg-BG.js.map +1 -1
  548. package/dist/private/intl/table/bg-BG.mjs +3 -3
  549. package/dist/private/intl/table/bg-BG.mjs.map +1 -1
  550. package/dist/private/intl/table/cs-CZ.cjs +3 -3
  551. package/dist/private/intl/table/cs-CZ.cjs.map +1 -1
  552. package/dist/private/intl/table/cs-CZ.js +3 -3
  553. package/dist/private/intl/table/cs-CZ.js.map +1 -1
  554. package/dist/private/intl/table/cs-CZ.mjs +3 -3
  555. package/dist/private/intl/table/cs-CZ.mjs.map +1 -1
  556. package/dist/private/intl/table/da-DK.cjs +3 -3
  557. package/dist/private/intl/table/da-DK.cjs.map +1 -1
  558. package/dist/private/intl/table/da-DK.js +3 -3
  559. package/dist/private/intl/table/da-DK.js.map +1 -1
  560. package/dist/private/intl/table/da-DK.mjs +3 -3
  561. package/dist/private/intl/table/da-DK.mjs.map +1 -1
  562. package/dist/private/intl/table/de-DE.cjs +3 -3
  563. package/dist/private/intl/table/de-DE.cjs.map +1 -1
  564. package/dist/private/intl/table/de-DE.js +3 -3
  565. package/dist/private/intl/table/de-DE.js.map +1 -1
  566. package/dist/private/intl/table/de-DE.mjs +3 -3
  567. package/dist/private/intl/table/de-DE.mjs.map +1 -1
  568. package/dist/private/intl/table/el-GR.cjs +3 -3
  569. package/dist/private/intl/table/el-GR.cjs.map +1 -1
  570. package/dist/private/intl/table/el-GR.js +3 -3
  571. package/dist/private/intl/table/el-GR.js.map +1 -1
  572. package/dist/private/intl/table/el-GR.mjs +3 -3
  573. package/dist/private/intl/table/el-GR.mjs.map +1 -1
  574. package/dist/private/intl/table/es-ES.cjs +3 -3
  575. package/dist/private/intl/table/es-ES.cjs.map +1 -1
  576. package/dist/private/intl/table/es-ES.js +3 -3
  577. package/dist/private/intl/table/es-ES.js.map +1 -1
  578. package/dist/private/intl/table/es-ES.mjs +3 -3
  579. package/dist/private/intl/table/es-ES.mjs.map +1 -1
  580. package/dist/private/intl/table/et-EE.cjs +3 -3
  581. package/dist/private/intl/table/et-EE.cjs.map +1 -1
  582. package/dist/private/intl/table/et-EE.js +3 -3
  583. package/dist/private/intl/table/et-EE.js.map +1 -1
  584. package/dist/private/intl/table/et-EE.mjs +3 -3
  585. package/dist/private/intl/table/et-EE.mjs.map +1 -1
  586. package/dist/private/intl/table/fi-FI.cjs +3 -3
  587. package/dist/private/intl/table/fi-FI.cjs.map +1 -1
  588. package/dist/private/intl/table/fi-FI.js +3 -3
  589. package/dist/private/intl/table/fi-FI.js.map +1 -1
  590. package/dist/private/intl/table/fi-FI.mjs +3 -3
  591. package/dist/private/intl/table/fi-FI.mjs.map +1 -1
  592. package/dist/private/intl/table/fr-FR.cjs +3 -3
  593. package/dist/private/intl/table/fr-FR.cjs.map +1 -1
  594. package/dist/private/intl/table/fr-FR.js +3 -3
  595. package/dist/private/intl/table/fr-FR.js.map +1 -1
  596. package/dist/private/intl/table/fr-FR.mjs +3 -3
  597. package/dist/private/intl/table/fr-FR.mjs.map +1 -1
  598. package/dist/private/intl/table/he-IL.cjs +3 -3
  599. package/dist/private/intl/table/he-IL.cjs.map +1 -1
  600. package/dist/private/intl/table/he-IL.js +3 -3
  601. package/dist/private/intl/table/he-IL.js.map +1 -1
  602. package/dist/private/intl/table/he-IL.mjs +3 -3
  603. package/dist/private/intl/table/he-IL.mjs.map +1 -1
  604. package/dist/private/intl/table/hr-HR.cjs +3 -3
  605. package/dist/private/intl/table/hr-HR.cjs.map +1 -1
  606. package/dist/private/intl/table/hr-HR.js +3 -3
  607. package/dist/private/intl/table/hr-HR.js.map +1 -1
  608. package/dist/private/intl/table/hr-HR.mjs +3 -3
  609. package/dist/private/intl/table/hr-HR.mjs.map +1 -1
  610. package/dist/private/intl/table/hu-HU.cjs +3 -3
  611. package/dist/private/intl/table/hu-HU.cjs.map +1 -1
  612. package/dist/private/intl/table/hu-HU.js +3 -3
  613. package/dist/private/intl/table/hu-HU.js.map +1 -1
  614. package/dist/private/intl/table/hu-HU.mjs +3 -3
  615. package/dist/private/intl/table/hu-HU.mjs.map +1 -1
  616. package/dist/private/intl/table/it-IT.cjs +3 -3
  617. package/dist/private/intl/table/it-IT.cjs.map +1 -1
  618. package/dist/private/intl/table/it-IT.js +3 -3
  619. package/dist/private/intl/table/it-IT.js.map +1 -1
  620. package/dist/private/intl/table/it-IT.mjs +3 -3
  621. package/dist/private/intl/table/it-IT.mjs.map +1 -1
  622. package/dist/private/intl/table/ja-JP.cjs +3 -3
  623. package/dist/private/intl/table/ja-JP.cjs.map +1 -1
  624. package/dist/private/intl/table/ja-JP.js +3 -3
  625. package/dist/private/intl/table/ja-JP.js.map +1 -1
  626. package/dist/private/intl/table/ja-JP.mjs +3 -3
  627. package/dist/private/intl/table/ja-JP.mjs.map +1 -1
  628. package/dist/private/intl/table/ko-KR.cjs +3 -3
  629. package/dist/private/intl/table/ko-KR.cjs.map +1 -1
  630. package/dist/private/intl/table/ko-KR.js +3 -3
  631. package/dist/private/intl/table/ko-KR.js.map +1 -1
  632. package/dist/private/intl/table/ko-KR.mjs +3 -3
  633. package/dist/private/intl/table/ko-KR.mjs.map +1 -1
  634. package/dist/private/intl/table/lt-LT.cjs +3 -3
  635. package/dist/private/intl/table/lt-LT.cjs.map +1 -1
  636. package/dist/private/intl/table/lt-LT.js +3 -3
  637. package/dist/private/intl/table/lt-LT.js.map +1 -1
  638. package/dist/private/intl/table/lt-LT.mjs +3 -3
  639. package/dist/private/intl/table/lt-LT.mjs.map +1 -1
  640. package/dist/private/intl/table/lv-LV.cjs +3 -3
  641. package/dist/private/intl/table/lv-LV.cjs.map +1 -1
  642. package/dist/private/intl/table/lv-LV.js +3 -3
  643. package/dist/private/intl/table/lv-LV.js.map +1 -1
  644. package/dist/private/intl/table/lv-LV.mjs +3 -3
  645. package/dist/private/intl/table/lv-LV.mjs.map +1 -1
  646. package/dist/private/intl/table/nb-NO.cjs +3 -3
  647. package/dist/private/intl/table/nb-NO.cjs.map +1 -1
  648. package/dist/private/intl/table/nb-NO.js +3 -3
  649. package/dist/private/intl/table/nb-NO.js.map +1 -1
  650. package/dist/private/intl/table/nb-NO.mjs +3 -3
  651. package/dist/private/intl/table/nb-NO.mjs.map +1 -1
  652. package/dist/private/intl/table/nl-NL.cjs +3 -3
  653. package/dist/private/intl/table/nl-NL.cjs.map +1 -1
  654. package/dist/private/intl/table/nl-NL.js +3 -3
  655. package/dist/private/intl/table/nl-NL.js.map +1 -1
  656. package/dist/private/intl/table/nl-NL.mjs +3 -3
  657. package/dist/private/intl/table/nl-NL.mjs.map +1 -1
  658. package/dist/private/intl/table/pl-PL.cjs +3 -3
  659. package/dist/private/intl/table/pl-PL.cjs.map +1 -1
  660. package/dist/private/intl/table/pl-PL.js +3 -3
  661. package/dist/private/intl/table/pl-PL.js.map +1 -1
  662. package/dist/private/intl/table/pl-PL.mjs +3 -3
  663. package/dist/private/intl/table/pl-PL.mjs.map +1 -1
  664. package/dist/private/intl/table/pt-BR.cjs +3 -3
  665. package/dist/private/intl/table/pt-BR.cjs.map +1 -1
  666. package/dist/private/intl/table/pt-BR.js +3 -3
  667. package/dist/private/intl/table/pt-BR.js.map +1 -1
  668. package/dist/private/intl/table/pt-BR.mjs +3 -3
  669. package/dist/private/intl/table/pt-BR.mjs.map +1 -1
  670. package/dist/private/intl/table/pt-PT.cjs +3 -3
  671. package/dist/private/intl/table/pt-PT.cjs.map +1 -1
  672. package/dist/private/intl/table/pt-PT.js +3 -3
  673. package/dist/private/intl/table/pt-PT.js.map +1 -1
  674. package/dist/private/intl/table/pt-PT.mjs +3 -3
  675. package/dist/private/intl/table/pt-PT.mjs.map +1 -1
  676. package/dist/private/intl/table/ro-RO.cjs +3 -3
  677. package/dist/private/intl/table/ro-RO.cjs.map +1 -1
  678. package/dist/private/intl/table/ro-RO.js +3 -3
  679. package/dist/private/intl/table/ro-RO.js.map +1 -1
  680. package/dist/private/intl/table/ro-RO.mjs +3 -3
  681. package/dist/private/intl/table/ro-RO.mjs.map +1 -1
  682. package/dist/private/intl/table/ru-RU.cjs +3 -3
  683. package/dist/private/intl/table/ru-RU.cjs.map +1 -1
  684. package/dist/private/intl/table/ru-RU.js +3 -3
  685. package/dist/private/intl/table/ru-RU.js.map +1 -1
  686. package/dist/private/intl/table/ru-RU.mjs +3 -3
  687. package/dist/private/intl/table/ru-RU.mjs.map +1 -1
  688. package/dist/private/intl/table/sk-SK.cjs +3 -3
  689. package/dist/private/intl/table/sk-SK.cjs.map +1 -1
  690. package/dist/private/intl/table/sk-SK.js +3 -3
  691. package/dist/private/intl/table/sk-SK.js.map +1 -1
  692. package/dist/private/intl/table/sk-SK.mjs +3 -3
  693. package/dist/private/intl/table/sk-SK.mjs.map +1 -1
  694. package/dist/private/intl/table/sl-SI.cjs +3 -3
  695. package/dist/private/intl/table/sl-SI.cjs.map +1 -1
  696. package/dist/private/intl/table/sl-SI.js +3 -3
  697. package/dist/private/intl/table/sl-SI.js.map +1 -1
  698. package/dist/private/intl/table/sl-SI.mjs +3 -3
  699. package/dist/private/intl/table/sl-SI.mjs.map +1 -1
  700. package/dist/private/intl/table/sr-SP.cjs +3 -3
  701. package/dist/private/intl/table/sr-SP.cjs.map +1 -1
  702. package/dist/private/intl/table/sr-SP.js +3 -3
  703. package/dist/private/intl/table/sr-SP.js.map +1 -1
  704. package/dist/private/intl/table/sr-SP.mjs +3 -3
  705. package/dist/private/intl/table/sr-SP.mjs.map +1 -1
  706. package/dist/private/intl/table/sv-SE.cjs +3 -3
  707. package/dist/private/intl/table/sv-SE.cjs.map +1 -1
  708. package/dist/private/intl/table/sv-SE.js +3 -3
  709. package/dist/private/intl/table/sv-SE.js.map +1 -1
  710. package/dist/private/intl/table/sv-SE.mjs +3 -3
  711. package/dist/private/intl/table/sv-SE.mjs.map +1 -1
  712. package/dist/private/intl/table/tr-TR.cjs +3 -3
  713. package/dist/private/intl/table/tr-TR.cjs.map +1 -1
  714. package/dist/private/intl/table/tr-TR.js +3 -3
  715. package/dist/private/intl/table/tr-TR.js.map +1 -1
  716. package/dist/private/intl/table/tr-TR.mjs +3 -3
  717. package/dist/private/intl/table/tr-TR.mjs.map +1 -1
  718. package/dist/private/intl/table/uk-UA.cjs +3 -3
  719. package/dist/private/intl/table/uk-UA.cjs.map +1 -1
  720. package/dist/private/intl/table/uk-UA.js +3 -3
  721. package/dist/private/intl/table/uk-UA.js.map +1 -1
  722. package/dist/private/intl/table/uk-UA.mjs +3 -3
  723. package/dist/private/intl/table/uk-UA.mjs.map +1 -1
  724. package/dist/private/intl/table/zh-CN.cjs +4 -4
  725. package/dist/private/intl/table/zh-CN.cjs.map +1 -1
  726. package/dist/private/intl/table/zh-CN.js +4 -4
  727. package/dist/private/intl/table/zh-CN.js.map +1 -1
  728. package/dist/private/intl/table/zh-CN.mjs +4 -4
  729. package/dist/private/intl/table/zh-CN.mjs.map +1 -1
  730. package/dist/private/intl/table/zh-TW.cjs +3 -3
  731. package/dist/private/intl/table/zh-TW.cjs.map +1 -1
  732. package/dist/private/intl/table/zh-TW.js +3 -3
  733. package/dist/private/intl/table/zh-TW.js.map +1 -1
  734. package/dist/private/intl/table/zh-TW.mjs +3 -3
  735. package/dist/private/intl/table/zh-TW.mjs.map +1 -1
  736. package/dist/private/intl/tree/es-ES.cjs +1 -1
  737. package/dist/private/intl/tree/es-ES.cjs.map +1 -1
  738. package/dist/private/intl/tree/es-ES.js +1 -1
  739. package/dist/private/intl/tree/es-ES.js.map +1 -1
  740. package/dist/private/intl/tree/es-ES.mjs +1 -1
  741. package/dist/private/intl/tree/es-ES.mjs.map +1 -1
  742. package/dist/private/link/useLink.cjs +2 -1
  743. package/dist/private/link/useLink.cjs.map +1 -1
  744. package/dist/private/link/useLink.js +2 -1
  745. package/dist/private/link/useLink.js.map +1 -1
  746. package/dist/private/link/useLink.mjs +2 -1
  747. package/dist/private/link/useLink.mjs.map +1 -1
  748. package/dist/private/menu/useMenuItem.cjs +33 -33
  749. package/dist/private/menu/useMenuItem.cjs.map +1 -1
  750. package/dist/private/menu/useMenuItem.js +33 -33
  751. package/dist/private/menu/useMenuItem.js.map +1 -1
  752. package/dist/private/menu/useMenuItem.mjs +33 -33
  753. package/dist/private/menu/useMenuItem.mjs.map +1 -1
  754. package/dist/private/menu/useMenuTrigger.cjs +96 -30
  755. package/dist/private/menu/useMenuTrigger.cjs.map +1 -1
  756. package/dist/private/menu/useMenuTrigger.js +96 -30
  757. package/dist/private/menu/useMenuTrigger.js.map +1 -1
  758. package/dist/private/menu/useMenuTrigger.mjs +96 -30
  759. package/dist/private/menu/useMenuTrigger.mjs.map +1 -1
  760. package/dist/private/menu/useSubmenuTrigger.cjs +44 -36
  761. package/dist/private/menu/useSubmenuTrigger.cjs.map +1 -1
  762. package/dist/private/menu/useSubmenuTrigger.js +44 -36
  763. package/dist/private/menu/useSubmenuTrigger.js.map +1 -1
  764. package/dist/private/menu/useSubmenuTrigger.mjs +44 -36
  765. package/dist/private/menu/useSubmenuTrigger.mjs.map +1 -1
  766. package/dist/private/numberfield/useNumberField.cjs +24 -19
  767. package/dist/private/numberfield/useNumberField.cjs.map +1 -1
  768. package/dist/private/numberfield/useNumberField.js +24 -19
  769. package/dist/private/numberfield/useNumberField.js.map +1 -1
  770. package/dist/private/numberfield/useNumberField.mjs +24 -19
  771. package/dist/private/numberfield/useNumberField.mjs.map +1 -1
  772. package/dist/private/overlays/Overlay.cjs +5 -1
  773. package/dist/private/overlays/Overlay.cjs.map +1 -1
  774. package/dist/private/overlays/Overlay.js +5 -1
  775. package/dist/private/overlays/Overlay.js.map +1 -1
  776. package/dist/private/overlays/Overlay.mjs +5 -1
  777. package/dist/private/overlays/Overlay.mjs.map +1 -1
  778. package/dist/private/overlays/ariaHideOutside.cjs +12 -8
  779. package/dist/private/overlays/ariaHideOutside.cjs.map +1 -1
  780. package/dist/private/overlays/ariaHideOutside.js +13 -9
  781. package/dist/private/overlays/ariaHideOutside.js.map +1 -1
  782. package/dist/private/overlays/ariaHideOutside.mjs +13 -9
  783. package/dist/private/overlays/ariaHideOutside.mjs.map +1 -1
  784. package/dist/private/overlays/calculatePosition.cjs +3 -2
  785. package/dist/private/overlays/calculatePosition.cjs.map +1 -1
  786. package/dist/private/overlays/calculatePosition.js +5 -2
  787. package/dist/private/overlays/calculatePosition.js.map +1 -1
  788. package/dist/private/overlays/calculatePosition.mjs +3 -2
  789. package/dist/private/overlays/calculatePosition.mjs.map +1 -1
  790. package/dist/private/overlays/useCloseOnScroll.cjs +3 -4
  791. package/dist/private/overlays/useCloseOnScroll.cjs.map +1 -1
  792. package/dist/private/overlays/useCloseOnScroll.js +4 -5
  793. package/dist/private/overlays/useCloseOnScroll.js.map +1 -1
  794. package/dist/private/overlays/useCloseOnScroll.mjs +4 -5
  795. package/dist/private/overlays/useCloseOnScroll.mjs.map +1 -1
  796. package/dist/private/overlays/useOverlay.cjs +13 -7
  797. package/dist/private/overlays/useOverlay.cjs.map +1 -1
  798. package/dist/private/overlays/useOverlay.js +13 -7
  799. package/dist/private/overlays/useOverlay.js.map +1 -1
  800. package/dist/private/overlays/useOverlay.mjs +13 -7
  801. package/dist/private/overlays/useOverlay.mjs.map +1 -1
  802. package/dist/private/overlays/useOverlayPosition.cjs +11 -0
  803. package/dist/private/overlays/useOverlayPosition.cjs.map +1 -1
  804. package/dist/private/overlays/useOverlayPosition.js +12 -1
  805. package/dist/private/overlays/useOverlayPosition.js.map +1 -1
  806. package/dist/private/overlays/useOverlayPosition.mjs +12 -1
  807. package/dist/private/overlays/useOverlayPosition.mjs.map +1 -1
  808. package/dist/private/overlays/usePopover.cjs +6 -2
  809. package/dist/private/overlays/usePopover.cjs.map +1 -1
  810. package/dist/private/overlays/usePopover.js +7 -2
  811. package/dist/private/overlays/usePopover.js.map +1 -1
  812. package/dist/private/overlays/usePopover.mjs +6 -2
  813. package/dist/private/overlays/usePopover.mjs.map +1 -1
  814. package/dist/private/overlays/usePreventScroll.cjs +29 -40
  815. package/dist/private/overlays/usePreventScroll.cjs.map +1 -1
  816. package/dist/private/overlays/usePreventScroll.js +30 -41
  817. package/dist/private/overlays/usePreventScroll.js.map +1 -1
  818. package/dist/private/overlays/usePreventScroll.mjs +30 -41
  819. package/dist/private/overlays/usePreventScroll.mjs.map +1 -1
  820. package/dist/private/progress/useProgressBar.cjs +2 -1
  821. package/dist/private/progress/useProgressBar.cjs.map +1 -1
  822. package/dist/private/progress/useProgressBar.js +2 -1
  823. package/dist/private/progress/useProgressBar.js.map +1 -1
  824. package/dist/private/progress/useProgressBar.mjs +2 -1
  825. package/dist/private/progress/useProgressBar.mjs.map +1 -1
  826. package/dist/private/radio/useRadioGroup.cjs +26 -23
  827. package/dist/private/radio/useRadioGroup.cjs.map +1 -1
  828. package/dist/private/radio/useRadioGroup.js +26 -23
  829. package/dist/private/radio/useRadioGroup.js.map +1 -1
  830. package/dist/private/radio/useRadioGroup.mjs +26 -23
  831. package/dist/private/radio/useRadioGroup.mjs.map +1 -1
  832. package/dist/private/searchfield/useSearchField.cjs +28 -22
  833. package/dist/private/searchfield/useSearchField.cjs.map +1 -1
  834. package/dist/private/searchfield/useSearchField.js +28 -22
  835. package/dist/private/searchfield/useSearchField.js.map +1 -1
  836. package/dist/private/searchfield/useSearchField.mjs +28 -22
  837. package/dist/private/searchfield/useSearchField.mjs.map +1 -1
  838. package/dist/private/select/useSelect.cjs +21 -23
  839. package/dist/private/select/useSelect.cjs.map +1 -1
  840. package/dist/private/select/useSelect.js +23 -25
  841. package/dist/private/select/useSelect.js.map +1 -1
  842. package/dist/private/select/useSelect.mjs +21 -23
  843. package/dist/private/select/useSelect.mjs.map +1 -1
  844. package/dist/private/selection/useSelectableCollection.cjs +204 -146
  845. package/dist/private/selection/useSelectableCollection.cjs.map +1 -1
  846. package/dist/private/selection/useSelectableCollection.js +208 -150
  847. package/dist/private/selection/useSelectableCollection.js.map +1 -1
  848. package/dist/private/selection/useSelectableCollection.mjs +204 -146
  849. package/dist/private/selection/useSelectableCollection.mjs.map +1 -1
  850. package/dist/private/selection/useSelectableItem.cjs +58 -13
  851. package/dist/private/selection/useSelectableItem.cjs.map +1 -1
  852. package/dist/private/selection/useSelectableItem.js +58 -13
  853. package/dist/private/selection/useSelectableItem.js.map +1 -1
  854. package/dist/private/selection/useSelectableItem.mjs +58 -13
  855. package/dist/private/selection/useSelectableItem.mjs.map +1 -1
  856. package/dist/private/slider/useSlider.cjs.map +1 -1
  857. package/dist/private/slider/useSlider.js.map +1 -1
  858. package/dist/private/slider/useSlider.mjs.map +1 -1
  859. package/dist/private/slider/useSliderThumb.cjs +28 -26
  860. package/dist/private/slider/useSliderThumb.cjs.map +1 -1
  861. package/dist/private/slider/useSliderThumb.js +28 -26
  862. package/dist/private/slider/useSliderThumb.js.map +1 -1
  863. package/dist/private/slider/useSliderThumb.mjs +28 -26
  864. package/dist/private/slider/useSliderThumb.mjs.map +1 -1
  865. package/dist/private/spinbutton/useSpinButton.cjs +49 -34
  866. package/dist/private/spinbutton/useSpinButton.cjs.map +1 -1
  867. package/dist/private/spinbutton/useSpinButton.js +49 -34
  868. package/dist/private/spinbutton/useSpinButton.js.map +1 -1
  869. package/dist/private/spinbutton/useSpinButton.mjs +49 -34
  870. package/dist/private/spinbutton/useSpinButton.mjs.map +1 -1
  871. package/dist/private/ssr/SSRProvider.cjs +12 -3
  872. package/dist/private/ssr/SSRProvider.cjs.map +1 -1
  873. package/dist/private/ssr/SSRProvider.js +12 -3
  874. package/dist/private/ssr/SSRProvider.js.map +1 -1
  875. package/dist/private/ssr/SSRProvider.mjs +12 -3
  876. package/dist/private/ssr/SSRProvider.mjs.map +1 -1
  877. package/dist/private/steplist/useStepListItem.cjs +0 -9
  878. package/dist/private/steplist/useStepListItem.cjs.map +1 -1
  879. package/dist/private/steplist/useStepListItem.js +0 -10
  880. package/dist/private/steplist/useStepListItem.js.map +1 -1
  881. package/dist/private/steplist/useStepListItem.mjs +0 -9
  882. package/dist/private/steplist/useStepListItem.mjs.map +1 -1
  883. package/dist/private/table/useTable.cjs +4 -2
  884. package/dist/private/table/useTable.cjs.map +1 -1
  885. package/dist/private/table/useTable.js +4 -2
  886. package/dist/private/table/useTable.js.map +1 -1
  887. package/dist/private/table/useTable.mjs +4 -2
  888. package/dist/private/table/useTable.mjs.map +1 -1
  889. package/dist/private/table/useTableCell.cjs +2 -0
  890. package/dist/private/table/useTableCell.cjs.map +1 -1
  891. package/dist/private/table/useTableCell.js +2 -0
  892. package/dist/private/table/useTableCell.js.map +1 -1
  893. package/dist/private/table/useTableCell.mjs +2 -0
  894. package/dist/private/table/useTableCell.mjs.map +1 -1
  895. package/dist/private/table/useTableColumnHeader.cjs +2 -3
  896. package/dist/private/table/useTableColumnHeader.cjs.map +1 -1
  897. package/dist/private/table/useTableColumnHeader.js +2 -3
  898. package/dist/private/table/useTableColumnHeader.js.map +1 -1
  899. package/dist/private/table/useTableColumnHeader.mjs +2 -3
  900. package/dist/private/table/useTableColumnHeader.mjs.map +1 -1
  901. package/dist/private/table/useTableColumnResize.cjs +32 -14
  902. package/dist/private/table/useTableColumnResize.cjs.map +1 -1
  903. package/dist/private/table/useTableColumnResize.js +33 -15
  904. package/dist/private/table/useTableColumnResize.js.map +1 -1
  905. package/dist/private/table/useTableColumnResize.mjs +33 -15
  906. package/dist/private/table/useTableColumnResize.mjs.map +1 -1
  907. package/dist/private/table/useTableRow.cjs +4 -2
  908. package/dist/private/table/useTableRow.cjs.map +1 -1
  909. package/dist/private/table/useTableRow.js +4 -2
  910. package/dist/private/table/useTableRow.js.map +1 -1
  911. package/dist/private/table/useTableRow.mjs +4 -2
  912. package/dist/private/table/useTableRow.mjs.map +1 -1
  913. package/dist/private/tabs/TabsKeyboardDelegate.cjs +3 -1
  914. package/dist/private/tabs/TabsKeyboardDelegate.cjs.map +1 -1
  915. package/dist/private/tabs/TabsKeyboardDelegate.js +3 -1
  916. package/dist/private/tabs/TabsKeyboardDelegate.js.map +1 -1
  917. package/dist/private/tabs/TabsKeyboardDelegate.mjs +3 -1
  918. package/dist/private/tabs/TabsKeyboardDelegate.mjs.map +1 -1
  919. package/dist/private/tag/useTag.cjs +21 -11
  920. package/dist/private/tag/useTag.cjs.map +1 -1
  921. package/dist/private/tag/useTag.js +21 -11
  922. package/dist/private/tag/useTag.js.map +1 -1
  923. package/dist/private/tag/useTag.mjs +21 -11
  924. package/dist/private/tag/useTag.mjs.map +1 -1
  925. package/dist/private/textfield/useFormattedTextField.cjs +1 -0
  926. package/dist/private/textfield/useFormattedTextField.cjs.map +1 -1
  927. package/dist/private/textfield/useFormattedTextField.js +1 -0
  928. package/dist/private/textfield/useFormattedTextField.js.map +1 -1
  929. package/dist/private/textfield/useFormattedTextField.mjs +1 -0
  930. package/dist/private/textfield/useFormattedTextField.mjs.map +1 -1
  931. package/dist/private/toast/useToastRegion.cjs +5 -0
  932. package/dist/private/toast/useToastRegion.cjs.map +1 -1
  933. package/dist/private/toast/useToastRegion.js +5 -0
  934. package/dist/private/toast/useToastRegion.js.map +1 -1
  935. package/dist/private/toast/useToastRegion.mjs +5 -0
  936. package/dist/private/toast/useToastRegion.mjs.map +1 -1
  937. package/dist/private/toggle/useToggle.cjs +1 -0
  938. package/dist/private/toggle/useToggle.cjs.map +1 -1
  939. package/dist/private/toggle/useToggle.js +1 -0
  940. package/dist/private/toggle/useToggle.js.map +1 -1
  941. package/dist/private/toggle/useToggle.mjs +1 -0
  942. package/dist/private/toggle/useToggle.mjs.map +1 -1
  943. package/dist/private/tokenfield/useToken.cjs +61 -0
  944. package/dist/private/tokenfield/useToken.cjs.map +1 -0
  945. package/dist/private/tokenfield/useToken.js +57 -0
  946. package/dist/private/tokenfield/useToken.js.map +1 -0
  947. package/dist/private/tokenfield/useToken.mjs +56 -0
  948. package/dist/private/tokenfield/useToken.mjs.map +1 -0
  949. package/dist/private/tokenfield/useTokenField.cjs +663 -0
  950. package/dist/private/tokenfield/useTokenField.cjs.map +1 -0
  951. package/dist/private/tokenfield/useTokenField.js +667 -0
  952. package/dist/private/tokenfield/useTokenField.js.map +1 -0
  953. package/dist/private/tokenfield/useTokenField.mjs +655 -0
  954. package/dist/private/tokenfield/useTokenField.mjs.map +1 -0
  955. package/dist/private/toolbar/useToolbar.cjs +1 -0
  956. package/dist/private/toolbar/useToolbar.cjs.map +1 -1
  957. package/dist/private/toolbar/useToolbar.js +1 -0
  958. package/dist/private/toolbar/useToolbar.js.map +1 -1
  959. package/dist/private/toolbar/useToolbar.mjs +1 -0
  960. package/dist/private/toolbar/useToolbar.mjs.map +1 -1
  961. package/dist/private/tooltip/intlStrings.cjs +108 -0
  962. package/dist/private/tooltip/intlStrings.cjs.map +1 -0
  963. package/dist/private/tooltip/intlStrings.js +110 -0
  964. package/dist/private/tooltip/intlStrings.js.map +1 -0
  965. package/dist/private/tooltip/intlStrings.mjs +110 -0
  966. package/dist/private/tooltip/intlStrings.mjs.map +1 -0
  967. package/dist/private/tooltip/usePreviewTrigger.cjs +212 -0
  968. package/dist/private/tooltip/usePreviewTrigger.cjs.map +1 -0
  969. package/dist/private/tooltip/usePreviewTrigger.js +208 -0
  970. package/dist/private/tooltip/usePreviewTrigger.js.map +1 -0
  971. package/dist/private/tooltip/usePreviewTrigger.mjs +207 -0
  972. package/dist/private/tooltip/usePreviewTrigger.mjs.map +1 -0
  973. package/dist/private/tooltip/useSafeArea.cjs +134 -0
  974. package/dist/private/tooltip/useSafeArea.cjs.map +1 -0
  975. package/dist/private/tooltip/useSafeArea.js +130 -0
  976. package/dist/private/tooltip/useSafeArea.js.map +1 -0
  977. package/dist/private/tooltip/useSafeArea.mjs +129 -0
  978. package/dist/private/tooltip/useSafeArea.mjs.map +1 -0
  979. package/dist/private/tooltip/useTooltipTrigger.cjs +1 -0
  980. package/dist/private/tooltip/useTooltipTrigger.cjs.map +1 -1
  981. package/dist/private/tooltip/useTooltipTrigger.js +1 -0
  982. package/dist/private/tooltip/useTooltipTrigger.js.map +1 -1
  983. package/dist/private/tooltip/useTooltipTrigger.mjs +1 -0
  984. package/dist/private/tooltip/useTooltipTrigger.mjs.map +1 -1
  985. package/dist/private/tree/useTree.cjs +1 -0
  986. package/dist/private/tree/useTree.cjs.map +1 -1
  987. package/dist/private/tree/useTree.js +1 -0
  988. package/dist/private/tree/useTree.js.map +1 -1
  989. package/dist/private/tree/useTree.mjs +1 -0
  990. package/dist/private/tree/useTree.mjs.map +1 -1
  991. package/dist/private/utils/domHelpers.cjs +64 -12
  992. package/dist/private/utils/domHelpers.cjs.map +1 -1
  993. package/dist/private/utils/domHelpers.js +64 -14
  994. package/dist/private/utils/domHelpers.js.map +1 -1
  995. package/dist/private/utils/domHelpers.mjs +62 -13
  996. package/dist/private/utils/domHelpers.mjs.map +1 -1
  997. package/dist/private/utils/getMetaValue.cjs +36 -0
  998. package/dist/private/utils/getMetaValue.cjs.map +1 -0
  999. package/dist/private/utils/getMetaValue.js +31 -0
  1000. package/dist/private/utils/getMetaValue.js.map +1 -0
  1001. package/dist/private/utils/getMetaValue.mjs +31 -0
  1002. package/dist/private/utils/getMetaValue.mjs.map +1 -0
  1003. package/dist/private/utils/getNonce.cjs +6 -10
  1004. package/dist/private/utils/getNonce.cjs.map +1 -1
  1005. package/dist/private/utils/getNonce.js +7 -11
  1006. package/dist/private/utils/getNonce.js.map +1 -1
  1007. package/dist/private/utils/getNonce.mjs +7 -11
  1008. package/dist/private/utils/getNonce.mjs.map +1 -1
  1009. package/dist/private/utils/isVirtualEvent.cjs +1 -1
  1010. package/dist/private/utils/isVirtualEvent.cjs.map +1 -1
  1011. package/dist/private/utils/isVirtualEvent.js +1 -1
  1012. package/dist/private/utils/isVirtualEvent.js.map +1 -1
  1013. package/dist/private/utils/isVirtualEvent.mjs +1 -1
  1014. package/dist/private/utils/isVirtualEvent.mjs.map +1 -1
  1015. package/dist/private/utils/openLink.cjs +4 -2
  1016. package/dist/private/utils/openLink.cjs.map +1 -1
  1017. package/dist/private/utils/openLink.js +4 -2
  1018. package/dist/private/utils/openLink.js.map +1 -1
  1019. package/dist/private/utils/openLink.mjs +4 -2
  1020. package/dist/private/utils/openLink.mjs.map +1 -1
  1021. package/dist/private/utils/platform.cjs +8 -4
  1022. package/dist/private/utils/platform.cjs.map +1 -1
  1023. package/dist/private/utils/platform.js +7 -4
  1024. package/dist/private/utils/platform.js.map +1 -1
  1025. package/dist/private/utils/platform.mjs +7 -4
  1026. package/dist/private/utils/platform.mjs.map +1 -1
  1027. package/dist/private/utils/scrollIntoView.cjs +3 -3
  1028. package/dist/private/utils/scrollIntoView.cjs.map +1 -1
  1029. package/dist/private/utils/scrollIntoView.js +4 -4
  1030. package/dist/private/utils/scrollIntoView.js.map +1 -1
  1031. package/dist/private/utils/scrollIntoView.mjs +4 -4
  1032. package/dist/private/utils/scrollIntoView.mjs.map +1 -1
  1033. package/dist/private/utils/shadowdom/DOMFunctions.cjs +28 -1
  1034. package/dist/private/utils/shadowdom/DOMFunctions.cjs.map +1 -1
  1035. package/dist/private/utils/shadowdom/DOMFunctions.js +30 -2
  1036. package/dist/private/utils/shadowdom/DOMFunctions.js.map +1 -1
  1037. package/dist/private/utils/shadowdom/DOMFunctions.mjs +28 -2
  1038. package/dist/private/utils/shadowdom/DOMFunctions.mjs.map +1 -1
  1039. package/dist/private/utils/useDeepMemo.cjs +4 -1
  1040. package/dist/private/utils/useDeepMemo.cjs.map +1 -1
  1041. package/dist/private/utils/useDeepMemo.js +4 -1
  1042. package/dist/private/utils/useDeepMemo.js.map +1 -1
  1043. package/dist/private/utils/useDeepMemo.mjs +4 -1
  1044. package/dist/private/utils/useDeepMemo.mjs.map +1 -1
  1045. package/dist/private/utils/useDrag1D.cjs +2 -0
  1046. package/dist/private/utils/useDrag1D.cjs.map +1 -1
  1047. package/dist/private/utils/useDrag1D.js +2 -0
  1048. package/dist/private/utils/useDrag1D.js.map +1 -1
  1049. package/dist/private/utils/useDrag1D.mjs +2 -0
  1050. package/dist/private/utils/useDrag1D.mjs.map +1 -1
  1051. package/dist/private/utils/useEvent.cjs +7 -9
  1052. package/dist/private/utils/useEvent.cjs.map +1 -1
  1053. package/dist/private/utils/useEvent.js +7 -9
  1054. package/dist/private/utils/useEvent.js.map +1 -1
  1055. package/dist/private/utils/useEvent.mjs +7 -9
  1056. package/dist/private/utils/useEvent.mjs.map +1 -1
  1057. package/dist/private/utils/useFormReset.cjs +4 -0
  1058. package/dist/private/utils/useFormReset.cjs.map +1 -1
  1059. package/dist/private/utils/useFormReset.js +4 -0
  1060. package/dist/private/utils/useFormReset.js.map +1 -1
  1061. package/dist/private/utils/useFormReset.mjs +4 -0
  1062. package/dist/private/utils/useFormReset.mjs.map +1 -1
  1063. package/dist/private/utils/useId.cjs +23 -4
  1064. package/dist/private/utils/useId.cjs.map +1 -1
  1065. package/dist/private/utils/useId.js +23 -4
  1066. package/dist/private/utils/useId.js.map +1 -1
  1067. package/dist/private/utils/useId.mjs +23 -4
  1068. package/dist/private/utils/useId.mjs.map +1 -1
  1069. package/dist/private/utils/useLoadMoreSentinel.cjs +7 -3
  1070. package/dist/private/utils/useLoadMoreSentinel.cjs.map +1 -1
  1071. package/dist/private/utils/useLoadMoreSentinel.js +7 -3
  1072. package/dist/private/utils/useLoadMoreSentinel.js.map +1 -1
  1073. package/dist/private/utils/useLoadMoreSentinel.mjs +7 -3
  1074. package/dist/private/utils/useLoadMoreSentinel.mjs.map +1 -1
  1075. package/dist/private/utils/useObjectRef.cjs +3 -1
  1076. package/dist/private/utils/useObjectRef.cjs.map +1 -1
  1077. package/dist/private/utils/useObjectRef.js +3 -1
  1078. package/dist/private/utils/useObjectRef.js.map +1 -1
  1079. package/dist/private/utils/useObjectRef.mjs +3 -1
  1080. package/dist/private/utils/useObjectRef.mjs.map +1 -1
  1081. package/dist/private/utils/useSyncRef.cjs +2 -0
  1082. package/dist/private/utils/useSyncRef.cjs.map +1 -1
  1083. package/dist/private/utils/useSyncRef.js +2 -0
  1084. package/dist/private/utils/useSyncRef.js.map +1 -1
  1085. package/dist/private/utils/useSyncRef.mjs +2 -0
  1086. package/dist/private/utils/useSyncRef.mjs.map +1 -1
  1087. package/dist/private/utils/useViewportSize.cjs +3 -3
  1088. package/dist/private/utils/useViewportSize.cjs.map +1 -1
  1089. package/dist/private/utils/useViewportSize.js +4 -4
  1090. package/dist/private/utils/useViewportSize.js.map +1 -1
  1091. package/dist/private/utils/useViewportSize.mjs +4 -4
  1092. package/dist/private/utils/useViewportSize.mjs.map +1 -1
  1093. package/dist/private/virtualizer/ScrollView.cjs +7 -4
  1094. package/dist/private/virtualizer/ScrollView.cjs.map +1 -1
  1095. package/dist/private/virtualizer/ScrollView.js +8 -5
  1096. package/dist/private/virtualizer/ScrollView.js.map +1 -1
  1097. package/dist/private/virtualizer/ScrollView.mjs +8 -5
  1098. package/dist/private/virtualizer/ScrollView.mjs.map +1 -1
  1099. package/dist/private/virtualizer/VirtualizerItem.cjs +3 -2
  1100. package/dist/private/virtualizer/VirtualizerItem.cjs.map +1 -1
  1101. package/dist/private/virtualizer/VirtualizerItem.js +3 -2
  1102. package/dist/private/virtualizer/VirtualizerItem.js.map +1 -1
  1103. package/dist/private/virtualizer/VirtualizerItem.mjs +3 -2
  1104. package/dist/private/virtualizer/VirtualizerItem.mjs.map +1 -1
  1105. package/dist/private/virtualizer/useVirtualizerItem.cjs +35 -2
  1106. package/dist/private/virtualizer/useVirtualizerItem.cjs.map +1 -1
  1107. package/dist/private/virtualizer/useVirtualizerItem.js +36 -3
  1108. package/dist/private/virtualizer/useVirtualizerItem.js.map +1 -1
  1109. package/dist/private/virtualizer/useVirtualizerItem.mjs +36 -3
  1110. package/dist/private/virtualizer/useVirtualizerItem.mjs.map +1 -1
  1111. package/dist/private/visually-hidden/VisuallyHidden.cjs +2 -1
  1112. package/dist/private/visually-hidden/VisuallyHidden.cjs.map +1 -1
  1113. package/dist/private/visually-hidden/VisuallyHidden.js +2 -1
  1114. package/dist/private/visually-hidden/VisuallyHidden.js.map +1 -1
  1115. package/dist/private/visually-hidden/VisuallyHidden.mjs +2 -1
  1116. package/dist/private/visually-hidden/VisuallyHidden.mjs.map +1 -1
  1117. package/dist/types/exports/index.d.ts +11 -2
  1118. package/dist/types/exports/private/utils/domHelpers.d.ts +1 -1
  1119. package/dist/types/exports/private/utils/platform.d.ts +1 -1
  1120. package/dist/types/exports/private/utils/shadowdom/DOMFunctions.d.ts +1 -1
  1121. package/dist/types/exports/useContextMenu.d.ts +2 -0
  1122. package/dist/types/exports/useFocusVisible.d.ts +2 -1
  1123. package/dist/types/exports/usePreviewTrigger.d.ts +2 -0
  1124. package/dist/types/exports/useTokenField.d.ts +4 -0
  1125. package/dist/types/src/button/useToggleButtonGroup.d.ts +8 -0
  1126. package/dist/types/src/combobox/useComboBox.d.ts +7 -1
  1127. package/dist/types/src/dialog/useDialog.d.ts +2 -0
  1128. package/dist/types/src/grid/useGrid.d.ts +7 -0
  1129. package/dist/types/src/grid/useGridCell.d.ts +8 -1
  1130. package/dist/types/src/grid/utils.d.ts +1 -0
  1131. package/dist/types/src/gridlist/useGridListItem.d.ts +13 -0
  1132. package/dist/types/src/interactions/createKeyboardShortcutHandler.d.ts +56 -0
  1133. package/dist/types/src/interactions/useContextMenu.d.ts +21 -0
  1134. package/dist/types/src/interactions/useKeyboard.d.ts +7 -0
  1135. package/dist/types/src/interactions/useLongPress.d.ts +2 -0
  1136. package/dist/types/src/overlays/usePopover.d.ts +2 -1
  1137. package/dist/types/src/table/useTableCell.d.ts +12 -0
  1138. package/dist/types/src/table/useTableColumnHeader.d.ts +12 -0
  1139. package/dist/types/src/table/useTableColumnResize.d.ts +5 -0
  1140. package/dist/types/src/tokenfield/useToken.d.ts +14 -0
  1141. package/dist/types/src/tokenfield/useTokenField.d.ts +58 -0
  1142. package/dist/types/src/tooltip/usePreviewTrigger.d.ts +27 -0
  1143. package/dist/types/src/tooltip/useSafeArea.d.ts +26 -0
  1144. package/dist/types/src/utils/domHelpers.d.ts +24 -5
  1145. package/dist/types/src/utils/getMetaValue.d.ts +7 -0
  1146. package/dist/types/src/utils/platform.d.ts +1 -0
  1147. package/dist/types/src/utils/shadowdom/DOMFunctions.d.ts +11 -0
  1148. package/dist/types/src/utils/useEvent.d.ts +2 -2
  1149. package/dist/types/src/utils/useLoadMoreSentinel.d.ts +7 -0
  1150. package/dist/types/src/virtualizer/Virtualizer.d.ts +3 -3
  1151. package/dist/types/src/virtualizer/VirtualizerItem.d.ts +1 -0
  1152. package/dist/types/src/virtualizer/useVirtualizerItem.d.ts +1 -0
  1153. package/i18n/ar-AE.js +1 -1
  1154. package/i18n/ar-AE.mjs +1 -1
  1155. package/i18n/bg-BG.js +1 -1
  1156. package/i18n/bg-BG.mjs +1 -1
  1157. package/i18n/cs-CZ.js +1 -1
  1158. package/i18n/cs-CZ.mjs +1 -1
  1159. package/i18n/da-DK.js +1 -1
  1160. package/i18n/da-DK.mjs +1 -1
  1161. package/i18n/de-DE.js +1 -1
  1162. package/i18n/de-DE.mjs +1 -1
  1163. package/i18n/el-GR.js +1 -1
  1164. package/i18n/el-GR.mjs +1 -1
  1165. package/i18n/en-US.js +1 -1
  1166. package/i18n/en-US.mjs +1 -1
  1167. package/i18n/es-ES.js +1 -1
  1168. package/i18n/es-ES.mjs +1 -1
  1169. package/i18n/et-EE.js +1 -1
  1170. package/i18n/et-EE.mjs +1 -1
  1171. package/i18n/fi-FI.js +1 -1
  1172. package/i18n/fi-FI.mjs +1 -1
  1173. package/i18n/fr-FR.js +1 -1
  1174. package/i18n/fr-FR.mjs +1 -1
  1175. package/i18n/he-IL.js +1 -1
  1176. package/i18n/he-IL.mjs +1 -1
  1177. package/i18n/hr-HR.js +1 -1
  1178. package/i18n/hr-HR.mjs +1 -1
  1179. package/i18n/hu-HU.js +1 -1
  1180. package/i18n/hu-HU.mjs +1 -1
  1181. package/i18n/it-IT.js +1 -1
  1182. package/i18n/it-IT.mjs +1 -1
  1183. package/i18n/ja-JP.js +1 -1
  1184. package/i18n/ja-JP.mjs +1 -1
  1185. package/i18n/ko-KR.js +1 -1
  1186. package/i18n/ko-KR.mjs +1 -1
  1187. package/i18n/lt-LT.js +1 -1
  1188. package/i18n/lt-LT.mjs +1 -1
  1189. package/i18n/lv-LV.js +1 -1
  1190. package/i18n/lv-LV.mjs +1 -1
  1191. package/i18n/nb-NO.js +1 -1
  1192. package/i18n/nb-NO.mjs +1 -1
  1193. package/i18n/nl-NL.js +1 -1
  1194. package/i18n/nl-NL.mjs +1 -1
  1195. package/i18n/pl-PL.js +1 -1
  1196. package/i18n/pl-PL.mjs +1 -1
  1197. package/i18n/pt-BR.js +1 -1
  1198. package/i18n/pt-BR.mjs +1 -1
  1199. package/i18n/pt-PT.js +1 -1
  1200. package/i18n/pt-PT.mjs +1 -1
  1201. package/i18n/ro-RO.js +1 -1
  1202. package/i18n/ro-RO.mjs +1 -1
  1203. package/i18n/ru-RU.js +1 -1
  1204. package/i18n/ru-RU.mjs +1 -1
  1205. package/i18n/sk-SK.js +1 -1
  1206. package/i18n/sk-SK.mjs +1 -1
  1207. package/i18n/sl-SI.js +1 -1
  1208. package/i18n/sl-SI.mjs +1 -1
  1209. package/i18n/sr-SP.js +1 -1
  1210. package/i18n/sr-SP.mjs +1 -1
  1211. package/i18n/sv-SE.js +1 -1
  1212. package/i18n/sv-SE.mjs +1 -1
  1213. package/i18n/tr-TR.js +1 -1
  1214. package/i18n/tr-TR.mjs +1 -1
  1215. package/i18n/uk-UA.js +1 -1
  1216. package/i18n/uk-UA.mjs +1 -1
  1217. package/i18n/zh-CN.js +1 -1
  1218. package/i18n/zh-CN.mjs +1 -1
  1219. package/i18n/zh-TW.js +1 -1
  1220. package/i18n/zh-TW.mjs +1 -1
  1221. package/package.json +8 -7
  1222. package/useContextMenu/package.json +5 -0
  1223. package/usePreviewTrigger/package.json +5 -0
  1224. package/useTokenField/package.json +5 -0
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAiDD,MAAM,wCAA+C,EAAE;AAOhD,SAAS,0CAAW,KAAuB,EAAE,GAA8B;IAChF,IAAI,WACF,OAAO,qBACP,iBAAiB,UACjB,MAAM,iBACN,gBAAgB,kCAChB,4BAA4B,qCAC5B,4BAA4B,EAC7B,GAAG;IAEJ,IAAI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QACtC,YAAY,CAAC;QACb,cAAc,CAAA;YACZ,gFAAgF;YAChF,8GAA8G;YAC9G,6FAA6F;YAC7F,sDAAsD;YACtD,sDAAsD;YACtD,EAAE;YACF,2EAA2E;YAC3E,yEAAyE;YACzE,kEAAkE;YAClE,IAAI,CAAC,EAAE,aAAa,IAAI,CAAA,GAAA,yCAA4B,EAAE,EAAE,aAAa,GACnE;YAGF,IACE,CAAC,gCACD,6BAA6B,EAAE,aAAa,GAE5C;QAEJ;IACF;IAEA,OAAO;QACL,cAAc;uBACZ;YACA,GAAG,gBAAgB;QACrB;QACA,eAAe,CAAC;IAClB;AACF","sources":["packages/react-aria/src/overlays/useOverlay.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {DOMAttributes, RefObject} from '@react-types/shared';\nimport {getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport {isElementInChildOfActiveScope} from '../focus/FocusScope';\nimport {useEffect, useRef} from 'react';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useInteractOutside} from '../interactions/useInteractOutside';\n\nexport interface AriaOverlayProps {\n /** Whether the overlay is currently open. */\n isOpen?: boolean;\n\n /** Handler that is called when the overlay should close. */\n onClose?: () => void;\n\n /**\n * Whether to close the overlay when the user interacts outside it.\n *\n * @default false\n */\n isDismissable?: boolean;\n\n /** Whether the overlay should close when focus is lost or moves outside it. */\n shouldCloseOnBlur?: boolean;\n\n /**\n * Whether pressing the escape key to close the overlay should be disabled.\n *\n * @default false\n */\n isKeyboardDismissDisabled?: boolean;\n\n /**\n * When user interacts with the argument element outside of the overlay ref,\n * return true if onClose should be called. This gives you a chance to filter\n * out interaction with elements that should not dismiss the overlay.\n * By default, onClose will always be called on interaction outside the overlay ref.\n */\n shouldCloseOnInteractOutside?: (element: Element) => boolean;\n}\n\nexport interface OverlayAria {\n /** Props to apply to the overlay container element. */\n overlayProps: DOMAttributes;\n /** Props to apply to the underlay element, if any. */\n underlayProps: DOMAttributes;\n}\n\nconst visibleOverlays: RefObject<Element | null>[] = [];\n\n/**\n * Provides the behavior for overlays such as dialogs, popovers, and menus.\n * Hides the overlay when the user interacts outside it, when the Escape key is pressed,\n * or optionally, on blur. Only the top-most overlay will close at once.\n */\nexport function useOverlay(props: AriaOverlayProps, ref: RefObject<Element | null>): OverlayAria {\n let {\n onClose,\n shouldCloseOnBlur,\n isOpen,\n isDismissable = false,\n isKeyboardDismissDisabled = false,\n shouldCloseOnInteractOutside\n } = props;\n\n let lastVisibleOverlay = useRef<RefObject<Element | null>>(undefined);\n\n // Add the overlay ref to the stack of visible overlays on mount, and remove on unmount.\n useEffect(() => {\n if (isOpen && !visibleOverlays.includes(ref)) {\n visibleOverlays.push(ref);\n return () => {\n let index = visibleOverlays.indexOf(ref);\n if (index >= 0) {\n visibleOverlays.splice(index, 1);\n }\n };\n }\n }, [isOpen, ref]);\n\n // Only hide the overlay when it is the topmost visible overlay in the stack\n let onHide = () => {\n if (visibleOverlays[visibleOverlays.length - 1] === ref && onClose) {\n onClose();\n }\n };\n\n let onInteractOutsideStart = (e: PointerEvent) => {\n const topMostOverlay = visibleOverlays[visibleOverlays.length - 1];\n lastVisibleOverlay.current = topMostOverlay;\n if (\n !shouldCloseOnInteractOutside ||\n shouldCloseOnInteractOutside(getEventTarget(e) as Element)\n ) {\n if (topMostOverlay === ref) {\n e.stopPropagation();\n }\n }\n };\n\n let onInteractOutside = (e: PointerEvent) => {\n if (\n !shouldCloseOnInteractOutside ||\n shouldCloseOnInteractOutside(getEventTarget(e) as Element)\n ) {\n if (visibleOverlays[visibleOverlays.length - 1] === ref) {\n e.stopPropagation();\n }\n if (lastVisibleOverlay.current === ref) {\n onHide();\n }\n }\n lastVisibleOverlay.current = undefined;\n };\n\n // Handle the escape key\n let onKeyDown = e => {\n if (e.key === 'Escape' && !isKeyboardDismissDisabled && !e.nativeEvent.isComposing) {\n e.stopPropagation();\n e.preventDefault();\n onHide();\n }\n };\n\n // Handle clicking outside the overlay to close it\n useInteractOutside({\n ref,\n onInteractOutside: isDismissable && isOpen ? onInteractOutside : undefined,\n onInteractOutsideStart\n });\n\n let {focusWithinProps} = useFocusWithin({\n isDisabled: !shouldCloseOnBlur,\n onBlurWithin: e => {\n // Do not close if relatedTarget is null, which means focus is lost to the body.\n // That can happen when switching tabs, or due to a VoiceOver/Chrome bug with Control+Option+Arrow navigation.\n // Clicking on the body to close the overlay should already be handled by useInteractOutside.\n // https://github.com/adobe/react-spectrum/issues/4130\n // https://github.com/adobe/react-spectrum/issues/4922\n //\n // If focus is moving into a child focus scope (e.g. menu inside a dialog),\n // do not close the outer overlay. At this point, the active scope should\n // still be the outer overlay, since blur events run before focus.\n if (!e.relatedTarget || isElementInChildOfActiveScope(e.relatedTarget)) {\n return;\n }\n\n if (\n !shouldCloseOnInteractOutside ||\n shouldCloseOnInteractOutside(e.relatedTarget as Element)\n ) {\n onClose?.();\n }\n }\n });\n\n return {\n overlayProps: {\n onKeyDown,\n ...focusWithinProps\n },\n underlayProps: {}\n };\n}\n"],"names":[],"version":3,"file":"useOverlay.mjs.map"}
1
+ {"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAkDD,MAAM,wCAA+C,EAAE;AAOhD,SAAS,0CAAW,KAAuB,EAAE,GAA8B;IAChF,IAAI,WACF,OAAO,qBACP,iBAAiB,UACjB,MAAM,iBACN,gBAAgB,kCAChB,4BAA4B,qCAC5B,4BAA4B,EAC7B,GAAG;IAEJ,IAAI,qBAAqB,CAAA,GAAA,aAAK,EAA6B;IAE3D,wFAAwF;IACxF,CAAA,GAAA,gBAAQ,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;YAC7F,sDAAsD;YACtD,sDAAsD;YACtD,EAAE;YACF,2EAA2E;YAC3E,yEAAyE;YACzE,kEAAkE;YAClE,IAAI,CAAC,EAAE,aAAa,IAAI,CAAA,GAAA,yCAA4B,EAAE,EAAE,aAAa,GACnE;YAGF,IACE,CAAC,gCACD,6BAA6B,EAAE,aAAa,GAE5C;QAEJ;IACF;IAEA,OAAO;QACL,cAAc;YACZ,GAAG,aAAa;YAChB,GAAG,gBAAgB;QACrB;QACA,eAAe,CAAC;IAClB;AACF","sources":["packages/react-aria/src/overlays/useOverlay.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {DOMAttributes, RefObject} from '@react-types/shared';\nimport {getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport {isElementInChildOfActiveScope} from '../focus/FocusScope';\nimport {useEffect, useRef} from 'react';\nimport {useFocusWithin} from '../interactions/useFocusWithin';\nimport {useInteractOutside} from '../interactions/useInteractOutside';\nimport {useKeyboard} from '../interactions/useKeyboard';\n\nexport interface AriaOverlayProps {\n /** Whether the overlay is currently open. */\n isOpen?: boolean;\n\n /** Handler that is called when the overlay should close. */\n onClose?: () => void;\n\n /**\n * Whether to close the overlay when the user interacts outside it.\n *\n * @default false\n */\n isDismissable?: boolean;\n\n /** Whether the overlay should close when focus is lost or moves outside it. */\n shouldCloseOnBlur?: boolean;\n\n /**\n * Whether pressing the escape key to close the overlay should be disabled.\n *\n * @default false\n */\n isKeyboardDismissDisabled?: boolean;\n\n /**\n * When user interacts with the argument element outside of the overlay ref,\n * return true if onClose should be called. This gives you a chance to filter\n * out interaction with elements that should not dismiss the overlay.\n * By default, onClose will always be called on interaction outside the overlay ref.\n */\n shouldCloseOnInteractOutside?: (element: Element) => boolean;\n}\n\nexport interface OverlayAria {\n /** Props to apply to the overlay container element. */\n overlayProps: DOMAttributes;\n /** Props to apply to the underlay element, if any. */\n underlayProps: DOMAttributes;\n}\n\nconst visibleOverlays: RefObject<Element | null>[] = [];\n\n/**\n * Provides the behavior for overlays such as dialogs, popovers, and menus.\n * Hides the overlay when the user interacts outside it, when the Escape key is pressed,\n * or optionally, on blur. Only the top-most overlay will close at once.\n */\nexport function useOverlay(props: AriaOverlayProps, ref: RefObject<Element | null>): OverlayAria {\n let {\n onClose,\n shouldCloseOnBlur,\n isOpen,\n isDismissable = false,\n isKeyboardDismissDisabled = false,\n shouldCloseOnInteractOutside\n } = props;\n\n let lastVisibleOverlay = useRef<RefObject<Element | null>>(undefined);\n\n // Add the overlay ref to the stack of visible overlays on mount, and remove on unmount.\n useEffect(() => {\n if (isOpen && !visibleOverlays.includes(ref)) {\n visibleOverlays.push(ref);\n return () => {\n let index = visibleOverlays.indexOf(ref);\n if (index >= 0) {\n visibleOverlays.splice(index, 1);\n }\n };\n }\n }, [isOpen, ref]);\n\n // Only hide the overlay when it is the topmost visible overlay in the stack\n let onHide = () => {\n if (visibleOverlays[visibleOverlays.length - 1] === ref && onClose) {\n onClose();\n }\n };\n\n let onInteractOutsideStart = (e: PointerEvent) => {\n const topMostOverlay = visibleOverlays[visibleOverlays.length - 1];\n lastVisibleOverlay.current = topMostOverlay;\n if (\n !shouldCloseOnInteractOutside ||\n shouldCloseOnInteractOutside(getEventTarget(e) as Element)\n ) {\n if (topMostOverlay === ref) {\n e.stopPropagation();\n }\n }\n };\n\n let onInteractOutside = (e: PointerEvent) => {\n if (\n !shouldCloseOnInteractOutside ||\n shouldCloseOnInteractOutside(getEventTarget(e) as Element)\n ) {\n if (visibleOverlays[visibleOverlays.length - 1] === ref) {\n e.stopPropagation();\n }\n if (lastVisibleOverlay.current === ref) {\n onHide();\n }\n }\n lastVisibleOverlay.current = undefined;\n };\n\n // Handle the escape key\n let {keyboardProps} = useKeyboard({\n shortcuts: {\n Escape: () => {\n if (!isKeyboardDismissDisabled) {\n onHide();\n return;\n }\n return false;\n }\n }\n });\n\n // Handle clicking outside the overlay to close it\n useInteractOutside({\n ref,\n onInteractOutside: isDismissable && isOpen ? onInteractOutside : undefined,\n onInteractOutsideStart\n });\n\n let {focusWithinProps} = useFocusWithin({\n isDisabled: !shouldCloseOnBlur,\n onBlurWithin: e => {\n // Do not close if relatedTarget is null, which means focus is lost to the body.\n // That can happen when switching tabs, or due to a VoiceOver/Chrome bug with Control+Option+Arrow navigation.\n // Clicking on the body to close the overlay should already be handled by useInteractOutside.\n // https://github.com/adobe/react-spectrum/issues/4130\n // https://github.com/adobe/react-spectrum/issues/4922\n //\n // If focus is moving into a child focus scope (e.g. menu inside a dialog),\n // do not close the outer overlay. At this point, the active scope should\n // still be the outer overlay, since blur events run before focus.\n if (!e.relatedTarget || isElementInChildOfActiveScope(e.relatedTarget)) {\n return;\n }\n\n if (\n !shouldCloseOnInteractOutside ||\n shouldCloseOnInteractOutside(e.relatedTarget as Element)\n ) {\n onClose?.();\n }\n }\n });\n\n return {\n overlayProps: {\n ...keyboardProps,\n ...focusWithinProps\n },\n underlayProps: {}\n };\n}\n"],"names":[],"version":3,"file":"useOverlay.mjs.map"}
@@ -1,3 +1,4 @@
1
+ var $49582955cc364b1c$exports = require("../utils/domHelpers.cjs");
1
2
  var $43b053bcc899501d$exports = require("./calculatePosition.cjs");
2
3
  var $da02ee888921bc9e$exports = require("../utils/shadowdom/DOMFunctions.cjs");
3
4
  var $bee406a175a03c3e$exports = require("./useCloseOnScroll.cjs");
@@ -29,6 +30,7 @@ $parcel$export(module.exports, "useOverlayPosition", function () { return $9b275
29
30
 
30
31
 
31
32
 
33
+
32
34
  let $9b27591aafdd7244$var$visualViewport = typeof document !== 'undefined' ? window.visualViewport : null;
33
35
  function $9b27591aafdd7244$export$d39e1813b3bdd0e1(props) {
34
36
  let { direction: direction } = (0, $2522e612fa919664$exports.useLocale)();
@@ -37,9 +39,13 @@ function $9b27591aafdd7244$export$d39e1813b3bdd0e1(props) {
37
39
  let deps = [
38
40
  shouldUpdatePosition,
39
41
  placement,
42
+ // oxlint-disable-next-line react/react-compiler
40
43
  overlayRef.current,
44
+ // oxlint-disable-next-line react/react-compiler
41
45
  targetRef.current,
46
+ // oxlint-disable-next-line react/react-compiler
42
47
  arrowRef?.current,
48
+ // oxlint-disable-next-line react/react-compiler
43
49
  scrollRef.current,
44
50
  containerPadding,
45
51
  shouldFlip,
@@ -126,9 +132,11 @@ function $9b27591aafdd7244$export$d39e1813b3bdd0e1(props) {
126
132
  // Trigger a set state for a second render anyway for arrow positioning
127
133
  setPosition(position);
128
134
  // eslint-disable-next-line react-hooks/exhaustive-deps
135
+ // oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps
129
136
  }, deps);
130
137
  // Update position when anything changes
131
138
  // eslint-disable-next-line react-hooks/exhaustive-deps
139
+ // oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps
132
140
  (0, $429333cab433657c$exports.useLayoutEffect)(updatePosition, deps);
133
141
  // Update position on window resize
134
142
  $9b27591aafdd7244$var$useResize(updatePosition);
@@ -162,9 +170,12 @@ function $9b27591aafdd7244$export$d39e1813b3bdd0e1(props) {
162
170
  };
163
171
  $9b27591aafdd7244$var$visualViewport?.addEventListener('resize', onResize);
164
172
  $9b27591aafdd7244$var$visualViewport?.addEventListener('scroll', onScroll);
173
+ let cleanup = (0, $49582955cc364b1c$exports.addEvent)(// @ts-expect-error
174
+ (0, $da02ee888921bc9e$exports.getPropagationTargets)(window), 'scroll', onScroll);
165
175
  return ()=>{
166
176
  $9b27591aafdd7244$var$visualViewport?.removeEventListener('resize', onResize);
167
177
  $9b27591aafdd7244$var$visualViewport?.removeEventListener('scroll', onScroll);
178
+ cleanup();
168
179
  };
169
180
  }, [
170
181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OAAO;YACL,sCAAgB,oBAAoB,UAAU;YAC9C,sCAAgB,oBAAoB,UAAU;QAChD;IACF,GAAG;QAAC;KAAe;IAEnB,IAAI,QAAQ,CAAA,GAAA,wBAAU,EAAE;QACtB,IAAI,CAAC,WAAW,OAAO,EACrB;IAEJ,GAAG;QAAC;QAAS;KAAW;IAExB,kFAAkF;IAClF,mEAAmE;IACnE,CAAA,GAAA,0CAAe,EAAE;QACf,YAAY;gBACZ;QACA,SAAS,WAAW;IACtB;IAEA,OAAO;QACL,cAAc;YACZ,OAAO;gBACL,UAAU,WAAW,aAAa;gBAClC,KAAK,CAAC,WAAW,IAAI;gBACrB,MAAM,CAAC,WAAW,IAAI;gBACtB,QAAQ;gBACR,GAAG,UAAU,QAAQ;gBACrB,WAAW,UAAU,aAAa;YACpC;QACF;QACA,WAAW,UAAU,aAAa;QAClC,oBAAoB,UAAU,sBAAsB;QACpD,YAAY;YACV,eAAe;YACf,MAAM;YACN,OAAO;gBACL,MAAM,UAAU;gBAChB,KAAK,UAAU;YACjB;QACF;wBACA;IACF;AACF;AAEA,SAAS,gCAAU,QAAQ;IACzB,CAAA,GAAA,yCAAc,EAAE;QACd,OAAO,gBAAgB,CAAC,UAAU,UAAU;QAC5C,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU,UAAU;QACjD;IACF,GAAG;QAAC;KAAS;AACf;AAEA,SAAS,mCAAa,QAAQ,EAAE,SAAS;IACvC,IAAI,cAAc,OAChB,OAAO,SAAS,OAAO,CAAC,SAAS,SAAS,OAAO,CAAC,OAAO;IAE3D,OAAO,SAAS,OAAO,CAAC,SAAS,QAAQ,OAAO,CAAC,OAAO;AAC1D","sources":["packages/react-aria/src/overlays/useOverlayPosition.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {calculatePosition, getRect, PositionResult} from './calculatePosition';\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {getActiveElement, isFocusWithin} from '../utils/shadowdom/DOMFunctions';\nimport {useCallback, useEffect, useRef, useState} from 'react';\nimport {useCloseOnScroll} from './useCloseOnScroll';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocale} from '../i18n/I18nProvider';\nimport {useResizeObserver} from '../utils/useResizeObserver';\n\nexport type Placement =\n | 'bottom'\n | 'bottom left'\n | 'bottom right'\n | 'bottom start'\n | 'bottom end'\n | 'top'\n | 'top left'\n | 'top right'\n | 'top start'\n | 'top end'\n | 'left'\n | 'left top'\n | 'left bottom'\n | 'start'\n | 'start top'\n | 'start bottom'\n | 'right'\n | 'right top'\n | 'right bottom'\n | 'end'\n | 'end top'\n | 'end bottom';\n\nexport type Axis = 'top' | 'bottom' | 'left' | 'right';\nexport type SizeAxis = 'width' | 'height';\nexport type PlacementAxis = Axis | 'center';\n\nexport interface PositionProps {\n /**\n * The placement of the element with respect to its anchor element.\n *\n * @default 'bottom'\n */\n placement?: Placement;\n /**\n * The placement padding that should be applied between the element and its\n * surrounding container.\n *\n * @default 12\n */\n containerPadding?: number;\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n *\n * @default 0\n */\n offset?: number;\n /**\n * The additional offset applied along the cross axis between the element and its\n * anchor element.\n *\n * @default 0\n */\n crossOffset?: number;\n /**\n * Whether the element should flip its orientation (e.g. top to bottom or left to right) when\n * there is insufficient room for it to render completely.\n *\n * @default true\n */\n shouldFlip?: boolean;\n // /**\n // * The element that should be used as the bounding container when calculating container offset\n // * or whether it should flip.\n // */\n // boundaryElement?: Element,\n /** Whether the element is rendered. */\n isOpen?: boolean;\n}\n\nexport interface AriaPositionProps extends PositionProps {\n /**\n * Cross size of the overlay arrow in pixels.\n *\n * @default 0\n */\n arrowSize?: number;\n /**\n * Element that that serves as the positioning boundary.\n *\n * @default document.body\n */\n boundaryElement?: Element;\n /**\n * The ref for the element which the overlay positions itself with respect to.\n */\n targetRef: RefObject<Element | null>;\n /**\n * The ref for the overlay element.\n */\n overlayRef: RefObject<Element | null>;\n /**\n * The ref for the arrow element.\n */\n arrowRef?: RefObject<Element | null>;\n /**\n * A ref for the scrollable region within the overlay.\n *\n * @default overlayRef\n */\n scrollRef?: RefObject<Element | null>;\n /**\n * Whether the overlay should update its position automatically.\n *\n * @default true\n */\n shouldUpdatePosition?: boolean;\n /** Handler that is called when the overlay should close. */\n onClose?: (() => void) | null;\n /**\n * The maxHeight specified for the overlay element.\n * By default, it will take all space up to the current viewport height.\n */\n maxHeight?: number;\n /**\n * The minimum distance the arrow's edge should be from the edge of the overlay element.\n *\n * @default 0\n */\n arrowBoundaryOffset?: number;\n /**\n * Overrides the target element's bounding rectangle. Useful for positioning relative to\n * a specific point such as the mouse cursor (e.g. context menus) or text selection.\n *\n * @default target.getBoundingClientRect()\n * @param target - The target element.\n */\n getTargetRect?: (target: Element) => DOMRect | null | undefined;\n}\n\nexport interface PositionAria {\n /** Props for the overlay container element. */\n overlayProps: DOMAttributes;\n /** Props for the overlay tip arrow if any. */\n arrowProps: DOMAttributes;\n /** Placement of the overlay with respect to the overlay trigger. */\n placement: PlacementAxis | null;\n /** The origin of the target in the overlay's coordinate system. Useful for animations. */\n triggerAnchorPoint: {x: number; y: number} | null;\n /** Updates the position of the overlay. */\n updatePosition(): void;\n}\n\ninterface ScrollAnchor {\n type: 'top' | 'bottom';\n offset: number;\n}\n\nlet visualViewport = typeof document !== 'undefined' ? window.visualViewport : null;\n\n/**\n * Handles positioning overlays like popovers and menus relative to a trigger\n * element, and updating the position when the window resizes.\n */\nexport function useOverlayPosition(props: AriaPositionProps): PositionAria {\n let {direction} = useLocale();\n let {\n arrowSize,\n targetRef,\n overlayRef,\n arrowRef,\n scrollRef = overlayRef,\n placement = 'bottom' as Placement,\n containerPadding = 12,\n shouldFlip = true,\n boundaryElement = typeof document !== 'undefined' ? document.body : null,\n offset = 0,\n crossOffset = 0,\n shouldUpdatePosition = true,\n isOpen = true,\n onClose,\n maxHeight,\n arrowBoundaryOffset = 0,\n getTargetRect\n } = props;\n let [position, setPosition] = useState<PositionResult | null>(null);\n\n let deps = [\n shouldUpdatePosition,\n placement,\n overlayRef.current,\n targetRef.current,\n arrowRef?.current,\n scrollRef.current,\n containerPadding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n isOpen,\n direction,\n maxHeight,\n arrowBoundaryOffset,\n arrowSize\n ];\n\n // Note, the position freezing breaks if body sizes itself dynamicly with the visual viewport but that might\n // just be a non-realistic use case\n // Upon opening a overlay, record the current visual viewport scale so we can freeze the overlay styles\n let lastScale = useRef(visualViewport?.scale);\n useEffect(() => {\n if (isOpen) {\n lastScale.current = visualViewport?.scale;\n }\n }, [isOpen]);\n\n let updatePosition = useCallback(() => {\n if (\n shouldUpdatePosition === false ||\n !isOpen ||\n !overlayRef.current ||\n !targetRef.current ||\n !boundaryElement\n ) {\n return;\n }\n\n if (visualViewport?.scale !== lastScale.current) {\n return;\n }\n\n // Determine a scroll anchor based on the focused element.\n // This stores the offset of the anchor element from the scroll container\n // so it can be restored after repositioning. This way if the overlay height\n // changes, the focused element appears to stay in the same position.\n let anchor: ScrollAnchor | null = null;\n if (scrollRef.current && isFocusWithin(scrollRef.current)) {\n let anchorRect = getActiveElement()?.getBoundingClientRect();\n let scrollRect = scrollRef.current.getBoundingClientRect();\n // Anchor from the top if the offset is in the top half of the scrollable element,\n // otherwise anchor from the bottom.\n anchor = {\n type: 'top',\n offset: (anchorRect?.top ?? 0) - scrollRect.top\n };\n if (anchor.offset > scrollRect.height / 2) {\n anchor.type = 'bottom';\n anchor.offset = (anchorRect?.bottom ?? 0) - scrollRect.bottom;\n }\n }\n\n // Always reset the overlay's previous max height if not defined by the user so that we can compensate for\n // RAC collections populating after a second render and properly set a correct max height + positioning when it populates.\n let overlay = overlayRef.current as HTMLElement;\n if (!maxHeight && overlayRef.current) {\n overlay.style.top = '0px';\n overlay.style.bottom = '';\n overlay.style.maxHeight = (window.visualViewport?.height ?? window.innerHeight) + 'px';\n }\n\n let position = calculatePosition({\n placement: translateRTL(placement, direction),\n overlayNode: overlayRef.current,\n targetNode: targetRef.current,\n scrollNode: scrollRef.current || overlayRef.current,\n padding: containerPadding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n maxHeight,\n arrowSize: arrowSize ?? (arrowRef?.current ? getRect(arrowRef.current, true).width : 0),\n arrowBoundaryOffset,\n targetRect: getTargetRect?.(targetRef.current)\n });\n\n if (!position.position) {\n return;\n }\n\n // Modify overlay styles directly so positioning happens immediately without the need of a second render\n // This is so we don't have to delay autoFocus scrolling or delay applying preventScroll for popovers\n overlay.style.top = '';\n overlay.style.bottom = '';\n overlay.style.left = '';\n overlay.style.right = '';\n\n Object.keys(position.position).forEach(\n key => (overlay.style[key] = position.position![key] + 'px')\n );\n overlay.style.maxHeight = position.maxHeight != null ? position.maxHeight + 'px' : '';\n\n // Restore scroll position relative to anchor element.\n let activeElement = getActiveElement();\n if (anchor && activeElement && scrollRef.current) {\n let anchorRect = activeElement.getBoundingClientRect();\n let scrollRect = scrollRef.current.getBoundingClientRect();\n let newOffset = anchorRect[anchor.type] - scrollRect[anchor.type];\n scrollRef.current.scrollTop += newOffset - anchor.offset;\n }\n\n // Trigger a set state for a second render anyway for arrow positioning\n setPosition(position);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n\n // Update position when anything changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(updatePosition, deps);\n\n // Update position on window resize\n useResize(updatePosition);\n\n // Update position when the overlay changes size (might need to flip).\n useResizeObserver({\n ref: overlayRef,\n onResize: updatePosition\n });\n\n // Update position when the target changes size (might need to flip).\n useResizeObserver({\n ref: targetRef,\n onResize: updatePosition\n });\n\n // Reposition the overlay and do not close on scroll while the visual viewport is resizing.\n // This will ensure that overlays adjust their positioning when the iOS virtual keyboard appears.\n let isResizing = useRef(false);\n useLayoutEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n let onResize = () => {\n isResizing.current = true;\n clearTimeout(timeout);\n\n timeout = setTimeout(() => {\n isResizing.current = false;\n }, 500);\n\n updatePosition();\n };\n\n // Only reposition the overlay if a scroll event happens immediately as a result of resize (aka the virtual keyboard has appears)\n // We don't want to reposition the overlay if the user has pinch zoomed in and is scrolling the viewport around.\n let onScroll = () => {\n if (isResizing.current) {\n onResize();\n }\n };\n\n visualViewport?.addEventListener('resize', onResize);\n visualViewport?.addEventListener('scroll', onScroll);\n return () => {\n visualViewport?.removeEventListener('resize', onResize);\n visualViewport?.removeEventListener('scroll', onScroll);\n };\n }, [updatePosition]);\n\n let close = useCallback(() => {\n if (!isResizing.current) {\n onClose?.();\n }\n }, [onClose, isResizing]);\n\n // When scrolling a parent scrollable region of the trigger (other than the body),\n // we hide the popover. Otherwise, its position would be incorrect.\n useCloseOnScroll({\n triggerRef: targetRef,\n isOpen,\n onClose: onClose && close\n });\n\n return {\n overlayProps: {\n style: {\n position: position ? 'absolute' : 'fixed',\n top: !position ? 0 : undefined,\n left: !position ? 0 : undefined,\n zIndex: 100000, // should match the z-index in ModalTrigger\n ...position?.position,\n maxHeight: position?.maxHeight ?? '100vh'\n }\n },\n placement: position?.placement ?? null,\n triggerAnchorPoint: position?.triggerAnchorPoint ?? null,\n arrowProps: {\n 'aria-hidden': 'true',\n role: 'presentation',\n style: {\n left: position?.arrowOffsetLeft,\n top: position?.arrowOffsetTop\n }\n },\n updatePosition\n };\n}\n\nfunction useResize(onResize) {\n useLayoutEffect(() => {\n window.addEventListener('resize', onResize, false);\n return () => {\n window.removeEventListener('resize', onResize, false);\n };\n }, [onResize]);\n}\n\nfunction translateRTL(position, direction) {\n if (direction === 'rtl') {\n return position.replace('start', 'right').replace('end', 'left');\n }\n return position.replace('start', 'left').replace('end', 'right');\n}\n"],"names":[],"version":3,"file":"useOverlayPosition.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAmKD,IAAI,uCAAiB,OAAO,aAAa,cAAc,OAAO,cAAc,GAAG;AAMxE,SAAS,0CAAmB,KAAwB;IACzD,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,mCAAQ;IAC1B,IAAI,aACF,SAAS,aACT,SAAS,cACT,UAAU,YACV,QAAQ,aACR,YAAY,uBACZ,YAAY,4BACZ,mBAAmB,gBACnB,aAAa,uBACb,kBAAkB,OAAO,aAAa,cAAc,SAAS,IAAI,GAAG,cACpE,SAAS,gBACT,cAAc,yBACd,uBAAuB,cACvB,SAAS,eACT,OAAO,aACP,SAAS,uBACT,sBAAsB,kBACtB,aAAa,EACd,GAAG;IACJ,IAAI,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,qBAAO,EAAyB;IAE9D,IAAI,OAAO;QACT;QACA;QACA,gDAAgD;QAChD,WAAW,OAAO;QAClB,gDAAgD;QAChD,UAAU,OAAO;QACjB,gDAAgD;QAChD,UAAU;QACV,gDAAgD;QAChD,UAAU,OAAO;QACjB;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD;IAED,4GAA4G;IAC5G,mCAAmC;IACnC,uGAAuG;IACvG,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAE,sCAAgB;IACvC,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,QACF,UAAU,OAAO,GAAG,sCAAgB;IAExC,GAAG;QAAC;KAAO;IAEX,IAAI,iBAAiB,CAAA,GAAA,wBAAU,EAAE;QAC/B,IACE,yBAAyB,SACzB,CAAC,UACD,CAAC,WAAW,OAAO,IACnB,CAAC,UAAU,OAAO,IAClB,CAAC,iBAED;QAGF,IAAI,sCAAgB,UAAU,UAAU,OAAO,EAC7C;QAGF,0DAA0D;QAC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AAS,OAAO,CAAC,SAAS,QAAQ,OAAO,CAAC,OAAO;AAC1D","sources":["packages/react-aria/src/overlays/useOverlayPosition.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {addEvent} from '../utils/domHelpers';\nimport {calculatePosition, getRect, PositionResult} from './calculatePosition';\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {getActiveElement, isFocusWithin} from '../utils/shadowdom/DOMFunctions';\nimport {getPropagationTargets} from '../utils/shadowdom/DOMFunctions';\nimport {useCallback, useEffect, useRef, useState} from 'react';\nimport {useCloseOnScroll} from './useCloseOnScroll';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocale} from '../i18n/I18nProvider';\nimport {useResizeObserver} from '../utils/useResizeObserver';\n\nexport type Placement =\n | 'bottom'\n | 'bottom left'\n | 'bottom right'\n | 'bottom start'\n | 'bottom end'\n | 'top'\n | 'top left'\n | 'top right'\n | 'top start'\n | 'top end'\n | 'left'\n | 'left top'\n | 'left bottom'\n | 'start'\n | 'start top'\n | 'start bottom'\n | 'right'\n | 'right top'\n | 'right bottom'\n | 'end'\n | 'end top'\n | 'end bottom';\n\nexport type Axis = 'top' | 'bottom' | 'left' | 'right';\nexport type SizeAxis = 'width' | 'height';\nexport type PlacementAxis = Axis | 'center';\n\nexport interface PositionProps {\n /**\n * The placement of the element with respect to its anchor element.\n *\n * @default 'bottom'\n */\n placement?: Placement;\n /**\n * The placement padding that should be applied between the element and its\n * surrounding container.\n *\n * @default 12\n */\n containerPadding?: number;\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n *\n * @default 0\n */\n offset?: number;\n /**\n * The additional offset applied along the cross axis between the element and its\n * anchor element.\n *\n * @default 0\n */\n crossOffset?: number;\n /**\n * Whether the element should flip its orientation (e.g. top to bottom or left to right) when\n * there is insufficient room for it to render completely.\n *\n * @default true\n */\n shouldFlip?: boolean;\n // /**\n // * The element that should be used as the bounding container when calculating container offset\n // * or whether it should flip.\n // */\n // boundaryElement?: Element,\n /** Whether the element is rendered. */\n isOpen?: boolean;\n}\n\nexport interface AriaPositionProps extends PositionProps {\n /**\n * Cross size of the overlay arrow in pixels.\n *\n * @default 0\n */\n arrowSize?: number;\n /**\n * Element that that serves as the positioning boundary.\n *\n * @default document.body\n */\n boundaryElement?: Element;\n /**\n * The ref for the element which the overlay positions itself with respect to.\n */\n targetRef: RefObject<Element | null>;\n /**\n * The ref for the overlay element.\n */\n overlayRef: RefObject<Element | null>;\n /**\n * The ref for the arrow element.\n */\n arrowRef?: RefObject<Element | null>;\n /**\n * A ref for the scrollable region within the overlay.\n *\n * @default overlayRef\n */\n scrollRef?: RefObject<Element | null>;\n /**\n * Whether the overlay should update its position automatically.\n *\n * @default true\n */\n shouldUpdatePosition?: boolean;\n /** Handler that is called when the overlay should close. */\n onClose?: (() => void) | null;\n /**\n * The maxHeight specified for the overlay element.\n * By default, it will take all space up to the current viewport height.\n */\n maxHeight?: number;\n /**\n * The minimum distance the arrow's edge should be from the edge of the overlay element.\n *\n * @default 0\n */\n arrowBoundaryOffset?: number;\n /**\n * Overrides the target element's bounding rectangle. Useful for positioning relative to\n * a specific point such as the mouse cursor (e.g. context menus) or text selection.\n *\n * @default target.getBoundingClientRect()\n * @param target - The target element.\n */\n getTargetRect?: (target: Element) => DOMRect | null | undefined;\n}\n\nexport interface PositionAria {\n /** Props for the overlay container element. */\n overlayProps: DOMAttributes;\n /** Props for the overlay tip arrow if any. */\n arrowProps: DOMAttributes;\n /** Placement of the overlay with respect to the overlay trigger. */\n placement: PlacementAxis | null;\n /** The origin of the target in the overlay's coordinate system. Useful for animations. */\n triggerAnchorPoint: {x: number; y: number} | null;\n /** Updates the position of the overlay. */\n updatePosition(): void;\n}\n\ninterface ScrollAnchor {\n type: 'top' | 'bottom';\n offset: number;\n}\n\nlet visualViewport = typeof document !== 'undefined' ? window.visualViewport : null;\n\n/**\n * Handles positioning overlays like popovers and menus relative to a trigger\n * element, and updating the position when the window resizes.\n */\nexport function useOverlayPosition(props: AriaPositionProps): PositionAria {\n let {direction} = useLocale();\n let {\n arrowSize,\n targetRef,\n overlayRef,\n arrowRef,\n scrollRef = overlayRef,\n placement = 'bottom' as Placement,\n containerPadding = 12,\n shouldFlip = true,\n boundaryElement = typeof document !== 'undefined' ? document.body : null,\n offset = 0,\n crossOffset = 0,\n shouldUpdatePosition = true,\n isOpen = true,\n onClose,\n maxHeight,\n arrowBoundaryOffset = 0,\n getTargetRect\n } = props;\n let [position, setPosition] = useState<PositionResult | null>(null);\n\n let deps = [\n shouldUpdatePosition,\n placement,\n // oxlint-disable-next-line react/react-compiler\n overlayRef.current,\n // oxlint-disable-next-line react/react-compiler\n targetRef.current,\n // oxlint-disable-next-line react/react-compiler\n arrowRef?.current,\n // oxlint-disable-next-line react/react-compiler\n scrollRef.current,\n containerPadding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n isOpen,\n direction,\n maxHeight,\n arrowBoundaryOffset,\n arrowSize\n ];\n\n // Note, the position freezing breaks if body sizes itself dynamicly with the visual viewport but that might\n // just be a non-realistic use case\n // Upon opening a overlay, record the current visual viewport scale so we can freeze the overlay styles\n let lastScale = useRef(visualViewport?.scale);\n useEffect(() => {\n if (isOpen) {\n lastScale.current = visualViewport?.scale;\n }\n }, [isOpen]);\n\n let updatePosition = useCallback(() => {\n if (\n shouldUpdatePosition === false ||\n !isOpen ||\n !overlayRef.current ||\n !targetRef.current ||\n !boundaryElement\n ) {\n return;\n }\n\n if (visualViewport?.scale !== lastScale.current) {\n return;\n }\n\n // Determine a scroll anchor based on the focused element.\n // This stores the offset of the anchor element from the scroll container\n // so it can be restored after repositioning. This way if the overlay height\n // changes, the focused element appears to stay in the same position.\n let anchor: ScrollAnchor | null = null;\n if (scrollRef.current && isFocusWithin(scrollRef.current)) {\n let anchorRect = getActiveElement()?.getBoundingClientRect();\n let scrollRect = scrollRef.current.getBoundingClientRect();\n // Anchor from the top if the offset is in the top half of the scrollable element,\n // otherwise anchor from the bottom.\n anchor = {\n type: 'top',\n offset: (anchorRect?.top ?? 0) - scrollRect.top\n };\n if (anchor.offset > scrollRect.height / 2) {\n anchor.type = 'bottom';\n anchor.offset = (anchorRect?.bottom ?? 0) - scrollRect.bottom;\n }\n }\n\n // Always reset the overlay's previous max height if not defined by the user so that we can compensate for\n // RAC collections populating after a second render and properly set a correct max height + positioning when it populates.\n let overlay = overlayRef.current as HTMLElement;\n if (!maxHeight && overlayRef.current) {\n overlay.style.top = '0px';\n overlay.style.bottom = '';\n overlay.style.maxHeight = (window.visualViewport?.height ?? window.innerHeight) + 'px';\n }\n\n let position = calculatePosition({\n placement: translateRTL(placement, direction),\n overlayNode: overlayRef.current,\n targetNode: targetRef.current,\n scrollNode: scrollRef.current || overlayRef.current,\n padding: containerPadding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n maxHeight,\n arrowSize: arrowSize ?? (arrowRef?.current ? getRect(arrowRef.current, true).width : 0),\n arrowBoundaryOffset,\n targetRect: getTargetRect?.(targetRef.current)\n });\n\n if (!position.position) {\n return;\n }\n\n // Modify overlay styles directly so positioning happens immediately without the need of a second render\n // This is so we don't have to delay autoFocus scrolling or delay applying preventScroll for popovers\n overlay.style.top = '';\n overlay.style.bottom = '';\n overlay.style.left = '';\n overlay.style.right = '';\n\n Object.keys(position.position).forEach(\n key => (overlay.style[key] = position.position![key] + 'px')\n );\n overlay.style.maxHeight = position.maxHeight != null ? position.maxHeight + 'px' : '';\n\n // Restore scroll position relative to anchor element.\n let activeElement = getActiveElement();\n if (anchor && activeElement && scrollRef.current) {\n let anchorRect = activeElement.getBoundingClientRect();\n let scrollRect = scrollRef.current.getBoundingClientRect();\n let newOffset = anchorRect[anchor.type] - scrollRect[anchor.type];\n scrollRef.current.scrollTop += newOffset - anchor.offset;\n }\n\n // Trigger a set state for a second render anyway for arrow positioning\n setPosition(position);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n // oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps\n }, deps);\n\n // Update position when anything changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n // oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps\n useLayoutEffect(updatePosition, deps);\n\n // Update position on window resize\n useResize(updatePosition);\n\n // Update position when the overlay changes size (might need to flip).\n useResizeObserver({\n ref: overlayRef,\n onResize: updatePosition\n });\n\n // Update position when the target changes size (might need to flip).\n useResizeObserver({\n ref: targetRef,\n onResize: updatePosition\n });\n\n // Reposition the overlay and do not close on scroll while the visual viewport is resizing.\n // This will ensure that overlays adjust their positioning when the iOS virtual keyboard appears.\n let isResizing = useRef(false);\n useLayoutEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n let onResize = () => {\n isResizing.current = true;\n clearTimeout(timeout);\n\n timeout = setTimeout(() => {\n isResizing.current = false;\n }, 500);\n\n updatePosition();\n };\n\n // Only reposition the overlay if a scroll event happens immediately as a result of resize (aka the virtual keyboard has appears)\n // We don't want to reposition the overlay if the user has pinch zoomed in and is scrolling the viewport around.\n let onScroll = () => {\n if (isResizing.current) {\n onResize();\n }\n };\n\n visualViewport?.addEventListener('resize', onResize);\n visualViewport?.addEventListener('scroll', onScroll);\n let cleanup = addEvent(\n // @ts-expect-error\n getPropagationTargets(window),\n 'scroll',\n onScroll\n );\n return () => {\n visualViewport?.removeEventListener('resize', onResize);\n visualViewport?.removeEventListener('scroll', onScroll);\n cleanup();\n };\n }, [updatePosition]);\n\n let close = useCallback(() => {\n if (!isResizing.current) {\n onClose?.();\n }\n }, [onClose, isResizing]);\n\n // When scrolling a parent scrollable region of the trigger (other than the body),\n // we hide the popover. Otherwise, its position would be incorrect.\n useCloseOnScroll({\n triggerRef: targetRef,\n isOpen,\n onClose: onClose && close\n });\n\n return {\n overlayProps: {\n style: {\n position: position ? 'absolute' : 'fixed',\n top: !position ? 0 : undefined,\n left: !position ? 0 : undefined,\n zIndex: 100000, // should match the z-index in ModalTrigger\n ...position?.position,\n maxHeight: position?.maxHeight ?? '100vh'\n }\n },\n placement: position?.placement ?? null,\n triggerAnchorPoint: position?.triggerAnchorPoint ?? null,\n arrowProps: {\n 'aria-hidden': 'true',\n role: 'presentation',\n style: {\n left: position?.arrowOffsetLeft,\n top: position?.arrowOffsetTop\n }\n },\n updatePosition\n };\n}\n\nfunction useResize(onResize) {\n useLayoutEffect(() => {\n window.addEventListener('resize', onResize, false);\n return () => {\n window.removeEventListener('resize', onResize, false);\n };\n }, [onResize]);\n}\n\nfunction translateRTL(position, direction) {\n if (direction === 'rtl') {\n return position.replace('start', 'right').replace('end', 'left');\n }\n return position.replace('start', 'left').replace('end', 'right');\n}\n"],"names":[],"version":3,"file":"useOverlayPosition.cjs.map"}
@@ -1,5 +1,6 @@
1
+ import {addEvent as $cc3c3666b64debad$export$f531f92e2a15358f} from "../utils/domHelpers.js";
1
2
  import {calculatePosition as $ba2991ee81d3897a$export$b3ceb0cbf1056d98, getRect as $ba2991ee81d3897a$export$4b834cebd9e5cebe} from "./calculatePosition.js";
2
- import {getActiveElement as $d8ac7ed472840322$export$cd4e5573fbe2b576, isFocusWithin as $d8ac7ed472840322$export$b4f377a2b6254582} from "../utils/shadowdom/DOMFunctions.js";
3
+ import {getActiveElement as $d8ac7ed472840322$export$cd4e5573fbe2b576, getPropagationTargets as $d8ac7ed472840322$export$da7af4355d792141, isFocusWithin as $d8ac7ed472840322$export$b4f377a2b6254582} from "../utils/shadowdom/DOMFunctions.js";
3
4
  import {useCloseOnScroll as $767706801671d160$export$18fc8428861184da} from "./useCloseOnScroll.js";
4
5
  import {useLayoutEffect as $53fed047b798be36$export$e5c5a5f917a5871c} from "../utils/useLayoutEffect.js";
5
6
  import {useLocale as $4defb058003b3e05$export$43bb16f9c6d9e3f7} from "../i18n/I18nProvider.js";
@@ -23,6 +24,7 @@ import {useState as $dzWlW$useState, useRef as $dzWlW$useRef, useEffect as $dzWl
23
24
 
24
25
 
25
26
 
27
+
26
28
  let $e55325afa7851309$var$visualViewport = typeof document !== 'undefined' ? window.visualViewport : null;
27
29
  function $e55325afa7851309$export$d39e1813b3bdd0e1(props) {
28
30
  let { direction: direction } = (0, $4defb058003b3e05$export$43bb16f9c6d9e3f7)();
@@ -31,9 +33,13 @@ function $e55325afa7851309$export$d39e1813b3bdd0e1(props) {
31
33
  let deps = [
32
34
  shouldUpdatePosition,
33
35
  placement,
36
+ // oxlint-disable-next-line react/react-compiler
34
37
  overlayRef.current,
38
+ // oxlint-disable-next-line react/react-compiler
35
39
  targetRef.current,
40
+ // oxlint-disable-next-line react/react-compiler
36
41
  arrowRef === null || arrowRef === void 0 ? void 0 : arrowRef.current,
42
+ // oxlint-disable-next-line react/react-compiler
37
43
  scrollRef.current,
38
44
  containerPadding,
39
45
  shouldFlip,
@@ -125,9 +131,11 @@ function $e55325afa7851309$export$d39e1813b3bdd0e1(props) {
125
131
  // Trigger a set state for a second render anyway for arrow positioning
126
132
  setPosition(position);
127
133
  // eslint-disable-next-line react-hooks/exhaustive-deps
134
+ // oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps
128
135
  }, deps);
129
136
  // Update position when anything changes
130
137
  // eslint-disable-next-line react-hooks/exhaustive-deps
138
+ // oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps
131
139
  (0, $53fed047b798be36$export$e5c5a5f917a5871c)(updatePosition, deps);
132
140
  // Update position on window resize
133
141
  $e55325afa7851309$var$useResize(updatePosition);
@@ -161,9 +169,12 @@ function $e55325afa7851309$export$d39e1813b3bdd0e1(props) {
161
169
  };
162
170
  $e55325afa7851309$var$visualViewport === null || $e55325afa7851309$var$visualViewport === void 0 ? void 0 : $e55325afa7851309$var$visualViewport.addEventListener('resize', onResize);
163
171
  $e55325afa7851309$var$visualViewport === null || $e55325afa7851309$var$visualViewport === void 0 ? void 0 : $e55325afa7851309$var$visualViewport.addEventListener('scroll', onScroll);
172
+ let cleanup = (0, $cc3c3666b64debad$export$f531f92e2a15358f)(// @ts-expect-error
173
+ (0, $d8ac7ed472840322$export$da7af4355d792141)(window), 'scroll', onScroll);
164
174
  return ()=>{
165
175
  $e55325afa7851309$var$visualViewport === null || $e55325afa7851309$var$visualViewport === void 0 ? void 0 : $e55325afa7851309$var$visualViewport.removeEventListener('resize', onResize);
166
176
  $e55325afa7851309$var$visualViewport === null || $e55325afa7851309$var$visualViewport === void 0 ? void 0 : $e55325afa7851309$var$visualViewport.removeEventListener('scroll', onScroll);
177
+ cleanup();
167
178
  };
168
179
  }, [
169
180
  updatePosition
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAiKD,IAAI,uCAAiB,OAAO,aAAa,cAAc,OAAO,cAAc,GAAG;AAMxE,SAAS,0CAAmB,KAAwB;IACzD,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,yCAAQ;IAC1B,IAAI,aACF,SAAS,aACT,SAAS,cACT,UAAU,YACV,QAAQ,aACR,YAAY,uBACZ,YAAY,4BACZ,mBAAmB,gBACnB,aAAa,uBACb,kBAAkB,OAAO,aAAa,cAAc,SAAS,IAAI,GAAG,cACpE,SAAS,gBACT,cAAc,yBACd,uBAAuB,cACvB,SAAS,eACT,OAAO,aACP,SAAS,uBACT,sBAAsB,kBACtB,aAAa,EACd,GAAG;IACJ,IAAI,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,eAAO,EAAyB;IAE9D,IAAI,OAAO;QACT;QACA;QACA,WAAW,OAAO;QAClB,UAAU,OAAO;QACjB,qBAAA,+BAAA,SAAU,OAAO;QACjB,UAAU,OAAO;QACjB;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;Q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yCAAe,EAAE;QACf,YAAY;gBACZ;QACA,SAAS,WAAW;IACtB;QAUiB,qBAGJ,qBACS;IAZtB,OAAO;QACL,cAAc;YACZ,OAAO;gBACL,UAAU,WAAW,aAAa;gBAClC,KAAK,CAAC,WAAW,IAAI;gBACrB,MAAM,CAAC,WAAW,IAAI;gBACtB,QAAQ;mBACL,qBAAA,+BAAA,SAAU,QAAQ,AAArB;gBACA,WAAW,CAAA,sBAAA,qBAAA,+BAAA,SAAU,SAAS,cAAnB,iCAAA,sBAAuB;YACpC;QACF;QACA,WAAW,CAAA,sBAAA,qBAAA,+BAAA,SAAU,SAAS,cAAnB,iCAAA,sBAAuB;QAClC,oBAAoB,CAAA,+BAAA,qBAAA,+BAAA,SAAU,kBAAkB,cAA5B,0CAAA,+BAAgC;QACpD,YAAY;YACV,eAAe;YACf,MAAM;YACN,OAAO;gBACL,IAAI,EAAE,qBAAA,+BAAA,SAAU,eAAe;gBAC/B,GAAG,EAAE,qBAAA,+BAAA,SAAU,cAAc;YAC/B;QACF;wBACA;IACF;AACF;AAEA,SAAS,gCAAU,QAAQ;IACzB,CAAA,GAAA,yCAAc,EAAE;QACd,OAAO,gBAAgB,CAAC,UAAU,UAAU;QAC5C,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU,UAAU;QACjD;IACF,GAAG;QAAC;KAAS;AACf;AAEA,SAAS,mCAAa,QAAQ,EAAE,SAAS;IACvC,IAAI,cAAc,OAChB,OAAO,SAAS,OAAO,CAAC,SAAS,SAAS,OAAO,CAAC,OAAO;IAE3D,OAAO,SAAS,OAAO,CAAC,SAAS,QAAQ,OAAO,CAAC,OAAO;AAC1D","sources":["packages/react-aria/src/overlays/useOverlayPosition.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {calculatePosition, getRect, PositionResult} from './calculatePosition';\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {getActiveElement, isFocusWithin} from '../utils/shadowdom/DOMFunctions';\nimport {useCallback, useEffect, useRef, useState} from 'react';\nimport {useCloseOnScroll} from './useCloseOnScroll';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocale} from '../i18n/I18nProvider';\nimport {useResizeObserver} from '../utils/useResizeObserver';\n\nexport type Placement =\n | 'bottom'\n | 'bottom left'\n | 'bottom right'\n | 'bottom start'\n | 'bottom end'\n | 'top'\n | 'top left'\n | 'top right'\n | 'top start'\n | 'top end'\n | 'left'\n | 'left top'\n | 'left bottom'\n | 'start'\n | 'start top'\n | 'start bottom'\n | 'right'\n | 'right top'\n | 'right bottom'\n | 'end'\n | 'end top'\n | 'end bottom';\n\nexport type Axis = 'top' | 'bottom' | 'left' | 'right';\nexport type SizeAxis = 'width' | 'height';\nexport type PlacementAxis = Axis | 'center';\n\nexport interface PositionProps {\n /**\n * The placement of the element with respect to its anchor element.\n *\n * @default 'bottom'\n */\n placement?: Placement;\n /**\n * The placement padding that should be applied between the element and its\n * surrounding container.\n *\n * @default 12\n */\n containerPadding?: number;\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n *\n * @default 0\n */\n offset?: number;\n /**\n * The additional offset applied along the cross axis between the element and its\n * anchor element.\n *\n * @default 0\n */\n crossOffset?: number;\n /**\n * Whether the element should flip its orientation (e.g. top to bottom or left to right) when\n * there is insufficient room for it to render completely.\n *\n * @default true\n */\n shouldFlip?: boolean;\n // /**\n // * The element that should be used as the bounding container when calculating container offset\n // * or whether it should flip.\n // */\n // boundaryElement?: Element,\n /** Whether the element is rendered. */\n isOpen?: boolean;\n}\n\nexport interface AriaPositionProps extends PositionProps {\n /**\n * Cross size of the overlay arrow in pixels.\n *\n * @default 0\n */\n arrowSize?: number;\n /**\n * Element that that serves as the positioning boundary.\n *\n * @default document.body\n */\n boundaryElement?: Element;\n /**\n * The ref for the element which the overlay positions itself with respect to.\n */\n targetRef: RefObject<Element | null>;\n /**\n * The ref for the overlay element.\n */\n overlayRef: RefObject<Element | null>;\n /**\n * The ref for the arrow element.\n */\n arrowRef?: RefObject<Element | null>;\n /**\n * A ref for the scrollable region within the overlay.\n *\n * @default overlayRef\n */\n scrollRef?: RefObject<Element | null>;\n /**\n * Whether the overlay should update its position automatically.\n *\n * @default true\n */\n shouldUpdatePosition?: boolean;\n /** Handler that is called when the overlay should close. */\n onClose?: (() => void) | null;\n /**\n * The maxHeight specified for the overlay element.\n * By default, it will take all space up to the current viewport height.\n */\n maxHeight?: number;\n /**\n * The minimum distance the arrow's edge should be from the edge of the overlay element.\n *\n * @default 0\n */\n arrowBoundaryOffset?: number;\n /**\n * Overrides the target element's bounding rectangle. Useful for positioning relative to\n * a specific point such as the mouse cursor (e.g. context menus) or text selection.\n *\n * @default target.getBoundingClientRect()\n * @param target - The target element.\n */\n getTargetRect?: (target: Element) => DOMRect | null | undefined;\n}\n\nexport interface PositionAria {\n /** Props for the overlay container element. */\n overlayProps: DOMAttributes;\n /** Props for the overlay tip arrow if any. */\n arrowProps: DOMAttributes;\n /** Placement of the overlay with respect to the overlay trigger. */\n placement: PlacementAxis | null;\n /** The origin of the target in the overlay's coordinate system. Useful for animations. */\n triggerAnchorPoint: {x: number; y: number} | null;\n /** Updates the position of the overlay. */\n updatePosition(): void;\n}\n\ninterface ScrollAnchor {\n type: 'top' | 'bottom';\n offset: number;\n}\n\nlet visualViewport = typeof document !== 'undefined' ? window.visualViewport : null;\n\n/**\n * Handles positioning overlays like popovers and menus relative to a trigger\n * element, and updating the position when the window resizes.\n */\nexport function useOverlayPosition(props: AriaPositionProps): PositionAria {\n let {direction} = useLocale();\n let {\n arrowSize,\n targetRef,\n overlayRef,\n arrowRef,\n scrollRef = overlayRef,\n placement = 'bottom' as Placement,\n containerPadding = 12,\n shouldFlip = true,\n boundaryElement = typeof document !== 'undefined' ? document.body : null,\n offset = 0,\n crossOffset = 0,\n shouldUpdatePosition = true,\n isOpen = true,\n onClose,\n maxHeight,\n arrowBoundaryOffset = 0,\n getTargetRect\n } = props;\n let [position, setPosition] = useState<PositionResult | null>(null);\n\n let deps = [\n shouldUpdatePosition,\n placement,\n overlayRef.current,\n targetRef.current,\n arrowRef?.current,\n scrollRef.current,\n containerPadding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n isOpen,\n direction,\n maxHeight,\n arrowBoundaryOffset,\n arrowSize\n ];\n\n // Note, the position freezing breaks if body sizes itself dynamicly with the visual viewport but that might\n // just be a non-realistic use case\n // Upon opening a overlay, record the current visual viewport scale so we can freeze the overlay styles\n let lastScale = useRef(visualViewport?.scale);\n useEffect(() => {\n if (isOpen) {\n lastScale.current = visualViewport?.scale;\n }\n }, [isOpen]);\n\n let updatePosition = useCallback(() => {\n if (\n shouldUpdatePosition === false ||\n !isOpen ||\n !overlayRef.current ||\n !targetRef.current ||\n !boundaryElement\n ) {\n return;\n }\n\n if (visualViewport?.scale !== lastScale.current) {\n return;\n }\n\n // Determine a scroll anchor based on the focused element.\n // This stores the offset of the anchor element from the scroll container\n // so it can be restored after repositioning. This way if the overlay height\n // changes, the focused element appears to stay in the same position.\n let anchor: ScrollAnchor | null = null;\n if (scrollRef.current && isFocusWithin(scrollRef.current)) {\n let anchorRect = getActiveElement()?.getBoundingClientRect();\n let scrollRect = scrollRef.current.getBoundingClientRect();\n // Anchor from the top if the offset is in the top half of the scrollable element,\n // otherwise anchor from the bottom.\n anchor = {\n type: 'top',\n offset: (anchorRect?.top ?? 0) - scrollRect.top\n };\n if (anchor.offset > scrollRect.height / 2) {\n anchor.type = 'bottom';\n anchor.offset = (anchorRect?.bottom ?? 0) - scrollRect.bottom;\n }\n }\n\n // Always reset the overlay's previous max height if not defined by the user so that we can compensate for\n // RAC collections populating after a second render and properly set a correct max height + positioning when it populates.\n let overlay = overlayRef.current as HTMLElement;\n if (!maxHeight && overlayRef.current) {\n overlay.style.top = '0px';\n overlay.style.bottom = '';\n overlay.style.maxHeight = (window.visualViewport?.height ?? window.innerHeight) + 'px';\n }\n\n let position = calculatePosition({\n placement: translateRTL(placement, direction),\n overlayNode: overlayRef.current,\n targetNode: targetRef.current,\n scrollNode: scrollRef.current || overlayRef.current,\n padding: containerPadding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n maxHeight,\n arrowSize: arrowSize ?? (arrowRef?.current ? getRect(arrowRef.current, true).width : 0),\n arrowBoundaryOffset,\n targetRect: getTargetRect?.(targetRef.current)\n });\n\n if (!position.position) {\n return;\n }\n\n // Modify overlay styles directly so positioning happens immediately without the need of a second render\n // This is so we don't have to delay autoFocus scrolling or delay applying preventScroll for popovers\n overlay.style.top = '';\n overlay.style.bottom = '';\n overlay.style.left = '';\n overlay.style.right = '';\n\n Object.keys(position.position).forEach(\n key => (overlay.style[key] = position.position![key] + 'px')\n );\n overlay.style.maxHeight = position.maxHeight != null ? position.maxHeight + 'px' : '';\n\n // Restore scroll position relative to anchor element.\n let activeElement = getActiveElement();\n if (anchor && activeElement && scrollRef.current) {\n let anchorRect = activeElement.getBoundingClientRect();\n let scrollRect = scrollRef.current.getBoundingClientRect();\n let newOffset = anchorRect[anchor.type] - scrollRect[anchor.type];\n scrollRef.current.scrollTop += newOffset - anchor.offset;\n }\n\n // Trigger a set state for a second render anyway for arrow positioning\n setPosition(position);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n\n // Update position when anything changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(updatePosition, deps);\n\n // Update position on window resize\n useResize(updatePosition);\n\n // Update position when the overlay changes size (might need to flip).\n useResizeObserver({\n ref: overlayRef,\n onResize: updatePosition\n });\n\n // Update position when the target changes size (might need to flip).\n useResizeObserver({\n ref: targetRef,\n onResize: updatePosition\n });\n\n // Reposition the overlay and do not close on scroll while the visual viewport is resizing.\n // This will ensure that overlays adjust their positioning when the iOS virtual keyboard appears.\n let isResizing = useRef(false);\n useLayoutEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n let onResize = () => {\n isResizing.current = true;\n clearTimeout(timeout);\n\n timeout = setTimeout(() => {\n isResizing.current = false;\n }, 500);\n\n updatePosition();\n };\n\n // Only reposition the overlay if a scroll event happens immediately as a result of resize (aka the virtual keyboard has appears)\n // We don't want to reposition the overlay if the user has pinch zoomed in and is scrolling the viewport around.\n let onScroll = () => {\n if (isResizing.current) {\n onResize();\n }\n };\n\n visualViewport?.addEventListener('resize', onResize);\n visualViewport?.addEventListener('scroll', onScroll);\n return () => {\n visualViewport?.removeEventListener('resize', onResize);\n visualViewport?.removeEventListener('scroll', onScroll);\n };\n }, [updatePosition]);\n\n let close = useCallback(() => {\n if (!isResizing.current) {\n onClose?.();\n }\n }, [onClose, isResizing]);\n\n // When scrolling a parent scrollable region of the trigger (other than the body),\n // we hide the popover. Otherwise, its position would be incorrect.\n useCloseOnScroll({\n triggerRef: targetRef,\n isOpen,\n onClose: onClose && close\n });\n\n return {\n overlayProps: {\n style: {\n position: position ? 'absolute' : 'fixed',\n top: !position ? 0 : undefined,\n left: !position ? 0 : undefined,\n zIndex: 100000, // should match the z-index in ModalTrigger\n ...position?.position,\n maxHeight: position?.maxHeight ?? '100vh'\n }\n },\n placement: position?.placement ?? null,\n triggerAnchorPoint: position?.triggerAnchorPoint ?? null,\n arrowProps: {\n 'aria-hidden': 'true',\n role: 'presentation',\n style: {\n left: position?.arrowOffsetLeft,\n top: position?.arrowOffsetTop\n }\n },\n updatePosition\n };\n}\n\nfunction useResize(onResize) {\n useLayoutEffect(() => {\n window.addEventListener('resize', onResize, false);\n return () => {\n window.removeEventListener('resize', onResize, false);\n };\n }, [onResize]);\n}\n\nfunction translateRTL(position, direction) {\n if (direction === 'rtl') {\n return position.replace('start', 'right').replace('end', 'left');\n }\n return position.replace('start', 'left').replace('end', 'right');\n}\n"],"names":[],"version":3,"file":"useOverlayPosition.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAmKD,IAAI,uCAAiB,OAAO,aAAa,cAAc,OAAO,cAAc,GAAG;AAMxE,SAAS,0CAAmB,KAAwB;IACzD,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,yCAAQ;IAC1B,IAAI,aACF,SAAS,aACT,SAAS,cACT,UAAU,YACV,QAAQ,aACR,YAAY,uBACZ,YAAY,4BACZ,mBAAmB,gBACnB,aAAa,uBACb,kBAAkB,OAAO,aAAa,cAAc,SAAS,IAAI,GAAG,cACpE,SAAS,gBACT,cAAc,yBACd,uBAAuB,cACvB,SAAS,eACT,OAAO,aACP,SAAS,uBACT,sBAAsB,kBACtB,aAAa,EACd,GAAG;IACJ,IAAI,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,eAAO,EAAyB;IAE9D,IAAI,OAAO;QACT;QACA;QACA,gDAAgD;QAChD,WAAW,OAAO;QAClB,gDAAgD;QAChD,UAAU,OAAO;QACjB,gDAAgD;QAChD,qBAAA,+BAAA,SAAU,OAAO;QACjB,gDAAgD;QAChD,UAAU,OAAO;QACjB;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD;IAED,4GAA4G;IAC5G,mCAAmC;IACnC,uGAAuG;IACvG,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE,iDAAA,2DAAA,qCAAgB,KAAK;IAC5C,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,QACF,UAAU,OAAO,GAAG,iDAAA,2DAAA,qCAAgB,KAAK;IAE7C,GAAG;QAAC;KAAO;IAEX,IAAI,iBAAiB,CAAA,GAAA,kBAAU,EAAE;QAC/B,IACE,yBAAyB,SACzB,CAAC,UACD,CAAC,WAAW,OAAO,IACnB,CAAC,UAAU,OAAO,IAClB,CAAC,iBAED;QAGF,IAAI,CAAA,iD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A,qBAAA,+BAAA,SAAU,SAAS,cAAnB,iCAAA,sBAAuB;YACpC;QACF;QACA,WAAW,CAAA,sBAAA,qBAAA,+BAAA,SAAU,SAAS,cAAnB,iCAAA,sBAAuB;QAClC,oBAAoB,CAAA,+BAAA,qBAAA,+BAAA,SAAU,kBAAkB,cAA5B,0CAAA,+BAAgC;QACpD,YAAY;YACV,eAAe;YACf,MAAM;YACN,OAAO;gBACL,IAAI,EAAE,qBAAA,+BAAA,SAAU,eAAe;gBAC/B,GAAG,EAAE,qBAAA,+BAAA,SAAU,cAAc;YAC/B;QACF;wBACA;IACF;AACF;AAEA,SAAS,gCAAU,QAAQ;IACzB,CAAA,GAAA,yCAAc,EAAE;QACd,OAAO,gBAAgB,CAAC,UAAU,UAAU;QAC5C,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU,UAAU;QACjD;IACF,GAAG;QAAC;KAAS;AACf;AAEA,SAAS,mCAAa,QAAQ,EAAE,SAAS;IACvC,IAAI,cAAc,OAChB,OAAO,SAAS,OAAO,CAAC,SAAS,SAAS,OAAO,CAAC,OAAO;IAE3D,OAAO,SAAS,OAAO,CAAC,SAAS,QAAQ,OAAO,CAAC,OAAO;AAC1D","sources":["packages/react-aria/src/overlays/useOverlayPosition.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {addEvent} from '../utils/domHelpers';\nimport {calculatePosition, getRect, PositionResult} from './calculatePosition';\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {getActiveElement, isFocusWithin} from '../utils/shadowdom/DOMFunctions';\nimport {getPropagationTargets} from '../utils/shadowdom/DOMFunctions';\nimport {useCallback, useEffect, useRef, useState} from 'react';\nimport {useCloseOnScroll} from './useCloseOnScroll';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocale} from '../i18n/I18nProvider';\nimport {useResizeObserver} from '../utils/useResizeObserver';\n\nexport type Placement =\n | 'bottom'\n | 'bottom left'\n | 'bottom right'\n | 'bottom start'\n | 'bottom end'\n | 'top'\n | 'top left'\n | 'top right'\n | 'top start'\n | 'top end'\n | 'left'\n | 'left top'\n | 'left bottom'\n | 'start'\n | 'start top'\n | 'start bottom'\n | 'right'\n | 'right top'\n | 'right bottom'\n | 'end'\n | 'end top'\n | 'end bottom';\n\nexport type Axis = 'top' | 'bottom' | 'left' | 'right';\nexport type SizeAxis = 'width' | 'height';\nexport type PlacementAxis = Axis | 'center';\n\nexport interface PositionProps {\n /**\n * The placement of the element with respect to its anchor element.\n *\n * @default 'bottom'\n */\n placement?: Placement;\n /**\n * The placement padding that should be applied between the element and its\n * surrounding container.\n *\n * @default 12\n */\n containerPadding?: number;\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n *\n * @default 0\n */\n offset?: number;\n /**\n * The additional offset applied along the cross axis between the element and its\n * anchor element.\n *\n * @default 0\n */\n crossOffset?: number;\n /**\n * Whether the element should flip its orientation (e.g. top to bottom or left to right) when\n * there is insufficient room for it to render completely.\n *\n * @default true\n */\n shouldFlip?: boolean;\n // /**\n // * The element that should be used as the bounding container when calculating container offset\n // * or whether it should flip.\n // */\n // boundaryElement?: Element,\n /** Whether the element is rendered. */\n isOpen?: boolean;\n}\n\nexport interface AriaPositionProps extends PositionProps {\n /**\n * Cross size of the overlay arrow in pixels.\n *\n * @default 0\n */\n arrowSize?: number;\n /**\n * Element that that serves as the positioning boundary.\n *\n * @default document.body\n */\n boundaryElement?: Element;\n /**\n * The ref for the element which the overlay positions itself with respect to.\n */\n targetRef: RefObject<Element | null>;\n /**\n * The ref for the overlay element.\n */\n overlayRef: RefObject<Element | null>;\n /**\n * The ref for the arrow element.\n */\n arrowRef?: RefObject<Element | null>;\n /**\n * A ref for the scrollable region within the overlay.\n *\n * @default overlayRef\n */\n scrollRef?: RefObject<Element | null>;\n /**\n * Whether the overlay should update its position automatically.\n *\n * @default true\n */\n shouldUpdatePosition?: boolean;\n /** Handler that is called when the overlay should close. */\n onClose?: (() => void) | null;\n /**\n * The maxHeight specified for the overlay element.\n * By default, it will take all space up to the current viewport height.\n */\n maxHeight?: number;\n /**\n * The minimum distance the arrow's edge should be from the edge of the overlay element.\n *\n * @default 0\n */\n arrowBoundaryOffset?: number;\n /**\n * Overrides the target element's bounding rectangle. Useful for positioning relative to\n * a specific point such as the mouse cursor (e.g. context menus) or text selection.\n *\n * @default target.getBoundingClientRect()\n * @param target - The target element.\n */\n getTargetRect?: (target: Element) => DOMRect | null | undefined;\n}\n\nexport interface PositionAria {\n /** Props for the overlay container element. */\n overlayProps: DOMAttributes;\n /** Props for the overlay tip arrow if any. */\n arrowProps: DOMAttributes;\n /** Placement of the overlay with respect to the overlay trigger. */\n placement: PlacementAxis | null;\n /** The origin of the target in the overlay's coordinate system. Useful for animations. */\n triggerAnchorPoint: {x: number; y: number} | null;\n /** Updates the position of the overlay. */\n updatePosition(): void;\n}\n\ninterface ScrollAnchor {\n type: 'top' | 'bottom';\n offset: number;\n}\n\nlet visualViewport = typeof document !== 'undefined' ? window.visualViewport : null;\n\n/**\n * Handles positioning overlays like popovers and menus relative to a trigger\n * element, and updating the position when the window resizes.\n */\nexport function useOverlayPosition(props: AriaPositionProps): PositionAria {\n let {direction} = useLocale();\n let {\n arrowSize,\n targetRef,\n overlayRef,\n arrowRef,\n scrollRef = overlayRef,\n placement = 'bottom' as Placement,\n containerPadding = 12,\n shouldFlip = true,\n boundaryElement = typeof document !== 'undefined' ? document.body : null,\n offset = 0,\n crossOffset = 0,\n shouldUpdatePosition = true,\n isOpen = true,\n onClose,\n maxHeight,\n arrowBoundaryOffset = 0,\n getTargetRect\n } = props;\n let [position, setPosition] = useState<PositionResult | null>(null);\n\n let deps = [\n shouldUpdatePosition,\n placement,\n // oxlint-disable-next-line react/react-compiler\n overlayRef.current,\n // oxlint-disable-next-line react/react-compiler\n targetRef.current,\n // oxlint-disable-next-line react/react-compiler\n arrowRef?.current,\n // oxlint-disable-next-line react/react-compiler\n scrollRef.current,\n containerPadding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n isOpen,\n direction,\n maxHeight,\n arrowBoundaryOffset,\n arrowSize\n ];\n\n // Note, the position freezing breaks if body sizes itself dynamicly with the visual viewport but that might\n // just be a non-realistic use case\n // Upon opening a overlay, record the current visual viewport scale so we can freeze the overlay styles\n let lastScale = useRef(visualViewport?.scale);\n useEffect(() => {\n if (isOpen) {\n lastScale.current = visualViewport?.scale;\n }\n }, [isOpen]);\n\n let updatePosition = useCallback(() => {\n if (\n shouldUpdatePosition === false ||\n !isOpen ||\n !overlayRef.current ||\n !targetRef.current ||\n !boundaryElement\n ) {\n return;\n }\n\n if (visualViewport?.scale !== lastScale.current) {\n return;\n }\n\n // Determine a scroll anchor based on the focused element.\n // This stores the offset of the anchor element from the scroll container\n // so it can be restored after repositioning. This way if the overlay height\n // changes, the focused element appears to stay in the same position.\n let anchor: ScrollAnchor | null = null;\n if (scrollRef.current && isFocusWithin(scrollRef.current)) {\n let anchorRect = getActiveElement()?.getBoundingClientRect();\n let scrollRect = scrollRef.current.getBoundingClientRect();\n // Anchor from the top if the offset is in the top half of the scrollable element,\n // otherwise anchor from the bottom.\n anchor = {\n type: 'top',\n offset: (anchorRect?.top ?? 0) - scrollRect.top\n };\n if (anchor.offset > scrollRect.height / 2) {\n anchor.type = 'bottom';\n anchor.offset = (anchorRect?.bottom ?? 0) - scrollRect.bottom;\n }\n }\n\n // Always reset the overlay's previous max height if not defined by the user so that we can compensate for\n // RAC collections populating after a second render and properly set a correct max height + positioning when it populates.\n let overlay = overlayRef.current as HTMLElement;\n if (!maxHeight && overlayRef.current) {\n overlay.style.top = '0px';\n overlay.style.bottom = '';\n overlay.style.maxHeight = (window.visualViewport?.height ?? window.innerHeight) + 'px';\n }\n\n let position = calculatePosition({\n placement: translateRTL(placement, direction),\n overlayNode: overlayRef.current,\n targetNode: targetRef.current,\n scrollNode: scrollRef.current || overlayRef.current,\n padding: containerPadding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n maxHeight,\n arrowSize: arrowSize ?? (arrowRef?.current ? getRect(arrowRef.current, true).width : 0),\n arrowBoundaryOffset,\n targetRect: getTargetRect?.(targetRef.current)\n });\n\n if (!position.position) {\n return;\n }\n\n // Modify overlay styles directly so positioning happens immediately without the need of a second render\n // This is so we don't have to delay autoFocus scrolling or delay applying preventScroll for popovers\n overlay.style.top = '';\n overlay.style.bottom = '';\n overlay.style.left = '';\n overlay.style.right = '';\n\n Object.keys(position.position).forEach(\n key => (overlay.style[key] = position.position![key] + 'px')\n );\n overlay.style.maxHeight = position.maxHeight != null ? position.maxHeight + 'px' : '';\n\n // Restore scroll position relative to anchor element.\n let activeElement = getActiveElement();\n if (anchor && activeElement && scrollRef.current) {\n let anchorRect = activeElement.getBoundingClientRect();\n let scrollRect = scrollRef.current.getBoundingClientRect();\n let newOffset = anchorRect[anchor.type] - scrollRect[anchor.type];\n scrollRef.current.scrollTop += newOffset - anchor.offset;\n }\n\n // Trigger a set state for a second render anyway for arrow positioning\n setPosition(position);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n // oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps\n }, deps);\n\n // Update position when anything changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n // oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps\n useLayoutEffect(updatePosition, deps);\n\n // Update position on window resize\n useResize(updatePosition);\n\n // Update position when the overlay changes size (might need to flip).\n useResizeObserver({\n ref: overlayRef,\n onResize: updatePosition\n });\n\n // Update position when the target changes size (might need to flip).\n useResizeObserver({\n ref: targetRef,\n onResize: updatePosition\n });\n\n // Reposition the overlay and do not close on scroll while the visual viewport is resizing.\n // This will ensure that overlays adjust their positioning when the iOS virtual keyboard appears.\n let isResizing = useRef(false);\n useLayoutEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n let onResize = () => {\n isResizing.current = true;\n clearTimeout(timeout);\n\n timeout = setTimeout(() => {\n isResizing.current = false;\n }, 500);\n\n updatePosition();\n };\n\n // Only reposition the overlay if a scroll event happens immediately as a result of resize (aka the virtual keyboard has appears)\n // We don't want to reposition the overlay if the user has pinch zoomed in and is scrolling the viewport around.\n let onScroll = () => {\n if (isResizing.current) {\n onResize();\n }\n };\n\n visualViewport?.addEventListener('resize', onResize);\n visualViewport?.addEventListener('scroll', onScroll);\n let cleanup = addEvent(\n // @ts-expect-error\n getPropagationTargets(window),\n 'scroll',\n onScroll\n );\n return () => {\n visualViewport?.removeEventListener('resize', onResize);\n visualViewport?.removeEventListener('scroll', onScroll);\n cleanup();\n };\n }, [updatePosition]);\n\n let close = useCallback(() => {\n if (!isResizing.current) {\n onClose?.();\n }\n }, [onClose, isResizing]);\n\n // When scrolling a parent scrollable region of the trigger (other than the body),\n // we hide the popover. Otherwise, its position would be incorrect.\n useCloseOnScroll({\n triggerRef: targetRef,\n isOpen,\n onClose: onClose && close\n });\n\n return {\n overlayProps: {\n style: {\n position: position ? 'absolute' : 'fixed',\n top: !position ? 0 : undefined,\n left: !position ? 0 : undefined,\n zIndex: 100000, // should match the z-index in ModalTrigger\n ...position?.position,\n maxHeight: position?.maxHeight ?? '100vh'\n }\n },\n placement: position?.placement ?? null,\n triggerAnchorPoint: position?.triggerAnchorPoint ?? null,\n arrowProps: {\n 'aria-hidden': 'true',\n role: 'presentation',\n style: {\n left: position?.arrowOffsetLeft,\n top: position?.arrowOffsetTop\n }\n },\n updatePosition\n };\n}\n\nfunction useResize(onResize) {\n useLayoutEffect(() => {\n window.addEventListener('resize', onResize, false);\n return () => {\n window.removeEventListener('resize', onResize, false);\n };\n }, [onResize]);\n}\n\nfunction translateRTL(position, direction) {\n if (direction === 'rtl') {\n return position.replace('start', 'right').replace('end', 'left');\n }\n return position.replace('start', 'left').replace('end', 'right');\n}\n"],"names":[],"version":3,"file":"useOverlayPosition.js.map"}
@@ -1,5 +1,6 @@
1
+ import {addEvent as $d447af545b77c9f1$export$f531f92e2a15358f} from "../utils/domHelpers.mjs";
1
2
  import {calculatePosition as $954926fb6168ae2a$export$b3ceb0cbf1056d98, getRect as $954926fb6168ae2a$export$4b834cebd9e5cebe} from "./calculatePosition.mjs";
2
- import {getActiveElement as $23f2114a1b82827e$export$cd4e5573fbe2b576, isFocusWithin as $23f2114a1b82827e$export$b4f377a2b6254582} from "../utils/shadowdom/DOMFunctions.mjs";
3
+ import {getActiveElement as $23f2114a1b82827e$export$cd4e5573fbe2b576, getPropagationTargets as $23f2114a1b82827e$export$da7af4355d792141, isFocusWithin as $23f2114a1b82827e$export$b4f377a2b6254582} from "../utils/shadowdom/DOMFunctions.mjs";
3
4
  import {useCloseOnScroll as $22e2f5f6490788e8$export$18fc8428861184da} from "./useCloseOnScroll.mjs";
4
5
  import {useLayoutEffect as $c4867b2f328c2698$export$e5c5a5f917a5871c} from "../utils/useLayoutEffect.mjs";
5
6
  import {useLocale as $2eb8e6d23f3d0cb0$export$43bb16f9c6d9e3f7} from "../i18n/I18nProvider.mjs";
@@ -23,6 +24,7 @@ import {useState as $jKzS8$useState, useRef as $jKzS8$useRef, useEffect as $jKzS
23
24
 
24
25
 
25
26
 
27
+
26
28
  let $b3526bc71400be8d$var$visualViewport = typeof document !== 'undefined' ? window.visualViewport : null;
27
29
  function $b3526bc71400be8d$export$d39e1813b3bdd0e1(props) {
28
30
  let { direction: direction } = (0, $2eb8e6d23f3d0cb0$export$43bb16f9c6d9e3f7)();
@@ -31,9 +33,13 @@ function $b3526bc71400be8d$export$d39e1813b3bdd0e1(props) {
31
33
  let deps = [
32
34
  shouldUpdatePosition,
33
35
  placement,
36
+ // oxlint-disable-next-line react/react-compiler
34
37
  overlayRef.current,
38
+ // oxlint-disable-next-line react/react-compiler
35
39
  targetRef.current,
40
+ // oxlint-disable-next-line react/react-compiler
36
41
  arrowRef?.current,
42
+ // oxlint-disable-next-line react/react-compiler
37
43
  scrollRef.current,
38
44
  containerPadding,
39
45
  shouldFlip,
@@ -120,9 +126,11 @@ function $b3526bc71400be8d$export$d39e1813b3bdd0e1(props) {
120
126
  // Trigger a set state for a second render anyway for arrow positioning
121
127
  setPosition(position);
122
128
  // eslint-disable-next-line react-hooks/exhaustive-deps
129
+ // oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps
123
130
  }, deps);
124
131
  // Update position when anything changes
125
132
  // eslint-disable-next-line react-hooks/exhaustive-deps
133
+ // oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps
126
134
  (0, $c4867b2f328c2698$export$e5c5a5f917a5871c)(updatePosition, deps);
127
135
  // Update position on window resize
128
136
  $b3526bc71400be8d$var$useResize(updatePosition);
@@ -156,9 +164,12 @@ function $b3526bc71400be8d$export$d39e1813b3bdd0e1(props) {
156
164
  };
157
165
  $b3526bc71400be8d$var$visualViewport?.addEventListener('resize', onResize);
158
166
  $b3526bc71400be8d$var$visualViewport?.addEventListener('scroll', onScroll);
167
+ let cleanup = (0, $d447af545b77c9f1$export$f531f92e2a15358f)(// @ts-expect-error
168
+ (0, $23f2114a1b82827e$export$da7af4355d792141)(window), 'scroll', onScroll);
159
169
  return ()=>{
160
170
  $b3526bc71400be8d$var$visualViewport?.removeEventListener('resize', onResize);
161
171
  $b3526bc71400be8d$var$visualViewport?.removeEventListener('scroll', onScroll);
172
+ cleanup();
162
173
  };
163
174
  }, [
164
175
  updatePosition
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAiKD,IAAI,uCAAiB,OAAO,aAAa,cAAc,OAAO,cAAc,GAAG;AAMxE,SAAS,0CAAmB,KAAwB;IACzD,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,yCAAQ;IA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mE;IACnE,CAAA,GAAA,yCAAe,EAAE;QACf,YAAY;gBACZ;QACA,SAAS,WAAW;IACtB;IAEA,OAAO;QACL,cAAc;YACZ,OAAO;gBACL,UAAU,WAAW,aAAa;gBAClC,KAAK,CAAC,WAAW,IAAI;gBACrB,MAAM,CAAC,WAAW,IAAI;gBACtB,QAAQ;gBACR,GAAG,UAAU,QAAQ;gBACrB,WAAW,UAAU,aAAa;YACpC;QACF;QACA,WAAW,UAAU,aAAa;QAClC,oBAAoB,UAAU,sBAAsB;QACpD,YAAY;YACV,eAAe;YACf,MAAM;YACN,OAAO;gBACL,MAAM,UAAU;gBAChB,KAAK,UAAU;YACjB;QACF;wBACA;IACF;AACF;AAEA,SAAS,gCAAU,QAAQ;IACzB,CAAA,GAAA,yCAAc,EAAE;QACd,OAAO,gBAAgB,CAAC,UAAU,UAAU;QAC5C,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU,UAAU;QACjD;IACF,GAAG;QAAC;KAAS;AACf;AAEA,SAAS,mCAAa,QAAQ,EAAE,SAAS;IACvC,IAAI,cAAc,OAChB,OAAO,SAAS,OAAO,CAAC,SAAS,SAAS,OAAO,CAAC,OAAO;IAE3D,OAAO,SAAS,OAAO,CAAC,SAAS,QAAQ,OAAO,CAAC,OAAO;AAC1D","sources":["packages/react-aria/src/overlays/useOverlayPosition.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {calculatePosition, getRect, PositionResult} from './calculatePosition';\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {getActiveElement, isFocusWithin} from '../utils/shadowdom/DOMFunctions';\nimport {useCallback, useEffect, useRef, useState} from 'react';\nimport {useCloseOnScroll} from './useCloseOnScroll';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocale} from '../i18n/I18nProvider';\nimport {useResizeObserver} from '../utils/useResizeObserver';\n\nexport type Placement =\n | 'bottom'\n | 'bottom left'\n | 'bottom right'\n | 'bottom start'\n | 'bottom end'\n | 'top'\n | 'top left'\n | 'top right'\n | 'top start'\n | 'top end'\n | 'left'\n | 'left top'\n | 'left bottom'\n | 'start'\n | 'start top'\n | 'start bottom'\n | 'right'\n | 'right top'\n | 'right bottom'\n | 'end'\n | 'end top'\n | 'end bottom';\n\nexport type Axis = 'top' | 'bottom' | 'left' | 'right';\nexport type SizeAxis = 'width' | 'height';\nexport type PlacementAxis = Axis | 'center';\n\nexport interface PositionProps {\n /**\n * The placement of the element with respect to its anchor element.\n *\n * @default 'bottom'\n */\n placement?: Placement;\n /**\n * The placement padding that should be applied between the element and its\n * surrounding container.\n *\n * @default 12\n */\n containerPadding?: number;\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n *\n * @default 0\n */\n offset?: number;\n /**\n * The additional offset applied along the cross axis between the element and its\n * anchor element.\n *\n * @default 0\n */\n crossOffset?: number;\n /**\n * Whether the element should flip its orientation (e.g. top to bottom or left to right) when\n * there is insufficient room for it to render completely.\n *\n * @default true\n */\n shouldFlip?: boolean;\n // /**\n // * The element that should be used as the bounding container when calculating container offset\n // * or whether it should flip.\n // */\n // boundaryElement?: Element,\n /** Whether the element is rendered. */\n isOpen?: boolean;\n}\n\nexport interface AriaPositionProps extends PositionProps {\n /**\n * Cross size of the overlay arrow in pixels.\n *\n * @default 0\n */\n arrowSize?: number;\n /**\n * Element that that serves as the positioning boundary.\n *\n * @default document.body\n */\n boundaryElement?: Element;\n /**\n * The ref for the element which the overlay positions itself with respect to.\n */\n targetRef: RefObject<Element | null>;\n /**\n * The ref for the overlay element.\n */\n overlayRef: RefObject<Element | null>;\n /**\n * The ref for the arrow element.\n */\n arrowRef?: RefObject<Element | null>;\n /**\n * A ref for the scrollable region within the overlay.\n *\n * @default overlayRef\n */\n scrollRef?: RefObject<Element | null>;\n /**\n * Whether the overlay should update its position automatically.\n *\n * @default true\n */\n shouldUpdatePosition?: boolean;\n /** Handler that is called when the overlay should close. */\n onClose?: (() => void) | null;\n /**\n * The maxHeight specified for the overlay element.\n * By default, it will take all space up to the current viewport height.\n */\n maxHeight?: number;\n /**\n * The minimum distance the arrow's edge should be from the edge of the overlay element.\n *\n * @default 0\n */\n arrowBoundaryOffset?: number;\n /**\n * Overrides the target element's bounding rectangle. Useful for positioning relative to\n * a specific point such as the mouse cursor (e.g. context menus) or text selection.\n *\n * @default target.getBoundingClientRect()\n * @param target - The target element.\n */\n getTargetRect?: (target: Element) => DOMRect | null | undefined;\n}\n\nexport interface PositionAria {\n /** Props for the overlay container element. */\n overlayProps: DOMAttributes;\n /** Props for the overlay tip arrow if any. */\n arrowProps: DOMAttributes;\n /** Placement of the overlay with respect to the overlay trigger. */\n placement: PlacementAxis | null;\n /** The origin of the target in the overlay's coordinate system. Useful for animations. */\n triggerAnchorPoint: {x: number; y: number} | null;\n /** Updates the position of the overlay. */\n updatePosition(): void;\n}\n\ninterface ScrollAnchor {\n type: 'top' | 'bottom';\n offset: number;\n}\n\nlet visualViewport = typeof document !== 'undefined' ? window.visualViewport : null;\n\n/**\n * Handles positioning overlays like popovers and menus relative to a trigger\n * element, and updating the position when the window resizes.\n */\nexport function useOverlayPosition(props: AriaPositionProps): PositionAria {\n let {direction} = useLocale();\n let {\n arrowSize,\n targetRef,\n overlayRef,\n arrowRef,\n scrollRef = overlayRef,\n placement = 'bottom' as Placement,\n containerPadding = 12,\n shouldFlip = true,\n boundaryElement = typeof document !== 'undefined' ? document.body : null,\n offset = 0,\n crossOffset = 0,\n shouldUpdatePosition = true,\n isOpen = true,\n onClose,\n maxHeight,\n arrowBoundaryOffset = 0,\n getTargetRect\n } = props;\n let [position, setPosition] = useState<PositionResult | null>(null);\n\n let deps = [\n shouldUpdatePosition,\n placement,\n overlayRef.current,\n targetRef.current,\n arrowRef?.current,\n scrollRef.current,\n containerPadding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n isOpen,\n direction,\n maxHeight,\n arrowBoundaryOffset,\n arrowSize\n ];\n\n // Note, the position freezing breaks if body sizes itself dynamicly with the visual viewport but that might\n // just be a non-realistic use case\n // Upon opening a overlay, record the current visual viewport scale so we can freeze the overlay styles\n let lastScale = useRef(visualViewport?.scale);\n useEffect(() => {\n if (isOpen) {\n lastScale.current = visualViewport?.scale;\n }\n }, [isOpen]);\n\n let updatePosition = useCallback(() => {\n if (\n shouldUpdatePosition === false ||\n !isOpen ||\n !overlayRef.current ||\n !targetRef.current ||\n !boundaryElement\n ) {\n return;\n }\n\n if (visualViewport?.scale !== lastScale.current) {\n return;\n }\n\n // Determine a scroll anchor based on the focused element.\n // This stores the offset of the anchor element from the scroll container\n // so it can be restored after repositioning. This way if the overlay height\n // changes, the focused element appears to stay in the same position.\n let anchor: ScrollAnchor | null = null;\n if (scrollRef.current && isFocusWithin(scrollRef.current)) {\n let anchorRect = getActiveElement()?.getBoundingClientRect();\n let scrollRect = scrollRef.current.getBoundingClientRect();\n // Anchor from the top if the offset is in the top half of the scrollable element,\n // otherwise anchor from the bottom.\n anchor = {\n type: 'top',\n offset: (anchorRect?.top ?? 0) - scrollRect.top\n };\n if (anchor.offset > scrollRect.height / 2) {\n anchor.type = 'bottom';\n anchor.offset = (anchorRect?.bottom ?? 0) - scrollRect.bottom;\n }\n }\n\n // Always reset the overlay's previous max height if not defined by the user so that we can compensate for\n // RAC collections populating after a second render and properly set a correct max height + positioning when it populates.\n let overlay = overlayRef.current as HTMLElement;\n if (!maxHeight && overlayRef.current) {\n overlay.style.top = '0px';\n overlay.style.bottom = '';\n overlay.style.maxHeight = (window.visualViewport?.height ?? window.innerHeight) + 'px';\n }\n\n let position = calculatePosition({\n placement: translateRTL(placement, direction),\n overlayNode: overlayRef.current,\n targetNode: targetRef.current,\n scrollNode: scrollRef.current || overlayRef.current,\n padding: containerPadding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n maxHeight,\n arrowSize: arrowSize ?? (arrowRef?.current ? getRect(arrowRef.current, true).width : 0),\n arrowBoundaryOffset,\n targetRect: getTargetRect?.(targetRef.current)\n });\n\n if (!position.position) {\n return;\n }\n\n // Modify overlay styles directly so positioning happens immediately without the need of a second render\n // This is so we don't have to delay autoFocus scrolling or delay applying preventScroll for popovers\n overlay.style.top = '';\n overlay.style.bottom = '';\n overlay.style.left = '';\n overlay.style.right = '';\n\n Object.keys(position.position).forEach(\n key => (overlay.style[key] = position.position![key] + 'px')\n );\n overlay.style.maxHeight = position.maxHeight != null ? position.maxHeight + 'px' : '';\n\n // Restore scroll position relative to anchor element.\n let activeElement = getActiveElement();\n if (anchor && activeElement && scrollRef.current) {\n let anchorRect = activeElement.getBoundingClientRect();\n let scrollRect = scrollRef.current.getBoundingClientRect();\n let newOffset = anchorRect[anchor.type] - scrollRect[anchor.type];\n scrollRef.current.scrollTop += newOffset - anchor.offset;\n }\n\n // Trigger a set state for a second render anyway for arrow positioning\n setPosition(position);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n\n // Update position when anything changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(updatePosition, deps);\n\n // Update position on window resize\n useResize(updatePosition);\n\n // Update position when the overlay changes size (might need to flip).\n useResizeObserver({\n ref: overlayRef,\n onResize: updatePosition\n });\n\n // Update position when the target changes size (might need to flip).\n useResizeObserver({\n ref: targetRef,\n onResize: updatePosition\n });\n\n // Reposition the overlay and do not close on scroll while the visual viewport is resizing.\n // This will ensure that overlays adjust their positioning when the iOS virtual keyboard appears.\n let isResizing = useRef(false);\n useLayoutEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n let onResize = () => {\n isResizing.current = true;\n clearTimeout(timeout);\n\n timeout = setTimeout(() => {\n isResizing.current = false;\n }, 500);\n\n updatePosition();\n };\n\n // Only reposition the overlay if a scroll event happens immediately as a result of resize (aka the virtual keyboard has appears)\n // We don't want to reposition the overlay if the user has pinch zoomed in and is scrolling the viewport around.\n let onScroll = () => {\n if (isResizing.current) {\n onResize();\n }\n };\n\n visualViewport?.addEventListener('resize', onResize);\n visualViewport?.addEventListener('scroll', onScroll);\n return () => {\n visualViewport?.removeEventListener('resize', onResize);\n visualViewport?.removeEventListener('scroll', onScroll);\n };\n }, [updatePosition]);\n\n let close = useCallback(() => {\n if (!isResizing.current) {\n onClose?.();\n }\n }, [onClose, isResizing]);\n\n // When scrolling a parent scrollable region of the trigger (other than the body),\n // we hide the popover. Otherwise, its position would be incorrect.\n useCloseOnScroll({\n triggerRef: targetRef,\n isOpen,\n onClose: onClose && close\n });\n\n return {\n overlayProps: {\n style: {\n position: position ? 'absolute' : 'fixed',\n top: !position ? 0 : undefined,\n left: !position ? 0 : undefined,\n zIndex: 100000, // should match the z-index in ModalTrigger\n ...position?.position,\n maxHeight: position?.maxHeight ?? '100vh'\n }\n },\n placement: position?.placement ?? null,\n triggerAnchorPoint: position?.triggerAnchorPoint ?? null,\n arrowProps: {\n 'aria-hidden': 'true',\n role: 'presentation',\n style: {\n left: position?.arrowOffsetLeft,\n top: position?.arrowOffsetTop\n }\n },\n updatePosition\n };\n}\n\nfunction useResize(onResize) {\n useLayoutEffect(() => {\n window.addEventListener('resize', onResize, false);\n return () => {\n window.removeEventListener('resize', onResize, false);\n };\n }, [onResize]);\n}\n\nfunction translateRTL(position, direction) {\n if (direction === 'rtl') {\n return position.replace('start', 'right').replace('end', 'left');\n }\n return position.replace('start', 'left').replace('end', 'right');\n}\n"],"names":[],"version":3,"file":"useOverlayPosition.mjs.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAmKD,IAAI,uCAAiB,OAAO,aAAa,cAAc,OAAO,cAAc,GAAG;AAMxE,SAAS,0CAAmB,KAAwB;IAC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ACA;QAEF,OAAO;YACL,sCAAgB,oBAAoB,UAAU;YAC9C,sCAAgB,oBAAoB,UAAU;YAC9C;QACF;IACF,GAAG;QAAC;KAAe;IAEnB,IAAI,QAAQ,CAAA,GAAA,kBAAU,EAAE;QACtB,IAAI,CAAC,WAAW,OAAO,EACrB;IAEJ,GAAG;QAAC;QAAS;KAAW;IAExB,kFAAkF;IAClF,mEAAmE;IACnE,CAAA,GAAA,yCAAe,EAAE;QACf,YAAY;gBACZ;QACA,SAAS,WAAW;IACtB;IAEA,OAAO;QACL,cAAc;YACZ,OAAO;gBACL,UAAU,WAAW,aAAa;gBAClC,KAAK,CAAC,WAAW,IAAI;gBACrB,MAAM,CAAC,WAAW,IAAI;gBACtB,QAAQ;gBACR,GAAG,UAAU,QAAQ;gBACrB,WAAW,UAAU,aAAa;YACpC;QACF;QACA,WAAW,UAAU,aAAa;QAClC,oBAAoB,UAAU,sBAAsB;QACpD,YAAY;YACV,eAAe;YACf,MAAM;YACN,OAAO;gBACL,MAAM,UAAU;gBAChB,KAAK,UAAU;YACjB;QACF;wBACA;IACF;AACF;AAEA,SAAS,gCAAU,QAAQ;IACzB,CAAA,GAAA,yCAAc,EAAE;QACd,OAAO,gBAAgB,CAAC,UAAU,UAAU;QAC5C,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU,UAAU;QACjD;IACF,GAAG;QAAC;KAAS;AACf;AAEA,SAAS,mCAAa,QAAQ,EAAE,SAAS;IACvC,IAAI,cAAc,OAChB,OAAO,SAAS,OAAO,CAAC,SAAS,SAAS,OAAO,CAAC,OAAO;IAE3D,OAAO,SAAS,OAAO,CAAC,SAAS,QAAQ,OAAO,CAAC,OAAO;AAC1D","sources":["packages/react-aria/src/overlays/useOverlayPosition.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {addEvent} from '../utils/domHelpers';\nimport {calculatePosition, getRect, PositionResult} from './calculatePosition';\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {getActiveElement, isFocusWithin} from '../utils/shadowdom/DOMFunctions';\nimport {getPropagationTargets} from '../utils/shadowdom/DOMFunctions';\nimport {useCallback, useEffect, useRef, useState} from 'react';\nimport {useCloseOnScroll} from './useCloseOnScroll';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocale} from '../i18n/I18nProvider';\nimport {useResizeObserver} from '../utils/useResizeObserver';\n\nexport type Placement =\n | 'bottom'\n | 'bottom left'\n | 'bottom right'\n | 'bottom start'\n | 'bottom end'\n | 'top'\n | 'top left'\n | 'top right'\n | 'top start'\n | 'top end'\n | 'left'\n | 'left top'\n | 'left bottom'\n | 'start'\n | 'start top'\n | 'start bottom'\n | 'right'\n | 'right top'\n | 'right bottom'\n | 'end'\n | 'end top'\n | 'end bottom';\n\nexport type Axis = 'top' | 'bottom' | 'left' | 'right';\nexport type SizeAxis = 'width' | 'height';\nexport type PlacementAxis = Axis | 'center';\n\nexport interface PositionProps {\n /**\n * The placement of the element with respect to its anchor element.\n *\n * @default 'bottom'\n */\n placement?: Placement;\n /**\n * The placement padding that should be applied between the element and its\n * surrounding container.\n *\n * @default 12\n */\n containerPadding?: number;\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n *\n * @default 0\n */\n offset?: number;\n /**\n * The additional offset applied along the cross axis between the element and its\n * anchor element.\n *\n * @default 0\n */\n crossOffset?: number;\n /**\n * Whether the element should flip its orientation (e.g. top to bottom or left to right) when\n * there is insufficient room for it to render completely.\n *\n * @default true\n */\n shouldFlip?: boolean;\n // /**\n // * The element that should be used as the bounding container when calculating container offset\n // * or whether it should flip.\n // */\n // boundaryElement?: Element,\n /** Whether the element is rendered. */\n isOpen?: boolean;\n}\n\nexport interface AriaPositionProps extends PositionProps {\n /**\n * Cross size of the overlay arrow in pixels.\n *\n * @default 0\n */\n arrowSize?: number;\n /**\n * Element that that serves as the positioning boundary.\n *\n * @default document.body\n */\n boundaryElement?: Element;\n /**\n * The ref for the element which the overlay positions itself with respect to.\n */\n targetRef: RefObject<Element | null>;\n /**\n * The ref for the overlay element.\n */\n overlayRef: RefObject<Element | null>;\n /**\n * The ref for the arrow element.\n */\n arrowRef?: RefObject<Element | null>;\n /**\n * A ref for the scrollable region within the overlay.\n *\n * @default overlayRef\n */\n scrollRef?: RefObject<Element | null>;\n /**\n * Whether the overlay should update its position automatically.\n *\n * @default true\n */\n shouldUpdatePosition?: boolean;\n /** Handler that is called when the overlay should close. */\n onClose?: (() => void) | null;\n /**\n * The maxHeight specified for the overlay element.\n * By default, it will take all space up to the current viewport height.\n */\n maxHeight?: number;\n /**\n * The minimum distance the arrow's edge should be from the edge of the overlay element.\n *\n * @default 0\n */\n arrowBoundaryOffset?: number;\n /**\n * Overrides the target element's bounding rectangle. Useful for positioning relative to\n * a specific point such as the mouse cursor (e.g. context menus) or text selection.\n *\n * @default target.getBoundingClientRect()\n * @param target - The target element.\n */\n getTargetRect?: (target: Element) => DOMRect | null | undefined;\n}\n\nexport interface PositionAria {\n /** Props for the overlay container element. */\n overlayProps: DOMAttributes;\n /** Props for the overlay tip arrow if any. */\n arrowProps: DOMAttributes;\n /** Placement of the overlay with respect to the overlay trigger. */\n placement: PlacementAxis | null;\n /** The origin of the target in the overlay's coordinate system. Useful for animations. */\n triggerAnchorPoint: {x: number; y: number} | null;\n /** Updates the position of the overlay. */\n updatePosition(): void;\n}\n\ninterface ScrollAnchor {\n type: 'top' | 'bottom';\n offset: number;\n}\n\nlet visualViewport = typeof document !== 'undefined' ? window.visualViewport : null;\n\n/**\n * Handles positioning overlays like popovers and menus relative to a trigger\n * element, and updating the position when the window resizes.\n */\nexport function useOverlayPosition(props: AriaPositionProps): PositionAria {\n let {direction} = useLocale();\n let {\n arrowSize,\n targetRef,\n overlayRef,\n arrowRef,\n scrollRef = overlayRef,\n placement = 'bottom' as Placement,\n containerPadding = 12,\n shouldFlip = true,\n boundaryElement = typeof document !== 'undefined' ? document.body : null,\n offset = 0,\n crossOffset = 0,\n shouldUpdatePosition = true,\n isOpen = true,\n onClose,\n maxHeight,\n arrowBoundaryOffset = 0,\n getTargetRect\n } = props;\n let [position, setPosition] = useState<PositionResult | null>(null);\n\n let deps = [\n shouldUpdatePosition,\n placement,\n // oxlint-disable-next-line react/react-compiler\n overlayRef.current,\n // oxlint-disable-next-line react/react-compiler\n targetRef.current,\n // oxlint-disable-next-line react/react-compiler\n arrowRef?.current,\n // oxlint-disable-next-line react/react-compiler\n scrollRef.current,\n containerPadding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n isOpen,\n direction,\n maxHeight,\n arrowBoundaryOffset,\n arrowSize\n ];\n\n // Note, the position freezing breaks if body sizes itself dynamicly with the visual viewport but that might\n // just be a non-realistic use case\n // Upon opening a overlay, record the current visual viewport scale so we can freeze the overlay styles\n let lastScale = useRef(visualViewport?.scale);\n useEffect(() => {\n if (isOpen) {\n lastScale.current = visualViewport?.scale;\n }\n }, [isOpen]);\n\n let updatePosition = useCallback(() => {\n if (\n shouldUpdatePosition === false ||\n !isOpen ||\n !overlayRef.current ||\n !targetRef.current ||\n !boundaryElement\n ) {\n return;\n }\n\n if (visualViewport?.scale !== lastScale.current) {\n return;\n }\n\n // Determine a scroll anchor based on the focused element.\n // This stores the offset of the anchor element from the scroll container\n // so it can be restored after repositioning. This way if the overlay height\n // changes, the focused element appears to stay in the same position.\n let anchor: ScrollAnchor | null = null;\n if (scrollRef.current && isFocusWithin(scrollRef.current)) {\n let anchorRect = getActiveElement()?.getBoundingClientRect();\n let scrollRect = scrollRef.current.getBoundingClientRect();\n // Anchor from the top if the offset is in the top half of the scrollable element,\n // otherwise anchor from the bottom.\n anchor = {\n type: 'top',\n offset: (anchorRect?.top ?? 0) - scrollRect.top\n };\n if (anchor.offset > scrollRect.height / 2) {\n anchor.type = 'bottom';\n anchor.offset = (anchorRect?.bottom ?? 0) - scrollRect.bottom;\n }\n }\n\n // Always reset the overlay's previous max height if not defined by the user so that we can compensate for\n // RAC collections populating after a second render and properly set a correct max height + positioning when it populates.\n let overlay = overlayRef.current as HTMLElement;\n if (!maxHeight && overlayRef.current) {\n overlay.style.top = '0px';\n overlay.style.bottom = '';\n overlay.style.maxHeight = (window.visualViewport?.height ?? window.innerHeight) + 'px';\n }\n\n let position = calculatePosition({\n placement: translateRTL(placement, direction),\n overlayNode: overlayRef.current,\n targetNode: targetRef.current,\n scrollNode: scrollRef.current || overlayRef.current,\n padding: containerPadding,\n shouldFlip,\n boundaryElement,\n offset,\n crossOffset,\n maxHeight,\n arrowSize: arrowSize ?? (arrowRef?.current ? getRect(arrowRef.current, true).width : 0),\n arrowBoundaryOffset,\n targetRect: getTargetRect?.(targetRef.current)\n });\n\n if (!position.position) {\n return;\n }\n\n // Modify overlay styles directly so positioning happens immediately without the need of a second render\n // This is so we don't have to delay autoFocus scrolling or delay applying preventScroll for popovers\n overlay.style.top = '';\n overlay.style.bottom = '';\n overlay.style.left = '';\n overlay.style.right = '';\n\n Object.keys(position.position).forEach(\n key => (overlay.style[key] = position.position![key] + 'px')\n );\n overlay.style.maxHeight = position.maxHeight != null ? position.maxHeight + 'px' : '';\n\n // Restore scroll position relative to anchor element.\n let activeElement = getActiveElement();\n if (anchor && activeElement && scrollRef.current) {\n let anchorRect = activeElement.getBoundingClientRect();\n let scrollRect = scrollRef.current.getBoundingClientRect();\n let newOffset = anchorRect[anchor.type] - scrollRect[anchor.type];\n scrollRef.current.scrollTop += newOffset - anchor.offset;\n }\n\n // Trigger a set state for a second render anyway for arrow positioning\n setPosition(position);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n // oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps\n }, deps);\n\n // Update position when anything changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n // oxlint-disable-next-line react/react-compiler, react-hooks/exhaustive-deps\n useLayoutEffect(updatePosition, deps);\n\n // Update position on window resize\n useResize(updatePosition);\n\n // Update position when the overlay changes size (might need to flip).\n useResizeObserver({\n ref: overlayRef,\n onResize: updatePosition\n });\n\n // Update position when the target changes size (might need to flip).\n useResizeObserver({\n ref: targetRef,\n onResize: updatePosition\n });\n\n // Reposition the overlay and do not close on scroll while the visual viewport is resizing.\n // This will ensure that overlays adjust their positioning when the iOS virtual keyboard appears.\n let isResizing = useRef(false);\n useLayoutEffect(() => {\n let timeout: ReturnType<typeof setTimeout>;\n let onResize = () => {\n isResizing.current = true;\n clearTimeout(timeout);\n\n timeout = setTimeout(() => {\n isResizing.current = false;\n }, 500);\n\n updatePosition();\n };\n\n // Only reposition the overlay if a scroll event happens immediately as a result of resize (aka the virtual keyboard has appears)\n // We don't want to reposition the overlay if the user has pinch zoomed in and is scrolling the viewport around.\n let onScroll = () => {\n if (isResizing.current) {\n onResize();\n }\n };\n\n visualViewport?.addEventListener('resize', onResize);\n visualViewport?.addEventListener('scroll', onScroll);\n let cleanup = addEvent(\n // @ts-expect-error\n getPropagationTargets(window),\n 'scroll',\n onScroll\n );\n return () => {\n visualViewport?.removeEventListener('resize', onResize);\n visualViewport?.removeEventListener('scroll', onScroll);\n cleanup();\n };\n }, [updatePosition]);\n\n let close = useCallback(() => {\n if (!isResizing.current) {\n onClose?.();\n }\n }, [onClose, isResizing]);\n\n // When scrolling a parent scrollable region of the trigger (other than the body),\n // we hide the popover. Otherwise, its position would be incorrect.\n useCloseOnScroll({\n triggerRef: targetRef,\n isOpen,\n onClose: onClose && close\n });\n\n return {\n overlayProps: {\n style: {\n position: position ? 'absolute' : 'fixed',\n top: !position ? 0 : undefined,\n left: !position ? 0 : undefined,\n zIndex: 100000, // should match the z-index in ModalTrigger\n ...position?.position,\n maxHeight: position?.maxHeight ?? '100vh'\n }\n },\n placement: position?.placement ?? null,\n triggerAnchorPoint: position?.triggerAnchorPoint ?? null,\n arrowProps: {\n 'aria-hidden': 'true',\n role: 'presentation',\n style: {\n left: position?.arrowOffsetLeft,\n top: position?.arrowOffsetTop\n }\n },\n updatePosition\n };\n}\n\nfunction useResize(onResize) {\n useLayoutEffect(() => {\n window.addEventListener('resize', onResize, false);\n return () => {\n window.removeEventListener('resize', onResize, false);\n };\n }, [onResize]);\n}\n\nfunction translateRTL(position, direction) {\n if (direction === 'rtl') {\n return position.replace('start', 'right').replace('end', 'left');\n }\n return position.replace('start', 'left').replace('end', 'right');\n}\n"],"names":[],"version":3,"file":"useOverlayPosition.mjs.map"}
@@ -1,5 +1,6 @@
1
1
  var $3c73045d61be2d91$exports = require("./ariaHideOutside.cjs");
2
2
  var $9b27591aafdd7244$exports = require("./useOverlayPosition.cjs");
3
+ var $b4f85e31b7b8044c$exports = require("../interactions/useFocusWithin.cjs");
3
4
  var $89b39774f3b79dbb$exports = require("../utils/mergeProps.cjs");
4
5
  var $79bdf1333d17b238$exports = require("./useOverlay.cjs");
5
6
  var $b5daf4744c764686$exports = require("./usePreventScroll.cjs");
@@ -27,6 +28,7 @@ $parcel$export(module.exports, "usePopover", function () { return $55bfcc8b5195f
27
28
 
28
29
 
29
30
 
31
+
30
32
  function $55bfcc8b5195fb51$export$542a6fd13ac93354(props, state) {
31
33
  let { triggerRef: triggerRef, popoverRef: popoverRef, groupRef: groupRef, isNonModal: isNonModal, isKeyboardDismissDisabled: isKeyboardDismissDisabled, shouldCloseOnInteractOutside: shouldCloseOnInteractOutside, ...otherProps } = props;
32
34
  let isSubmenu = otherProps['trigger'] === 'SubmenuTrigger';
@@ -43,7 +45,8 @@ function $55bfcc8b5195fb51$export$542a6fd13ac93354(props, state) {
43
45
  targetRef: triggerRef,
44
46
  overlayRef: popoverRef,
45
47
  isOpen: state.isOpen,
46
- onClose: isNonModal && !isSubmenu ? state.close : null
48
+ onClose: isNonModal && !isSubmenu ? state.close : null,
49
+ getTargetRect: otherProps.getTargetRect ?? (state.point ? ()=>new DOMRect(state.point.x, state.point.y, 0, 0) : undefined)
47
50
  });
48
51
  (0, $b5daf4744c764686$exports.usePreventScroll)({
49
52
  isDisabled: isNonModal || !state.isOpen
@@ -63,8 +66,9 @@ function $55bfcc8b5195fb51$export$542a6fd13ac93354(props, state) {
63
66
  popoverRef,
64
67
  groupRef
65
68
  ]);
69
+ let { focusWithinProps: focusWithinProps } = (0, $b4f85e31b7b8044c$exports.useFocusWithin)(props);
66
70
  return {
67
- popoverProps: (0, $89b39774f3b79dbb$exports.mergeProps)(overlayProps, positionProps),
71
+ popoverProps: (0, $89b39774f3b79dbb$exports.mergeProps)(overlayProps, positionProps, focusWithinProps),
68
72
  arrowProps: arrowProps,
69
73
  underlayProps: underlayProps,
70
74
  placement: placement,
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AA2EM,SAAS,0CAAW,KAAuB,EAAE,KAA0B;IAC5E,IAAI,cACF,UAAU,cACV,UAAU,YACV,QAAQ,cACR,UAAU,6BACV,yBAAyB,gCACzB,4BAA4B,EAC5B,GAAG,YACJ,GAAG;IAEJ,IAAI,YAAY,UAAU,CAAC,UAAU,KAAK;IAE1C,IAAI,gBAAC,YAAY,iBAAE,aAAa,EAAC,GAAG,CAAA,GAAA,oCAAS,EAC3C;QACE,QAAQ,MAAM,MAAM;QACpB,SAAS,MAAM,KAAK;QACpB,mBAAmB;QACnB,eAAe,CAAC,cAAc;mCAC9B;sCACA;IACF,GACA,YAAY;IAGd,IAAI,EACF,cAAc,aAAa,cAC3B,UAAU,aACV,SAAS,EACT,oBAAoB,MAAM,EAC3B,GAAG,CAAA,GAAA,4CAAiB,EAAE;QACrB,GAAG,UAAU;QACb,WAAW;QACX,YAAY;QACZ,QAAQ,MAAM,MAAM;QACpB,SAAS,cAAc,CAAC,YAAY,MAAM,KAAK,GAAG;IACpD;IAEA,CAAA,GAAA,0CAAe,EAAE;QACf,YAAY,cAAc,CAAC,MAAM,MAAM;IACzC;IAEA,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,MAAM,MAAM,IAAI,WAAW,OAAO,EAAE;YACtC,IAAI,YACF,OAAO,CAAA,GAAA,qCAAU,EAAE,UAAU,WAAW,WAAW,OAAO;iBAE1D,OAAO,CAAA,GAAA,yCAAc,EAAE;gBAAC,UAAU,WAAW,WAAW,OAAO;aAAC,EAAE;gBAAC,gBAAgB;YAAI;QAE3F;IACF,GAAG;QAAC;QAAY,MAAM,MAAM;QAAE;QAAY;KAAS;IAEnD,OAAO;QACL,cAAc,CAAA,GAAA,oCAAS,EAAE,cAAc;oBACvC;uBACA;mBACA;QACA,oBAAoB;IACtB;AACF","sources":["packages/react-aria/src/overlays/usePopover.ts"],"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 {ariaHideOutside, keepVisible} from './ariaHideOutside';\nimport {AriaPositionProps, PlacementAxis, useOverlayPosition} from './useOverlayPosition';\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {mergeProps} from '../utils/mergeProps';\nimport {OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {useEffect} from 'react';\nimport {useOverlay} from './useOverlay';\nimport {usePreventScroll} from './usePreventScroll';\n\nexport interface AriaPopoverProps extends Omit<\n AriaPositionProps,\n 'isOpen' | 'onClose' | 'targetRef' | 'overlayRef'\n> {\n /**\n * The ref for the element which the popover positions itself with respect to.\n */\n triggerRef: RefObject<Element | null>;\n /**\n * The ref for the popover element.\n */\n popoverRef: RefObject<Element | null>;\n /** A ref for the popover arrow element. */\n arrowRef?: RefObject<Element | null>;\n /**\n * An optional ref for a group of popovers, e.g. submenus.\n * When provided, this element is used to detect outside interactions\n * and hiding elements from assistive technologies instead of the popoverRef.\n */\n groupRef?: RefObject<Element | null>;\n /**\n * Whether the popover is non-modal, i.e. elements outside the popover may be\n * interacted with by assistive technologies.\n *\n * Most popovers should not use this option as it may negatively impact the screen\n * reader experience. Only use with components such as combobox, which are designed\n * to handle this situation carefully.\n */\n isNonModal?: boolean;\n /**\n * Whether pressing the escape key to close the popover should be disabled.\n *\n * Most popovers should not use this option. When set to true, an alternative\n * way to close the popover with a keyboard must be provided.\n *\n * @default false\n */\n isKeyboardDismissDisabled?: boolean;\n /**\n * When user interacts with the argument element outside of the popover ref,\n * return true if onClose should be called. This gives you a chance to filter\n * out interaction with elements that should not dismiss the popover.\n * By default, onClose will always be called on interaction outside the popover ref.\n */\n shouldCloseOnInteractOutside?: (element: Element) => boolean;\n}\n\nexport interface PopoverAria {\n /** Props for the popover element. */\n popoverProps: DOMAttributes;\n /** Props for the popover tip arrow if any. */\n arrowProps: DOMAttributes;\n /** Props to apply to the underlay element, if any. */\n underlayProps: DOMAttributes;\n /** Placement of the popover with respect to the trigger. */\n placement: PlacementAxis | null;\n /** The origin of the target in the overlay's coordinate system. Useful for animations. */\n triggerAnchorPoint: {x: number; y: number} | null;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a popover component.\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport function usePopover(props: AriaPopoverProps, state: OverlayTriggerState): PopoverAria {\n let {\n triggerRef,\n popoverRef,\n groupRef,\n isNonModal,\n isKeyboardDismissDisabled,\n shouldCloseOnInteractOutside,\n ...otherProps\n } = props;\n\n let isSubmenu = otherProps['trigger'] === 'SubmenuTrigger';\n\n let {overlayProps, underlayProps} = useOverlay(\n {\n isOpen: state.isOpen,\n onClose: state.close,\n shouldCloseOnBlur: true,\n isDismissable: !isNonModal || isSubmenu,\n isKeyboardDismissDisabled,\n shouldCloseOnInteractOutside\n },\n groupRef ?? popoverRef\n );\n\n let {\n overlayProps: positionProps,\n arrowProps,\n placement,\n triggerAnchorPoint: origin\n } = useOverlayPosition({\n ...otherProps,\n targetRef: triggerRef,\n overlayRef: popoverRef,\n isOpen: state.isOpen,\n onClose: isNonModal && !isSubmenu ? state.close : null\n });\n\n usePreventScroll({\n isDisabled: isNonModal || !state.isOpen\n });\n\n useEffect(() => {\n if (state.isOpen && popoverRef.current) {\n if (isNonModal) {\n return keepVisible(groupRef?.current ?? popoverRef.current);\n } else {\n return ariaHideOutside([groupRef?.current ?? popoverRef.current], {shouldUseInert: true});\n }\n }\n }, [isNonModal, state.isOpen, popoverRef, groupRef]);\n\n return {\n popoverProps: mergeProps(overlayProps, positionProps),\n arrowProps,\n underlayProps,\n placement,\n triggerAnchorPoint: origin\n };\n}\n"],"names":[],"version":3,"file":"usePopover.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA4EM,SAAS,0CAAW,KAAuB,EAAE,KAA0B;IAC5E,IAAI,cACF,UAAU,cACV,UAAU,YACV,QAAQ,cACR,UAAU,6BACV,yBAAyB,gCACzB,4BAA4B,EAC5B,GAAG,YACJ,GAAG;IAEJ,IAAI,YAAY,UAAU,CAAC,UAAU,KAAK;IAE1C,IAAI,gBAAC,YAAY,iBAAE,aAAa,EAAC,GAAG,CAAA,GAAA,oCAAS,EAC3C;QACE,QAAQ,MAAM,MAAM;QACpB,SAAS,MAAM,KAAK;QACpB,mBAAmB;QACnB,eAAe,CAAC,cAAc;mCAC9B;sCACA;IACF,GACA,YAAY;IAGd,IAAI,EACF,cAAc,aAAa,cAC3B,UAAU,aACV,SAAS,EACT,oBAAoB,MAAM,EAC3B,GAAG,CAAA,GAAA,4CAAiB,EAAE;QACrB,GAAG,UAAU;QACb,WAAW;QACX,YAAY;QACZ,QAAQ,MAAM,MAAM;QACpB,SAAS,cAAc,CAAC,YAAY,MAAM,KAAK,GAAG;QAClD,eACE,WAAW,aAAa,IACvB,CAAA,MAAM,KAAK,GAAG,IAAM,IAAI,QAAQ,MAAM,KAAK,CAAE,CAAC,EAAE,MAAM,KAAK,CAAE,CAAC,EAAE,GAAG,KAAK,SAAQ;IACrF;IAEA,CAAA,GAAA,0CAAe,EAAE;QACf,YAAY,cAAc,CAAC,MAAM,MAAM;IACzC;IAEA,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,MAAM,MAAM,IAAI,WAAW,OAAO,EAAE;YACtC,IAAI,YACF,OAAO,CAAA,GAAA,qCAAU,EAAE,UAAU,WAAW,WAAW,OAAO;iBAE1D,OAAO,CAAA,GAAA,yCAAc,EAAE;gBAAC,UAAU,WAAW,WAAW,OAAO;aAAC,EAAE;gBAAC,gBAAgB;YAAI;QAE3F;IACF,GAAG;QAAC;QAAY,MAAM,MAAM;QAAE;QAAY;KAAS;IAEnD,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,wCAAa,EAAE;IAExC,OAAO;QACL,cAAc,CAAA,GAAA,oCAAS,EAAE,cAAc,eAAe;oBACtD;uBACA;mBACA;QACA,oBAAoB;IACtB;AACF","sources":["packages/react-aria/src/overlays/usePopover.ts"],"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 {ariaHideOutside, keepVisible} from './ariaHideOutside';\nimport {AriaPositionProps, PlacementAxis, useOverlayPosition} from './useOverlayPosition';\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {FocusWithinProps, useFocusWithin} from '../interactions/useFocusWithin';\nimport {mergeProps} from '../utils/mergeProps';\nimport {OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {useEffect} from 'react';\nimport {useOverlay} from './useOverlay';\nimport {usePreventScroll} from './usePreventScroll';\n\nexport interface AriaPopoverProps\n extends\n Omit<AriaPositionProps, 'isOpen' | 'onClose' | 'targetRef' | 'overlayRef'>,\n Omit<FocusWithinProps, 'isDisabled'> {\n /**\n * The ref for the element which the popover positions itself with respect to.\n */\n triggerRef: RefObject<Element | null>;\n /**\n * The ref for the popover element.\n */\n popoverRef: RefObject<Element | null>;\n /** A ref for the popover arrow element. */\n arrowRef?: RefObject<Element | null>;\n /**\n * An optional ref for a group of popovers, e.g. submenus.\n * When provided, this element is used to detect outside interactions\n * and hiding elements from assistive technologies instead of the popoverRef.\n */\n groupRef?: RefObject<Element | null>;\n /**\n * Whether the popover is non-modal, i.e. elements outside the popover may be\n * interacted with by assistive technologies.\n *\n * Most popovers should not use this option as it may negatively impact the screen\n * reader experience. Only use with components such as combobox, which are designed\n * to handle this situation carefully.\n */\n isNonModal?: boolean;\n /**\n * Whether pressing the escape key to close the popover should be disabled.\n *\n * Most popovers should not use this option. When set to true, an alternative\n * way to close the popover with a keyboard must be provided.\n *\n * @default false\n */\n isKeyboardDismissDisabled?: boolean;\n /**\n * When user interacts with the argument element outside of the popover ref,\n * return true if onClose should be called. This gives you a chance to filter\n * out interaction with elements that should not dismiss the popover.\n * By default, onClose will always be called on interaction outside the popover ref.\n */\n shouldCloseOnInteractOutside?: (element: Element) => boolean;\n}\n\nexport interface PopoverAria {\n /** Props for the popover element. */\n popoverProps: DOMAttributes;\n /** Props for the popover tip arrow if any. */\n arrowProps: DOMAttributes;\n /** Props to apply to the underlay element, if any. */\n underlayProps: DOMAttributes;\n /** Placement of the popover with respect to the trigger. */\n placement: PlacementAxis | null;\n /** The origin of the target in the overlay's coordinate system. Useful for animations. */\n triggerAnchorPoint: {x: number; y: number} | null;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a popover component.\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport function usePopover(props: AriaPopoverProps, state: OverlayTriggerState): PopoverAria {\n let {\n triggerRef,\n popoverRef,\n groupRef,\n isNonModal,\n isKeyboardDismissDisabled,\n shouldCloseOnInteractOutside,\n ...otherProps\n } = props;\n\n let isSubmenu = otherProps['trigger'] === 'SubmenuTrigger';\n\n let {overlayProps, underlayProps} = useOverlay(\n {\n isOpen: state.isOpen,\n onClose: state.close,\n shouldCloseOnBlur: true,\n isDismissable: !isNonModal || isSubmenu,\n isKeyboardDismissDisabled,\n shouldCloseOnInteractOutside\n },\n groupRef ?? popoverRef\n );\n\n let {\n overlayProps: positionProps,\n arrowProps,\n placement,\n triggerAnchorPoint: origin\n } = useOverlayPosition({\n ...otherProps,\n targetRef: triggerRef,\n overlayRef: popoverRef,\n isOpen: state.isOpen,\n onClose: isNonModal && !isSubmenu ? state.close : null,\n getTargetRect:\n otherProps.getTargetRect ??\n (state.point ? () => new DOMRect(state.point!.x, state.point!.y, 0, 0) : undefined)\n });\n\n usePreventScroll({\n isDisabled: isNonModal || !state.isOpen\n });\n\n useEffect(() => {\n if (state.isOpen && popoverRef.current) {\n if (isNonModal) {\n return keepVisible(groupRef?.current ?? popoverRef.current);\n } else {\n return ariaHideOutside([groupRef?.current ?? popoverRef.current], {shouldUseInert: true});\n }\n }\n }, [isNonModal, state.isOpen, popoverRef, groupRef]);\n\n let {focusWithinProps} = useFocusWithin(props);\n\n return {\n popoverProps: mergeProps(overlayProps, positionProps, focusWithinProps),\n arrowProps,\n underlayProps,\n placement,\n triggerAnchorPoint: origin\n };\n}\n"],"names":[],"version":3,"file":"usePopover.cjs.map"}
@@ -1,5 +1,6 @@
1
1
  import {ariaHideOutside as $20aa6983aa303ce6$export$1c3ebcada18427bf, keepVisible as $20aa6983aa303ce6$export$1020fa7f77e17884} from "./ariaHideOutside.js";
2
2
  import {useOverlayPosition as $e55325afa7851309$export$d39e1813b3bdd0e1} from "./useOverlayPosition.js";
3
+ import {useFocusWithin as $b842b95ed9b5d4d5$export$420e68273165f4ec} from "../interactions/useFocusWithin.js";
3
4
  import {mergeProps as $64c36edd757dfa16$export$9d1611c77c2fe928} from "../utils/mergeProps.js";
4
5
  import {useOverlay as $1a051e369e68734b$export$ea8f71083e90600f} from "./useOverlay.js";
5
6
  import {usePreventScroll as $100c50c02aceaf6e$export$ee0f7cc6afcd1c18} from "./usePreventScroll.js";
@@ -21,6 +22,7 @@ import {useEffect as $6dR5U$useEffect} from "react";
21
22
 
22
23
 
23
24
 
25
+
24
26
  function $c238dca4a8f34a03$export$542a6fd13ac93354(props, state) {
25
27
  let { triggerRef: triggerRef, popoverRef: popoverRef, groupRef: groupRef, isNonModal: isNonModal, isKeyboardDismissDisabled: isKeyboardDismissDisabled, shouldCloseOnInteractOutside: shouldCloseOnInteractOutside, ...otherProps } = props;
26
28
  let isSubmenu = otherProps['trigger'] === 'SubmenuTrigger';
@@ -32,12 +34,14 @@ function $c238dca4a8f34a03$export$542a6fd13ac93354(props, state) {
32
34
  isKeyboardDismissDisabled: isKeyboardDismissDisabled,
33
35
  shouldCloseOnInteractOutside: shouldCloseOnInteractOutside
34
36
  }, groupRef !== null && groupRef !== void 0 ? groupRef : popoverRef);
37
+ var _otherProps_getTargetRect;
35
38
  let { overlayProps: positionProps, arrowProps: arrowProps, placement: placement, triggerAnchorPoint: origin } = (0, $e55325afa7851309$export$d39e1813b3bdd0e1)({
36
39
  ...otherProps,
37
40
  targetRef: triggerRef,
38
41
  overlayRef: popoverRef,
39
42
  isOpen: state.isOpen,
40
- onClose: isNonModal && !isSubmenu ? state.close : null
43
+ onClose: isNonModal && !isSubmenu ? state.close : null,
44
+ getTargetRect: (_otherProps_getTargetRect = otherProps.getTargetRect) !== null && _otherProps_getTargetRect !== void 0 ? _otherProps_getTargetRect : state.point ? ()=>new DOMRect(state.point.x, state.point.y, 0, 0) : undefined
41
45
  });
42
46
  (0, $100c50c02aceaf6e$export$ee0f7cc6afcd1c18)({
43
47
  isDisabled: isNonModal || !state.isOpen
@@ -58,8 +62,9 @@ function $c238dca4a8f34a03$export$542a6fd13ac93354(props, state) {
58
62
  popoverRef,
59
63
  groupRef
60
64
  ]);
65
+ let { focusWithinProps: focusWithinProps } = (0, $b842b95ed9b5d4d5$export$420e68273165f4ec)(props);
61
66
  return {
62
- popoverProps: (0, $64c36edd757dfa16$export$9d1611c77c2fe928)(overlayProps, positionProps),
67
+ popoverProps: (0, $64c36edd757dfa16$export$9d1611c77c2fe928)(overlayProps, positionProps, focusWithinProps),
63
68
  arrowProps: arrowProps,
64
69
  underlayProps: underlayProps,
65
70
  placement: placement,