@navikt/ds-react 8.7.0 → 8.8.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 (330) hide show
  1. package/cjs/alert/base-alert/root/BaseAlertRoot.js +1 -2
  2. package/cjs/alert/base-alert/root/BaseAlertRoot.js.map +1 -1
  3. package/cjs/alert/info-card/index.d.ts +2 -2
  4. package/cjs/alert/info-card/index.js +2 -1
  5. package/cjs/alert/info-card/index.js.map +1 -1
  6. package/cjs/alert/info-card/message/InfoCardMessage.d.ts +23 -0
  7. package/cjs/alert/info-card/message/InfoCardMessage.js +73 -0
  8. package/cjs/alert/info-card/message/InfoCardMessage.js.map +1 -0
  9. package/cjs/alert/info-card/root/InfoCardRoot.d.ts +15 -2
  10. package/cjs/alert/info-card/root/InfoCardRoot.js +4 -1
  11. package/cjs/alert/info-card/root/InfoCardRoot.js.map +1 -1
  12. package/cjs/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.d.ts +21 -0
  13. package/cjs/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.js +24 -0
  14. package/cjs/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.js.map +1 -0
  15. package/cjs/data/drag-and-drop/item/DataDragAndDropItem.js +7 -57
  16. package/cjs/data/drag-and-drop/item/DataDragAndDropItem.js.map +1 -1
  17. package/cjs/data/drag-and-drop/root/DataDragAndDrop.context.d.ts +4 -1
  18. package/cjs/data/drag-and-drop/root/DataDragAndDrop.context.js +7 -3
  19. package/cjs/data/drag-and-drop/root/DataDragAndDrop.context.js.map +1 -1
  20. package/cjs/data/drag-and-drop/root/DataDragAndDropRoot.d.ts +12 -2
  21. package/cjs/data/drag-and-drop/root/DataDragAndDropRoot.js +14 -64
  22. package/cjs/data/drag-and-drop/root/DataDragAndDropRoot.js.map +1 -1
  23. package/cjs/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.d.ts +22 -0
  24. package/cjs/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.js +35 -0
  25. package/cjs/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.js.map +1 -0
  26. package/cjs/data/drag-and-drop-old/item/DataDragAndDropItem.d.ts +27 -0
  27. package/cjs/data/drag-and-drop-old/item/DataDragAndDropItem.js +86 -0
  28. package/cjs/data/drag-and-drop-old/item/DataDragAndDropItem.js.map +1 -0
  29. package/cjs/data/drag-and-drop-old/root/DataDragAndDrop.context.d.ts +5 -0
  30. package/cjs/data/drag-and-drop-old/root/DataDragAndDrop.context.js +6 -0
  31. package/cjs/data/drag-and-drop-old/root/DataDragAndDrop.context.js.map +1 -0
  32. package/cjs/data/drag-and-drop-old/root/DataDragAndDropRoot.d.ts +24 -0
  33. package/cjs/data/drag-and-drop-old/root/DataDragAndDropRoot.js +108 -0
  34. package/cjs/data/drag-and-drop-old/root/DataDragAndDropRoot.js.map +1 -0
  35. package/cjs/data/table/empty-state/DataTableEmptyState.d.ts +5 -0
  36. package/cjs/data/table/empty-state/DataTableEmptyState.js +57 -0
  37. package/cjs/data/table/empty-state/DataTableEmptyState.js.map +1 -0
  38. package/cjs/data/table/helpers/table-focus.js +7 -1
  39. package/cjs/data/table/helpers/table-focus.js.map +1 -1
  40. package/cjs/data/table/helpers/table-keyboard.d.ts +0 -1
  41. package/cjs/data/table/helpers/table-keyboard.js +2 -4
  42. package/cjs/data/table/helpers/table-keyboard.js.map +1 -1
  43. package/cjs/data/table/loading-state/DataTableLoadingState.d.ts +5 -0
  44. package/cjs/data/table/loading-state/DataTableLoadingState.js +57 -0
  45. package/cjs/data/table/loading-state/DataTableLoadingState.js.map +1 -0
  46. package/cjs/data/table/root/DataTable.types.d.ts +13 -0
  47. package/cjs/data/table/root/DataTable.types.js +3 -0
  48. package/cjs/data/table/root/DataTable.types.js.map +1 -0
  49. package/cjs/data/table/root/DataTableAuto.d.ts +60 -0
  50. package/cjs/data/table/root/DataTableAuto.js +99 -0
  51. package/cjs/data/table/root/DataTableAuto.js.map +1 -0
  52. package/cjs/data/table/root/DataTableRoot.context.d.ts +3 -2
  53. package/cjs/data/table/root/DataTableRoot.context.js.map +1 -1
  54. package/cjs/data/table/root/DataTableRoot.d.ts +30 -3
  55. package/cjs/data/table/root/DataTableRoot.js +8 -2
  56. package/cjs/data/table/root/DataTableRoot.js.map +1 -1
  57. package/cjs/data/table/root/useTableKeyboardNav.js +1 -0
  58. package/cjs/data/table/root/useTableKeyboardNav.js.map +1 -1
  59. package/cjs/data/table/root/useTableSelection.d.ts +55 -0
  60. package/cjs/data/table/root/useTableSelection.js +79 -0
  61. package/cjs/data/table/root/useTableSelection.js.map +1 -0
  62. package/cjs/data/table/td/DataTableTd.d.ts +10 -0
  63. package/cjs/data/table/td/DataTableTd.js +4 -2
  64. package/cjs/data/table/td/DataTableTd.js.map +1 -1
  65. package/cjs/data/table/th/DataTableTh.d.ts +10 -4
  66. package/cjs/data/table/th/DataTableTh.js +24 -22
  67. package/cjs/data/table/th/DataTableTh.js.map +1 -1
  68. package/cjs/data/table/th/useTableColumnResize.d.ts +64 -0
  69. package/cjs/data/table/th/useTableColumnResize.js +144 -0
  70. package/cjs/data/table/th/useTableColumnResize.js.map +1 -0
  71. package/cjs/data/table/thead/DataTableThead.context.d.ts +4 -0
  72. package/cjs/data/table/thead/DataTableThead.context.js +45 -0
  73. package/cjs/data/table/thead/DataTableThead.context.js.map +1 -0
  74. package/cjs/data/table/thead/DataTableThead.js +3 -1
  75. package/cjs/data/table/thead/DataTableThead.js.map +1 -1
  76. package/cjs/data/table/tr/DataTableTr.js +4 -3
  77. package/cjs/data/table/tr/DataTableTr.js.map +1 -1
  78. package/cjs/data/token-filter/AutoSuggest.js +4 -6
  79. package/cjs/data/token-filter/AutoSuggest.js.map +1 -1
  80. package/cjs/date/Date.Input.js +1 -1
  81. package/cjs/date/Date.Input.js.map +1 -1
  82. package/cjs/date/datepicker/hooks/useDatepicker.d.ts +12 -1
  83. package/cjs/date/datepicker/hooks/useDatepicker.js.map +1 -1
  84. package/cjs/date/monthpicker/hooks/useMonthPicker.d.ts +11 -1
  85. package/cjs/date/monthpicker/hooks/useMonthPicker.js.map +1 -1
  86. package/cjs/form/checkbox/CheckboxGroup.js +1 -1
  87. package/cjs/form/checkbox/CheckboxGroup.js.map +1 -1
  88. package/cjs/form/fieldset/Fieldset.d.ts +25 -5
  89. package/cjs/form/fieldset/Fieldset.js +19 -2
  90. package/cjs/form/fieldset/Fieldset.js.map +1 -1
  91. package/cjs/form/radio/RadioGroup.js +1 -1
  92. package/cjs/form/radio/RadioGroup.js.map +1 -1
  93. package/cjs/index.d.ts +1 -1
  94. package/cjs/index.js.map +1 -1
  95. package/cjs/read-more/ReadMore.d.ts +10 -0
  96. package/cjs/read-more/ReadMore.js +4 -6
  97. package/cjs/read-more/ReadMore.js.map +1 -1
  98. package/cjs/types/index.d.ts +1 -1
  99. package/cjs/types/index.js +0 -15
  100. package/cjs/types/index.js.map +1 -1
  101. package/cjs/utils/components/Listbox/input-slot/ListboxInputSlot.js +1 -1
  102. package/cjs/utils/components/Listbox/input-slot/ListboxInputSlot.js.map +1 -1
  103. package/cjs/utils/components/Listbox/option/ListboxOption.d.ts +24 -0
  104. package/cjs/utils/components/Listbox/{item/ListboxItem.js → option/ListboxOption.js} +8 -8
  105. package/cjs/utils/components/Listbox/option/ListboxOption.js.map +1 -0
  106. package/cjs/utils/components/Listbox/options/ListboxOptions.d.ts +8 -0
  107. package/cjs/utils/components/Listbox/{list/ListboxList.js → options/ListboxOptions.js} +8 -8
  108. package/cjs/utils/components/Listbox/options/ListboxOptions.js.map +1 -0
  109. package/cjs/utils/components/Listbox/root/ListboxRoot.d.ts +6 -6
  110. package/cjs/utils/components/Listbox/root/ListboxRoot.js +28 -28
  111. package/cjs/utils/components/Listbox/root/ListboxRoot.js.map +1 -1
  112. package/cjs/utils/components/Listbox/root/domHelpers.d.ts +3 -3
  113. package/cjs/utils/components/Listbox/root/domHelpers.js +8 -8
  114. package/cjs/utils/components/Listbox/root/domHelpers.js.map +1 -1
  115. package/cjs/utils/components/floating/Floating.d.ts +1 -1
  116. package/cjs/utils/components/floating/Floating.js +1 -1
  117. package/cjs/utils/components/floating/Floating.js.map +1 -1
  118. package/cjs/utils/components/focus-boundary/FocusBoundary.d.ts +0 -1
  119. package/cjs/utils/components/focus-boundary/FocusBoundary.js +1 -1
  120. package/cjs/utils/components/focus-boundary/FocusBoundary.js.map +1 -1
  121. package/cjs/utils/components/link-anchor/LinkAnchor.js +10 -0
  122. package/cjs/utils/components/link-anchor/LinkAnchor.js.map +1 -1
  123. package/cjs/utils/helpers/className.js +1 -1
  124. package/cjs/utils/helpers/className.js.map +1 -1
  125. package/cjs/utils/helpers/focus.d.ts +3 -1
  126. package/cjs/utils/helpers/focus.js +2 -2
  127. package/cjs/utils/helpers/focus.js.map +1 -1
  128. package/cjs/utils/helpers/index.d.ts +9 -9
  129. package/cjs/utils/helpers/index.js +22 -23
  130. package/cjs/utils/helpers/index.js.map +1 -1
  131. package/cjs/utils/hooks/index.d.ts +13 -13
  132. package/cjs/utils/hooks/index.js +31 -28
  133. package/cjs/utils/hooks/index.js.map +1 -1
  134. package/cjs/utils/hooks/useScrollLock.js +41 -11
  135. package/cjs/utils/hooks/useScrollLock.js.map +1 -1
  136. package/esm/alert/base-alert/root/BaseAlertRoot.js +1 -2
  137. package/esm/alert/base-alert/root/BaseAlertRoot.js.map +1 -1
  138. package/esm/alert/info-card/index.d.ts +2 -2
  139. package/esm/alert/info-card/index.js +1 -1
  140. package/esm/alert/info-card/index.js.map +1 -1
  141. package/esm/alert/info-card/message/InfoCardMessage.d.ts +23 -0
  142. package/esm/alert/info-card/message/InfoCardMessage.js +37 -0
  143. package/esm/alert/info-card/message/InfoCardMessage.js.map +1 -0
  144. package/esm/alert/info-card/root/InfoCardRoot.d.ts +15 -2
  145. package/esm/alert/info-card/root/InfoCardRoot.js +3 -1
  146. package/esm/alert/info-card/root/InfoCardRoot.js.map +1 -1
  147. package/esm/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.d.ts +21 -0
  148. package/esm/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.js +18 -0
  149. package/esm/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.js.map +1 -0
  150. package/esm/data/drag-and-drop/item/DataDragAndDropItem.js +4 -24
  151. package/esm/data/drag-and-drop/item/DataDragAndDropItem.js.map +1 -1
  152. package/esm/data/drag-and-drop/root/DataDragAndDrop.context.d.ts +4 -1
  153. package/esm/data/drag-and-drop/root/DataDragAndDrop.context.js +5 -2
  154. package/esm/data/drag-and-drop/root/DataDragAndDrop.context.js.map +1 -1
  155. package/esm/data/drag-and-drop/root/DataDragAndDropRoot.d.ts +12 -2
  156. package/esm/data/drag-and-drop/root/DataDragAndDropRoot.js +15 -65
  157. package/esm/data/drag-and-drop/root/DataDragAndDropRoot.js.map +1 -1
  158. package/esm/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.d.ts +22 -0
  159. package/esm/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.js +29 -0
  160. package/esm/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.js.map +1 -0
  161. package/esm/data/drag-and-drop-old/item/DataDragAndDropItem.d.ts +27 -0
  162. package/esm/data/drag-and-drop-old/item/DataDragAndDropItem.js +50 -0
  163. package/esm/data/drag-and-drop-old/item/DataDragAndDropItem.js.map +1 -0
  164. package/esm/data/drag-and-drop-old/root/DataDragAndDrop.context.d.ts +5 -0
  165. package/esm/data/drag-and-drop-old/root/DataDragAndDrop.context.js +3 -0
  166. package/esm/data/drag-and-drop-old/root/DataDragAndDrop.context.js.map +1 -0
  167. package/esm/data/drag-and-drop-old/root/DataDragAndDropRoot.d.ts +24 -0
  168. package/esm/data/drag-and-drop-old/root/DataDragAndDropRoot.js +68 -0
  169. package/esm/data/drag-and-drop-old/root/DataDragAndDropRoot.js.map +1 -0
  170. package/esm/data/table/empty-state/DataTableEmptyState.d.ts +5 -0
  171. package/esm/data/table/empty-state/DataTableEmptyState.js +21 -0
  172. package/esm/data/table/empty-state/DataTableEmptyState.js.map +1 -0
  173. package/esm/data/table/helpers/table-focus.js +7 -1
  174. package/esm/data/table/helpers/table-focus.js.map +1 -1
  175. package/esm/data/table/helpers/table-keyboard.d.ts +0 -1
  176. package/esm/data/table/helpers/table-keyboard.js +2 -4
  177. package/esm/data/table/helpers/table-keyboard.js.map +1 -1
  178. package/esm/data/table/loading-state/DataTableLoadingState.d.ts +5 -0
  179. package/esm/data/table/loading-state/DataTableLoadingState.js +21 -0
  180. package/esm/data/table/loading-state/DataTableLoadingState.js.map +1 -0
  181. package/esm/data/table/root/DataTable.types.d.ts +13 -0
  182. package/esm/data/table/root/DataTable.types.js +2 -0
  183. package/esm/data/table/root/DataTable.types.js.map +1 -0
  184. package/esm/data/table/root/DataTableAuto.d.ts +60 -0
  185. package/esm/data/table/root/DataTableAuto.js +63 -0
  186. package/esm/data/table/root/DataTableAuto.js.map +1 -0
  187. package/esm/data/table/root/DataTableRoot.context.d.ts +3 -2
  188. package/esm/data/table/root/DataTableRoot.context.js.map +1 -1
  189. package/esm/data/table/root/DataTableRoot.d.ts +30 -3
  190. package/esm/data/table/root/DataTableRoot.js +6 -2
  191. package/esm/data/table/root/DataTableRoot.js.map +1 -1
  192. package/esm/data/table/root/useTableKeyboardNav.js +1 -0
  193. package/esm/data/table/root/useTableKeyboardNav.js.map +1 -1
  194. package/esm/data/table/root/useTableSelection.d.ts +55 -0
  195. package/esm/data/table/root/useTableSelection.js +77 -0
  196. package/esm/data/table/root/useTableSelection.js.map +1 -0
  197. package/esm/data/table/td/DataTableTd.d.ts +10 -0
  198. package/esm/data/table/td/DataTableTd.js +4 -2
  199. package/esm/data/table/td/DataTableTd.js.map +1 -1
  200. package/esm/data/table/th/DataTableTh.d.ts +10 -4
  201. package/esm/data/table/th/DataTableTh.js +25 -23
  202. package/esm/data/table/th/DataTableTh.js.map +1 -1
  203. package/esm/data/table/th/useTableColumnResize.d.ts +64 -0
  204. package/esm/data/table/th/useTableColumnResize.js +142 -0
  205. package/esm/data/table/th/useTableColumnResize.js.map +1 -0
  206. package/esm/data/table/thead/DataTableThead.context.d.ts +4 -0
  207. package/esm/data/table/thead/DataTableThead.context.js +8 -0
  208. package/esm/data/table/thead/DataTableThead.context.js.map +1 -0
  209. package/esm/data/table/thead/DataTableThead.js +3 -1
  210. package/esm/data/table/thead/DataTableThead.js.map +1 -1
  211. package/esm/data/table/tr/DataTableTr.js +4 -3
  212. package/esm/data/table/tr/DataTableTr.js.map +1 -1
  213. package/esm/data/token-filter/AutoSuggest.js +4 -6
  214. package/esm/data/token-filter/AutoSuggest.js.map +1 -1
  215. package/esm/date/Date.Input.js +1 -1
  216. package/esm/date/Date.Input.js.map +1 -1
  217. package/esm/date/datepicker/hooks/useDatepicker.d.ts +12 -1
  218. package/esm/date/datepicker/hooks/useDatepicker.js.map +1 -1
  219. package/esm/date/monthpicker/hooks/useMonthPicker.d.ts +11 -1
  220. package/esm/date/monthpicker/hooks/useMonthPicker.js.map +1 -1
  221. package/esm/form/checkbox/CheckboxGroup.js +1 -1
  222. package/esm/form/checkbox/CheckboxGroup.js.map +1 -1
  223. package/esm/form/fieldset/Fieldset.d.ts +25 -5
  224. package/esm/form/fieldset/Fieldset.js +19 -2
  225. package/esm/form/fieldset/Fieldset.js.map +1 -1
  226. package/esm/form/radio/RadioGroup.js +1 -1
  227. package/esm/form/radio/RadioGroup.js.map +1 -1
  228. package/esm/index.d.ts +1 -1
  229. package/esm/index.js.map +1 -1
  230. package/esm/read-more/ReadMore.d.ts +10 -0
  231. package/esm/read-more/ReadMore.js +4 -6
  232. package/esm/read-more/ReadMore.js.map +1 -1
  233. package/esm/types/index.d.ts +1 -1
  234. package/esm/types/index.js +1 -1
  235. package/esm/types/index.js.map +1 -1
  236. package/esm/utils/components/Listbox/input-slot/ListboxInputSlot.js +1 -1
  237. package/esm/utils/components/Listbox/input-slot/ListboxInputSlot.js.map +1 -1
  238. package/esm/utils/components/Listbox/option/ListboxOption.d.ts +24 -0
  239. package/esm/utils/components/Listbox/{item/ListboxItem.js → option/ListboxOption.js} +7 -7
  240. package/esm/utils/components/Listbox/option/ListboxOption.js.map +1 -0
  241. package/esm/utils/components/Listbox/options/ListboxOptions.d.ts +8 -0
  242. package/esm/utils/components/Listbox/{list/ListboxList.js → options/ListboxOptions.js} +8 -8
  243. package/esm/utils/components/Listbox/options/ListboxOptions.js.map +1 -0
  244. package/esm/utils/components/Listbox/root/ListboxRoot.d.ts +6 -6
  245. package/esm/utils/components/Listbox/root/ListboxRoot.js +29 -29
  246. package/esm/utils/components/Listbox/root/ListboxRoot.js.map +1 -1
  247. package/esm/utils/components/Listbox/root/domHelpers.d.ts +3 -3
  248. package/esm/utils/components/Listbox/root/domHelpers.js +7 -7
  249. package/esm/utils/components/Listbox/root/domHelpers.js.map +1 -1
  250. package/esm/utils/components/floating/Floating.d.ts +1 -1
  251. package/esm/utils/components/floating/Floating.js +1 -1
  252. package/esm/utils/components/floating/Floating.js.map +1 -1
  253. package/esm/utils/components/focus-boundary/FocusBoundary.d.ts +0 -1
  254. package/esm/utils/components/focus-boundary/FocusBoundary.js +1 -1
  255. package/esm/utils/components/focus-boundary/FocusBoundary.js.map +1 -1
  256. package/esm/utils/components/link-anchor/LinkAnchor.js +10 -0
  257. package/esm/utils/components/link-anchor/LinkAnchor.js.map +1 -1
  258. package/esm/utils/helpers/className.js +1 -1
  259. package/esm/utils/helpers/className.js.map +1 -1
  260. package/esm/utils/helpers/focus.d.ts +3 -1
  261. package/esm/utils/helpers/focus.js +2 -2
  262. package/esm/utils/helpers/focus.js.map +1 -1
  263. package/esm/utils/helpers/index.d.ts +9 -9
  264. package/esm/utils/helpers/index.js +9 -9
  265. package/esm/utils/helpers/index.js.map +1 -1
  266. package/esm/utils/hooks/index.d.ts +13 -13
  267. package/esm/utils/hooks/index.js +13 -13
  268. package/esm/utils/hooks/index.js.map +1 -1
  269. package/esm/utils/hooks/useScrollLock.js +41 -11
  270. package/esm/utils/hooks/useScrollLock.js.map +1 -1
  271. package/package.json +5 -5
  272. package/src/alert/base-alert/root/BaseAlertRoot.tsx +1 -1
  273. package/src/alert/info-card/index.ts +2 -0
  274. package/src/alert/info-card/message/InfoCardMessage.tsx +48 -0
  275. package/src/alert/info-card/root/InfoCardRoot.tsx +20 -1
  276. package/src/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.tsx +63 -0
  277. package/src/data/drag-and-drop/item/DataDragAndDropItem.tsx +6 -53
  278. package/src/data/drag-and-drop/root/DataDragAndDrop.context.tsx +9 -4
  279. package/src/data/drag-and-drop/root/DataDragAndDropRoot.tsx +19 -63
  280. package/src/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.tsx +104 -0
  281. package/src/data/drag-and-drop-old/item/DataDragAndDropItem.tsx +74 -0
  282. package/src/data/drag-and-drop-old/root/DataDragAndDrop.context.tsx +11 -0
  283. package/src/data/drag-and-drop-old/root/DataDragAndDropRoot.tsx +96 -0
  284. package/src/data/table/empty-state/DataTableEmptyState.tsx +26 -0
  285. package/src/data/table/helpers/table-focus.ts +10 -1
  286. package/src/data/table/helpers/table-keyboard.ts +2 -6
  287. package/src/data/table/loading-state/DataTableLoadingState.tsx +26 -0
  288. package/src/data/table/root/DataTable.types.ts +16 -0
  289. package/src/data/table/root/DataTableAuto.tsx +182 -0
  290. package/src/data/table/root/DataTableRoot.context.ts +3 -2
  291. package/src/data/table/root/DataTableRoot.tsx +45 -2
  292. package/src/data/table/root/useTableKeyboardNav.ts +1 -0
  293. package/src/data/table/root/useTableSelection.ts +126 -0
  294. package/src/data/table/td/DataTableTd.tsx +14 -1
  295. package/src/data/table/th/DataTableTh.tsx +48 -36
  296. package/src/data/table/th/useTableColumnResize.ts +276 -0
  297. package/src/data/table/thead/DataTableThead.context.ts +10 -0
  298. package/src/data/table/thead/DataTableThead.tsx +8 -5
  299. package/src/data/table/tr/DataTableTr.tsx +8 -3
  300. package/src/data/token-filter/AutoSuggest.tsx +11 -12
  301. package/src/date/Date.Input.tsx +1 -1
  302. package/src/date/datepicker/hooks/useDatepicker.tsx +12 -1
  303. package/src/date/monthpicker/hooks/useMonthPicker.tsx +11 -1
  304. package/src/form/checkbox/CheckboxGroup.tsx +1 -1
  305. package/src/form/fieldset/Fieldset.tsx +31 -7
  306. package/src/form/radio/RadioGroup.tsx +1 -1
  307. package/src/index.ts +1 -0
  308. package/src/read-more/ReadMore.tsx +15 -16
  309. package/src/types/index.ts +1 -1
  310. package/src/utils/components/Listbox/input-slot/ListboxInputSlot.tsx +1 -1
  311. package/src/utils/components/Listbox/{item/ListboxItem.tsx → option/ListboxOption.tsx} +14 -14
  312. package/src/utils/components/Listbox/{list/ListboxList.tsx → options/ListboxOptions.tsx} +10 -10
  313. package/src/utils/components/Listbox/root/ListboxRoot.tsx +31 -31
  314. package/src/utils/components/Listbox/root/domHelpers.ts +8 -7
  315. package/src/utils/components/floating/Floating.tsx +2 -2
  316. package/src/utils/components/focus-boundary/FocusBoundary.tsx +1 -2
  317. package/src/utils/components/link-anchor/LinkAnchor.tsx +11 -0
  318. package/src/utils/helpers/className.ts +1 -1
  319. package/src/utils/helpers/focus.ts +5 -2
  320. package/src/utils/helpers/index.ts +9 -9
  321. package/src/utils/hooks/index.ts +20 -13
  322. package/src/utils/hooks/useScrollLock.ts +57 -13
  323. package/cjs/utils/components/Listbox/item/ListboxItem.d.ts +0 -24
  324. package/cjs/utils/components/Listbox/item/ListboxItem.js.map +0 -1
  325. package/cjs/utils/components/Listbox/list/ListboxList.d.ts +0 -8
  326. package/cjs/utils/components/Listbox/list/ListboxList.js.map +0 -1
  327. package/esm/utils/components/Listbox/item/ListboxItem.d.ts +0 -24
  328. package/esm/utils/components/Listbox/item/ListboxItem.js.map +0 -1
  329. package/esm/utils/components/Listbox/list/ListboxList.d.ts +0 -8
  330. package/esm/utils/components/Listbox/list/ListboxList.js.map +0 -1
@@ -13,6 +13,7 @@ import React, { forwardRef } from "react";
13
13
  import { BaseAlert } from "../../base-alert/index.js";
14
14
  import { InfoCardContent, } from "../content/InfoCardContent.js";
15
15
  import { InfoCardHeader, } from "../header/InfoCardHeader.js";
16
+ import { InfoCardMessage, } from "../message/InfoCardMessage.js";
16
17
  import { InfoCardTitle } from "../title/InfoCardTitle.js";
17
18
  /**
18
19
  * A component for displaying informational content in a card format.
@@ -35,6 +36,7 @@ export const InfoCard = forwardRef((_a, forwardedRef) => {
35
36
  InfoCard.Header = InfoCardHeader;
36
37
  InfoCard.Title = InfoCardTitle;
37
38
  InfoCard.Content = InfoCardContent;
39
+ InfoCard.Message = InfoCardMessage;
38
40
  export default InfoCard;
39
- export { InfoCardContent, InfoCardHeader, InfoCardTitle };
41
+ export { InfoCardContent, InfoCardHeader, InfoCardTitle, InfoCardMessage };
40
42
  //# sourceMappingURL=InfoCardRoot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InfoCardRoot.js","sourceRoot":"","sources":["../../../../src/alert/info-card/root/InfoCardRoot.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EACL,eAAe,GAEhB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,cAAc,GAEf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAA2B,MAAM,wBAAwB,CAAC;AAgEhF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAChC,CACE,EAIgB,EAChB,YAAY,EACZ,EAAE;QANF,EACE,YAAY,EAAE,SAAS,GAAG,MAAM,EAChC,EAAE,GAAG,KAAK,OAEI,EADX,SAAS,cAHd,oBAIC,CADa;IAId,OAAO,CACL,oBAAC,SAAS,CAAC,IAAI,kBACb,GAAG,EAAE,YAAY,gBACL,SAAS,IACjB,SAAS,IACb,IAAI,EAAC,UAAU,EACf,MAAM,EAAE,KAAK,EACb,EAAE,EAAE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ACnC,QAAQ,CAAC,OAAO,GAAG,eAAe,CAAC;AAEnC,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ export interface DataDragAndDropDragHandlerProps {
3
+ /**
4
+ * Whether the drag handler is disabled
5
+ */
6
+ /**
7
+ * Wether dragging is done by keyboard. Used to conditionally render drag indicators.
8
+ */
9
+ keyboardDragging?: boolean;
10
+ /**
11
+ * Handle ref is forwarded to the button element serving as drag handle.
12
+ */
13
+ handleRef: React.Ref<HTMLDivElement>;
14
+ }
15
+ /**
16
+ * DataDragAndDropDragHandler
17
+ *
18
+ * A button component that serves as a drag handle for drag and drop operations.
19
+ * Can be used to initiate dragging of elements in a data table or list.
20
+ */
21
+ export declare const DataDragAndDropDragHandler: React.ForwardRefExoticComponent<DataDragAndDropDragHandlerProps & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { CaretDownCircleFillIcon, CaretUpCircleFillIcon, DragVerticalIcon, } from "@navikt/aksel-icons";
3
+ /**
4
+ * DataDragAndDropDragHandler
5
+ *
6
+ * A button component that serves as a drag handle for drag and drop operations.
7
+ * Can be used to initiate dragging of elements in a data table or list.
8
+ */
9
+ export const DataDragAndDropDragHandler = React.forwardRef(({ keyboardDragging, handleRef }) => {
10
+ return (React.createElement("div", { className: "aksel-data-drag-and-drop__drag-handler__alt" },
11
+ keyboardDragging && (React.createElement("span", { className: "aksel-data-drag-and-drop__drag-handler__arrow", "data-direction": "up" },
12
+ React.createElement(CaretUpCircleFillIcon, { "aria-hidden": true, fontSize: "1.2rem" }))),
13
+ React.createElement("div", { ref: handleRef, className: "aksel-data-drag-and-drop__drag-handler__button" },
14
+ React.createElement(DragVerticalIcon, { "aria-hidden": true, title: "Dra for \u00E5 flytte", fontSize: "1.5rem" })),
15
+ keyboardDragging && (React.createElement("span", { className: "aksel-data-drag-and-drop__drag-handler__arrow", "data-direction": "down" },
16
+ React.createElement(CaretDownCircleFillIcon, { "aria-hidden": true, fontSize: "1.2rem" })))));
17
+ });
18
+ //# sourceMappingURL=DataDragAndDropDragHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataDragAndDropDragHandler.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop/drag-handler/DataDragAndDropDragHandler.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAiB7B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAC,UAAU,CAGxD,CAAC,EAAE,gBAAgB,EAAE,SAAS,EAAE,EAAE,EAAE;IACpC,OAAO,CACL,6BAAK,SAAS,EAAC,6CAA6C;QACzD,gBAAgB,IAAI,CACnB,8BACE,SAAS,EAAC,+CAA+C,oBAC1C,IAAI;YAEnB,oBAAC,qBAAqB,yBAAa,QAAQ,EAAC,QAAQ,GAAG,CAClD,CACR;QACD,6BACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAC,gDAAgD;YAE1D,oBAAC,gBAAgB,yBAEf,KAAK,EAAC,uBAAkB,EACxB,QAAQ,EAAC,QAAQ,GACjB,CACE;QACL,gBAAgB,IAAI,CACnB,8BACE,SAAS,EAAC,+CAA+C,oBAC1C,MAAM;YAErB,oBAAC,uBAAuB,yBAAa,QAAQ,EAAC,QAAQ,GAAG,CACpD,CACR,CACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -9,13 +9,9 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { useSortable } from "@dnd-kit/react/sortable";
13
- import React, { useRef } from "react";
14
- import { CaretDownCircleFillIcon, CaretUpCircleFillIcon, DragVerticalIcon, } from "@navikt/aksel-icons";
12
+ import React from "react";
15
13
  import { HStack } from "../../../primitives/stack/index.js";
16
14
  import { cl } from "../../../utils/helpers/index.js";
17
- import { useMergeRefs } from "../../../utils/hooks/index.js";
18
- import { DataDragAndDropContext } from "../root/DataDragAndDrop.context.js";
19
15
  /**
20
16
  * TODO
21
17
  *
@@ -28,26 +24,10 @@ import { DataDragAndDropContext } from "../root/DataDragAndDrop.context.js";
28
24
  * ```
29
25
  */
30
26
  const DataDragAndDropItem = React.forwardRef((_a, forwardedRef) => {
31
- var { children, id, index, className } = _a, rest = __rest(_a, ["children", "id", "index", "className"]);
32
- const handleRef = useRef(null);
33
- const { ref, isDragging, isDropTarget } = useSortable({
34
- id,
35
- index,
36
- handle: handleRef,
37
- });
38
- const mergedRef = useMergeRefs(ref, forwardedRef);
39
- const context = React.useContext(DataDragAndDropContext);
40
- const mouseDragging = isDragging && (context === null || context === void 0 ? void 0 : context.inputMethod) === "mouse";
41
- const mouseDropTarget = isDropTarget && (context === null || context === void 0 ? void 0 : context.inputMethod) === "mouse";
42
- const keyboardDragging = isDragging && (context === null || context === void 0 ? void 0 : context.inputMethod) === "keyboard";
27
+ // const context = useDataDragAndDropContext();
28
+ var { children, className } = _a, rest = __rest(_a, ["children", "className"]);
43
29
  return (React.createElement(HStack, { gap: "space-8", align: "center", wrap: false, asChild: true },
44
- React.createElement("div", Object.assign({ ref: mergedRef }, rest, { className: cl("aksel-data-table__drag-and-drop-item", className), "data-dragging": isDragging, "data-mouse-dragging": mouseDragging, "data-keyboard-dragging": keyboardDragging, "data-drop-target": mouseDropTarget, tabIndex: -1 }),
45
- React.createElement("div", { className: "aksel-data-table__drag-and-drop-item-drag-handler", ref: handleRef },
46
- keyboardDragging && (React.createElement("span", { className: "aksel-data-table__drag-and-drop-item-keyboard-drag-icon", "data-direction": "up" },
47
- React.createElement(CaretUpCircleFillIcon, { "aria-hidden": true, fontSize: "1.2rem" }))),
48
- React.createElement(DragVerticalIcon, { "aria-hidden": true, title: "Dra for \u00E5 flytte", fontSize: "1.5rem" }),
49
- keyboardDragging && (React.createElement("span", { className: "aksel-data-table__drag-and-drop-item-keyboard-drag-icon", "data-direction": "down" },
50
- React.createElement(CaretDownCircleFillIcon, { "aria-hidden": true, fontSize: "1.2rem" })))),
30
+ React.createElement("div", Object.assign({ ref: forwardedRef }, rest, { className: cl("aksel-data-table__drag-and-drop-item", className) }),
51
31
  React.createElement("div", null, children))));
52
32
  });
53
33
  export default DataDragAndDropItem;
@@ -1 +1 @@
1
- {"version":3,"file":"DataDragAndDropItem.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop/item/DataDragAndDropItem.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAczE;;;;;;;;;;GAUG;AACH,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAG1C,CAAC,EAA2C,EAAE,YAAY,EAAE,EAAE;QAA7D,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,OAAW,EAAN,IAAI,cAAzC,wCAA2C,CAAF;IAC1C,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC/C,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,WAAW,CAAC;QACpD,EAAE;QACF,KAAK;QACL,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,YAAY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ACnC,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
1
+ {"version":3,"file":"DataDragAndDropItem.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop/item/DataDragAndDropItem.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAc5C;;;;;;;;;;GAUG;AACH,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAG1C,CAAC,EAAgC,EAAE,YAAY,EAAE,EAAE;IACnD,+CAA+C;QAD9C,EAAE,QAAQ,EAAE,SAAS,OAAW,EAAN,IAAI,cAA9B,yBAAgC,CAAF;IAG/B,OAAO,CACL,oBAAC,MAAM,IAAC,GAAG,EAAC,SAAS,EAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAE,KAAK,EAAE,OAAO;QAEvD,2CACE,GAAG,EAAE,YAAY,IACb,IAAI,IACR,SAAS,EAAE,EAAE,CAAC,sCAAsC,EAAE,SAAS,CAAC;YAMhE,iCAAM,QAAQ,CAAO,CACjB,CACC,CACV,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
@@ -1,5 +1,8 @@
1
1
  interface DataDragAndDropContextType {
2
2
  inputMethod: "mouse" | "keyboard" | null;
3
3
  }
4
- export declare const DataDragAndDropContext: import("react").Context<DataDragAndDropContextType | undefined>;
4
+ export declare const DataDragAndDropProvider: import("react").FC<DataDragAndDropContextType & {
5
+ children: React.ReactNode;
6
+ ref?: never;
7
+ }>, useDataDragAndDropContext: <S extends boolean = true>(strict?: S | undefined) => S extends true ? DataDragAndDropContextType | undefined : DataDragAndDropContextType | undefined;
5
8
  export {};
@@ -1,3 +1,6 @@
1
- import { createContext } from "react";
2
- export const DataDragAndDropContext = createContext(undefined);
1
+ import { createStrictContext } from "../../../utils/helpers/index.js";
2
+ export const { Provider: DataDragAndDropProvider, useContext: useDataDragAndDropContext, } = createStrictContext({
3
+ errorMessage: "useDataDragAndDropContext must be used within a DataDragAndDropProvider",
4
+ name: "DataDragAndDropContext",
5
+ });
3
6
  //# sourceMappingURL=DataDragAndDrop.context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataDragAndDrop.context.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop/root/DataDragAndDrop.context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAMtC,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAEjD,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"DataDragAndDrop.context.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop/root/DataDragAndDrop.context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAM7D,MAAM,CAAC,MAAM,EACX,QAAQ,EAAE,uBAAuB,EACjC,UAAU,EAAE,yBAAyB,GACtC,GAAG,mBAAmB,CAAyC;IAC9D,YAAY,EACV,yEAAyE;IAC3E,IAAI,EAAE,wBAAwB;CAC/B,CAAC,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import React from "react";
2
2
  import DataDragAndDropItem, { DataDragAndDropItemProps } from "../item/DataDragAndDropItem.js";
3
- interface DataDragAndDropProps extends React.HTMLAttributes<HTMLTableElement> {
3
+ interface DataDragAndDropProps extends React.HTMLAttributes<HTMLDivElement> {
4
4
  children: any[];
5
5
  setItems: React.Dispatch<React.SetStateAction<any[]>>;
6
6
  }
7
- interface DataDragAndDropRootComponent extends React.ForwardRefExoticComponent<DataDragAndDropProps & React.RefAttributes<HTMLTableElement>> {
7
+ interface DataDragAndDropRootComponent extends React.ForwardRefExoticComponent<DataDragAndDropProps & React.RefAttributes<HTMLDivElement>> {
8
8
  /**
9
9
  * @see 🏷️ {@link DataDragAndDropItemProps}
10
10
  * * @example
@@ -18,6 +18,16 @@ interface DataDragAndDropRootComponent extends React.ForwardRefExoticComponent<D
18
18
  */
19
19
  Item: typeof DataDragAndDropItem;
20
20
  }
21
+ /**
22
+ * TODO
23
+ * setItems on root
24
+ * state : active element
25
+ * pointer over listener / state, onPointerEnter, onPointerLeave
26
+ * Overlay - Use floating component
27
+ * Keyboard navigation
28
+ * Handle - button, arrows also button
29
+ * UU - announce on drag start, item moved, drag end
30
+ */
21
31
  declare const DataDragAndDrop: DataDragAndDropRootComponent;
22
32
  export { DataDragAndDrop, DataDragAndDropItem };
23
33
  export default DataDragAndDrop;
@@ -1,69 +1,19 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { DragDropProvider, DragOverlay } from "@dnd-kit/react";
13
- import { isSortable } from "@dnd-kit/react/sortable";
14
- import React, { forwardRef, isValidElement } from "react";
15
- import { VStack } from "../../../primitives/stack/index.js";
1
+ import React, { forwardRef } from "react";
16
2
  import DataDragAndDropItem from "../item/DataDragAndDropItem.js";
17
- import { DataDragAndDropContext } from "./DataDragAndDrop.context.js";
18
- const DataDragAndDrop = forwardRef((_a, forwardedRef) => {
19
- var { setItems, children } = _a, rest = __rest(_a, ["setItems", "children"]);
20
- const [inputMethod, setInputMethod] = React.useState(null);
21
- const setItemOrder = (initalIndex, targetIndex) => {
22
- setItems((items) => {
23
- const newItems = [...items];
24
- const [movedItem] = newItems.splice(initalIndex, 1);
25
- newItems.splice(targetIndex, 0, movedItem);
26
- return newItems;
27
- });
28
- };
29
- return (React.createElement(DataDragAndDropContext.Provider, { value: { inputMethod } },
30
- React.createElement(DragDropProvider
31
- // TODO Look into overriding default keybinds, might eliminate context need
32
- , {
33
- // TODO Look into overriding default keybinds, might eliminate context need
34
- onBeforeDragStart: (event) => {
35
- var _a;
36
- return setInputMethod(((_a = event.operation.activatorEvent) === null || _a === void 0 ? void 0 : _a.type) === "pointerdown"
37
- ? "mouse"
38
- : "keyboard");
39
- }, onDragOver: (event) => {
40
- var _a;
41
- if (((_a = event.operation.activatorEvent) === null || _a === void 0 ? void 0 : _a.type) === "pointerdown") {
42
- // Prevents items to rearrange while dragging with mouse, but allows keyboard dragging to work as intended
43
- event.preventDefault();
44
- }
45
- }, onDragEnd: (event) => {
46
- var _a;
47
- if (((_a = event.operation.activatorEvent) === null || _a === void 0 ? void 0 : _a.type) === "pointerdown") {
48
- const { source, target } = event.operation;
49
- if (!isSortable(source) || !isSortable(target))
50
- return;
51
- setItemOrder(source.initialIndex, target.index);
52
- }
53
- } },
54
- React.createElement(VStack, { asChild: true, gap: "space-12" },
55
- React.createElement("div", Object.assign({}, rest, { ref: forwardedRef }), children)),
56
- React.createElement(DragOverlay, null, (source) => {
57
- // Overlay not needed and causes glitching when using keyboard
58
- if (inputMethod === "keyboard")
59
- return null;
60
- if (!isSortable(source))
61
- return null;
62
- if (isValidElement(children[source.initialIndex])) {
63
- return children[source.initialIndex];
64
- }
65
- return null;
66
- }))));
3
+ import { DataDragAndDropProvider } from "./DataDragAndDrop.context.js";
4
+ /**
5
+ * TODO
6
+ * setItems on root
7
+ * state : active element
8
+ * pointer over listener / state, onPointerEnter, onPointerLeave
9
+ * Overlay - Use floating component
10
+ * Keyboard navigation
11
+ * Handle - button, arrows also button
12
+ * UU - announce on drag start, item moved, drag end
13
+ */
14
+ const DataDragAndDrop = forwardRef(({ children }, forwardedRef) => {
15
+ return (React.createElement(DataDragAndDropProvider, { inputMethod: null },
16
+ React.createElement("div", { ref: forwardedRef }, children)));
67
17
  });
68
18
  DataDragAndDrop.Item = DataDragAndDropItem;
69
19
  export { DataDragAndDrop, DataDragAndDropItem };
@@ -1 +1 @@
1
- {"version":3,"file":"DataDragAndDropRoot.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop/root/DataDragAndDropRoot.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,mBAEN,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAwBnE,MAAM,eAAe,GAAG,UAAU,CAChC,CAAC,EAA+B,EAAE,YAAY,EAAE,EAAE;QAAjD,EAAE,QAAQ,EAAE,QAAQ,OAAW,EAAN,IAAI,cAA7B,wBAA+B,CAAF;IAC5B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAElD,IAAI,CAAC,CAAC;IAER,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAE,WAAmB,EAAE,EAAE;QAChE,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE;YACjB,MAAM,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;YAC5B,MAAM,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;YACpD,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;YAC3C,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,sBAAsB,CAAC,QAAQ,IAAC,KAAK,EAAE,E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AQ,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;oBAClD,OAAO,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;gBACvC,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CACW,CACG,CACa,CACnC,CAAC;AACJ,CAAC,CAC8B,CAAC;AAElC,eAAe,CAAC,IAAI,GAAG,mBAAmB,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,CAAC;AAChD,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"DataDragAndDropRoot.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop/root/DataDragAndDropRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,mBAEN,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAwBpE;;;;;;;;;GASG;AAEH,MAAM,eAAe,GAAG,UAAU,CAChC,CAAC,EAAE,QAAQ,EAAE,EAAE,YAAY,EAAE,EAAE;IAC7B,OAAO,CACL,oBAAC,uBAAuB,IAAC,WAAW,EAAE,IAAI;QACxC,6BAAK,GAAG,EAAE,YAAY,IAAG,QAAQ,CAAO,CAChB,CAC3B,CAAC;AACJ,CAAC,CAC8B,CAAC;AAElC,eAAe,CAAC,IAAI,GAAG,mBAAmB,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,CAAC;AAChD,eAAe,eAAe,CAAC"}
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ export interface DataDragAndDropDragHandlerProps {
3
+ /**
4
+ * Whether the drag handler is disabled
5
+ */
6
+ /**
7
+ * Wether dragging is done by keyboard. Used to conditionally render drag indicators.
8
+ */
9
+ keyboardDragging?: boolean;
10
+ /**
11
+ * Handle ref is forwarded to the button element serving as drag handle.
12
+ */
13
+ handleRef: React.Ref<HTMLDivElement>;
14
+ alt?: boolean;
15
+ }
16
+ /**
17
+ * DataDragAndDropDragHandler
18
+ *
19
+ * A button component that serves as a drag handle for drag and drop operations.
20
+ * Can be used to initiate dragging of elements in a data table or list.
21
+ */
22
+ export declare const DataDragAndDropDragHandler: React.ForwardRefExoticComponent<DataDragAndDropDragHandlerProps & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import { CaretDownCircleFillIcon, CaretUpCircleFillIcon, DragVerticalIcon, } from "@navikt/aksel-icons";
3
+ import { Floating } from "../../../utils/components/floating/Floating.js";
4
+ /**
5
+ * DataDragAndDropDragHandler
6
+ *
7
+ * A button component that serves as a drag handle for drag and drop operations.
8
+ * Can be used to initiate dragging of elements in a data table or list.
9
+ */
10
+ export const DataDragAndDropDragHandler = React.forwardRef(({ keyboardDragging, handleRef, alt }) => {
11
+ if (alt) {
12
+ return (React.createElement("div", { className: "aksel-data-drag-and-drop__drag-handler__alt" },
13
+ keyboardDragging && (React.createElement("span", { className: "aksel-data-drag-and-drop__drag-handler__arrow", "data-direction": "up" },
14
+ React.createElement(CaretUpCircleFillIcon, { "aria-hidden": true, fontSize: "1.2rem" }))),
15
+ React.createElement("div", { ref: handleRef, className: "aksel-data-drag-and-drop__drag-handler__button" },
16
+ React.createElement(DragVerticalIcon, { "aria-hidden": true, title: "Dra for \u00E5 flytte", fontSize: "1.5rem" })),
17
+ keyboardDragging && (React.createElement("span", { className: "aksel-data-drag-and-drop__drag-handler__arrow", "data-direction": "down" },
18
+ React.createElement(CaretDownCircleFillIcon, { "aria-hidden": true, fontSize: "1.2rem" })))));
19
+ }
20
+ return (React.createElement(Floating, null,
21
+ keyboardDragging && (React.createElement(Floating.Content, { side: "top", avoidCollisions: false, updatePositionStrategy: "always", className: "aksel-data-drag-and-drop__drag-handler__arrow" },
22
+ React.createElement(CaretUpCircleFillIcon, { "aria-hidden": true, fontSize: "1.2rem" }))),
23
+ React.createElement(Floating.Anchor, { asChild: true },
24
+ React.createElement("div", { ref: handleRef, className: "aksel-data-drag-and-drop__drag-handler__button" },
25
+ React.createElement(DragVerticalIcon, { "aria-hidden": true, title: "Dra for \u00E5 flytte", fontSize: "1.5rem" }))),
26
+ keyboardDragging && (React.createElement(Floating.Content, { avoidCollisions: false, updatePositionStrategy: "always", className: "aksel-data-drag-and-drop__drag-handler__arrow" },
27
+ React.createElement(CaretDownCircleFillIcon, { "aria-hidden": true, fontSize: "1.2rem" })))));
28
+ });
29
+ //# sourceMappingURL=DataDragAndDropDragHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataDragAndDropDragHandler.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop-old/drag-handler/DataDragAndDropDragHandler.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AAmBvE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAC,UAAU,CAGxD,CAAC,EAAE,gBAAgB,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE;IACzC,IAAI,GAAG,EAAE,CAAC;QACR,OAAO,CACL,6BAAK,SAAS,EAAC,6CAA6C;YACzD,gBAAgB,IAAI,CACnB,8BACE,SAAS,EAAC,+CAA+C,oBAC1C,IAAI;gBAEnB,oBAAC,qBAAqB,yBAAa,QAAQ,EAAC,QAAQ,GAAG,CAClD,CACR;YACD,6BACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAC,gDAAgD;gBAE1D,oBAAC,gBAAgB,yBAEf,KAAK,EAAC,uBAAkB,EACxB,QAAQ,EAAC,QAAQ,GACjB,CACE;YACL,gBAAgB,IAAI,CACnB,8BACE,SAAS,EAAC,+CAA+C,oBAC1C,MAAM;gBAErB,oBAAC,uBAAuB,yBAAa,QAAQ,EAAC,QAAQ,GAAG,CACpD,CACR,CACG,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,oBAAC,QAAQ;QACN,gBAAgB,IAAI,CACnB,oBAAC,QAAQ,CAAC,OAAO,IACf,IAAI,EAAC,KAAK,EACV,eAAe,EAAE,KAAK,EACtB,sBAAsB,EAAC,QAAQ,EAC/B,SAAS,EAAC,+CAA+C;YAEzD,oBAAC,qBAAqB,yBAAa,QAAQ,EAAC,QAAQ,GAAG,CACtC,CACpB;QACD,oBAAC,QAAQ,CAAC,MAAM,IAAC,OAAO;YACtB,6BACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAC,gDAAgD;gBAE1D,oBAAC,gBAAgB,yBAEf,KAAK,EAAC,uBAAkB,EACxB,QAAQ,EAAC,QAAQ,GACjB,CACE,CACU;QACjB,gBAAgB,IAAI,CACnB,oBAAC,QAAQ,CAAC,OAAO,IACf,eAAe,EAAE,KAAK,EACtB,sBAAsB,EAAC,QAAQ,EAC/B,SAAS,EAAC,+CAA+C;YAEzD,oBAAC,uBAAuB,yBAAa,QAAQ,EAAC,QAAQ,GAAG,CACxC,CACpB,CACQ,CACZ,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ interface DataDragAndDropItemProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ children: React.ReactNode;
4
+ /**
5
+ * Unique id
6
+ */
7
+ id: string;
8
+ /**
9
+ * Index of the item being dragged
10
+ */
11
+ index: number;
12
+ }
13
+ /**
14
+ * TODO
15
+ *
16
+ * @see 🏷️ {@link DataDragAndDropItemProps}
17
+ * @example
18
+ * ```tsx
19
+ * <DragAndDrop.Item numOfSelectedRows={selectedRows.length} onClear={handleClear}>
20
+ * TODO
21
+ * </DragAndDrop.Item>
22
+ * ```
23
+ */
24
+ declare const DataDragAndDropItem: React.ForwardRefExoticComponent<DataDragAndDropItemProps & React.RefAttributes<HTMLDivElement>>;
25
+ export default DataDragAndDropItem;
26
+ export { DataDragAndDropItem };
27
+ export type { DataDragAndDropItemProps };
@@ -0,0 +1,50 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { useSortable } from "@dnd-kit/react/sortable";
13
+ import React, { useRef } from "react";
14
+ import { HStack } from "../../../primitives/stack/index.js";
15
+ import { cl } from "../../../utils/helpers/index.js";
16
+ import { useMergeRefs } from "../../../utils/hooks/index.js";
17
+ import { DataDragAndDropDragHandler } from "../drag-handler/DataDragAndDropDragHandler.js";
18
+ import { DataDragAndDropContext } from "../root/DataDragAndDrop.context.js";
19
+ /**
20
+ * TODO
21
+ *
22
+ * @see 🏷️ {@link DataDragAndDropItemProps}
23
+ * @example
24
+ * ```tsx
25
+ * <DragAndDrop.Item numOfSelectedRows={selectedRows.length} onClear={handleClear}>
26
+ * TODO
27
+ * </DragAndDrop.Item>
28
+ * ```
29
+ */
30
+ const DataDragAndDropItem = React.forwardRef((_a, forwardedRef) => {
31
+ var { children, id, index, className } = _a, rest = __rest(_a, ["children", "id", "index", "className"]);
32
+ const handleRef = useRef(null);
33
+ const { ref, isDragging, isDropTarget } = useSortable({
34
+ id,
35
+ index,
36
+ handle: handleRef,
37
+ });
38
+ const mergedRef = useMergeRefs(ref, forwardedRef);
39
+ const context = React.useContext(DataDragAndDropContext);
40
+ const mouseDragging = isDragging && (context === null || context === void 0 ? void 0 : context.inputMethod) === "mouse";
41
+ const mouseDropTarget = isDropTarget && (context === null || context === void 0 ? void 0 : context.inputMethod) === "mouse";
42
+ const keyboardDragging = isDragging && (context === null || context === void 0 ? void 0 : context.inputMethod) === "keyboard";
43
+ return (React.createElement(HStack, { gap: "space-8", align: "center", wrap: false, asChild: true },
44
+ React.createElement("div", Object.assign({ ref: mergedRef }, rest, { className: cl("aksel-data-table__drag-and-drop-item", className), "data-dragging": isDragging, "data-mouse-dragging": mouseDragging, "data-keyboard-dragging": keyboardDragging, "data-drop-target": mouseDropTarget, tabIndex: -1 }),
45
+ React.createElement(DataDragAndDropDragHandler, { handleRef: handleRef, keyboardDragging: keyboardDragging, alt: true }),
46
+ React.createElement("div", null, children))));
47
+ });
48
+ export default DataDragAndDropItem;
49
+ export { DataDragAndDropItem };
50
+ //# sourceMappingURL=DataDragAndDropItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataDragAndDropItem.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop-old/item/DataDragAndDropItem.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAczE;;;;;;;;;;GAUG;AACH,MAAM,mBAAmB,GAAG,KAAK,CAAC,UAAU,CAG1C,CAAC,EAA2C,EAAE,YAAY,EAAE,EAAE;QAA7D,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,OAAW,EAAN,IAAI,cAAzC,wCAA2C,CAAF;IAC1C,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC/C,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,WAAW,CAAC;QACpD,EAAE;QACF,KAAK;QACL,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;IACzD,MAAM,aAAa,GAAG,UAAU,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,MAAK,OAAO,CAAC;IACrE,MAAM,eAAe,GAAG,YAAY,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,MAAK,OAAO,CAAC;IACzE,MAAM,gBAAgB,GAAG,UAAU,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,MAAK,UAAU,CAAC;IAE3E,OAAO,CACL,oBAAC,MAAM,IAAC,GAAG,EAAC,SAAS,EAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAE,KAAK,EAAE,OAAO;QAEvD,2CACE,GAAG,EAAE,SAAS,IACV,IAAI,IACR,SAAS,EAAE,EAAE,CAAC,sCAAsC,EAAE,SAAS,CAAC,mBACjD,UAAU,yBACJ,aAAa,4BACV,gBAAgB,sBACtB,eAAe,EACjC,QAAQ,EAAE,CAAC,CAAC;YAEZ,oBAAC,0BAA0B,IACzB,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,SACH;YACF,iCAAM,QAAQ,CAAO,CACjB,CACC,CACV,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ interface DataDragAndDropContextType {
2
+ inputMethod: "mouse" | "keyboard" | null;
3
+ }
4
+ export declare const DataDragAndDropContext: import("react").Context<DataDragAndDropContextType | undefined>;
5
+ export {};
@@ -0,0 +1,3 @@
1
+ import { createContext } from "react";
2
+ export const DataDragAndDropContext = createContext(undefined);
3
+ //# sourceMappingURL=DataDragAndDrop.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataDragAndDrop.context.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop-old/root/DataDragAndDrop.context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAQtC,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAEjD,SAAS,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import DataDragAndDropItem, { DataDragAndDropItemProps } from "../item/DataDragAndDropItem.js";
3
+ interface DataDragAndDropProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ children: any[];
5
+ setItems: React.Dispatch<React.SetStateAction<any[]>>;
6
+ }
7
+ interface DataDragAndDropRootComponent extends React.ForwardRefExoticComponent<DataDragAndDropProps & React.RefAttributes<HTMLDivElement>> {
8
+ /**
9
+ * @see 🏷️ {@link DataDragAndDropItemProps}
10
+ * * @example
11
+ * ```jsx
12
+ * <DragAndDrop>
13
+ * <DragAndDrop.Item id="1" index={0}>
14
+ * ...
15
+ * </DragAndDrop.Item>
16
+ * </DragAndDrop>
17
+ * ```
18
+ */
19
+ Item: typeof DataDragAndDropItem;
20
+ }
21
+ declare const DataDragAndDrop: DataDragAndDropRootComponent;
22
+ export { DataDragAndDrop, DataDragAndDropItem };
23
+ export default DataDragAndDrop;
24
+ export type { DataDragAndDropItemProps, DataDragAndDropProps };
@@ -0,0 +1,68 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { DragDropProvider, DragOverlay } from "@dnd-kit/react";
13
+ import { isSortable } from "@dnd-kit/react/sortable";
14
+ import React, { forwardRef, isValidElement } from "react";
15
+ import { VStack } from "../../../primitives/stack/index.js";
16
+ import DataDragAndDropItem from "../item/DataDragAndDropItem.js";
17
+ import { DataDragAndDropContext } from "./DataDragAndDrop.context.js";
18
+ const DataDragAndDrop = forwardRef((_a, forwardedRef) => {
19
+ var { setItems, children } = _a, rest = __rest(_a, ["setItems", "children"]);
20
+ const [inputMethod, setInputMethod] = React.useState(null);
21
+ const setItemOrder = (initalIndex, targetIndex) => {
22
+ setItems((items) => {
23
+ const newItems = [...items];
24
+ const [movedItem] = newItems.splice(initalIndex, 1);
25
+ newItems.splice(targetIndex, 0, movedItem);
26
+ return newItems;
27
+ });
28
+ };
29
+ return (React.createElement(DataDragAndDropContext.Provider, { value: { inputMethod } },
30
+ React.createElement(DragDropProvider
31
+ // TODO Look into overriding default keybinds, might eliminate context need
32
+ , {
33
+ // TODO Look into overriding default keybinds, might eliminate context need
34
+ onBeforeDragStart: (event) => {
35
+ var _a;
36
+ return setInputMethod(((_a = event.operation.activatorEvent) === null || _a === void 0 ? void 0 : _a.type) === "pointerdown"
37
+ ? "mouse"
38
+ : "keyboard");
39
+ }, onDragOver: (event) => {
40
+ var _a;
41
+ if (((_a = event.operation.activatorEvent) === null || _a === void 0 ? void 0 : _a.type) === "pointerdown") {
42
+ // Prevents items to rearrange while dragging with mouse, but allows keyboard dragging to work as intended
43
+ event.preventDefault();
44
+ }
45
+ }, onDragEnd: (event) => {
46
+ const { source, target } = event.operation;
47
+ if (!isSortable(source) || !isSortable(target))
48
+ return;
49
+ setItemOrder(source.initialIndex, target.index);
50
+ } },
51
+ React.createElement(VStack, { asChild: true, gap: "space-12" },
52
+ React.createElement("div", Object.assign({}, rest, { ref: forwardedRef }), children)),
53
+ React.createElement(DragOverlay, { dropAnimation: null }, (source) => {
54
+ // Overlay not needed and causes glitching when using keyboard
55
+ if (inputMethod === "keyboard")
56
+ return null;
57
+ if (!isSortable(source))
58
+ return null;
59
+ if (isValidElement(children[source.initialIndex])) {
60
+ return children[source.initialIndex];
61
+ }
62
+ return null;
63
+ }))));
64
+ });
65
+ DataDragAndDrop.Item = DataDragAndDropItem;
66
+ export { DataDragAndDrop, DataDragAndDropItem };
67
+ export default DataDragAndDrop;
68
+ //# sourceMappingURL=DataDragAndDropRoot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataDragAndDropRoot.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop-old/root/DataDragAndDropRoot.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,mBAEN,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAwBnE,MAAM,eAAe,GAAG,UAAU,CAChC,CAAC,EAA+B,EAAE,YAAY,EAAE,EAAE;QAAjD,EAAE,QAAQ,EAAE,QAAQ,OAAW,EAAN,IAAI,cAA7B,wBAA+B,CAAF;IAC5B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAElD,IAAI,CAAC,CAAC;IAER,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAE,WAAmB,EAAE,EAAE;QAChE,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE;YACjB,MAAM,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;YAC5B,MAAM,CA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,IAC7B,CAAC,MAAM,EAAE,EAAE;gBACV,8DAA8D;gBAC9D,IAAI,WAAW,KAAK,UAAU;oBAAE,OAAO,IAAI,CAAC;gBAC5C,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;oBAAE,OAAO,IAAI,CAAC;gBACrC,IAAI,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;oBAClD,OAAO,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;gBACvC,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CACW,CACG,CACa,CACnC,CAAC;AACJ,CAAC,CAC8B,CAAC;AAElC,eAAe,CAAC,IAAI,GAAG,mBAAmB,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,CAAC;AAChD,eAAe,eAAe,CAAC"}
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ type DataTableEmptyStateProps = React.HTMLAttributes<HTMLDivElement>;
3
+ declare const DataTableEmptyState: React.ForwardRefExoticComponent<DataTableEmptyStateProps & React.RefAttributes<HTMLDivElement>>;
4
+ export { DataTableEmptyState };
5
+ export type { DataTableEmptyStateProps };
@@ -0,0 +1,21 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import React, { forwardRef } from "react";
13
+ import { cl } from "../../../utils/helpers/index.js";
14
+ const DataTableEmptyState = forwardRef((_a, forwardedRef) => {
15
+ var { className, children } = _a, rest = __rest(_a, ["className", "children"]);
16
+ return (React.createElement("tr", null,
17
+ React.createElement("td", { colSpan: 999 },
18
+ React.createElement("div", Object.assign({}, rest, { ref: forwardedRef, className: cl("aksel-data-table__empty-state", className) }), children))));
19
+ });
20
+ export { DataTableEmptyState };
21
+ //# sourceMappingURL=DataTableEmptyState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataTableEmptyState.js","sourceRoot":"","sources":["../../../../src/data/table/empty-state/DataTableEmptyState.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAI5C,MAAM,mBAAmB,GAAG,UAAU,CAGpC,CAAC,EAAgC,EAAE,YAAY,EAAE,EAAE;QAAlD,EAAE,SAAS,EAAE,QAAQ,OAAW,EAAN,IAAI,cAA9B,yBAAgC,CAAF;IAC/B,OAAO,CACL;QACE,4BAAI,OAAO,EAAE,GAAG;YACd,6CACM,IAAI,IACR,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,KAExD,QAAQ,CACL,CACH,CACF,CACN,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
@@ -31,7 +31,9 @@ function restoreTabIndex(cell) {
31
31
  */
32
32
  function findFocusableElementInCell(cell) {
33
33
  const el = cell;
34
- if (!el || isHiddenElement(el)) {
34
+ if (!el ||
35
+ isHiddenElement(el) ||
36
+ el.hasAttribute("data-block-keyboard-nav")) {
35
37
  return null;
36
38
  }
37
39
  const focusables = el.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]');
@@ -40,6 +42,10 @@ function findFocusableElementInCell(cell) {
40
42
  }
41
43
  for (let i = 0; i < focusables.length; i += 1) {
42
44
  const focusable = focusables[i];
45
+ /* Ignore element if it has [data-block-keyboard-nav="true"] */
46
+ if (focusable.hasAttribute("data-block-keyboard-nav")) {
47
+ continue;
48
+ }
43
49
  if (!isHiddenElement(focusable) && !isDisabledElement(focusable)) {
44
50
  return focusable;
45
51
  }