@octanejs/aria 0.0.40 → 0.0.42

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 (416) hide show
  1. package/LICENSE-APACHE-2.0 +201 -0
  2. package/README.md +20 -7
  3. package/UPSTREAM.md +108 -0
  4. package/package.json +10 -6
  5. package/src/calendar/useCalendar.tsx +36 -0
  6. package/src/calendar/useCalendarBase.tsx +142 -0
  7. package/src/calendar/useCalendarCell.tsx +416 -0
  8. package/src/calendar/useCalendarGrid.tsx +202 -0
  9. package/src/calendar/useCalendarHeading.tsx +85 -0
  10. package/src/calendar/useCalendarMonthPicker.tsx +92 -0
  11. package/src/calendar/useCalendarYearPicker.tsx +127 -0
  12. package/src/calendar/useRangeCalendar.tsx +121 -0
  13. package/src/calendar/utils.tsx +183 -0
  14. package/src/color/useColorArea.tsx +599 -0
  15. package/src/color/useColorAreaGradient.tsx +157 -0
  16. package/src/color/useColorChannelField.tsx +53 -0
  17. package/src/color/useColorField.tsx +170 -0
  18. package/src/color/useColorSlider.tsx +177 -0
  19. package/src/color/useColorSwatch.tsx +83 -0
  20. package/src/color/useColorWheel.tsx +401 -0
  21. package/src/compat/react.ts +111 -0
  22. package/src/components/Calendar.tsx +842 -0
  23. package/src/components/ColorArea.tsx +120 -0
  24. package/src/components/ColorField.tsx +304 -0
  25. package/src/components/ColorPicker.tsx +86 -0
  26. package/src/components/ColorSlider.tsx +144 -0
  27. package/src/components/ColorSwatch.tsx +72 -0
  28. package/src/components/ColorSwatchPicker.tsx +176 -0
  29. package/src/components/ColorThumb.tsx +140 -0
  30. package/src/components/ColorWheel.tsx +163 -0
  31. package/src/components/DateField.tsx +580 -0
  32. package/src/components/DatePicker.tsx +386 -0
  33. package/src/components/DropZone.tsx +181 -0
  34. package/src/components/FileTrigger.tsx +96 -0
  35. package/src/components/GridLayout.tsx +33 -0
  36. package/src/components/HiddenDateInput.tsx +169 -0
  37. package/src/components/TableLayout.tsx +39 -0
  38. package/src/components/Toast.tsx +336 -0
  39. package/src/components/Virtualizer.tsx +219 -0
  40. package/src/components/index.ts +257 -7
  41. package/src/components/useDragAndDrop.tsx +221 -0
  42. package/src/components/utils.ts +12 -89
  43. package/src/datepicker/useDateField.tsx +272 -0
  44. package/src/datepicker/useDatePicker.tsx +229 -0
  45. package/src/datepicker/useDatePickerGroup.tsx +147 -0
  46. package/src/datepicker/useDateRangePicker.tsx +288 -0
  47. package/src/datepicker/useDateSegment.tsx +439 -0
  48. package/src/datepicker/useDisplayNames.tsx +53 -0
  49. package/src/dnd/DragManager.tsx +718 -0
  50. package/src/dnd/DragPreview.tsx +100 -0
  51. package/src/dnd/DropTargetKeyboardNavigation.tsx +317 -0
  52. package/src/dnd/ListDropTargetDelegate.tsx +215 -0
  53. package/src/dnd/constants.tsx +93 -0
  54. package/src/dnd/useAutoScroll.tsx +116 -0
  55. package/src/dnd/useClipboard.tsx +160 -0
  56. package/src/dnd/useDrag.tsx +437 -0
  57. package/src/dnd/useDraggableCollection.tsx +35 -0
  58. package/src/dnd/useDraggableItem.tsx +168 -0
  59. package/src/dnd/useDrop.tsx +518 -0
  60. package/src/dnd/useDropIndicator.tsx +129 -0
  61. package/src/dnd/useDroppableCollection.tsx +808 -0
  62. package/src/dnd/useDroppableItem.tsx +99 -0
  63. package/src/dnd/useVirtualDrop.tsx +52 -0
  64. package/src/dnd/utils.tsx +430 -0
  65. package/src/intl/calendar/ar-AE.json +14 -0
  66. package/src/intl/calendar/bg-BG.json +14 -0
  67. package/src/intl/calendar/cs-CZ.json +14 -0
  68. package/src/intl/calendar/da-DK.json +14 -0
  69. package/src/intl/calendar/de-DE.json +14 -0
  70. package/src/intl/calendar/el-GR.json +14 -0
  71. package/src/intl/calendar/en-US.json +14 -0
  72. package/src/intl/calendar/es-ES.json +14 -0
  73. package/src/intl/calendar/et-EE.json +14 -0
  74. package/src/intl/calendar/fi-FI.json +14 -0
  75. package/src/intl/calendar/fr-FR.json +14 -0
  76. package/src/intl/calendar/he-IL.json +14 -0
  77. package/src/intl/calendar/hr-HR.json +14 -0
  78. package/src/intl/calendar/hu-HU.json +14 -0
  79. package/src/intl/calendar/index.ts +73 -0
  80. package/src/intl/calendar/it-IT.json +14 -0
  81. package/src/intl/calendar/ja-JP.json +14 -0
  82. package/src/intl/calendar/ko-KR.json +14 -0
  83. package/src/intl/calendar/lt-LT.json +14 -0
  84. package/src/intl/calendar/lv-LV.json +14 -0
  85. package/src/intl/calendar/nb-NO.json +14 -0
  86. package/src/intl/calendar/nl-NL.json +14 -0
  87. package/src/intl/calendar/pl-PL.json +14 -0
  88. package/src/intl/calendar/pt-BR.json +14 -0
  89. package/src/intl/calendar/pt-PT.json +14 -0
  90. package/src/intl/calendar/ro-RO.json +14 -0
  91. package/src/intl/calendar/ru-RU.json +14 -0
  92. package/src/intl/calendar/sk-SK.json +14 -0
  93. package/src/intl/calendar/sl-SI.json +14 -0
  94. package/src/intl/calendar/sr-SP.json +14 -0
  95. package/src/intl/calendar/sv-SE.json +14 -0
  96. package/src/intl/calendar/tr-TR.json +14 -0
  97. package/src/intl/calendar/uk-UA.json +14 -0
  98. package/src/intl/calendar/zh-CN.json +14 -0
  99. package/src/intl/calendar/zh-TW.json +14 -0
  100. package/src/intl/color/ar-AE.json +8 -0
  101. package/src/intl/color/bg-BG.json +8 -0
  102. package/src/intl/color/cs-CZ.json +8 -0
  103. package/src/intl/color/da-DK.json +8 -0
  104. package/src/intl/color/de-DE.json +8 -0
  105. package/src/intl/color/el-GR.json +8 -0
  106. package/src/intl/color/en-US.json +8 -0
  107. package/src/intl/color/es-ES.json +8 -0
  108. package/src/intl/color/et-EE.json +8 -0
  109. package/src/intl/color/fi-FI.json +8 -0
  110. package/src/intl/color/fr-FR.json +8 -0
  111. package/src/intl/color/he-IL.json +8 -0
  112. package/src/intl/color/hr-HR.json +8 -0
  113. package/src/intl/color/hu-HU.json +8 -0
  114. package/src/intl/color/index.ts +73 -0
  115. package/src/intl/color/it-IT.json +8 -0
  116. package/src/intl/color/ja-JP.json +8 -0
  117. package/src/intl/color/ko-KR.json +8 -0
  118. package/src/intl/color/lt-LT.json +8 -0
  119. package/src/intl/color/lv-LV.json +8 -0
  120. package/src/intl/color/nb-NO.json +8 -0
  121. package/src/intl/color/nl-NL.json +8 -0
  122. package/src/intl/color/pl-PL.json +8 -0
  123. package/src/intl/color/pt-BR.json +8 -0
  124. package/src/intl/color/pt-PT.json +8 -0
  125. package/src/intl/color/ro-RO.json +8 -0
  126. package/src/intl/color/ru-RU.json +8 -0
  127. package/src/intl/color/sk-SK.json +8 -0
  128. package/src/intl/color/sl-SI.json +8 -0
  129. package/src/intl/color/sr-SP.json +8 -0
  130. package/src/intl/color/sv-SE.json +8 -0
  131. package/src/intl/color/tr-TR.json +8 -0
  132. package/src/intl/color/uk-UA.json +8 -0
  133. package/src/intl/color/zh-CN.json +8 -0
  134. package/src/intl/color/zh-TW.json +8 -0
  135. package/src/intl/datepicker/ar-AE.json +18 -0
  136. package/src/intl/datepicker/bg-BG.json +18 -0
  137. package/src/intl/datepicker/cs-CZ.json +18 -0
  138. package/src/intl/datepicker/da-DK.json +18 -0
  139. package/src/intl/datepicker/de-DE.json +18 -0
  140. package/src/intl/datepicker/el-GR.json +18 -0
  141. package/src/intl/datepicker/en-US.json +18 -0
  142. package/src/intl/datepicker/es-ES.json +18 -0
  143. package/src/intl/datepicker/et-EE.json +18 -0
  144. package/src/intl/datepicker/fi-FI.json +18 -0
  145. package/src/intl/datepicker/fr-FR.json +18 -0
  146. package/src/intl/datepicker/he-IL.json +18 -0
  147. package/src/intl/datepicker/hr-HR.json +18 -0
  148. package/src/intl/datepicker/hu-HU.json +18 -0
  149. package/src/intl/datepicker/index.ts +73 -0
  150. package/src/intl/datepicker/it-IT.json +18 -0
  151. package/src/intl/datepicker/ja-JP.json +18 -0
  152. package/src/intl/datepicker/ko-KR.json +18 -0
  153. package/src/intl/datepicker/lt-LT.json +18 -0
  154. package/src/intl/datepicker/lv-LV.json +18 -0
  155. package/src/intl/datepicker/nb-NO.json +18 -0
  156. package/src/intl/datepicker/nl-NL.json +18 -0
  157. package/src/intl/datepicker/pl-PL.json +18 -0
  158. package/src/intl/datepicker/pt-BR.json +18 -0
  159. package/src/intl/datepicker/pt-PT.json +18 -0
  160. package/src/intl/datepicker/ro-RO.json +18 -0
  161. package/src/intl/datepicker/ru-RU.json +18 -0
  162. package/src/intl/datepicker/sk-SK.json +18 -0
  163. package/src/intl/datepicker/sl-SI.json +18 -0
  164. package/src/intl/datepicker/sr-SP.json +18 -0
  165. package/src/intl/datepicker/sv-SE.json +18 -0
  166. package/src/intl/datepicker/tr-TR.json +18 -0
  167. package/src/intl/datepicker/uk-UA.json +18 -0
  168. package/src/intl/datepicker/zh-CN.json +18 -0
  169. package/src/intl/datepicker/zh-TW.json +18 -0
  170. package/src/intl/dnd/ar-AE.json +29 -0
  171. package/src/intl/dnd/bg-BG.json +29 -0
  172. package/src/intl/dnd/cs-CZ.json +29 -0
  173. package/src/intl/dnd/da-DK.json +29 -0
  174. package/src/intl/dnd/de-DE.json +29 -0
  175. package/src/intl/dnd/el-GR.json +29 -0
  176. package/src/intl/dnd/en-US.json +29 -0
  177. package/src/intl/dnd/es-ES.json +29 -0
  178. package/src/intl/dnd/et-EE.json +29 -0
  179. package/src/intl/dnd/fi-FI.json +29 -0
  180. package/src/intl/dnd/fr-FR.json +29 -0
  181. package/src/intl/dnd/he-IL.json +29 -0
  182. package/src/intl/dnd/hr-HR.json +29 -0
  183. package/src/intl/dnd/hu-HU.json +29 -0
  184. package/src/intl/dnd/index.ts +73 -0
  185. package/src/intl/dnd/it-IT.json +29 -0
  186. package/src/intl/dnd/ja-JP.json +29 -0
  187. package/src/intl/dnd/ko-KR.json +29 -0
  188. package/src/intl/dnd/lt-LT.json +29 -0
  189. package/src/intl/dnd/lv-LV.json +29 -0
  190. package/src/intl/dnd/nb-NO.json +29 -0
  191. package/src/intl/dnd/nl-NL.json +29 -0
  192. package/src/intl/dnd/pl-PL.json +29 -0
  193. package/src/intl/dnd/pt-BR.json +29 -0
  194. package/src/intl/dnd/pt-PT.json +29 -0
  195. package/src/intl/dnd/ro-RO.json +29 -0
  196. package/src/intl/dnd/ru-RU.json +29 -0
  197. package/src/intl/dnd/sk-SK.json +29 -0
  198. package/src/intl/dnd/sl-SI.json +29 -0
  199. package/src/intl/dnd/sr-SP.json +29 -0
  200. package/src/intl/dnd/sv-SE.json +29 -0
  201. package/src/intl/dnd/tr-TR.json +29 -0
  202. package/src/intl/dnd/uk-UA.json +29 -0
  203. package/src/intl/dnd/zh-CN.json +29 -0
  204. package/src/intl/dnd/zh-TW.json +29 -0
  205. package/src/intl/react-aria-components/ar-AE.json +6 -0
  206. package/src/intl/react-aria-components/bg-BG.json +6 -0
  207. package/src/intl/react-aria-components/cs-CZ.json +6 -0
  208. package/src/intl/react-aria-components/da-DK.json +6 -0
  209. package/src/intl/react-aria-components/de-DE.json +6 -0
  210. package/src/intl/react-aria-components/el-GR.json +6 -0
  211. package/src/intl/react-aria-components/en-US.json +6 -0
  212. package/src/intl/react-aria-components/es-ES.json +6 -0
  213. package/src/intl/react-aria-components/et-EE.json +6 -0
  214. package/src/intl/react-aria-components/fi-FI.json +6 -0
  215. package/src/intl/react-aria-components/fr-FR.json +6 -0
  216. package/src/intl/react-aria-components/he-IL.json +6 -0
  217. package/src/intl/react-aria-components/hr-HR.json +6 -0
  218. package/src/intl/react-aria-components/hu-HU.json +6 -0
  219. package/src/intl/react-aria-components/index.ts +73 -0
  220. package/src/intl/react-aria-components/it-IT.json +6 -0
  221. package/src/intl/react-aria-components/ja-JP.json +6 -0
  222. package/src/intl/react-aria-components/ko-KR.json +6 -0
  223. package/src/intl/react-aria-components/lt-LT.json +6 -0
  224. package/src/intl/react-aria-components/lv-LV.json +6 -0
  225. package/src/intl/react-aria-components/nb-NO.json +6 -0
  226. package/src/intl/react-aria-components/nl-NL.json +6 -0
  227. package/src/intl/react-aria-components/pl-PL.json +6 -0
  228. package/src/intl/react-aria-components/pt-BR.json +6 -0
  229. package/src/intl/react-aria-components/pt-PT.json +6 -0
  230. package/src/intl/react-aria-components/ro-RO.json +6 -0
  231. package/src/intl/react-aria-components/ru-RU.json +6 -0
  232. package/src/intl/react-aria-components/sk-SK.json +6 -0
  233. package/src/intl/react-aria-components/sl-SI.json +6 -0
  234. package/src/intl/react-aria-components/sr-SP.json +6 -0
  235. package/src/intl/react-aria-components/sv-SE.json +6 -0
  236. package/src/intl/react-aria-components/tr-TR.json +6 -0
  237. package/src/intl/react-aria-components/uk-UA.json +6 -0
  238. package/src/intl/react-aria-components/zh-CN.json +6 -0
  239. package/src/intl/react-aria-components/zh-TW.json +6 -0
  240. package/src/intl/stately-color/ar-AE.json +39 -0
  241. package/src/intl/stately-color/bg-BG.json +39 -0
  242. package/src/intl/stately-color/cs-CZ.json +39 -0
  243. package/src/intl/stately-color/da-DK.json +39 -0
  244. package/src/intl/stately-color/de-DE.json +39 -0
  245. package/src/intl/stately-color/el-GR.json +39 -0
  246. package/src/intl/stately-color/en-US.json +39 -0
  247. package/src/intl/stately-color/es-ES.json +39 -0
  248. package/src/intl/stately-color/et-EE.json +39 -0
  249. package/src/intl/stately-color/fi-FI.json +39 -0
  250. package/src/intl/stately-color/fr-FR.json +39 -0
  251. package/src/intl/stately-color/he-IL.json +39 -0
  252. package/src/intl/stately-color/hr-HR.json +39 -0
  253. package/src/intl/stately-color/hu-HU.json +39 -0
  254. package/src/intl/stately-color/index.ts +73 -0
  255. package/src/intl/stately-color/it-IT.json +39 -0
  256. package/src/intl/stately-color/ja-JP.json +39 -0
  257. package/src/intl/stately-color/ko-KR.json +39 -0
  258. package/src/intl/stately-color/lt-LT.json +39 -0
  259. package/src/intl/stately-color/lv-LV.json +39 -0
  260. package/src/intl/stately-color/nb-NO.json +39 -0
  261. package/src/intl/stately-color/nl-NL.json +39 -0
  262. package/src/intl/stately-color/pl-PL.json +39 -0
  263. package/src/intl/stately-color/pt-BR.json +39 -0
  264. package/src/intl/stately-color/pt-PT.json +39 -0
  265. package/src/intl/stately-color/ro-RO.json +39 -0
  266. package/src/intl/stately-color/ru-RU.json +39 -0
  267. package/src/intl/stately-color/sk-SK.json +39 -0
  268. package/src/intl/stately-color/sl-SI.json +39 -0
  269. package/src/intl/stately-color/sr-SP.json +39 -0
  270. package/src/intl/stately-color/sv-SE.json +39 -0
  271. package/src/intl/stately-color/tr-TR.json +39 -0
  272. package/src/intl/stately-color/uk-UA.json +39 -0
  273. package/src/intl/stately-color/zh-CN.json +39 -0
  274. package/src/intl/stately-color/zh-TW.json +39 -0
  275. package/src/intl/toast/ar-AE.json +4 -0
  276. package/src/intl/toast/bg-BG.json +4 -0
  277. package/src/intl/toast/cs-CZ.json +4 -0
  278. package/src/intl/toast/da-DK.json +4 -0
  279. package/src/intl/toast/de-DE.json +4 -0
  280. package/src/intl/toast/el-GR.json +4 -0
  281. package/src/intl/toast/en-US.json +4 -0
  282. package/src/intl/toast/es-ES.json +4 -0
  283. package/src/intl/toast/et-EE.json +4 -0
  284. package/src/intl/toast/fi-FI.json +4 -0
  285. package/src/intl/toast/fr-FR.json +4 -0
  286. package/src/intl/toast/he-IL.json +4 -0
  287. package/src/intl/toast/hr-HR.json +4 -0
  288. package/src/intl/toast/hu-HU.json +4 -0
  289. package/src/intl/toast/index.ts +73 -0
  290. package/src/intl/toast/it-IT.json +4 -0
  291. package/src/intl/toast/ja-JP.json +4 -0
  292. package/src/intl/toast/ko-KR.json +4 -0
  293. package/src/intl/toast/lt-LT.json +4 -0
  294. package/src/intl/toast/lv-LV.json +4 -0
  295. package/src/intl/toast/nb-NO.json +4 -0
  296. package/src/intl/toast/nl-NL.json +4 -0
  297. package/src/intl/toast/pl-PL.json +4 -0
  298. package/src/intl/toast/pt-BR.json +4 -0
  299. package/src/intl/toast/pt-PT.json +4 -0
  300. package/src/intl/toast/ro-RO.json +4 -0
  301. package/src/intl/toast/ru-RU.json +4 -0
  302. package/src/intl/toast/sk-SK.json +4 -0
  303. package/src/intl/toast/sl-SI.json +4 -0
  304. package/src/intl/toast/sr-SP.json +4 -0
  305. package/src/intl/toast/sv-SE.json +4 -0
  306. package/src/intl/toast/tr-TR.json +4 -0
  307. package/src/intl/toast/uk-UA.json +4 -0
  308. package/src/intl/toast/zh-CN.json +4 -0
  309. package/src/intl/toast/zh-TW.json +4 -0
  310. package/src/landmark/useLandmark.tsx +569 -0
  311. package/src/stately/calendar/types.tsx +239 -0
  312. package/src/stately/calendar/useCalendarState.tsx +527 -0
  313. package/src/stately/calendar/useRangeCalendarState.tsx +323 -0
  314. package/src/stately/calendar/utils.tsx +175 -0
  315. package/src/stately/color/Color.tsx +889 -0
  316. package/src/stately/color/types.tsx +82 -0
  317. package/src/stately/color/useColor.tsx +30 -0
  318. package/src/stately/color/useColorAreaState.tsx +255 -0
  319. package/src/stately/color/useColorChannelFieldState.tsx +86 -0
  320. package/src/stately/color/useColorFieldState.tsx +220 -0
  321. package/src/stately/color/useColorPickerState.tsx +31 -0
  322. package/src/stately/color/useColorSliderState.tsx +143 -0
  323. package/src/stately/color/useColorWheelState.tsx +225 -0
  324. package/src/stately/data/useAsyncList.tsx +382 -0
  325. package/src/stately/data/useListData.tsx +447 -0
  326. package/src/stately/data/useTreeData.tsx +603 -0
  327. package/src/stately/datepicker/IncompleteDate.tsx +427 -0
  328. package/src/stately/datepicker/placeholders.tsx +116 -0
  329. package/src/stately/datepicker/types.tsx +169 -0
  330. package/src/stately/datepicker/useDateFieldState.tsx +564 -0
  331. package/src/stately/datepicker/useDatePickerState.tsx +244 -0
  332. package/src/stately/datepicker/useDateRangePickerState.tsx +397 -0
  333. package/src/stately/datepicker/useTimeFieldState.tsx +123 -0
  334. package/src/stately/datepicker/utils.tsx +316 -0
  335. package/src/stately/dnd/useDraggableCollectionState.tsx +191 -0
  336. package/src/stately/dnd/useDroppableCollectionState.tsx +288 -0
  337. package/src/stately/layout/GridLayout.tsx +449 -0
  338. package/src/stately/layout/ListLayout.tsx +872 -0
  339. package/src/stately/layout/TableLayout.tsx +793 -0
  340. package/src/stately/layout/WaterfallLayout.tsx +399 -0
  341. package/src/stately/toast/useToastState.tsx +219 -0
  342. package/src/stately/virtualizer/Layout.tsx +105 -0
  343. package/src/stately/virtualizer/LayoutInfo.tsx +127 -0
  344. package/src/stately/virtualizer/OverscanManager.tsx +56 -0
  345. package/src/stately/virtualizer/Point.tsx +47 -0
  346. package/src/stately/virtualizer/Rect.tsx +194 -0
  347. package/src/stately/virtualizer/ReusableView.tsx +101 -0
  348. package/src/stately/virtualizer/Size.tsx +48 -0
  349. package/src/stately/virtualizer/Virtualizer.tsx +408 -0
  350. package/src/stately/virtualizer/types.tsx +48 -0
  351. package/src/stately/virtualizer/useVirtualizerState.tsx +138 -0
  352. package/src/stately/virtualizer/utils.tsx +32 -0
  353. package/src/textfield/useTextField.ts +3 -0
  354. package/src/toast/useToast.tsx +105 -0
  355. package/src/toast/useToastRegion.tsx +223 -0
  356. package/src/upstream-exports/react-aria/I18nProvider.tsx +17 -0
  357. package/src/upstream-exports/react-aria/ListDropTargetDelegate.tsx +15 -0
  358. package/src/upstream-exports/react-aria/PortalProvider.tsx +19 -0
  359. package/src/upstream-exports/react-aria/SSRProvider.tsx +15 -0
  360. package/src/upstream-exports/react-aria/VisuallyHidden.tsx +15 -0
  361. package/src/upstream-exports/react-aria/filterDOMProps.tsx +3 -0
  362. package/src/upstream-exports/react-aria/mergeProps.tsx +14 -0
  363. package/src/upstream-exports/react-aria/private/dnd/DragManager.tsx +3 -0
  364. package/src/upstream-exports/react-aria/private/interactions/PressResponder.tsx +3 -0
  365. package/src/upstream-exports/react-aria/private/utils/isFocusable.tsx +3 -0
  366. package/src/upstream-exports/react-aria/private/utils/shadowdom/DOMFunctions.tsx +8 -0
  367. package/src/upstream-exports/react-aria/private/utils/useId.tsx +3 -0
  368. package/src/upstream-exports/react-aria/private/utils/useLabels.tsx +3 -0
  369. package/src/upstream-exports/react-aria/private/virtualizer/ScrollView.tsx +3 -0
  370. package/src/upstream-exports/react-aria/private/virtualizer/VirtualizerItem.tsx +3 -0
  371. package/src/upstream-exports/react-aria/useButton.tsx +22 -0
  372. package/src/upstream-exports/react-aria/useCalendar.tsx +37 -0
  373. package/src/upstream-exports/react-aria/useClipboard.tsx +23 -0
  374. package/src/upstream-exports/react-aria/useColorArea.tsx +19 -0
  375. package/src/upstream-exports/react-aria/useColorField.tsx +20 -0
  376. package/src/upstream-exports/react-aria/useColorSlider.tsx +19 -0
  377. package/src/upstream-exports/react-aria/useColorSwatch.tsx +15 -0
  378. package/src/upstream-exports/react-aria/useColorWheel.tsx +19 -0
  379. package/src/upstream-exports/react-aria/useDateField.tsx +23 -0
  380. package/src/upstream-exports/react-aria/useDatePicker.tsx +17 -0
  381. package/src/upstream-exports/react-aria/useDateRangePicker.tsx +24 -0
  382. package/src/upstream-exports/react-aria/useDraggableCollection.tsx +31 -0
  383. package/src/upstream-exports/react-aria/useDrop.tsx +33 -0
  384. package/src/upstream-exports/react-aria/useDroppableCollection.tsx +47 -0
  385. package/src/upstream-exports/react-aria/useFocusRing.tsx +16 -0
  386. package/src/upstream-exports/react-aria/useHover.tsx +17 -0
  387. package/src/upstream-exports/react-aria/useLocalizedStringFormatter.tsx +19 -0
  388. package/src/upstream-exports/react-aria/useObjectRef.tsx +14 -0
  389. package/src/upstream-exports/react-aria/useRangeCalendar.tsx +38 -0
  390. package/src/upstream-exports/react-aria/useTimeField.tsx +23 -0
  391. package/src/upstream-exports/react-aria/useToast.tsx +18 -0
  392. package/src/upstream-exports/react-stately/Color.tsx +23 -0
  393. package/src/upstream-exports/react-stately/private/form/useFormValidationState.tsx +11 -0
  394. package/src/upstream-exports/react-stately/useCalendarState.tsx +24 -0
  395. package/src/upstream-exports/react-stately/useColorAreaState.tsx +24 -0
  396. package/src/upstream-exports/react-stately/useColorFieldState.tsx +22 -0
  397. package/src/upstream-exports/react-stately/useColorPickerState.tsx +25 -0
  398. package/src/upstream-exports/react-stately/useColorSliderState.tsx +25 -0
  399. package/src/upstream-exports/react-stately/useColorWheelState.tsx +24 -0
  400. package/src/upstream-exports/react-stately/useDateFieldState.tsx +29 -0
  401. package/src/upstream-exports/react-stately/useDatePickerState.tsx +25 -0
  402. package/src/upstream-exports/react-stately/useDateRangePickerState.tsx +26 -0
  403. package/src/upstream-exports/react-stately/useDraggableCollectionState.tsx +19 -0
  404. package/src/upstream-exports/react-stately/useDroppableCollectionState.tsx +19 -0
  405. package/src/upstream-exports/react-stately/useRangeCalendarState.tsx +27 -0
  406. package/src/upstream-exports/react-stately/useTimeFieldState.tsx +26 -0
  407. package/src/upstream-exports/react-stately/useToastState.tsx +21 -0
  408. package/src/upstream-exports/react-stately/useVirtualizerState.tsx +22 -0
  409. package/src/utils/useLoadMore.tsx +89 -0
  410. package/src/virtualizer/ScrollView.tsx +401 -0
  411. package/src/virtualizer/Virtualizer.tsx +147 -0
  412. package/src/virtualizer/VirtualizerItem.tsx +108 -0
  413. package/src/virtualizer/useVirtualizerItem.tsx +57 -0
  414. package/src/virtualizer/utils.tsx +105 -0
  415. package/LICENSE +0 -21
  416. package/src/components/useDragAndDrop.ts +0 -164
@@ -0,0 +1,147 @@
1
+ /** @jsxImportSource octane */
2
+ // Ported from adobe/react-spectrum@1c84a49a1faf50b571c84e00bcf9c60b22ddd03e (packages/react-aria/src/virtualizer/Virtualizer.tsx).
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
15
+ import { Collection, Key, RefObject } from '@react-types/shared';
16
+ import {
17
+ Layout,
18
+ Rect,
19
+ ReusableView,
20
+ useVirtualizerState,
21
+ } from '../upstream-exports/react-stately/useVirtualizerState';
22
+ import { mergeProps } from '../utils/mergeProps';
23
+ import React, {
24
+ ForwardedRef,
25
+ HTMLAttributes,
26
+ ReactElement,
27
+ ReactNode,
28
+ useCallback,
29
+ } from '../compat/react';
30
+ import { ScrollView } from './ScrollView';
31
+ import { useLoadMore } from '../utils/useLoadMore';
32
+ import { useObjectRef } from '../utils/useObjectRef';
33
+ import { VirtualizerItem } from './VirtualizerItem';
34
+
35
+ type RenderWrapper<T extends object, V> = (
36
+ parent: ReusableView<T, V> | null,
37
+ reusableView: ReusableView<T, V>,
38
+ children: ReusableView<T, V>[],
39
+ renderChildren: (views: ReusableView<T, V>[]) => ReactElement[],
40
+ ) => ReactElement | null;
41
+
42
+ interface VirtualizerProps<T extends object, V, O> extends Omit<
43
+ HTMLAttributes<HTMLElement>,
44
+ 'children' | 'onScroll'
45
+ > {
46
+ children: (type: string, content: T) => V;
47
+ renderWrapper?: RenderWrapper<T, V>;
48
+ layout: Layout<T, O>;
49
+ collection: Collection<T>;
50
+ persistedKeys?: Set<Key> | null;
51
+ scrollDirection?: 'horizontal' | 'vertical' | 'both';
52
+ isLoading?: boolean;
53
+ onLoadMore?: () => void;
54
+ layoutOptions?: O;
55
+ onScroll?: (e: Event) => void;
56
+ }
57
+
58
+ // forwardRef doesn't support generic parameters, so cast the result to the correct type
59
+ // https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
60
+ export const Virtualizer = React.forwardRef(function Virtualizer<
61
+ T extends object,
62
+ V extends ReactNode,
63
+ O,
64
+ >(props: VirtualizerProps<T, V, O>, forwardedRef: ForwardedRef<HTMLDivElement | null>) {
65
+ let {
66
+ children: renderView,
67
+ renderWrapper,
68
+ layout,
69
+ collection,
70
+ scrollDirection,
71
+ isLoading,
72
+ onLoadMore,
73
+ persistedKeys,
74
+ layoutOptions,
75
+ ...otherProps
76
+ } = props;
77
+
78
+ let ref = useObjectRef(forwardedRef);
79
+
80
+ let state = useVirtualizerState({
81
+ layout,
82
+ collection,
83
+ renderView,
84
+ onVisibleRectChange(rect) {
85
+ if (ref.current) {
86
+ ref.current.scrollLeft = rect.x;
87
+ ref.current.scrollTop = rect.y;
88
+ }
89
+ },
90
+ persistedKeys,
91
+ layoutOptions,
92
+ });
93
+
94
+ useLoadMore({ isLoading, onLoadMore, scrollOffset: 1 }, ref);
95
+ let onVisibleRectChange = useCallback(
96
+ (rect: Rect) => {
97
+ state.setVisibleRect(rect);
98
+ },
99
+ [state],
100
+ );
101
+
102
+ return (
103
+ <ScrollView
104
+ {...mergeProps(otherProps, { onVisibleRectChange })}
105
+ ref={ref}
106
+ contentSize={state.contentSize}
107
+ onScrollStart={state.startScrolling}
108
+ onScrollEnd={state.endScrolling}
109
+ scrollDirection={scrollDirection}
110
+ >
111
+ {renderChildren(null, state.visibleViews, renderWrapper || defaultRenderWrapper)}
112
+ </ScrollView>
113
+ );
114
+ }) as <T extends object, V, O>(
115
+ props: VirtualizerProps<T, V, O> & { ref?: RefObject<HTMLDivElement | null> },
116
+ ) => ReactElement;
117
+
118
+ function renderChildren<T extends object, V>(
119
+ parent: ReusableView<T, V> | null,
120
+ views: ReusableView<T, V>[],
121
+ renderWrapper: RenderWrapper<T, V>,
122
+ ): ReactElement[] {
123
+ return views.map((view) => {
124
+ return renderWrapper(
125
+ parent,
126
+ view,
127
+ view.children ? Array.from(view.children) : [],
128
+ (childViews: ReusableView<T, V>[]) => renderChildren(view, childViews, renderWrapper),
129
+ );
130
+ });
131
+ }
132
+
133
+ function defaultRenderWrapper<T extends object, V extends ReactNode>(
134
+ parent: ReusableView<T, V> | null,
135
+ reusableView: ReusableView<T, V>,
136
+ ): ReactElement {
137
+ return (
138
+ <VirtualizerItem
139
+ key={reusableView.key}
140
+ layoutInfo={reusableView.layoutInfo!}
141
+ virtualizer={reusableView.virtualizer}
142
+ parent={parent?.layoutInfo}
143
+ >
144
+ {reusableView.rendered}
145
+ </VirtualizerItem>
146
+ );
147
+ }
@@ -0,0 +1,108 @@
1
+ /** @jsxImportSource octane */
2
+ // Ported from adobe/react-spectrum@1c84a49a1faf50b571c84e00bcf9c60b22ddd03e (packages/react-aria/src/virtualizer/VirtualizerItem.tsx).
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
15
+ import { Direction } from '@react-types/shared';
16
+ import { LayoutInfo } from '../upstream-exports/react-stately/useVirtualizerState';
17
+ import React, { CSSProperties, JSX, ReactNode, useRef } from '../compat/react';
18
+ import { useLocale } from '../i18n/I18nProvider';
19
+ import { useVirtualizerItem, VirtualizerItemOptions } from './useVirtualizerItem';
20
+
21
+ interface VirtualizerItemProps extends Omit<VirtualizerItemOptions, 'ref'> {
22
+ layoutInfo: LayoutInfo;
23
+ parent?: LayoutInfo | null;
24
+ style?: CSSProperties;
25
+ className?: string;
26
+ children: ReactNode;
27
+ }
28
+
29
+ export function VirtualizerItem(props: VirtualizerItemProps): JSX.Element {
30
+ let { style, className, layoutInfo, virtualizer, parent, children } = props;
31
+ let { direction } = useLocale();
32
+ let ref = useRef<HTMLDivElement | null>(null);
33
+ useVirtualizerItem({
34
+ layoutInfo,
35
+ virtualizer,
36
+ ref,
37
+ });
38
+
39
+ return (
40
+ <div
41
+ role="presentation"
42
+ ref={ref}
43
+ className={className}
44
+ style={{ ...layoutInfoToStyle(layoutInfo, direction, parent), ...style }}
45
+ >
46
+ {children}
47
+ </div>
48
+ );
49
+ }
50
+
51
+ let cache = new WeakMap();
52
+ export function layoutInfoToStyle(
53
+ layoutInfo: LayoutInfo,
54
+ dir: Direction,
55
+ parent?: LayoutInfo | null,
56
+ ): CSSProperties {
57
+ let xProperty = dir === 'rtl' ? 'right' : 'left';
58
+ let cached = cache.get(layoutInfo);
59
+ if (cached && cached[xProperty] != null) {
60
+ if (!parent) {
61
+ return cached;
62
+ }
63
+
64
+ // Invalidate if the parent position changed.
65
+ let top = layoutInfo.rect.y - parent.rect.y;
66
+ let x = layoutInfo.rect.x - parent.rect.x;
67
+ if (cached.top === top && cached[xProperty] === x) {
68
+ return cached;
69
+ }
70
+ }
71
+
72
+ let rectStyles: Record<string, number | undefined> = {
73
+ // TODO: For layoutInfos that are sticky that have parents with overflow visible, their "top" will be relative to the to the nearest scrolling container
74
+ // which WON'T be the parent since the parent has overflow visible. This means we shouldn't offset the height by the parent's position
75
+ // Not 100% about this change here since it is quite ambigious what the scrolling container maybe and how its top is positioned with respect to the
76
+ // calculated layoutInfo.y here
77
+ top:
78
+ layoutInfo.rect.y -
79
+ (parent && !(parent.allowOverflow && layoutInfo.isSticky) ? parent.rect.y : 0),
80
+ [xProperty]:
81
+ layoutInfo.rect.x -
82
+ (parent && !(parent.allowOverflow && layoutInfo.isSticky) ? parent.rect.x : 0),
83
+ width: layoutInfo.rect.width,
84
+ height: layoutInfo.rect.height,
85
+ };
86
+
87
+ // Get rid of any non finite values since they aren't valid css values
88
+ Object.entries(rectStyles).forEach(([key, value]) => {
89
+ if (!Number.isFinite(value)) {
90
+ rectStyles[key] = undefined;
91
+ }
92
+ });
93
+
94
+ let style: CSSProperties = {
95
+ position: layoutInfo.isSticky ? 'sticky' : 'absolute',
96
+ // Sticky elements are positioned in normal document flow. Display inline-block so that they don't push other sticky columns onto the following rows.
97
+ display: layoutInfo.isSticky ? 'inline-block' : undefined,
98
+ overflow: layoutInfo.allowOverflow ? 'visible' : 'hidden',
99
+ opacity: layoutInfo.opacity,
100
+ zIndex: layoutInfo.zIndex,
101
+ transform: layoutInfo.transform ?? undefined,
102
+ contain: 'size layout style',
103
+ ...rectStyles,
104
+ };
105
+
106
+ cache.set(layoutInfo, style);
107
+ return style;
108
+ }
@@ -0,0 +1,57 @@
1
+ /** @jsxImportSource octane */
2
+ // Ported from adobe/react-spectrum@1c84a49a1faf50b571c84e00bcf9c60b22ddd03e (packages/react-aria/src/virtualizer/useVirtualizerItem.ts).
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
15
+ import { Key, RefObject } from '@react-types/shared';
16
+ import { LayoutInfo, Size } from '../upstream-exports/react-stately/useVirtualizerState';
17
+ import { useCallback } from '../compat/react';
18
+ import { useLayoutEffect } from '../utils/useLayoutEffect';
19
+
20
+ interface IVirtualizer {
21
+ updateItemSize(key: Key, size: Size): void;
22
+ }
23
+
24
+ export interface VirtualizerItemOptions {
25
+ layoutInfo: LayoutInfo | null;
26
+ virtualizer: IVirtualizer;
27
+ ref: RefObject<HTMLElement | null>;
28
+ }
29
+
30
+ export function useVirtualizerItem(options: VirtualizerItemOptions): { updateSize: () => void } {
31
+ let { layoutInfo, virtualizer, ref } = options;
32
+ let key = layoutInfo?.key;
33
+
34
+ let updateSize = useCallback(() => {
35
+ if (key != null && ref.current) {
36
+ let size = getSize(ref.current);
37
+ virtualizer.updateItemSize(key, size);
38
+ }
39
+ }, [virtualizer, key, ref]);
40
+
41
+ useLayoutEffect(() => {
42
+ if (layoutInfo?.estimatedSize) {
43
+ updateSize();
44
+ }
45
+ });
46
+
47
+ return { updateSize };
48
+ }
49
+
50
+ function getSize(node: HTMLElement): Size {
51
+ // Reset height before measuring so we get the intrinsic size
52
+ let height = node.style.height;
53
+ node.style.height = '';
54
+ let size = new Size(node.scrollWidth, node.scrollHeight);
55
+ node.style.height = height;
56
+ return size;
57
+ }
@@ -0,0 +1,105 @@
1
+ /** @jsxImportSource octane */
2
+ // Ported from adobe/react-spectrum@1c84a49a1faf50b571c84e00bcf9c60b22ddd03e (packages/react-aria/src/virtualizer/utils.ts).
3
+ /*
4
+ * Copyright 2020 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+
15
+ import { Direction } from '@react-types/shared';
16
+
17
+ export type RTLOffsetType = 'negative' | 'positive-descending' | 'positive-ascending';
18
+
19
+ let cachedRTLResult: RTLOffsetType | null = null;
20
+
21
+ // Original licensing for the following methods can be found in the
22
+ // NOTICE file in the root directory of this source tree.
23
+ // See https://github.com/bvaughn/react-window/blob/master/src/createGridComponent.js
24
+
25
+ // According to the spec, scrollLeft should be negative for RTL aligned elements.
26
+ // Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).
27
+ // Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.
28
+ // The safest way to check this is to intentionally set a negative offset,
29
+ // and then verify that the subsequent "scroll" event matches the negative offset.
30
+ // If it does not match, then we can assume a non-standard RTL scroll implementation.
31
+ export function getRTLOffsetType(recalculate: boolean = false): RTLOffsetType {
32
+ if (cachedRTLResult === null || recalculate) {
33
+ const outerDiv = document.createElement('div');
34
+ const outerStyle = outerDiv.style;
35
+ outerStyle.width = '50px';
36
+ outerStyle.height = '50px';
37
+ outerStyle.overflow = 'scroll';
38
+ outerStyle.direction = 'rtl';
39
+
40
+ const innerDiv = document.createElement('div');
41
+ const innerStyle = innerDiv.style;
42
+ innerStyle.width = '100px';
43
+ innerStyle.height = '100px';
44
+
45
+ outerDiv.appendChild(innerDiv);
46
+
47
+ document.body.appendChild(outerDiv);
48
+
49
+ if (outerDiv.scrollLeft > 0) {
50
+ cachedRTLResult = 'positive-descending';
51
+ } else {
52
+ outerDiv.scrollLeft = 1;
53
+ if (outerDiv.scrollLeft === 0) {
54
+ cachedRTLResult = 'negative';
55
+ } else {
56
+ cachedRTLResult = 'positive-ascending';
57
+ }
58
+ }
59
+
60
+ document.body.removeChild(outerDiv);
61
+
62
+ return cachedRTLResult;
63
+ }
64
+
65
+ return cachedRTLResult;
66
+ }
67
+
68
+ export function getScrollLeft(node: Element, direction: Direction): number {
69
+ let { scrollLeft } = node;
70
+
71
+ // scrollLeft in rtl locales differs across browsers, so normalize.
72
+ // See comment by getRTLOffsetType below for details.
73
+ if (direction === 'rtl') {
74
+ let { scrollWidth, clientWidth } = node;
75
+ switch (getRTLOffsetType()) {
76
+ case 'negative':
77
+ scrollLeft = -scrollLeft;
78
+ break;
79
+ case 'positive-descending':
80
+ scrollLeft = scrollWidth - clientWidth - scrollLeft;
81
+ break;
82
+ }
83
+ }
84
+
85
+ return scrollLeft;
86
+ }
87
+
88
+ export function setScrollLeft(node: Element, direction: Direction, scrollLeft: number): void {
89
+ if (direction === 'rtl') {
90
+ switch (getRTLOffsetType()) {
91
+ case 'negative':
92
+ scrollLeft = -scrollLeft;
93
+ break;
94
+ case 'positive-ascending':
95
+ break;
96
+ default: {
97
+ const { clientWidth, scrollWidth } = node;
98
+ scrollLeft = scrollWidth - clientWidth - scrollLeft;
99
+ break;
100
+ }
101
+ }
102
+ }
103
+
104
+ node.scrollLeft = scrollLeft;
105
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Dominic Gannaway
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,164 +0,0 @@
1
- // Ported from react-aria-components (source: .react-spectrum/packages/react-aria-components/src/useDragAndDrop.tsx).
2
- // PHASE-7: the react-aria drag-and-drop ENGINE (useDraggableCollection(State),
3
- // useDroppableCollection(State), useDropIndicator, DragManager, ListDropTargetDelegate)
4
- // is NOT ported yet. This module ships the `DragAndDropHooks` / `DragAndDropOptions`
5
- // TYPE surface so collection components can accept a `dragAndDropHooks` prop (their dnd
6
- // branches stay inert until a consumer can construct hooks), with every engine-referencing
7
- // member typed via local structural aliases below. The `useDragAndDrop()` function itself
8
- // is a THROWING STUB (the remix-router framework-stub precedent): importing is safe;
9
- // CALLING throws with a pointer to the phase plan instead of failing somewhere deep inside.
10
- // octane adaptations: `.tsx` → `.ts`; `JSX.Element` → a structural `any` alias.
11
- import type {
12
- DragItem,
13
- DraggableCollectionProps,
14
- DropTarget,
15
- DropTargetDelegate,
16
- DroppableCollectionProps,
17
- Key,
18
- RefObject,
19
- } from '@react-types/shared';
20
-
21
- export { DropIndicator, DropIndicatorContext, DragAndDropContext } from './DragAndDrop';
22
- export type { DropIndicatorProps, DropIndicatorRenderProps } from './DragAndDrop';
23
-
24
- // octane adaptation: structural alias for React's JSX.Element.
25
- type JSXElement = any;
26
-
27
- // ── PHASE-7 structural aliases ──────────────────────────────────────────────
28
- // Stand-ins for the unported react-aria/react-stately dnd engine types. They keep
29
- // `DragAndDropHooks` importable as a TYPE without pulling any engine code; Phase 7
30
- // replaces them with the real ported definitions.
31
- /** PHASE-7: react-stately/useDraggableCollectionState's DraggableCollectionState (engine unported). */
32
- export type DraggableCollectionState = any;
33
- /** PHASE-7: react-stately/useDraggableCollectionState's DraggableCollectionStateOptions (engine unported). */
34
- export type DraggableCollectionStateOptions = any;
35
- /** PHASE-7: react-aria/useDraggableCollection's DraggableCollectionOptions (engine unported). */
36
- export type DraggableCollectionOptions = any;
37
- /** PHASE-7: react-aria/useDraggableCollection's DraggableItemProps (engine unported). */
38
- export type DraggableItemProps = any;
39
- /** PHASE-7: react-aria/useDraggableCollection's DraggableItemResult (engine unported). */
40
- export type DraggableItemResult = any;
41
- /** PHASE-7: react-aria/useDraggableCollection's DragPreview component type (engine unported). */
42
- export type DragPreview = any;
43
- /** PHASE-7: react-stately/useDroppableCollectionState's DroppableCollectionState (engine unported). */
44
- export type DroppableCollectionState = any;
45
- /** PHASE-7: react-stately/useDroppableCollectionState's DroppableCollectionStateOptions (engine unported). */
46
- export type DroppableCollectionStateOptions = any;
47
- /** PHASE-7: react-aria/useDroppableCollection's DroppableCollectionOptions (engine unported). */
48
- export type DroppableCollectionOptions = any;
49
- /** PHASE-7: react-aria/useDroppableCollection's DroppableCollectionResult (engine unported). */
50
- export type DroppableCollectionResult = any;
51
- /** PHASE-7: react-aria/useDroppableCollection's DroppableItemOptions (engine unported). */
52
- export type DroppableItemOptions = any;
53
- /** PHASE-7: react-aria/useDroppableCollection's DroppableItemResult (engine unported). */
54
- export type DroppableItemResult = any;
55
- /** PHASE-7: react-aria/useDropIndicator's DropIndicatorProps (engine unported; `target` is real). */
56
- export interface AriaDropIndicatorProps {
57
- /** The drop target that the drop indicator represents. */
58
- target: DropTarget;
59
- /** PHASE-7: the activate-button ref (engine unported). */
60
- activateButtonRef?: RefObject<any>;
61
- }
62
- /** PHASE-7: react-aria/useDropIndicator's DropIndicatorAria (engine unported). */
63
- export type DropIndicatorAria = any;
64
- /** PHASE-7: react-aria/ListDropTargetDelegate's class type (engine unported). */
65
- export type ListDropTargetDelegate = any;
66
-
67
- interface DraggableCollectionStateOpts<T = object> extends Omit<
68
- DraggableCollectionStateOptions,
69
- 'getItems'
70
- > {}
71
-
72
- interface DragHooks<T = object> {
73
- useDraggableCollectionState?: (
74
- props: DraggableCollectionStateOpts<T>,
75
- ) => DraggableCollectionState;
76
- useDraggableCollection?: (
77
- props: DraggableCollectionOptions,
78
- state: DraggableCollectionState,
79
- ref: RefObject<HTMLElement | null>,
80
- ) => void;
81
- useDraggableItem?: (
82
- props: DraggableItemProps,
83
- state: DraggableCollectionState,
84
- ) => DraggableItemResult;
85
- DragPreview?: DragPreview;
86
- renderDragPreview?: (
87
- items: DragItem[],
88
- ) => JSXElement | { element: JSXElement; x: number; y: number };
89
- isVirtualDragging?: () => boolean;
90
- }
91
-
92
- interface DropHooks {
93
- useDroppableCollectionState?: (
94
- props: DroppableCollectionStateOptions,
95
- ) => DroppableCollectionState;
96
- useDroppableCollection?: (
97
- props: DroppableCollectionOptions,
98
- state: DroppableCollectionState,
99
- ref: RefObject<HTMLElement | null>,
100
- ) => DroppableCollectionResult;
101
- useDroppableItem?: (
102
- options: DroppableItemOptions,
103
- state: DroppableCollectionState,
104
- ref: RefObject<HTMLElement | null>,
105
- ) => DroppableItemResult;
106
- useDropIndicator?: (
107
- props: AriaDropIndicatorProps,
108
- state: DroppableCollectionState,
109
- ref: RefObject<HTMLElement | null>,
110
- ) => DropIndicatorAria;
111
- renderDropIndicator?: (target: DropTarget) => JSXElement;
112
- dropTargetDelegate?: DropTargetDelegate;
113
- ListDropTargetDelegate: ListDropTargetDelegate;
114
- }
115
-
116
- export type DragAndDropHooks<T = object> = DragHooks<T> & DropHooks;
117
-
118
- export interface DragAndDrop<T = object> {
119
- /** Drag and drop hooks for the collection element. */
120
- dragAndDropHooks: DragAndDropHooks<T>;
121
- }
122
-
123
- export interface DragAndDropOptions<T = object>
124
- extends Omit<DraggableCollectionProps, 'preview' | 'getItems'>, DroppableCollectionProps {
125
- /**
126
- * A function that returns the items being dragged. If not specified, we assume that the
127
- * collection is not draggable.
128
- *
129
- * @default () => []
130
- */
131
- getItems?: (keys: Set<Key>, items: T[]) => DragItem[];
132
- /**
133
- * A function that renders a drag preview, which is shown under the user's cursor while dragging.
134
- * By default, a copy of the dragged element is rendered.
135
- */
136
- renderDragPreview?: (
137
- items: DragItem[],
138
- ) => JSXElement | { element: JSXElement; x: number; y: number };
139
- /**
140
- * A function that renders a drop indicator element between two items in a collection.
141
- * This should render a `<DropIndicator>` element. If this function is not provided, a
142
- * default DropIndicator is provided.
143
- */
144
- renderDropIndicator?: (target: DropTarget) => JSXElement;
145
- /**
146
- * A custom delegate object that provides drop targets for pointer coordinates within the
147
- * collection.
148
- */
149
- dropTargetDelegate?: DropTargetDelegate;
150
- /** Whether the drag and drop events should be disabled. */
151
- isDisabled?: boolean;
152
- }
153
-
154
- /**
155
- * Provides the hooks required to enable drag and drop behavior for a drag and drop compatible
156
- * collection component.
157
- *
158
- * PHASE-7: throwing stub — the dnd engine is not ported yet.
159
- */
160
- export function useDragAndDrop<T = object>(options: DragAndDropOptions<T>): DragAndDrop<T> {
161
- throw new Error(
162
- '@octanejs/aria: useDragAndDrop is not ported yet (drag and drop arrives in a later phase)',
163
- );
164
- }