@object-ui/plugin-kanban 0.3.0 → 0.5.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.
- package/.turbo/turbo-build.log +20 -0
- package/CHANGELOG.md +11 -0
- package/dist/KanbanEnhanced-BqDEu7Z6.js +894 -0
- package/dist/KanbanImpl-B8nu2BvG.js +144 -0
- package/dist/index-CrR06na7.js +562 -0
- package/dist/index.d.ts +2 -22
- package/dist/index.js +6 -3
- package/dist/index.umd.cjs +6 -11
- package/dist/{KanbanImpl-mGLdSHcd.js → sortable.esm-ZHwgFQIO.js} +1053 -1183
- package/dist/src/KanbanEnhanced.d.ts +36 -0
- package/dist/src/KanbanEnhanced.d.ts.map +1 -0
- package/dist/{KanbanImpl.d.ts → src/KanbanImpl.d.ts} +7 -0
- package/dist/src/KanbanImpl.d.ts.map +1 -0
- package/dist/src/ObjectKanban.d.ts +10 -0
- package/dist/src/ObjectKanban.d.ts.map +1 -0
- package/dist/src/index.d.ts +31 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/{types.d.ts → src/types.d.ts} +20 -0
- package/dist/src/types.d.ts.map +1 -0
- package/package.json +22 -9
- package/src/KanbanEnhanced.tsx +394 -0
- package/src/KanbanImpl.tsx +8 -0
- package/src/ObjectKanban.msw.test.tsx +91 -0
- package/src/ObjectKanban.tsx +188 -0
- package/src/__tests__/KanbanEnhanced.test.tsx +259 -0
- package/src/index.test.ts +9 -1
- package/src/index.tsx +93 -2
- package/src/registration.test.tsx +26 -0
- package/src/types.ts +33 -0
- package/tsconfig.json +12 -4
- package/vite.config.ts +23 -0
- package/vitest.config.ts +12 -0
- package/vitest.setup.ts +1 -0
- package/dist/KanbanImpl.d.ts.map +0 -1
- package/dist/index-i_5clVsp.js +0 -746
- package/dist/index.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
|
@@ -0,0 +1,894 @@
|
|
|
1
|
+
import { j as h } from "./index-CrR06na7.js";
|
|
2
|
+
import * as C from "react";
|
|
3
|
+
import { forwardRef as K, createElement as R } from "react";
|
|
4
|
+
import { flushSync as J } from "react-dom";
|
|
5
|
+
import { u as Q, a as X, P as ee, D as te, c as se, b as ne, d as ie, e as Z, S as re, v as oe, C as le } from "./sortable.esm-ZHwgFQIO.js";
|
|
6
|
+
import { Button as ae, Badge as F, Card as ce, CardHeader as he, CardTitle as de, CardDescription as ue, CardContent as fe } from "@object-ui/components";
|
|
7
|
+
function N(n, l, e) {
|
|
8
|
+
let s = e.initialDeps ?? [], t, i = !0;
|
|
9
|
+
function o() {
|
|
10
|
+
var r, a, c;
|
|
11
|
+
let d;
|
|
12
|
+
e.key && ((r = e.debug) != null && r.call(e)) && (d = Date.now());
|
|
13
|
+
const v = n();
|
|
14
|
+
if (!(v.length !== s.length || v.some((w, p) => s[p] !== w)))
|
|
15
|
+
return t;
|
|
16
|
+
s = v;
|
|
17
|
+
let b;
|
|
18
|
+
if (e.key && ((a = e.debug) != null && a.call(e)) && (b = Date.now()), t = l(...v), e.key && ((c = e.debug) != null && c.call(e))) {
|
|
19
|
+
const w = Math.round((Date.now() - d) * 100) / 100, p = Math.round((Date.now() - b) * 100) / 100, y = p / 16, E = (f, g) => {
|
|
20
|
+
for (f = String(f); f.length < g; )
|
|
21
|
+
f = " " + f;
|
|
22
|
+
return f;
|
|
23
|
+
};
|
|
24
|
+
console.info(
|
|
25
|
+
`%c⏱ ${E(p, 5)} /${E(w, 5)} ms`,
|
|
26
|
+
`
|
|
27
|
+
font-size: .6rem;
|
|
28
|
+
font-weight: bold;
|
|
29
|
+
color: hsl(${Math.max(
|
|
30
|
+
0,
|
|
31
|
+
Math.min(120 - 120 * y, 120)
|
|
32
|
+
)}deg 100% 31%);`,
|
|
33
|
+
e?.key
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
return e?.onChange && !(i && e.skipInitialOnChange) && e.onChange(t), i = !1, t;
|
|
37
|
+
}
|
|
38
|
+
return o.updateDeps = (r) => {
|
|
39
|
+
s = r;
|
|
40
|
+
}, o;
|
|
41
|
+
}
|
|
42
|
+
function B(n, l) {
|
|
43
|
+
if (n === void 0)
|
|
44
|
+
throw new Error("Unexpected undefined");
|
|
45
|
+
return n;
|
|
46
|
+
}
|
|
47
|
+
const me = (n, l) => Math.abs(n - l) < 1.01, ge = (n, l, e) => {
|
|
48
|
+
let s;
|
|
49
|
+
return function(...t) {
|
|
50
|
+
n.clearTimeout(s), s = n.setTimeout(() => l.apply(this, t), e);
|
|
51
|
+
};
|
|
52
|
+
}, $ = (n) => {
|
|
53
|
+
const { offsetWidth: l, offsetHeight: e } = n;
|
|
54
|
+
return { width: l, height: e };
|
|
55
|
+
}, pe = (n) => n, ve = (n) => {
|
|
56
|
+
const l = Math.max(n.startIndex - n.overscan, 0), e = Math.min(n.endIndex + n.overscan, n.count - 1), s = [];
|
|
57
|
+
for (let t = l; t <= e; t++)
|
|
58
|
+
s.push(t);
|
|
59
|
+
return s;
|
|
60
|
+
}, xe = (n, l) => {
|
|
61
|
+
const e = n.scrollElement;
|
|
62
|
+
if (!e)
|
|
63
|
+
return;
|
|
64
|
+
const s = n.targetWindow;
|
|
65
|
+
if (!s)
|
|
66
|
+
return;
|
|
67
|
+
const t = (o) => {
|
|
68
|
+
const { width: r, height: a } = o;
|
|
69
|
+
l({ width: Math.round(r), height: Math.round(a) });
|
|
70
|
+
};
|
|
71
|
+
if (t($(e)), !s.ResizeObserver)
|
|
72
|
+
return () => {
|
|
73
|
+
};
|
|
74
|
+
const i = new s.ResizeObserver((o) => {
|
|
75
|
+
const r = () => {
|
|
76
|
+
const a = o[0];
|
|
77
|
+
if (a?.borderBoxSize) {
|
|
78
|
+
const c = a.borderBoxSize[0];
|
|
79
|
+
if (c) {
|
|
80
|
+
t({ width: c.inlineSize, height: c.blockSize });
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
t($(e));
|
|
85
|
+
};
|
|
86
|
+
n.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(r) : r();
|
|
87
|
+
});
|
|
88
|
+
return i.observe(e, { box: "border-box" }), () => {
|
|
89
|
+
i.unobserve(e);
|
|
90
|
+
};
|
|
91
|
+
}, P = {
|
|
92
|
+
passive: !0
|
|
93
|
+
}, H = typeof window > "u" ? !0 : "onscrollend" in window, be = (n, l) => {
|
|
94
|
+
const e = n.scrollElement;
|
|
95
|
+
if (!e)
|
|
96
|
+
return;
|
|
97
|
+
const s = n.targetWindow;
|
|
98
|
+
if (!s)
|
|
99
|
+
return;
|
|
100
|
+
let t = 0;
|
|
101
|
+
const i = n.options.useScrollendEvent && H ? () => {
|
|
102
|
+
} : ge(
|
|
103
|
+
s,
|
|
104
|
+
() => {
|
|
105
|
+
l(t, !1);
|
|
106
|
+
},
|
|
107
|
+
n.options.isScrollingResetDelay
|
|
108
|
+
), o = (d) => () => {
|
|
109
|
+
const { horizontal: v, isRtl: u } = n.options;
|
|
110
|
+
t = v ? e.scrollLeft * (u && -1 || 1) : e.scrollTop, i(), l(t, d);
|
|
111
|
+
}, r = o(!0), a = o(!1);
|
|
112
|
+
e.addEventListener("scroll", r, P);
|
|
113
|
+
const c = n.options.useScrollendEvent && H;
|
|
114
|
+
return c && e.addEventListener("scrollend", a, P), () => {
|
|
115
|
+
e.removeEventListener("scroll", r), c && e.removeEventListener("scrollend", a);
|
|
116
|
+
};
|
|
117
|
+
}, Ce = (n, l, e) => {
|
|
118
|
+
if (l?.borderBoxSize) {
|
|
119
|
+
const s = l.borderBoxSize[0];
|
|
120
|
+
if (s)
|
|
121
|
+
return Math.round(
|
|
122
|
+
s[e.options.horizontal ? "inlineSize" : "blockSize"]
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
return n[e.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
126
|
+
}, we = (n, {
|
|
127
|
+
adjustments: l = 0,
|
|
128
|
+
behavior: e
|
|
129
|
+
}, s) => {
|
|
130
|
+
var t, i;
|
|
131
|
+
const o = n + l;
|
|
132
|
+
(i = (t = s.scrollElement) == null ? void 0 : t.scrollTo) == null || i.call(t, {
|
|
133
|
+
[s.options.horizontal ? "left" : "top"]: o,
|
|
134
|
+
behavior: e
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
class ye {
|
|
138
|
+
constructor(l) {
|
|
139
|
+
this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.currentScrollToIndex = null, this.measurementsCache = [], this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMeasuredCacheIndexes = [], this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this.elementsCache = /* @__PURE__ */ new Map(), this.observer = /* @__PURE__ */ (() => {
|
|
140
|
+
let e = null;
|
|
141
|
+
const s = () => e || (!this.targetWindow || !this.targetWindow.ResizeObserver ? null : e = new this.targetWindow.ResizeObserver((t) => {
|
|
142
|
+
t.forEach((i) => {
|
|
143
|
+
const o = () => {
|
|
144
|
+
this._measureElement(i.target, i);
|
|
145
|
+
};
|
|
146
|
+
this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(o) : o();
|
|
147
|
+
});
|
|
148
|
+
}));
|
|
149
|
+
return {
|
|
150
|
+
disconnect: () => {
|
|
151
|
+
var t;
|
|
152
|
+
(t = s()) == null || t.disconnect(), e = null;
|
|
153
|
+
},
|
|
154
|
+
observe: (t) => {
|
|
155
|
+
var i;
|
|
156
|
+
return (i = s()) == null ? void 0 : i.observe(t, { box: "border-box" });
|
|
157
|
+
},
|
|
158
|
+
unobserve: (t) => {
|
|
159
|
+
var i;
|
|
160
|
+
return (i = s()) == null ? void 0 : i.unobserve(t);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
})(), this.range = null, this.setOptions = (e) => {
|
|
164
|
+
Object.entries(e).forEach(([s, t]) => {
|
|
165
|
+
typeof t > "u" && delete e[s];
|
|
166
|
+
}), this.options = {
|
|
167
|
+
debug: !1,
|
|
168
|
+
initialOffset: 0,
|
|
169
|
+
overscan: 1,
|
|
170
|
+
paddingStart: 0,
|
|
171
|
+
paddingEnd: 0,
|
|
172
|
+
scrollPaddingStart: 0,
|
|
173
|
+
scrollPaddingEnd: 0,
|
|
174
|
+
horizontal: !1,
|
|
175
|
+
getItemKey: pe,
|
|
176
|
+
rangeExtractor: ve,
|
|
177
|
+
onChange: () => {
|
|
178
|
+
},
|
|
179
|
+
measureElement: Ce,
|
|
180
|
+
initialRect: { width: 0, height: 0 },
|
|
181
|
+
scrollMargin: 0,
|
|
182
|
+
gap: 0,
|
|
183
|
+
indexAttribute: "data-index",
|
|
184
|
+
initialMeasurementsCache: [],
|
|
185
|
+
lanes: 1,
|
|
186
|
+
isScrollingResetDelay: 150,
|
|
187
|
+
enabled: !0,
|
|
188
|
+
isRtl: !1,
|
|
189
|
+
useScrollendEvent: !1,
|
|
190
|
+
useAnimationFrameWithResizeObserver: !1,
|
|
191
|
+
...e
|
|
192
|
+
};
|
|
193
|
+
}, this.notify = (e) => {
|
|
194
|
+
var s, t;
|
|
195
|
+
(t = (s = this.options).onChange) == null || t.call(s, this, e);
|
|
196
|
+
}, this.maybeNotify = N(
|
|
197
|
+
() => (this.calculateRange(), [
|
|
198
|
+
this.isScrolling,
|
|
199
|
+
this.range ? this.range.startIndex : null,
|
|
200
|
+
this.range ? this.range.endIndex : null
|
|
201
|
+
]),
|
|
202
|
+
(e) => {
|
|
203
|
+
this.notify(e);
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
key: process.env.NODE_ENV !== "production" && "maybeNotify",
|
|
207
|
+
debug: () => this.options.debug,
|
|
208
|
+
initialDeps: [
|
|
209
|
+
this.isScrolling,
|
|
210
|
+
this.range ? this.range.startIndex : null,
|
|
211
|
+
this.range ? this.range.endIndex : null
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
), this.cleanup = () => {
|
|
215
|
+
this.unsubs.filter(Boolean).forEach((e) => e()), this.unsubs = [], this.observer.disconnect(), this.scrollElement = null, this.targetWindow = null;
|
|
216
|
+
}, this._didMount = () => () => {
|
|
217
|
+
this.cleanup();
|
|
218
|
+
}, this._willUpdate = () => {
|
|
219
|
+
var e;
|
|
220
|
+
const s = this.options.enabled ? this.options.getScrollElement() : null;
|
|
221
|
+
if (this.scrollElement !== s) {
|
|
222
|
+
if (this.cleanup(), !s) {
|
|
223
|
+
this.maybeNotify();
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
this.scrollElement = s, this.scrollElement && "ownerDocument" in this.scrollElement ? this.targetWindow = this.scrollElement.ownerDocument.defaultView : this.targetWindow = ((e = this.scrollElement) == null ? void 0 : e.window) ?? null, this.elementsCache.forEach((t) => {
|
|
227
|
+
this.observer.observe(t);
|
|
228
|
+
}), this.unsubs.push(
|
|
229
|
+
this.options.observeElementRect(this, (t) => {
|
|
230
|
+
this.scrollRect = t, this.maybeNotify();
|
|
231
|
+
})
|
|
232
|
+
), this.unsubs.push(
|
|
233
|
+
this.options.observeElementOffset(this, (t, i) => {
|
|
234
|
+
this.scrollAdjustments = 0, this.scrollDirection = i ? this.getScrollOffset() < t ? "forward" : "backward" : null, this.scrollOffset = t, this.isScrolling = i, this.maybeNotify();
|
|
235
|
+
})
|
|
236
|
+
), this._scrollToOffset(this.getScrollOffset(), {
|
|
237
|
+
adjustments: void 0,
|
|
238
|
+
behavior: void 0
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getFurthestMeasurement = (e, s) => {
|
|
242
|
+
const t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
243
|
+
for (let o = s - 1; o >= 0; o--) {
|
|
244
|
+
const r = e[o];
|
|
245
|
+
if (t.has(r.lane))
|
|
246
|
+
continue;
|
|
247
|
+
const a = i.get(
|
|
248
|
+
r.lane
|
|
249
|
+
);
|
|
250
|
+
if (a == null || r.end > a.end ? i.set(r.lane, r) : r.end < a.end && t.set(r.lane, !0), t.size === this.options.lanes)
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
return i.size === this.options.lanes ? Array.from(i.values()).sort((o, r) => o.end === r.end ? o.index - r.index : o.end - r.end)[0] : void 0;
|
|
254
|
+
}, this.getMeasurementOptions = N(
|
|
255
|
+
() => [
|
|
256
|
+
this.options.count,
|
|
257
|
+
this.options.paddingStart,
|
|
258
|
+
this.options.scrollMargin,
|
|
259
|
+
this.options.getItemKey,
|
|
260
|
+
this.options.enabled,
|
|
261
|
+
this.options.lanes
|
|
262
|
+
],
|
|
263
|
+
(e, s, t, i, o, r) => (this.prevLanes !== void 0 && this.prevLanes !== r && (this.lanesChangedFlag = !0), this.prevLanes = r, this.pendingMeasuredCacheIndexes = [], {
|
|
264
|
+
count: e,
|
|
265
|
+
paddingStart: s,
|
|
266
|
+
scrollMargin: t,
|
|
267
|
+
getItemKey: i,
|
|
268
|
+
enabled: o,
|
|
269
|
+
lanes: r
|
|
270
|
+
}),
|
|
271
|
+
{
|
|
272
|
+
key: !1
|
|
273
|
+
}
|
|
274
|
+
), this.getMeasurements = N(
|
|
275
|
+
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
|
276
|
+
({ count: e, paddingStart: s, scrollMargin: t, getItemKey: i, enabled: o, lanes: r }, a) => {
|
|
277
|
+
if (!o)
|
|
278
|
+
return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
|
|
279
|
+
if (this.laneAssignments.size > e)
|
|
280
|
+
for (const u of this.laneAssignments.keys())
|
|
281
|
+
u >= e && this.laneAssignments.delete(u);
|
|
282
|
+
this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMeasuredCacheIndexes = []), this.measurementsCache.length === 0 && !this.lanesSettling && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((u) => {
|
|
283
|
+
this.itemSizeCache.set(u.key, u.size);
|
|
284
|
+
}));
|
|
285
|
+
const c = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
286
|
+
this.pendingMeasuredCacheIndexes = [], this.lanesSettling && this.measurementsCache.length === e && (this.lanesSettling = !1);
|
|
287
|
+
const d = this.measurementsCache.slice(0, c), v = new Array(r).fill(
|
|
288
|
+
void 0
|
|
289
|
+
);
|
|
290
|
+
for (let u = 0; u < c; u++) {
|
|
291
|
+
const b = d[u];
|
|
292
|
+
b && (v[b.lane] = u);
|
|
293
|
+
}
|
|
294
|
+
for (let u = c; u < e; u++) {
|
|
295
|
+
const b = i(u), w = this.laneAssignments.get(u);
|
|
296
|
+
let p, y;
|
|
297
|
+
if (w !== void 0 && this.options.lanes > 1) {
|
|
298
|
+
p = w;
|
|
299
|
+
const m = v[p], x = m !== void 0 ? d[m] : void 0;
|
|
300
|
+
y = x ? x.end + this.options.gap : s + t;
|
|
301
|
+
} else {
|
|
302
|
+
const m = this.options.lanes === 1 ? d[u - 1] : this.getFurthestMeasurement(d, u);
|
|
303
|
+
y = m ? m.end + this.options.gap : s + t, p = m ? m.lane : u % this.options.lanes, this.options.lanes > 1 && this.laneAssignments.set(u, p);
|
|
304
|
+
}
|
|
305
|
+
const E = a.get(b), f = typeof E == "number" ? E : this.options.estimateSize(u), g = y + f;
|
|
306
|
+
d[u] = {
|
|
307
|
+
index: u,
|
|
308
|
+
start: y,
|
|
309
|
+
size: f,
|
|
310
|
+
end: g,
|
|
311
|
+
key: b,
|
|
312
|
+
lane: p
|
|
313
|
+
}, v[p] = u;
|
|
314
|
+
}
|
|
315
|
+
return this.measurementsCache = d, d;
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
key: process.env.NODE_ENV !== "production" && "getMeasurements",
|
|
319
|
+
debug: () => this.options.debug
|
|
320
|
+
}
|
|
321
|
+
), this.calculateRange = N(
|
|
322
|
+
() => [
|
|
323
|
+
this.getMeasurements(),
|
|
324
|
+
this.getSize(),
|
|
325
|
+
this.getScrollOffset(),
|
|
326
|
+
this.options.lanes
|
|
327
|
+
],
|
|
328
|
+
(e, s, t, i) => this.range = e.length > 0 && s > 0 ? Se({
|
|
329
|
+
measurements: e,
|
|
330
|
+
outerSize: s,
|
|
331
|
+
scrollOffset: t,
|
|
332
|
+
lanes: i
|
|
333
|
+
}) : null,
|
|
334
|
+
{
|
|
335
|
+
key: process.env.NODE_ENV !== "production" && "calculateRange",
|
|
336
|
+
debug: () => this.options.debug
|
|
337
|
+
}
|
|
338
|
+
), this.getVirtualIndexes = N(
|
|
339
|
+
() => {
|
|
340
|
+
let e = null, s = null;
|
|
341
|
+
const t = this.calculateRange();
|
|
342
|
+
return t && (e = t.startIndex, s = t.endIndex), this.maybeNotify.updateDeps([this.isScrolling, e, s]), [
|
|
343
|
+
this.options.rangeExtractor,
|
|
344
|
+
this.options.overscan,
|
|
345
|
+
this.options.count,
|
|
346
|
+
e,
|
|
347
|
+
s
|
|
348
|
+
];
|
|
349
|
+
},
|
|
350
|
+
(e, s, t, i, o) => i === null || o === null ? [] : e({
|
|
351
|
+
startIndex: i,
|
|
352
|
+
endIndex: o,
|
|
353
|
+
overscan: s,
|
|
354
|
+
count: t
|
|
355
|
+
}),
|
|
356
|
+
{
|
|
357
|
+
key: process.env.NODE_ENV !== "production" && "getVirtualIndexes",
|
|
358
|
+
debug: () => this.options.debug
|
|
359
|
+
}
|
|
360
|
+
), this.indexFromElement = (e) => {
|
|
361
|
+
const s = this.options.indexAttribute, t = e.getAttribute(s);
|
|
362
|
+
return t ? parseInt(t, 10) : (console.warn(
|
|
363
|
+
`Missing attribute name '${s}={index}' on measured element.`
|
|
364
|
+
), -1);
|
|
365
|
+
}, this._measureElement = (e, s) => {
|
|
366
|
+
const t = this.indexFromElement(e), i = this.measurementsCache[t];
|
|
367
|
+
if (!i)
|
|
368
|
+
return;
|
|
369
|
+
const o = i.key, r = this.elementsCache.get(o);
|
|
370
|
+
r !== e && (r && this.observer.unobserve(r), this.observer.observe(e), this.elementsCache.set(o, e)), e.isConnected && this.resizeItem(t, this.options.measureElement(e, s, this));
|
|
371
|
+
}, this.resizeItem = (e, s) => {
|
|
372
|
+
const t = this.measurementsCache[e];
|
|
373
|
+
if (!t)
|
|
374
|
+
return;
|
|
375
|
+
const i = this.itemSizeCache.get(t.key) ?? t.size, o = s - i;
|
|
376
|
+
o !== 0 && ((this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(t, o, this) : t.start < this.getScrollOffset() + this.scrollAdjustments) && (process.env.NODE_ENV !== "production" && this.options.debug && console.info("correction", o), this._scrollToOffset(this.getScrollOffset(), {
|
|
377
|
+
adjustments: this.scrollAdjustments += o,
|
|
378
|
+
behavior: void 0
|
|
379
|
+
})), this.pendingMeasuredCacheIndexes.push(t.index), this.itemSizeCache = new Map(this.itemSizeCache.set(t.key, s)), this.notify(!1));
|
|
380
|
+
}, this.measureElement = (e) => {
|
|
381
|
+
if (!e) {
|
|
382
|
+
this.elementsCache.forEach((s, t) => {
|
|
383
|
+
s.isConnected || (this.observer.unobserve(s), this.elementsCache.delete(t));
|
|
384
|
+
});
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
this._measureElement(e, void 0);
|
|
388
|
+
}, this.getVirtualItems = N(
|
|
389
|
+
() => [this.getVirtualIndexes(), this.getMeasurements()],
|
|
390
|
+
(e, s) => {
|
|
391
|
+
const t = [];
|
|
392
|
+
for (let i = 0, o = e.length; i < o; i++) {
|
|
393
|
+
const r = e[i], a = s[r];
|
|
394
|
+
t.push(a);
|
|
395
|
+
}
|
|
396
|
+
return t;
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
key: process.env.NODE_ENV !== "production" && "getVirtualItems",
|
|
400
|
+
debug: () => this.options.debug
|
|
401
|
+
}
|
|
402
|
+
), this.getVirtualItemForOffset = (e) => {
|
|
403
|
+
const s = this.getMeasurements();
|
|
404
|
+
if (s.length !== 0)
|
|
405
|
+
return B(
|
|
406
|
+
s[Y(
|
|
407
|
+
0,
|
|
408
|
+
s.length - 1,
|
|
409
|
+
(t) => B(s[t]).start,
|
|
410
|
+
e
|
|
411
|
+
)]
|
|
412
|
+
);
|
|
413
|
+
}, this.getMaxScrollOffset = () => {
|
|
414
|
+
if (!this.scrollElement) return 0;
|
|
415
|
+
if ("scrollHeight" in this.scrollElement)
|
|
416
|
+
return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
|
|
417
|
+
{
|
|
418
|
+
const e = this.scrollElement.document.documentElement;
|
|
419
|
+
return this.options.horizontal ? e.scrollWidth - this.scrollElement.innerWidth : e.scrollHeight - this.scrollElement.innerHeight;
|
|
420
|
+
}
|
|
421
|
+
}, this.getOffsetForAlignment = (e, s, t = 0) => {
|
|
422
|
+
if (!this.scrollElement) return 0;
|
|
423
|
+
const i = this.getSize(), o = this.getScrollOffset();
|
|
424
|
+
s === "auto" && (s = e >= o + i ? "end" : "start"), s === "center" ? e += (t - i) / 2 : s === "end" && (e -= i);
|
|
425
|
+
const r = this.getMaxScrollOffset();
|
|
426
|
+
return Math.max(Math.min(r, e), 0);
|
|
427
|
+
}, this.getOffsetForIndex = (e, s = "auto") => {
|
|
428
|
+
e = Math.max(0, Math.min(e, this.options.count - 1));
|
|
429
|
+
const t = this.measurementsCache[e];
|
|
430
|
+
if (!t)
|
|
431
|
+
return;
|
|
432
|
+
const i = this.getSize(), o = this.getScrollOffset();
|
|
433
|
+
if (s === "auto")
|
|
434
|
+
if (t.end >= o + i - this.options.scrollPaddingEnd)
|
|
435
|
+
s = "end";
|
|
436
|
+
else if (t.start <= o + this.options.scrollPaddingStart)
|
|
437
|
+
s = "start";
|
|
438
|
+
else
|
|
439
|
+
return [o, s];
|
|
440
|
+
if (s === "end" && e === this.options.count - 1)
|
|
441
|
+
return [this.getMaxScrollOffset(), s];
|
|
442
|
+
const r = s === "end" ? t.end + this.options.scrollPaddingEnd : t.start - this.options.scrollPaddingStart;
|
|
443
|
+
return [
|
|
444
|
+
this.getOffsetForAlignment(r, s, t.size),
|
|
445
|
+
s
|
|
446
|
+
];
|
|
447
|
+
}, this.isDynamicMode = () => this.elementsCache.size > 0, this.scrollToOffset = (e, { align: s = "start", behavior: t } = {}) => {
|
|
448
|
+
t === "smooth" && this.isDynamicMode() && console.warn(
|
|
449
|
+
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
450
|
+
), this._scrollToOffset(this.getOffsetForAlignment(e, s), {
|
|
451
|
+
adjustments: void 0,
|
|
452
|
+
behavior: t
|
|
453
|
+
});
|
|
454
|
+
}, this.scrollToIndex = (e, { align: s = "auto", behavior: t } = {}) => {
|
|
455
|
+
t === "smooth" && this.isDynamicMode() && console.warn(
|
|
456
|
+
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
457
|
+
), e = Math.max(0, Math.min(e, this.options.count - 1)), this.currentScrollToIndex = e;
|
|
458
|
+
let i = 0;
|
|
459
|
+
const o = 10, r = (c) => {
|
|
460
|
+
if (!this.targetWindow) return;
|
|
461
|
+
const d = this.getOffsetForIndex(e, c);
|
|
462
|
+
if (!d) {
|
|
463
|
+
console.warn("Failed to get offset for index:", e);
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
const [v, u] = d;
|
|
467
|
+
this._scrollToOffset(v, { adjustments: void 0, behavior: t }), this.targetWindow.requestAnimationFrame(() => {
|
|
468
|
+
const b = () => {
|
|
469
|
+
if (this.currentScrollToIndex !== e) return;
|
|
470
|
+
const w = this.getScrollOffset(), p = this.getOffsetForIndex(e, u);
|
|
471
|
+
if (!p) {
|
|
472
|
+
console.warn("Failed to get offset for index:", e);
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
me(p[0], w) || a(u);
|
|
476
|
+
};
|
|
477
|
+
this.isDynamicMode() ? this.targetWindow.requestAnimationFrame(b) : b();
|
|
478
|
+
});
|
|
479
|
+
}, a = (c) => {
|
|
480
|
+
this.targetWindow && this.currentScrollToIndex === e && (i++, i < o ? (process.env.NODE_ENV !== "production" && this.options.debug && console.info("Schedule retry", i, o), this.targetWindow.requestAnimationFrame(() => r(c))) : console.warn(
|
|
481
|
+
`Failed to scroll to index ${e} after ${o} attempts.`
|
|
482
|
+
));
|
|
483
|
+
};
|
|
484
|
+
r(s);
|
|
485
|
+
}, this.scrollBy = (e, { behavior: s } = {}) => {
|
|
486
|
+
s === "smooth" && this.isDynamicMode() && console.warn(
|
|
487
|
+
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
488
|
+
), this._scrollToOffset(this.getScrollOffset() + e, {
|
|
489
|
+
adjustments: void 0,
|
|
490
|
+
behavior: s
|
|
491
|
+
});
|
|
492
|
+
}, this.getTotalSize = () => {
|
|
493
|
+
var e;
|
|
494
|
+
const s = this.getMeasurements();
|
|
495
|
+
let t;
|
|
496
|
+
if (s.length === 0)
|
|
497
|
+
t = this.options.paddingStart;
|
|
498
|
+
else if (this.options.lanes === 1)
|
|
499
|
+
t = ((e = s[s.length - 1]) == null ? void 0 : e.end) ?? 0;
|
|
500
|
+
else {
|
|
501
|
+
const i = Array(this.options.lanes).fill(null);
|
|
502
|
+
let o = s.length - 1;
|
|
503
|
+
for (; o >= 0 && i.some((r) => r === null); ) {
|
|
504
|
+
const r = s[o];
|
|
505
|
+
i[r.lane] === null && (i[r.lane] = r.end), o--;
|
|
506
|
+
}
|
|
507
|
+
t = Math.max(...i.filter((r) => r !== null));
|
|
508
|
+
}
|
|
509
|
+
return Math.max(
|
|
510
|
+
t - this.options.scrollMargin + this.options.paddingEnd,
|
|
511
|
+
0
|
|
512
|
+
);
|
|
513
|
+
}, this._scrollToOffset = (e, {
|
|
514
|
+
adjustments: s,
|
|
515
|
+
behavior: t
|
|
516
|
+
}) => {
|
|
517
|
+
this.options.scrollToFn(e, { behavior: t, adjustments: s }, this);
|
|
518
|
+
}, this.measure = () => {
|
|
519
|
+
this.itemSizeCache = /* @__PURE__ */ new Map(), this.laneAssignments = /* @__PURE__ */ new Map(), this.notify(!1);
|
|
520
|
+
}, this.setOptions(l);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
const Y = (n, l, e, s) => {
|
|
524
|
+
for (; n <= l; ) {
|
|
525
|
+
const t = (n + l) / 2 | 0, i = e(t);
|
|
526
|
+
if (i < s)
|
|
527
|
+
n = t + 1;
|
|
528
|
+
else if (i > s)
|
|
529
|
+
l = t - 1;
|
|
530
|
+
else
|
|
531
|
+
return t;
|
|
532
|
+
}
|
|
533
|
+
return n > 0 ? n - 1 : 0;
|
|
534
|
+
};
|
|
535
|
+
function Se({
|
|
536
|
+
measurements: n,
|
|
537
|
+
outerSize: l,
|
|
538
|
+
scrollOffset: e,
|
|
539
|
+
lanes: s
|
|
540
|
+
}) {
|
|
541
|
+
const t = n.length - 1, i = (a) => n[a].start;
|
|
542
|
+
if (n.length <= s)
|
|
543
|
+
return {
|
|
544
|
+
startIndex: 0,
|
|
545
|
+
endIndex: t
|
|
546
|
+
};
|
|
547
|
+
let o = Y(
|
|
548
|
+
0,
|
|
549
|
+
t,
|
|
550
|
+
i,
|
|
551
|
+
e
|
|
552
|
+
), r = o;
|
|
553
|
+
if (s === 1)
|
|
554
|
+
for (; r < t && n[r].end < e + l; )
|
|
555
|
+
r++;
|
|
556
|
+
else if (s > 1) {
|
|
557
|
+
const a = Array(s).fill(0);
|
|
558
|
+
for (; r < t && a.some((d) => d < e + l); ) {
|
|
559
|
+
const d = n[r];
|
|
560
|
+
a[d.lane] = d.end, r++;
|
|
561
|
+
}
|
|
562
|
+
const c = Array(s).fill(e + l);
|
|
563
|
+
for (; o >= 0 && c.some((d) => d >= e); ) {
|
|
564
|
+
const d = n[o];
|
|
565
|
+
c[d.lane] = d.start, o--;
|
|
566
|
+
}
|
|
567
|
+
o = Math.max(0, o - o % s), r = Math.min(t, r + (s - 1 - r % s));
|
|
568
|
+
}
|
|
569
|
+
return { startIndex: o, endIndex: r };
|
|
570
|
+
}
|
|
571
|
+
const q = typeof document < "u" ? C.useLayoutEffect : C.useEffect;
|
|
572
|
+
function Ee({
|
|
573
|
+
useFlushSync: n = !0,
|
|
574
|
+
...l
|
|
575
|
+
}) {
|
|
576
|
+
const e = C.useReducer(() => ({}), {})[1], s = {
|
|
577
|
+
...l,
|
|
578
|
+
onChange: (i, o) => {
|
|
579
|
+
var r;
|
|
580
|
+
n && o ? J(e) : e(), (r = l.onChange) == null || r.call(l, i, o);
|
|
581
|
+
}
|
|
582
|
+
}, [t] = C.useState(
|
|
583
|
+
() => new ye(s)
|
|
584
|
+
);
|
|
585
|
+
return t.setOptions(s), q(() => t._didMount(), []), q(() => t._willUpdate()), t;
|
|
586
|
+
}
|
|
587
|
+
function Me(n) {
|
|
588
|
+
return Ee({
|
|
589
|
+
observeElementRect: xe,
|
|
590
|
+
observeElementOffset: be,
|
|
591
|
+
scrollToFn: we,
|
|
592
|
+
...n
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
const G = (...n) => n.filter((l, e, s) => !!l && l.trim() !== "" && s.indexOf(l) === e).join(" ").trim();
|
|
596
|
+
const Oe = (n) => n.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
597
|
+
const ze = (n) => n.replace(
|
|
598
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
599
|
+
(l, e, s) => s ? s.toUpperCase() : e.toLowerCase()
|
|
600
|
+
);
|
|
601
|
+
const U = (n) => {
|
|
602
|
+
const l = ze(n);
|
|
603
|
+
return l.charAt(0).toUpperCase() + l.slice(1);
|
|
604
|
+
};
|
|
605
|
+
var Ie = {
|
|
606
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
607
|
+
width: 24,
|
|
608
|
+
height: 24,
|
|
609
|
+
viewBox: "0 0 24 24",
|
|
610
|
+
fill: "none",
|
|
611
|
+
stroke: "currentColor",
|
|
612
|
+
strokeWidth: 2,
|
|
613
|
+
strokeLinecap: "round",
|
|
614
|
+
strokeLinejoin: "round"
|
|
615
|
+
};
|
|
616
|
+
const je = (n) => {
|
|
617
|
+
for (const l in n)
|
|
618
|
+
if (l.startsWith("aria-") || l === "role" || l === "title")
|
|
619
|
+
return !0;
|
|
620
|
+
return !1;
|
|
621
|
+
};
|
|
622
|
+
const Ne = K(
|
|
623
|
+
({
|
|
624
|
+
color: n = "currentColor",
|
|
625
|
+
size: l = 24,
|
|
626
|
+
strokeWidth: e = 2,
|
|
627
|
+
absoluteStrokeWidth: s,
|
|
628
|
+
className: t = "",
|
|
629
|
+
children: i,
|
|
630
|
+
iconNode: o,
|
|
631
|
+
...r
|
|
632
|
+
}, a) => R(
|
|
633
|
+
"svg",
|
|
634
|
+
{
|
|
635
|
+
ref: a,
|
|
636
|
+
...Ie,
|
|
637
|
+
width: l,
|
|
638
|
+
height: l,
|
|
639
|
+
stroke: n,
|
|
640
|
+
strokeWidth: s ? Number(e) * 24 / Number(l) : e,
|
|
641
|
+
className: G("lucide", t),
|
|
642
|
+
...!i && !je(r) && { "aria-hidden": "true" },
|
|
643
|
+
...r
|
|
644
|
+
},
|
|
645
|
+
[
|
|
646
|
+
...o.map(([c, d]) => R(c, d)),
|
|
647
|
+
...Array.isArray(i) ? i : [i]
|
|
648
|
+
]
|
|
649
|
+
)
|
|
650
|
+
);
|
|
651
|
+
const L = (n, l) => {
|
|
652
|
+
const e = K(
|
|
653
|
+
({ className: s, ...t }, i) => R(Ne, {
|
|
654
|
+
ref: i,
|
|
655
|
+
iconNode: l,
|
|
656
|
+
className: G(
|
|
657
|
+
`lucide-${Oe(U(n))}`,
|
|
658
|
+
`lucide-${n}`,
|
|
659
|
+
s
|
|
660
|
+
),
|
|
661
|
+
...t
|
|
662
|
+
})
|
|
663
|
+
);
|
|
664
|
+
return e.displayName = U(n), e;
|
|
665
|
+
};
|
|
666
|
+
const Ae = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], ke = L("chevron-down", Ae);
|
|
667
|
+
const _e = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], De = L("chevron-right", _e);
|
|
668
|
+
const Re = [
|
|
669
|
+
[
|
|
670
|
+
"path",
|
|
671
|
+
{
|
|
672
|
+
d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
|
|
673
|
+
key: "wmoenq"
|
|
674
|
+
}
|
|
675
|
+
],
|
|
676
|
+
["path", { d: "M12 9v4", key: "juzpu7" }],
|
|
677
|
+
["path", { d: "M12 17h.01", key: "p32p05" }]
|
|
678
|
+
], Fe = L("triangle-alert", Re), T = (...n) => n.filter(Boolean).join(" ");
|
|
679
|
+
function W({ card: n }) {
|
|
680
|
+
const {
|
|
681
|
+
attributes: l,
|
|
682
|
+
listeners: e,
|
|
683
|
+
setNodeRef: s,
|
|
684
|
+
transform: t,
|
|
685
|
+
transition: i,
|
|
686
|
+
isDragging: o
|
|
687
|
+
} = Z({ id: n.id }), r = {
|
|
688
|
+
transform: le.Transform.toString(t),
|
|
689
|
+
transition: i,
|
|
690
|
+
opacity: o ? 0.5 : void 0
|
|
691
|
+
};
|
|
692
|
+
return /* @__PURE__ */ h.jsx("div", { ref: s, style: r, ...l, ...e, children: /* @__PURE__ */ h.jsxs(ce, { className: "mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group", children: [
|
|
693
|
+
/* @__PURE__ */ h.jsxs(he, { className: "p-4", children: [
|
|
694
|
+
/* @__PURE__ */ h.jsx(de, { className: "text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors", children: n.title }),
|
|
695
|
+
n.description && /* @__PURE__ */ h.jsx(ue, { className: "text-xs text-muted-foreground font-mono", children: n.description })
|
|
696
|
+
] }),
|
|
697
|
+
n.badges && n.badges.length > 0 && /* @__PURE__ */ h.jsx(fe, { className: "p-4 pt-0", children: /* @__PURE__ */ h.jsx("div", { className: "flex flex-wrap gap-1", children: n.badges.map((a, c) => /* @__PURE__ */ h.jsx(F, { variant: a.variant || "default", className: "text-xs", children: a.label }, c)) }) })
|
|
698
|
+
] }) });
|
|
699
|
+
}
|
|
700
|
+
function Te({ cards: n, parentRef: l }) {
|
|
701
|
+
const e = Me({
|
|
702
|
+
count: n.length,
|
|
703
|
+
getScrollElement: () => l.current,
|
|
704
|
+
estimateSize: () => 120,
|
|
705
|
+
overscan: 5
|
|
706
|
+
});
|
|
707
|
+
return /* @__PURE__ */ h.jsx(
|
|
708
|
+
"div",
|
|
709
|
+
{
|
|
710
|
+
style: {
|
|
711
|
+
height: `${e.getTotalSize()}px`,
|
|
712
|
+
width: "100%",
|
|
713
|
+
position: "relative"
|
|
714
|
+
},
|
|
715
|
+
children: e.getVirtualItems().map((s) => {
|
|
716
|
+
const t = n[s.index];
|
|
717
|
+
return /* @__PURE__ */ h.jsx(
|
|
718
|
+
"div",
|
|
719
|
+
{
|
|
720
|
+
style: {
|
|
721
|
+
position: "absolute",
|
|
722
|
+
top: 0,
|
|
723
|
+
left: 0,
|
|
724
|
+
width: "100%",
|
|
725
|
+
transform: `translateY(${s.start}px)`
|
|
726
|
+
},
|
|
727
|
+
children: /* @__PURE__ */ h.jsx(W, { card: t })
|
|
728
|
+
},
|
|
729
|
+
t.id
|
|
730
|
+
);
|
|
731
|
+
})
|
|
732
|
+
}
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
function Le({
|
|
736
|
+
column: n,
|
|
737
|
+
cards: l,
|
|
738
|
+
onToggle: e,
|
|
739
|
+
enableVirtual: s
|
|
740
|
+
}) {
|
|
741
|
+
const t = l || [], i = C.useRef(null), { setNodeRef: o } = Z({
|
|
742
|
+
id: n.id,
|
|
743
|
+
data: {
|
|
744
|
+
type: "column"
|
|
745
|
+
}
|
|
746
|
+
}), r = n.limit && t.length >= n.limit, a = n.limit && t.length >= n.limit * 0.8;
|
|
747
|
+
return /* @__PURE__ */ h.jsxs(
|
|
748
|
+
"div",
|
|
749
|
+
{
|
|
750
|
+
ref: o,
|
|
751
|
+
className: T(
|
|
752
|
+
"flex flex-col flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl transition-all",
|
|
753
|
+
n.collapsed ? "w-16" : "w-80",
|
|
754
|
+
n.className
|
|
755
|
+
),
|
|
756
|
+
children: [
|
|
757
|
+
/* @__PURE__ */ h.jsxs("div", { className: "p-4 border-b border-border/50 bg-muted/20 flex items-center justify-between", children: [
|
|
758
|
+
/* @__PURE__ */ h.jsxs("div", { className: "flex items-center gap-2 flex-1 min-w-0", children: [
|
|
759
|
+
/* @__PURE__ */ h.jsx(
|
|
760
|
+
ae,
|
|
761
|
+
{
|
|
762
|
+
variant: "ghost",
|
|
763
|
+
size: "sm",
|
|
764
|
+
className: "h-6 w-6 p-0",
|
|
765
|
+
onClick: () => e(!n.collapsed),
|
|
766
|
+
children: n.collapsed ? /* @__PURE__ */ h.jsx(De, { className: "h-4 w-4" }) : /* @__PURE__ */ h.jsx(ke, { className: "h-4 w-4" })
|
|
767
|
+
}
|
|
768
|
+
),
|
|
769
|
+
!n.collapsed && /* @__PURE__ */ h.jsxs(h.Fragment, { children: [
|
|
770
|
+
/* @__PURE__ */ h.jsx("h3", { className: "font-mono text-sm font-semibold tracking-wider text-primary/90 uppercase truncate", children: n.title }),
|
|
771
|
+
/* @__PURE__ */ h.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
772
|
+
/* @__PURE__ */ h.jsxs("span", { className: T(
|
|
773
|
+
"font-mono text-xs",
|
|
774
|
+
r ? "text-destructive" : a ? "text-yellow-500" : "text-muted-foreground"
|
|
775
|
+
), children: [
|
|
776
|
+
t.length,
|
|
777
|
+
n.limit && ` / ${n.limit}`
|
|
778
|
+
] }),
|
|
779
|
+
r && /* @__PURE__ */ h.jsx(F, { variant: "destructive", className: "text-xs", children: "Full" }),
|
|
780
|
+
a && !r && /* @__PURE__ */ h.jsx(Fe, { className: "h-3 w-3 text-yellow-500" })
|
|
781
|
+
] })
|
|
782
|
+
] })
|
|
783
|
+
] }),
|
|
784
|
+
n.collapsed && /* @__PURE__ */ h.jsxs("div", { className: "flex flex-col items-center gap-1", children: [
|
|
785
|
+
/* @__PURE__ */ h.jsx("span", { className: "font-mono text-xs font-bold text-primary/90 [writing-mode:vertical-rl] rotate-180", children: n.title }),
|
|
786
|
+
/* @__PURE__ */ h.jsx(F, { variant: "secondary", className: "text-xs", children: t.length })
|
|
787
|
+
] })
|
|
788
|
+
] }),
|
|
789
|
+
!n.collapsed && /* @__PURE__ */ h.jsx("div", { ref: i, className: "flex-1 p-4 overflow-y-auto", style: { maxHeight: "600px" }, children: /* @__PURE__ */ h.jsx(
|
|
790
|
+
re,
|
|
791
|
+
{
|
|
792
|
+
items: t.map((c) => c.id),
|
|
793
|
+
strategy: oe,
|
|
794
|
+
children: s ? /* @__PURE__ */ h.jsx(Te, { cards: t, parentRef: i }) : /* @__PURE__ */ h.jsx("div", { className: "space-y-2", children: t.map((c) => /* @__PURE__ */ h.jsx(W, { card: c }, c.id)) })
|
|
795
|
+
}
|
|
796
|
+
) })
|
|
797
|
+
]
|
|
798
|
+
}
|
|
799
|
+
);
|
|
800
|
+
}
|
|
801
|
+
function He({
|
|
802
|
+
columns: n,
|
|
803
|
+
onCardMove: l,
|
|
804
|
+
onColumnToggle: e,
|
|
805
|
+
enableVirtualScrolling: s = !1,
|
|
806
|
+
virtualScrollThreshold: t = 50,
|
|
807
|
+
className: i
|
|
808
|
+
}) {
|
|
809
|
+
const [o, r] = C.useState(null), a = C.useMemo(() => (n || []).map((f) => ({
|
|
810
|
+
...f,
|
|
811
|
+
cards: f.cards || []
|
|
812
|
+
})), [n]), [c, d] = C.useState(a);
|
|
813
|
+
C.useEffect(() => {
|
|
814
|
+
d(a);
|
|
815
|
+
}, [a]);
|
|
816
|
+
const v = Q(
|
|
817
|
+
X(ee, {
|
|
818
|
+
activationConstraint: {
|
|
819
|
+
distance: 8
|
|
820
|
+
}
|
|
821
|
+
})
|
|
822
|
+
), u = (f) => {
|
|
823
|
+
const { active: g } = f, m = w(g.id);
|
|
824
|
+
r(m);
|
|
825
|
+
}, b = (f) => {
|
|
826
|
+
const { active: g, over: m } = f;
|
|
827
|
+
if (r(null), !m) return;
|
|
828
|
+
const x = g.id, z = m.id;
|
|
829
|
+
if (x === z) return;
|
|
830
|
+
const M = p(x), I = p(z) || y(z);
|
|
831
|
+
if (!(!M || !I))
|
|
832
|
+
if (M.id === I.id) {
|
|
833
|
+
const O = [...M.cards], j = O.findIndex((S) => S.id === x), D = O.findIndex((S) => S.id === z), V = ie(O, j, D);
|
|
834
|
+
d(
|
|
835
|
+
(S) => S.map(
|
|
836
|
+
(A) => A.id === M.id ? { ...A, cards: V } : A
|
|
837
|
+
)
|
|
838
|
+
);
|
|
839
|
+
} else {
|
|
840
|
+
const O = [...M.cards], j = [...I.cards], D = O.findIndex((k) => k.id === x), S = z === I.id ? j.length : j.findIndex((k) => k.id === z), [A] = O.splice(D, 1);
|
|
841
|
+
j.splice(S, 0, A), d(
|
|
842
|
+
(k) => k.map((_) => _.id === M.id ? { ..._, cards: O } : _.id === I.id ? { ..._, cards: j } : _)
|
|
843
|
+
), l && l(x, M.id, I.id, S);
|
|
844
|
+
}
|
|
845
|
+
}, w = C.useCallback(
|
|
846
|
+
(f) => {
|
|
847
|
+
for (const g of c) {
|
|
848
|
+
const m = g.cards.find((x) => x.id === f);
|
|
849
|
+
if (m) return m;
|
|
850
|
+
}
|
|
851
|
+
return null;
|
|
852
|
+
},
|
|
853
|
+
[c]
|
|
854
|
+
), p = C.useCallback(
|
|
855
|
+
(f) => c.find((g) => g.cards.some((m) => m.id === f)) || null,
|
|
856
|
+
[c]
|
|
857
|
+
), y = C.useCallback(
|
|
858
|
+
(f) => c.find((g) => g.id === f) || null,
|
|
859
|
+
[c]
|
|
860
|
+
), E = C.useCallback((f, g) => {
|
|
861
|
+
d(
|
|
862
|
+
(m) => m.map((x) => x.id === f ? { ...x, collapsed: g } : x)
|
|
863
|
+
), e?.(f, g);
|
|
864
|
+
}, [e]);
|
|
865
|
+
return /* @__PURE__ */ h.jsxs(
|
|
866
|
+
te,
|
|
867
|
+
{
|
|
868
|
+
sensors: v,
|
|
869
|
+
collisionDetection: se,
|
|
870
|
+
onDragStart: u,
|
|
871
|
+
onDragEnd: b,
|
|
872
|
+
children: [
|
|
873
|
+
/* @__PURE__ */ h.jsx("div", { className: T("flex gap-4 overflow-x-auto p-4", i), children: c.map((f) => {
|
|
874
|
+
const g = s && f.cards.length > t;
|
|
875
|
+
return /* @__PURE__ */ h.jsx(
|
|
876
|
+
Le,
|
|
877
|
+
{
|
|
878
|
+
column: f,
|
|
879
|
+
cards: f.cards,
|
|
880
|
+
onToggle: (m) => E(f.id, m),
|
|
881
|
+
enableVirtual: g
|
|
882
|
+
},
|
|
883
|
+
f.id
|
|
884
|
+
);
|
|
885
|
+
}) }),
|
|
886
|
+
/* @__PURE__ */ h.jsx(ne, { children: o ? /* @__PURE__ */ h.jsx(W, { card: o }) : null })
|
|
887
|
+
]
|
|
888
|
+
}
|
|
889
|
+
);
|
|
890
|
+
}
|
|
891
|
+
export {
|
|
892
|
+
He as KanbanEnhanced,
|
|
893
|
+
He as default
|
|
894
|
+
};
|