laif-ds 0.2.63 → 0.2.64

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,8 +1,8 @@
1
1
  "use client";
2
- import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
3
- import { __require as r } from "../node_modules/extend/index.js";
4
- var t = r();
5
- const x = /* @__PURE__ */ e(t);
2
+ import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
3
+ import { __require as e } from "../node_modules/style-to-js/cjs/index.js";
4
+ var t = e();
5
+ const a = /* @__PURE__ */ r(t);
6
6
  export {
7
- x as default
7
+ a as default
8
8
  };
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
3
- import { __require as e } from "../node_modules/style-to-js/cjs/index.js";
4
- var t = e();
5
- const a = /* @__PURE__ */ r(t);
2
+ import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
3
+ import { __require as r } from "../node_modules/extend/index.js";
4
+ var t = r();
5
+ const x = /* @__PURE__ */ e(t);
6
6
  export {
7
- a as default
7
+ x as default
8
8
  };
@@ -1,66 +1,66 @@
1
1
  "use client";
2
- import { jsxs as r, jsx as t, Fragment as O } from "react/jsx-runtime";
2
+ import { jsxs as r, jsx as t, Fragment as C } from "react/jsx-runtime";
3
3
  import { designTokens as h } from "../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: [
4
+ import { cn as s } from "../../lib/utils.js";
5
+ import { Icon as F } from "./icon.js";
6
+ import { Label as I } from "./label.js";
7
+ import { RadioGroup as P, RadioGroupItem as T } from "./radio-group.js";
8
+ const d = ({ content: e }) => typeof e == "string" ? /* @__PURE__ */ t("span", { children: e }) : e, $ = ({ option: e }) => /* @__PURE__ */ r(C, { children: [
9
9
  /* @__PURE__ */ r(
10
10
  "div",
11
11
  {
12
- className: o(
12
+ className: s(
13
13
  "text-d-foreground flex flex-row items-center gap-1.5",
14
14
  h.text.base
15
15
  ),
16
16
  children: [
17
- e.icon && /* @__PURE__ */ t(j, { size: "xs", className: "min-h-4 min-w-4", name: e.icon }),
17
+ e.icon && /* @__PURE__ */ t(F, { size: "xs", className: "min-h-4 min-w-4", name: e.icon }),
18
18
  /* @__PURE__ */ t(d, { content: e.label })
19
19
  ]
20
20
  }
21
21
  ),
22
22
  e.description && /* @__PURE__ */ t("div", { className: "text-d-foreground text-xs font-light", children: /* @__PURE__ */ t(d, { content: e.description }) })
23
- ] }), T = ({
23
+ ] }), k = ({
24
24
  option: e,
25
- optionId: c,
26
- isDisabled: s,
25
+ optionId: l,
26
+ isDisabled: o,
27
27
  isCard: n,
28
- optionClassName: l
28
+ optionClassName: a
29
29
  }) => /* @__PURE__ */ r(
30
- C,
30
+ I,
31
31
  {
32
- htmlFor: c,
33
- className: o(
32
+ htmlFor: l,
33
+ className: s(
34
34
  "flex items-center gap-2",
35
- s ? "cursor-not-allowed opacity-50" : "cursor-pointer",
36
- n && o(
35
+ o ? "cursor-not-allowed opacity-50" : "cursor-pointer",
36
+ n && s(
37
37
  "bg-d-card border-d-border border p-2 shadow",
38
38
  h.radius.lg
39
39
  // Card layout uses lg radius
40
40
  ),
41
- l
41
+ a
42
42
  ),
43
43
  children: [
44
- /* @__PURE__ */ t(I, { value: e.value, id: c, disabled: s }),
44
+ /* @__PURE__ */ t(T, { value: e.value, id: l, disabled: o }),
45
45
  /* @__PURE__ */ t(
46
46
  "div",
47
47
  {
48
- className: o(
48
+ className: s(
49
49
  "flex flex-1 flex-col items-start gap-1",
50
- s ? "cursor-not-allowed" : "cursor-pointer"
50
+ o ? "cursor-not-allowed" : "cursor-pointer"
51
51
  ),
52
- children: /* @__PURE__ */ t(P, { option: e })
52
+ children: /* @__PURE__ */ t($, { option: e })
53
53
  }
54
54
  )
55
55
  ]
56
56
  }
57
57
  );
58
- function E({
58
+ function K({
59
59
  options: e,
60
- value: c,
61
- defaultValue: s,
60
+ value: l,
61
+ defaultValue: o,
62
62
  onValueChange: n,
63
- label: l,
63
+ label: a,
64
64
  description: i,
65
65
  disabled: x = !1,
66
66
  required: f = !1,
@@ -71,20 +71,22 @@ function E({
71
71
  wrpClassName: N = "",
72
72
  optionClassName: w = "",
73
73
  layout: b = "default",
74
- error: m
74
+ error: m,
75
+ id: y,
76
+ "data-testid": R
75
77
  }) {
76
- const y = p === "horizontal", R = b === "card";
77
- return /* @__PURE__ */ r("div", { className: o("flex w-full flex-col gap-2", N), children: [
78
- (l || i) && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
79
- l && /* @__PURE__ */ r(
78
+ const z = p === "horizontal", G = b === "card";
79
+ return /* @__PURE__ */ r("div", { className: s("flex w-full flex-col gap-2", N), children: [
80
+ (a || i) && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
81
+ a && /* @__PURE__ */ r(
80
82
  "div",
81
83
  {
82
- className: o(
84
+ className: s(
83
85
  "flex items-center gap-1 text-sm font-medium",
84
86
  m ? "text-d-destructive" : "text-d-foreground"
85
87
  ),
86
88
  children: [
87
- /* @__PURE__ */ t(d, { content: l }),
89
+ /* @__PURE__ */ t(d, { content: a }),
88
90
  f && /* @__PURE__ */ t("span", { children: "*" })
89
91
  ]
90
92
  }
@@ -92,29 +94,31 @@ function E({
92
94
  i && /* @__PURE__ */ t("div", { className: "text-bodySecondary text-xs", children: /* @__PURE__ */ t(d, { content: i }) })
93
95
  ] }),
94
96
  /* @__PURE__ */ t(
95
- F,
97
+ P,
96
98
  {
97
- value: c,
98
- defaultValue: s,
99
+ id: y,
100
+ "data-testid": R,
101
+ value: l,
102
+ defaultValue: o,
99
103
  onValueChange: n,
100
104
  disabled: x,
101
105
  required: f,
102
106
  name: u,
103
107
  orientation: p,
104
108
  loop: g,
105
- className: o(
109
+ className: s(
106
110
  "flex gap-2",
107
- y ? "flex-row" : "flex-col",
111
+ z ? "flex-row" : "flex-col",
108
112
  v
109
113
  ),
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,
114
+ children: e.map((c) => {
115
+ const O = `${u || "radio"}-${c.value}`, j = x || !!c.disabled;
116
+ return /* @__PURE__ */ t(k, { isCard: G, ...{
117
+ option: c,
118
+ optionId: O,
119
+ isDisabled: j,
116
120
  optionClassName: w
117
- } }, a.value);
121
+ } }, c.value);
118
122
  })
119
123
  }
120
124
  ),
@@ -125,5 +129,5 @@ function E({
125
129
  ] });
126
130
  }
127
131
  export {
128
- E as AppRadioGroup
132
+ K as AppRadioGroup
129
133
  };
@@ -1,21 +1,21 @@
1
1
  "use client";
2
- import { jsxs as t, jsx as l, Fragment as re } from "react/jsx-runtime";
2
+ import { jsxs as s, jsx as l, Fragment as te } from "react/jsx-runtime";
3
3
  import { designTokens as i } from "../design-tokens.js";
4
- import { Badge as ne } from "./badge.js";
5
- import { Command as se, CommandInput as te, CommandList as ie, CommandEmpty as oe, CommandGroup as R, CommandItem as A } from "./command.js";
6
- import { Label as de } from "./label.js";
4
+ import { Badge as se } from "./badge.js";
5
+ import { Command as ie, CommandInput as oe, CommandList as de, CommandEmpty as ce, CommandGroup as R, CommandItem as A } from "./command.js";
6
+ import { Label as ue } from "./label.js";
7
7
  import { cn as y } from "../../lib/utils.js";
8
- import { useState as h, useRef as ce, useMemo as P, useCallback as ue, useEffect as me } from "react";
9
- import { Checkbox as fe } from "./checkbox.js";
8
+ import { useState as h, useRef as me, useMemo as P, useCallback as fe, useEffect as pe } from "react";
9
+ import { Checkbox as he } from "./checkbox.js";
10
10
  import { Icon as S } from "./icon.js";
11
- import { Popover as pe, PopoverTrigger as he, PopoverContent as ge } from "./popover.js";
12
- import ve from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
13
- const be = {
11
+ import { Popover as ge, PopoverTrigger as ve, PopoverContent as be } from "./popover.js";
12
+ import xe from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
13
+ const Ce = {
14
14
  sm: i.sizes.sm,
15
15
  default: i.sizes.default,
16
16
  lg: i.sizes.lg
17
17
  };
18
- function Ve(z) {
18
+ function je(z) {
19
19
  const {
20
20
  multiple: r = !1,
21
21
  options: c,
@@ -29,82 +29,86 @@ function Ve(z) {
29
29
  addItemPlaceholder: L = "Aggiungi",
30
30
  itemCountMessage: $ = (e) => `${e} elementi selezionati`,
31
31
  maxSelectedMessage: G = (e) => `Puoi selezionare fino a ${e} elementi`,
32
- label: D,
32
+ label: I,
33
33
  className: q = "",
34
34
  labelClassName: H = "",
35
35
  wrpClassName: J = "",
36
- searchable: I = !1,
36
+ searchable: D = !1,
37
37
  creatable: K = !1,
38
38
  groupBy: v = "group",
39
39
  maxSelected: d,
40
40
  showChipsInsteadOfCount: Q = !1,
41
41
  disabled: b,
42
42
  size: U = "default",
43
- isSingleSelectClearable: Y = !1
44
- } = z, [x, C] = h(!1), [u, w] = h(""), N = ce(null), [O, Z] = h(0), V = z.hasOwnProperty("value"), [_, ee] = h(T), o = V ? B : _, m = (e) => {
45
- V || ee(e), W?.(e);
43
+ isSingleSelectClearable: Y = !1,
44
+ id: Z,
45
+ "data-testid": _
46
+ } = z, [x, C] = h(!1), [u, w] = h(""), N = me(null), [O, ee] = h(0), V = z.hasOwnProperty("value"), [le, ae] = h(T), o = V ? B : le, m = (e) => {
47
+ V || ae(e), W?.(e);
46
48
  }, n = P(() => r ? Array.isArray(o) ? o : [] : o != null ? [o] : [], [o, r]), f = P(() => {
47
- const e = c.filter((s) => n.includes(s.value));
49
+ const e = c.filter((t) => n.includes(t.value));
48
50
  if (r) {
49
- const s = n.filter((a) => !e.find((p) => p.value === a)).map((a) => ({ value: a, label: a }));
50
- return [...e, ...s];
51
+ const t = n.filter((a) => !e.find((p) => p.value === a)).map((a) => ({ value: a, label: a }));
52
+ return [...e, ...t];
51
53
  } else if (n.length && !e.length)
52
54
  return [{ value: n[0], label: n[0] }];
53
55
  return e;
54
56
  }, [c, n, r]), k = (e) => {
55
57
  if (!e.disabled)
56
58
  if (r) {
57
- const s = n.includes(e.value);
58
- if (!s && d !== void 0 && n.length >= d)
59
+ const t = n.includes(e.value);
60
+ if (!t && d !== void 0 && n.length >= d)
59
61
  return;
60
62
  m(
61
- s ? n.filter((a) => a !== e.value) : [...n, e.value]
63
+ t ? n.filter((a) => a !== e.value) : [...n, e.value]
62
64
  );
63
65
  } else
64
66
  m(e.value), C(!1);
65
- }, j = ue(() => {
67
+ }, j = fe(() => {
66
68
  m(r ? [] : void 0), w(""), g && g();
67
- }, [m, g, r]), le = P(() => v ? c.reduce(
68
- (e, s) => {
69
- const a = s[v] || "";
70
- return e[a] = e[a] || [], e[a].push(s), e;
69
+ }, [m, g, r]), re = P(() => v ? c.reduce(
70
+ (e, t) => {
71
+ const a = t[v] || "";
72
+ return e[a] = e[a] || [], e[a].push(t), e;
71
73
  },
72
74
  {}
73
75
  ) : { "": c }, [c, v]);
74
- return me(() => {
75
- N.current && Z(N.current.getBoundingClientRect().width);
76
- }, [x, n, c]), /* @__PURE__ */ t("div", { className: y("flex flex-col gap-1.5", J), children: [
77
- D && /* @__PURE__ */ l(de, { className: H, children: D }),
78
- /* @__PURE__ */ t(
79
- pe,
76
+ return pe(() => {
77
+ N.current && ee(N.current.getBoundingClientRect().width);
78
+ }, [x, n, c]), /* @__PURE__ */ s("div", { className: y("flex flex-col gap-1.5", J), children: [
79
+ I && /* @__PURE__ */ l(ue, { className: H, children: I }),
80
+ /* @__PURE__ */ s(
81
+ ge,
80
82
  {
81
83
  open: b ? !1 : x,
82
84
  onOpenChange: (e) => !b && C(e),
83
85
  modal: !0,
84
86
  children: [
85
- /* @__PURE__ */ l(he, { asChild: !0, children: /* @__PURE__ */ t(
87
+ /* @__PURE__ */ l(ve, { asChild: !0, children: /* @__PURE__ */ s(
86
88
  "div",
87
89
  {
88
90
  ref: N,
91
+ id: Z,
92
+ "data-testid": _,
89
93
  className: y(
90
94
  i.input.base,
91
95
  i.radius.default,
92
96
  i.focusRingWithin,
93
97
  "flex w-full min-w-[100px] cursor-pointer items-center justify-between gap-2",
94
98
  x && i.activeRing,
95
- be[U],
99
+ Ce[U],
96
100
  b && "cursor-not-allowed opacity-50",
97
101
  q
98
102
  ),
99
103
  children: [
100
- f.length === 0 ? /* @__PURE__ */ l("span", { className: "text-d-muted-foreground", children: X }) : r ? /* @__PURE__ */ t("div", { className: "flex h-full w-full min-w-0 items-center justify-between gap-2", children: [
101
- /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-nowrap gap-1 overflow-auto", children: Q ? /* @__PURE__ */ l(re, { children: f.map((e) => /* @__PURE__ */ t(
102
- ne,
104
+ f.length === 0 ? /* @__PURE__ */ l("span", { className: "text-d-muted-foreground", children: X }) : r ? /* @__PURE__ */ s("div", { className: "flex h-full w-full min-w-0 items-center justify-between gap-2", children: [
105
+ /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-nowrap gap-1 overflow-auto", children: Q ? /* @__PURE__ */ l(te, { children: f.map((e) => /* @__PURE__ */ s(
106
+ se,
103
107
  {
104
108
  variant: "secondary",
105
109
  className: "hover:bg-d-secondary/100 bg-d-secondary/50 border-d-border flex cursor-pointer items-center gap-1 border",
106
- onClick: (s) => {
107
- s.stopPropagation(), k(e);
110
+ onClick: (t) => {
111
+ t.stopPropagation(), k(e);
108
112
  },
109
113
  children: [
110
114
  e.label,
@@ -132,7 +136,7 @@ function Ve(z) {
132
136
  )
133
137
  }
134
138
  )
135
- ] }) : /* @__PURE__ */ t("div", { className: "flex h-full w-full min-w-0 items-center justify-between gap-2", children: [
139
+ ] }) : /* @__PURE__ */ s("div", { className: "flex h-full w-full min-w-0 items-center justify-between gap-2", children: [
136
140
  /* @__PURE__ */ l("div", { className: "min-w-0 flex-1 truncate", children: typeof f[0]?.label == "string" ? /* @__PURE__ */ l("span", { children: f[0]?.label }) : f[0]?.label }),
137
141
  Y && o !== void 0 && o !== null && /* @__PURE__ */ l(
138
142
  "div",
@@ -154,12 +158,12 @@ function Ve(z) {
154
158
  }
155
159
  )
156
160
  ] }),
157
- /* @__PURE__ */ l(ve, { className: "h-4 w-4 opacity-50" })
161
+ /* @__PURE__ */ l(xe, { className: "h-4 w-4 opacity-50" })
158
162
  ]
159
163
  }
160
164
  ) }),
161
165
  /* @__PURE__ */ l(
162
- ge,
166
+ be,
163
167
  {
164
168
  className: "p-0",
165
169
  style: { width: O > 0 ? O : "auto" },
@@ -167,9 +171,9 @@ function Ve(z) {
167
171
  sideOffset: 4,
168
172
  avoidCollisions: !0,
169
173
  collisionPadding: 8,
170
- children: /* @__PURE__ */ t(se, { shouldFilter: !!I, className: "w-full", children: [
171
- I && /* @__PURE__ */ l(
172
- te,
174
+ children: /* @__PURE__ */ s(ie, { shouldFilter: !!D, className: "w-full", children: [
175
+ D && /* @__PURE__ */ l(
176
+ oe,
173
177
  {
174
178
  placeholder: F,
175
179
  className: "placeholder:text-d-muted-foreground",
@@ -177,8 +181,8 @@ function Ve(z) {
177
181
  onValueChange: w
178
182
  }
179
183
  ),
180
- /* @__PURE__ */ t(ie, { className: "max-h-60 overflow-auto overscroll-contain", children: [
181
- /* @__PURE__ */ l(oe, { children: E }),
184
+ /* @__PURE__ */ s(de, { className: "max-h-60 overflow-auto overscroll-contain", children: [
185
+ /* @__PURE__ */ l(ce, { children: E }),
182
186
  K && u && /* @__PURE__ */ l(R, { children: /* @__PURE__ */ l(
183
187
  A,
184
188
  {
@@ -186,7 +190,7 @@ function Ve(z) {
186
190
  onSelect: () => {
187
191
  u && (m(r ? [...n, u] : u), w(""), !r && C(!1));
188
192
  },
189
- children: /* @__PURE__ */ t("div", { className: "text-d-foreground text-xs", children: [
193
+ children: /* @__PURE__ */ s("div", { className: "text-d-foreground text-xs", children: [
190
194
  L,
191
195
  " “",
192
196
  u,
@@ -194,9 +198,9 @@ function Ve(z) {
194
198
  ] })
195
199
  }
196
200
  ) }),
197
- Object.entries(le).map(([e, s]) => /* @__PURE__ */ l(R, { heading: e || void 0, children: s.map((a) => {
198
- const p = n.includes(a.value), ae = r && d !== void 0 && !p && n.length >= d, M = a.disabled || ae;
199
- return /* @__PURE__ */ t(
201
+ Object.entries(re).map(([e, t]) => /* @__PURE__ */ l(R, { heading: e || void 0, children: t.map((a) => {
202
+ const p = n.includes(a.value), ne = r && d !== void 0 && !p && n.length >= d, M = a.disabled || ne;
203
+ return /* @__PURE__ */ s(
200
204
  A,
201
205
  {
202
206
  value: typeof a.label == "string" ? a.label : String(a.value),
@@ -208,7 +212,7 @@ function Ve(z) {
208
212
  !r && p && i.dropdownItem.selected
209
213
  ),
210
214
  children: [
211
- r && /* @__PURE__ */ l(fe, { checked: p, className: "mr-1" }),
215
+ r && /* @__PURE__ */ l(he, { checked: p, className: "mr-1" }),
212
216
  typeof a.label == "string" ? /* @__PURE__ */ l("span", { children: a.label }) : a.label
213
217
  ]
214
218
  },
@@ -226,5 +230,5 @@ function Ve(z) {
226
230
  ] });
227
231
  }
228
232
  export {
229
- Ve as AppSelect
233
+ je as AppSelect
230
234
  };