@depup/react-aria-components 1.19.0-depup.27 → 1.21.0-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/NavigationTree/package.json +5 -0
  2. package/PreviewTrigger/package.json +5 -0
  3. package/README.md +2 -2
  4. package/TokenField/package.json +5 -0
  5. package/changes.json +1 -1
  6. package/dist/exports/GridList.cjs.map +1 -1
  7. package/dist/exports/GridList.js.map +1 -1
  8. package/dist/exports/GridList.mjs.map +1 -1
  9. package/dist/exports/Menu.cjs +1 -0
  10. package/dist/exports/Menu.cjs.map +1 -1
  11. package/dist/exports/Menu.js +2 -2
  12. package/dist/exports/Menu.js.map +1 -1
  13. package/dist/exports/Menu.mjs +2 -2
  14. package/dist/exports/Menu.mjs.map +1 -1
  15. package/dist/exports/NavigationTree.cjs +37 -0
  16. package/dist/exports/NavigationTree.cjs.map +1 -0
  17. package/dist/exports/NavigationTree.js +25 -0
  18. package/dist/exports/NavigationTree.js.map +1 -0
  19. package/dist/exports/NavigationTree.mjs +25 -0
  20. package/dist/exports/NavigationTree.mjs.map +1 -0
  21. package/dist/exports/PreviewTrigger.cjs +26 -0
  22. package/dist/exports/PreviewTrigger.cjs.map +1 -0
  23. package/dist/exports/PreviewTrigger.js +21 -0
  24. package/dist/exports/PreviewTrigger.js.map +1 -0
  25. package/dist/exports/PreviewTrigger.mjs +21 -0
  26. package/dist/exports/PreviewTrigger.mjs.map +1 -0
  27. package/dist/exports/TokenField.cjs +31 -0
  28. package/dist/exports/TokenField.cjs.map +1 -0
  29. package/dist/exports/TokenField.js +21 -0
  30. package/dist/exports/TokenField.js.map +1 -0
  31. package/dist/exports/TokenField.mjs +21 -0
  32. package/dist/exports/TokenField.mjs.map +1 -0
  33. package/dist/exports/Tree.cjs.map +1 -1
  34. package/dist/exports/Tree.js.map +1 -1
  35. package/dist/exports/Tree.mjs.map +1 -1
  36. package/dist/exports/index.cjs +25 -0
  37. package/dist/exports/index.cjs.map +1 -1
  38. package/dist/exports/index.js +12 -2
  39. package/dist/exports/index.js.map +1 -1
  40. package/dist/exports/index.mjs +12 -2
  41. package/dist/exports/index.mjs.map +1 -1
  42. package/dist/private/Checkbox.cjs.map +1 -1
  43. package/dist/private/Checkbox.js.map +1 -1
  44. package/dist/private/Checkbox.mjs.map +1 -1
  45. package/dist/private/ComboBox.cjs +21 -2
  46. package/dist/private/ComboBox.cjs.map +1 -1
  47. package/dist/private/ComboBox.js +21 -2
  48. package/dist/private/ComboBox.js.map +1 -1
  49. package/dist/private/ComboBox.mjs +21 -2
  50. package/dist/private/ComboBox.mjs.map +1 -1
  51. package/dist/private/Dialog.cjs +21 -1
  52. package/dist/private/Dialog.cjs.map +1 -1
  53. package/dist/private/Dialog.js +21 -1
  54. package/dist/private/Dialog.js.map +1 -1
  55. package/dist/private/Dialog.mjs +21 -1
  56. package/dist/private/Dialog.mjs.map +1 -1
  57. package/dist/private/DragAndDrop.cjs +1 -0
  58. package/dist/private/DragAndDrop.cjs.map +1 -1
  59. package/dist/private/DragAndDrop.js +1 -0
  60. package/dist/private/DragAndDrop.js.map +1 -1
  61. package/dist/private/DragAndDrop.mjs +1 -0
  62. package/dist/private/DragAndDrop.mjs.map +1 -1
  63. package/dist/private/DropZone.cjs +5 -2
  64. package/dist/private/DropZone.cjs.map +1 -1
  65. package/dist/private/DropZone.js +5 -3
  66. package/dist/private/DropZone.js.map +1 -1
  67. package/dist/private/DropZone.mjs +5 -2
  68. package/dist/private/DropZone.mjs.map +1 -1
  69. package/dist/private/FileTrigger.cjs +1 -0
  70. package/dist/private/FileTrigger.cjs.map +1 -1
  71. package/dist/private/FileTrigger.js +1 -0
  72. package/dist/private/FileTrigger.js.map +1 -1
  73. package/dist/private/FileTrigger.mjs +1 -0
  74. package/dist/private/FileTrigger.mjs.map +1 -1
  75. package/dist/private/GridLayout.cjs +3 -1
  76. package/dist/private/GridLayout.cjs.map +1 -1
  77. package/dist/private/GridLayout.js +3 -1
  78. package/dist/private/GridLayout.js.map +1 -1
  79. package/dist/private/GridLayout.mjs +3 -1
  80. package/dist/private/GridLayout.mjs.map +1 -1
  81. package/dist/private/GridList.cjs +12 -1
  82. package/dist/private/GridList.cjs.map +1 -1
  83. package/dist/private/GridList.js +12 -1
  84. package/dist/private/GridList.js.map +1 -1
  85. package/dist/private/GridList.mjs +12 -1
  86. package/dist/private/GridList.mjs.map +1 -1
  87. package/dist/private/ListBox.cjs +9 -1
  88. package/dist/private/ListBox.cjs.map +1 -1
  89. package/dist/private/ListBox.js +9 -1
  90. package/dist/private/ListBox.js.map +1 -1
  91. package/dist/private/ListBox.mjs +9 -1
  92. package/dist/private/ListBox.mjs.map +1 -1
  93. package/dist/private/Menu.cjs +59 -2
  94. package/dist/private/Menu.cjs.map +1 -1
  95. package/dist/private/Menu.js +60 -4
  96. package/dist/private/Menu.js.map +1 -1
  97. package/dist/private/Menu.mjs +60 -4
  98. package/dist/private/Menu.mjs.map +1 -1
  99. package/dist/private/Meter.cjs +2 -1
  100. package/dist/private/Meter.cjs.map +1 -1
  101. package/dist/private/Meter.js +2 -1
  102. package/dist/private/Meter.js.map +1 -1
  103. package/dist/private/Meter.mjs +2 -1
  104. package/dist/private/Meter.mjs.map +1 -1
  105. package/dist/private/Modal.cjs +2 -0
  106. package/dist/private/Modal.cjs.map +1 -1
  107. package/dist/private/Modal.js +2 -0
  108. package/dist/private/Modal.js.map +1 -1
  109. package/dist/private/Modal.mjs +2 -0
  110. package/dist/private/Modal.mjs.map +1 -1
  111. package/dist/private/NavigationTree.cjs +272 -0
  112. package/dist/private/NavigationTree.cjs.map +1 -0
  113. package/dist/private/NavigationTree.js +258 -0
  114. package/dist/private/NavigationTree.js.map +1 -0
  115. package/dist/private/NavigationTree.mjs +257 -0
  116. package/dist/private/NavigationTree.mjs.map +1 -0
  117. package/dist/private/Popover.cjs +34 -9
  118. package/dist/private/Popover.cjs.map +1 -1
  119. package/dist/private/Popover.js +34 -9
  120. package/dist/private/Popover.js.map +1 -1
  121. package/dist/private/Popover.mjs +34 -9
  122. package/dist/private/Popover.mjs.map +1 -1
  123. package/dist/private/PreviewTrigger.cjs +88 -0
  124. package/dist/private/PreviewTrigger.cjs.map +1 -0
  125. package/dist/private/PreviewTrigger.js +80 -0
  126. package/dist/private/PreviewTrigger.js.map +1 -0
  127. package/dist/private/PreviewTrigger.mjs +79 -0
  128. package/dist/private/PreviewTrigger.mjs.map +1 -0
  129. package/dist/private/ProgressBar.cjs +6 -1
  130. package/dist/private/ProgressBar.cjs.map +1 -1
  131. package/dist/private/ProgressBar.js +6 -1
  132. package/dist/private/ProgressBar.js.map +1 -1
  133. package/dist/private/ProgressBar.mjs +6 -1
  134. package/dist/private/ProgressBar.mjs.map +1 -1
  135. package/dist/private/RadioGroup.cjs.map +1 -1
  136. package/dist/private/RadioGroup.js.map +1 -1
  137. package/dist/private/RadioGroup.mjs.map +1 -1
  138. package/dist/private/Select.cjs.map +1 -1
  139. package/dist/private/Select.js.map +1 -1
  140. package/dist/private/Select.mjs.map +1 -1
  141. package/dist/private/Switch.cjs +8 -2
  142. package/dist/private/Switch.cjs.map +1 -1
  143. package/dist/private/Switch.js +9 -3
  144. package/dist/private/Switch.js.map +1 -1
  145. package/dist/private/Switch.mjs +9 -3
  146. package/dist/private/Switch.mjs.map +1 -1
  147. package/dist/private/Table.cjs +26 -14
  148. package/dist/private/Table.cjs.map +1 -1
  149. package/dist/private/Table.js +26 -14
  150. package/dist/private/Table.js.map +1 -1
  151. package/dist/private/Table.mjs +26 -14
  152. package/dist/private/Table.mjs.map +1 -1
  153. package/dist/private/TableLayout.cjs +3 -1
  154. package/dist/private/TableLayout.cjs.map +1 -1
  155. package/dist/private/TableLayout.js +3 -1
  156. package/dist/private/TableLayout.js.map +1 -1
  157. package/dist/private/TableLayout.mjs +3 -1
  158. package/dist/private/TableLayout.mjs.map +1 -1
  159. package/dist/private/TagGroup.cjs +1 -0
  160. package/dist/private/TagGroup.cjs.map +1 -1
  161. package/dist/private/TagGroup.js +1 -0
  162. package/dist/private/TagGroup.js.map +1 -1
  163. package/dist/private/TagGroup.mjs +1 -0
  164. package/dist/private/TagGroup.mjs.map +1 -1
  165. package/dist/private/Text.cjs +3 -1
  166. package/dist/private/Text.cjs.map +1 -1
  167. package/dist/private/Text.js +4 -2
  168. package/dist/private/Text.js.map +1 -1
  169. package/dist/private/Text.mjs +4 -2
  170. package/dist/private/Text.mjs.map +1 -1
  171. package/dist/private/ToggleButton.cjs.map +1 -1
  172. package/dist/private/ToggleButton.js.map +1 -1
  173. package/dist/private/ToggleButton.mjs.map +1 -1
  174. package/dist/private/TokenField.cjs +235 -0
  175. package/dist/private/TokenField.cjs.map +1 -0
  176. package/dist/private/TokenField.js +225 -0
  177. package/dist/private/TokenField.js.map +1 -0
  178. package/dist/private/TokenField.mjs +223 -0
  179. package/dist/private/TokenField.mjs.map +1 -0
  180. package/dist/private/Tooltip.cjs +10 -2
  181. package/dist/private/Tooltip.cjs.map +1 -1
  182. package/dist/private/Tooltip.js +10 -2
  183. package/dist/private/Tooltip.js.map +1 -1
  184. package/dist/private/Tooltip.mjs +10 -2
  185. package/dist/private/Tooltip.mjs.map +1 -1
  186. package/dist/private/Tree.cjs +11 -1
  187. package/dist/private/Tree.cjs.map +1 -1
  188. package/dist/private/Tree.js +11 -1
  189. package/dist/private/Tree.js.map +1 -1
  190. package/dist/private/Tree.mjs +11 -1
  191. package/dist/private/Tree.mjs.map +1 -1
  192. package/dist/private/TreeDropTargetDelegate.cjs +11 -6
  193. package/dist/private/TreeDropTargetDelegate.cjs.map +1 -1
  194. package/dist/private/TreeDropTargetDelegate.js +11 -6
  195. package/dist/private/TreeDropTargetDelegate.js.map +1 -1
  196. package/dist/private/TreeDropTargetDelegate.mjs +11 -6
  197. package/dist/private/TreeDropTargetDelegate.mjs.map +1 -1
  198. package/dist/private/Virtualizer.cjs +18 -16
  199. package/dist/private/Virtualizer.cjs.map +1 -1
  200. package/dist/private/Virtualizer.js +18 -16
  201. package/dist/private/Virtualizer.js.map +1 -1
  202. package/dist/private/Virtualizer.mjs +18 -16
  203. package/dist/private/Virtualizer.mjs.map +1 -1
  204. package/dist/private/useDragAndDrop.cjs +7 -0
  205. package/dist/private/useDragAndDrop.cjs.map +1 -1
  206. package/dist/private/useDragAndDrop.js +7 -0
  207. package/dist/private/useDragAndDrop.js.map +1 -1
  208. package/dist/private/useDragAndDrop.mjs +7 -0
  209. package/dist/private/useDragAndDrop.mjs.map +1 -1
  210. package/dist/private/utils.cjs.map +1 -1
  211. package/dist/private/utils.js.map +1 -1
  212. package/dist/private/utils.mjs.map +1 -1
  213. package/dist/types/exports/GridList.d.ts +1 -1
  214. package/dist/types/exports/Menu.d.ts +2 -2
  215. package/dist/types/exports/NavigationTree.d.ts +8 -0
  216. package/dist/types/exports/PreviewTrigger.d.ts +3 -0
  217. package/dist/types/exports/TokenField.d.ts +5 -0
  218. package/dist/types/exports/Tree.d.ts +1 -1
  219. package/dist/types/exports/index.d.ts +14 -5
  220. package/dist/types/src/Breadcrumbs.d.ts +2 -2
  221. package/dist/types/src/Button.d.ts +1 -1
  222. package/dist/types/src/Calendar.d.ts +6 -6
  223. package/dist/types/src/Checkbox.d.ts +8 -8
  224. package/dist/types/src/Collection.d.ts +1 -1
  225. package/dist/types/src/ComboBox.d.ts +6 -3
  226. package/dist/types/src/DateField.d.ts +4 -4
  227. package/dist/types/src/DatePicker.d.ts +2 -2
  228. package/dist/types/src/Dialog.d.ts +2 -2
  229. package/dist/types/src/Disclosure.d.ts +2 -2
  230. package/dist/types/src/GridList.d.ts +18 -7
  231. package/dist/types/src/Group.d.ts +1 -1
  232. package/dist/types/src/Header.d.ts +1 -1
  233. package/dist/types/src/Input.d.ts +1 -1
  234. package/dist/types/src/Label.d.ts +1 -1
  235. package/dist/types/src/Link.d.ts +1 -1
  236. package/dist/types/src/ListBox.d.ts +6 -6
  237. package/dist/types/src/Menu.d.ts +25 -6
  238. package/dist/types/src/Meter.d.ts +1 -1
  239. package/dist/types/src/Modal.d.ts +2 -2
  240. package/dist/types/src/NavigationTree.d.ts +80 -0
  241. package/dist/types/src/NumberField.d.ts +1 -1
  242. package/dist/types/src/OverlayArrow.d.ts +1 -1
  243. package/dist/types/src/Popover.d.ts +8 -1
  244. package/dist/types/src/PreviewTrigger.d.ts +23 -0
  245. package/dist/types/src/RadioGroup.d.ts +8 -8
  246. package/dist/types/src/SearchField.d.ts +1 -1
  247. package/dist/types/src/Select.d.ts +3 -3
  248. package/dist/types/src/Separator.d.ts +1 -1
  249. package/dist/types/src/Slider.d.ts +5 -5
  250. package/dist/types/src/Switch.d.ts +7 -7
  251. package/dist/types/src/Table.d.ts +32 -8
  252. package/dist/types/src/Tabs.d.ts +5 -5
  253. package/dist/types/src/TagGroup.d.ts +3 -3
  254. package/dist/types/src/Text.d.ts +1 -1
  255. package/dist/types/src/TextField.d.ts +1 -1
  256. package/dist/types/src/Toast.d.ts +3 -3
  257. package/dist/types/src/ToggleButton.d.ts +1 -1
  258. package/dist/types/src/ToggleButtonGroup.d.ts +1 -1
  259. package/dist/types/src/TokenField.d.ts +111 -0
  260. package/dist/types/src/Toolbar.d.ts +1 -1
  261. package/dist/types/src/Tooltip.d.ts +1 -1
  262. package/dist/types/src/Tree.d.ts +12 -10
  263. package/dist/types/src/Virtualizer.d.ts +4 -0
  264. package/dist/types/src/utils.d.ts +19 -5
  265. package/i18n/ar-AE.js +1 -1
  266. package/i18n/ar-AE.mjs +1 -1
  267. package/i18n/bg-BG.js +1 -1
  268. package/i18n/bg-BG.mjs +1 -1
  269. package/i18n/cs-CZ.js +1 -1
  270. package/i18n/cs-CZ.mjs +1 -1
  271. package/i18n/da-DK.js +1 -1
  272. package/i18n/da-DK.mjs +1 -1
  273. package/i18n/de-DE.js +1 -1
  274. package/i18n/de-DE.mjs +1 -1
  275. package/i18n/el-GR.js +1 -1
  276. package/i18n/el-GR.mjs +1 -1
  277. package/i18n/en-US.js +1 -1
  278. package/i18n/en-US.mjs +1 -1
  279. package/i18n/es-ES.js +1 -1
  280. package/i18n/es-ES.mjs +1 -1
  281. package/i18n/et-EE.js +1 -1
  282. package/i18n/et-EE.mjs +1 -1
  283. package/i18n/fi-FI.js +1 -1
  284. package/i18n/fi-FI.mjs +1 -1
  285. package/i18n/fr-FR.js +1 -1
  286. package/i18n/fr-FR.mjs +1 -1
  287. package/i18n/he-IL.js +1 -1
  288. package/i18n/he-IL.mjs +1 -1
  289. package/i18n/hr-HR.js +1 -1
  290. package/i18n/hr-HR.mjs +1 -1
  291. package/i18n/hu-HU.js +1 -1
  292. package/i18n/hu-HU.mjs +1 -1
  293. package/i18n/it-IT.js +1 -1
  294. package/i18n/it-IT.mjs +1 -1
  295. package/i18n/ja-JP.js +1 -1
  296. package/i18n/ja-JP.mjs +1 -1
  297. package/i18n/ko-KR.js +1 -1
  298. package/i18n/ko-KR.mjs +1 -1
  299. package/i18n/lt-LT.js +1 -1
  300. package/i18n/lt-LT.mjs +1 -1
  301. package/i18n/lv-LV.js +1 -1
  302. package/i18n/lv-LV.mjs +1 -1
  303. package/i18n/nb-NO.js +1 -1
  304. package/i18n/nb-NO.mjs +1 -1
  305. package/i18n/nl-NL.js +1 -1
  306. package/i18n/nl-NL.mjs +1 -1
  307. package/i18n/pl-PL.js +1 -1
  308. package/i18n/pl-PL.mjs +1 -1
  309. package/i18n/pt-BR.js +1 -1
  310. package/i18n/pt-BR.mjs +1 -1
  311. package/i18n/pt-PT.js +1 -1
  312. package/i18n/pt-PT.mjs +1 -1
  313. package/i18n/ro-RO.js +1 -1
  314. package/i18n/ro-RO.mjs +1 -1
  315. package/i18n/ru-RU.js +1 -1
  316. package/i18n/ru-RU.mjs +1 -1
  317. package/i18n/sk-SK.js +1 -1
  318. package/i18n/sk-SK.mjs +1 -1
  319. package/i18n/sl-SI.js +1 -1
  320. package/i18n/sl-SI.mjs +1 -1
  321. package/i18n/sr-SP.js +1 -1
  322. package/i18n/sr-SP.mjs +1 -1
  323. package/i18n/sv-SE.js +1 -1
  324. package/i18n/sv-SE.mjs +1 -1
  325. package/i18n/tr-TR.js +1 -1
  326. package/i18n/tr-TR.mjs +1 -1
  327. package/i18n/uk-UA.js +1 -1
  328. package/i18n/uk-UA.mjs +1 -1
  329. package/i18n/zh-CN.js +1 -1
  330. package/i18n/zh-CN.mjs +1 -1
  331. package/i18n/zh-TW.js +1 -1
  332. package/i18n/zh-TW.mjs +1 -1
  333. package/package.json +33 -31
@@ -33,12 +33,15 @@ function $f7f9f96335a17b66$export$2cfc5be7a55829f6(options) {
33
33
  let hooks = {};
34
34
  if (isDraggable) {
35
35
  hooks.useDraggableCollectionState = function useDraggableCollectionStateOverride(props) {
36
+ // oxlint-disable-next-line react/react-compiler
36
37
  return (0, $deUbz$useDraggableCollectionState)({
37
38
  ...props,
38
39
  ...options
39
40
  });
40
41
  };
42
+ // oxlint-disable-next-line react/react-compiler
41
43
  hooks.useDraggableCollection = (0, $deUbz$useDraggableCollection);
44
+ // oxlint-disable-next-line react/react-compiler
42
45
  hooks.useDraggableItem = (0, $deUbz$useDraggableItem);
43
46
  hooks.DragPreview = (0, $deUbz$DragPreview);
44
47
  hooks.renderDragPreview = renderDragPreview;
@@ -46,18 +49,22 @@ function $f7f9f96335a17b66$export$2cfc5be7a55829f6(options) {
46
49
  }
47
50
  if (isDroppable) {
48
51
  hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(props) {
52
+ // oxlint-disable-next-line react/react-compiler
49
53
  return (0, $deUbz$useDroppableCollectionState)({
50
54
  ...props,
51
55
  ...options
52
56
  });
53
57
  };
58
+ // oxlint-disable-next-line react/react-compiler
54
59
  hooks.useDroppableItem = (0, $deUbz$useDroppableItem);
55
60
  hooks.useDroppableCollection = function useDroppableCollectionOverride(props, state, ref) {
61
+ // oxlint-disable-next-line react/react-compiler
56
62
  return (0, $deUbz$useDroppableCollection)({
57
63
  ...props,
58
64
  ...options
59
65
  }, state, ref);
60
66
  };
67
+ // oxlint-disable-next-line react/react-compiler
61
68
  hooks.useDropIndicator = (0,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AO;gBAAA,GAAG,OAAO;YAC/D;YACA,MAAM,gBAAgB,GAAG,CAAA,GAAA,uBAAe;YACxC,MAAM,mBAAmB,GAAG;YAC5B,MAAM,kBAAkB,GAAG;YAC3B,MAAM,sBAAsB,GAAG,CAAA,GAAA,6BAAqB;QACtD;QAEA,OAAO;IACT,GAAG;QAAC;KAAQ;IAEZ,OAAO;0BACL;IACF;AACF","sources":["packages/react-aria-components/src/useDragAndDrop.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n DropIndicatorProps as AriaDropIndicatorProps,\n DropIndicatorAria,\n DroppableCollectionOptions,\n DroppableCollectionResult,\n DroppableItemOptions,\n DroppableItemResult,\n useDropIndicator,\n useDroppableCollection,\n useDroppableItem\n} from 'react-aria/useDroppableCollection';\nimport {\n DraggableCollectionOptions,\n DraggableItemProps,\n DraggableItemResult,\n DragPreview,\n useDraggableCollection,\n useDraggableItem\n} from 'react-aria/useDraggableCollection';\nimport {\n DraggableCollectionProps,\n DroppableCollectionProps,\n Key,\n RefObject\n} from '@react-types/shared';\nimport {\n DraggableCollectionState,\n DraggableCollectionStateOptions,\n useDraggableCollectionState\n} from 'react-stately/useDraggableCollectionState';\nimport {DragItem, DropTarget, DropTargetDelegate} from '@react-types/shared';\nimport {\n DroppableCollectionState,\n DroppableCollectionStateOptions,\n useDroppableCollectionState\n} from 'react-stately/useDroppableCollectionState';\nimport {isVirtualDragging} from 'react-aria/private/dnd/DragManager';\nimport {JSX, useMemo} from 'react';\nimport {ListDropTargetDelegate} from 'react-aria/ListDropTargetDelegate';\n\nexport {DropIndicator, DropIndicatorContext, DragAndDropContext} from './DragAndDrop';\nexport type {DropIndicatorProps, DropIndicatorRenderProps} from './DragAndDrop';\n\ninterface DraggableCollectionStateOpts<T = object> extends Omit<\n DraggableCollectionStateOptions<T>,\n 'getItems'\n> {}\n\ninterface DragHooks<T = object> {\n useDraggableCollectionState?: (\n props: DraggableCollectionStateOpts<T>\n ) => DraggableCollectionState;\n useDraggableCollection?: (\n props: DraggableCollectionOptions,\n state: DraggableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) => void;\n useDraggableItem?: (\n props: DraggableItemProps,\n state: DraggableCollectionState\n ) => DraggableItemResult;\n DragPreview?: typeof DragPreview;\n renderDragPreview?: (\n items: DragItem[]\n ) => JSX.Element | {element: JSX.Element; x: number; y: number};\n isVirtualDragging?: () => boolean;\n}\n\ninterface DropHooks {\n useDroppableCollectionState?: (\n props: DroppableCollectionStateOptions\n ) => DroppableCollectionState;\n useDroppableCollection?: (\n props: DroppableCollectionOptions,\n state: DroppableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) => DroppableCollectionResult;\n useDroppableItem?: (\n options: DroppableItemOptions,\n state: DroppableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) => DroppableItemResult;\n useDropIndicator?: (\n props: AriaDropIndicatorProps,\n state: DroppableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) => DropIndicatorAria;\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n dropTargetDelegate?: DropTargetDelegate;\n ListDropTargetDelegate: typeof ListDropTargetDelegate;\n}\n\nexport type DragAndDropHooks<T = object> = DragHooks<T> & DropHooks;\n\nexport interface DragAndDrop<T = object> {\n /** Drag and drop hooks for the collection element. */\n dragAndDropHooks: DragAndDropHooks<T>;\n}\n\nexport interface DragAndDropOptions<T = object>\n extends Omit<DraggableCollectionProps, 'preview' | 'getItems'>, DroppableCollectionProps {\n /**\n * A function that returns the items being dragged. If not specified, we assume that the\n * collection is not draggable.\n *\n * @default () => []\n */\n getItems?: (keys: Set<Key>, items: T[]) => DragItem[];\n /**\n * A function that renders a drag preview, which is shown under the user's cursor while dragging.\n * By default, a copy of the dragged element is rendered.\n */\n renderDragPreview?: (\n items: DragItem[]\n ) => JSX.Element | {element: JSX.Element; x: number; y: number};\n /**\n * A function that renders a drop indicator element between two items in a collection.\n * This should render a `<DropIndicator>` element. If this function is not provided, a\n * default DropIndicator is provided.\n */\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n /**\n * A custom delegate object that provides drop targets for pointer coordinates within the\n * collection.\n */\n dropTargetDelegate?: DropTargetDelegate;\n /** Whether the drag and drop events should be disabled. */\n isDisabled?: boolean;\n}\n\n/**\n * Provides the hooks required to enable drag and drop behavior for a drag and drop compatible\n * collection component.\n */\nexport function useDragAndDrop<T = object>(options: DragAndDropOptions<T>): DragAndDrop<T> {\n let dragAndDropHooks = useMemo(() => {\n let {\n onDrop,\n onInsert,\n onItemDrop,\n onReorder,\n onMove,\n onRootDrop,\n getItems,\n renderDragPreview,\n renderDropIndicator,\n dropTargetDelegate\n } = options;\n\n let isDraggable = !!getItems;\n let isDroppable = !!(onDrop || onInsert || onItemDrop || onReorder || onMove || onRootDrop);\n\n let hooks = {} as DragAndDropHooks;\n if (isDraggable) {\n hooks.useDraggableCollectionState = function useDraggableCollectionStateOverride(\n props: DraggableCollectionStateOpts\n ) {\n return useDraggableCollectionState({\n ...props,\n ...options\n } as DraggableCollectionStateOptions);\n };\n hooks.useDraggableCollection = useDraggableCollection;\n hooks.useDraggableItem = useDraggableItem;\n hooks.DragPreview = DragPreview;\n hooks.renderDragPreview = renderDragPreview;\n hooks.isVirtualDragging = isVirtualDragging;\n }\n\n if (isDroppable) {\n hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(\n props: DroppableCollectionStateOptions\n ) {\n return useDroppableCollectionState({...props, ...options});\n };\n hooks.useDroppableItem = useDroppableItem;\n hooks.useDroppableCollection = function useDroppableCollectionOverride(\n props: DroppableCollectionOptions,\n state: DroppableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) {\n return useDroppableCollection({...props, ...options}, state, ref);\n };\n hooks.useDropIndicator = useDropIndicator;\n hooks.renderDropIndicator = renderDropIndicator;\n hooks.dropTargetDelegate = dropTargetDelegate;\n hooks.ListDropTargetDelegate = ListDropTargetDelegate;\n }\n\n return hooks;\n }, [options]);\n\n return {\n dragAndDropHooks\n };\n}\n"],"names":[],"version":3,"file":"useDragAndDrop.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAwIM,SAAS,0CAA2B,OAA8B;IACvE,IAAI,mBAAmB,CAAA,GAAA,cAAM,EAAE;QAC7B,IAAI,UACF,MAAM,YACN,QAAQ,cACR,UAAU,aACV,SAAS,UACT,MAAM,cACN,UAAU,YACV,QAAQ,qBACR,iBAAiB,uBACjB,mBAAmB,sBACnB,kBAAkB,EACnB,GAAG;QAEJ,IAAI,cAAc,CAAC,CAAC;QACpB,IAAI,cAAc,CAAC,CAAE,CAAA,UAAU,YAAY,cAAc,aAAa,UAAU,UAAS;QAEzF,IAAI,QAAQ,CAAC;QACb,IAAI,aAAa;YACf,MAAM,2BAA2B,GAAG,SAAS,oCAC3C,KAAmC;gBAEnC,gDAAgD;gBAChD,OAAO,CAAA,GAAA,kCAA0B,EAAE;oBACjC,GAAG,KAAK;oBACR,GAAG,OAAO;gBACZ;YACF;YACA,gDAAgD;YAChD,MAAM,sBAAsB,GAAG,CAAA,GAAA,6BAAqB;YACpD,gDAAgD;YAChD,MAAM,gBAAgB,GAAG,CAAA,GAAA,uBAAe;YACxC,MAAM,WAAW,GAAG,CAAA,GAAA,kBAAU;YAC9B,MAAM,iBAAiB,GAAG;YAC1B,MAAM,iBAAiB,GAAG,CAAA,GAAA,wBAAgB;QAC5C;QAEA,IAAI,aAAa;YACf,MAAM,2BAA2B,GAAG,SAAS,oCAC3C,KAAsC;gBAEtC,gDAAgD;gBAChD,OAAO,CAAA,GAAA,kCAA0B,EAAE;oBAAC,GAAG,KAAK;oBAAE,GAAG,OAAO;gBAAA;YAC1D;YACA,gDAAgD;YAChD,MAAM,gBAAgB,GAAG,CAAA,GAAA,uBAAe;YACxC,MAAM,sBAAsB,GAAG,SAAS,+BACtC,KAAiC,EACjC,KAA+B,EAC/B,GAAkC;gBAElC,gDAAgD;gBAChD,OAAO,CAAA,GAAA,6BAAqB,EAAE;oBAAC,GAAG,KAAK;oBAAE,GAAG,OAAO;gBAAA,GAAG,OAAO;YAC/D;YACA,gDAAgD;YAChD,MAAM,gBAAgB,GAAG,CAAA,GAAA,uBAAe;YACxC,MAAM,mBAAmB,GAAG;YAC5B,MAAM,kBAAkB,GAAG;YAC3B,MAAM,sBAAsB,GAAG,CAAA,GAAA,6BAAqB;QACtD;QAEA,OAAO;IACT,GAAG;QAAC;KAAQ;IAEZ,OAAO;0BACL;IACF;AACF","sources":["packages/react-aria-components/src/useDragAndDrop.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n DropIndicatorProps as AriaDropIndicatorProps,\n DropIndicatorAria,\n DroppableCollectionOptions,\n DroppableCollectionResult,\n DroppableItemOptions,\n DroppableItemResult,\n useDropIndicator,\n useDroppableCollection,\n useDroppableItem\n} from 'react-aria/useDroppableCollection';\nimport {\n DraggableCollectionOptions,\n DraggableItemProps,\n DraggableItemResult,\n DragPreview,\n useDraggableCollection,\n useDraggableItem\n} from 'react-aria/useDraggableCollection';\nimport {\n DraggableCollectionProps,\n DroppableCollectionProps,\n Key,\n RefObject\n} from '@react-types/shared';\nimport {\n DraggableCollectionState,\n DraggableCollectionStateOptions,\n useDraggableCollectionState\n} from 'react-stately/useDraggableCollectionState';\nimport {DragItem, DropTarget, DropTargetDelegate} from '@react-types/shared';\nimport {\n DroppableCollectionState,\n DroppableCollectionStateOptions,\n useDroppableCollectionState\n} from 'react-stately/useDroppableCollectionState';\nimport {isVirtualDragging} from 'react-aria/private/dnd/DragManager';\nimport {JSX, useMemo} from 'react';\nimport {ListDropTargetDelegate} from 'react-aria/ListDropTargetDelegate';\n\nexport {DropIndicator, DropIndicatorContext, DragAndDropContext} from './DragAndDrop';\nexport type {DropIndicatorProps, DropIndicatorRenderProps} from './DragAndDrop';\n\ninterface DraggableCollectionStateOpts<T = object> extends Omit<\n DraggableCollectionStateOptions<T>,\n 'getItems'\n> {}\n\ninterface DragHooks<T = object> {\n useDraggableCollectionState?: (\n props: DraggableCollectionStateOpts<T>\n ) => DraggableCollectionState;\n useDraggableCollection?: (\n props: DraggableCollectionOptions,\n state: DraggableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) => void;\n useDraggableItem?: (\n props: DraggableItemProps,\n state: DraggableCollectionState\n ) => DraggableItemResult;\n DragPreview?: typeof DragPreview;\n renderDragPreview?: (\n items: DragItem[]\n ) => JSX.Element | {element: JSX.Element; x: number; y: number};\n isVirtualDragging?: () => boolean;\n}\n\ninterface DropHooks {\n useDroppableCollectionState?: (\n props: DroppableCollectionStateOptions\n ) => DroppableCollectionState;\n useDroppableCollection?: (\n props: DroppableCollectionOptions,\n state: DroppableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) => DroppableCollectionResult;\n useDroppableItem?: (\n options: DroppableItemOptions,\n state: DroppableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) => DroppableItemResult;\n useDropIndicator?: (\n props: AriaDropIndicatorProps,\n state: DroppableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) => DropIndicatorAria;\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n dropTargetDelegate?: DropTargetDelegate;\n ListDropTargetDelegate: typeof ListDropTargetDelegate;\n}\n\nexport type DragAndDropHooks<T = object> = DragHooks<T> & DropHooks;\n\nexport interface DragAndDrop<T = object> {\n /** Drag and drop hooks for the collection element. */\n dragAndDropHooks: DragAndDropHooks<T>;\n}\n\nexport interface DragAndDropOptions<T = object>\n extends Omit<DraggableCollectionProps, 'preview' | 'getItems'>, DroppableCollectionProps {\n /**\n * A function that returns the items being dragged. If not specified, we assume that the\n * collection is not draggable.\n *\n * @default () => []\n */\n getItems?: (keys: Set<Key>, items: T[]) => DragItem[];\n /**\n * A function that renders a drag preview, which is shown under the user's cursor while dragging.\n * By default, a copy of the dragged element is rendered.\n */\n renderDragPreview?: (\n items: DragItem[]\n ) => JSX.Element | {element: JSX.Element; x: number; y: number};\n /**\n * A function that renders a drop indicator element between two items in a collection.\n * This should render a `<DropIndicator>` element. If this function is not provided, a\n * default DropIndicator is provided.\n */\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n /**\n * A custom delegate object that provides drop targets for pointer coordinates within the\n * collection.\n */\n dropTargetDelegate?: DropTargetDelegate;\n /** Whether the drag and drop events should be disabled. */\n isDisabled?: boolean;\n}\n\n/**\n * Provides the hooks required to enable drag and drop behavior for a drag and drop compatible\n * collection component.\n */\nexport function useDragAndDrop<T = object>(options: DragAndDropOptions<T>): DragAndDrop<T> {\n let dragAndDropHooks = useMemo(() => {\n let {\n onDrop,\n onInsert,\n onItemDrop,\n onReorder,\n onMove,\n onRootDrop,\n getItems,\n renderDragPreview,\n renderDropIndicator,\n dropTargetDelegate\n } = options;\n\n let isDraggable = !!getItems;\n let isDroppable = !!(onDrop || onInsert || onItemDrop || onReorder || onMove || onRootDrop);\n\n let hooks = {} as DragAndDropHooks;\n if (isDraggable) {\n hooks.useDraggableCollectionState = function useDraggableCollectionStateOverride(\n props: DraggableCollectionStateOpts\n ) {\n // oxlint-disable-next-line react/react-compiler\n return useDraggableCollectionState({\n ...props,\n ...options\n } as DraggableCollectionStateOptions);\n };\n // oxlint-disable-next-line react/react-compiler\n hooks.useDraggableCollection = useDraggableCollection;\n // oxlint-disable-next-line react/react-compiler\n hooks.useDraggableItem = useDraggableItem;\n hooks.DragPreview = DragPreview;\n hooks.renderDragPreview = renderDragPreview;\n hooks.isVirtualDragging = isVirtualDragging;\n }\n\n if (isDroppable) {\n hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(\n props: DroppableCollectionStateOptions\n ) {\n // oxlint-disable-next-line react/react-compiler\n return useDroppableCollectionState({...props, ...options});\n };\n // oxlint-disable-next-line react/react-compiler\n hooks.useDroppableItem = useDroppableItem;\n hooks.useDroppableCollection = function useDroppableCollectionOverride(\n props: DroppableCollectionOptions,\n state: DroppableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) {\n // oxlint-disable-next-line react/react-compiler\n return useDroppableCollection({...props, ...options}, state, ref);\n };\n // oxlint-disable-next-line react/react-compiler\n hooks.useDropIndicator = useDropIndicator;\n hooks.renderDropIndicator = renderDropIndicator;\n hooks.dropTargetDelegate = dropTargetDelegate;\n hooks.ListDropTargetDelegate = ListDropTargetDelegate;\n }\n\n return hooks;\n }, [options]);\n\n return {\n dragAndDropHooks\n };\n}\n"],"names":[],"version":3,"file":"useDragAndDrop.js.map"}
@@ -33,12 +33,15 @@ function $32ef394310635fd5$export$2cfc5be7a55829f6(options) {
33
33
  let hooks = {};
34
34
  if (isDraggable) {
35
35
  hooks.useDraggableCollectionState = function useDraggableCollectionStateOverride(props) {
36
+ // oxlint-disable-next-line react/react-compiler
36
37
  return (0, $6P4UV$useDraggableCollectionState)({
37
38
  ...props,
38
39
  ...options
39
40
  });
40
41
  };
42
+ // oxlint-disable-next-line react/react-compiler
41
43
  hooks.useDraggableCollection = (0, $6P4UV$useDraggableCollection);
44
+ // oxlint-disable-next-line react/react-compiler
42
45
  hooks.useDraggableItem = (0, $6P4UV$useDraggableItem);
43
46
  hooks.DragPreview = (0, $6P4UV$DragPreview);
44
47
  hooks.renderDragPreview = renderDragPreview;
@@ -46,18 +49,22 @@ function $32ef394310635fd5$export$2cfc5be7a55829f6(options) {
46
49
  }
47
50
  if (isDroppable) {
48
51
  hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(props) {
52
+ // oxlint-disable-next-line react/react-compiler
49
53
  return (0, $6P4UV$useDroppableCollectionState)({
50
54
  ...props,
51
55
  ...options
52
56
  });
53
57
  };
58
+ // oxlint-disable-next-line react/react-compiler
54
59
  hooks.useDroppableItem = (0, $6P4UV$useDroppableItem);
55
60
  hooks.useDroppableCollection = function useDroppableCollectionOverride(props, state, ref) {
61
+ // oxlint-disable-next-line react/react-compiler
56
62
  return (0, $6P4UV$useDroppableCollection)({
57
63
  ...props,
58
64
  ...options
59
65
  }, state, ref);
60
66
  };
67
+ // oxlint-disable-next-line react/react-compiler
61
68
  hooks.useDropIndicator = (0, $6P4UV$useDropIndicator);
62
69
  hooks.renderDropIndicator = renderDropIndicator;
63
70
  hooks.dropTargetDelegate = dropTargetDelegate;
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAwIM,SAAS,0CAA2B,OAA8B;IACvE,IAAI,mBAAmB,CAAA,GAAA,cAAM,EAAE;QAC7B,IAAI,UACF,MAAM,YACN,QAAQ,cACR,UAAU,aACV,SAAS,UACT,MAAM,cACN,UAAU,YACV,QAAQ,qBACR,iBAAiB,uBACjB,mBAAmB,sBACnB,kBAAkB,EACnB,GAAG;QAEJ,IAAI,cAAc,CAAC,CAAC;QACpB,IAAI,cAAc,CAAC,CAAE,CAAA,UAAU,YAAY,cAAc,aAAa,UAAU,UAAS;QAEzF,IAAI,QAAQ,CAAC;QACb,IAAI,aAAa;YACf,MAAM,2BAA2B,GAAG,SAAS,oCAC3C,KAAmC;gBAEnC,OAAO,CAAA,GAAA,kCAA0B,EAAE;oBACjC,GAAG,KAAK;oBACR,GAAG,OAAO;gBACZ;YACF;YACA,MAAM,sBAAsB,GAAG,CAAA,GAAA,6BAAqB;YACpD,MAAM,gBAAgB,GAAG,CAAA,GAAA,uBAAe;YACxC,MAAM,WAAW,GAAG,CAAA,GAAA,kBAAU;YAC9B,MAAM,iBAAiB,GAAG;YAC1B,MAAM,iBAAiB,GAAG,CAAA,GAAA,wBAAgB;QAC5C;QAEA,IAAI,aAAa;YACf,MAAM,2BAA2B,GAAG,SAAS,oCAC3C,KAAsC;gBAEtC,OAAO,CAAA,GAAA,kCAA0B,EAAE;oBAAC,GAAG,KAAK;oBAAE,GAAG,OAAO;gBAAA;YAC1D;YACA,MAAM,gBAAgB,GAAG,CAAA,GAAA,uBAAe;YACxC,MAAM,sBAAsB,GAAG,SAAS,+BACtC,KAAiC,EACjC,KAA+B,EAC/B,GAAkC;gBAElC,OAAO,CAAA,GAAA,6BAAqB,EAAE;oBAAC,GAAG,KAAK;oBAAE,GAAG,OAAO;gBAAA,GAAG,OAAO;YAC/D;YACA,MAAM,gBAAgB,GAAG,CAAA,GAAA,uBAAe;YACxC,MAAM,mBAAmB,GAAG;YAC5B,MAAM,kBAAkB,GAAG;YAC3B,MAAM,sBAAsB,GAAG,CAAA,GAAA,6BAAqB;QACtD;QAEA,OAAO;IACT,GAAG;QAAC;KAAQ;IAEZ,OAAO;0BACL;IACF;AACF","sources":["packages/react-aria-components/src/useDragAndDrop.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n DropIndicatorProps as AriaDropIndicatorProps,\n DropIndicatorAria,\n DroppableCollectionOptions,\n DroppableCollectionResult,\n DroppableItemOptions,\n DroppableItemResult,\n useDropIndicator,\n useDroppableCollection,\n useDroppableItem\n} from 'react-aria/useDroppableCollection';\nimport {\n DraggableCollectionOptions,\n DraggableItemProps,\n DraggableItemResult,\n DragPreview,\n useDraggableCollection,\n useDraggableItem\n} from 'react-aria/useDraggableCollection';\nimport {\n DraggableCollectionProps,\n DroppableCollectionProps,\n Key,\n RefObject\n} from '@react-types/shared';\nimport {\n DraggableCollectionState,\n DraggableCollectionStateOptions,\n useDraggableCollectionState\n} from 'react-stately/useDraggableCollectionState';\nimport {DragItem, DropTarget, DropTargetDelegate} from '@react-types/shared';\nimport {\n DroppableCollectionState,\n DroppableCollectionStateOptions,\n useDroppableCollectionState\n} from 'react-stately/useDroppableCollectionState';\nimport {isVirtualDragging} from 'react-aria/private/dnd/DragManager';\nimport {JSX, useMemo} from 'react';\nimport {ListDropTargetDelegate} from 'react-aria/ListDropTargetDelegate';\n\nexport {DropIndicator, DropIndicatorContext, DragAndDropContext} from './DragAndDrop';\nexport type {DropIndicatorProps, DropIndicatorRenderProps} from './DragAndDrop';\n\ninterface DraggableCollectionStateOpts<T = object> extends Omit<\n DraggableCollectionStateOptions<T>,\n 'getItems'\n> {}\n\ninterface DragHooks<T = object> {\n useDraggableCollectionState?: (\n props: DraggableCollectionStateOpts<T>\n ) => DraggableCollectionState;\n useDraggableCollection?: (\n props: DraggableCollectionOptions,\n state: DraggableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) => void;\n useDraggableItem?: (\n props: DraggableItemProps,\n state: DraggableCollectionState\n ) => DraggableItemResult;\n DragPreview?: typeof DragPreview;\n renderDragPreview?: (\n items: DragItem[]\n ) => JSX.Element | {element: JSX.Element; x: number; y: number};\n isVirtualDragging?: () => boolean;\n}\n\ninterface DropHooks {\n useDroppableCollectionState?: (\n props: DroppableCollectionStateOptions\n ) => DroppableCollectionState;\n useDroppableCollection?: (\n props: DroppableCollectionOptions,\n state: DroppableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) => DroppableCollectionResult;\n useDroppableItem?: (\n options: DroppableItemOptions,\n state: DroppableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) => DroppableItemResult;\n useDropIndicator?: (\n props: AriaDropIndicatorProps,\n state: DroppableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) => DropIndicatorAria;\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n dropTargetDelegate?: DropTargetDelegate;\n ListDropTargetDelegate: typeof ListDropTargetDelegate;\n}\n\nexport type DragAndDropHooks<T = object> = DragHooks<T> & DropHooks;\n\nexport interface DragAndDrop<T = object> {\n /** Drag and drop hooks for the collection element. */\n dragAndDropHooks: DragAndDropHooks<T>;\n}\n\nexport interface DragAndDropOptions<T = object>\n extends Omit<DraggableCollectionProps, 'preview' | 'getItems'>, DroppableCollectionProps {\n /**\n * A function that returns the items being dragged. If not specified, we assume that the\n * collection is not draggable.\n *\n * @default () => []\n */\n getItems?: (keys: Set<Key>, items: T[]) => DragItem[];\n /**\n * A function that renders a drag preview, which is shown under the user's cursor while dragging.\n * By default, a copy of the dragged element is rendered.\n */\n renderDragPreview?: (\n items: DragItem[]\n ) => JSX.Element | {element: JSX.Element; x: number; y: number};\n /**\n * A function that renders a drop indicator element between two items in a collection.\n * This should render a `<DropIndicator>` element. If this function is not provided, a\n * default DropIndicator is provided.\n */\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n /**\n * A custom delegate object that provides drop targets for pointer coordinates within the\n * collection.\n */\n dropTargetDelegate?: DropTargetDelegate;\n /** Whether the drag and drop events should be disabled. */\n isDisabled?: boolean;\n}\n\n/**\n * Provides the hooks required to enable drag and drop behavior for a drag and drop compatible\n * collection component.\n */\nexport function useDragAndDrop<T = object>(options: DragAndDropOptions<T>): DragAndDrop<T> {\n let dragAndDropHooks = useMemo(() => {\n let {\n onDrop,\n onInsert,\n onItemDrop,\n onReorder,\n onMove,\n onRootDrop,\n getItems,\n renderDragPreview,\n renderDropIndicator,\n dropTargetDelegate\n } = options;\n\n let isDraggable = !!getItems;\n let isDroppable = !!(onDrop || onInsert || onItemDrop || onReorder || onMove || onRootDrop);\n\n let hooks = {} as DragAndDropHooks;\n if (isDraggable) {\n hooks.useDraggableCollectionState = function useDraggableCollectionStateOverride(\n props: DraggableCollectionStateOpts\n ) {\n return useDraggableCollectionState({\n ...props,\n ...options\n } as DraggableCollectionStateOptions);\n };\n hooks.useDraggableCollection = useDraggableCollection;\n hooks.useDraggableItem = useDraggableItem;\n hooks.DragPreview = DragPreview;\n hooks.renderDragPreview = renderDragPreview;\n hooks.isVirtualDragging = isVirtualDragging;\n }\n\n if (isDroppable) {\n hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(\n props: DroppableCollectionStateOptions\n ) {\n return useDroppableCollectionState({...props, ...options});\n };\n hooks.useDroppableItem = useDroppableItem;\n hooks.useDroppableCollection = function useDroppableCollectionOverride(\n props: DroppableCollectionOptions,\n state: DroppableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) {\n return useDroppableCollection({...props, ...options}, state, ref);\n };\n hooks.useDropIndicator = useDropIndicator;\n hooks.renderDropIndicator = renderDropIndicator;\n hooks.dropTargetDelegate = dropTargetDelegate;\n hooks.ListDropTargetDelegate = ListDropTargetDelegate;\n }\n\n return hooks;\n }, [options]);\n\n return {\n dragAndDropHooks\n };\n}\n"],"names":[],"version":3,"file":"useDragAndDrop.mjs.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAwIM,SAAS,0CAA2B,OAA8B;IACvE,IAAI,mBAAmB,CAAA,GAAA,cAAM,EAAE;QAC7B,IAAI,UACF,MAAM,YACN,QAAQ,cACR,UAAU,aACV,SAAS,UACT,MAAM,cACN,UAAU,YACV,QAAQ,qBACR,iBAAiB,uBACjB,mBAAmB,sBACnB,kBAAkB,EACnB,GAAG;QAEJ,IAAI,cAAc,CAAC,CAAC;QACpB,IAAI,cAAc,CAAC,CAAE,CAAA,UAAU,YAAY,cAAc,aAAa,UAAU,UAAS;QAEzF,IAAI,QAAQ,CAAC;QACb,IAAI,aAAa;YACf,MAAM,2BAA2B,GAAG,SAAS,oCAC3C,KAAmC;gBAEnC,gDAAgD;gBAChD,OAAO,CAAA,GAAA,kCAA0B,EAAE;oBACjC,GAAG,KAAK;oBACR,GAAG,OAAO;gBACZ;YACF;YACA,gDAAgD;YAChD,MAAM,sBAAsB,GAAG,CAAA,GAAA,6BAAqB;YACpD,gDAAgD;YAChD,MAAM,gBAAgB,GAAG,CAAA,GAAA,uBAAe;YACxC,MAAM,WAAW,GAAG,CAAA,GAAA,kBAAU;YAC9B,MAAM,iBAAiB,GAAG;YAC1B,MAAM,iBAAiB,GAAG,CAAA,GAAA,wBAAgB;QAC5C;QAEA,IAAI,aAAa;YACf,MAAM,2BAA2B,GAAG,SAAS,oCAC3C,KAAsC;gBAEtC,gDAAgD;gBAChD,OAAO,CAAA,GAAA,kCAA0B,EAAE;oBAAC,GAAG,KAAK;oBAAE,GAAG,OAAO;gBAAA;YAC1D;YACA,gDAAgD;YAChD,MAAM,gBAAgB,GAAG,CAAA,GAAA,uBAAe;YACxC,MAAM,sBAAsB,GAAG,SAAS,+BACtC,KAAiC,EACjC,KAA+B,EAC/B,GAAkC;gBAElC,gDAAgD;gBAChD,OAAO,CAAA,GAAA,6BAAqB,EAAE;oBAAC,GAAG,KAAK;oBAAE,GAAG,OAAO;gBAAA,GAAG,OAAO;YAC/D;YACA,gDAAgD;YAChD,MAAM,gBAAgB,GAAG,CAAA,GAAA,uBAAe;YACxC,MAAM,mBAAmB,GAAG;YAC5B,MAAM,kBAAkB,GAAG;YAC3B,MAAM,sBAAsB,GAAG,CAAA,GAAA,6BAAqB;QACtD;QAEA,OAAO;IACT,GAAG;QAAC;KAAQ;IAEZ,OAAO;0BACL;IACF;AACF","sources":["packages/react-aria-components/src/useDragAndDrop.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n DropIndicatorProps as AriaDropIndicatorProps,\n DropIndicatorAria,\n DroppableCollectionOptions,\n DroppableCollectionResult,\n DroppableItemOptions,\n DroppableItemResult,\n useDropIndicator,\n useDroppableCollection,\n useDroppableItem\n} from 'react-aria/useDroppableCollection';\nimport {\n DraggableCollectionOptions,\n DraggableItemProps,\n DraggableItemResult,\n DragPreview,\n useDraggableCollection,\n useDraggableItem\n} from 'react-aria/useDraggableCollection';\nimport {\n DraggableCollectionProps,\n DroppableCollectionProps,\n Key,\n RefObject\n} from '@react-types/shared';\nimport {\n DraggableCollectionState,\n DraggableCollectionStateOptions,\n useDraggableCollectionState\n} from 'react-stately/useDraggableCollectionState';\nimport {DragItem, DropTarget, DropTargetDelegate} from '@react-types/shared';\nimport {\n DroppableCollectionState,\n DroppableCollectionStateOptions,\n useDroppableCollectionState\n} from 'react-stately/useDroppableCollectionState';\nimport {isVirtualDragging} from 'react-aria/private/dnd/DragManager';\nimport {JSX, useMemo} from 'react';\nimport {ListDropTargetDelegate} from 'react-aria/ListDropTargetDelegate';\n\nexport {DropIndicator, DropIndicatorContext, DragAndDropContext} from './DragAndDrop';\nexport type {DropIndicatorProps, DropIndicatorRenderProps} from './DragAndDrop';\n\ninterface DraggableCollectionStateOpts<T = object> extends Omit<\n DraggableCollectionStateOptions<T>,\n 'getItems'\n> {}\n\ninterface DragHooks<T = object> {\n useDraggableCollectionState?: (\n props: DraggableCollectionStateOpts<T>\n ) => DraggableCollectionState;\n useDraggableCollection?: (\n props: DraggableCollectionOptions,\n state: DraggableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) => void;\n useDraggableItem?: (\n props: DraggableItemProps,\n state: DraggableCollectionState\n ) => DraggableItemResult;\n DragPreview?: typeof DragPreview;\n renderDragPreview?: (\n items: DragItem[]\n ) => JSX.Element | {element: JSX.Element; x: number; y: number};\n isVirtualDragging?: () => boolean;\n}\n\ninterface DropHooks {\n useDroppableCollectionState?: (\n props: DroppableCollectionStateOptions\n ) => DroppableCollectionState;\n useDroppableCollection?: (\n props: DroppableCollectionOptions,\n state: DroppableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) => DroppableCollectionResult;\n useDroppableItem?: (\n options: DroppableItemOptions,\n state: DroppableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) => DroppableItemResult;\n useDropIndicator?: (\n props: AriaDropIndicatorProps,\n state: DroppableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) => DropIndicatorAria;\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n dropTargetDelegate?: DropTargetDelegate;\n ListDropTargetDelegate: typeof ListDropTargetDelegate;\n}\n\nexport type DragAndDropHooks<T = object> = DragHooks<T> & DropHooks;\n\nexport interface DragAndDrop<T = object> {\n /** Drag and drop hooks for the collection element. */\n dragAndDropHooks: DragAndDropHooks<T>;\n}\n\nexport interface DragAndDropOptions<T = object>\n extends Omit<DraggableCollectionProps, 'preview' | 'getItems'>, DroppableCollectionProps {\n /**\n * A function that returns the items being dragged. If not specified, we assume that the\n * collection is not draggable.\n *\n * @default () => []\n */\n getItems?: (keys: Set<Key>, items: T[]) => DragItem[];\n /**\n * A function that renders a drag preview, which is shown under the user's cursor while dragging.\n * By default, a copy of the dragged element is rendered.\n */\n renderDragPreview?: (\n items: DragItem[]\n ) => JSX.Element | {element: JSX.Element; x: number; y: number};\n /**\n * A function that renders a drop indicator element between two items in a collection.\n * This should render a `<DropIndicator>` element. If this function is not provided, a\n * default DropIndicator is provided.\n */\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n /**\n * A custom delegate object that provides drop targets for pointer coordinates within the\n * collection.\n */\n dropTargetDelegate?: DropTargetDelegate;\n /** Whether the drag and drop events should be disabled. */\n isDisabled?: boolean;\n}\n\n/**\n * Provides the hooks required to enable drag and drop behavior for a drag and drop compatible\n * collection component.\n */\nexport function useDragAndDrop<T = object>(options: DragAndDropOptions<T>): DragAndDrop<T> {\n let dragAndDropHooks = useMemo(() => {\n let {\n onDrop,\n onInsert,\n onItemDrop,\n onReorder,\n onMove,\n onRootDrop,\n getItems,\n renderDragPreview,\n renderDropIndicator,\n dropTargetDelegate\n } = options;\n\n let isDraggable = !!getItems;\n let isDroppable = !!(onDrop || onInsert || onItemDrop || onReorder || onMove || onRootDrop);\n\n let hooks = {} as DragAndDropHooks;\n if (isDraggable) {\n hooks.useDraggableCollectionState = function useDraggableCollectionStateOverride(\n props: DraggableCollectionStateOpts\n ) {\n // oxlint-disable-next-line react/react-compiler\n return useDraggableCollectionState({\n ...props,\n ...options\n } as DraggableCollectionStateOptions);\n };\n // oxlint-disable-next-line react/react-compiler\n hooks.useDraggableCollection = useDraggableCollection;\n // oxlint-disable-next-line react/react-compiler\n hooks.useDraggableItem = useDraggableItem;\n hooks.DragPreview = DragPreview;\n hooks.renderDragPreview = renderDragPreview;\n hooks.isVirtualDragging = isVirtualDragging;\n }\n\n if (isDroppable) {\n hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(\n props: DroppableCollectionStateOptions\n ) {\n // oxlint-disable-next-line react/react-compiler\n return useDroppableCollectionState({...props, ...options});\n };\n // oxlint-disable-next-line react/react-compiler\n hooks.useDroppableItem = useDroppableItem;\n hooks.useDroppableCollection = function useDroppableCollectionOverride(\n props: DroppableCollectionOptions,\n state: DroppableCollectionState,\n ref: RefObject<HTMLElement | null>\n ) {\n // oxlint-disable-next-line react/react-compiler\n return useDroppableCollection({...props, ...options}, state, ref);\n };\n // oxlint-disable-next-line react/react-compiler\n hooks.useDropIndicator = useDropIndicator;\n hooks.renderDropIndicator = renderDropIndicator;\n hooks.dropTargetDelegate = dropTargetDelegate;\n hooks.ListDropTargetDelegate = ListDropTargetDelegate;\n }\n\n return hooks;\n }, [options]);\n\n return {\n dragAndDropHooks\n };\n}\n"],"names":[],"version":3,"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AC5C,IAAI,MAAM,CAAA,GAAA,oBAAM,EAAE,IAAM,CAAA,GAAA,mCAAQ,EAAE,cAAc,aAAa;QAAC;QAAc;KAAW;IAEvF,CAAA,GAAA,2DAAc,EAAE;QACd,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,gBAAgB,QAAQ;YACnD,IAAI,CAAC,WAAW,OAAO,EACrB,QAAQ,IAAI,CACV;iBAEG,IAAI,WAAW,OAAO,CAAC,SAAS,KAAK,aAC1C,QAAQ,IAAI,CACV,CAAC,yEAAyE,EAAE,YAAY,QAAQ,EAAE,WAAW,OAAO,CAAC,SAAS,CAAC,2DAA2D,CAAC;QAGjM;IACF,GAAG;QAAC;QAAa;KAAO;IAExB,IAAI,WAAgB;QAAC,GAAG,UAAU;aAAE;IAAG;IACvC,IAAI,QACF,OAAO,OAAO,UAAU;IAG1B,qBAAO,0DAAC,aAAgB;AAC1B;AAQA,MAAM,0CAAoB,CAAC;AAGpB,MAAM,4CAAM,IAAI,MACrB,CAAC,GACD;IACE,KAAI,MAAM,EAAE,WAAW;QACrB,IAAI,OAAO,gBAAgB,UACzB,OAAO;QAGT,IAAI,MAAM,uCAAiB,CAAC,YAAY;QACxC,IAAI,CAAC,KAAK;YACR,oBAAM,CAAA,GAAA,uBAAS,EAAE,iCAAW,IAAI,CAAC,MAAM;YACvC,uCAAiB,CAAC,YAAY,GAAG;QACnC;QAEA,OAAO;IACT;AACF","sources":["packages/react-aria-components/src/utils.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, RefObject, DOMProps as SharedDOMProps} from '@react-types/shared';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport React, {\n AllHTMLAttributes,\n AnchorHTMLAttributes,\n Context,\n CSSProperties,\n DetailedHTMLProps,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactElement,\n ReactNode,\n RefCallback,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useObjectRef} from 'react-aria/useObjectRef';\n\nexport const DEFAULT_SLOT = Symbol('default');\n\ninterface SlottedValue<T> {\n slots?: Record<string | symbol, T>;\n}\n\nexport type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;\nexport type ContextValue<T, E> = SlottedContextValue<WithRef<T, E>>;\n\ntype ProviderValue<T> = [Context<T>, T];\ntype ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L> =\n | [ProviderValue<A>]\n | [ProviderValue<A>, ProviderValue<B>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>,\n ProviderValue<L>\n ];\n\ninterface ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L> {\n values: ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L>;\n children: ReactNode;\n}\n\nexport function Provider<A, B, C, D, E, F, G, H, I, J, K, L>({\n values,\n children\n}: ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L>): JSX.Element {\n for (let [Context, value] of values) {\n // @ts-ignore\n children = <Context.Provider value={value}>{children}</Context.Provider>;\n }\n\n return children as JSX.Element;\n}\n\nexport interface StyleProps {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element.\n */\n className?: string;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element.\n */\n style?: CSSProperties;\n}\n\nexport interface DOMProps extends StyleProps, SharedDOMProps {\n /** The children of the component. */\n children?: ReactNode;\n}\n\nexport type ClassNameOrFunction<T> =\n | string\n | ((values: T & {defaultClassName: string | undefined}) => string);\ntype StyleOrFunction<T> =\n | CSSProperties\n | ((values: T & {defaultStyle: CSSProperties}) => CSSProperties | undefined);\n\nexport interface StyleRenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends DOMRenderProps<E, T> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n */\n className?: ClassNameOrFunction<T>;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element. A function may be provided to compute the style based on component state.\n */\n style?: StyleOrFunction<T>;\n}\n\nexport type ChildrenOrFunction<T> =\n | ReactNode\n | ((values: T & {defaultChildren: ReactNode | undefined}) => ReactNode);\n\nexport interface RenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends StyleRenderProps<T, E> {\n /**\n * The children of the component. A function may be provided to alter the children based on\n * component state.\n */\n children?: ChildrenOrFunction<T>;\n}\n\ninterface RenderPropsHookOptions<T, E extends keyof React.JSX.IntrinsicElements>\n extends RenderProps<T, E>, SharedDOMProps, AriaLabelingProps {\n values: T;\n defaultChildren?: ReactNode;\n defaultClassName?: string;\n defaultStyle?: CSSProperties;\n}\n\ninterface RenderPropsHookRetVal<T, E extends keyof React.JSX.IntrinsicElements> {\n className?: string;\n style?: CSSProperties;\n children?: ReactNode;\n 'data-rac': string;\n render?: DOMRenderFunction<E, T>;\n}\n\nexport function useRenderProps<T, E extends keyof React.JSX.IntrinsicElements>(\n props: RenderPropsHookOptions<T, E>\n): RenderPropsHookRetVal<T, E> {\n let {\n className,\n style,\n children,\n defaultClassName = undefined,\n defaultChildren = undefined,\n defaultStyle,\n values,\n render\n } = props;\n\n return useMemo(() => {\n let computedClassName: string | undefined;\n let computedStyle: React.CSSProperties | undefined;\n let computedChildren: React.ReactNode | undefined;\n\n if (typeof className === 'function') {\n computedClassName = className({...values, defaultClassName});\n } else {\n computedClassName = className;\n }\n\n if (typeof style === 'function') {\n computedStyle = style({...values, defaultStyle: defaultStyle || {}});\n } else {\n computedStyle = style;\n }\n\n if (typeof children === 'function') {\n computedChildren = children({...values, defaultChildren});\n } else if (children == null) {\n computedChildren = defaultChildren;\n } else {\n computedChildren = children;\n }\n\n return {\n className: computedClassName ?? defaultClassName,\n style: computedStyle || defaultStyle ? {...defaultStyle, ...computedStyle} : undefined,\n children: computedChildren ?? defaultChildren,\n 'data-rac': '',\n render: render ? props => render(props, values) : undefined\n };\n }, [className, style, children, defaultClassName, defaultChildren, defaultStyle, values, render]);\n}\n\n/**\n * A helper function that accepts a user-provided render prop value (either a static value or a\n * function), and combines it with another value to create a final result.\n */\nexport function composeRenderProps<T, U, V extends T>(\n // https://stackoverflow.com/questions/60898079/typescript-type-t-or-function-t-usage\n value: T extends any ? T | ((renderProps: U) => V) : never,\n wrap: (prevValue: T, renderProps: U) => V\n): (renderProps: U) => V {\n return renderProps => wrap(typeof value === 'function' ? value(renderProps) : value, renderProps);\n}\n\nexport type WithRef<T, E> = T & {ref?: ForwardedRef<E>};\nexport interface SlotProps {\n /**\n * A slot name for the component. Slots allow the component to receive props from a parent\n * component. An explicit `null` value indicates that the local props completely override all\n * props received from a parent.\n */\n slot?: string | null;\n}\n\nexport function useSlottedContext<T>(\n context: Context<SlottedContextValue<T>>,\n slot?: string | null\n): T | null | undefined {\n let ctx = useContext(context);\n if (slot === null) {\n // An explicit `null` slot means don't use context.\n return null;\n }\n if (ctx && typeof ctx === 'object' && 'slots' in ctx && ctx.slots) {\n let slotKey = slot || DEFAULT_SLOT;\n if (!ctx.slots[slotKey]) {\n let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map(p => `\"${p}\"`));\n let errorMessage = slot ? `Invalid slot \"${slot}\".` : 'A slot prop is required.';\n\n throw new Error(`${errorMessage} Valid slot names are ${availableSlots}.`);\n }\n return ctx.slots[slotKey];\n }\n // @ts-ignore\n return ctx;\n}\n\nexport function useContextProps<T, U extends SlotProps, E extends Element>(\n props: T & SlotProps,\n ref: ForwardedRef<E> | undefined,\n context: Context<ContextValue<U, E>>\n): [T, RefObject<E | null>] {\n let ctx = useSlottedContext(context, props.slot) || {};\n let {ref: contextRef, ...contextProps} = ctx as any;\n let mergedRef = useObjectRef(useMemo(() => mergeRefs(ref, contextRef), [ref, contextRef]));\n let mergedProps = mergeProps(contextProps, props) as unknown as T;\n\n // mergeProps does not merge `style`. Adding this there might be a breaking change.\n if ('style' in contextProps && contextProps.style && 'style' in props && props.style) {\n if (typeof contextProps.style === 'function' || typeof props.style === 'function') {\n // @ts-ignore\n mergedProps.style = renderProps => {\n let contextStyle =\n typeof contextProps.style === 'function'\n ? contextProps.style(renderProps)\n : contextProps.style;\n let defaultStyle = {...renderProps.defaultStyle, ...contextStyle};\n let style =\n typeof props.style === 'function'\n ? props.style({...renderProps, defaultStyle})\n : props.style;\n return {...defaultStyle, ...style};\n };\n } else {\n // @ts-ignore\n mergedProps.style = {...contextProps.style, ...props.style};\n }\n }\n\n return [mergedProps, mergedRef];\n}\n\nexport function useSlot(\n initialState: boolean | (() => boolean) = true\n): [RefCallback<Element>, boolean] {\n // Initial state is typically based on the parent having an aria-label or aria-labelledby.\n // If it does, this value should be false so that we don't update the state and cause a rerender when we go through the layoutEffect\n let [hasSlot, setHasSlot] = useState(initialState);\n let hasRun = useRef(false);\n\n // A callback ref which will run when the slotted element mounts.\n // This should happen before the useLayoutEffect below.\n let ref = useCallback(el => {\n hasRun.current = true;\n setHasSlot(!!el);\n }, []);\n\n // If the callback hasn't been called, then reset to false.\n useLayoutEffect(() => {\n if (!hasRun.current) {\n setHasSlot(false);\n }\n }, []);\n\n return [ref, hasSlot];\n}\n\n/**\n * Filters out `data-*` attributes to keep them from being passed down and duplicated.\n *\n * @param props\n */\nexport function removeDataAttributes<T>(props: T): T {\n const prefix = /^(data-.*)$/;\n let filteredProps = {} as T;\n\n for (const prop in props) {\n if (!prefix.test(prop)) {\n filteredProps[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n\n// Override base type to change the default.\nexport interface RACValidation {\n /**\n * Whether to use native HTML form validation to prevent form submission\n * when the value is missing or invalid, or mark the field as required\n * or invalid via ARIA.\n *\n * @default 'native'\n */\n validationBehavior?: 'native' | 'aria';\n}\n\nexport type DOMRenderFunction<E extends keyof React.JSX.IntrinsicElements, T> = (\n props: React.JSX.IntrinsicElements[E],\n renderProps: T\n) => ReactElement;\nexport interface DOMRenderProps<E extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an\n * `<a>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: DOMRenderFunction<E, T>;\n}\n\n// Makes `href` required in AnchorHTMLAttributes\ntype LinkWithRequiredHref = Required<Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>> &\n Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;\n\n// Same as DOMRenderProps but specific for the case where the element could be a 'a' or 'div' element.\nexport interface PossibleLinkDOMRenderProps<Fallback extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Note: You can check if `'href' in props` in order to tell whether to render an `<a>` element.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<a>` is expected, you cannot render a\n * `<button>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: (\n props:\n | DetailedHTMLProps<LinkWithRequiredHref, HTMLAnchorElement>\n | React.JSX.IntrinsicElements[Fallback],\n renderProps: T\n ) => ReactElement;\n}\n\nfunction DOMElement(\n ElementType: string,\n props: DOMRenderProps<any, any> & AllHTMLAttributes<HTMLElement>,\n forwardedRef: ForwardedRef<HTMLElement>\n) {\n let {render, ...otherProps} = props;\n let elementRef = useRef<HTMLElement | null>(null);\n let ref = useMemo(() => mergeRefs(forwardedRef, elementRef), [forwardedRef, elementRef]);\n\n useLayoutEffect(() => {\n if (process.env.NODE_ENV !== 'production' && render) {\n if (!elementRef.current) {\n console.warn(\n 'Ref was not connected to DOM element returned by custom `render` function. Did you forget to pass through or merge the `ref`?'\n );\n } else if (elementRef.current.localName !== ElementType) {\n console.warn(\n `Unexpected DOM element returned by custom \\`render\\` function. Expected <${ElementType}>, got <${elementRef.current.localName}>. This may break the component behavior and accessibility.`\n );\n }\n }\n }, [ElementType, render]);\n\n let domProps: any = {...otherProps, ref};\n if (render) {\n return render(domProps, undefined);\n }\n\n return <ElementType {...domProps} />;\n}\n\ntype DOMComponents = {\n [E in keyof React.JSX.IntrinsicElements]: (\n props: DOMRenderProps<E, any> & React.JSX.IntrinsicElements[E]\n ) => ReactElement;\n};\n\nconst domComponentCache = {};\n\n// Dynamically generates and caches components for each DOM element (e.g. `dom.button`).\nexport const dom = new Proxy(\n {},\n {\n get(target, elementType) {\n if (typeof elementType !== 'string') {\n return undefined;\n }\n\n let res = domComponentCache[elementType];\n if (!res) {\n res = forwardRef(DOMElement.bind(null, elementType));\n domComponentCache[elementType] = res;\n }\n\n return res;\n }\n }\n) as DOMComponents;\n"],"names":[],"version":3,"file":"utils.cjs.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA0BM,MAAM,4CAAe,OAAO;AAkH5B,SAAS,0CAAgD,UAC9D,MAAM,YACN,QAAQ,EAC6C;IACrD,KAAK,IAAI,CAAC,SAAS,MAAM,IAAI,OAC3B,aAAa;IACb,yBAAW,0DAAC,QAAQ,QAAQ;QAAC,OAAO;OAAQ;IAG9C,OAAO;AACT;AA0EO,SAAS,wCACd,KAAmC;IAEnC,IAAI,aACF,SAAS,SACT,KAAK,YACL,QAAQ,oBACR,gBAAgB,mBAChB,eAAe,gBACf,YAAY,UACZ,MAAM,UACN,MAAM,EACP,GAAG;IAEJ,OAAO,CAAA,GAAA,oBAAM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vC,IAAI,QACF,OAAO,OAAO,UAAU;IAG1B,qBAAO,0DAAC,aAAgB;AAC1B;AAQA,MAAM,0CAAoB,CAAC;AAGpB,MAAM,4CAAM,IAAI,MACrB,CAAC,GACD;IACE,KAAI,MAAM,EAAE,WAAW;QACrB,IAAI,OAAO,gBAAgB,UACzB,OAAO;QAGT,IAAI,MAAM,uCAAiB,CAAC,YAAY;QACxC,IAAI,CAAC,KAAK;YACR,oBAAM,CAAA,GAAA,uBAAS,EAAE,iCAAW,IAAI,CAAC,MAAM;YACvC,uCAAiB,CAAC,YAAY,GAAG;QACnC;QAEA,OAAO;IACT;AACF","sources":["packages/react-aria-components/src/utils.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, RefObject, DOMProps as SharedDOMProps} from '@react-types/shared';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport React, {\n AllHTMLAttributes,\n AnchorHTMLAttributes,\n Context,\n CSSProperties,\n DetailedHTMLProps,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactElement,\n ReactNode,\n RefCallback,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useObjectRef} from 'react-aria/useObjectRef';\n\nexport const DEFAULT_SLOT = Symbol('default');\n\ninterface SlottedValue<T> {\n slots?: Record<string | symbol, T>;\n}\n\nexport type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;\nexport type ContextValue<T, E> = SlottedContextValue<WithRef<T, E>>;\n\ntype ProviderValue<T> = [Context<T>, T];\ntype ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L, M> =\n | [ProviderValue<A>]\n | [ProviderValue<A>, ProviderValue<B>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>,\n ProviderValue<L>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>,\n ProviderValue<L>,\n ProviderValue<M>\n ];\n\ninterface ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L, M> {\n values: ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L, M>;\n children: ReactNode;\n}\n\nexport function Provider<A, B, C, D, E, F, G, H, I, J, K, L, M>({\n values,\n children\n}: ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L, M>): JSX.Element {\n for (let [Context, value] of values) {\n // @ts-ignore\n children = <Context.Provider value={value}>{children}</Context.Provider>;\n }\n\n return children as JSX.Element;\n}\n\nexport interface StyleProps {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element.\n */\n className?: string;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element.\n */\n style?: CSSProperties;\n}\n\nexport interface DOMProps extends StyleProps, SharedDOMProps {\n /** The children of the component. */\n children?: ReactNode;\n}\n\nexport type ClassNameOrFunction<T> =\n | string\n | ((values: T & {defaultClassName: string | undefined}) => string);\nexport type StyleOrFunction<T> =\n | CSSProperties\n | ((values: T & {defaultStyle: CSSProperties}) => CSSProperties | undefined);\n\nexport interface StyleRenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends DOMRenderProps<E, T> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n */\n className?: ClassNameOrFunction<T>;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element. A function may be provided to compute the style based on component state.\n */\n style?: StyleOrFunction<T>;\n}\n\nexport type ChildrenOrFunction<T> =\n | ReactNode\n | ((values: T & {defaultChildren: ReactNode | undefined}) => ReactNode);\n\nexport interface RenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends StyleRenderProps<T, E> {\n /**\n * The children of the component. A function may be provided to alter the children based on\n * component state.\n */\n children?: ChildrenOrFunction<T>;\n}\n\ninterface RenderPropsHookOptions<T, E extends keyof React.JSX.IntrinsicElements>\n extends RenderProps<T, E>, SharedDOMProps, AriaLabelingProps {\n values: T;\n defaultChildren?: ReactNode;\n defaultClassName?: string;\n defaultStyle?: CSSProperties;\n}\n\ninterface RenderPropsHookRetVal<T, E extends keyof React.JSX.IntrinsicElements> {\n className?: string;\n style?: CSSProperties;\n children?: ReactNode;\n 'data-rac': string;\n render?: DOMRenderFunction<E, T>;\n}\n\nexport function useRenderProps<T, E extends keyof React.JSX.IntrinsicElements>(\n props: RenderPropsHookOptions<T, E>\n): RenderPropsHookRetVal<T, E> {\n let {\n className,\n style,\n children,\n defaultClassName = undefined,\n defaultChildren = undefined,\n defaultStyle,\n values,\n render\n } = props;\n\n return useMemo(() => {\n let computedClassName: string | undefined;\n let computedStyle: React.CSSProperties | undefined;\n let computedChildren: React.ReactNode | undefined;\n\n if (typeof className === 'function') {\n computedClassName = className({...values, defaultClassName});\n } else {\n computedClassName = className;\n }\n\n if (typeof style === 'function') {\n computedStyle = style({...values, defaultStyle: defaultStyle || {}});\n } else {\n computedStyle = style;\n }\n\n if (typeof children === 'function') {\n computedChildren = children({...values, defaultChildren});\n } else if (children == null) {\n computedChildren = defaultChildren;\n } else {\n computedChildren = children;\n }\n\n return {\n className: computedClassName ?? defaultClassName,\n style: computedStyle || defaultStyle ? {...defaultStyle, ...computedStyle} : undefined,\n children: computedChildren ?? defaultChildren,\n 'data-rac': '',\n render: render ? props => render(props, values) : undefined\n };\n }, [className, style, children, defaultClassName, defaultChildren, defaultStyle, values, render]);\n}\n\n/**\n * A helper function that accepts a user-provided render prop value (either a static value or a\n * function), and combines it with another value to create a final result.\n */\nexport function composeRenderProps<T, U, V extends T>(\n // https://stackoverflow.com/questions/60898079/typescript-type-t-or-function-t-usage\n value: T extends any ? T | ((renderProps: U) => V) : never,\n wrap: (prevValue: T, renderProps: U) => V\n): (renderProps: U) => V {\n return renderProps => wrap(typeof value === 'function' ? value(renderProps) : value, renderProps);\n}\n\nexport type WithRef<T, E> = T & {ref?: ForwardedRef<E>};\nexport interface SlotProps {\n /**\n * A slot name for the component. Slots allow the component to receive props from a parent\n * component. An explicit `null` value indicates that the local props completely override all\n * props received from a parent.\n */\n slot?: string | null;\n}\n\nexport function useSlottedContext<T>(\n context: Context<SlottedContextValue<T>>,\n slot?: string | null\n): T | null | undefined {\n let ctx = useContext(context);\n if (slot === null) {\n // An explicit `null` slot means don't use context.\n return null;\n }\n if (ctx && typeof ctx === 'object' && 'slots' in ctx && ctx.slots) {\n let slotKey = slot || DEFAULT_SLOT;\n if (!ctx.slots[slotKey]) {\n let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map(p => `\"${p}\"`));\n let errorMessage = slot ? `Invalid slot \"${slot}\".` : 'A slot prop is required.';\n\n throw new Error(`${errorMessage} Valid slot names are ${availableSlots}.`);\n }\n return ctx.slots[slotKey];\n }\n // @ts-ignore\n return ctx;\n}\n\nexport function useContextProps<T, U extends SlotProps, E extends Element>(\n props: T & SlotProps,\n ref: ForwardedRef<E> | undefined,\n context: Context<ContextValue<U, E>>\n): [T, RefObject<E | null>] {\n let ctx = useSlottedContext(context, props.slot) || {};\n let {ref: contextRef, ...contextProps} = ctx as any;\n let mergedRef = useObjectRef(useMemo(() => mergeRefs(ref, contextRef), [ref, contextRef]));\n let mergedProps = mergeProps(contextProps, props) as unknown as T;\n\n // mergeProps does not merge `style`. Adding this there might be a breaking change.\n if ('style' in contextProps && contextProps.style && 'style' in props && props.style) {\n if (typeof contextProps.style === 'function' || typeof props.style === 'function') {\n // @ts-ignore\n mergedProps.style = renderProps => {\n let contextStyle =\n typeof contextProps.style === 'function'\n ? contextProps.style(renderProps)\n : contextProps.style;\n let defaultStyle = {...renderProps.defaultStyle, ...contextStyle};\n let style =\n typeof props.style === 'function'\n ? props.style({...renderProps, defaultStyle})\n : props.style;\n return {...defaultStyle, ...style};\n };\n } else {\n // @ts-ignore\n mergedProps.style = {...contextProps.style, ...props.style};\n }\n }\n\n return [mergedProps, mergedRef];\n}\n\nexport function useSlot(\n initialState: boolean | (() => boolean) = true\n): [RefCallback<Element>, boolean] {\n // Initial state is typically based on the parent having an aria-label or aria-labelledby.\n // If it does, this value should be false so that we don't update the state and cause a rerender when we go through the layoutEffect\n let [hasSlot, setHasSlot] = useState(initialState);\n let hasRun = useRef(false);\n\n // A callback ref which will run when the slotted element mounts.\n // This should happen before the useLayoutEffect below.\n let ref = useCallback(el => {\n hasRun.current = true;\n setHasSlot(!!el);\n }, []);\n\n // If the callback hasn't been called, then reset to false.\n useLayoutEffect(() => {\n if (!hasRun.current) {\n setHasSlot(false);\n }\n }, []);\n\n return [ref, hasSlot];\n}\n\n/**\n * Filters out `data-*` attributes to keep them from being passed down and duplicated.\n *\n * @param props\n */\nexport function removeDataAttributes<T>(props: T): T {\n const prefix = /^(data-.*)$/;\n let filteredProps = {} as T;\n\n for (const prop in props) {\n if (!prefix.test(prop)) {\n filteredProps[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n\n// Override base type to change the default.\nexport interface RACValidation {\n /**\n * Whether to use native HTML form validation to prevent form submission\n * when the value is missing or invalid, or mark the field as required\n * or invalid via ARIA.\n *\n * @default 'native'\n */\n validationBehavior?: 'native' | 'aria';\n}\n\nexport type DOMRenderFunction<E extends keyof React.JSX.IntrinsicElements, T> = (\n props: React.JSX.IntrinsicElements[E],\n renderProps: T\n) => ReactElement;\nexport interface DOMRenderProps<E extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an\n * `<a>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: DOMRenderFunction<E, T>;\n}\n\n// Makes `href` required in AnchorHTMLAttributes\ntype LinkWithRequiredHref = Required<Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>> &\n Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;\n\n// Same as DOMRenderProps but specific for the case where the element could be a 'a' or 'div' element.\nexport interface PossibleLinkDOMRenderProps<Fallback extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Note: You can check if `'href' in props` in order to tell whether to render an `<a>` element.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<a>` is expected, you cannot render a\n * `<button>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: (\n props:\n | DetailedHTMLProps<LinkWithRequiredHref, HTMLAnchorElement>\n | React.JSX.IntrinsicElements[Fallback],\n renderProps: T\n ) => ReactElement;\n}\n\nfunction DOMElement(\n ElementType: string,\n props: DOMRenderProps<any, any> & AllHTMLAttributes<HTMLElement>,\n forwardedRef: ForwardedRef<HTMLElement>\n) {\n let {render, ...otherProps} = props;\n let elementRef = useRef<HTMLElement | null>(null);\n let ref = useMemo(() => mergeRefs(forwardedRef, elementRef), [forwardedRef, elementRef]);\n\n useLayoutEffect(() => {\n if (process.env.NODE_ENV !== 'production' && render) {\n if (!elementRef.current) {\n console.warn(\n 'Ref was not connected to DOM element returned by custom `render` function. Did you forget to pass through or merge the `ref`?'\n );\n } else if (elementRef.current.localName !== ElementType) {\n console.warn(\n `Unexpected DOM element returned by custom \\`render\\` function. Expected <${ElementType}>, got <${elementRef.current.localName}>. This may break the component behavior and accessibility.`\n );\n }\n }\n }, [ElementType, render]);\n\n let domProps: any = {...otherProps, ref};\n if (render) {\n return render(domProps, undefined);\n }\n\n return <ElementType {...domProps} />;\n}\n\ntype DOMComponents = {\n [E in keyof React.JSX.IntrinsicElements]: (\n props: DOMRenderProps<E, any> & React.JSX.IntrinsicElements[E]\n ) => ReactElement;\n};\n\nconst domComponentCache = {};\n\n// Dynamically generates and caches components for each DOM element (e.g. `dom.button`).\nexport const dom = new Proxy(\n {},\n {\n get(target, elementType) {\n if (typeof elementType !== 'string') {\n return undefined;\n }\n\n let res = domComponentCache[elementType];\n if (!res) {\n res = forwardRef(DOMElement.bind(null, elementType));\n domComponentCache[elementType] = res;\n }\n\n return res;\n }\n }\n) as DOMComponents;\n"],"names":[],"version":3,"file":"utils.cjs.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA0BM,MAAM,4CAAe,OAAO;AAmG5B,SAAS,0CAA6C,UAC3D,MAAM,YACN,QAAQ,EAC0C;IAClD,KAAK,IAAI,CAAC,SAAS,MAAM,IAAI,OAC3B,aAAa;IACb,yBAAW,gCAAC,QAAQ,QAAQ;QAAC,OAAO;OAAQ;IAG9C,OAAO;AACT;AA0EO,SAAS,wCACd,KAAmC;IAEnC,IAAI,aACF,SAAS,SACT,KAAK,YACL,QAAQ,oBACR,gBAAgB,mBAChB,eAAe,gBACf,YAAY,UACZ,MAAM,UACN,MAAM,EACP,GAAG;IAEJ,OAAO,CAAA,GAAA,cAAM,EAAE;QACb,IAAI;QACJ,IAAI;QACJ,IAAI;QAEJ,IAAI,OAAO,cAAc,YACvB,oBAAoB,UAAU;YAAC,GAAG,MAAM;8BAAE;QAAgB;aAE1D,oBAAoB;QAGtB,IAAI,OAAO,UAAU,YACnB,gBAAgB,MAAM;YAAC,GAAG,MAAM;YAAE,cAAc,gBAAgB,CAAC;QAAC;aAElE,gBAAgB;QAGlB,IAAI,OAAO,aAAa,YACtB,mBAAmB,SAAS;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ACR,oBAAM,CAAA,GAAA,iBAAS,EAAE,iCAAW,IAAI,CAAC,MAAM;YACvC,uCAAiB,CAAC,YAAY,GAAG;QACnC;QAEA,OAAO;IACT;AACF","sources":["packages/react-aria-components/src/utils.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, RefObject, DOMProps as SharedDOMProps} from '@react-types/shared';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport React, {\n AllHTMLAttributes,\n AnchorHTMLAttributes,\n Context,\n CSSProperties,\n DetailedHTMLProps,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactElement,\n ReactNode,\n RefCallback,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useObjectRef} from 'react-aria/useObjectRef';\n\nexport const DEFAULT_SLOT = Symbol('default');\n\ninterface SlottedValue<T> {\n slots?: Record<string | symbol, T>;\n}\n\nexport type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;\nexport type ContextValue<T, E> = SlottedContextValue<WithRef<T, E>>;\n\ntype ProviderValue<T> = [Context<T>, T];\ntype ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L> =\n | [ProviderValue<A>]\n | [ProviderValue<A>, ProviderValue<B>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>,\n ProviderValue<L>\n ];\n\ninterface ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L> {\n values: ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L>;\n children: ReactNode;\n}\n\nexport function Provider<A, B, C, D, E, F, G, H, I, J, K, L>({\n values,\n children\n}: ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L>): JSX.Element {\n for (let [Context, value] of values) {\n // @ts-ignore\n children = <Context.Provider value={value}>{children}</Context.Provider>;\n }\n\n return children as JSX.Element;\n}\n\nexport interface StyleProps {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element.\n */\n className?: string;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element.\n */\n style?: CSSProperties;\n}\n\nexport interface DOMProps extends StyleProps, SharedDOMProps {\n /** The children of the component. */\n children?: ReactNode;\n}\n\nexport type ClassNameOrFunction<T> =\n | string\n | ((values: T & {defaultClassName: string | undefined}) => string);\ntype StyleOrFunction<T> =\n | CSSProperties\n | ((values: T & {defaultStyle: CSSProperties}) => CSSProperties | undefined);\n\nexport interface StyleRenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends DOMRenderProps<E, T> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n */\n className?: ClassNameOrFunction<T>;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element. A function may be provided to compute the style based on component state.\n */\n style?: StyleOrFunction<T>;\n}\n\nexport type ChildrenOrFunction<T> =\n | ReactNode\n | ((values: T & {defaultChildren: ReactNode | undefined}) => ReactNode);\n\nexport interface RenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends StyleRenderProps<T, E> {\n /**\n * The children of the component. A function may be provided to alter the children based on\n * component state.\n */\n children?: ChildrenOrFunction<T>;\n}\n\ninterface RenderPropsHookOptions<T, E extends keyof React.JSX.IntrinsicElements>\n extends RenderProps<T, E>, SharedDOMProps, AriaLabelingProps {\n values: T;\n defaultChildren?: ReactNode;\n defaultClassName?: string;\n defaultStyle?: CSSProperties;\n}\n\ninterface RenderPropsHookRetVal<T, E extends keyof React.JSX.IntrinsicElements> {\n className?: string;\n style?: CSSProperties;\n children?: ReactNode;\n 'data-rac': string;\n render?: DOMRenderFunction<E, T>;\n}\n\nexport function useRenderProps<T, E extends keyof React.JSX.IntrinsicElements>(\n props: RenderPropsHookOptions<T, E>\n): RenderPropsHookRetVal<T, E> {\n let {\n className,\n style,\n children,\n defaultClassName = undefined,\n defaultChildren = undefined,\n defaultStyle,\n values,\n render\n } = props;\n\n return useMemo(() => {\n let computedClassName: string | undefined;\n let computedStyle: React.CSSProperties | undefined;\n let computedChildren: React.ReactNode | undefined;\n\n if (typeof className === 'function') {\n computedClassName = className({...values, defaultClassName});\n } else {\n computedClassName = className;\n }\n\n if (typeof style === 'function') {\n computedStyle = style({...values, defaultStyle: defaultStyle || {}});\n } else {\n computedStyle = style;\n }\n\n if (typeof children === 'function') {\n computedChildren = children({...values, defaultChildren});\n } else if (children == null) {\n computedChildren = defaultChildren;\n } else {\n computedChildren = children;\n }\n\n return {\n className: computedClassName ?? defaultClassName,\n style: computedStyle || defaultStyle ? {...defaultStyle, ...computedStyle} : undefined,\n children: computedChildren ?? defaultChildren,\n 'data-rac': '',\n render: render ? props => render(props, values) : undefined\n };\n }, [className, style, children, defaultClassName, defaultChildren, defaultStyle, values, render]);\n}\n\n/**\n * A helper function that accepts a user-provided render prop value (either a static value or a\n * function), and combines it with another value to create a final result.\n */\nexport function composeRenderProps<T, U, V extends T>(\n // https://stackoverflow.com/questions/60898079/typescript-type-t-or-function-t-usage\n value: T extends any ? T | ((renderProps: U) => V) : never,\n wrap: (prevValue: T, renderProps: U) => V\n): (renderProps: U) => V {\n return renderProps => wrap(typeof value === 'function' ? value(renderProps) : value, renderProps);\n}\n\nexport type WithRef<T, E> = T & {ref?: ForwardedRef<E>};\nexport interface SlotProps {\n /**\n * A slot name for the component. Slots allow the component to receive props from a parent\n * component. An explicit `null` value indicates that the local props completely override all\n * props received from a parent.\n */\n slot?: string | null;\n}\n\nexport function useSlottedContext<T>(\n context: Context<SlottedContextValue<T>>,\n slot?: string | null\n): T | null | undefined {\n let ctx = useContext(context);\n if (slot === null) {\n // An explicit `null` slot means don't use context.\n return null;\n }\n if (ctx && typeof ctx === 'object' && 'slots' in ctx && ctx.slots) {\n let slotKey = slot || DEFAULT_SLOT;\n if (!ctx.slots[slotKey]) {\n let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map(p => `\"${p}\"`));\n let errorMessage = slot ? `Invalid slot \"${slot}\".` : 'A slot prop is required.';\n\n throw new Error(`${errorMessage} Valid slot names are ${availableSlots}.`);\n }\n return ctx.slots[slotKey];\n }\n // @ts-ignore\n return ctx;\n}\n\nexport function useContextProps<T, U extends SlotProps, E extends Element>(\n props: T & SlotProps,\n ref: ForwardedRef<E> | undefined,\n context: Context<ContextValue<U, E>>\n): [T, RefObject<E | null>] {\n let ctx = useSlottedContext(context, props.slot) || {};\n let {ref: contextRef, ...contextProps} = ctx as any;\n let mergedRef = useObjectRef(useMemo(() => mergeRefs(ref, contextRef), [ref, contextRef]));\n let mergedProps = mergeProps(contextProps, props) as unknown as T;\n\n // mergeProps does not merge `style`. Adding this there might be a breaking change.\n if ('style' in contextProps && contextProps.style && 'style' in props && props.style) {\n if (typeof contextProps.style === 'function' || typeof props.style === 'function') {\n // @ts-ignore\n mergedProps.style = renderProps => {\n let contextStyle =\n typeof contextProps.style === 'function'\n ? contextProps.style(renderProps)\n : contextProps.style;\n let defaultStyle = {...renderProps.defaultStyle, ...contextStyle};\n let style =\n typeof props.style === 'function'\n ? props.style({...renderProps, defaultStyle})\n : props.style;\n return {...defaultStyle, ...style};\n };\n } else {\n // @ts-ignore\n mergedProps.style = {...contextProps.style, ...props.style};\n }\n }\n\n return [mergedProps, mergedRef];\n}\n\nexport function useSlot(\n initialState: boolean | (() => boolean) = true\n): [RefCallback<Element>, boolean] {\n // Initial state is typically based on the parent having an aria-label or aria-labelledby.\n // If it does, this value should be false so that we don't update the state and cause a rerender when we go through the layoutEffect\n let [hasSlot, setHasSlot] = useState(initialState);\n let hasRun = useRef(false);\n\n // A callback ref which will run when the slotted element mounts.\n // This should happen before the useLayoutEffect below.\n let ref = useCallback(el => {\n hasRun.current = true;\n setHasSlot(!!el);\n }, []);\n\n // If the callback hasn't been called, then reset to false.\n useLayoutEffect(() => {\n if (!hasRun.current) {\n setHasSlot(false);\n }\n }, []);\n\n return [ref, hasSlot];\n}\n\n/**\n * Filters out `data-*` attributes to keep them from being passed down and duplicated.\n *\n * @param props\n */\nexport function removeDataAttributes<T>(props: T): T {\n const prefix = /^(data-.*)$/;\n let filteredProps = {} as T;\n\n for (const prop in props) {\n if (!prefix.test(prop)) {\n filteredProps[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n\n// Override base type to change the default.\nexport interface RACValidation {\n /**\n * Whether to use native HTML form validation to prevent form submission\n * when the value is missing or invalid, or mark the field as required\n * or invalid via ARIA.\n *\n * @default 'native'\n */\n validationBehavior?: 'native' | 'aria';\n}\n\nexport type DOMRenderFunction<E extends keyof React.JSX.IntrinsicElements, T> = (\n props: React.JSX.IntrinsicElements[E],\n renderProps: T\n) => ReactElement;\nexport interface DOMRenderProps<E extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an\n * `<a>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: DOMRenderFunction<E, T>;\n}\n\n// Makes `href` required in AnchorHTMLAttributes\ntype LinkWithRequiredHref = Required<Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>> &\n Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;\n\n// Same as DOMRenderProps but specific for the case where the element could be a 'a' or 'div' element.\nexport interface PossibleLinkDOMRenderProps<Fallback extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Note: You can check if `'href' in props` in order to tell whether to render an `<a>` element.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<a>` is expected, you cannot render a\n * `<button>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: (\n props:\n | DetailedHTMLProps<LinkWithRequiredHref, HTMLAnchorElement>\n | React.JSX.IntrinsicElements[Fallback],\n renderProps: T\n ) => ReactElement;\n}\n\nfunction DOMElement(\n ElementType: string,\n props: DOMRenderProps<any, any> & AllHTMLAttributes<HTMLElement>,\n forwardedRef: ForwardedRef<HTMLElement>\n) {\n let {render, ...otherProps} = props;\n let elementRef = useRef<HTMLElement | null>(null);\n let ref = useMemo(() => mergeRefs(forwardedRef, elementRef), [forwardedRef, elementRef]);\n\n useLayoutEffect(() => {\n if (process.env.NODE_ENV !== 'production' && render) {\n if (!elementRef.current) {\n console.warn(\n 'Ref was not connected to DOM element returned by custom `render` function. Did you forget to pass through or merge the `ref`?'\n );\n } else if (elementRef.current.localName !== ElementType) {\n console.warn(\n `Unexpected DOM element returned by custom \\`render\\` function. Expected <${ElementType}>, got <${elementRef.current.localName}>. This may break the component behavior and accessibility.`\n );\n }\n }\n }, [ElementType, render]);\n\n let domProps: any = {...otherProps, ref};\n if (render) {\n return render(domProps, undefined);\n }\n\n return <ElementType {...domProps} />;\n}\n\ntype DOMComponents = {\n [E in keyof React.JSX.IntrinsicElements]: (\n props: DOMRenderProps<E, any> & React.JSX.IntrinsicElements[E]\n ) => ReactElement;\n};\n\nconst domComponentCache = {};\n\n// Dynamically generates and caches components for each DOM element (e.g. `dom.button`).\nexport const dom = new Proxy(\n {},\n {\n get(target, elementType) {\n if (typeof elementType !== 'string') {\n return undefined;\n }\n\n let res = domComponentCache[elementType];\n if (!res) {\n res = forwardRef(DOMElement.bind(null, elementType));\n domComponentCache[elementType] = res;\n }\n\n return res;\n }\n }\n) as DOMComponents;\n"],"names":[],"version":3,"file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,GAAA,cAAM,EAAE,IAAM,CAAA,GAAA,gBAAQ,EAAE,cAAc,aAAa;QAAC;QAAc;KAAW;IAEvF,CAAA,GAAA,sBAAc,EAAE;QACd,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,gBAAgB,QAAQ;YACnD,IAAI,CAAC,WAAW,OAAO,EACrB,QAAQ,IAAI,CACV;iBAEG,IAAI,WAAW,OAAO,CAAC,SAAS,KAAK,aAC1C,QAAQ,IAAI,CACV,CAAC,yEAAyE,EAAE,YAAY,QAAQ,EAAE,WAAW,OAAO,CAAC,SAAS,CAAC,2DAA2D,CAAC;QAGjM;IACF,GAAG;QAAC;QAAa;KAAO;IAExB,IAAI,WAAgB;QAAC,GAAG,UAAU;aAAE;IAAG;IACvC,IAAI,QACF,OAAO,OAAO,UAAU;IAG1B,qBAAO,gCAAC,aAAgB;AAC1B;AAQA,MAAM,0CAAoB,CAAC;AAGpB,MAAM,4CAAM,IAAI,MACrB,CAAC,GACD;IACE,KAAI,MAAM,EAAE,WAAW;QACrB,IAAI,OAAO,gBAAgB,UACzB,OAAO;QAGT,IAAI,MAAM,uCAAiB,CAAC,YAAY;QACxC,IAAI,CAAC,KAAK;YACR,oBAAM,CAAA,GAAA,iBAAS,EAAE,iCAAW,IAAI,CAAC,MAAM;YACvC,uCAAiB,CAAC,YAAY,GAAG;QACnC;QAEA,OAAO;IACT;AACF","sources":["packages/react-aria-components/src/utils.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, RefObject, DOMProps as SharedDOMProps} from '@react-types/shared';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport React, {\n AllHTMLAttributes,\n AnchorHTMLAttributes,\n Context,\n CSSProperties,\n DetailedHTMLProps,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactElement,\n ReactNode,\n RefCallback,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useObjectRef} from 'react-aria/useObjectRef';\n\nexport const DEFAULT_SLOT = Symbol('default');\n\ninterface SlottedValue<T> {\n slots?: Record<string | symbol, T>;\n}\n\nexport type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;\nexport type ContextValue<T, E> = SlottedContextValue<WithRef<T, E>>;\n\ntype ProviderValue<T> = [Context<T>, T];\ntype ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L, M> =\n | [ProviderValue<A>]\n | [ProviderValue<A>, ProviderValue<B>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>,\n ProviderValue<L>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>,\n ProviderValue<L>,\n ProviderValue<M>\n ];\n\ninterface ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L, M> {\n values: ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L, M>;\n children: ReactNode;\n}\n\nexport function Provider<A, B, C, D, E, F, G, H, I, J, K, L, M>({\n values,\n children\n}: ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L, M>): JSX.Element {\n for (let [Context, value] of values) {\n // @ts-ignore\n children = <Context.Provider value={value}>{children}</Context.Provider>;\n }\n\n return children as JSX.Element;\n}\n\nexport interface StyleProps {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element.\n */\n className?: string;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element.\n */\n style?: CSSProperties;\n}\n\nexport interface DOMProps extends StyleProps, SharedDOMProps {\n /** The children of the component. */\n children?: ReactNode;\n}\n\nexport type ClassNameOrFunction<T> =\n | string\n | ((values: T & {defaultClassName: string | undefined}) => string);\nexport type StyleOrFunction<T> =\n | CSSProperties\n | ((values: T & {defaultStyle: CSSProperties}) => CSSProperties | undefined);\n\nexport interface StyleRenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends DOMRenderProps<E, T> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n */\n className?: ClassNameOrFunction<T>;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element. A function may be provided to compute the style based on component state.\n */\n style?: StyleOrFunction<T>;\n}\n\nexport type ChildrenOrFunction<T> =\n | ReactNode\n | ((values: T & {defaultChildren: ReactNode | undefined}) => ReactNode);\n\nexport interface RenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends StyleRenderProps<T, E> {\n /**\n * The children of the component. A function may be provided to alter the children based on\n * component state.\n */\n children?: ChildrenOrFunction<T>;\n}\n\ninterface RenderPropsHookOptions<T, E extends keyof React.JSX.IntrinsicElements>\n extends RenderProps<T, E>, SharedDOMProps, AriaLabelingProps {\n values: T;\n defaultChildren?: ReactNode;\n defaultClassName?: string;\n defaultStyle?: CSSProperties;\n}\n\ninterface RenderPropsHookRetVal<T, E extends keyof React.JSX.IntrinsicElements> {\n className?: string;\n style?: CSSProperties;\n children?: ReactNode;\n 'data-rac': string;\n render?: DOMRenderFunction<E, T>;\n}\n\nexport function useRenderProps<T, E extends keyof React.JSX.IntrinsicElements>(\n props: RenderPropsHookOptions<T, E>\n): RenderPropsHookRetVal<T, E> {\n let {\n className,\n style,\n children,\n defaultClassName = undefined,\n defaultChildren = undefined,\n defaultStyle,\n values,\n render\n } = props;\n\n return useMemo(() => {\n let computedClassName: string | undefined;\n let computedStyle: React.CSSProperties | undefined;\n let computedChildren: React.ReactNode | undefined;\n\n if (typeof className === 'function') {\n computedClassName = className({...values, defaultClassName});\n } else {\n computedClassName = className;\n }\n\n if (typeof style === 'function') {\n computedStyle = style({...values, defaultStyle: defaultStyle || {}});\n } else {\n computedStyle = style;\n }\n\n if (typeof children === 'function') {\n computedChildren = children({...values, defaultChildren});\n } else if (children == null) {\n computedChildren = defaultChildren;\n } else {\n computedChildren = children;\n }\n\n return {\n className: computedClassName ?? defaultClassName,\n style: computedStyle || defaultStyle ? {...defaultStyle, ...computedStyle} : undefined,\n children: computedChildren ?? defaultChildren,\n 'data-rac': '',\n render: render ? props => render(props, values) : undefined\n };\n }, [className, style, children, defaultClassName, defaultChildren, defaultStyle, values, render]);\n}\n\n/**\n * A helper function that accepts a user-provided render prop value (either a static value or a\n * function), and combines it with another value to create a final result.\n */\nexport function composeRenderProps<T, U, V extends T>(\n // https://stackoverflow.com/questions/60898079/typescript-type-t-or-function-t-usage\n value: T extends any ? T | ((renderProps: U) => V) : never,\n wrap: (prevValue: T, renderProps: U) => V\n): (renderProps: U) => V {\n return renderProps => wrap(typeof value === 'function' ? value(renderProps) : value, renderProps);\n}\n\nexport type WithRef<T, E> = T & {ref?: ForwardedRef<E>};\nexport interface SlotProps {\n /**\n * A slot name for the component. Slots allow the component to receive props from a parent\n * component. An explicit `null` value indicates that the local props completely override all\n * props received from a parent.\n */\n slot?: string | null;\n}\n\nexport function useSlottedContext<T>(\n context: Context<SlottedContextValue<T>>,\n slot?: string | null\n): T | null | undefined {\n let ctx = useContext(context);\n if (slot === null) {\n // An explicit `null` slot means don't use context.\n return null;\n }\n if (ctx && typeof ctx === 'object' && 'slots' in ctx && ctx.slots) {\n let slotKey = slot || DEFAULT_SLOT;\n if (!ctx.slots[slotKey]) {\n let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map(p => `\"${p}\"`));\n let errorMessage = slot ? `Invalid slot \"${slot}\".` : 'A slot prop is required.';\n\n throw new Error(`${errorMessage} Valid slot names are ${availableSlots}.`);\n }\n return ctx.slots[slotKey];\n }\n // @ts-ignore\n return ctx;\n}\n\nexport function useContextProps<T, U extends SlotProps, E extends Element>(\n props: T & SlotProps,\n ref: ForwardedRef<E> | undefined,\n context: Context<ContextValue<U, E>>\n): [T, RefObject<E | null>] {\n let ctx = useSlottedContext(context, props.slot) || {};\n let {ref: contextRef, ...contextProps} = ctx as any;\n let mergedRef = useObjectRef(useMemo(() => mergeRefs(ref, contextRef), [ref, contextRef]));\n let mergedProps = mergeProps(contextProps, props) as unknown as T;\n\n // mergeProps does not merge `style`. Adding this there might be a breaking change.\n if ('style' in contextProps && contextProps.style && 'style' in props && props.style) {\n if (typeof contextProps.style === 'function' || typeof props.style === 'function') {\n // @ts-ignore\n mergedProps.style = renderProps => {\n let contextStyle =\n typeof contextProps.style === 'function'\n ? contextProps.style(renderProps)\n : contextProps.style;\n let defaultStyle = {...renderProps.defaultStyle, ...contextStyle};\n let style =\n typeof props.style === 'function'\n ? props.style({...renderProps, defaultStyle})\n : props.style;\n return {...defaultStyle, ...style};\n };\n } else {\n // @ts-ignore\n mergedProps.style = {...contextProps.style, ...props.style};\n }\n }\n\n return [mergedProps, mergedRef];\n}\n\nexport function useSlot(\n initialState: boolean | (() => boolean) = true\n): [RefCallback<Element>, boolean] {\n // Initial state is typically based on the parent having an aria-label or aria-labelledby.\n // If it does, this value should be false so that we don't update the state and cause a rerender when we go through the layoutEffect\n let [hasSlot, setHasSlot] = useState(initialState);\n let hasRun = useRef(false);\n\n // A callback ref which will run when the slotted element mounts.\n // This should happen before the useLayoutEffect below.\n let ref = useCallback(el => {\n hasRun.current = true;\n setHasSlot(!!el);\n }, []);\n\n // If the callback hasn't been called, then reset to false.\n useLayoutEffect(() => {\n if (!hasRun.current) {\n setHasSlot(false);\n }\n }, []);\n\n return [ref, hasSlot];\n}\n\n/**\n * Filters out `data-*` attributes to keep them from being passed down and duplicated.\n *\n * @param props\n */\nexport function removeDataAttributes<T>(props: T): T {\n const prefix = /^(data-.*)$/;\n let filteredProps = {} as T;\n\n for (const prop in props) {\n if (!prefix.test(prop)) {\n filteredProps[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n\n// Override base type to change the default.\nexport interface RACValidation {\n /**\n * Whether to use native HTML form validation to prevent form submission\n * when the value is missing or invalid, or mark the field as required\n * or invalid via ARIA.\n *\n * @default 'native'\n */\n validationBehavior?: 'native' | 'aria';\n}\n\nexport type DOMRenderFunction<E extends keyof React.JSX.IntrinsicElements, T> = (\n props: React.JSX.IntrinsicElements[E],\n renderProps: T\n) => ReactElement;\nexport interface DOMRenderProps<E extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an\n * `<a>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: DOMRenderFunction<E, T>;\n}\n\n// Makes `href` required in AnchorHTMLAttributes\ntype LinkWithRequiredHref = Required<Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>> &\n Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;\n\n// Same as DOMRenderProps but specific for the case where the element could be a 'a' or 'div' element.\nexport interface PossibleLinkDOMRenderProps<Fallback extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Note: You can check if `'href' in props` in order to tell whether to render an `<a>` element.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<a>` is expected, you cannot render a\n * `<button>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: (\n props:\n | DetailedHTMLProps<LinkWithRequiredHref, HTMLAnchorElement>\n | React.JSX.IntrinsicElements[Fallback],\n renderProps: T\n ) => ReactElement;\n}\n\nfunction DOMElement(\n ElementType: string,\n props: DOMRenderProps<any, any> & AllHTMLAttributes<HTMLElement>,\n forwardedRef: ForwardedRef<HTMLElement>\n) {\n let {render, ...otherProps} = props;\n let elementRef = useRef<HTMLElement | null>(null);\n let ref = useMemo(() => mergeRefs(forwardedRef, elementRef), [forwardedRef, elementRef]);\n\n useLayoutEffect(() => {\n if (process.env.NODE_ENV !== 'production' && render) {\n if (!elementRef.current) {\n console.warn(\n 'Ref was not connected to DOM element returned by custom `render` function. Did you forget to pass through or merge the `ref`?'\n );\n } else if (elementRef.current.localName !== ElementType) {\n console.warn(\n `Unexpected DOM element returned by custom \\`render\\` function. Expected <${ElementType}>, got <${elementRef.current.localName}>. This may break the component behavior and accessibility.`\n );\n }\n }\n }, [ElementType, render]);\n\n let domProps: any = {...otherProps, ref};\n if (render) {\n return render(domProps, undefined);\n }\n\n return <ElementType {...domProps} />;\n}\n\ntype DOMComponents = {\n [E in keyof React.JSX.IntrinsicElements]: (\n props: DOMRenderProps<E, any> & React.JSX.IntrinsicElements[E]\n ) => ReactElement;\n};\n\nconst domComponentCache = {};\n\n// Dynamically generates and caches components for each DOM element (e.g. `dom.button`).\nexport const dom = new Proxy(\n {},\n {\n get(target, elementType) {\n if (typeof elementType !== 'string') {\n return undefined;\n }\n\n let res = domComponentCache[elementType];\n if (!res) {\n res = forwardRef(DOMElement.bind(null, elementType));\n domComponentCache[elementType] = res;\n }\n\n return res;\n }\n }\n) as DOMComponents;\n"],"names":[],"version":3,"file":"utils.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA0BM,MAAM,4CAAe,OAAO;AAmG5B,SAAS,0CAA6C,UAC3D,MAAM,YACN,QAAQ,EAC0C;IAClD,KAAK,IAAI,CAAC,SAAS,MAAM,IAAI,OAC3B,aAAa;IACb,yBAAW,gCAAC,QAAQ,QAAQ;QAAC,OAAO;OAAQ;IAG9C,OAAO;AACT;AA0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,yEAAyE,EAAE,YAAY,QAAQ,EAAE,WAAW,OAAO,CAAC,SAAS,CAAC,2DAA2D,CAAC;QAGjM;IACF,GAAG;QAAC;QAAa;KAAO;IAExB,IAAI,WAAgB;QAAC,GAAG,UAAU;aAAE;IAAG;IACvC,IAAI,QACF,OAAO,OAAO,UAAU;IAG1B,qBAAO,gCAAC,aAAgB;AAC1B;AAQA,MAAM,0CAAoB,CAAC;AAGpB,MAAM,4CAAM,IAAI,MACrB,CAAC,GACD;IACE,KAAI,MAAM,EAAE,WAAW;QACrB,IAAI,OAAO,gBAAgB,UACzB,OAAO;QAGT,IAAI,MAAM,uCAAiB,CAAC,YAAY;QACxC,IAAI,CAAC,KAAK;YACR,oBAAM,CAAA,GAAA,iBAAS,EAAE,iCAAW,IAAI,CAAC,MAAM;YACvC,uCAAiB,CAAC,YAAY,GAAG;QACnC;QAEA,OAAO;IACT;AACF","sources":["packages/react-aria-components/src/utils.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, RefObject, DOMProps as SharedDOMProps} from '@react-types/shared';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport React, {\n AllHTMLAttributes,\n AnchorHTMLAttributes,\n Context,\n CSSProperties,\n DetailedHTMLProps,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactElement,\n ReactNode,\n RefCallback,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useObjectRef} from 'react-aria/useObjectRef';\n\nexport const DEFAULT_SLOT = Symbol('default');\n\ninterface SlottedValue<T> {\n slots?: Record<string | symbol, T>;\n}\n\nexport type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;\nexport type ContextValue<T, E> = SlottedContextValue<WithRef<T, E>>;\n\ntype ProviderValue<T> = [Context<T>, T];\ntype ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L> =\n | [ProviderValue<A>]\n | [ProviderValue<A>, ProviderValue<B>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>,\n ProviderValue<L>\n ];\n\ninterface ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L> {\n values: ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L>;\n children: ReactNode;\n}\n\nexport function Provider<A, B, C, D, E, F, G, H, I, J, K, L>({\n values,\n children\n}: ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L>): JSX.Element {\n for (let [Context, value] of values) {\n // @ts-ignore\n children = <Context.Provider value={value}>{children}</Context.Provider>;\n }\n\n return children as JSX.Element;\n}\n\nexport interface StyleProps {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element.\n */\n className?: string;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element.\n */\n style?: CSSProperties;\n}\n\nexport interface DOMProps extends StyleProps, SharedDOMProps {\n /** The children of the component. */\n children?: ReactNode;\n}\n\nexport type ClassNameOrFunction<T> =\n | string\n | ((values: T & {defaultClassName: string | undefined}) => string);\ntype StyleOrFunction<T> =\n | CSSProperties\n | ((values: T & {defaultStyle: CSSProperties}) => CSSProperties | undefined);\n\nexport interface StyleRenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends DOMRenderProps<E, T> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n */\n className?: ClassNameOrFunction<T>;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element. A function may be provided to compute the style based on component state.\n */\n style?: StyleOrFunction<T>;\n}\n\nexport type ChildrenOrFunction<T> =\n | ReactNode\n | ((values: T & {defaultChildren: ReactNode | undefined}) => ReactNode);\n\nexport interface RenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends StyleRenderProps<T, E> {\n /**\n * The children of the component. A function may be provided to alter the children based on\n * component state.\n */\n children?: ChildrenOrFunction<T>;\n}\n\ninterface RenderPropsHookOptions<T, E extends keyof React.JSX.IntrinsicElements>\n extends RenderProps<T, E>, SharedDOMProps, AriaLabelingProps {\n values: T;\n defaultChildren?: ReactNode;\n defaultClassName?: string;\n defaultStyle?: CSSProperties;\n}\n\ninterface RenderPropsHookRetVal<T, E extends keyof React.JSX.IntrinsicElements> {\n className?: string;\n style?: CSSProperties;\n children?: ReactNode;\n 'data-rac': string;\n render?: DOMRenderFunction<E, T>;\n}\n\nexport function useRenderProps<T, E extends keyof React.JSX.IntrinsicElements>(\n props: RenderPropsHookOptions<T, E>\n): RenderPropsHookRetVal<T, E> {\n let {\n className,\n style,\n children,\n defaultClassName = undefined,\n defaultChildren = undefined,\n defaultStyle,\n values,\n render\n } = props;\n\n return useMemo(() => {\n let computedClassName: string | undefined;\n let computedStyle: React.CSSProperties | undefined;\n let computedChildren: React.ReactNode | undefined;\n\n if (typeof className === 'function') {\n computedClassName = className({...values, defaultClassName});\n } else {\n computedClassName = className;\n }\n\n if (typeof style === 'function') {\n computedStyle = style({...values, defaultStyle: defaultStyle || {}});\n } else {\n computedStyle = style;\n }\n\n if (typeof children === 'function') {\n computedChildren = children({...values, defaultChildren});\n } else if (children == null) {\n computedChildren = defaultChildren;\n } else {\n computedChildren = children;\n }\n\n return {\n className: computedClassName ?? defaultClassName,\n style: computedStyle || defaultStyle ? {...defaultStyle, ...computedStyle} : undefined,\n children: computedChildren ?? defaultChildren,\n 'data-rac': '',\n render: render ? props => render(props, values) : undefined\n };\n }, [className, style, children, defaultClassName, defaultChildren, defaultStyle, values, render]);\n}\n\n/**\n * A helper function that accepts a user-provided render prop value (either a static value or a\n * function), and combines it with another value to create a final result.\n */\nexport function composeRenderProps<T, U, V extends T>(\n // https://stackoverflow.com/questions/60898079/typescript-type-t-or-function-t-usage\n value: T extends any ? T | ((renderProps: U) => V) : never,\n wrap: (prevValue: T, renderProps: U) => V\n): (renderProps: U) => V {\n return renderProps => wrap(typeof value === 'function' ? value(renderProps) : value, renderProps);\n}\n\nexport type WithRef<T, E> = T & {ref?: ForwardedRef<E>};\nexport interface SlotProps {\n /**\n * A slot name for the component. Slots allow the component to receive props from a parent\n * component. An explicit `null` value indicates that the local props completely override all\n * props received from a parent.\n */\n slot?: string | null;\n}\n\nexport function useSlottedContext<T>(\n context: Context<SlottedContextValue<T>>,\n slot?: string | null\n): T | null | undefined {\n let ctx = useContext(context);\n if (slot === null) {\n // An explicit `null` slot means don't use context.\n return null;\n }\n if (ctx && typeof ctx === 'object' && 'slots' in ctx && ctx.slots) {\n let slotKey = slot || DEFAULT_SLOT;\n if (!ctx.slots[slotKey]) {\n let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map(p => `\"${p}\"`));\n let errorMessage = slot ? `Invalid slot \"${slot}\".` : 'A slot prop is required.';\n\n throw new Error(`${errorMessage} Valid slot names are ${availableSlots}.`);\n }\n return ctx.slots[slotKey];\n }\n // @ts-ignore\n return ctx;\n}\n\nexport function useContextProps<T, U extends SlotProps, E extends Element>(\n props: T & SlotProps,\n ref: ForwardedRef<E> | undefined,\n context: Context<ContextValue<U, E>>\n): [T, RefObject<E | null>] {\n let ctx = useSlottedContext(context, props.slot) || {};\n let {ref: contextRef, ...contextProps} = ctx as any;\n let mergedRef = useObjectRef(useMemo(() => mergeRefs(ref, contextRef), [ref, contextRef]));\n let mergedProps = mergeProps(contextProps, props) as unknown as T;\n\n // mergeProps does not merge `style`. Adding this there might be a breaking change.\n if ('style' in contextProps && contextProps.style && 'style' in props && props.style) {\n if (typeof contextProps.style === 'function' || typeof props.style === 'function') {\n // @ts-ignore\n mergedProps.style = renderProps => {\n let contextStyle =\n typeof contextProps.style === 'function'\n ? contextProps.style(renderProps)\n : contextProps.style;\n let defaultStyle = {...renderProps.defaultStyle, ...contextStyle};\n let style =\n typeof props.style === 'function'\n ? props.style({...renderProps, defaultStyle})\n : props.style;\n return {...defaultStyle, ...style};\n };\n } else {\n // @ts-ignore\n mergedProps.style = {...contextProps.style, ...props.style};\n }\n }\n\n return [mergedProps, mergedRef];\n}\n\nexport function useSlot(\n initialState: boolean | (() => boolean) = true\n): [RefCallback<Element>, boolean] {\n // Initial state is typically based on the parent having an aria-label or aria-labelledby.\n // If it does, this value should be false so that we don't update the state and cause a rerender when we go through the layoutEffect\n let [hasSlot, setHasSlot] = useState(initialState);\n let hasRun = useRef(false);\n\n // A callback ref which will run when the slotted element mounts.\n // This should happen before the useLayoutEffect below.\n let ref = useCallback(el => {\n hasRun.current = true;\n setHasSlot(!!el);\n }, []);\n\n // If the callback hasn't been called, then reset to false.\n useLayoutEffect(() => {\n if (!hasRun.current) {\n setHasSlot(false);\n }\n }, []);\n\n return [ref, hasSlot];\n}\n\n/**\n * Filters out `data-*` attributes to keep them from being passed down and duplicated.\n *\n * @param props\n */\nexport function removeDataAttributes<T>(props: T): T {\n const prefix = /^(data-.*)$/;\n let filteredProps = {} as T;\n\n for (const prop in props) {\n if (!prefix.test(prop)) {\n filteredProps[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n\n// Override base type to change the default.\nexport interface RACValidation {\n /**\n * Whether to use native HTML form validation to prevent form submission\n * when the value is missing or invalid, or mark the field as required\n * or invalid via ARIA.\n *\n * @default 'native'\n */\n validationBehavior?: 'native' | 'aria';\n}\n\nexport type DOMRenderFunction<E extends keyof React.JSX.IntrinsicElements, T> = (\n props: React.JSX.IntrinsicElements[E],\n renderProps: T\n) => ReactElement;\nexport interface DOMRenderProps<E extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an\n * `<a>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: DOMRenderFunction<E, T>;\n}\n\n// Makes `href` required in AnchorHTMLAttributes\ntype LinkWithRequiredHref = Required<Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>> &\n Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;\n\n// Same as DOMRenderProps but specific for the case where the element could be a 'a' or 'div' element.\nexport interface PossibleLinkDOMRenderProps<Fallback extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Note: You can check if `'href' in props` in order to tell whether to render an `<a>` element.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<a>` is expected, you cannot render a\n * `<button>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: (\n props:\n | DetailedHTMLProps<LinkWithRequiredHref, HTMLAnchorElement>\n | React.JSX.IntrinsicElements[Fallback],\n renderProps: T\n ) => ReactElement;\n}\n\nfunction DOMElement(\n ElementType: string,\n props: DOMRenderProps<any, any> & AllHTMLAttributes<HTMLElement>,\n forwardedRef: ForwardedRef<HTMLElement>\n) {\n let {render, ...otherProps} = props;\n let elementRef = useRef<HTMLElement | null>(null);\n let ref = useMemo(() => mergeRefs(forwardedRef, elementRef), [forwardedRef, elementRef]);\n\n useLayoutEffect(() => {\n if (process.env.NODE_ENV !== 'production' && render) {\n if (!elementRef.current) {\n console.warn(\n 'Ref was not connected to DOM element returned by custom `render` function. Did you forget to pass through or merge the `ref`?'\n );\n } else if (elementRef.current.localName !== ElementType) {\n console.warn(\n `Unexpected DOM element returned by custom \\`render\\` function. Expected <${ElementType}>, got <${elementRef.current.localName}>. This may break the component behavior and accessibility.`\n );\n }\n }\n }, [ElementType, render]);\n\n let domProps: any = {...otherProps, ref};\n if (render) {\n return render(domProps, undefined);\n }\n\n return <ElementType {...domProps} />;\n}\n\ntype DOMComponents = {\n [E in keyof React.JSX.IntrinsicElements]: (\n props: DOMRenderProps<E, any> & React.JSX.IntrinsicElements[E]\n ) => ReactElement;\n};\n\nconst domComponentCache = {};\n\n// Dynamically generates and caches components for each DOM element (e.g. `dom.button`).\nexport const dom = new Proxy(\n {},\n {\n get(target, elementType) {\n if (typeof elementType !== 'string') {\n return undefined;\n }\n\n let res = domComponentCache[elementType];\n if (!res) {\n res = forwardRef(DOMElement.bind(null, elementType));\n domComponentCache[elementType] = res;\n }\n\n return res;\n }\n }\n) as DOMComponents;\n"],"names":[],"version":3,"file":"utils.mjs.map"}
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA0BM,MAAM,4CAAe,OAAO;AAkH5B,SAAS,0CAAgD,UAC9D,MAAM,YACN,QAAQ,EAC6C;IACrD,KAAK,IAAI,CAAC,SAAS,MAAM,IAAI,OAC3B,aAAa;IACb,yBAAW,gCAAC,QAAQ,QAAQ;QAAC,OAAO;OAAQ;IAG9C,OAAO;AACT;AA0EO,SAAS,wCACd,KAAmC;IAEnC,IAAI,aACF,SAAS,SACT,KAAK,YACL,QAAQ,oBACR,gBAAgB,mBAChB,eAAe,gBACf,YAAY,UACZ,MAAM,UACN,MAAM,EACP,GAAG;IAEJ,OAAO,CAAA,GAAA,cAAM,EAAE;QACb,IAAI;QACJ,IAAI;QACJ,IAAI;QAEJ,IAAI,OAAO,cAAc,YACvB,oBAAoB,UAAU;YAAC,GAAG,MAAM;8BAAE;QAAgB;aAE1D,oBAAoB;QAGtB,IAAI,OAAO,UAAU,YACnB,gBAAgB,MAAM;YAAC,GAAG,MAAM;YAAE,cAAc,gBAAgB,CAAC;QAAC;aAElE,gBAAgB;QAGlB,IAAI,OAAO,aAAa,YACtB,mBAAmB,SAAS;YAAC,GAAG,MAAM;6BAAE;QAAe;aAClD,IAAI,YAAY,MACrB,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AY,GAAG;QACnC;QAEA,OAAO;IACT;AACF","sources":["packages/react-aria-components/src/utils.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, RefObject, DOMProps as SharedDOMProps} from '@react-types/shared';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport React, {\n AllHTMLAttributes,\n AnchorHTMLAttributes,\n Context,\n CSSProperties,\n DetailedHTMLProps,\n ForwardedRef,\n forwardRef,\n JSX,\n ReactElement,\n ReactNode,\n RefCallback,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useObjectRef} from 'react-aria/useObjectRef';\n\nexport const DEFAULT_SLOT = Symbol('default');\n\ninterface SlottedValue<T> {\n slots?: Record<string | symbol, T>;\n}\n\nexport type SlottedContextValue<T> = SlottedValue<T> | T | null | undefined;\nexport type ContextValue<T, E> = SlottedContextValue<WithRef<T, E>>;\n\ntype ProviderValue<T> = [Context<T>, T];\ntype ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L, M> =\n | [ProviderValue<A>]\n | [ProviderValue<A>, ProviderValue<B>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>]\n | [ProviderValue<A>, ProviderValue<B>, ProviderValue<C>, ProviderValue<D>, ProviderValue<E>]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>,\n ProviderValue<L>\n ]\n | [\n ProviderValue<A>,\n ProviderValue<B>,\n ProviderValue<C>,\n ProviderValue<D>,\n ProviderValue<E>,\n ProviderValue<F>,\n ProviderValue<G>,\n ProviderValue<H>,\n ProviderValue<I>,\n ProviderValue<J>,\n ProviderValue<K>,\n ProviderValue<L>,\n ProviderValue<M>\n ];\n\ninterface ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L, M> {\n values: ProviderValues<A, B, C, D, E, F, G, H, I, J, K, L, M>;\n children: ReactNode;\n}\n\nexport function Provider<A, B, C, D, E, F, G, H, I, J, K, L, M>({\n values,\n children\n}: ProviderProps<A, B, C, D, E, F, G, H, I, J, K, L, M>): JSX.Element {\n for (let [Context, value] of values) {\n // @ts-ignore\n children = <Context.Provider value={value}>{children}</Context.Provider>;\n }\n\n return children as JSX.Element;\n}\n\nexport interface StyleProps {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element.\n */\n className?: string;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element.\n */\n style?: CSSProperties;\n}\n\nexport interface DOMProps extends StyleProps, SharedDOMProps {\n /** The children of the component. */\n children?: ReactNode;\n}\n\nexport type ClassNameOrFunction<T> =\n | string\n | ((values: T & {defaultClassName: string | undefined}) => string);\nexport type StyleOrFunction<T> =\n | CSSProperties\n | ((values: T & {defaultStyle: CSSProperties}) => CSSProperties | undefined);\n\nexport interface StyleRenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends DOMRenderProps<E, T> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n */\n className?: ClassNameOrFunction<T>;\n /**\n * The inline [style](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style) for the\n * element. A function may be provided to compute the style based on component state.\n */\n style?: StyleOrFunction<T>;\n}\n\nexport type ChildrenOrFunction<T> =\n | ReactNode\n | ((values: T & {defaultChildren: ReactNode | undefined}) => ReactNode);\n\nexport interface RenderProps<\n T,\n E extends keyof React.JSX.IntrinsicElements = 'div'\n> extends StyleRenderProps<T, E> {\n /**\n * The children of the component. A function may be provided to alter the children based on\n * component state.\n */\n children?: ChildrenOrFunction<T>;\n}\n\ninterface RenderPropsHookOptions<T, E extends keyof React.JSX.IntrinsicElements>\n extends RenderProps<T, E>, SharedDOMProps, AriaLabelingProps {\n values: T;\n defaultChildren?: ReactNode;\n defaultClassName?: string;\n defaultStyle?: CSSProperties;\n}\n\ninterface RenderPropsHookRetVal<T, E extends keyof React.JSX.IntrinsicElements> {\n className?: string;\n style?: CSSProperties;\n children?: ReactNode;\n 'data-rac': string;\n render?: DOMRenderFunction<E, T>;\n}\n\nexport function useRenderProps<T, E extends keyof React.JSX.IntrinsicElements>(\n props: RenderPropsHookOptions<T, E>\n): RenderPropsHookRetVal<T, E> {\n let {\n className,\n style,\n children,\n defaultClassName = undefined,\n defaultChildren = undefined,\n defaultStyle,\n values,\n render\n } = props;\n\n return useMemo(() => {\n let computedClassName: string | undefined;\n let computedStyle: React.CSSProperties | undefined;\n let computedChildren: React.ReactNode | undefined;\n\n if (typeof className === 'function') {\n computedClassName = className({...values, defaultClassName});\n } else {\n computedClassName = className;\n }\n\n if (typeof style === 'function') {\n computedStyle = style({...values, defaultStyle: defaultStyle || {}});\n } else {\n computedStyle = style;\n }\n\n if (typeof children === 'function') {\n computedChildren = children({...values, defaultChildren});\n } else if (children == null) {\n computedChildren = defaultChildren;\n } else {\n computedChildren = children;\n }\n\n return {\n className: computedClassName ?? defaultClassName,\n style: computedStyle || defaultStyle ? {...defaultStyle, ...computedStyle} : undefined,\n children: computedChildren ?? defaultChildren,\n 'data-rac': '',\n render: render ? props => render(props, values) : undefined\n };\n }, [className, style, children, defaultClassName, defaultChildren, defaultStyle, values, render]);\n}\n\n/**\n * A helper function that accepts a user-provided render prop value (either a static value or a\n * function), and combines it with another value to create a final result.\n */\nexport function composeRenderProps<T, U, V extends T>(\n // https://stackoverflow.com/questions/60898079/typescript-type-t-or-function-t-usage\n value: T extends any ? T | ((renderProps: U) => V) : never,\n wrap: (prevValue: T, renderProps: U) => V\n): (renderProps: U) => V {\n return renderProps => wrap(typeof value === 'function' ? value(renderProps) : value, renderProps);\n}\n\nexport type WithRef<T, E> = T & {ref?: ForwardedRef<E>};\nexport interface SlotProps {\n /**\n * A slot name for the component. Slots allow the component to receive props from a parent\n * component. An explicit `null` value indicates that the local props completely override all\n * props received from a parent.\n */\n slot?: string | null;\n}\n\nexport function useSlottedContext<T>(\n context: Context<SlottedContextValue<T>>,\n slot?: string | null\n): T | null | undefined {\n let ctx = useContext(context);\n if (slot === null) {\n // An explicit `null` slot means don't use context.\n return null;\n }\n if (ctx && typeof ctx === 'object' && 'slots' in ctx && ctx.slots) {\n let slotKey = slot || DEFAULT_SLOT;\n if (!ctx.slots[slotKey]) {\n let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map(p => `\"${p}\"`));\n let errorMessage = slot ? `Invalid slot \"${slot}\".` : 'A slot prop is required.';\n\n throw new Error(`${errorMessage} Valid slot names are ${availableSlots}.`);\n }\n return ctx.slots[slotKey];\n }\n // @ts-ignore\n return ctx;\n}\n\nexport function useContextProps<T, U extends SlotProps, E extends Element>(\n props: T & SlotProps,\n ref: ForwardedRef<E> | undefined,\n context: Context<ContextValue<U, E>>\n): [T, RefObject<E | null>] {\n let ctx = useSlottedContext(context, props.slot) || {};\n let {ref: contextRef, ...contextProps} = ctx as any;\n let mergedRef = useObjectRef(useMemo(() => mergeRefs(ref, contextRef), [ref, contextRef]));\n let mergedProps = mergeProps(contextProps, props) as unknown as T;\n\n // mergeProps does not merge `style`. Adding this there might be a breaking change.\n if ('style' in contextProps && contextProps.style && 'style' in props && props.style) {\n if (typeof contextProps.style === 'function' || typeof props.style === 'function') {\n // @ts-ignore\n mergedProps.style = renderProps => {\n let contextStyle =\n typeof contextProps.style === 'function'\n ? contextProps.style(renderProps)\n : contextProps.style;\n let defaultStyle = {...renderProps.defaultStyle, ...contextStyle};\n let style =\n typeof props.style === 'function'\n ? props.style({...renderProps, defaultStyle})\n : props.style;\n return {...defaultStyle, ...style};\n };\n } else {\n // @ts-ignore\n mergedProps.style = {...contextProps.style, ...props.style};\n }\n }\n\n return [mergedProps, mergedRef];\n}\n\nexport function useSlot(\n initialState: boolean | (() => boolean) = true\n): [RefCallback<Element>, boolean] {\n // Initial state is typically based on the parent having an aria-label or aria-labelledby.\n // If it does, this value should be false so that we don't update the state and cause a rerender when we go through the layoutEffect\n let [hasSlot, setHasSlot] = useState(initialState);\n let hasRun = useRef(false);\n\n // A callback ref which will run when the slotted element mounts.\n // This should happen before the useLayoutEffect below.\n let ref = useCallback(el => {\n hasRun.current = true;\n setHasSlot(!!el);\n }, []);\n\n // If the callback hasn't been called, then reset to false.\n useLayoutEffect(() => {\n if (!hasRun.current) {\n setHasSlot(false);\n }\n }, []);\n\n return [ref, hasSlot];\n}\n\n/**\n * Filters out `data-*` attributes to keep them from being passed down and duplicated.\n *\n * @param props\n */\nexport function removeDataAttributes<T>(props: T): T {\n const prefix = /^(data-.*)$/;\n let filteredProps = {} as T;\n\n for (const prop in props) {\n if (!prefix.test(prop)) {\n filteredProps[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n\n// Override base type to change the default.\nexport interface RACValidation {\n /**\n * Whether to use native HTML form validation to prevent form submission\n * when the value is missing or invalid, or mark the field as required\n * or invalid via ARIA.\n *\n * @default 'native'\n */\n validationBehavior?: 'native' | 'aria';\n}\n\nexport type DOMRenderFunction<E extends keyof React.JSX.IntrinsicElements, T> = (\n props: React.JSX.IntrinsicElements[E],\n renderProps: T\n) => ReactElement;\nexport interface DOMRenderProps<E extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<button>` is expected, you cannot render an\n * `<a>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: DOMRenderFunction<E, T>;\n}\n\n// Makes `href` required in AnchorHTMLAttributes\ntype LinkWithRequiredHref = Required<Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>> &\n Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>;\n\n// Same as DOMRenderProps but specific for the case where the element could be a 'a' or 'div' element.\nexport interface PossibleLinkDOMRenderProps<Fallback extends keyof React.JSX.IntrinsicElements, T> {\n /**\n * Overrides the default DOM element with a custom render function.\n * This allows rendering existing components with built-in styles and behaviors\n * such as router links, animation libraries, and pre-styled components.\n *\n * Note: You can check if `'href' in props` in order to tell whether to render an `<a>` element.\n *\n * Requirements:\n *\n * - You must render the expected element type (e.g. if `<a>` is expected, you cannot render a\n * `<button>`).\n * - Only a single root DOM element can be rendered (no fragments).\n * - You must pass through props and ref to the underlying DOM element, merging with your own prop\n * as appropriate.\n */\n render?: (\n props:\n | DetailedHTMLProps<LinkWithRequiredHref, HTMLAnchorElement>\n | React.JSX.IntrinsicElements[Fallback],\n renderProps: T\n ) => ReactElement;\n}\n\nfunction DOMElement(\n ElementType: string,\n props: DOMRenderProps<any, any> & AllHTMLAttributes<HTMLElement>,\n forwardedRef: ForwardedRef<HTMLElement>\n) {\n let {render, ...otherProps} = props;\n let elementRef = useRef<HTMLElement | null>(null);\n let ref = useMemo(() => mergeRefs(forwardedRef, elementRef), [forwardedRef, elementRef]);\n\n useLayoutEffect(() => {\n if (process.env.NODE_ENV !== 'production' && render) {\n if (!elementRef.current) {\n console.warn(\n 'Ref was not connected to DOM element returned by custom `render` function. Did you forget to pass through or merge the `ref`?'\n );\n } else if (elementRef.current.localName !== ElementType) {\n console.warn(\n `Unexpected DOM element returned by custom \\`render\\` function. Expected <${ElementType}>, got <${elementRef.current.localName}>. This may break the component behavior and accessibility.`\n );\n }\n }\n }, [ElementType, render]);\n\n let domProps: any = {...otherProps, ref};\n if (render) {\n return render(domProps, undefined);\n }\n\n return <ElementType {...domProps} />;\n}\n\ntype DOMComponents = {\n [E in keyof React.JSX.IntrinsicElements]: (\n props: DOMRenderProps<E, any> & React.JSX.IntrinsicElements[E]\n ) => ReactElement;\n};\n\nconst domComponentCache = {};\n\n// Dynamically generates and caches components for each DOM element (e.g. `dom.button`).\nexport const dom = new Proxy(\n {},\n {\n get(target, elementType) {\n if (typeof elementType !== 'string') {\n return undefined;\n }\n\n let res = domComponentCache[elementType];\n if (!res) {\n res = forwardRef(DOMElement.bind(null, elementType));\n domComponentCache[elementType] = res;\n }\n\n return res;\n }\n }\n) as DOMComponents;\n"],"names":[],"version":3,"file":"utils.mjs.map"}
@@ -1,7 +1,7 @@
1
1
  import 'client-only';
2
2
  export { GridListLoadMoreItem, GridList, GridListItem, GridListContext, GridListHeader, GridListHeaderContext, GridListSection } from '../src/GridList';
3
3
  export { Collection, type CollectionProps } from 'react-aria/Collection';
4
- export type { GridListProps, GridListRenderProps, GridListItemProps, GridListItemRenderProps, GridListLoadMoreItemProps, GridListSectionProps } from '../src/GridList';
4
+ export type { GridListHeaderProps, GridListProps, GridListRenderProps, GridListItemProps, GridListItemRenderProps, GridListLoadMoreItemProps, GridListSectionProps } from '../src/GridList';
5
5
  export type { Key, Selection, SelectionMode, DirectoryDropItem, DraggableCollectionEndEvent, DraggableCollectionMoveEvent, DraggableCollectionStartEvent, DragPreviewRenderer, DragTypes, DropItem, DropOperation, DroppableCollectionDropEvent, DroppableCollectionEnterEvent, DroppableCollectionExitEvent, DroppableCollectionInsertDropEvent, DroppableCollectionMoveEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, DroppableCollectionRootDropEvent, DropPosition, DropTarget, FileDropItem, ItemDropTarget, RootDropTarget, TextDropItem } from '@react-types/shared';
6
6
  export type { ListState } from 'react-stately/useListState';
7
7
  export { Button } from '../src/Button';
@@ -1,7 +1,7 @@
1
1
  import 'client-only';
2
- export { Menu, MenuItem, MenuTrigger, MenuSection, MenuContext, MenuStateContext, RootMenuTriggerStateContext, SubmenuTrigger } from '../src/Menu';
2
+ export { Menu, MenuItem, MenuLoadMoreItem, MenuTrigger, MenuSection, MenuContext, MenuStateContext, RootMenuTriggerStateContext, SubmenuTrigger } from '../src/Menu';
3
3
  export { Collection, type CollectionProps } from 'react-aria/Collection';
4
- export type { MenuProps, MenuItemProps, MenuItemRenderProps, MenuTriggerProps, SubmenuTriggerProps, MenuSectionProps } from '../src/Menu';
4
+ export type { MenuProps, MenuItemProps, MenuItemRenderProps, MenuLoadMoreItemProps, MenuTriggerProps, SubmenuTriggerProps, MenuSectionProps } from '../src/Menu';
5
5
  export type { Key, Selection, SelectionMode } from '@react-types/shared';
6
6
  export type { ListState } from 'react-stately/useListState';
7
7
  export type { RootMenuTriggerState } from 'react-stately/useMenuTriggerState';
@@ -0,0 +1,8 @@
1
+ import 'client-only';
2
+ export { NavigationTree, NavigationTreeItem, NavigationTreeItemContent, NavigationTreeSection, NavigationTreeHeader, NavigationTreeContext } from '../src/NavigationTree';
3
+ export type { NavigationTreeProps, NavigationTreeRenderProps, NavigationTreeItemProps, NavigationTreeItemRenderProps, NavigationTreeItemContentProps, NavigationTreeItemContentRenderProps, NavigationTreeSectionProps, NavigationTreeHeaderProps } from '../src/NavigationTree';
4
+ export type { Key } from '@react-types/shared';
5
+ export { Button } from '../src/Button';
6
+ export type { ButtonProps, ButtonRenderProps } from '../src/Button';
7
+ export { Link } from '../src/Link';
8
+ export type { LinkProps, LinkRenderProps } from '../src/Link';
@@ -0,0 +1,3 @@
1
+ import 'client-only';
2
+ export { PreviewTrigger } from '../src/PreviewTrigger';
3
+ export type { PreviewTriggerProps } from '../src/PreviewTrigger';
@@ -0,0 +1,5 @@
1
+ export { TokenField, TokenInput, Token } from '../src/TokenField';
2
+ export type { TokenFieldProps, TokenFieldRenderProps, TokenInputProps, TokenInputRenderProps, TokenProps, TokenRenderProps, TokenFieldContext } from '../src/TokenField';
3
+ export { tokenFieldPositionToDOMRange, setTokenFieldSelection } from 'react-aria/useTokenField';
4
+ export { TokenFieldValue } from 'react-stately/useTokenFieldState';
5
+ export type { TokenFieldSegment, TokenSegment, TextSegment, Position, TokenFieldValueOptions } from 'react-stately/useTokenFieldState';
@@ -1,6 +1,6 @@
1
1
  import 'client-only';
2
2
  export { TreeLoadMoreItem, Tree, TreeItem, TreeContext, TreeItemContent, TreeHeader, TreeSection, TreeStateContext } from '../src/Tree';
3
- export type { TreeProps, TreeRenderProps, TreeEmptyStateRenderProps, TreeItemProps, TreeItemRenderProps, TreeItemContentProps, TreeItemContentRenderProps, TreeLoadMoreItemProps, TreeLoadMoreItemRenderProps } from '../src/Tree';
3
+ export type { TreeSectionProps, TreeHeaderProps, TreeProps, TreeRenderProps, TreeEmptyStateRenderProps, TreeItemProps, TreeItemRenderProps, TreeItemContentProps, TreeItemContentRenderProps, TreeLoadMoreItemProps, TreeLoadMoreItemRenderProps } from '../src/Tree';
4
4
  export type { Key, Selection, SelectionMode, DirectoryDropItem, DraggableCollectionEndEvent, DraggableCollectionMoveEvent, DraggableCollectionStartEvent, DragPreviewRenderer, DragTypes, DropItem, DropOperation, DroppableCollectionDropEvent, DroppableCollectionEnterEvent, DroppableCollectionExitEvent, DroppableCollectionInsertDropEvent, DroppableCollectionMoveEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, DroppableCollectionRootDropEvent, DropPosition, DropTarget, FileDropItem, ItemDropTarget, RootDropTarget, TextDropItem } from '@react-types/shared';
5
5
  export type { TreeState } from 'react-stately/useTreeState';
6
6
  export { Button } from '../src/Button';