@vritti/quantum-ui 0.2.10 → 0.3.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 (939) hide show
  1. package/dist/Alert.js +4 -32
  2. package/dist/Alert.js.map +1 -1
  3. package/dist/AppSelector.js +37 -0
  4. package/dist/AppSelector.js.map +1 -0
  5. package/dist/Avatar.js +6 -6
  6. package/dist/Avatar.js.map +1 -1
  7. package/dist/Badge2.js +3 -3
  8. package/dist/Breadcrumb.js +125 -0
  9. package/dist/Breadcrumb.js.map +1 -0
  10. package/dist/Button.js +9 -5
  11. package/dist/Button.js.map +1 -1
  12. package/dist/Button2.js +4 -4
  13. package/dist/Button2.js.map +1 -1
  14. package/dist/Card.js +1 -1
  15. package/dist/CardSkeleton.js +17 -0
  16. package/dist/CardSkeleton.js.map +1 -0
  17. package/dist/Chart.js +6196 -6402
  18. package/dist/Chart.js.map +1 -1
  19. package/dist/Checkbox2.js +7 -6
  20. package/dist/Checkbox2.js.map +1 -1
  21. package/dist/CheckboxGroup.js +74 -0
  22. package/dist/CheckboxGroup.js.map +1 -0
  23. package/dist/CloudProviderSelector.js +37 -0
  24. package/dist/CloudProviderSelector.js.map +1 -0
  25. package/dist/Collapsible.js +8 -0
  26. package/dist/Collapsible.js.map +1 -0
  27. package/dist/Combination.js +10 -2509
  28. package/dist/Combination.js.map +1 -1
  29. package/dist/ConfirmContext.js +75 -0
  30. package/dist/ConfirmContext.js.map +1 -0
  31. package/dist/CurrencySelector.js +194 -0
  32. package/dist/CurrencySelector.js.map +1 -0
  33. package/dist/DangerZoneSkeleton.js +52 -0
  34. package/dist/DangerZoneSkeleton.js.map +1 -0
  35. package/dist/DatePicker.js +36 -18
  36. package/dist/DatePicker.js.map +1 -1
  37. package/dist/DeploymentSelector.js +37 -0
  38. package/dist/DeploymentSelector.js.map +1 -0
  39. package/dist/Dialog.js +159 -0
  40. package/dist/Dialog.js.map +1 -0
  41. package/dist/DropdownMenu.js +66 -1493
  42. package/dist/DropdownMenu.js.map +1 -1
  43. package/dist/Empty.js +49 -0
  44. package/dist/Empty.js.map +1 -0
  45. package/dist/ErrorBoundary.js +255 -0
  46. package/dist/ErrorBoundary.js.map +1 -0
  47. package/dist/FeatureSelector.js +37 -0
  48. package/dist/FeatureSelector.js.map +1 -0
  49. package/dist/FilePreview.js +194 -0
  50. package/dist/FilePreview.js.map +1 -0
  51. package/dist/Form.js +1922 -20
  52. package/dist/Form.js.map +1 -1
  53. package/dist/HierarchyGraph.js +10729 -0
  54. package/dist/HierarchyGraph.js.map +1 -0
  55. package/dist/IndustrySelector.js +37 -0
  56. package/dist/IndustrySelector.js.map +1 -0
  57. package/dist/Input.js +22 -0
  58. package/dist/Input.js.map +1 -0
  59. package/dist/Label.js +2 -22
  60. package/dist/Label.js.map +1 -1
  61. package/dist/LocaleSelector.js +111 -0
  62. package/dist/LocaleSelector.js.map +1 -0
  63. package/dist/MicrofrontendSelector.js +19 -0
  64. package/dist/MicrofrontendSelector.js.map +1 -0
  65. package/dist/OTPField.js +29 -27
  66. package/dist/OTPField.js.map +1 -1
  67. package/dist/PageHeaderSkeleton.js +35 -0
  68. package/dist/PageHeaderSkeleton.js.map +1 -0
  69. package/dist/PasswordField.js +2 -50
  70. package/dist/PasswordField.js.map +1 -1
  71. package/dist/PhoneField.js +9 -14
  72. package/dist/PhoneField.js.map +1 -1
  73. package/dist/PlanSelector.js +37 -0
  74. package/dist/PlanSelector.js.map +1 -0
  75. package/dist/Progress.js +5 -4
  76. package/dist/Progress.js.map +1 -1
  77. package/dist/RadioGroup.js +392 -0
  78. package/dist/RadioGroup.js.map +1 -0
  79. package/dist/RegionSelector.js +37 -0
  80. package/dist/RegionSelector.js.map +1 -0
  81. package/dist/Select.js +780 -0
  82. package/dist/Select.js.map +1 -0
  83. package/dist/SelectFilter.js +387 -0
  84. package/dist/SelectFilter.js.map +1 -0
  85. package/dist/Sidebar.js +616 -0
  86. package/dist/Sidebar.js.map +1 -0
  87. package/dist/SingleSelect.js +429 -0
  88. package/dist/SingleSelect.js.map +1 -0
  89. package/dist/Skeleton.js +1 -1
  90. package/dist/Sonner.js +2 -1134
  91. package/dist/Sonner.js.map +1 -1
  92. package/dist/Sortable.js +4517 -0
  93. package/dist/Sortable.js.map +1 -0
  94. package/dist/Spinner.js +1 -1
  95. package/dist/StepProgressIndicator.js +42 -0
  96. package/dist/StepProgressIndicator.js.map +1 -0
  97. package/dist/Switch.js +16 -16
  98. package/dist/Switch.js.map +1 -1
  99. package/dist/TabsSkeleton.js +188 -0
  100. package/dist/TabsSkeleton.js.map +1 -0
  101. package/dist/TextArea.js +17 -20
  102. package/dist/TextArea.js.map +1 -1
  103. package/dist/TextField.js +3 -19
  104. package/dist/TextField.js.map +1 -1
  105. package/dist/TimezoneSelector.js +144 -0
  106. package/dist/TimezoneSelector.js.map +1 -0
  107. package/dist/Toggle.js +3 -33
  108. package/dist/Toggle.js.map +1 -1
  109. package/dist/Typography.js +1 -1
  110. package/dist/UploadFile.js +232 -0
  111. package/dist/UploadFile.js.map +1 -0
  112. package/dist/ValueFilter.js +123 -0
  113. package/dist/ValueFilter.js.map +1 -0
  114. package/dist/ViewTabs.js +218 -0
  115. package/dist/ViewTabs.js.map +1 -0
  116. package/dist/_commonjsHelpers.js +3 -1
  117. package/dist/_commonjsHelpers.js.map +1 -1
  118. package/dist/assets/quantum-ui.css +808 -38
  119. package/dist/axios.js +4575 -0
  120. package/dist/axios.js.map +1 -0
  121. package/dist/circle-alert.js +19 -0
  122. package/dist/circle-alert.js.map +1 -0
  123. package/dist/circle-check.js +18 -0
  124. package/dist/circle-check.js.map +1 -0
  125. package/dist/collapsible2.js +154 -0
  126. package/dist/collapsible2.js.map +1 -0
  127. package/dist/components/Breadcrumb.js +2 -0
  128. package/dist/components/Breadcrumb.js.map +1 -0
  129. package/dist/components/Card.js +1 -0
  130. package/dist/components/Card.js.map +1 -1
  131. package/dist/components/CheckboxGroup.js +2 -0
  132. package/dist/components/CheckboxGroup.js.map +1 -0
  133. package/dist/components/Collapsible.js +2 -0
  134. package/dist/components/Collapsible.js.map +1 -0
  135. package/dist/components/DangerZone.js +2 -0
  136. package/dist/components/DangerZone.js.map +1 -0
  137. package/dist/components/DataTable.js +1 -1
  138. package/dist/components/Dialog.js +2 -0
  139. package/dist/components/Dialog.js.map +1 -0
  140. package/dist/components/DropdownMenu.js +1 -1
  141. package/dist/components/Empty.js +2 -0
  142. package/dist/components/Empty.js.map +1 -0
  143. package/dist/components/ErrorBoundary.js +2 -0
  144. package/dist/components/ErrorBoundary.js.map +1 -0
  145. package/dist/components/FilePreview.js +2 -0
  146. package/dist/components/FilePreview.js.map +1 -0
  147. package/dist/components/HierarchyGraph.js +2 -0
  148. package/dist/components/HierarchyGraph.js.map +1 -0
  149. package/dist/components/PageHeader.js +2 -0
  150. package/dist/components/PageHeader.js.map +1 -0
  151. package/dist/components/RadioGroup.js +2 -0
  152. package/dist/components/RadioGroup.js.map +1 -0
  153. package/dist/components/RichTextEditor.js +4 -0
  154. package/dist/components/RichTextEditor.js.map +1 -0
  155. package/dist/components/Select.js +6 -1356
  156. package/dist/components/Select.js.map +1 -1
  157. package/dist/components/Sidebar.js +2 -0
  158. package/dist/components/Sidebar.js.map +1 -0
  159. package/dist/components/Sortable.js +2 -0
  160. package/dist/components/Sortable.js.map +1 -0
  161. package/dist/components/StepProgressIndicator.js +2 -0
  162. package/dist/components/StepProgressIndicator.js.map +1 -0
  163. package/dist/components/Tabs.js +2 -0
  164. package/dist/components/Tabs.js.map +1 -0
  165. package/dist/components/UploadFile.js +2 -0
  166. package/dist/components/UploadFile.js.map +1 -0
  167. package/dist/components/ValueFilter.js +2 -0
  168. package/dist/components/ValueFilter.js.map +1 -0
  169. package/dist/components/ViewTabs.js +2 -0
  170. package/dist/components/ViewTabs.js.map +1 -0
  171. package/dist/context/index.js +1 -0
  172. package/dist/context/index.js.map +1 -1
  173. package/dist/dropdown-menu.js +1209 -0
  174. package/dist/dropdown-menu.js.map +1 -0
  175. package/dist/ellipsis.js +19 -0
  176. package/dist/ellipsis.js.map +1 -0
  177. package/dist/eye.js +52 -0
  178. package/dist/eye.js.map +1 -0
  179. package/dist/field.js +2 -2
  180. package/dist/file-text.js +27 -0
  181. package/dist/file-text.js.map +1 -0
  182. package/dist/grip-vertical.js +22 -0
  183. package/dist/grip-vertical.js.map +1 -0
  184. package/dist/hooks/index.js +3 -1
  185. package/dist/hooks/index.js.map +1 -1
  186. package/dist/image-component.js +614 -0
  187. package/dist/image-component.js.map +1 -0
  188. package/dist/index.js +48 -12
  189. package/dist/index.js.map +1 -1
  190. package/dist/index10.js +181 -11
  191. package/dist/index10.js.map +1 -1
  192. package/dist/index11.js +177 -4
  193. package/dist/index11.js.map +1 -1
  194. package/dist/index12.js +17 -38
  195. package/dist/index12.js.map +1 -1
  196. package/dist/index13.js +204 -188
  197. package/dist/index13.js.map +1 -1
  198. package/dist/index14.js +124 -192
  199. package/dist/index14.js.map +1 -1
  200. package/dist/index15.js +79 -0
  201. package/dist/index15.js.map +1 -0
  202. package/dist/index16.js +16 -0
  203. package/dist/index16.js.map +1 -0
  204. package/dist/index17.js +1137 -0
  205. package/dist/index17.js.map +1 -0
  206. package/dist/index18.js +41 -0
  207. package/dist/index18.js.map +1 -0
  208. package/dist/index19.js +314 -0
  209. package/dist/index19.js.map +1 -0
  210. package/dist/index2.js +54030 -59
  211. package/dist/index2.js.map +1 -1
  212. package/dist/index20.js +488 -0
  213. package/dist/index20.js.map +1 -0
  214. package/dist/index21.js +2540 -0
  215. package/dist/index21.js.map +1 -0
  216. package/dist/index22.js +36 -0
  217. package/dist/index22.js.map +1 -0
  218. package/dist/index23.js +13 -0
  219. package/dist/index23.js.map +1 -0
  220. package/dist/index24.js +8 -0
  221. package/dist/index24.js.map +1 -0
  222. package/dist/index25.js +35 -0
  223. package/dist/index25.js.map +1 -0
  224. package/dist/index26.js +65 -0
  225. package/dist/index26.js.map +1 -0
  226. package/dist/index27.js +16 -0
  227. package/dist/index27.js.map +1 -0
  228. package/dist/index28.js +41 -0
  229. package/dist/index28.js.map +1 -0
  230. package/dist/index29.js +84 -0
  231. package/dist/index29.js.map +1 -0
  232. package/dist/index3.js +41 -61
  233. package/dist/index3.js.map +1 -1
  234. package/dist/index30.js +199 -0
  235. package/dist/index30.js.map +1 -0
  236. package/dist/index4.js +290 -92
  237. package/dist/index4.js.map +1 -1
  238. package/dist/index5.js +102 -42
  239. package/dist/index5.js.map +1 -1
  240. package/dist/index6.js +35 -8
  241. package/dist/index6.js.map +1 -1
  242. package/dist/index7.js +1141 -110
  243. package/dist/index7.js.map +1 -1
  244. package/dist/index8.js +19 -34
  245. package/dist/index8.js.map +1 -1
  246. package/dist/index9.js +27 -4
  247. package/dist/index9.js.map +1 -1
  248. package/dist/lib/components/Breadcrumb/Breadcrumb.d.ts +17 -0
  249. package/dist/lib/components/Breadcrumb/Breadcrumb.d.ts.map +1 -0
  250. package/dist/lib/components/Breadcrumb/index.d.ts +4 -0
  251. package/dist/lib/components/Breadcrumb/index.d.ts.map +1 -0
  252. package/dist/lib/components/Button/Button.d.ts +3 -1
  253. package/dist/lib/components/Button/Button.d.ts.map +1 -1
  254. package/dist/lib/components/Card/CardSkeleton.d.ts +9 -0
  255. package/dist/lib/components/Card/CardSkeleton.d.ts.map +1 -0
  256. package/dist/lib/components/Card/index.d.ts +1 -0
  257. package/dist/lib/components/Card/index.d.ts.map +1 -1
  258. package/dist/lib/components/Chart/Chart.d.ts +1 -1
  259. package/dist/lib/components/Chart/Chart.d.ts.map +1 -1
  260. package/dist/lib/components/CheckboxGroup/CheckboxGroup.d.ts +24 -0
  261. package/dist/lib/components/CheckboxGroup/CheckboxGroup.d.ts.map +1 -0
  262. package/dist/lib/components/CheckboxGroup/index.d.ts +3 -0
  263. package/dist/lib/components/CheckboxGroup/index.d.ts.map +1 -0
  264. package/dist/lib/components/Collapsible/Collapsible.d.ts +5 -0
  265. package/dist/lib/components/Collapsible/Collapsible.d.ts.map +1 -0
  266. package/dist/lib/components/Collapsible/index.d.ts +2 -0
  267. package/dist/lib/components/Collapsible/index.d.ts.map +1 -0
  268. package/dist/lib/components/DangerZone/DangerZone.d.ts +13 -0
  269. package/dist/lib/components/DangerZone/DangerZone.d.ts.map +1 -0
  270. package/dist/lib/components/DangerZone/DangerZoneSkeleton.d.ts +9 -0
  271. package/dist/lib/components/DangerZone/DangerZoneSkeleton.d.ts.map +1 -0
  272. package/dist/lib/components/DangerZone/index.d.ts +4 -0
  273. package/dist/lib/components/DangerZone/index.d.ts.map +1 -0
  274. package/dist/lib/components/DataTable/DataTable.d.ts +2 -11
  275. package/dist/lib/components/DataTable/DataTable.d.ts.map +1 -1
  276. package/dist/lib/components/DataTable/components/DataTableColumnHeader.d.ts.map +1 -1
  277. package/dist/lib/components/DataTable/components/DataTableEmpty.d.ts.map +1 -1
  278. package/dist/lib/components/DataTable/components/DataTableFilters.d.ts +11 -0
  279. package/dist/lib/components/DataTable/components/DataTableFilters.d.ts.map +1 -0
  280. package/dist/lib/components/DataTable/components/DataTableImportDialog.d.ts +16 -0
  281. package/dist/lib/components/DataTable/components/DataTableImportDialog.d.ts.map +1 -0
  282. package/dist/lib/components/DataTable/components/DataTablePagination.d.ts +1 -2
  283. package/dist/lib/components/DataTable/components/DataTablePagination.d.ts.map +1 -1
  284. package/dist/lib/components/DataTable/components/DataTableRowDensity.d.ts +11 -0
  285. package/dist/lib/components/DataTable/components/DataTableRowDensity.d.ts.map +1 -0
  286. package/dist/lib/components/DataTable/components/DataTableSearch.d.ts +14 -0
  287. package/dist/lib/components/DataTable/components/DataTableSearch.d.ts.map +1 -0
  288. package/dist/lib/components/DataTable/components/DataTableSelectionBar.d.ts +14 -0
  289. package/dist/lib/components/DataTable/components/DataTableSelectionBar.d.ts.map +1 -0
  290. package/dist/lib/components/DataTable/components/DataTableViewOptions.d.ts.map +1 -1
  291. package/dist/lib/components/DataTable/components/DataTableViewTabs.d.ts +7 -0
  292. package/dist/lib/components/DataTable/components/DataTableViewTabs.d.ts.map +1 -0
  293. package/dist/lib/components/DataTable/components/DataTableViewsMenu.d.ts +14 -0
  294. package/dist/lib/components/DataTable/components/DataTableViewsMenu.d.ts.map +1 -0
  295. package/dist/lib/components/DataTable/components/FilterWrapper.d.ts +21 -0
  296. package/dist/lib/components/DataTable/components/FilterWrapper.d.ts.map +1 -0
  297. package/dist/lib/components/DataTable/components/RowActions.d.ts +20 -0
  298. package/dist/lib/components/DataTable/components/RowActions.d.ts.map +1 -0
  299. package/dist/lib/components/DataTable/hooks/useAutoUpsert.d.ts +3 -0
  300. package/dist/lib/components/DataTable/hooks/useAutoUpsert.d.ts.map +1 -0
  301. package/dist/lib/components/DataTable/hooks/useDataTable.d.ts +24 -2
  302. package/dist/lib/components/DataTable/hooks/useDataTable.d.ts.map +1 -1
  303. package/dist/lib/components/DataTable/index.d.ts +11 -3
  304. package/dist/lib/components/DataTable/index.d.ts.map +1 -1
  305. package/dist/lib/components/DataTable/store/store.d.ts +28 -0
  306. package/dist/lib/components/DataTable/store/store.d.ts.map +1 -0
  307. package/dist/lib/components/DataTable/store/useTableSlice.d.ts +18 -0
  308. package/dist/lib/components/DataTable/store/useTableSlice.d.ts.map +1 -0
  309. package/dist/lib/components/DataTable/types.d.ts +55 -56
  310. package/dist/lib/components/DataTable/types.d.ts.map +1 -1
  311. package/dist/lib/components/DataTable/utils.d.ts +8 -1
  312. package/dist/lib/components/DataTable/utils.d.ts.map +1 -1
  313. package/dist/lib/components/DatePicker/DatePicker.d.ts +1 -1
  314. package/dist/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
  315. package/dist/lib/components/Dialog/Dialog.d.ts +31 -0
  316. package/dist/lib/components/Dialog/Dialog.d.ts.map +1 -0
  317. package/dist/lib/components/Dialog/index.d.ts +3 -0
  318. package/dist/lib/components/Dialog/index.d.ts.map +1 -0
  319. package/dist/lib/components/DropdownMenu/DropdownMenu.d.ts +1 -1
  320. package/dist/lib/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  321. package/dist/lib/components/DropdownMenu/types.d.ts +10 -1
  322. package/dist/lib/components/DropdownMenu/types.d.ts.map +1 -1
  323. package/dist/lib/components/Editor/context/editor-config-context.d.ts +9 -0
  324. package/dist/lib/components/Editor/context/editor-config-context.d.ts.map +1 -0
  325. package/dist/lib/components/Editor/context/toolbar-context.d.ts +18 -0
  326. package/dist/lib/components/Editor/context/toolbar-context.d.ts.map +1 -0
  327. package/dist/lib/components/Editor/editor-hooks/use-debounce.d.ts +2 -0
  328. package/dist/lib/components/Editor/editor-hooks/use-debounce.d.ts.map +1 -0
  329. package/dist/lib/components/Editor/editor-hooks/use-modal.d.ts +6 -0
  330. package/dist/lib/components/Editor/editor-hooks/use-modal.d.ts.map +1 -0
  331. package/dist/lib/components/Editor/editor-hooks/use-report.d.ts +2 -0
  332. package/dist/lib/components/Editor/editor-hooks/use-report.d.ts.map +1 -0
  333. package/dist/lib/components/Editor/editor-hooks/use-update-toolbar.d.ts +3 -0
  334. package/dist/lib/components/Editor/editor-hooks/use-update-toolbar.d.ts.map +1 -0
  335. package/dist/lib/components/Editor/editor-ui/button-group.d.ts +12 -0
  336. package/dist/lib/components/Editor/editor-ui/button-group.d.ts.map +1 -0
  337. package/dist/lib/components/Editor/editor-ui/button.d.ts +11 -0
  338. package/dist/lib/components/Editor/editor-ui/button.d.ts.map +1 -0
  339. package/dist/lib/components/Editor/editor-ui/code-button.d.ts +8 -0
  340. package/dist/lib/components/Editor/editor-ui/code-button.d.ts.map +1 -0
  341. package/dist/lib/components/Editor/editor-ui/color-picker.d.ts +92 -0
  342. package/dist/lib/components/Editor/editor-ui/color-picker.d.ts.map +1 -0
  343. package/dist/lib/components/Editor/editor-ui/command.d.ts +19 -0
  344. package/dist/lib/components/Editor/editor-ui/command.d.ts.map +1 -0
  345. package/dist/lib/components/Editor/editor-ui/content-editable.d.ts +9 -0
  346. package/dist/lib/components/Editor/editor-ui/content-editable.d.ts.map +1 -0
  347. package/dist/lib/components/Editor/editor-ui/dialog.d.ts +16 -0
  348. package/dist/lib/components/Editor/editor-ui/dialog.d.ts.map +1 -0
  349. package/dist/lib/components/Editor/editor-ui/image-component.d.ts +16 -0
  350. package/dist/lib/components/Editor/editor-ui/image-component.d.ts.map +1 -0
  351. package/dist/lib/components/Editor/editor-ui/image-resizer.d.ts +18 -0
  352. package/dist/lib/components/Editor/editor-ui/image-resizer.d.ts.map +1 -0
  353. package/dist/lib/components/Editor/editor-ui/input.d.ts +4 -0
  354. package/dist/lib/components/Editor/editor-ui/input.d.ts.map +1 -0
  355. package/dist/lib/components/Editor/editor-ui/label.d.ts +5 -0
  356. package/dist/lib/components/Editor/editor-ui/label.d.ts.map +1 -0
  357. package/dist/lib/components/Editor/editor-ui/popover.d.ts +8 -0
  358. package/dist/lib/components/Editor/editor-ui/popover.d.ts.map +1 -0
  359. package/dist/lib/components/Editor/editor-ui/scroll-area.d.ts +6 -0
  360. package/dist/lib/components/Editor/editor-ui/scroll-area.d.ts.map +1 -0
  361. package/dist/lib/components/Editor/editor-ui/select.d.ts +16 -0
  362. package/dist/lib/components/Editor/editor-ui/select.d.ts.map +1 -0
  363. package/dist/lib/components/Editor/editor-ui/separator.d.ts +5 -0
  364. package/dist/lib/components/Editor/editor-ui/separator.d.ts.map +1 -0
  365. package/dist/lib/components/Editor/editor-ui/tabs.d.ts +8 -0
  366. package/dist/lib/components/Editor/editor-ui/tabs.d.ts.map +1 -0
  367. package/dist/lib/components/Editor/editor-ui/toggle-group.d.ts +8 -0
  368. package/dist/lib/components/Editor/editor-ui/toggle-group.d.ts.map +1 -0
  369. package/dist/lib/components/Editor/editor-ui/toggle.d.ts +10 -0
  370. package/dist/lib/components/Editor/editor-ui/toggle.d.ts.map +1 -0
  371. package/dist/lib/components/Editor/editor-ui/tooltip.d.ts +8 -0
  372. package/dist/lib/components/Editor/editor-ui/tooltip.d.ts.map +1 -0
  373. package/dist/lib/components/Editor/index.d.ts +4 -0
  374. package/dist/lib/components/Editor/index.d.ts.map +1 -0
  375. package/dist/lib/components/Editor/nodes/autocomplete-node.d.ts +19 -0
  376. package/dist/lib/components/Editor/nodes/autocomplete-node.d.ts.map +1 -0
  377. package/dist/lib/components/Editor/nodes/embeds/tweet-node.d.ts +22 -0
  378. package/dist/lib/components/Editor/nodes/embeds/tweet-node.d.ts.map +1 -0
  379. package/dist/lib/components/Editor/nodes/embeds/youtube-node.d.ts +23 -0
  380. package/dist/lib/components/Editor/nodes/embeds/youtube-node.d.ts.map +1 -0
  381. package/dist/lib/components/Editor/nodes/emoji-node.d.ts +18 -0
  382. package/dist/lib/components/Editor/nodes/emoji-node.d.ts.map +1 -0
  383. package/dist/lib/components/Editor/nodes/image-node.d.ts +49 -0
  384. package/dist/lib/components/Editor/nodes/image-node.d.ts.map +1 -0
  385. package/dist/lib/components/Editor/nodes/keyword-node.d.ts +15 -0
  386. package/dist/lib/components/Editor/nodes/keyword-node.d.ts.map +1 -0
  387. package/dist/lib/components/Editor/nodes/layout-container-node.d.ts +23 -0
  388. package/dist/lib/components/Editor/nodes/layout-container-node.d.ts.map +1 -0
  389. package/dist/lib/components/Editor/nodes/layout-item-node.d.ts +15 -0
  390. package/dist/lib/components/Editor/nodes/layout-item-node.d.ts.map +1 -0
  391. package/dist/lib/components/Editor/nodes/mention-node.d.ts +21 -0
  392. package/dist/lib/components/Editor/nodes/mention-node.d.ts.map +1 -0
  393. package/dist/lib/components/Editor/nodes/nodes.d.ts +3 -0
  394. package/dist/lib/components/Editor/nodes/nodes.d.ts.map +1 -0
  395. package/dist/lib/components/Editor/nodes.d.ts +2 -0
  396. package/dist/lib/components/Editor/nodes.d.ts.map +1 -0
  397. package/dist/lib/components/Editor/plugins/actions/actions-plugin.d.ts +4 -0
  398. package/dist/lib/components/Editor/plugins/actions/actions-plugin.d.ts.map +1 -0
  399. package/dist/lib/components/Editor/plugins/actions/character-limit-plugin.d.ts +5 -0
  400. package/dist/lib/components/Editor/plugins/actions/character-limit-plugin.d.ts.map +1 -0
  401. package/dist/lib/components/Editor/plugins/actions/clear-editor-plugin.d.ts +2 -0
  402. package/dist/lib/components/Editor/plugins/actions/clear-editor-plugin.d.ts.map +1 -0
  403. package/dist/lib/components/Editor/plugins/actions/counter-character-plugin.d.ts +6 -0
  404. package/dist/lib/components/Editor/plugins/actions/counter-character-plugin.d.ts.map +1 -0
  405. package/dist/lib/components/Editor/plugins/actions/edit-mode-toggle-plugin.d.ts +2 -0
  406. package/dist/lib/components/Editor/plugins/actions/edit-mode-toggle-plugin.d.ts.map +1 -0
  407. package/dist/lib/components/Editor/plugins/actions/import-export-plugin.d.ts +2 -0
  408. package/dist/lib/components/Editor/plugins/actions/import-export-plugin.d.ts.map +1 -0
  409. package/dist/lib/components/Editor/plugins/actions/markdown-toggle-plugin.d.ts +6 -0
  410. package/dist/lib/components/Editor/plugins/actions/markdown-toggle-plugin.d.ts.map +1 -0
  411. package/dist/lib/components/Editor/plugins/actions/max-length-plugin.d.ts +4 -0
  412. package/dist/lib/components/Editor/plugins/actions/max-length-plugin.d.ts.map +1 -0
  413. package/dist/lib/components/Editor/plugins/actions/share-content-plugin.d.ts +2 -0
  414. package/dist/lib/components/Editor/plugins/actions/share-content-plugin.d.ts.map +1 -0
  415. package/dist/lib/components/Editor/plugins/actions/speech-to-text-plugin.d.ts +7 -0
  416. package/dist/lib/components/Editor/plugins/actions/speech-to-text-plugin.d.ts.map +1 -0
  417. package/dist/lib/components/Editor/plugins/actions/tree-view-plugin.d.ts +3 -0
  418. package/dist/lib/components/Editor/plugins/actions/tree-view-plugin.d.ts.map +1 -0
  419. package/dist/lib/components/Editor/plugins/auto-link-plugin.d.ts +3 -0
  420. package/dist/lib/components/Editor/plugins/auto-link-plugin.d.ts.map +1 -0
  421. package/dist/lib/components/Editor/plugins/autocomplete-plugin.d.ts +11 -0
  422. package/dist/lib/components/Editor/plugins/autocomplete-plugin.d.ts.map +1 -0
  423. package/dist/lib/components/Editor/plugins/code-action-menu-plugin.d.ts +4 -0
  424. package/dist/lib/components/Editor/plugins/code-action-menu-plugin.d.ts.map +1 -0
  425. package/dist/lib/components/Editor/plugins/code-highlight-plugin.d.ts +3 -0
  426. package/dist/lib/components/Editor/plugins/code-highlight-plugin.d.ts.map +1 -0
  427. package/dist/lib/components/Editor/plugins/component-picker-menu-plugin.d.ts +9 -0
  428. package/dist/lib/components/Editor/plugins/component-picker-menu-plugin.d.ts.map +1 -0
  429. package/dist/lib/components/Editor/plugins/context-menu-plugin.d.ts +3 -0
  430. package/dist/lib/components/Editor/plugins/context-menu-plugin.d.ts.map +1 -0
  431. package/dist/lib/components/Editor/plugins/drag-drop-paste-plugin.d.ts +2 -0
  432. package/dist/lib/components/Editor/plugins/drag-drop-paste-plugin.d.ts.map +1 -0
  433. package/dist/lib/components/Editor/plugins/draggable-block-plugin.d.ts +5 -0
  434. package/dist/lib/components/Editor/plugins/draggable-block-plugin.d.ts.map +1 -0
  435. package/dist/lib/components/Editor/plugins/embeds/auto-embed-plugin.d.ts +18 -0
  436. package/dist/lib/components/Editor/plugins/embeds/auto-embed-plugin.d.ts.map +1 -0
  437. package/dist/lib/components/Editor/plugins/embeds/twitter-plugin.d.ts +5 -0
  438. package/dist/lib/components/Editor/plugins/embeds/twitter-plugin.d.ts.map +1 -0
  439. package/dist/lib/components/Editor/plugins/embeds/youtube-plugin.d.ts +5 -0
  440. package/dist/lib/components/Editor/plugins/embeds/youtube-plugin.d.ts.map +1 -0
  441. package/dist/lib/components/Editor/plugins/emoji-picker-plugin.d.ts +2 -0
  442. package/dist/lib/components/Editor/plugins/emoji-picker-plugin.d.ts.map +1 -0
  443. package/dist/lib/components/Editor/plugins/emojis-plugin.d.ts +3 -0
  444. package/dist/lib/components/Editor/plugins/emojis-plugin.d.ts.map +1 -0
  445. package/dist/lib/components/Editor/plugins/floating-link-editor-plugin.d.ts +7 -0
  446. package/dist/lib/components/Editor/plugins/floating-link-editor-plugin.d.ts.map +1 -0
  447. package/dist/lib/components/Editor/plugins/floating-text-format-plugin.d.ts +7 -0
  448. package/dist/lib/components/Editor/plugins/floating-text-format-plugin.d.ts.map +1 -0
  449. package/dist/lib/components/Editor/plugins/images-plugin.d.ts +25 -0
  450. package/dist/lib/components/Editor/plugins/images-plugin.d.ts.map +1 -0
  451. package/dist/lib/components/Editor/plugins/keywords-plugin.d.ts +3 -0
  452. package/dist/lib/components/Editor/plugins/keywords-plugin.d.ts.map +1 -0
  453. package/dist/lib/components/Editor/plugins/layout-plugin.d.ts +13 -0
  454. package/dist/lib/components/Editor/plugins/layout-plugin.d.ts.map +1 -0
  455. package/dist/lib/components/Editor/plugins/link-plugin.d.ts +3 -0
  456. package/dist/lib/components/Editor/plugins/link-plugin.d.ts.map +1 -0
  457. package/dist/lib/components/Editor/plugins/list-max-indent-level-plugin.d.ts +4 -0
  458. package/dist/lib/components/Editor/plugins/list-max-indent-level-plugin.d.ts.map +1 -0
  459. package/dist/lib/components/Editor/plugins/mentions-plugin.d.ts +3 -0
  460. package/dist/lib/components/Editor/plugins/mentions-plugin.d.ts.map +1 -0
  461. package/dist/lib/components/Editor/plugins/picker/alignment-picker-plugin.d.ts +5 -0
  462. package/dist/lib/components/Editor/plugins/picker/alignment-picker-plugin.d.ts.map +1 -0
  463. package/dist/lib/components/Editor/plugins/picker/bulleted-list-picker-plugin.d.ts +3 -0
  464. package/dist/lib/components/Editor/plugins/picker/bulleted-list-picker-plugin.d.ts.map +1 -0
  465. package/dist/lib/components/Editor/plugins/picker/check-list-picker-plugin.d.ts +3 -0
  466. package/dist/lib/components/Editor/plugins/picker/check-list-picker-plugin.d.ts.map +1 -0
  467. package/dist/lib/components/Editor/plugins/picker/code-picker-plugin.d.ts +3 -0
  468. package/dist/lib/components/Editor/plugins/picker/code-picker-plugin.d.ts.map +1 -0
  469. package/dist/lib/components/Editor/plugins/picker/columns-layout-picker-plugin.d.ts +3 -0
  470. package/dist/lib/components/Editor/plugins/picker/columns-layout-picker-plugin.d.ts.map +1 -0
  471. package/dist/lib/components/Editor/plugins/picker/component-picker-menu-plugin.d.ts +2 -0
  472. package/dist/lib/components/Editor/plugins/picker/component-picker-menu-plugin.d.ts.map +1 -0
  473. package/dist/lib/components/Editor/plugins/picker/component-picker-option.d.ts +17 -0
  474. package/dist/lib/components/Editor/plugins/picker/component-picker-option.d.ts.map +1 -0
  475. package/dist/lib/components/Editor/plugins/picker/divider-picker-plugin.d.ts +3 -0
  476. package/dist/lib/components/Editor/plugins/picker/divider-picker-plugin.d.ts.map +1 -0
  477. package/dist/lib/components/Editor/plugins/picker/embeds-picker-plugin.d.ts +5 -0
  478. package/dist/lib/components/Editor/plugins/picker/embeds-picker-plugin.d.ts.map +1 -0
  479. package/dist/lib/components/Editor/plugins/picker/heading-picker-plugin.d.ts +5 -0
  480. package/dist/lib/components/Editor/plugins/picker/heading-picker-plugin.d.ts.map +1 -0
  481. package/dist/lib/components/Editor/plugins/picker/image-picker-plugin.d.ts +3 -0
  482. package/dist/lib/components/Editor/plugins/picker/image-picker-plugin.d.ts.map +1 -0
  483. package/dist/lib/components/Editor/plugins/picker/numbered-list-picker-plugin.d.ts +3 -0
  484. package/dist/lib/components/Editor/plugins/picker/numbered-list-picker-plugin.d.ts.map +1 -0
  485. package/dist/lib/components/Editor/plugins/picker/paragraph-picker-plugin.d.ts +3 -0
  486. package/dist/lib/components/Editor/plugins/picker/paragraph-picker-plugin.d.ts.map +1 -0
  487. package/dist/lib/components/Editor/plugins/picker/quote-picker-plugin.d.ts +3 -0
  488. package/dist/lib/components/Editor/plugins/picker/quote-picker-plugin.d.ts.map +1 -0
  489. package/dist/lib/components/Editor/plugins/picker/table-picker-plugin.d.ts +6 -0
  490. package/dist/lib/components/Editor/plugins/picker/table-picker-plugin.d.ts.map +1 -0
  491. package/dist/lib/components/Editor/plugins/plugins.d.ts +2 -0
  492. package/dist/lib/components/Editor/plugins/plugins.d.ts.map +1 -0
  493. package/dist/lib/components/Editor/plugins/tab-focus-plugin.d.ts +2 -0
  494. package/dist/lib/components/Editor/plugins/tab-focus-plugin.d.ts.map +1 -0
  495. package/dist/lib/components/Editor/plugins/table-plugin.d.ts +34 -0
  496. package/dist/lib/components/Editor/plugins/table-plugin.d.ts.map +1 -0
  497. package/dist/lib/components/Editor/plugins/toolbar/block-format/block-format-data.d.ts +5 -0
  498. package/dist/lib/components/Editor/plugins/toolbar/block-format/block-format-data.d.ts.map +1 -0
  499. package/dist/lib/components/Editor/plugins/toolbar/block-format/format-bulleted-list.d.ts +2 -0
  500. package/dist/lib/components/Editor/plugins/toolbar/block-format/format-bulleted-list.d.ts.map +1 -0
  501. package/dist/lib/components/Editor/plugins/toolbar/block-format/format-check-list.d.ts +2 -0
  502. package/dist/lib/components/Editor/plugins/toolbar/block-format/format-check-list.d.ts.map +1 -0
  503. package/dist/lib/components/Editor/plugins/toolbar/block-format/format-code-block.d.ts +2 -0
  504. package/dist/lib/components/Editor/plugins/toolbar/block-format/format-code-block.d.ts.map +1 -0
  505. package/dist/lib/components/Editor/plugins/toolbar/block-format/format-heading.d.ts +5 -0
  506. package/dist/lib/components/Editor/plugins/toolbar/block-format/format-heading.d.ts.map +1 -0
  507. package/dist/lib/components/Editor/plugins/toolbar/block-format/format-numbered-list.d.ts +2 -0
  508. package/dist/lib/components/Editor/plugins/toolbar/block-format/format-numbered-list.d.ts.map +1 -0
  509. package/dist/lib/components/Editor/plugins/toolbar/block-format/format-paragraph.d.ts +2 -0
  510. package/dist/lib/components/Editor/plugins/toolbar/block-format/format-paragraph.d.ts.map +1 -0
  511. package/dist/lib/components/Editor/plugins/toolbar/block-format/format-quote.d.ts +2 -0
  512. package/dist/lib/components/Editor/plugins/toolbar/block-format/format-quote.d.ts.map +1 -0
  513. package/dist/lib/components/Editor/plugins/toolbar/block-format-toolbar-plugin.d.ts +4 -0
  514. package/dist/lib/components/Editor/plugins/toolbar/block-format-toolbar-plugin.d.ts.map +1 -0
  515. package/dist/lib/components/Editor/plugins/toolbar/block-insert/insert-columns-layout.d.ts +2 -0
  516. package/dist/lib/components/Editor/plugins/toolbar/block-insert/insert-columns-layout.d.ts.map +1 -0
  517. package/dist/lib/components/Editor/plugins/toolbar/block-insert/insert-embeds.d.ts +2 -0
  518. package/dist/lib/components/Editor/plugins/toolbar/block-insert/insert-embeds.d.ts.map +1 -0
  519. package/dist/lib/components/Editor/plugins/toolbar/block-insert/insert-horizontal-rule.d.ts +2 -0
  520. package/dist/lib/components/Editor/plugins/toolbar/block-insert/insert-horizontal-rule.d.ts.map +1 -0
  521. package/dist/lib/components/Editor/plugins/toolbar/block-insert/insert-image.d.ts +2 -0
  522. package/dist/lib/components/Editor/plugins/toolbar/block-insert/insert-image.d.ts.map +1 -0
  523. package/dist/lib/components/Editor/plugins/toolbar/block-insert/insert-table.d.ts +2 -0
  524. package/dist/lib/components/Editor/plugins/toolbar/block-insert/insert-table.d.ts.map +1 -0
  525. package/dist/lib/components/Editor/plugins/toolbar/block-insert-plugin.d.ts +4 -0
  526. package/dist/lib/components/Editor/plugins/toolbar/block-insert-plugin.d.ts.map +1 -0
  527. package/dist/lib/components/Editor/plugins/toolbar/clear-formatting-toolbar-plugin.d.ts +2 -0
  528. package/dist/lib/components/Editor/plugins/toolbar/clear-formatting-toolbar-plugin.d.ts.map +1 -0
  529. package/dist/lib/components/Editor/plugins/toolbar/code-language-toolbar-plugin.d.ts +2 -0
  530. package/dist/lib/components/Editor/plugins/toolbar/code-language-toolbar-plugin.d.ts.map +1 -0
  531. package/dist/lib/components/Editor/plugins/toolbar/element-format-toolbar-plugin.d.ts +4 -0
  532. package/dist/lib/components/Editor/plugins/toolbar/element-format-toolbar-plugin.d.ts.map +1 -0
  533. package/dist/lib/components/Editor/plugins/toolbar/font-background-toolbar-plugin.d.ts +2 -0
  534. package/dist/lib/components/Editor/plugins/toolbar/font-background-toolbar-plugin.d.ts.map +1 -0
  535. package/dist/lib/components/Editor/plugins/toolbar/font-color-toolbar-plugin.d.ts +2 -0
  536. package/dist/lib/components/Editor/plugins/toolbar/font-color-toolbar-plugin.d.ts.map +1 -0
  537. package/dist/lib/components/Editor/plugins/toolbar/font-family-toolbar-plugin.d.ts +2 -0
  538. package/dist/lib/components/Editor/plugins/toolbar/font-family-toolbar-plugin.d.ts.map +1 -0
  539. package/dist/lib/components/Editor/plugins/toolbar/font-format-toolbar-plugin.d.ts +2 -0
  540. package/dist/lib/components/Editor/plugins/toolbar/font-format-toolbar-plugin.d.ts.map +1 -0
  541. package/dist/lib/components/Editor/plugins/toolbar/font-size-toolbar-plugin.d.ts +2 -0
  542. package/dist/lib/components/Editor/plugins/toolbar/font-size-toolbar-plugin.d.ts.map +1 -0
  543. package/dist/lib/components/Editor/plugins/toolbar/history-toolbar-plugin.d.ts +2 -0
  544. package/dist/lib/components/Editor/plugins/toolbar/history-toolbar-plugin.d.ts.map +1 -0
  545. package/dist/lib/components/Editor/plugins/toolbar/horizontal-rule-toolbar-plugin.d.ts +2 -0
  546. package/dist/lib/components/Editor/plugins/toolbar/horizontal-rule-toolbar-plugin.d.ts.map +1 -0
  547. package/dist/lib/components/Editor/plugins/toolbar/image-toolbar-plugin.d.ts +2 -0
  548. package/dist/lib/components/Editor/plugins/toolbar/image-toolbar-plugin.d.ts.map +1 -0
  549. package/dist/lib/components/Editor/plugins/toolbar/link-toolbar-plugin.d.ts +4 -0
  550. package/dist/lib/components/Editor/plugins/toolbar/link-toolbar-plugin.d.ts.map +1 -0
  551. package/dist/lib/components/Editor/plugins/toolbar/subsuper-toolbar-plugin.d.ts +2 -0
  552. package/dist/lib/components/Editor/plugins/toolbar/subsuper-toolbar-plugin.d.ts.map +1 -0
  553. package/dist/lib/components/Editor/plugins/toolbar/table-toolbar-plugin.d.ts +2 -0
  554. package/dist/lib/components/Editor/plugins/toolbar/table-toolbar-plugin.d.ts.map +1 -0
  555. package/dist/lib/components/Editor/plugins/toolbar/toolbar-plugin.d.ts +6 -0
  556. package/dist/lib/components/Editor/plugins/toolbar/toolbar-plugin.d.ts.map +1 -0
  557. package/dist/lib/components/Editor/plugins/typing-pref-plugin.d.ts +4 -0
  558. package/dist/lib/components/Editor/plugins/typing-pref-plugin.d.ts.map +1 -0
  559. package/dist/lib/components/Editor/plugins.d.ts +2 -0
  560. package/dist/lib/components/Editor/plugins.d.ts.map +1 -0
  561. package/dist/lib/components/Editor/shared/can-use-dom.d.ts +2 -0
  562. package/dist/lib/components/Editor/shared/can-use-dom.d.ts.map +1 -0
  563. package/dist/lib/components/Editor/shared/caret-from-point.d.ts +5 -0
  564. package/dist/lib/components/Editor/shared/caret-from-point.d.ts.map +1 -0
  565. package/dist/lib/components/Editor/shared/environment.d.ts +18 -0
  566. package/dist/lib/components/Editor/shared/environment.d.ts.map +1 -0
  567. package/dist/lib/components/Editor/shared/invariant.d.ts +2 -0
  568. package/dist/lib/components/Editor/shared/invariant.d.ts.map +1 -0
  569. package/dist/lib/components/Editor/shared/normalize-class-names.d.ts +2 -0
  570. package/dist/lib/components/Editor/shared/normalize-class-names.d.ts.map +1 -0
  571. package/dist/lib/components/Editor/shared/react-patches.d.ts +2 -0
  572. package/dist/lib/components/Editor/shared/react-patches.d.ts.map +1 -0
  573. package/dist/lib/components/Editor/shared/react-test-utils.d.ts +3 -0
  574. package/dist/lib/components/Editor/shared/react-test-utils.d.ts.map +1 -0
  575. package/dist/lib/components/Editor/shared/simple-diff-with-cursor.d.ts +6 -0
  576. package/dist/lib/components/Editor/shared/simple-diff-with-cursor.d.ts.map +1 -0
  577. package/dist/lib/components/Editor/shared/use-layout-effect.d.ts +4 -0
  578. package/dist/lib/components/Editor/shared/use-layout-effect.d.ts.map +1 -0
  579. package/dist/lib/components/Editor/shared/warn-only-once.d.ts +2 -0
  580. package/dist/lib/components/Editor/shared/warn-only-once.d.ts.map +1 -0
  581. package/dist/lib/components/Editor/themes/editor-theme.d.ts +3 -0
  582. package/dist/lib/components/Editor/themes/editor-theme.d.ts.map +1 -0
  583. package/dist/lib/components/Editor/transformers/index.d.ts +16 -0
  584. package/dist/lib/components/Editor/transformers/index.d.ts.map +1 -0
  585. package/dist/lib/components/Editor/transformers/markdown-emoji-transformer.d.ts +3 -0
  586. package/dist/lib/components/Editor/transformers/markdown-emoji-transformer.d.ts.map +1 -0
  587. package/dist/lib/components/Editor/transformers/markdown-hr-transformer.d.ts +3 -0
  588. package/dist/lib/components/Editor/transformers/markdown-hr-transformer.d.ts.map +1 -0
  589. package/dist/lib/components/Editor/transformers/markdown-image-transformer.d.ts +3 -0
  590. package/dist/lib/components/Editor/transformers/markdown-image-transformer.d.ts.map +1 -0
  591. package/dist/lib/components/Editor/transformers/markdown-table-transformer.d.ts +3 -0
  592. package/dist/lib/components/Editor/transformers/markdown-table-transformer.d.ts.map +1 -0
  593. package/dist/lib/components/Editor/transformers/markdown-tweet-transformer.d.ts +3 -0
  594. package/dist/lib/components/Editor/transformers/markdown-tweet-transformer.d.ts.map +1 -0
  595. package/dist/lib/components/Editor/types.d.ts +23 -0
  596. package/dist/lib/components/Editor/types.d.ts.map +1 -0
  597. package/dist/lib/components/Editor/utils/can-use-dom.d.ts +2 -0
  598. package/dist/lib/components/Editor/utils/can-use-dom.d.ts.map +1 -0
  599. package/dist/lib/components/Editor/utils/collapsible.d.ts +3 -0
  600. package/dist/lib/components/Editor/utils/collapsible.d.ts.map +1 -0
  601. package/dist/lib/components/Editor/utils/doc-serialization.d.ts +4 -0
  602. package/dist/lib/components/Editor/utils/doc-serialization.d.ts.map +1 -0
  603. package/dist/lib/components/Editor/utils/emoji-list.d.ts +21 -0
  604. package/dist/lib/components/Editor/utils/emoji-list.d.ts.map +1 -0
  605. package/dist/lib/components/Editor/utils/get-dom-range-rect.d.ts +2 -0
  606. package/dist/lib/components/Editor/utils/get-dom-range-rect.d.ts.map +1 -0
  607. package/dist/lib/components/Editor/utils/get-selected-node.d.ts +3 -0
  608. package/dist/lib/components/Editor/utils/get-selected-node.d.ts.map +1 -0
  609. package/dist/lib/components/Editor/utils/guard.d.ts +2 -0
  610. package/dist/lib/components/Editor/utils/guard.d.ts.map +1 -0
  611. package/dist/lib/components/Editor/utils/is-mobile-width.d.ts +2 -0
  612. package/dist/lib/components/Editor/utils/is-mobile-width.d.ts.map +1 -0
  613. package/dist/lib/components/Editor/utils/set-floating-elem-position-for-link-editor.d.ts +2 -0
  614. package/dist/lib/components/Editor/utils/set-floating-elem-position-for-link-editor.d.ts.map +1 -0
  615. package/dist/lib/components/Editor/utils/set-floating-elem-position.d.ts +2 -0
  616. package/dist/lib/components/Editor/utils/set-floating-elem-position.d.ts.map +1 -0
  617. package/dist/lib/components/Editor/utils/swipe.d.ts +5 -0
  618. package/dist/lib/components/Editor/utils/swipe.d.ts.map +1 -0
  619. package/dist/lib/components/Editor/utils/url.d.ts +3 -0
  620. package/dist/lib/components/Editor/utils/url.d.ts.map +1 -0
  621. package/dist/lib/components/Empty/Empty.d.ts +12 -0
  622. package/dist/lib/components/Empty/Empty.d.ts.map +1 -0
  623. package/dist/lib/components/Empty/index.d.ts +3 -0
  624. package/dist/lib/components/Empty/index.d.ts.map +1 -0
  625. package/dist/lib/components/ErrorBoundary/ErrorBoundary.d.ts +7 -0
  626. package/dist/lib/components/ErrorBoundary/ErrorBoundary.d.ts.map +1 -0
  627. package/dist/lib/components/ErrorBoundary/ErrorPage.d.ts +38 -0
  628. package/dist/lib/components/ErrorBoundary/ErrorPage.d.ts.map +1 -0
  629. package/dist/lib/components/ErrorBoundary/index.d.ts +3 -0
  630. package/dist/lib/components/ErrorBoundary/index.d.ts.map +1 -0
  631. package/dist/lib/components/FilePreview/FilePreview.d.ts +8 -0
  632. package/dist/lib/components/FilePreview/FilePreview.d.ts.map +1 -0
  633. package/dist/lib/components/FilePreview/index.d.ts +2 -0
  634. package/dist/lib/components/FilePreview/index.d.ts.map +1 -0
  635. package/dist/lib/components/Form/Form.d.ts +5 -3
  636. package/dist/lib/components/Form/Form.d.ts.map +1 -1
  637. package/dist/lib/components/HierarchyGraph/HierarchyGraph.d.ts +24 -0
  638. package/dist/lib/components/HierarchyGraph/HierarchyGraph.d.ts.map +1 -0
  639. package/dist/lib/components/HierarchyGraph/index.d.ts +5 -0
  640. package/dist/lib/components/HierarchyGraph/index.d.ts.map +1 -0
  641. package/dist/lib/components/PageHeader/PageHeader.d.ts +8 -0
  642. package/dist/lib/components/PageHeader/PageHeader.d.ts.map +1 -0
  643. package/dist/lib/components/PageHeader/PageHeaderSkeleton.d.ts +10 -0
  644. package/dist/lib/components/PageHeader/PageHeaderSkeleton.d.ts.map +1 -0
  645. package/dist/lib/components/PageHeader/index.d.ts +3 -0
  646. package/dist/lib/components/PageHeader/index.d.ts.map +1 -0
  647. package/dist/lib/components/PhoneField/PhoneField.d.ts.map +1 -1
  648. package/dist/lib/components/RadioGroup/RadioGroup.d.ts +23 -0
  649. package/dist/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -0
  650. package/dist/lib/components/RadioGroup/index.d.ts +3 -0
  651. package/dist/lib/components/RadioGroup/index.d.ts.map +1 -0
  652. package/dist/lib/components/Select/Select.d.ts +8 -10
  653. package/dist/lib/components/Select/Select.d.ts.map +1 -1
  654. package/dist/lib/components/Select/SelectFilter.d.ts +20 -0
  655. package/dist/lib/components/Select/SelectFilter.d.ts.map +1 -0
  656. package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts +3 -1
  657. package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  658. package/dist/lib/components/Select/components/MultiSelect/MultiSelectFilter.d.ts +13 -6
  659. package/dist/lib/components/Select/components/MultiSelect/MultiSelectFilter.d.ts.map +1 -1
  660. package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts +17 -1
  661. package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts.map +1 -1
  662. package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts +9 -2
  663. package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts.map +1 -1
  664. package/dist/lib/components/Select/hooks/useMultiSelect.d.ts +2 -1
  665. package/dist/lib/components/Select/hooks/useMultiSelect.d.ts.map +1 -1
  666. package/dist/lib/components/Select/hooks/useSelect.d.ts +3 -1
  667. package/dist/lib/components/Select/hooks/useSelect.d.ts.map +1 -1
  668. package/dist/lib/components/Select/hooks/useSingleSelect.d.ts +2 -1
  669. package/dist/lib/components/Select/hooks/useSingleSelect.d.ts.map +1 -1
  670. package/dist/lib/components/Select/index.d.ts +4 -2
  671. package/dist/lib/components/Select/index.d.ts.map +1 -1
  672. package/dist/lib/components/Select/types.d.ts +8 -1
  673. package/dist/lib/components/Select/types.d.ts.map +1 -1
  674. package/dist/lib/components/Sidebar/Sidebar.d.ts +24 -0
  675. package/dist/lib/components/Sidebar/Sidebar.d.ts.map +1 -0
  676. package/dist/lib/components/Sidebar/index.d.ts +2 -0
  677. package/dist/lib/components/Sidebar/index.d.ts.map +1 -0
  678. package/dist/lib/components/Sortable/Sortable.d.ts +39 -0
  679. package/dist/lib/components/Sortable/Sortable.d.ts.map +1 -0
  680. package/dist/lib/components/Sortable/index.d.ts +3 -0
  681. package/dist/lib/components/Sortable/index.d.ts.map +1 -0
  682. package/dist/lib/components/StepProgressIndicator/StepProgressIndicator.d.ts +12 -0
  683. package/dist/lib/components/StepProgressIndicator/StepProgressIndicator.d.ts.map +1 -0
  684. package/dist/lib/components/StepProgressIndicator/index.d.ts +3 -0
  685. package/dist/lib/components/StepProgressIndicator/index.d.ts.map +1 -0
  686. package/dist/lib/components/Switch/Switch.d.ts.map +1 -1
  687. package/dist/lib/components/Tabs/Tabs.d.ts +27 -0
  688. package/dist/lib/components/Tabs/Tabs.d.ts.map +1 -0
  689. package/dist/lib/components/Tabs/TabsSkeleton.d.ts +11 -0
  690. package/dist/lib/components/Tabs/TabsSkeleton.d.ts.map +1 -0
  691. package/dist/lib/components/Tabs/index.d.ts +3 -0
  692. package/dist/lib/components/Tabs/index.d.ts.map +1 -0
  693. package/dist/lib/components/TextArea/TextArea.d.ts.map +1 -1
  694. package/dist/lib/components/UploadFile/UploadFile.d.ts +26 -0
  695. package/dist/lib/components/UploadFile/UploadFile.d.ts.map +1 -0
  696. package/dist/lib/components/UploadFile/index.d.ts +2 -0
  697. package/dist/lib/components/UploadFile/index.d.ts.map +1 -0
  698. package/dist/lib/components/ValueFilter/ValueFilter.d.ts +11 -0
  699. package/dist/lib/components/ValueFilter/ValueFilter.d.ts.map +1 -0
  700. package/dist/lib/components/ValueFilter/index.d.ts +3 -0
  701. package/dist/lib/components/ValueFilter/index.d.ts.map +1 -0
  702. package/dist/lib/components/ViewTabs/ViewTabs.d.ts +23 -0
  703. package/dist/lib/components/ViewTabs/ViewTabs.d.ts.map +1 -0
  704. package/dist/lib/components/ViewTabs/index.d.ts +3 -0
  705. package/dist/lib/components/ViewTabs/index.d.ts.map +1 -0
  706. package/dist/lib/components/index.d.ts +19 -0
  707. package/dist/lib/components/index.d.ts.map +1 -1
  708. package/dist/lib/config/index.d.ts +6 -0
  709. package/dist/lib/config/index.d.ts.map +1 -1
  710. package/dist/lib/context/ConfirmContext.d.ts +21 -0
  711. package/dist/lib/context/ConfirmContext.d.ts.map +1 -0
  712. package/dist/lib/context/index.d.ts +1 -0
  713. package/dist/lib/context/index.d.ts.map +1 -1
  714. package/dist/lib/hooks/index.d.ts +5 -0
  715. package/dist/lib/hooks/index.d.ts.map +1 -1
  716. package/dist/lib/hooks/useConfirm.d.ts +4 -0
  717. package/dist/lib/hooks/useConfirm.d.ts.map +1 -0
  718. package/dist/lib/hooks/useDialog.d.ts +11 -0
  719. package/dist/lib/hooks/useDialog.d.ts.map +1 -0
  720. package/dist/lib/hooks/useIsMobile.d.ts +2 -0
  721. package/dist/lib/hooks/useIsMobile.d.ts.map +1 -0
  722. package/dist/lib/hooks/useSlugParams.d.ts +12 -0
  723. package/dist/lib/hooks/useSlugParams.d.ts.map +1 -0
  724. package/dist/lib/hooks/useTimer.d.ts +6 -0
  725. package/dist/lib/hooks/useTimer.d.ts.map +1 -0
  726. package/dist/lib/index.d.ts +1 -0
  727. package/dist/lib/index.d.ts.map +1 -1
  728. package/dist/lib/selects/app/AppFilter.d.ts +11 -0
  729. package/dist/lib/selects/app/AppFilter.d.ts.map +1 -0
  730. package/dist/lib/selects/app/AppSelector.d.ts +4 -0
  731. package/dist/lib/selects/app/AppSelector.d.ts.map +1 -0
  732. package/dist/lib/selects/app/index.d.ts +3 -0
  733. package/dist/lib/selects/app/index.d.ts.map +1 -0
  734. package/dist/lib/selects/app-code/AppCodeFilter.d.ts +11 -0
  735. package/dist/lib/selects/app-code/AppCodeFilter.d.ts.map +1 -0
  736. package/dist/lib/selects/app-code/AppCodeSelector.d.ts +4 -0
  737. package/dist/lib/selects/app-code/AppCodeSelector.d.ts.map +1 -0
  738. package/dist/lib/selects/app-code/index.d.ts +3 -0
  739. package/dist/lib/selects/app-code/index.d.ts.map +1 -0
  740. package/dist/lib/selects/cloud-provider/CloudProviderFilter.d.ts +11 -0
  741. package/dist/lib/selects/cloud-provider/CloudProviderFilter.d.ts.map +1 -0
  742. package/dist/lib/selects/cloud-provider/CloudProviderSelector.d.ts +4 -0
  743. package/dist/lib/selects/cloud-provider/CloudProviderSelector.d.ts.map +1 -0
  744. package/dist/lib/selects/cloud-provider/index.d.ts +3 -0
  745. package/dist/lib/selects/cloud-provider/index.d.ts.map +1 -0
  746. package/dist/lib/selects/currency/CurrencyFilter.d.ts +11 -0
  747. package/dist/lib/selects/currency/CurrencyFilter.d.ts.map +1 -0
  748. package/dist/lib/selects/currency/CurrencySelector.d.ts +4 -0
  749. package/dist/lib/selects/currency/CurrencySelector.d.ts.map +1 -0
  750. package/dist/lib/selects/currency/currencies.d.ts +3 -0
  751. package/dist/lib/selects/currency/currencies.d.ts.map +1 -0
  752. package/dist/lib/selects/currency/index.d.ts +3 -0
  753. package/dist/lib/selects/currency/index.d.ts.map +1 -0
  754. package/dist/lib/selects/deployment/DeploymentFilter.d.ts +11 -0
  755. package/dist/lib/selects/deployment/DeploymentFilter.d.ts.map +1 -0
  756. package/dist/lib/selects/deployment/DeploymentSelector.d.ts +4 -0
  757. package/dist/lib/selects/deployment/DeploymentSelector.d.ts.map +1 -0
  758. package/dist/lib/selects/deployment/index.d.ts +3 -0
  759. package/dist/lib/selects/deployment/index.d.ts.map +1 -0
  760. package/dist/lib/selects/feature/FeatureFilter.d.ts +11 -0
  761. package/dist/lib/selects/feature/FeatureFilter.d.ts.map +1 -0
  762. package/dist/lib/selects/feature/FeatureSelector.d.ts +4 -0
  763. package/dist/lib/selects/feature/FeatureSelector.d.ts.map +1 -0
  764. package/dist/lib/selects/feature/index.d.ts +3 -0
  765. package/dist/lib/selects/feature/index.d.ts.map +1 -0
  766. package/dist/lib/selects/index.d.ts +12 -0
  767. package/dist/lib/selects/index.d.ts.map +1 -0
  768. package/dist/lib/selects/industry/IndustryFilter.d.ts +11 -0
  769. package/dist/lib/selects/industry/IndustryFilter.d.ts.map +1 -0
  770. package/dist/lib/selects/industry/IndustrySelector.d.ts +4 -0
  771. package/dist/lib/selects/industry/IndustrySelector.d.ts.map +1 -0
  772. package/dist/lib/selects/industry/index.d.ts +3 -0
  773. package/dist/lib/selects/industry/index.d.ts.map +1 -0
  774. package/dist/lib/selects/locale/LocaleFilter.d.ts +11 -0
  775. package/dist/lib/selects/locale/LocaleFilter.d.ts.map +1 -0
  776. package/dist/lib/selects/locale/LocaleSelector.d.ts +4 -0
  777. package/dist/lib/selects/locale/LocaleSelector.d.ts.map +1 -0
  778. package/dist/lib/selects/locale/index.d.ts +3 -0
  779. package/dist/lib/selects/locale/index.d.ts.map +1 -0
  780. package/dist/lib/selects/locale/locales.d.ts +3 -0
  781. package/dist/lib/selects/locale/locales.d.ts.map +1 -0
  782. package/dist/lib/selects/microfrontend/MicrofrontendSelector.d.ts +4 -0
  783. package/dist/lib/selects/microfrontend/MicrofrontendSelector.d.ts.map +1 -0
  784. package/dist/lib/selects/microfrontend/index.d.ts +2 -0
  785. package/dist/lib/selects/microfrontend/index.d.ts.map +1 -0
  786. package/dist/lib/selects/plan/PlanFilter.d.ts +11 -0
  787. package/dist/lib/selects/plan/PlanFilter.d.ts.map +1 -0
  788. package/dist/lib/selects/plan/PlanSelector.d.ts +4 -0
  789. package/dist/lib/selects/plan/PlanSelector.d.ts.map +1 -0
  790. package/dist/lib/selects/plan/index.d.ts +3 -0
  791. package/dist/lib/selects/plan/index.d.ts.map +1 -0
  792. package/dist/lib/selects/region/RegionFilter.d.ts +11 -0
  793. package/dist/lib/selects/region/RegionFilter.d.ts.map +1 -0
  794. package/dist/lib/selects/region/RegionSelector.d.ts +4 -0
  795. package/dist/lib/selects/region/RegionSelector.d.ts.map +1 -0
  796. package/dist/lib/selects/region/index.d.ts +3 -0
  797. package/dist/lib/selects/region/index.d.ts.map +1 -0
  798. package/dist/lib/selects/timezone/TimezoneFilter.d.ts +11 -0
  799. package/dist/lib/selects/timezone/TimezoneFilter.d.ts.map +1 -0
  800. package/dist/lib/selects/timezone/TimezoneSelector.d.ts +4 -0
  801. package/dist/lib/selects/timezone/TimezoneSelector.d.ts.map +1 -0
  802. package/dist/lib/selects/timezone/index.d.ts +3 -0
  803. package/dist/lib/selects/timezone/index.d.ts.map +1 -0
  804. package/dist/lib/selects/timezone/timezones.d.ts +3 -0
  805. package/dist/lib/selects/timezone/timezones.d.ts.map +1 -0
  806. package/dist/lib/services/table-views.service.d.ts +25 -0
  807. package/dist/lib/services/table-views.service.d.ts.map +1 -0
  808. package/dist/lib/types/api-response.d.ts +21 -0
  809. package/dist/lib/types/api-response.d.ts.map +1 -0
  810. package/dist/lib/types/table-filter.d.ts +41 -0
  811. package/dist/lib/types/table-filter.d.ts.map +1 -0
  812. package/dist/lib/utils/axios.d.ts.map +1 -1
  813. package/dist/lib/utils/index.d.ts +1 -0
  814. package/dist/lib/utils/index.d.ts.map +1 -1
  815. package/dist/lib/utils/motion.d.ts +2 -0
  816. package/dist/lib/utils/motion.d.ts.map +1 -0
  817. package/dist/lib/utils/slug.d.ts +7 -0
  818. package/dist/lib/utils/slug.d.ts.map +1 -0
  819. package/dist/plus.js +18 -0
  820. package/dist/plus.js.map +1 -0
  821. package/dist/popover.js +3 -299
  822. package/dist/popover.js.map +1 -1
  823. package/dist/proxy.js +11392 -0
  824. package/dist/proxy.js.map +1 -0
  825. package/dist/react-error-boundary.js +67 -0
  826. package/dist/react-error-boundary.js.map +1 -0
  827. package/dist/select2.js +116 -0
  828. package/dist/select2.js.map +1 -0
  829. package/dist/selects/app-code.js +37 -0
  830. package/dist/selects/app-code.js.map +1 -0
  831. package/dist/selects/app.js +2 -0
  832. package/dist/selects/app.js.map +1 -0
  833. package/dist/selects/cloud-provider.js +2 -0
  834. package/dist/selects/cloud-provider.js.map +1 -0
  835. package/dist/selects/currency.js +2 -0
  836. package/dist/selects/currency.js.map +1 -0
  837. package/dist/selects/deployment.js +2 -0
  838. package/dist/selects/deployment.js.map +1 -0
  839. package/dist/selects/feature.js +2 -0
  840. package/dist/selects/feature.js.map +1 -0
  841. package/dist/selects/industry.js +2 -0
  842. package/dist/selects/industry.js.map +1 -0
  843. package/dist/selects/locale.js +2 -0
  844. package/dist/selects/locale.js.map +1 -0
  845. package/dist/selects/microfrontend.js +2 -0
  846. package/dist/selects/microfrontend.js.map +1 -0
  847. package/dist/selects/plan.js +2 -0
  848. package/dist/selects/plan.js.map +1 -0
  849. package/dist/selects/region.js +2 -0
  850. package/dist/selects/region.js.map +1 -0
  851. package/dist/selects/timezone.js +2 -0
  852. package/dist/selects/timezone.js.map +1 -0
  853. package/dist/separator2.js +2 -28
  854. package/dist/separator2.js.map +1 -1
  855. package/dist/shadcn/index.d.ts +2 -0
  856. package/dist/shadcn/index.d.ts.map +1 -1
  857. package/dist/shadcn/shadcnBreadcrumb/breadcrumb.d.ts +18 -0
  858. package/dist/shadcn/shadcnBreadcrumb/breadcrumb.d.ts.map +1 -0
  859. package/dist/shadcn/shadcnBreadcrumb/index.d.ts +2 -0
  860. package/dist/shadcn/shadcnBreadcrumb/index.d.ts.map +1 -0
  861. package/dist/shadcn/shadcnCalendar/calendar.d.ts +1 -1
  862. package/dist/shadcn/shadcnCalendar/calendar.d.ts.map +1 -1
  863. package/dist/shadcn/shadcnChart/Chart.d.ts +2 -2
  864. package/dist/shadcn/shadcnChart/Chart.d.ts.map +1 -1
  865. package/dist/shadcn/shadcnCollapsible/collapsible.d.ts +7 -0
  866. package/dist/shadcn/shadcnCollapsible/collapsible.d.ts.map +1 -0
  867. package/dist/shadcn/shadcnCollapsible/index.d.ts +2 -0
  868. package/dist/shadcn/shadcnCollapsible/index.d.ts.map +1 -0
  869. package/dist/shadcn/shadcnDialog/dialog.d.ts +20 -0
  870. package/dist/shadcn/shadcnDialog/dialog.d.ts.map +1 -0
  871. package/dist/shadcn/shadcnDialog/index.d.ts +2 -0
  872. package/dist/shadcn/shadcnDialog/index.d.ts.map +1 -0
  873. package/dist/shadcn/shadcnDropdownMenu/dropdown-menu.d.ts +1 -1
  874. package/dist/shadcn/shadcnDropdownMenu/dropdown-menu.d.ts.map +1 -1
  875. package/dist/shadcn/shadcnForm/form.d.ts +1 -1
  876. package/dist/shadcn/shadcnForm/form.d.ts.map +1 -1
  877. package/dist/shadcn/shadcnInputOTP/InputOTP.d.ts +1 -1
  878. package/dist/shadcn/shadcnInputOTP/InputOTP.d.ts.map +1 -1
  879. package/dist/shadcn/shadcnMultiSelect/multi-select.d.ts +1 -1
  880. package/dist/shadcn/shadcnMultiSelect/multi-select.d.ts.map +1 -1
  881. package/dist/shadcn/shadcnProgress/Progress.d.ts +1 -1
  882. package/dist/shadcn/shadcnProgress/Progress.d.ts.map +1 -1
  883. package/dist/shadcn/shadcnRadioGroup/RadioGroup.d.ts +6 -0
  884. package/dist/shadcn/shadcnRadioGroup/RadioGroup.d.ts.map +1 -0
  885. package/dist/shadcn/shadcnRadioGroup/index.d.ts +2 -0
  886. package/dist/shadcn/shadcnRadioGroup/index.d.ts.map +1 -0
  887. package/dist/shadcn/shadcnSheet/sheet.d.ts +1 -1
  888. package/dist/shadcn/shadcnSheet/sheet.d.ts.map +1 -1
  889. package/dist/shadcn/shadcnSidebar/index.d.ts +2 -0
  890. package/dist/shadcn/shadcnSidebar/index.d.ts.map +1 -0
  891. package/dist/shadcn/shadcnSidebar/sidebar.d.ts +86 -0
  892. package/dist/shadcn/shadcnSidebar/sidebar.d.ts.map +1 -0
  893. package/dist/shadcn/shadcnSingleSelect/single-select.d.ts +2 -1
  894. package/dist/shadcn/shadcnSingleSelect/single-select.d.ts.map +1 -1
  895. package/dist/shadcn/shadcnSwitch/Switch.d.ts.map +1 -1
  896. package/dist/shadcn/shadcnTable/table.d.ts +1 -1
  897. package/dist/shadcn/shadcnTable/table.d.ts.map +1 -1
  898. package/dist/shadcn/shadcnTabs/index.d.ts +2 -0
  899. package/dist/shadcn/shadcnTabs/index.d.ts.map +1 -0
  900. package/dist/shadcn/shadcnTabs/tabs.d.ts +8 -0
  901. package/dist/shadcn/shadcnTabs/tabs.d.ts.map +1 -0
  902. package/dist/shadcn/shadcnTooltip/tooltip.d.ts +1 -1
  903. package/dist/shadcn/shadcnTooltip/tooltip.d.ts.map +1 -1
  904. package/dist/share-2.js +42 -0
  905. package/dist/share-2.js.map +1 -0
  906. package/dist/text-align-justify.js +34 -0
  907. package/dist/text-align-justify.js.map +1 -0
  908. package/dist/trash-2.js +55 -0
  909. package/dist/trash-2.js.map +1 -0
  910. package/dist/types/api-response.js +2 -0
  911. package/dist/types/api-response.js.map +1 -0
  912. package/dist/types/table-filter.js +17 -0
  913. package/dist/types/table-filter.js.map +1 -0
  914. package/dist/upload.js +19 -0
  915. package/dist/upload.js.map +1 -0
  916. package/dist/useConfirm.js +37 -0
  917. package/dist/useConfirm.js.map +1 -0
  918. package/dist/useDataTable.js +26545 -0
  919. package/dist/useDataTable.js.map +1 -0
  920. package/dist/useIsMobile.js +19 -0
  921. package/dist/useIsMobile.js.map +1 -0
  922. package/dist/{useSSE.js → useTimer.js} +33 -3
  923. package/dist/useTimer.js.map +1 -0
  924. package/dist/utils/axios.js +2 -4167
  925. package/dist/utils/axios.js.map +1 -1
  926. package/dist/utils/motion.js +4425 -0
  927. package/dist/utils/motion.js.map +1 -0
  928. package/dist/utils/slug.js +15 -0
  929. package/dist/utils/slug.js.map +1 -0
  930. package/dist/utils.js +3137 -3750
  931. package/dist/utils.js.map +1 -1
  932. package/dist/value.js +820 -0
  933. package/dist/value.js.map +1 -0
  934. package/package.json +186 -3
  935. package/dist/lib/components/DataTable/components/DataTableToolbar.d.ts +0 -15
  936. package/dist/lib/components/DataTable/components/DataTableToolbar.d.ts.map +0 -1
  937. package/dist/useSSE.js.map +0 -1
  938. package/dist/utils2.js +0 -3042
  939. package/dist/utils2.js.map +0 -1
@@ -0,0 +1,4517 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import React__default, { useMemo, useRef, useLayoutEffect, useEffect, useCallback, useState, memo, useReducer, useContext, createContext } from 'react';
4
+ import { unstable_batchedUpdates, createPortal } from 'react-dom';
5
+ import { c as cn } from './utils.js';
6
+ import { G as GripVertical } from './grip-vertical.js';
7
+
8
+ function useCombinedRefs() {
9
+ for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
10
+ refs[_key] = arguments[_key];
11
+ }
12
+
13
+ return useMemo(() => node => {
14
+ refs.forEach(ref => ref(node));
15
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps
16
+ refs);
17
+ }
18
+
19
+ // https://github.com/facebook/react/blob/master/packages/shared/ExecutionEnvironment.js
20
+ const canUseDOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
21
+
22
+ function isWindow(element) {
23
+ const elementString = Object.prototype.toString.call(element);
24
+ return elementString === '[object Window]' || // In Electron context the Window object serializes to [object global]
25
+ elementString === '[object global]';
26
+ }
27
+
28
+ function isNode(node) {
29
+ return 'nodeType' in node;
30
+ }
31
+
32
+ function getWindow(target) {
33
+ var _target$ownerDocument, _target$ownerDocument2;
34
+
35
+ if (!target) {
36
+ return window;
37
+ }
38
+
39
+ if (isWindow(target)) {
40
+ return target;
41
+ }
42
+
43
+ if (!isNode(target)) {
44
+ return window;
45
+ }
46
+
47
+ return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window;
48
+ }
49
+
50
+ function isDocument(node) {
51
+ const {
52
+ Document
53
+ } = getWindow(node);
54
+ return node instanceof Document;
55
+ }
56
+
57
+ function isHTMLElement(node) {
58
+ if (isWindow(node)) {
59
+ return false;
60
+ }
61
+
62
+ return node instanceof getWindow(node).HTMLElement;
63
+ }
64
+
65
+ function isSVGElement(node) {
66
+ return node instanceof getWindow(node).SVGElement;
67
+ }
68
+
69
+ function getOwnerDocument(target) {
70
+ if (!target) {
71
+ return document;
72
+ }
73
+
74
+ if (isWindow(target)) {
75
+ return target.document;
76
+ }
77
+
78
+ if (!isNode(target)) {
79
+ return document;
80
+ }
81
+
82
+ if (isDocument(target)) {
83
+ return target;
84
+ }
85
+
86
+ if (isHTMLElement(target) || isSVGElement(target)) {
87
+ return target.ownerDocument;
88
+ }
89
+
90
+ return document;
91
+ }
92
+
93
+ /**
94
+ * A hook that resolves to useEffect on the server and useLayoutEffect on the client
95
+ * @param callback {function} Callback function that is invoked when the dependencies of the hook change
96
+ */
97
+
98
+ const useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
99
+
100
+ function useEvent(handler) {
101
+ const handlerRef = useRef(handler);
102
+ useIsomorphicLayoutEffect(() => {
103
+ handlerRef.current = handler;
104
+ });
105
+ return useCallback(function () {
106
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
107
+ args[_key] = arguments[_key];
108
+ }
109
+
110
+ return handlerRef.current == null ? void 0 : handlerRef.current(...args);
111
+ }, []);
112
+ }
113
+
114
+ function useInterval() {
115
+ const intervalRef = useRef(null);
116
+ const set = useCallback((listener, duration) => {
117
+ intervalRef.current = setInterval(listener, duration);
118
+ }, []);
119
+ const clear = useCallback(() => {
120
+ if (intervalRef.current !== null) {
121
+ clearInterval(intervalRef.current);
122
+ intervalRef.current = null;
123
+ }
124
+ }, []);
125
+ return [set, clear];
126
+ }
127
+
128
+ function useLatestValue(value, dependencies) {
129
+ if (dependencies === void 0) {
130
+ dependencies = [value];
131
+ }
132
+
133
+ const valueRef = useRef(value);
134
+ useIsomorphicLayoutEffect(() => {
135
+ if (valueRef.current !== value) {
136
+ valueRef.current = value;
137
+ }
138
+ }, dependencies);
139
+ return valueRef;
140
+ }
141
+
142
+ function useLazyMemo(callback, dependencies) {
143
+ const valueRef = useRef();
144
+ return useMemo(() => {
145
+ const newValue = callback(valueRef.current);
146
+ valueRef.current = newValue;
147
+ return newValue;
148
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps
149
+ [...dependencies]);
150
+ }
151
+
152
+ function useNodeRef(onChange) {
153
+ const onChangeHandler = useEvent(onChange);
154
+ const node = useRef(null);
155
+ const setNodeRef = useCallback(element => {
156
+ if (element !== node.current) {
157
+ onChangeHandler == null ? void 0 : onChangeHandler(element, node.current);
158
+ }
159
+
160
+ node.current = element;
161
+ }, //eslint-disable-next-line
162
+ []);
163
+ return [node, setNodeRef];
164
+ }
165
+
166
+ function usePrevious(value) {
167
+ const ref = useRef();
168
+ useEffect(() => {
169
+ ref.current = value;
170
+ }, [value]);
171
+ return ref.current;
172
+ }
173
+
174
+ let ids = {};
175
+ function useUniqueId(prefix, value) {
176
+ return useMemo(() => {
177
+ if (value) {
178
+ return value;
179
+ }
180
+
181
+ const id = ids[prefix] == null ? 0 : ids[prefix] + 1;
182
+ ids[prefix] = id;
183
+ return prefix + "-" + id;
184
+ }, [prefix, value]);
185
+ }
186
+
187
+ function createAdjustmentFn(modifier) {
188
+ return function (object) {
189
+ for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
190
+ adjustments[_key - 1] = arguments[_key];
191
+ }
192
+
193
+ return adjustments.reduce((accumulator, adjustment) => {
194
+ const entries = Object.entries(adjustment);
195
+
196
+ for (const [key, valueAdjustment] of entries) {
197
+ const value = accumulator[key];
198
+
199
+ if (value != null) {
200
+ accumulator[key] = value + modifier * valueAdjustment;
201
+ }
202
+ }
203
+
204
+ return accumulator;
205
+ }, { ...object
206
+ });
207
+ };
208
+ }
209
+
210
+ const add = /*#__PURE__*/createAdjustmentFn(1);
211
+ const subtract = /*#__PURE__*/createAdjustmentFn(-1);
212
+
213
+ function hasViewportRelativeCoordinates(event) {
214
+ return 'clientX' in event && 'clientY' in event;
215
+ }
216
+
217
+ function isKeyboardEvent(event) {
218
+ if (!event) {
219
+ return false;
220
+ }
221
+
222
+ const {
223
+ KeyboardEvent
224
+ } = getWindow(event.target);
225
+ return KeyboardEvent && event instanceof KeyboardEvent;
226
+ }
227
+
228
+ function isTouchEvent(event) {
229
+ if (!event) {
230
+ return false;
231
+ }
232
+
233
+ const {
234
+ TouchEvent
235
+ } = getWindow(event.target);
236
+ return TouchEvent && event instanceof TouchEvent;
237
+ }
238
+
239
+ /**
240
+ * Returns the normalized x and y coordinates for mouse and touch events.
241
+ */
242
+
243
+ function getEventCoordinates(event) {
244
+ if (isTouchEvent(event)) {
245
+ if (event.touches && event.touches.length) {
246
+ const {
247
+ clientX: x,
248
+ clientY: y
249
+ } = event.touches[0];
250
+ return {
251
+ x,
252
+ y
253
+ };
254
+ } else if (event.changedTouches && event.changedTouches.length) {
255
+ const {
256
+ clientX: x,
257
+ clientY: y
258
+ } = event.changedTouches[0];
259
+ return {
260
+ x,
261
+ y
262
+ };
263
+ }
264
+ }
265
+
266
+ if (hasViewportRelativeCoordinates(event)) {
267
+ return {
268
+ x: event.clientX,
269
+ y: event.clientY
270
+ };
271
+ }
272
+
273
+ return null;
274
+ }
275
+
276
+ const CSS = /*#__PURE__*/Object.freeze({
277
+ Translate: {
278
+ toString(transform) {
279
+ if (!transform) {
280
+ return;
281
+ }
282
+
283
+ const {
284
+ x,
285
+ y
286
+ } = transform;
287
+ return "translate3d(" + (x ? Math.round(x) : 0) + "px, " + (y ? Math.round(y) : 0) + "px, 0)";
288
+ }
289
+
290
+ },
291
+ Scale: {
292
+ toString(transform) {
293
+ if (!transform) {
294
+ return;
295
+ }
296
+
297
+ const {
298
+ scaleX,
299
+ scaleY
300
+ } = transform;
301
+ return "scaleX(" + scaleX + ") scaleY(" + scaleY + ")";
302
+ }
303
+
304
+ },
305
+ Transform: {
306
+ toString(transform) {
307
+ if (!transform) {
308
+ return;
309
+ }
310
+
311
+ return [CSS.Translate.toString(transform), CSS.Scale.toString(transform)].join(' ');
312
+ }
313
+
314
+ },
315
+ Transition: {
316
+ toString(_ref) {
317
+ let {
318
+ property,
319
+ duration,
320
+ easing
321
+ } = _ref;
322
+ return property + " " + duration + "ms " + easing;
323
+ }
324
+
325
+ }
326
+ });
327
+
328
+ const SELECTOR = 'a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]';
329
+ function findFirstFocusableNode(element) {
330
+ if (element.matches(SELECTOR)) {
331
+ return element;
332
+ }
333
+
334
+ return element.querySelector(SELECTOR);
335
+ }
336
+
337
+ const hiddenStyles = {
338
+ display: 'none'
339
+ };
340
+ function HiddenText(_ref) {
341
+ let {
342
+ id,
343
+ value
344
+ } = _ref;
345
+ return React__default.createElement("div", {
346
+ id: id,
347
+ style: hiddenStyles
348
+ }, value);
349
+ }
350
+
351
+ function LiveRegion(_ref) {
352
+ let {
353
+ id,
354
+ announcement,
355
+ ariaLiveType = "assertive"
356
+ } = _ref;
357
+ // Hide element visually but keep it readable by screen readers
358
+ const visuallyHidden = {
359
+ position: 'fixed',
360
+ top: 0,
361
+ left: 0,
362
+ width: 1,
363
+ height: 1,
364
+ margin: -1,
365
+ border: 0,
366
+ padding: 0,
367
+ overflow: 'hidden',
368
+ clip: 'rect(0 0 0 0)',
369
+ clipPath: 'inset(100%)',
370
+ whiteSpace: 'nowrap'
371
+ };
372
+ return React__default.createElement("div", {
373
+ id: id,
374
+ style: visuallyHidden,
375
+ role: "status",
376
+ "aria-live": ariaLiveType,
377
+ "aria-atomic": true
378
+ }, announcement);
379
+ }
380
+
381
+ function useAnnouncement() {
382
+ const [announcement, setAnnouncement] = useState('');
383
+ const announce = useCallback(value => {
384
+ if (value != null) {
385
+ setAnnouncement(value);
386
+ }
387
+ }, []);
388
+ return {
389
+ announce,
390
+ announcement
391
+ };
392
+ }
393
+
394
+ const DndMonitorContext = /*#__PURE__*/createContext(null);
395
+
396
+ function useDndMonitor(listener) {
397
+ const registerListener = useContext(DndMonitorContext);
398
+ useEffect(() => {
399
+ if (!registerListener) {
400
+ throw new Error('useDndMonitor must be used within a children of <DndContext>');
401
+ }
402
+
403
+ const unsubscribe = registerListener(listener);
404
+ return unsubscribe;
405
+ }, [listener, registerListener]);
406
+ }
407
+
408
+ function useDndMonitorProvider() {
409
+ const [listeners] = useState(() => new Set());
410
+ const registerListener = useCallback(listener => {
411
+ listeners.add(listener);
412
+ return () => listeners.delete(listener);
413
+ }, [listeners]);
414
+ const dispatch = useCallback(_ref => {
415
+ let {
416
+ type,
417
+ event
418
+ } = _ref;
419
+ listeners.forEach(listener => {
420
+ var _listener$type;
421
+
422
+ return (_listener$type = listener[type]) == null ? void 0 : _listener$type.call(listener, event);
423
+ });
424
+ }, [listeners]);
425
+ return [dispatch, registerListener];
426
+ }
427
+
428
+ const defaultScreenReaderInstructions = {
429
+ draggable: "\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "
430
+ };
431
+ const defaultAnnouncements = {
432
+ onDragStart(_ref) {
433
+ let {
434
+ active
435
+ } = _ref;
436
+ return "Picked up draggable item " + active.id + ".";
437
+ },
438
+
439
+ onDragOver(_ref2) {
440
+ let {
441
+ active,
442
+ over
443
+ } = _ref2;
444
+
445
+ if (over) {
446
+ return "Draggable item " + active.id + " was moved over droppable area " + over.id + ".";
447
+ }
448
+
449
+ return "Draggable item " + active.id + " is no longer over a droppable area.";
450
+ },
451
+
452
+ onDragEnd(_ref3) {
453
+ let {
454
+ active,
455
+ over
456
+ } = _ref3;
457
+
458
+ if (over) {
459
+ return "Draggable item " + active.id + " was dropped over droppable area " + over.id;
460
+ }
461
+
462
+ return "Draggable item " + active.id + " was dropped.";
463
+ },
464
+
465
+ onDragCancel(_ref4) {
466
+ let {
467
+ active
468
+ } = _ref4;
469
+ return "Dragging was cancelled. Draggable item " + active.id + " was dropped.";
470
+ }
471
+
472
+ };
473
+
474
+ function Accessibility(_ref) {
475
+ let {
476
+ announcements = defaultAnnouncements,
477
+ container,
478
+ hiddenTextDescribedById,
479
+ screenReaderInstructions = defaultScreenReaderInstructions
480
+ } = _ref;
481
+ const {
482
+ announce,
483
+ announcement
484
+ } = useAnnouncement();
485
+ const liveRegionId = useUniqueId("DndLiveRegion");
486
+ const [mounted, setMounted] = useState(false);
487
+ useEffect(() => {
488
+ setMounted(true);
489
+ }, []);
490
+ useDndMonitor(useMemo(() => ({
491
+ onDragStart(_ref2) {
492
+ let {
493
+ active
494
+ } = _ref2;
495
+ announce(announcements.onDragStart({
496
+ active
497
+ }));
498
+ },
499
+
500
+ onDragMove(_ref3) {
501
+ let {
502
+ active,
503
+ over
504
+ } = _ref3;
505
+
506
+ if (announcements.onDragMove) {
507
+ announce(announcements.onDragMove({
508
+ active,
509
+ over
510
+ }));
511
+ }
512
+ },
513
+
514
+ onDragOver(_ref4) {
515
+ let {
516
+ active,
517
+ over
518
+ } = _ref4;
519
+ announce(announcements.onDragOver({
520
+ active,
521
+ over
522
+ }));
523
+ },
524
+
525
+ onDragEnd(_ref5) {
526
+ let {
527
+ active,
528
+ over
529
+ } = _ref5;
530
+ announce(announcements.onDragEnd({
531
+ active,
532
+ over
533
+ }));
534
+ },
535
+
536
+ onDragCancel(_ref6) {
537
+ let {
538
+ active,
539
+ over
540
+ } = _ref6;
541
+ announce(announcements.onDragCancel({
542
+ active,
543
+ over
544
+ }));
545
+ }
546
+
547
+ }), [announce, announcements]));
548
+
549
+ if (!mounted) {
550
+ return null;
551
+ }
552
+
553
+ const markup = React__default.createElement(React__default.Fragment, null, React__default.createElement(HiddenText, {
554
+ id: hiddenTextDescribedById,
555
+ value: screenReaderInstructions.draggable
556
+ }), React__default.createElement(LiveRegion, {
557
+ id: liveRegionId,
558
+ announcement: announcement
559
+ }));
560
+ return container ? createPortal(markup, container) : markup;
561
+ }
562
+
563
+ var Action;
564
+
565
+ (function (Action) {
566
+ Action["DragStart"] = "dragStart";
567
+ Action["DragMove"] = "dragMove";
568
+ Action["DragEnd"] = "dragEnd";
569
+ Action["DragCancel"] = "dragCancel";
570
+ Action["DragOver"] = "dragOver";
571
+ Action["RegisterDroppable"] = "registerDroppable";
572
+ Action["SetDroppableDisabled"] = "setDroppableDisabled";
573
+ Action["UnregisterDroppable"] = "unregisterDroppable";
574
+ })(Action || (Action = {}));
575
+
576
+ function noop() {}
577
+
578
+ function useSensor(sensor, options) {
579
+ return useMemo(() => ({
580
+ sensor,
581
+ options: options != null ? options : {}
582
+ }), // eslint-disable-next-line react-hooks/exhaustive-deps
583
+ [sensor, options]);
584
+ }
585
+
586
+ function useSensors() {
587
+ for (var _len = arguments.length, sensors = new Array(_len), _key = 0; _key < _len; _key++) {
588
+ sensors[_key] = arguments[_key];
589
+ }
590
+
591
+ return useMemo(() => [...sensors].filter(sensor => sensor != null), // eslint-disable-next-line react-hooks/exhaustive-deps
592
+ [...sensors]);
593
+ }
594
+
595
+ const defaultCoordinates = /*#__PURE__*/Object.freeze({
596
+ x: 0,
597
+ y: 0
598
+ });
599
+
600
+ /**
601
+ * Returns the distance between two points
602
+ */
603
+ function distanceBetween(p1, p2) {
604
+ return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
605
+ }
606
+
607
+ /**
608
+ * Sort collisions from smallest to greatest value
609
+ */
610
+ function sortCollisionsAsc(_ref, _ref2) {
611
+ let {
612
+ data: {
613
+ value: a
614
+ }
615
+ } = _ref;
616
+ let {
617
+ data: {
618
+ value: b
619
+ }
620
+ } = _ref2;
621
+ return a - b;
622
+ }
623
+ /**
624
+ * Sort collisions from greatest to smallest value
625
+ */
626
+
627
+ function sortCollisionsDesc(_ref3, _ref4) {
628
+ let {
629
+ data: {
630
+ value: a
631
+ }
632
+ } = _ref3;
633
+ let {
634
+ data: {
635
+ value: b
636
+ }
637
+ } = _ref4;
638
+ return b - a;
639
+ }
640
+ function getFirstCollision(collisions, property) {
641
+ if (!collisions || collisions.length === 0) {
642
+ return null;
643
+ }
644
+
645
+ const [firstCollision] = collisions;
646
+ return firstCollision[property] ;
647
+ }
648
+
649
+ /**
650
+ * Returns the coordinates of the center of a given ClientRect
651
+ */
652
+
653
+ function centerOfRectangle(rect, left, top) {
654
+ if (left === void 0) {
655
+ left = rect.left;
656
+ }
657
+
658
+ if (top === void 0) {
659
+ top = rect.top;
660
+ }
661
+
662
+ return {
663
+ x: left + rect.width * 0.5,
664
+ y: top + rect.height * 0.5
665
+ };
666
+ }
667
+ /**
668
+ * Returns the closest rectangles from an array of rectangles to the center of a given
669
+ * rectangle.
670
+ */
671
+
672
+
673
+ const closestCenter = _ref => {
674
+ let {
675
+ collisionRect,
676
+ droppableRects,
677
+ droppableContainers
678
+ } = _ref;
679
+ const centerRect = centerOfRectangle(collisionRect, collisionRect.left, collisionRect.top);
680
+ const collisions = [];
681
+
682
+ for (const droppableContainer of droppableContainers) {
683
+ const {
684
+ id
685
+ } = droppableContainer;
686
+ const rect = droppableRects.get(id);
687
+
688
+ if (rect) {
689
+ const distBetween = distanceBetween(centerOfRectangle(rect), centerRect);
690
+ collisions.push({
691
+ id,
692
+ data: {
693
+ droppableContainer,
694
+ value: distBetween
695
+ }
696
+ });
697
+ }
698
+ }
699
+
700
+ return collisions.sort(sortCollisionsAsc);
701
+ };
702
+
703
+ /**
704
+ * Returns the intersecting rectangle area between two rectangles
705
+ */
706
+
707
+ function getIntersectionRatio(entry, target) {
708
+ const top = Math.max(target.top, entry.top);
709
+ const left = Math.max(target.left, entry.left);
710
+ const right = Math.min(target.left + target.width, entry.left + entry.width);
711
+ const bottom = Math.min(target.top + target.height, entry.top + entry.height);
712
+ const width = right - left;
713
+ const height = bottom - top;
714
+
715
+ if (left < right && top < bottom) {
716
+ const targetArea = target.width * target.height;
717
+ const entryArea = entry.width * entry.height;
718
+ const intersectionArea = width * height;
719
+ const intersectionRatio = intersectionArea / (targetArea + entryArea - intersectionArea);
720
+ return Number(intersectionRatio.toFixed(4));
721
+ } // Rectangles do not overlap, or overlap has an area of zero (edge/corner overlap)
722
+
723
+
724
+ return 0;
725
+ }
726
+ /**
727
+ * Returns the rectangles that has the greatest intersection area with a given
728
+ * rectangle in an array of rectangles.
729
+ */
730
+
731
+ const rectIntersection = _ref => {
732
+ let {
733
+ collisionRect,
734
+ droppableRects,
735
+ droppableContainers
736
+ } = _ref;
737
+ const collisions = [];
738
+
739
+ for (const droppableContainer of droppableContainers) {
740
+ const {
741
+ id
742
+ } = droppableContainer;
743
+ const rect = droppableRects.get(id);
744
+
745
+ if (rect) {
746
+ const intersectionRatio = getIntersectionRatio(rect, collisionRect);
747
+
748
+ if (intersectionRatio > 0) {
749
+ collisions.push({
750
+ id,
751
+ data: {
752
+ droppableContainer,
753
+ value: intersectionRatio
754
+ }
755
+ });
756
+ }
757
+ }
758
+ }
759
+
760
+ return collisions.sort(sortCollisionsDesc);
761
+ };
762
+
763
+ function adjustScale(transform, rect1, rect2) {
764
+ return { ...transform,
765
+ scaleX: rect1 && rect2 ? rect1.width / rect2.width : 1,
766
+ scaleY: rect1 && rect2 ? rect1.height / rect2.height : 1
767
+ };
768
+ }
769
+
770
+ function getRectDelta(rect1, rect2) {
771
+ return rect1 && rect2 ? {
772
+ x: rect1.left - rect2.left,
773
+ y: rect1.top - rect2.top
774
+ } : defaultCoordinates;
775
+ }
776
+
777
+ function createRectAdjustmentFn(modifier) {
778
+ return function adjustClientRect(rect) {
779
+ for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
780
+ adjustments[_key - 1] = arguments[_key];
781
+ }
782
+
783
+ return adjustments.reduce((acc, adjustment) => ({ ...acc,
784
+ top: acc.top + modifier * adjustment.y,
785
+ bottom: acc.bottom + modifier * adjustment.y,
786
+ left: acc.left + modifier * adjustment.x,
787
+ right: acc.right + modifier * adjustment.x
788
+ }), { ...rect
789
+ });
790
+ };
791
+ }
792
+ const getAdjustedRect = /*#__PURE__*/createRectAdjustmentFn(1);
793
+
794
+ function parseTransform(transform) {
795
+ if (transform.startsWith('matrix3d(')) {
796
+ const transformArray = transform.slice(9, -1).split(/, /);
797
+ return {
798
+ x: +transformArray[12],
799
+ y: +transformArray[13],
800
+ scaleX: +transformArray[0],
801
+ scaleY: +transformArray[5]
802
+ };
803
+ } else if (transform.startsWith('matrix(')) {
804
+ const transformArray = transform.slice(7, -1).split(/, /);
805
+ return {
806
+ x: +transformArray[4],
807
+ y: +transformArray[5],
808
+ scaleX: +transformArray[0],
809
+ scaleY: +transformArray[3]
810
+ };
811
+ }
812
+
813
+ return null;
814
+ }
815
+
816
+ function inverseTransform(rect, transform, transformOrigin) {
817
+ const parsedTransform = parseTransform(transform);
818
+
819
+ if (!parsedTransform) {
820
+ return rect;
821
+ }
822
+
823
+ const {
824
+ scaleX,
825
+ scaleY,
826
+ x: translateX,
827
+ y: translateY
828
+ } = parsedTransform;
829
+ const x = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin);
830
+ const y = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(' ') + 1));
831
+ const w = scaleX ? rect.width / scaleX : rect.width;
832
+ const h = scaleY ? rect.height / scaleY : rect.height;
833
+ return {
834
+ width: w,
835
+ height: h,
836
+ top: y,
837
+ right: x + w,
838
+ bottom: y + h,
839
+ left: x
840
+ };
841
+ }
842
+
843
+ const defaultOptions = {
844
+ ignoreTransform: false
845
+ };
846
+ /**
847
+ * Returns the bounding client rect of an element relative to the viewport.
848
+ */
849
+
850
+ function getClientRect(element, options) {
851
+ if (options === void 0) {
852
+ options = defaultOptions;
853
+ }
854
+
855
+ let rect = element.getBoundingClientRect();
856
+
857
+ if (options.ignoreTransform) {
858
+ const {
859
+ transform,
860
+ transformOrigin
861
+ } = getWindow(element).getComputedStyle(element);
862
+
863
+ if (transform) {
864
+ rect = inverseTransform(rect, transform, transformOrigin);
865
+ }
866
+ }
867
+
868
+ const {
869
+ top,
870
+ left,
871
+ width,
872
+ height,
873
+ bottom,
874
+ right
875
+ } = rect;
876
+ return {
877
+ top,
878
+ left,
879
+ width,
880
+ height,
881
+ bottom,
882
+ right
883
+ };
884
+ }
885
+ /**
886
+ * Returns the bounding client rect of an element relative to the viewport.
887
+ *
888
+ * @remarks
889
+ * The ClientRect returned by this method does not take into account transforms
890
+ * applied to the element it measures.
891
+ *
892
+ */
893
+
894
+ function getTransformAgnosticClientRect(element) {
895
+ return getClientRect(element, {
896
+ ignoreTransform: true
897
+ });
898
+ }
899
+
900
+ function getWindowClientRect(element) {
901
+ const width = element.innerWidth;
902
+ const height = element.innerHeight;
903
+ return {
904
+ top: 0,
905
+ left: 0,
906
+ right: width,
907
+ bottom: height,
908
+ width,
909
+ height
910
+ };
911
+ }
912
+
913
+ function isFixed(node, computedStyle) {
914
+ if (computedStyle === void 0) {
915
+ computedStyle = getWindow(node).getComputedStyle(node);
916
+ }
917
+
918
+ return computedStyle.position === 'fixed';
919
+ }
920
+
921
+ function isScrollable(element, computedStyle) {
922
+ if (computedStyle === void 0) {
923
+ computedStyle = getWindow(element).getComputedStyle(element);
924
+ }
925
+
926
+ const overflowRegex = /(auto|scroll|overlay)/;
927
+ const properties = ['overflow', 'overflowX', 'overflowY'];
928
+ return properties.some(property => {
929
+ const value = computedStyle[property];
930
+ return typeof value === 'string' ? overflowRegex.test(value) : false;
931
+ });
932
+ }
933
+
934
+ function getScrollableAncestors(element, limit) {
935
+ const scrollParents = [];
936
+
937
+ function findScrollableAncestors(node) {
938
+ if (limit != null && scrollParents.length >= limit) {
939
+ return scrollParents;
940
+ }
941
+
942
+ if (!node) {
943
+ return scrollParents;
944
+ }
945
+
946
+ if (isDocument(node) && node.scrollingElement != null && !scrollParents.includes(node.scrollingElement)) {
947
+ scrollParents.push(node.scrollingElement);
948
+ return scrollParents;
949
+ }
950
+
951
+ if (!isHTMLElement(node) || isSVGElement(node)) {
952
+ return scrollParents;
953
+ }
954
+
955
+ if (scrollParents.includes(node)) {
956
+ return scrollParents;
957
+ }
958
+
959
+ const computedStyle = getWindow(element).getComputedStyle(node);
960
+
961
+ if (node !== element) {
962
+ if (isScrollable(node, computedStyle)) {
963
+ scrollParents.push(node);
964
+ }
965
+ }
966
+
967
+ if (isFixed(node, computedStyle)) {
968
+ return scrollParents;
969
+ }
970
+
971
+ return findScrollableAncestors(node.parentNode);
972
+ }
973
+
974
+ if (!element) {
975
+ return scrollParents;
976
+ }
977
+
978
+ return findScrollableAncestors(element);
979
+ }
980
+ function getFirstScrollableAncestor(node) {
981
+ const [firstScrollableAncestor] = getScrollableAncestors(node, 1);
982
+ return firstScrollableAncestor != null ? firstScrollableAncestor : null;
983
+ }
984
+
985
+ function getScrollableElement(element) {
986
+ if (!canUseDOM || !element) {
987
+ return null;
988
+ }
989
+
990
+ if (isWindow(element)) {
991
+ return element;
992
+ }
993
+
994
+ if (!isNode(element)) {
995
+ return null;
996
+ }
997
+
998
+ if (isDocument(element) || element === getOwnerDocument(element).scrollingElement) {
999
+ return window;
1000
+ }
1001
+
1002
+ if (isHTMLElement(element)) {
1003
+ return element;
1004
+ }
1005
+
1006
+ return null;
1007
+ }
1008
+
1009
+ function getScrollXCoordinate(element) {
1010
+ if (isWindow(element)) {
1011
+ return element.scrollX;
1012
+ }
1013
+
1014
+ return element.scrollLeft;
1015
+ }
1016
+ function getScrollYCoordinate(element) {
1017
+ if (isWindow(element)) {
1018
+ return element.scrollY;
1019
+ }
1020
+
1021
+ return element.scrollTop;
1022
+ }
1023
+ function getScrollCoordinates(element) {
1024
+ return {
1025
+ x: getScrollXCoordinate(element),
1026
+ y: getScrollYCoordinate(element)
1027
+ };
1028
+ }
1029
+
1030
+ var Direction;
1031
+
1032
+ (function (Direction) {
1033
+ Direction[Direction["Forward"] = 1] = "Forward";
1034
+ Direction[Direction["Backward"] = -1] = "Backward";
1035
+ })(Direction || (Direction = {}));
1036
+
1037
+ function isDocumentScrollingElement(element) {
1038
+ if (!canUseDOM || !element) {
1039
+ return false;
1040
+ }
1041
+
1042
+ return element === document.scrollingElement;
1043
+ }
1044
+
1045
+ function getScrollPosition(scrollingContainer) {
1046
+ const minScroll = {
1047
+ x: 0,
1048
+ y: 0
1049
+ };
1050
+ const dimensions = isDocumentScrollingElement(scrollingContainer) ? {
1051
+ height: window.innerHeight,
1052
+ width: window.innerWidth
1053
+ } : {
1054
+ height: scrollingContainer.clientHeight,
1055
+ width: scrollingContainer.clientWidth
1056
+ };
1057
+ const maxScroll = {
1058
+ x: scrollingContainer.scrollWidth - dimensions.width,
1059
+ y: scrollingContainer.scrollHeight - dimensions.height
1060
+ };
1061
+ const isTop = scrollingContainer.scrollTop <= minScroll.y;
1062
+ const isLeft = scrollingContainer.scrollLeft <= minScroll.x;
1063
+ const isBottom = scrollingContainer.scrollTop >= maxScroll.y;
1064
+ const isRight = scrollingContainer.scrollLeft >= maxScroll.x;
1065
+ return {
1066
+ isTop,
1067
+ isLeft,
1068
+ isBottom,
1069
+ isRight,
1070
+ maxScroll,
1071
+ minScroll
1072
+ };
1073
+ }
1074
+
1075
+ const defaultThreshold = {
1076
+ x: 0.2,
1077
+ y: 0.2
1078
+ };
1079
+ function getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref, acceleration, thresholdPercentage) {
1080
+ let {
1081
+ top,
1082
+ left,
1083
+ right,
1084
+ bottom
1085
+ } = _ref;
1086
+
1087
+ if (acceleration === void 0) {
1088
+ acceleration = 10;
1089
+ }
1090
+
1091
+ if (thresholdPercentage === void 0) {
1092
+ thresholdPercentage = defaultThreshold;
1093
+ }
1094
+
1095
+ const {
1096
+ isTop,
1097
+ isBottom,
1098
+ isLeft,
1099
+ isRight
1100
+ } = getScrollPosition(scrollContainer);
1101
+ const direction = {
1102
+ x: 0,
1103
+ y: 0
1104
+ };
1105
+ const speed = {
1106
+ x: 0,
1107
+ y: 0
1108
+ };
1109
+ const threshold = {
1110
+ height: scrollContainerRect.height * thresholdPercentage.y,
1111
+ width: scrollContainerRect.width * thresholdPercentage.x
1112
+ };
1113
+
1114
+ if (!isTop && top <= scrollContainerRect.top + threshold.height) {
1115
+ // Scroll Up
1116
+ direction.y = Direction.Backward;
1117
+ speed.y = acceleration * Math.abs((scrollContainerRect.top + threshold.height - top) / threshold.height);
1118
+ } else if (!isBottom && bottom >= scrollContainerRect.bottom - threshold.height) {
1119
+ // Scroll Down
1120
+ direction.y = Direction.Forward;
1121
+ speed.y = acceleration * Math.abs((scrollContainerRect.bottom - threshold.height - bottom) / threshold.height);
1122
+ }
1123
+
1124
+ if (!isRight && right >= scrollContainerRect.right - threshold.width) {
1125
+ // Scroll Right
1126
+ direction.x = Direction.Forward;
1127
+ speed.x = acceleration * Math.abs((scrollContainerRect.right - threshold.width - right) / threshold.width);
1128
+ } else if (!isLeft && left <= scrollContainerRect.left + threshold.width) {
1129
+ // Scroll Left
1130
+ direction.x = Direction.Backward;
1131
+ speed.x = acceleration * Math.abs((scrollContainerRect.left + threshold.width - left) / threshold.width);
1132
+ }
1133
+
1134
+ return {
1135
+ direction,
1136
+ speed
1137
+ };
1138
+ }
1139
+
1140
+ function getScrollElementRect(element) {
1141
+ if (element === document.scrollingElement) {
1142
+ const {
1143
+ innerWidth,
1144
+ innerHeight
1145
+ } = window;
1146
+ return {
1147
+ top: 0,
1148
+ left: 0,
1149
+ right: innerWidth,
1150
+ bottom: innerHeight,
1151
+ width: innerWidth,
1152
+ height: innerHeight
1153
+ };
1154
+ }
1155
+
1156
+ const {
1157
+ top,
1158
+ left,
1159
+ right,
1160
+ bottom
1161
+ } = element.getBoundingClientRect();
1162
+ return {
1163
+ top,
1164
+ left,
1165
+ right,
1166
+ bottom,
1167
+ width: element.clientWidth,
1168
+ height: element.clientHeight
1169
+ };
1170
+ }
1171
+
1172
+ function getScrollOffsets(scrollableAncestors) {
1173
+ return scrollableAncestors.reduce((acc, node) => {
1174
+ return add(acc, getScrollCoordinates(node));
1175
+ }, defaultCoordinates);
1176
+ }
1177
+ function getScrollXOffset(scrollableAncestors) {
1178
+ return scrollableAncestors.reduce((acc, node) => {
1179
+ return acc + getScrollXCoordinate(node);
1180
+ }, 0);
1181
+ }
1182
+ function getScrollYOffset(scrollableAncestors) {
1183
+ return scrollableAncestors.reduce((acc, node) => {
1184
+ return acc + getScrollYCoordinate(node);
1185
+ }, 0);
1186
+ }
1187
+
1188
+ function scrollIntoViewIfNeeded(element, measure) {
1189
+ if (measure === void 0) {
1190
+ measure = getClientRect;
1191
+ }
1192
+
1193
+ if (!element) {
1194
+ return;
1195
+ }
1196
+
1197
+ const {
1198
+ top,
1199
+ left,
1200
+ bottom,
1201
+ right
1202
+ } = measure(element);
1203
+ const firstScrollableAncestor = getFirstScrollableAncestor(element);
1204
+
1205
+ if (!firstScrollableAncestor) {
1206
+ return;
1207
+ }
1208
+
1209
+ if (bottom <= 0 || right <= 0 || top >= window.innerHeight || left >= window.innerWidth) {
1210
+ element.scrollIntoView({
1211
+ block: 'center',
1212
+ inline: 'center'
1213
+ });
1214
+ }
1215
+ }
1216
+
1217
+ const properties = [['x', ['left', 'right'], getScrollXOffset], ['y', ['top', 'bottom'], getScrollYOffset]];
1218
+ class Rect {
1219
+ constructor(rect, element) {
1220
+ this.rect = void 0;
1221
+ this.width = void 0;
1222
+ this.height = void 0;
1223
+ this.top = void 0;
1224
+ this.bottom = void 0;
1225
+ this.right = void 0;
1226
+ this.left = void 0;
1227
+ const scrollableAncestors = getScrollableAncestors(element);
1228
+ const scrollOffsets = getScrollOffsets(scrollableAncestors);
1229
+ this.rect = { ...rect
1230
+ };
1231
+ this.width = rect.width;
1232
+ this.height = rect.height;
1233
+
1234
+ for (const [axis, keys, getScrollOffset] of properties) {
1235
+ for (const key of keys) {
1236
+ Object.defineProperty(this, key, {
1237
+ get: () => {
1238
+ const currentOffsets = getScrollOffset(scrollableAncestors);
1239
+ const scrollOffsetsDeltla = scrollOffsets[axis] - currentOffsets;
1240
+ return this.rect[key] + scrollOffsetsDeltla;
1241
+ },
1242
+ enumerable: true
1243
+ });
1244
+ }
1245
+ }
1246
+
1247
+ Object.defineProperty(this, 'rect', {
1248
+ enumerable: false
1249
+ });
1250
+ }
1251
+
1252
+ }
1253
+
1254
+ class Listeners {
1255
+ constructor(target) {
1256
+ this.target = void 0;
1257
+ this.listeners = [];
1258
+
1259
+ this.removeAll = () => {
1260
+ this.listeners.forEach(listener => {
1261
+ var _this$target;
1262
+
1263
+ return (_this$target = this.target) == null ? void 0 : _this$target.removeEventListener(...listener);
1264
+ });
1265
+ };
1266
+
1267
+ this.target = target;
1268
+ }
1269
+
1270
+ add(eventName, handler, options) {
1271
+ var _this$target2;
1272
+
1273
+ (_this$target2 = this.target) == null ? void 0 : _this$target2.addEventListener(eventName, handler, options);
1274
+ this.listeners.push([eventName, handler, options]);
1275
+ }
1276
+
1277
+ }
1278
+
1279
+ function getEventListenerTarget(target) {
1280
+ // If the `event.target` element is removed from the document events will still be targeted
1281
+ // at it, and hence won't always bubble up to the window or document anymore.
1282
+ // If there is any risk of an element being removed while it is being dragged,
1283
+ // the best practice is to attach the event listeners directly to the target.
1284
+ // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
1285
+ const {
1286
+ EventTarget
1287
+ } = getWindow(target);
1288
+ return target instanceof EventTarget ? target : getOwnerDocument(target);
1289
+ }
1290
+
1291
+ function hasExceededDistance(delta, measurement) {
1292
+ const dx = Math.abs(delta.x);
1293
+ const dy = Math.abs(delta.y);
1294
+
1295
+ if (typeof measurement === 'number') {
1296
+ return Math.sqrt(dx ** 2 + dy ** 2) > measurement;
1297
+ }
1298
+
1299
+ if ('x' in measurement && 'y' in measurement) {
1300
+ return dx > measurement.x && dy > measurement.y;
1301
+ }
1302
+
1303
+ if ('x' in measurement) {
1304
+ return dx > measurement.x;
1305
+ }
1306
+
1307
+ if ('y' in measurement) {
1308
+ return dy > measurement.y;
1309
+ }
1310
+
1311
+ return false;
1312
+ }
1313
+
1314
+ var EventName;
1315
+
1316
+ (function (EventName) {
1317
+ EventName["Click"] = "click";
1318
+ EventName["DragStart"] = "dragstart";
1319
+ EventName["Keydown"] = "keydown";
1320
+ EventName["ContextMenu"] = "contextmenu";
1321
+ EventName["Resize"] = "resize";
1322
+ EventName["SelectionChange"] = "selectionchange";
1323
+ EventName["VisibilityChange"] = "visibilitychange";
1324
+ })(EventName || (EventName = {}));
1325
+
1326
+ function preventDefault(event) {
1327
+ event.preventDefault();
1328
+ }
1329
+ function stopPropagation(event) {
1330
+ event.stopPropagation();
1331
+ }
1332
+
1333
+ var KeyboardCode;
1334
+
1335
+ (function (KeyboardCode) {
1336
+ KeyboardCode["Space"] = "Space";
1337
+ KeyboardCode["Down"] = "ArrowDown";
1338
+ KeyboardCode["Right"] = "ArrowRight";
1339
+ KeyboardCode["Left"] = "ArrowLeft";
1340
+ KeyboardCode["Up"] = "ArrowUp";
1341
+ KeyboardCode["Esc"] = "Escape";
1342
+ KeyboardCode["Enter"] = "Enter";
1343
+ KeyboardCode["Tab"] = "Tab";
1344
+ })(KeyboardCode || (KeyboardCode = {}));
1345
+
1346
+ const defaultKeyboardCodes = {
1347
+ start: [KeyboardCode.Space, KeyboardCode.Enter],
1348
+ cancel: [KeyboardCode.Esc],
1349
+ end: [KeyboardCode.Space, KeyboardCode.Enter, KeyboardCode.Tab]
1350
+ };
1351
+ const defaultKeyboardCoordinateGetter = (event, _ref) => {
1352
+ let {
1353
+ currentCoordinates
1354
+ } = _ref;
1355
+
1356
+ switch (event.code) {
1357
+ case KeyboardCode.Right:
1358
+ return { ...currentCoordinates,
1359
+ x: currentCoordinates.x + 25
1360
+ };
1361
+
1362
+ case KeyboardCode.Left:
1363
+ return { ...currentCoordinates,
1364
+ x: currentCoordinates.x - 25
1365
+ };
1366
+
1367
+ case KeyboardCode.Down:
1368
+ return { ...currentCoordinates,
1369
+ y: currentCoordinates.y + 25
1370
+ };
1371
+
1372
+ case KeyboardCode.Up:
1373
+ return { ...currentCoordinates,
1374
+ y: currentCoordinates.y - 25
1375
+ };
1376
+ }
1377
+
1378
+ return undefined;
1379
+ };
1380
+
1381
+ class KeyboardSensor {
1382
+ constructor(props) {
1383
+ this.props = void 0;
1384
+ this.autoScrollEnabled = false;
1385
+ this.referenceCoordinates = void 0;
1386
+ this.listeners = void 0;
1387
+ this.windowListeners = void 0;
1388
+ this.props = props;
1389
+ const {
1390
+ event: {
1391
+ target
1392
+ }
1393
+ } = props;
1394
+ this.props = props;
1395
+ this.listeners = new Listeners(getOwnerDocument(target));
1396
+ this.windowListeners = new Listeners(getWindow(target));
1397
+ this.handleKeyDown = this.handleKeyDown.bind(this);
1398
+ this.handleCancel = this.handleCancel.bind(this);
1399
+ this.attach();
1400
+ }
1401
+
1402
+ attach() {
1403
+ this.handleStart();
1404
+ this.windowListeners.add(EventName.Resize, this.handleCancel);
1405
+ this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
1406
+ setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown));
1407
+ }
1408
+
1409
+ handleStart() {
1410
+ const {
1411
+ activeNode,
1412
+ onStart
1413
+ } = this.props;
1414
+ const node = activeNode.node.current;
1415
+
1416
+ if (node) {
1417
+ scrollIntoViewIfNeeded(node);
1418
+ }
1419
+
1420
+ onStart(defaultCoordinates);
1421
+ }
1422
+
1423
+ handleKeyDown(event) {
1424
+ if (isKeyboardEvent(event)) {
1425
+ const {
1426
+ active,
1427
+ context,
1428
+ options
1429
+ } = this.props;
1430
+ const {
1431
+ keyboardCodes = defaultKeyboardCodes,
1432
+ coordinateGetter = defaultKeyboardCoordinateGetter,
1433
+ scrollBehavior = 'smooth'
1434
+ } = options;
1435
+ const {
1436
+ code
1437
+ } = event;
1438
+
1439
+ if (keyboardCodes.end.includes(code)) {
1440
+ this.handleEnd(event);
1441
+ return;
1442
+ }
1443
+
1444
+ if (keyboardCodes.cancel.includes(code)) {
1445
+ this.handleCancel(event);
1446
+ return;
1447
+ }
1448
+
1449
+ const {
1450
+ collisionRect
1451
+ } = context.current;
1452
+ const currentCoordinates = collisionRect ? {
1453
+ x: collisionRect.left,
1454
+ y: collisionRect.top
1455
+ } : defaultCoordinates;
1456
+
1457
+ if (!this.referenceCoordinates) {
1458
+ this.referenceCoordinates = currentCoordinates;
1459
+ }
1460
+
1461
+ const newCoordinates = coordinateGetter(event, {
1462
+ active,
1463
+ context: context.current,
1464
+ currentCoordinates
1465
+ });
1466
+
1467
+ if (newCoordinates) {
1468
+ const coordinatesDelta = subtract(newCoordinates, currentCoordinates);
1469
+ const scrollDelta = {
1470
+ x: 0,
1471
+ y: 0
1472
+ };
1473
+ const {
1474
+ scrollableAncestors
1475
+ } = context.current;
1476
+
1477
+ for (const scrollContainer of scrollableAncestors) {
1478
+ const direction = event.code;
1479
+ const {
1480
+ isTop,
1481
+ isRight,
1482
+ isLeft,
1483
+ isBottom,
1484
+ maxScroll,
1485
+ minScroll
1486
+ } = getScrollPosition(scrollContainer);
1487
+ const scrollElementRect = getScrollElementRect(scrollContainer);
1488
+ const clampedCoordinates = {
1489
+ x: Math.min(direction === KeyboardCode.Right ? scrollElementRect.right - scrollElementRect.width / 2 : scrollElementRect.right, Math.max(direction === KeyboardCode.Right ? scrollElementRect.left : scrollElementRect.left + scrollElementRect.width / 2, newCoordinates.x)),
1490
+ y: Math.min(direction === KeyboardCode.Down ? scrollElementRect.bottom - scrollElementRect.height / 2 : scrollElementRect.bottom, Math.max(direction === KeyboardCode.Down ? scrollElementRect.top : scrollElementRect.top + scrollElementRect.height / 2, newCoordinates.y))
1491
+ };
1492
+ const canScrollX = direction === KeyboardCode.Right && !isRight || direction === KeyboardCode.Left && !isLeft;
1493
+ const canScrollY = direction === KeyboardCode.Down && !isBottom || direction === KeyboardCode.Up && !isTop;
1494
+
1495
+ if (canScrollX && clampedCoordinates.x !== newCoordinates.x) {
1496
+ const newScrollCoordinates = scrollContainer.scrollLeft + coordinatesDelta.x;
1497
+ const canScrollToNewCoordinates = direction === KeyboardCode.Right && newScrollCoordinates <= maxScroll.x || direction === KeyboardCode.Left && newScrollCoordinates >= minScroll.x;
1498
+
1499
+ if (canScrollToNewCoordinates && !coordinatesDelta.y) {
1500
+ // We don't need to update coordinates, the scroll adjustment alone will trigger
1501
+ // logic to auto-detect the new container we are over
1502
+ scrollContainer.scrollTo({
1503
+ left: newScrollCoordinates,
1504
+ behavior: scrollBehavior
1505
+ });
1506
+ return;
1507
+ }
1508
+
1509
+ if (canScrollToNewCoordinates) {
1510
+ scrollDelta.x = scrollContainer.scrollLeft - newScrollCoordinates;
1511
+ } else {
1512
+ scrollDelta.x = direction === KeyboardCode.Right ? scrollContainer.scrollLeft - maxScroll.x : scrollContainer.scrollLeft - minScroll.x;
1513
+ }
1514
+
1515
+ if (scrollDelta.x) {
1516
+ scrollContainer.scrollBy({
1517
+ left: -scrollDelta.x,
1518
+ behavior: scrollBehavior
1519
+ });
1520
+ }
1521
+
1522
+ break;
1523
+ } else if (canScrollY && clampedCoordinates.y !== newCoordinates.y) {
1524
+ const newScrollCoordinates = scrollContainer.scrollTop + coordinatesDelta.y;
1525
+ const canScrollToNewCoordinates = direction === KeyboardCode.Down && newScrollCoordinates <= maxScroll.y || direction === KeyboardCode.Up && newScrollCoordinates >= minScroll.y;
1526
+
1527
+ if (canScrollToNewCoordinates && !coordinatesDelta.x) {
1528
+ // We don't need to update coordinates, the scroll adjustment alone will trigger
1529
+ // logic to auto-detect the new container we are over
1530
+ scrollContainer.scrollTo({
1531
+ top: newScrollCoordinates,
1532
+ behavior: scrollBehavior
1533
+ });
1534
+ return;
1535
+ }
1536
+
1537
+ if (canScrollToNewCoordinates) {
1538
+ scrollDelta.y = scrollContainer.scrollTop - newScrollCoordinates;
1539
+ } else {
1540
+ scrollDelta.y = direction === KeyboardCode.Down ? scrollContainer.scrollTop - maxScroll.y : scrollContainer.scrollTop - minScroll.y;
1541
+ }
1542
+
1543
+ if (scrollDelta.y) {
1544
+ scrollContainer.scrollBy({
1545
+ top: -scrollDelta.y,
1546
+ behavior: scrollBehavior
1547
+ });
1548
+ }
1549
+
1550
+ break;
1551
+ }
1552
+ }
1553
+
1554
+ this.handleMove(event, add(subtract(newCoordinates, this.referenceCoordinates), scrollDelta));
1555
+ }
1556
+ }
1557
+ }
1558
+
1559
+ handleMove(event, coordinates) {
1560
+ const {
1561
+ onMove
1562
+ } = this.props;
1563
+ event.preventDefault();
1564
+ onMove(coordinates);
1565
+ }
1566
+
1567
+ handleEnd(event) {
1568
+ const {
1569
+ onEnd
1570
+ } = this.props;
1571
+ event.preventDefault();
1572
+ this.detach();
1573
+ onEnd();
1574
+ }
1575
+
1576
+ handleCancel(event) {
1577
+ const {
1578
+ onCancel
1579
+ } = this.props;
1580
+ event.preventDefault();
1581
+ this.detach();
1582
+ onCancel();
1583
+ }
1584
+
1585
+ detach() {
1586
+ this.listeners.removeAll();
1587
+ this.windowListeners.removeAll();
1588
+ }
1589
+
1590
+ }
1591
+ KeyboardSensor.activators = [{
1592
+ eventName: 'onKeyDown',
1593
+ handler: (event, _ref, _ref2) => {
1594
+ let {
1595
+ keyboardCodes = defaultKeyboardCodes,
1596
+ onActivation
1597
+ } = _ref;
1598
+ let {
1599
+ active
1600
+ } = _ref2;
1601
+ const {
1602
+ code
1603
+ } = event.nativeEvent;
1604
+
1605
+ if (keyboardCodes.start.includes(code)) {
1606
+ const activator = active.activatorNode.current;
1607
+
1608
+ if (activator && event.target !== activator) {
1609
+ return false;
1610
+ }
1611
+
1612
+ event.preventDefault();
1613
+ onActivation == null ? void 0 : onActivation({
1614
+ event: event.nativeEvent
1615
+ });
1616
+ return true;
1617
+ }
1618
+
1619
+ return false;
1620
+ }
1621
+ }];
1622
+
1623
+ function isDistanceConstraint(constraint) {
1624
+ return Boolean(constraint && 'distance' in constraint);
1625
+ }
1626
+
1627
+ function isDelayConstraint(constraint) {
1628
+ return Boolean(constraint && 'delay' in constraint);
1629
+ }
1630
+
1631
+ class AbstractPointerSensor {
1632
+ constructor(props, events, listenerTarget) {
1633
+ var _getEventCoordinates;
1634
+
1635
+ if (listenerTarget === void 0) {
1636
+ listenerTarget = getEventListenerTarget(props.event.target);
1637
+ }
1638
+
1639
+ this.props = void 0;
1640
+ this.events = void 0;
1641
+ this.autoScrollEnabled = true;
1642
+ this.document = void 0;
1643
+ this.activated = false;
1644
+ this.initialCoordinates = void 0;
1645
+ this.timeoutId = null;
1646
+ this.listeners = void 0;
1647
+ this.documentListeners = void 0;
1648
+ this.windowListeners = void 0;
1649
+ this.props = props;
1650
+ this.events = events;
1651
+ const {
1652
+ event
1653
+ } = props;
1654
+ const {
1655
+ target
1656
+ } = event;
1657
+ this.props = props;
1658
+ this.events = events;
1659
+ this.document = getOwnerDocument(target);
1660
+ this.documentListeners = new Listeners(this.document);
1661
+ this.listeners = new Listeners(listenerTarget);
1662
+ this.windowListeners = new Listeners(getWindow(target));
1663
+ this.initialCoordinates = (_getEventCoordinates = getEventCoordinates(event)) != null ? _getEventCoordinates : defaultCoordinates;
1664
+ this.handleStart = this.handleStart.bind(this);
1665
+ this.handleMove = this.handleMove.bind(this);
1666
+ this.handleEnd = this.handleEnd.bind(this);
1667
+ this.handleCancel = this.handleCancel.bind(this);
1668
+ this.handleKeydown = this.handleKeydown.bind(this);
1669
+ this.removeTextSelection = this.removeTextSelection.bind(this);
1670
+ this.attach();
1671
+ }
1672
+
1673
+ attach() {
1674
+ const {
1675
+ events,
1676
+ props: {
1677
+ options: {
1678
+ activationConstraint,
1679
+ bypassActivationConstraint
1680
+ }
1681
+ }
1682
+ } = this;
1683
+ this.listeners.add(events.move.name, this.handleMove, {
1684
+ passive: false
1685
+ });
1686
+ this.listeners.add(events.end.name, this.handleEnd);
1687
+
1688
+ if (events.cancel) {
1689
+ this.listeners.add(events.cancel.name, this.handleCancel);
1690
+ }
1691
+
1692
+ this.windowListeners.add(EventName.Resize, this.handleCancel);
1693
+ this.windowListeners.add(EventName.DragStart, preventDefault);
1694
+ this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
1695
+ this.windowListeners.add(EventName.ContextMenu, preventDefault);
1696
+ this.documentListeners.add(EventName.Keydown, this.handleKeydown);
1697
+
1698
+ if (activationConstraint) {
1699
+ if (bypassActivationConstraint != null && bypassActivationConstraint({
1700
+ event: this.props.event,
1701
+ activeNode: this.props.activeNode,
1702
+ options: this.props.options
1703
+ })) {
1704
+ return this.handleStart();
1705
+ }
1706
+
1707
+ if (isDelayConstraint(activationConstraint)) {
1708
+ this.timeoutId = setTimeout(this.handleStart, activationConstraint.delay);
1709
+ this.handlePending(activationConstraint);
1710
+ return;
1711
+ }
1712
+
1713
+ if (isDistanceConstraint(activationConstraint)) {
1714
+ this.handlePending(activationConstraint);
1715
+ return;
1716
+ }
1717
+ }
1718
+
1719
+ this.handleStart();
1720
+ }
1721
+
1722
+ detach() {
1723
+ this.listeners.removeAll();
1724
+ this.windowListeners.removeAll(); // Wait until the next event loop before removing document listeners
1725
+ // This is necessary because we listen for `click` and `selection` events on the document
1726
+
1727
+ setTimeout(this.documentListeners.removeAll, 50);
1728
+
1729
+ if (this.timeoutId !== null) {
1730
+ clearTimeout(this.timeoutId);
1731
+ this.timeoutId = null;
1732
+ }
1733
+ }
1734
+
1735
+ handlePending(constraint, offset) {
1736
+ const {
1737
+ active,
1738
+ onPending
1739
+ } = this.props;
1740
+ onPending(active, constraint, this.initialCoordinates, offset);
1741
+ }
1742
+
1743
+ handleStart() {
1744
+ const {
1745
+ initialCoordinates
1746
+ } = this;
1747
+ const {
1748
+ onStart
1749
+ } = this.props;
1750
+
1751
+ if (initialCoordinates) {
1752
+ this.activated = true; // Stop propagation of click events once activation constraints are met
1753
+
1754
+ this.documentListeners.add(EventName.Click, stopPropagation, {
1755
+ capture: true
1756
+ }); // Remove any text selection from the document
1757
+
1758
+ this.removeTextSelection(); // Prevent further text selection while dragging
1759
+
1760
+ this.documentListeners.add(EventName.SelectionChange, this.removeTextSelection);
1761
+ onStart(initialCoordinates);
1762
+ }
1763
+ }
1764
+
1765
+ handleMove(event) {
1766
+ var _getEventCoordinates2;
1767
+
1768
+ const {
1769
+ activated,
1770
+ initialCoordinates,
1771
+ props
1772
+ } = this;
1773
+ const {
1774
+ onMove,
1775
+ options: {
1776
+ activationConstraint
1777
+ }
1778
+ } = props;
1779
+
1780
+ if (!initialCoordinates) {
1781
+ return;
1782
+ }
1783
+
1784
+ const coordinates = (_getEventCoordinates2 = getEventCoordinates(event)) != null ? _getEventCoordinates2 : defaultCoordinates;
1785
+ const delta = subtract(initialCoordinates, coordinates); // Constraint validation
1786
+
1787
+ if (!activated && activationConstraint) {
1788
+ if (isDistanceConstraint(activationConstraint)) {
1789
+ if (activationConstraint.tolerance != null && hasExceededDistance(delta, activationConstraint.tolerance)) {
1790
+ return this.handleCancel();
1791
+ }
1792
+
1793
+ if (hasExceededDistance(delta, activationConstraint.distance)) {
1794
+ return this.handleStart();
1795
+ }
1796
+ }
1797
+
1798
+ if (isDelayConstraint(activationConstraint)) {
1799
+ if (hasExceededDistance(delta, activationConstraint.tolerance)) {
1800
+ return this.handleCancel();
1801
+ }
1802
+ }
1803
+
1804
+ this.handlePending(activationConstraint, delta);
1805
+ return;
1806
+ }
1807
+
1808
+ if (event.cancelable) {
1809
+ event.preventDefault();
1810
+ }
1811
+
1812
+ onMove(coordinates);
1813
+ }
1814
+
1815
+ handleEnd() {
1816
+ const {
1817
+ onAbort,
1818
+ onEnd
1819
+ } = this.props;
1820
+ this.detach();
1821
+
1822
+ if (!this.activated) {
1823
+ onAbort(this.props.active);
1824
+ }
1825
+
1826
+ onEnd();
1827
+ }
1828
+
1829
+ handleCancel() {
1830
+ const {
1831
+ onAbort,
1832
+ onCancel
1833
+ } = this.props;
1834
+ this.detach();
1835
+
1836
+ if (!this.activated) {
1837
+ onAbort(this.props.active);
1838
+ }
1839
+
1840
+ onCancel();
1841
+ }
1842
+
1843
+ handleKeydown(event) {
1844
+ if (event.code === KeyboardCode.Esc) {
1845
+ this.handleCancel();
1846
+ }
1847
+ }
1848
+
1849
+ removeTextSelection() {
1850
+ var _this$document$getSel;
1851
+
1852
+ (_this$document$getSel = this.document.getSelection()) == null ? void 0 : _this$document$getSel.removeAllRanges();
1853
+ }
1854
+
1855
+ }
1856
+
1857
+ const events = {
1858
+ cancel: {
1859
+ name: 'pointercancel'
1860
+ },
1861
+ move: {
1862
+ name: 'pointermove'
1863
+ },
1864
+ end: {
1865
+ name: 'pointerup'
1866
+ }
1867
+ };
1868
+ class PointerSensor extends AbstractPointerSensor {
1869
+ constructor(props) {
1870
+ const {
1871
+ event
1872
+ } = props; // Pointer events stop firing if the target is unmounted while dragging
1873
+ // Therefore we attach listeners to the owner document instead
1874
+
1875
+ const listenerTarget = getOwnerDocument(event.target);
1876
+ super(props, events, listenerTarget);
1877
+ }
1878
+
1879
+ }
1880
+ PointerSensor.activators = [{
1881
+ eventName: 'onPointerDown',
1882
+ handler: (_ref, _ref2) => {
1883
+ let {
1884
+ nativeEvent: event
1885
+ } = _ref;
1886
+ let {
1887
+ onActivation
1888
+ } = _ref2;
1889
+
1890
+ if (!event.isPrimary || event.button !== 0) {
1891
+ return false;
1892
+ }
1893
+
1894
+ onActivation == null ? void 0 : onActivation({
1895
+ event
1896
+ });
1897
+ return true;
1898
+ }
1899
+ }];
1900
+
1901
+ const events$1 = {
1902
+ move: {
1903
+ name: 'mousemove'
1904
+ },
1905
+ end: {
1906
+ name: 'mouseup'
1907
+ }
1908
+ };
1909
+ var MouseButton;
1910
+
1911
+ (function (MouseButton) {
1912
+ MouseButton[MouseButton["RightClick"] = 2] = "RightClick";
1913
+ })(MouseButton || (MouseButton = {}));
1914
+
1915
+ class MouseSensor extends AbstractPointerSensor {
1916
+ constructor(props) {
1917
+ super(props, events$1, getOwnerDocument(props.event.target));
1918
+ }
1919
+
1920
+ }
1921
+ MouseSensor.activators = [{
1922
+ eventName: 'onMouseDown',
1923
+ handler: (_ref, _ref2) => {
1924
+ let {
1925
+ nativeEvent: event
1926
+ } = _ref;
1927
+ let {
1928
+ onActivation
1929
+ } = _ref2;
1930
+
1931
+ if (event.button === MouseButton.RightClick) {
1932
+ return false;
1933
+ }
1934
+
1935
+ onActivation == null ? void 0 : onActivation({
1936
+ event
1937
+ });
1938
+ return true;
1939
+ }
1940
+ }];
1941
+
1942
+ const events$2 = {
1943
+ cancel: {
1944
+ name: 'touchcancel'
1945
+ },
1946
+ move: {
1947
+ name: 'touchmove'
1948
+ },
1949
+ end: {
1950
+ name: 'touchend'
1951
+ }
1952
+ };
1953
+ class TouchSensor extends AbstractPointerSensor {
1954
+ constructor(props) {
1955
+ super(props, events$2);
1956
+ }
1957
+
1958
+ static setup() {
1959
+ // Adding a non-capture and non-passive `touchmove` listener in order
1960
+ // to force `event.preventDefault()` calls to work in dynamically added
1961
+ // touchmove event handlers. This is required for iOS Safari.
1962
+ window.addEventListener(events$2.move.name, noop, {
1963
+ capture: false,
1964
+ passive: false
1965
+ });
1966
+ return function teardown() {
1967
+ window.removeEventListener(events$2.move.name, noop);
1968
+ }; // We create a new handler because the teardown function of another sensor
1969
+ // could remove our event listener if we use a referentially equal listener.
1970
+
1971
+ function noop() {}
1972
+ }
1973
+
1974
+ }
1975
+ TouchSensor.activators = [{
1976
+ eventName: 'onTouchStart',
1977
+ handler: (_ref, _ref2) => {
1978
+ let {
1979
+ nativeEvent: event
1980
+ } = _ref;
1981
+ let {
1982
+ onActivation
1983
+ } = _ref2;
1984
+ const {
1985
+ touches
1986
+ } = event;
1987
+
1988
+ if (touches.length > 1) {
1989
+ return false;
1990
+ }
1991
+
1992
+ onActivation == null ? void 0 : onActivation({
1993
+ event
1994
+ });
1995
+ return true;
1996
+ }
1997
+ }];
1998
+
1999
+ var AutoScrollActivator;
2000
+
2001
+ (function (AutoScrollActivator) {
2002
+ AutoScrollActivator[AutoScrollActivator["Pointer"] = 0] = "Pointer";
2003
+ AutoScrollActivator[AutoScrollActivator["DraggableRect"] = 1] = "DraggableRect";
2004
+ })(AutoScrollActivator || (AutoScrollActivator = {}));
2005
+
2006
+ var TraversalOrder;
2007
+
2008
+ (function (TraversalOrder) {
2009
+ TraversalOrder[TraversalOrder["TreeOrder"] = 0] = "TreeOrder";
2010
+ TraversalOrder[TraversalOrder["ReversedTreeOrder"] = 1] = "ReversedTreeOrder";
2011
+ })(TraversalOrder || (TraversalOrder = {}));
2012
+
2013
+ function useAutoScroller(_ref) {
2014
+ let {
2015
+ acceleration,
2016
+ activator = AutoScrollActivator.Pointer,
2017
+ canScroll,
2018
+ draggingRect,
2019
+ enabled,
2020
+ interval = 5,
2021
+ order = TraversalOrder.TreeOrder,
2022
+ pointerCoordinates,
2023
+ scrollableAncestors,
2024
+ scrollableAncestorRects,
2025
+ delta,
2026
+ threshold
2027
+ } = _ref;
2028
+ const scrollIntent = useScrollIntent({
2029
+ delta,
2030
+ disabled: !enabled
2031
+ });
2032
+ const [setAutoScrollInterval, clearAutoScrollInterval] = useInterval();
2033
+ const scrollSpeed = useRef({
2034
+ x: 0,
2035
+ y: 0
2036
+ });
2037
+ const scrollDirection = useRef({
2038
+ x: 0,
2039
+ y: 0
2040
+ });
2041
+ const rect = useMemo(() => {
2042
+ switch (activator) {
2043
+ case AutoScrollActivator.Pointer:
2044
+ return pointerCoordinates ? {
2045
+ top: pointerCoordinates.y,
2046
+ bottom: pointerCoordinates.y,
2047
+ left: pointerCoordinates.x,
2048
+ right: pointerCoordinates.x
2049
+ } : null;
2050
+
2051
+ case AutoScrollActivator.DraggableRect:
2052
+ return draggingRect;
2053
+ }
2054
+ }, [activator, draggingRect, pointerCoordinates]);
2055
+ const scrollContainerRef = useRef(null);
2056
+ const autoScroll = useCallback(() => {
2057
+ const scrollContainer = scrollContainerRef.current;
2058
+
2059
+ if (!scrollContainer) {
2060
+ return;
2061
+ }
2062
+
2063
+ const scrollLeft = scrollSpeed.current.x * scrollDirection.current.x;
2064
+ const scrollTop = scrollSpeed.current.y * scrollDirection.current.y;
2065
+ scrollContainer.scrollBy(scrollLeft, scrollTop);
2066
+ }, []);
2067
+ const sortedScrollableAncestors = useMemo(() => order === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order, scrollableAncestors]);
2068
+ useEffect(() => {
2069
+ if (!enabled || !scrollableAncestors.length || !rect) {
2070
+ clearAutoScrollInterval();
2071
+ return;
2072
+ }
2073
+
2074
+ for (const scrollContainer of sortedScrollableAncestors) {
2075
+ if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) {
2076
+ continue;
2077
+ }
2078
+
2079
+ const index = scrollableAncestors.indexOf(scrollContainer);
2080
+ const scrollContainerRect = scrollableAncestorRects[index];
2081
+
2082
+ if (!scrollContainerRect) {
2083
+ continue;
2084
+ }
2085
+
2086
+ const {
2087
+ direction,
2088
+ speed
2089
+ } = getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, rect, acceleration, threshold);
2090
+
2091
+ for (const axis of ['x', 'y']) {
2092
+ if (!scrollIntent[axis][direction[axis]]) {
2093
+ speed[axis] = 0;
2094
+ direction[axis] = 0;
2095
+ }
2096
+ }
2097
+
2098
+ if (speed.x > 0 || speed.y > 0) {
2099
+ clearAutoScrollInterval();
2100
+ scrollContainerRef.current = scrollContainer;
2101
+ setAutoScrollInterval(autoScroll, interval);
2102
+ scrollSpeed.current = speed;
2103
+ scrollDirection.current = direction;
2104
+ return;
2105
+ }
2106
+ }
2107
+
2108
+ scrollSpeed.current = {
2109
+ x: 0,
2110
+ y: 0
2111
+ };
2112
+ scrollDirection.current = {
2113
+ x: 0,
2114
+ y: 0
2115
+ };
2116
+ clearAutoScrollInterval();
2117
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps
2118
+ [acceleration, autoScroll, canScroll, clearAutoScrollInterval, enabled, interval, // eslint-disable-next-line react-hooks/exhaustive-deps
2119
+ JSON.stringify(rect), // eslint-disable-next-line react-hooks/exhaustive-deps
2120
+ JSON.stringify(scrollIntent), setAutoScrollInterval, scrollableAncestors, sortedScrollableAncestors, scrollableAncestorRects, // eslint-disable-next-line react-hooks/exhaustive-deps
2121
+ JSON.stringify(threshold)]);
2122
+ }
2123
+ const defaultScrollIntent = {
2124
+ x: {
2125
+ [Direction.Backward]: false,
2126
+ [Direction.Forward]: false
2127
+ },
2128
+ y: {
2129
+ [Direction.Backward]: false,
2130
+ [Direction.Forward]: false
2131
+ }
2132
+ };
2133
+
2134
+ function useScrollIntent(_ref2) {
2135
+ let {
2136
+ delta,
2137
+ disabled
2138
+ } = _ref2;
2139
+ const previousDelta = usePrevious(delta);
2140
+ return useLazyMemo(previousIntent => {
2141
+ if (disabled || !previousDelta || !previousIntent) {
2142
+ // Reset scroll intent tracking when auto-scrolling is disabled
2143
+ return defaultScrollIntent;
2144
+ }
2145
+
2146
+ const direction = {
2147
+ x: Math.sign(delta.x - previousDelta.x),
2148
+ y: Math.sign(delta.y - previousDelta.y)
2149
+ }; // Keep track of the user intent to scroll in each direction for both axis
2150
+
2151
+ return {
2152
+ x: {
2153
+ [Direction.Backward]: previousIntent.x[Direction.Backward] || direction.x === -1,
2154
+ [Direction.Forward]: previousIntent.x[Direction.Forward] || direction.x === 1
2155
+ },
2156
+ y: {
2157
+ [Direction.Backward]: previousIntent.y[Direction.Backward] || direction.y === -1,
2158
+ [Direction.Forward]: previousIntent.y[Direction.Forward] || direction.y === 1
2159
+ }
2160
+ };
2161
+ }, [disabled, delta, previousDelta]);
2162
+ }
2163
+
2164
+ function useCachedNode(draggableNodes, id) {
2165
+ const draggableNode = id != null ? draggableNodes.get(id) : undefined;
2166
+ const node = draggableNode ? draggableNode.node.current : null;
2167
+ return useLazyMemo(cachedNode => {
2168
+ var _ref;
2169
+
2170
+ if (id == null) {
2171
+ return null;
2172
+ } // In some cases, the draggable node can unmount while dragging
2173
+ // This is the case for virtualized lists. In those situations,
2174
+ // we fall back to the last known value for that node.
2175
+
2176
+
2177
+ return (_ref = node != null ? node : cachedNode) != null ? _ref : null;
2178
+ }, [node, id]);
2179
+ }
2180
+
2181
+ function useCombineActivators(sensors, getSyntheticHandler) {
2182
+ return useMemo(() => sensors.reduce((accumulator, sensor) => {
2183
+ const {
2184
+ sensor: Sensor
2185
+ } = sensor;
2186
+ const sensorActivators = Sensor.activators.map(activator => ({
2187
+ eventName: activator.eventName,
2188
+ handler: getSyntheticHandler(activator.handler, sensor)
2189
+ }));
2190
+ return [...accumulator, ...sensorActivators];
2191
+ }, []), [sensors, getSyntheticHandler]);
2192
+ }
2193
+
2194
+ var MeasuringStrategy;
2195
+
2196
+ (function (MeasuringStrategy) {
2197
+ MeasuringStrategy[MeasuringStrategy["Always"] = 0] = "Always";
2198
+ MeasuringStrategy[MeasuringStrategy["BeforeDragging"] = 1] = "BeforeDragging";
2199
+ MeasuringStrategy[MeasuringStrategy["WhileDragging"] = 2] = "WhileDragging";
2200
+ })(MeasuringStrategy || (MeasuringStrategy = {}));
2201
+
2202
+ var MeasuringFrequency;
2203
+
2204
+ (function (MeasuringFrequency) {
2205
+ MeasuringFrequency["Optimized"] = "optimized";
2206
+ })(MeasuringFrequency || (MeasuringFrequency = {}));
2207
+
2208
+ const defaultValue = /*#__PURE__*/new Map();
2209
+ function useDroppableMeasuring(containers, _ref) {
2210
+ let {
2211
+ dragging,
2212
+ dependencies,
2213
+ config
2214
+ } = _ref;
2215
+ const [queue, setQueue] = useState(null);
2216
+ const {
2217
+ frequency,
2218
+ measure,
2219
+ strategy
2220
+ } = config;
2221
+ const containersRef = useRef(containers);
2222
+ const disabled = isDisabled();
2223
+ const disabledRef = useLatestValue(disabled);
2224
+ const measureDroppableContainers = useCallback(function (ids) {
2225
+ if (ids === void 0) {
2226
+ ids = [];
2227
+ }
2228
+
2229
+ if (disabledRef.current) {
2230
+ return;
2231
+ }
2232
+
2233
+ setQueue(value => {
2234
+ if (value === null) {
2235
+ return ids;
2236
+ }
2237
+
2238
+ return value.concat(ids.filter(id => !value.includes(id)));
2239
+ });
2240
+ }, [disabledRef]);
2241
+ const timeoutId = useRef(null);
2242
+ const droppableRects = useLazyMemo(previousValue => {
2243
+ if (disabled && !dragging) {
2244
+ return defaultValue;
2245
+ }
2246
+
2247
+ if (!previousValue || previousValue === defaultValue || containersRef.current !== containers || queue != null) {
2248
+ const map = new Map();
2249
+
2250
+ for (let container of containers) {
2251
+ if (!container) {
2252
+ continue;
2253
+ }
2254
+
2255
+ if (queue && queue.length > 0 && !queue.includes(container.id) && container.rect.current) {
2256
+ // This container does not need to be re-measured
2257
+ map.set(container.id, container.rect.current);
2258
+ continue;
2259
+ }
2260
+
2261
+ const node = container.node.current;
2262
+ const rect = node ? new Rect(measure(node), node) : null;
2263
+ container.rect.current = rect;
2264
+
2265
+ if (rect) {
2266
+ map.set(container.id, rect);
2267
+ }
2268
+ }
2269
+
2270
+ return map;
2271
+ }
2272
+
2273
+ return previousValue;
2274
+ }, [containers, queue, dragging, disabled, measure]);
2275
+ useEffect(() => {
2276
+ containersRef.current = containers;
2277
+ }, [containers]);
2278
+ useEffect(() => {
2279
+ if (disabled) {
2280
+ return;
2281
+ }
2282
+
2283
+ measureDroppableContainers();
2284
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps
2285
+ [dragging, disabled]);
2286
+ useEffect(() => {
2287
+ if (queue && queue.length > 0) {
2288
+ setQueue(null);
2289
+ }
2290
+ }, //eslint-disable-next-line react-hooks/exhaustive-deps
2291
+ [JSON.stringify(queue)]);
2292
+ useEffect(() => {
2293
+ if (disabled || typeof frequency !== 'number' || timeoutId.current !== null) {
2294
+ return;
2295
+ }
2296
+
2297
+ timeoutId.current = setTimeout(() => {
2298
+ measureDroppableContainers();
2299
+ timeoutId.current = null;
2300
+ }, frequency);
2301
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps
2302
+ [frequency, disabled, measureDroppableContainers, ...dependencies]);
2303
+ return {
2304
+ droppableRects,
2305
+ measureDroppableContainers,
2306
+ measuringScheduled: queue != null
2307
+ };
2308
+
2309
+ function isDisabled() {
2310
+ switch (strategy) {
2311
+ case MeasuringStrategy.Always:
2312
+ return false;
2313
+
2314
+ case MeasuringStrategy.BeforeDragging:
2315
+ return dragging;
2316
+
2317
+ default:
2318
+ return !dragging;
2319
+ }
2320
+ }
2321
+ }
2322
+
2323
+ function useInitialValue(value, computeFn) {
2324
+ return useLazyMemo(previousValue => {
2325
+ if (!value) {
2326
+ return null;
2327
+ }
2328
+
2329
+ if (previousValue) {
2330
+ return previousValue;
2331
+ }
2332
+
2333
+ return typeof computeFn === 'function' ? computeFn(value) : value;
2334
+ }, [computeFn, value]);
2335
+ }
2336
+
2337
+ function useInitialRect(node, measure) {
2338
+ return useInitialValue(node, measure);
2339
+ }
2340
+
2341
+ /**
2342
+ * Returns a new MutationObserver instance.
2343
+ * If `MutationObserver` is undefined in the execution environment, returns `undefined`.
2344
+ */
2345
+
2346
+ function useMutationObserver(_ref) {
2347
+ let {
2348
+ callback,
2349
+ disabled
2350
+ } = _ref;
2351
+ const handleMutations = useEvent(callback);
2352
+ const mutationObserver = useMemo(() => {
2353
+ if (disabled || typeof window === 'undefined' || typeof window.MutationObserver === 'undefined') {
2354
+ return undefined;
2355
+ }
2356
+
2357
+ const {
2358
+ MutationObserver
2359
+ } = window;
2360
+ return new MutationObserver(handleMutations);
2361
+ }, [handleMutations, disabled]);
2362
+ useEffect(() => {
2363
+ return () => mutationObserver == null ? void 0 : mutationObserver.disconnect();
2364
+ }, [mutationObserver]);
2365
+ return mutationObserver;
2366
+ }
2367
+
2368
+ /**
2369
+ * Returns a new ResizeObserver instance bound to the `onResize` callback.
2370
+ * If `ResizeObserver` is undefined in the execution environment, returns `undefined`.
2371
+ */
2372
+
2373
+ function useResizeObserver(_ref) {
2374
+ let {
2375
+ callback,
2376
+ disabled
2377
+ } = _ref;
2378
+ const handleResize = useEvent(callback);
2379
+ const resizeObserver = useMemo(() => {
2380
+ if (disabled || typeof window === 'undefined' || typeof window.ResizeObserver === 'undefined') {
2381
+ return undefined;
2382
+ }
2383
+
2384
+ const {
2385
+ ResizeObserver
2386
+ } = window;
2387
+ return new ResizeObserver(handleResize);
2388
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps
2389
+ [disabled]);
2390
+ useEffect(() => {
2391
+ return () => resizeObserver == null ? void 0 : resizeObserver.disconnect();
2392
+ }, [resizeObserver]);
2393
+ return resizeObserver;
2394
+ }
2395
+
2396
+ function defaultMeasure(element) {
2397
+ return new Rect(getClientRect(element), element);
2398
+ }
2399
+
2400
+ function useRect(element, measure, fallbackRect) {
2401
+ if (measure === void 0) {
2402
+ measure = defaultMeasure;
2403
+ }
2404
+
2405
+ const [rect, setRect] = useState(null);
2406
+
2407
+ function measureRect() {
2408
+ setRect(currentRect => {
2409
+ if (!element) {
2410
+ return null;
2411
+ }
2412
+
2413
+ if (element.isConnected === false) {
2414
+ var _ref;
2415
+
2416
+ // Fall back to last rect we measured if the element is
2417
+ // no longer connected to the DOM.
2418
+ return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null;
2419
+ }
2420
+
2421
+ const newRect = measure(element);
2422
+
2423
+ if (JSON.stringify(currentRect) === JSON.stringify(newRect)) {
2424
+ return currentRect;
2425
+ }
2426
+
2427
+ return newRect;
2428
+ });
2429
+ }
2430
+
2431
+ const mutationObserver = useMutationObserver({
2432
+ callback(records) {
2433
+ if (!element) {
2434
+ return;
2435
+ }
2436
+
2437
+ for (const record of records) {
2438
+ const {
2439
+ type,
2440
+ target
2441
+ } = record;
2442
+
2443
+ if (type === 'childList' && target instanceof HTMLElement && target.contains(element)) {
2444
+ measureRect();
2445
+ break;
2446
+ }
2447
+ }
2448
+ }
2449
+
2450
+ });
2451
+ const resizeObserver = useResizeObserver({
2452
+ callback: measureRect
2453
+ });
2454
+ useIsomorphicLayoutEffect(() => {
2455
+ measureRect();
2456
+
2457
+ if (element) {
2458
+ resizeObserver == null ? void 0 : resizeObserver.observe(element);
2459
+ mutationObserver == null ? void 0 : mutationObserver.observe(document.body, {
2460
+ childList: true,
2461
+ subtree: true
2462
+ });
2463
+ } else {
2464
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
2465
+ mutationObserver == null ? void 0 : mutationObserver.disconnect();
2466
+ }
2467
+ }, [element]);
2468
+ return rect;
2469
+ }
2470
+
2471
+ function useRectDelta(rect) {
2472
+ const initialRect = useInitialValue(rect);
2473
+ return getRectDelta(rect, initialRect);
2474
+ }
2475
+
2476
+ const defaultValue$1 = [];
2477
+ function useScrollableAncestors(node) {
2478
+ const previousNode = useRef(node);
2479
+ const ancestors = useLazyMemo(previousValue => {
2480
+ if (!node) {
2481
+ return defaultValue$1;
2482
+ }
2483
+
2484
+ if (previousValue && previousValue !== defaultValue$1 && node && previousNode.current && node.parentNode === previousNode.current.parentNode) {
2485
+ return previousValue;
2486
+ }
2487
+
2488
+ return getScrollableAncestors(node);
2489
+ }, [node]);
2490
+ useEffect(() => {
2491
+ previousNode.current = node;
2492
+ }, [node]);
2493
+ return ancestors;
2494
+ }
2495
+
2496
+ function useScrollOffsets(elements) {
2497
+ const [scrollCoordinates, setScrollCoordinates] = useState(null);
2498
+ const prevElements = useRef(elements); // To-do: Throttle the handleScroll callback
2499
+
2500
+ const handleScroll = useCallback(event => {
2501
+ const scrollingElement = getScrollableElement(event.target);
2502
+
2503
+ if (!scrollingElement) {
2504
+ return;
2505
+ }
2506
+
2507
+ setScrollCoordinates(scrollCoordinates => {
2508
+ if (!scrollCoordinates) {
2509
+ return null;
2510
+ }
2511
+
2512
+ scrollCoordinates.set(scrollingElement, getScrollCoordinates(scrollingElement));
2513
+ return new Map(scrollCoordinates);
2514
+ });
2515
+ }, []);
2516
+ useEffect(() => {
2517
+ const previousElements = prevElements.current;
2518
+
2519
+ if (elements !== previousElements) {
2520
+ cleanup(previousElements);
2521
+ const entries = elements.map(element => {
2522
+ const scrollableElement = getScrollableElement(element);
2523
+
2524
+ if (scrollableElement) {
2525
+ scrollableElement.addEventListener('scroll', handleScroll, {
2526
+ passive: true
2527
+ });
2528
+ return [scrollableElement, getScrollCoordinates(scrollableElement)];
2529
+ }
2530
+
2531
+ return null;
2532
+ }).filter(entry => entry != null);
2533
+ setScrollCoordinates(entries.length ? new Map(entries) : null);
2534
+ prevElements.current = elements;
2535
+ }
2536
+
2537
+ return () => {
2538
+ cleanup(elements);
2539
+ cleanup(previousElements);
2540
+ };
2541
+
2542
+ function cleanup(elements) {
2543
+ elements.forEach(element => {
2544
+ const scrollableElement = getScrollableElement(element);
2545
+ scrollableElement == null ? void 0 : scrollableElement.removeEventListener('scroll', handleScroll);
2546
+ });
2547
+ }
2548
+ }, [handleScroll, elements]);
2549
+ return useMemo(() => {
2550
+ if (elements.length) {
2551
+ return scrollCoordinates ? Array.from(scrollCoordinates.values()).reduce((acc, coordinates) => add(acc, coordinates), defaultCoordinates) : getScrollOffsets(elements);
2552
+ }
2553
+
2554
+ return defaultCoordinates;
2555
+ }, [elements, scrollCoordinates]);
2556
+ }
2557
+
2558
+ function useScrollOffsetsDelta(scrollOffsets, dependencies) {
2559
+ if (dependencies === void 0) {
2560
+ dependencies = [];
2561
+ }
2562
+
2563
+ const initialScrollOffsets = useRef(null);
2564
+ useEffect(() => {
2565
+ initialScrollOffsets.current = null;
2566
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps
2567
+ dependencies);
2568
+ useEffect(() => {
2569
+ const hasScrollOffsets = scrollOffsets !== defaultCoordinates;
2570
+
2571
+ if (hasScrollOffsets && !initialScrollOffsets.current) {
2572
+ initialScrollOffsets.current = scrollOffsets;
2573
+ }
2574
+
2575
+ if (!hasScrollOffsets && initialScrollOffsets.current) {
2576
+ initialScrollOffsets.current = null;
2577
+ }
2578
+ }, [scrollOffsets]);
2579
+ return initialScrollOffsets.current ? subtract(scrollOffsets, initialScrollOffsets.current) : defaultCoordinates;
2580
+ }
2581
+
2582
+ function useSensorSetup(sensors) {
2583
+ useEffect(() => {
2584
+ if (!canUseDOM) {
2585
+ return;
2586
+ }
2587
+
2588
+ const teardownFns = sensors.map(_ref => {
2589
+ let {
2590
+ sensor
2591
+ } = _ref;
2592
+ return sensor.setup == null ? void 0 : sensor.setup();
2593
+ });
2594
+ return () => {
2595
+ for (const teardown of teardownFns) {
2596
+ teardown == null ? void 0 : teardown();
2597
+ }
2598
+ };
2599
+ }, // TO-DO: Sensors length could theoretically change which would not be a valid dependency
2600
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2601
+ sensors.map(_ref2 => {
2602
+ let {
2603
+ sensor
2604
+ } = _ref2;
2605
+ return sensor;
2606
+ }));
2607
+ }
2608
+
2609
+ function useSyntheticListeners(listeners, id) {
2610
+ return useMemo(() => {
2611
+ return listeners.reduce((acc, _ref) => {
2612
+ let {
2613
+ eventName,
2614
+ handler
2615
+ } = _ref;
2616
+
2617
+ acc[eventName] = event => {
2618
+ handler(event, id);
2619
+ };
2620
+
2621
+ return acc;
2622
+ }, {});
2623
+ }, [listeners, id]);
2624
+ }
2625
+
2626
+ function useWindowRect(element) {
2627
+ return useMemo(() => element ? getWindowClientRect(element) : null, [element]);
2628
+ }
2629
+
2630
+ const defaultValue$2 = [];
2631
+ function useRects(elements, measure) {
2632
+ if (measure === void 0) {
2633
+ measure = getClientRect;
2634
+ }
2635
+
2636
+ const [firstElement] = elements;
2637
+ const windowRect = useWindowRect(firstElement ? getWindow(firstElement) : null);
2638
+ const [rects, setRects] = useState(defaultValue$2);
2639
+
2640
+ function measureRects() {
2641
+ setRects(() => {
2642
+ if (!elements.length) {
2643
+ return defaultValue$2;
2644
+ }
2645
+
2646
+ return elements.map(element => isDocumentScrollingElement(element) ? windowRect : new Rect(measure(element), element));
2647
+ });
2648
+ }
2649
+
2650
+ const resizeObserver = useResizeObserver({
2651
+ callback: measureRects
2652
+ });
2653
+ useIsomorphicLayoutEffect(() => {
2654
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
2655
+ measureRects();
2656
+ elements.forEach(element => resizeObserver == null ? void 0 : resizeObserver.observe(element));
2657
+ }, [elements]);
2658
+ return rects;
2659
+ }
2660
+
2661
+ function getMeasurableNode(node) {
2662
+ if (!node) {
2663
+ return null;
2664
+ }
2665
+
2666
+ if (node.children.length > 1) {
2667
+ return node;
2668
+ }
2669
+
2670
+ const firstChild = node.children[0];
2671
+ return isHTMLElement(firstChild) ? firstChild : node;
2672
+ }
2673
+
2674
+ function useDragOverlayMeasuring(_ref) {
2675
+ let {
2676
+ measure
2677
+ } = _ref;
2678
+ const [rect, setRect] = useState(null);
2679
+ const handleResize = useCallback(entries => {
2680
+ for (const {
2681
+ target
2682
+ } of entries) {
2683
+ if (isHTMLElement(target)) {
2684
+ setRect(rect => {
2685
+ const newRect = measure(target);
2686
+ return rect ? { ...rect,
2687
+ width: newRect.width,
2688
+ height: newRect.height
2689
+ } : newRect;
2690
+ });
2691
+ break;
2692
+ }
2693
+ }
2694
+ }, [measure]);
2695
+ const resizeObserver = useResizeObserver({
2696
+ callback: handleResize
2697
+ });
2698
+ const handleNodeChange = useCallback(element => {
2699
+ const node = getMeasurableNode(element);
2700
+ resizeObserver == null ? void 0 : resizeObserver.disconnect();
2701
+
2702
+ if (node) {
2703
+ resizeObserver == null ? void 0 : resizeObserver.observe(node);
2704
+ }
2705
+
2706
+ setRect(node ? measure(node) : null);
2707
+ }, [measure, resizeObserver]);
2708
+ const [nodeRef, setRef] = useNodeRef(handleNodeChange);
2709
+ return useMemo(() => ({
2710
+ nodeRef,
2711
+ rect,
2712
+ setRef
2713
+ }), [rect, nodeRef, setRef]);
2714
+ }
2715
+
2716
+ const defaultSensors = [{
2717
+ sensor: PointerSensor,
2718
+ options: {}
2719
+ }, {
2720
+ sensor: KeyboardSensor,
2721
+ options: {}
2722
+ }];
2723
+ const defaultData = {
2724
+ current: {}
2725
+ };
2726
+ const defaultMeasuringConfiguration = {
2727
+ draggable: {
2728
+ measure: getTransformAgnosticClientRect
2729
+ },
2730
+ droppable: {
2731
+ measure: getTransformAgnosticClientRect,
2732
+ strategy: MeasuringStrategy.WhileDragging,
2733
+ frequency: MeasuringFrequency.Optimized
2734
+ },
2735
+ dragOverlay: {
2736
+ measure: getClientRect
2737
+ }
2738
+ };
2739
+
2740
+ class DroppableContainersMap extends Map {
2741
+ get(id) {
2742
+ var _super$get;
2743
+
2744
+ return id != null ? (_super$get = super.get(id)) != null ? _super$get : undefined : undefined;
2745
+ }
2746
+
2747
+ toArray() {
2748
+ return Array.from(this.values());
2749
+ }
2750
+
2751
+ getEnabled() {
2752
+ return this.toArray().filter(_ref => {
2753
+ let {
2754
+ disabled
2755
+ } = _ref;
2756
+ return !disabled;
2757
+ });
2758
+ }
2759
+
2760
+ getNodeFor(id) {
2761
+ var _this$get$node$curren, _this$get;
2762
+
2763
+ return (_this$get$node$curren = (_this$get = this.get(id)) == null ? void 0 : _this$get.node.current) != null ? _this$get$node$curren : undefined;
2764
+ }
2765
+
2766
+ }
2767
+
2768
+ const defaultPublicContext = {
2769
+ activatorEvent: null,
2770
+ active: null,
2771
+ activeNode: null,
2772
+ activeNodeRect: null,
2773
+ collisions: null,
2774
+ containerNodeRect: null,
2775
+ draggableNodes: /*#__PURE__*/new Map(),
2776
+ droppableRects: /*#__PURE__*/new Map(),
2777
+ droppableContainers: /*#__PURE__*/new DroppableContainersMap(),
2778
+ over: null,
2779
+ dragOverlay: {
2780
+ nodeRef: {
2781
+ current: null
2782
+ },
2783
+ rect: null,
2784
+ setRef: noop
2785
+ },
2786
+ scrollableAncestors: [],
2787
+ scrollableAncestorRects: [],
2788
+ measuringConfiguration: defaultMeasuringConfiguration,
2789
+ measureDroppableContainers: noop,
2790
+ windowRect: null,
2791
+ measuringScheduled: false
2792
+ };
2793
+ const defaultInternalContext = {
2794
+ activatorEvent: null,
2795
+ activators: [],
2796
+ active: null,
2797
+ activeNodeRect: null,
2798
+ ariaDescribedById: {
2799
+ draggable: ''
2800
+ },
2801
+ dispatch: noop,
2802
+ draggableNodes: /*#__PURE__*/new Map(),
2803
+ over: null,
2804
+ measureDroppableContainers: noop
2805
+ };
2806
+ const InternalContext = /*#__PURE__*/createContext(defaultInternalContext);
2807
+ const PublicContext = /*#__PURE__*/createContext(defaultPublicContext);
2808
+
2809
+ function getInitialState() {
2810
+ return {
2811
+ draggable: {
2812
+ active: null,
2813
+ initialCoordinates: {
2814
+ x: 0,
2815
+ y: 0
2816
+ },
2817
+ nodes: new Map(),
2818
+ translate: {
2819
+ x: 0,
2820
+ y: 0
2821
+ }
2822
+ },
2823
+ droppable: {
2824
+ containers: new DroppableContainersMap()
2825
+ }
2826
+ };
2827
+ }
2828
+ function reducer(state, action) {
2829
+ switch (action.type) {
2830
+ case Action.DragStart:
2831
+ return { ...state,
2832
+ draggable: { ...state.draggable,
2833
+ initialCoordinates: action.initialCoordinates,
2834
+ active: action.active
2835
+ }
2836
+ };
2837
+
2838
+ case Action.DragMove:
2839
+ if (state.draggable.active == null) {
2840
+ return state;
2841
+ }
2842
+
2843
+ return { ...state,
2844
+ draggable: { ...state.draggable,
2845
+ translate: {
2846
+ x: action.coordinates.x - state.draggable.initialCoordinates.x,
2847
+ y: action.coordinates.y - state.draggable.initialCoordinates.y
2848
+ }
2849
+ }
2850
+ };
2851
+
2852
+ case Action.DragEnd:
2853
+ case Action.DragCancel:
2854
+ return { ...state,
2855
+ draggable: { ...state.draggable,
2856
+ active: null,
2857
+ initialCoordinates: {
2858
+ x: 0,
2859
+ y: 0
2860
+ },
2861
+ translate: {
2862
+ x: 0,
2863
+ y: 0
2864
+ }
2865
+ }
2866
+ };
2867
+
2868
+ case Action.RegisterDroppable:
2869
+ {
2870
+ const {
2871
+ element
2872
+ } = action;
2873
+ const {
2874
+ id
2875
+ } = element;
2876
+ const containers = new DroppableContainersMap(state.droppable.containers);
2877
+ containers.set(id, element);
2878
+ return { ...state,
2879
+ droppable: { ...state.droppable,
2880
+ containers
2881
+ }
2882
+ };
2883
+ }
2884
+
2885
+ case Action.SetDroppableDisabled:
2886
+ {
2887
+ const {
2888
+ id,
2889
+ key,
2890
+ disabled
2891
+ } = action;
2892
+ const element = state.droppable.containers.get(id);
2893
+
2894
+ if (!element || key !== element.key) {
2895
+ return state;
2896
+ }
2897
+
2898
+ const containers = new DroppableContainersMap(state.droppable.containers);
2899
+ containers.set(id, { ...element,
2900
+ disabled
2901
+ });
2902
+ return { ...state,
2903
+ droppable: { ...state.droppable,
2904
+ containers
2905
+ }
2906
+ };
2907
+ }
2908
+
2909
+ case Action.UnregisterDroppable:
2910
+ {
2911
+ const {
2912
+ id,
2913
+ key
2914
+ } = action;
2915
+ const element = state.droppable.containers.get(id);
2916
+
2917
+ if (!element || key !== element.key) {
2918
+ return state;
2919
+ }
2920
+
2921
+ const containers = new DroppableContainersMap(state.droppable.containers);
2922
+ containers.delete(id);
2923
+ return { ...state,
2924
+ droppable: { ...state.droppable,
2925
+ containers
2926
+ }
2927
+ };
2928
+ }
2929
+
2930
+ default:
2931
+ {
2932
+ return state;
2933
+ }
2934
+ }
2935
+ }
2936
+
2937
+ function RestoreFocus(_ref) {
2938
+ let {
2939
+ disabled
2940
+ } = _ref;
2941
+ const {
2942
+ active,
2943
+ activatorEvent,
2944
+ draggableNodes
2945
+ } = useContext(InternalContext);
2946
+ const previousActivatorEvent = usePrevious(activatorEvent);
2947
+ const previousActiveId = usePrevious(active == null ? void 0 : active.id); // Restore keyboard focus on the activator node
2948
+
2949
+ useEffect(() => {
2950
+ if (disabled) {
2951
+ return;
2952
+ }
2953
+
2954
+ if (!activatorEvent && previousActivatorEvent && previousActiveId != null) {
2955
+ if (!isKeyboardEvent(previousActivatorEvent)) {
2956
+ return;
2957
+ }
2958
+
2959
+ if (document.activeElement === previousActivatorEvent.target) {
2960
+ // No need to restore focus
2961
+ return;
2962
+ }
2963
+
2964
+ const draggableNode = draggableNodes.get(previousActiveId);
2965
+
2966
+ if (!draggableNode) {
2967
+ return;
2968
+ }
2969
+
2970
+ const {
2971
+ activatorNode,
2972
+ node
2973
+ } = draggableNode;
2974
+
2975
+ if (!activatorNode.current && !node.current) {
2976
+ return;
2977
+ }
2978
+
2979
+ requestAnimationFrame(() => {
2980
+ for (const element of [activatorNode.current, node.current]) {
2981
+ if (!element) {
2982
+ continue;
2983
+ }
2984
+
2985
+ const focusableNode = findFirstFocusableNode(element);
2986
+
2987
+ if (focusableNode) {
2988
+ focusableNode.focus();
2989
+ break;
2990
+ }
2991
+ }
2992
+ });
2993
+ }
2994
+ }, [activatorEvent, disabled, draggableNodes, previousActiveId, previousActivatorEvent]);
2995
+ return null;
2996
+ }
2997
+
2998
+ function applyModifiers(modifiers, _ref) {
2999
+ let {
3000
+ transform,
3001
+ ...args
3002
+ } = _ref;
3003
+ return modifiers != null && modifiers.length ? modifiers.reduce((accumulator, modifier) => {
3004
+ return modifier({
3005
+ transform: accumulator,
3006
+ ...args
3007
+ });
3008
+ }, transform) : transform;
3009
+ }
3010
+
3011
+ function useMeasuringConfiguration(config) {
3012
+ return useMemo(() => ({
3013
+ draggable: { ...defaultMeasuringConfiguration.draggable,
3014
+ ...(config == null ? void 0 : config.draggable)
3015
+ },
3016
+ droppable: { ...defaultMeasuringConfiguration.droppable,
3017
+ ...(config == null ? void 0 : config.droppable)
3018
+ },
3019
+ dragOverlay: { ...defaultMeasuringConfiguration.dragOverlay,
3020
+ ...(config == null ? void 0 : config.dragOverlay)
3021
+ }
3022
+ }), // eslint-disable-next-line react-hooks/exhaustive-deps
3023
+ [config == null ? void 0 : config.draggable, config == null ? void 0 : config.droppable, config == null ? void 0 : config.dragOverlay]);
3024
+ }
3025
+
3026
+ function useLayoutShiftScrollCompensation(_ref) {
3027
+ let {
3028
+ activeNode,
3029
+ measure,
3030
+ initialRect,
3031
+ config = true
3032
+ } = _ref;
3033
+ const initialized = useRef(false);
3034
+ const {
3035
+ x,
3036
+ y
3037
+ } = typeof config === 'boolean' ? {
3038
+ x: config,
3039
+ y: config
3040
+ } : config;
3041
+ useIsomorphicLayoutEffect(() => {
3042
+ const disabled = !x && !y;
3043
+
3044
+ if (disabled || !activeNode) {
3045
+ initialized.current = false;
3046
+ return;
3047
+ }
3048
+
3049
+ if (initialized.current || !initialRect) {
3050
+ // Return early if layout shift scroll compensation was already attempted
3051
+ // or if there is no initialRect to compare to.
3052
+ return;
3053
+ } // Get the most up to date node ref for the active draggable
3054
+
3055
+
3056
+ const node = activeNode == null ? void 0 : activeNode.node.current;
3057
+
3058
+ if (!node || node.isConnected === false) {
3059
+ // Return early if there is no attached node ref or if the node is
3060
+ // disconnected from the document.
3061
+ return;
3062
+ }
3063
+
3064
+ const rect = measure(node);
3065
+ const rectDelta = getRectDelta(rect, initialRect);
3066
+
3067
+ if (!x) {
3068
+ rectDelta.x = 0;
3069
+ }
3070
+
3071
+ if (!y) {
3072
+ rectDelta.y = 0;
3073
+ } // Only perform layout shift scroll compensation once
3074
+
3075
+
3076
+ initialized.current = true;
3077
+
3078
+ if (Math.abs(rectDelta.x) > 0 || Math.abs(rectDelta.y) > 0) {
3079
+ const firstScrollableAncestor = getFirstScrollableAncestor(node);
3080
+
3081
+ if (firstScrollableAncestor) {
3082
+ firstScrollableAncestor.scrollBy({
3083
+ top: rectDelta.y,
3084
+ left: rectDelta.x
3085
+ });
3086
+ }
3087
+ }
3088
+ }, [activeNode, x, y, initialRect, measure]);
3089
+ }
3090
+
3091
+ const ActiveDraggableContext = /*#__PURE__*/createContext({ ...defaultCoordinates,
3092
+ scaleX: 1,
3093
+ scaleY: 1
3094
+ });
3095
+ var Status;
3096
+
3097
+ (function (Status) {
3098
+ Status[Status["Uninitialized"] = 0] = "Uninitialized";
3099
+ Status[Status["Initializing"] = 1] = "Initializing";
3100
+ Status[Status["Initialized"] = 2] = "Initialized";
3101
+ })(Status || (Status = {}));
3102
+
3103
+ const DndContext = /*#__PURE__*/memo(function DndContext(_ref) {
3104
+ var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect;
3105
+
3106
+ let {
3107
+ id,
3108
+ accessibility,
3109
+ autoScroll = true,
3110
+ children,
3111
+ sensors = defaultSensors,
3112
+ collisionDetection = rectIntersection,
3113
+ measuring,
3114
+ modifiers,
3115
+ ...props
3116
+ } = _ref;
3117
+ const store = useReducer(reducer, undefined, getInitialState);
3118
+ const [state, dispatch] = store;
3119
+ const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider();
3120
+ const [status, setStatus] = useState(Status.Uninitialized);
3121
+ const isInitialized = status === Status.Initialized;
3122
+ const {
3123
+ draggable: {
3124
+ active: activeId,
3125
+ nodes: draggableNodes,
3126
+ translate
3127
+ },
3128
+ droppable: {
3129
+ containers: droppableContainers
3130
+ }
3131
+ } = state;
3132
+ const node = activeId != null ? draggableNodes.get(activeId) : null;
3133
+ const activeRects = useRef({
3134
+ initial: null,
3135
+ translated: null
3136
+ });
3137
+ const active = useMemo(() => {
3138
+ var _node$data;
3139
+
3140
+ return activeId != null ? {
3141
+ id: activeId,
3142
+ // It's possible for the active node to unmount while dragging
3143
+ data: (_node$data = node == null ? void 0 : node.data) != null ? _node$data : defaultData,
3144
+ rect: activeRects
3145
+ } : null;
3146
+ }, [activeId, node]);
3147
+ const activeRef = useRef(null);
3148
+ const [activeSensor, setActiveSensor] = useState(null);
3149
+ const [activatorEvent, setActivatorEvent] = useState(null);
3150
+ const latestProps = useLatestValue(props, Object.values(props));
3151
+ const draggableDescribedById = useUniqueId("DndDescribedBy", id);
3152
+ const enabledDroppableContainers = useMemo(() => droppableContainers.getEnabled(), [droppableContainers]);
3153
+ const measuringConfiguration = useMeasuringConfiguration(measuring);
3154
+ const {
3155
+ droppableRects,
3156
+ measureDroppableContainers,
3157
+ measuringScheduled
3158
+ } = useDroppableMeasuring(enabledDroppableContainers, {
3159
+ dragging: isInitialized,
3160
+ dependencies: [translate.x, translate.y],
3161
+ config: measuringConfiguration.droppable
3162
+ });
3163
+ const activeNode = useCachedNode(draggableNodes, activeId);
3164
+ const activationCoordinates = useMemo(() => activatorEvent ? getEventCoordinates(activatorEvent) : null, [activatorEvent]);
3165
+ const autoScrollOptions = getAutoScrollerOptions();
3166
+ const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure);
3167
+ useLayoutShiftScrollCompensation({
3168
+ activeNode: activeId != null ? draggableNodes.get(activeId) : null,
3169
+ config: autoScrollOptions.layoutShiftCompensation,
3170
+ initialRect: initialActiveNodeRect,
3171
+ measure: measuringConfiguration.draggable.measure
3172
+ });
3173
+ const activeNodeRect = useRect(activeNode, measuringConfiguration.draggable.measure, initialActiveNodeRect);
3174
+ const containerNodeRect = useRect(activeNode ? activeNode.parentElement : null);
3175
+ const sensorContext = useRef({
3176
+ activatorEvent: null,
3177
+ active: null,
3178
+ activeNode,
3179
+ collisionRect: null,
3180
+ collisions: null,
3181
+ droppableRects,
3182
+ draggableNodes,
3183
+ draggingNode: null,
3184
+ draggingNodeRect: null,
3185
+ droppableContainers,
3186
+ over: null,
3187
+ scrollableAncestors: [],
3188
+ scrollAdjustedTranslate: null
3189
+ });
3190
+ const overNode = droppableContainers.getNodeFor((_sensorContext$curren = sensorContext.current.over) == null ? void 0 : _sensorContext$curren.id);
3191
+ const dragOverlay = useDragOverlayMeasuring({
3192
+ measure: measuringConfiguration.dragOverlay.measure
3193
+ }); // Use the rect of the drag overlay if it is mounted
3194
+
3195
+ const draggingNode = (_dragOverlay$nodeRef$ = dragOverlay.nodeRef.current) != null ? _dragOverlay$nodeRef$ : activeNode;
3196
+ const draggingNodeRect = isInitialized ? (_dragOverlay$rect = dragOverlay.rect) != null ? _dragOverlay$rect : activeNodeRect : null;
3197
+ const usesDragOverlay = Boolean(dragOverlay.nodeRef.current && dragOverlay.rect); // The delta between the previous and new position of the draggable node
3198
+ // is only relevant when there is no drag overlay
3199
+
3200
+ const nodeRectDelta = useRectDelta(usesDragOverlay ? null : activeNodeRect); // Get the window rect of the dragging node
3201
+
3202
+ const windowRect = useWindowRect(draggingNode ? getWindow(draggingNode) : null); // Get scrollable ancestors of the dragging node
3203
+
3204
+ const scrollableAncestors = useScrollableAncestors(isInitialized ? overNode != null ? overNode : activeNode : null);
3205
+ const scrollableAncestorRects = useRects(scrollableAncestors); // Apply modifiers
3206
+
3207
+ const modifiedTranslate = applyModifiers(modifiers, {
3208
+ transform: {
3209
+ x: translate.x - nodeRectDelta.x,
3210
+ y: translate.y - nodeRectDelta.y,
3211
+ scaleX: 1,
3212
+ scaleY: 1
3213
+ },
3214
+ activatorEvent,
3215
+ active,
3216
+ activeNodeRect,
3217
+ containerNodeRect,
3218
+ draggingNodeRect,
3219
+ over: sensorContext.current.over,
3220
+ overlayNodeRect: dragOverlay.rect,
3221
+ scrollableAncestors,
3222
+ scrollableAncestorRects,
3223
+ windowRect
3224
+ });
3225
+ const pointerCoordinates = activationCoordinates ? add(activationCoordinates, translate) : null;
3226
+ const scrollOffsets = useScrollOffsets(scrollableAncestors); // Represents the scroll delta since dragging was initiated
3227
+
3228
+ const scrollAdjustment = useScrollOffsetsDelta(scrollOffsets); // Represents the scroll delta since the last time the active node rect was measured
3229
+
3230
+ const activeNodeScrollDelta = useScrollOffsetsDelta(scrollOffsets, [activeNodeRect]);
3231
+ const scrollAdjustedTranslate = add(modifiedTranslate, scrollAdjustment);
3232
+ const collisionRect = draggingNodeRect ? getAdjustedRect(draggingNodeRect, modifiedTranslate) : null;
3233
+ const collisions = active && collisionRect ? collisionDetection({
3234
+ active,
3235
+ collisionRect,
3236
+ droppableRects,
3237
+ droppableContainers: enabledDroppableContainers,
3238
+ pointerCoordinates
3239
+ }) : null;
3240
+ const overId = getFirstCollision(collisions, 'id');
3241
+ const [over, setOver] = useState(null); // When there is no drag overlay used, we need to account for the
3242
+ // window scroll delta
3243
+
3244
+ const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta);
3245
+ const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect);
3246
+ const activeSensorRef = useRef(null);
3247
+ const instantiateSensor = useCallback((event, _ref2) => {
3248
+ let {
3249
+ sensor: Sensor,
3250
+ options
3251
+ } = _ref2;
3252
+
3253
+ if (activeRef.current == null) {
3254
+ return;
3255
+ }
3256
+
3257
+ const activeNode = draggableNodes.get(activeRef.current);
3258
+
3259
+ if (!activeNode) {
3260
+ return;
3261
+ }
3262
+
3263
+ const activatorEvent = event.nativeEvent;
3264
+ const sensorInstance = new Sensor({
3265
+ active: activeRef.current,
3266
+ activeNode,
3267
+ event: activatorEvent,
3268
+ options,
3269
+ // Sensors need to be instantiated with refs for arguments that change over time
3270
+ // otherwise they are frozen in time with the stale arguments
3271
+ context: sensorContext,
3272
+
3273
+ onAbort(id) {
3274
+ const draggableNode = draggableNodes.get(id);
3275
+
3276
+ if (!draggableNode) {
3277
+ return;
3278
+ }
3279
+
3280
+ const {
3281
+ onDragAbort
3282
+ } = latestProps.current;
3283
+ const event = {
3284
+ id
3285
+ };
3286
+ onDragAbort == null ? void 0 : onDragAbort(event);
3287
+ dispatchMonitorEvent({
3288
+ type: 'onDragAbort',
3289
+ event
3290
+ });
3291
+ },
3292
+
3293
+ onPending(id, constraint, initialCoordinates, offset) {
3294
+ const draggableNode = draggableNodes.get(id);
3295
+
3296
+ if (!draggableNode) {
3297
+ return;
3298
+ }
3299
+
3300
+ const {
3301
+ onDragPending
3302
+ } = latestProps.current;
3303
+ const event = {
3304
+ id,
3305
+ constraint,
3306
+ initialCoordinates,
3307
+ offset
3308
+ };
3309
+ onDragPending == null ? void 0 : onDragPending(event);
3310
+ dispatchMonitorEvent({
3311
+ type: 'onDragPending',
3312
+ event
3313
+ });
3314
+ },
3315
+
3316
+ onStart(initialCoordinates) {
3317
+ const id = activeRef.current;
3318
+
3319
+ if (id == null) {
3320
+ return;
3321
+ }
3322
+
3323
+ const draggableNode = draggableNodes.get(id);
3324
+
3325
+ if (!draggableNode) {
3326
+ return;
3327
+ }
3328
+
3329
+ const {
3330
+ onDragStart
3331
+ } = latestProps.current;
3332
+ const event = {
3333
+ activatorEvent,
3334
+ active: {
3335
+ id,
3336
+ data: draggableNode.data,
3337
+ rect: activeRects
3338
+ }
3339
+ };
3340
+ unstable_batchedUpdates(() => {
3341
+ onDragStart == null ? void 0 : onDragStart(event);
3342
+ setStatus(Status.Initializing);
3343
+ dispatch({
3344
+ type: Action.DragStart,
3345
+ initialCoordinates,
3346
+ active: id
3347
+ });
3348
+ dispatchMonitorEvent({
3349
+ type: 'onDragStart',
3350
+ event
3351
+ });
3352
+ setActiveSensor(activeSensorRef.current);
3353
+ setActivatorEvent(activatorEvent);
3354
+ });
3355
+ },
3356
+
3357
+ onMove(coordinates) {
3358
+ dispatch({
3359
+ type: Action.DragMove,
3360
+ coordinates
3361
+ });
3362
+ },
3363
+
3364
+ onEnd: createHandler(Action.DragEnd),
3365
+ onCancel: createHandler(Action.DragCancel)
3366
+ });
3367
+ activeSensorRef.current = sensorInstance;
3368
+
3369
+ function createHandler(type) {
3370
+ return async function handler() {
3371
+ const {
3372
+ active,
3373
+ collisions,
3374
+ over,
3375
+ scrollAdjustedTranslate
3376
+ } = sensorContext.current;
3377
+ let event = null;
3378
+
3379
+ if (active && scrollAdjustedTranslate) {
3380
+ const {
3381
+ cancelDrop
3382
+ } = latestProps.current;
3383
+ event = {
3384
+ activatorEvent,
3385
+ active: active,
3386
+ collisions,
3387
+ delta: scrollAdjustedTranslate,
3388
+ over
3389
+ };
3390
+
3391
+ if (type === Action.DragEnd && typeof cancelDrop === 'function') {
3392
+ const shouldCancel = await Promise.resolve(cancelDrop(event));
3393
+
3394
+ if (shouldCancel) {
3395
+ type = Action.DragCancel;
3396
+ }
3397
+ }
3398
+ }
3399
+
3400
+ activeRef.current = null;
3401
+ unstable_batchedUpdates(() => {
3402
+ dispatch({
3403
+ type
3404
+ });
3405
+ setStatus(Status.Uninitialized);
3406
+ setOver(null);
3407
+ setActiveSensor(null);
3408
+ setActivatorEvent(null);
3409
+ activeSensorRef.current = null;
3410
+ const eventName = type === Action.DragEnd ? 'onDragEnd' : 'onDragCancel';
3411
+
3412
+ if (event) {
3413
+ const handler = latestProps.current[eventName];
3414
+ handler == null ? void 0 : handler(event);
3415
+ dispatchMonitorEvent({
3416
+ type: eventName,
3417
+ event
3418
+ });
3419
+ }
3420
+ });
3421
+ };
3422
+ }
3423
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps
3424
+ [draggableNodes]);
3425
+ const bindActivatorToSensorInstantiator = useCallback((handler, sensor) => {
3426
+ return (event, active) => {
3427
+ const nativeEvent = event.nativeEvent;
3428
+ const activeDraggableNode = draggableNodes.get(active);
3429
+
3430
+ if ( // Another sensor is already instantiating
3431
+ activeRef.current !== null || // No active draggable
3432
+ !activeDraggableNode || // Event has already been captured
3433
+ nativeEvent.dndKit || nativeEvent.defaultPrevented) {
3434
+ return;
3435
+ }
3436
+
3437
+ const activationContext = {
3438
+ active: activeDraggableNode
3439
+ };
3440
+ const shouldActivate = handler(event, sensor.options, activationContext);
3441
+
3442
+ if (shouldActivate === true) {
3443
+ nativeEvent.dndKit = {
3444
+ capturedBy: sensor.sensor
3445
+ };
3446
+ activeRef.current = active;
3447
+ instantiateSensor(event, sensor);
3448
+ }
3449
+ };
3450
+ }, [draggableNodes, instantiateSensor]);
3451
+ const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator);
3452
+ useSensorSetup(sensors);
3453
+ useIsomorphicLayoutEffect(() => {
3454
+ if (activeNodeRect && status === Status.Initializing) {
3455
+ setStatus(Status.Initialized);
3456
+ }
3457
+ }, [activeNodeRect, status]);
3458
+ useEffect(() => {
3459
+ const {
3460
+ onDragMove
3461
+ } = latestProps.current;
3462
+ const {
3463
+ active,
3464
+ activatorEvent,
3465
+ collisions,
3466
+ over
3467
+ } = sensorContext.current;
3468
+
3469
+ if (!active || !activatorEvent) {
3470
+ return;
3471
+ }
3472
+
3473
+ const event = {
3474
+ active,
3475
+ activatorEvent,
3476
+ collisions,
3477
+ delta: {
3478
+ x: scrollAdjustedTranslate.x,
3479
+ y: scrollAdjustedTranslate.y
3480
+ },
3481
+ over
3482
+ };
3483
+ unstable_batchedUpdates(() => {
3484
+ onDragMove == null ? void 0 : onDragMove(event);
3485
+ dispatchMonitorEvent({
3486
+ type: 'onDragMove',
3487
+ event
3488
+ });
3489
+ });
3490
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps
3491
+ [scrollAdjustedTranslate.x, scrollAdjustedTranslate.y]);
3492
+ useEffect(() => {
3493
+ const {
3494
+ active,
3495
+ activatorEvent,
3496
+ collisions,
3497
+ droppableContainers,
3498
+ scrollAdjustedTranslate
3499
+ } = sensorContext.current;
3500
+
3501
+ if (!active || activeRef.current == null || !activatorEvent || !scrollAdjustedTranslate) {
3502
+ return;
3503
+ }
3504
+
3505
+ const {
3506
+ onDragOver
3507
+ } = latestProps.current;
3508
+ const overContainer = droppableContainers.get(overId);
3509
+ const over = overContainer && overContainer.rect.current ? {
3510
+ id: overContainer.id,
3511
+ rect: overContainer.rect.current,
3512
+ data: overContainer.data,
3513
+ disabled: overContainer.disabled
3514
+ } : null;
3515
+ const event = {
3516
+ active,
3517
+ activatorEvent,
3518
+ collisions,
3519
+ delta: {
3520
+ x: scrollAdjustedTranslate.x,
3521
+ y: scrollAdjustedTranslate.y
3522
+ },
3523
+ over
3524
+ };
3525
+ unstable_batchedUpdates(() => {
3526
+ setOver(over);
3527
+ onDragOver == null ? void 0 : onDragOver(event);
3528
+ dispatchMonitorEvent({
3529
+ type: 'onDragOver',
3530
+ event
3531
+ });
3532
+ });
3533
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps
3534
+ [overId]);
3535
+ useIsomorphicLayoutEffect(() => {
3536
+ sensorContext.current = {
3537
+ activatorEvent,
3538
+ active,
3539
+ activeNode,
3540
+ collisionRect,
3541
+ collisions,
3542
+ droppableRects,
3543
+ draggableNodes,
3544
+ draggingNode,
3545
+ draggingNodeRect,
3546
+ droppableContainers,
3547
+ over,
3548
+ scrollableAncestors,
3549
+ scrollAdjustedTranslate
3550
+ };
3551
+ activeRects.current = {
3552
+ initial: draggingNodeRect,
3553
+ translated: collisionRect
3554
+ };
3555
+ }, [active, activeNode, collisions, collisionRect, draggableNodes, draggingNode, draggingNodeRect, droppableRects, droppableContainers, over, scrollableAncestors, scrollAdjustedTranslate]);
3556
+ useAutoScroller({ ...autoScrollOptions,
3557
+ delta: translate,
3558
+ draggingRect: collisionRect,
3559
+ pointerCoordinates,
3560
+ scrollableAncestors,
3561
+ scrollableAncestorRects
3562
+ });
3563
+ const publicContext = useMemo(() => {
3564
+ const context = {
3565
+ active,
3566
+ activeNode,
3567
+ activeNodeRect,
3568
+ activatorEvent,
3569
+ collisions,
3570
+ containerNodeRect,
3571
+ dragOverlay,
3572
+ draggableNodes,
3573
+ droppableContainers,
3574
+ droppableRects,
3575
+ over,
3576
+ measureDroppableContainers,
3577
+ scrollableAncestors,
3578
+ scrollableAncestorRects,
3579
+ measuringConfiguration,
3580
+ measuringScheduled,
3581
+ windowRect
3582
+ };
3583
+ return context;
3584
+ }, [active, activeNode, activeNodeRect, activatorEvent, collisions, containerNodeRect, dragOverlay, draggableNodes, droppableContainers, droppableRects, over, measureDroppableContainers, scrollableAncestors, scrollableAncestorRects, measuringConfiguration, measuringScheduled, windowRect]);
3585
+ const internalContext = useMemo(() => {
3586
+ const context = {
3587
+ activatorEvent,
3588
+ activators,
3589
+ active,
3590
+ activeNodeRect,
3591
+ ariaDescribedById: {
3592
+ draggable: draggableDescribedById
3593
+ },
3594
+ dispatch,
3595
+ draggableNodes,
3596
+ over,
3597
+ measureDroppableContainers
3598
+ };
3599
+ return context;
3600
+ }, [activatorEvent, activators, active, activeNodeRect, dispatch, draggableDescribedById, draggableNodes, over, measureDroppableContainers]);
3601
+ return React__default.createElement(DndMonitorContext.Provider, {
3602
+ value: registerMonitorListener
3603
+ }, React__default.createElement(InternalContext.Provider, {
3604
+ value: internalContext
3605
+ }, React__default.createElement(PublicContext.Provider, {
3606
+ value: publicContext
3607
+ }, React__default.createElement(ActiveDraggableContext.Provider, {
3608
+ value: transform
3609
+ }, children)), React__default.createElement(RestoreFocus, {
3610
+ disabled: (accessibility == null ? void 0 : accessibility.restoreFocus) === false
3611
+ })), React__default.createElement(Accessibility, { ...accessibility,
3612
+ hiddenTextDescribedById: draggableDescribedById
3613
+ }));
3614
+
3615
+ function getAutoScrollerOptions() {
3616
+ const activeSensorDisablesAutoscroll = (activeSensor == null ? void 0 : activeSensor.autoScrollEnabled) === false;
3617
+ const autoScrollGloballyDisabled = typeof autoScroll === 'object' ? autoScroll.enabled === false : autoScroll === false;
3618
+ const enabled = isInitialized && !activeSensorDisablesAutoscroll && !autoScrollGloballyDisabled;
3619
+
3620
+ if (typeof autoScroll === 'object') {
3621
+ return { ...autoScroll,
3622
+ enabled
3623
+ };
3624
+ }
3625
+
3626
+ return {
3627
+ enabled
3628
+ };
3629
+ }
3630
+ });
3631
+
3632
+ const NullContext = /*#__PURE__*/createContext(null);
3633
+ const defaultRole = 'button';
3634
+ const ID_PREFIX$1 = 'Draggable';
3635
+ function useDraggable(_ref) {
3636
+ let {
3637
+ id,
3638
+ data,
3639
+ disabled = false,
3640
+ attributes
3641
+ } = _ref;
3642
+ const key = useUniqueId(ID_PREFIX$1);
3643
+ const {
3644
+ activators,
3645
+ activatorEvent,
3646
+ active,
3647
+ activeNodeRect,
3648
+ ariaDescribedById,
3649
+ draggableNodes,
3650
+ over
3651
+ } = useContext(InternalContext);
3652
+ const {
3653
+ role = defaultRole,
3654
+ roleDescription = 'draggable',
3655
+ tabIndex = 0
3656
+ } = attributes != null ? attributes : {};
3657
+ const isDragging = (active == null ? void 0 : active.id) === id;
3658
+ const transform = useContext(isDragging ? ActiveDraggableContext : NullContext);
3659
+ const [node, setNodeRef] = useNodeRef();
3660
+ const [activatorNode, setActivatorNodeRef] = useNodeRef();
3661
+ const listeners = useSyntheticListeners(activators, id);
3662
+ const dataRef = useLatestValue(data);
3663
+ useIsomorphicLayoutEffect(() => {
3664
+ draggableNodes.set(id, {
3665
+ id,
3666
+ key,
3667
+ node,
3668
+ activatorNode,
3669
+ data: dataRef
3670
+ });
3671
+ return () => {
3672
+ const node = draggableNodes.get(id);
3673
+
3674
+ if (node && node.key === key) {
3675
+ draggableNodes.delete(id);
3676
+ }
3677
+ };
3678
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps
3679
+ [draggableNodes, id]);
3680
+ const memoizedAttributes = useMemo(() => ({
3681
+ role,
3682
+ tabIndex,
3683
+ 'aria-disabled': disabled,
3684
+ 'aria-pressed': isDragging && role === defaultRole ? true : undefined,
3685
+ 'aria-roledescription': roleDescription,
3686
+ 'aria-describedby': ariaDescribedById.draggable
3687
+ }), [disabled, role, tabIndex, isDragging, roleDescription, ariaDescribedById.draggable]);
3688
+ return {
3689
+ active,
3690
+ activatorEvent,
3691
+ activeNodeRect,
3692
+ attributes: memoizedAttributes,
3693
+ isDragging,
3694
+ listeners: disabled ? undefined : listeners,
3695
+ node,
3696
+ over,
3697
+ setNodeRef,
3698
+ setActivatorNodeRef,
3699
+ transform
3700
+ };
3701
+ }
3702
+
3703
+ function useDndContext() {
3704
+ return useContext(PublicContext);
3705
+ }
3706
+
3707
+ const ID_PREFIX$1$1 = 'Droppable';
3708
+ const defaultResizeObserverConfig = {
3709
+ timeout: 25
3710
+ };
3711
+ function useDroppable(_ref) {
3712
+ let {
3713
+ data,
3714
+ disabled = false,
3715
+ id,
3716
+ resizeObserverConfig
3717
+ } = _ref;
3718
+ const key = useUniqueId(ID_PREFIX$1$1);
3719
+ const {
3720
+ active,
3721
+ dispatch,
3722
+ over,
3723
+ measureDroppableContainers
3724
+ } = useContext(InternalContext);
3725
+ const previous = useRef({
3726
+ disabled
3727
+ });
3728
+ const resizeObserverConnected = useRef(false);
3729
+ const rect = useRef(null);
3730
+ const callbackId = useRef(null);
3731
+ const {
3732
+ disabled: resizeObserverDisabled,
3733
+ updateMeasurementsFor,
3734
+ timeout: resizeObserverTimeout
3735
+ } = { ...defaultResizeObserverConfig,
3736
+ ...resizeObserverConfig
3737
+ };
3738
+ const ids = useLatestValue(updateMeasurementsFor != null ? updateMeasurementsFor : id);
3739
+ const handleResize = useCallback(() => {
3740
+ if (!resizeObserverConnected.current) {
3741
+ // ResizeObserver invokes the `handleResize` callback as soon as `observe` is called,
3742
+ // assuming the element is rendered and displayed.
3743
+ resizeObserverConnected.current = true;
3744
+ return;
3745
+ }
3746
+
3747
+ if (callbackId.current != null) {
3748
+ clearTimeout(callbackId.current);
3749
+ }
3750
+
3751
+ callbackId.current = setTimeout(() => {
3752
+ measureDroppableContainers(Array.isArray(ids.current) ? ids.current : [ids.current]);
3753
+ callbackId.current = null;
3754
+ }, resizeObserverTimeout);
3755
+ }, //eslint-disable-next-line react-hooks/exhaustive-deps
3756
+ [resizeObserverTimeout]);
3757
+ const resizeObserver = useResizeObserver({
3758
+ callback: handleResize,
3759
+ disabled: resizeObserverDisabled || !active
3760
+ });
3761
+ const handleNodeChange = useCallback((newElement, previousElement) => {
3762
+ if (!resizeObserver) {
3763
+ return;
3764
+ }
3765
+
3766
+ if (previousElement) {
3767
+ resizeObserver.unobserve(previousElement);
3768
+ resizeObserverConnected.current = false;
3769
+ }
3770
+
3771
+ if (newElement) {
3772
+ resizeObserver.observe(newElement);
3773
+ }
3774
+ }, [resizeObserver]);
3775
+ const [nodeRef, setNodeRef] = useNodeRef(handleNodeChange);
3776
+ const dataRef = useLatestValue(data);
3777
+ useEffect(() => {
3778
+ if (!resizeObserver || !nodeRef.current) {
3779
+ return;
3780
+ }
3781
+
3782
+ resizeObserver.disconnect();
3783
+ resizeObserverConnected.current = false;
3784
+ resizeObserver.observe(nodeRef.current);
3785
+ }, [nodeRef, resizeObserver]);
3786
+ useEffect(() => {
3787
+ dispatch({
3788
+ type: Action.RegisterDroppable,
3789
+ element: {
3790
+ id,
3791
+ key,
3792
+ disabled,
3793
+ node: nodeRef,
3794
+ rect,
3795
+ data: dataRef
3796
+ }
3797
+ });
3798
+ return () => dispatch({
3799
+ type: Action.UnregisterDroppable,
3800
+ key,
3801
+ id
3802
+ });
3803
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps
3804
+ [id]);
3805
+ useEffect(() => {
3806
+ if (disabled !== previous.current.disabled) {
3807
+ dispatch({
3808
+ type: Action.SetDroppableDisabled,
3809
+ id,
3810
+ key,
3811
+ disabled
3812
+ });
3813
+ previous.current.disabled = disabled;
3814
+ }
3815
+ }, [id, key, disabled, dispatch]);
3816
+ return {
3817
+ active,
3818
+ rect,
3819
+ isOver: (over == null ? void 0 : over.id) === id,
3820
+ node: nodeRef,
3821
+ over,
3822
+ setNodeRef
3823
+ };
3824
+ }
3825
+
3826
+ /**
3827
+ * Move an array item to a different position. Returns a new array with the item moved to the new position.
3828
+ */
3829
+ function arrayMove(array, from, to) {
3830
+ const newArray = array.slice();
3831
+ newArray.splice(to < 0 ? newArray.length + to : to, 0, newArray.splice(from, 1)[0]);
3832
+ return newArray;
3833
+ }
3834
+
3835
+ function getSortedRects(items, rects) {
3836
+ return items.reduce((accumulator, id, index) => {
3837
+ const rect = rects.get(id);
3838
+
3839
+ if (rect) {
3840
+ accumulator[index] = rect;
3841
+ }
3842
+
3843
+ return accumulator;
3844
+ }, Array(items.length));
3845
+ }
3846
+
3847
+ function isValidIndex(index) {
3848
+ return index !== null && index >= 0;
3849
+ }
3850
+
3851
+ function itemsEqual(a, b) {
3852
+ if (a === b) {
3853
+ return true;
3854
+ }
3855
+
3856
+ if (a.length !== b.length) {
3857
+ return false;
3858
+ }
3859
+
3860
+ for (let i = 0; i < a.length; i++) {
3861
+ if (a[i] !== b[i]) {
3862
+ return false;
3863
+ }
3864
+ }
3865
+
3866
+ return true;
3867
+ }
3868
+
3869
+ function normalizeDisabled(disabled) {
3870
+ if (typeof disabled === 'boolean') {
3871
+ return {
3872
+ draggable: disabled,
3873
+ droppable: disabled
3874
+ };
3875
+ }
3876
+
3877
+ return disabled;
3878
+ }
3879
+
3880
+ // To-do: We should be calculating scale transformation
3881
+ const defaultScale = {
3882
+ scaleX: 1,
3883
+ scaleY: 1
3884
+ };
3885
+ const horizontalListSortingStrategy = _ref => {
3886
+ var _rects$activeIndex;
3887
+
3888
+ let {
3889
+ rects,
3890
+ activeNodeRect: fallbackActiveRect,
3891
+ activeIndex,
3892
+ overIndex,
3893
+ index
3894
+ } = _ref;
3895
+ const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect;
3896
+
3897
+ if (!activeNodeRect) {
3898
+ return null;
3899
+ }
3900
+
3901
+ const itemGap = getItemGap(rects, index, activeIndex);
3902
+
3903
+ if (index === activeIndex) {
3904
+ const newIndexRect = rects[overIndex];
3905
+
3906
+ if (!newIndexRect) {
3907
+ return null;
3908
+ }
3909
+
3910
+ return {
3911
+ x: activeIndex < overIndex ? newIndexRect.left + newIndexRect.width - (activeNodeRect.left + activeNodeRect.width) : newIndexRect.left - activeNodeRect.left,
3912
+ y: 0,
3913
+ ...defaultScale
3914
+ };
3915
+ }
3916
+
3917
+ if (index > activeIndex && index <= overIndex) {
3918
+ return {
3919
+ x: -activeNodeRect.width - itemGap,
3920
+ y: 0,
3921
+ ...defaultScale
3922
+ };
3923
+ }
3924
+
3925
+ if (index < activeIndex && index >= overIndex) {
3926
+ return {
3927
+ x: activeNodeRect.width + itemGap,
3928
+ y: 0,
3929
+ ...defaultScale
3930
+ };
3931
+ }
3932
+
3933
+ return {
3934
+ x: 0,
3935
+ y: 0,
3936
+ ...defaultScale
3937
+ };
3938
+ };
3939
+
3940
+ function getItemGap(rects, index, activeIndex) {
3941
+ const currentRect = rects[index];
3942
+ const previousRect = rects[index - 1];
3943
+ const nextRect = rects[index + 1];
3944
+
3945
+ if (!currentRect || !previousRect && !nextRect) {
3946
+ return 0;
3947
+ }
3948
+
3949
+ if (activeIndex < index) {
3950
+ return previousRect ? currentRect.left - (previousRect.left + previousRect.width) : nextRect.left - (currentRect.left + currentRect.width);
3951
+ }
3952
+
3953
+ return nextRect ? nextRect.left - (currentRect.left + currentRect.width) : currentRect.left - (previousRect.left + previousRect.width);
3954
+ }
3955
+
3956
+ const rectSortingStrategy = _ref => {
3957
+ let {
3958
+ rects,
3959
+ activeIndex,
3960
+ overIndex,
3961
+ index
3962
+ } = _ref;
3963
+ const newRects = arrayMove(rects, overIndex, activeIndex);
3964
+ const oldRect = rects[index];
3965
+ const newRect = newRects[index];
3966
+
3967
+ if (!newRect || !oldRect) {
3968
+ return null;
3969
+ }
3970
+
3971
+ return {
3972
+ x: newRect.left - oldRect.left,
3973
+ y: newRect.top - oldRect.top,
3974
+ scaleX: newRect.width / oldRect.width,
3975
+ scaleY: newRect.height / oldRect.height
3976
+ };
3977
+ };
3978
+
3979
+ // To-do: We should be calculating scale transformation
3980
+ const defaultScale$1 = {
3981
+ scaleX: 1,
3982
+ scaleY: 1
3983
+ };
3984
+ const verticalListSortingStrategy = _ref => {
3985
+ var _rects$activeIndex;
3986
+
3987
+ let {
3988
+ activeIndex,
3989
+ activeNodeRect: fallbackActiveRect,
3990
+ index,
3991
+ rects,
3992
+ overIndex
3993
+ } = _ref;
3994
+ const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect;
3995
+
3996
+ if (!activeNodeRect) {
3997
+ return null;
3998
+ }
3999
+
4000
+ if (index === activeIndex) {
4001
+ const overIndexRect = rects[overIndex];
4002
+
4003
+ if (!overIndexRect) {
4004
+ return null;
4005
+ }
4006
+
4007
+ return {
4008
+ x: 0,
4009
+ y: activeIndex < overIndex ? overIndexRect.top + overIndexRect.height - (activeNodeRect.top + activeNodeRect.height) : overIndexRect.top - activeNodeRect.top,
4010
+ ...defaultScale$1
4011
+ };
4012
+ }
4013
+
4014
+ const itemGap = getItemGap$1(rects, index, activeIndex);
4015
+
4016
+ if (index > activeIndex && index <= overIndex) {
4017
+ return {
4018
+ x: 0,
4019
+ y: -activeNodeRect.height - itemGap,
4020
+ ...defaultScale$1
4021
+ };
4022
+ }
4023
+
4024
+ if (index < activeIndex && index >= overIndex) {
4025
+ return {
4026
+ x: 0,
4027
+ y: activeNodeRect.height + itemGap,
4028
+ ...defaultScale$1
4029
+ };
4030
+ }
4031
+
4032
+ return {
4033
+ x: 0,
4034
+ y: 0,
4035
+ ...defaultScale$1
4036
+ };
4037
+ };
4038
+
4039
+ function getItemGap$1(clientRects, index, activeIndex) {
4040
+ const currentRect = clientRects[index];
4041
+ const previousRect = clientRects[index - 1];
4042
+ const nextRect = clientRects[index + 1];
4043
+
4044
+ if (!currentRect) {
4045
+ return 0;
4046
+ }
4047
+
4048
+ if (activeIndex < index) {
4049
+ return previousRect ? currentRect.top - (previousRect.top + previousRect.height) : nextRect ? nextRect.top - (currentRect.top + currentRect.height) : 0;
4050
+ }
4051
+
4052
+ return nextRect ? nextRect.top - (currentRect.top + currentRect.height) : previousRect ? currentRect.top - (previousRect.top + previousRect.height) : 0;
4053
+ }
4054
+
4055
+ const ID_PREFIX = 'Sortable';
4056
+ const Context = /*#__PURE__*/React__default.createContext({
4057
+ activeIndex: -1,
4058
+ containerId: ID_PREFIX,
4059
+ disableTransforms: false,
4060
+ items: [],
4061
+ overIndex: -1,
4062
+ useDragOverlay: false,
4063
+ sortedRects: [],
4064
+ strategy: rectSortingStrategy,
4065
+ disabled: {
4066
+ draggable: false,
4067
+ droppable: false
4068
+ }
4069
+ });
4070
+ function SortableContext(_ref) {
4071
+ let {
4072
+ children,
4073
+ id,
4074
+ items: userDefinedItems,
4075
+ strategy = rectSortingStrategy,
4076
+ disabled: disabledProp = false
4077
+ } = _ref;
4078
+ const {
4079
+ active,
4080
+ dragOverlay,
4081
+ droppableRects,
4082
+ over,
4083
+ measureDroppableContainers
4084
+ } = useDndContext();
4085
+ const containerId = useUniqueId(ID_PREFIX, id);
4086
+ const useDragOverlay = Boolean(dragOverlay.rect !== null);
4087
+ const items = useMemo(() => userDefinedItems.map(item => typeof item === 'object' && 'id' in item ? item.id : item), [userDefinedItems]);
4088
+ const isDragging = active != null;
4089
+ const activeIndex = active ? items.indexOf(active.id) : -1;
4090
+ const overIndex = over ? items.indexOf(over.id) : -1;
4091
+ const previousItemsRef = useRef(items);
4092
+ const itemsHaveChanged = !itemsEqual(items, previousItemsRef.current);
4093
+ const disableTransforms = overIndex !== -1 && activeIndex === -1 || itemsHaveChanged;
4094
+ const disabled = normalizeDisabled(disabledProp);
4095
+ useIsomorphicLayoutEffect(() => {
4096
+ if (itemsHaveChanged && isDragging) {
4097
+ measureDroppableContainers(items);
4098
+ }
4099
+ }, [itemsHaveChanged, items, isDragging, measureDroppableContainers]);
4100
+ useEffect(() => {
4101
+ previousItemsRef.current = items;
4102
+ }, [items]);
4103
+ const contextValue = useMemo(() => ({
4104
+ activeIndex,
4105
+ containerId,
4106
+ disabled,
4107
+ disableTransforms,
4108
+ items,
4109
+ overIndex,
4110
+ useDragOverlay,
4111
+ sortedRects: getSortedRects(items, droppableRects),
4112
+ strategy
4113
+ }), // eslint-disable-next-line react-hooks/exhaustive-deps
4114
+ [activeIndex, containerId, disabled.draggable, disabled.droppable, disableTransforms, items, overIndex, droppableRects, useDragOverlay, strategy]);
4115
+ return React__default.createElement(Context.Provider, {
4116
+ value: contextValue
4117
+ }, children);
4118
+ }
4119
+
4120
+ const defaultNewIndexGetter = _ref => {
4121
+ let {
4122
+ id,
4123
+ items,
4124
+ activeIndex,
4125
+ overIndex
4126
+ } = _ref;
4127
+ return arrayMove(items, activeIndex, overIndex).indexOf(id);
4128
+ };
4129
+ const defaultAnimateLayoutChanges = _ref2 => {
4130
+ let {
4131
+ containerId,
4132
+ isSorting,
4133
+ wasDragging,
4134
+ index,
4135
+ items,
4136
+ newIndex,
4137
+ previousItems,
4138
+ previousContainerId,
4139
+ transition
4140
+ } = _ref2;
4141
+
4142
+ if (!transition || !wasDragging) {
4143
+ return false;
4144
+ }
4145
+
4146
+ if (previousItems !== items && index === newIndex) {
4147
+ return false;
4148
+ }
4149
+
4150
+ if (isSorting) {
4151
+ return true;
4152
+ }
4153
+
4154
+ return newIndex !== index && containerId === previousContainerId;
4155
+ };
4156
+ const defaultTransition = {
4157
+ duration: 200,
4158
+ easing: 'ease'
4159
+ };
4160
+ const transitionProperty = 'transform';
4161
+ const disabledTransition = /*#__PURE__*/CSS.Transition.toString({
4162
+ property: transitionProperty,
4163
+ duration: 0,
4164
+ easing: 'linear'
4165
+ });
4166
+ const defaultAttributes = {
4167
+ roleDescription: 'sortable'
4168
+ };
4169
+
4170
+ /*
4171
+ * When the index of an item changes while sorting,
4172
+ * we need to temporarily disable the transforms
4173
+ */
4174
+
4175
+ function useDerivedTransform(_ref) {
4176
+ let {
4177
+ disabled,
4178
+ index,
4179
+ node,
4180
+ rect
4181
+ } = _ref;
4182
+ const [derivedTransform, setDerivedtransform] = useState(null);
4183
+ const previousIndex = useRef(index);
4184
+ useIsomorphicLayoutEffect(() => {
4185
+ if (!disabled && index !== previousIndex.current && node.current) {
4186
+ const initial = rect.current;
4187
+
4188
+ if (initial) {
4189
+ const current = getClientRect(node.current, {
4190
+ ignoreTransform: true
4191
+ });
4192
+ const delta = {
4193
+ x: initial.left - current.left,
4194
+ y: initial.top - current.top,
4195
+ scaleX: initial.width / current.width,
4196
+ scaleY: initial.height / current.height
4197
+ };
4198
+
4199
+ if (delta.x || delta.y) {
4200
+ setDerivedtransform(delta);
4201
+ }
4202
+ }
4203
+ }
4204
+
4205
+ if (index !== previousIndex.current) {
4206
+ previousIndex.current = index;
4207
+ }
4208
+ }, [disabled, index, node, rect]);
4209
+ useEffect(() => {
4210
+ if (derivedTransform) {
4211
+ setDerivedtransform(null);
4212
+ }
4213
+ }, [derivedTransform]);
4214
+ return derivedTransform;
4215
+ }
4216
+
4217
+ function useSortable(_ref) {
4218
+ let {
4219
+ animateLayoutChanges = defaultAnimateLayoutChanges,
4220
+ attributes: userDefinedAttributes,
4221
+ disabled: localDisabled,
4222
+ data: customData,
4223
+ getNewIndex = defaultNewIndexGetter,
4224
+ id,
4225
+ strategy: localStrategy,
4226
+ resizeObserverConfig,
4227
+ transition = defaultTransition
4228
+ } = _ref;
4229
+ const {
4230
+ items,
4231
+ containerId,
4232
+ activeIndex,
4233
+ disabled: globalDisabled,
4234
+ disableTransforms,
4235
+ sortedRects,
4236
+ overIndex,
4237
+ useDragOverlay,
4238
+ strategy: globalStrategy
4239
+ } = useContext(Context);
4240
+ const disabled = normalizeLocalDisabled(localDisabled, globalDisabled);
4241
+ const index = items.indexOf(id);
4242
+ const data = useMemo(() => ({
4243
+ sortable: {
4244
+ containerId,
4245
+ index,
4246
+ items
4247
+ },
4248
+ ...customData
4249
+ }), [containerId, customData, index, items]);
4250
+ const itemsAfterCurrentSortable = useMemo(() => items.slice(items.indexOf(id)), [items, id]);
4251
+ const {
4252
+ rect,
4253
+ node,
4254
+ isOver,
4255
+ setNodeRef: setDroppableNodeRef
4256
+ } = useDroppable({
4257
+ id,
4258
+ data,
4259
+ disabled: disabled.droppable,
4260
+ resizeObserverConfig: {
4261
+ updateMeasurementsFor: itemsAfterCurrentSortable,
4262
+ ...resizeObserverConfig
4263
+ }
4264
+ });
4265
+ const {
4266
+ active,
4267
+ activatorEvent,
4268
+ activeNodeRect,
4269
+ attributes,
4270
+ setNodeRef: setDraggableNodeRef,
4271
+ listeners,
4272
+ isDragging,
4273
+ over,
4274
+ setActivatorNodeRef,
4275
+ transform
4276
+ } = useDraggable({
4277
+ id,
4278
+ data,
4279
+ attributes: { ...defaultAttributes,
4280
+ ...userDefinedAttributes
4281
+ },
4282
+ disabled: disabled.draggable
4283
+ });
4284
+ const setNodeRef = useCombinedRefs(setDroppableNodeRef, setDraggableNodeRef);
4285
+ const isSorting = Boolean(active);
4286
+ const displaceItem = isSorting && !disableTransforms && isValidIndex(activeIndex) && isValidIndex(overIndex);
4287
+ const shouldDisplaceDragSource = !useDragOverlay && isDragging;
4288
+ const dragSourceDisplacement = shouldDisplaceDragSource && displaceItem ? transform : null;
4289
+ const strategy = localStrategy != null ? localStrategy : globalStrategy;
4290
+ const finalTransform = displaceItem ? dragSourceDisplacement != null ? dragSourceDisplacement : strategy({
4291
+ rects: sortedRects,
4292
+ activeNodeRect,
4293
+ activeIndex,
4294
+ overIndex,
4295
+ index
4296
+ }) : null;
4297
+ const newIndex = isValidIndex(activeIndex) && isValidIndex(overIndex) ? getNewIndex({
4298
+ id,
4299
+ items,
4300
+ activeIndex,
4301
+ overIndex
4302
+ }) : index;
4303
+ const activeId = active == null ? void 0 : active.id;
4304
+ const previous = useRef({
4305
+ activeId,
4306
+ items,
4307
+ newIndex,
4308
+ containerId
4309
+ });
4310
+ const itemsHaveChanged = items !== previous.current.items;
4311
+ const shouldAnimateLayoutChanges = animateLayoutChanges({
4312
+ active,
4313
+ containerId,
4314
+ isDragging,
4315
+ isSorting,
4316
+ id,
4317
+ index,
4318
+ items,
4319
+ newIndex: previous.current.newIndex,
4320
+ previousItems: previous.current.items,
4321
+ previousContainerId: previous.current.containerId,
4322
+ transition,
4323
+ wasDragging: previous.current.activeId != null
4324
+ });
4325
+ const derivedTransform = useDerivedTransform({
4326
+ disabled: !shouldAnimateLayoutChanges,
4327
+ index,
4328
+ node,
4329
+ rect
4330
+ });
4331
+ useEffect(() => {
4332
+ if (isSorting && previous.current.newIndex !== newIndex) {
4333
+ previous.current.newIndex = newIndex;
4334
+ }
4335
+
4336
+ if (containerId !== previous.current.containerId) {
4337
+ previous.current.containerId = containerId;
4338
+ }
4339
+
4340
+ if (items !== previous.current.items) {
4341
+ previous.current.items = items;
4342
+ }
4343
+ }, [isSorting, newIndex, containerId, items]);
4344
+ useEffect(() => {
4345
+ if (activeId === previous.current.activeId) {
4346
+ return;
4347
+ }
4348
+
4349
+ if (activeId != null && previous.current.activeId == null) {
4350
+ previous.current.activeId = activeId;
4351
+ return;
4352
+ }
4353
+
4354
+ const timeoutId = setTimeout(() => {
4355
+ previous.current.activeId = activeId;
4356
+ }, 50);
4357
+ return () => clearTimeout(timeoutId);
4358
+ }, [activeId]);
4359
+ return {
4360
+ active,
4361
+ activeIndex,
4362
+ attributes,
4363
+ data,
4364
+ rect,
4365
+ index,
4366
+ newIndex,
4367
+ items,
4368
+ isOver,
4369
+ isSorting,
4370
+ isDragging,
4371
+ listeners,
4372
+ node,
4373
+ overIndex,
4374
+ over,
4375
+ setNodeRef,
4376
+ setActivatorNodeRef,
4377
+ setDroppableNodeRef,
4378
+ setDraggableNodeRef,
4379
+ transform: derivedTransform != null ? derivedTransform : finalTransform,
4380
+ transition: getTransition()
4381
+ };
4382
+
4383
+ function getTransition() {
4384
+ if ( // Temporarily disable transitions for a single frame to set up derived transforms
4385
+ derivedTransform || // Or to prevent items jumping to back to their "new" position when items change
4386
+ itemsHaveChanged && previous.current.newIndex === index) {
4387
+ return disabledTransition;
4388
+ }
4389
+
4390
+ if (shouldDisplaceDragSource && !isKeyboardEvent(activatorEvent) || !transition) {
4391
+ return undefined;
4392
+ }
4393
+
4394
+ if (isSorting || shouldAnimateLayoutChanges) {
4395
+ return CSS.Transition.toString({ ...transition,
4396
+ property: transitionProperty
4397
+ });
4398
+ }
4399
+
4400
+ return undefined;
4401
+ }
4402
+ }
4403
+
4404
+ function normalizeLocalDisabled(localDisabled, globalDisabled) {
4405
+ var _localDisabled$dragga, _localDisabled$droppa;
4406
+
4407
+ if (typeof localDisabled === 'boolean') {
4408
+ return {
4409
+ draggable: localDisabled,
4410
+ // Backwards compatibility
4411
+ droppable: false
4412
+ };
4413
+ }
4414
+
4415
+ return {
4416
+ draggable: (_localDisabled$dragga = localDisabled == null ? void 0 : localDisabled.draggable) != null ? _localDisabled$dragga : globalDisabled.draggable,
4417
+ droppable: (_localDisabled$droppa = localDisabled == null ? void 0 : localDisabled.droppable) != null ? _localDisabled$droppa : globalDisabled.droppable
4418
+ };
4419
+ }
4420
+
4421
+ [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left];
4422
+
4423
+ const SortableItemContext = createContext(null);
4424
+ function useSortableItemContext() {
4425
+ const context = useContext(SortableItemContext);
4426
+ if (!context) {
4427
+ throw new Error("SortableDragHandle must be used within a SortableItem");
4428
+ }
4429
+ return context;
4430
+ }
4431
+ const STRATEGY_MAP = {
4432
+ vertical: verticalListSortingStrategy,
4433
+ horizontal: horizontalListSortingStrategy,
4434
+ grid: rectSortingStrategy
4435
+ };
4436
+ function SortableList({
4437
+ items,
4438
+ onReorder,
4439
+ strategy = "vertical",
4440
+ activationDistance = 5,
4441
+ children,
4442
+ className
4443
+ }) {
4444
+ const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: activationDistance } }));
4445
+ const itemIds = useMemo(() => items.map((item) => item.id), [items]);
4446
+ const resolvedStrategy = STRATEGY_MAP[strategy];
4447
+ function handleDragOver(event) {
4448
+ const { active, over } = event;
4449
+ if (!over || active.id === over.id) return;
4450
+ const oldIndex = items.findIndex((item) => item.id === active.id);
4451
+ const newIndex = items.findIndex((item) => item.id === over.id);
4452
+ if (oldIndex === -1 || newIndex === -1) return;
4453
+ onReorder(arrayMove(items, oldIndex, newIndex));
4454
+ }
4455
+ return /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragOver: handleDragOver, children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy: resolvedStrategy, children: /* @__PURE__ */ jsx("div", { className, children }) }) });
4456
+ }
4457
+ SortableList.displayName = "SortableList";
4458
+ const SortableItem = React.forwardRef(({ id, children, className }, ref) => {
4459
+ const { attributes, listeners, setNodeRef, setActivatorNodeRef, transform, transition, isDragging } = useSortable({
4460
+ id
4461
+ });
4462
+ const style = {
4463
+ transform: CSS.Transform.toString(transform),
4464
+ transition
4465
+ };
4466
+ const contextValue = useMemo(
4467
+ () => ({ attributes, listeners, setActivatorNodeRef }),
4468
+ [attributes, listeners, setActivatorNodeRef]
4469
+ );
4470
+ const mergedRef = useCallback(
4471
+ (node) => {
4472
+ setNodeRef(node);
4473
+ if (typeof ref === "function") ref(node);
4474
+ else if (ref) ref.current = node;
4475
+ },
4476
+ [setNodeRef, ref]
4477
+ );
4478
+ const renderProps = {
4479
+ isDragging,
4480
+ dragHandleProps: { attributes, listeners, ref: setActivatorNodeRef }
4481
+ };
4482
+ const isRenderProp = typeof children === "function";
4483
+ return /* @__PURE__ */ jsx(SortableItemContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx("div", { ref: mergedRef, style, className: cn(!isRenderProp && isDragging && "opacity-50", className), children: isRenderProp ? children(renderProps) : children }) });
4484
+ });
4485
+ SortableItem.displayName = "SortableItem";
4486
+ const SortableDragHandle = React.forwardRef(
4487
+ ({ children, className, ...props }, ref) => {
4488
+ const { attributes, listeners, setActivatorNodeRef } = useSortableItemContext();
4489
+ const mergedRef = useCallback(
4490
+ (node) => {
4491
+ setActivatorNodeRef(node);
4492
+ if (typeof ref === "function") ref(node);
4493
+ else if (ref) ref.current = node;
4494
+ },
4495
+ [setActivatorNodeRef, ref]
4496
+ );
4497
+ return /* @__PURE__ */ jsx(
4498
+ "button",
4499
+ {
4500
+ type: "button",
4501
+ ref: mergedRef,
4502
+ className: cn(
4503
+ "cursor-grab active:cursor-grabbing text-muted-foreground hover:text-foreground transition-colors shrink-0",
4504
+ className
4505
+ ),
4506
+ ...attributes,
4507
+ ...listeners,
4508
+ ...props,
4509
+ children: children ?? /* @__PURE__ */ jsx(GripVertical, { className: "h-3.5 w-3.5" })
4510
+ }
4511
+ );
4512
+ }
4513
+ );
4514
+ SortableDragHandle.displayName = "SortableDragHandle";
4515
+
4516
+ export { SortableDragHandle as S, SortableItem as a, SortableList as b };
4517
+ //# sourceMappingURL=Sortable.js.map