@archbase/kanban 4.0.37

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 (95) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +630 -0
  3. package/dist/archbase-kanban-4.0.37.tgz +0 -0
  4. package/dist/components/Card/Card.d.ts +26 -0
  5. package/dist/components/Card/index.d.ts +1 -0
  6. package/dist/components/CardSkeleton/CardSkeleton.d.ts +9 -0
  7. package/dist/components/CardSkeleton/index.d.ts +2 -0
  8. package/dist/components/Column/Column.d.ts +47 -0
  9. package/dist/components/Column/index.d.ts +1 -0
  10. package/dist/components/ColumnAdder/ColumnAdder.d.ts +6 -0
  11. package/dist/components/ColumnAdder/index.d.ts +1 -0
  12. package/dist/components/ColumnContent/ColumnContent.d.ts +24 -0
  13. package/dist/components/ColumnContent/index.d.ts +1 -0
  14. package/dist/components/ColumnHeader/ColumnHeader.d.ts +10 -0
  15. package/dist/components/ColumnHeader/index.d.ts +1 -0
  16. package/dist/components/DefaultCard/DefaultCard.d.ts +3 -0
  17. package/dist/components/DefaultCard/index.d.ts +1 -0
  18. package/dist/components/GenericItem/GenericItem.d.ts +26 -0
  19. package/dist/components/GenericItem/index.d.ts +1 -0
  20. package/dist/components/Kanban.d.ts +3 -0
  21. package/dist/components/index.d.ts +2 -0
  22. package/dist/components/types.d.ts +124 -0
  23. package/dist/context/KanbanContext.d.ts +5 -0
  24. package/dist/global/dnd/dropManager.d.ts +16 -0
  25. package/dist/global/dnd/useCardDnd.d.ts +22 -0
  26. package/dist/global/dnd/useColumnDnd.d.ts +29 -0
  27. package/dist/index.css +1 -0
  28. package/dist/index.d.ts +4 -0
  29. package/dist/index.js +1041 -0
  30. package/dist/utils/columnsUtils.d.ts +4 -0
  31. package/dist/utils/getPrefix.d.ts +2 -0
  32. package/dist/utils/getSharedProps.d.ts +8 -0
  33. package/dist/utils/infinite-scroll.d.ts +4 -0
  34. package/dist/utils/mergeRefs.d.ts +5 -0
  35. package/dist/utils/scroll.d.ts +2 -0
  36. package/package.json +66 -0
  37. package/src/common/_index.scss +0 -0
  38. package/src/components/Card/Card.tsx +215 -0
  39. package/src/components/Card/_Card.scss +11 -0
  40. package/src/components/Card/_index.scss +1 -0
  41. package/src/components/Card/index.ts +1 -0
  42. package/src/components/CardSkeleton/CardSkeleton.tsx +45 -0
  43. package/src/components/CardSkeleton/_CardSkeleton.scss +245 -0
  44. package/src/components/CardSkeleton/_index.scss +1 -0
  45. package/src/components/CardSkeleton/index.ts +2 -0
  46. package/src/components/Column/Column.tsx +246 -0
  47. package/src/components/Column/_Column.scss +44 -0
  48. package/src/components/Column/_index.scss +1 -0
  49. package/src/components/Column/index.ts +1 -0
  50. package/src/components/ColumnAdder/ColumnAdder.tsx +18 -0
  51. package/src/components/ColumnAdder/_ColumnAdder.scss +0 -0
  52. package/src/components/ColumnAdder/_index.scss +1 -0
  53. package/src/components/ColumnAdder/index.ts +1 -0
  54. package/src/components/ColumnContent/ColumnContent.tsx +238 -0
  55. package/src/components/ColumnContent/_ColumnContent.scss +23 -0
  56. package/src/components/ColumnContent/_index.scss +1 -0
  57. package/src/components/ColumnContent/index.ts +1 -0
  58. package/src/components/ColumnHeader/ColumnHeader.tsx +43 -0
  59. package/src/components/ColumnHeader/_ColumnHeader.scss +26 -0
  60. package/src/components/ColumnHeader/_index.scss +1 -0
  61. package/src/components/ColumnHeader/index.ts +1 -0
  62. package/src/components/DefaultCard/DefaultCard.tsx +9 -0
  63. package/src/components/DefaultCard/_DefaultCard.scss +14 -0
  64. package/src/components/DefaultCard/_index.scss +1 -0
  65. package/src/components/DefaultCard/index.ts +1 -0
  66. package/src/components/GenericItem/GenericItem.tsx +132 -0
  67. package/src/components/GenericItem/_GenericItem.scss +4 -0
  68. package/src/components/GenericItem/_index.scss +1 -0
  69. package/src/components/GenericItem/index.ts +1 -0
  70. package/src/components/Kanban.tsx +102 -0
  71. package/src/components/_Kanban.scss +8 -0
  72. package/src/components/_index.scss +9 -0
  73. package/src/components/index.ts +2 -0
  74. package/src/components/types.ts +155 -0
  75. package/src/context/KanbanContext.tsx +19 -0
  76. package/src/global/_index.scss +3 -0
  77. package/src/global/assets/styles/abstracts/_breakpoints.scss +71 -0
  78. package/src/global/assets/styles/abstracts/_colors.scss +85 -0
  79. package/src/global/assets/styles/abstracts/_functions.scss +3 -0
  80. package/src/global/assets/styles/abstracts/_index.scss +5 -0
  81. package/src/global/assets/styles/abstracts/_mixins.scss +49 -0
  82. package/src/global/assets/styles/abstracts/_padding.scss +1 -0
  83. package/src/global/assets/styles/abstracts/_variables.scss +8 -0
  84. package/src/global/assets/styles/base/_index.scss +34 -0
  85. package/src/global/dnd/dropManager.ts +301 -0
  86. package/src/global/dnd/useCardDnd.tsx +225 -0
  87. package/src/global/dnd/useColumnDnd.tsx +231 -0
  88. package/src/global/theme-default.scss +137 -0
  89. package/src/index.ts +6 -0
  90. package/src/utils/columnsUtils.ts +19 -0
  91. package/src/utils/getPrefix.ts +7 -0
  92. package/src/utils/getSharedProps.ts +18 -0
  93. package/src/utils/infinite-scroll.ts +18 -0
  94. package/src/utils/mergeRefs.ts +23 -0
  95. package/src/utils/scroll.ts +34 -0
package/dist/index.js ADDED
@@ -0,0 +1,1041 @@
1
+ import { extractClosestEdge as $, attachClosestEdge as oe } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
2
+ import { reorderWithEdge as z } from "@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge";
3
+ import { jsx as m, jsxs as T, Fragment as ae } from "react/jsx-runtime";
4
+ import H from "classnames";
5
+ import { forwardRef as J, createContext as Ie, useContext as ye, useRef as R, useState as se, useCallback as E, useEffect as F, memo as ie, useMemo as V, Fragment as ve } from "react";
6
+ import { createPortal as le } from "react-dom";
7
+ import { VList as De } from "virtua";
8
+ import { draggable as de, dropTargetForElements as ce, monitorForElements as ke } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
9
+ import { combine as Q } from "@atlaskit/pragmatic-drag-and-drop/combine";
10
+ import { setCustomNativeDragPreview as ue } from "@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview";
11
+ import { preserveOffsetOnSource as ge } from "@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source";
12
+ import { autoScrollForElements as me } from "@atlaskit/pragmatic-drag-and-drop-auto-scroll/element";
13
+ import { autoScroller as M } from "@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll";
14
+ const we = (e) => e?.type === "card", j = (e) => e?.type === "column", G = (e, r) => {
15
+ const t = [], n = r[e];
16
+ return n && n.children?.forEach((a) => {
17
+ const l = r[a];
18
+ l && t.push(l);
19
+ }), t;
20
+ }, Se = ({
21
+ source: e,
22
+ location: r,
23
+ columns: t,
24
+ dataSource: n,
25
+ onCardMove: o,
26
+ onColumnMove: a
27
+ }) => {
28
+ if (j(e.data)) {
29
+ if (!a)
30
+ return;
31
+ const i = r.current.dropTargets[0];
32
+ if (!i)
33
+ return;
34
+ const f = i.data;
35
+ if (!j(f))
36
+ return;
37
+ const g = e.data.columnId, x = f.columnId;
38
+ if (g === x)
39
+ return;
40
+ const u = t.findIndex((D) => D.id === g), k = t.findIndex((D) => D.id === x);
41
+ if (u === -1 || k === -1)
42
+ return;
43
+ const p = $(f), S = z({
44
+ axis: "horizontal",
45
+ list: t,
46
+ startIndex: u,
47
+ indexOfTarget: k,
48
+ closestEdgeOfTarget: p
49
+ });
50
+ a({
51
+ columnId: g,
52
+ fromIndex: u,
53
+ toIndex: S.findIndex((D) => D.id === g)
54
+ });
55
+ return;
56
+ }
57
+ if (!we(e.data))
58
+ return;
59
+ const l = e.data.itemId, d = e.data.columnId, y = r.current.dropTargets[0];
60
+ if (!y)
61
+ return;
62
+ const h = y.data;
63
+ if (h["card-drop-target"]) {
64
+ const i = h.columnId, f = h.itemId, g = $(h), x = n[d], u = n[i];
65
+ if (!x || !u)
66
+ return;
67
+ if (d === i) {
68
+ const k = G(i, n), p = k.findIndex(
69
+ (w) => w.id === l
70
+ ), S = k.findIndex(
71
+ (w) => w.id === f
72
+ );
73
+ if (p === -1 || S === -1 || p === S)
74
+ return;
75
+ const D = z({
76
+ axis: "vertical",
77
+ list: k,
78
+ startIndex: p,
79
+ indexOfTarget: S,
80
+ closestEdgeOfTarget: g
81
+ }), c = D.findIndex(
82
+ (w) => w.id === l
83
+ ), C = c > 0 ? D[c - 1] : null, s = c < D.length - 1 ? D[c + 1] : null;
84
+ o && o({
85
+ cardId: l,
86
+ fromColumnId: d,
87
+ toColumnId: i,
88
+ taskAbove: C?.id,
89
+ taskBelow: s?.id,
90
+ position: c
91
+ });
92
+ } else {
93
+ const k = G(i, n), p = k.findIndex(
94
+ (N) => N.id === f
95
+ );
96
+ if (p === -1)
97
+ return;
98
+ const S = g === "bottom" ? p + 1 : p, D = G(d, n).find(
99
+ (N) => N.id === l
100
+ );
101
+ if (!D)
102
+ return;
103
+ const c = [...k];
104
+ c.splice(S, 0, D);
105
+ const C = z({
106
+ axis: "vertical",
107
+ list: c,
108
+ startIndex: S,
109
+ indexOfTarget: S,
110
+ closestEdgeOfTarget: g
111
+ }), s = C.findIndex(
112
+ (N) => N.id === l
113
+ ), w = s > 0 ? C[s - 1] : null, v = s < C.length - 1 ? C[s + 1] : null;
114
+ o && o({
115
+ cardId: l,
116
+ fromColumnId: d,
117
+ toColumnId: i,
118
+ taskAbove: w?.id,
119
+ taskBelow: v?.id,
120
+ position: s
121
+ });
122
+ }
123
+ } else if (j(h)) {
124
+ const i = h.columnId, f = G(i, n), g = f.length > 0 ? f[f.length - 1] : null;
125
+ o && o({
126
+ cardId: l,
127
+ fromColumnId: d,
128
+ toColumnId: i,
129
+ taskAbove: g?.id,
130
+ taskBelow: null,
131
+ position: f.length
132
+ });
133
+ }
134
+ }, it = (e, r) => {
135
+ const { columnId: t, toIndex: n } = e, o = { ...r }, a = [...o.root?.children || []], l = a.indexOf(t);
136
+ return l === -1 || (a.splice(l, 1), a.splice(n, 0, t), o.root && (o.root.children = a)), o;
137
+ }, lt = (e, r, t, n, o) => {
138
+ const { cardId: a, fromColumnId: l, toColumnId: d, taskAbove: y, taskBelow: h } = e, i = { ...r };
139
+ i[l]?.children && (i[l].children = i[l].children.filter((u) => u !== a), i[l]?.totalItems !== void 0 && i[l].totalItems > 0 && i[l].totalItems--), o && i[l] && (i[l] = o(
140
+ i[l]
141
+ ));
142
+ const f = i[d]?.children || [];
143
+ let g = 0;
144
+ y ? g = f.indexOf(y) + 1 : h && (g = f.indexOf(h));
145
+ const x = f.includes(a);
146
+ if (i[d]?.totalItems !== void 0 && !x && i[d].totalItems++, t && i[a]) {
147
+ const u = t?.(
148
+ i[d],
149
+ i[a]
150
+ );
151
+ i[a] = u || i[a];
152
+ }
153
+ return i[d]?.children && (i[d].children = i[d]?.children?.filter((u) => u !== a), i[d].children.splice(g, 0, a)), n && i[d] && (i[d] = n(
154
+ i[d]
155
+ )), i;
156
+ }, xe = (e) => e?.root ? e.root.children?.map((r) => e[r]) || [] : [], Ne = (e, r) => e ? e.children?.map((t) => r[t]) || [] : [], te = "rkk", I = (e, r = " ") => Array.isArray(e) ? e.map((t) => `${te}-${t}`).join(r) : `${te}-${e}`, be = J((e, r) => {
157
+ const {
158
+ renderColumnHeader: t,
159
+ columnHeaderStyle: n,
160
+ columnHeaderClassName: o = "",
161
+ data: a
162
+ } = e, l = H(
163
+ I("column-header"),
164
+ o
165
+ );
166
+ return t ? /* @__PURE__ */ m("div", { ref: r, children: t(a) }) : /* @__PURE__ */ T(
167
+ "header",
168
+ {
169
+ ref: r,
170
+ className: l,
171
+ style: n?.(a),
172
+ children: [
173
+ /* @__PURE__ */ m("div", { className: I("column-header-left"), children: a?.title }),
174
+ /* @__PURE__ */ m("div", { className: I("column-header-right"), children: a?.totalItemsCount || a?.totalChildrenCount || 0 })
175
+ ]
176
+ }
177
+ );
178
+ }), Ee = ({
179
+ className: e,
180
+ style: r,
181
+ animationType: t = "shimmer"
182
+ }) => {
183
+ const n = `${I("skeleton")} ${t === "pulse" ? I("skeleton-pulse") : ""} ${t === "wave" ? I("skeleton-wave") : ""} ${e || ""}`.trim();
184
+ return /* @__PURE__ */ m("div", { className: n, style: r, children: /* @__PURE__ */ T("div", { className: I("skeleton-content"), children: [
185
+ /* @__PURE__ */ m("div", { className: I("skeleton-title") }),
186
+ /* @__PURE__ */ T("div", { className: I("skeleton-description"), children: [
187
+ /* @__PURE__ */ m("div", { className: I("skeleton-line") }),
188
+ /* @__PURE__ */ m(
189
+ "div",
190
+ {
191
+ className: `${I("skeleton-line")} ${I(
192
+ "skeleton-line-short"
193
+ )}`
194
+ }
195
+ )
196
+ ] })
197
+ ] }) });
198
+ }, fe = Ie(void 0), K = () => {
199
+ const e = ye(fe);
200
+ if (!e)
201
+ throw new Error("KanbanContext must be used within a provider");
202
+ return e;
203
+ }, Te = ({
204
+ children: e,
205
+ ...r
206
+ }) => /* @__PURE__ */ m(fe.Provider, { value: r, children: e }), q = { type: "idle" }, Oe = (e = {}, r = {}, t, n, o) => {
207
+ const { viewOnly: a } = K(), l = R(null), d = R(null), [y, h] = se(q), i = E(
208
+ () => ({
209
+ type: "card",
210
+ itemId: e?.id,
211
+ columnId: r?.id,
212
+ index: t,
213
+ isDraggable: n,
214
+ parentId: e.parentId,
215
+ rect: d.current?.getBoundingClientRect() || null
216
+ }),
217
+ [e?.id, r?.id, t, n, e?.parentId]
218
+ ), f = E(
219
+ ({ input: c, element: C }) => {
220
+ const s = {
221
+ type: "card",
222
+ "card-drop-target": !0,
223
+ itemId: e.id,
224
+ columnId: r.id,
225
+ index: t,
226
+ isDraggable: n,
227
+ parentId: e.parentId
228
+ };
229
+ return oe(s, {
230
+ input: c,
231
+ element: C,
232
+ allowedEdges: ["top", "bottom"]
233
+ });
234
+ },
235
+ [e?.id, r?.id, t, n, e?.parentId]
236
+ ), g = E(
237
+ (c) => {
238
+ const C = c.source.data;
239
+ return C.itemId === e.parentId ? !1 : C.isDraggable;
240
+ },
241
+ [e?.id, e?.parentId]
242
+ ), x = E(
243
+ ({ nativeSetDragImage: c, location: C }) => {
244
+ ue({
245
+ nativeSetDragImage: c,
246
+ getOffset: ge({
247
+ element: d.current,
248
+ input: C.current.input
249
+ }),
250
+ render({ container: s }) {
251
+ const w = d.current.getBoundingClientRect();
252
+ h({
253
+ type: "preview",
254
+ container: s,
255
+ dragging: w
256
+ });
257
+ }
258
+ });
259
+ },
260
+ []
261
+ ), u = E(() => {
262
+ h({ type: "is-dragging" });
263
+ }, []), k = E(() => {
264
+ h(q);
265
+ }, []), p = E(
266
+ ({ source: c, self: C }) => {
267
+ if (c.data.type !== "card" || c.data.itemId === e.id)
268
+ return;
269
+ const s = $(C.data);
270
+ s && h({
271
+ type: "is-over",
272
+ dragging: c.data.rect,
273
+ closestEdge: s
274
+ });
275
+ },
276
+ [e?.id]
277
+ ), S = E(
278
+ ({ source: c, self: C }) => {
279
+ if (c.data.type !== "card" || c.data.itemId === e.id)
280
+ return;
281
+ const s = $(C.data);
282
+ s && h({
283
+ type: "is-over",
284
+ dragging: c.data.rect,
285
+ closestEdge: s
286
+ });
287
+ },
288
+ [e?.id]
289
+ ), D = E(
290
+ ({ source: c }) => {
291
+ if (c.data.type === "card") {
292
+ if (c.data.itemId === e?.id) {
293
+ h({ type: "is-dragging-and-left-self" });
294
+ return;
295
+ }
296
+ h(q);
297
+ }
298
+ },
299
+ [e.id]
300
+ );
301
+ return F(() => {
302
+ const c = l.current, C = d.current;
303
+ if (!(!c || !C))
304
+ return Q(
305
+ de({
306
+ element: C,
307
+ getInitialData: i,
308
+ onGenerateDragPreview: x,
309
+ onDragStart: u,
310
+ onDrop: k,
311
+ canDrag: () => n && !a
312
+ }),
313
+ ce({
314
+ element: c,
315
+ canDrop: g,
316
+ getIsSticky: () => !0,
317
+ getData: f,
318
+ onDragEnter: p,
319
+ onDrag: S,
320
+ onDragLeave: D,
321
+ onDrop: k
322
+ })
323
+ );
324
+ }, [
325
+ i,
326
+ x,
327
+ u,
328
+ k,
329
+ n,
330
+ g,
331
+ f,
332
+ p,
333
+ S,
334
+ D
335
+ ]), F(() => {
336
+ o?.({ state: y, card: e, column: r });
337
+ }, [y, o]), {
338
+ outerRef: l,
339
+ innerRef: d,
340
+ state: y
341
+ };
342
+ }, _ = ie(
343
+ ({
344
+ height: e,
345
+ customIndicator: r
346
+ }) => /* @__PURE__ */ m("div", { className: I("card-shadow-container"), children: r || /* @__PURE__ */ m(
347
+ "div",
348
+ {
349
+ className: I("card-shadow"),
350
+ style: { height: `${e - 2}px` }
351
+ }
352
+ ) })
353
+ ), ne = (e) => {
354
+ const {
355
+ outerRef: r,
356
+ innerRef: t,
357
+ state: n,
358
+ data: o,
359
+ column: a,
360
+ index: l,
361
+ isDraggable: d,
362
+ cardsGap: y,
363
+ render: h,
364
+ onClick: i,
365
+ renderCardDragIndicator: f
366
+ } = e, g = V(() => {
367
+ const c = {};
368
+ return n.type === "is-dragging-and-left-self" && (c.display = "none"), c;
369
+ }, [n.type]), x = V(() => n.type === "is-dragging" ? { opacity: 0.6 } : n.type === "preview" ? {
370
+ width: n.dragging.width,
371
+ height: n.dragging.height,
372
+ transform: "rotate(4deg)"
373
+ } : {}, [n]), u = n.type === "is-over" && n.closestEdge === "top", k = n.type === "is-over" && n.closestEdge === "bottom", p = n.type === "is-over" ? n.dragging.height : 0, S = h({ data: o, column: a, index: l, isDraggable: d }), D = f?.(
374
+ n.type === "is-dragging" ? o : null,
375
+ {
376
+ height: p
377
+ }
378
+ );
379
+ return /* @__PURE__ */ m(ve, { children: /* @__PURE__ */ T(
380
+ "div",
381
+ {
382
+ ref: r,
383
+ className: I("card-outer"),
384
+ onClick: (c) => i?.(c, o),
385
+ style: {
386
+ ...g,
387
+ ...y !== void 0 ? { marginBottom: y } : {}
388
+ },
389
+ "data-test-id": o?.id,
390
+ "data-rkk-column": a?.id,
391
+ "data-rkk-index": l,
392
+ children: [
393
+ u && /* @__PURE__ */ m(_, { height: p, customIndicator: D }),
394
+ /* @__PURE__ */ m(
395
+ "div",
396
+ {
397
+ ref: t,
398
+ className: I("card-inner"),
399
+ style: {
400
+ ...x,
401
+ marginBottom: k ? y : 0,
402
+ marginTop: u ? y : 0
403
+ },
404
+ children: S
405
+ }
406
+ ),
407
+ k && /* @__PURE__ */ m(_, { height: p, customIndicator: D })
408
+ ]
409
+ }
410
+ ) });
411
+ }, Re = (e) => {
412
+ const {
413
+ render: r,
414
+ data: t,
415
+ column: n,
416
+ index: o,
417
+ isDraggable: a,
418
+ cardsGap: l,
419
+ onClick: d,
420
+ onCardDndStateChange: y,
421
+ renderCardDragIndicator: h,
422
+ renderCardDragPreview: i,
423
+ renderGap: f
424
+ } = e, { outerRef: g, innerRef: x, state: u } = Oe(
425
+ t,
426
+ n,
427
+ o,
428
+ a,
429
+ y
430
+ );
431
+ return /* @__PURE__ */ T(ae, { children: [
432
+ /* @__PURE__ */ m(
433
+ ne,
434
+ {
435
+ outerRef: g,
436
+ innerRef: x,
437
+ state: u,
438
+ data: t,
439
+ column: n,
440
+ index: o,
441
+ isDraggable: a,
442
+ render: r,
443
+ onClick: d,
444
+ cardsGap: l,
445
+ renderCardDragIndicator: h,
446
+ renderGap: f
447
+ }
448
+ ),
449
+ u.type === "preview" ? le(
450
+ i?.(t, {
451
+ state: u,
452
+ data: t,
453
+ column: n,
454
+ index: o,
455
+ isDraggable: a
456
+ }) || /* @__PURE__ */ m(
457
+ ne,
458
+ {
459
+ state: u,
460
+ data: t,
461
+ column: n,
462
+ index: o,
463
+ isDraggable: a,
464
+ render: r
465
+ }
466
+ ),
467
+ u.container
468
+ ) : null
469
+ ] });
470
+ }, $e = (e) => /* @__PURE__ */ m("div", { className: I("default-card"), children: e?.data?.title }), He = (e, r) => e?.isDraggable !== void 0 ? e?.isDraggable : r, Ae = (e) => {
471
+ const { index: r, options: t } = e, {
472
+ data: n,
473
+ column: o,
474
+ configMap: a,
475
+ isSkeleton: l,
476
+ cardWrapperStyle: d,
477
+ cardWrapperClassName: y,
478
+ cardsGap: h = 8,
479
+ isShadow: i,
480
+ isListFooter: f,
481
+ cardOverHeight: g = 90,
482
+ renderSkeletonCard: x,
483
+ onCardClick: u,
484
+ onCardDndStateChange: k,
485
+ renderCardDragIndicator: p,
486
+ renderListFooter: S,
487
+ renderCardDragPreview: D,
488
+ renderGap: c
489
+ } = t, { render: C = $e, isDraggable: s = !0 } = a?.[n?.type] || {}, w = H(
490
+ I("generic-item-wrapper"),
491
+ y
492
+ ), v = () => f ? /* @__PURE__ */ m("div", { className: I("generic-item-list-footer"), children: S?.(o) || "Default Footer" }) : i ? /* @__PURE__ */ m(
493
+ _,
494
+ {
495
+ height: g,
496
+ customIndicator: p?.(n, {
497
+ height: g
498
+ })
499
+ }
500
+ ) : l ? /* @__PURE__ */ m(
501
+ "div",
502
+ {
503
+ className: I("generic-item-skeleton"),
504
+ "data-index": r,
505
+ "data-rkk-column": o?.id,
506
+ children: x?.({ index: r, column: o }) || /* @__PURE__ */ m(Ee, { animationType: "wave" })
507
+ }
508
+ ) : /* @__PURE__ */ m(
509
+ Re,
510
+ {
511
+ render: C,
512
+ isDraggable: He(n, s),
513
+ data: n,
514
+ column: o,
515
+ index: r,
516
+ onClick: u,
517
+ cardsGap: h,
518
+ renderGap: c,
519
+ onCardDndStateChange: k,
520
+ renderCardDragIndicator: p,
521
+ renderCardDragPreview: D
522
+ }
523
+ );
524
+ return /* @__PURE__ */ m(
525
+ "div",
526
+ {
527
+ className: w,
528
+ style: {
529
+ ...d?.(n, o) || {}
530
+ },
531
+ children: v()
532
+ }
533
+ );
534
+ }, Be = (e, r, t, n) => {
535
+ const o = document.querySelector(
536
+ `.${I("column-content-list")}`
537
+ );
538
+ if (!o)
539
+ return;
540
+ const { scrollHeight: a, clientHeight: l } = o;
541
+ let d;
542
+ r ? d = typeof e == "number" ? e : 0 : d = e.target.scrollTop, t?.({
543
+ target: {
544
+ scrollTop: d,
545
+ scrollHeight: a,
546
+ clientHeight: l
547
+ }
548
+ }, n);
549
+ }, Fe = ({ columnId: e, limit: r = 20 }) => {
550
+ const t = document.querySelectorAll(
551
+ `.${I("generic-item-skeleton")}[data-rkk-column="${e}"]`
552
+ );
553
+ return t.length ? Array.from(t).slice(0, r).some((a) => {
554
+ const { top: l, bottom: d } = a.getBoundingClientRect();
555
+ return l <= window.innerHeight && d >= 0;
556
+ }) : !1;
557
+ }, pe = (e, r, t, n, o, a, l, d) => /* @__PURE__ */ m(
558
+ Ae,
559
+ {
560
+ index: r,
561
+ options: {
562
+ data: e[r],
563
+ column: t,
564
+ configMap: n,
565
+ isSkeleton: r >= e.length,
566
+ renderListFooter: a,
567
+ isShadow: o && r === d - (a ? 2 : 1),
568
+ isListFooter: a && r === d - (a ? 1 : 0),
569
+ ...l
570
+ }
571
+ },
572
+ r
573
+ ), Pe = ({
574
+ column: e,
575
+ items: r,
576
+ configMap: t,
577
+ onScroll: n,
578
+ cardOverShadowCount: o,
579
+ renderListFooter: a,
580
+ ...l
581
+ }) => {
582
+ const d = e?.totalChildrenCount + o + (a ? 1 : 0);
583
+ return /* @__PURE__ */ m(
584
+ De,
585
+ {
586
+ count: d,
587
+ onScroll: n,
588
+ className: I("column-content-list"),
589
+ children: (y) => pe(
590
+ r,
591
+ y,
592
+ e,
593
+ t,
594
+ o,
595
+ a,
596
+ l,
597
+ d
598
+ )
599
+ }
600
+ );
601
+ }, Ge = ({
602
+ column: e,
603
+ items: r,
604
+ configMap: t,
605
+ onScroll: n,
606
+ cardOverShadowCount: o,
607
+ renderListFooter: a,
608
+ ...l
609
+ }) => {
610
+ const d = e?.totalChildrenCount + o + (a ? 1 : 0);
611
+ return /* @__PURE__ */ m("div", { className: I("column-content-list"), onScroll: n, children: Array.from(
612
+ {
613
+ length: d
614
+ },
615
+ (y, h) => pe(
616
+ r,
617
+ h,
618
+ e,
619
+ t,
620
+ o,
621
+ a,
622
+ l,
623
+ d
624
+ )
625
+ ) });
626
+ }, Le = J((e, r) => {
627
+ const {
628
+ items: t,
629
+ column: n,
630
+ configMap: o,
631
+ columnListContentStyle: a,
632
+ columnListContentClassName: l,
633
+ cardWrapperStyle: d,
634
+ renderSkeletonCard: y,
635
+ cardWrapperClassName: h,
636
+ onCardClick: i,
637
+ loadMore: f,
638
+ cardOverShadowCount: g,
639
+ cardOverHeight: x,
640
+ onCardDndStateChange: u,
641
+ renderCardDragIndicator: k,
642
+ renderCardDragPreview: p,
643
+ renderListFooter: S,
644
+ renderGap: D
645
+ } = e, {
646
+ virtualization: c = !0,
647
+ cardsGap: C,
648
+ allowListFooter: s
649
+ } = K(), w = H(
650
+ I("column-content"),
651
+ l
652
+ ), v = (b, A) => {
653
+ Fe({
654
+ columnId: A?.id
655
+ }) && f?.(A?.id), e?.onScroll?.(b, A);
656
+ }, N = c ? Pe : Ge;
657
+ return /* @__PURE__ */ m(
658
+ "div",
659
+ {
660
+ ref: r,
661
+ className: w,
662
+ style: a?.(n),
663
+ children: /* @__PURE__ */ m(
664
+ N,
665
+ {
666
+ column: n,
667
+ items: t,
668
+ configMap: o,
669
+ cardWrapperStyle: d,
670
+ cardWrapperClassName: h,
671
+ cardsGap: C,
672
+ renderSkeletonCard: y,
673
+ onScroll: (b) => Be(b, c, v, n),
674
+ onCardClick: i,
675
+ cardOverShadowCount: g,
676
+ onCardDndStateChange: u,
677
+ renderCardDragIndicator: k,
678
+ renderCardDragPreview: p,
679
+ cardOverHeight: x,
680
+ renderGap: D,
681
+ renderListFooter: s !== void 0 && s?.(n) || s === void 0 ? S : null
682
+ }
683
+ )
684
+ }
685
+ );
686
+ }), B = (e) => e.type === "card", L = (e) => e.type === "column", W = { type: "idle" }, We = (e, r, t, n, o, a) => {
687
+ const { viewOnly: l } = K(), d = !l && o !== !1 && e.isDraggable !== !1, y = R(null), h = R(null), i = R(null), [f, g] = se(W), x = f.type === "is-card-over" && !f.isOverChildCard ? 1 : 0, u = e.totalChildrenCount + x, k = E(
688
+ ({ data: p, location: S }) => {
689
+ const c = !!S.current.dropTargets[0]?.data["card-drop-target"], C = {
690
+ type: "is-card-over",
691
+ dragging: p.rect,
692
+ isOverChildCard: c
693
+ };
694
+ g((s) => s.type === C.type && s.isOverChildCard === C.isOverChildCard && s.dragging === C.dragging ? s : C);
695
+ },
696
+ []
697
+ );
698
+ return F(() => {
699
+ const p = h.current, S = i.current, D = y.current;
700
+ if (!p || !S || !D)
701
+ return;
702
+ const c = p.querySelector(
703
+ `.${I("column-content-list")}`
704
+ ), C = {
705
+ type: "column",
706
+ columnId: e.id,
707
+ column: e,
708
+ index: r
709
+ };
710
+ return Q(
711
+ de({
712
+ element: D,
713
+ getInitialData: () => C,
714
+ canDrag: () => d,
715
+ onGenerateDragPreview({ location: s, nativeSetDragImage: w }) {
716
+ const v = p.getBoundingClientRect();
717
+ ue({
718
+ nativeSetDragImage: w,
719
+ getOffset: ge({
720
+ element: p,
721
+ input: s.current.input
722
+ }),
723
+ render({ container: N }) {
724
+ if (a)
725
+ g({ type: "preview", container: N, dragging: v });
726
+ else {
727
+ const b = p.cloneNode(!0);
728
+ b.style.width = `${v.width}px`, b.style.height = `${v.height}px`, b.style.transform = "rotate(4deg)", b.style.boxShadow = "0 8px 24px rgba(0,0,0,0.15)", N.appendChild(b);
729
+ }
730
+ }
731
+ });
732
+ },
733
+ onDragStart() {
734
+ g({ type: "is-dragging" });
735
+ },
736
+ onDrop() {
737
+ g(W);
738
+ }
739
+ }),
740
+ ce({
741
+ element: p,
742
+ getData({ input: s, element: w }) {
743
+ return oe(C, {
744
+ input: s,
745
+ element: w,
746
+ allowedEdges: ["left", "right"]
747
+ });
748
+ },
749
+ canDrop({ source: s }) {
750
+ return B(s.data) || L(s.data);
751
+ },
752
+ getIsSticky: () => !0,
753
+ onDragStart({ source: s, location: w }) {
754
+ B(s.data) && k({ data: s.data, location: w });
755
+ },
756
+ onDragEnter({ source: s, location: w, self: v }) {
757
+ if (B(s.data)) {
758
+ k({ data: s.data, location: w });
759
+ return;
760
+ }
761
+ if (L(s.data) && s.data.columnId !== e.id) {
762
+ const N = $(v.data);
763
+ if (!N)
764
+ return;
765
+ const b = p.getBoundingClientRect();
766
+ g({ type: "is-column-over", closestEdge: N, rect: b });
767
+ }
768
+ },
769
+ onDrag({ source: s, self: w }) {
770
+ if (!L(s.data) || s.data.columnId === e.id)
771
+ return;
772
+ const v = $(w.data);
773
+ v && g((N) => {
774
+ if (N.type === "is-column-over" && N.closestEdge === v)
775
+ return N;
776
+ const b = p.getBoundingClientRect();
777
+ return { type: "is-column-over", closestEdge: v, rect: b };
778
+ });
779
+ },
780
+ onDropTargetChange({ source: s, location: w }) {
781
+ B(s.data) && k({ data: s.data, location: w });
782
+ },
783
+ onDragLeave({ source: s }) {
784
+ if (L(s.data) && s.data.columnId === e.id) {
785
+ g({ type: "is-dragging-and-left-self" });
786
+ return;
787
+ }
788
+ g(W);
789
+ },
790
+ onDrop() {
791
+ g(W);
792
+ }
793
+ }),
794
+ me({
795
+ canScroll({ source: s }) {
796
+ return B(s.data);
797
+ },
798
+ getConfiguration: () => ({ maxScrollSpeed: "standard" }),
799
+ element: c
800
+ })
801
+ );
802
+ }, [e, r, t?.length, d, a]), F(() => {
803
+ n?.({ state: f, column: e });
804
+ }, [f, n]), {
805
+ headerRef: y,
806
+ outerFullHeightRef: h,
807
+ innerRef: i,
808
+ state: f,
809
+ cardOverShadowCount: x,
810
+ totalTasksCount: u
811
+ };
812
+ }, Ve = ie(
813
+ ({
814
+ width: e,
815
+ height: r,
816
+ customIndicator: t
817
+ }) => /* @__PURE__ */ m("div", { className: I("column-shadow-container"), children: t || /* @__PURE__ */ m(
818
+ "div",
819
+ {
820
+ className: I("column-shadow"),
821
+ style: { width: e, height: r }
822
+ }
823
+ ) })
824
+ ), Ke = (e) => {
825
+ const {
826
+ index: r,
827
+ data: t,
828
+ items: n,
829
+ onColumnClick: o,
830
+ renderColumnHeader: a,
831
+ renderColumnWrapper: l,
832
+ renderColumnFooter: d,
833
+ columnWrapperStyle: y,
834
+ columnHeaderStyle: h,
835
+ onColumnDndStateChange: i,
836
+ columnWrapperClassName: f,
837
+ columnHeaderClassName: g,
838
+ columnListContentClassName: x,
839
+ columnClassName: u,
840
+ columnStyle: k,
841
+ renderColumnDragPreview: p,
842
+ renderColumnDragIndicator: S,
843
+ allowColumnDrag: D,
844
+ ...c
845
+ } = e, {
846
+ headerRef: C,
847
+ outerFullHeightRef: s,
848
+ innerRef: w,
849
+ state: v,
850
+ cardOverShadowCount: N
851
+ } = We(
852
+ t,
853
+ r,
854
+ n,
855
+ i,
856
+ D,
857
+ !!p
858
+ ), b = v.type === "is-dragging" || v.type === "preview", A = v.type === "is-dragging-and-left-self", P = v.type === "is-column-over", U = P ? v.closestEdge : null, X = V(() => {
859
+ if (!P)
860
+ return null;
861
+ const { width: O, height: ee } = v.rect, he = v.closestEdge === "left" ? "left" : "right", Ce = S?.(t, { width: O, height: ee, edge: he });
862
+ return /* @__PURE__ */ m(
863
+ Ve,
864
+ {
865
+ width: O,
866
+ height: ee,
867
+ customIndicator: Ce
868
+ }
869
+ );
870
+ }, [P, v, S, t]), Y = V(() => v.type !== "preview" || !p ? null : p(t, {
871
+ state: v,
872
+ data: t,
873
+ index: r,
874
+ isDraggable: t.isDraggable !== !1
875
+ }), [v, t, r, p]), Z = H(
876
+ I("column-outer"),
877
+ f?.(t)
878
+ );
879
+ return /* @__PURE__ */ T(ae, { children: [
880
+ U === "left" && X,
881
+ /* @__PURE__ */ T("div", { onClick: (O) => o?.(O, t), style: A ? { display: "none" } : b ? { opacity: 0.4 } : void 0, children: [
882
+ ((O) => l ? l(t, {
883
+ children: O,
884
+ className: Z,
885
+ style: y?.(t),
886
+ ref: s
887
+ }) : /* @__PURE__ */ m(
888
+ "div",
889
+ {
890
+ className: Z,
891
+ ref: s,
892
+ style: y?.(t),
893
+ children: O
894
+ }
895
+ ))(
896
+ /* @__PURE__ */ m(
897
+ "div",
898
+ {
899
+ className: H(
900
+ I("column"),
901
+ u?.(t)
902
+ ),
903
+ ref: w,
904
+ style: k?.(t),
905
+ children: /* @__PURE__ */ T("div", { className: I("column-wrapper"), children: [
906
+ /* @__PURE__ */ m(
907
+ be,
908
+ {
909
+ renderColumnHeader: a,
910
+ columnHeaderStyle: h,
911
+ columnHeaderClassName: g?.(t),
912
+ data: t,
913
+ ref: C
914
+ }
915
+ ),
916
+ /* @__PURE__ */ m(
917
+ Le,
918
+ {
919
+ items: n,
920
+ column: t,
921
+ columnListContentClassName: x?.(t),
922
+ cardOverHeight: N ? v.dragging.height : null,
923
+ cardOverShadowCount: N,
924
+ ...c
925
+ }
926
+ ),
927
+ d?.(t)
928
+ ] })
929
+ }
930
+ )
931
+ ),
932
+ v.type === "preview" && Y && le(Y, v.container)
933
+ ] }),
934
+ U === "right" && X
935
+ ] });
936
+ }, re = (e) => !e || typeof e == "function" ? e : (r) => {
937
+ e.current = r;
938
+ };
939
+ function ze(e, r) {
940
+ const t = re(e), n = re(r);
941
+ return (o) => {
942
+ typeof t == "function" && t(o), typeof n == "function" && n(o);
943
+ };
944
+ }
945
+ const Me = (e) => {
946
+ const {
947
+ viewOnly: r = !1,
948
+ virtualization: t = !0,
949
+ cardsGap: n = 8,
950
+ allowColumnAdder: o = !0,
951
+ allowListFooter: a
952
+ } = e;
953
+ return {
954
+ viewOnly: r,
955
+ virtualization: t,
956
+ cardsGap: n,
957
+ allowColumnAdder: o,
958
+ allowListFooter: a
959
+ };
960
+ }, je = ({ renderColumnAdder: e }) => {
961
+ const { allowColumnAdder: r = !0 } = K();
962
+ return r ? /* @__PURE__ */ m("div", { className: I("column-adder"), children: e?.() }) : null;
963
+ }, dt = J((e, r) => {
964
+ const {
965
+ dataSource: t,
966
+ rootStyle: n = {},
967
+ rootClassName: o,
968
+ onColumnMove: a,
969
+ onCardMove: l,
970
+ renderColumnWrapper: d,
971
+ renderColumnAdder: y,
972
+ allowColumnDrag: h,
973
+ ...i
974
+ } = e, f = xe(t), g = R(null);
975
+ F(() => {
976
+ if (g.current)
977
+ return Q(
978
+ ke({
979
+ onDragStart({ location: u }) {
980
+ M.start({ input: u.current.input });
981
+ },
982
+ onDrag({ location: u }) {
983
+ M.updateInput({ input: u.current.input });
984
+ },
985
+ onDrop(u) {
986
+ M.stop(), Se({
987
+ source: {
988
+ id: u.source.id || "",
989
+ data: u.source.data
990
+ },
991
+ location: {
992
+ current: {
993
+ dropTargets: u.location.current.dropTargets
994
+ }
995
+ },
996
+ columns: f,
997
+ dataSource: t,
998
+ onCardMove: l,
999
+ onColumnMove: a
1000
+ });
1001
+ }
1002
+ }),
1003
+ me({
1004
+ element: g.current,
1005
+ canScroll: () => !0,
1006
+ getConfiguration: () => ({
1007
+ maxScrollSpeed: "standard"
1008
+ })
1009
+ })
1010
+ );
1011
+ }, [f, t, l, a]);
1012
+ const x = H(I("board"), o);
1013
+ return /* @__PURE__ */ m(Te, { ...Me(e), children: /* @__PURE__ */ T(
1014
+ "div",
1015
+ {
1016
+ ref: ze(r, g),
1017
+ className: x,
1018
+ style: n,
1019
+ children: [
1020
+ f?.map((u, k) => /* @__PURE__ */ m(
1021
+ Ke,
1022
+ {
1023
+ index: k,
1024
+ data: u,
1025
+ items: Ne(u, t),
1026
+ renderColumnWrapper: d,
1027
+ allowColumnDrag: h,
1028
+ ...i
1029
+ },
1030
+ u.id
1031
+ )),
1032
+ /* @__PURE__ */ m(je, { renderColumnAdder: y })
1033
+ ]
1034
+ }
1035
+ ) });
1036
+ });
1037
+ export {
1038
+ dt as Kanban,
1039
+ it as dropColumnHandler,
1040
+ lt as dropHandler
1041
+ };