laif-ds 0.2.14 → 0.2.15

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,5 +1,8 @@
1
1
  "use client";
2
- var e = { exports: {} };
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);
3
6
  export {
4
- e as __module
7
+ a as default
5
8
  };
@@ -1,8 +1,5 @@
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
+ var e = {};
6
3
  export {
7
- a as default
4
+ e as __exports
8
5
  };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- var e = {};
2
+ var e = { exports: {} };
3
3
  export {
4
- e as __exports
4
+ e as __module
5
5
  };
@@ -1,13 +1,13 @@
1
1
  "use client";
2
- import { jsxs as o, jsx as t, Fragment as te } from "react/jsx-runtime";
3
- import { Badge as re } from "./badge.js";
4
- import { Command as le, CommandInput as ne, CommandList as ae, CommandEmpty as se, CommandGroup as k, CommandItem as D } from "./command.js";
2
+ import { jsxs as o, jsx as l, Fragment as te } from "react/jsx-runtime";
3
+ import { Badge as le } from "./badge.js";
4
+ import { Command as ne, CommandInput as re, CommandList as ae, CommandEmpty as se, CommandGroup as k, CommandItem as D } from "./command.js";
5
5
  import { Label as oe } from "./label.js";
6
6
  import { cn as g } from "../../lib/utils.js";
7
7
  import * as s from "react";
8
8
  import { Checkbox as ie } from "./checkbox.js";
9
9
  import { Icon as j } from "./icon.js";
10
- import { Popover as de, PopoverTrigger as ce, PopoverContent as ue } from "./popover.js";
10
+ import { Popover as ce, PopoverTrigger as de, PopoverContent as ue } from "./popover.js";
11
11
  import me from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
12
12
  const fe = {
13
13
  sm: "min-h-8 h-8 text-xs py-1.5",
@@ -22,7 +22,7 @@ function Se(B) {
22
22
  const {
23
23
  multiple: a = !1,
24
24
  options: f,
25
- value: N,
25
+ value: S,
26
26
  defaultValue: A,
27
27
  onValueChange: R,
28
28
  onClear: b,
@@ -32,108 +32,112 @@ function Se(B) {
32
32
  addItemPlaceholder: T = "Aggiungi",
33
33
  itemCountMessage: W = (e) => `${e} elementi selezionati`,
34
34
  maxSelectedMessage: X = (e) => `Puoi selezionare fino a ${e} elementi`,
35
- label: S,
35
+ label: P,
36
36
  className: $ = "",
37
37
  wrpClassName: q = "",
38
- searchable: P = !1,
38
+ searchable: V = !1,
39
39
  creatable: G = !1,
40
40
  groupBy: v = "group",
41
41
  maxSelected: i,
42
42
  showChipsInsteadOfCount: H = !1,
43
43
  disabled: x,
44
- size: V = "default"
45
- } = B, [C, w] = s.useState(!1), [d, y] = s.useState(""), c = s.useRef(null), [J, K] = s.useState(0), [Q, z] = s.useState(null);
44
+ size: z = "default"
45
+ } = B, [C, w] = s.useState(!1), [d, y] = s.useState(""), c = s.useRef(null), [J, K] = s.useState(0), [Q, N] = s.useState(null);
46
46
  s.useEffect(() => {
47
47
  if (c.current) {
48
48
  const e = c.current.closest(
49
49
  '[data-slot="drawer-content"]'
50
50
  );
51
- e && z(e);
52
- const l = c.current.closest(
51
+ e && N(e);
52
+ const n = c.current.closest(
53
53
  '[data-slot="sheet-content"]'
54
54
  );
55
- l && z(l);
55
+ n && N(n);
56
+ const t = c.current.closest(
57
+ '[data-slot="dialog-content"]'
58
+ );
59
+ t && N(t);
56
60
  }
57
61
  }, []);
58
- const O = N !== void 0, [U, Y] = s.useState(A), u = O ? N : U, m = (e) => {
62
+ const O = S !== void 0, [U, Y] = s.useState(A), u = O ? S : U, m = (e) => {
59
63
  O || Y(e), R?.(e);
60
- }, n = s.useMemo(() => a ? Array.isArray(u) ? u : [] : u != null ? [u] : [], [u, a]), p = s.useMemo(() => {
61
- const e = f.filter((l) => n.includes(l.value));
64
+ }, r = s.useMemo(() => a ? Array.isArray(u) ? u : [] : u != null ? [u] : [], [u, a]), p = s.useMemo(() => {
65
+ const e = f.filter((n) => r.includes(n.value));
62
66
  if (a) {
63
- const l = n.filter((r) => !e.find((h) => h.value === r)).map((r) => ({ value: r, label: r }));
64
- return [...e, ...l];
65
- } else if (n.length && !e.length)
66
- return [{ value: n[0], label: n[0] }];
67
+ const n = r.filter((t) => !e.find((h) => h.value === t)).map((t) => ({ value: t, label: t }));
68
+ return [...e, ...n];
69
+ } else if (r.length && !e.length)
70
+ return [{ value: r[0], label: r[0] }];
67
71
  return e;
68
- }, [f, n, a]), I = (e) => {
72
+ }, [f, r, a]), I = (e) => {
69
73
  if (!e.disabled)
70
74
  if (a) {
71
- const l = n.includes(e.value);
72
- if (!l && i !== void 0 && n.length >= i)
75
+ const n = r.includes(e.value);
76
+ if (!n && i !== void 0 && r.length >= i)
73
77
  return;
74
78
  m(
75
- l ? n.filter((r) => r !== e.value) : [...n, e.value]
79
+ n ? r.filter((t) => t !== e.value) : [...r, e.value]
76
80
  );
77
81
  } else
78
82
  m(e.value), w(!1);
79
83
  }, Z = s.useCallback(() => {
80
84
  m([]), y(""), b && b();
81
85
  }, [m, b]), _ = s.useMemo(() => v ? f.reduce(
82
- (e, l) => {
83
- const r = l[v] || "";
84
- return e[r] = e[r] || [], e[r].push(l), e;
86
+ (e, n) => {
87
+ const t = n[v] || "";
88
+ return e[t] = e[t] || [], e[t].push(n), e;
85
89
  },
86
90
  {}
87
91
  ) : { "": f }, [f, v]);
88
92
  return s.useEffect(() => {
89
93
  C && c.current && K(c.current.getBoundingClientRect().width);
90
94
  }, [C]), /* @__PURE__ */ o("div", { className: g("flex flex-col gap-2", q), children: [
91
- S && /* @__PURE__ */ t(oe, { children: S }),
95
+ P && /* @__PURE__ */ l(oe, { children: P }),
92
96
  /* @__PURE__ */ o(
93
- de,
97
+ ce,
94
98
  {
95
99
  open: x ? !1 : C,
96
100
  onOpenChange: (e) => !x && w(e),
97
101
  children: [
98
- /* @__PURE__ */ t(ce, { asChild: !0, children: /* @__PURE__ */ o(
102
+ /* @__PURE__ */ l(de, { asChild: !0, children: /* @__PURE__ */ o(
99
103
  "div",
100
104
  {
101
105
  ref: c,
102
106
  className: g(
103
107
  "bg-d-input border-d-border/50 focus-within:ring-d-ring flex min-h-10 w-full min-w-[100px] items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm focus-within:ring-1",
104
- fe[V],
108
+ fe[z],
105
109
  x && "cursor-not-allowed opacity-50",
106
110
  $
107
111
  ),
108
112
  children: [
109
- p.length === 0 ? /* @__PURE__ */ t("span", { className: "text-d-muted-foreground", children: E }) : a ? /* @__PURE__ */ o("div", { className: "flex h-full w-full min-w-0 items-center justify-between gap-2", children: [
110
- /* @__PURE__ */ t("div", { className: "flex min-w-0 flex-nowrap gap-1 overflow-auto", children: H ? /* @__PURE__ */ t(te, { children: p.map((e) => /* @__PURE__ */ o(
111
- re,
113
+ p.length === 0 ? /* @__PURE__ */ l("span", { className: "text-d-muted-foreground", children: E }) : a ? /* @__PURE__ */ o("div", { className: "flex h-full w-full min-w-0 items-center justify-between gap-2", children: [
114
+ /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-nowrap gap-1 overflow-auto", children: H ? /* @__PURE__ */ l(te, { children: p.map((e) => /* @__PURE__ */ o(
115
+ le,
112
116
  {
113
117
  variant: "secondary",
114
118
  className: "hover:bg-d-secondary/100 bg-d-secondary/50 border-d-border flex cursor-pointer items-center gap-1 border",
115
- onClick: (l) => {
116
- l.stopPropagation(), I(e);
119
+ onClick: (n) => {
120
+ n.stopPropagation(), I(e);
117
121
  },
118
122
  children: [
119
123
  e.label,
120
- !e.fixed && /* @__PURE__ */ t(j, { name: "X", size: "xs" })
124
+ !e.fixed && /* @__PURE__ */ l(j, { name: "X", size: "xs" })
121
125
  ]
122
126
  },
123
127
  e.value
124
- )) }) : /* @__PURE__ */ t("div", { children: W(p.length) }) }),
125
- /* @__PURE__ */ t(
128
+ )) }) : /* @__PURE__ */ l("div", { children: W(p.length) }) }),
129
+ /* @__PURE__ */ l(
126
130
  "div",
127
131
  {
128
132
  className: g(
129
133
  "border-d-input bg-d-accent flex aspect-square cursor-pointer items-center rounded-full p-1",
130
- he[V]
134
+ he[z]
131
135
  ),
132
136
  onClick: (e) => {
133
137
  e.stopPropagation(), e.preventDefault(), Z();
134
138
  },
135
139
  onMouseDown: (e) => e.preventDefault(),
136
- children: /* @__PURE__ */ t(
140
+ children: /* @__PURE__ */ l(
137
141
  j,
138
142
  {
139
143
  name: "X",
@@ -143,12 +147,12 @@ function Se(B) {
143
147
  )
144
148
  }
145
149
  )
146
- ] }) : /* @__PURE__ */ t("span", { children: p[0]?.label }),
147
- /* @__PURE__ */ t(me, { className: "h-4 w-4 opacity-50" })
150
+ ] }) : /* @__PURE__ */ l("span", { children: p[0]?.label }),
151
+ /* @__PURE__ */ l(me, { className: "h-4 w-4 opacity-50" })
148
152
  ]
149
153
  }
150
154
  ) }),
151
- /* @__PURE__ */ t(
155
+ /* @__PURE__ */ l(
152
156
  ue,
153
157
  {
154
158
  className: "p-0",
@@ -156,9 +160,9 @@ function Se(B) {
156
160
  align: "start",
157
161
  sideOffset: 4,
158
162
  container: Q,
159
- children: /* @__PURE__ */ o(le, { shouldFilter: !!P, className: "w-full", children: [
160
- P && /* @__PURE__ */ t("div", { className: "border-d-border border-b p-0.5", children: /* @__PURE__ */ t(
161
- ne,
163
+ children: /* @__PURE__ */ o(ne, { shouldFilter: !!V, className: "w-full", children: [
164
+ V && /* @__PURE__ */ l("div", { className: "border-d-border border-b p-0.5", children: /* @__PURE__ */ l(
165
+ re,
162
166
  {
163
167
  placeholder: L,
164
168
  value: d,
@@ -166,13 +170,13 @@ function Se(B) {
166
170
  }
167
171
  ) }),
168
172
  /* @__PURE__ */ o(ae, { className: "max-h-60 overflow-auto overscroll-contain", children: [
169
- /* @__PURE__ */ t(se, { children: F }),
170
- G && d && /* @__PURE__ */ t(k, { children: /* @__PURE__ */ t(
173
+ /* @__PURE__ */ l(se, { children: F }),
174
+ G && d && /* @__PURE__ */ l(k, { children: /* @__PURE__ */ l(
171
175
  D,
172
176
  {
173
177
  className: "cursor-pointer",
174
178
  onSelect: () => {
175
- d && (m(a ? [...n, d] : d), y(""), !a && w(!1));
179
+ d && (m(a ? [...r, d] : d), y(""), !a && w(!1));
176
180
  },
177
181
  children: /* @__PURE__ */ o("div", { className: "text-d-foreground text-xs", children: [
178
182
  T,
@@ -182,13 +186,13 @@ function Se(B) {
182
186
  ] })
183
187
  }
184
188
  ) }),
185
- Object.entries(_).map(([e, l]) => /* @__PURE__ */ t(k, { heading: e || void 0, children: l.map((r) => {
186
- const h = n.includes(r.value), ee = a && i !== void 0 && !h && n.length >= i, M = r.disabled || ee;
189
+ Object.entries(_).map(([e, n]) => /* @__PURE__ */ l(k, { heading: e || void 0, children: n.map((t) => {
190
+ const h = r.includes(t.value), ee = a && i !== void 0 && !h && r.length >= i, M = t.disabled || ee;
187
191
  return /* @__PURE__ */ o(
188
192
  D,
189
193
  {
190
- value: typeof r.label == "string" ? r.label : String(r.value),
191
- onSelect: () => !M && I(r),
194
+ value: typeof t.label == "string" ? t.label : String(t.value),
195
+ onSelect: () => !M && I(t),
192
196
  className: g(
193
197
  "cursor-pointer",
194
198
  M && "cursor-not-allowed opacity-50",
@@ -196,15 +200,15 @@ function Se(B) {
196
200
  // highlight single select
197
201
  ),
198
202
  children: [
199
- a && /* @__PURE__ */ t(ie, { checked: h, className: "mr-1" }),
200
- /* @__PURE__ */ t("span", { children: r.label })
203
+ a && /* @__PURE__ */ l(ie, { checked: h, className: "mr-1" }),
204
+ /* @__PURE__ */ l("span", { children: t.label })
201
205
  ]
202
206
  },
203
- r.value
207
+ t.value
204
208
  );
205
209
  }) }, e))
206
210
  ] }),
207
- a && i !== void 0 && n.length >= i && /* @__PURE__ */ t("div", { className: "border-d-border text-d-muted-foreground border-t px-2 py-1 text-xs", children: X(i) })
211
+ a && i !== void 0 && r.length >= i && /* @__PURE__ */ l("div", { className: "border-d-border text-d-muted-foreground border-t px-2 py-1 text-xs", children: X(i) })
208
212
  ] })
209
213
  }
210
214
  )
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { __module as x } from "../../_virtual/index4.js";
2
+ import { __module as x } from "../../_virtual/index7.js";
3
3
  var w;
4
4
  function O() {
5
5
  return w ? x.exports : (w = 1, function(d) {
@@ -3,7 +3,7 @@ import { stringify as w } from "../../comma-separated-tokens/index.js";
3
3
  import { ok as u } from "../../devlop/lib/default.js";
4
4
  import { svg as m, html as C } from "../../property-information/index.js";
5
5
  import { stringify as N } from "../../space-separated-tokens/index.js";
6
- import S from "../../../_virtual/index6.js";
6
+ import S from "../../../_virtual/index4.js";
7
7
  import { whitespace as j } from "../../hast-util-whitespace/lib/index.js";
8
8
  import { name as x } from "../../estree-util-is-identifier-name/lib/index.js";
9
9
  import { VFileMessage as h } from "../../vfile-message/lib/index.js";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { __exports as r } from "../../../_virtual/index7.js";
2
+ import { __exports as r } from "../../../_virtual/index6.js";
3
3
  import { __require as c } from "../../inline-style-parser/index.js";
4
4
  var f;
5
5
  function j() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "laif-ds",
3
3
  "private": false,
4
- "version": "0.2.14",
4
+ "version": "0.2.15",
5
5
  "type": "module",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",