@object-ui/plugin-kanban 4.0.3 → 4.0.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @object-ui/plugin-kanban
2
2
 
3
+ ## 4.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - d2b6ece: fix: externalize all bare imports in library builds
8
+
9
+ Library builds (vite lib mode) now externalize every non-relative import instead of bundling third-party CJS dependencies into the published dist. This avoids inlined `require("react")` / `require("react-dom")` calls that cause `Calling \`require\` for "react" in an environment that doesn't expose the \`require\` function` runtime errors when consumer apps re-bundle the published dist.
10
+
11
+ Specifically fixes:
12
+ - `@object-ui/plugin-dashboard` no longer inlines `react-grid-layout` (and its transitive `react-draggable` / `react-resizable` CJS bundles). `react-grid-layout` is now declared as a peer dependency so consumers install a single ESM-friendly copy.
13
+ - `@object-ui/components`, `@object-ui/plugin-calendar`, `@object-ui/plugin-charts`, `@object-ui/plugin-designer` no longer inline `react-i18next` / `i18next` / `use-sync-external-store` CJS shims.
14
+ - All plugin packages now use a unified `external: (id) => !/^[./]/.test(id) && !id.startsWith(__dirname)` rule, ensuring future additions of CJS deps are automatically externalized.
15
+
16
+ - Updated dependencies [d2b6ece]
17
+ - @object-ui/components@4.0.4
18
+ - @object-ui/types@4.0.4
19
+ - @object-ui/core@4.0.4
20
+ - @object-ui/react@4.0.4
21
+
3
22
  ## 4.0.3
4
23
 
5
24
  ### Patch Changes
@@ -0,0 +1,290 @@
1
+ import * as e from "react";
2
+ import { Badge as t, Button as n, Card as r, CardContent as i, CardDescription as a, CardHeader as o, CardTitle as s, Input as c } from "@object-ui/components";
3
+ import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
4
+ import { AlertTriangle as f, ChevronDown as p, ChevronRight as m, Plus as h } from "lucide-react";
5
+ import { useVirtualizer as g } from "@tanstack/react-virtual";
6
+ import { DndContext as _, DragOverlay as v, PointerSensor as y, closestCorners as b, useSensor as x, useSensors as S } from "@dnd-kit/core";
7
+ import { SortableContext as C, arrayMove as w, useSortable as T, verticalListSortingStrategy as E } from "@dnd-kit/sortable";
8
+ import { CSS as D } from "@dnd-kit/utilities";
9
+ //#region src/KanbanEnhanced.tsx
10
+ var O = (...e) => e.filter(Boolean).join(" ");
11
+ function k(e, t) {
12
+ if (!t || t.length === 0) return {};
13
+ for (let n of t) {
14
+ let t = e[n.field];
15
+ if (t == null) continue;
16
+ let r = !1, i = String(t);
17
+ switch (n.operator) {
18
+ case "equals":
19
+ r = i === String(n.value);
20
+ break;
21
+ case "not_equals":
22
+ r = i !== String(n.value);
23
+ break;
24
+ case "contains":
25
+ r = i.toLowerCase().includes(String(n.value).toLowerCase());
26
+ break;
27
+ case "in":
28
+ r = Array.isArray(n.value) && n.value.includes(i);
29
+ break;
30
+ }
31
+ if (r) return {
32
+ ...n.backgroundColor ? { backgroundColor: n.backgroundColor } : {},
33
+ ...n.borderColor ? { borderColor: n.borderColor } : {}
34
+ };
35
+ }
36
+ return {};
37
+ }
38
+ function A({ card: e, conditionalFormatting: n }) {
39
+ let { attributes: c, listeners: l, setNodeRef: f, transform: p, transition: m, isDragging: h } = T({ id: e.id }), g = {
40
+ transform: D.Transform.toString(p),
41
+ transition: m,
42
+ opacity: h ? .5 : void 0
43
+ }, _ = k(e, n);
44
+ return /* @__PURE__ */ u("div", {
45
+ ref: f,
46
+ style: g,
47
+ ...c,
48
+ ...l,
49
+ children: /* @__PURE__ */ d(r, {
50
+ 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",
51
+ style: _,
52
+ children: [
53
+ e.coverImage && /* @__PURE__ */ u("div", {
54
+ className: "w-full h-32 overflow-hidden rounded-t-lg",
55
+ children: /* @__PURE__ */ u("img", {
56
+ src: e.coverImage,
57
+ alt: "",
58
+ className: "w-full h-full object-cover",
59
+ loading: "lazy"
60
+ })
61
+ }),
62
+ /* @__PURE__ */ d(o, {
63
+ className: "p-4",
64
+ children: [/* @__PURE__ */ u(s, {
65
+ className: "text-sm font-medium tracking-tight text-foreground group-hover:text-primary transition-colors",
66
+ children: e.title
67
+ }), e.description && /* @__PURE__ */ u(a, {
68
+ className: "text-xs text-muted-foreground",
69
+ children: e.description
70
+ })]
71
+ }),
72
+ e.badges && e.badges.length > 0 && /* @__PURE__ */ u(i, {
73
+ className: "p-4 pt-0",
74
+ children: /* @__PURE__ */ u("div", {
75
+ className: "flex flex-wrap gap-1",
76
+ children: e.badges.map((e, n) => /* @__PURE__ */ u(t, {
77
+ variant: e.variant || "default",
78
+ className: "text-xs",
79
+ children: e.label
80
+ }, n))
81
+ })
82
+ })
83
+ ]
84
+ })
85
+ });
86
+ }
87
+ function j({ cards: e, parentRef: t, conditionalFormatting: n }) {
88
+ let r = g({
89
+ count: e.length,
90
+ getScrollElement: () => t.current,
91
+ estimateSize: () => 120,
92
+ overscan: 5
93
+ });
94
+ return /* @__PURE__ */ u("div", {
95
+ style: {
96
+ height: `${r.getTotalSize()}px`,
97
+ width: "100%",
98
+ position: "relative"
99
+ },
100
+ children: r.getVirtualItems().map((t) => {
101
+ let r = e[t.index];
102
+ return /* @__PURE__ */ u("div", {
103
+ style: {
104
+ position: "absolute",
105
+ top: 0,
106
+ left: 0,
107
+ width: "100%",
108
+ transform: `translateY(${t.start}px)`
109
+ },
110
+ children: /* @__PURE__ */ u(A, {
111
+ card: r,
112
+ conditionalFormatting: n
113
+ })
114
+ }, r.id);
115
+ })
116
+ });
117
+ }
118
+ function M({ columnId: t, onAdd: r }) {
119
+ let [i, a] = e.useState(!1), [o, s] = e.useState(""), l = e.useRef(null), f = () => {
120
+ let e = o.trim();
121
+ e && (r(t, e), s("")), a(!1);
122
+ };
123
+ return i ? /* @__PURE__ */ u("div", {
124
+ className: "mt-2 space-y-2",
125
+ children: /* @__PURE__ */ u(c, {
126
+ ref: l,
127
+ value: o,
128
+ onChange: (e) => s(e.target.value),
129
+ onKeyDown: (e) => {
130
+ e.key === "Enter" ? (e.preventDefault(), f()) : e.key === "Escape" && (s(""), a(!1));
131
+ },
132
+ onBlur: f,
133
+ placeholder: "Enter card title...",
134
+ className: "text-sm",
135
+ autoFocus: !0
136
+ })
137
+ }) : /* @__PURE__ */ d(n, {
138
+ variant: "ghost",
139
+ size: "sm",
140
+ className: "w-full mt-2 text-muted-foreground hover:text-foreground",
141
+ onClick: () => {
142
+ a(!0), setTimeout(() => l.current?.focus(), 0);
143
+ },
144
+ children: [/* @__PURE__ */ u(h, { className: "h-4 w-4 mr-1" }), "Add Card"]
145
+ });
146
+ }
147
+ function N({ column: r, cards: i, onToggle: a, enableVirtual: o, quickAdd: s, onQuickAdd: c, conditionalFormatting: h }) {
148
+ let g = i || [], _ = e.useRef(null), { setNodeRef: v } = T({
149
+ id: r.id,
150
+ data: { type: "column" }
151
+ }), y = r.limit && g.length >= r.limit, b = r.limit && g.length >= r.limit * .8;
152
+ return /* @__PURE__ */ d("div", {
153
+ ref: v,
154
+ className: O("flex flex-col flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl transition-all", r.collapsed ? "w-16" : "w-80", r.className),
155
+ children: [/* @__PURE__ */ d("div", {
156
+ className: "p-4 border-b border-border/50 bg-muted/20 flex items-center justify-between",
157
+ children: [/* @__PURE__ */ d("div", {
158
+ className: "flex items-center gap-2 flex-1 min-w-0",
159
+ children: [/* @__PURE__ */ u(n, {
160
+ variant: "ghost",
161
+ size: "sm",
162
+ className: "h-6 w-6 p-0",
163
+ onClick: () => a(!r.collapsed),
164
+ children: r.collapsed ? /* @__PURE__ */ u(m, { className: "h-4 w-4" }) : /* @__PURE__ */ u(p, { className: "h-4 w-4" })
165
+ }), !r.collapsed && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("h3", {
166
+ className: " text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",
167
+ children: r.title
168
+ }), /* @__PURE__ */ d("div", {
169
+ className: "flex items-center gap-2",
170
+ children: [
171
+ /* @__PURE__ */ d("span", {
172
+ className: O(" text-xs", y ? "text-destructive" : b ? "text-yellow-500" : "text-muted-foreground"),
173
+ children: [g.length, r.limit && ` / ${r.limit}`]
174
+ }),
175
+ y && /* @__PURE__ */ u(t, {
176
+ variant: "destructive",
177
+ className: "text-xs",
178
+ children: "Full"
179
+ }),
180
+ b && !y && /* @__PURE__ */ u(f, { className: "h-3 w-3 text-yellow-500" })
181
+ ]
182
+ })] })]
183
+ }), r.collapsed && /* @__PURE__ */ d("div", {
184
+ className: "flex flex-col items-center gap-1",
185
+ children: [/* @__PURE__ */ u("span", {
186
+ className: " text-xs font-bold text-primary/90 [writing-mode:vertical-rl] rotate-180",
187
+ children: r.title
188
+ }), /* @__PURE__ */ u(t, {
189
+ variant: "secondary",
190
+ className: "text-xs",
191
+ children: g.length
192
+ })]
193
+ })]
194
+ }), !r.collapsed && /* @__PURE__ */ d("div", {
195
+ ref: _,
196
+ className: "flex-1 p-4 overflow-y-auto",
197
+ style: { maxHeight: "600px" },
198
+ children: [/* @__PURE__ */ u(C, {
199
+ items: g.map((e) => e.id),
200
+ strategy: E,
201
+ children: o ? /* @__PURE__ */ u(j, {
202
+ cards: g,
203
+ parentRef: _,
204
+ conditionalFormatting: h
205
+ }) : /* @__PURE__ */ u("div", {
206
+ className: "space-y-2",
207
+ children: g.map((e) => /* @__PURE__ */ u(A, {
208
+ card: e,
209
+ conditionalFormatting: h
210
+ }, e.id))
211
+ })
212
+ }), s && c && /* @__PURE__ */ u(M, {
213
+ columnId: r.id,
214
+ onAdd: c
215
+ })]
216
+ })]
217
+ });
218
+ }
219
+ function P({ columns: t, onCardMove: n, onColumnToggle: r, enableVirtualScrolling: i = !1, virtualScrollThreshold: a = 50, className: o, quickAdd: s, onQuickAdd: c, conditionalFormatting: l }) {
220
+ let [f, p] = e.useState(null), m = e.useMemo(() => (t || []).map((e) => ({
221
+ ...e,
222
+ cards: e.cards || []
223
+ })), [t]), [h, g] = e.useState(m);
224
+ e.useEffect(() => {
225
+ g(m);
226
+ }, [m]);
227
+ let C = S(x(y, { activationConstraint: { distance: 8 } })), T = (e) => {
228
+ let { active: t } = e;
229
+ p(D(t.id));
230
+ }, E = (e) => {
231
+ let { active: t, over: r } = e;
232
+ if (p(null), !r) return;
233
+ let i = t.id, a = r.id;
234
+ if (i === a) return;
235
+ let o = k(i), s = k(a) || j(a);
236
+ if (!(!o || !s)) if (o.id === s.id) {
237
+ let e = [...o.cards], t = w(e, e.findIndex((e) => e.id === i), e.findIndex((e) => e.id === a));
238
+ g((e) => e.map((e) => e.id === o.id ? {
239
+ ...e,
240
+ cards: t
241
+ } : e));
242
+ } else {
243
+ let e = [...o.cards], t = [...s.cards], r = e.findIndex((e) => e.id === i), c = a === s.id ? t.length : t.findIndex((e) => e.id === a), [l] = e.splice(r, 1);
244
+ t.splice(c, 0, l), g((n) => n.map((n) => n.id === o.id ? {
245
+ ...n,
246
+ cards: e
247
+ } : n.id === s.id ? {
248
+ ...n,
249
+ cards: t
250
+ } : n)), n && n(i, o.id, s.id, c);
251
+ }
252
+ }, D = e.useCallback((e) => {
253
+ for (let t of h) {
254
+ let n = t.cards.find((t) => t.id === e);
255
+ if (n) return n;
256
+ }
257
+ return null;
258
+ }, [h]), k = e.useCallback((e) => h.find((t) => t.cards.some((t) => t.id === e)) || null, [h]), j = e.useCallback((e) => h.find((t) => t.id === e) || null, [h]), M = e.useCallback((e, t) => {
259
+ g((n) => n.map((n) => n.id === e ? {
260
+ ...n,
261
+ collapsed: t
262
+ } : n)), r?.(e, t);
263
+ }, [r]);
264
+ return /* @__PURE__ */ d(_, {
265
+ sensors: C,
266
+ collisionDetection: b,
267
+ onDragStart: T,
268
+ onDragEnd: E,
269
+ children: [/* @__PURE__ */ u("div", {
270
+ className: O("flex gap-4 overflow-x-auto p-4", o),
271
+ children: h.map((e) => {
272
+ let t = i && e.cards.length > a;
273
+ return /* @__PURE__ */ u(N, {
274
+ column: e,
275
+ cards: e.cards,
276
+ onToggle: (t) => M(e.id, t),
277
+ enableVirtual: t,
278
+ quickAdd: s,
279
+ onQuickAdd: c,
280
+ conditionalFormatting: l
281
+ }, e.id);
282
+ })
283
+ }), /* @__PURE__ */ u(v, { children: f ? /* @__PURE__ */ u(A, {
284
+ card: f,
285
+ conditionalFormatting: l
286
+ }) : null })]
287
+ });
288
+ }
289
+ //#endregion
290
+ export { P as KanbanEnhanced, P as default };