laif-ds 0.2.48 → 0.2.50

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.
@@ -1,137 +1,151 @@
1
1
  "use client";
2
- import { jsx as d, jsxs as f, Fragment as P } from "react/jsx-runtime";
3
- import { useState as H } from "react";
4
- import { KanbanBoardProvider as S, KanbanBoard as A, KanbanBoardColumn as F, KanbanBoardColumnHeader as I, KanbanBoardColumnList as J, KanbanBoardColumnListItem as W, KanbanBoardCard as $, KanbanBoardCardTitle as q, KanbanBoardCardDescription as w } from "../kanban.js";
5
- import { Button as E } from "./button.js";
6
- import { stringToHexColor as x } from "../../lib/utils.js";
7
- import G from "../../node_modules/lucide-react/dist/esm/icons/plus.js";
8
- function Z({
9
- columns: g,
10
- initialTasks: N,
11
- onTaskMove: l,
12
- onTaskEdit: b,
13
- onTaskCreate: h,
14
- taskActions: O,
15
- renderTaskContent: u,
16
- className: j,
17
- allowTaskCreate: v = !0
2
+ import { jsx as i, jsxs as l, Fragment as z } from "react/jsx-runtime";
3
+ import { useState as L } from "react";
4
+ import { KanbanBoardProvider as H, KanbanBoard as I, KanbanBoardColumn as P, KanbanBoardColumnHeader as S, KanbanBoardColumnList as A, KanbanBoardColumnListItem as F, KanbanBoardCard as J, KanbanBoardCardTitle as R, KanbanBoardCardDescription as W } from "../kanban.js";
5
+ import { stringToHexColor as q, hexToRgba as E } from "../../lib/utils.js";
6
+ import { Button as G } from "./button.js";
7
+ import { Icon as Q } from "./icon.js";
8
+ import U from "../../node_modules/lucide-react/dist/esm/icons/plus.js";
9
+ function M({
10
+ columns: v,
11
+ initialTasks: K,
12
+ onTaskMove: m,
13
+ onTaskEdit: x,
14
+ onTaskCreate: u,
15
+ taskActions: B,
16
+ renderTaskContent: b,
17
+ className: y,
18
+ allowTaskCreate: j = !0
18
19
  }) {
19
- const [C, K] = H(N), y = (e) => {
20
- const i = {};
21
- for (const r of Object.keys(e))
22
- i[r] = [...e[r]];
23
- return i;
24
- }, D = (e, i) => {
25
- K((r) => {
26
- const o = y(r);
20
+ const [h, N] = L(K), g = (r) => {
21
+ const d = {};
22
+ for (const e of Object.keys(r))
23
+ d[e] = [...r[e]];
24
+ return d;
25
+ }, w = (r, d) => {
26
+ N((e) => {
27
+ const o = g(e);
27
28
  let t, n;
28
- for (const a of Object.keys(o)) {
29
- const c = o[a].findIndex((p) => p.id === e);
29
+ for (const s of Object.keys(o)) {
30
+ const c = o[s].findIndex((p) => p.id === r);
30
31
  if (c !== -1) {
31
- n = a, [t] = o[a].splice(c, 1);
32
+ n = s, [t] = o[s].splice(c, 1);
32
33
  break;
33
34
  }
34
35
  }
35
- return !t || n === i ? r : (o[i] || (o[i] = []), o[i].push(t), n && l && l(e, n, i), o);
36
+ return !t || n === d ? e : (o[d] || (o[d] = []), o[d].push(t), n && m && m(r, n, d), o);
36
37
  });
37
- }, z = (e, i, r, o) => {
38
- K((t) => {
39
- const n = y(t), a = Object.keys(n).find(
40
- (s) => n[s].some((L) => L.id === e)
38
+ }, O = (r, d, e, o) => {
39
+ N((t) => {
40
+ const n = g(t), s = Object.keys(n).find(
41
+ (a) => n[a].some((D) => D.id === r)
41
42
  );
42
- if (!a) return t;
43
- const c = n[a].findIndex(
44
- (s) => s.id === e
43
+ if (!s) return t;
44
+ const c = n[s].findIndex(
45
+ (a) => a.id === r
45
46
  );
46
47
  if (c === -1) return t;
47
- const [p] = n[a].splice(c, 1);
48
- n[r] || (n[r] = []);
49
- const m = n[r].findIndex(
50
- (s) => s.id === i
48
+ const [p] = n[s].splice(c, 1);
49
+ n[e] || (n[e] = []);
50
+ const f = n[e].findIndex(
51
+ (a) => a.id === d
51
52
  );
52
- if (m === -1)
53
- n[r].push(p);
53
+ if (f === -1)
54
+ n[e].push(p);
54
55
  else {
55
- const s = o === "top" ? m : m + 1;
56
- n[r].splice(s, 0, p);
56
+ const a = o === "top" ? f : f + 1;
57
+ n[e].splice(a, 0, p);
57
58
  }
58
- return a !== r && l && l(e, a, r), n;
59
+ return s !== e && m && m(r, s, e), n;
59
60
  });
60
- }, B = (e) => JSON.parse(e);
61
- return /* @__PURE__ */ d(S, { children: /* @__PURE__ */ d(A, { className: j, children: g.map((e) => /* @__PURE__ */ f(
62
- F,
63
- {
64
- columnId: e.id,
65
- onDropOverColumn: (i) => {
66
- const r = B(i);
67
- D(r.id, e.id);
68
- },
69
- className: "group/column",
70
- children: [
71
- /* @__PURE__ */ f(I, { className: "relative", children: [
72
- /* @__PURE__ */ f("div", { className: "flex items-center gap-2", children: [
73
- /* @__PURE__ */ d(
74
- "span",
61
+ }, C = (r) => JSON.parse(r);
62
+ return /* @__PURE__ */ i(H, { children: /* @__PURE__ */ i(I, { className: y, children: v.map((r) => {
63
+ const d = q(r.label);
64
+ return /* @__PURE__ */ l(
65
+ P,
66
+ {
67
+ columnId: r.id,
68
+ onDropOverColumn: (e) => {
69
+ const o = C(e);
70
+ w(o.id, r.id);
71
+ },
72
+ className: "group/column rounded-xl backdrop-blur-sm transition-colors",
73
+ children: [
74
+ /* @__PURE__ */ i(S, { className: "relative mb-1.5 px-1.5 pt-1.5", children: /* @__PURE__ */ l("div", { className: "flex w-full items-center justify-between", children: [
75
+ /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
76
+ /* @__PURE__ */ i(
77
+ "div",
78
+ {
79
+ className: "flex items-center gap-1.5 rounded-md px-2 py-0.5 text-xs font-semibold",
80
+ style: {
81
+ backgroundColor: E(d, 0.15),
82
+ color: d
83
+ },
84
+ children: /* @__PURE__ */ i("span", { className: "max-w-[150px] truncate", children: r.label })
85
+ }
86
+ ),
87
+ /* @__PURE__ */ i("span", { className: "text-d-muted-foreground text-xs", children: h[r.id]?.length ?? 0 })
88
+ ] }),
89
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: j && u && /* @__PURE__ */ i(
90
+ G,
75
91
  {
76
- className: "inline-flex items-center gap-1.5 rounded-md px-2 py-0.5 text-xs font-medium",
77
- style: {
78
- backgroundColor: `${x(e.label)}20`,
79
- color: x(e.label)
80
- },
81
- children: e.label
92
+ variant: "ghost",
93
+ size: "icon",
94
+ className: "text-d-muted-foreground hover:text-d-foreground h-6 w-6",
95
+ onClick: () => u(r.id),
96
+ children: /* @__PURE__ */ i(U, { className: "size-3.5" })
82
97
  }
83
- ),
84
- /* @__PURE__ */ d("span", { className: "text-d-muted-foreground text-xs", children: C[e.id]?.length ?? 0 })
85
- ] }),
86
- v && h && /* @__PURE__ */ d(
87
- E,
98
+ ) })
99
+ ] }) }),
100
+ /* @__PURE__ */ i(A, { className: "px-1 pb-2", children: h[r.id]?.map((e) => /* @__PURE__ */ i(
101
+ F,
88
102
  {
89
- variant: "ghost",
90
- size: "icon",
91
- className: "size-6 opacity-0 transition-opacity group-hover/column:opacity-100",
92
- onClick: (i) => {
93
- i.stopPropagation(), h(e.id);
103
+ cardId: e.id,
104
+ className: "mb-1.5 border-0 last:mb-0",
105
+ onDropOverListItem: (o, t) => {
106
+ if (t === "none") return;
107
+ const n = C(o);
108
+ O(
109
+ n.id,
110
+ e.id,
111
+ r.id,
112
+ t
113
+ );
94
114
  },
95
- children: /* @__PURE__ */ d(G, { className: "size-4" })
96
- }
97
- )
98
- ] }),
99
- /* @__PURE__ */ d(J, { children: C[e.id]?.map((i) => /* @__PURE__ */ d(
100
- W,
101
- {
102
- cardId: i.id,
103
- onDropOverListItem: (r, o) => {
104
- if (o === "none") return;
105
- const t = B(r);
106
- z(
107
- t.id,
108
- i.id,
109
- e.id,
110
- o
111
- );
115
+ children: /* @__PURE__ */ i(
116
+ J,
117
+ {
118
+ data: e,
119
+ className: "group/card hover:border-d-border/40 relative rounded-md border border-transparent shadow-sm transition-all duration-200 hover:shadow-md",
120
+ backgroundColor: d,
121
+ onEdit: x ? () => x(e, r.id) : void 0,
122
+ actions: B?.(e, r.id),
123
+ meta: e.meta,
124
+ children: b ? b(e, r.id) : /* @__PURE__ */ l(z, { children: [
125
+ /* @__PURE__ */ l("div", { className: "mb-1 flex items-start gap-2", children: [
126
+ e.icon && /* @__PURE__ */ i(
127
+ Q,
128
+ {
129
+ name: e.icon,
130
+ size: "sm",
131
+ className: "text-d-muted-foreground mt-0.5 shrink-0"
132
+ }
133
+ ),
134
+ /* @__PURE__ */ i(R, { className: "flex-1 text-sm leading-snug font-medium", children: e.title })
135
+ ] }),
136
+ e.description && /* @__PURE__ */ i(W, { className: "text-d-muted-foreground mt-1.5 line-clamp-2 text-xs", children: e.description })
137
+ ] })
138
+ }
139
+ )
112
140
  },
113
- children: /* @__PURE__ */ d(
114
- $,
115
- {
116
- data: i,
117
- onEdit: b ? () => b(i, e.id) : void 0,
118
- actions: O?.(i, e.id),
119
- meta: i.meta,
120
- backgroundColor: x(e.label),
121
- children: u ? u(i, e.id) : /* @__PURE__ */ f(P, { children: [
122
- /* @__PURE__ */ d(q, { children: i.title }),
123
- i.description && /* @__PURE__ */ d(w, { children: i.description })
124
- ] })
125
- }
126
- )
127
- },
128
- i.id
129
- )) })
130
- ]
131
- },
132
- e.id
133
- )) }) });
141
+ e.id
142
+ )) })
143
+ ]
144
+ },
145
+ r.id
146
+ );
147
+ }) }) });
134
148
  }
135
149
  export {
136
- Z as AppKanban
150
+ M as AppKanban
137
151
  };
@@ -1,50 +1,64 @@
1
1
  "use client";
2
- import { jsxs as r, jsx as t, Fragment as G } from "react/jsx-runtime";
3
- import { cn as s } from "../../lib/utils.js";
4
- import { Icon as O } from "./icon.js";
5
- import { Label as j } from "./label.js";
6
- import { RadioGroup as C, RadioGroupItem as F } from "./radio-group.js";
7
- const a = ({ content: e }) => typeof e == "string" ? /* @__PURE__ */ t("span", { children: e }) : e, I = ({ option: e }) => /* @__PURE__ */ r(G, { children: [
8
- /* @__PURE__ */ r("div", { className: "text-d-foreground flex flex-row items-center gap-1.5 text-sm font-medium", children: [
9
- e.icon && /* @__PURE__ */ t(O, { size: "xs", className: "min-h-4 min-w-4", name: e.icon }),
10
- /* @__PURE__ */ t(a, { content: e.label })
11
- ] }),
12
- e.description && /* @__PURE__ */ t("div", { className: "text-d-foreground text-xs font-light", children: /* @__PURE__ */ t(a, { content: e.description }) })
13
- ] }), P = ({
2
+ import { jsxs as r, jsx as t, Fragment as O } from "react/jsx-runtime";
3
+ import { designTokens as h } from "../../lib/design-tokens.js";
4
+ import { cn as o } from "../../lib/utils.js";
5
+ import { Icon as j } from "./icon.js";
6
+ import { Label as C } from "./label.js";
7
+ import { RadioGroup as F, RadioGroupItem as I } from "./radio-group.js";
8
+ const d = ({ content: e }) => typeof e == "string" ? /* @__PURE__ */ t("span", { children: e }) : e, P = ({ option: e }) => /* @__PURE__ */ r(O, { children: [
9
+ /* @__PURE__ */ r(
10
+ "div",
11
+ {
12
+ className: o(
13
+ "text-d-foreground flex flex-row items-center gap-1.5",
14
+ h.text.base
15
+ ),
16
+ children: [
17
+ e.icon && /* @__PURE__ */ t(j, { size: "xs", className: "min-h-4 min-w-4", name: e.icon }),
18
+ /* @__PURE__ */ t(d, { content: e.label })
19
+ ]
20
+ }
21
+ ),
22
+ e.description && /* @__PURE__ */ t("div", { className: "text-d-foreground text-xs font-light", children: /* @__PURE__ */ t(d, { content: e.description }) })
23
+ ] }), T = ({
14
24
  option: e,
15
25
  optionId: c,
16
- isDisabled: o,
26
+ isDisabled: s,
17
27
  isCard: n,
18
28
  optionClassName: l
19
29
  }) => /* @__PURE__ */ r(
20
- j,
30
+ C,
21
31
  {
22
32
  htmlFor: c,
23
- className: s(
33
+ className: o(
24
34
  "flex items-center gap-2",
25
- o ? "cursor-not-allowed opacity-50" : "cursor-pointer",
26
- n && "bg-d-card border-d-border rounded-lg border p-2 shadow",
35
+ s ? "cursor-not-allowed opacity-50" : "cursor-pointer",
36
+ n && o(
37
+ "bg-d-card border-d-border border p-2 shadow",
38
+ h.radius.lg
39
+ // Card layout uses lg radius
40
+ ),
27
41
  l
28
42
  ),
29
43
  children: [
30
- /* @__PURE__ */ t(F, { value: e.value, id: c, disabled: o }),
44
+ /* @__PURE__ */ t(I, { value: e.value, id: c, disabled: s }),
31
45
  /* @__PURE__ */ t(
32
46
  "div",
33
47
  {
34
- className: s(
48
+ className: o(
35
49
  "flex flex-1 flex-col items-start gap-1",
36
- o ? "cursor-not-allowed" : "cursor-pointer"
50
+ s ? "cursor-not-allowed" : "cursor-pointer"
37
51
  ),
38
- children: /* @__PURE__ */ t(I, { option: e })
52
+ children: /* @__PURE__ */ t(P, { option: e })
39
53
  }
40
54
  )
41
55
  ]
42
56
  }
43
57
  );
44
- function k({
58
+ function E({
45
59
  options: e,
46
60
  value: c,
47
- defaultValue: o,
61
+ defaultValue: s,
48
62
  onValueChange: n,
49
63
  label: l,
50
64
  description: i,
@@ -52,55 +66,55 @@ function k({
52
66
  required: f = !1,
53
67
  name: u,
54
68
  orientation: p = "vertical",
55
- loop: h = !0,
56
- className: g = "",
57
- wrpClassName: v = "",
58
- optionClassName: N = "",
59
- layout: w = "default",
69
+ loop: g = !0,
70
+ className: v = "",
71
+ wrpClassName: N = "",
72
+ optionClassName: w = "",
73
+ layout: b = "default",
60
74
  error: m
61
75
  }) {
62
- const b = p === "horizontal", y = w === "card";
63
- return /* @__PURE__ */ r("div", { className: s("flex w-full flex-col gap-2", v), children: [
76
+ const y = p === "horizontal", R = b === "card";
77
+ return /* @__PURE__ */ r("div", { className: o("flex w-full flex-col gap-2", N), children: [
64
78
  (l || i) && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
65
79
  l && /* @__PURE__ */ r(
66
80
  "div",
67
81
  {
68
- className: s(
82
+ className: o(
69
83
  "flex items-center gap-1 text-sm font-medium",
70
84
  m ? "text-d-destructive" : "text-d-foreground"
71
85
  ),
72
86
  children: [
73
- /* @__PURE__ */ t(a, { content: l }),
87
+ /* @__PURE__ */ t(d, { content: l }),
74
88
  f && /* @__PURE__ */ t("span", { children: "*" })
75
89
  ]
76
90
  }
77
91
  ),
78
- i && /* @__PURE__ */ t("div", { className: "text-bodySecondary text-xs", children: /* @__PURE__ */ t(a, { content: i }) })
92
+ i && /* @__PURE__ */ t("div", { className: "text-bodySecondary text-xs", children: /* @__PURE__ */ t(d, { content: i }) })
79
93
  ] }),
80
94
  /* @__PURE__ */ t(
81
- C,
95
+ F,
82
96
  {
83
97
  value: c,
84
- defaultValue: o,
98
+ defaultValue: s,
85
99
  onValueChange: n,
86
100
  disabled: x,
87
101
  required: f,
88
102
  name: u,
89
103
  orientation: p,
90
- loop: h,
91
- className: s(
104
+ loop: g,
105
+ className: o(
92
106
  "flex gap-2",
93
- b ? "flex-row" : "flex-col",
94
- g
107
+ y ? "flex-row" : "flex-col",
108
+ v
95
109
  ),
96
- children: e.map((d) => {
97
- const R = `${u || "radio"}-${d.value}`, z = x || !!d.disabled;
98
- return /* @__PURE__ */ t(P, { isCard: y, ...{
99
- option: d,
100
- optionId: R,
101
- isDisabled: z,
102
- optionClassName: N
103
- } }, d.value);
110
+ children: e.map((a) => {
111
+ const z = `${u || "radio"}-${a.value}`, G = x || !!a.disabled;
112
+ return /* @__PURE__ */ t(T, { isCard: R, ...{
113
+ option: a,
114
+ optionId: z,
115
+ isDisabled: G,
116
+ optionClassName: w
117
+ } }, a.value);
104
118
  })
105
119
  }
106
120
  ),
@@ -111,5 +125,5 @@ function k({
111
125
  ] });
112
126
  }
113
127
  export {
114
- k as AppRadioGroup
128
+ E as AppRadioGroup
115
129
  };