laif-ds 0.2.53 → 0.2.55

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 t } from "../node_modules/eventemitter3/index2.js";
4
- var r = t();
5
- const m = /* @__PURE__ */ e(r);
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
- m 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,8 +1,8 @@
1
1
  "use client";
2
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);
3
+ import { __require as t } from "../node_modules/eventemitter3/index2.js";
4
+ var r = t();
5
+ const m = /* @__PURE__ */ e(r);
6
6
  export {
7
- x as default
7
+ m as default
8
8
  };
@@ -1,19 +1,19 @@
1
1
  "use client";
2
- import { jsxs as s, jsx as l, Fragment as ae } from "react/jsx-runtime";
3
- import { Badge as re } from "./badge.js";
4
- import { Command as ne, CommandInput as te, CommandList as se, CommandEmpty as ie, CommandGroup as R, CommandItem as A } from "./command.js";
5
- import { Label as oe } from "./label.js";
6
- import { designTokens as d } from "../../lib/design-tokens.js";
2
+ import { jsxs as s, jsx as l, Fragment as re } from "react/jsx-runtime";
3
+ import { Badge as ne } from "./badge.js";
4
+ import { Command as te, CommandInput as se, CommandList as ie, CommandEmpty as oe, CommandGroup as R, CommandItem as A } from "./command.js";
5
+ import { Label as de } from "./label.js";
6
+ import { designTokens as i } from "../../lib/design-tokens.js";
7
7
  import { cn as y } from "../../lib/utils.js";
8
- import { useState as h, useRef as de, useMemo as S, useCallback as ce, useEffect as ue } from "react";
9
- import { Checkbox as me } from "./checkbox.js";
8
+ import { useState as h, useRef as ce, useMemo as S, useCallback as ue, useEffect as me } from "react";
9
+ import { Checkbox as fe } from "./checkbox.js";
10
10
  import { Icon as z } from "./icon.js";
11
- import { Popover as fe, PopoverTrigger as pe, PopoverContent as he } from "./popover.js";
12
- import ge from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
13
- const ve = {
14
- sm: d.sizes.sm,
15
- default: d.sizes.default,
16
- lg: d.sizes.lg
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 = {
14
+ sm: i.sizes.sm,
15
+ default: i.sizes.default,
16
+ lg: i.sizes.lg
17
17
  };
18
18
  function Ve(P) {
19
19
  const {
@@ -31,18 +31,19 @@ function Ve(P) {
31
31
  maxSelectedMessage: G = (e) => `Puoi selezionare fino a ${e} elementi`,
32
32
  label: D,
33
33
  className: q = "",
34
- wrpClassName: H = "",
35
- searchable: O = !1,
36
- creatable: J = !1,
34
+ labelClassName: H = "",
35
+ wrpClassName: J = "",
36
+ searchable: I = !1,
37
+ creatable: K = !1,
37
38
  groupBy: v = "group",
38
- maxSelected: o,
39
- showChipsInsteadOfCount: K = !1,
39
+ maxSelected: d,
40
+ showChipsInsteadOfCount: Q = !1,
40
41
  disabled: b,
41
- size: Q = "default",
42
- isSingleSelectClearable: U = !1
43
- } = P, [x, C] = h(!1), [u, w] = h(""), N = de(null), [V, Y] = h(0), k = P.hasOwnProperty("value"), [Z, _] = h(T), i = k ? B : Z, m = (e) => {
44
- k || _(e), W?.(e);
45
- }, n = S(() => r ? Array.isArray(i) ? i : [] : i != null ? [i] : [], [i, r]), f = S(() => {
42
+ size: U = "default",
43
+ isSingleSelectClearable: Y = !1
44
+ } = P, [x, C] = h(!1), [u, w] = h(""), N = ce(null), [O, Z] = h(0), V = P.hasOwnProperty("value"), [_, ee] = h(T), o = V ? B : _, m = (e) => {
45
+ V || ee(e), W?.(e);
46
+ }, n = S(() => r ? Array.isArray(o) ? o : [] : o != null ? [o] : [], [o, r]), f = S(() => {
46
47
  const e = c.filter((t) => n.includes(t.value));
47
48
  if (r) {
48
49
  const t = n.filter((a) => !e.find((p) => p.value === a)).map((a) => ({ value: a, label: a }));
@@ -50,60 +51,60 @@ function Ve(P) {
50
51
  } else if (n.length && !e.length)
51
52
  return [{ value: n[0], label: n[0] }];
52
53
  return e;
53
- }, [c, n, r]), I = (e) => {
54
+ }, [c, n, r]), k = (e) => {
54
55
  if (!e.disabled)
55
56
  if (r) {
56
57
  const t = n.includes(e.value);
57
- if (!t && o !== void 0 && n.length >= o)
58
+ if (!t && d !== void 0 && n.length >= d)
58
59
  return;
59
60
  m(
60
61
  t ? n.filter((a) => a !== e.value) : [...n, e.value]
61
62
  );
62
63
  } else
63
64
  m(e.value), C(!1);
64
- }, j = ce(() => {
65
+ }, j = ue(() => {
65
66
  m(r ? [] : void 0), w(""), g && g();
66
- }, [m, g, r]), ee = S(() => v ? c.reduce(
67
+ }, [m, g, r]), le = S(() => v ? c.reduce(
67
68
  (e, t) => {
68
69
  const a = t[v] || "";
69
70
  return e[a] = e[a] || [], e[a].push(t), e;
70
71
  },
71
72
  {}
72
73
  ) : { "": c }, [c, v]);
73
- return ue(() => {
74
- N.current && Y(N.current.getBoundingClientRect().width);
75
- }, [x, n, c]), /* @__PURE__ */ s("div", { className: y("flex flex-col gap-1.5", H), children: [
76
- D && /* @__PURE__ */ l(oe, { children: D }),
74
+ return me(() => {
75
+ N.current && Z(N.current.getBoundingClientRect().width);
76
+ }, [x, n, c]), /* @__PURE__ */ s("div", { className: y("flex flex-col gap-1.5", J), children: [
77
+ D && /* @__PURE__ */ l(de, { className: H, children: D }),
77
78
  /* @__PURE__ */ s(
78
- fe,
79
+ pe,
79
80
  {
80
81
  open: b ? !1 : x,
81
82
  onOpenChange: (e) => !b && C(e),
82
83
  modal: !0,
83
84
  children: [
84
- /* @__PURE__ */ l(pe, { asChild: !0, children: /* @__PURE__ */ s(
85
+ /* @__PURE__ */ l(he, { asChild: !0, children: /* @__PURE__ */ s(
85
86
  "div",
86
87
  {
87
88
  ref: N,
88
89
  className: y(
89
- d.input.base,
90
- d.radius.default,
91
- d.focusRingWithin,
90
+ i.input.base,
91
+ i.radius.default,
92
+ i.focusRingWithin,
92
93
  "flex w-full min-w-[100px] cursor-pointer items-center justify-between gap-2",
93
- x && d.activeRing,
94
- ve[Q],
94
+ x && i.activeRing,
95
+ be[U],
95
96
  b && "cursor-not-allowed opacity-50",
96
97
  q
97
98
  ),
98
99
  children: [
99
100
  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: [
100
- /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-nowrap gap-1 overflow-auto", children: K ? /* @__PURE__ */ l(ae, { children: f.map((e) => /* @__PURE__ */ s(
101
- re,
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__ */ s(
102
+ ne,
102
103
  {
103
104
  variant: "secondary",
104
105
  className: "hover:bg-d-secondary/100 bg-d-secondary/50 border-d-border flex cursor-pointer items-center gap-1 border",
105
106
  onClick: (t) => {
106
- t.stopPropagation(), I(e);
107
+ t.stopPropagation(), k(e);
107
108
  },
108
109
  children: [
109
110
  e.label,
@@ -133,7 +134,7 @@ function Ve(P) {
133
134
  )
134
135
  ] }) : /* @__PURE__ */ s("div", { className: "flex h-full w-full min-w-0 items-center justify-between gap-2", children: [
135
136
  /* @__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 }),
136
- U && i !== void 0 && i !== null && /* @__PURE__ */ l(
137
+ Y && o !== void 0 && o !== null && /* @__PURE__ */ l(
137
138
  "div",
138
139
  {
139
140
  className: "border-d-input bg-d-accent cursor-pointer rounded-full p-1",
@@ -153,20 +154,20 @@ function Ve(P) {
153
154
  }
154
155
  )
155
156
  ] }),
156
- /* @__PURE__ */ l(ge, { className: "h-4 w-4 opacity-50" })
157
+ /* @__PURE__ */ l(ve, { className: "h-4 w-4 opacity-50" })
157
158
  ]
158
159
  }
159
160
  ) }),
160
161
  /* @__PURE__ */ l(
161
- he,
162
+ ge,
162
163
  {
163
164
  className: "p-0",
164
- style: { width: V > 0 ? V : "auto" },
165
+ style: { width: O > 0 ? O : "auto" },
165
166
  align: "start",
166
167
  sideOffset: 4,
167
- children: /* @__PURE__ */ s(ne, { shouldFilter: !!O, className: "w-full", children: [
168
- O && /* @__PURE__ */ l(
169
- te,
168
+ children: /* @__PURE__ */ s(te, { shouldFilter: !!I, className: "w-full", children: [
169
+ I && /* @__PURE__ */ l(
170
+ se,
170
171
  {
171
172
  placeholder: F,
172
173
  className: "placeholder:text-d-muted-foreground",
@@ -174,9 +175,9 @@ function Ve(P) {
174
175
  onValueChange: w
175
176
  }
176
177
  ),
177
- /* @__PURE__ */ s(se, { className: "max-h-60 overflow-auto overscroll-contain", children: [
178
- /* @__PURE__ */ l(ie, { children: E }),
179
- J && u && /* @__PURE__ */ l(R, { children: /* @__PURE__ */ l(
178
+ /* @__PURE__ */ s(ie, { className: "max-h-60 overflow-auto overscroll-contain", children: [
179
+ /* @__PURE__ */ l(oe, { children: E }),
180
+ K && u && /* @__PURE__ */ l(R, { children: /* @__PURE__ */ l(
180
181
  A,
181
182
  {
182
183
  className: "cursor-pointer",
@@ -191,20 +192,21 @@ function Ve(P) {
191
192
  ] })
192
193
  }
193
194
  ) }),
194
- Object.entries(ee).map(([e, t]) => /* @__PURE__ */ l(R, { heading: e || void 0, children: t.map((a) => {
195
- const p = n.includes(a.value), le = r && o !== void 0 && !p && n.length >= o, M = a.disabled || le;
195
+ Object.entries(le).map(([e, t]) => /* @__PURE__ */ l(R, { heading: e || void 0, children: t.map((a) => {
196
+ const p = n.includes(a.value), ae = r && d !== void 0 && !p && n.length >= d, M = a.disabled || ae;
196
197
  return /* @__PURE__ */ s(
197
198
  A,
198
199
  {
199
200
  value: typeof a.label == "string" ? a.label : String(a.value),
200
- onSelect: () => !M && I(a),
201
+ onSelect: () => !M && k(a),
201
202
  className: y(
202
203
  "cursor-pointer",
204
+ i.dropdownItem.hover,
203
205
  M && "cursor-not-allowed opacity-50",
204
- !r && p && "bg-d-accent/75 text-d-accent-foreground"
206
+ !r && p && i.dropdownItem.selected
205
207
  ),
206
208
  children: [
207
- r && /* @__PURE__ */ l(me, { checked: p, className: "mr-1" }),
209
+ r && /* @__PURE__ */ l(fe, { checked: p, className: "mr-1" }),
208
210
  typeof a.label == "string" ? /* @__PURE__ */ l("span", { children: a.label }) : a.label
209
211
  ]
210
212
  },
@@ -212,7 +214,7 @@ function Ve(P) {
212
214
  );
213
215
  }) }, e))
214
216
  ] }),
215
- r && o !== void 0 && n.length >= o && /* @__PURE__ */ l("div", { className: "border-d-border text-d-muted-foreground border-t px-2 py-1 text-xs", children: G(o) })
217
+ r && d !== void 0 && n.length >= d && /* @__PURE__ */ l("div", { className: "border-d-border text-d-muted-foreground border-t px-2 py-1 text-xs", children: G(d) })
216
218
  ] })
217
219
  }
218
220
  )
@@ -0,0 +1,123 @@
1
+ "use client";
2
+ import { jsxs as d, jsx as e } from "react/jsx-runtime";
3
+ import { cn as r } from "../../lib/utils.js";
4
+ import { cva as k } from "../../node_modules/class-variance-authority/dist/index.js";
5
+ import * as c from "react";
6
+ import { Label as g } from "./label.js";
7
+ import { Tooltip as z, TooltipTrigger as B, TooltipContent as C } from "./tooltip.js";
8
+ const x = k(
9
+ "inline-flex items-center justify-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-d-ring focus-visible:ring-offset-2",
10
+ {
11
+ variants: {
12
+ variant: {
13
+ default: "hover:text-d-foreground text-d-muted-foreground",
14
+ primary: "hover:text-d-primary text-d-primary/70",
15
+ secondary: "hover:text-d-secondary-foreground text-d-secondary-foreground/70",
16
+ accent: "hover:text-d-accent-foreground text-d-accent-foreground/70",
17
+ muted: "hover:text-d-muted-foreground text-d-muted-foreground/50",
18
+ ghost: "hover:bg-d-accent hover:text-d-accent-foreground"
19
+ },
20
+ size: {
21
+ sm: "text-xs",
22
+ default: "text-sm",
23
+ lg: "text-base"
24
+ }
25
+ },
26
+ defaultVariants: {
27
+ variant: "default",
28
+ size: "default"
29
+ }
30
+ }
31
+ );
32
+ function E({
33
+ content: o,
34
+ children: n,
35
+ label: t,
36
+ labelClassName: i,
37
+ header: f,
38
+ variant: v = "primary",
39
+ triggerVariant: l = "default",
40
+ size: u = "default",
41
+ className: m,
42
+ wrpClassName: p,
43
+ contentClassName: h,
44
+ side: b = "top",
45
+ align: y = "center",
46
+ sideOffset: T = 4,
47
+ matchTriggerWidth: s = !1,
48
+ delayDuration: N = 200,
49
+ disabled: R = !1,
50
+ asChild: j = !1
51
+ }) {
52
+ const [w, A] = c.useState(), a = c.useRef(null);
53
+ return c.useEffect(() => {
54
+ s && a.current && A(a.current.getBoundingClientRect().width);
55
+ }, [s]), R ? /* @__PURE__ */ d("div", { className: r("flex flex-col gap-2", p), children: [
56
+ t && /* @__PURE__ */ e(g, { className: i, children: t }),
57
+ /* @__PURE__ */ e(
58
+ "div",
59
+ {
60
+ className: r(
61
+ x({ variant: l, size: u }),
62
+ m
63
+ ),
64
+ children: n
65
+ }
66
+ )
67
+ ] }) : /* @__PURE__ */ d("div", { className: r("flex flex-col gap-2", p), children: [
68
+ t && /* @__PURE__ */ e(g, { className: i, children: t }),
69
+ /* @__PURE__ */ d(z, { delayDuration: N, children: [
70
+ /* @__PURE__ */ e(B, { asChild: j, children: /* @__PURE__ */ e(
71
+ "div",
72
+ {
73
+ ref: a,
74
+ className: r(
75
+ x({ variant: l, size: u }),
76
+ m
77
+ ),
78
+ children: n
79
+ }
80
+ ) }),
81
+ /* @__PURE__ */ d(
82
+ C,
83
+ {
84
+ variant: v,
85
+ side: b,
86
+ align: y,
87
+ sideOffset: T,
88
+ className: r(h),
89
+ style: {
90
+ width: s ? w : void 0
91
+ },
92
+ children: [
93
+ f && /* @__PURE__ */ e("div", { className: "border-d-border mb-2 border-b pb-2 font-semibold", children: f }),
94
+ o
95
+ ]
96
+ }
97
+ )
98
+ ] })
99
+ ] });
100
+ }
101
+ function F({
102
+ text: o,
103
+ className: n,
104
+ variant: t = "primary",
105
+ truncate: i = !0
106
+ }) {
107
+ return /* @__PURE__ */ e(E, { content: o, variant: t, asChild: !0, children: /* @__PURE__ */ e(
108
+ "span",
109
+ {
110
+ className: r(
111
+ "text-d-secondary-foreground block w-full min-w-0",
112
+ i && "truncate",
113
+ n
114
+ ),
115
+ children: o
116
+ }
117
+ ) });
118
+ }
119
+ export {
120
+ F as AppTextTooltip,
121
+ E as AppTooltip,
122
+ E as default
123
+ };