react-aria 3.48.0 → 3.50.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 (1248) hide show
  1. package/dist/exports/CollectionBuilder.cjs.map +1 -1
  2. package/dist/exports/CollectionBuilder.js.map +1 -1
  3. package/dist/exports/CollectionBuilder.mjs.map +1 -1
  4. package/dist/exports/index.cjs +12 -0
  5. package/dist/exports/index.cjs.map +1 -1
  6. package/dist/exports/index.js +9 -1
  7. package/dist/exports/index.js.map +1 -1
  8. package/dist/exports/index.mjs +9 -1
  9. package/dist/exports/index.mjs.map +1 -1
  10. package/dist/exports/private/actiongroup/useActionGroup.cjs.map +1 -1
  11. package/dist/exports/private/actiongroup/useActionGroup.js.map +1 -1
  12. package/dist/exports/private/actiongroup/useActionGroup.mjs.map +1 -1
  13. package/dist/exports/private/actiongroup/useActionGroupItem.cjs.map +1 -1
  14. package/dist/exports/private/actiongroup/useActionGroupItem.js.map +1 -1
  15. package/dist/exports/private/actiongroup/useActionGroupItem.mjs.map +1 -1
  16. package/dist/exports/private/autocomplete/useSearchAutocomplete.cjs.map +1 -1
  17. package/dist/exports/private/autocomplete/useSearchAutocomplete.js.map +1 -1
  18. package/dist/exports/private/autocomplete/useSearchAutocomplete.mjs.map +1 -1
  19. package/dist/exports/private/collections/BaseCollection.cjs.map +1 -1
  20. package/dist/exports/private/collections/BaseCollection.js.map +1 -1
  21. package/dist/exports/private/collections/BaseCollection.mjs.map +1 -1
  22. package/dist/exports/private/collections/useCachedChildren.cjs.map +1 -1
  23. package/dist/exports/private/collections/useCachedChildren.js.map +1 -1
  24. package/dist/exports/private/collections/useCachedChildren.mjs.map +1 -1
  25. package/dist/exports/private/focus/FocusScope.cjs.map +1 -1
  26. package/dist/exports/private/focus/FocusScope.js.map +1 -1
  27. package/dist/exports/private/focus/FocusScope.mjs.map +1 -1
  28. package/dist/exports/private/focus/virtualFocus.cjs.map +1 -1
  29. package/dist/exports/private/focus/virtualFocus.js.map +1 -1
  30. package/dist/exports/private/focus/virtualFocus.mjs.map +1 -1
  31. package/dist/exports/private/grid/GridKeyboardDelegate.cjs.map +1 -1
  32. package/dist/exports/private/grid/GridKeyboardDelegate.js.map +1 -1
  33. package/dist/exports/private/grid/GridKeyboardDelegate.mjs.map +1 -1
  34. package/dist/exports/private/grid/useGridSelectionAnnouncement.cjs.map +1 -1
  35. package/dist/exports/private/grid/useGridSelectionAnnouncement.js.map +1 -1
  36. package/dist/exports/private/grid/useGridSelectionAnnouncement.mjs.map +1 -1
  37. package/dist/exports/private/grid/useGridSelectionCheckbox.cjs.map +1 -1
  38. package/dist/exports/private/grid/useGridSelectionCheckbox.js.map +1 -1
  39. package/dist/exports/private/grid/useGridSelectionCheckbox.mjs.map +1 -1
  40. package/dist/exports/private/grid/useHighlightSelectionDescription.cjs.map +1 -1
  41. package/dist/exports/private/grid/useHighlightSelectionDescription.js.map +1 -1
  42. package/dist/exports/private/grid/useHighlightSelectionDescription.mjs.map +1 -1
  43. package/dist/exports/private/interactions/useFocusVisible.cjs.map +1 -1
  44. package/dist/exports/private/interactions/useFocusVisible.js.map +1 -1
  45. package/dist/exports/private/interactions/useFocusVisible.mjs.map +1 -1
  46. package/dist/exports/private/interactions/useFocusable.cjs.map +1 -1
  47. package/dist/exports/private/interactions/useFocusable.js.map +1 -1
  48. package/dist/exports/private/interactions/useFocusable.mjs.map +1 -1
  49. package/dist/exports/private/landmark/useLandmark.cjs.map +1 -1
  50. package/dist/exports/private/landmark/useLandmark.js.map +1 -1
  51. package/dist/exports/private/landmark/useLandmark.mjs.map +1 -1
  52. package/dist/exports/private/live-announcer/LiveAnnouncer.cjs.map +1 -1
  53. package/dist/exports/private/live-announcer/LiveAnnouncer.js.map +1 -1
  54. package/dist/exports/private/live-announcer/LiveAnnouncer.mjs.map +1 -1
  55. package/dist/exports/private/overlays/useModal.cjs.map +1 -1
  56. package/dist/exports/private/overlays/useModal.js.map +1 -1
  57. package/dist/exports/private/overlays/useModal.mjs.map +1 -1
  58. package/dist/exports/private/selection/useSelectableCollection.cjs.map +1 -1
  59. package/dist/exports/private/selection/useSelectableCollection.js.map +1 -1
  60. package/dist/exports/private/selection/useSelectableCollection.mjs.map +1 -1
  61. package/dist/exports/private/selection/useSelectableItem.cjs.map +1 -1
  62. package/dist/exports/private/selection/useSelectableItem.js.map +1 -1
  63. package/dist/exports/private/selection/useSelectableItem.mjs.map +1 -1
  64. package/dist/exports/private/selection/useSelectableList.cjs.map +1 -1
  65. package/dist/exports/private/selection/useSelectableList.js.map +1 -1
  66. package/dist/exports/private/selection/useSelectableList.mjs.map +1 -1
  67. package/dist/exports/private/selection/useTypeSelect.cjs.map +1 -1
  68. package/dist/exports/private/selection/useTypeSelect.js.map +1 -1
  69. package/dist/exports/private/selection/useTypeSelect.mjs.map +1 -1
  70. package/dist/exports/private/spinbutton/useSpinButton.cjs.map +1 -1
  71. package/dist/exports/private/spinbutton/useSpinButton.js.map +1 -1
  72. package/dist/exports/private/spinbutton/useSpinButton.mjs.map +1 -1
  73. package/dist/exports/private/steplist/useStepList.cjs.map +1 -1
  74. package/dist/exports/private/steplist/useStepList.js.map +1 -1
  75. package/dist/exports/private/steplist/useStepList.mjs.map +1 -1
  76. package/dist/exports/private/steplist/useStepListItem.cjs.map +1 -1
  77. package/dist/exports/private/steplist/useStepListItem.js.map +1 -1
  78. package/dist/exports/private/steplist/useStepListItem.mjs.map +1 -1
  79. package/dist/exports/private/utils/openLink.cjs.map +1 -1
  80. package/dist/exports/private/utils/openLink.js.map +1 -1
  81. package/dist/exports/private/utils/openLink.mjs.map +1 -1
  82. package/dist/exports/private/utils/platform.cjs.map +1 -1
  83. package/dist/exports/private/utils/platform.js.map +1 -1
  84. package/dist/exports/private/utils/platform.mjs.map +1 -1
  85. package/dist/exports/private/utils/shadowdom/DOMFunctions.cjs.map +1 -1
  86. package/dist/exports/private/utils/shadowdom/DOMFunctions.js.map +1 -1
  87. package/dist/exports/private/utils/shadowdom/DOMFunctions.mjs.map +1 -1
  88. package/dist/exports/private/utils/shadowdom/ShadowTreeWalker.cjs.map +1 -1
  89. package/dist/exports/private/utils/shadowdom/ShadowTreeWalker.js.map +1 -1
  90. package/dist/exports/private/utils/shadowdom/ShadowTreeWalker.mjs.map +1 -1
  91. package/dist/exports/private/utils/useLoadMoreSentinel.cjs.map +1 -1
  92. package/dist/exports/private/utils/useLoadMoreSentinel.js.map +1 -1
  93. package/dist/exports/private/utils/useLoadMoreSentinel.mjs.map +1 -1
  94. package/dist/exports/private/virtualizer/useVirtualizerItem.cjs.map +1 -1
  95. package/dist/exports/private/virtualizer/useVirtualizerItem.js.map +1 -1
  96. package/dist/exports/private/virtualizer/useVirtualizerItem.mjs.map +1 -1
  97. package/dist/exports/private/virtualizer/utils.cjs.map +1 -1
  98. package/dist/exports/private/virtualizer/utils.js.map +1 -1
  99. package/dist/exports/private/virtualizer/utils.mjs.map +1 -1
  100. package/dist/exports/useAutocomplete.cjs.map +1 -1
  101. package/dist/exports/useAutocomplete.js.map +1 -1
  102. package/dist/exports/useAutocomplete.mjs.map +1 -1
  103. package/dist/exports/useBreadcrumbs.cjs.map +1 -1
  104. package/dist/exports/useBreadcrumbs.js.map +1 -1
  105. package/dist/exports/useBreadcrumbs.mjs.map +1 -1
  106. package/dist/exports/useButton.cjs.map +1 -1
  107. package/dist/exports/useButton.js.map +1 -1
  108. package/dist/exports/useButton.mjs.map +1 -1
  109. package/dist/exports/useCalendar.cjs +9 -0
  110. package/dist/exports/useCalendar.cjs.map +1 -1
  111. package/dist/exports/useCalendar.js +7 -1
  112. package/dist/exports/useCalendar.js.map +1 -1
  113. package/dist/exports/useCalendar.mjs +7 -1
  114. package/dist/exports/useCalendar.mjs.map +1 -1
  115. package/dist/exports/useClipboard.cjs.map +1 -1
  116. package/dist/exports/useClipboard.js.map +1 -1
  117. package/dist/exports/useClipboard.mjs.map +1 -1
  118. package/dist/exports/useColorArea.cjs.map +1 -1
  119. package/dist/exports/useColorArea.js.map +1 -1
  120. package/dist/exports/useColorArea.mjs.map +1 -1
  121. package/dist/exports/useColorField.cjs.map +1 -1
  122. package/dist/exports/useColorField.js.map +1 -1
  123. package/dist/exports/useColorField.mjs.map +1 -1
  124. package/dist/exports/useColorSlider.cjs.map +1 -1
  125. package/dist/exports/useColorSlider.js.map +1 -1
  126. package/dist/exports/useColorSlider.mjs.map +1 -1
  127. package/dist/exports/useColorWheel.cjs.map +1 -1
  128. package/dist/exports/useColorWheel.js.map +1 -1
  129. package/dist/exports/useColorWheel.mjs.map +1 -1
  130. package/dist/exports/useComboBox.cjs.map +1 -1
  131. package/dist/exports/useComboBox.js.map +1 -1
  132. package/dist/exports/useComboBox.mjs.map +1 -1
  133. package/dist/exports/useDateField.cjs.map +1 -1
  134. package/dist/exports/useDateField.js.map +1 -1
  135. package/dist/exports/useDateField.mjs.map +1 -1
  136. package/dist/exports/useDateRangePicker.cjs.map +1 -1
  137. package/dist/exports/useDateRangePicker.js.map +1 -1
  138. package/dist/exports/useDateRangePicker.mjs.map +1 -1
  139. package/dist/exports/useDisclosure.cjs +1 -1
  140. package/dist/exports/useDisclosure.cjs.map +1 -1
  141. package/dist/exports/useDisclosure.js +1 -1
  142. package/dist/exports/useDisclosure.js.map +1 -1
  143. package/dist/exports/useDisclosure.mjs +1 -1
  144. package/dist/exports/useDisclosure.mjs.map +1 -1
  145. package/dist/exports/useDrag.cjs.map +1 -1
  146. package/dist/exports/useDrag.js.map +1 -1
  147. package/dist/exports/useDrag.mjs.map +1 -1
  148. package/dist/exports/useDraggableCollection.cjs.map +1 -1
  149. package/dist/exports/useDraggableCollection.js.map +1 -1
  150. package/dist/exports/useDraggableCollection.mjs.map +1 -1
  151. package/dist/exports/useDrop.cjs.map +1 -1
  152. package/dist/exports/useDrop.js.map +1 -1
  153. package/dist/exports/useDrop.mjs.map +1 -1
  154. package/dist/exports/useDroppableCollection.cjs.map +1 -1
  155. package/dist/exports/useDroppableCollection.js.map +1 -1
  156. package/dist/exports/useDroppableCollection.mjs.map +1 -1
  157. package/dist/exports/useFocusable.cjs.map +1 -1
  158. package/dist/exports/useFocusable.js.map +1 -1
  159. package/dist/exports/useFocusable.mjs.map +1 -1
  160. package/dist/exports/useGridList.cjs.map +1 -1
  161. package/dist/exports/useGridList.js.map +1 -1
  162. package/dist/exports/useGridList.mjs.map +1 -1
  163. package/dist/exports/useInteractOutside.cjs.map +1 -1
  164. package/dist/exports/useInteractOutside.js.map +1 -1
  165. package/dist/exports/useInteractOutside.mjs.map +1 -1
  166. package/dist/exports/useLandmark.cjs.map +1 -1
  167. package/dist/exports/useLandmark.js.map +1 -1
  168. package/dist/exports/useLandmark.mjs.map +1 -1
  169. package/dist/exports/useListBox.cjs.map +1 -1
  170. package/dist/exports/useListBox.js.map +1 -1
  171. package/dist/exports/useListBox.mjs.map +1 -1
  172. package/dist/exports/useLocalizedStringFormatter.cjs.map +1 -1
  173. package/dist/exports/useLocalizedStringFormatter.js.map +1 -1
  174. package/dist/exports/useLocalizedStringFormatter.mjs.map +1 -1
  175. package/dist/exports/useMove.cjs.map +1 -1
  176. package/dist/exports/useMove.js.map +1 -1
  177. package/dist/exports/useMove.mjs.map +1 -1
  178. package/dist/exports/useOverlayPosition.cjs.map +1 -1
  179. package/dist/exports/useOverlayPosition.js.map +1 -1
  180. package/dist/exports/useOverlayPosition.mjs.map +1 -1
  181. package/dist/exports/useProgressBar.cjs.map +1 -1
  182. package/dist/exports/useProgressBar.js.map +1 -1
  183. package/dist/exports/useProgressBar.mjs.map +1 -1
  184. package/dist/exports/useRangeCalendar.cjs +15 -0
  185. package/dist/exports/useRangeCalendar.cjs.map +1 -1
  186. package/dist/exports/useRangeCalendar.js +11 -1
  187. package/dist/exports/useRangeCalendar.js.map +1 -1
  188. package/dist/exports/useRangeCalendar.mjs +11 -1
  189. package/dist/exports/useRangeCalendar.mjs.map +1 -1
  190. package/dist/exports/useSelect.cjs.map +1 -1
  191. package/dist/exports/useSelect.js.map +1 -1
  192. package/dist/exports/useSelect.mjs.map +1 -1
  193. package/dist/exports/useSlider.cjs.map +1 -1
  194. package/dist/exports/useSlider.js.map +1 -1
  195. package/dist/exports/useSlider.mjs.map +1 -1
  196. package/dist/exports/useTable.cjs.map +1 -1
  197. package/dist/exports/useTable.js.map +1 -1
  198. package/dist/exports/useTable.mjs.map +1 -1
  199. package/dist/exports/useTimeField.cjs.map +1 -1
  200. package/dist/exports/useTimeField.js.map +1 -1
  201. package/dist/exports/useTimeField.mjs.map +1 -1
  202. package/dist/exports/useToggleButton.cjs.map +1 -1
  203. package/dist/exports/useToggleButton.js.map +1 -1
  204. package/dist/exports/useToggleButton.mjs.map +1 -1
  205. package/dist/exports/useToggleButtonGroup.cjs.map +1 -1
  206. package/dist/exports/useToggleButtonGroup.js.map +1 -1
  207. package/dist/exports/useToggleButtonGroup.mjs.map +1 -1
  208. package/dist/exports/useTree.cjs.map +1 -1
  209. package/dist/exports/useTree.js.map +1 -1
  210. package/dist/exports/useTree.mjs.map +1 -1
  211. package/dist/private/actiongroup/useActionGroup.cjs +3 -3
  212. package/dist/private/actiongroup/useActionGroup.cjs.map +1 -1
  213. package/dist/private/actiongroup/useActionGroup.js +3 -3
  214. package/dist/private/actiongroup/useActionGroup.js.map +1 -1
  215. package/dist/private/actiongroup/useActionGroup.mjs +3 -3
  216. package/dist/private/actiongroup/useActionGroup.mjs.map +1 -1
  217. package/dist/private/actiongroup/useActionGroupItem.cjs +5 -4
  218. package/dist/private/actiongroup/useActionGroupItem.cjs.map +1 -1
  219. package/dist/private/actiongroup/useActionGroupItem.js +5 -4
  220. package/dist/private/actiongroup/useActionGroupItem.js.map +1 -1
  221. package/dist/private/actiongroup/useActionGroupItem.mjs +5 -4
  222. package/dist/private/actiongroup/useActionGroupItem.mjs.map +1 -1
  223. package/dist/private/aria-modal-polyfill/ariaModalPolyfill.cjs +7 -5
  224. package/dist/private/aria-modal-polyfill/ariaModalPolyfill.cjs.map +1 -1
  225. package/dist/private/aria-modal-polyfill/ariaModalPolyfill.js +7 -5
  226. package/dist/private/aria-modal-polyfill/ariaModalPolyfill.js.map +1 -1
  227. package/dist/private/aria-modal-polyfill/ariaModalPolyfill.mjs +7 -5
  228. package/dist/private/aria-modal-polyfill/ariaModalPolyfill.mjs.map +1 -1
  229. package/dist/private/autocomplete/useAutocomplete.cjs +16 -7
  230. package/dist/private/autocomplete/useAutocomplete.cjs.map +1 -1
  231. package/dist/private/autocomplete/useAutocomplete.js +16 -7
  232. package/dist/private/autocomplete/useAutocomplete.js.map +1 -1
  233. package/dist/private/autocomplete/useAutocomplete.mjs +16 -7
  234. package/dist/private/autocomplete/useAutocomplete.mjs.map +1 -1
  235. package/dist/private/autocomplete/useSearchAutocomplete.cjs.map +1 -1
  236. package/dist/private/autocomplete/useSearchAutocomplete.js.map +1 -1
  237. package/dist/private/autocomplete/useSearchAutocomplete.mjs.map +1 -1
  238. package/dist/private/breadcrumbs/useBreadcrumbItem.cjs.map +1 -1
  239. package/dist/private/breadcrumbs/useBreadcrumbItem.js.map +1 -1
  240. package/dist/private/breadcrumbs/useBreadcrumbItem.mjs.map +1 -1
  241. package/dist/private/breadcrumbs/useBreadcrumbs.cjs.map +1 -1
  242. package/dist/private/breadcrumbs/useBreadcrumbs.js.map +1 -1
  243. package/dist/private/breadcrumbs/useBreadcrumbs.mjs.map +1 -1
  244. package/dist/private/button/useButton.cjs.map +1 -1
  245. package/dist/private/button/useButton.js.map +1 -1
  246. package/dist/private/button/useButton.mjs.map +1 -1
  247. package/dist/private/button/useToggleButton.cjs.map +1 -1
  248. package/dist/private/button/useToggleButton.js.map +1 -1
  249. package/dist/private/button/useToggleButton.mjs.map +1 -1
  250. package/dist/private/button/useToggleButtonGroup.cjs.map +1 -1
  251. package/dist/private/button/useToggleButtonGroup.js.map +1 -1
  252. package/dist/private/button/useToggleButtonGroup.mjs.map +1 -1
  253. package/dist/private/calendar/useCalendar.cjs.map +1 -1
  254. package/dist/private/calendar/useCalendar.js.map +1 -1
  255. package/dist/private/calendar/useCalendar.mjs.map +1 -1
  256. package/dist/private/calendar/useCalendarBase.cjs.map +1 -1
  257. package/dist/private/calendar/useCalendarBase.js.map +1 -1
  258. package/dist/private/calendar/useCalendarBase.mjs.map +1 -1
  259. package/dist/private/calendar/useCalendarCell.cjs +10 -14
  260. package/dist/private/calendar/useCalendarCell.cjs.map +1 -1
  261. package/dist/private/calendar/useCalendarCell.js +10 -14
  262. package/dist/private/calendar/useCalendarCell.js.map +1 -1
  263. package/dist/private/calendar/useCalendarCell.mjs +10 -14
  264. package/dist/private/calendar/useCalendarCell.mjs.map +1 -1
  265. package/dist/private/calendar/useCalendarGrid.cjs +9 -5
  266. package/dist/private/calendar/useCalendarGrid.cjs.map +1 -1
  267. package/dist/private/calendar/useCalendarGrid.js +10 -6
  268. package/dist/private/calendar/useCalendarGrid.js.map +1 -1
  269. package/dist/private/calendar/useCalendarGrid.mjs +10 -6
  270. package/dist/private/calendar/useCalendarGrid.mjs.map +1 -1
  271. package/dist/private/calendar/useCalendarHeading.cjs +56 -0
  272. package/dist/private/calendar/useCalendarHeading.cjs.map +1 -0
  273. package/dist/private/calendar/useCalendarHeading.js +52 -0
  274. package/dist/private/calendar/useCalendarHeading.js.map +1 -0
  275. package/dist/private/calendar/useCalendarHeading.mjs +51 -0
  276. package/dist/private/calendar/useCalendarHeading.mjs.map +1 -0
  277. package/dist/private/calendar/useCalendarMonthPicker.cjs +66 -0
  278. package/dist/private/calendar/useCalendarMonthPicker.cjs.map +1 -0
  279. package/dist/private/calendar/useCalendarMonthPicker.js +61 -0
  280. package/dist/private/calendar/useCalendarMonthPicker.js.map +1 -0
  281. package/dist/private/calendar/useCalendarMonthPicker.mjs +61 -0
  282. package/dist/private/calendar/useCalendarMonthPicker.mjs.map +1 -0
  283. package/dist/private/calendar/useCalendarYearPicker.cjs +90 -0
  284. package/dist/private/calendar/useCalendarYearPicker.cjs.map +1 -0
  285. package/dist/private/calendar/useCalendarYearPicker.js +86 -0
  286. package/dist/private/calendar/useCalendarYearPicker.js.map +1 -0
  287. package/dist/private/calendar/useCalendarYearPicker.mjs +85 -0
  288. package/dist/private/calendar/useCalendarYearPicker.mjs.map +1 -0
  289. package/dist/private/calendar/useRangeCalendar.cjs +1 -1
  290. package/dist/private/calendar/useRangeCalendar.cjs.map +1 -1
  291. package/dist/private/calendar/useRangeCalendar.js +1 -1
  292. package/dist/private/calendar/useRangeCalendar.js.map +1 -1
  293. package/dist/private/calendar/useRangeCalendar.mjs +1 -1
  294. package/dist/private/calendar/useRangeCalendar.mjs.map +1 -1
  295. package/dist/private/calendar/utils.cjs +20 -4
  296. package/dist/private/calendar/utils.cjs.map +1 -1
  297. package/dist/private/calendar/utils.js +22 -5
  298. package/dist/private/calendar/utils.js.map +1 -1
  299. package/dist/private/calendar/utils.mjs +20 -4
  300. package/dist/private/calendar/utils.mjs.map +1 -1
  301. package/dist/private/checkbox/useCheckbox.cjs +6 -35
  302. package/dist/private/checkbox/useCheckbox.cjs.map +1 -1
  303. package/dist/private/checkbox/useCheckbox.js +6 -35
  304. package/dist/private/checkbox/useCheckbox.js.map +1 -1
  305. package/dist/private/checkbox/useCheckbox.mjs +6 -35
  306. package/dist/private/checkbox/useCheckbox.mjs.map +1 -1
  307. package/dist/private/checkbox/useCheckboxGroup.cjs.map +1 -1
  308. package/dist/private/checkbox/useCheckboxGroup.js.map +1 -1
  309. package/dist/private/checkbox/useCheckboxGroup.mjs.map +1 -1
  310. package/dist/private/checkbox/useCheckboxGroupItem.cjs +1 -1
  311. package/dist/private/checkbox/useCheckboxGroupItem.cjs.map +1 -1
  312. package/dist/private/checkbox/useCheckboxGroupItem.js +1 -1
  313. package/dist/private/checkbox/useCheckboxGroupItem.js.map +1 -1
  314. package/dist/private/checkbox/useCheckboxGroupItem.mjs +1 -1
  315. package/dist/private/checkbox/useCheckboxGroupItem.mjs.map +1 -1
  316. package/dist/private/checkbox/utils.cjs.map +1 -1
  317. package/dist/private/checkbox/utils.js.map +1 -1
  318. package/dist/private/checkbox/utils.mjs.map +1 -1
  319. package/dist/private/collections/BaseCollection.cjs +4 -4
  320. package/dist/private/collections/BaseCollection.cjs.map +1 -1
  321. package/dist/private/collections/BaseCollection.js +4 -4
  322. package/dist/private/collections/BaseCollection.js.map +1 -1
  323. package/dist/private/collections/BaseCollection.mjs +4 -4
  324. package/dist/private/collections/BaseCollection.mjs.map +1 -1
  325. package/dist/private/collections/CollectionBuilder.cjs +5 -3
  326. package/dist/private/collections/CollectionBuilder.cjs.map +1 -1
  327. package/dist/private/collections/CollectionBuilder.js +5 -3
  328. package/dist/private/collections/CollectionBuilder.js.map +1 -1
  329. package/dist/private/collections/CollectionBuilder.mjs +5 -3
  330. package/dist/private/collections/CollectionBuilder.mjs.map +1 -1
  331. package/dist/private/collections/Document.cjs.map +1 -1
  332. package/dist/private/collections/Document.js.map +1 -1
  333. package/dist/private/collections/Document.mjs.map +1 -1
  334. package/dist/private/collections/Hidden.cjs.map +1 -1
  335. package/dist/private/collections/Hidden.js.map +1 -1
  336. package/dist/private/collections/Hidden.mjs.map +1 -1
  337. package/dist/private/collections/useCachedChildren.cjs +29 -8
  338. package/dist/private/collections/useCachedChildren.cjs.map +1 -1
  339. package/dist/private/collections/useCachedChildren.js +29 -8
  340. package/dist/private/collections/useCachedChildren.js.map +1 -1
  341. package/dist/private/collections/useCachedChildren.mjs +29 -8
  342. package/dist/private/collections/useCachedChildren.mjs.map +1 -1
  343. package/dist/private/color/useColorArea.cjs.map +1 -1
  344. package/dist/private/color/useColorArea.js.map +1 -1
  345. package/dist/private/color/useColorArea.mjs.map +1 -1
  346. package/dist/private/color/useColorAreaGradient.cjs +1 -1
  347. package/dist/private/color/useColorAreaGradient.cjs.map +1 -1
  348. package/dist/private/color/useColorAreaGradient.js +1 -1
  349. package/dist/private/color/useColorAreaGradient.js.map +1 -1
  350. package/dist/private/color/useColorAreaGradient.mjs +1 -1
  351. package/dist/private/color/useColorAreaGradient.mjs.map +1 -1
  352. package/dist/private/color/useColorChannelField.cjs.map +1 -1
  353. package/dist/private/color/useColorChannelField.js.map +1 -1
  354. package/dist/private/color/useColorChannelField.mjs.map +1 -1
  355. package/dist/private/color/useColorField.cjs +1 -1
  356. package/dist/private/color/useColorField.cjs.map +1 -1
  357. package/dist/private/color/useColorField.js +1 -1
  358. package/dist/private/color/useColorField.js.map +1 -1
  359. package/dist/private/color/useColorField.mjs +1 -1
  360. package/dist/private/color/useColorField.mjs.map +1 -1
  361. package/dist/private/color/useColorSlider.cjs +2 -2
  362. package/dist/private/color/useColorSlider.cjs.map +1 -1
  363. package/dist/private/color/useColorSlider.js +2 -2
  364. package/dist/private/color/useColorSlider.js.map +1 -1
  365. package/dist/private/color/useColorSlider.mjs +2 -2
  366. package/dist/private/color/useColorSlider.mjs.map +1 -1
  367. package/dist/private/color/useColorSwatch.cjs.map +1 -1
  368. package/dist/private/color/useColorSwatch.js.map +1 -1
  369. package/dist/private/color/useColorSwatch.mjs.map +1 -1
  370. package/dist/private/color/useColorWheel.cjs.map +1 -1
  371. package/dist/private/color/useColorWheel.js.map +1 -1
  372. package/dist/private/color/useColorWheel.mjs.map +1 -1
  373. package/dist/private/combobox/useComboBox.cjs +5 -3
  374. package/dist/private/combobox/useComboBox.cjs.map +1 -1
  375. package/dist/private/combobox/useComboBox.js +5 -3
  376. package/dist/private/combobox/useComboBox.js.map +1 -1
  377. package/dist/private/combobox/useComboBox.mjs +5 -3
  378. package/dist/private/combobox/useComboBox.mjs.map +1 -1
  379. package/dist/private/datepicker/useDateField.cjs.map +1 -1
  380. package/dist/private/datepicker/useDateField.js.map +1 -1
  381. package/dist/private/datepicker/useDateField.mjs.map +1 -1
  382. package/dist/private/datepicker/useDatePicker.cjs.map +1 -1
  383. package/dist/private/datepicker/useDatePicker.js.map +1 -1
  384. package/dist/private/datepicker/useDatePicker.mjs.map +1 -1
  385. package/dist/private/datepicker/useDatePickerGroup.cjs.map +1 -1
  386. package/dist/private/datepicker/useDatePickerGroup.js.map +1 -1
  387. package/dist/private/datepicker/useDatePickerGroup.mjs.map +1 -1
  388. package/dist/private/datepicker/useDateRangePicker.cjs.map +1 -1
  389. package/dist/private/datepicker/useDateRangePicker.js.map +1 -1
  390. package/dist/private/datepicker/useDateRangePicker.mjs.map +1 -1
  391. package/dist/private/datepicker/useDateSegment.cjs +2 -2
  392. package/dist/private/datepicker/useDateSegment.cjs.map +1 -1
  393. package/dist/private/datepicker/useDateSegment.js +2 -2
  394. package/dist/private/datepicker/useDateSegment.js.map +1 -1
  395. package/dist/private/datepicker/useDateSegment.mjs +2 -2
  396. package/dist/private/datepicker/useDateSegment.mjs.map +1 -1
  397. package/dist/private/datepicker/useDisplayNames.cjs +1 -2
  398. package/dist/private/datepicker/useDisplayNames.cjs.map +1 -1
  399. package/dist/private/datepicker/useDisplayNames.js +1 -2
  400. package/dist/private/datepicker/useDisplayNames.js.map +1 -1
  401. package/dist/private/datepicker/useDisplayNames.mjs +1 -2
  402. package/dist/private/datepicker/useDisplayNames.mjs.map +1 -1
  403. package/dist/private/dialog/useDialog.cjs.map +1 -1
  404. package/dist/private/dialog/useDialog.js.map +1 -1
  405. package/dist/private/dialog/useDialog.mjs.map +1 -1
  406. package/dist/private/disclosure/useDisclosure.cjs.map +1 -1
  407. package/dist/private/disclosure/useDisclosure.js.map +1 -1
  408. package/dist/private/disclosure/useDisclosure.mjs.map +1 -1
  409. package/dist/private/dnd/DragManager.cjs +4 -1
  410. package/dist/private/dnd/DragManager.cjs.map +1 -1
  411. package/dist/private/dnd/DragManager.js +4 -1
  412. package/dist/private/dnd/DragManager.js.map +1 -1
  413. package/dist/private/dnd/DragManager.mjs +4 -1
  414. package/dist/private/dnd/DragManager.mjs.map +1 -1
  415. package/dist/private/dnd/DragPreview.cjs.map +1 -1
  416. package/dist/private/dnd/DragPreview.js.map +1 -1
  417. package/dist/private/dnd/DragPreview.mjs.map +1 -1
  418. package/dist/private/dnd/DropTargetKeyboardNavigation.cjs +16 -4
  419. package/dist/private/dnd/DropTargetKeyboardNavigation.cjs.map +1 -1
  420. package/dist/private/dnd/DropTargetKeyboardNavigation.js +16 -4
  421. package/dist/private/dnd/DropTargetKeyboardNavigation.js.map +1 -1
  422. package/dist/private/dnd/DropTargetKeyboardNavigation.mjs +16 -4
  423. package/dist/private/dnd/DropTargetKeyboardNavigation.mjs.map +1 -1
  424. package/dist/private/dnd/ListDropTargetDelegate.cjs.map +1 -1
  425. package/dist/private/dnd/ListDropTargetDelegate.js.map +1 -1
  426. package/dist/private/dnd/ListDropTargetDelegate.mjs.map +1 -1
  427. package/dist/private/dnd/constants.cjs.map +1 -1
  428. package/dist/private/dnd/constants.js.map +1 -1
  429. package/dist/private/dnd/constants.mjs.map +1 -1
  430. package/dist/private/dnd/useAutoScroll.cjs.map +1 -1
  431. package/dist/private/dnd/useAutoScroll.js.map +1 -1
  432. package/dist/private/dnd/useAutoScroll.mjs.map +1 -1
  433. package/dist/private/dnd/useClipboard.cjs.map +1 -1
  434. package/dist/private/dnd/useClipboard.js.map +1 -1
  435. package/dist/private/dnd/useClipboard.mjs.map +1 -1
  436. package/dist/private/dnd/useDrag.cjs.map +1 -1
  437. package/dist/private/dnd/useDrag.js.map +1 -1
  438. package/dist/private/dnd/useDrag.mjs.map +1 -1
  439. package/dist/private/dnd/useDraggableCollection.cjs.map +1 -1
  440. package/dist/private/dnd/useDraggableCollection.js.map +1 -1
  441. package/dist/private/dnd/useDraggableCollection.mjs.map +1 -1
  442. package/dist/private/dnd/useDraggableItem.cjs.map +1 -1
  443. package/dist/private/dnd/useDraggableItem.js.map +1 -1
  444. package/dist/private/dnd/useDraggableItem.mjs.map +1 -1
  445. package/dist/private/dnd/useDrop.cjs.map +1 -1
  446. package/dist/private/dnd/useDrop.js.map +1 -1
  447. package/dist/private/dnd/useDrop.mjs.map +1 -1
  448. package/dist/private/dnd/useDropIndicator.cjs.map +1 -1
  449. package/dist/private/dnd/useDropIndicator.js.map +1 -1
  450. package/dist/private/dnd/useDropIndicator.mjs.map +1 -1
  451. package/dist/private/dnd/useDroppableCollection.cjs.map +1 -1
  452. package/dist/private/dnd/useDroppableCollection.js.map +1 -1
  453. package/dist/private/dnd/useDroppableCollection.mjs.map +1 -1
  454. package/dist/private/dnd/useDroppableItem.cjs.map +1 -1
  455. package/dist/private/dnd/useDroppableItem.js.map +1 -1
  456. package/dist/private/dnd/useDroppableItem.mjs.map +1 -1
  457. package/dist/private/dnd/useVirtualDrop.cjs.map +1 -1
  458. package/dist/private/dnd/useVirtualDrop.js.map +1 -1
  459. package/dist/private/dnd/useVirtualDrop.mjs.map +1 -1
  460. package/dist/private/dnd/utils.cjs +14 -4
  461. package/dist/private/dnd/utils.cjs.map +1 -1
  462. package/dist/private/dnd/utils.js +14 -4
  463. package/dist/private/dnd/utils.js.map +1 -1
  464. package/dist/private/dnd/utils.mjs +14 -4
  465. package/dist/private/dnd/utils.mjs.map +1 -1
  466. package/dist/private/focus/FocusRing.cjs.map +1 -1
  467. package/dist/private/focus/FocusRing.js.map +1 -1
  468. package/dist/private/focus/FocusRing.mjs.map +1 -1
  469. package/dist/private/focus/FocusScope.cjs +4 -1
  470. package/dist/private/focus/FocusScope.cjs.map +1 -1
  471. package/dist/private/focus/FocusScope.js +4 -1
  472. package/dist/private/focus/FocusScope.js.map +1 -1
  473. package/dist/private/focus/FocusScope.mjs +4 -1
  474. package/dist/private/focus/FocusScope.mjs.map +1 -1
  475. package/dist/private/focus/useFocusRing.cjs.map +1 -1
  476. package/dist/private/focus/useFocusRing.js.map +1 -1
  477. package/dist/private/focus/useFocusRing.mjs.map +1 -1
  478. package/dist/private/focus/useHasTabbableChild.cjs.map +1 -1
  479. package/dist/private/focus/useHasTabbableChild.js.map +1 -1
  480. package/dist/private/focus/useHasTabbableChild.mjs.map +1 -1
  481. package/dist/private/form/useFormValidation.cjs +1 -1
  482. package/dist/private/form/useFormValidation.cjs.map +1 -1
  483. package/dist/private/form/useFormValidation.js +1 -1
  484. package/dist/private/form/useFormValidation.js.map +1 -1
  485. package/dist/private/form/useFormValidation.mjs +1 -1
  486. package/dist/private/form/useFormValidation.mjs.map +1 -1
  487. package/dist/private/grid/GridKeyboardDelegate.cjs +9 -9
  488. package/dist/private/grid/GridKeyboardDelegate.cjs.map +1 -1
  489. package/dist/private/grid/GridKeyboardDelegate.js +10 -10
  490. package/dist/private/grid/GridKeyboardDelegate.js.map +1 -1
  491. package/dist/private/grid/GridKeyboardDelegate.mjs +9 -9
  492. package/dist/private/grid/GridKeyboardDelegate.mjs.map +1 -1
  493. package/dist/private/grid/useGrid.cjs.map +1 -1
  494. package/dist/private/grid/useGrid.js.map +1 -1
  495. package/dist/private/grid/useGrid.mjs.map +1 -1
  496. package/dist/private/grid/useGridCell.cjs.map +1 -1
  497. package/dist/private/grid/useGridCell.js.map +1 -1
  498. package/dist/private/grid/useGridCell.mjs.map +1 -1
  499. package/dist/private/grid/useGridRow.cjs.map +1 -1
  500. package/dist/private/grid/useGridRow.js.map +1 -1
  501. package/dist/private/grid/useGridRow.mjs.map +1 -1
  502. package/dist/private/grid/useGridRowGroup.cjs.map +1 -1
  503. package/dist/private/grid/useGridRowGroup.js.map +1 -1
  504. package/dist/private/grid/useGridRowGroup.mjs.map +1 -1
  505. package/dist/private/grid/useGridSelectionAnnouncement.cjs.map +1 -1
  506. package/dist/private/grid/useGridSelectionAnnouncement.js.map +1 -1
  507. package/dist/private/grid/useGridSelectionAnnouncement.mjs.map +1 -1
  508. package/dist/private/grid/useGridSelectionCheckbox.cjs.map +1 -1
  509. package/dist/private/grid/useGridSelectionCheckbox.js.map +1 -1
  510. package/dist/private/grid/useGridSelectionCheckbox.mjs.map +1 -1
  511. package/dist/private/grid/useHighlightSelectionDescription.cjs.map +1 -1
  512. package/dist/private/grid/useHighlightSelectionDescription.js.map +1 -1
  513. package/dist/private/grid/useHighlightSelectionDescription.mjs.map +1 -1
  514. package/dist/private/grid/utils.cjs.map +1 -1
  515. package/dist/private/grid/utils.js.map +1 -1
  516. package/dist/private/grid/utils.mjs.map +1 -1
  517. package/dist/private/gridlist/useGridList.cjs +2 -1
  518. package/dist/private/gridlist/useGridList.cjs.map +1 -1
  519. package/dist/private/gridlist/useGridList.js +2 -1
  520. package/dist/private/gridlist/useGridList.js.map +1 -1
  521. package/dist/private/gridlist/useGridList.mjs +2 -1
  522. package/dist/private/gridlist/useGridList.mjs.map +1 -1
  523. package/dist/private/gridlist/useGridListItem.cjs +66 -23
  524. package/dist/private/gridlist/useGridListItem.cjs.map +1 -1
  525. package/dist/private/gridlist/useGridListItem.js +67 -23
  526. package/dist/private/gridlist/useGridListItem.js.map +1 -1
  527. package/dist/private/gridlist/useGridListItem.mjs +66 -23
  528. package/dist/private/gridlist/useGridListItem.mjs.map +1 -1
  529. package/dist/private/gridlist/useGridListSection.cjs +3 -1
  530. package/dist/private/gridlist/useGridListSection.cjs.map +1 -1
  531. package/dist/private/gridlist/useGridListSection.js +3 -1
  532. package/dist/private/gridlist/useGridListSection.js.map +1 -1
  533. package/dist/private/gridlist/useGridListSection.mjs +3 -1
  534. package/dist/private/gridlist/useGridListSection.mjs.map +1 -1
  535. package/dist/private/gridlist/useGridListSelectionCheckbox.cjs.map +1 -1
  536. package/dist/private/gridlist/useGridListSelectionCheckbox.js.map +1 -1
  537. package/dist/private/gridlist/useGridListSelectionCheckbox.mjs.map +1 -1
  538. package/dist/private/gridlist/utils.cjs.map +1 -1
  539. package/dist/private/gridlist/utils.js.map +1 -1
  540. package/dist/private/gridlist/utils.mjs.map +1 -1
  541. package/dist/private/i18n/I18nProvider.cjs.map +1 -1
  542. package/dist/private/i18n/I18nProvider.js.map +1 -1
  543. package/dist/private/i18n/I18nProvider.mjs.map +1 -1
  544. package/dist/private/i18n/server.cjs.map +1 -1
  545. package/dist/private/i18n/server.js.map +1 -1
  546. package/dist/private/i18n/server.mjs.map +1 -1
  547. package/dist/private/i18n/useCollator.cjs.map +1 -1
  548. package/dist/private/i18n/useCollator.js.map +1 -1
  549. package/dist/private/i18n/useCollator.mjs.map +1 -1
  550. package/dist/private/i18n/useDateFormatter.cjs.map +1 -1
  551. package/dist/private/i18n/useDateFormatter.js.map +1 -1
  552. package/dist/private/i18n/useDateFormatter.mjs.map +1 -1
  553. package/dist/private/i18n/useDefaultLocale.cjs +2 -1
  554. package/dist/private/i18n/useDefaultLocale.cjs.map +1 -1
  555. package/dist/private/i18n/useDefaultLocale.js +2 -1
  556. package/dist/private/i18n/useDefaultLocale.js.map +1 -1
  557. package/dist/private/i18n/useDefaultLocale.mjs +2 -1
  558. package/dist/private/i18n/useDefaultLocale.mjs.map +1 -1
  559. package/dist/private/i18n/useFilter.cjs.map +1 -1
  560. package/dist/private/i18n/useFilter.js.map +1 -1
  561. package/dist/private/i18n/useFilter.mjs.map +1 -1
  562. package/dist/private/i18n/useListFormatter.cjs.map +1 -1
  563. package/dist/private/i18n/useListFormatter.js.map +1 -1
  564. package/dist/private/i18n/useListFormatter.mjs.map +1 -1
  565. package/dist/private/i18n/useLocalizedStringFormatter.cjs.map +1 -1
  566. package/dist/private/i18n/useLocalizedStringFormatter.js.map +1 -1
  567. package/dist/private/i18n/useLocalizedStringFormatter.mjs.map +1 -1
  568. package/dist/private/i18n/useNumberFormatter.cjs.map +1 -1
  569. package/dist/private/i18n/useNumberFormatter.js.map +1 -1
  570. package/dist/private/i18n/useNumberFormatter.mjs.map +1 -1
  571. package/dist/private/i18n/utils.cjs +2 -2
  572. package/dist/private/i18n/utils.cjs.map +1 -1
  573. package/dist/private/i18n/utils.js +2 -2
  574. package/dist/private/i18n/utils.js.map +1 -1
  575. package/dist/private/i18n/utils.mjs +2 -2
  576. package/dist/private/i18n/utils.mjs.map +1 -1
  577. package/dist/private/interactions/PressResponder.cjs.map +1 -1
  578. package/dist/private/interactions/PressResponder.js.map +1 -1
  579. package/dist/private/interactions/PressResponder.mjs.map +1 -1
  580. package/dist/private/interactions/Pressable.cjs.map +1 -1
  581. package/dist/private/interactions/Pressable.js.map +1 -1
  582. package/dist/private/interactions/Pressable.mjs.map +1 -1
  583. package/dist/private/interactions/context.cjs.map +1 -1
  584. package/dist/private/interactions/context.js.map +1 -1
  585. package/dist/private/interactions/context.mjs.map +1 -1
  586. package/dist/private/interactions/createEventHandler.cjs +3 -0
  587. package/dist/private/interactions/createEventHandler.cjs.map +1 -1
  588. package/dist/private/interactions/createEventHandler.js +3 -0
  589. package/dist/private/interactions/createEventHandler.js.map +1 -1
  590. package/dist/private/interactions/createEventHandler.mjs +3 -0
  591. package/dist/private/interactions/createEventHandler.mjs.map +1 -1
  592. package/dist/private/interactions/focusSafely.cjs.map +1 -1
  593. package/dist/private/interactions/focusSafely.js.map +1 -1
  594. package/dist/private/interactions/focusSafely.mjs.map +1 -1
  595. package/dist/private/interactions/textSelection.cjs.map +1 -1
  596. package/dist/private/interactions/textSelection.js.map +1 -1
  597. package/dist/private/interactions/textSelection.mjs.map +1 -1
  598. package/dist/private/interactions/useFocus.cjs.map +1 -1
  599. package/dist/private/interactions/useFocus.js.map +1 -1
  600. package/dist/private/interactions/useFocus.mjs.map +1 -1
  601. package/dist/private/interactions/useFocusVisible.cjs +20 -8
  602. package/dist/private/interactions/useFocusVisible.cjs.map +1 -1
  603. package/dist/private/interactions/useFocusVisible.js +20 -8
  604. package/dist/private/interactions/useFocusVisible.js.map +1 -1
  605. package/dist/private/interactions/useFocusVisible.mjs +20 -8
  606. package/dist/private/interactions/useFocusVisible.mjs.map +1 -1
  607. package/dist/private/interactions/useFocusWithin.cjs.map +1 -1
  608. package/dist/private/interactions/useFocusWithin.js.map +1 -1
  609. package/dist/private/interactions/useFocusWithin.mjs.map +1 -1
  610. package/dist/private/interactions/useFocusable.cjs.map +1 -1
  611. package/dist/private/interactions/useFocusable.js.map +1 -1
  612. package/dist/private/interactions/useFocusable.mjs.map +1 -1
  613. package/dist/private/interactions/useHover.cjs.map +1 -1
  614. package/dist/private/interactions/useHover.js.map +1 -1
  615. package/dist/private/interactions/useHover.mjs.map +1 -1
  616. package/dist/private/interactions/useInteractOutside.cjs.map +1 -1
  617. package/dist/private/interactions/useInteractOutside.js.map +1 -1
  618. package/dist/private/interactions/useInteractOutside.mjs.map +1 -1
  619. package/dist/private/interactions/useKeyboard.cjs.map +1 -1
  620. package/dist/private/interactions/useKeyboard.js.map +1 -1
  621. package/dist/private/interactions/useKeyboard.mjs.map +1 -1
  622. package/dist/private/interactions/useLongPress.cjs.map +1 -1
  623. package/dist/private/interactions/useLongPress.js.map +1 -1
  624. package/dist/private/interactions/useLongPress.mjs.map +1 -1
  625. package/dist/private/interactions/useMove.cjs.map +1 -1
  626. package/dist/private/interactions/useMove.js.map +1 -1
  627. package/dist/private/interactions/useMove.mjs.map +1 -1
  628. package/dist/private/interactions/usePress.cjs +11 -0
  629. package/dist/private/interactions/usePress.cjs.map +1 -1
  630. package/dist/private/interactions/usePress.js +12 -1
  631. package/dist/private/interactions/usePress.js.map +1 -1
  632. package/dist/private/interactions/usePress.mjs +12 -1
  633. package/dist/private/interactions/usePress.mjs.map +1 -1
  634. package/dist/private/interactions/useScrollWheel.cjs.map +1 -1
  635. package/dist/private/interactions/useScrollWheel.js.map +1 -1
  636. package/dist/private/interactions/useScrollWheel.mjs.map +1 -1
  637. package/dist/private/interactions/utils.cjs.map +1 -1
  638. package/dist/private/interactions/utils.js.map +1 -1
  639. package/dist/private/interactions/utils.mjs.map +1 -1
  640. package/dist/private/intl/tag/en-US.cjs.map +1 -1
  641. package/dist/private/intl/tag/en-US.js.map +1 -1
  642. package/dist/private/intl/tag/en-US.mjs.map +1 -1
  643. package/dist/private/label/useField.cjs.map +1 -1
  644. package/dist/private/label/useField.js.map +1 -1
  645. package/dist/private/label/useField.mjs.map +1 -1
  646. package/dist/private/label/useLabel.cjs.map +1 -1
  647. package/dist/private/label/useLabel.js.map +1 -1
  648. package/dist/private/label/useLabel.mjs.map +1 -1
  649. package/dist/private/landmark/useLandmark.cjs +2 -1
  650. package/dist/private/landmark/useLandmark.cjs.map +1 -1
  651. package/dist/private/landmark/useLandmark.js +2 -1
  652. package/dist/private/landmark/useLandmark.js.map +1 -1
  653. package/dist/private/landmark/useLandmark.mjs +2 -1
  654. package/dist/private/landmark/useLandmark.mjs.map +1 -1
  655. package/dist/private/link/useLink.cjs.map +1 -1
  656. package/dist/private/link/useLink.js.map +1 -1
  657. package/dist/private/link/useLink.mjs.map +1 -1
  658. package/dist/private/listbox/useListBox.cjs.map +1 -1
  659. package/dist/private/listbox/useListBox.js.map +1 -1
  660. package/dist/private/listbox/useListBox.mjs.map +1 -1
  661. package/dist/private/listbox/useListBoxSection.cjs.map +1 -1
  662. package/dist/private/listbox/useListBoxSection.js.map +1 -1
  663. package/dist/private/listbox/useListBoxSection.mjs.map +1 -1
  664. package/dist/private/listbox/useOption.cjs.map +1 -1
  665. package/dist/private/listbox/useOption.js.map +1 -1
  666. package/dist/private/listbox/useOption.mjs.map +1 -1
  667. package/dist/private/listbox/utils.cjs.map +1 -1
  668. package/dist/private/listbox/utils.js.map +1 -1
  669. package/dist/private/listbox/utils.mjs.map +1 -1
  670. package/dist/private/live-announcer/LiveAnnouncer.cjs +2 -2
  671. package/dist/private/live-announcer/LiveAnnouncer.cjs.map +1 -1
  672. package/dist/private/live-announcer/LiveAnnouncer.js +2 -2
  673. package/dist/private/live-announcer/LiveAnnouncer.js.map +1 -1
  674. package/dist/private/live-announcer/LiveAnnouncer.mjs +2 -2
  675. package/dist/private/live-announcer/LiveAnnouncer.mjs.map +1 -1
  676. package/dist/private/menu/useMenu.cjs.map +1 -1
  677. package/dist/private/menu/useMenu.js.map +1 -1
  678. package/dist/private/menu/useMenu.mjs.map +1 -1
  679. package/dist/private/menu/useMenuItem.cjs +1 -1
  680. package/dist/private/menu/useMenuItem.cjs.map +1 -1
  681. package/dist/private/menu/useMenuItem.js +1 -1
  682. package/dist/private/menu/useMenuItem.js.map +1 -1
  683. package/dist/private/menu/useMenuItem.mjs +1 -1
  684. package/dist/private/menu/useMenuItem.mjs.map +1 -1
  685. package/dist/private/menu/useMenuSection.cjs.map +1 -1
  686. package/dist/private/menu/useMenuSection.js.map +1 -1
  687. package/dist/private/menu/useMenuSection.mjs.map +1 -1
  688. package/dist/private/menu/useMenuTrigger.cjs.map +1 -1
  689. package/dist/private/menu/useMenuTrigger.js.map +1 -1
  690. package/dist/private/menu/useMenuTrigger.mjs.map +1 -1
  691. package/dist/private/menu/useSafelyMouseToSubmenu.cjs.map +1 -1
  692. package/dist/private/menu/useSafelyMouseToSubmenu.js.map +1 -1
  693. package/dist/private/menu/useSafelyMouseToSubmenu.mjs.map +1 -1
  694. package/dist/private/menu/useSubmenuTrigger.cjs.map +1 -1
  695. package/dist/private/menu/useSubmenuTrigger.js.map +1 -1
  696. package/dist/private/menu/useSubmenuTrigger.mjs.map +1 -1
  697. package/dist/private/menu/utils.cjs.map +1 -1
  698. package/dist/private/menu/utils.js.map +1 -1
  699. package/dist/private/menu/utils.mjs.map +1 -1
  700. package/dist/private/meter/useMeter.cjs.map +1 -1
  701. package/dist/private/meter/useMeter.js.map +1 -1
  702. package/dist/private/meter/useMeter.mjs.map +1 -1
  703. package/dist/private/numberfield/useNumberField.cjs.map +1 -1
  704. package/dist/private/numberfield/useNumberField.js.map +1 -1
  705. package/dist/private/numberfield/useNumberField.mjs.map +1 -1
  706. package/dist/private/overlays/DismissButton.cjs.map +1 -1
  707. package/dist/private/overlays/DismissButton.js.map +1 -1
  708. package/dist/private/overlays/DismissButton.mjs.map +1 -1
  709. package/dist/private/overlays/Overlay.cjs.map +1 -1
  710. package/dist/private/overlays/Overlay.js.map +1 -1
  711. package/dist/private/overlays/Overlay.mjs.map +1 -1
  712. package/dist/private/overlays/PortalProvider.cjs.map +1 -1
  713. package/dist/private/overlays/PortalProvider.js.map +1 -1
  714. package/dist/private/overlays/PortalProvider.mjs.map +1 -1
  715. package/dist/private/overlays/ariaHideOutside.cjs.map +1 -1
  716. package/dist/private/overlays/ariaHideOutside.js.map +1 -1
  717. package/dist/private/overlays/ariaHideOutside.mjs.map +1 -1
  718. package/dist/private/overlays/calculatePosition.cjs +19 -20
  719. package/dist/private/overlays/calculatePosition.cjs.map +1 -1
  720. package/dist/private/overlays/calculatePosition.js +20 -21
  721. package/dist/private/overlays/calculatePosition.js.map +1 -1
  722. package/dist/private/overlays/calculatePosition.mjs +19 -20
  723. package/dist/private/overlays/calculatePosition.mjs.map +1 -1
  724. package/dist/private/overlays/useCloseOnScroll.cjs.map +1 -1
  725. package/dist/private/overlays/useCloseOnScroll.js.map +1 -1
  726. package/dist/private/overlays/useCloseOnScroll.mjs.map +1 -1
  727. package/dist/private/overlays/useModal.cjs.map +1 -1
  728. package/dist/private/overlays/useModal.js.map +1 -1
  729. package/dist/private/overlays/useModal.mjs.map +1 -1
  730. package/dist/private/overlays/useModalOverlay.cjs.map +1 -1
  731. package/dist/private/overlays/useModalOverlay.js.map +1 -1
  732. package/dist/private/overlays/useModalOverlay.mjs.map +1 -1
  733. package/dist/private/overlays/useOverlay.cjs.map +1 -1
  734. package/dist/private/overlays/useOverlay.js.map +1 -1
  735. package/dist/private/overlays/useOverlay.mjs.map +1 -1
  736. package/dist/private/overlays/useOverlayPosition.cjs +3 -2
  737. package/dist/private/overlays/useOverlayPosition.cjs.map +1 -1
  738. package/dist/private/overlays/useOverlayPosition.js +3 -2
  739. package/dist/private/overlays/useOverlayPosition.js.map +1 -1
  740. package/dist/private/overlays/useOverlayPosition.mjs +3 -2
  741. package/dist/private/overlays/useOverlayPosition.mjs.map +1 -1
  742. package/dist/private/overlays/useOverlayTrigger.cjs.map +1 -1
  743. package/dist/private/overlays/useOverlayTrigger.js.map +1 -1
  744. package/dist/private/overlays/useOverlayTrigger.mjs.map +1 -1
  745. package/dist/private/overlays/usePopover.cjs.map +1 -1
  746. package/dist/private/overlays/usePopover.js.map +1 -1
  747. package/dist/private/overlays/usePopover.mjs.map +1 -1
  748. package/dist/private/overlays/usePreventScroll.cjs.map +1 -1
  749. package/dist/private/overlays/usePreventScroll.js.map +1 -1
  750. package/dist/private/overlays/usePreventScroll.mjs.map +1 -1
  751. package/dist/private/progress/useProgressBar.cjs.map +1 -1
  752. package/dist/private/progress/useProgressBar.js.map +1 -1
  753. package/dist/private/progress/useProgressBar.mjs.map +1 -1
  754. package/dist/private/radio/useRadio.cjs +5 -0
  755. package/dist/private/radio/useRadio.cjs.map +1 -1
  756. package/dist/private/radio/useRadio.js +5 -0
  757. package/dist/private/radio/useRadio.js.map +1 -1
  758. package/dist/private/radio/useRadio.mjs +5 -0
  759. package/dist/private/radio/useRadio.mjs.map +1 -1
  760. package/dist/private/radio/useRadioGroup.cjs.map +1 -1
  761. package/dist/private/radio/useRadioGroup.js.map +1 -1
  762. package/dist/private/radio/useRadioGroup.mjs.map +1 -1
  763. package/dist/private/radio/utils.cjs.map +1 -1
  764. package/dist/private/radio/utils.js.map +1 -1
  765. package/dist/private/radio/utils.mjs.map +1 -1
  766. package/dist/private/searchfield/useSearchField.cjs.map +1 -1
  767. package/dist/private/searchfield/useSearchField.js.map +1 -1
  768. package/dist/private/searchfield/useSearchField.mjs.map +1 -1
  769. package/dist/private/select/HiddenSelect.cjs +2 -1
  770. package/dist/private/select/HiddenSelect.cjs.map +1 -1
  771. package/dist/private/select/HiddenSelect.js +2 -1
  772. package/dist/private/select/HiddenSelect.js.map +1 -1
  773. package/dist/private/select/HiddenSelect.mjs +2 -1
  774. package/dist/private/select/HiddenSelect.mjs.map +1 -1
  775. package/dist/private/select/useSelect.cjs +3 -4
  776. package/dist/private/select/useSelect.cjs.map +1 -1
  777. package/dist/private/select/useSelect.js +3 -4
  778. package/dist/private/select/useSelect.js.map +1 -1
  779. package/dist/private/select/useSelect.mjs +3 -4
  780. package/dist/private/select/useSelect.mjs.map +1 -1
  781. package/dist/private/selection/ListKeyboardDelegate.cjs +56 -28
  782. package/dist/private/selection/ListKeyboardDelegate.cjs.map +1 -1
  783. package/dist/private/selection/ListKeyboardDelegate.js +57 -29
  784. package/dist/private/selection/ListKeyboardDelegate.js.map +1 -1
  785. package/dist/private/selection/ListKeyboardDelegate.mjs +56 -28
  786. package/dist/private/selection/ListKeyboardDelegate.mjs.map +1 -1
  787. package/dist/private/selection/useSelectableCollection.cjs +21 -14
  788. package/dist/private/selection/useSelectableCollection.cjs.map +1 -1
  789. package/dist/private/selection/useSelectableCollection.js +27 -19
  790. package/dist/private/selection/useSelectableCollection.js.map +1 -1
  791. package/dist/private/selection/useSelectableCollection.mjs +21 -14
  792. package/dist/private/selection/useSelectableCollection.mjs.map +1 -1
  793. package/dist/private/selection/useSelectableItem.cjs.map +1 -1
  794. package/dist/private/selection/useSelectableItem.js.map +1 -1
  795. package/dist/private/selection/useSelectableItem.mjs.map +1 -1
  796. package/dist/private/selection/useSelectableList.cjs.map +1 -1
  797. package/dist/private/selection/useSelectableList.js.map +1 -1
  798. package/dist/private/selection/useSelectableList.mjs.map +1 -1
  799. package/dist/private/selection/useTypeSelect.cjs +50 -18
  800. package/dist/private/selection/useTypeSelect.cjs.map +1 -1
  801. package/dist/private/selection/useTypeSelect.js +51 -19
  802. package/dist/private/selection/useTypeSelect.js.map +1 -1
  803. package/dist/private/selection/useTypeSelect.mjs +51 -19
  804. package/dist/private/selection/useTypeSelect.mjs.map +1 -1
  805. package/dist/private/selection/utils.cjs.map +1 -1
  806. package/dist/private/selection/utils.js.map +1 -1
  807. package/dist/private/selection/utils.mjs.map +1 -1
  808. package/dist/private/separator/useSeparator.cjs.map +1 -1
  809. package/dist/private/separator/useSeparator.js.map +1 -1
  810. package/dist/private/separator/useSeparator.mjs.map +1 -1
  811. package/dist/private/slider/useSlider.cjs +4 -2
  812. package/dist/private/slider/useSlider.cjs.map +1 -1
  813. package/dist/private/slider/useSlider.js +4 -2
  814. package/dist/private/slider/useSlider.js.map +1 -1
  815. package/dist/private/slider/useSlider.mjs +4 -2
  816. package/dist/private/slider/useSlider.mjs.map +1 -1
  817. package/dist/private/slider/useSliderThumb.cjs.map +1 -1
  818. package/dist/private/slider/useSliderThumb.js.map +1 -1
  819. package/dist/private/slider/useSliderThumb.mjs.map +1 -1
  820. package/dist/private/slider/utils.cjs.map +1 -1
  821. package/dist/private/slider/utils.js.map +1 -1
  822. package/dist/private/slider/utils.mjs.map +1 -1
  823. package/dist/private/spinbutton/useSpinButton.cjs +2 -0
  824. package/dist/private/spinbutton/useSpinButton.cjs.map +1 -1
  825. package/dist/private/spinbutton/useSpinButton.js +2 -0
  826. package/dist/private/spinbutton/useSpinButton.js.map +1 -1
  827. package/dist/private/spinbutton/useSpinButton.mjs +2 -0
  828. package/dist/private/spinbutton/useSpinButton.mjs.map +1 -1
  829. package/dist/private/ssr/SSRProvider.cjs +6 -6
  830. package/dist/private/ssr/SSRProvider.cjs.map +1 -1
  831. package/dist/private/ssr/SSRProvider.js +6 -6
  832. package/dist/private/ssr/SSRProvider.js.map +1 -1
  833. package/dist/private/ssr/SSRProvider.mjs +6 -6
  834. package/dist/private/ssr/SSRProvider.mjs.map +1 -1
  835. package/dist/private/steplist/useStepList.cjs.map +1 -1
  836. package/dist/private/steplist/useStepList.js.map +1 -1
  837. package/dist/private/steplist/useStepList.mjs.map +1 -1
  838. package/dist/private/steplist/useStepListItem.cjs.map +1 -1
  839. package/dist/private/steplist/useStepListItem.js.map +1 -1
  840. package/dist/private/steplist/useStepListItem.mjs.map +1 -1
  841. package/dist/private/switch/useSwitch.cjs +2 -4
  842. package/dist/private/switch/useSwitch.cjs.map +1 -1
  843. package/dist/private/switch/useSwitch.js +2 -4
  844. package/dist/private/switch/useSwitch.js.map +1 -1
  845. package/dist/private/switch/useSwitch.mjs +2 -4
  846. package/dist/private/switch/useSwitch.mjs.map +1 -1
  847. package/dist/private/table/TableKeyboardDelegate.cjs +4 -4
  848. package/dist/private/table/TableKeyboardDelegate.cjs.map +1 -1
  849. package/dist/private/table/TableKeyboardDelegate.js +4 -4
  850. package/dist/private/table/TableKeyboardDelegate.js.map +1 -1
  851. package/dist/private/table/TableKeyboardDelegate.mjs +4 -4
  852. package/dist/private/table/TableKeyboardDelegate.mjs.map +1 -1
  853. package/dist/private/table/useTable.cjs.map +1 -1
  854. package/dist/private/table/useTable.js.map +1 -1
  855. package/dist/private/table/useTable.mjs.map +1 -1
  856. package/dist/private/table/useTableCell.cjs.map +1 -1
  857. package/dist/private/table/useTableCell.js.map +1 -1
  858. package/dist/private/table/useTableCell.mjs.map +1 -1
  859. package/dist/private/table/useTableColumnHeader.cjs.map +1 -1
  860. package/dist/private/table/useTableColumnHeader.js.map +1 -1
  861. package/dist/private/table/useTableColumnHeader.mjs.map +1 -1
  862. package/dist/private/table/useTableColumnResize.cjs +1 -1
  863. package/dist/private/table/useTableColumnResize.cjs.map +1 -1
  864. package/dist/private/table/useTableColumnResize.js +1 -1
  865. package/dist/private/table/useTableColumnResize.js.map +1 -1
  866. package/dist/private/table/useTableColumnResize.mjs +1 -1
  867. package/dist/private/table/useTableColumnResize.mjs.map +1 -1
  868. package/dist/private/table/useTableHeaderRow.cjs +2 -1
  869. package/dist/private/table/useTableHeaderRow.cjs.map +1 -1
  870. package/dist/private/table/useTableHeaderRow.js +2 -1
  871. package/dist/private/table/useTableHeaderRow.js.map +1 -1
  872. package/dist/private/table/useTableHeaderRow.mjs +2 -1
  873. package/dist/private/table/useTableHeaderRow.mjs.map +1 -1
  874. package/dist/private/table/useTableRow.cjs +2 -2
  875. package/dist/private/table/useTableRow.cjs.map +1 -1
  876. package/dist/private/table/useTableRow.js +2 -2
  877. package/dist/private/table/useTableRow.js.map +1 -1
  878. package/dist/private/table/useTableRow.mjs +2 -2
  879. package/dist/private/table/useTableRow.mjs.map +1 -1
  880. package/dist/private/table/useTableSelectionCheckbox.cjs.map +1 -1
  881. package/dist/private/table/useTableSelectionCheckbox.js.map +1 -1
  882. package/dist/private/table/useTableSelectionCheckbox.mjs.map +1 -1
  883. package/dist/private/table/utils.cjs.map +1 -1
  884. package/dist/private/table/utils.js.map +1 -1
  885. package/dist/private/table/utils.mjs.map +1 -1
  886. package/dist/private/tabs/TabsKeyboardDelegate.cjs +2 -2
  887. package/dist/private/tabs/TabsKeyboardDelegate.cjs.map +1 -1
  888. package/dist/private/tabs/TabsKeyboardDelegate.js +2 -2
  889. package/dist/private/tabs/TabsKeyboardDelegate.js.map +1 -1
  890. package/dist/private/tabs/TabsKeyboardDelegate.mjs +2 -2
  891. package/dist/private/tabs/TabsKeyboardDelegate.mjs.map +1 -1
  892. package/dist/private/tabs/useTab.cjs.map +1 -1
  893. package/dist/private/tabs/useTab.js.map +1 -1
  894. package/dist/private/tabs/useTab.mjs.map +1 -1
  895. package/dist/private/tabs/useTabList.cjs +10 -10
  896. package/dist/private/tabs/useTabList.cjs.map +1 -1
  897. package/dist/private/tabs/useTabList.js +10 -10
  898. package/dist/private/tabs/useTabList.js.map +1 -1
  899. package/dist/private/tabs/useTabList.mjs +10 -10
  900. package/dist/private/tabs/useTabList.mjs.map +1 -1
  901. package/dist/private/tabs/useTabPanel.cjs.map +1 -1
  902. package/dist/private/tabs/useTabPanel.js.map +1 -1
  903. package/dist/private/tabs/useTabPanel.mjs.map +1 -1
  904. package/dist/private/tabs/utils.cjs.map +1 -1
  905. package/dist/private/tabs/utils.js.map +1 -1
  906. package/dist/private/tabs/utils.mjs.map +1 -1
  907. package/dist/private/tag/useTag.cjs.map +1 -1
  908. package/dist/private/tag/useTag.js.map +1 -1
  909. package/dist/private/tag/useTag.mjs.map +1 -1
  910. package/dist/private/tag/useTagGroup.cjs.map +1 -1
  911. package/dist/private/tag/useTagGroup.js.map +1 -1
  912. package/dist/private/tag/useTagGroup.mjs.map +1 -1
  913. package/dist/private/textfield/useFormattedTextField.cjs.map +1 -1
  914. package/dist/private/textfield/useFormattedTextField.js.map +1 -1
  915. package/dist/private/textfield/useFormattedTextField.mjs.map +1 -1
  916. package/dist/private/textfield/useTextField.cjs.map +1 -1
  917. package/dist/private/textfield/useTextField.js.map +1 -1
  918. package/dist/private/textfield/useTextField.mjs.map +1 -1
  919. package/dist/private/toast/useToast.cjs +2 -1
  920. package/dist/private/toast/useToast.cjs.map +1 -1
  921. package/dist/private/toast/useToast.js +2 -1
  922. package/dist/private/toast/useToast.js.map +1 -1
  923. package/dist/private/toast/useToast.mjs +2 -1
  924. package/dist/private/toast/useToast.mjs.map +1 -1
  925. package/dist/private/toast/useToastRegion.cjs.map +1 -1
  926. package/dist/private/toast/useToastRegion.js.map +1 -1
  927. package/dist/private/toast/useToastRegion.mjs.map +1 -1
  928. package/dist/private/toggle/useToggle.cjs +70 -8
  929. package/dist/private/toggle/useToggle.cjs.map +1 -1
  930. package/dist/private/toggle/useToggle.js +70 -8
  931. package/dist/private/toggle/useToggle.js.map +1 -1
  932. package/dist/private/toggle/useToggle.mjs +70 -8
  933. package/dist/private/toggle/useToggle.mjs.map +1 -1
  934. package/dist/private/toolbar/useToolbar.cjs +0 -1
  935. package/dist/private/toolbar/useToolbar.cjs.map +1 -1
  936. package/dist/private/toolbar/useToolbar.js +0 -1
  937. package/dist/private/toolbar/useToolbar.js.map +1 -1
  938. package/dist/private/toolbar/useToolbar.mjs +0 -1
  939. package/dist/private/toolbar/useToolbar.mjs.map +1 -1
  940. package/dist/private/tooltip/useTooltip.cjs.map +1 -1
  941. package/dist/private/tooltip/useTooltip.js.map +1 -1
  942. package/dist/private/tooltip/useTooltip.mjs.map +1 -1
  943. package/dist/private/tooltip/useTooltipTrigger.cjs.map +1 -1
  944. package/dist/private/tooltip/useTooltipTrigger.js.map +1 -1
  945. package/dist/private/tooltip/useTooltipTrigger.mjs.map +1 -1
  946. package/dist/private/tree/useTree.cjs.map +1 -1
  947. package/dist/private/tree/useTree.js.map +1 -1
  948. package/dist/private/tree/useTree.mjs.map +1 -1
  949. package/dist/private/tree/useTreeItem.cjs.map +1 -1
  950. package/dist/private/tree/useTreeItem.js.map +1 -1
  951. package/dist/private/tree/useTreeItem.mjs.map +1 -1
  952. package/dist/private/utils/animation.cjs.map +1 -1
  953. package/dist/private/utils/animation.js.map +1 -1
  954. package/dist/private/utils/animation.mjs.map +1 -1
  955. package/dist/private/utils/domHelpers.cjs +2 -1
  956. package/dist/private/utils/domHelpers.cjs.map +1 -1
  957. package/dist/private/utils/domHelpers.js +2 -1
  958. package/dist/private/utils/domHelpers.js.map +1 -1
  959. package/dist/private/utils/domHelpers.mjs +2 -1
  960. package/dist/private/utils/domHelpers.mjs.map +1 -1
  961. package/dist/private/utils/filterDOMProps.cjs.map +1 -1
  962. package/dist/private/utils/filterDOMProps.js.map +1 -1
  963. package/dist/private/utils/filterDOMProps.mjs.map +1 -1
  964. package/dist/private/utils/focusWithoutScrolling.cjs.map +1 -1
  965. package/dist/private/utils/focusWithoutScrolling.js.map +1 -1
  966. package/dist/private/utils/focusWithoutScrolling.mjs.map +1 -1
  967. package/dist/private/utils/getNonce.cjs.map +1 -1
  968. package/dist/private/utils/getNonce.js.map +1 -1
  969. package/dist/private/utils/getNonce.mjs.map +1 -1
  970. package/dist/private/utils/getOffset.cjs.map +1 -1
  971. package/dist/private/utils/getOffset.js.map +1 -1
  972. package/dist/private/utils/getOffset.mjs.map +1 -1
  973. package/dist/private/utils/getScrollParent.cjs.map +1 -1
  974. package/dist/private/utils/getScrollParent.js.map +1 -1
  975. package/dist/private/utils/getScrollParent.mjs.map +1 -1
  976. package/dist/private/utils/getScrollParents.cjs +3 -2
  977. package/dist/private/utils/getScrollParents.cjs.map +1 -1
  978. package/dist/private/utils/getScrollParents.js +3 -2
  979. package/dist/private/utils/getScrollParents.js.map +1 -1
  980. package/dist/private/utils/getScrollParents.mjs +3 -2
  981. package/dist/private/utils/getScrollParents.mjs.map +1 -1
  982. package/dist/private/utils/isElementVisible.cjs +1 -1
  983. package/dist/private/utils/isElementVisible.cjs.map +1 -1
  984. package/dist/private/utils/isElementVisible.js +1 -1
  985. package/dist/private/utils/isElementVisible.js.map +1 -1
  986. package/dist/private/utils/isElementVisible.mjs +1 -1
  987. package/dist/private/utils/isElementVisible.mjs.map +1 -1
  988. package/dist/private/utils/isFocusable.cjs +3 -1
  989. package/dist/private/utils/isFocusable.cjs.map +1 -1
  990. package/dist/private/utils/isFocusable.js +3 -1
  991. package/dist/private/utils/isFocusable.js.map +1 -1
  992. package/dist/private/utils/isFocusable.mjs +3 -1
  993. package/dist/private/utils/isFocusable.mjs.map +1 -1
  994. package/dist/private/utils/isVirtualEvent.cjs.map +1 -1
  995. package/dist/private/utils/isVirtualEvent.js.map +1 -1
  996. package/dist/private/utils/isVirtualEvent.mjs.map +1 -1
  997. package/dist/private/utils/keyboard.cjs.map +1 -1
  998. package/dist/private/utils/keyboard.js.map +1 -1
  999. package/dist/private/utils/keyboard.mjs.map +1 -1
  1000. package/dist/private/utils/mergeProps.cjs.map +1 -1
  1001. package/dist/private/utils/mergeProps.js.map +1 -1
  1002. package/dist/private/utils/mergeProps.mjs.map +1 -1
  1003. package/dist/private/utils/mergeRefs.cjs.map +1 -1
  1004. package/dist/private/utils/mergeRefs.js.map +1 -1
  1005. package/dist/private/utils/mergeRefs.mjs.map +1 -1
  1006. package/dist/private/utils/openLink.cjs +12 -8
  1007. package/dist/private/utils/openLink.cjs.map +1 -1
  1008. package/dist/private/utils/openLink.js +12 -8
  1009. package/dist/private/utils/openLink.js.map +1 -1
  1010. package/dist/private/utils/openLink.mjs +12 -8
  1011. package/dist/private/utils/openLink.mjs.map +1 -1
  1012. package/dist/private/utils/platform.cjs.map +1 -1
  1013. package/dist/private/utils/platform.js.map +1 -1
  1014. package/dist/private/utils/platform.mjs.map +1 -1
  1015. package/dist/private/utils/scrollIntoView.cjs +21 -18
  1016. package/dist/private/utils/scrollIntoView.cjs.map +1 -1
  1017. package/dist/private/utils/scrollIntoView.js +21 -18
  1018. package/dist/private/utils/scrollIntoView.js.map +1 -1
  1019. package/dist/private/utils/scrollIntoView.mjs +21 -18
  1020. package/dist/private/utils/scrollIntoView.mjs.map +1 -1
  1021. package/dist/private/utils/shadowdom/DOMFunctions.cjs.map +1 -1
  1022. package/dist/private/utils/shadowdom/DOMFunctions.js.map +1 -1
  1023. package/dist/private/utils/shadowdom/DOMFunctions.mjs.map +1 -1
  1024. package/dist/private/utils/shadowdom/ShadowTreeWalker.cjs +6 -6
  1025. package/dist/private/utils/shadowdom/ShadowTreeWalker.cjs.map +1 -1
  1026. package/dist/private/utils/shadowdom/ShadowTreeWalker.js +6 -6
  1027. package/dist/private/utils/shadowdom/ShadowTreeWalker.js.map +1 -1
  1028. package/dist/private/utils/shadowdom/ShadowTreeWalker.mjs +6 -6
  1029. package/dist/private/utils/shadowdom/ShadowTreeWalker.mjs.map +1 -1
  1030. package/dist/private/utils/useDeepMemo.cjs +1 -1
  1031. package/dist/private/utils/useDeepMemo.cjs.map +1 -1
  1032. package/dist/private/utils/useDeepMemo.js +1 -1
  1033. package/dist/private/utils/useDeepMemo.js.map +1 -1
  1034. package/dist/private/utils/useDeepMemo.mjs +1 -1
  1035. package/dist/private/utils/useDeepMemo.mjs.map +1 -1
  1036. package/dist/private/utils/useDescription.cjs.map +1 -1
  1037. package/dist/private/utils/useDescription.js.map +1 -1
  1038. package/dist/private/utils/useDescription.mjs.map +1 -1
  1039. package/dist/private/utils/useDrag1D.cjs +1 -1
  1040. package/dist/private/utils/useDrag1D.cjs.map +1 -1
  1041. package/dist/private/utils/useDrag1D.js +1 -1
  1042. package/dist/private/utils/useDrag1D.js.map +1 -1
  1043. package/dist/private/utils/useDrag1D.mjs +1 -1
  1044. package/dist/private/utils/useDrag1D.mjs.map +1 -1
  1045. package/dist/private/utils/useFormReset.cjs.map +1 -1
  1046. package/dist/private/utils/useFormReset.js.map +1 -1
  1047. package/dist/private/utils/useFormReset.mjs.map +1 -1
  1048. package/dist/private/utils/useGlobalListeners.cjs.map +1 -1
  1049. package/dist/private/utils/useGlobalListeners.js.map +1 -1
  1050. package/dist/private/utils/useGlobalListeners.mjs.map +1 -1
  1051. package/dist/private/utils/useId.cjs.map +1 -1
  1052. package/dist/private/utils/useId.js.map +1 -1
  1053. package/dist/private/utils/useId.mjs.map +1 -1
  1054. package/dist/private/utils/useLabels.cjs.map +1 -1
  1055. package/dist/private/utils/useLabels.js.map +1 -1
  1056. package/dist/private/utils/useLabels.mjs.map +1 -1
  1057. package/dist/private/utils/useLayoutEffect.cjs.map +1 -1
  1058. package/dist/private/utils/useLayoutEffect.js.map +1 -1
  1059. package/dist/private/utils/useLayoutEffect.mjs.map +1 -1
  1060. package/dist/private/utils/useLoadMore.cjs.map +1 -1
  1061. package/dist/private/utils/useLoadMore.js.map +1 -1
  1062. package/dist/private/utils/useLoadMore.mjs.map +1 -1
  1063. package/dist/private/utils/useLoadMoreSentinel.cjs.map +1 -1
  1064. package/dist/private/utils/useLoadMoreSentinel.js.map +1 -1
  1065. package/dist/private/utils/useLoadMoreSentinel.mjs.map +1 -1
  1066. package/dist/private/utils/useObjectRef.cjs.map +1 -1
  1067. package/dist/private/utils/useObjectRef.js.map +1 -1
  1068. package/dist/private/utils/useObjectRef.mjs.map +1 -1
  1069. package/dist/private/utils/useResizeObserver.cjs.map +1 -1
  1070. package/dist/private/utils/useResizeObserver.js.map +1 -1
  1071. package/dist/private/utils/useResizeObserver.mjs.map +1 -1
  1072. package/dist/private/utils/useSlot.cjs +54 -0
  1073. package/dist/private/utils/useSlot.cjs.map +1 -0
  1074. package/dist/private/utils/useSlot.js +49 -0
  1075. package/dist/private/utils/useSlot.js.map +1 -0
  1076. package/dist/private/utils/useSlot.mjs +49 -0
  1077. package/dist/private/utils/useSlot.mjs.map +1 -0
  1078. package/dist/private/utils/useSyncRef.cjs +2 -1
  1079. package/dist/private/utils/useSyncRef.cjs.map +1 -1
  1080. package/dist/private/utils/useSyncRef.js +2 -1
  1081. package/dist/private/utils/useSyncRef.js.map +1 -1
  1082. package/dist/private/utils/useSyncRef.mjs +2 -1
  1083. package/dist/private/utils/useSyncRef.mjs.map +1 -1
  1084. package/dist/private/utils/useUpdateEffect.cjs.map +1 -1
  1085. package/dist/private/utils/useUpdateEffect.js.map +1 -1
  1086. package/dist/private/utils/useUpdateEffect.mjs.map +1 -1
  1087. package/dist/private/utils/useValueEffect.cjs.map +1 -1
  1088. package/dist/private/utils/useValueEffect.js.map +1 -1
  1089. package/dist/private/utils/useValueEffect.mjs.map +1 -1
  1090. package/dist/private/utils/useViewportSize.cjs +3 -1
  1091. package/dist/private/utils/useViewportSize.cjs.map +1 -1
  1092. package/dist/private/utils/useViewportSize.js +3 -1
  1093. package/dist/private/utils/useViewportSize.js.map +1 -1
  1094. package/dist/private/utils/useViewportSize.mjs +3 -1
  1095. package/dist/private/utils/useViewportSize.mjs.map +1 -1
  1096. package/dist/private/virtualizer/ScrollView.cjs +2 -2
  1097. package/dist/private/virtualizer/ScrollView.cjs.map +1 -1
  1098. package/dist/private/virtualizer/ScrollView.js +2 -2
  1099. package/dist/private/virtualizer/ScrollView.js.map +1 -1
  1100. package/dist/private/virtualizer/ScrollView.mjs +2 -2
  1101. package/dist/private/virtualizer/ScrollView.mjs.map +1 -1
  1102. package/dist/private/virtualizer/Virtualizer.cjs.map +1 -1
  1103. package/dist/private/virtualizer/Virtualizer.js.map +1 -1
  1104. package/dist/private/virtualizer/Virtualizer.mjs.map +1 -1
  1105. package/dist/private/virtualizer/VirtualizerItem.cjs.map +1 -1
  1106. package/dist/private/virtualizer/VirtualizerItem.js.map +1 -1
  1107. package/dist/private/virtualizer/VirtualizerItem.mjs.map +1 -1
  1108. package/dist/private/virtualizer/useVirtualizerItem.cjs.map +1 -1
  1109. package/dist/private/virtualizer/useVirtualizerItem.js.map +1 -1
  1110. package/dist/private/virtualizer/useVirtualizerItem.mjs.map +1 -1
  1111. package/dist/private/virtualizer/utils.cjs.map +1 -1
  1112. package/dist/private/virtualizer/utils.js.map +1 -1
  1113. package/dist/private/virtualizer/utils.mjs.map +1 -1
  1114. package/dist/private/visually-hidden/VisuallyHidden.cjs.map +1 -1
  1115. package/dist/private/visually-hidden/VisuallyHidden.js.map +1 -1
  1116. package/dist/private/visually-hidden/VisuallyHidden.mjs.map +1 -1
  1117. package/dist/types/exports/index.d.ts +7 -0
  1118. package/dist/types/exports/useCalendar.d.ts +6 -0
  1119. package/dist/types/exports/useRangeCalendar.d.ts +11 -0
  1120. package/dist/types/src/actiongroup/useActionGroup.d.ts +5 -1
  1121. package/dist/types/src/aria-modal-polyfill/ariaModalPolyfill.d.ts +2 -1
  1122. package/dist/types/src/autocomplete/useAutocomplete.d.ts +21 -9
  1123. package/dist/types/src/autocomplete/useSearchAutocomplete.d.ts +15 -8
  1124. package/dist/types/src/breadcrumbs/useBreadcrumbItem.d.ts +2 -0
  1125. package/dist/types/src/button/useButton.d.ts +25 -7
  1126. package/dist/types/src/button/useToggleButtonGroup.d.ts +1 -0
  1127. package/dist/types/src/calendar/useCalendar.d.ts +3 -3
  1128. package/dist/types/src/calendar/useCalendarBase.d.ts +2 -2
  1129. package/dist/types/src/calendar/useCalendarCell.d.ts +9 -8
  1130. package/dist/types/src/calendar/useCalendarGrid.d.ts +8 -4
  1131. package/dist/types/src/calendar/useCalendarHeading.d.ts +22 -0
  1132. package/dist/types/src/calendar/useCalendarMonthPicker.d.ts +22 -0
  1133. package/dist/types/src/calendar/useCalendarYearPicker.d.ts +32 -0
  1134. package/dist/types/src/calendar/useRangeCalendar.d.ts +5 -5
  1135. package/dist/types/src/calendar/utils.d.ts +3 -3
  1136. package/dist/types/src/checkbox/useCheckbox.d.ts +6 -1
  1137. package/dist/types/src/checkbox/useCheckboxGroup.d.ts +1 -0
  1138. package/dist/types/src/checkbox/useCheckboxGroupItem.d.ts +3 -2
  1139. package/dist/types/src/collections/CollectionBuilder.d.ts +8 -7
  1140. package/dist/types/src/collections/useCachedChildren.d.ts +1 -1
  1141. package/dist/types/src/color/useColorArea.d.ts +7 -4
  1142. package/dist/types/src/color/useColorChannelField.d.ts +2 -2
  1143. package/dist/types/src/combobox/useComboBox.d.ts +5 -3
  1144. package/dist/types/src/datepicker/useDateField.d.ts +2 -1
  1145. package/dist/types/src/datepicker/useDatePicker.d.ts +5 -3
  1146. package/dist/types/src/dialog/useDialog.d.ts +1 -0
  1147. package/dist/types/src/disclosure/useDisclosure.d.ts +1 -0
  1148. package/dist/types/src/dnd/ListDropTargetDelegate.d.ts +3 -0
  1149. package/dist/types/src/dnd/useDrag.d.ts +11 -4
  1150. package/dist/types/src/dnd/useDraggableCollection.d.ts +2 -2
  1151. package/dist/types/src/dnd/useDraggableItem.d.ts +7 -6
  1152. package/dist/types/src/dnd/useDrop.d.ts +5 -4
  1153. package/dist/types/src/dnd/useDroppableCollection.d.ts +2 -2
  1154. package/dist/types/src/dnd/utils.d.ts +3 -3
  1155. package/dist/types/src/focus/FocusRing.d.ts +1 -0
  1156. package/dist/types/src/focus/useFocusRing.d.ts +1 -0
  1157. package/dist/types/src/focus/useHasTabbableChild.d.ts +1 -0
  1158. package/dist/types/src/grid/GridKeyboardDelegate.d.ts +8 -4
  1159. package/dist/types/src/grid/useGrid.d.ts +12 -4
  1160. package/dist/types/src/grid/useGridCell.d.ts +11 -3
  1161. package/dist/types/src/grid/useGridRow.d.ts +7 -2
  1162. package/dist/types/src/grid/useGridSelectionAnnouncement.d.ts +3 -1
  1163. package/dist/types/src/grid/useGridSelectionCheckbox.d.ts +1 -0
  1164. package/dist/types/src/grid/useHighlightSelectionDescription.d.ts +1 -0
  1165. package/dist/types/src/gridlist/useGridList.d.ts +20 -5
  1166. package/dist/types/src/gridlist/useGridListItem.d.ts +5 -1
  1167. package/dist/types/src/gridlist/useGridListSection.d.ts +1 -0
  1168. package/dist/types/src/gridlist/useGridListSelectionCheckbox.d.ts +1 -0
  1169. package/dist/types/src/i18n/useCollator.d.ts +3 -2
  1170. package/dist/types/src/i18n/useDateFormatter.d.ts +3 -2
  1171. package/dist/types/src/i18n/useFilter.d.ts +3 -2
  1172. package/dist/types/src/i18n/useListFormatter.d.ts +3 -2
  1173. package/dist/types/src/i18n/useLocalizedStringFormatter.d.ts +3 -1
  1174. package/dist/types/src/i18n/useNumberFormatter.d.ts +3 -2
  1175. package/dist/types/src/i18n/utils.d.ts +2 -1
  1176. package/dist/types/src/interactions/createEventHandler.d.ts +2 -1
  1177. package/dist/types/src/interactions/useFocusVisible.d.ts +11 -9
  1178. package/dist/types/src/interactions/useLongPress.d.ts +3 -2
  1179. package/dist/types/src/interactions/utils.d.ts +4 -3
  1180. package/dist/types/src/label/useField.d.ts +3 -2
  1181. package/dist/types/src/label/useLabel.d.ts +2 -0
  1182. package/dist/types/src/landmark/useLandmark.d.ts +4 -1
  1183. package/dist/types/src/link/useLink.d.ts +1 -0
  1184. package/dist/types/src/listbox/useListBox.d.ts +8 -3
  1185. package/dist/types/src/listbox/useListBoxSection.d.ts +1 -0
  1186. package/dist/types/src/listbox/useOption.d.ts +7 -0
  1187. package/dist/types/src/menu/useMenu.d.ts +3 -1
  1188. package/dist/types/src/menu/useMenuItem.d.ts +10 -1
  1189. package/dist/types/src/menu/useMenuSection.d.ts +1 -0
  1190. package/dist/types/src/menu/useMenuTrigger.d.ts +1 -0
  1191. package/dist/types/src/menu/useSafelyMouseToSubmenu.d.ts +3 -2
  1192. package/dist/types/src/menu/useSubmenuTrigger.d.ts +7 -2
  1193. package/dist/types/src/menu/utils.d.ts +1 -1
  1194. package/dist/types/src/numberfield/useNumberField.d.ts +11 -4
  1195. package/dist/types/src/overlays/Overlay.d.ts +1 -0
  1196. package/dist/types/src/overlays/PortalProvider.d.ts +4 -1
  1197. package/dist/types/src/overlays/ariaHideOutside.d.ts +1 -0
  1198. package/dist/types/src/overlays/calculatePosition.d.ts +3 -1
  1199. package/dist/types/src/overlays/useModal.d.ts +8 -7
  1200. package/dist/types/src/overlays/useModalOverlay.d.ts +2 -0
  1201. package/dist/types/src/overlays/useOverlay.d.ts +2 -0
  1202. package/dist/types/src/overlays/useOverlayPosition.d.ts +18 -0
  1203. package/dist/types/src/progress/useProgressBar.d.ts +5 -1
  1204. package/dist/types/src/radio/useRadio.d.ts +4 -1
  1205. package/dist/types/src/radio/useRadioGroup.d.ts +1 -0
  1206. package/dist/types/src/searchfield/useSearchField.d.ts +7 -2
  1207. package/dist/types/src/select/HiddenSelect.d.ts +2 -1
  1208. package/dist/types/src/select/useSelect.d.ts +3 -1
  1209. package/dist/types/src/selection/ListKeyboardDelegate.d.ts +19 -6
  1210. package/dist/types/src/selection/useSelectableCollection.d.ts +17 -2
  1211. package/dist/types/src/selection/useSelectableItem.d.ts +9 -7
  1212. package/dist/types/src/selection/useSelectableList.d.ts +5 -2
  1213. package/dist/types/src/separator/useSeparator.d.ts +1 -0
  1214. package/dist/types/src/slider/useSlider.d.ts +5 -4
  1215. package/dist/types/src/slider/useSliderThumb.d.ts +3 -1
  1216. package/dist/types/src/switch/useSwitch.d.ts +14 -27
  1217. package/dist/types/src/table/TableKeyboardDelegate.d.ts +6 -2
  1218. package/dist/types/src/table/useTable.d.ts +8 -4
  1219. package/dist/types/src/table/useTableCell.d.ts +7 -2
  1220. package/dist/types/src/table/useTableColumnHeader.d.ts +9 -2
  1221. package/dist/types/src/table/useTableColumnResize.d.ts +12 -6
  1222. package/dist/types/src/table/useTableHeaderRow.d.ts +1 -0
  1223. package/dist/types/src/table/useTableRow.d.ts +1 -0
  1224. package/dist/types/src/table/useTableSelectionCheckbox.d.ts +2 -0
  1225. package/dist/types/src/tabs/useTabList.d.ts +2 -0
  1226. package/dist/types/src/tabs/useTabPanel.d.ts +2 -2
  1227. package/dist/types/src/tag/useTag.d.ts +1 -0
  1228. package/dist/types/src/tag/useTagGroup.d.ts +7 -3
  1229. package/dist/types/src/textfield/useTextField.d.ts +26 -11
  1230. package/dist/types/src/toast/useToast.d.ts +2 -2
  1231. package/dist/types/src/toast/useToastRegion.d.ts +5 -3
  1232. package/dist/types/src/toggle/useToggle.d.ts +8 -3
  1233. package/dist/types/src/toolbar/useToolbar.d.ts +2 -0
  1234. package/dist/types/src/tree/useTree.d.ts +5 -3
  1235. package/dist/types/src/tree/useTreeItem.d.ts +5 -1
  1236. package/dist/types/src/utils/filterDOMProps.d.ts +1 -0
  1237. package/dist/types/src/utils/getNonce.d.ts +3 -2
  1238. package/dist/types/src/utils/isElementVisible.d.ts +1 -0
  1239. package/dist/types/src/utils/mergeProps.d.ts +3 -2
  1240. package/dist/types/src/utils/scrollIntoView.d.ts +5 -3
  1241. package/dist/types/src/utils/shadowdom/DOMFunctions.d.ts +1 -0
  1242. package/dist/types/src/utils/useId.d.ts +2 -0
  1243. package/dist/types/src/utils/useLabels.d.ts +1 -0
  1244. package/dist/types/src/utils/useLoadMore.d.ts +6 -4
  1245. package/dist/types/src/utils/useLoadMoreSentinel.d.ts +5 -3
  1246. package/dist/types/src/utils/useSlot.d.ts +8 -0
  1247. package/dist/types/src/visually-hidden/VisuallyHidden.d.ts +1 -0
  1248. package/package.json +10 -8
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA4HD,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,GACvB,GAAG;IACJ,IAAI,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,eAAO,EAAyB;IAE9D,IAAI,OAAO;QACT;QACA;QACA,WAAW,OAAO;QAClB,UAAU,OAAO;QACjB,UAAU;QACV,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,sCAAgB;IACvC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,QACF,UAAU,OAAO,GAAG,sCAAgB;IAExC,GAAG;QAAC;KAAO;IAEX,IAAI,iBAAiB,CAAA,GAAA,kBAAU,EAAE;QAC/B,IAAI,yBAAyB,SAAS,CAAC,UAAU,CAAC,WAAW,OAAO,IAAI,CAAC,UAAU,OAAO,IAA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ayPosition.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 = 'bottom' | 'bottom left' | 'bottom right' | 'bottom start' | 'bottom end' |\n 'top' | 'top left' | 'top right' | 'top start' | 'top end' |\n 'left' | 'left top' | 'left bottom' | 'start' | 'start top' | 'start bottom' |\n 'right' | 'right top' | 'right bottom' | 'end' | 'end top' | '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 * @default 'bottom'\n */\n placement?: Placement,\n /**\n * The placement padding that should be applied between the element and its\n * surrounding container.\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 * @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 * @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 * @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 * @default 0\n */\n arrowSize?: number,\n /**\n * Element that that serves as the positioning boundary.\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 * @default overlayRef\n */\n scrollRef?: RefObject<Element | null>,\n /**\n * Whether the overlay should update its position automatically.\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 * @default 0\n */\n arrowBoundaryOffset?: number\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 } = 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 (shouldUpdatePosition === false || !isOpen || !overlayRef.current || !targetRef.current || !boundaryElement) {\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 });\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(key => overlay.style[key] = (position.position!)[key] + 'px');\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;;;;;;;;;;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F,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 {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 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AA0BM,SAAS,0CAAkB,KAA0B,EAAE,KAA0B,EAAE,GAA+B;IACvH,IAAI,QAAC,IAAI,EAAC,GAAG;IACb,IAAI,UAAC,MAAM,EAAC,GAAG;IAEf,uGAAuG;IACvG,yCAAyC;IACzC,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,OAAO,IAAI,OAAO,EACpB,CAAA,GAAA,oCAAS,EAAE,GAAG,CAAC,IAAI,OAAO,EAAE,MAAM,KAAK;IAE3C;IAEA,6EAA6E;IAC7E,oDAAoD;IACpD,yEAAyE;IACzE,+CAA+C;IAC/C,IAAI,eAAgD;IACpD,IAAI,SAAS,QACX,eAAe;SACV,IAAI,SAAS,WAClB,eAAe;IAGjB,IAAI,YAAY,CAAA,GAAA,+BAAI;IACpB,OAAO;QACL,cAAc;YACZ,iBAAiB;YACjB,iBAAiB;YACjB,iBAAiB,SAAS,YAAY;YACtC,SAAS,MAAM,MAAM;QACvB;QACA,cAAc;YACZ,IAAI;QACN;IACF;AACF","sources":["packages/react-aria/src/overlays/useOverlayTrigger.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 {AriaButtonProps} from '../button/useButton';\nimport {DOMProps, RefObject} from '@react-types/shared';\nimport {onCloseMap} from './useCloseOnScroll';\nimport {OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {useEffect} from 'react';\nimport {useId} from '../utils/useId';\n\nexport interface OverlayTriggerProps {\n /** Type of overlay that is opened by the trigger. */\n type: 'dialog' | 'menu' | 'listbox' | 'tree' | 'grid'\n}\n\nexport interface OverlayTriggerAria {\n /** Props for the trigger element. */\n triggerProps: AriaButtonProps,\n\n /** Props for the overlay container element. */\n overlayProps: DOMProps\n}\n\n/**\n * Handles the behavior and accessibility for an overlay trigger, e.g. a button\n * that opens a popover, menu, or other overlay that is positioned relative to the trigger.\n */\nexport function useOverlayTrigger(props: OverlayTriggerProps, state: OverlayTriggerState, ref?: RefObject<Element | null>): OverlayTriggerAria {\n let {type} = props;\n let {isOpen} = state;\n\n // Backward compatibility. Share state close function with useOverlayPosition so it can close on scroll\n // without forcing users to pass onClose.\n useEffect(() => {\n if (ref && ref.current) {\n onCloseMap.set(ref.current, state.close);\n }\n });\n\n // Aria 1.1 supports multiple values for aria-haspopup other than just menus.\n // https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup\n // However, we only add it for menus for now because screen readers often\n // announce it as a menu even for other values.\n let ariaHasPopup: undefined | boolean | 'listbox' = undefined;\n if (type === 'menu') {\n ariaHasPopup = true;\n } else if (type === 'listbox') {\n ariaHasPopup = 'listbox';\n }\n\n let overlayId = useId();\n return {\n triggerProps: {\n 'aria-haspopup': ariaHasPopup,\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? overlayId : undefined,\n onPress: state.toggle\n },\n overlayProps: {\n id: overlayId\n }\n };\n}\n"],"names":[],"version":3,"file":"useOverlayTrigger.cjs.map"}
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AA0BM,SAAS,0CACd,KAA0B,EAC1B,KAA0B,EAC1B,GAA+B;IAE/B,IAAI,QAAC,IAAI,EAAC,GAAG;IACb,IAAI,UAAC,MAAM,EAAC,GAAG;IAEf,uGAAuG;IACvG,yCAAyC;IACzC,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,OAAO,IAAI,OAAO,EACpB,CAAA,GAAA,oCAAS,EAAE,GAAG,CAAC,IAAI,OAAO,EAAE,MAAM,KAAK;IAE3C;IAEA,6EAA6E;IAC7E,oDAAoD;IACpD,yEAAyE;IACzE,+CAA+C;IAC/C,IAAI,eAAgD;IACpD,IAAI,SAAS,QACX,eAAe;SACV,IAAI,SAAS,WAClB,eAAe;IAGjB,IAAI,YAAY,CAAA,GAAA,+BAAI;IACpB,OAAO;QACL,cAAc;YACZ,iBAAiB;YACjB,iBAAiB;YACjB,iBAAiB,SAAS,YAAY;YACtC,SAAS,MAAM,MAAM;QACvB;QACA,cAAc;YACZ,IAAI;QACN;IACF;AACF","sources":["packages/react-aria/src/overlays/useOverlayTrigger.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 {AriaButtonProps} from '../button/useButton';\nimport {DOMProps, RefObject} from '@react-types/shared';\nimport {onCloseMap} from './useCloseOnScroll';\nimport {OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {useEffect} from 'react';\nimport {useId} from '../utils/useId';\n\nexport interface OverlayTriggerProps {\n /** Type of overlay that is opened by the trigger. */\n type: 'dialog' | 'menu' | 'listbox' | 'tree' | 'grid';\n}\n\nexport interface OverlayTriggerAria {\n /** Props for the trigger element. */\n triggerProps: AriaButtonProps;\n\n /** Props for the overlay container element. */\n overlayProps: DOMProps;\n}\n\n/**\n * Handles the behavior and accessibility for an overlay trigger, e.g. a button\n * that opens a popover, menu, or other overlay that is positioned relative to the trigger.\n */\nexport function useOverlayTrigger(\n props: OverlayTriggerProps,\n state: OverlayTriggerState,\n ref?: RefObject<Element | null>\n): OverlayTriggerAria {\n let {type} = props;\n let {isOpen} = state;\n\n // Backward compatibility. Share state close function with useOverlayPosition so it can close on scroll\n // without forcing users to pass onClose.\n useEffect(() => {\n if (ref && ref.current) {\n onCloseMap.set(ref.current, state.close);\n }\n });\n\n // Aria 1.1 supports multiple values for aria-haspopup other than just menus.\n // https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup\n // However, we only add it for menus for now because screen readers often\n // announce it as a menu even for other values.\n let ariaHasPopup: undefined | boolean | 'listbox' = undefined;\n if (type === 'menu') {\n ariaHasPopup = true;\n } else if (type === 'listbox') {\n ariaHasPopup = 'listbox';\n }\n\n let overlayId = useId();\n return {\n triggerProps: {\n 'aria-haspopup': ariaHasPopup,\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? overlayId : undefined,\n onPress: state.toggle\n },\n overlayProps: {\n id: overlayId\n }\n };\n}\n"],"names":[],"version":3,"file":"useOverlayTrigger.cjs.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AA0BM,SAAS,0CAAkB,KAA0B,EAAE,KAA0B,EAAE,GAA+B;IACvH,IAAI,QAAC,IAAI,EAAC,GAAG;IACb,IAAI,UAAC,MAAM,EAAC,GAAG;IAEf,uGAAuG;IACvG,yCAAyC;IACzC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,OAAO,IAAI,OAAO,EACpB,CAAA,GAAA,yCAAS,EAAE,GAAG,CAAC,IAAI,OAAO,EAAE,MAAM,KAAK;IAE3C;IAEA,6EAA6E;IAC7E,oDAAoD;IACpD,yEAAyE;IACzE,+CAA+C;IAC/C,IAAI,eAAgD;IACpD,IAAI,SAAS,QACX,eAAe;SACV,IAAI,SAAS,WAClB,eAAe;IAGjB,IAAI,YAAY,CAAA,GAAA,yCAAI;IACpB,OAAO;QACL,cAAc;YACZ,iBAAiB;YACjB,iBAAiB;YACjB,iBAAiB,SAAS,YAAY;YACtC,SAAS,MAAM,MAAM;QACvB;QACA,cAAc;YACZ,IAAI;QACN;IACF;AACF","sources":["packages/react-aria/src/overlays/useOverlayTrigger.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 {AriaButtonProps} from '../button/useButton';\nimport {DOMProps, RefObject} from '@react-types/shared';\nimport {onCloseMap} from './useCloseOnScroll';\nimport {OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {useEffect} from 'react';\nimport {useId} from '../utils/useId';\n\nexport interface OverlayTriggerProps {\n /** Type of overlay that is opened by the trigger. */\n type: 'dialog' | 'menu' | 'listbox' | 'tree' | 'grid'\n}\n\nexport interface OverlayTriggerAria {\n /** Props for the trigger element. */\n triggerProps: AriaButtonProps,\n\n /** Props for the overlay container element. */\n overlayProps: DOMProps\n}\n\n/**\n * Handles the behavior and accessibility for an overlay trigger, e.g. a button\n * that opens a popover, menu, or other overlay that is positioned relative to the trigger.\n */\nexport function useOverlayTrigger(props: OverlayTriggerProps, state: OverlayTriggerState, ref?: RefObject<Element | null>): OverlayTriggerAria {\n let {type} = props;\n let {isOpen} = state;\n\n // Backward compatibility. Share state close function with useOverlayPosition so it can close on scroll\n // without forcing users to pass onClose.\n useEffect(() => {\n if (ref && ref.current) {\n onCloseMap.set(ref.current, state.close);\n }\n });\n\n // Aria 1.1 supports multiple values for aria-haspopup other than just menus.\n // https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup\n // However, we only add it for menus for now because screen readers often\n // announce it as a menu even for other values.\n let ariaHasPopup: undefined | boolean | 'listbox' = undefined;\n if (type === 'menu') {\n ariaHasPopup = true;\n } else if (type === 'listbox') {\n ariaHasPopup = 'listbox';\n }\n\n let overlayId = useId();\n return {\n triggerProps: {\n 'aria-haspopup': ariaHasPopup,\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? overlayId : undefined,\n onPress: state.toggle\n },\n overlayProps: {\n id: overlayId\n }\n };\n}\n"],"names":[],"version":3,"file":"useOverlayTrigger.js.map"}
1
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AA0BM,SAAS,0CACd,KAA0B,EAC1B,KAA0B,EAC1B,GAA+B;IAE/B,IAAI,QAAC,IAAI,EAAC,GAAG;IACb,IAAI,UAAC,MAAM,EAAC,GAAG;IAEf,uGAAuG;IACvG,yCAAyC;IACzC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,OAAO,IAAI,OAAO,EACpB,CAAA,GAAA,yCAAS,EAAE,GAAG,CAAC,IAAI,OAAO,EAAE,MAAM,KAAK;IAE3C;IAEA,6EAA6E;IAC7E,oDAAoD;IACpD,yEAAyE;IACzE,+CAA+C;IAC/C,IAAI,eAAgD;IACpD,IAAI,SAAS,QACX,eAAe;SACV,IAAI,SAAS,WAClB,eAAe;IAGjB,IAAI,YAAY,CAAA,GAAA,yCAAI;IACpB,OAAO;QACL,cAAc;YACZ,iBAAiB;YACjB,iBAAiB;YACjB,iBAAiB,SAAS,YAAY;YACtC,SAAS,MAAM,MAAM;QACvB;QACA,cAAc;YACZ,IAAI;QACN;IACF;AACF","sources":["packages/react-aria/src/overlays/useOverlayTrigger.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 {AriaButtonProps} from '../button/useButton';\nimport {DOMProps, RefObject} from '@react-types/shared';\nimport {onCloseMap} from './useCloseOnScroll';\nimport {OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {useEffect} from 'react';\nimport {useId} from '../utils/useId';\n\nexport interface OverlayTriggerProps {\n /** Type of overlay that is opened by the trigger. */\n type: 'dialog' | 'menu' | 'listbox' | 'tree' | 'grid';\n}\n\nexport interface OverlayTriggerAria {\n /** Props for the trigger element. */\n triggerProps: AriaButtonProps;\n\n /** Props for the overlay container element. */\n overlayProps: DOMProps;\n}\n\n/**\n * Handles the behavior and accessibility for an overlay trigger, e.g. a button\n * that opens a popover, menu, or other overlay that is positioned relative to the trigger.\n */\nexport function useOverlayTrigger(\n props: OverlayTriggerProps,\n state: OverlayTriggerState,\n ref?: RefObject<Element | null>\n): OverlayTriggerAria {\n let {type} = props;\n let {isOpen} = state;\n\n // Backward compatibility. Share state close function with useOverlayPosition so it can close on scroll\n // without forcing users to pass onClose.\n useEffect(() => {\n if (ref && ref.current) {\n onCloseMap.set(ref.current, state.close);\n }\n });\n\n // Aria 1.1 supports multiple values for aria-haspopup other than just menus.\n // https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup\n // However, we only add it for menus for now because screen readers often\n // announce it as a menu even for other values.\n let ariaHasPopup: undefined | boolean | 'listbox' = undefined;\n if (type === 'menu') {\n ariaHasPopup = true;\n } else if (type === 'listbox') {\n ariaHasPopup = 'listbox';\n }\n\n let overlayId = useId();\n return {\n triggerProps: {\n 'aria-haspopup': ariaHasPopup,\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? overlayId : undefined,\n onPress: state.toggle\n },\n overlayProps: {\n id: overlayId\n }\n };\n}\n"],"names":[],"version":3,"file":"useOverlayTrigger.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AA0BM,SAAS,0CAAkB,KAA0B,EAAE,KAA0B,EAAE,GAA+B;IACvH,IAAI,QAAC,IAAI,EAAC,GAAG;IACb,IAAI,UAAC,MAAM,EAAC,GAAG;IAEf,uGAAuG;IACvG,yCAAyC;IACzC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,OAAO,IAAI,OAAO,EACpB,CAAA,GAAA,yCAAS,EAAE,GAAG,CAAC,IAAI,OAAO,EAAE,MAAM,KAAK;IAE3C;IAEA,6EAA6E;IAC7E,oDAAoD;IACpD,yEAAyE;IACzE,+CAA+C;IAC/C,IAAI,eAAgD;IACpD,IAAI,SAAS,QACX,eAAe;SACV,IAAI,SAAS,WAClB,eAAe;IAGjB,IAAI,YAAY,CAAA,GAAA,yCAAI;IACpB,OAAO;QACL,cAAc;YACZ,iBAAiB;YACjB,iBAAiB;YACjB,iBAAiB,SAAS,YAAY;YACtC,SAAS,MAAM,MAAM;QACvB;QACA,cAAc;YACZ,IAAI;QACN;IACF;AACF","sources":["packages/react-aria/src/overlays/useOverlayTrigger.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 {AriaButtonProps} from '../button/useButton';\nimport {DOMProps, RefObject} from '@react-types/shared';\nimport {onCloseMap} from './useCloseOnScroll';\nimport {OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {useEffect} from 'react';\nimport {useId} from '../utils/useId';\n\nexport interface OverlayTriggerProps {\n /** Type of overlay that is opened by the trigger. */\n type: 'dialog' | 'menu' | 'listbox' | 'tree' | 'grid'\n}\n\nexport interface OverlayTriggerAria {\n /** Props for the trigger element. */\n triggerProps: AriaButtonProps,\n\n /** Props for the overlay container element. */\n overlayProps: DOMProps\n}\n\n/**\n * Handles the behavior and accessibility for an overlay trigger, e.g. a button\n * that opens a popover, menu, or other overlay that is positioned relative to the trigger.\n */\nexport function useOverlayTrigger(props: OverlayTriggerProps, state: OverlayTriggerState, ref?: RefObject<Element | null>): OverlayTriggerAria {\n let {type} = props;\n let {isOpen} = state;\n\n // Backward compatibility. Share state close function with useOverlayPosition so it can close on scroll\n // without forcing users to pass onClose.\n useEffect(() => {\n if (ref && ref.current) {\n onCloseMap.set(ref.current, state.close);\n }\n });\n\n // Aria 1.1 supports multiple values for aria-haspopup other than just menus.\n // https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup\n // However, we only add it for menus for now because screen readers often\n // announce it as a menu even for other values.\n let ariaHasPopup: undefined | boolean | 'listbox' = undefined;\n if (type === 'menu') {\n ariaHasPopup = true;\n } else if (type === 'listbox') {\n ariaHasPopup = 'listbox';\n }\n\n let overlayId = useId();\n return {\n triggerProps: {\n 'aria-haspopup': ariaHasPopup,\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? overlayId : undefined,\n onPress: state.toggle\n },\n overlayProps: {\n id: overlayId\n }\n };\n}\n"],"names":[],"version":3,"file":"useOverlayTrigger.mjs.map"}
1
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AA0BM,SAAS,0CACd,KAA0B,EAC1B,KAA0B,EAC1B,GAA+B;IAE/B,IAAI,QAAC,IAAI,EAAC,GAAG;IACb,IAAI,UAAC,MAAM,EAAC,GAAG;IAEf,uGAAuG;IACvG,yCAAyC;IACzC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,OAAO,IAAI,OAAO,EACpB,CAAA,GAAA,yCAAS,EAAE,GAAG,CAAC,IAAI,OAAO,EAAE,MAAM,KAAK;IAE3C;IAEA,6EAA6E;IAC7E,oDAAoD;IACpD,yEAAyE;IACzE,+CAA+C;IAC/C,IAAI,eAAgD;IACpD,IAAI,SAAS,QACX,eAAe;SACV,IAAI,SAAS,WAClB,eAAe;IAGjB,IAAI,YAAY,CAAA,GAAA,yCAAI;IACpB,OAAO;QACL,cAAc;YACZ,iBAAiB;YACjB,iBAAiB;YACjB,iBAAiB,SAAS,YAAY;YACtC,SAAS,MAAM,MAAM;QACvB;QACA,cAAc;YACZ,IAAI;QACN;IACF;AACF","sources":["packages/react-aria/src/overlays/useOverlayTrigger.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 {AriaButtonProps} from '../button/useButton';\nimport {DOMProps, RefObject} from '@react-types/shared';\nimport {onCloseMap} from './useCloseOnScroll';\nimport {OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {useEffect} from 'react';\nimport {useId} from '../utils/useId';\n\nexport interface OverlayTriggerProps {\n /** Type of overlay that is opened by the trigger. */\n type: 'dialog' | 'menu' | 'listbox' | 'tree' | 'grid';\n}\n\nexport interface OverlayTriggerAria {\n /** Props for the trigger element. */\n triggerProps: AriaButtonProps;\n\n /** Props for the overlay container element. */\n overlayProps: DOMProps;\n}\n\n/**\n * Handles the behavior and accessibility for an overlay trigger, e.g. a button\n * that opens a popover, menu, or other overlay that is positioned relative to the trigger.\n */\nexport function useOverlayTrigger(\n props: OverlayTriggerProps,\n state: OverlayTriggerState,\n ref?: RefObject<Element | null>\n): OverlayTriggerAria {\n let {type} = props;\n let {isOpen} = state;\n\n // Backward compatibility. Share state close function with useOverlayPosition so it can close on scroll\n // without forcing users to pass onClose.\n useEffect(() => {\n if (ref && ref.current) {\n onCloseMap.set(ref.current, state.close);\n }\n });\n\n // Aria 1.1 supports multiple values for aria-haspopup other than just menus.\n // https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup\n // However, we only add it for menus for now because screen readers often\n // announce it as a menu even for other values.\n let ariaHasPopup: undefined | boolean | 'listbox' = undefined;\n if (type === 'menu') {\n ariaHasPopup = true;\n } else if (type === 'listbox') {\n ariaHasPopup = 'listbox';\n }\n\n let overlayId = useId();\n return {\n triggerProps: {\n 'aria-haspopup': ariaHasPopup,\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? overlayId : undefined,\n onPress: state.toggle\n },\n overlayProps: {\n id: overlayId\n }\n };\n}\n"],"names":[],"version":3,"file":"useOverlayTrigger.mjs.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAwEM,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,EAAC,cAAc,aAAa,cAAE,UAAU,aAAE,SAAS,EAAE,oBAAoB,MAAM,EAAC,GAAG,CAAA,GAAA,4CAAiB,EAAE;QACxG,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<AriaPositionProps, 'isOpen' | 'onClose' | 'targetRef' | 'overlayRef'> {\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 {overlayProps: positionProps, arrowProps, placement, triggerAnchorPoint: origin} = 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;;;;;;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 +1 @@
1
- {"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAwEM,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,yCAAS,EAC3C;QACE,QAAQ,MAAM,MAAM;QACpB,SAAS,MAAM,KAAK;QACpB,mBAAmB;QACnB,eAAe,CAAC,cAAc;mCAC9B;sCACA;IACF,GACA,qBAAA,sBAAA,WAAY;IAGd,IAAI,EAAC,cAAc,aAAa,cAAE,UAAU,aAAE,SAAS,EAAE,oBAAoB,MAAM,EAAC,GAAG,CAAA,GAAA,yCAAiB,EAAE;QACxG,GAAG,UAAU;QACb,WAAW;QACX,YAAY;QACZ,QAAQ,MAAM,MAAM;QACpB,SAAS,cAAc,CAAC,YAAY,MAAM,KAAK,GAAG;IACpD;IAEA,CAAA,GAAA,yCAAe,EAAE;QACf,YAAY,cAAc,CAAC,MAAM,MAAM;IACzC;IAEA,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,MAAM,IAAI,WAAW,OAAO,EAAE;gBAEjB,mBAEK;YAH1B,IAAI,YACF,OAAO,CAAA,GAAA,yCAAU,EAAE,CAAA,oBAAA,qBAAA,+BAAA,SAAU,OAAO,cAAjB,+BAAA,oBAAqB,WAAW,OAAO;iBAE1D,OAAO,CAAA,GAAA,yCAAc,EAAE;gBAAC,CAAA,qBAAA,qBAAA,+BAAA,SAAU,OAAO,cAAjB,gCAAA,qBAAqB,WAAW,OAAO;aAAC,EAAE;gBAAC,gBAAgB;YAAI;QAE3F;IACF,GAAG;QAAC;QAAY,MAAM,MAAM;QAAE;QAAY;KAAS;IAEnD,OAAO;QACL,cAAc,CAAA,GAAA,yCAAS,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<AriaPositionProps, 'isOpen' | 'onClose' | 'targetRef' | 'overlayRef'> {\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 {overlayProps: positionProps, arrowProps, placement, triggerAnchorPoint: origin} = 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.js.map"}
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,yCAAS,EAC3C;QACE,QAAQ,MAAM,MAAM;QACpB,SAAS,MAAM,KAAK;QACpB,mBAAmB;QACnB,eAAe,CAAC,cAAc;mCAC9B;sCACA;IACF,GACA,qBAAA,sBAAA,WAAY;IAGd,IAAI,EACF,cAAc,aAAa,cAC3B,UAAU,aACV,SAAS,EACT,oBAAoB,MAAM,EAC3B,GAAG,CAAA,GAAA,yCAAiB,EAAE;QACrB,GAAG,UAAU;QACb,WAAW;QACX,YAAY;QACZ,QAAQ,MAAM,MAAM;QACpB,SAAS,cAAc,CAAC,YAAY,MAAM,KAAK,GAAG;IACpD;IAEA,CAAA,GAAA,yCAAe,EAAE;QACf,YAAY,cAAc,CAAC,MAAM,MAAM;IACzC;IAEA,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,MAAM,IAAI,WAAW,OAAO,EAAE;gBAEjB,mBAEK;YAH1B,IAAI,YACF,OAAO,CAAA,GAAA,yCAAU,EAAE,CAAA,oBAAA,qBAAA,+BAAA,SAAU,OAAO,cAAjB,+BAAA,oBAAqB,WAAW,OAAO;iBAE1D,OAAO,CAAA,GAAA,yCAAc,EAAE;gBAAC,CAAA,qBAAA,qBAAA,+BAAA,SAAU,OAAO,cAAjB,gCAAA,qBAAqB,WAAW,OAAO;aAAC,EAAE;gBAAC,gBAAgB;YAAI;QAE3F;IACF,GAAG;QAAC;QAAY,MAAM,MAAM;QAAE;QAAY;KAAS;IAEnD,OAAO;QACL,cAAc,CAAA,GAAA,yCAAS,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.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAwEM,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,yCAAS,EAC3C;QACE,QAAQ,MAAM,MAAM;QACpB,SAAS,MAAM,KAAK;QACpB,mBAAmB;QACnB,eAAe,CAAC,cAAc;mCAC9B;sCACA;IACF,GACA,YAAY;IAGd,IAAI,EAAC,cAAc,aAAa,cAAE,UAAU,aAAE,SAAS,EAAE,oBAAoB,MAAM,EAAC,GAAG,CAAA,GAAA,yCAAiB,EAAE;QACxG,GAAG,UAAU;QACb,WAAW;QACX,YAAY;QACZ,QAAQ,MAAM,MAAM;QACpB,SAAS,cAAc,CAAC,YAAY,MAAM,KAAK,GAAG;IACpD;IAEA,CAAA,GAAA,yCAAe,EAAE;QACf,YAAY,cAAc,CAAC,MAAM,MAAM;IACzC;IAEA,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,MAAM,IAAI,WAAW,OAAO,EAAE;YACtC,IAAI,YACF,OAAO,CAAA,GAAA,yCAAU,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,yCAAS,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<AriaPositionProps, 'isOpen' | 'onClose' | 'targetRef' | 'overlayRef'> {\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 {overlayProps: positionProps, arrowProps, placement, triggerAnchorPoint: origin} = 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.mjs.map"}
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,yCAAS,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,yCAAiB,EAAE;QACrB,GAAG,UAAU;QACb,WAAW;QACX,YAAY;QACZ,QAAQ,MAAM,MAAM;QACpB,SAAS,cAAc,CAAC,YAAY,MAAM,KAAK,GAAG;IACpD;IAEA,CAAA,GAAA,yCAAe,EAAE;QACf,YAAY,cAAc,CAAC,MAAM,MAAM;IACzC;IAEA,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,MAAM,IAAI,WAAW,OAAO,EAAE;YACtC,IAAI,YACF,OAAO,CAAA,GAAA,yCAAU,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,yCAAS,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.mjs.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAiBD,MAAM,uCAAiB,OAAO,aAAa,eAAe,OAAO,cAAc;AAE/E,mIAAmI;AACnI,IAAI,2CAAqB;AACzB,IAAI;AAOG,SAAS,0CAAiB,UAAgC,CAAC,CAAC;IACjE,IAAI,cAAC,UAAU,EAAC,GAAG;IAEnB,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,YACF;QAGF;QACA,IAAI,6CAAuB;YACzB,IAAI,CAAA,GAAA,+BAAI,KACN,gCAAU;iBAEV,gCAAU;;QAId,OAAO;YACL;YACA,IAAI,6CAAuB,GACzB;QAEJ;IACF,GAAG;Q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AA2B;IAC3E,IAAI,sBAAsB,CAAC,sCACzB,gFAAgF;IAChF,qCAAe;SAEf,+EAA+E;IAC/E,6CAA6C;IAC7C,qCAAe,gBAAgB,CAAC,UAAU,IAAM,qCAAe,SAAS;QAAC,MAAM;IAAI;AAEvF;AAEA,SAAS,qCAAe,MAAe;IACrC,IAAI,OAAO,SAAS,gBAAgB,IAAI,SAAS,eAAe;IAChE,IAAI,aAA6B;IACjC,MAAO,cAAc,eAAe,KAAM;QACxC,0GAA0G;QAC1G,IAAI,aAAa,CAAA,GAAA,yCAAc,EAAE;QACjC,IAAI,eAAe,SAAS,eAAe,IAAI,eAAe,SAAS,IAAI,IAAI,eAAe,YAAY;YACxG,IAAI,iBAAiB,WAAW,qBAAqB;YACrD,IAAI,aAAa,WAAW,qBAAqB;YACjD,IAAI,WAAW,GAAG,GAAG,eAAe,GAAG,IAAI,WAAW,MAAM,GAAG,eAAe,GAAG,GAAG,WAAW,YAAY,EAAE;gBAC3G,IAAI,SAAS,eAAe,MAAM;gBAClC,IAAI,sCACF,SAAS,KAAK,GAAG,CAAC,QAAQ,qCAAe,SAAS,GAAG,qCAAe,MAAM;gBAG5E,8BAA8B;gBAC9B,IAAI,aAAa,AAAC,WAAW,GAAG,GAAG,eAAe,GAAG,GAAK,CAAA,AAAC,CAAA,SAAS,eAAe,GAAG,AAAD,IAAK,IAAI,WAAW,MAAM,GAAG,CAAA;gBAClH,WAAW,QAAQ,CAAC;oBAClB,sDAAsD;oBACtD,KAAK,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,WAAW,YAAY,GAAG,WAAW,YAAY,EAAE,WAAW,SAAS,GAAG;oBACpG,UAAU;gBACZ;YACF;QACF;QAEA,aAAa,WAAW,aAAa;IACvC;AACF","sources":["packages/react-aria/src/overlays/usePreventScroll.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 {chain} from '../utils/chain';\n\nimport {getActiveElement, getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport {getNonce} from '../utils/getNonce';\nimport {getScrollParent} from '../utils/getScrollParent';\nimport {isIOS} from '../utils/platform';\nimport {isScrollable} from '../utils/isScrollable';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {willOpenKeyboard} from '../utils/keyboard';\n\ninterface PreventScrollOptions {\n /** Whether the scroll lock is disabled. */\n isDisabled?: boolean\n}\n\nconst visualViewport = typeof document !== 'undefined' && window.visualViewport;\n\n// The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position\nlet preventScrollCount = 0;\nlet restore;\n\n/**\n * Prevents scrolling on the document body on mount, and\n * restores it on unmount. Also ensures that content does not\n * shift due to the scrollbars disappearing.\n */\nexport function usePreventScroll(options: PreventScrollOptions = {}): void {\n let {isDisabled} = options;\n\n useLayoutEffect(() => {\n if (isDisabled) {\n return;\n }\n\n preventScrollCount++;\n if (preventScrollCount === 1) {\n if (isIOS()) {\n restore = preventScrollMobileSafari();\n } else {\n restore = preventScrollStandard();\n }\n }\n\n return () => {\n preventScrollCount--;\n if (preventScrollCount === 0) {\n restore();\n }\n };\n }, [isDisabled]);\n}\n\n// For most browsers, all we need to do is set `overflow: hidden` on the root element, and\n// add some padding to prevent the page from shifting when the scrollbar is hidden.\nfunction preventScrollStandard() {\n let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;\n return chain(\n scrollbarWidth > 0 &&\n // Use scrollbar-gutter when supported because it also works for fixed positioned elements.\n ('scrollbarGutter' in document.documentElement.style\n ? setStyle(document.documentElement, 'scrollbarGutter', 'stable')\n : setStyle(document.documentElement, 'paddingRight', `${scrollbarWidth}px`)),\n setStyle(document.documentElement, 'overflow', 'hidden')\n );\n}\n\n// Mobile Safari is a whole different beast. Even with overflow: hidden,\n// it still scrolls the page in many situations:\n//\n// 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.\n// 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of\n// it, so it becomes scrollable.\n// 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.\n// This may cause even fixed position elements to scroll off the screen.\n// 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always\n// scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.\n//\n// In order to work around these cases, and prevent scrolling without jankiness, we do a few things:\n//\n// 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling\n// on the window.\n// 2. Set `overscroll-behavior: contain` on nested scrollable regions so they do not scroll the page when at\n// the top or bottom. Work around a bug where this does not work when the element does not actually overflow\n// by preventing default in a `touchmove` event. This is best effort: we can't prevent default when pinch\n// zooming or when an element contains text selection, which may allow scrolling in some cases.\n// 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.\n// 4. When focus moves to an input, create an off screen input and focus that temporarily. This prevents\n// Safari from scrolling the page. After a small delay, focus the real input and scroll it into view\n// ourselves, without scrolling the whole page.\nfunction preventScrollMobileSafari() {\n // Set overflow hidden so scrollIntoViewport() (useSelectableCollection) sees isScrollPrevented and\n // scrolls only scroll parents instead of calling native scrollIntoView() which moves the window.\n let restoreOverflow = setStyle(document.documentElement, 'overflow', 'hidden');\n\n let scrollable: Element;\n let allowTouchMove = false;\n let onTouchStart = (e: TouchEvent) => {\n // Store the nearest scrollable parent element from the element that the user touched.\n let target = getEventTarget(e) as Element;\n scrollable = isScrollable(target) ? target : getScrollParent(target, true);\n allowTouchMove = false;\n\n // If the target is selected, don't preventDefault in touchmove to allow user to adjust selection.\n let selection = target.ownerDocument.defaultView!.getSelection();\n if (selection && !selection.isCollapsed && selection.containsNode(target, true)) {\n allowTouchMove = true;\n }\n\n // If this is a range input, allow touch move to allow user to adjust the slider value\n if (e.composedPath().some((el) =>\n el instanceof HTMLInputElement &&\n el.type === 'range'\n )) {\n allowTouchMove = true;\n }\n\n // If this is a focused input element with a selected range, allow user to drag the selection handles.\n if (\n 'selectionStart' in target &&\n 'selectionEnd' in target &&\n (target.selectionStart as number) < (target.selectionEnd as number) &&\n target.ownerDocument.activeElement === target\n ) {\n allowTouchMove = true;\n }\n };\n\n // Prevent scrolling up when at the top and scrolling down when at the bottom\n // of a nested scrollable area, otherwise mobile Safari will start scrolling\n // the window instead.\n // This must be applied before the touchstart event as of iOS 26, so inject it as a <style> element.\n let style = document.createElement('style');\n let nonce = getNonce();\n if (nonce) {\n style.nonce = nonce;\n }\n style.textContent = `\n@layer {\n * {\n overscroll-behavior: contain;\n }\n}`.trim();\n document.head.prepend(style);\n\n let onTouchMove = (e: TouchEvent) => {\n // Allow pinch-zooming.\n if (e.touches.length === 2 || allowTouchMove) {\n return;\n }\n\n // Prevent scrolling the window.\n if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {\n e.preventDefault();\n return;\n }\n\n // overscroll-behavior should prevent scroll chaining, but currently does not\n // if the element doesn't actually overflow. https://bugs.webkit.org/show_bug.cgi?id=243452\n // This checks that both the width and height do not overflow, otherwise we might\n // block horizontal scrolling too. In that case, adding `touch-action: pan-x` to\n // the element will prevent vertical page scrolling. We can't add that automatically\n // because it must be set before the touchstart event.\n if (scrollable.scrollHeight === scrollable.clientHeight && scrollable.scrollWidth === scrollable.clientWidth) {\n e.preventDefault();\n }\n };\n\n let onBlur = (e: FocusEvent) => {\n let target = getEventTarget(e) as HTMLElement;\n let relatedTarget = e.relatedTarget as HTMLElement | null;\n if (relatedTarget && willOpenKeyboard(relatedTarget)) {\n // Focus without scrolling the whole page, and then scroll into view manually.\n relatedTarget.focus({preventScroll: true});\n scrollIntoViewWhenReady(relatedTarget, willOpenKeyboard(target));\n } else if (!relatedTarget) {\n // When tapping the Done button on the keyboard, focus moves to the body.\n // FocusScope will then restore focus back to the input. Later when tapping\n // the same input again, it is already focused, so no blur event will fire,\n // resulting in the flow above never running and Safari's native scrolling occurring.\n // Instead, move focus to the parent focusable element (e.g. the dialog).\n let focusable = target.parentElement?.closest('[tabindex]') as HTMLElement | null;\n focusable?.focus({preventScroll: true});\n }\n };\n\n // Override programmatic focus to scroll into view without scrolling the whole page.\n let focus = HTMLElement.prototype.focus;\n HTMLElement.prototype.focus = function (opts) {\n // Track whether the keyboard was already visible before.\n let activeElement = getActiveElement();\n let wasKeyboardVisible = activeElement != null && willOpenKeyboard(activeElement);\n\n // Focus the element without scrolling the page.\n focus.call(this, {...opts, preventScroll: true});\n\n if (!opts || !opts.preventScroll) {\n scrollIntoViewWhenReady(this, wasKeyboardVisible);\n }\n };\n\n let removeEvents = chain(\n addEvent(document, 'touchstart', onTouchStart, {passive: false, capture: true}),\n addEvent(document, 'touchmove', onTouchMove, {passive: false, capture: true}),\n addEvent(document, 'blur', onBlur, true)\n );\n\n return () => {\n restoreOverflow();\n removeEvents();\n style.remove();\n HTMLElement.prototype.focus = focus;\n };\n}\n\n// Sets a CSS property on an element, and returns a function to revert it to the previous value.\nfunction setStyle(element: HTMLElement, style: string, value: string) {\n let cur = element.style[style];\n element.style[style] = value;\n\n return () => {\n element.style[style] = cur;\n };\n}\n\n// Adds an event listener to an element, and returns a function to remove it.\nfunction addEvent<K extends keyof GlobalEventHandlersEventMap>(\n target: Document | Window,\n event: K,\n handler: (this: Document | Window, ev: GlobalEventHandlersEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n) {\n // internal function, so it's ok to ignore the difficult to fix type error\n // @ts-ignore\n target.addEventListener(event, handler, options);\n return () => {\n // @ts-ignore\n target.removeEventListener(event, handler, options);\n };\n}\n\nfunction scrollIntoViewWhenReady(target: Element, wasKeyboardVisible: boolean) {\n if (wasKeyboardVisible || !visualViewport) {\n // If the keyboard was already visible, scroll the target into view immediately.\n scrollIntoView(target);\n } else {\n // Otherwise, wait for the visual viewport to resize before scrolling so we can\n // measure the correct position to scroll to.\n visualViewport.addEventListener('resize', () => scrollIntoView(target), {once: true});\n }\n}\n\nfunction scrollIntoView(target: Element) {\n let root = document.scrollingElement || document.documentElement;\n let nextTarget: Element | null = target;\n while (nextTarget && nextTarget !== root) {\n // Find the parent scrollable element and adjust the scroll position if the target is not already in view.\n let scrollable = getScrollParent(nextTarget);\n if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== nextTarget) {\n let scrollableRect = scrollable.getBoundingClientRect();\n let targetRect = nextTarget.getBoundingClientRect();\n if (targetRect.top < scrollableRect.top || targetRect.bottom > scrollableRect.top + nextTarget.clientHeight) {\n let bottom = scrollableRect.bottom;\n if (visualViewport) {\n bottom = Math.min(bottom, visualViewport.offsetTop + visualViewport.height);\n }\n\n // Center within the viewport.\n let adjustment = (targetRect.top - scrollableRect.top) - ((bottom - scrollableRect.top) / 2 - targetRect.height / 2);\n scrollable.scrollTo({\n // Clamp to the valid range to prevent over-scrolling.\n top: Math.max(0, Math.min(scrollable.scrollHeight - scrollable.clientHeight, scrollable.scrollTop + adjustment)),\n behavior: 'smooth'\n });\n }\n }\n\n nextTarget = scrollable.parentElement;\n }\n}\n"],"names":[],"version":3,"file":"usePreventScroll.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAiBD,MAAM,uCAAiB,OAAO,aAAa,eAAe,OAAO,cAAc;AAE/E,mIAAmI;AACnI,IAAI,2CAAqB;AACzB,IAAI;AAOG,SAAS,0CAAiB,UAAgC,CAAC,CAAC;IACjE,IAAI,cAAC,UAAU,EAAC,GAAG;IAEnB,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,YACF;QAGF;QACA,IAAI,6CAAuB;YACzB,IAAI,CAAA,GAAA,+BAAI,KACN,gCAAU;iBAEV,gCAAU;;QAId,OAAO;YACL;YACA,IAAI,6CAAuB,GACzB;QAEJ;IACF,GAAG;QAAC;KAAW;AACjB;A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I,sBAAsB,CAAC,sCACzB,gFAAgF;IAChF,qCAAe;SAEf,+EAA+E;IAC/E,6CAA6C;IAC7C,qCAAe,gBAAgB,CAAC,UAAU,IAAM,qCAAe,SAAS;QAAC,MAAM;IAAI;AAEvF;AAEA,SAAS,qCAAe,MAAe;IACrC,IAAI,OAAO,SAAS,gBAAgB,IAAI,SAAS,eAAe;IAChE,IAAI,aAA6B;IACjC,MAAO,cAAc,eAAe,KAAM;QACxC,0GAA0G;QAC1G,IAAI,aAAa,CAAA,GAAA,yCAAc,EAAE;QACjC,IACE,eAAe,SAAS,eAAe,IACvC,eAAe,SAAS,IAAI,IAC5B,eAAe,YACf;YACA,IAAI,iBAAiB,WAAW,qBAAqB;YACrD,IAAI,aAAa,WAAW,qBAAqB;YACjD,IACE,WAAW,GAAG,GAAG,eAAe,GAAG,IACnC,WAAW,MAAM,GAAG,eAAe,GAAG,GAAG,WAAW,YAAY,EAChE;gBACA,IAAI,SAAS,eAAe,MAAM;gBAClC,IAAI,sCACF,SAAS,KAAK,GAAG,CAAC,QAAQ,qCAAe,SAAS,GAAG,qCAAe,MAAM;gBAG5E,8BAA8B;gBAC9B,IAAI,aACF,WAAW,GAAG,GACd,eAAe,GAAG,GACjB,CAAA,AAAC,CAAA,SAAS,eAAe,GAAG,AAAD,IAAK,IAAI,WAAW,MAAM,GAAG,CAAA;gBAC3D,WAAW,QAAQ,CAAC;oBAClB,sDAAsD;oBACtD,KAAK,KAAK,GAAG,CACX,GACA,KAAK,GAAG,CACN,WAAW,YAAY,GAAG,WAAW,YAAY,EACjD,WAAW,SAAS,GAAG;oBAG3B,UAAU;gBACZ;YACF;QACF;QAEA,aAAa,WAAW,aAAa;IACvC;AACF","sources":["packages/react-aria/src/overlays/usePreventScroll.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 {chain} from '../utils/chain';\n\nimport {getActiveElement, getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport {getNonce} from '../utils/getNonce';\nimport {getScrollParent} from '../utils/getScrollParent';\nimport {isIOS} from '../utils/platform';\nimport {isScrollable} from '../utils/isScrollable';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {willOpenKeyboard} from '../utils/keyboard';\n\ninterface PreventScrollOptions {\n /** Whether the scroll lock is disabled. */\n isDisabled?: boolean;\n}\n\nconst visualViewport = typeof document !== 'undefined' && window.visualViewport;\n\n// The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position\nlet preventScrollCount = 0;\nlet restore;\n\n/**\n * Prevents scrolling on the document body on mount, and\n * restores it on unmount. Also ensures that content does not\n * shift due to the scrollbars disappearing.\n */\nexport function usePreventScroll(options: PreventScrollOptions = {}): void {\n let {isDisabled} = options;\n\n useLayoutEffect(() => {\n if (isDisabled) {\n return;\n }\n\n preventScrollCount++;\n if (preventScrollCount === 1) {\n if (isIOS()) {\n restore = preventScrollMobileSafari();\n } else {\n restore = preventScrollStandard();\n }\n }\n\n return () => {\n preventScrollCount--;\n if (preventScrollCount === 0) {\n restore();\n }\n };\n }, [isDisabled]);\n}\n\n// For most browsers, all we need to do is set `overflow: hidden` on the root element, and\n// add some padding to prevent the page from shifting when the scrollbar is hidden.\nfunction preventScrollStandard() {\n let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;\n return chain(\n scrollbarWidth > 0 &&\n // Use scrollbar-gutter when supported because it also works for fixed positioned elements.\n ('scrollbarGutter' in document.documentElement.style\n ? setStyle(document.documentElement, 'scrollbarGutter', 'stable')\n : setStyle(document.documentElement, 'paddingRight', `${scrollbarWidth}px`)),\n setStyle(document.documentElement, 'overflow', 'hidden')\n );\n}\n\n// Mobile Safari is a whole different beast. Even with overflow: hidden,\n// it still scrolls the page in many situations:\n//\n// 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.\n// 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of\n// it, so it becomes scrollable.\n// 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.\n// This may cause even fixed position elements to scroll off the screen.\n// 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always\n// scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.\n//\n// In order to work around these cases, and prevent scrolling without jankiness, we do a few things:\n//\n// 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling\n// on the window.\n// 2. Set `overscroll-behavior: contain` on nested scrollable regions so they do not scroll the page when at\n// the top or bottom. Work around a bug where this does not work when the element does not actually overflow\n// by preventing default in a `touchmove` event. This is best effort: we can't prevent default when pinch\n// zooming or when an element contains text selection, which may allow scrolling in some cases.\n// 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.\n// 4. When focus moves to an input, create an off screen input and focus that temporarily. This prevents\n// Safari from scrolling the page. After a small delay, focus the real input and scroll it into view\n// ourselves, without scrolling the whole page.\nfunction preventScrollMobileSafari() {\n // Set overflow hidden so scrollIntoViewport() (useSelectableCollection) sees isScrollPrevented and\n // scrolls only scroll parents instead of calling native scrollIntoView() which moves the window.\n let restoreOverflow = setStyle(document.documentElement, 'overflow', 'hidden');\n\n let scrollable: Element;\n let allowTouchMove = false;\n let onTouchStart = (e: TouchEvent) => {\n // Store the nearest scrollable parent element from the element that the user touched.\n let target = getEventTarget(e) as Element;\n scrollable = isScrollable(target) ? target : getScrollParent(target, true);\n allowTouchMove = false;\n\n // If the target is selected, don't preventDefault in touchmove to allow user to adjust selection.\n let selection = target.ownerDocument.defaultView!.getSelection();\n if (selection && !selection.isCollapsed && selection.containsNode(target, true)) {\n allowTouchMove = true;\n }\n\n // If this is a range input, allow touch move to allow user to adjust the slider value\n if (e.composedPath().some(el => el instanceof HTMLInputElement && el.type === 'range')) {\n allowTouchMove = true;\n }\n\n // If this is a focused input element with a selected range, allow user to drag the selection handles.\n if (\n 'selectionStart' in target &&\n 'selectionEnd' in target &&\n (target.selectionStart as number) < (target.selectionEnd as number) &&\n target.ownerDocument.activeElement === target\n ) {\n allowTouchMove = true;\n }\n };\n\n // Prevent scrolling up when at the top and scrolling down when at the bottom\n // of a nested scrollable area, otherwise mobile Safari will start scrolling\n // the window instead.\n // This must be applied before the touchstart event as of iOS 26, so inject it as a <style> element.\n let style = document.createElement('style');\n let nonce = getNonce();\n if (nonce) {\n style.nonce = nonce;\n }\n style.textContent = `\n@layer {\n * {\n overscroll-behavior: contain;\n }\n}`.trim();\n document.head.prepend(style);\n\n let onTouchMove = (e: TouchEvent) => {\n // Allow pinch-zooming.\n if (e.touches.length === 2 || allowTouchMove) {\n return;\n }\n\n // Prevent scrolling the window.\n if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {\n e.preventDefault();\n return;\n }\n\n // overscroll-behavior should prevent scroll chaining, but currently does not\n // if the element doesn't actually overflow. https://bugs.webkit.org/show_bug.cgi?id=243452\n // This checks that both the width and height do not overflow, otherwise we might\n // block horizontal scrolling too. In that case, adding `touch-action: pan-x` to\n // the element will prevent vertical page scrolling. We can't add that automatically\n // because it must be set before the touchstart event.\n if (\n scrollable.scrollHeight === scrollable.clientHeight &&\n scrollable.scrollWidth === scrollable.clientWidth\n ) {\n e.preventDefault();\n }\n };\n\n let onBlur = (e: FocusEvent) => {\n let target = getEventTarget(e) as HTMLElement;\n let relatedTarget = e.relatedTarget as HTMLElement | null;\n if (relatedTarget && willOpenKeyboard(relatedTarget)) {\n // Focus without scrolling the whole page, and then scroll into view manually.\n relatedTarget.focus({preventScroll: true});\n scrollIntoViewWhenReady(relatedTarget, willOpenKeyboard(target));\n } else if (!relatedTarget) {\n // When tapping the Done button on the keyboard, focus moves to the body.\n // FocusScope will then restore focus back to the input. Later when tapping\n // the same input again, it is already focused, so no blur event will fire,\n // resulting in the flow above never running and Safari's native scrolling occurring.\n // Instead, move focus to the parent focusable element (e.g. the dialog).\n let focusable = target.parentElement?.closest('[tabindex]') as HTMLElement | null;\n focusable?.focus({preventScroll: true});\n }\n };\n\n // Override programmatic focus to scroll into view without scrolling the whole page.\n let focus = HTMLElement.prototype.focus;\n HTMLElement.prototype.focus = function (opts) {\n // Track whether the keyboard was already visible before.\n let activeElement = getActiveElement();\n let wasKeyboardVisible = activeElement != null && willOpenKeyboard(activeElement);\n\n // Focus the element without scrolling the page.\n focus.call(this, {...opts, preventScroll: true});\n\n if (!opts || !opts.preventScroll) {\n scrollIntoViewWhenReady(this, wasKeyboardVisible);\n }\n };\n\n let removeEvents = chain(\n addEvent(document, 'touchstart', onTouchStart, {passive: false, capture: true}),\n addEvent(document, 'touchmove', onTouchMove, {passive: false, capture: true}),\n addEvent(document, 'blur', onBlur, true)\n );\n\n return () => {\n restoreOverflow();\n removeEvents();\n style.remove();\n HTMLElement.prototype.focus = focus;\n };\n}\n\n// Sets a CSS property on an element, and returns a function to revert it to the previous value.\nfunction setStyle(element: HTMLElement, style: string, value: string) {\n let cur = element.style[style];\n element.style[style] = value;\n\n return () => {\n element.style[style] = cur;\n };\n}\n\n// Adds an event listener to an element, and returns a function to remove it.\nfunction addEvent<K extends keyof GlobalEventHandlersEventMap>(\n target: Document | Window,\n event: K,\n handler: (this: Document | Window, ev: GlobalEventHandlersEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n) {\n // internal function, so it's ok to ignore the difficult to fix type error\n // @ts-ignore\n target.addEventListener(event, handler, options);\n return () => {\n // @ts-ignore\n target.removeEventListener(event, handler, options);\n };\n}\n\nfunction scrollIntoViewWhenReady(target: Element, wasKeyboardVisible: boolean) {\n if (wasKeyboardVisible || !visualViewport) {\n // If the keyboard was already visible, scroll the target into view immediately.\n scrollIntoView(target);\n } else {\n // Otherwise, wait for the visual viewport to resize before scrolling so we can\n // measure the correct position to scroll to.\n visualViewport.addEventListener('resize', () => scrollIntoView(target), {once: true});\n }\n}\n\nfunction scrollIntoView(target: Element) {\n let root = document.scrollingElement || document.documentElement;\n let nextTarget: Element | null = target;\n while (nextTarget && nextTarget !== root) {\n // Find the parent scrollable element and adjust the scroll position if the target is not already in view.\n let scrollable = getScrollParent(nextTarget);\n if (\n scrollable !== document.documentElement &&\n scrollable !== document.body &&\n scrollable !== nextTarget\n ) {\n let scrollableRect = scrollable.getBoundingClientRect();\n let targetRect = nextTarget.getBoundingClientRect();\n if (\n targetRect.top < scrollableRect.top ||\n targetRect.bottom > scrollableRect.top + nextTarget.clientHeight\n ) {\n let bottom = scrollableRect.bottom;\n if (visualViewport) {\n bottom = Math.min(bottom, visualViewport.offsetTop + visualViewport.height);\n }\n\n // Center within the viewport.\n let adjustment =\n targetRect.top -\n scrollableRect.top -\n ((bottom - scrollableRect.top) / 2 - targetRect.height / 2);\n scrollable.scrollTo({\n // Clamp to the valid range to prevent over-scrolling.\n top: Math.max(\n 0,\n Math.min(\n scrollable.scrollHeight - scrollable.clientHeight,\n scrollable.scrollTop + adjustment\n )\n ),\n behavior: 'smooth'\n });\n }\n }\n\n nextTarget = scrollable.parentElement;\n }\n}\n"],"names":[],"version":3,"file":"usePreventScroll.cjs.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAiBD,MAAM,uCAAiB,OAAO,aAAa,eAAe,OAAO,cAAc;AAE/E,mIAAmI;AACnI,IAAI,2CAAqB;AACzB,IAAI;AAOG,SAAS,0CAAiB,UAAgC,CAAC,CAAC;IACjE,IAAI,cAAC,UAAU,EAAC,GAAG;IAEnB,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,YACF;QAGF;QACA,IAAI,6CAAuB;YACzB,IAAI,CAAA,GAAA,yCAAI,KACN,gCAAU;iBAEV,gCAAU;;QAId,OAAO;YACL;YACA,IAAI,6CAAuB,GACzB;QAEJ;IACF,GAAG;QA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,SAAS;IAC7C;AACF;AAEA,SAAS,8CAAwB,MAAe,EAAE,kBAA2B;IAC3E,IAAI,sBAAsB,CAAC,sCACzB,gFAAgF;IAChF,qCAAe;SAEf,+EAA+E;IAC/E,6CAA6C;IAC7C,qCAAe,gBAAgB,CAAC,UAAU,IAAM,qCAAe,SAAS;QAAC,MAAM;IAAI;AAEvF;AAEA,SAAS,qCAAe,MAAe;IACrC,IAAI,OAAO,SAAS,gBAAgB,IAAI,SAAS,eAAe;IAChE,IAAI,aAA6B;IACjC,MAAO,cAAc,eAAe,KAAM;QACxC,0GAA0G;QAC1G,IAAI,aAAa,CAAA,GAAA,yCAAc,EAAE;QACjC,IAAI,eAAe,SAAS,eAAe,IAAI,eAAe,SAAS,IAAI,IAAI,eAAe,YAAY;YACxG,IAAI,iBAAiB,WAAW,qBAAqB;YACrD,IAAI,aAAa,WAAW,qBAAqB;YACjD,IAAI,WAAW,GAAG,GAAG,eAAe,GAAG,IAAI,WAAW,MAAM,GAAG,eAAe,GAAG,GAAG,WAAW,YAAY,EAAE;gBAC3G,IAAI,SAAS,eAAe,MAAM;gBAClC,IAAI,sCACF,SAAS,KAAK,GAAG,CAAC,QAAQ,qCAAe,SAAS,GAAG,qCAAe,MAAM;gBAG5E,8BAA8B;gBAC9B,IAAI,aAAa,AAAC,WAAW,GAAG,GAAG,eAAe,GAAG,GAAK,CAAA,AAAC,CAAA,SAAS,eAAe,GAAG,AAAD,IAAK,IAAI,WAAW,MAAM,GAAG,CAAA;gBAClH,WAAW,QAAQ,CAAC;oBAClB,sDAAsD;oBACtD,KAAK,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,WAAW,YAAY,GAAG,WAAW,YAAY,EAAE,WAAW,SAAS,GAAG;oBACpG,UAAU;gBACZ;YACF;QACF;QAEA,aAAa,WAAW,aAAa;IACvC;AACF","sources":["packages/react-aria/src/overlays/usePreventScroll.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 {chain} from '../utils/chain';\n\nimport {getActiveElement, getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport {getNonce} from '../utils/getNonce';\nimport {getScrollParent} from '../utils/getScrollParent';\nimport {isIOS} from '../utils/platform';\nimport {isScrollable} from '../utils/isScrollable';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {willOpenKeyboard} from '../utils/keyboard';\n\ninterface PreventScrollOptions {\n /** Whether the scroll lock is disabled. */\n isDisabled?: boolean\n}\n\nconst visualViewport = typeof document !== 'undefined' && window.visualViewport;\n\n// The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position\nlet preventScrollCount = 0;\nlet restore;\n\n/**\n * Prevents scrolling on the document body on mount, and\n * restores it on unmount. Also ensures that content does not\n * shift due to the scrollbars disappearing.\n */\nexport function usePreventScroll(options: PreventScrollOptions = {}): void {\n let {isDisabled} = options;\n\n useLayoutEffect(() => {\n if (isDisabled) {\n return;\n }\n\n preventScrollCount++;\n if (preventScrollCount === 1) {\n if (isIOS()) {\n restore = preventScrollMobileSafari();\n } else {\n restore = preventScrollStandard();\n }\n }\n\n return () => {\n preventScrollCount--;\n if (preventScrollCount === 0) {\n restore();\n }\n };\n }, [isDisabled]);\n}\n\n// For most browsers, all we need to do is set `overflow: hidden` on the root element, and\n// add some padding to prevent the page from shifting when the scrollbar is hidden.\nfunction preventScrollStandard() {\n let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;\n return chain(\n scrollbarWidth > 0 &&\n // Use scrollbar-gutter when supported because it also works for fixed positioned elements.\n ('scrollbarGutter' in document.documentElement.style\n ? setStyle(document.documentElement, 'scrollbarGutter', 'stable')\n : setStyle(document.documentElement, 'paddingRight', `${scrollbarWidth}px`)),\n setStyle(document.documentElement, 'overflow', 'hidden')\n );\n}\n\n// Mobile Safari is a whole different beast. Even with overflow: hidden,\n// it still scrolls the page in many situations:\n//\n// 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.\n// 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of\n// it, so it becomes scrollable.\n// 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.\n// This may cause even fixed position elements to scroll off the screen.\n// 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always\n// scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.\n//\n// In order to work around these cases, and prevent scrolling without jankiness, we do a few things:\n//\n// 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling\n// on the window.\n// 2. Set `overscroll-behavior: contain` on nested scrollable regions so they do not scroll the page when at\n// the top or bottom. Work around a bug where this does not work when the element does not actually overflow\n// by preventing default in a `touchmove` event. This is best effort: we can't prevent default when pinch\n// zooming or when an element contains text selection, which may allow scrolling in some cases.\n// 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.\n// 4. When focus moves to an input, create an off screen input and focus that temporarily. This prevents\n// Safari from scrolling the page. After a small delay, focus the real input and scroll it into view\n// ourselves, without scrolling the whole page.\nfunction preventScrollMobileSafari() {\n // Set overflow hidden so scrollIntoViewport() (useSelectableCollection) sees isScrollPrevented and\n // scrolls only scroll parents instead of calling native scrollIntoView() which moves the window.\n let restoreOverflow = setStyle(document.documentElement, 'overflow', 'hidden');\n\n let scrollable: Element;\n let allowTouchMove = false;\n let onTouchStart = (e: TouchEvent) => {\n // Store the nearest scrollable parent element from the element that the user touched.\n let target = getEventTarget(e) as Element;\n scrollable = isScrollable(target) ? target : getScrollParent(target, true);\n allowTouchMove = false;\n\n // If the target is selected, don't preventDefault in touchmove to allow user to adjust selection.\n let selection = target.ownerDocument.defaultView!.getSelection();\n if (selection && !selection.isCollapsed && selection.containsNode(target, true)) {\n allowTouchMove = true;\n }\n\n // If this is a range input, allow touch move to allow user to adjust the slider value\n if (e.composedPath().some((el) =>\n el instanceof HTMLInputElement &&\n el.type === 'range'\n )) {\n allowTouchMove = true;\n }\n\n // If this is a focused input element with a selected range, allow user to drag the selection handles.\n if (\n 'selectionStart' in target &&\n 'selectionEnd' in target &&\n (target.selectionStart as number) < (target.selectionEnd as number) &&\n target.ownerDocument.activeElement === target\n ) {\n allowTouchMove = true;\n }\n };\n\n // Prevent scrolling up when at the top and scrolling down when at the bottom\n // of a nested scrollable area, otherwise mobile Safari will start scrolling\n // the window instead.\n // This must be applied before the touchstart event as of iOS 26, so inject it as a <style> element.\n let style = document.createElement('style');\n let nonce = getNonce();\n if (nonce) {\n style.nonce = nonce;\n }\n style.textContent = `\n@layer {\n * {\n overscroll-behavior: contain;\n }\n}`.trim();\n document.head.prepend(style);\n\n let onTouchMove = (e: TouchEvent) => {\n // Allow pinch-zooming.\n if (e.touches.length === 2 || allowTouchMove) {\n return;\n }\n\n // Prevent scrolling the window.\n if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {\n e.preventDefault();\n return;\n }\n\n // overscroll-behavior should prevent scroll chaining, but currently does not\n // if the element doesn't actually overflow. https://bugs.webkit.org/show_bug.cgi?id=243452\n // This checks that both the width and height do not overflow, otherwise we might\n // block horizontal scrolling too. In that case, adding `touch-action: pan-x` to\n // the element will prevent vertical page scrolling. We can't add that automatically\n // because it must be set before the touchstart event.\n if (scrollable.scrollHeight === scrollable.clientHeight && scrollable.scrollWidth === scrollable.clientWidth) {\n e.preventDefault();\n }\n };\n\n let onBlur = (e: FocusEvent) => {\n let target = getEventTarget(e) as HTMLElement;\n let relatedTarget = e.relatedTarget as HTMLElement | null;\n if (relatedTarget && willOpenKeyboard(relatedTarget)) {\n // Focus without scrolling the whole page, and then scroll into view manually.\n relatedTarget.focus({preventScroll: true});\n scrollIntoViewWhenReady(relatedTarget, willOpenKeyboard(target));\n } else if (!relatedTarget) {\n // When tapping the Done button on the keyboard, focus moves to the body.\n // FocusScope will then restore focus back to the input. Later when tapping\n // the same input again, it is already focused, so no blur event will fire,\n // resulting in the flow above never running and Safari's native scrolling occurring.\n // Instead, move focus to the parent focusable element (e.g. the dialog).\n let focusable = target.parentElement?.closest('[tabindex]') as HTMLElement | null;\n focusable?.focus({preventScroll: true});\n }\n };\n\n // Override programmatic focus to scroll into view without scrolling the whole page.\n let focus = HTMLElement.prototype.focus;\n HTMLElement.prototype.focus = function (opts) {\n // Track whether the keyboard was already visible before.\n let activeElement = getActiveElement();\n let wasKeyboardVisible = activeElement != null && willOpenKeyboard(activeElement);\n\n // Focus the element without scrolling the page.\n focus.call(this, {...opts, preventScroll: true});\n\n if (!opts || !opts.preventScroll) {\n scrollIntoViewWhenReady(this, wasKeyboardVisible);\n }\n };\n\n let removeEvents = chain(\n addEvent(document, 'touchstart', onTouchStart, {passive: false, capture: true}),\n addEvent(document, 'touchmove', onTouchMove, {passive: false, capture: true}),\n addEvent(document, 'blur', onBlur, true)\n );\n\n return () => {\n restoreOverflow();\n removeEvents();\n style.remove();\n HTMLElement.prototype.focus = focus;\n };\n}\n\n// Sets a CSS property on an element, and returns a function to revert it to the previous value.\nfunction setStyle(element: HTMLElement, style: string, value: string) {\n let cur = element.style[style];\n element.style[style] = value;\n\n return () => {\n element.style[style] = cur;\n };\n}\n\n// Adds an event listener to an element, and returns a function to remove it.\nfunction addEvent<K extends keyof GlobalEventHandlersEventMap>(\n target: Document | Window,\n event: K,\n handler: (this: Document | Window, ev: GlobalEventHandlersEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n) {\n // internal function, so it's ok to ignore the difficult to fix type error\n // @ts-ignore\n target.addEventListener(event, handler, options);\n return () => {\n // @ts-ignore\n target.removeEventListener(event, handler, options);\n };\n}\n\nfunction scrollIntoViewWhenReady(target: Element, wasKeyboardVisible: boolean) {\n if (wasKeyboardVisible || !visualViewport) {\n // If the keyboard was already visible, scroll the target into view immediately.\n scrollIntoView(target);\n } else {\n // Otherwise, wait for the visual viewport to resize before scrolling so we can\n // measure the correct position to scroll to.\n visualViewport.addEventListener('resize', () => scrollIntoView(target), {once: true});\n }\n}\n\nfunction scrollIntoView(target: Element) {\n let root = document.scrollingElement || document.documentElement;\n let nextTarget: Element | null = target;\n while (nextTarget && nextTarget !== root) {\n // Find the parent scrollable element and adjust the scroll position if the target is not already in view.\n let scrollable = getScrollParent(nextTarget);\n if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== nextTarget) {\n let scrollableRect = scrollable.getBoundingClientRect();\n let targetRect = nextTarget.getBoundingClientRect();\n if (targetRect.top < scrollableRect.top || targetRect.bottom > scrollableRect.top + nextTarget.clientHeight) {\n let bottom = scrollableRect.bottom;\n if (visualViewport) {\n bottom = Math.min(bottom, visualViewport.offsetTop + visualViewport.height);\n }\n\n // Center within the viewport.\n let adjustment = (targetRect.top - scrollableRect.top) - ((bottom - scrollableRect.top) / 2 - targetRect.height / 2);\n scrollable.scrollTo({\n // Clamp to the valid range to prevent over-scrolling.\n top: Math.max(0, Math.min(scrollable.scrollHeight - scrollable.clientHeight, scrollable.scrollTop + adjustment)),\n behavior: 'smooth'\n });\n }\n }\n\n nextTarget = scrollable.parentElement;\n }\n}\n"],"names":[],"version":3,"file":"usePreventScroll.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAiBD,MAAM,uCAAiB,OAAO,aAAa,eAAe,OAAO,cAAc;AAE/E,mIAAmI;AACnI,IAAI,2CAAqB;AACzB,IAAI;AAOG,SAAS,0CAAiB,UAAgC,CAAC,CAAC;IACjE,IAAI,cAAC,UAAU,EAAC,GAAG;IAEnB,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,YACF;QAGF;QACA,IAAI,6CAAuB;YACzB,IAAI,CAAA,GAAA,yCAAI,KACN,gCAAU;iBAEV,gCAAU;;QAId,OAAO;YACL;YACA,IAAI,6CAAuB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ACb,OAAO,mBAAmB,CAAC,OAAO,SAAS;IAC7C;AACF;AAEA,SAAS,8CAAwB,MAAe,EAAE,kBAA2B;IAC3E,IAAI,sBAAsB,CAAC,sCACzB,gFAAgF;IAChF,qCAAe;SAEf,+EAA+E;IAC/E,6CAA6C;IAC7C,qCAAe,gBAAgB,CAAC,UAAU,IAAM,qCAAe,SAAS;QAAC,MAAM;IAAI;AAEvF;AAEA,SAAS,qCAAe,MAAe;IACrC,IAAI,OAAO,SAAS,gBAAgB,IAAI,SAAS,eAAe;IAChE,IAAI,aAA6B;IACjC,MAAO,cAAc,eAAe,KAAM;QACxC,0GAA0G;QAC1G,IAAI,aAAa,CAAA,GAAA,yCAAc,EAAE;QACjC,IACE,eAAe,SAAS,eAAe,IACvC,eAAe,SAAS,IAAI,IAC5B,eAAe,YACf;YACA,IAAI,iBAAiB,WAAW,qBAAqB;YACrD,IAAI,aAAa,WAAW,qBAAqB;YACjD,IACE,WAAW,GAAG,GAAG,eAAe,GAAG,IACnC,WAAW,MAAM,GAAG,eAAe,GAAG,GAAG,WAAW,YAAY,EAChE;gBACA,IAAI,SAAS,eAAe,MAAM;gBAClC,IAAI,sCACF,SAAS,KAAK,GAAG,CAAC,QAAQ,qCAAe,SAAS,GAAG,qCAAe,MAAM;gBAG5E,8BAA8B;gBAC9B,IAAI,aACF,WAAW,GAAG,GACd,eAAe,GAAG,GACjB,CAAA,AAAC,CAAA,SAAS,eAAe,GAAG,AAAD,IAAK,IAAI,WAAW,MAAM,GAAG,CAAA;gBAC3D,WAAW,QAAQ,CAAC;oBAClB,sDAAsD;oBACtD,KAAK,KAAK,GAAG,CACX,GACA,KAAK,GAAG,CACN,WAAW,YAAY,GAAG,WAAW,YAAY,EACjD,WAAW,SAAS,GAAG;oBAG3B,UAAU;gBACZ;YACF;QACF;QAEA,aAAa,WAAW,aAAa;IACvC;AACF","sources":["packages/react-aria/src/overlays/usePreventScroll.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 {chain} from '../utils/chain';\n\nimport {getActiveElement, getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport {getNonce} from '../utils/getNonce';\nimport {getScrollParent} from '../utils/getScrollParent';\nimport {isIOS} from '../utils/platform';\nimport {isScrollable} from '../utils/isScrollable';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {willOpenKeyboard} from '../utils/keyboard';\n\ninterface PreventScrollOptions {\n /** Whether the scroll lock is disabled. */\n isDisabled?: boolean;\n}\n\nconst visualViewport = typeof document !== 'undefined' && window.visualViewport;\n\n// The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position\nlet preventScrollCount = 0;\nlet restore;\n\n/**\n * Prevents scrolling on the document body on mount, and\n * restores it on unmount. Also ensures that content does not\n * shift due to the scrollbars disappearing.\n */\nexport function usePreventScroll(options: PreventScrollOptions = {}): void {\n let {isDisabled} = options;\n\n useLayoutEffect(() => {\n if (isDisabled) {\n return;\n }\n\n preventScrollCount++;\n if (preventScrollCount === 1) {\n if (isIOS()) {\n restore = preventScrollMobileSafari();\n } else {\n restore = preventScrollStandard();\n }\n }\n\n return () => {\n preventScrollCount--;\n if (preventScrollCount === 0) {\n restore();\n }\n };\n }, [isDisabled]);\n}\n\n// For most browsers, all we need to do is set `overflow: hidden` on the root element, and\n// add some padding to prevent the page from shifting when the scrollbar is hidden.\nfunction preventScrollStandard() {\n let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;\n return chain(\n scrollbarWidth > 0 &&\n // Use scrollbar-gutter when supported because it also works for fixed positioned elements.\n ('scrollbarGutter' in document.documentElement.style\n ? setStyle(document.documentElement, 'scrollbarGutter', 'stable')\n : setStyle(document.documentElement, 'paddingRight', `${scrollbarWidth}px`)),\n setStyle(document.documentElement, 'overflow', 'hidden')\n );\n}\n\n// Mobile Safari is a whole different beast. Even with overflow: hidden,\n// it still scrolls the page in many situations:\n//\n// 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.\n// 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of\n// it, so it becomes scrollable.\n// 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.\n// This may cause even fixed position elements to scroll off the screen.\n// 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always\n// scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.\n//\n// In order to work around these cases, and prevent scrolling without jankiness, we do a few things:\n//\n// 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling\n// on the window.\n// 2. Set `overscroll-behavior: contain` on nested scrollable regions so they do not scroll the page when at\n// the top or bottom. Work around a bug where this does not work when the element does not actually overflow\n// by preventing default in a `touchmove` event. This is best effort: we can't prevent default when pinch\n// zooming or when an element contains text selection, which may allow scrolling in some cases.\n// 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.\n// 4. When focus moves to an input, create an off screen input and focus that temporarily. This prevents\n// Safari from scrolling the page. After a small delay, focus the real input and scroll it into view\n// ourselves, without scrolling the whole page.\nfunction preventScrollMobileSafari() {\n // Set overflow hidden so scrollIntoViewport() (useSelectableCollection) sees isScrollPrevented and\n // scrolls only scroll parents instead of calling native scrollIntoView() which moves the window.\n let restoreOverflow = setStyle(document.documentElement, 'overflow', 'hidden');\n\n let scrollable: Element;\n let allowTouchMove = false;\n let onTouchStart = (e: TouchEvent) => {\n // Store the nearest scrollable parent element from the element that the user touched.\n let target = getEventTarget(e) as Element;\n scrollable = isScrollable(target) ? target : getScrollParent(target, true);\n allowTouchMove = false;\n\n // If the target is selected, don't preventDefault in touchmove to allow user to adjust selection.\n let selection = target.ownerDocument.defaultView!.getSelection();\n if (selection && !selection.isCollapsed && selection.containsNode(target, true)) {\n allowTouchMove = true;\n }\n\n // If this is a range input, allow touch move to allow user to adjust the slider value\n if (e.composedPath().some(el => el instanceof HTMLInputElement && el.type === 'range')) {\n allowTouchMove = true;\n }\n\n // If this is a focused input element with a selected range, allow user to drag the selection handles.\n if (\n 'selectionStart' in target &&\n 'selectionEnd' in target &&\n (target.selectionStart as number) < (target.selectionEnd as number) &&\n target.ownerDocument.activeElement === target\n ) {\n allowTouchMove = true;\n }\n };\n\n // Prevent scrolling up when at the top and scrolling down when at the bottom\n // of a nested scrollable area, otherwise mobile Safari will start scrolling\n // the window instead.\n // This must be applied before the touchstart event as of iOS 26, so inject it as a <style> element.\n let style = document.createElement('style');\n let nonce = getNonce();\n if (nonce) {\n style.nonce = nonce;\n }\n style.textContent = `\n@layer {\n * {\n overscroll-behavior: contain;\n }\n}`.trim();\n document.head.prepend(style);\n\n let onTouchMove = (e: TouchEvent) => {\n // Allow pinch-zooming.\n if (e.touches.length === 2 || allowTouchMove) {\n return;\n }\n\n // Prevent scrolling the window.\n if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {\n e.preventDefault();\n return;\n }\n\n // overscroll-behavior should prevent scroll chaining, but currently does not\n // if the element doesn't actually overflow. https://bugs.webkit.org/show_bug.cgi?id=243452\n // This checks that both the width and height do not overflow, otherwise we might\n // block horizontal scrolling too. In that case, adding `touch-action: pan-x` to\n // the element will prevent vertical page scrolling. We can't add that automatically\n // because it must be set before the touchstart event.\n if (\n scrollable.scrollHeight === scrollable.clientHeight &&\n scrollable.scrollWidth === scrollable.clientWidth\n ) {\n e.preventDefault();\n }\n };\n\n let onBlur = (e: FocusEvent) => {\n let target = getEventTarget(e) as HTMLElement;\n let relatedTarget = e.relatedTarget as HTMLElement | null;\n if (relatedTarget && willOpenKeyboard(relatedTarget)) {\n // Focus without scrolling the whole page, and then scroll into view manually.\n relatedTarget.focus({preventScroll: true});\n scrollIntoViewWhenReady(relatedTarget, willOpenKeyboard(target));\n } else if (!relatedTarget) {\n // When tapping the Done button on the keyboard, focus moves to the body.\n // FocusScope will then restore focus back to the input. Later when tapping\n // the same input again, it is already focused, so no blur event will fire,\n // resulting in the flow above never running and Safari's native scrolling occurring.\n // Instead, move focus to the parent focusable element (e.g. the dialog).\n let focusable = target.parentElement?.closest('[tabindex]') as HTMLElement | null;\n focusable?.focus({preventScroll: true});\n }\n };\n\n // Override programmatic focus to scroll into view without scrolling the whole page.\n let focus = HTMLElement.prototype.focus;\n HTMLElement.prototype.focus = function (opts) {\n // Track whether the keyboard was already visible before.\n let activeElement = getActiveElement();\n let wasKeyboardVisible = activeElement != null && willOpenKeyboard(activeElement);\n\n // Focus the element without scrolling the page.\n focus.call(this, {...opts, preventScroll: true});\n\n if (!opts || !opts.preventScroll) {\n scrollIntoViewWhenReady(this, wasKeyboardVisible);\n }\n };\n\n let removeEvents = chain(\n addEvent(document, 'touchstart', onTouchStart, {passive: false, capture: true}),\n addEvent(document, 'touchmove', onTouchMove, {passive: false, capture: true}),\n addEvent(document, 'blur', onBlur, true)\n );\n\n return () => {\n restoreOverflow();\n removeEvents();\n style.remove();\n HTMLElement.prototype.focus = focus;\n };\n}\n\n// Sets a CSS property on an element, and returns a function to revert it to the previous value.\nfunction setStyle(element: HTMLElement, style: string, value: string) {\n let cur = element.style[style];\n element.style[style] = value;\n\n return () => {\n element.style[style] = cur;\n };\n}\n\n// Adds an event listener to an element, and returns a function to remove it.\nfunction addEvent<K extends keyof GlobalEventHandlersEventMap>(\n target: Document | Window,\n event: K,\n handler: (this: Document | Window, ev: GlobalEventHandlersEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n) {\n // internal function, so it's ok to ignore the difficult to fix type error\n // @ts-ignore\n target.addEventListener(event, handler, options);\n return () => {\n // @ts-ignore\n target.removeEventListener(event, handler, options);\n };\n}\n\nfunction scrollIntoViewWhenReady(target: Element, wasKeyboardVisible: boolean) {\n if (wasKeyboardVisible || !visualViewport) {\n // If the keyboard was already visible, scroll the target into view immediately.\n scrollIntoView(target);\n } else {\n // Otherwise, wait for the visual viewport to resize before scrolling so we can\n // measure the correct position to scroll to.\n visualViewport.addEventListener('resize', () => scrollIntoView(target), {once: true});\n }\n}\n\nfunction scrollIntoView(target: Element) {\n let root = document.scrollingElement || document.documentElement;\n let nextTarget: Element | null = target;\n while (nextTarget && nextTarget !== root) {\n // Find the parent scrollable element and adjust the scroll position if the target is not already in view.\n let scrollable = getScrollParent(nextTarget);\n if (\n scrollable !== document.documentElement &&\n scrollable !== document.body &&\n scrollable !== nextTarget\n ) {\n let scrollableRect = scrollable.getBoundingClientRect();\n let targetRect = nextTarget.getBoundingClientRect();\n if (\n targetRect.top < scrollableRect.top ||\n targetRect.bottom > scrollableRect.top + nextTarget.clientHeight\n ) {\n let bottom = scrollableRect.bottom;\n if (visualViewport) {\n bottom = Math.min(bottom, visualViewport.offsetTop + visualViewport.height);\n }\n\n // Center within the viewport.\n let adjustment =\n targetRect.top -\n scrollableRect.top -\n ((bottom - scrollableRect.top) / 2 - targetRect.height / 2);\n scrollable.scrollTo({\n // Clamp to the valid range to prevent over-scrolling.\n top: Math.max(\n 0,\n Math.min(\n scrollable.scrollHeight - scrollable.clientHeight,\n scrollable.scrollTop + adjustment\n )\n ),\n behavior: 'smooth'\n });\n }\n }\n\n nextTarget = scrollable.parentElement;\n }\n}\n"],"names":[],"version":3,"file":"usePreventScroll.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAiBD,MAAM,uCAAiB,OAAO,aAAa,eAAe,OAAO,cAAc;AAE/E,mIAAmI;AACnI,IAAI,2CAAqB;AACzB,IAAI;AAOG,SAAS,0CAAiB,UAAgC,CAAC,CAAC;IACjE,IAAI,cAAC,UAAU,EAAC,GAAG;IAEnB,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,YACF;QAGF;QACA,IAAI,6CAAuB;YACzB,IAAI,CAAA,GAAA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*\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 {chain} from '../utils/chain';\n\nimport {getActiveElement, getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport {getNonce} from '../utils/getNonce';\nimport {getScrollParent} from '../utils/getScrollParent';\nimport {isIOS} from '../utils/platform';\nimport {isScrollable} from '../utils/isScrollable';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {willOpenKeyboard} from '../utils/keyboard';\n\ninterface PreventScrollOptions {\n /** Whether the scroll lock is disabled. */\n isDisabled?: boolean\n}\n\nconst visualViewport = typeof document !== 'undefined' && window.visualViewport;\n\n// The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position\nlet preventScrollCount = 0;\nlet restore;\n\n/**\n * Prevents scrolling on the document body on mount, and\n * restores it on unmount. Also ensures that content does not\n * shift due to the scrollbars disappearing.\n */\nexport function usePreventScroll(options: PreventScrollOptions = {}): void {\n let {isDisabled} = options;\n\n useLayoutEffect(() => {\n if (isDisabled) {\n return;\n }\n\n preventScrollCount++;\n if (preventScrollCount === 1) {\n if (isIOS()) {\n restore = preventScrollMobileSafari();\n } else {\n restore = preventScrollStandard();\n }\n }\n\n return () => {\n preventScrollCount--;\n if (preventScrollCount === 0) {\n restore();\n }\n };\n }, [isDisabled]);\n}\n\n// For most browsers, all we need to do is set `overflow: hidden` on the root element, and\n// add some padding to prevent the page from shifting when the scrollbar is hidden.\nfunction preventScrollStandard() {\n let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;\n return chain(\n scrollbarWidth > 0 &&\n // Use scrollbar-gutter when supported because it also works for fixed positioned elements.\n ('scrollbarGutter' in document.documentElement.style\n ? setStyle(document.documentElement, 'scrollbarGutter', 'stable')\n : setStyle(document.documentElement, 'paddingRight', `${scrollbarWidth}px`)),\n setStyle(document.documentElement, 'overflow', 'hidden')\n );\n}\n\n// Mobile Safari is a whole different beast. Even with overflow: hidden,\n// it still scrolls the page in many situations:\n//\n// 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.\n// 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of\n// it, so it becomes scrollable.\n// 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.\n// This may cause even fixed position elements to scroll off the screen.\n// 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always\n// scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.\n//\n// In order to work around these cases, and prevent scrolling without jankiness, we do a few things:\n//\n// 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling\n// on the window.\n// 2. Set `overscroll-behavior: contain` on nested scrollable regions so they do not scroll the page when at\n// the top or bottom. Work around a bug where this does not work when the element does not actually overflow\n// by preventing default in a `touchmove` event. This is best effort: we can't prevent default when pinch\n// zooming or when an element contains text selection, which may allow scrolling in some cases.\n// 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.\n// 4. When focus moves to an input, create an off screen input and focus that temporarily. This prevents\n// Safari from scrolling the page. After a small delay, focus the real input and scroll it into view\n// ourselves, without scrolling the whole page.\nfunction preventScrollMobileSafari() {\n // Set overflow hidden so scrollIntoViewport() (useSelectableCollection) sees isScrollPrevented and\n // scrolls only scroll parents instead of calling native scrollIntoView() which moves the window.\n let restoreOverflow = setStyle(document.documentElement, 'overflow', 'hidden');\n\n let scrollable: Element;\n let allowTouchMove = false;\n let onTouchStart = (e: TouchEvent) => {\n // Store the nearest scrollable parent element from the element that the user touched.\n let target = getEventTarget(e) as Element;\n scrollable = isScrollable(target) ? target : getScrollParent(target, true);\n allowTouchMove = false;\n\n // If the target is selected, don't preventDefault in touchmove to allow user to adjust selection.\n let selection = target.ownerDocument.defaultView!.getSelection();\n if (selection && !selection.isCollapsed && selection.containsNode(target, true)) {\n allowTouchMove = true;\n }\n\n // If this is a range input, allow touch move to allow user to adjust the slider value\n if (e.composedPath().some((el) =>\n el instanceof HTMLInputElement &&\n el.type === 'range'\n )) {\n allowTouchMove = true;\n }\n\n // If this is a focused input element with a selected range, allow user to drag the selection handles.\n if (\n 'selectionStart' in target &&\n 'selectionEnd' in target &&\n (target.selectionStart as number) < (target.selectionEnd as number) &&\n target.ownerDocument.activeElement === target\n ) {\n allowTouchMove = true;\n }\n };\n\n // Prevent scrolling up when at the top and scrolling down when at the bottom\n // of a nested scrollable area, otherwise mobile Safari will start scrolling\n // the window instead.\n // This must be applied before the touchstart event as of iOS 26, so inject it as a <style> element.\n let style = document.createElement('style');\n let nonce = getNonce();\n if (nonce) {\n style.nonce = nonce;\n }\n style.textContent = `\n@layer {\n * {\n overscroll-behavior: contain;\n }\n}`.trim();\n document.head.prepend(style);\n\n let onTouchMove = (e: TouchEvent) => {\n // Allow pinch-zooming.\n if (e.touches.length === 2 || allowTouchMove) {\n return;\n }\n\n // Prevent scrolling the window.\n if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {\n e.preventDefault();\n return;\n }\n\n // overscroll-behavior should prevent scroll chaining, but currently does not\n // if the element doesn't actually overflow. https://bugs.webkit.org/show_bug.cgi?id=243452\n // This checks that both the width and height do not overflow, otherwise we might\n // block horizontal scrolling too. In that case, adding `touch-action: pan-x` to\n // the element will prevent vertical page scrolling. We can't add that automatically\n // because it must be set before the touchstart event.\n if (scrollable.scrollHeight === scrollable.clientHeight && scrollable.scrollWidth === scrollable.clientWidth) {\n e.preventDefault();\n }\n };\n\n let onBlur = (e: FocusEvent) => {\n let target = getEventTarget(e) as HTMLElement;\n let relatedTarget = e.relatedTarget as HTMLElement | null;\n if (relatedTarget && willOpenKeyboard(relatedTarget)) {\n // Focus without scrolling the whole page, and then scroll into view manually.\n relatedTarget.focus({preventScroll: true});\n scrollIntoViewWhenReady(relatedTarget, willOpenKeyboard(target));\n } else if (!relatedTarget) {\n // When tapping the Done button on the keyboard, focus moves to the body.\n // FocusScope will then restore focus back to the input. Later when tapping\n // the same input again, it is already focused, so no blur event will fire,\n // resulting in the flow above never running and Safari's native scrolling occurring.\n // Instead, move focus to the parent focusable element (e.g. the dialog).\n let focusable = target.parentElement?.closest('[tabindex]') as HTMLElement | null;\n focusable?.focus({preventScroll: true});\n }\n };\n\n // Override programmatic focus to scroll into view without scrolling the whole page.\n let focus = HTMLElement.prototype.focus;\n HTMLElement.prototype.focus = function (opts) {\n // Track whether the keyboard was already visible before.\n let activeElement = getActiveElement();\n let wasKeyboardVisible = activeElement != null && willOpenKeyboard(activeElement);\n\n // Focus the element without scrolling the page.\n focus.call(this, {...opts, preventScroll: true});\n\n if (!opts || !opts.preventScroll) {\n scrollIntoViewWhenReady(this, wasKeyboardVisible);\n }\n };\n\n let removeEvents = chain(\n addEvent(document, 'touchstart', onTouchStart, {passive: false, capture: true}),\n addEvent(document, 'touchmove', onTouchMove, {passive: false, capture: true}),\n addEvent(document, 'blur', onBlur, true)\n );\n\n return () => {\n restoreOverflow();\n removeEvents();\n style.remove();\n HTMLElement.prototype.focus = focus;\n };\n}\n\n// Sets a CSS property on an element, and returns a function to revert it to the previous value.\nfunction setStyle(element: HTMLElement, style: string, value: string) {\n let cur = element.style[style];\n element.style[style] = value;\n\n return () => {\n element.style[style] = cur;\n };\n}\n\n// Adds an event listener to an element, and returns a function to remove it.\nfunction addEvent<K extends keyof GlobalEventHandlersEventMap>(\n target: Document | Window,\n event: K,\n handler: (this: Document | Window, ev: GlobalEventHandlersEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n) {\n // internal function, so it's ok to ignore the difficult to fix type error\n // @ts-ignore\n target.addEventListener(event, handler, options);\n return () => {\n // @ts-ignore\n target.removeEventListener(event, handler, options);\n };\n}\n\nfunction scrollIntoViewWhenReady(target: Element, wasKeyboardVisible: boolean) {\n if (wasKeyboardVisible || !visualViewport) {\n // If the keyboard was already visible, scroll the target into view immediately.\n scrollIntoView(target);\n } else {\n // Otherwise, wait for the visual viewport to resize before scrolling so we can\n // measure the correct position to scroll to.\n visualViewport.addEventListener('resize', () => scrollIntoView(target), {once: true});\n }\n}\n\nfunction scrollIntoView(target: Element) {\n let root = document.scrollingElement || document.documentElement;\n let nextTarget: Element | null = target;\n while (nextTarget && nextTarget !== root) {\n // Find the parent scrollable element and adjust the scroll position if the target is not already in view.\n let scrollable = getScrollParent(nextTarget);\n if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== nextTarget) {\n let scrollableRect = scrollable.getBoundingClientRect();\n let targetRect = nextTarget.getBoundingClientRect();\n if (targetRect.top < scrollableRect.top || targetRect.bottom > scrollableRect.top + nextTarget.clientHeight) {\n let bottom = scrollableRect.bottom;\n if (visualViewport) {\n bottom = Math.min(bottom, visualViewport.offsetTop + visualViewport.height);\n }\n\n // Center within the viewport.\n let adjustment = (targetRect.top - scrollableRect.top) - ((bottom - scrollableRect.top) / 2 - targetRect.height / 2);\n scrollable.scrollTo({\n // Clamp to the valid range to prevent over-scrolling.\n top: Math.max(0, Math.min(scrollable.scrollHeight - scrollable.clientHeight, scrollable.scrollTop + adjustment)),\n behavior: 'smooth'\n });\n }\n }\n\n nextTarget = scrollable.parentElement;\n }\n}\n"],"names":[],"version":3,"file":"usePreventScroll.mjs.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAiBD,MAAM,uCAAiB,OAAO,aAAa,eAAe,OAAO,cAAc;AAE/E,mIAAmI;AACnI,IAAI,2CAAqB;AACzB,IAAI;AAOG,SAAS,0CAAiB,UAAgC,CAAC,CAAC;IACjE,IAAI,cAAC,UAAU,EAAC,GAAG;IAEnB,CAAA,GAAA,yCAAc,EAAE;QACd,IAAI,YACF;QAGF;QACA,IAAI,6CAAuB;YACzB,IAAI,CAAA,GAAA,yCAAI,KACN,gCAAU;iBAE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BAAmB,CAAC,OAAO,SAAS;IAC7C;AACF;AAEA,SAAS,8CAAwB,MAAe,EAAE,kBAA2B;IAC3E,IAAI,sBAAsB,CAAC,sCACzB,gFAAgF;IAChF,qCAAe;SAEf,+EAA+E;IAC/E,6CAA6C;IAC7C,qCAAe,gBAAgB,CAAC,UAAU,IAAM,qCAAe,SAAS;QAAC,MAAM;IAAI;AAEvF;AAEA,SAAS,qCAAe,MAAe;IACrC,IAAI,OAAO,SAAS,gBAAgB,IAAI,SAAS,eAAe;IAChE,IAAI,aAA6B;IACjC,MAAO,cAAc,eAAe,KAAM;QACxC,0GAA0G;QAC1G,IAAI,aAAa,CAAA,GAAA,yCAAc,EAAE;QACjC,IACE,eAAe,SAAS,eAAe,IACvC,eAAe,SAAS,IAAI,IAC5B,eAAe,YACf;YACA,IAAI,iBAAiB,WAAW,qBAAqB;YACrD,IAAI,aAAa,WAAW,qBAAqB;YACjD,IACE,WAAW,GAAG,GAAG,eAAe,GAAG,IACnC,WAAW,MAAM,GAAG,eAAe,GAAG,GAAG,WAAW,YAAY,EAChE;gBACA,IAAI,SAAS,eAAe,MAAM;gBAClC,IAAI,sCACF,SAAS,KAAK,GAAG,CAAC,QAAQ,qCAAe,SAAS,GAAG,qCAAe,MAAM;gBAG5E,8BAA8B;gBAC9B,IAAI,aACF,WAAW,GAAG,GACd,eAAe,GAAG,GACjB,CAAA,AAAC,CAAA,SAAS,eAAe,GAAG,AAAD,IAAK,IAAI,WAAW,MAAM,GAAG,CAAA;gBAC3D,WAAW,QAAQ,CAAC;oBAClB,sDAAsD;oBACtD,KAAK,KAAK,GAAG,CACX,GACA,KAAK,GAAG,CACN,WAAW,YAAY,GAAG,WAAW,YAAY,EACjD,WAAW,SAAS,GAAG;oBAG3B,UAAU;gBACZ;YACF;QACF;QAEA,aAAa,WAAW,aAAa;IACvC;AACF","sources":["packages/react-aria/src/overlays/usePreventScroll.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 {chain} from '../utils/chain';\n\nimport {getActiveElement, getEventTarget} from '../utils/shadowdom/DOMFunctions';\nimport {getNonce} from '../utils/getNonce';\nimport {getScrollParent} from '../utils/getScrollParent';\nimport {isIOS} from '../utils/platform';\nimport {isScrollable} from '../utils/isScrollable';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {willOpenKeyboard} from '../utils/keyboard';\n\ninterface PreventScrollOptions {\n /** Whether the scroll lock is disabled. */\n isDisabled?: boolean;\n}\n\nconst visualViewport = typeof document !== 'undefined' && window.visualViewport;\n\n// The number of active usePreventScroll calls. Used to determine whether to revert back to the original page style/scroll position\nlet preventScrollCount = 0;\nlet restore;\n\n/**\n * Prevents scrolling on the document body on mount, and\n * restores it on unmount. Also ensures that content does not\n * shift due to the scrollbars disappearing.\n */\nexport function usePreventScroll(options: PreventScrollOptions = {}): void {\n let {isDisabled} = options;\n\n useLayoutEffect(() => {\n if (isDisabled) {\n return;\n }\n\n preventScrollCount++;\n if (preventScrollCount === 1) {\n if (isIOS()) {\n restore = preventScrollMobileSafari();\n } else {\n restore = preventScrollStandard();\n }\n }\n\n return () => {\n preventScrollCount--;\n if (preventScrollCount === 0) {\n restore();\n }\n };\n }, [isDisabled]);\n}\n\n// For most browsers, all we need to do is set `overflow: hidden` on the root element, and\n// add some padding to prevent the page from shifting when the scrollbar is hidden.\nfunction preventScrollStandard() {\n let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;\n return chain(\n scrollbarWidth > 0 &&\n // Use scrollbar-gutter when supported because it also works for fixed positioned elements.\n ('scrollbarGutter' in document.documentElement.style\n ? setStyle(document.documentElement, 'scrollbarGutter', 'stable')\n : setStyle(document.documentElement, 'paddingRight', `${scrollbarWidth}px`)),\n setStyle(document.documentElement, 'overflow', 'hidden')\n );\n}\n\n// Mobile Safari is a whole different beast. Even with overflow: hidden,\n// it still scrolls the page in many situations:\n//\n// 1. When the bottom toolbar and address bar are collapsed, page scrolling is always allowed.\n// 2. When the keyboard is visible, the viewport does not resize. Instead, the keyboard covers part of\n// it, so it becomes scrollable.\n// 3. When tapping on an input, the page always scrolls so that the input is centered in the visual viewport.\n// This may cause even fixed position elements to scroll off the screen.\n// 4. When using the next/previous buttons in the keyboard to navigate between inputs, the whole page always\n// scrolls, even if the input is inside a nested scrollable element that could be scrolled instead.\n//\n// In order to work around these cases, and prevent scrolling without jankiness, we do a few things:\n//\n// 1. Prevent default on `touchmove` events that are not in a scrollable element. This prevents touch scrolling\n// on the window.\n// 2. Set `overscroll-behavior: contain` on nested scrollable regions so they do not scroll the page when at\n// the top or bottom. Work around a bug where this does not work when the element does not actually overflow\n// by preventing default in a `touchmove` event. This is best effort: we can't prevent default when pinch\n// zooming or when an element contains text selection, which may allow scrolling in some cases.\n// 3. Prevent default on `touchend` events on input elements and handle focusing the element ourselves.\n// 4. When focus moves to an input, create an off screen input and focus that temporarily. This prevents\n// Safari from scrolling the page. After a small delay, focus the real input and scroll it into view\n// ourselves, without scrolling the whole page.\nfunction preventScrollMobileSafari() {\n // Set overflow hidden so scrollIntoViewport() (useSelectableCollection) sees isScrollPrevented and\n // scrolls only scroll parents instead of calling native scrollIntoView() which moves the window.\n let restoreOverflow = setStyle(document.documentElement, 'overflow', 'hidden');\n\n let scrollable: Element;\n let allowTouchMove = false;\n let onTouchStart = (e: TouchEvent) => {\n // Store the nearest scrollable parent element from the element that the user touched.\n let target = getEventTarget(e) as Element;\n scrollable = isScrollable(target) ? target : getScrollParent(target, true);\n allowTouchMove = false;\n\n // If the target is selected, don't preventDefault in touchmove to allow user to adjust selection.\n let selection = target.ownerDocument.defaultView!.getSelection();\n if (selection && !selection.isCollapsed && selection.containsNode(target, true)) {\n allowTouchMove = true;\n }\n\n // If this is a range input, allow touch move to allow user to adjust the slider value\n if (e.composedPath().some(el => el instanceof HTMLInputElement && el.type === 'range')) {\n allowTouchMove = true;\n }\n\n // If this is a focused input element with a selected range, allow user to drag the selection handles.\n if (\n 'selectionStart' in target &&\n 'selectionEnd' in target &&\n (target.selectionStart as number) < (target.selectionEnd as number) &&\n target.ownerDocument.activeElement === target\n ) {\n allowTouchMove = true;\n }\n };\n\n // Prevent scrolling up when at the top and scrolling down when at the bottom\n // of a nested scrollable area, otherwise mobile Safari will start scrolling\n // the window instead.\n // This must be applied before the touchstart event as of iOS 26, so inject it as a <style> element.\n let style = document.createElement('style');\n let nonce = getNonce();\n if (nonce) {\n style.nonce = nonce;\n }\n style.textContent = `\n@layer {\n * {\n overscroll-behavior: contain;\n }\n}`.trim();\n document.head.prepend(style);\n\n let onTouchMove = (e: TouchEvent) => {\n // Allow pinch-zooming.\n if (e.touches.length === 2 || allowTouchMove) {\n return;\n }\n\n // Prevent scrolling the window.\n if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {\n e.preventDefault();\n return;\n }\n\n // overscroll-behavior should prevent scroll chaining, but currently does not\n // if the element doesn't actually overflow. https://bugs.webkit.org/show_bug.cgi?id=243452\n // This checks that both the width and height do not overflow, otherwise we might\n // block horizontal scrolling too. In that case, adding `touch-action: pan-x` to\n // the element will prevent vertical page scrolling. We can't add that automatically\n // because it must be set before the touchstart event.\n if (\n scrollable.scrollHeight === scrollable.clientHeight &&\n scrollable.scrollWidth === scrollable.clientWidth\n ) {\n e.preventDefault();\n }\n };\n\n let onBlur = (e: FocusEvent) => {\n let target = getEventTarget(e) as HTMLElement;\n let relatedTarget = e.relatedTarget as HTMLElement | null;\n if (relatedTarget && willOpenKeyboard(relatedTarget)) {\n // Focus without scrolling the whole page, and then scroll into view manually.\n relatedTarget.focus({preventScroll: true});\n scrollIntoViewWhenReady(relatedTarget, willOpenKeyboard(target));\n } else if (!relatedTarget) {\n // When tapping the Done button on the keyboard, focus moves to the body.\n // FocusScope will then restore focus back to the input. Later when tapping\n // the same input again, it is already focused, so no blur event will fire,\n // resulting in the flow above never running and Safari's native scrolling occurring.\n // Instead, move focus to the parent focusable element (e.g. the dialog).\n let focusable = target.parentElement?.closest('[tabindex]') as HTMLElement | null;\n focusable?.focus({preventScroll: true});\n }\n };\n\n // Override programmatic focus to scroll into view without scrolling the whole page.\n let focus = HTMLElement.prototype.focus;\n HTMLElement.prototype.focus = function (opts) {\n // Track whether the keyboard was already visible before.\n let activeElement = getActiveElement();\n let wasKeyboardVisible = activeElement != null && willOpenKeyboard(activeElement);\n\n // Focus the element without scrolling the page.\n focus.call(this, {...opts, preventScroll: true});\n\n if (!opts || !opts.preventScroll) {\n scrollIntoViewWhenReady(this, wasKeyboardVisible);\n }\n };\n\n let removeEvents = chain(\n addEvent(document, 'touchstart', onTouchStart, {passive: false, capture: true}),\n addEvent(document, 'touchmove', onTouchMove, {passive: false, capture: true}),\n addEvent(document, 'blur', onBlur, true)\n );\n\n return () => {\n restoreOverflow();\n removeEvents();\n style.remove();\n HTMLElement.prototype.focus = focus;\n };\n}\n\n// Sets a CSS property on an element, and returns a function to revert it to the previous value.\nfunction setStyle(element: HTMLElement, style: string, value: string) {\n let cur = element.style[style];\n element.style[style] = value;\n\n return () => {\n element.style[style] = cur;\n };\n}\n\n// Adds an event listener to an element, and returns a function to remove it.\nfunction addEvent<K extends keyof GlobalEventHandlersEventMap>(\n target: Document | Window,\n event: K,\n handler: (this: Document | Window, ev: GlobalEventHandlersEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n) {\n // internal function, so it's ok to ignore the difficult to fix type error\n // @ts-ignore\n target.addEventListener(event, handler, options);\n return () => {\n // @ts-ignore\n target.removeEventListener(event, handler, options);\n };\n}\n\nfunction scrollIntoViewWhenReady(target: Element, wasKeyboardVisible: boolean) {\n if (wasKeyboardVisible || !visualViewport) {\n // If the keyboard was already visible, scroll the target into view immediately.\n scrollIntoView(target);\n } else {\n // Otherwise, wait for the visual viewport to resize before scrolling so we can\n // measure the correct position to scroll to.\n visualViewport.addEventListener('resize', () => scrollIntoView(target), {once: true});\n }\n}\n\nfunction scrollIntoView(target: Element) {\n let root = document.scrollingElement || document.documentElement;\n let nextTarget: Element | null = target;\n while (nextTarget && nextTarget !== root) {\n // Find the parent scrollable element and adjust the scroll position if the target is not already in view.\n let scrollable = getScrollParent(nextTarget);\n if (\n scrollable !== document.documentElement &&\n scrollable !== document.body &&\n scrollable !== nextTarget\n ) {\n let scrollableRect = scrollable.getBoundingClientRect();\n let targetRect = nextTarget.getBoundingClientRect();\n if (\n targetRect.top < scrollableRect.top ||\n targetRect.bottom > scrollableRect.top + nextTarget.clientHeight\n ) {\n let bottom = scrollableRect.bottom;\n if (visualViewport) {\n bottom = Math.min(bottom, visualViewport.offsetTop + visualViewport.height);\n }\n\n // Center within the viewport.\n let adjustment =\n targetRect.top -\n scrollableRect.top -\n ((bottom - scrollableRect.top) / 2 - targetRect.height / 2);\n scrollable.scrollTo({\n // Clamp to the valid range to prevent over-scrolling.\n top: Math.max(\n 0,\n Math.min(\n scrollable.scrollHeight - scrollable.clientHeight,\n scrollable.scrollTop + adjustment\n )\n ),\n behavior: 'smooth'\n });\n }\n }\n\n nextTarget = scrollable.parentElement;\n }\n}\n"],"names":[],"version":3,"file":"usePreventScroll.mjs.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA4DM,SAAS,0CAAe,KAA2B;IACxD,IAAI,SACF,QAAQ,aACR,WAAW,aACX,WAAW,iBACX,UAAU,mBACV,eAAe,iBACf,gBAAgB;QACd,OAAO;IACT,GACD,GAAG;IAEJ,IAAI,WAAW,CAAA,GAAA,wCAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IACrD,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,kCAAO,EAAE;QACtC,GAAG,KAAK;QACR,kDAAkD;QAClD,6CAA6C;QAC7C,kBAAkB;IACpB;IAEA,QAAQ,CAAA,GAAA,2CAAI,EAAE,OAAO,UAAU;IAC/B,IAAI,aAAa,AAAC,CAAA,QAAQ,QAAO,IAAM,CAAA,WAAW,QAAO;IACzD,IAAI,YAAY,CAAA,GAAA,4CAAiB,EAAE;IAEnC,IAAI,CAAC,mBAAmB,CAAC,YAAY;QACnC,IAAI,gBAAgB,cAAc,KAAK,KAAK,YAAY,aAAa;QACrE,aAAa,UAAU,MAAM,CAAC;IAChC;IAEA,OAAO;QACL,kBAAkB,CAAA,GAAA,oCAAS,EAAE,UAAU;YACrC,GAAG,UAAU;YACb,iBAAiB,kBAAkB,YAAY;YAC/C,iBAAiB;YACjB,iBAAiB;YACjB,kBAAkB,kBAAkB,YAAY;YAChD,MAAM;QACR;oBACA;IACF;AACF","sources":["packages/react-aria/src/progress/useProgressBar.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 {AriaLabelingProps, DOMAttributes, DOMProps} from '@react-types/shared';\nimport {clamp} from 'react-stately/private/utils/number';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {mergeProps} from '../utils/mergeProps';\nimport {ReactNode} from 'react';\nimport {useLabel} from '../label/useLabel';\nimport {useNumberFormatter} from '../i18n/useNumberFormatter';\n\nexport interface ProgressBarBaseProps {\n /**\n * The current value (controlled).\n * @default 0\n */\n value?: number,\n /**\n * The smallest value allowed for the input.\n * @default 0\n */\n minValue?: number,\n /**\n * The largest value allowed for the input.\n * @default 100\n */\n maxValue?: number,\n /** The content to display as the label. */\n label?: ReactNode,\n /**\n * The display format of the value label.\n * @default {style: 'percent'}\n */\n formatOptions?: Intl.NumberFormatOptions,\n /** The content to display as the value's label (e.g. 1 of 4). */\n valueLabel?: ReactNode\n}\n\nexport interface AriaProgressBarBaseProps extends ProgressBarBaseProps, DOMProps, AriaLabelingProps {}\n\nexport interface ProgressBarProps extends ProgressBarBaseProps {\n /**\n * Whether presentation is indeterminate when progress isn't known.\n */\n isIndeterminate?: boolean\n}\n\nexport interface AriaProgressBarProps extends ProgressBarProps, DOMProps, AriaLabelingProps {}\n\nexport interface ProgressBarAria {\n /** Props for the progress bar container element. */\n progressBarProps: DOMAttributes,\n /** Props for the progress bar's visual label element (if any). */\n labelProps: DOMAttributes\n}\n\n/**\n * Provides the accessibility implementation for a progress bar component.\n * Progress bars show either determinate or indeterminate progress of an operation\n * over time.\n */\nexport function useProgressBar(props: AriaProgressBarProps): ProgressBarAria {\n let {\n value = 0,\n minValue = 0,\n maxValue = 100,\n valueLabel,\n isIndeterminate,\n formatOptions = {\n style: 'percent'\n }\n } = props;\n\n let domProps = filterDOMProps(props, {labelable: true});\n let {labelProps, fieldProps} = useLabel({\n ...props,\n // Progress bar is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: 'span'\n });\n\n value = clamp(value, minValue, maxValue);\n let percentage = (value - minValue) / (maxValue - minValue);\n let formatter = useNumberFormatter(formatOptions);\n\n if (!isIndeterminate && !valueLabel) {\n let valueToFormat = formatOptions.style === 'percent' ? percentage : value;\n valueLabel = formatter.format(valueToFormat);\n }\n\n return {\n progressBarProps: mergeProps(domProps, {\n ...fieldProps,\n 'aria-valuenow': isIndeterminate ? undefined : value,\n 'aria-valuemin': minValue,\n 'aria-valuemax': maxValue,\n 'aria-valuetext': isIndeterminate ? undefined : valueLabel as string,\n role: 'progressbar'\n }),\n labelProps\n };\n}\n"],"names":[],"version":3,"file":"useProgressBar.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAiEM,SAAS,0CAAe,KAA2B;IACxD,IAAI,SACF,QAAQ,aACR,WAAW,aACX,WAAW,iBACX,UAAU,mBACV,eAAe,iBACf,gBAAgB;QACd,OAAO;IACT,GACD,GAAG;IAEJ,IAAI,WAAW,CAAA,GAAA,wCAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IACrD,IAAI,cAAC,UAAU,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,kCAAO,EAAE;QACtC,GAAG,KAAK;QACR,kDAAkD;QAClD,6CAA6C;QAC7C,kBAAkB;IACpB;IAEA,QAAQ,CAAA,GAAA,2CAAI,EAAE,OAAO,UAAU;IAC/B,IAAI,aAAa,AAAC,CAAA,QAAQ,QAAO,IAAM,CAAA,WAAW,QAAO;IACzD,IAAI,YAAY,CAAA,GAAA,4CAAiB,EAAE;IAEnC,IAAI,CAAC,mBAAmB,CAAC,YAAY;QACnC,IAAI,gBAAgB,cAAc,KAAK,KAAK,YAAY,aAAa;QACrE,aAAa,UAAU,MAAM,CAAC;IAChC;IAEA,OAAO;QACL,kBAAkB,CAAA,GAAA,oCAAS,EAAE,UAAU;YACrC,GAAG,UAAU;YACb,iBAAiB,kBAAkB,YAAY;YAC/C,iBAAiB;YACjB,iBAAiB;YACjB,kBAAkB,kBAAkB,YAAa;YACjD,MAAM;QACR;oBACA;IACF;AACF","sources":["packages/react-aria/src/progress/useProgressBar.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 {AriaLabelingProps, DOMAttributes, DOMProps} from '@react-types/shared';\nimport {clamp} from 'react-stately/private/utils/number';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {mergeProps} from '../utils/mergeProps';\nimport {ReactNode} from 'react';\nimport {useLabel} from '../label/useLabel';\nimport {useNumberFormatter} from '../i18n/useNumberFormatter';\n\nexport interface ProgressBarBaseProps {\n /**\n * The current value (controlled).\n *\n * @default 0\n */\n value?: number;\n /**\n * The smallest value allowed for the input.\n *\n * @default 0\n */\n minValue?: number;\n /**\n * The largest value allowed for the input.\n *\n * @default 100\n */\n maxValue?: number;\n /** The content to display as the label. */\n label?: ReactNode;\n /**\n * The display format of the value label.\n *\n * @default { style: 'percent' }\n */\n formatOptions?: Intl.NumberFormatOptions;\n /** The content to display as the value's label (e.g. 1 of 4). */\n valueLabel?: ReactNode;\n}\n\nexport interface AriaProgressBarBaseProps\n extends ProgressBarBaseProps, DOMProps, AriaLabelingProps {}\n\nexport interface ProgressBarProps extends ProgressBarBaseProps {\n /**\n * Whether presentation is indeterminate when progress isn't known.\n */\n isIndeterminate?: boolean;\n}\n\nexport interface AriaProgressBarProps extends ProgressBarProps, DOMProps, AriaLabelingProps {}\n\nexport interface ProgressBarAria {\n /** Props for the progress bar container element. */\n progressBarProps: DOMAttributes;\n /** Props for the progress bar's visual label element (if any). */\n labelProps: DOMAttributes;\n}\n\n/**\n * Provides the accessibility implementation for a progress bar component.\n * Progress bars show either determinate or indeterminate progress of an operation\n * over time.\n */\nexport function useProgressBar(props: AriaProgressBarProps): ProgressBarAria {\n let {\n value = 0,\n minValue = 0,\n maxValue = 100,\n valueLabel,\n isIndeterminate,\n formatOptions = {\n style: 'percent'\n }\n } = props;\n\n let domProps = filterDOMProps(props, {labelable: true});\n let {labelProps, fieldProps} = useLabel({\n ...props,\n // Progress bar is not an HTML input element so it\n // shouldn't be labeled by a <label> element.\n labelElementType: 'span'\n });\n\n value = clamp(value, minValue, maxValue);\n let percentage = (value - minValue) / (maxValue - minValue);\n let formatter = useNumberFormatter(formatOptions);\n\n if (!isIndeterminate && !valueLabel) {\n let valueToFormat = formatOptions.style === 'percent' ? percentage : value;\n valueLabel = formatter.format(valueToFormat);\n }\n\n return {\n progressBarProps: mergeProps(domProps, {\n ...fieldProps,\n 'aria-valuenow': isIndeterminate ? undefined : value,\n 'aria-valuemin': minValue,\n 'aria-valuemax': maxValue,\n 'aria-valuetext': isIndeterminate ? undefined : (valueLabel as string),\n role: 'progressbar'\n }),\n labelProps\n };\n}\n"],"names":[],"version":3,"file":"useProgressBar.cjs.map"}