@proyecto-viviana/solidaria-components 0.5.0 → 0.7.0-rc.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 (561) hide show
  1. package/LICENSE-APACHE-2.0 +201 -0
  2. package/NOTICE +91 -0
  3. package/README.md +4 -7
  4. package/dist/ActionBar.d.ts +2 -10
  5. package/dist/ActionBar.d.ts.map +1 -1
  6. package/dist/ActionBar.js +95 -59
  7. package/dist/ActionBar.js.map +1 -1
  8. package/dist/ActionBar.jsx +42 -15
  9. package/dist/ActionBar.jsx.map +1 -1
  10. package/dist/ActionGroup.d.ts +1 -12
  11. package/dist/ActionGroup.d.ts.map +1 -1
  12. package/dist/ActionGroup.js +66 -44
  13. package/dist/ActionGroup.js.map +1 -1
  14. package/dist/ActionGroup.jsx +25 -10
  15. package/dist/ActionGroup.jsx.map +1 -1
  16. package/dist/Alert.d.ts +4 -1
  17. package/dist/Alert.d.ts.map +1 -1
  18. package/dist/Alert.js +25 -17
  19. package/dist/Alert.js.map +1 -1
  20. package/dist/Alert.jsx +9 -5
  21. package/dist/Alert.jsx.map +1 -1
  22. package/dist/Autocomplete.d.ts +2 -9
  23. package/dist/Autocomplete.d.ts.map +1 -1
  24. package/dist/Autocomplete.js +18 -5
  25. package/dist/Autocomplete.js.map +1 -1
  26. package/dist/Autocomplete.jsx +20 -7
  27. package/dist/Autocomplete.jsx.map +1 -1
  28. package/dist/Breadcrumbs.d.ts +2 -7
  29. package/dist/Breadcrumbs.d.ts.map +1 -1
  30. package/dist/Breadcrumbs.js +71 -51
  31. package/dist/Breadcrumbs.js.map +1 -1
  32. package/dist/Breadcrumbs.jsx +25 -12
  33. package/dist/Breadcrumbs.jsx.map +1 -1
  34. package/dist/Button.d.ts +1 -7
  35. package/dist/Button.d.ts.map +1 -1
  36. package/dist/Button.js +125 -72
  37. package/dist/Button.js.map +1 -1
  38. package/dist/Button.jsx +105 -43
  39. package/dist/Button.jsx.map +1 -1
  40. package/dist/Calendar.d.ts +1 -7
  41. package/dist/Calendar.d.ts.map +1 -1
  42. package/dist/Calendar.js +297 -221
  43. package/dist/Calendar.js.map +1 -1
  44. package/dist/Calendar.jsx +52 -32
  45. package/dist/Calendar.jsx.map +1 -1
  46. package/dist/CalendarPicker.d.ts +1 -10
  47. package/dist/CalendarPicker.d.ts.map +1 -1
  48. package/dist/CalendarPicker.js +12 -0
  49. package/dist/CalendarPicker.js.map +1 -1
  50. package/dist/CalendarPicker.jsx +12 -0
  51. package/dist/CalendarPicker.jsx.map +1 -1
  52. package/dist/Checkbox.d.ts +2 -7
  53. package/dist/Checkbox.d.ts.map +1 -1
  54. package/dist/Checkbox.js +332 -270
  55. package/dist/Checkbox.js.map +1 -1
  56. package/dist/Checkbox.jsx +70 -77
  57. package/dist/Checkbox.jsx.map +1 -1
  58. package/dist/Collection.d.ts +33 -7
  59. package/dist/Collection.d.ts.map +1 -1
  60. package/dist/Collection.js +128 -74
  61. package/dist/Collection.js.map +1 -1
  62. package/dist/Collection.jsx +46 -7
  63. package/dist/Collection.jsx.map +1 -1
  64. package/dist/Color.d.ts +15 -20
  65. package/dist/Color.d.ts.map +1 -1
  66. package/dist/Color.js +572 -334
  67. package/dist/Color.js.map +1 -1
  68. package/dist/Color.jsx +205 -85
  69. package/dist/Color.jsx.map +1 -1
  70. package/dist/ColorEditor.d.ts +3 -1
  71. package/dist/ColorEditor.d.ts.map +1 -1
  72. package/dist/ColorEditor.js +147 -124
  73. package/dist/ColorEditor.js.map +1 -1
  74. package/dist/ColorEditor.jsx +4 -1
  75. package/dist/ColorEditor.jsx.map +1 -1
  76. package/dist/ComboBox.d.ts +31 -10
  77. package/dist/ComboBox.d.ts.map +1 -1
  78. package/dist/ComboBox.js +539 -274
  79. package/dist/ComboBox.js.map +1 -1
  80. package/dist/ComboBox.jsx +213 -70
  81. package/dist/ComboBox.jsx.map +1 -1
  82. package/dist/ContextualHelpTrigger.d.ts +1 -7
  83. package/dist/ContextualHelpTrigger.d.ts.map +1 -1
  84. package/dist/ContextualHelpTrigger.js +102 -72
  85. package/dist/ContextualHelpTrigger.js.map +1 -1
  86. package/dist/ContextualHelpTrigger.jsx +36 -16
  87. package/dist/ContextualHelpTrigger.jsx.map +1 -1
  88. package/dist/DateField.d.ts +2 -7
  89. package/dist/DateField.d.ts.map +1 -1
  90. package/dist/DateField.js +0 -2
  91. package/dist/DateField.jsx +0 -2
  92. package/dist/DateField2.js +194 -179
  93. package/dist/DateField2.js.map +1 -1
  94. package/dist/DateField2.jsx +58 -55
  95. package/dist/DateField2.jsx.map +1 -1
  96. package/dist/DatePicker.d.ts +7 -7
  97. package/dist/DatePicker.d.ts.map +1 -1
  98. package/dist/DatePicker.js +2 -2
  99. package/dist/DatePicker.jsx +2 -2
  100. package/dist/DatePicker2.js +357 -435
  101. package/dist/DatePicker2.js.map +1 -1
  102. package/dist/DatePicker2.jsx +109 -178
  103. package/dist/DatePicker2.jsx.map +1 -1
  104. package/dist/DateRangePickerContext.d.ts +7 -0
  105. package/dist/DateRangePickerContext.d.ts.map +1 -1
  106. package/dist/Dialog.d.ts +4 -9
  107. package/dist/Dialog.d.ts.map +1 -1
  108. package/dist/Dialog.js +168 -101
  109. package/dist/Dialog.js.map +1 -1
  110. package/dist/Dialog.jsx +75 -27
  111. package/dist/Dialog.jsx.map +1 -1
  112. package/dist/Disclosure.d.ts +1 -9
  113. package/dist/Disclosure.d.ts.map +1 -1
  114. package/dist/Disclosure.js +121 -79
  115. package/dist/Disclosure.js.map +1 -1
  116. package/dist/Disclosure.jsx +32 -19
  117. package/dist/Disclosure.jsx.map +1 -1
  118. package/dist/DragAndDrop.d.ts +9 -6
  119. package/dist/DragAndDrop.d.ts.map +1 -1
  120. package/dist/DragAndDrop.js +37 -22
  121. package/dist/DragAndDrop.js.map +1 -1
  122. package/dist/DragAndDrop.jsx +20 -4
  123. package/dist/DragAndDrop.jsx.map +1 -1
  124. package/dist/DragPreview.d.ts +1 -1
  125. package/dist/DragPreview.d.ts.map +1 -1
  126. package/dist/DropZone.d.ts +1 -7
  127. package/dist/DropZone.d.ts.map +1 -1
  128. package/dist/DropZone.js +74 -40
  129. package/dist/DropZone.js.map +1 -1
  130. package/dist/DropZone.jsx +24 -8
  131. package/dist/DropZone.jsx.map +1 -1
  132. package/dist/ElementTag.d.ts +9 -20
  133. package/dist/ElementTag.d.ts.map +1 -1
  134. package/dist/ElementTag.js +8 -210
  135. package/dist/ElementTag.js.map +1 -1
  136. package/dist/ElementTag.jsx +8 -57
  137. package/dist/ElementTag.jsx.map +1 -1
  138. package/dist/FieldError.d.ts +8 -7
  139. package/dist/FieldError.d.ts.map +1 -1
  140. package/dist/FieldError.js +33 -13
  141. package/dist/FieldError.js.map +1 -1
  142. package/dist/FieldError.jsx +20 -5
  143. package/dist/FieldError.jsx.map +1 -1
  144. package/dist/FileTrigger.d.ts +1 -7
  145. package/dist/FileTrigger.d.ts.map +1 -1
  146. package/dist/FileTrigger.js +30 -12
  147. package/dist/FileTrigger.js.map +1 -1
  148. package/dist/FileTrigger.jsx +15 -2
  149. package/dist/FileTrigger.jsx.map +1 -1
  150. package/dist/Focusable.d.ts +2 -8
  151. package/dist/Focusable.d.ts.map +1 -1
  152. package/dist/Focusable.js +23 -6
  153. package/dist/Focusable.js.map +1 -1
  154. package/dist/Focusable.jsx +22 -5
  155. package/dist/Focusable.jsx.map +1 -1
  156. package/dist/Form.d.ts +9 -8
  157. package/dist/Form.d.ts.map +1 -1
  158. package/dist/Form.js +66 -43
  159. package/dist/Form.js.map +1 -1
  160. package/dist/Form.jsx +36 -16
  161. package/dist/Form.jsx.map +1 -1
  162. package/dist/GridList.d.ts +5 -10
  163. package/dist/GridList.d.ts.map +1 -1
  164. package/dist/GridList.js +372 -243
  165. package/dist/GridList.js.map +1 -1
  166. package/dist/GridList.jsx +177 -99
  167. package/dist/GridList.jsx.map +1 -1
  168. package/dist/HiddenDateInput.d.ts +1 -7
  169. package/dist/HiddenDateInput.d.ts.map +1 -1
  170. package/dist/Icon.d.ts +4 -1
  171. package/dist/Icon.d.ts.map +1 -1
  172. package/dist/Icon.js +41 -37
  173. package/dist/Icon.js.map +1 -1
  174. package/dist/Icon.jsx +7 -3
  175. package/dist/Icon.jsx.map +1 -1
  176. package/dist/Keyboard.d.ts +1 -7
  177. package/dist/Keyboard.d.ts.map +1 -1
  178. package/dist/Keyboard.js +24 -11
  179. package/dist/Keyboard.js.map +1 -1
  180. package/dist/Keyboard.jsx +15 -2
  181. package/dist/Keyboard.jsx.map +1 -1
  182. package/dist/Label.d.ts +20 -0
  183. package/dist/Label.d.ts.map +1 -0
  184. package/dist/Label.js +60 -0
  185. package/dist/Label.js.map +1 -0
  186. package/dist/Label.jsx +47 -0
  187. package/dist/Label.jsx.map +1 -0
  188. package/dist/Landmark.d.ts +4 -1
  189. package/dist/Landmark.d.ts.map +1 -1
  190. package/dist/Landmark.js +10 -4
  191. package/dist/Landmark.js.map +1 -1
  192. package/dist/Landmark.jsx +5 -1
  193. package/dist/Landmark.jsx.map +1 -1
  194. package/dist/Link.d.ts +2 -7
  195. package/dist/Link.d.ts.map +1 -1
  196. package/dist/Link.js +56 -36
  197. package/dist/Link.js.map +1 -1
  198. package/dist/Link.jsx +52 -10
  199. package/dist/Link.jsx.map +1 -1
  200. package/dist/ListBox.d.ts +17 -13
  201. package/dist/ListBox.d.ts.map +1 -1
  202. package/dist/ListBox.js +647 -348
  203. package/dist/ListBox.js.map +1 -1
  204. package/dist/ListBox.jsx +339 -236
  205. package/dist/ListBox.jsx.map +1 -1
  206. package/dist/ListDropTargetDelegate.d.ts +3 -0
  207. package/dist/ListDropTargetDelegate.d.ts.map +1 -1
  208. package/dist/Menu.d.ts +39 -30
  209. package/dist/Menu.d.ts.map +1 -1
  210. package/dist/Menu.js +547 -368
  211. package/dist/Menu.js.map +1 -1
  212. package/dist/Menu.jsx +328 -230
  213. package/dist/Menu.jsx.map +1 -1
  214. package/dist/Meter.d.ts +6 -13
  215. package/dist/Meter.d.ts.map +1 -1
  216. package/dist/Meter.js +55 -18
  217. package/dist/Meter.js.map +1 -1
  218. package/dist/Meter.jsx +33 -8
  219. package/dist/Meter.jsx.map +1 -1
  220. package/dist/Modal.d.ts +1 -7
  221. package/dist/Modal.d.ts.map +1 -1
  222. package/dist/Modal.js +104 -56
  223. package/dist/Modal.js.map +1 -1
  224. package/dist/Modal.jsx +68 -38
  225. package/dist/Modal.jsx.map +1 -1
  226. package/dist/NumberField.d.ts +4 -7
  227. package/dist/NumberField.d.ts.map +1 -1
  228. package/dist/NumberField.js +243 -124
  229. package/dist/NumberField.js.map +1 -1
  230. package/dist/NumberField.jsx +115 -26
  231. package/dist/NumberField.jsx.map +1 -1
  232. package/dist/Popover.d.ts +15 -7
  233. package/dist/Popover.d.ts.map +1 -1
  234. package/dist/Popover.js +370 -181
  235. package/dist/Popover.js.map +1 -1
  236. package/dist/Popover.jsx +215 -82
  237. package/dist/Popover.jsx.map +1 -1
  238. package/dist/Pressable.d.ts +2 -8
  239. package/dist/Pressable.d.ts.map +1 -1
  240. package/dist/Pressable.js +23 -6
  241. package/dist/Pressable.js.map +1 -1
  242. package/dist/Pressable.jsx +22 -5
  243. package/dist/Pressable.jsx.map +1 -1
  244. package/dist/PreviewTrigger.d.ts +24 -0
  245. package/dist/PreviewTrigger.d.ts.map +1 -0
  246. package/dist/PreviewTrigger.js +128 -0
  247. package/dist/PreviewTrigger.js.map +1 -0
  248. package/dist/PreviewTrigger.jsx +117 -0
  249. package/dist/PreviewTrigger.jsx.map +1 -0
  250. package/dist/ProgressBar.d.ts +1 -7
  251. package/dist/ProgressBar.d.ts.map +1 -1
  252. package/dist/ProgressBar.js +34 -14
  253. package/dist/ProgressBar.js.map +1 -1
  254. package/dist/ProgressBar.jsx +17 -3
  255. package/dist/ProgressBar.jsx.map +1 -1
  256. package/dist/RadioGroup.d.ts +2 -7
  257. package/dist/RadioGroup.d.ts.map +1 -1
  258. package/dist/RadioGroup.js +388 -269
  259. package/dist/RadioGroup.js.map +1 -1
  260. package/dist/RadioGroup.jsx +110 -99
  261. package/dist/RadioGroup.jsx.map +1 -1
  262. package/dist/RangeCalendar.d.ts +3 -7
  263. package/dist/RangeCalendar.d.ts.map +1 -1
  264. package/dist/RangeCalendar.js +271 -202
  265. package/dist/RangeCalendar.js.map +1 -1
  266. package/dist/RangeCalendar.jsx +56 -37
  267. package/dist/RangeCalendar.jsx.map +1 -1
  268. package/dist/RouterProvider.d.ts +3 -9
  269. package/dist/RouterProvider.d.ts.map +1 -1
  270. package/dist/RouterProvider.js +15 -14
  271. package/dist/RouterProvider.js.map +1 -1
  272. package/dist/RouterProvider.jsx +14 -13
  273. package/dist/RouterProvider.jsx.map +1 -1
  274. package/dist/SearchField.d.ts +4 -7
  275. package/dist/SearchField.d.ts.map +1 -1
  276. package/dist/SearchField.js +191 -164
  277. package/dist/SearchField.js.map +1 -1
  278. package/dist/SearchField.jsx +69 -62
  279. package/dist/SearchField.jsx.map +1 -1
  280. package/dist/Select.d.ts +5 -10
  281. package/dist/Select.d.ts.map +1 -1
  282. package/dist/Select.js +565 -359
  283. package/dist/Select.js.map +1 -1
  284. package/dist/Select.jsx +281 -161
  285. package/dist/Select.jsx.map +1 -1
  286. package/dist/SelectionIndicator.d.ts +1 -4
  287. package/dist/SelectionIndicator.d.ts.map +1 -1
  288. package/dist/SelectionIndicator.js +29 -13
  289. package/dist/SelectionIndicator.js.map +1 -1
  290. package/dist/SelectionIndicator.jsx +18 -4
  291. package/dist/SelectionIndicator.jsx.map +1 -1
  292. package/dist/Separator.d.ts +1 -7
  293. package/dist/Separator.d.ts.map +1 -1
  294. package/dist/Separator.js +22 -6
  295. package/dist/Separator.js.map +1 -1
  296. package/dist/Separator.jsx +16 -3
  297. package/dist/Separator.jsx.map +1 -1
  298. package/dist/SharedElementTransition.d.ts +1 -10
  299. package/dist/SharedElementTransition.d.ts.map +1 -1
  300. package/dist/SharedElementTransition.js +68 -40
  301. package/dist/SharedElementTransition.js.map +1 -1
  302. package/dist/SharedElementTransition.jsx +49 -25
  303. package/dist/SharedElementTransition.jsx.map +1 -1
  304. package/dist/Slider.d.ts +2 -8
  305. package/dist/Slider.d.ts.map +1 -1
  306. package/dist/Slider.js +155 -97
  307. package/dist/Slider.js.map +1 -1
  308. package/dist/Slider.jsx +25 -12
  309. package/dist/Slider.jsx.map +1 -1
  310. package/dist/StepList.d.ts +1 -7
  311. package/dist/StepList.d.ts.map +1 -1
  312. package/dist/StepList.js +112 -68
  313. package/dist/StepList.js.map +1 -1
  314. package/dist/StepList.jsx +58 -20
  315. package/dist/StepList.jsx.map +1 -1
  316. package/dist/Switch.d.ts +2 -9
  317. package/dist/Switch.d.ts.map +1 -1
  318. package/dist/Switch.js +164 -114
  319. package/dist/Switch.js.map +1 -1
  320. package/dist/Switch.jsx +26 -13
  321. package/dist/Switch.jsx.map +1 -1
  322. package/dist/Table.d.ts +2 -1
  323. package/dist/Table.d.ts.map +1 -1
  324. package/dist/Table.js +689 -592
  325. package/dist/Table.js.map +1 -1
  326. package/dist/Table.jsx +317 -237
  327. package/dist/Table.jsx.map +1 -1
  328. package/dist/Tabs.d.ts +2 -7
  329. package/dist/Tabs.d.ts.map +1 -1
  330. package/dist/Tabs.js +278 -293
  331. package/dist/Tabs.js.map +1 -1
  332. package/dist/Tabs.jsx +68 -66
  333. package/dist/Tabs.jsx.map +1 -1
  334. package/dist/TagGroup.d.ts +4 -11
  335. package/dist/TagGroup.d.ts.map +1 -1
  336. package/dist/TagGroup.js +153 -115
  337. package/dist/TagGroup.js.map +1 -1
  338. package/dist/TagGroup.jsx +37 -24
  339. package/dist/TagGroup.jsx.map +1 -1
  340. package/dist/Text.d.ts +3 -3
  341. package/dist/Text.d.ts.map +1 -1
  342. package/dist/Text.js +24 -7
  343. package/dist/Text.js.map +1 -1
  344. package/dist/Text.jsx +17 -5
  345. package/dist/Text.jsx.map +1 -1
  346. package/dist/TextField.d.ts +3 -16
  347. package/dist/TextField.d.ts.map +1 -1
  348. package/dist/TextField.js +104 -129
  349. package/dist/TextField.js.map +1 -1
  350. package/dist/TextField.jsx +76 -102
  351. package/dist/TextField.jsx.map +1 -1
  352. package/dist/TimeField.d.ts +2 -15
  353. package/dist/TimeField.d.ts.map +1 -1
  354. package/dist/TimeField.js +86 -102
  355. package/dist/TimeField.js.map +1 -1
  356. package/dist/TimeField.jsx +32 -49
  357. package/dist/TimeField.jsx.map +1 -1
  358. package/dist/Toast.d.ts +10 -13
  359. package/dist/Toast.d.ts.map +1 -1
  360. package/dist/Toast.js +209 -108
  361. package/dist/Toast.js.map +1 -1
  362. package/dist/Toast.jsx +127 -22
  363. package/dist/Toast.jsx.map +1 -1
  364. package/dist/ToggleButton.d.ts +1 -7
  365. package/dist/ToggleButton.d.ts.map +1 -1
  366. package/dist/ToggleButton.js +57 -35
  367. package/dist/ToggleButton.js.map +1 -1
  368. package/dist/ToggleButton.jsx +26 -12
  369. package/dist/ToggleButton.jsx.map +1 -1
  370. package/dist/ToggleButtonGroup.d.ts +1 -7
  371. package/dist/ToggleButtonGroup.d.ts.map +1 -1
  372. package/dist/ToggleButtonGroup.js +59 -44
  373. package/dist/ToggleButtonGroup.js.map +1 -1
  374. package/dist/ToggleButtonGroup.jsx +25 -12
  375. package/dist/ToggleButtonGroup.jsx.map +1 -1
  376. package/dist/TokenField.d.ts +52 -0
  377. package/dist/TokenField.d.ts.map +1 -0
  378. package/dist/TokenField.js +301 -0
  379. package/dist/TokenField.js.map +1 -0
  380. package/dist/TokenField.jsx +197 -0
  381. package/dist/TokenField.jsx.map +1 -0
  382. package/dist/Toolbar.d.ts +2 -7
  383. package/dist/Toolbar.d.ts.map +1 -1
  384. package/dist/Toolbar.js +35 -16
  385. package/dist/Toolbar.js.map +1 -1
  386. package/dist/Toolbar.jsx +15 -2
  387. package/dist/Toolbar.jsx.map +1 -1
  388. package/dist/Tooltip.d.ts +2 -7
  389. package/dist/Tooltip.d.ts.map +1 -1
  390. package/dist/Tooltip.js +105 -68
  391. package/dist/Tooltip.js.map +1 -1
  392. package/dist/Tooltip.jsx +60 -36
  393. package/dist/Tooltip.jsx.map +1 -1
  394. package/dist/Tree.d.ts +8 -11
  395. package/dist/Tree.d.ts.map +1 -1
  396. package/dist/Tree.js +486 -339
  397. package/dist/Tree.js.map +1 -1
  398. package/dist/Tree.jsx +155 -107
  399. package/dist/Tree.jsx.map +1 -1
  400. package/dist/Virtualizer.d.ts +39 -9
  401. package/dist/Virtualizer.d.ts.map +1 -1
  402. package/dist/Virtualizer.js +2 -2
  403. package/dist/Virtualizer.jsx +2 -2
  404. package/dist/Virtualizer2.js +491 -136
  405. package/dist/Virtualizer2.js.map +1 -1
  406. package/dist/Virtualizer2.jsx +455 -122
  407. package/dist/Virtualizer2.jsx.map +1 -1
  408. package/dist/VirtualizerLayouts.d.ts +55 -2
  409. package/dist/VirtualizerLayouts.d.ts.map +1 -1
  410. package/dist/VisuallyHidden.d.ts +4 -3
  411. package/dist/VisuallyHidden.d.ts.map +1 -1
  412. package/dist/VisuallyHidden.js +18 -11
  413. package/dist/VisuallyHidden.js.map +1 -1
  414. package/dist/VisuallyHidden.jsx +15 -9
  415. package/dist/VisuallyHidden.jsx.map +1 -1
  416. package/dist/contexts.d.ts +25 -0
  417. package/dist/contexts.d.ts.map +1 -1
  418. package/dist/contexts.js +3 -0
  419. package/dist/contexts.js.map +1 -1
  420. package/dist/contexts.jsx +3 -0
  421. package/dist/contexts.jsx.map +1 -1
  422. package/dist/index.d.ts +11 -9
  423. package/dist/index.d.ts.map +1 -1
  424. package/dist/index.js +14 -11
  425. package/dist/index.jsx +14 -11
  426. package/dist/intl/index.d.ts +16 -0
  427. package/dist/intl/index.d.ts.map +1 -0
  428. package/dist/intl.js +212 -0
  429. package/dist/intl.js.map +1 -0
  430. package/dist/intl.jsx +212 -0
  431. package/dist/intl.jsx.map +1 -0
  432. package/dist/useDragAndDrop.d.ts +4 -2
  433. package/dist/useDragAndDrop.d.ts.map +1 -1
  434. package/dist/useDragAndDrop2.js +39 -21
  435. package/dist/useDragAndDrop2.js.map +1 -1
  436. package/dist/useDragAndDrop2.jsx +39 -21
  437. package/dist/useDragAndDrop2.jsx.map +1 -1
  438. package/dist/utils.d.ts +28 -9
  439. package/dist/utils.d.ts.map +1 -1
  440. package/dist/utils.js +96 -24
  441. package/dist/utils.js.map +1 -1
  442. package/dist/utils.jsx +81 -24
  443. package/dist/utils.jsx.map +1 -1
  444. package/dist/virtualizer/Layout.d.ts +9 -0
  445. package/dist/virtualizer/Layout.d.ts.map +1 -1
  446. package/dist/virtualizer/Layout.js +23 -2
  447. package/dist/virtualizer/Layout.js.map +1 -1
  448. package/dist/virtualizer/Layout.jsx +23 -2
  449. package/dist/virtualizer/Layout.jsx.map +1 -1
  450. package/package.json +29 -10
  451. package/src/ActionBar.tsx +50 -24
  452. package/src/ActionGroup.tsx +31 -19
  453. package/src/Alert.tsx +10 -4
  454. package/src/Autocomplete.tsx +24 -15
  455. package/src/Breadcrumbs.tsx +32 -16
  456. package/src/Button.tsx +182 -67
  457. package/src/Calendar.tsx +65 -47
  458. package/src/CalendarPicker.tsx +16 -1
  459. package/src/Checkbox.tsx +84 -116
  460. package/src/Collection.tsx +84 -3
  461. package/src/Color.tsx +282 -104
  462. package/src/ColorEditor.tsx +5 -1
  463. package/src/ComboBox.tsx +384 -109
  464. package/src/ContextualHelpTrigger.tsx +47 -41
  465. package/src/DateField.tsx +74 -106
  466. package/src/DatePicker.tsx +156 -352
  467. package/src/DateRangePickerContext.tsx +8 -0
  468. package/src/Dialog.tsx +105 -38
  469. package/src/Disclosure.tsx +29 -19
  470. package/src/DragAndDrop.tsx +43 -8
  471. package/src/DragPreview.tsx +20 -1
  472. package/src/DropZone.tsx +32 -18
  473. package/src/ElementTag.tsx +14 -104
  474. package/src/FieldError.tsx +39 -7
  475. package/src/FileTrigger.tsx +18 -3
  476. package/src/Focusable.tsx +27 -6
  477. package/src/Form.tsx +57 -11
  478. package/src/GridList.tsx +233 -141
  479. package/src/HiddenDateInput.tsx +19 -3
  480. package/src/Icon.tsx +8 -2
  481. package/src/Keyboard.tsx +18 -2
  482. package/src/Label.tsx +77 -0
  483. package/src/Landmark.tsx +6 -1
  484. package/src/Link.tsx +65 -19
  485. package/src/ListBox.tsx +645 -468
  486. package/src/ListDropTargetDelegate.ts +4 -0
  487. package/src/Menu.tsx +512 -349
  488. package/src/Meter.tsx +42 -8
  489. package/src/Modal.tsx +85 -42
  490. package/src/NumberField.tsx +161 -48
  491. package/src/Popover.tsx +424 -148
  492. package/src/Pressable.tsx +27 -6
  493. package/src/PreviewTrigger.tsx +171 -0
  494. package/src/ProgressBar.tsx +25 -3
  495. package/src/RadioGroup.tsx +230 -161
  496. package/src/RangeCalendar.tsx +75 -63
  497. package/src/RouterProvider.tsx +24 -14
  498. package/src/SearchField.tsx +118 -121
  499. package/src/Select.tsx +454 -274
  500. package/src/SelectionIndicator.tsx +21 -3
  501. package/src/Separator.tsx +17 -1
  502. package/src/SharedElementTransition.tsx +115 -97
  503. package/src/Slider.tsx +35 -17
  504. package/src/StepList.tsx +71 -32
  505. package/src/Switch.tsx +45 -29
  506. package/src/Table.tsx +446 -380
  507. package/src/Tabs.tsx +132 -155
  508. package/src/TagGroup.tsx +53 -40
  509. package/src/Text.tsx +23 -6
  510. package/src/TextField.tsx +118 -159
  511. package/src/TimeField.tsx +34 -95
  512. package/src/Toast.tsx +141 -67
  513. package/src/ToggleButton.tsx +33 -15
  514. package/src/ToggleButtonGroup.tsx +27 -9
  515. package/src/TokenField.tsx +379 -0
  516. package/src/Toolbar.tsx +19 -9
  517. package/src/Tooltip.tsx +126 -84
  518. package/src/Tree.tsx +233 -173
  519. package/src/Virtualizer.tsx +400 -138
  520. package/src/VirtualizerLayouts.ts +211 -26
  521. package/src/VisuallyHidden.tsx +22 -8
  522. package/src/contexts.ts +13 -0
  523. package/src/index.ts +32 -11
  524. package/src/intl/ar-AE.json +6 -0
  525. package/src/intl/bg-BG.json +6 -0
  526. package/src/intl/cs-CZ.json +6 -0
  527. package/src/intl/da-DK.json +6 -0
  528. package/src/intl/de-DE.json +6 -0
  529. package/src/intl/el-GR.json +6 -0
  530. package/src/intl/en-US.json +6 -0
  531. package/src/intl/es-ES.json +6 -0
  532. package/src/intl/et-EE.json +6 -0
  533. package/src/intl/fi-FI.json +6 -0
  534. package/src/intl/fr-FR.json +6 -0
  535. package/src/intl/he-IL.json +6 -0
  536. package/src/intl/hr-HR.json +6 -0
  537. package/src/intl/hu-HU.json +6 -0
  538. package/src/intl/index.ts +125 -0
  539. package/src/intl/it-IT.json +6 -0
  540. package/src/intl/ja-JP.json +6 -0
  541. package/src/intl/ko-KR.json +6 -0
  542. package/src/intl/lt-LT.json +6 -0
  543. package/src/intl/lv-LV.json +6 -0
  544. package/src/intl/nb-NO.json +6 -0
  545. package/src/intl/nl-NL.json +6 -0
  546. package/src/intl/pl-PL.json +6 -0
  547. package/src/intl/pt-BR.json +6 -0
  548. package/src/intl/pt-PT.json +6 -0
  549. package/src/intl/ro-RO.json +6 -0
  550. package/src/intl/ru-RU.json +6 -0
  551. package/src/intl/sk-SK.json +6 -0
  552. package/src/intl/sl-SI.json +6 -0
  553. package/src/intl/sr-SP.json +6 -0
  554. package/src/intl/sv-SE.json +6 -0
  555. package/src/intl/tr-TR.json +6 -0
  556. package/src/intl/uk-UA.json +6 -0
  557. package/src/intl/zh-CN.json +6 -0
  558. package/src/intl/zh-TW.json +6 -0
  559. package/src/useDragAndDrop.ts +30 -32
  560. package/src/utils.tsx +124 -68
  561. package/src/virtualizer/Layout.ts +29 -0
@@ -1 +1 @@
1
- {"version":3,"file":"useDragAndDrop2.js","names":["onCleanup","JSX","DragItem","DragPreviewRenderer","DragPreviewProps","ref","current","children","items","Element","element","x","y","DragPreview","props","hasDom","HTMLElement","isElementNode","value","nodeType","renderer","callback","rendered","previewValue"],"sources":["../src/DragPreview.tsx","../src/ListDropTargetDelegate.ts","../src/useDragAndDrop.ts"],"sourcesContent":["import { onCleanup, type JSX } from \"solid-js\";\nimport type { DragItem, DragPreviewRenderer } from \"@proyecto-viviana/solid-stately\";\n\nexport interface DragPreviewProps {\n ref?: { current: DragPreviewRenderer | null };\n children: (\n items: DragItem[],\n ) => JSX.Element | { element: JSX.Element; x?: number; y?: number } | null | undefined;\n}\n\nexport function DragPreview(props: DragPreviewProps): JSX.Element {\n const hasDom = typeof HTMLElement !== \"undefined\";\n const isElementNode = (value: unknown): value is HTMLElement => {\n if (!value) return false;\n if (hasDom && value instanceof HTMLElement) return true;\n return typeof value === \"object\" && (value as { nodeType?: number }).nodeType === 1;\n };\n\n if (props.ref) {\n const renderer: DragPreviewRenderer = (items, callback) => {\n const rendered = props.children(items);\n if (!rendered) {\n callback(null);\n return;\n }\n if (typeof rendered === \"object\" && rendered !== null && \"element\" in rendered) {\n const previewValue = rendered as { element: unknown; x?: number; y?: number };\n callback(\n isElementNode(previewValue.element) ? previewValue.element : null,\n previewValue.x,\n previewValue.y,\n );\n return;\n }\n callback(isElementNode(rendered) ? rendered : null);\n };\n\n props.ref.current = renderer;\n onCleanup(() => {\n if (props.ref?.current === renderer) {\n props.ref.current = null;\n }\n });\n }\n\n return null as unknown as JSX.Element;\n}\n","import type { Accessor } from \"solid-js\";\nimport type { DropTarget } from \"@proyecto-viviana/solid-stately\";\n\ntype Direction = \"ltr\" | \"rtl\";\ntype Orientation = \"horizontal\" | \"vertical\";\ntype Layout = \"stack\" | \"grid\";\n\ninterface CollectionNodeLike {\n key: string | number;\n type?: string;\n}\n\nexport interface ListDropTargetDelegateOptions {\n layout?: Layout;\n orientation?: Orientation;\n direction?: Direction;\n}\n\nconst cssEscape = (value: string): string => {\n const css = (globalThis as { CSS?: { escape?: (input: string) => string } }).CSS;\n return css?.escape ? css.escape(value) : value.replace(/[^a-zA-Z0-9_-]/g, \"\\\\$&\");\n};\n\nexport class ListDropTargetDelegate {\n private collection: Iterable<CollectionNodeLike> | (() => Iterable<CollectionNodeLike>);\n private ref: Accessor<HTMLElement | null>;\n private layout: Layout;\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(\n collection: Iterable<CollectionNodeLike> | (() => Iterable<CollectionNodeLike>),\n ref: Accessor<HTMLElement | null>,\n options?: ListDropTargetDelegateOptions,\n ) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout ?? \"stack\";\n this.orientation = options?.orientation ?? \"vertical\";\n this.direction = options?.direction ?? \"ltr\";\n }\n\n private getCollection(): Iterable<CollectionNodeLike> {\n return typeof this.collection === \"function\"\n ? (this.collection as () => Iterable<CollectionNodeLike>)()\n : this.collection;\n }\n\n private getPrimaryStart(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect): number {\n return this.layout === \"stack\" ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect): number {\n return this.layout === \"stack\" ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect): number {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n private getItemKeys(): Array<string | number> {\n return [...this.getCollection()].filter((item) => item.type === \"item\").map((item) => item.key);\n }\n\n private resolveBoundaryTarget(\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n const keys = this.getItemKeys();\n if (keys.length === 0) return null;\n const key = direction === \"next\" ? keys[0] : keys[keys.length - 1];\n const order: Array<\"before\" | \"on\" | \"after\"> =\n direction === \"next\" ? [\"before\", \"on\", \"after\"] : [\"after\", \"on\", \"before\"];\n for (const dropPosition of order) {\n const target: DropTarget = { type: \"item\", key, dropPosition };\n if (isValidDropTarget(target)) return target;\n }\n return null;\n }\n\n private resolveTransitionTarget(\n target: DropTarget,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (target.type !== \"item\") return null;\n const tryPosition = (dropPosition: \"before\" | \"on\" | \"after\"): DropTarget | null => {\n if (target.dropPosition === dropPosition) return null;\n const nextTarget: DropTarget = {\n type: \"item\",\n key: target.key,\n dropPosition,\n };\n return isValidDropTarget(nextTarget) ? nextTarget : null;\n };\n\n if (direction === \"next\") {\n if (target.dropPosition === \"before\") {\n return tryPosition(\"on\") ?? tryPosition(\"after\");\n }\n if (target.dropPosition === \"on\") {\n return tryPosition(\"after\");\n }\n } else {\n if (target.dropPosition === \"after\") {\n return tryPosition(\"on\") ?? tryPosition(\"before\");\n }\n if (target.dropPosition === \"on\") {\n return tryPosition(\"before\");\n }\n }\n\n return null;\n }\n\n private resolveNeighborTarget(\n target: DropTarget,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (target.type !== \"item\") return null;\n const keys = this.getItemKeys();\n const index = keys.findIndex((key) => key === target.key);\n if (index < 0) return this.resolveBoundaryTarget(direction, isValidDropTarget);\n const nextIndex = direction === \"next\" ? index + 1 : index - 1;\n if (nextIndex < 0 || nextIndex >= keys.length) {\n const rootTarget: DropTarget = { type: \"root\" };\n return isValidDropTarget(rootTarget) ? rootTarget : null;\n }\n const key = keys[nextIndex];\n const order: Array<\"on\" | \"before\" | \"after\"> =\n direction === \"next\" ? [\"on\", \"before\", \"after\"] : [\"on\", \"after\", \"before\"];\n for (const dropPosition of order) {\n const nextTarget: DropTarget = { type: \"item\", key, dropPosition };\n if (isValidDropTarget(nextTarget)) return nextTarget;\n }\n return null;\n }\n\n getKeyboardNavigationTarget(\n target: DropTarget | null,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (!target || target.type === \"root\") {\n return this.resolveBoundaryTarget(direction, isValidDropTarget);\n }\n const transition = this.resolveTransitionTarget(target, direction, isValidDropTarget);\n if (transition) return transition;\n return this.resolveNeighborTarget(target, direction, isValidDropTarget);\n }\n\n getDropTargetFromPoint(\n x: number,\n y: number,\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget {\n const root = this.ref();\n if (!root) {\n return { type: \"root\" };\n }\n\n const allItems = [...this.getCollection()].filter((item) => item.type === \"item\");\n if (allItems.length === 0) {\n return { type: \"root\" };\n }\n\n const collectionId = root.dataset.collection;\n const selector = collectionId ? `[data-collection=\"${cssEscape(collectionId)}\"]` : \"[data-key]\";\n const elements = root.querySelectorAll(selector);\n const elementMap = new Map<string, HTMLElement>();\n for (const node of elements) {\n if (node instanceof HTMLElement && node.dataset.key != null) {\n elementMap.set(node.dataset.key, node);\n }\n }\n\n let low = 0;\n let high = allItems.length;\n const rootRect = root.getBoundingClientRect();\n let primary = this.orientation === \"horizontal\" ? x : y;\n let secondary = this.orientation === \"horizontal\" ? y : x;\n primary += this.getPrimaryStart(rootRect);\n secondary += this.getSecondaryStart(rootRect);\n\n const flow = this.layout === \"stack\" ? primary : secondary;\n const isPrimaryRtl = this.orientation === \"horizontal\" && this.direction === \"rtl\";\n const isSecondaryRtl =\n this.layout === \"grid\" && this.orientation === \"vertical\" && this.direction === \"rtl\";\n const isFlowRtl = this.layout === \"stack\" ? isPrimaryRtl : isSecondaryRtl;\n\n while (low < high) {\n const mid = Math.floor((low + high) / 2);\n const item = allItems[mid];\n const element = elementMap.get(String(item.key));\n if (!element) break;\n const rect = element.getBoundingClientRect();\n const update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRtl);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRtl);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRtl);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRtl);\n } else {\n const target: DropTarget = {\n type: \"item\",\n key: item.key,\n dropPosition: \"on\",\n };\n\n if (isValidDropTarget(target)) {\n if (\n flow <= this.getFlowStart(rect) + 5 &&\n isValidDropTarget({ ...target, dropPosition: \"before\" })\n ) {\n target.dropPosition = isFlowRtl ? \"after\" : \"before\";\n } else if (\n flow >= this.getFlowEnd(rect) - 5 &&\n isValidDropTarget({ ...target, dropPosition: \"after\" })\n ) {\n target.dropPosition = isFlowRtl ? \"before\" : \"after\";\n }\n } else {\n const midpoint = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= midpoint && isValidDropTarget({ ...target, dropPosition: \"before\" })) {\n target.dropPosition = isFlowRtl ? \"after\" : \"before\";\n } else if (flow >= midpoint && isValidDropTarget({ ...target, dropPosition: \"after\" })) {\n target.dropPosition = isFlowRtl ? \"before\" : \"after\";\n }\n }\n\n return target;\n }\n }\n\n const item = allItems[Math.min(low, allItems.length - 1)];\n const element = elementMap.get(String(item.key));\n const rect = element?.getBoundingClientRect();\n if (\n rect &&\n (primary < this.getPrimaryStart(rect) ||\n Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect)))\n ) {\n return {\n type: \"item\",\n key: item.key,\n dropPosition: isFlowRtl ? \"after\" : \"before\",\n };\n }\n\n return {\n type: \"item\",\n key: item.key,\n dropPosition: isFlowRtl ? \"before\" : \"after\",\n };\n }\n}\n","/**\n * Drag and drop compatibility hook for collection components.\n *\n * Mirrors RAC's `useDragAndDrop` shape while delegating to Solid\n * state and aria primitives.\n */\n\nimport type { Accessor, JSX } from \"solid-js\";\nimport { DragPreview } from \"./DragPreview\";\nimport { ListDropTargetDelegate } from \"./ListDropTargetDelegate\";\nimport {\n createDraggableCollection,\n createDraggableItem,\n createDroppableCollection,\n createDroppableItem,\n getGlobalDraggingCollectionRef,\n getGlobalDraggingKeys,\n type DraggableCollectionOptions,\n type DraggableCollectionAria,\n type DraggableItemOptions,\n type DraggableItemAria,\n type DroppableCollectionOptions,\n type DroppableCollectionAria,\n type DroppableItemOptions,\n type DroppableItemAria,\n type DropTargetDelegate as AriaDropTargetDelegate,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createDraggableCollectionState,\n createDroppableCollectionState,\n type DragItem,\n type DragPreviewRenderer,\n type DraggableCollectionProps,\n type DraggableCollectionState,\n type DraggableCollectionStateOptions,\n type DropTarget,\n type DroppableCollectionProps,\n type DroppableCollectionState,\n type DroppableCollectionStateOptions,\n} from \"@proyecto-viviana/solid-stately\";\n\ninterface DraggableCollectionStateOpts<T = object> extends Omit<\n DraggableCollectionStateOptions<T>,\n \"getItems\"\n> {\n items?: T[];\n}\n\ninterface DragHooks<T = object> {\n useDraggableCollectionState?: (\n props: DraggableCollectionStateOpts<T>,\n ) => DraggableCollectionState;\n useDraggableCollection?: (\n props: Omit<DraggableCollectionOptions, \"ref\">,\n state: DraggableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DraggableCollectionAria;\n useDraggableItem?: (\n props: DraggableItemOptions,\n state: DraggableCollectionState,\n ) => DraggableItemAria;\n DragPreview?: typeof DragPreview;\n renderDragPreview?: DragAndDropOptions<T>[\"renderDragPreview\"];\n isVirtualDragging?: () => boolean;\n}\n\ninterface DropHooks {\n useDroppableCollectionState?: (\n props: DroppableCollectionStateOptions,\n ) => DroppableCollectionState;\n useDroppableCollection?: (\n props: Omit<DroppableCollectionOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DroppableCollectionAria;\n useDroppableItem?: (\n options: Omit<DroppableItemOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DroppableItemAria;\n useDropIndicator?: (\n props: { target: DropTarget },\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => {\n dropIndicatorProps: JSX.HTMLAttributes<HTMLElement>;\n isDropTarget: boolean;\n isHidden: boolean;\n };\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n dropTargetDelegate?: AriaDropTargetDelegate;\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 Partial<Omit<DraggableCollectionProps<T>, \"preview\">>, Partial<DroppableCollectionProps> {\n /**\n * A function that returns the items being dragged.\n * If omitted, draggable hooks are not added.\n */\n getItems?: (keys: Set<string | number>, items: T[]) => DragItem[];\n /**\n * Optional custom drag preview renderer.\n */\n renderDragPreview?: (\n items: DragItem[],\n ) => JSX.Element | { element: JSX.Element; x: number; y: number };\n /**\n * Optional drop indicator renderer for collection components.\n */\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n /**\n * Optional custom drop target delegate.\n */\n dropTargetDelegate?: AriaDropTargetDelegate;\n /**\n * Optional drag preview ref.\n */\n preview?: { current: DragPreviewRenderer | null };\n /**\n * Optional item snapshot used by draggable state `getItems`.\n */\n items?: T[];\n /**\n * Disable both drag and drop behavior.\n */\n isDisabled?: boolean;\n}\n\n/**\n * Provides hooks to enable drag-and-drop behavior for collection components.\n */\nexport function useDragAndDrop<T = object>(options: DragAndDropOptions<T> = {}): DragAndDrop<T> {\n const {\n getItems,\n onDrop,\n onInsert,\n onItemDrop,\n onReorder,\n onMove,\n onRootDrop,\n renderDragPreview,\n renderDropIndicator,\n dropTargetDelegate,\n } = options;\n\n const isDraggable = typeof getItems === \"function\";\n const isDroppable = Boolean(\n onDrop || onInsert || onItemDrop || onReorder || onMove || onRootDrop,\n );\n\n const hooks: DragAndDropHooks<T> = {};\n const hasDom = typeof HTMLElement !== \"undefined\";\n const isElementNode = (value: unknown): value is HTMLElement => {\n if (!value) return false;\n if (hasDom && value instanceof HTMLElement) return true;\n return typeof value === \"object\" && (value as { nodeType?: number }).nodeType === 1;\n };\n const resolvedPreview =\n options.preview ??\n (renderDragPreview\n ? {\n current: (\n items: DragItem[],\n callback: (node: HTMLElement | null, x?: number, y?: number) => void,\n ) => {\n const rendered = renderDragPreview(items);\n if (!rendered) {\n callback(null);\n return;\n }\n if (typeof rendered === \"object\" && rendered !== null && \"element\" in rendered) {\n const previewValue = rendered as { element: unknown; x?: number; y?: number };\n callback(\n isElementNode(previewValue.element) ? previewValue.element : null,\n previewValue.x,\n previewValue.y,\n );\n return;\n }\n callback(isElementNode(rendered) ? rendered : null);\n },\n }\n : undefined);\n\n if (isDraggable && getItems) {\n hooks.useDraggableCollectionState = (props: DraggableCollectionStateOpts<T>) => {\n return createDraggableCollectionState<T>(() => ({\n onDragStart: options.onDragStart ?? props.onDragStart,\n onDragMove: options.onDragMove ?? props.onDragMove,\n onDragEnd: options.onDragEnd ?? props.onDragEnd,\n getAllowedDropOperations:\n options.getAllowedDropOperations ?? props.getAllowedDropOperations,\n isDisabled: options.isDisabled ?? props.isDisabled,\n preview: resolvedPreview ?? props.preview,\n getItems: (keys) => {\n const sourceItems = props.items ?? options.items ?? [];\n return getItems(keys, sourceItems);\n },\n }));\n };\n hooks.useDraggableCollection = (\n props: Omit<DraggableCollectionOptions, \"ref\">,\n state: DraggableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => createDraggableCollection({ ...props, ref }, state);\n hooks.useDraggableItem = (props, state) => createDraggableItem(() => props, state);\n hooks.DragPreview = DragPreview;\n hooks.renderDragPreview = renderDragPreview;\n hooks.isVirtualDragging = () =>\n getGlobalDraggingCollectionRef() != null || getGlobalDraggingKeys().size > 0;\n }\n\n if (isDroppable) {\n hooks.useDroppableCollectionState = (props: DroppableCollectionStateOptions) => {\n return createDroppableCollectionState(() => ({\n acceptedDragTypes: options.acceptedDragTypes ?? props.acceptedDragTypes,\n getDropOperation: options.getDropOperation ?? props.getDropOperation,\n onDropEnter: options.onDropEnter ?? props.onDropEnter,\n onDropActivate: options.onDropActivate ?? props.onDropActivate,\n onDropExit: options.onDropExit ?? props.onDropExit,\n onDrop: options.onDrop ?? props.onDrop,\n onInsert: options.onInsert ?? props.onInsert,\n onRootDrop: options.onRootDrop ?? props.onRootDrop,\n onItemDrop: options.onItemDrop ?? props.onItemDrop,\n onReorder: options.onReorder ?? props.onReorder,\n onMove: options.onMove ?? props.onMove,\n shouldAcceptItemDrop: options.shouldAcceptItemDrop ?? props.shouldAcceptItemDrop,\n isDisabled: options.isDisabled ?? props.isDisabled,\n }));\n };\n hooks.useDroppableCollection = (\n props: Omit<DroppableCollectionOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => {\n const acceptedDragTypes = options.acceptedDragTypes ?? props.acceptedDragTypes;\n const normalizedAcceptedDragTypes =\n acceptedDragTypes === \"all\"\n ? \"all\"\n : acceptedDragTypes?.filter(\n (type): type is string | symbol =>\n typeof type === \"string\" || typeof type === \"symbol\",\n );\n return createDroppableCollection(\n () => ({\n ref,\n dropTargetDelegate: options.dropTargetDelegate ?? props.dropTargetDelegate,\n keyboardDelegate: props.keyboardDelegate,\n // Host collection + selection/focus setters, forwarded so keyboard\n // drop-target navigation and post-drop focus restoration work.\n collection: props.collection,\n selectedKeys: props.selectedKeys,\n setSelectedKeys: props.setSelectedKeys,\n setFocusedKey: props.setFocusedKey,\n onKeyDown: props.onKeyDown,\n acceptedDragTypes: normalizedAcceptedDragTypes,\n isDisabled: options.isDisabled ?? props.isDisabled,\n onDropActivate: (e) => {\n (options.onDropActivate ?? props.onDropActivate)?.({\n type: \"dropactivate\",\n target: e.target,\n x: e.x,\n y: e.y,\n });\n },\n onDrop: (e) => {\n (options.onDrop ?? props.onDrop)?.({\n type: \"drop\",\n target: e.target,\n x: e.x,\n y: e.y,\n items: e.items,\n dropOperation: e.dropOperation,\n });\n },\n onRootDrop: options.onRootDrop ?? props.onRootDrop,\n onItemDrop: (e) => {\n if (e.target.type === \"item\") {\n (options.onItemDrop ?? props.onItemDrop)?.({\n items: e.items,\n target: e.target,\n dropOperation: e.dropOperation,\n isInternal: e.isInternal,\n });\n }\n },\n onInsert: (e) => {\n if (e.target.type === \"item\") {\n (options.onInsert ?? props.onInsert)?.({\n items: e.items,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n onReorder: (e) => {\n if (e.target.type === \"item\") {\n (options.onReorder ?? props.onReorder)?.({\n keys: e.keys,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n onMove: (e) => {\n if (e.target.type === \"item\") {\n (options.onMove ?? props.onMove)?.({\n keys: e.keys,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n }),\n state,\n );\n };\n hooks.useDroppableItem = (\n props: Omit<DroppableItemOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => createDroppableItem(() => ({ ...props, ref }), state);\n hooks.useDropIndicator = (\n props: { target: DropTarget },\n state: DroppableCollectionState,\n _ref: Accessor<HTMLElement | null>,\n ) => {\n const target = props.target;\n const activeTarget = state.target;\n const isDropTarget =\n activeTarget?.type === target.type &&\n (target.type === \"root\" ||\n (activeTarget.type === \"item\" &&\n target.type === \"item\" &&\n activeTarget.key === target.key &&\n activeTarget.dropPosition === target.dropPosition));\n return {\n dropIndicatorProps: {\n role: \"option\",\n \"aria-disabled\": true,\n \"aria-hidden\": isDropTarget ? undefined : \"true\",\n tabIndex: -1,\n \"data-drop-target\": isDropTarget ? \"\" : undefined,\n },\n isDropTarget,\n isHidden: !isDropTarget,\n };\n };\n hooks.renderDropIndicator = renderDropIndicator;\n hooks.dropTargetDelegate = dropTargetDelegate;\n hooks.ListDropTargetDelegate = ListDropTargetDelegate;\n }\n\n return {\n dragAndDropHooks: hooks,\n };\n}\n"],"mappings":";;;;AAUA,SAAgBa,YAAYC,OAAsC;CAChE,MAAMC,SAAS,OAAOC,gBAAgB;CACtC,MAAMC,iBAAiBC,UAAyC;EAC9D,IAAI,CAACA,OAAO,OAAO;EACnB,IAAIH,UAAUG,iBAAiBF,aAAa,OAAO;EACnD,OAAO,OAAOE,U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AK,KAAA;IAC1C;IACA;IACA,UAAU,CAAC;GACb;EACF;EACA,MAAM,sBAAsB;EAC5B,MAAM,qBAAqB;EAC3B,MAAM,yBAAyB;CACjC;CAEA,OAAO,EACL,kBAAkB,MACpB;AACF"}
1
+ {"version":3,"file":"useDragAndDrop2.js","names":[],"sources":["../src/DragPreview.tsx","../src/ListDropTargetDelegate.ts","../src/useDragAndDrop.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria/src/dnd/DragPreview.tsx\n\n/**\n * Based on packages/react-aria/src/dnd/DragPreview.tsx.\n */\n\nimport { onCleanup } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport type { DragItem, DragPreviewRenderer } from \"@proyecto-viviana/solid-stately\";\n\nexport interface DragPreviewProps {\n ref?: { current: DragPreviewRenderer | null };\n children: (\n items: DragItem[],\n ) => JSX.Element | { element: JSX.Element; x?: number; y?: number } | null | undefined;\n}\n\nexport function DragPreview(props: DragPreviewProps): JSX.Element {\n const hasDom = typeof HTMLElement !== \"undefined\";\n const isElementNode = (value: unknown): value is HTMLElement => {\n if (!value) return false;\n if (hasDom && value instanceof HTMLElement) return true;\n return typeof value === \"object\" && (value as { nodeType?: number }).nodeType === 1;\n };\n\n if (props.ref) {\n const renderer: DragPreviewRenderer = (items, callback) => {\n const rendered = props.children(items);\n if (!rendered) {\n callback(null);\n return;\n }\n if (typeof rendered === \"object\" && rendered !== null && \"element\" in rendered) {\n const previewValue = rendered as { element: unknown; x?: number; y?: number };\n callback(\n isElementNode(previewValue.element) ? previewValue.element : null,\n previewValue.x,\n previewValue.y,\n );\n return;\n }\n callback(isElementNode(rendered) ? rendered : null);\n };\n\n props.ref.current = renderer;\n onCleanup(() => {\n if (props.ref?.current === renderer) {\n props.ref.current = null;\n }\n });\n }\n\n return null as unknown as JSX.Element;\n}\n","/**\n * Based on packages/react-aria/src/dnd/ListDropTargetDelegate.ts.\n */\n\nimport type { Accessor } from \"solid-js\";\nimport type { DropTarget } from \"@proyecto-viviana/solid-stately\";\n\ntype Direction = \"ltr\" | \"rtl\";\ntype Orientation = \"horizontal\" | \"vertical\";\ntype Layout = \"stack\" | \"grid\";\n\ninterface CollectionNodeLike {\n key: string | number;\n type?: string;\n}\n\nexport interface ListDropTargetDelegateOptions {\n layout?: Layout;\n orientation?: Orientation;\n direction?: Direction;\n}\n\nconst cssEscape = (value: string): string => {\n const css = (globalThis as { CSS?: { escape?: (input: string) => string } }).CSS;\n return css?.escape ? css.escape(value) : value.replace(/[^a-zA-Z0-9_-]/g, \"\\\\$&\");\n};\n\nexport class ListDropTargetDelegate {\n private collection: Iterable<CollectionNodeLike> | (() => Iterable<CollectionNodeLike>);\n private ref: Accessor<HTMLElement | null>;\n private layout: Layout;\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(\n collection: Iterable<CollectionNodeLike> | (() => Iterable<CollectionNodeLike>),\n ref: Accessor<HTMLElement | null>,\n options?: ListDropTargetDelegateOptions,\n ) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout ?? \"stack\";\n this.orientation = options?.orientation ?? \"vertical\";\n this.direction = options?.direction ?? \"ltr\";\n }\n\n private getCollection(): Iterable<CollectionNodeLike> {\n return typeof this.collection === \"function\"\n ? (this.collection as () => Iterable<CollectionNodeLike>)()\n : this.collection;\n }\n\n private getPrimaryStart(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect): number {\n return this.layout === \"stack\" ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect): number {\n return this.layout === \"stack\" ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect): number {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n private getItemKeys(): Array<string | number> {\n return [...this.getCollection()].filter((item) => item.type === \"item\").map((item) => item.key);\n }\n\n private resolveBoundaryTarget(\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n const keys = this.getItemKeys();\n if (keys.length === 0) return null;\n const key = direction === \"next\" ? keys[0] : keys[keys.length - 1];\n const order: Array<\"before\" | \"on\" | \"after\"> =\n direction === \"next\" ? [\"before\", \"on\", \"after\"] : [\"after\", \"on\", \"before\"];\n for (const dropPosition of order) {\n const target: DropTarget = { type: \"item\", key, dropPosition };\n if (isValidDropTarget(target)) return target;\n }\n return null;\n }\n\n private resolveTransitionTarget(\n target: DropTarget,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (target.type !== \"item\") return null;\n const tryPosition = (dropPosition: \"before\" | \"on\" | \"after\"): DropTarget | null => {\n if (target.dropPosition === dropPosition) return null;\n const nextTarget: DropTarget = {\n type: \"item\",\n key: target.key,\n dropPosition,\n };\n return isValidDropTarget(nextTarget) ? nextTarget : null;\n };\n\n if (direction === \"next\") {\n if (target.dropPosition === \"before\") {\n return tryPosition(\"on\") ?? tryPosition(\"after\");\n }\n if (target.dropPosition === \"on\") {\n return tryPosition(\"after\");\n }\n } else {\n if (target.dropPosition === \"after\") {\n return tryPosition(\"on\") ?? tryPosition(\"before\");\n }\n if (target.dropPosition === \"on\") {\n return tryPosition(\"before\");\n }\n }\n\n return null;\n }\n\n private resolveNeighborTarget(\n target: DropTarget,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (target.type !== \"item\") return null;\n const keys = this.getItemKeys();\n const index = keys.findIndex((key) => key === target.key);\n if (index < 0) return this.resolveBoundaryTarget(direction, isValidDropTarget);\n const nextIndex = direction === \"next\" ? index + 1 : index - 1;\n if (nextIndex < 0 || nextIndex >= keys.length) {\n const rootTarget: DropTarget = { type: \"root\" };\n return isValidDropTarget(rootTarget) ? rootTarget : null;\n }\n const key = keys[nextIndex];\n const order: Array<\"on\" | \"before\" | \"after\"> =\n direction === \"next\" ? [\"on\", \"before\", \"after\"] : [\"on\", \"after\", \"before\"];\n for (const dropPosition of order) {\n const nextTarget: DropTarget = { type: \"item\", key, dropPosition };\n if (isValidDropTarget(nextTarget)) return nextTarget;\n }\n return null;\n }\n\n getKeyboardNavigationTarget(\n target: DropTarget | null,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (!target || target.type === \"root\") {\n return this.resolveBoundaryTarget(direction, isValidDropTarget);\n }\n const transition = this.resolveTransitionTarget(target, direction, isValidDropTarget);\n if (transition) return transition;\n return this.resolveNeighborTarget(target, direction, isValidDropTarget);\n }\n\n getDropTargetFromPoint(\n x: number,\n y: number,\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget {\n const root = this.ref();\n if (!root) {\n return { type: \"root\" };\n }\n\n const allItems = [...this.getCollection()].filter((item) => item.type === \"item\");\n if (allItems.length === 0) {\n return { type: \"root\" };\n }\n\n const collectionId = root.dataset.collection;\n const selector = collectionId ? `[data-collection=\"${cssEscape(collectionId)}\"]` : \"[data-key]\";\n const elements = root.querySelectorAll(selector);\n const elementMap = new Map<string, HTMLElement>();\n for (const node of elements) {\n if (node instanceof HTMLElement && node.dataset.key != null) {\n elementMap.set(node.dataset.key, node);\n }\n }\n\n let low = 0;\n let high = allItems.length;\n const rootRect = root.getBoundingClientRect();\n let primary = this.orientation === \"horizontal\" ? x : y;\n let secondary = this.orientation === \"horizontal\" ? y : x;\n primary += this.getPrimaryStart(rootRect);\n secondary += this.getSecondaryStart(rootRect);\n\n const flow = this.layout === \"stack\" ? primary : secondary;\n const isPrimaryRtl = this.orientation === \"horizontal\" && this.direction === \"rtl\";\n const isSecondaryRtl =\n this.layout === \"grid\" && this.orientation === \"vertical\" && this.direction === \"rtl\";\n const isFlowRtl = this.layout === \"stack\" ? isPrimaryRtl : isSecondaryRtl;\n\n while (low < high) {\n const mid = Math.floor((low + high) / 2);\n const item = allItems[mid];\n const element = elementMap.get(String(item.key));\n if (!element) break;\n const rect = element.getBoundingClientRect();\n const update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRtl);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRtl);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRtl);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRtl);\n } else {\n const target: DropTarget = {\n type: \"item\",\n key: item.key,\n dropPosition: \"on\",\n };\n\n if (isValidDropTarget(target)) {\n if (\n flow <= this.getFlowStart(rect) + 5 &&\n isValidDropTarget({ ...target, dropPosition: \"before\" })\n ) {\n target.dropPosition = isFlowRtl ? \"after\" : \"before\";\n } else if (\n flow >= this.getFlowEnd(rect) - 5 &&\n isValidDropTarget({ ...target, dropPosition: \"after\" })\n ) {\n target.dropPosition = isFlowRtl ? \"before\" : \"after\";\n }\n } else {\n const midpoint = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= midpoint && isValidDropTarget({ ...target, dropPosition: \"before\" })) {\n target.dropPosition = isFlowRtl ? \"after\" : \"before\";\n } else if (flow >= midpoint && isValidDropTarget({ ...target, dropPosition: \"after\" })) {\n target.dropPosition = isFlowRtl ? \"before\" : \"after\";\n }\n }\n\n return target;\n }\n }\n\n const item = allItems[Math.min(low, allItems.length - 1)];\n const element = elementMap.get(String(item.key));\n const rect = element?.getBoundingClientRect();\n if (\n rect &&\n (primary < this.getPrimaryStart(rect) ||\n Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect)))\n ) {\n return {\n type: \"item\",\n key: item.key,\n dropPosition: isFlowRtl ? \"after\" : \"before\",\n };\n }\n\n return {\n type: \"item\",\n key: item.key,\n dropPosition: isFlowRtl ? \"before\" : \"after\",\n };\n }\n}\n","/*\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\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/useDragAndDrop.tsx\n\n/**\n * Drag and drop compatibility hook for collection components.\n *\n * Mirrors RAC's `useDragAndDrop` shape while delegating to Solid\n * state and aria primitives. Based on\n * packages/react-aria-components/src/useDragAndDrop.tsx.\n */\n\nimport type { Accessor } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport { DragPreview } from \"./DragPreview\";\nimport { ListDropTargetDelegate } from \"./ListDropTargetDelegate\";\nimport {\n createDraggableCollection,\n createDraggableItem,\n createDroppableCollection,\n createDroppableItem,\n createDropIndicator,\n isVirtualDragging,\n type DraggableCollectionOptions,\n type DraggableCollectionAria,\n type DraggableItemOptions,\n type DraggableItemAria,\n type DroppableCollectionOptions,\n type DroppableCollectionAria,\n type DroppableItemOptions,\n type DroppableItemAria,\n type DropTargetDelegate as AriaDropTargetDelegate,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createDraggableCollectionState,\n createDroppableCollectionState,\n type DragItem,\n type DragPreviewRenderer,\n type DraggableCollectionProps,\n type DraggableCollectionState,\n type DraggableCollectionStateOptions,\n type DropTarget,\n type DroppableCollectionProps,\n type DroppableCollectionState,\n type DroppableCollectionStateOptions,\n} from \"@proyecto-viviana/solid-stately\";\n\ninterface DraggableCollectionStateOpts<T = object> extends Omit<\n DraggableCollectionStateOptions<T>,\n \"getItems\"\n> {\n items?: T[];\n}\n\ninterface DragHooks<T = object> {\n useDraggableCollectionState?: (\n props: DraggableCollectionStateOpts<T>,\n ) => DraggableCollectionState;\n useDraggableCollection?: (\n props: Omit<DraggableCollectionOptions, \"ref\">,\n state: DraggableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DraggableCollectionAria;\n useDraggableItem?: (\n props: DraggableItemOptions,\n state: DraggableCollectionState,\n ) => DraggableItemAria;\n DragPreview?: typeof DragPreview;\n renderDragPreview?: DragAndDropOptions<T>[\"renderDragPreview\"];\n isVirtualDragging?: () => boolean;\n}\n\ninterface DropHooks {\n useDroppableCollectionState?: (\n props: DroppableCollectionStateOptions,\n ) => DroppableCollectionState;\n useDroppableCollection?: (\n props: Omit<DroppableCollectionOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DroppableCollectionAria;\n useDroppableItem?: (\n options: Omit<DroppableItemOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DroppableItemAria;\n useDropIndicator?: (\n props: { target: DropTarget },\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => {\n dropIndicatorProps: JSX.HTMLAttributes<HTMLElement>;\n isDropTarget: boolean;\n isHidden: boolean;\n };\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n dropTargetDelegate?: AriaDropTargetDelegate;\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 Partial<Omit<DraggableCollectionProps<T>, \"preview\">>, Partial<DroppableCollectionProps> {\n /**\n * A function that returns the items being dragged.\n * If omitted, draggable hooks are not added.\n */\n getItems?: (keys: Set<string | number>, items: T[]) => DragItem[];\n /**\n * Optional custom drag preview renderer.\n */\n renderDragPreview?: (\n items: DragItem[],\n ) => JSX.Element | { element: JSX.Element; x: number; y: number };\n /**\n * Optional drop indicator renderer for collection components.\n */\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n /**\n * Optional custom drop target delegate.\n */\n dropTargetDelegate?: AriaDropTargetDelegate;\n /**\n * Optional drag preview ref.\n */\n preview?: { current: DragPreviewRenderer | null };\n /**\n * Optional item snapshot used by draggable state `getItems`.\n */\n items?: T[];\n /**\n * Disable both drag and drop behavior.\n */\n isDisabled?: boolean;\n}\n\n/**\n * Provides hooks to enable drag-and-drop behavior for collection components.\n */\nexport function useDragAndDrop<T = object>(options: DragAndDropOptions<T> = {}): DragAndDrop<T> {\n const {\n getItems,\n onDrop,\n onInsert,\n onItemDrop,\n onReorder,\n onMove,\n onRootDrop,\n renderDragPreview,\n renderDropIndicator,\n dropTargetDelegate,\n } = options;\n\n const isDraggable = typeof getItems === \"function\";\n const isDroppable = Boolean(\n onDrop || onInsert || onItemDrop || onReorder || onMove || onRootDrop,\n );\n\n const hooks: DragAndDropHooks<T> = {};\n const hasDom = typeof HTMLElement !== \"undefined\";\n const isElementNode = (value: unknown): value is HTMLElement => {\n if (!value) return false;\n if (hasDom && value instanceof HTMLElement) return true;\n return typeof value === \"object\" && (value as { nodeType?: number }).nodeType === 1;\n };\n const resolvedPreview =\n options.preview ??\n (renderDragPreview\n ? {\n current: (\n items: DragItem[],\n callback: (node: HTMLElement | null, x?: number, y?: number) => void,\n ) => {\n const rendered = renderDragPreview(items);\n if (!rendered) {\n callback(null);\n return;\n }\n if (typeof rendered === \"object\" && rendered !== null && \"element\" in rendered) {\n const previewValue = rendered as { element: unknown; x?: number; y?: number };\n callback(\n isElementNode(previewValue.element) ? previewValue.element : null,\n previewValue.x,\n previewValue.y,\n );\n return;\n }\n callback(isElementNode(rendered) ? rendered : null);\n },\n }\n : undefined);\n\n if (isDraggable && getItems) {\n hooks.useDraggableCollectionState = (props: DraggableCollectionStateOpts<T>) => {\n return createDraggableCollectionState<T>(() => ({\n onDragStart: options.onDragStart ?? props.onDragStart,\n onDragMove: options.onDragMove ?? props.onDragMove,\n onDragEnd: options.onDragEnd ?? props.onDragEnd,\n getAllowedDropOperations:\n options.getAllowedDropOperations ?? props.getAllowedDropOperations,\n isDisabled: options.isDisabled ?? props.isDisabled,\n preview: resolvedPreview ?? props.preview,\n getItems: (keys) => {\n const sourceItems = props.items ?? options.items ?? [];\n return getItems(keys, sourceItems);\n },\n collection: props.collection,\n selectedKeys: props.selectedKeys,\n isSelected: props.isSelected,\n }));\n };\n hooks.useDraggableCollection = (\n props: Omit<DraggableCollectionOptions, \"ref\">,\n state: DraggableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => createDraggableCollection({ ...props, ref }, state);\n hooks.useDraggableItem = (props, state) => createDraggableItem(() => props, state);\n hooks.DragPreview = DragPreview;\n hooks.renderDragPreview = renderDragPreview;\n // RAC `useDragAndDrop.tsx:182` `isVirtualDragging` is DragManager's\n // `!!dragSession`, not \"any in-flight pointer keys\".\n hooks.isVirtualDragging = isVirtualDragging;\n }\n\n if (isDroppable) {\n hooks.useDroppableCollectionState = (props: DroppableCollectionStateOptions) => {\n return createDroppableCollectionState(() => ({\n acceptedDragTypes: options.acceptedDragTypes ?? props.acceptedDragTypes,\n getDropOperation: options.getDropOperation ?? props.getDropOperation,\n onDropEnter: options.onDropEnter ?? props.onDropEnter,\n onDropActivate: options.onDropActivate ?? props.onDropActivate,\n onDropExit: options.onDropExit ?? props.onDropExit,\n onDrop: options.onDrop ?? props.onDrop,\n onInsert: options.onInsert ?? props.onInsert,\n onRootDrop: options.onRootDrop ?? props.onRootDrop,\n onItemDrop: options.onItemDrop ?? props.onItemDrop,\n onReorder: options.onReorder ?? props.onReorder,\n onMove: options.onMove ?? props.onMove,\n shouldAcceptItemDrop: options.shouldAcceptItemDrop ?? props.shouldAcceptItemDrop,\n isDisabled: options.isDisabled ?? props.isDisabled,\n collection: props.collection,\n }));\n };\n hooks.useDroppableCollection = (\n props: Omit<DroppableCollectionOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => {\n const acceptedDragTypes = options.acceptedDragTypes ?? props.acceptedDragTypes;\n const normalizedAcceptedDragTypes =\n acceptedDragTypes === \"all\"\n ? \"all\"\n : acceptedDragTypes?.filter(\n (type): type is string | symbol =>\n typeof type === \"string\" || typeof type === \"symbol\",\n );\n return createDroppableCollection(\n () => ({\n ref,\n dropTargetDelegate: options.dropTargetDelegate ?? props.dropTargetDelegate,\n keyboardDelegate: props.keyboardDelegate,\n // Host collection + selection/focus setters, forwarded so keyboard\n // drop-target navigation and post-drop focus restoration work.\n collection: props.collection,\n selectedKeys: props.selectedKeys,\n setSelectedKeys: props.setSelectedKeys,\n setFocusedKey: props.setFocusedKey,\n setFocused: props.setFocused,\n onKeyDown: props.onKeyDown,\n acceptedDragTypes: normalizedAcceptedDragTypes,\n isDisabled: options.isDisabled ?? props.isDisabled,\n onDropActivate: (e) => {\n (options.onDropActivate ?? props.onDropActivate)?.({\n type: \"dropactivate\",\n target: e.target,\n x: e.x,\n y: e.y,\n });\n },\n onDrop: (e) => {\n (options.onDrop ?? props.onDrop)?.({\n type: \"drop\",\n target: e.target,\n x: e.x,\n y: e.y,\n items: e.items,\n dropOperation: e.dropOperation,\n });\n },\n onRootDrop: options.onRootDrop ?? props.onRootDrop,\n onItemDrop: (e) => {\n if (e.target.type === \"item\") {\n (options.onItemDrop ?? props.onItemDrop)?.({\n items: e.items,\n target: e.target,\n dropOperation: e.dropOperation,\n isInternal: e.isInternal,\n });\n }\n },\n onInsert: (e) => {\n if (e.target.type === \"item\") {\n (options.onInsert ?? props.onInsert)?.({\n items: e.items,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n onReorder: (e) => {\n if (e.target.type === \"item\") {\n (options.onReorder ?? props.onReorder)?.({\n keys: e.keys,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n onMove: (e) => {\n if (e.target.type === \"item\") {\n (options.onMove ?? props.onMove)?.({\n keys: e.keys,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n }),\n state,\n );\n };\n hooks.useDroppableItem = (\n props: Omit<DroppableItemOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => createDroppableItem(() => ({ ...props, ref }), state);\n // RAC `useDragAndDrop.tsx:203` `hooks.useDropIndicator = useDropIndicator`.\n hooks.useDropIndicator = (props, state, ref) => createDropIndicator(props, state, ref);\n hooks.renderDropIndicator = renderDropIndicator;\n hooks.dropTargetDelegate = dropTargetDelegate;\n hooks.ListDropTargetDelegate = ListDropTargetDelegate;\n }\n\n return {\n dragAndDropHooks: hooks,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,YAAY,OAAsC;CAChE,MAAM,SAAS,OAAO,gBAAgB;CACtC,MAAM,iBAAiB,UAAyC;EAC9D,IAAI,CAAC,OAAO,OAAO;EACnB,IAAI,UAAU,iBAAiB,aAAa,OAAO;EACnD,OAAO,OAAO,UAAU,YAAa,MAAgC,aAAa;CACpF;CAEA,IAAI,MAAM,KAAK;EACb,MAAM,YAAiC,OAAO,aAAa;GACzD,MAAM,WAAW,MAAM,SAAS,KAAK;GACrC,IAAI,CAAC,UAAU;IACb,SAAS,IAAI;IACb;GACF;GACA,IAAI,OAAO,aAAa,YAAY,aAAa,QAAQ,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QAAQ,cAAc,MAAM,WAAA,GAAc;MACzC,OAAO,EAAE;MACT,QAAQ,EAAE;MACV,eAAe,EAAE;MACjB,YAAY,EAAE;KAChB,CAAC;IAEL;IACA,WAAW,MAAM;KACf,IAAI,EAAE,OAAO,SAAS,QACpB,CAAC,QAAQ,YAAY,MAAM,SAAA,GAAY;MACrC,OAAO,EAAE;MACT,QAAQ,EAAE;MACV,eAAe,EAAE;KACnB,CAAC;IAEL;IACA,YAAY,MAAM;KAChB,IAAI,EAAE,OAAO,SAAS,QACpB,CAAC,QAAQ,aAAa,MAAM,UAAA,GAAa;MACvC,MAAM,EAAE;MACR,QAAQ,EAAE;MACV,eAAe,EAAE;KACnB,CAAC;IAEL;IACA,SAAS,MAAM;KACb,IAAI,EAAE,OAAO,SAAS,QACpB,CAAC,QAAQ,UAAU,MAAM,OAAA,GAAU;MACjC,MAAM,EAAE;MACR,QAAQ,EAAE;MACV,eAAe,EAAE;KACnB,CAAC;IAEL;GACF,IACA,KACF;EACF;EACA,MAAM,oBACJ,OACA,OACA,QACG,2BAA2B;GAAE,GAAG;GAAO;EAAI,IAAI,KAAK;EAEzD,MAAM,oBAAoB,OAAO,OAAO,QAAQ,oBAAoB,OAAO,OAAO,GAAG;EACrF,MAAM,sBAAsB;EAC5B,MAAM,qBAAqB;EAC3B,MAAM,yBAAyB;CACjC;CAEA,OAAO,EACL,kBAAkB,MACpB;AACF"}
@@ -1,7 +1,34 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-aria/src/dnd/DragPreview.tsx
13
+ /*
14
+ * Copyright 2022 Adobe. All rights reserved.
15
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
16
+ * you may not use this file except in compliance with the License. You may obtain a copy
17
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
18
+ *
19
+ * Unless required by applicable law or agreed to in writing, software distributed under
20
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21
+ * OF ANY KIND, either express or implied. See the License for the specific language
22
+ * governing permissions and limitations under the License.
23
+ */
24
+ // Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/useDragAndDrop.tsx
1
25
  import { onCleanup } from "solid-js";
2
- import { createDraggableCollection, createDraggableItem, createDroppableCollection, createDroppableItem, getGlobalDraggingCollectionRef, getGlobalDraggingKeys } from "@proyecto-viviana/solidaria";
26
+ import { createDraggableCollection, createDraggableItem, createDropIndicator, createDroppableCollection, createDroppableItem, isVirtualDragging } from "@proyecto-viviana/solidaria";
3
27
  import { createDraggableCollectionState, createDroppableCollectionState } from "@proyecto-viviana/solid-stately";
4
28
  //#region src/DragPreview.tsx
29
+ /**
30
+ * Based on packages/react-aria/src/dnd/DragPreview.tsx.
31
+ */
5
32
  function DragPreview(props) {
6
33
  const hasDom = typeof HTMLElement !== "undefined";
7
34
  const isElementNode = (value) => {
@@ -272,8 +299,12 @@ function useDragAndDrop(options = {}) {
272
299
  isDisabled: options.isDisabled ?? props.isDisabled,
273
300
  preview: resolvedPreview ?? props.preview,
274
301
  getItems: (keys) => {
275
- return getItems(keys, props.items ?? options.items ?? []);
276
- }
302
+ const sourceItems = props.items ?? options.items ?? [];
303
+ return getItems(keys, sourceItems);
304
+ },
305
+ collection: props.collection,
306
+ selectedKeys: props.selectedKeys,
307
+ isSelected: props.isSelected
277
308
  }));
278
309
  };
279
310
  hooks.useDraggableCollection = (props, state, ref) => createDraggableCollection({
@@ -283,7 +314,7 @@ function useDragAndDrop(options = {}) {
283
314
  hooks.useDraggableItem = (props, state) => createDraggableItem(() => props, state);
284
315
  hooks.DragPreview = DragPreview;
285
316
  hooks.renderDragPreview = renderDragPreview;
286
- hooks.isVirtualDragging = () => getGlobalDraggingCollectionRef() != null || getGlobalDraggingKeys().size > 0;
317
+ hooks.isVirtualDragging = isVirtualDragging;
287
318
  }
288
319
  if (isDroppable) {
289
320
  hooks.useDroppableCollectionState = (props) => {
@@ -300,7 +331,8 @@ function useDragAndDrop(options = {}) {
300
331
  onReorder: options.onReorder ?? props.onReorder,
301
332
  onMove: options.onMove ?? props.onMove,
302
333
  shouldAcceptItemDrop: options.shouldAcceptItemDrop ?? props.shouldAcceptItemDrop,
303
- isDisabled: options.isDisabled ?? props.isDisabled
334
+ isDisabled: options.isDisabled ?? props.isDisabled,
335
+ collection: props.collection
304
336
  }));
305
337
  };
306
338
  hooks.useDroppableCollection = (props, state, ref) => {
@@ -314,6 +346,7 @@ function useDragAndDrop(options = {}) {
314
346
  selectedKeys: props.selectedKeys,
315
347
  setSelectedKeys: props.setSelectedKeys,
316
348
  setFocusedKey: props.setFocusedKey,
349
+ setFocused: props.setFocused,
317
350
  onKeyDown: props.onKeyDown,
318
351
  acceptedDragTypes: normalizedAcceptedDragTypes,
319
352
  isDisabled: options.isDisabled ?? props.isDisabled,
@@ -371,22 +404,7 @@ function useDragAndDrop(options = {}) {
371
404
  ...props,
372
405
  ref
373
406
  }), state);
374
- hooks.useDropIndicator = (props, state, _ref) => {
375
- const target = props.target;
376
- const activeTarget = state.target;
377
- const isDropTarget = activeTarget?.type === target.type && (target.type === "root" || activeTarget.type === "item" && target.type === "item" && activeTarget.key === target.key && activeTarget.dropPosition === target.dropPosition);
378
- return {
379
- dropIndicatorProps: {
380
- role: "option",
381
- "aria-disabled": true,
382
- "aria-hidden": isDropTarget ? void 0 : "true",
383
- tabIndex: -1,
384
- "data-drop-target": isDropTarget ? "" : void 0
385
- },
386
- isDropTarget,
387
- isHidden: !isDropTarget
388
- };
389
- };
407
+ hooks.useDropIndicator = (props, state, ref) => createDropIndicator(props, state, ref);
390
408
  hooks.renderDropIndicator = renderDropIndicator;
391
409
  hooks.dropTargetDelegate = dropTargetDelegate;
392
410
  hooks.ListDropTargetDelegate = ListDropTargetDelegate;
@@ -1 +1 @@
1
- {"version":3,"file":"useDragAndDrop2.jsx","names":[],"sources":["../src/DragPreview.tsx","../src/ListDropTargetDelegate.ts","../src/useDragAndDrop.ts"],"sourcesContent":["import { onCleanup, type JSX } from \"solid-js\";\nimport type { DragItem, DragPreviewRenderer } from \"@proyecto-viviana/solid-stately\";\n\nexport interface DragPreviewProps {\n ref?: { current: DragPreviewRenderer | null };\n children: (\n items: DragItem[],\n ) => JSX.Element | { element: JSX.Element; x?: number; y?: number } | null | undefined;\n}\n\nexport function DragPreview(props: DragPreviewProps): JSX.Element {\n const hasDom = typeof HTMLElement !== \"undefined\";\n const isElementNode = (value: unknown): value is HTMLElement => {\n if (!value) return false;\n if (hasDom && value instanceof HTMLElement) return true;\n return typeof value === \"object\" && (value as { nodeType?: number }).nodeType === 1;\n };\n\n if (props.ref) {\n const renderer: DragPreviewRenderer = (items, callback) => {\n const rendered = props.children(items);\n if (!rendered) {\n callback(null);\n return;\n }\n if (typeof rendered === \"object\" && rendered !== null && \"element\" in rendered) {\n const previewValue = rendered as { element: unknown; x?: number; y?: number };\n callback(\n isElementNode(previewValue.element) ? previewValue.element : null,\n previewValue.x,\n previewValue.y,\n );\n return;\n }\n callback(isElementNode(rendered) ? rendered : null);\n };\n\n props.ref.current = renderer;\n onCleanup(() => {\n if (props.ref?.current === renderer) {\n props.ref.current = null;\n }\n });\n }\n\n return null as unknown as JSX.Element;\n}\n","import type { Accessor } from \"solid-js\";\nimport type { DropTarget } from \"@proyecto-viviana/solid-stately\";\n\ntype Direction = \"ltr\" | \"rtl\";\ntype Orientation = \"horizontal\" | \"vertical\";\ntype Layout = \"stack\" | \"grid\";\n\ninterface CollectionNodeLike {\n key: string | number;\n type?: string;\n}\n\nexport interface ListDropTargetDelegateOptions {\n layout?: Layout;\n orientation?: Orientation;\n direction?: Direction;\n}\n\nconst cssEscape = (value: string): string => {\n const css = (globalThis as { CSS?: { escape?: (input: string) => string } }).CSS;\n return css?.escape ? css.escape(value) : value.replace(/[^a-zA-Z0-9_-]/g, \"\\\\$&\");\n};\n\nexport class ListDropTargetDelegate {\n private collection: Iterable<CollectionNodeLike> | (() => Iterable<CollectionNodeLike>);\n private ref: Accessor<HTMLElement | null>;\n private layout: Layout;\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(\n collection: Iterable<CollectionNodeLike> | (() => Iterable<CollectionNodeLike>),\n ref: Accessor<HTMLElement | null>,\n options?: ListDropTargetDelegateOptions,\n ) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout ?? \"stack\";\n this.orientation = options?.orientation ?? \"vertical\";\n this.direction = options?.direction ?? \"ltr\";\n }\n\n private getCollection(): Iterable<CollectionNodeLike> {\n return typeof this.collection === \"function\"\n ? (this.collection as () => Iterable<CollectionNodeLike>)()\n : this.collection;\n }\n\n private getPrimaryStart(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect): number {\n return this.layout === \"stack\" ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect): number {\n return this.layout === \"stack\" ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect): number {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n private getItemKeys(): Array<string | number> {\n return [...this.getCollection()].filter((item) => item.type === \"item\").map((item) => item.key);\n }\n\n private resolveBoundaryTarget(\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n const keys = this.getItemKeys();\n if (keys.length === 0) return null;\n const key = direction === \"next\" ? keys[0] : keys[keys.length - 1];\n const order: Array<\"before\" | \"on\" | \"after\"> =\n direction === \"next\" ? [\"before\", \"on\", \"after\"] : [\"after\", \"on\", \"before\"];\n for (const dropPosition of order) {\n const target: DropTarget = { type: \"item\", key, dropPosition };\n if (isValidDropTarget(target)) return target;\n }\n return null;\n }\n\n private resolveTransitionTarget(\n target: DropTarget,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (target.type !== \"item\") return null;\n const tryPosition = (dropPosition: \"before\" | \"on\" | \"after\"): DropTarget | null => {\n if (target.dropPosition === dropPosition) return null;\n const nextTarget: DropTarget = {\n type: \"item\",\n key: target.key,\n dropPosition,\n };\n return isValidDropTarget(nextTarget) ? nextTarget : null;\n };\n\n if (direction === \"next\") {\n if (target.dropPosition === \"before\") {\n return tryPosition(\"on\") ?? tryPosition(\"after\");\n }\n if (target.dropPosition === \"on\") {\n return tryPosition(\"after\");\n }\n } else {\n if (target.dropPosition === \"after\") {\n return tryPosition(\"on\") ?? tryPosition(\"before\");\n }\n if (target.dropPosition === \"on\") {\n return tryPosition(\"before\");\n }\n }\n\n return null;\n }\n\n private resolveNeighborTarget(\n target: DropTarget,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (target.type !== \"item\") return null;\n const keys = this.getItemKeys();\n const index = keys.findIndex((key) => key === target.key);\n if (index < 0) return this.resolveBoundaryTarget(direction, isValidDropTarget);\n const nextIndex = direction === \"next\" ? index + 1 : index - 1;\n if (nextIndex < 0 || nextIndex >= keys.length) {\n const rootTarget: DropTarget = { type: \"root\" };\n return isValidDropTarget(rootTarget) ? rootTarget : null;\n }\n const key = keys[nextIndex];\n const order: Array<\"on\" | \"before\" | \"after\"> =\n direction === \"next\" ? [\"on\", \"before\", \"after\"] : [\"on\", \"after\", \"before\"];\n for (const dropPosition of order) {\n const nextTarget: DropTarget = { type: \"item\", key, dropPosition };\n if (isValidDropTarget(nextTarget)) return nextTarget;\n }\n return null;\n }\n\n getKeyboardNavigationTarget(\n target: DropTarget | null,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (!target || target.type === \"root\") {\n return this.resolveBoundaryTarget(direction, isValidDropTarget);\n }\n const transition = this.resolveTransitionTarget(target, direction, isValidDropTarget);\n if (transition) return transition;\n return this.resolveNeighborTarget(target, direction, isValidDropTarget);\n }\n\n getDropTargetFromPoint(\n x: number,\n y: number,\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget {\n const root = this.ref();\n if (!root) {\n return { type: \"root\" };\n }\n\n const allItems = [...this.getCollection()].filter((item) => item.type === \"item\");\n if (allItems.length === 0) {\n return { type: \"root\" };\n }\n\n const collectionId = root.dataset.collection;\n const selector = collectionId ? `[data-collection=\"${cssEscape(collectionId)}\"]` : \"[data-key]\";\n const elements = root.querySelectorAll(selector);\n const elementMap = new Map<string, HTMLElement>();\n for (const node of elements) {\n if (node instanceof HTMLElement && node.dataset.key != null) {\n elementMap.set(node.dataset.key, node);\n }\n }\n\n let low = 0;\n let high = allItems.length;\n const rootRect = root.getBoundingClientRect();\n let primary = this.orientation === \"horizontal\" ? x : y;\n let secondary = this.orientation === \"horizontal\" ? y : x;\n primary += this.getPrimaryStart(rootRect);\n secondary += this.getSecondaryStart(rootRect);\n\n const flow = this.layout === \"stack\" ? primary : secondary;\n const isPrimaryRtl = this.orientation === \"horizontal\" && this.direction === \"rtl\";\n const isSecondaryRtl =\n this.layout === \"grid\" && this.orientation === \"vertical\" && this.direction === \"rtl\";\n const isFlowRtl = this.layout === \"stack\" ? isPrimaryRtl : isSecondaryRtl;\n\n while (low < high) {\n const mid = Math.floor((low + high) / 2);\n const item = allItems[mid];\n const element = elementMap.get(String(item.key));\n if (!element) break;\n const rect = element.getBoundingClientRect();\n const update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRtl);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRtl);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRtl);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRtl);\n } else {\n const target: DropTarget = {\n type: \"item\",\n key: item.key,\n dropPosition: \"on\",\n };\n\n if (isValidDropTarget(target)) {\n if (\n flow <= this.getFlowStart(rect) + 5 &&\n isValidDropTarget({ ...target, dropPosition: \"before\" })\n ) {\n target.dropPosition = isFlowRtl ? \"after\" : \"before\";\n } else if (\n flow >= this.getFlowEnd(rect) - 5 &&\n isValidDropTarget({ ...target, dropPosition: \"after\" })\n ) {\n target.dropPosition = isFlowRtl ? \"before\" : \"after\";\n }\n } else {\n const midpoint = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= midpoint && isValidDropTarget({ ...target, dropPosition: \"before\" })) {\n target.dropPosition = isFlowRtl ? \"after\" : \"before\";\n } else if (flow >= midpoint && isValidDropTarget({ ...target, dropPosition: \"after\" })) {\n target.dropPosition = isFlowRtl ? \"before\" : \"after\";\n }\n }\n\n return target;\n }\n }\n\n const item = allItems[Math.min(low, allItems.length - 1)];\n const element = elementMap.get(String(item.key));\n const rect = element?.getBoundingClientRect();\n if (\n rect &&\n (primary < this.getPrimaryStart(rect) ||\n Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect)))\n ) {\n return {\n type: \"item\",\n key: item.key,\n dropPosition: isFlowRtl ? \"after\" : \"before\",\n };\n }\n\n return {\n type: \"item\",\n key: item.key,\n dropPosition: isFlowRtl ? \"before\" : \"after\",\n };\n }\n}\n","/**\n * Drag and drop compatibility hook for collection components.\n *\n * Mirrors RAC's `useDragAndDrop` shape while delegating to Solid\n * state and aria primitives.\n */\n\nimport type { Accessor, JSX } from \"solid-js\";\nimport { DragPreview } from \"./DragPreview\";\nimport { ListDropTargetDelegate } from \"./ListDropTargetDelegate\";\nimport {\n createDraggableCollection,\n createDraggableItem,\n createDroppableCollection,\n createDroppableItem,\n getGlobalDraggingCollectionRef,\n getGlobalDraggingKeys,\n type DraggableCollectionOptions,\n type DraggableCollectionAria,\n type DraggableItemOptions,\n type DraggableItemAria,\n type DroppableCollectionOptions,\n type DroppableCollectionAria,\n type DroppableItemOptions,\n type DroppableItemAria,\n type DropTargetDelegate as AriaDropTargetDelegate,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createDraggableCollectionState,\n createDroppableCollectionState,\n type DragItem,\n type DragPreviewRenderer,\n type DraggableCollectionProps,\n type DraggableCollectionState,\n type DraggableCollectionStateOptions,\n type DropTarget,\n type DroppableCollectionProps,\n type DroppableCollectionState,\n type DroppableCollectionStateOptions,\n} from \"@proyecto-viviana/solid-stately\";\n\ninterface DraggableCollectionStateOpts<T = object> extends Omit<\n DraggableCollectionStateOptions<T>,\n \"getItems\"\n> {\n items?: T[];\n}\n\ninterface DragHooks<T = object> {\n useDraggableCollectionState?: (\n props: DraggableCollectionStateOpts<T>,\n ) => DraggableCollectionState;\n useDraggableCollection?: (\n props: Omit<DraggableCollectionOptions, \"ref\">,\n state: DraggableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DraggableCollectionAria;\n useDraggableItem?: (\n props: DraggableItemOptions,\n state: DraggableCollectionState,\n ) => DraggableItemAria;\n DragPreview?: typeof DragPreview;\n renderDragPreview?: DragAndDropOptions<T>[\"renderDragPreview\"];\n isVirtualDragging?: () => boolean;\n}\n\ninterface DropHooks {\n useDroppableCollectionState?: (\n props: DroppableCollectionStateOptions,\n ) => DroppableCollectionState;\n useDroppableCollection?: (\n props: Omit<DroppableCollectionOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DroppableCollectionAria;\n useDroppableItem?: (\n options: Omit<DroppableItemOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DroppableItemAria;\n useDropIndicator?: (\n props: { target: DropTarget },\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => {\n dropIndicatorProps: JSX.HTMLAttributes<HTMLElement>;\n isDropTarget: boolean;\n isHidden: boolean;\n };\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n dropTargetDelegate?: AriaDropTargetDelegate;\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 Partial<Omit<DraggableCollectionProps<T>, \"preview\">>, Partial<DroppableCollectionProps> {\n /**\n * A function that returns the items being dragged.\n * If omitted, draggable hooks are not added.\n */\n getItems?: (keys: Set<string | number>, items: T[]) => DragItem[];\n /**\n * Optional custom drag preview renderer.\n */\n renderDragPreview?: (\n items: DragItem[],\n ) => JSX.Element | { element: JSX.Element; x: number; y: number };\n /**\n * Optional drop indicator renderer for collection components.\n */\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n /**\n * Optional custom drop target delegate.\n */\n dropTargetDelegate?: AriaDropTargetDelegate;\n /**\n * Optional drag preview ref.\n */\n preview?: { current: DragPreviewRenderer | null };\n /**\n * Optional item snapshot used by draggable state `getItems`.\n */\n items?: T[];\n /**\n * Disable both drag and drop behavior.\n */\n isDisabled?: boolean;\n}\n\n/**\n * Provides hooks to enable drag-and-drop behavior for collection components.\n */\nexport function useDragAndDrop<T = object>(options: DragAndDropOptions<T> = {}): DragAndDrop<T> {\n const {\n getItems,\n onDrop,\n onInsert,\n onItemDrop,\n onReorder,\n onMove,\n onRootDrop,\n renderDragPreview,\n renderDropIndicator,\n dropTargetDelegate,\n } = options;\n\n const isDraggable = typeof getItems === \"function\";\n const isDroppable = Boolean(\n onDrop || onInsert || onItemDrop || onReorder || onMove || onRootDrop,\n );\n\n const hooks: DragAndDropHooks<T> = {};\n const hasDom = typeof HTMLElement !== \"undefined\";\n const isElementNode = (value: unknown): value is HTMLElement => {\n if (!value) return false;\n if (hasDom && value instanceof HTMLElement) return true;\n return typeof value === \"object\" && (value as { nodeType?: number }).nodeType === 1;\n };\n const resolvedPreview =\n options.preview ??\n (renderDragPreview\n ? {\n current: (\n items: DragItem[],\n callback: (node: HTMLElement | null, x?: number, y?: number) => void,\n ) => {\n const rendered = renderDragPreview(items);\n if (!rendered) {\n callback(null);\n return;\n }\n if (typeof rendered === \"object\" && rendered !== null && \"element\" in rendered) {\n const previewValue = rendered as { element: unknown; x?: number; y?: number };\n callback(\n isElementNode(previewValue.element) ? previewValue.element : null,\n previewValue.x,\n previewValue.y,\n );\n return;\n }\n callback(isElementNode(rendered) ? rendered : null);\n },\n }\n : undefined);\n\n if (isDraggable && getItems) {\n hooks.useDraggableCollectionState = (props: DraggableCollectionStateOpts<T>) => {\n return createDraggableCollectionState<T>(() => ({\n onDragStart: options.onDragStart ?? props.onDragStart,\n onDragMove: options.onDragMove ?? props.onDragMove,\n onDragEnd: options.onDragEnd ?? props.onDragEnd,\n getAllowedDropOperations:\n options.getAllowedDropOperations ?? props.getAllowedDropOperations,\n isDisabled: options.isDisabled ?? props.isDisabled,\n preview: resolvedPreview ?? props.preview,\n getItems: (keys) => {\n const sourceItems = props.items ?? options.items ?? [];\n return getItems(keys, sourceItems);\n },\n }));\n };\n hooks.useDraggableCollection = (\n props: Omit<DraggableCollectionOptions, \"ref\">,\n state: DraggableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => createDraggableCollection({ ...props, ref }, state);\n hooks.useDraggableItem = (props, state) => createDraggableItem(() => props, state);\n hooks.DragPreview = DragPreview;\n hooks.renderDragPreview = renderDragPreview;\n hooks.isVirtualDragging = () =>\n getGlobalDraggingCollectionRef() != null || getGlobalDraggingKeys().size > 0;\n }\n\n if (isDroppable) {\n hooks.useDroppableCollectionState = (props: DroppableCollectionStateOptions) => {\n return createDroppableCollectionState(() => ({\n acceptedDragTypes: options.acceptedDragTypes ?? props.acceptedDragTypes,\n getDropOperation: options.getDropOperation ?? props.getDropOperation,\n onDropEnter: options.onDropEnter ?? props.onDropEnter,\n onDropActivate: options.onDropActivate ?? props.onDropActivate,\n onDropExit: options.onDropExit ?? props.onDropExit,\n onDrop: options.onDrop ?? props.onDrop,\n onInsert: options.onInsert ?? props.onInsert,\n onRootDrop: options.onRootDrop ?? props.onRootDrop,\n onItemDrop: options.onItemDrop ?? props.onItemDrop,\n onReorder: options.onReorder ?? props.onReorder,\n onMove: options.onMove ?? props.onMove,\n shouldAcceptItemDrop: options.shouldAcceptItemDrop ?? props.shouldAcceptItemDrop,\n isDisabled: options.isDisabled ?? props.isDisabled,\n }));\n };\n hooks.useDroppableCollection = (\n props: Omit<DroppableCollectionOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => {\n const acceptedDragTypes = options.acceptedDragTypes ?? props.acceptedDragTypes;\n const normalizedAcceptedDragTypes =\n acceptedDragTypes === \"all\"\n ? \"all\"\n : acceptedDragTypes?.filter(\n (type): type is string | symbol =>\n typeof type === \"string\" || typeof type === \"symbol\",\n );\n return createDroppableCollection(\n () => ({\n ref,\n dropTargetDelegate: options.dropTargetDelegate ?? props.dropTargetDelegate,\n keyboardDelegate: props.keyboardDelegate,\n // Host collection + selection/focus setters, forwarded so keyboard\n // drop-target navigation and post-drop focus restoration work.\n collection: props.collection,\n selectedKeys: props.selectedKeys,\n setSelectedKeys: props.setSelectedKeys,\n setFocusedKey: props.setFocusedKey,\n onKeyDown: props.onKeyDown,\n acceptedDragTypes: normalizedAcceptedDragTypes,\n isDisabled: options.isDisabled ?? props.isDisabled,\n onDropActivate: (e) => {\n (options.onDropActivate ?? props.onDropActivate)?.({\n type: \"dropactivate\",\n target: e.target,\n x: e.x,\n y: e.y,\n });\n },\n onDrop: (e) => {\n (options.onDrop ?? props.onDrop)?.({\n type: \"drop\",\n target: e.target,\n x: e.x,\n y: e.y,\n items: e.items,\n dropOperation: e.dropOperation,\n });\n },\n onRootDrop: options.onRootDrop ?? props.onRootDrop,\n onItemDrop: (e) => {\n if (e.target.type === \"item\") {\n (options.onItemDrop ?? props.onItemDrop)?.({\n items: e.items,\n target: e.target,\n dropOperation: e.dropOperation,\n isInternal: e.isInternal,\n });\n }\n },\n onInsert: (e) => {\n if (e.target.type === \"item\") {\n (options.onInsert ?? props.onInsert)?.({\n items: e.items,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n onReorder: (e) => {\n if (e.target.type === \"item\") {\n (options.onReorder ?? props.onReorder)?.({\n keys: e.keys,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n onMove: (e) => {\n if (e.target.type === \"item\") {\n (options.onMove ?? props.onMove)?.({\n keys: e.keys,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n }),\n state,\n );\n };\n hooks.useDroppableItem = (\n props: Omit<DroppableItemOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => createDroppableItem(() => ({ ...props, ref }), state);\n hooks.useDropIndicator = (\n props: { target: DropTarget },\n state: DroppableCollectionState,\n _ref: Accessor<HTMLElement | null>,\n ) => {\n const target = props.target;\n const activeTarget = state.target;\n const isDropTarget =\n activeTarget?.type === target.type &&\n (target.type === \"root\" ||\n (activeTarget.type === \"item\" &&\n target.type === \"item\" &&\n activeTarget.key === target.key &&\n activeTarget.dropPosition === target.dropPosition));\n return {\n dropIndicatorProps: {\n role: \"option\",\n \"aria-disabled\": true,\n \"aria-hidden\": isDropTarget ? undefined : \"true\",\n tabIndex: -1,\n \"data-drop-target\": isDropTarget ? \"\" : undefined,\n },\n isDropTarget,\n isHidden: !isDropTarget,\n };\n };\n hooks.renderDropIndicator = renderDropIndicator;\n hooks.dropTargetDelegate = dropTargetDelegate;\n hooks.ListDropTargetDelegate = ListDropTargetDelegate;\n }\n\n return {\n dragAndDropHooks: hooks,\n };\n}\n"],"mappings":";;;;AAUA,SAAgB,YAAY,OAAsC;CAChE,MAAM,SAAS,OAAO,gBAAgB;CACtC,MAAM,iBAAiB,UAAyC;EAC9D,IAAI,CAAC,OAAO,OAAO;EACnB,IAAI,UAAU,iBAAiB,aAAa,OAAO;EACnD,OAAO,OAAO,UAAU,YAAa,MAAgC,aAAa;CACpF;CAEA,IAAI,MAAM,KAAK;EACb,MAAM,YAAiC,OAAO,aAAa;GACzD,MAAM,WAAW,MAAM,SAAS,KAAK;GACrC,IAAI,CAAC,UAAU;IACb,SAAS,IAAI;IACb;GACF;GACA,IAAI,OAAO,aAAa,YAAY,aAAa,QAAQ,aAAa,UAAU;IAC9E,MAAM,eAAe;IACrB,SACE,cAAc,aAAa,OAAO,IAAI,aAAa,UAAU,MAC7D,aAAa,GACb,aAAa,CACf;IACA;GACF;GACA,SAAS,cAAc,QAAQ,IAAI,WAAW,IAAI;EACpD;EAEA,MAAM,IAAI,UAAU;EACpB,gBAAgB;GACd,IAAI,MAAM,KAAK,YAAY,UACzB,MAAM,IAAI,UAAU;EAExB,CAAC;CACH;CAEA,OAAO;AACT;;;AC5BA,MAAM,aAAa,UAA0B;CAC3C,MAAM,MAAO,WAAgE;CAC7E,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,MAAM,QAAQ,mBAAmB,MAAM;AAClF;AAEA,IAAa,yBAAb,MAAoC;CAClC;CACA;CACA;CACA;CACA;CAEA,YACE,YACA,KACA,SACA;EACA,KAAK,aAAa;EAClB,KAAK,MAAM;EACX,KAAK,SAAS,SAAS,UAAU;EACjC,KAAK,cAAc,SAAS,eAAe;EAC3C,KAAK,YAAY,SAAS,aAAa;CACzC;CAEA,gBAAsD;EACpD,OAAO,OAAO,KAAK,eA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AM;GACrB,MAAM,eAAe,MAAM;GAC3B,MAAM,eACJ,cAAc,SAAS,OAAO,SAC7B,OAAO,SAAS,UACd,aAAa,SAAS,UACrB,OAAO,SAAS,UAChB,aAAa,QAAQ,OAAO,OAC5B,aAAa,iBAAiB,OAAO;GAC3C,OAAO;IACL,oBAAoB;KAClB,MAAM;KACN,iBAAiB;KACjB,eAAe,eAAe,KAAA,IAAY;KAC1C,UAAU;KACV,oBAAoB,eAAe,KAAK,KAAA;IAC1C;IACA;IACA,UAAU,CAAC;GACb;EACF;EACA,MAAM,sBAAsB;EAC5B,MAAM,qBAAqB;EAC3B,MAAM,yBAAyB;CACjC;CAEA,OAAO,EACL,kBAAkB,MACpB;AACF"}
1
+ {"version":3,"file":"useDragAndDrop2.jsx","names":[],"sources":["../src/DragPreview.tsx","../src/ListDropTargetDelegate.ts","../src/useDragAndDrop.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria/src/dnd/DragPreview.tsx\n\n/**\n * Based on packages/react-aria/src/dnd/DragPreview.tsx.\n */\n\nimport { onCleanup } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport type { DragItem, DragPreviewRenderer } from \"@proyecto-viviana/solid-stately\";\n\nexport interface DragPreviewProps {\n ref?: { current: DragPreviewRenderer | null };\n children: (\n items: DragItem[],\n ) => JSX.Element | { element: JSX.Element; x?: number; y?: number } | null | undefined;\n}\n\nexport function DragPreview(props: DragPreviewProps): JSX.Element {\n const hasDom = typeof HTMLElement !== \"undefined\";\n const isElementNode = (value: unknown): value is HTMLElement => {\n if (!value) return false;\n if (hasDom && value instanceof HTMLElement) return true;\n return typeof value === \"object\" && (value as { nodeType?: number }).nodeType === 1;\n };\n\n if (props.ref) {\n const renderer: DragPreviewRenderer = (items, callback) => {\n const rendered = props.children(items);\n if (!rendered) {\n callback(null);\n return;\n }\n if (typeof rendered === \"object\" && rendered !== null && \"element\" in rendered) {\n const previewValue = rendered as { element: unknown; x?: number; y?: number };\n callback(\n isElementNode(previewValue.element) ? previewValue.element : null,\n previewValue.x,\n previewValue.y,\n );\n return;\n }\n callback(isElementNode(rendered) ? rendered : null);\n };\n\n props.ref.current = renderer;\n onCleanup(() => {\n if (props.ref?.current === renderer) {\n props.ref.current = null;\n }\n });\n }\n\n return null as unknown as JSX.Element;\n}\n","/**\n * Based on packages/react-aria/src/dnd/ListDropTargetDelegate.ts.\n */\n\nimport type { Accessor } from \"solid-js\";\nimport type { DropTarget } from \"@proyecto-viviana/solid-stately\";\n\ntype Direction = \"ltr\" | \"rtl\";\ntype Orientation = \"horizontal\" | \"vertical\";\ntype Layout = \"stack\" | \"grid\";\n\ninterface CollectionNodeLike {\n key: string | number;\n type?: string;\n}\n\nexport interface ListDropTargetDelegateOptions {\n layout?: Layout;\n orientation?: Orientation;\n direction?: Direction;\n}\n\nconst cssEscape = (value: string): string => {\n const css = (globalThis as { CSS?: { escape?: (input: string) => string } }).CSS;\n return css?.escape ? css.escape(value) : value.replace(/[^a-zA-Z0-9_-]/g, \"\\\\$&\");\n};\n\nexport class ListDropTargetDelegate {\n private collection: Iterable<CollectionNodeLike> | (() => Iterable<CollectionNodeLike>);\n private ref: Accessor<HTMLElement | null>;\n private layout: Layout;\n private orientation: Orientation;\n private direction: Direction;\n\n constructor(\n collection: Iterable<CollectionNodeLike> | (() => Iterable<CollectionNodeLike>),\n ref: Accessor<HTMLElement | null>,\n options?: ListDropTargetDelegateOptions,\n ) {\n this.collection = collection;\n this.ref = ref;\n this.layout = options?.layout ?? \"stack\";\n this.orientation = options?.orientation ?? \"vertical\";\n this.direction = options?.direction ?? \"ltr\";\n }\n\n private getCollection(): Iterable<CollectionNodeLike> {\n return typeof this.collection === \"function\"\n ? (this.collection as () => Iterable<CollectionNodeLike>)()\n : this.collection;\n }\n\n private getPrimaryStart(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.left : rect.top;\n }\n\n private getPrimaryEnd(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.right : rect.bottom;\n }\n\n private getSecondaryStart(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.top : rect.left;\n }\n\n private getSecondaryEnd(rect: DOMRect): number {\n return this.orientation === \"horizontal\" ? rect.bottom : rect.right;\n }\n\n private getFlowStart(rect: DOMRect): number {\n return this.layout === \"stack\" ? this.getPrimaryStart(rect) : this.getSecondaryStart(rect);\n }\n\n private getFlowEnd(rect: DOMRect): number {\n return this.layout === \"stack\" ? this.getPrimaryEnd(rect) : this.getSecondaryEnd(rect);\n }\n\n private getFlowSize(rect: DOMRect): number {\n return this.getFlowEnd(rect) - this.getFlowStart(rect);\n }\n\n private getItemKeys(): Array<string | number> {\n return [...this.getCollection()].filter((item) => item.type === \"item\").map((item) => item.key);\n }\n\n private resolveBoundaryTarget(\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n const keys = this.getItemKeys();\n if (keys.length === 0) return null;\n const key = direction === \"next\" ? keys[0] : keys[keys.length - 1];\n const order: Array<\"before\" | \"on\" | \"after\"> =\n direction === \"next\" ? [\"before\", \"on\", \"after\"] : [\"after\", \"on\", \"before\"];\n for (const dropPosition of order) {\n const target: DropTarget = { type: \"item\", key, dropPosition };\n if (isValidDropTarget(target)) return target;\n }\n return null;\n }\n\n private resolveTransitionTarget(\n target: DropTarget,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (target.type !== \"item\") return null;\n const tryPosition = (dropPosition: \"before\" | \"on\" | \"after\"): DropTarget | null => {\n if (target.dropPosition === dropPosition) return null;\n const nextTarget: DropTarget = {\n type: \"item\",\n key: target.key,\n dropPosition,\n };\n return isValidDropTarget(nextTarget) ? nextTarget : null;\n };\n\n if (direction === \"next\") {\n if (target.dropPosition === \"before\") {\n return tryPosition(\"on\") ?? tryPosition(\"after\");\n }\n if (target.dropPosition === \"on\") {\n return tryPosition(\"after\");\n }\n } else {\n if (target.dropPosition === \"after\") {\n return tryPosition(\"on\") ?? tryPosition(\"before\");\n }\n if (target.dropPosition === \"on\") {\n return tryPosition(\"before\");\n }\n }\n\n return null;\n }\n\n private resolveNeighborTarget(\n target: DropTarget,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (target.type !== \"item\") return null;\n const keys = this.getItemKeys();\n const index = keys.findIndex((key) => key === target.key);\n if (index < 0) return this.resolveBoundaryTarget(direction, isValidDropTarget);\n const nextIndex = direction === \"next\" ? index + 1 : index - 1;\n if (nextIndex < 0 || nextIndex >= keys.length) {\n const rootTarget: DropTarget = { type: \"root\" };\n return isValidDropTarget(rootTarget) ? rootTarget : null;\n }\n const key = keys[nextIndex];\n const order: Array<\"on\" | \"before\" | \"after\"> =\n direction === \"next\" ? [\"on\", \"before\", \"after\"] : [\"on\", \"after\", \"before\"];\n for (const dropPosition of order) {\n const nextTarget: DropTarget = { type: \"item\", key, dropPosition };\n if (isValidDropTarget(nextTarget)) return nextTarget;\n }\n return null;\n }\n\n getKeyboardNavigationTarget(\n target: DropTarget | null,\n direction: \"next\" | \"previous\",\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget | null {\n if (!target || target.type === \"root\") {\n return this.resolveBoundaryTarget(direction, isValidDropTarget);\n }\n const transition = this.resolveTransitionTarget(target, direction, isValidDropTarget);\n if (transition) return transition;\n return this.resolveNeighborTarget(target, direction, isValidDropTarget);\n }\n\n getDropTargetFromPoint(\n x: number,\n y: number,\n isValidDropTarget: (target: DropTarget) => boolean,\n ): DropTarget {\n const root = this.ref();\n if (!root) {\n return { type: \"root\" };\n }\n\n const allItems = [...this.getCollection()].filter((item) => item.type === \"item\");\n if (allItems.length === 0) {\n return { type: \"root\" };\n }\n\n const collectionId = root.dataset.collection;\n const selector = collectionId ? `[data-collection=\"${cssEscape(collectionId)}\"]` : \"[data-key]\";\n const elements = root.querySelectorAll(selector);\n const elementMap = new Map<string, HTMLElement>();\n for (const node of elements) {\n if (node instanceof HTMLElement && node.dataset.key != null) {\n elementMap.set(node.dataset.key, node);\n }\n }\n\n let low = 0;\n let high = allItems.length;\n const rootRect = root.getBoundingClientRect();\n let primary = this.orientation === \"horizontal\" ? x : y;\n let secondary = this.orientation === \"horizontal\" ? y : x;\n primary += this.getPrimaryStart(rootRect);\n secondary += this.getSecondaryStart(rootRect);\n\n const flow = this.layout === \"stack\" ? primary : secondary;\n const isPrimaryRtl = this.orientation === \"horizontal\" && this.direction === \"rtl\";\n const isSecondaryRtl =\n this.layout === \"grid\" && this.orientation === \"vertical\" && this.direction === \"rtl\";\n const isFlowRtl = this.layout === \"stack\" ? isPrimaryRtl : isSecondaryRtl;\n\n while (low < high) {\n const mid = Math.floor((low + high) / 2);\n const item = allItems[mid];\n const element = elementMap.get(String(item.key));\n if (!element) break;\n const rect = element.getBoundingClientRect();\n const update = (isGreater: boolean) => {\n if (isGreater) {\n low = mid + 1;\n } else {\n high = mid;\n }\n };\n\n if (primary < this.getPrimaryStart(rect)) {\n update(isPrimaryRtl);\n } else if (primary > this.getPrimaryEnd(rect)) {\n update(!isPrimaryRtl);\n } else if (secondary < this.getSecondaryStart(rect)) {\n update(isSecondaryRtl);\n } else if (secondary > this.getSecondaryEnd(rect)) {\n update(!isSecondaryRtl);\n } else {\n const target: DropTarget = {\n type: \"item\",\n key: item.key,\n dropPosition: \"on\",\n };\n\n if (isValidDropTarget(target)) {\n if (\n flow <= this.getFlowStart(rect) + 5 &&\n isValidDropTarget({ ...target, dropPosition: \"before\" })\n ) {\n target.dropPosition = isFlowRtl ? \"after\" : \"before\";\n } else if (\n flow >= this.getFlowEnd(rect) - 5 &&\n isValidDropTarget({ ...target, dropPosition: \"after\" })\n ) {\n target.dropPosition = isFlowRtl ? \"before\" : \"after\";\n }\n } else {\n const midpoint = this.getFlowStart(rect) + this.getFlowSize(rect) / 2;\n if (flow <= midpoint && isValidDropTarget({ ...target, dropPosition: \"before\" })) {\n target.dropPosition = isFlowRtl ? \"after\" : \"before\";\n } else if (flow >= midpoint && isValidDropTarget({ ...target, dropPosition: \"after\" })) {\n target.dropPosition = isFlowRtl ? \"before\" : \"after\";\n }\n }\n\n return target;\n }\n }\n\n const item = allItems[Math.min(low, allItems.length - 1)];\n const element = elementMap.get(String(item.key));\n const rect = element?.getBoundingClientRect();\n if (\n rect &&\n (primary < this.getPrimaryStart(rect) ||\n Math.abs(flow - this.getFlowStart(rect)) < Math.abs(flow - this.getFlowEnd(rect)))\n ) {\n return {\n type: \"item\",\n key: item.key,\n dropPosition: isFlowRtl ? \"after\" : \"before\",\n };\n }\n\n return {\n type: \"item\",\n key: item.key,\n dropPosition: isFlowRtl ? \"before\" : \"after\",\n };\n }\n}\n","/*\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\n// Ported to SolidJS for Proyecto Viviana; based on packages/react-aria-components/src/useDragAndDrop.tsx\n\n/**\n * Drag and drop compatibility hook for collection components.\n *\n * Mirrors RAC's `useDragAndDrop` shape while delegating to Solid\n * state and aria primitives. Based on\n * packages/react-aria-components/src/useDragAndDrop.tsx.\n */\n\nimport type { Accessor } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\nimport { DragPreview } from \"./DragPreview\";\nimport { ListDropTargetDelegate } from \"./ListDropTargetDelegate\";\nimport {\n createDraggableCollection,\n createDraggableItem,\n createDroppableCollection,\n createDroppableItem,\n createDropIndicator,\n isVirtualDragging,\n type DraggableCollectionOptions,\n type DraggableCollectionAria,\n type DraggableItemOptions,\n type DraggableItemAria,\n type DroppableCollectionOptions,\n type DroppableCollectionAria,\n type DroppableItemOptions,\n type DroppableItemAria,\n type DropTargetDelegate as AriaDropTargetDelegate,\n} from \"@proyecto-viviana/solidaria\";\nimport {\n createDraggableCollectionState,\n createDroppableCollectionState,\n type DragItem,\n type DragPreviewRenderer,\n type DraggableCollectionProps,\n type DraggableCollectionState,\n type DraggableCollectionStateOptions,\n type DropTarget,\n type DroppableCollectionProps,\n type DroppableCollectionState,\n type DroppableCollectionStateOptions,\n} from \"@proyecto-viviana/solid-stately\";\n\ninterface DraggableCollectionStateOpts<T = object> extends Omit<\n DraggableCollectionStateOptions<T>,\n \"getItems\"\n> {\n items?: T[];\n}\n\ninterface DragHooks<T = object> {\n useDraggableCollectionState?: (\n props: DraggableCollectionStateOpts<T>,\n ) => DraggableCollectionState;\n useDraggableCollection?: (\n props: Omit<DraggableCollectionOptions, \"ref\">,\n state: DraggableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DraggableCollectionAria;\n useDraggableItem?: (\n props: DraggableItemOptions,\n state: DraggableCollectionState,\n ) => DraggableItemAria;\n DragPreview?: typeof DragPreview;\n renderDragPreview?: DragAndDropOptions<T>[\"renderDragPreview\"];\n isVirtualDragging?: () => boolean;\n}\n\ninterface DropHooks {\n useDroppableCollectionState?: (\n props: DroppableCollectionStateOptions,\n ) => DroppableCollectionState;\n useDroppableCollection?: (\n props: Omit<DroppableCollectionOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DroppableCollectionAria;\n useDroppableItem?: (\n options: Omit<DroppableItemOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => DroppableItemAria;\n useDropIndicator?: (\n props: { target: DropTarget },\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => {\n dropIndicatorProps: JSX.HTMLAttributes<HTMLElement>;\n isDropTarget: boolean;\n isHidden: boolean;\n };\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n dropTargetDelegate?: AriaDropTargetDelegate;\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 Partial<Omit<DraggableCollectionProps<T>, \"preview\">>, Partial<DroppableCollectionProps> {\n /**\n * A function that returns the items being dragged.\n * If omitted, draggable hooks are not added.\n */\n getItems?: (keys: Set<string | number>, items: T[]) => DragItem[];\n /**\n * Optional custom drag preview renderer.\n */\n renderDragPreview?: (\n items: DragItem[],\n ) => JSX.Element | { element: JSX.Element; x: number; y: number };\n /**\n * Optional drop indicator renderer for collection components.\n */\n renderDropIndicator?: (target: DropTarget) => JSX.Element;\n /**\n * Optional custom drop target delegate.\n */\n dropTargetDelegate?: AriaDropTargetDelegate;\n /**\n * Optional drag preview ref.\n */\n preview?: { current: DragPreviewRenderer | null };\n /**\n * Optional item snapshot used by draggable state `getItems`.\n */\n items?: T[];\n /**\n * Disable both drag and drop behavior.\n */\n isDisabled?: boolean;\n}\n\n/**\n * Provides hooks to enable drag-and-drop behavior for collection components.\n */\nexport function useDragAndDrop<T = object>(options: DragAndDropOptions<T> = {}): DragAndDrop<T> {\n const {\n getItems,\n onDrop,\n onInsert,\n onItemDrop,\n onReorder,\n onMove,\n onRootDrop,\n renderDragPreview,\n renderDropIndicator,\n dropTargetDelegate,\n } = options;\n\n const isDraggable = typeof getItems === \"function\";\n const isDroppable = Boolean(\n onDrop || onInsert || onItemDrop || onReorder || onMove || onRootDrop,\n );\n\n const hooks: DragAndDropHooks<T> = {};\n const hasDom = typeof HTMLElement !== \"undefined\";\n const isElementNode = (value: unknown): value is HTMLElement => {\n if (!value) return false;\n if (hasDom && value instanceof HTMLElement) return true;\n return typeof value === \"object\" && (value as { nodeType?: number }).nodeType === 1;\n };\n const resolvedPreview =\n options.preview ??\n (renderDragPreview\n ? {\n current: (\n items: DragItem[],\n callback: (node: HTMLElement | null, x?: number, y?: number) => void,\n ) => {\n const rendered = renderDragPreview(items);\n if (!rendered) {\n callback(null);\n return;\n }\n if (typeof rendered === \"object\" && rendered !== null && \"element\" in rendered) {\n const previewValue = rendered as { element: unknown; x?: number; y?: number };\n callback(\n isElementNode(previewValue.element) ? previewValue.element : null,\n previewValue.x,\n previewValue.y,\n );\n return;\n }\n callback(isElementNode(rendered) ? rendered : null);\n },\n }\n : undefined);\n\n if (isDraggable && getItems) {\n hooks.useDraggableCollectionState = (props: DraggableCollectionStateOpts<T>) => {\n return createDraggableCollectionState<T>(() => ({\n onDragStart: options.onDragStart ?? props.onDragStart,\n onDragMove: options.onDragMove ?? props.onDragMove,\n onDragEnd: options.onDragEnd ?? props.onDragEnd,\n getAllowedDropOperations:\n options.getAllowedDropOperations ?? props.getAllowedDropOperations,\n isDisabled: options.isDisabled ?? props.isDisabled,\n preview: resolvedPreview ?? props.preview,\n getItems: (keys) => {\n const sourceItems = props.items ?? options.items ?? [];\n return getItems(keys, sourceItems);\n },\n collection: props.collection,\n selectedKeys: props.selectedKeys,\n isSelected: props.isSelected,\n }));\n };\n hooks.useDraggableCollection = (\n props: Omit<DraggableCollectionOptions, \"ref\">,\n state: DraggableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => createDraggableCollection({ ...props, ref }, state);\n hooks.useDraggableItem = (props, state) => createDraggableItem(() => props, state);\n hooks.DragPreview = DragPreview;\n hooks.renderDragPreview = renderDragPreview;\n // RAC `useDragAndDrop.tsx:182` `isVirtualDragging` is DragManager's\n // `!!dragSession`, not \"any in-flight pointer keys\".\n hooks.isVirtualDragging = isVirtualDragging;\n }\n\n if (isDroppable) {\n hooks.useDroppableCollectionState = (props: DroppableCollectionStateOptions) => {\n return createDroppableCollectionState(() => ({\n acceptedDragTypes: options.acceptedDragTypes ?? props.acceptedDragTypes,\n getDropOperation: options.getDropOperation ?? props.getDropOperation,\n onDropEnter: options.onDropEnter ?? props.onDropEnter,\n onDropActivate: options.onDropActivate ?? props.onDropActivate,\n onDropExit: options.onDropExit ?? props.onDropExit,\n onDrop: options.onDrop ?? props.onDrop,\n onInsert: options.onInsert ?? props.onInsert,\n onRootDrop: options.onRootDrop ?? props.onRootDrop,\n onItemDrop: options.onItemDrop ?? props.onItemDrop,\n onReorder: options.onReorder ?? props.onReorder,\n onMove: options.onMove ?? props.onMove,\n shouldAcceptItemDrop: options.shouldAcceptItemDrop ?? props.shouldAcceptItemDrop,\n isDisabled: options.isDisabled ?? props.isDisabled,\n collection: props.collection,\n }));\n };\n hooks.useDroppableCollection = (\n props: Omit<DroppableCollectionOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => {\n const acceptedDragTypes = options.acceptedDragTypes ?? props.acceptedDragTypes;\n const normalizedAcceptedDragTypes =\n acceptedDragTypes === \"all\"\n ? \"all\"\n : acceptedDragTypes?.filter(\n (type): type is string | symbol =>\n typeof type === \"string\" || typeof type === \"symbol\",\n );\n return createDroppableCollection(\n () => ({\n ref,\n dropTargetDelegate: options.dropTargetDelegate ?? props.dropTargetDelegate,\n keyboardDelegate: props.keyboardDelegate,\n // Host collection + selection/focus setters, forwarded so keyboard\n // drop-target navigation and post-drop focus restoration work.\n collection: props.collection,\n selectedKeys: props.selectedKeys,\n setSelectedKeys: props.setSelectedKeys,\n setFocusedKey: props.setFocusedKey,\n setFocused: props.setFocused,\n onKeyDown: props.onKeyDown,\n acceptedDragTypes: normalizedAcceptedDragTypes,\n isDisabled: options.isDisabled ?? props.isDisabled,\n onDropActivate: (e) => {\n (options.onDropActivate ?? props.onDropActivate)?.({\n type: \"dropactivate\",\n target: e.target,\n x: e.x,\n y: e.y,\n });\n },\n onDrop: (e) => {\n (options.onDrop ?? props.onDrop)?.({\n type: \"drop\",\n target: e.target,\n x: e.x,\n y: e.y,\n items: e.items,\n dropOperation: e.dropOperation,\n });\n },\n onRootDrop: options.onRootDrop ?? props.onRootDrop,\n onItemDrop: (e) => {\n if (e.target.type === \"item\") {\n (options.onItemDrop ?? props.onItemDrop)?.({\n items: e.items,\n target: e.target,\n dropOperation: e.dropOperation,\n isInternal: e.isInternal,\n });\n }\n },\n onInsert: (e) => {\n if (e.target.type === \"item\") {\n (options.onInsert ?? props.onInsert)?.({\n items: e.items,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n onReorder: (e) => {\n if (e.target.type === \"item\") {\n (options.onReorder ?? props.onReorder)?.({\n keys: e.keys,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n onMove: (e) => {\n if (e.target.type === \"item\") {\n (options.onMove ?? props.onMove)?.({\n keys: e.keys,\n target: e.target,\n dropOperation: e.dropOperation,\n });\n }\n },\n }),\n state,\n );\n };\n hooks.useDroppableItem = (\n props: Omit<DroppableItemOptions, \"ref\">,\n state: DroppableCollectionState,\n ref: Accessor<HTMLElement | null>,\n ) => createDroppableItem(() => ({ ...props, ref }), state);\n // RAC `useDragAndDrop.tsx:203` `hooks.useDropIndicator = useDropIndicator`.\n hooks.useDropIndicator = (props, state, ref) => createDropIndicator(props, state, ref);\n hooks.renderDropIndicator = renderDropIndicator;\n hooks.dropTargetDelegate = dropTargetDelegate;\n hooks.ListDropTargetDelegate = ListDropTargetDelegate;\n }\n\n return {\n dragAndDropHooks: hooks,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,YAAY,OAAsC;CAChE,MAAM,SAAS,OAAO,gBAAgB;CACtC,MAAM,iBAAiB,UAAyC;EAC9D,IAA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
3
- * Port of react-aria-components/src/utils.tsx
4
- */
5
- import { type JSX, type Accessor, type Context, type FlowComponent } from "solid-js";
1
+ import type { Accessor, Context, FlowComponent } from "solid-js";
2
+ import type { JSX } from "@solidjs/web";
6
3
  /**
7
4
  * Render props pattern - children can be a function that receives state
8
5
  */
@@ -30,10 +27,12 @@ export interface RenderPropsBase<T> {
30
27
  * Slot props for named slots
31
28
  */
32
29
  export interface SlotProps {
33
- /** A slot name for the component. */
34
- slot?: string;
30
+ /** A slot name for the component. HTML `slot` may be `false` to omit. */
31
+ slot?: string | JSX.RemoveAttribute;
35
32
  }
36
33
  export declare const DEFAULT_SLOT = "default";
34
+ /** HTML `slot` may be `false`; RAC slots are string names. */
35
+ export declare function resolveSlot(slot: SlotProps["slot"]): string;
37
36
  /**
38
37
  * Return type for useRenderProps
39
38
  */
@@ -84,6 +83,25 @@ export declare function useRenderProps<T extends object>(props: RenderPropsBase<
84
83
  defaultClassName?: string;
85
84
  }, values: Accessor<T>): RenderPropsResult<T>;
86
85
  export declare function composeRenderProps<T extends object>(base: RenderPropsBase<T> | undefined, override: RenderPropsBase<T> | undefined): RenderPropsBase<T>;
86
+ export interface OptionContentProps {
87
+ /** `renderChildren` of the option's {@link useRenderProps} result. */
88
+ render: () => JSX.Element;
89
+ /** `labelProps` from `createOption`; spread onto the span that wraps a primitive label. */
90
+ labelProps: JSX.HTMLAttributes<HTMLSpanElement>;
91
+ }
92
+ /**
93
+ * Memoizes `props.render()` so classification and insertion share its result,
94
+ * wrapping a primitive (string/number) label in `<span {...labelProps}>` so the
95
+ * option's `aria-labelledby` has a target. Internal to the option components
96
+ * (ListBox, ComboBox, Select); mount it *inside* the option's `TextContext`
97
+ * provider so `<Text>` children resolve their slots.
98
+ *
99
+ * The tracked memo preserves updates while avoiding separate render calls for
100
+ * the primitive check and insertion. Re-evaluation can construct children, so
101
+ * keep this sharing and provider ownership; it is not a universal restriction
102
+ * on getter reads or a promise that the callback runs only once forever.
103
+ */
104
+ export declare function OptionContent(props: OptionContentProps): JSX.Element;
87
105
  /** A Solid ref target: a callback, a mutable `{ current }` object, or undefined. */
88
106
  export type RefLike<T> = T | ((el: T) => void) | {
89
107
  current?: T | null;
@@ -124,7 +142,7 @@ export declare function mergeRefs<T>(...refs: Array<RefLike<T>>): (el: T) => voi
124
142
  * {@link DEFAULT_SLOT}) is returned, throwing on an unknown slot name;
125
143
  * - otherwise the bare context value is returned.
126
144
  */
127
- export declare function useSlottedContext<T>(context: Context<SlottedContextValue<T>>, slot?: string | null): T | null | undefined;
145
+ export declare function useSlottedContext<T>(context: Context<SlottedContextValue<T>>, slot?: string | null | JSX.RemoveAttribute): T | null | undefined;
128
146
  /**
129
147
  * Merges context-provided props and a context ref into a component's own props
130
148
  * and ref. Port of react-aria-components' `useContextProps`:
@@ -162,7 +180,8 @@ export declare function Provider(props: {
162
180
  /**
163
181
  * Converts boolean state values to data attributes
164
182
  */
165
- export declare function dataAttr(value: boolean | undefined): "" | undefined;
183
+ export declare function dataAttr(value: boolean | undefined): "true" | undefined;
184
+ export { ariaTrueFalse, attrTrue, attrString, isAriaTrue, coerceDomBoolean, coerceDomRecord, } from "@proyecto-viviana/solidaria/utils";
166
185
  /**
167
186
  * Creates data attributes from render props
168
187
  */
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,KAAK,GAAG,EACR,KAAK,QAAQ,EACb,KAAK,OAAO,EACZ,KAAK,aAAa,EAUnB,MAAM,UAAU,CAAC;AAIlB;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,CAAC;AAEhF;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,MAAM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