@navikt/ds-react 8.10.5 → 8.10.6

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 (223) hide show
  1. package/cjs/data/data-grid/index.d.ts +2 -0
  2. package/cjs/data/data-grid/index.js +7 -0
  3. package/cjs/data/data-grid/index.js.map +1 -0
  4. package/cjs/data/data-grid/root/DataGridRoot.context.d.ts +11 -0
  5. package/cjs/data/data-grid/root/DataGridRoot.context.js +11 -0
  6. package/cjs/data/data-grid/root/DataGridRoot.context.js.map +1 -0
  7. package/cjs/data/data-grid/root/DataGridRoot.d.ts +38 -0
  8. package/cjs/data/data-grid/root/DataGridRoot.js +68 -0
  9. package/cjs/data/data-grid/root/DataGridRoot.js.map +1 -0
  10. package/cjs/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js +0 -1
  11. package/cjs/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js.map +1 -1
  12. package/cjs/data/drag-and-drop/root/DragAndDropRoot.d.ts +5 -5
  13. package/cjs/data/drag-and-drop/root/DragAndDropRoot.js +4 -27
  14. package/cjs/data/drag-and-drop/root/DragAndDropRoot.js.map +1 -1
  15. package/cjs/data/stories/Data.test-data.d.ts +2 -5
  16. package/cjs/data/stories/Data.test-data.js +30 -38
  17. package/cjs/data/stories/Data.test-data.js.map +1 -1
  18. package/cjs/data/table/base-cell/DataTableBaseCell.d.ts +15 -15
  19. package/cjs/data/table/base-cell/DataTableBaseCell.js +4 -8
  20. package/cjs/data/table/base-cell/DataTableBaseCell.js.map +1 -1
  21. package/cjs/data/table/column-header/DataTableColumnHeader.d.ts +24 -6
  22. package/cjs/data/table/column-header/DataTableColumnHeader.js +22 -27
  23. package/cjs/data/table/column-header/DataTableColumnHeader.js.map +1 -1
  24. package/cjs/data/table/column-header/useTableColumnResize.d.ts +19 -29
  25. package/cjs/data/table/column-header/useTableColumnResize.js +24 -22
  26. package/cjs/data/table/column-header/useTableColumnResize.js.map +1 -1
  27. package/cjs/data/table/details-panel-row/DataTableDetailsPanelRow.d.ts +1 -1
  28. package/cjs/data/table/details-panel-row/DataTableDetailsPanelRow.js +2 -2
  29. package/cjs/data/table/details-panel-row/DataTableDetailsPanelRow.js.map +1 -1
  30. package/cjs/data/table/helpers/collectTableRowEntries.d.ts +2 -2
  31. package/cjs/data/table/helpers/selection/getMultipleSelectProps.d.ts +13 -11
  32. package/cjs/data/table/helpers/selection/getMultipleSelectProps.js +43 -53
  33. package/cjs/data/table/helpers/selection/getMultipleSelectProps.js.map +1 -1
  34. package/cjs/data/table/helpers/selection/getSingleSelectProps.d.ts +9 -8
  35. package/cjs/data/table/helpers/selection/getSingleSelectProps.js +23 -10
  36. package/cjs/data/table/helpers/selection/getSingleSelectProps.js.map +1 -1
  37. package/cjs/data/table/helpers/selection/selection.types.d.ts +19 -19
  38. package/cjs/data/table/helpers/selection/selection.utils.d.ts +21 -0
  39. package/cjs/data/table/helpers/selection/selection.utils.js +46 -0
  40. package/cjs/data/table/helpers/selection/selection.utils.js.map +1 -0
  41. package/cjs/data/table/hooks/useColumnOptions.d.ts +16 -5
  42. package/cjs/data/table/hooks/useColumnOptions.js +26 -8
  43. package/cjs/data/table/hooks/useColumnOptions.js.map +1 -1
  44. package/cjs/data/table/hooks/useTableDetailsPanel.d.ts +10 -13
  45. package/cjs/data/table/hooks/useTableDetailsPanel.js +6 -5
  46. package/cjs/data/table/hooks/useTableDetailsPanel.js.map +1 -1
  47. package/cjs/data/table/hooks/useTableItems.d.ts +29 -15
  48. package/cjs/data/table/hooks/useTableItems.js +2 -12
  49. package/cjs/data/table/hooks/useTableItems.js.map +1 -1
  50. package/cjs/data/table/hooks/useTableKeyboardNav.d.ts +1 -6
  51. package/cjs/data/table/hooks/useTableKeyboardNav.js +1 -4
  52. package/cjs/data/table/hooks/useTableKeyboardNav.js.map +1 -1
  53. package/cjs/data/table/hooks/useTableSelection.d.ts +6 -6
  54. package/cjs/data/table/hooks/useTableSelection.js +13 -13
  55. package/cjs/data/table/hooks/useTableSelection.js.map +1 -1
  56. package/cjs/data/table/hooks/useTableSort.d.ts +2 -2
  57. package/cjs/data/table/hooks/useTableSort.js +4 -5
  58. package/cjs/data/table/hooks/useTableSort.js.map +1 -1
  59. package/cjs/data/table/root/DataTable.types.d.ts +22 -10
  60. package/cjs/data/table/root/DataTableRoot.context.d.ts +13 -7
  61. package/cjs/data/table/root/DataTableRoot.context.js.map +1 -1
  62. package/cjs/data/table/root/DataTableRoot.d.ts +49 -72
  63. package/cjs/data/table/root/DataTableRoot.js +54 -66
  64. package/cjs/data/table/root/DataTableRoot.js.map +1 -1
  65. package/cjs/data/table/root/DataTableRoot.legacy.d.ts +2 -7
  66. package/cjs/data/table/root/DataTableRoot.legacy.js +17 -3
  67. package/cjs/data/table/root/DataTableRoot.legacy.js.map +1 -1
  68. package/cjs/data/table/sub-row-toggle/DataTableSubRowToggle.js +4 -4
  69. package/cjs/data/table/sub-row-toggle/DataTableSubRowToggle.js.map +1 -1
  70. package/cjs/data/table/tbody/DataTableTbody.js +4 -2
  71. package/cjs/data/table/tbody/DataTableTbody.js.map +1 -1
  72. package/cjs/data/table/tr/DataTableTr.d.ts +5 -3
  73. package/cjs/data/table/tr/DataTableTr.js +36 -23
  74. package/cjs/data/table/tr/DataTableTr.js.map +1 -1
  75. package/cjs/table/ColumnHeader.js +2 -1
  76. package/cjs/table/ColumnHeader.js.map +1 -1
  77. package/esm/data/data-grid/index.d.ts +2 -0
  78. package/esm/data/data-grid/index.js +3 -0
  79. package/esm/data/data-grid/index.js.map +1 -0
  80. package/esm/data/data-grid/root/DataGridRoot.context.d.ts +11 -0
  81. package/esm/data/data-grid/root/DataGridRoot.context.js +7 -0
  82. package/esm/data/data-grid/root/DataGridRoot.context.js.map +1 -0
  83. package/esm/data/data-grid/root/DataGridRoot.d.ts +38 -0
  84. package/esm/data/data-grid/root/DataGridRoot.js +32 -0
  85. package/esm/data/data-grid/root/DataGridRoot.js.map +1 -0
  86. package/esm/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js +0 -1
  87. package/esm/data/drag-and-drop/drag-handler/DragAndDropDragHandler.js.map +1 -1
  88. package/esm/data/drag-and-drop/root/DragAndDropRoot.d.ts +5 -5
  89. package/esm/data/drag-and-drop/root/DragAndDropRoot.js +4 -27
  90. package/esm/data/drag-and-drop/root/DragAndDropRoot.js.map +1 -1
  91. package/esm/data/stories/Data.test-data.d.ts +2 -5
  92. package/esm/data/stories/Data.test-data.js +30 -38
  93. package/esm/data/stories/Data.test-data.js.map +1 -1
  94. package/esm/data/table/base-cell/DataTableBaseCell.d.ts +15 -15
  95. package/esm/data/table/base-cell/DataTableBaseCell.js +4 -8
  96. package/esm/data/table/base-cell/DataTableBaseCell.js.map +1 -1
  97. package/esm/data/table/column-header/DataTableColumnHeader.d.ts +24 -6
  98. package/esm/data/table/column-header/DataTableColumnHeader.js +23 -28
  99. package/esm/data/table/column-header/DataTableColumnHeader.js.map +1 -1
  100. package/esm/data/table/column-header/useTableColumnResize.d.ts +19 -29
  101. package/esm/data/table/column-header/useTableColumnResize.js +24 -22
  102. package/esm/data/table/column-header/useTableColumnResize.js.map +1 -1
  103. package/esm/data/table/details-panel-row/DataTableDetailsPanelRow.d.ts +1 -1
  104. package/esm/data/table/details-panel-row/DataTableDetailsPanelRow.js +2 -2
  105. package/esm/data/table/details-panel-row/DataTableDetailsPanelRow.js.map +1 -1
  106. package/esm/data/table/helpers/collectTableRowEntries.d.ts +2 -2
  107. package/esm/data/table/helpers/selection/getMultipleSelectProps.d.ts +13 -11
  108. package/esm/data/table/helpers/selection/getMultipleSelectProps.js +43 -53
  109. package/esm/data/table/helpers/selection/getMultipleSelectProps.js.map +1 -1
  110. package/esm/data/table/helpers/selection/getSingleSelectProps.d.ts +9 -8
  111. package/esm/data/table/helpers/selection/getSingleSelectProps.js +23 -10
  112. package/esm/data/table/helpers/selection/getSingleSelectProps.js.map +1 -1
  113. package/esm/data/table/helpers/selection/selection.types.d.ts +19 -19
  114. package/esm/data/table/helpers/selection/selection.utils.d.ts +21 -0
  115. package/esm/data/table/helpers/selection/selection.utils.js +43 -0
  116. package/esm/data/table/helpers/selection/selection.utils.js.map +1 -0
  117. package/esm/data/table/hooks/useColumnOptions.d.ts +16 -5
  118. package/esm/data/table/hooks/useColumnOptions.js +26 -8
  119. package/esm/data/table/hooks/useColumnOptions.js.map +1 -1
  120. package/esm/data/table/hooks/useTableDetailsPanel.d.ts +10 -13
  121. package/esm/data/table/hooks/useTableDetailsPanel.js +6 -5
  122. package/esm/data/table/hooks/useTableDetailsPanel.js.map +1 -1
  123. package/esm/data/table/hooks/useTableItems.d.ts +29 -15
  124. package/esm/data/table/hooks/useTableItems.js +3 -10
  125. package/esm/data/table/hooks/useTableItems.js.map +1 -1
  126. package/esm/data/table/hooks/useTableKeyboardNav.d.ts +1 -6
  127. package/esm/data/table/hooks/useTableKeyboardNav.js +1 -4
  128. package/esm/data/table/hooks/useTableKeyboardNav.js.map +1 -1
  129. package/esm/data/table/hooks/useTableSelection.d.ts +6 -6
  130. package/esm/data/table/hooks/useTableSelection.js +13 -13
  131. package/esm/data/table/hooks/useTableSelection.js.map +1 -1
  132. package/esm/data/table/hooks/useTableSort.d.ts +2 -2
  133. package/esm/data/table/hooks/useTableSort.js +4 -5
  134. package/esm/data/table/hooks/useTableSort.js.map +1 -1
  135. package/esm/data/table/root/DataTable.types.d.ts +22 -10
  136. package/esm/data/table/root/DataTableRoot.context.d.ts +13 -7
  137. package/esm/data/table/root/DataTableRoot.context.js.map +1 -1
  138. package/esm/data/table/root/DataTableRoot.d.ts +49 -72
  139. package/esm/data/table/root/DataTableRoot.js +56 -68
  140. package/esm/data/table/root/DataTableRoot.js.map +1 -1
  141. package/esm/data/table/root/DataTableRoot.legacy.d.ts +2 -7
  142. package/esm/data/table/root/DataTableRoot.legacy.js +17 -3
  143. package/esm/data/table/root/DataTableRoot.legacy.js.map +1 -1
  144. package/esm/data/table/sub-row-toggle/DataTableSubRowToggle.js +4 -4
  145. package/esm/data/table/sub-row-toggle/DataTableSubRowToggle.js.map +1 -1
  146. package/esm/data/table/tbody/DataTableTbody.js +4 -2
  147. package/esm/data/table/tbody/DataTableTbody.js.map +1 -1
  148. package/esm/data/table/tr/DataTableTr.d.ts +5 -3
  149. package/esm/data/table/tr/DataTableTr.js +35 -23
  150. package/esm/data/table/tr/DataTableTr.js.map +1 -1
  151. package/esm/table/ColumnHeader.js +2 -1
  152. package/esm/table/ColumnHeader.js.map +1 -1
  153. package/package.json +3 -3
  154. package/src/data/data-grid/index.ts +3 -0
  155. package/src/data/data-grid/root/DataGridRoot.context.ts +16 -0
  156. package/src/data/data-grid/root/DataGridRoot.tsx +71 -0
  157. package/src/data/drag-and-drop/drag-handler/DragAndDropDragHandler.tsx +0 -1
  158. package/src/data/drag-and-drop/root/DragAndDropRoot.tsx +15 -49
  159. package/src/data/stories/Data.test-data.tsx +52 -43
  160. package/src/data/table/agent-component-review.md +175 -0
  161. package/src/data/table/base-cell/DataTableBaseCell.tsx +31 -21
  162. package/src/data/table/column-header/DataTableColumnHeader.tsx +61 -58
  163. package/src/data/table/column-header/useTableColumnResize.ts +55 -71
  164. package/src/data/table/details-panel-row/DataTableDetailsPanelRow.tsx +3 -3
  165. package/src/data/table/helpers/collectTableRowEntries.ts +1 -2
  166. package/src/data/table/helpers/selection/getMultipleSelectProps.ts +65 -85
  167. package/src/data/table/helpers/selection/getSingleSelectProps.ts +35 -17
  168. package/src/data/table/helpers/selection/selection.types.ts +19 -19
  169. package/src/data/table/helpers/selection/selection.utils.test.ts +161 -0
  170. package/src/data/table/helpers/selection/selection.utils.ts +73 -0
  171. package/src/data/table/hooks/__tests__/useTableItems.test.ts +2 -1
  172. package/src/data/table/hooks/useColumnOptions.ts +48 -14
  173. package/src/data/table/hooks/useTableDetailsPanel.tsx +22 -25
  174. package/src/data/table/hooks/useTableItems.ts +32 -24
  175. package/src/data/table/hooks/useTableKeyboardNav.ts +1 -13
  176. package/src/data/table/hooks/useTableSelection.ts +26 -31
  177. package/src/data/table/hooks/useTableSort.ts +10 -9
  178. package/src/data/table/root/DataTable.types.ts +30 -22
  179. package/src/data/table/root/DataTableRoot.context.ts +19 -7
  180. package/src/data/table/root/DataTableRoot.legacy.tsx +22 -14
  181. package/src/data/table/root/DataTableRoot.tsx +244 -293
  182. package/src/data/table/sub-row-toggle/DataTableSubRowToggle.tsx +5 -4
  183. package/src/data/table/tbody/DataTableTbody.tsx +6 -2
  184. package/src/data/table/tr/DataTableTr.tsx +98 -35
  185. package/src/table/ColumnHeader.tsx +2 -1
  186. package/cjs/data/drag-and-drop-legacy/drag-handler/DragAndDropDragHandlerLegacy.d.ts +0 -22
  187. package/cjs/data/drag-and-drop-legacy/drag-handler/DragAndDropDragHandlerLegacy.js +0 -35
  188. package/cjs/data/drag-and-drop-legacy/drag-handler/DragAndDropDragHandlerLegacy.js.map +0 -1
  189. package/cjs/data/drag-and-drop-legacy/item/DragAndDropItemLegacy.d.ts +0 -27
  190. package/cjs/data/drag-and-drop-legacy/item/DragAndDropItemLegacy.js +0 -86
  191. package/cjs/data/drag-and-drop-legacy/item/DragAndDropItemLegacy.js.map +0 -1
  192. package/cjs/data/drag-and-drop-legacy/root/DragAndDropLegacy.context.d.ts +0 -5
  193. package/cjs/data/drag-and-drop-legacy/root/DragAndDropLegacy.context.js +0 -6
  194. package/cjs/data/drag-and-drop-legacy/root/DragAndDropLegacy.context.js.map +0 -1
  195. package/cjs/data/drag-and-drop-legacy/root/DragAndDropLegacyRoot.d.ts +0 -24
  196. package/cjs/data/drag-and-drop-legacy/root/DragAndDropLegacyRoot.js +0 -108
  197. package/cjs/data/drag-and-drop-legacy/root/DragAndDropLegacyRoot.js.map +0 -1
  198. package/cjs/data/table/helpers/selection/SelectionSubtreeHelper.d.ts +0 -46
  199. package/cjs/data/table/helpers/selection/SelectionSubtreeHelper.js +0 -112
  200. package/cjs/data/table/helpers/selection/SelectionSubtreeHelper.js.map +0 -1
  201. package/esm/data/drag-and-drop-legacy/drag-handler/DragAndDropDragHandlerLegacy.d.ts +0 -22
  202. package/esm/data/drag-and-drop-legacy/drag-handler/DragAndDropDragHandlerLegacy.js +0 -29
  203. package/esm/data/drag-and-drop-legacy/drag-handler/DragAndDropDragHandlerLegacy.js.map +0 -1
  204. package/esm/data/drag-and-drop-legacy/item/DragAndDropItemLegacy.d.ts +0 -27
  205. package/esm/data/drag-and-drop-legacy/item/DragAndDropItemLegacy.js +0 -50
  206. package/esm/data/drag-and-drop-legacy/item/DragAndDropItemLegacy.js.map +0 -1
  207. package/esm/data/drag-and-drop-legacy/root/DragAndDropLegacy.context.d.ts +0 -5
  208. package/esm/data/drag-and-drop-legacy/root/DragAndDropLegacy.context.js +0 -3
  209. package/esm/data/drag-and-drop-legacy/root/DragAndDropLegacy.context.js.map +0 -1
  210. package/esm/data/drag-and-drop-legacy/root/DragAndDropLegacyRoot.d.ts +0 -24
  211. package/esm/data/drag-and-drop-legacy/root/DragAndDropLegacyRoot.js +0 -68
  212. package/esm/data/drag-and-drop-legacy/root/DragAndDropLegacyRoot.js.map +0 -1
  213. package/esm/data/table/helpers/selection/SelectionSubtreeHelper.d.ts +0 -46
  214. package/esm/data/table/helpers/selection/SelectionSubtreeHelper.js +0 -109
  215. package/esm/data/table/helpers/selection/SelectionSubtreeHelper.js.map +0 -1
  216. package/src/data/drag-and-drop-legacy/drag-handler/DragAndDropDragHandlerLegacy.tsx +0 -104
  217. package/src/data/drag-and-drop-legacy/item/DragAndDropItemLegacy.tsx +0 -74
  218. package/src/data/drag-and-drop-legacy/root/DragAndDropLegacy.context.tsx +0 -11
  219. package/src/data/drag-and-drop-legacy/root/DragAndDropLegacyRoot.tsx +0 -94
  220. package/src/data/table/helpers/selection/SelectionSubtreeHelper.test.ts +0 -66
  221. package/src/data/table/helpers/selection/SelectionSubtreeHelper.ts +0 -162
  222. package/src/data/table/hooks/__tests__/useTableSelection.test.ts +0 -488
  223. package/src/data/table/root/agent-feature-gap.md +0 -96
@@ -1,108 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __rest = (this && this.__rest) || function (s, e) {
36
- var t = {};
37
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
38
- t[p] = s[p];
39
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
40
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
41
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
42
- t[p[i]] = s[p[i]];
43
- }
44
- return t;
45
- };
46
- var __importDefault = (this && this.__importDefault) || function (mod) {
47
- return (mod && mod.__esModule) ? mod : { "default": mod };
48
- };
49
- Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.DragAndDropItemLegacy = exports.DragAndDropLegacy = void 0;
51
- const react_1 = require("@dnd-kit/react");
52
- const sortable_1 = require("@dnd-kit/react/sortable");
53
- const react_2 = __importStar(require("react"));
54
- const stack_1 = require("../../../primitives/stack");
55
- const DragAndDropItemLegacy_1 = __importDefault(require("../item/DragAndDropItemLegacy"));
56
- exports.DragAndDropItemLegacy = DragAndDropItemLegacy_1.default;
57
- const DragAndDropLegacy_context_1 = require("./DragAndDropLegacy.context");
58
- const DragAndDropLegacy = (0, react_2.forwardRef)((_a, forwardedRef) => {
59
- var { setItems, children } = _a, rest = __rest(_a, ["setItems", "children"]);
60
- const [inputMethod, setInputMethod] = react_2.default.useState(null);
61
- const setItemOrder = (initalIndex, targetIndex) => {
62
- setItems((items) => {
63
- const newItems = [...items];
64
- const [movedItem] = newItems.splice(initalIndex, 1);
65
- newItems.splice(targetIndex, 0, movedItem);
66
- return newItems;
67
- });
68
- };
69
- return (react_2.default.createElement(DragAndDropLegacy_context_1.DragAndDropLegacyContext.Provider, { value: { inputMethod } },
70
- react_2.default.createElement(react_1.DragDropProvider
71
- // TODO Look into overriding default keybinds, might eliminate context need
72
- , {
73
- // TODO Look into overriding default keybinds, might eliminate context need
74
- onBeforeDragStart: (event) => {
75
- var _a;
76
- return setInputMethod(((_a = event.operation.activatorEvent) === null || _a === void 0 ? void 0 : _a.type) === "pointerdown"
77
- ? "mouse"
78
- : "keyboard");
79
- }, onDragOver: (event) => {
80
- var _a;
81
- if (((_a = event.operation.activatorEvent) === null || _a === void 0 ? void 0 : _a.type) === "pointerdown") {
82
- // Prevents items to rearrange while dragging with mouse, but allows keyboard dragging to work as intended
83
- event.preventDefault();
84
- }
85
- }, onDragEnd: (event) => {
86
- const { source, target } = event.operation;
87
- if (!(0, sortable_1.isSortable)(source) || !(0, sortable_1.isSortable)(target))
88
- return;
89
- setItemOrder(source.initialIndex, target.index);
90
- } },
91
- react_2.default.createElement(stack_1.VStack, { asChild: true, gap: "space-12" },
92
- react_2.default.createElement("div", Object.assign({}, rest, { ref: forwardedRef }), children)),
93
- react_2.default.createElement(react_1.DragOverlay, { dropAnimation: null }, (source) => {
94
- // Overlay not needed and causes glitching when using keyboard
95
- if (inputMethod === "keyboard")
96
- return null;
97
- if (!(0, sortable_1.isSortable)(source))
98
- return null;
99
- if ((0, react_2.isValidElement)(children[source.initialIndex])) {
100
- return children[source.initialIndex];
101
- }
102
- return null;
103
- }))));
104
- });
105
- exports.DragAndDropLegacy = DragAndDropLegacy;
106
- DragAndDropLegacy.Item = DragAndDropItemLegacy_1.default;
107
- exports.default = DragAndDropLegacy;
108
- //# sourceMappingURL=DragAndDropLegacyRoot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DragAndDropLegacyRoot.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop-legacy/root/DragAndDropLegacyRoot.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA+D;AAC/D,sDAAqD;AACrD,+CAA0D;AAC1D,qDAAmD;AACnD,0FAAkE;AAuFtC,gCAvFrB,+BAAqB,CAuFqB;AAtFjD,2EAAuE;AAwBvE,MAAM,iBAAiB,GAAG,IAAA,kBAAU,EAClC,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,eAAK,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,C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AAO,IAAI,CAAC;gBAC5C,IAAI,CAAC,IAAA,qBAAU,EAAC,MAAM,CAAC;oBAAE,OAAO,IAAI,CAAC;gBACrC,IAAI,IAAA,sBAAc,EAAC,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,CACe,CACrC,CAAC;AACJ,CAAC,CACgC,CAAC;AAI3B,8CAAiB;AAF1B,iBAAiB,CAAC,IAAI,GAAG,+BAAqB,CAAC;AAG/C,kBAAe,iBAAiB,CAAC"}
@@ -1,46 +0,0 @@
1
- type SelectionKey = string | number;
2
- type SelectionStats = {
3
- selectableCount: number;
4
- selectedCount: number;
5
- };
6
- type SelectionSubtreeHelperArgs = {
7
- childRowIdsById?: Map<SelectionKey, SelectionKey[]>;
8
- disabledKeysSet: Set<SelectionKey>;
9
- selectedKeysSet: Set<SelectionKey>;
10
- };
11
- /**
12
- * Helper class for managing selection state in a tree structure.
13
- * - It provides methods to get selectable keys in a subtree
14
- * - Compute selection statistics for a subtree
15
- * - Determine if a subtree is fully selected.
16
- *
17
- * Results of selection statistics are cached to optimize performance for repeated calls on the same subtree.
18
- */
19
- declare class SelectionSubtreeHelper {
20
- private childRowIdsById;
21
- private disabledKeysSet;
22
- private selectedKeysSet;
23
- private selectionStatsCache;
24
- constructor({ childRowIdsById, disabledKeysSet, selectedKeysSet, }: SelectionSubtreeHelperArgs);
25
- getSelectableKeys(rootIds: SelectionKey[]): SelectionKey[];
26
- /**
27
- * Returns the number of selectable and selected rows in the subtree of the given root ID.
28
- * Results are cached after the first computation to optimize repeated calls for the same root ID.
29
- *
30
- * The selectable count excludes disabled rows, and the selected count excludes disabled rows that are selected.
31
- * The method is implemented iteratively to handle deep trees without hitting call stack limits.
32
- *
33
- * How it works:
34
- * - Manually add root ID to stack to get processing going. Note that the ready-flag is `false`.
35
- * - Pop stack until empty. For each entry:
36
- * - - If entry is already cached, skip it.
37
- * - - If entry is not ready, push it back as ready and push all its children as not ready.
38
- * - - If entry is ready, compute its stats based on its own state and the stats of its children, then cache the result.
39
- * - Since we add all the children to the stack after pushing element with ready: true, while "popping" the stack we will always encounter the children before their parent is ready, ensuring that the stats for all children are computed and cached before computing the stats for their parent.
40
- * - Finally, return the cached stats for the root ID.
41
- */
42
- getSelectionStats(rootId: SelectionKey): SelectionStats;
43
- isFullySelected(rootId: SelectionKey): boolean;
44
- }
45
- export { SelectionSubtreeHelper };
46
- export type { SelectionKey, SelectionStats, SelectionSubtreeHelperArgs };
@@ -1,112 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SelectionSubtreeHelper = void 0;
4
- /**
5
- * Helper class for managing selection state in a tree structure.
6
- * - It provides methods to get selectable keys in a subtree
7
- * - Compute selection statistics for a subtree
8
- * - Determine if a subtree is fully selected.
9
- *
10
- * Results of selection statistics are cached to optimize performance for repeated calls on the same subtree.
11
- */
12
- class SelectionSubtreeHelper {
13
- constructor({ childRowIdsById, disabledKeysSet, selectedKeysSet, }) {
14
- this.selectionStatsCache = new Map();
15
- this.childRowIdsById = childRowIdsById !== null && childRowIdsById !== void 0 ? childRowIdsById : new Map();
16
- this.disabledKeysSet = disabledKeysSet;
17
- this.selectedKeysSet = selectedKeysSet;
18
- }
19
- getSelectableKeys(rootIds) {
20
- var _a;
21
- const visitedKeys = new Set();
22
- const selectableKeys = [];
23
- const stack = [...rootIds].reverse();
24
- while (stack.length > 0) {
25
- const key = stack.pop();
26
- if (key == null || visitedKeys.has(key)) {
27
- continue;
28
- }
29
- visitedKeys.add(key);
30
- if (!this.disabledKeysSet.has(key)) {
31
- selectableKeys.push(key);
32
- }
33
- const childRowIds = (_a = this.childRowIdsById.get(key)) !== null && _a !== void 0 ? _a : [];
34
- for (let childIndex = childRowIds.length - 1; childIndex >= 0; childIndex--) {
35
- stack.push(childRowIds[childIndex]);
36
- }
37
- }
38
- return selectableKeys;
39
- }
40
- /**
41
- * Returns the number of selectable and selected rows in the subtree of the given root ID.
42
- * Results are cached after the first computation to optimize repeated calls for the same root ID.
43
- *
44
- * The selectable count excludes disabled rows, and the selected count excludes disabled rows that are selected.
45
- * The method is implemented iteratively to handle deep trees without hitting call stack limits.
46
- *
47
- * How it works:
48
- * - Manually add root ID to stack to get processing going. Note that the ready-flag is `false`.
49
- * - Pop stack until empty. For each entry:
50
- * - - If entry is already cached, skip it.
51
- * - - If entry is not ready, push it back as ready and push all its children as not ready.
52
- * - - If entry is ready, compute its stats based on its own state and the stats of its children, then cache the result.
53
- * - Since we add all the children to the stack after pushing element with ready: true, while "popping" the stack we will always encounter the children before their parent is ready, ensuring that the stats for all children are computed and cached before computing the stats for their parent.
54
- * - Finally, return the cached stats for the root ID.
55
- */
56
- getSelectionStats(rootId) {
57
- var _a, _b, _c;
58
- const cachedStats = this.selectionStatsCache.get(rootId);
59
- if (cachedStats) {
60
- return cachedStats;
61
- }
62
- /* Compute subtree totals iteratively so deep trees do not depend on call stack depth. */
63
- const stack = [
64
- { key: rootId, ready: false },
65
- ];
66
- while (stack.length > 0) {
67
- const entry = stack.pop();
68
- if (!entry) {
69
- continue;
70
- }
71
- if (this.selectionStatsCache.has(entry.key)) {
72
- continue;
73
- }
74
- if (entry.ready) {
75
- let selectableCount = this.disabledKeysSet.has(entry.key) ? 0 : 1;
76
- let selectedCount = !this.disabledKeysSet.has(entry.key) &&
77
- this.selectedKeysSet.has(entry.key)
78
- ? 1
79
- : 0;
80
- for (const childKey of (_a = this.childRowIdsById.get(entry.key)) !== null && _a !== void 0 ? _a : []) {
81
- const childStats = this.selectionStatsCache.get(childKey);
82
- if (!childStats) {
83
- continue;
84
- }
85
- selectableCount += childStats.selectableCount;
86
- selectedCount += childStats.selectedCount;
87
- }
88
- this.selectionStatsCache.set(entry.key, {
89
- selectableCount,
90
- selectedCount,
91
- });
92
- continue;
93
- }
94
- stack.push({ key: entry.key, ready: true });
95
- for (const childKey of (_b = this.childRowIdsById.get(entry.key)) !== null && _b !== void 0 ? _b : []) {
96
- if (!this.selectionStatsCache.has(childKey)) {
97
- stack.push({ key: childKey, ready: false });
98
- }
99
- }
100
- }
101
- return ((_c = this.selectionStatsCache.get(rootId)) !== null && _c !== void 0 ? _c : {
102
- selectableCount: 0,
103
- selectedCount: 0,
104
- });
105
- }
106
- isFullySelected(rootId) {
107
- const stats = this.getSelectionStats(rootId);
108
- return (stats.selectableCount > 0 && stats.selectedCount === stats.selectableCount);
109
- }
110
- }
111
- exports.SelectionSubtreeHelper = SelectionSubtreeHelper;
112
- //# sourceMappingURL=SelectionSubtreeHelper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectionSubtreeHelper.js","sourceRoot":"","sources":["../../../../../src/data/table/helpers/selection/SelectionSubtreeHelper.ts"],"names":[],"mappings":";;;AAaA;;;;;;;GAOG;AACH,MAAM,sBAAsB;IAM1B,YAAY,EACV,eAAe,EACf,eAAe,EACf,eAAe,GACY;QANrB,wBAAmB,GAAG,IAAI,GAAG,EAAgC,CAAC;QAOpE,IAAI,CAAC,eAAe,GAAG,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,IAAI,GAAG,EAAE,CAAC;QACpD,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAED,iBAAiB,CAAC,OAAuB;;QACvC,MAAM,WAAW,GAAG,IAAI,GAAG,EAAgB,CAAC;QAC5C,MAAM,cAAc,GAAmB,EAAE,CAAC;QAC1C,MAAM,KAAK,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC;QAErC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;YAExB,IAAI,GAAG,IAAI,IAAI,IAAI,WAAW,CAAC,GA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K,EAAE,CAAC,CAAC;gBAC9C,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,CACL,MAAA,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,mCAAI;YACtC,eAAe,EAAE,CAAC;YAClB,aAAa,EAAE,CAAC;SACjB,CACF,CAAC;IACJ,CAAC;IAED,eAAe,CAAC,MAAoB;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAE7C,OAAO,CACL,KAAK,CAAC,eAAe,GAAG,CAAC,IAAI,KAAK,CAAC,aAAa,KAAK,KAAK,CAAC,eAAe,CAC3E,CAAC;IACJ,CAAC;CACF;AAEQ,wDAAsB"}
@@ -1,22 +0,0 @@
1
- import React from "react";
2
- export interface DragAndDropDragHandlerLegacyProps {
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
- * DragAndDropDragHandlerLegacy
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 DragAndDropDragHandlerLegacy: React.ForwardRefExoticComponent<DragAndDropDragHandlerLegacyProps & React.RefAttributes<HTMLButtonElement>>;
@@ -1,29 +0,0 @@
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
- * DragAndDropDragHandlerLegacy
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 DragAndDropDragHandlerLegacy = React.forwardRef(({ keyboardDragging, handleRef, alt }) => {
11
- if (alt) {
12
- return (React.createElement("div", { className: "aksel-data-drag-and-drop__drag-handler__legacy" },
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=DragAndDropDragHandlerLegacy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DragAndDropDragHandlerLegacy.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop-legacy/drag-handler/DragAndDropDragHandlerLegacy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,gB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AC,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"}
@@ -1,27 +0,0 @@
1
- import React from "react";
2
- interface DragAndDropItemLegacyProps 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 DragAndDropItemLegacyProps}
17
- * @example
18
- * ```tsx
19
- * <DragAndDropLegacy.Item numOfSelectedRows={selectedRows.length} onClear={handleClear}>
20
- * TODO
21
- * </DragAndDropLegacy.Item>
22
- * ```
23
- */
24
- declare const DragAndDropItemLegacy: React.ForwardRefExoticComponent<DragAndDropItemLegacyProps & React.RefAttributes<HTMLDivElement>>;
25
- export default DragAndDropItemLegacy;
26
- export { DragAndDropItemLegacy };
27
- export type { DragAndDropItemLegacyProps };
@@ -1,50 +0,0 @@
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 { DragAndDropDragHandlerLegacy } from "../drag-handler/DragAndDropDragHandlerLegacy.js";
18
- import { DragAndDropLegacyContext } from "../root/DragAndDropLegacy.context.js";
19
- /**
20
- * TODO
21
- *
22
- * @see 🏷️ {@link DragAndDropItemLegacyProps}
23
- * @example
24
- * ```tsx
25
- * <DragAndDropLegacy.Item numOfSelectedRows={selectedRows.length} onClear={handleClear}>
26
- * TODO
27
- * </DragAndDropLegacy.Item>
28
- * ```
29
- */
30
- const DragAndDropItemLegacy = 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(DragAndDropLegacyContext);
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(DragAndDropDragHandlerLegacy, { handleRef: handleRef, keyboardDragging: keyboardDragging, alt: true }),
46
- React.createElement("div", null, children))));
47
- });
48
- export default DragAndDropItemLegacy;
49
- export { DragAndDropItemLegacy };
50
- //# sourceMappingURL=DragAndDropItemLegacy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DragAndDropItemLegacy.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop-legacy/item/DragAndDropItemLegacy.tsx"],"names":[],"mappings":";;;;;;;;;;;AAA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L,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,4BAA4B,IAC3B,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,SACH;YACF,iCAAM,QAAQ,CAAO,CACjB,CACC,CACV,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,qBAAqB,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -1,5 +0,0 @@
1
- interface DragAndDropContextLegacyType {
2
- inputMethod: "mouse" | "keyboard" | null;
3
- }
4
- export declare const DragAndDropLegacyContext: import("react").Context<DragAndDropContextLegacyType | undefined>;
5
- export {};
@@ -1,3 +0,0 @@
1
- import { createContext } from "react";
2
- export const DragAndDropLegacyContext = createContext(undefined);
3
- //# sourceMappingURL=DragAndDropLegacy.context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DragAndDropLegacy.context.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop-legacy/root/DragAndDropLegacy.context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAQtC,MAAM,CAAC,MAAM,wBAAwB,GAAG,aAAa,CAEnD,SAAS,CAAC,CAAC"}
@@ -1,24 +0,0 @@
1
- import React from "react";
2
- import DragAndDropItemLegacy from "../item/DragAndDropItemLegacy.js";
3
- interface DragAndDropLegacyProps extends React.HTMLAttributes<HTMLDivElement> {
4
- children: any[];
5
- setItems: React.Dispatch<React.SetStateAction<any[]>>;
6
- }
7
- interface DragAndDropLegacyRootComponent extends React.ForwardRefExoticComponent<DragAndDropLegacyProps & React.RefAttributes<HTMLDivElement>> {
8
- /**
9
- * @see 🏷️ {@link DragAndDropItemLegacyProps}
10
- * * @example
11
- * ```jsx
12
- * <DragAndDropLegacy>
13
- * <DragAndDropLegacy.Item id="1" index={0}>
14
- * ...
15
- * </DragAndDropLegacy.Item>
16
- * </DragAndDropLegacy>
17
- * ```
18
- */
19
- Item: typeof DragAndDropItemLegacy;
20
- }
21
- declare const DragAndDropLegacy: DragAndDropLegacyRootComponent;
22
- export { DragAndDropLegacy, DragAndDropItemLegacy };
23
- export default DragAndDropLegacy;
24
- export type { DragAndDropLegacyProps };
@@ -1,68 +0,0 @@
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 DragAndDropItemLegacy from "../item/DragAndDropItemLegacy.js";
17
- import { DragAndDropLegacyContext } from "./DragAndDropLegacy.context.js";
18
- const DragAndDropLegacy = 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(DragAndDropLegacyContext.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
- DragAndDropLegacy.Item = DragAndDropItemLegacy;
66
- export { DragAndDropLegacy, DragAndDropItemLegacy };
67
- export default DragAndDropLegacy;
68
- //# sourceMappingURL=DragAndDropLegacyRoot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DragAndDropLegacyRoot.js","sourceRoot":"","sources":["../../../../src/data/drag-and-drop-legacy/root/DragAndDropLegacyRoot.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,cA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ionSubtreeHelperArgs = {
7
- childRowIdsById?: Map<SelectionKey, SelectionKey[]>;
8
- disabledKeysSet: Set<SelectionKey>;
9
- selectedKeysSet: Set<SelectionKey>;
10
- };
11
- /**
12
- * Helper class for managing selection state in a tree structure.
13
- * - It provides methods to get selectable keys in a subtree
14
- * - Compute selection statistics for a subtree
15
- * - Determine if a subtree is fully selected.
16
- *
17
- * Results of selection statistics are cached to optimize performance for repeated calls on the same subtree.
18
- */
19
- declare class SelectionSubtreeHelper {
20
- private childRowIdsById;
21
- private disabledKeysSet;
22
- private selectedKeysSet;
23
- private selectionStatsCache;
24
- constructor({ childRowIdsById, disabledKeysSet, selectedKeysSet, }: SelectionSubtreeHelperArgs);
25
- getSelectableKeys(rootIds: SelectionKey[]): SelectionKey[];
26
- /**
27
- * Returns the number of selectable and selected rows in the subtree of the given root ID.
28
- * Results are cached after the first computation to optimize repeated calls for the same root ID.
29
- *
30
- * The selectable count excludes disabled rows, and the selected count excludes disabled rows that are selected.
31
- * The method is implemented iteratively to handle deep trees without hitting call stack limits.
32
- *
33
- * How it works:
34
- * - Manually add root ID to stack to get processing going. Note that the ready-flag is `false`.
35
- * - Pop stack until empty. For each entry:
36
- * - - If entry is already cached, skip it.
37
- * - - If entry is not ready, push it back as ready and push all its children as not ready.
38
- * - - If entry is ready, compute its stats based on its own state and the stats of its children, then cache the result.
39
- * - Since we add all the children to the stack after pushing element with ready: true, while "popping" the stack we will always encounter the children before their parent is ready, ensuring that the stats for all children are computed and cached before computing the stats for their parent.
40
- * - Finally, return the cached stats for the root ID.
41
- */
42
- getSelectionStats(rootId: SelectionKey): SelectionStats;
43
- isFullySelected(rootId: SelectionKey): boolean;
44
- }
45
- export { SelectionSubtreeHelper };
46
- export type { SelectionKey, SelectionStats, SelectionSubtreeHelperArgs };