laif-ds 0.1.88 → 0.1.90

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 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
- 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,86 +1,89 @@
1
1
  "use client";
2
- import { jsx as r, jsxs as l, Fragment as F } from "react/jsx-runtime";
2
+ import { jsx as r, jsxs as l, Fragment as A } from "react/jsx-runtime";
3
3
  import * as t from "react";
4
- import { useEffect as T } from "react";
5
- import { cn as p } from "../../lib/utils.js";
6
- import { Label as G } from "./label.js";
4
+ import { useEffect as E } from "react";
5
+ import { cn as m } from "../../lib/utils.js";
6
+ import { Label as F } from "./label.js";
7
7
  import { Badge as V } from "./badge.js";
8
- import { Button as N } from "./button.js";
8
+ import { Button as G } from "./button.js";
9
9
  import { Popover as X, PopoverTrigger as $, PopoverContent as q } from "./popover.js";
10
10
  import { Command as H, CommandList as I, CommandEmpty as J, CommandGroup as K, CommandItem as Q } from "./command.js";
11
11
  import { inputVariants as U } from "./input.js";
12
12
  import { Checkbox as Y } from "./checkbox.js";
13
- import { Icon as y } from "./icon.js";
14
- import Z from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
15
- const _ = t.createContext({ size: "default" });
16
- function me({
17
- options: s,
13
+ import { Icon as N } from "./icon.js";
14
+ import { selectTriggerVariants as Z } from "./async-select.js";
15
+ import _ from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
16
+ const ee = t.createContext({ size: "default" });
17
+ function pe({
18
+ options: i,
18
19
  value: n,
19
- onChange: o,
20
- onClear: h,
21
- placeholder: k = "Seleziona...",
22
- disabled: z = !1,
23
- size: g = "default",
20
+ onChange: s,
21
+ onClear: g,
22
+ placeholder: y = "Seleziona...",
23
+ disabled: k = !1,
24
+ size: f = "default",
24
25
  label: b,
25
- labelClassName: M,
26
- emptyMessage: P = "Nessun risultato trovato",
27
- className: R,
28
- filterPlaceholder: j = "Cerca...",
29
- filterable: D = !1,
30
- cancelLabel: O = "Cancella selezione",
31
- cancelButtonLabel: S = "Cancella",
26
+ labelClassName: z,
27
+ emptyMessage: M = "Nessun risultato trovato",
28
+ className: P,
29
+ filterPlaceholder: R = "Cerca...",
30
+ filterable: j = !1,
31
+ cancelLabel: D = "Cancella selezione",
32
+ cancelButtonLabel: O = "Cancella",
32
33
  maxSelectedItems: a
33
34
  }) {
34
- const m = t.useId(), [d, L] = t.useState(!1), [c, v] = t.useState(""), [B, W] = t.useState(
35
+ const p = t.useId(), [o, S] = t.useState(!1), [d, v] = t.useState(""), [L, B] = t.useState(
35
36
  void 0
36
- ), A = t.useRef(null), f = t.useRef(null), w = t.useCallback(
37
+ ), T = t.useRef(null), h = t.useRef(null), w = t.useCallback(
37
38
  (e) => {
38
39
  if (n.includes(e))
39
- o(n.filter((i) => i !== e));
40
+ s(n.filter((c) => c !== e));
40
41
  else {
41
42
  if (a && n.length >= a)
42
43
  return;
43
- o([...n, e]);
44
+ s([...n, e]);
44
45
  }
45
46
  },
46
- [n, o, a]
47
+ [n, s, a]
47
48
  ), x = t.useCallback(() => {
48
- o([]), v(""), h && h();
49
- }, [o]), u = t.useMemo(() => s.filter((e) => n.includes(e.value)), [s, n]), E = t.useMemo(() => c ? s.filter(
50
- (e) => e.label.toLowerCase().includes(c.toLowerCase())
51
- ) : s, [s, c]), C = t.useMemo(() => a ? n.length >= a : !1, [n, a]);
52
- return T(() => {
53
- if (d && f.current) {
54
- const e = f.current.getBoundingClientRect();
55
- W(e.width);
49
+ s([]), v(""), g && g();
50
+ }, [s]), u = t.useMemo(() => i.filter((e) => n.includes(e.value)), [i, n]), W = t.useMemo(() => d ? i.filter(
51
+ (e) => e.label.toLowerCase().includes(d.toLowerCase())
52
+ ) : i, [i, d]), C = t.useMemo(() => a ? n.length >= a : !1, [n, a]);
53
+ return E(() => {
54
+ if (o && h.current) {
55
+ const e = h.current.getBoundingClientRect();
56
+ B(e.width);
56
57
  }
57
- }, [d]), /* @__PURE__ */ r(_.Provider, { value: { size: g, id: m }, children: /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
58
- b && /* @__PURE__ */ r(G, { htmlFor: m, className: M, children: b }),
58
+ }, [o]), /* @__PURE__ */ r(ee.Provider, { value: { size: f, id: p }, children: /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
59
+ b && /* @__PURE__ */ r(F, { htmlFor: p, className: m(z, "w-fit"), children: b }),
59
60
  /* @__PURE__ */ r(
60
61
  "div",
61
62
  {
62
- ref: A,
63
+ ref: T,
63
64
  className: "relative w-full",
64
65
  "data-slot": "app-multiple-select-dropdown",
65
- children: /* @__PURE__ */ l(X, { open: d, onOpenChange: L, children: [
66
+ children: /* @__PURE__ */ l(X, { open: o, onOpenChange: S, children: [
66
67
  /* @__PURE__ */ r($, { asChild: !0, children: /* @__PURE__ */ l(
67
- N,
68
+ "button",
68
69
  {
69
- id: m,
70
+ id: p,
70
71
  type: "button",
71
- variant: "outline",
72
72
  role: "combobox",
73
- "aria-expanded": d,
74
- disabled: z,
75
- ref: f,
76
- className: p(
77
- "!bg-d-input relative w-full justify-between border font-normal",
78
- "border-d-input ring-offset-background focus:ring-ring flex items-center rounded-md border whitespace-nowrap shadow-sm focus:ring-1 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",
73
+ "aria-expanded": o,
74
+ disabled: k,
75
+ ref: h,
76
+ className: m(
77
+ Z({ size: f }),
78
+ "!bg-d-input hover:bg-d-input/50 relative w-full justify-between font-normal",
79
+ "ring-offset-background border-d-border/50 flex items-center rounded-md border whitespace-nowrap focus:outline-none disabled:cursor-not-allowed disabled:opacity-50",
79
80
  "aria-invalid:ring-d-destructive/20 dark:aria-invalid:ring-d-destructive/40 aria-invalid:border-d-destructive",
80
- R
81
+ "focus-visible:ring-d-ring focus-visible:ring-1",
82
+ o && "ring-d-ring ring-1",
83
+ P
81
84
  ),
82
85
  children: [
83
- /* @__PURE__ */ r("div", { className: "flex w-full items-center justify-between gap-2 overflow-hidden", children: u.length > 0 ? /* @__PURE__ */ l(F, { children: [
86
+ /* @__PURE__ */ r("div", { className: "flex w-full items-center justify-between gap-2 overflow-hidden", children: u.length > 0 ? /* @__PURE__ */ l(A, { children: [
84
87
  /* @__PURE__ */ l(
85
88
  V,
86
89
  {
@@ -100,9 +103,9 @@ function me({
100
103
  e.stopPropagation(), e.preventDefault(), x();
101
104
  },
102
105
  onMouseDown: (e) => e.preventDefault(),
103
- "aria-label": O,
106
+ "aria-label": D,
104
107
  children: /* @__PURE__ */ r(
105
- y,
108
+ N,
106
109
  {
107
110
  name: "X",
108
111
  size: "xs",
@@ -111,29 +114,29 @@ function me({
111
114
  )
112
115
  }
113
116
  )
114
- ] }) : /* @__PURE__ */ r("span", { className: "text-d-muted-foreground", children: k }) }),
115
- /* @__PURE__ */ r(Z, { className: "ml-1 h-4 w-4 shrink-0 opacity-50" })
117
+ ] }) : /* @__PURE__ */ r("span", { className: "text-d-muted-foreground", children: y }) }),
118
+ /* @__PURE__ */ r(_, { className: "ml-1 h-4 w-4 shrink-0 opacity-50" })
116
119
  ]
117
120
  }
118
121
  ) }),
119
122
  /* @__PURE__ */ r(
120
123
  q,
121
124
  {
122
- className: p("p-0"),
123
- style: { width: B },
125
+ className: m("p-0"),
126
+ style: { width: L },
124
127
  align: "start",
125
128
  side: "bottom",
126
129
  sideOffset: 4,
127
130
  onWheel: (e) => e.stopPropagation(),
128
131
  avoidCollisions: !1,
129
- children: /* @__PURE__ */ l(H, { className: "bg-d-popover w-full rounded-md border border-none shadow-lg", children: [
130
- D && /* @__PURE__ */ l("div", { className: "border-d-border flex items-center justify-between border-b px-3", children: [
132
+ children: /* @__PURE__ */ l(H, { className: "bg-d-popover w-full rounded-md border border-none", children: [
133
+ j && /* @__PURE__ */ l("div", { className: "border-d-border flex items-center justify-between border-b px-3", children: [
131
134
  /* @__PURE__ */ l("div", { className: "flex items-center", children: [
132
135
  /* @__PURE__ */ r(
133
- y,
136
+ N,
134
137
  {
135
138
  name: "Search",
136
- className: "text-d-accent-foreground",
139
+ className: "text-d-accent-foreground opacity-50",
137
140
  size: "sm"
138
141
  }
139
142
  ),
@@ -141,43 +144,43 @@ function me({
141
144
  "input",
142
145
  {
143
146
  id: "app-multiple-select-dropdown-filter",
144
- placeholder: j,
145
- value: c,
147
+ placeholder: R,
148
+ value: d,
146
149
  onChange: (e) => v(e.target.value),
147
- className: `focus-visible:ring-none border-none focus-visible:border-none disabled:opacity-50 ${U({ size: g })} !shadow-none`
150
+ className: `focus-visible:ring-none border-none focus-visible:border-none disabled:opacity-50 ${U({ size: f })} !shadow-none`
148
151
  }
149
152
  )
150
153
  ] }),
151
154
  u.length > 0 && /* @__PURE__ */ r(
152
- N,
155
+ G,
153
156
  {
154
157
  variant: "ghost",
155
158
  size: "sm",
156
159
  className: "h-6 px-2 text-xs",
157
160
  onClick: x,
158
- children: S
161
+ children: O
159
162
  }
160
163
  )
161
164
  ] }),
162
165
  /* @__PURE__ */ l(I, { className: "max-h-60 w-full", children: [
163
- /* @__PURE__ */ r(J, { children: P }),
164
- /* @__PURE__ */ r(K, { children: E.map((e) => {
165
- const i = n.includes(e.value);
166
+ /* @__PURE__ */ r(J, { children: M }),
167
+ /* @__PURE__ */ r(K, { children: W.map((e) => {
168
+ const c = n.includes(e.value);
166
169
  return /* @__PURE__ */ l(
167
170
  Q,
168
171
  {
169
172
  value: e.value,
170
- disabled: e.disabled || !i && C,
173
+ disabled: e.disabled || !c && C,
171
174
  onSelect: () => w(e.value),
172
- className: p(
175
+ className: m(
173
176
  "aria-selected:!bg-d-accent aria-selected:text-d-accent-foreground flex cursor-pointer items-center gap-2 px-2 py-1.5",
174
- (e.disabled || !i && C) && "cursor-not-allowed opacity-50"
177
+ (e.disabled || !c && C) && "cursor-not-allowed opacity-50"
175
178
  ),
176
179
  children: [
177
180
  /* @__PURE__ */ r(
178
181
  Y,
179
182
  {
180
- checked: i,
183
+ checked: c,
181
184
  className: "z-10 mr-2 flex-shrink-0",
182
185
  onCheckedChange: () => {
183
186
  console.log("checkbox change for:", e.value), w(e.value);
@@ -200,5 +203,5 @@ function me({
200
203
  ] }) });
201
204
  }
202
205
  export {
203
- me as AppMultipleSelectDropdown
206
+ pe as AppMultipleSelectDropdown
204
207
  };
@@ -1,42 +1,62 @@
1
1
  "use client";
2
- import { jsxs as c, jsx as t } from "react/jsx-runtime";
3
- import { Select as g, SelectTrigger as h, SelectValue as b, SelectContent as C, SelectItem as B } from "./select.js";
4
- import { SelectGroup as I, SelectLabel as L, SelectScrollDownButton as T, SelectScrollUpButton as U, SelectSeparator as V } from "./select.js";
5
- function j({
2
+ import { jsxs as s, jsx as n } from "react/jsx-runtime";
3
+ import * as b from "react";
4
+ import { Select as C, SelectTrigger as O, SelectValue as B, SelectContent as G, SelectSeparator as N, SelectGroup as j, SelectLabel as w, SelectItem as D } from "./select.js";
5
+ import { SelectScrollDownButton as F, SelectScrollUpButton as R } from "./select.js";
6
+ function U({
6
7
  options: p,
7
- placeholder: o,
8
- children: u,
9
- label: i,
10
- className: d,
11
- labelKey: r,
12
- valueKey: n,
13
- descriptionKey: a,
14
- isOptionDisabled: m,
15
- ...x
8
+ placeholder: d,
9
+ children: m,
10
+ label: g,
11
+ className: h,
12
+ labelKey: S,
13
+ valueKey: o,
14
+ descriptionKey: u,
15
+ groupNameKey: a,
16
+ isOptionDisabled: f,
17
+ ...A
16
18
  }) {
17
- return /* @__PURE__ */ c(g, { ...x, label: i, className: d, children: [
18
- u || /* @__PURE__ */ t(h, { className: "w-full", children: /* @__PURE__ */ t(b, { placeholder: o }) }),
19
- /* @__PURE__ */ t(C, { children: p.map((e) => {
20
- const l = r && n, s = String(l ? e[n] : e.value), A = l ? String(e[r]) : e.label, S = l && a ? String(e[a]) : null, f = l ? m?.(e) ?? !1 : e.disabled;
21
- return /* @__PURE__ */ t(B, { value: s, disabled: f, children: /* @__PURE__ */ c("span", { className: "flex flex-col", children: [
22
- /* @__PURE__ */ t("span", { children: A }),
23
- S && /* @__PURE__ */ c("span", { className: "text-muted-foreground text-d-tertiary text-xs", children: [
24
- "- ",
25
- S
19
+ const i = (t) => {
20
+ const c = S && o, e = String(c ? t[o] : t.value), r = c ? String(t[S]) : t.label, l = c && u ? String(t[u]) : null, x = c ? f?.(t) ?? !1 : t.disabled;
21
+ return /* @__PURE__ */ n(D, { value: e, disabled: x, children: /* @__PURE__ */ s("span", { className: "flex flex-col", children: [
22
+ /* @__PURE__ */ n("span", { children: r }),
23
+ l && /* @__PURE__ */ s("span", { className: "text-muted-foreground text-d-tertiary text-xs", children: [
24
+ "- ",
25
+ l
26
+ ] })
27
+ ] }) }, e);
28
+ };
29
+ return /* @__PURE__ */ s(C, { ...A, label: g, className: h, children: [
30
+ m || /* @__PURE__ */ n(O, { className: "w-full", children: /* @__PURE__ */ n(B, { placeholder: d }) }),
31
+ /* @__PURE__ */ n(G, { children: (() => {
32
+ if (!p.some((e) => a ? String(e[a]) : e.groupName))
33
+ return p.map(i);
34
+ const c = p.reduce(
35
+ (e, r) => {
36
+ const l = a ? String(r[a]) : r.groupName || "Altro";
37
+ return e[l] || (e[l] = []), e[l].push(r), e;
38
+ },
39
+ {}
40
+ );
41
+ return Object.entries(c).map(([e, r], l) => /* @__PURE__ */ s(b.Fragment, { children: [
42
+ l > 0 && /* @__PURE__ */ n(N, {}),
43
+ /* @__PURE__ */ s(j, { children: [
44
+ /* @__PURE__ */ n(w, { children: e }),
45
+ r.map(i)
26
46
  ] })
27
- ] }) }, s);
28
- }) })
47
+ ] }, e));
48
+ })() })
29
49
  ] });
30
50
  }
31
51
  export {
32
- j as AppSelect,
33
- C as AppSelectContent,
34
- I as AppSelectGroup,
35
- B as AppSelectItem,
36
- L as AppSelectLabel,
37
- T as AppSelectScrollDownButton,
38
- U as AppSelectScrollUpButton,
39
- V as AppSelectSeparator,
40
- h as AppSelectTrigger,
41
- b as AppSelectValue
52
+ U as AppSelect,
53
+ G as AppSelectContent,
54
+ j as AppSelectGroup,
55
+ D as AppSelectItem,
56
+ w as AppSelectLabel,
57
+ F as AppSelectScrollDownButton,
58
+ R as AppSelectScrollUpButton,
59
+ N as AppSelectSeparator,
60
+ O as AppSelectTrigger,
61
+ B as AppSelectValue
42
62
  };