react-aria-components 1.5.0 → 1.7.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 (428) hide show
  1. package/README.md +1 -1
  2. package/dist/Autocomplete.main.js +91 -0
  3. package/dist/Autocomplete.main.js.map +1 -0
  4. package/dist/Autocomplete.mjs +79 -0
  5. package/dist/Autocomplete.module.js +79 -0
  6. package/dist/Autocomplete.module.js.map +1 -0
  7. package/dist/Breadcrumbs.main.js +2 -5
  8. package/dist/Breadcrumbs.main.js.map +1 -1
  9. package/dist/Breadcrumbs.mjs +3 -6
  10. package/dist/Breadcrumbs.module.js +3 -6
  11. package/dist/Breadcrumbs.module.js.map +1 -1
  12. package/dist/Button.main.js +5 -5
  13. package/dist/Button.main.js.map +1 -1
  14. package/dist/Button.mjs +5 -5
  15. package/dist/Button.module.js +5 -5
  16. package/dist/Button.module.js.map +1 -1
  17. package/dist/Calendar.main.js +29 -28
  18. package/dist/Calendar.main.js.map +1 -1
  19. package/dist/Calendar.mjs +30 -29
  20. package/dist/Calendar.module.js +30 -29
  21. package/dist/Calendar.module.js.map +1 -1
  22. package/dist/Checkbox.main.js +6 -13
  23. package/dist/Checkbox.main.js.map +1 -1
  24. package/dist/Checkbox.mjs +7 -14
  25. package/dist/Checkbox.module.js +7 -14
  26. package/dist/Checkbox.module.js.map +1 -1
  27. package/dist/Collection.main.js.map +1 -1
  28. package/dist/Collection.module.js.map +1 -1
  29. package/dist/ColorArea.main.js +6 -9
  30. package/dist/ColorArea.main.js.map +1 -1
  31. package/dist/ColorArea.mjs +5 -8
  32. package/dist/ColorArea.module.js +5 -8
  33. package/dist/ColorArea.module.js.map +1 -1
  34. package/dist/ColorField.main.js +10 -15
  35. package/dist/ColorField.main.js.map +1 -1
  36. package/dist/ColorField.mjs +6 -11
  37. package/dist/ColorField.module.js +6 -11
  38. package/dist/ColorField.module.js.map +1 -1
  39. package/dist/ColorPicker.main.js +2 -2
  40. package/dist/ColorPicker.main.js.map +1 -1
  41. package/dist/ColorPicker.mjs +1 -1
  42. package/dist/ColorPicker.module.js +1 -1
  43. package/dist/ColorPicker.module.js.map +1 -1
  44. package/dist/ColorSlider.main.js +7 -12
  45. package/dist/ColorSlider.main.js.map +1 -1
  46. package/dist/ColorSlider.mjs +5 -10
  47. package/dist/ColorSlider.module.js +5 -10
  48. package/dist/ColorSlider.module.js.map +1 -1
  49. package/dist/ColorSwatch.main.js +4 -7
  50. package/dist/ColorSwatch.main.js.map +1 -1
  51. package/dist/ColorSwatch.mjs +3 -6
  52. package/dist/ColorSwatch.module.js +3 -6
  53. package/dist/ColorSwatch.module.js.map +1 -1
  54. package/dist/ColorSwatchPicker.main.js +7 -11
  55. package/dist/ColorSwatchPicker.main.js.map +1 -1
  56. package/dist/ColorSwatchPicker.mjs +6 -10
  57. package/dist/ColorSwatchPicker.module.js +6 -10
  58. package/dist/ColorSwatchPicker.module.js.map +1 -1
  59. package/dist/ColorThumb.main.js +4 -11
  60. package/dist/ColorThumb.main.js.map +1 -1
  61. package/dist/ColorThumb.mjs +4 -11
  62. package/dist/ColorThumb.module.js +4 -11
  63. package/dist/ColorThumb.module.js.map +1 -1
  64. package/dist/ColorWheel.main.js +9 -15
  65. package/dist/ColorWheel.main.js.map +1 -1
  66. package/dist/ColorWheel.mjs +8 -14
  67. package/dist/ColorWheel.module.js +8 -14
  68. package/dist/ColorWheel.module.js.map +1 -1
  69. package/dist/ComboBox.main.js +3 -6
  70. package/dist/ComboBox.main.js.map +1 -1
  71. package/dist/ComboBox.mjs +4 -7
  72. package/dist/ComboBox.module.js +4 -7
  73. package/dist/ComboBox.module.js.map +1 -1
  74. package/dist/DateField.main.js +12 -26
  75. package/dist/DateField.main.js.map +1 -1
  76. package/dist/DateField.mjs +13 -27
  77. package/dist/DateField.module.js +13 -27
  78. package/dist/DateField.module.js.map +1 -1
  79. package/dist/DatePicker.main.js +6 -13
  80. package/dist/DatePicker.main.js.map +1 -1
  81. package/dist/DatePicker.mjs +7 -14
  82. package/dist/DatePicker.module.js +7 -14
  83. package/dist/DatePicker.module.js.map +1 -1
  84. package/dist/Dialog.main.js +4 -6
  85. package/dist/Dialog.main.js.map +1 -1
  86. package/dist/Dialog.mjs +5 -7
  87. package/dist/Dialog.module.js +5 -7
  88. package/dist/Dialog.module.js.map +1 -1
  89. package/dist/Disclosure.main.js +11 -23
  90. package/dist/Disclosure.main.js.map +1 -1
  91. package/dist/Disclosure.mjs +8 -20
  92. package/dist/Disclosure.module.js +8 -20
  93. package/dist/Disclosure.module.js.map +1 -1
  94. package/dist/DragAndDrop.main.js +2 -5
  95. package/dist/DragAndDrop.main.js.map +1 -1
  96. package/dist/DragAndDrop.mjs +3 -6
  97. package/dist/DragAndDrop.module.js +3 -6
  98. package/dist/DragAndDrop.module.js.map +1 -1
  99. package/dist/DropZone.main.js +3 -8
  100. package/dist/DropZone.main.js.map +1 -1
  101. package/dist/DropZone.mjs +4 -9
  102. package/dist/DropZone.module.js +4 -9
  103. package/dist/DropZone.module.js.map +1 -1
  104. package/dist/FieldError.main.js +2 -5
  105. package/dist/FieldError.main.js.map +1 -1
  106. package/dist/FieldError.mjs +3 -6
  107. package/dist/FieldError.module.js +3 -6
  108. package/dist/FieldError.module.js.map +1 -1
  109. package/dist/FileTrigger.main.js +2 -5
  110. package/dist/FileTrigger.main.js.map +1 -1
  111. package/dist/FileTrigger.mjs +2 -5
  112. package/dist/FileTrigger.module.js +2 -5
  113. package/dist/FileTrigger.module.js.map +1 -1
  114. package/dist/Form.main.js +2 -6
  115. package/dist/Form.main.js.map +1 -1
  116. package/dist/Form.mjs +2 -6
  117. package/dist/Form.module.js +2 -6
  118. package/dist/Form.module.js.map +1 -1
  119. package/dist/GridList.main.js +2 -6
  120. package/dist/GridList.main.js.map +1 -1
  121. package/dist/GridList.mjs +3 -7
  122. package/dist/GridList.module.js +3 -7
  123. package/dist/GridList.module.js.map +1 -1
  124. package/dist/Group.main.js +2 -5
  125. package/dist/Group.main.js.map +1 -1
  126. package/dist/Group.mjs +2 -5
  127. package/dist/Group.module.js +2 -5
  128. package/dist/Group.module.js.map +1 -1
  129. package/dist/Heading.main.js +2 -3
  130. package/dist/Heading.main.js.map +1 -1
  131. package/dist/Heading.mjs +2 -3
  132. package/dist/Heading.module.js +2 -3
  133. package/dist/Heading.module.js.map +1 -1
  134. package/dist/Input.main.js +2 -5
  135. package/dist/Input.main.js.map +1 -1
  136. package/dist/Input.mjs +2 -5
  137. package/dist/Input.module.js +2 -5
  138. package/dist/Input.module.js.map +1 -1
  139. package/dist/Keyboard.main.js +2 -3
  140. package/dist/Keyboard.main.js.map +1 -1
  141. package/dist/Keyboard.mjs +2 -3
  142. package/dist/Keyboard.module.js +2 -3
  143. package/dist/Keyboard.module.js.map +1 -1
  144. package/dist/Label.main.js +2 -3
  145. package/dist/Label.main.js.map +1 -1
  146. package/dist/Label.mjs +2 -3
  147. package/dist/Label.module.js +2 -3
  148. package/dist/Label.module.js.map +1 -1
  149. package/dist/Link.main.js +2 -6
  150. package/dist/Link.main.js.map +1 -1
  151. package/dist/Link.mjs +2 -6
  152. package/dist/Link.module.js +2 -6
  153. package/dist/Link.module.js.map +1 -1
  154. package/dist/ListBox.main.js +23 -11
  155. package/dist/ListBox.main.js.map +1 -1
  156. package/dist/ListBox.mjs +27 -15
  157. package/dist/ListBox.module.js +27 -15
  158. package/dist/ListBox.module.js.map +1 -1
  159. package/dist/Menu.main.js +56 -33
  160. package/dist/Menu.main.js.map +1 -1
  161. package/dist/Menu.mjs +58 -35
  162. package/dist/Menu.module.js +58 -35
  163. package/dist/Menu.module.js.map +1 -1
  164. package/dist/Meter.main.js +3 -6
  165. package/dist/Meter.main.js.map +1 -1
  166. package/dist/Meter.mjs +3 -6
  167. package/dist/Meter.module.js +3 -6
  168. package/dist/Meter.module.js.map +1 -1
  169. package/dist/Modal.main.js +7 -10
  170. package/dist/Modal.main.js.map +1 -1
  171. package/dist/Modal.mjs +10 -13
  172. package/dist/Modal.module.js +10 -13
  173. package/dist/Modal.module.js.map +1 -1
  174. package/dist/NumberField.main.js +6 -7
  175. package/dist/NumberField.main.js.map +1 -1
  176. package/dist/NumberField.mjs +7 -8
  177. package/dist/NumberField.module.js +7 -8
  178. package/dist/NumberField.module.js.map +1 -1
  179. package/dist/OverlayArrow.main.js +2 -6
  180. package/dist/OverlayArrow.main.js.map +1 -1
  181. package/dist/OverlayArrow.mjs +2 -6
  182. package/dist/OverlayArrow.module.js +2 -6
  183. package/dist/OverlayArrow.module.js.map +1 -1
  184. package/dist/Popover.main.js +71 -22
  185. package/dist/Popover.main.js.map +1 -1
  186. package/dist/Popover.mjs +75 -26
  187. package/dist/Popover.module.js +75 -26
  188. package/dist/Popover.module.js.map +1 -1
  189. package/dist/ProgressBar.main.js +3 -7
  190. package/dist/ProgressBar.main.js.map +1 -1
  191. package/dist/ProgressBar.mjs +3 -7
  192. package/dist/ProgressBar.module.js +3 -7
  193. package/dist/ProgressBar.module.js.map +1 -1
  194. package/dist/RadioGroup.main.js +5 -11
  195. package/dist/RadioGroup.main.js.map +1 -1
  196. package/dist/RadioGroup.mjs +5 -11
  197. package/dist/RadioGroup.module.js +5 -11
  198. package/dist/RadioGroup.module.js.map +1 -1
  199. package/dist/SearchField.main.js +9 -9
  200. package/dist/SearchField.main.js.map +1 -1
  201. package/dist/SearchField.mjs +11 -11
  202. package/dist/SearchField.module.js +11 -11
  203. package/dist/SearchField.module.js.map +1 -1
  204. package/dist/Select.main.js +9 -14
  205. package/dist/Select.main.js.map +1 -1
  206. package/dist/Select.mjs +10 -15
  207. package/dist/Select.module.js +10 -15
  208. package/dist/Select.module.js.map +1 -1
  209. package/dist/Slider.main.js +10 -22
  210. package/dist/Slider.main.js.map +1 -1
  211. package/dist/Slider.mjs +11 -23
  212. package/dist/Slider.module.js +11 -23
  213. package/dist/Slider.module.js.map +1 -1
  214. package/dist/Switch.main.js +2 -5
  215. package/dist/Switch.main.js.map +1 -1
  216. package/dist/Switch.mjs +2 -5
  217. package/dist/Switch.module.js +2 -5
  218. package/dist/Switch.module.js.map +1 -1
  219. package/dist/Table.main.js +21 -18
  220. package/dist/Table.main.js.map +1 -1
  221. package/dist/Table.mjs +22 -19
  222. package/dist/Table.module.js +22 -19
  223. package/dist/Table.module.js.map +1 -1
  224. package/dist/TableLayout.main.js.map +1 -1
  225. package/dist/TableLayout.module.js.map +1 -1
  226. package/dist/Tabs.main.js +12 -19
  227. package/dist/Tabs.main.js.map +1 -1
  228. package/dist/Tabs.mjs +15 -22
  229. package/dist/Tabs.module.js +15 -22
  230. package/dist/Tabs.module.js.map +1 -1
  231. package/dist/TagGroup.main.js +5 -11
  232. package/dist/TagGroup.main.js.map +1 -1
  233. package/dist/TagGroup.mjs +6 -12
  234. package/dist/TagGroup.module.js +6 -12
  235. package/dist/TagGroup.module.js.map +1 -1
  236. package/dist/Text.main.js +2 -3
  237. package/dist/Text.main.js.map +1 -1
  238. package/dist/Text.mjs +2 -3
  239. package/dist/Text.module.js +2 -3
  240. package/dist/Text.module.js.map +1 -1
  241. package/dist/TextArea.main.js +2 -5
  242. package/dist/TextArea.main.js.map +1 -1
  243. package/dist/TextArea.mjs +2 -5
  244. package/dist/TextArea.module.js +2 -5
  245. package/dist/TextArea.module.js.map +1 -1
  246. package/dist/TextField.main.js +12 -10
  247. package/dist/TextField.main.js.map +1 -1
  248. package/dist/TextField.mjs +14 -12
  249. package/dist/TextField.module.js +14 -12
  250. package/dist/TextField.module.js.map +1 -1
  251. package/dist/Toast.main.js +148 -0
  252. package/dist/Toast.main.js.map +1 -0
  253. package/dist/Toast.mjs +137 -0
  254. package/dist/Toast.module.js +137 -0
  255. package/dist/Toast.module.js.map +1 -0
  256. package/dist/ToggleButton.main.js +2 -5
  257. package/dist/ToggleButton.main.js.map +1 -1
  258. package/dist/ToggleButton.mjs +3 -6
  259. package/dist/ToggleButton.module.js +3 -6
  260. package/dist/ToggleButton.module.js.map +1 -1
  261. package/dist/ToggleButtonGroup.main.js +2 -5
  262. package/dist/ToggleButtonGroup.main.js.map +1 -1
  263. package/dist/ToggleButtonGroup.mjs +2 -5
  264. package/dist/ToggleButtonGroup.module.js +2 -5
  265. package/dist/ToggleButtonGroup.module.js.map +1 -1
  266. package/dist/Toolbar.main.js +2 -6
  267. package/dist/Toolbar.main.js.map +1 -1
  268. package/dist/Toolbar.mjs +2 -6
  269. package/dist/Toolbar.module.js +2 -6
  270. package/dist/Toolbar.module.js.map +1 -1
  271. package/dist/Tooltip.main.js +4 -7
  272. package/dist/Tooltip.main.js.map +1 -1
  273. package/dist/Tooltip.mjs +7 -10
  274. package/dist/Tooltip.module.js +7 -10
  275. package/dist/Tooltip.module.js.map +1 -1
  276. package/dist/Tree.main.js +39 -39
  277. package/dist/Tree.main.js.map +1 -1
  278. package/dist/Tree.mjs +36 -36
  279. package/dist/Tree.module.js +36 -36
  280. package/dist/Tree.module.js.map +1 -1
  281. package/dist/Virtualizer.main.js +4 -1
  282. package/dist/Virtualizer.main.js.map +1 -1
  283. package/dist/Virtualizer.mjs +4 -1
  284. package/dist/Virtualizer.module.js +4 -1
  285. package/dist/Virtualizer.module.js.map +1 -1
  286. package/dist/import.mjs +10 -6
  287. package/dist/main.js +34 -14
  288. package/dist/main.js.map +1 -1
  289. package/dist/module.js +10 -6
  290. package/dist/module.js.map +1 -1
  291. package/dist/types.d.ts +369 -259
  292. package/dist/types.d.ts.map +1 -1
  293. package/dist/utils.main.js +9 -68
  294. package/dist/utils.main.js.map +1 -1
  295. package/dist/utils.mjs +10 -67
  296. package/dist/utils.module.js +10 -67
  297. package/dist/utils.module.js.map +1 -1
  298. package/i18n/ar-AE.js +1 -1
  299. package/i18n/ar-AE.mjs +1 -1
  300. package/i18n/bg-BG.js +1 -1
  301. package/i18n/bg-BG.mjs +1 -1
  302. package/i18n/cs-CZ.js +1 -1
  303. package/i18n/cs-CZ.mjs +1 -1
  304. package/i18n/da-DK.js +1 -1
  305. package/i18n/da-DK.mjs +1 -1
  306. package/i18n/de-DE.js +1 -1
  307. package/i18n/de-DE.mjs +1 -1
  308. package/i18n/el-GR.js +1 -1
  309. package/i18n/el-GR.mjs +1 -1
  310. package/i18n/en-US.js +1 -1
  311. package/i18n/en-US.mjs +1 -1
  312. package/i18n/es-ES.js +1 -1
  313. package/i18n/es-ES.mjs +1 -1
  314. package/i18n/et-EE.js +1 -1
  315. package/i18n/et-EE.mjs +1 -1
  316. package/i18n/fi-FI.js +1 -1
  317. package/i18n/fi-FI.mjs +1 -1
  318. package/i18n/fr-FR.js +1 -1
  319. package/i18n/fr-FR.mjs +1 -1
  320. package/i18n/he-IL.js +1 -1
  321. package/i18n/he-IL.mjs +1 -1
  322. package/i18n/hr-HR.js +1 -1
  323. package/i18n/hr-HR.mjs +1 -1
  324. package/i18n/hu-HU.js +1 -1
  325. package/i18n/hu-HU.mjs +1 -1
  326. package/i18n/index.js +1 -1
  327. package/i18n/index.mjs +1 -1
  328. package/i18n/it-IT.js +1 -1
  329. package/i18n/it-IT.mjs +1 -1
  330. package/i18n/ja-JP.js +1 -1
  331. package/i18n/ja-JP.mjs +1 -1
  332. package/i18n/ko-KR.js +1 -1
  333. package/i18n/ko-KR.mjs +1 -1
  334. package/i18n/lt-LT.js +1 -1
  335. package/i18n/lt-LT.mjs +1 -1
  336. package/i18n/lv-LV.js +1 -1
  337. package/i18n/lv-LV.mjs +1 -1
  338. package/i18n/nb-NO.js +1 -1
  339. package/i18n/nb-NO.mjs +1 -1
  340. package/i18n/nl-NL.js +1 -1
  341. package/i18n/nl-NL.mjs +1 -1
  342. package/i18n/pl-PL.js +1 -1
  343. package/i18n/pl-PL.mjs +1 -1
  344. package/i18n/pt-BR.js +1 -1
  345. package/i18n/pt-BR.mjs +1 -1
  346. package/i18n/pt-PT.js +1 -1
  347. package/i18n/pt-PT.mjs +1 -1
  348. package/i18n/ro-RO.js +1 -1
  349. package/i18n/ro-RO.mjs +1 -1
  350. package/i18n/ru-RU.js +1 -1
  351. package/i18n/ru-RU.mjs +1 -1
  352. package/i18n/sk-SK.js +1 -1
  353. package/i18n/sk-SK.mjs +1 -1
  354. package/i18n/sl-SI.js +1 -1
  355. package/i18n/sl-SI.mjs +1 -1
  356. package/i18n/sr-SP.js +1 -1
  357. package/i18n/sr-SP.mjs +1 -1
  358. package/i18n/sv-SE.js +1 -1
  359. package/i18n/sv-SE.mjs +1 -1
  360. package/i18n/tr-TR.js +1 -1
  361. package/i18n/tr-TR.mjs +1 -1
  362. package/i18n/uk-UA.js +1 -1
  363. package/i18n/uk-UA.mjs +1 -1
  364. package/i18n/zh-CN.js +1 -1
  365. package/i18n/zh-CN.mjs +1 -1
  366. package/i18n/zh-TW.js +1 -1
  367. package/i18n/zh-TW.mjs +1 -1
  368. package/package.json +26 -29
  369. package/src/Autocomplete.tsx +75 -0
  370. package/src/Breadcrumbs.tsx +5 -8
  371. package/src/Button.tsx +8 -8
  372. package/src/Calendar.tsx +35 -39
  373. package/src/Checkbox.tsx +14 -18
  374. package/src/Collection.tsx +2 -2
  375. package/src/ColorArea.tsx +7 -11
  376. package/src/ColorField.tsx +13 -14
  377. package/src/ColorPicker.tsx +1 -2
  378. package/src/ColorSlider.tsx +10 -13
  379. package/src/ColorSwatch.tsx +7 -10
  380. package/src/ColorSwatchPicker.tsx +8 -14
  381. package/src/ColorThumb.tsx +7 -12
  382. package/src/ColorWheel.tsx +12 -18
  383. package/src/ComboBox.tsx +8 -9
  384. package/src/DateField.tsx +29 -36
  385. package/src/DatePicker.tsx +15 -17
  386. package/src/Dialog.tsx +11 -10
  387. package/src/Disclosure.tsx +18 -28
  388. package/src/DragAndDrop.tsx +5 -8
  389. package/src/DropZone.tsx +6 -10
  390. package/src/FieldError.tsx +5 -8
  391. package/src/FileTrigger.tsx +5 -8
  392. package/src/Form.tsx +6 -9
  393. package/src/GridList.tsx +11 -9
  394. package/src/Group.tsx +6 -8
  395. package/src/Heading.tsx +2 -5
  396. package/src/Input.tsx +5 -8
  397. package/src/Keyboard.tsx +2 -5
  398. package/src/Label.tsx +2 -5
  399. package/src/Link.tsx +6 -9
  400. package/src/ListBox.tsx +19 -16
  401. package/src/Menu.tsx +71 -42
  402. package/src/Meter.tsx +8 -9
  403. package/src/Modal.tsx +7 -10
  404. package/src/NumberField.tsx +16 -10
  405. package/src/OverlayArrow.tsx +6 -9
  406. package/src/Popover.tsx +84 -35
  407. package/src/ProgressBar.tsx +9 -10
  408. package/src/RadioGroup.tsx +13 -17
  409. package/src/SearchField.tsx +14 -14
  410. package/src/Select.tsx +17 -19
  411. package/src/Slider.tsx +26 -34
  412. package/src/Switch.tsx +5 -8
  413. package/src/Table.tsx +45 -34
  414. package/src/TableLayout.ts +1 -1
  415. package/src/Tabs.tsx +24 -28
  416. package/src/TagGroup.tsx +11 -15
  417. package/src/Text.tsx +2 -5
  418. package/src/TextArea.tsx +5 -7
  419. package/src/TextField.tsx +16 -16
  420. package/src/Toast.tsx +184 -0
  421. package/src/ToggleButton.tsx +5 -8
  422. package/src/ToggleButtonGroup.tsx +5 -8
  423. package/src/Toolbar.tsx +6 -9
  424. package/src/Tooltip.tsx +7 -10
  425. package/src/Tree.tsx +72 -57
  426. package/src/Virtualizer.tsx +18 -3
  427. package/src/index.ts +17 -15
  428. package/src/utils.tsx +8 -81
@@ -3,6 +3,7 @@ var $ee5958cbdc6becc1$exports = require("./OverlayArrow.main.js");
3
3
  var $2979ab89b336194b$exports = require("./Dialog.main.js");
4
4
  var $4DQW2$reactaria = require("react-aria");
5
5
  var $4DQW2$reactariautils = require("@react-aria/utils");
6
+ var $4DQW2$reactariainteractions = require("@react-aria/interactions");
6
7
  var $4DQW2$reactstately = require("react-stately");
7
8
  var $4DQW2$react = require("react");
8
9
  var $4DQW2$reactariacollections = require("@react-aria/collections");
@@ -36,14 +37,18 @@ $parcel$export(module.exports, "Popover", () => $61e2b7078adb18bc$export$5b6b194
36
37
 
37
38
 
38
39
 
40
+
39
41
  const $61e2b7078adb18bc$export$9b9a0cd73afb7ca4 = /*#__PURE__*/ (0, $4DQW2$react.createContext)(null);
40
- function $61e2b7078adb18bc$var$Popover(props, ref) {
42
+ // Stores a ref for the portal container for a group of popovers (e.g. submenus).
43
+ const $61e2b7078adb18bc$var$PopoverGroupContext = /*#__PURE__*/ (0, $4DQW2$react.createContext)(null);
44
+ const $61e2b7078adb18bc$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $4DQW2$react.forwardRef)(function Popover(props, ref) {
41
45
  [props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(props, ref, $61e2b7078adb18bc$export$9b9a0cd73afb7ca4);
42
46
  let contextState = (0, $4DQW2$react.useContext)((0, $2979ab89b336194b$exports.OverlayTriggerStateContext));
43
47
  let localState = (0, $4DQW2$reactstately.useOverlayTriggerState)(props);
44
48
  let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;
45
- let isExiting = (0, $c5ccf687772c0422$exports.useExitAnimation)(ref, state.isOpen) || props.isExiting || false;
49
+ let isExiting = (0, $4DQW2$reactariautils.useExitAnimation)(ref, state.isOpen) || props.isExiting || false;
46
50
  let isHidden = (0, $4DQW2$reactariacollections.useIsHidden)();
51
+ let { direction: direction } = (0, $4DQW2$reactaria.useLocale)();
47
52
  // If we are in a hidden tree, we still need to preserve our children.
48
53
  if (isHidden) {
49
54
  let children = props.children;
@@ -62,17 +67,18 @@ function $61e2b7078adb18bc$var$Popover(props, ref) {
62
67
  triggerRef: props.triggerRef,
63
68
  state: state,
64
69
  popoverRef: ref,
65
- isExiting: isExiting
70
+ isExiting: isExiting,
71
+ dir: direction
66
72
  });
67
- }
68
- /**
69
- * A popover is an overlay element positioned relative to a trigger.
70
- */ const $61e2b7078adb18bc$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $4DQW2$react.forwardRef)($61e2b7078adb18bc$var$Popover);
73
+ });
71
74
  function $61e2b7078adb18bc$var$PopoverInner({ state: state, isExiting: isExiting, UNSTABLE_portalContainer: UNSTABLE_portalContainer, ...props }) {
72
75
  // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)
73
76
  // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx
74
77
  let arrowRef = (0, $4DQW2$react.useRef)(null);
75
78
  let [arrowWidth, setArrowWidth] = (0, $4DQW2$react.useState)(0);
79
+ let containerRef = (0, $4DQW2$react.useRef)(null);
80
+ let groupCtx = (0, $4DQW2$react.useContext)($61e2b7078adb18bc$var$PopoverGroupContext);
81
+ let isSubPopover = groupCtx && props.trigger === 'SubmenuTrigger';
76
82
  (0, $4DQW2$reactariautils.useLayoutEffect)(()=>{
77
83
  if (arrowRef.current && state.isOpen) setArrowWidth(arrowRef.current.getBoundingClientRect().width);
78
84
  }, [
@@ -83,10 +89,13 @@ function $61e2b7078adb18bc$var$PopoverInner({ state: state, isExiting: isExiting
83
89
  let { popoverProps: popoverProps, underlayProps: underlayProps, arrowProps: arrowProps, placement: placement } = (0, $4DQW2$reactaria.usePopover)({
84
90
  ...props,
85
91
  offset: (_props_offset = props.offset) !== null && _props_offset !== void 0 ? _props_offset : 8,
86
- arrowSize: arrowWidth
92
+ arrowSize: arrowWidth,
93
+ // If this is a submenu/subdialog, use the root popover's container
94
+ // to detect outside interaction and add aria-hidden.
95
+ groupRef: isSubPopover ? groupCtx : containerRef
87
96
  }, state);
88
97
  let ref = props.popoverRef;
89
- let isEntering = (0, $c5ccf687772c0422$exports.useEnterAnimation)(ref, !!placement) || props.isEntering || false;
98
+ let isEntering = (0, $4DQW2$reactariautils.useEnterAnimation)(ref, !!placement) || props.isEntering || false;
90
99
  let renderProps = (0, $c5ccf687772c0422$exports.useRenderProps)({
91
100
  ...props,
92
101
  defaultClassName: 'react-aria-Popover',
@@ -97,27 +106,38 @@ function $61e2b7078adb18bc$var$PopoverInner({ state: state, isExiting: isExiting
97
106
  isExiting: isExiting
98
107
  }
99
108
  });
109
+ // Automatically render Popover with role=dialog except when isNonModal is true,
110
+ // or a dialog is already nested inside the popover.
111
+ let shouldBeDialog = !props.isNonModal || props.trigger === 'SubmenuTrigger';
112
+ let [isDialog, setDialog] = (0, $4DQW2$react.useState)(false);
113
+ (0, $4DQW2$reactariautils.useLayoutEffect)(()=>{
114
+ if (ref.current) setDialog(shouldBeDialog && !ref.current.querySelector('[role=dialog]'));
115
+ }, [
116
+ ref,
117
+ shouldBeDialog
118
+ ]);
119
+ // Focus the popover itself on mount, unless a child element is already focused.
120
+ (0, $4DQW2$react.useEffect)(()=>{
121
+ if (isDialog && ref.current && !ref.current.contains(document.activeElement)) (0, $4DQW2$reactariainteractions.focusSafely)(ref.current);
122
+ }, [
123
+ isDialog,
124
+ ref
125
+ ]);
100
126
  let style = {
101
127
  ...popoverProps.style,
102
128
  ...renderProps.style
103
129
  };
104
- return /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement((0, $4DQW2$reactaria.Overlay), {
105
- ...props,
106
- isExiting: isExiting,
107
- portalContainer: UNSTABLE_portalContainer
108
- }, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement("div", {
109
- "data-testid": "underlay",
110
- ...underlayProps,
111
- style: {
112
- position: 'fixed',
113
- inset: 0
114
- }
115
- }), /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement("div", {
130
+ let overlay = /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement("div", {
116
131
  ...(0, $4DQW2$reactariautils.mergeProps)((0, $4DQW2$reactariautils.filterDOMProps)(props), popoverProps),
117
132
  ...renderProps,
133
+ role: isDialog ? 'dialog' : undefined,
134
+ tabIndex: isDialog ? -1 : undefined,
135
+ "aria-label": props['aria-label'],
136
+ "aria-labelledby": props['aria-labelledby'],
118
137
  ref: ref,
119
138
  slot: props.slot || undefined,
120
139
  style: style,
140
+ dir: props.dir,
121
141
  "data-trigger": props.trigger,
122
142
  "data-placement": placement,
123
143
  "data-entering": isEntering || undefined,
@@ -132,7 +152,36 @@ function $61e2b7078adb18bc$var$PopoverInner({ state: state, isExiting: isExiting
132
152
  }
133
153
  }, renderProps.children), /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement((0, $4DQW2$reactaria.DismissButton), {
134
154
  onDismiss: state.close
135
- })));
155
+ }));
156
+ // If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.
157
+ if (!isSubPopover) return /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement((0, $4DQW2$reactaria.Overlay), {
158
+ ...props,
159
+ shouldContainFocus: isDialog,
160
+ isExiting: isExiting,
161
+ portalContainer: UNSTABLE_portalContainer
162
+ }, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement("div", {
163
+ "data-testid": "underlay",
164
+ ...underlayProps,
165
+ style: {
166
+ position: 'fixed',
167
+ inset: 0
168
+ }
169
+ }), /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement("div", {
170
+ ref: containerRef,
171
+ style: {
172
+ display: 'contents'
173
+ }
174
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement($61e2b7078adb18bc$var$PopoverGroupContext.Provider, {
175
+ value: containerRef
176
+ }, overlay)));
177
+ var _ref;
178
+ // Submenus/subdialogs are mounted into the root popover's container.
179
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($4DQW2$react))).createElement((0, $4DQW2$reactaria.Overlay), {
180
+ ...props,
181
+ shouldContainFocus: isDialog,
182
+ isExiting: isExiting,
183
+ portalContainer: (_ref = UNSTABLE_portalContainer !== null && UNSTABLE_portalContainer !== void 0 ? UNSTABLE_portalContainer : groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.current) !== null && _ref !== void 0 ? _ref : undefined
184
+ }, overlay);
136
185
  }
137
186
 
138
187
 
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAsEM,MAAM,0DAAiB,CAAA,GAAA,0BAAY,EAA2C;AAErF,SAAS,8BAAQ,KAAmB,EAAE,GAA8B;IAClE,CAAC,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;QAAE,WAAW,MAAM,KAAK;;AAI7C","sources":["packages/react-aria-components/src/Popover.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaPopoverProps, DismissButton, Overlay, PlacementAxis, PositionProps, usePopover} from 'react-aria';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useEnterAnimation, useExitAnimation, useRenderProps} from './utils';\nimport {filterDOMProps, mergeProps, useLayoutEffect} from '@react-aria/utils';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useRef, useState} from 'react';\nimport {useIsHidden} from '@react-aria/collections';\n\nexport interface PopoverProps extends Omit<PositionProps, 'isOpen'>, Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'offset' | 'arrowSize'>, OverlayTriggerProps, RenderProps<PopoverRenderProps>, SlotProps {\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string,\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the popover is currently performing an exit animation.\n */\n isExiting?: boolean,\n /**\n * The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element,\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n * @default 8\n */\n offset?: number\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null,\n /**\n * The placement of the popover relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, HTMLElement>>(null);\n\nfunction Popover(props: PopoverProps, ref: ForwardedRef<HTMLElement>) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n let isHidden = useIsHidden();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting} />\n );\n}\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nconst _Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(Popover);\nexport {_Popover as Popover};\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState,\n isEntering?: boolean,\n isExiting: boolean,\n UNSTABLE_portalContainer?: Element,\n trigger?: string\n}\n\nfunction PopoverInner({state, isExiting, UNSTABLE_portalContainer, ...props}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {popoverProps, underlayProps, arrowProps, placement} = usePopover({\n ...props,\n offset: props.offset ?? 8,\n arrowSize: arrowWidth\n }, state);\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n let isEntering = useEnterAnimation(ref, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Popover',\n values: {\n trigger: props.trigger || null,\n placement,\n isEntering,\n isExiting\n }\n });\n\n let style = {...popoverProps.style, ...renderProps.style};\n\n return (\n <Overlay {...props} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer}>\n {!props.isNonModal && state.isOpen && <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />}\n <div\n {...mergeProps(filterDOMProps(props as any), popoverProps)}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </div>\n </Overlay>\n );\n}\n"],"names":[],"version":3,"file":"Popover.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAU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C;QASgF;IAF3F,qEAAqE;IACrE,qBACE,0DAAC,CAAA,GAAA,wBAAM;QAAG,GAAG,KAAK;QAAE,oBAAoB;QAAU,WAAW;QAAW,iBAAiB,CAAA,OAAA,qCAAA,sCAAA,2BAA4B,qBAAA,+BAAA,SAAU,OAAO,cAA7C,kBAAA,OAAiD;OACvI;AAGP","sources":["packages/react-aria-components/src/Popover.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, forwardRefType, RefObject} from '@react-types/shared';\nimport {AriaPopoverProps, DismissButton, Overlay, PlacementAxis, PositionProps, useLocale, usePopover} from 'react-aria';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';\nimport {filterDOMProps, mergeProps, useEnterAnimation, useExitAnimation, useLayoutEffect} from '@react-aria/utils';\nimport {focusSafely} from '@react-aria/interactions';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useEffect, useRef, useState} from 'react';\nimport {useIsHidden} from '@react-aria/collections';\n\nexport interface PopoverProps extends Omit<PositionProps, 'isOpen'>, Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'groupRef' | 'offset' | 'arrowSize'>, OverlayTriggerProps, RenderProps<PopoverRenderProps>, SlotProps, AriaLabelingProps {\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string,\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the popover is currently performing an exit animation.\n */\n isExiting?: boolean,\n /**\n * The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element,\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n * @default 8\n */\n offset?: number\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null,\n /**\n * The placement of the popover relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, HTMLElement>>(null);\n\n// Stores a ref for the portal container for a group of popovers (e.g. submenus).\nconst PopoverGroupContext = createContext<RefObject<Element | null> | null>(null);\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(function Popover(props: PopoverProps, ref: ForwardedRef<HTMLElement>) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n let isHidden = useIsHidden();\n let {direction} = useLocale();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting}\n dir={direction} />\n );\n});\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState,\n isEntering?: boolean,\n isExiting: boolean,\n UNSTABLE_portalContainer?: Element,\n trigger?: string,\n dir?: 'ltr' | 'rtl'\n}\n\nfunction PopoverInner({state, isExiting, UNSTABLE_portalContainer, ...props}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n let containerRef = useRef<HTMLDivElement | null>(null);\n let groupCtx = useContext(PopoverGroupContext);\n let isSubPopover = groupCtx && props.trigger === 'SubmenuTrigger';\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {popoverProps, underlayProps, arrowProps, placement} = usePopover({\n ...props,\n offset: props.offset ?? 8,\n arrowSize: arrowWidth,\n // If this is a submenu/subdialog, use the root popover's container \n // to detect outside interaction and add aria-hidden.\n groupRef: isSubPopover ? groupCtx! : containerRef\n }, state);\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n let isEntering = useEnterAnimation(ref, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Popover',\n values: {\n trigger: props.trigger || null,\n placement,\n isEntering,\n isExiting\n }\n });\n\n // Automatically render Popover with role=dialog except when isNonModal is true,\n // or a dialog is already nested inside the popover.\n let shouldBeDialog = !props.isNonModal || props.trigger === 'SubmenuTrigger';\n let [isDialog, setDialog] = useState(false);\n useLayoutEffect(() => {\n if (ref.current) {\n setDialog(shouldBeDialog && !ref.current.querySelector('[role=dialog]'));\n }\n }, [ref, shouldBeDialog]);\n\n // Focus the popover itself on mount, unless a child element is already focused.\n useEffect(() => {\n if (isDialog && ref.current && !ref.current.contains(document.activeElement)) {\n focusSafely(ref.current);\n }\n }, [isDialog, ref]);\n\n let style = {...popoverProps.style, ...renderProps.style};\n let overlay = (\n <div\n {...mergeProps(filterDOMProps(props as any), popoverProps)}\n {...renderProps}\n role={isDialog ? 'dialog' : undefined}\n tabIndex={isDialog ? -1 : undefined}\n aria-label={props['aria-label']}\n aria-labelledby={props['aria-labelledby']}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n dir={props.dir}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </div>\n );\n\n // If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.\n if (!isSubPopover) {\n return (\n <Overlay {...props} shouldContainFocus={isDialog} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer}>\n {!props.isNonModal && state.isOpen && <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />}\n <div ref={containerRef} style={{display: 'contents'}}>\n <PopoverGroupContext.Provider value={containerRef}>\n {overlay}\n </PopoverGroupContext.Provider>\n </div>\n </Overlay>\n );\n }\n\n // Submenus/subdialogs are mounted into the root popover's container.\n return (\n <Overlay {...props} shouldContainFocus={isDialog} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer ?? groupCtx?.current ?? undefined}>\n {overlay}\n </Overlay>\n );\n}\n"],"names":[],"version":3,"file":"Popover.main.js.map"}
package/dist/Popover.mjs CHANGED
@@ -1,10 +1,11 @@
1
- import {useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useEnterAnimation as $64fa3d84918910a7$export$6d3443f2c48bfc20, useExitAnimation as $64fa3d84918910a7$export$45fda7c47f93fd48, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3} from "./utils.mjs";
1
+ import {useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3} from "./utils.mjs";
2
2
  import {OverlayArrowContext as $44f671af83e7d9e0$export$2de4954e8ae13b9f} from "./OverlayArrow.mjs";
3
3
  import {OverlayTriggerStateContext as $de32f1b87079253c$export$d2f961adcb0afbe} from "./Dialog.mjs";
4
- import {usePopover as $ehFet$usePopover, Overlay as $ehFet$Overlay, DismissButton as $ehFet$DismissButton} from "react-aria";
5
- import {useLayoutEffect as $ehFet$useLayoutEffect, mergeProps as $ehFet$mergeProps, filterDOMProps as $ehFet$filterDOMProps} from "@react-aria/utils";
4
+ import {useLocale as $ehFet$useLocale, usePopover as $ehFet$usePopover, DismissButton as $ehFet$DismissButton, Overlay as $ehFet$Overlay} from "react-aria";
5
+ import {useExitAnimation as $ehFet$useExitAnimation, useLayoutEffect as $ehFet$useLayoutEffect, useEnterAnimation as $ehFet$useEnterAnimation, mergeProps as $ehFet$mergeProps, filterDOMProps as $ehFet$filterDOMProps} from "@react-aria/utils";
6
+ import {focusSafely as $ehFet$focusSafely} from "@react-aria/interactions";
6
7
  import {useOverlayTriggerState as $ehFet$useOverlayTriggerState} from "react-stately";
7
- import $ehFet$react, {createContext as $ehFet$createContext, useContext as $ehFet$useContext, forwardRef as $ehFet$forwardRef, useRef as $ehFet$useRef, useState as $ehFet$useState} from "react";
8
+ import $ehFet$react, {createContext as $ehFet$createContext, forwardRef as $ehFet$forwardRef, useContext as $ehFet$useContext, useRef as $ehFet$useRef, useState as $ehFet$useState, useEffect as $ehFet$useEffect} from "react";
8
9
  import {useIsHidden as $ehFet$useIsHidden} from "@react-aria/collections";
9
10
 
10
11
  /*
@@ -25,14 +26,18 @@ import {useIsHidden as $ehFet$useIsHidden} from "@react-aria/collections";
25
26
 
26
27
 
27
28
 
29
+
28
30
  const $07b14b47974efb58$export$9b9a0cd73afb7ca4 = /*#__PURE__*/ (0, $ehFet$createContext)(null);
29
- function $07b14b47974efb58$var$Popover(props, ref) {
31
+ // Stores a ref for the portal container for a group of popovers (e.g. submenus).
32
+ const $07b14b47974efb58$var$PopoverGroupContext = /*#__PURE__*/ (0, $ehFet$createContext)(null);
33
+ const $07b14b47974efb58$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $ehFet$forwardRef)(function Popover(props, ref) {
30
34
  [props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $07b14b47974efb58$export$9b9a0cd73afb7ca4);
31
35
  let contextState = (0, $ehFet$useContext)((0, $de32f1b87079253c$export$d2f961adcb0afbe));
32
36
  let localState = (0, $ehFet$useOverlayTriggerState)(props);
33
37
  let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;
34
- let isExiting = (0, $64fa3d84918910a7$export$45fda7c47f93fd48)(ref, state.isOpen) || props.isExiting || false;
38
+ let isExiting = (0, $ehFet$useExitAnimation)(ref, state.isOpen) || props.isExiting || false;
35
39
  let isHidden = (0, $ehFet$useIsHidden)();
40
+ let { direction: direction } = (0, $ehFet$useLocale)();
36
41
  // If we are in a hidden tree, we still need to preserve our children.
37
42
  if (isHidden) {
38
43
  let children = props.children;
@@ -51,17 +56,18 @@ function $07b14b47974efb58$var$Popover(props, ref) {
51
56
  triggerRef: props.triggerRef,
52
57
  state: state,
53
58
  popoverRef: ref,
54
- isExiting: isExiting
59
+ isExiting: isExiting,
60
+ dir: direction
55
61
  });
56
- }
57
- /**
58
- * A popover is an overlay element positioned relative to a trigger.
59
- */ const $07b14b47974efb58$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $ehFet$forwardRef)($07b14b47974efb58$var$Popover);
62
+ });
60
63
  function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting, UNSTABLE_portalContainer: UNSTABLE_portalContainer, ...props }) {
61
64
  // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)
62
65
  // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx
63
66
  let arrowRef = (0, $ehFet$useRef)(null);
64
67
  let [arrowWidth, setArrowWidth] = (0, $ehFet$useState)(0);
68
+ let containerRef = (0, $ehFet$useRef)(null);
69
+ let groupCtx = (0, $ehFet$useContext)($07b14b47974efb58$var$PopoverGroupContext);
70
+ let isSubPopover = groupCtx && props.trigger === 'SubmenuTrigger';
65
71
  (0, $ehFet$useLayoutEffect)(()=>{
66
72
  if (arrowRef.current && state.isOpen) setArrowWidth(arrowRef.current.getBoundingClientRect().width);
67
73
  }, [
@@ -72,10 +78,13 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
72
78
  let { popoverProps: popoverProps, underlayProps: underlayProps, arrowProps: arrowProps, placement: placement } = (0, $ehFet$usePopover)({
73
79
  ...props,
74
80
  offset: (_props_offset = props.offset) !== null && _props_offset !== void 0 ? _props_offset : 8,
75
- arrowSize: arrowWidth
81
+ arrowSize: arrowWidth,
82
+ // If this is a submenu/subdialog, use the root popover's container
83
+ // to detect outside interaction and add aria-hidden.
84
+ groupRef: isSubPopover ? groupCtx : containerRef
76
85
  }, state);
77
86
  let ref = props.popoverRef;
78
- let isEntering = (0, $64fa3d84918910a7$export$6d3443f2c48bfc20)(ref, !!placement) || props.isEntering || false;
87
+ let isEntering = (0, $ehFet$useEnterAnimation)(ref, !!placement) || props.isEntering || false;
79
88
  let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
80
89
  ...props,
81
90
  defaultClassName: 'react-aria-Popover',
@@ -86,27 +95,38 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
86
95
  isExiting: isExiting
87
96
  }
88
97
  });
98
+ // Automatically render Popover with role=dialog except when isNonModal is true,
99
+ // or a dialog is already nested inside the popover.
100
+ let shouldBeDialog = !props.isNonModal || props.trigger === 'SubmenuTrigger';
101
+ let [isDialog, setDialog] = (0, $ehFet$useState)(false);
102
+ (0, $ehFet$useLayoutEffect)(()=>{
103
+ if (ref.current) setDialog(shouldBeDialog && !ref.current.querySelector('[role=dialog]'));
104
+ }, [
105
+ ref,
106
+ shouldBeDialog
107
+ ]);
108
+ // Focus the popover itself on mount, unless a child element is already focused.
109
+ (0, $ehFet$useEffect)(()=>{
110
+ if (isDialog && ref.current && !ref.current.contains(document.activeElement)) (0, $ehFet$focusSafely)(ref.current);
111
+ }, [
112
+ isDialog,
113
+ ref
114
+ ]);
89
115
  let style = {
90
116
  ...popoverProps.style,
91
117
  ...renderProps.style
92
118
  };
93
- return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
94
- ...props,
95
- isExiting: isExiting,
96
- portalContainer: UNSTABLE_portalContainer
97
- }, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
98
- "data-testid": "underlay",
99
- ...underlayProps,
100
- style: {
101
- position: 'fixed',
102
- inset: 0
103
- }
104
- }), /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
119
+ let overlay = /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
105
120
  ...(0, $ehFet$mergeProps)((0, $ehFet$filterDOMProps)(props), popoverProps),
106
121
  ...renderProps,
122
+ role: isDialog ? 'dialog' : undefined,
123
+ tabIndex: isDialog ? -1 : undefined,
124
+ "aria-label": props['aria-label'],
125
+ "aria-labelledby": props['aria-labelledby'],
107
126
  ref: ref,
108
127
  slot: props.slot || undefined,
109
128
  style: style,
129
+ dir: props.dir,
110
130
  "data-trigger": props.trigger,
111
131
  "data-placement": placement,
112
132
  "data-entering": isEntering || undefined,
@@ -121,7 +141,36 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
121
141
  }
122
142
  }, renderProps.children), /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$DismissButton), {
123
143
  onDismiss: state.close
124
- })));
144
+ }));
145
+ // If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.
146
+ if (!isSubPopover) return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
147
+ ...props,
148
+ shouldContainFocus: isDialog,
149
+ isExiting: isExiting,
150
+ portalContainer: UNSTABLE_portalContainer
151
+ }, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
152
+ "data-testid": "underlay",
153
+ ...underlayProps,
154
+ style: {
155
+ position: 'fixed',
156
+ inset: 0
157
+ }
158
+ }), /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
159
+ ref: containerRef,
160
+ style: {
161
+ display: 'contents'
162
+ }
163
+ }, /*#__PURE__*/ (0, $ehFet$react).createElement($07b14b47974efb58$var$PopoverGroupContext.Provider, {
164
+ value: containerRef
165
+ }, overlay)));
166
+ var _ref;
167
+ // Submenus/subdialogs are mounted into the root popover's container.
168
+ return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
169
+ ...props,
170
+ shouldContainFocus: isDialog,
171
+ isExiting: isExiting,
172
+ portalContainer: (_ref = UNSTABLE_portalContainer !== null && UNSTABLE_portalContainer !== void 0 ? UNSTABLE_portalContainer : groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.current) !== null && _ref !== void 0 ? _ref : undefined
173
+ }, overlay);
125
174
  }
126
175
 
127
176
 
@@ -1,10 +1,11 @@
1
- import {useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useEnterAnimation as $64fa3d84918910a7$export$6d3443f2c48bfc20, useExitAnimation as $64fa3d84918910a7$export$45fda7c47f93fd48, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3} from "./utils.module.js";
1
+ import {useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3} from "./utils.module.js";
2
2
  import {OverlayArrowContext as $44f671af83e7d9e0$export$2de4954e8ae13b9f} from "./OverlayArrow.module.js";
3
3
  import {OverlayTriggerStateContext as $de32f1b87079253c$export$d2f961adcb0afbe} from "./Dialog.module.js";
4
- import {usePopover as $ehFet$usePopover, Overlay as $ehFet$Overlay, DismissButton as $ehFet$DismissButton} from "react-aria";
5
- import {useLayoutEffect as $ehFet$useLayoutEffect, mergeProps as $ehFet$mergeProps, filterDOMProps as $ehFet$filterDOMProps} from "@react-aria/utils";
4
+ import {useLocale as $ehFet$useLocale, usePopover as $ehFet$usePopover, DismissButton as $ehFet$DismissButton, Overlay as $ehFet$Overlay} from "react-aria";
5
+ import {useExitAnimation as $ehFet$useExitAnimation, useLayoutEffect as $ehFet$useLayoutEffect, useEnterAnimation as $ehFet$useEnterAnimation, mergeProps as $ehFet$mergeProps, filterDOMProps as $ehFet$filterDOMProps} from "@react-aria/utils";
6
+ import {focusSafely as $ehFet$focusSafely} from "@react-aria/interactions";
6
7
  import {useOverlayTriggerState as $ehFet$useOverlayTriggerState} from "react-stately";
7
- import $ehFet$react, {createContext as $ehFet$createContext, useContext as $ehFet$useContext, forwardRef as $ehFet$forwardRef, useRef as $ehFet$useRef, useState as $ehFet$useState} from "react";
8
+ import $ehFet$react, {createContext as $ehFet$createContext, forwardRef as $ehFet$forwardRef, useContext as $ehFet$useContext, useRef as $ehFet$useRef, useState as $ehFet$useState, useEffect as $ehFet$useEffect} from "react";
8
9
  import {useIsHidden as $ehFet$useIsHidden} from "@react-aria/collections";
9
10
 
10
11
  /*
@@ -25,14 +26,18 @@ import {useIsHidden as $ehFet$useIsHidden} from "@react-aria/collections";
25
26
 
26
27
 
27
28
 
29
+
28
30
  const $07b14b47974efb58$export$9b9a0cd73afb7ca4 = /*#__PURE__*/ (0, $ehFet$createContext)(null);
29
- function $07b14b47974efb58$var$Popover(props, ref) {
31
+ // Stores a ref for the portal container for a group of popovers (e.g. submenus).
32
+ const $07b14b47974efb58$var$PopoverGroupContext = /*#__PURE__*/ (0, $ehFet$createContext)(null);
33
+ const $07b14b47974efb58$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $ehFet$forwardRef)(function Popover(props, ref) {
30
34
  [props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $07b14b47974efb58$export$9b9a0cd73afb7ca4);
31
35
  let contextState = (0, $ehFet$useContext)((0, $de32f1b87079253c$export$d2f961adcb0afbe));
32
36
  let localState = (0, $ehFet$useOverlayTriggerState)(props);
33
37
  let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;
34
- let isExiting = (0, $64fa3d84918910a7$export$45fda7c47f93fd48)(ref, state.isOpen) || props.isExiting || false;
38
+ let isExiting = (0, $ehFet$useExitAnimation)(ref, state.isOpen) || props.isExiting || false;
35
39
  let isHidden = (0, $ehFet$useIsHidden)();
40
+ let { direction: direction } = (0, $ehFet$useLocale)();
36
41
  // If we are in a hidden tree, we still need to preserve our children.
37
42
  if (isHidden) {
38
43
  let children = props.children;
@@ -51,17 +56,18 @@ function $07b14b47974efb58$var$Popover(props, ref) {
51
56
  triggerRef: props.triggerRef,
52
57
  state: state,
53
58
  popoverRef: ref,
54
- isExiting: isExiting
59
+ isExiting: isExiting,
60
+ dir: direction
55
61
  });
56
- }
57
- /**
58
- * A popover is an overlay element positioned relative to a trigger.
59
- */ const $07b14b47974efb58$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $ehFet$forwardRef)($07b14b47974efb58$var$Popover);
62
+ });
60
63
  function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting, UNSTABLE_portalContainer: UNSTABLE_portalContainer, ...props }) {
61
64
  // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)
62
65
  // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx
63
66
  let arrowRef = (0, $ehFet$useRef)(null);
64
67
  let [arrowWidth, setArrowWidth] = (0, $ehFet$useState)(0);
68
+ let containerRef = (0, $ehFet$useRef)(null);
69
+ let groupCtx = (0, $ehFet$useContext)($07b14b47974efb58$var$PopoverGroupContext);
70
+ let isSubPopover = groupCtx && props.trigger === 'SubmenuTrigger';
65
71
  (0, $ehFet$useLayoutEffect)(()=>{
66
72
  if (arrowRef.current && state.isOpen) setArrowWidth(arrowRef.current.getBoundingClientRect().width);
67
73
  }, [
@@ -72,10 +78,13 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
72
78
  let { popoverProps: popoverProps, underlayProps: underlayProps, arrowProps: arrowProps, placement: placement } = (0, $ehFet$usePopover)({
73
79
  ...props,
74
80
  offset: (_props_offset = props.offset) !== null && _props_offset !== void 0 ? _props_offset : 8,
75
- arrowSize: arrowWidth
81
+ arrowSize: arrowWidth,
82
+ // If this is a submenu/subdialog, use the root popover's container
83
+ // to detect outside interaction and add aria-hidden.
84
+ groupRef: isSubPopover ? groupCtx : containerRef
76
85
  }, state);
77
86
  let ref = props.popoverRef;
78
- let isEntering = (0, $64fa3d84918910a7$export$6d3443f2c48bfc20)(ref, !!placement) || props.isEntering || false;
87
+ let isEntering = (0, $ehFet$useEnterAnimation)(ref, !!placement) || props.isEntering || false;
79
88
  let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
80
89
  ...props,
81
90
  defaultClassName: 'react-aria-Popover',
@@ -86,27 +95,38 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
86
95
  isExiting: isExiting
87
96
  }
88
97
  });
98
+ // Automatically render Popover with role=dialog except when isNonModal is true,
99
+ // or a dialog is already nested inside the popover.
100
+ let shouldBeDialog = !props.isNonModal || props.trigger === 'SubmenuTrigger';
101
+ let [isDialog, setDialog] = (0, $ehFet$useState)(false);
102
+ (0, $ehFet$useLayoutEffect)(()=>{
103
+ if (ref.current) setDialog(shouldBeDialog && !ref.current.querySelector('[role=dialog]'));
104
+ }, [
105
+ ref,
106
+ shouldBeDialog
107
+ ]);
108
+ // Focus the popover itself on mount, unless a child element is already focused.
109
+ (0, $ehFet$useEffect)(()=>{
110
+ if (isDialog && ref.current && !ref.current.contains(document.activeElement)) (0, $ehFet$focusSafely)(ref.current);
111
+ }, [
112
+ isDialog,
113
+ ref
114
+ ]);
89
115
  let style = {
90
116
  ...popoverProps.style,
91
117
  ...renderProps.style
92
118
  };
93
- return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
94
- ...props,
95
- isExiting: isExiting,
96
- portalContainer: UNSTABLE_portalContainer
97
- }, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
98
- "data-testid": "underlay",
99
- ...underlayProps,
100
- style: {
101
- position: 'fixed',
102
- inset: 0
103
- }
104
- }), /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
119
+ let overlay = /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
105
120
  ...(0, $ehFet$mergeProps)((0, $ehFet$filterDOMProps)(props), popoverProps),
106
121
  ...renderProps,
122
+ role: isDialog ? 'dialog' : undefined,
123
+ tabIndex: isDialog ? -1 : undefined,
124
+ "aria-label": props['aria-label'],
125
+ "aria-labelledby": props['aria-labelledby'],
107
126
  ref: ref,
108
127
  slot: props.slot || undefined,
109
128
  style: style,
129
+ dir: props.dir,
110
130
  "data-trigger": props.trigger,
111
131
  "data-placement": placement,
112
132
  "data-entering": isEntering || undefined,
@@ -121,7 +141,36 @@ function $07b14b47974efb58$var$PopoverInner({ state: state, isExiting: isExiting
121
141
  }
122
142
  }, renderProps.children), /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$DismissButton), {
123
143
  onDismiss: state.close
124
- })));
144
+ }));
145
+ // If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.
146
+ if (!isSubPopover) return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
147
+ ...props,
148
+ shouldContainFocus: isDialog,
149
+ isExiting: isExiting,
150
+ portalContainer: UNSTABLE_portalContainer
151
+ }, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
152
+ "data-testid": "underlay",
153
+ ...underlayProps,
154
+ style: {
155
+ position: 'fixed',
156
+ inset: 0
157
+ }
158
+ }), /*#__PURE__*/ (0, $ehFet$react).createElement("div", {
159
+ ref: containerRef,
160
+ style: {
161
+ display: 'contents'
162
+ }
163
+ }, /*#__PURE__*/ (0, $ehFet$react).createElement($07b14b47974efb58$var$PopoverGroupContext.Provider, {
164
+ value: containerRef
165
+ }, overlay)));
166
+ var _ref;
167
+ // Submenus/subdialogs are mounted into the root popover's container.
168
+ return /*#__PURE__*/ (0, $ehFet$react).createElement((0, $ehFet$Overlay), {
169
+ ...props,
170
+ shouldContainFocus: isDialog,
171
+ isExiting: isExiting,
172
+ portalContainer: (_ref = UNSTABLE_portalContainer !== null && UNSTABLE_portalContainer !== void 0 ? UNSTABLE_portalContainer : groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.current) !== null && _ref !== void 0 ? _ref : undefined
173
+ }, overlay);
125
174
  }
126
175
 
127
176
 
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAsEM,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAA2C;AAErF,SAAS,8BAAQ,KAAmB,EAAE,GAA8B;IAClE,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,eAAe,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wCAAyB;IACvD,IAAI,aAAa,CAAA,GAAA,6BAAqB,EAAE;IACxC,IAAI,QAAQ,MAAM,MAAM,IAAI,QAAQ,MAAM,WAAW,IAAI,QAAQ,CAAC,eAAe,aAAa;IAC9F,IAAI,YAAY,CAAA,GAAA,yCAAe,EAAE,KAAK,MAAM,MAAM,KAAK,MAAM,SAAS,IAAI;IAC1E,IAAI,WAAW,CAAA,GAAA,kBAAU;I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QACR,kBAAkB;QAClB,QAAQ;YACN,SAAS,MAAM,OAAO,IAAI;uBAC1B;wBACA;uBACA;QACF;IACF;IAEA,IAAI,QAAQ;QAAC,GAAG,aAAa,KAAK;QAAE,GAAG,YAAY,KAAK;IAAA;IAExD,qBACE,gCAAC,CAAA,GAAA,cAAM;QAAG,GAAG,KAAK;QAAE,WAAW;QAAW,iBAAiB;OACxD,CAAC,MAAM,UAAU,IAAI,MAAM,MAAM,kBAAI,gCAAC;QAAI,eAAY;QAAY,GAAG,aAAa;QAAE,OAAO;YAAC,UAAU;YAAS,OAAO;QAAC;sBACxH,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,qBAAa,EAAE,QAAe,aAAa;QACzD,GAAG,WAAW;QACf,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,OAAO;QACP,gBAAc,MAAM,OAAO;QAC3B,kBAAgB;QAChB,iBAAe,cAAc;QAC7B,gBAAc,aAAa;OAC1B,CAAC,MAAM,UAAU,kBAAI,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;sBAC3D,gCAAC,CAAA,GAAA,yCAAkB,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;uBAAE;YAAW,KAAK;QAAQ;OAC1E,YAAY,QAAQ,iBAEvB,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;;AAI7C","sources":["packages/react-aria-components/src/Popover.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaPopoverProps, DismissButton, Overlay, PlacementAxis, PositionProps, usePopover} from 'react-aria';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useEnterAnimation, useExitAnimation, useRenderProps} from './utils';\nimport {filterDOMProps, mergeProps, useLayoutEffect} from '@react-aria/utils';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useRef, useState} from 'react';\nimport {useIsHidden} from '@react-aria/collections';\n\nexport interface PopoverProps extends Omit<PositionProps, 'isOpen'>, Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'offset' | 'arrowSize'>, OverlayTriggerProps, RenderProps<PopoverRenderProps>, SlotProps {\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string,\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the popover is currently performing an exit animation.\n */\n isExiting?: boolean,\n /**\n * The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element,\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n * @default 8\n */\n offset?: number\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null,\n /**\n * The placement of the popover relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, HTMLElement>>(null);\n\nfunction Popover(props: PopoverProps, ref: ForwardedRef<HTMLElement>) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n let isHidden = useIsHidden();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting} />\n );\n}\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nconst _Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(Popover);\nexport {_Popover as Popover};\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState,\n isEntering?: boolean,\n isExiting: boolean,\n UNSTABLE_portalContainer?: Element,\n trigger?: string\n}\n\nfunction PopoverInner({state, isExiting, UNSTABLE_portalContainer, ...props}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {popoverProps, underlayProps, arrowProps, placement} = usePopover({\n ...props,\n offset: props.offset ?? 8,\n arrowSize: arrowWidth\n }, state);\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n let isEntering = useEnterAnimation(ref, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Popover',\n values: {\n trigger: props.trigger || null,\n placement,\n isEntering,\n isExiting\n }\n });\n\n let style = {...popoverProps.style, ...renderProps.style};\n\n return (\n <Overlay {...props} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer}>\n {!props.isNonModal && state.isOpen && <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />}\n <div\n {...mergeProps(filterDOMProps(props as any), popoverProps)}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </div>\n </Overlay>\n );\n}\n"],"names":[],"version":3,"file":"Popover.module.js.map"}
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAuEM,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAA2C;AAErF,iFAAiF;AACjF,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAAoC;AAKrE,MAAM,4CAAwB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,QAAQ,KAAmB,EAAE,GAA8B;IACtI,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,eAAe,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wCAAyB;IACvD,IAAI,aAAa,CAAA,GAAA,6BAAqB,EAA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AC,aAAa;QAC/B,mBAAiB,KAAK,CAAC,kBAAkB;QACzC,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,OAAO;QACP,KAAK,MAAM,GAAG;QACd,gBAAc,MAAM,OAAO;QAC3B,kBAAgB;QAChB,iBAAe,cAAc;QAC7B,gBAAc,aAAa;OAC1B,CAAC,MAAM,UAAU,kBAAI,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;sBAC3D,gCAAC,CAAA,GAAA,yCAAkB,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;uBAAE;YAAW,KAAK;QAAQ;OAC1E,YAAY,QAAQ,iBAEvB,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;;IAIzC,yGAAyG;IACzG,IAAI,CAAC,cACH,qBACE,gCAAC,CAAA,GAAA,cAAM;QAAG,GAAG,KAAK;QAAE,oBAAoB;QAAU,WAAW;QAAW,iBAAiB;OACtF,CAAC,MAAM,UAAU,IAAI,MAAM,MAAM,kBAAI,gCAAC;QAAI,eAAY;QAAY,GAAG,aAAa;QAAE,OAAO;YAAC,UAAU;YAAS,OAAO;QAAC;sBACxH,gCAAC;QAAI,KAAK;QAAc,OAAO;YAAC,SAAS;QAAU;qBACjD,gCAAC,0CAAoB,QAAQ;QAAC,OAAO;OAClC;QASgF;IAF3F,qEAAqE;IACrE,qBACE,gCAAC,CAAA,GAAA,cAAM;QAAG,GAAG,KAAK;QAAE,oBAAoB;QAAU,WAAW;QAAW,iBAAiB,CAAA,OAAA,qCAAA,sCAAA,2BAA4B,qBAAA,+BAAA,SAAU,OAAO,cAA7C,kBAAA,OAAiD;OACvI;AAGP","sources":["packages/react-aria-components/src/Popover.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, forwardRefType, RefObject} from '@react-types/shared';\nimport {AriaPopoverProps, DismissButton, Overlay, PlacementAxis, PositionProps, useLocale, usePopover} from 'react-aria';\nimport {ContextValue, RenderProps, SlotProps, useContextProps, useRenderProps} from './utils';\nimport {filterDOMProps, mergeProps, useEnterAnimation, useExitAnimation, useLayoutEffect} from '@react-aria/utils';\nimport {focusSafely} from '@react-aria/interactions';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport React, {createContext, ForwardedRef, forwardRef, useContext, useEffect, useRef, useState} from 'react';\nimport {useIsHidden} from '@react-aria/collections';\n\nexport interface PopoverProps extends Omit<PositionProps, 'isOpen'>, Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'groupRef' | 'offset' | 'arrowSize'>, OverlayTriggerProps, RenderProps<PopoverRenderProps>, SlotProps, AriaLabelingProps {\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string,\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>,\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean,\n /**\n * Whether the popover is currently performing an exit animation.\n */\n isExiting?: boolean,\n /**\n * The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element,\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n * @default 8\n */\n offset?: number\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null,\n /**\n * The placement of the popover relative to the trigger.\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null,\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n * @selector [data-entering]\n */\n isEntering: boolean,\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n * @selector [data-exiting]\n */\n isExiting: boolean\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverProps, HTMLElement>>(null);\n\n// Stores a ref for the portal container for a group of popovers (e.g. submenus).\nconst PopoverGroupContext = createContext<RefObject<Element | null> | null>(null);\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(function Popover(props: PopoverProps, ref: ForwardedRef<HTMLElement>) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n let isHidden = useIsHidden();\n let {direction} = useLocale();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting}\n dir={direction} />\n );\n});\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState,\n isEntering?: boolean,\n isExiting: boolean,\n UNSTABLE_portalContainer?: Element,\n trigger?: string,\n dir?: 'ltr' | 'rtl'\n}\n\nfunction PopoverInner({state, isExiting, UNSTABLE_portalContainer, ...props}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let [arrowWidth, setArrowWidth] = useState(0);\n let containerRef = useRef<HTMLDivElement | null>(null);\n let groupCtx = useContext(PopoverGroupContext);\n let isSubPopover = groupCtx && props.trigger === 'SubmenuTrigger';\n useLayoutEffect(() => {\n if (arrowRef.current && state.isOpen) {\n setArrowWidth(arrowRef.current.getBoundingClientRect().width);\n }\n }, [state.isOpen, arrowRef]);\n\n let {popoverProps, underlayProps, arrowProps, placement} = usePopover({\n ...props,\n offset: props.offset ?? 8,\n arrowSize: arrowWidth,\n // If this is a submenu/subdialog, use the root popover's container \n // to detect outside interaction and add aria-hidden.\n groupRef: isSubPopover ? groupCtx! : containerRef\n }, state);\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n let isEntering = useEnterAnimation(ref, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Popover',\n values: {\n trigger: props.trigger || null,\n placement,\n isEntering,\n isExiting\n }\n });\n\n // Automatically render Popover with role=dialog except when isNonModal is true,\n // or a dialog is already nested inside the popover.\n let shouldBeDialog = !props.isNonModal || props.trigger === 'SubmenuTrigger';\n let [isDialog, setDialog] = useState(false);\n useLayoutEffect(() => {\n if (ref.current) {\n setDialog(shouldBeDialog && !ref.current.querySelector('[role=dialog]'));\n }\n }, [ref, shouldBeDialog]);\n\n // Focus the popover itself on mount, unless a child element is already focused.\n useEffect(() => {\n if (isDialog && ref.current && !ref.current.contains(document.activeElement)) {\n focusSafely(ref.current);\n }\n }, [isDialog, ref]);\n\n let style = {...popoverProps.style, ...renderProps.style};\n let overlay = (\n <div\n {...mergeProps(filterDOMProps(props as any), popoverProps)}\n {...renderProps}\n role={isDialog ? 'dialog' : undefined}\n tabIndex={isDialog ? -1 : undefined}\n aria-label={props['aria-label']}\n aria-labelledby={props['aria-labelledby']}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n dir={props.dir}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {renderProps.children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </div>\n );\n\n // If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.\n if (!isSubPopover) {\n return (\n <Overlay {...props} shouldContainFocus={isDialog} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer}>\n {!props.isNonModal && state.isOpen && <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />}\n <div ref={containerRef} style={{display: 'contents'}}>\n <PopoverGroupContext.Provider value={containerRef}>\n {overlay}\n </PopoverGroupContext.Provider>\n </div>\n </Overlay>\n );\n }\n\n // Submenus/subdialogs are mounted into the root popover's container.\n return (\n <Overlay {...props} shouldContainFocus={isDialog} isExiting={isExiting} portalContainer={UNSTABLE_portalContainer ?? groupCtx?.current ?? undefined}>\n {overlay}\n </Overlay>\n );\n}\n"],"names":[],"version":3,"file":"Popover.module.js.map"}
@@ -31,11 +31,11 @@ $parcel$export(module.exports, "ProgressBar", () => $0d6436f6a1b0b001$export$c17
31
31
 
32
32
 
33
33
  const $0d6436f6a1b0b001$export$e9f3bf65a26ce129 = /*#__PURE__*/ (0, $av4IL$react.createContext)(null);
34
- function $0d6436f6a1b0b001$var$ProgressBar(props, ref) {
34
+ const $0d6436f6a1b0b001$export$c17561cb55d4db30 = /*#__PURE__*/ (0, $av4IL$react.forwardRef)(function ProgressBar(props, ref) {
35
35
  [props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(props, ref, $0d6436f6a1b0b001$export$e9f3bf65a26ce129);
36
36
  let { value: value = 0, minValue: minValue = 0, maxValue: maxValue = 100, isIndeterminate: isIndeterminate = false } = props;
37
37
  value = (0, $av4IL$reactstatelyutils.clamp)(value, minValue, maxValue);
38
- let [labelRef, label] = (0, $c5ccf687772c0422$exports.useSlot)();
38
+ let [labelRef, label] = (0, $c5ccf687772c0422$exports.useSlot)(!props['aria-label'] && !props['aria-labelledby']);
39
39
  let { progressBarProps: progressBarProps, labelProps: labelProps } = (0, $av4IL$reactaria.useProgressBar)({
40
40
  ...props,
41
41
  label: label
@@ -63,11 +63,7 @@ function $0d6436f6a1b0b001$var$ProgressBar(props, ref) {
63
63
  elementType: 'span'
64
64
  }
65
65
  }, renderProps.children));
66
- }
67
- /**
68
- * Progress bars show either determinate or indeterminate progress of an operation
69
- * over time.
70
- */ const $0d6436f6a1b0b001$export$c17561cb55d4db30 = /*#__PURE__*/ (0, $av4IL$react.forwardRef)($0d6436f6a1b0b001$var$ProgressBar);
66
+ });
71
67
 
72
68
 
73
69
  //# sourceMappingURL=ProgressBar.main.js.map