laif-ds 0.1.14 → 0.1.16
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.
- package/dist/_virtual/index2.js +5 -2
- package/dist/_virtual/index3.js +5 -5
- package/dist/_virtual/index4.js +2 -5
- package/dist/_virtual/index5.js +2 -5
- package/dist/_virtual/index6.js +5 -2
- package/dist/components/ui/app-sidebar.js +42 -0
- package/dist/components/ui/async-select.js +119 -104
- package/dist/components/ui/badge.js +5 -5
- package/dist/components/ui/breadcrumb.js +2 -2
- package/dist/components/ui/button.js +8 -8
- package/dist/components/ui/card.js +48 -29
- package/dist/components/ui/chart.js +1 -1
- package/dist/components/ui/chat-message.js +4 -4
- package/dist/components/ui/command.js +1 -1
- package/dist/components/ui/context-menu.js +1 -1
- package/dist/components/ui/drawer.js +1 -1
- package/dist/components/ui/file-preview.js +1 -1
- package/dist/components/ui/gantt/components/Chart/Chart.js +1 -1
- package/dist/components/ui/input-selector.js +9 -9
- package/dist/components/ui/input.js +12 -12
- package/dist/components/ui/multiple-selector.js +111 -111
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sidebar.js +476 -534
- package/dist/components/ui/slider.js +132 -0
- package/dist/components/ui/table.js +1 -1
- package/dist/components/ui/toaster.js +3 -3
- package/dist/dist/components/ui/table.js +1 -1
- package/dist/index.d.ts +86 -35
- package/dist/index.js +103 -99
- package/dist/node_modules/@radix-ui/react-slider/dist/index.js +439 -0
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-collection/dist/index.js +49 -0
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-primitive/dist/index.js +33 -0
- package/dist/node_modules/@radix-ui/react-slider/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +55 -0
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +7 -4
|
@@ -18,7 +18,7 @@ const b = C(
|
|
|
18
18
|
variants: {
|
|
19
19
|
isUser: {
|
|
20
20
|
true: "bg-d-primary text-d-primary-foreground",
|
|
21
|
-
false: "bg-d-secondary text-foreground"
|
|
21
|
+
false: "bg-d-secondary text-d-foreground"
|
|
22
22
|
},
|
|
23
23
|
animation: {
|
|
24
24
|
none: "",
|
|
@@ -98,7 +98,7 @@ const b = C(
|
|
|
98
98
|
children: [
|
|
99
99
|
/* @__PURE__ */ l("div", { className: i(b({ isUser: t, animation: d })), children: [
|
|
100
100
|
/* @__PURE__ */ e(h, { fallback: /* @__PURE__ */ e("div", { className: "text-d-secondary-foreground", children: "Caricamento..." }), children: /* @__PURE__ */ e(x, { children: n.text }) }),
|
|
101
|
-
m ? /* @__PURE__ */ e("div", { className: "absolute -bottom-4 right-2 flex space-x-1 rounded-lg border bg-d-background p-1 text-foreground opacity-0 transition-opacity group-hover/message:opacity-100", children: m }) : null
|
|
101
|
+
m ? /* @__PURE__ */ e("div", { className: "absolute -bottom-4 right-2 flex space-x-1 rounded-lg border bg-d-background p-1 text-d-foreground opacity-0 transition-opacity group-hover/message:opacity-100", children: m }) : null
|
|
102
102
|
] }),
|
|
103
103
|
c && r ? /* @__PURE__ */ e(
|
|
104
104
|
"time",
|
|
@@ -151,7 +151,7 @@ const L = ({ part: s }) => {
|
|
|
151
151
|
onOpenChange: r,
|
|
152
152
|
className: "group w-full overflow-hidden rounded-lg border bg-d-secondary/50",
|
|
153
153
|
children: [
|
|
154
|
-
/* @__PURE__ */ e("div", { className: "flex items-center p-2", children: /* @__PURE__ */ e(S, { asChild: !0, children: /* @__PURE__ */ l("button", { className: "flex items-center gap-2 text-sm text-d-secondary-foreground hover:text-foreground", children: [
|
|
154
|
+
/* @__PURE__ */ e("div", { className: "flex items-center p-2", children: /* @__PURE__ */ e(S, { asChild: !0, children: /* @__PURE__ */ l("button", { className: "flex items-center gap-2 text-sm text-d-secondary-foreground hover:text-d-foreground", children: [
|
|
155
155
|
/* @__PURE__ */ e(B, { className: "h-4 w-4 transition-transform group-data-[state=open]:rotate-90" }),
|
|
156
156
|
/* @__PURE__ */ e("span", { children: "Thinking" })
|
|
157
157
|
] }) }) }),
|
|
@@ -239,7 +239,7 @@ function y({
|
|
|
239
239
|
] })
|
|
240
240
|
] })
|
|
241
241
|
] }),
|
|
242
|
-
/* @__PURE__ */ e("pre", { className: "overflow-x-auto whitespace-pre-wrap text-foreground", children: JSON.stringify(a.result, null, 2) })
|
|
242
|
+
/* @__PURE__ */ e("pre", { className: "overflow-x-auto whitespace-pre-wrap text-d-foreground", children: JSON.stringify(a.result, null, 2) })
|
|
243
243
|
]
|
|
244
244
|
},
|
|
245
245
|
r
|
|
@@ -97,7 +97,7 @@ function C({
|
|
|
97
97
|
{
|
|
98
98
|
"data-slot": "command-group",
|
|
99
99
|
className: a(
|
|
100
|
-
"text-foreground [&_[cmdk-group-heading]]:text-d-secondary-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
|
|
100
|
+
"text-d-foreground [&_[cmdk-group-heading]]:text-d-secondary-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
|
|
101
101
|
e
|
|
102
102
|
),
|
|
103
103
|
...t
|
|
@@ -171,7 +171,7 @@ function J({
|
|
|
171
171
|
"data-slot": "context-menu-label",
|
|
172
172
|
"data-inset": n,
|
|
173
173
|
className: a(
|
|
174
|
-
"text-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
174
|
+
"text-d-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
175
175
|
t
|
|
176
176
|
),
|
|
177
177
|
...o
|
|
@@ -98,7 +98,7 @@ const f = l.forwardRef(
|
|
|
98
98
|
exit: { opacity: 0, y: "100%" },
|
|
99
99
|
children: [
|
|
100
100
|
/* @__PURE__ */ a("div", { className: "flex w-full items-center space-x-2", children: [
|
|
101
|
-
/* @__PURE__ */ t("div", { className: "grid h-10 w-10 shrink-0 place-items-center rounded-sm border bg-d-secondary", children: /* @__PURE__ */ t(p, { className: "h-6 w-6 text-foreground" }) }),
|
|
101
|
+
/* @__PURE__ */ t("div", { className: "grid h-10 w-10 shrink-0 place-items-center rounded-sm border bg-d-secondary", children: /* @__PURE__ */ t(p, { className: "h-6 w-6 text-d-foreground" }) }),
|
|
102
102
|
/* @__PURE__ */ t("span", { className: "w-full truncate text-d-secondary-foreground", children: e.name })
|
|
103
103
|
] }),
|
|
104
104
|
r ? /* @__PURE__ */ t(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as o, jsxs as M, Fragment as N } from "react/jsx-runtime";
|
|
3
3
|
import { useContext as R, useRef as a, useState as s, useCallback as k, useMemo as y, useEffect as u } from "react";
|
|
4
|
-
import A from "../../../../../_virtual/
|
|
4
|
+
import A from "../../../../../_virtual/index6.js";
|
|
5
5
|
import B from "../../../../../_virtual/debounce.js";
|
|
6
6
|
import { GanttContext as F } from "../Gantt/GanttContext.js";
|
|
7
7
|
import { transformData as O } from "../../utils/transformData.js";
|
|
@@ -16,10 +16,10 @@ function V({
|
|
|
16
16
|
min: p = 1,
|
|
17
17
|
max: b = 4,
|
|
18
18
|
className: v,
|
|
19
|
-
buttonClassName:
|
|
19
|
+
buttonClassName: d,
|
|
20
20
|
counterClassName: y
|
|
21
21
|
}) {
|
|
22
|
-
const [e, o] = s.useState(a), [
|
|
22
|
+
const [e, o] = s.useState(a), [u, m] = s.useState(!1);
|
|
23
23
|
s.useEffect(() => {
|
|
24
24
|
o(a);
|
|
25
25
|
}, [a]);
|
|
@@ -50,7 +50,7 @@ function V({
|
|
|
50
50
|
children: /* @__PURE__ */ N(
|
|
51
51
|
l.div,
|
|
52
52
|
{
|
|
53
|
-
variants:
|
|
53
|
+
variants: u ? {
|
|
54
54
|
initial: { x: 0 },
|
|
55
55
|
vibrate: {
|
|
56
56
|
x: [0, -5, 5, -5, 5, 0],
|
|
@@ -58,7 +58,7 @@ function V({
|
|
|
58
58
|
}
|
|
59
59
|
} : void 0,
|
|
60
60
|
initial: "initial",
|
|
61
|
-
animate:
|
|
61
|
+
animate: u ? "vibrate" : "initial",
|
|
62
62
|
className: "flex items-center gap-8",
|
|
63
63
|
children: [
|
|
64
64
|
/* @__PURE__ */ i(
|
|
@@ -70,9 +70,9 @@ function V({
|
|
|
70
70
|
"h-12 w-12 rounded-full border",
|
|
71
71
|
"bg-d-background",
|
|
72
72
|
"hover:bg-d-accent hover:text-d-accent-foreground",
|
|
73
|
-
"text-foreground cursor-pointer",
|
|
73
|
+
"text-d-foreground cursor-pointer",
|
|
74
74
|
"flex items-center justify-center",
|
|
75
|
-
|
|
75
|
+
d
|
|
76
76
|
),
|
|
77
77
|
children: /* @__PURE__ */ i("span", { className: "text-2xl font-medium", children: "-" })
|
|
78
78
|
}
|
|
@@ -85,7 +85,7 @@ function V({
|
|
|
85
85
|
animate: "animate",
|
|
86
86
|
exit: "exit",
|
|
87
87
|
className: r(
|
|
88
|
-
"text-2xl font-medium text-foreground dark:text-foreground",
|
|
88
|
+
"text-2xl font-medium text-d-foreground dark:text-d-foreground",
|
|
89
89
|
y
|
|
90
90
|
),
|
|
91
91
|
children: e
|
|
@@ -101,9 +101,9 @@ function V({
|
|
|
101
101
|
"h-12 w-12 rounded-full border",
|
|
102
102
|
"bg-d-background",
|
|
103
103
|
"hover:bg-d-accent hover:text-d-accent-foreground",
|
|
104
|
-
"text-foreground cursor-pointer",
|
|
104
|
+
"text-d-foreground cursor-pointer",
|
|
105
105
|
"flex items-center justify-center",
|
|
106
|
-
|
|
106
|
+
d
|
|
107
107
|
),
|
|
108
108
|
children: /* @__PURE__ */ i("span", { className: "text-2xl font-medium", children: "+" })
|
|
109
109
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
3
3
|
import { cva as c } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
4
4
|
import { cn as f } from "../../lib/utils.js";
|
|
5
5
|
import { Label as x } from "./label.js";
|
|
6
|
-
import { Icon as
|
|
6
|
+
import { Icon as s } from "./icon.js";
|
|
7
7
|
const g = c(
|
|
8
|
-
"file:text-foreground placeholder:text-d-secondary-foreground selection:bg-d-primary selection:text-d-primary-foreground dark:bg-d-input/30 border-d-input flex w-full min-w-0 rounded-md border bg-transparent px-3 transition-[color,box-shadow] outline-none file:inline-flex file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
8
|
+
"file:text-d-foreground placeholder:text-d-secondary-foreground selection:bg-d-primary selection:text-d-primary-foreground dark:bg-d-input/30 border-d-input flex w-full min-w-0 rounded-md border bg-transparent px-3 transition-[color,box-shadow] outline-none file:inline-flex file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 transition-all duration-200",
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
size: {
|
|
@@ -23,25 +23,25 @@ function w({
|
|
|
23
23
|
className: o,
|
|
24
24
|
type: l,
|
|
25
25
|
label: r,
|
|
26
|
-
labelClassName:
|
|
27
|
-
id:
|
|
26
|
+
labelClassName: m,
|
|
27
|
+
id: p,
|
|
28
28
|
iconLeft: i,
|
|
29
29
|
iconRight: n,
|
|
30
30
|
size: t,
|
|
31
31
|
...u
|
|
32
32
|
}) {
|
|
33
|
-
const d =
|
|
34
|
-
return /* @__PURE__ */
|
|
33
|
+
const d = p || (r ? `input-${Math.random().toString(36).substring(2, 9)}` : void 0);
|
|
34
|
+
return /* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
|
|
35
35
|
r && /* @__PURE__ */ e(
|
|
36
36
|
x,
|
|
37
37
|
{
|
|
38
38
|
htmlFor: d,
|
|
39
|
-
className:
|
|
39
|
+
className: m,
|
|
40
40
|
children: r
|
|
41
41
|
}
|
|
42
42
|
),
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
i && /* @__PURE__ */ e("div", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-d-secondary-foreground pointer-events-none", children: /* @__PURE__ */ e(
|
|
43
|
+
/* @__PURE__ */ a("div", { className: "relative", children: [
|
|
44
|
+
i && /* @__PURE__ */ e("div", { className: "absolute left-3 top-1/2 -translate-y-1/2 text-d-secondary-foreground pointer-events-none", children: /* @__PURE__ */ e(s, { name: i, size: t === "lg" ? "sm" : "xs" }) }),
|
|
45
45
|
/* @__PURE__ */ e(
|
|
46
46
|
"input",
|
|
47
47
|
{
|
|
@@ -50,7 +50,7 @@ function w({
|
|
|
50
50
|
"data-slot": "input",
|
|
51
51
|
className: f(
|
|
52
52
|
g({ size: t }),
|
|
53
|
-
"focus-visible:border-d-ring focus-visible:ring-d-ring/50 focus-visible:ring-
|
|
53
|
+
"focus-visible:border-d-ring focus-visible:ring-d-ring/50 focus-visible:ring-3",
|
|
54
54
|
"aria-invalid:ring-d-destructive/20 dark:aria-invalid:ring-d-destructive/40 aria-invalid:border-d-destructive",
|
|
55
55
|
"shadow-xs",
|
|
56
56
|
i ? t !== "lg" ? "pl-8" : "pl-10" : "",
|
|
@@ -60,7 +60,7 @@ function w({
|
|
|
60
60
|
...u
|
|
61
61
|
}
|
|
62
62
|
),
|
|
63
|
-
n && /* @__PURE__ */ e("div", { className: "absolute right-3 top-1/2 -translate-y-1/2 text-d-secondary-foreground pointer-events-none", children: /* @__PURE__ */ e(
|
|
63
|
+
n && /* @__PURE__ */ e("div", { className: "absolute right-3 top-1/2 -translate-y-1/2 text-d-secondary-foreground pointer-events-none", children: /* @__PURE__ */ e(s, { name: n, size: t === "lg" ? "sm" : "xs" }) })
|
|
64
64
|
] })
|
|
65
65
|
] });
|
|
66
66
|
}
|
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as u, jsxs as
|
|
2
|
+
import { jsx as u, jsxs as V, Fragment as U } from "react/jsx-runtime";
|
|
3
3
|
import { Command as ue, useCommandState as fe } from "../../node_modules/cmdk/dist/index.js";
|
|
4
4
|
import * as a from "react";
|
|
5
5
|
import { useEffect as L, forwardRef as de } from "react";
|
|
6
6
|
import { Badge as ae } from "./badge.js";
|
|
7
|
-
import { CommandItem as K, Command as
|
|
8
|
-
import { cn as
|
|
7
|
+
import { CommandItem as K, Command as oe, CommandList as ce, CommandGroup as ve } from "./command.js";
|
|
8
|
+
import { cn as g } from "../../lib/utils.js";
|
|
9
9
|
import { Label as be } from "./label.js";
|
|
10
10
|
import Y from "../../node_modules/lucide-react/dist/esm/icons/x.js";
|
|
11
|
-
function me(i,
|
|
11
|
+
function me(i, l) {
|
|
12
12
|
const [f, b] = a.useState(i);
|
|
13
13
|
return L(() => {
|
|
14
|
-
const
|
|
14
|
+
const o = setTimeout(() => b(i), l);
|
|
15
15
|
return () => {
|
|
16
|
-
clearTimeout(
|
|
16
|
+
clearTimeout(o);
|
|
17
17
|
};
|
|
18
|
-
}, [i,
|
|
18
|
+
}, [i, l]), f;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function z(i, l) {
|
|
21
21
|
if (i.length === 0)
|
|
22
22
|
return {};
|
|
23
|
-
if (!
|
|
23
|
+
if (!l)
|
|
24
24
|
return {
|
|
25
25
|
"": i
|
|
26
26
|
};
|
|
27
27
|
const f = {};
|
|
28
28
|
return i.forEach((b) => {
|
|
29
|
-
const
|
|
30
|
-
f[
|
|
29
|
+
const o = b[l] || "";
|
|
30
|
+
f[o] || (f[o] = []), f[o].push(b);
|
|
31
31
|
}), f;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function ge(i, l) {
|
|
34
34
|
const f = JSON.parse(JSON.stringify(i));
|
|
35
|
-
for (const [b,
|
|
36
|
-
f[b] =
|
|
35
|
+
for (const [b, o] of Object.entries(f))
|
|
36
|
+
f[b] = o.filter((C) => !l.find((v) => v.value === C.value));
|
|
37
37
|
return f;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function we(i, l) {
|
|
40
40
|
for (const [, f] of Object.entries(i))
|
|
41
|
-
if (f.some((b) =>
|
|
41
|
+
if (f.some((b) => l.find((o) => o.value === b.value)))
|
|
42
42
|
return !0;
|
|
43
43
|
return !1;
|
|
44
44
|
}
|
|
45
|
-
const Z = de(({ className: i, ...
|
|
45
|
+
const Z = de(({ className: i, ...l }, f) => fe((o) => o.filtered.count === 0) ? /* @__PURE__ */ u(
|
|
46
46
|
"div",
|
|
47
47
|
{
|
|
48
48
|
ref: f,
|
|
49
|
-
className:
|
|
49
|
+
className: g("py-6 text-center text-sm", i),
|
|
50
50
|
"cmdk-empty": "",
|
|
51
51
|
role: "presentation",
|
|
52
|
-
...
|
|
52
|
+
...l
|
|
53
53
|
}
|
|
54
54
|
) : null);
|
|
55
55
|
Z.displayName = "CommandEmpty";
|
|
56
|
-
const
|
|
56
|
+
const xe = a.forwardRef(
|
|
57
57
|
({
|
|
58
58
|
value: i,
|
|
59
|
-
onChange:
|
|
59
|
+
onChange: l,
|
|
60
60
|
placeholder: f,
|
|
61
61
|
defaultOptions: b = [],
|
|
62
|
-
options:
|
|
63
|
-
delay:
|
|
62
|
+
options: o,
|
|
63
|
+
delay: C,
|
|
64
64
|
onSearch: v,
|
|
65
65
|
onSearchSync: I,
|
|
66
66
|
loadingIndicator: W,
|
|
67
67
|
emptyIndicator: F,
|
|
68
|
-
maxSelected:
|
|
68
|
+
maxSelected: X = Number.MAX_SAFE_INTEGER,
|
|
69
69
|
onMaxSelected: k,
|
|
70
70
|
hidePlaceholderWhenSelected: H,
|
|
71
71
|
disabled: E,
|
|
72
|
-
groupBy:
|
|
72
|
+
groupBy: w,
|
|
73
73
|
className: B,
|
|
74
74
|
badgeClassName: S,
|
|
75
75
|
selectFirstItem: p = !0,
|
|
@@ -80,69 +80,69 @@ const he = a.forwardRef(
|
|
|
80
80
|
hideClearAllButton: P = !1,
|
|
81
81
|
label: M
|
|
82
82
|
}, ee) => {
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
), [m,
|
|
83
|
+
const c = a.useRef(null), [x, G] = a.useState(!1), [te, $] = a.useState(!1), [q, Q] = a.useState(!1), _ = a.useRef(null), [r, O] = a.useState(i || []), [h, A] = a.useState(
|
|
84
|
+
z(b, w)
|
|
85
|
+
), [m, R] = a.useState(""), N = me(m, C || 500);
|
|
86
86
|
a.useImperativeHandle(
|
|
87
87
|
ee,
|
|
88
88
|
() => ({
|
|
89
|
-
selectedValue: [...
|
|
90
|
-
input:
|
|
89
|
+
selectedValue: [...r],
|
|
90
|
+
input: c.current,
|
|
91
91
|
focus: () => {
|
|
92
92
|
var e;
|
|
93
|
-
return (e =
|
|
93
|
+
return (e = c == null ? void 0 : c.current) == null ? void 0 : e.focus();
|
|
94
94
|
},
|
|
95
95
|
reset: () => O([])
|
|
96
96
|
}),
|
|
97
|
-
[
|
|
97
|
+
[r]
|
|
98
98
|
);
|
|
99
99
|
const y = (e) => {
|
|
100
|
-
|
|
100
|
+
_.current && !_.current.contains(e.target) && c.current && !c.current.contains(e.target) && (G(!1), c.current.blur());
|
|
101
101
|
}, J = a.useCallback(
|
|
102
102
|
(e) => {
|
|
103
|
-
const t =
|
|
104
|
-
O(t),
|
|
103
|
+
const t = r.filter((d) => d.value !== e.value);
|
|
104
|
+
O(t), l == null || l(t);
|
|
105
105
|
},
|
|
106
|
-
[
|
|
107
|
-
),
|
|
106
|
+
[l, r]
|
|
107
|
+
), re = a.useCallback(
|
|
108
108
|
(e) => {
|
|
109
|
-
const t =
|
|
110
|
-
t && ((e.key === "Delete" || e.key === "Backspace") && t.value === "" &&
|
|
109
|
+
const t = c.current;
|
|
110
|
+
t && ((e.key === "Delete" || e.key === "Backspace") && t.value === "" && r.length > 0 && (r[r.length - 1].fixed || J(r[r.length - 1])), e.key === "Escape" && t.blur());
|
|
111
111
|
},
|
|
112
|
-
[J,
|
|
112
|
+
[J, r]
|
|
113
113
|
);
|
|
114
114
|
L(() => {
|
|
115
115
|
if (typeof document < "u")
|
|
116
|
-
return
|
|
116
|
+
return x ? (document.addEventListener("mousedown", y), document.addEventListener("touchend", y)) : (document.removeEventListener("mousedown", y), document.removeEventListener("touchend", y)), () => {
|
|
117
117
|
document.removeEventListener("mousedown", y), document.removeEventListener("touchend", y);
|
|
118
118
|
};
|
|
119
|
-
}, [
|
|
119
|
+
}, [x, y]), L(() => {
|
|
120
120
|
i && O(i);
|
|
121
121
|
}, [i]), L(() => {
|
|
122
|
-
if (!
|
|
122
|
+
if (!o || v)
|
|
123
123
|
return;
|
|
124
|
-
const e =
|
|
125
|
-
JSON.stringify(e) !== JSON.stringify(
|
|
126
|
-
}, [b,
|
|
124
|
+
const e = z(o || [], w);
|
|
125
|
+
JSON.stringify(e) !== JSON.stringify(h) && A(e);
|
|
126
|
+
}, [b, o, w, v, h]), L(() => {
|
|
127
127
|
const e = () => {
|
|
128
128
|
const d = I == null ? void 0 : I(N);
|
|
129
|
-
|
|
129
|
+
A(z(d || [], w));
|
|
130
130
|
};
|
|
131
131
|
(async () => {
|
|
132
|
-
!I || !
|
|
132
|
+
!I || !x || (T && e(), N && e());
|
|
133
133
|
})();
|
|
134
|
-
}, [N,
|
|
134
|
+
}, [N, w, x, T]), L(() => {
|
|
135
135
|
const e = async () => {
|
|
136
136
|
Q(!0);
|
|
137
137
|
const d = await (v == null ? void 0 : v(N));
|
|
138
|
-
|
|
138
|
+
A(z(d || [], w)), Q(!1);
|
|
139
139
|
};
|
|
140
140
|
(async () => {
|
|
141
|
-
!v || !
|
|
141
|
+
!v || !x || (T && await e(), N && await e());
|
|
142
142
|
})();
|
|
143
|
-
}, [N,
|
|
144
|
-
const
|
|
145
|
-
if (!D ||
|
|
143
|
+
}, [N, w, x, T]);
|
|
144
|
+
const le = () => {
|
|
145
|
+
if (!D || we(h, [{ value: m, label: m }]) || r.find((t) => t.value === m))
|
|
146
146
|
return;
|
|
147
147
|
const e = /* @__PURE__ */ u(
|
|
148
148
|
K,
|
|
@@ -153,13 +153,13 @@ const he = a.forwardRef(
|
|
|
153
153
|
t.preventDefault(), t.stopPropagation();
|
|
154
154
|
},
|
|
155
155
|
onSelect: (t) => {
|
|
156
|
-
if (
|
|
157
|
-
k == null || k(
|
|
156
|
+
if (r.length >= X) {
|
|
157
|
+
k == null || k(r.length);
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
|
-
|
|
161
|
-
const d = [...
|
|
162
|
-
O(d),
|
|
160
|
+
R("");
|
|
161
|
+
const d = [...r, { value: t, label: t }];
|
|
162
|
+
O(d), l == null || l(d);
|
|
163
163
|
},
|
|
164
164
|
children: `Create "${m}"`
|
|
165
165
|
}
|
|
@@ -168,51 +168,51 @@ const he = a.forwardRef(
|
|
|
168
168
|
return e;
|
|
169
169
|
}, ne = a.useCallback(() => {
|
|
170
170
|
if (F)
|
|
171
|
-
return v && !D && Object.keys(
|
|
172
|
-
}, [D, F, v,
|
|
173
|
-
() =>
|
|
174
|
-
[
|
|
171
|
+
return v && !D && Object.keys(h).length === 0 ? /* @__PURE__ */ u(K, { value: "-", disabled: !0, children: F }) : /* @__PURE__ */ u(Z, { children: F });
|
|
172
|
+
}, [D, F, v, h]), se = a.useMemo(
|
|
173
|
+
() => ge(h, r),
|
|
174
|
+
[h, r]
|
|
175
175
|
), ie = a.useCallback(() => {
|
|
176
176
|
if (n != null && n.filter)
|
|
177
177
|
return n.filter;
|
|
178
178
|
if (D)
|
|
179
179
|
return (e, t) => e.toLowerCase().includes(t.toLowerCase()) ? 1 : -1;
|
|
180
180
|
}, [D, n == null ? void 0 : n.filter]);
|
|
181
|
-
return /* @__PURE__ */
|
|
181
|
+
return /* @__PURE__ */ V("div", { className: "flex flex-col space-y-1.5", children: [
|
|
182
182
|
M && /* @__PURE__ */ u(be, { children: M }),
|
|
183
|
-
/* @__PURE__ */
|
|
184
|
-
|
|
183
|
+
/* @__PURE__ */ V(
|
|
184
|
+
oe,
|
|
185
185
|
{
|
|
186
|
-
ref:
|
|
186
|
+
ref: _,
|
|
187
187
|
...n,
|
|
188
188
|
onKeyDown: (e) => {
|
|
189
189
|
var t;
|
|
190
|
-
|
|
190
|
+
re(e), (t = n == null ? void 0 : n.onKeyDown) == null || t.call(n, e);
|
|
191
191
|
},
|
|
192
|
-
className:
|
|
192
|
+
className: g("h-auto overflow-visible bg-transparent", n == null ? void 0 : n.className),
|
|
193
193
|
shouldFilter: (n == null ? void 0 : n.shouldFilter) !== void 0 ? n.shouldFilter : !v,
|
|
194
194
|
filter: ie(),
|
|
195
195
|
children: [
|
|
196
196
|
/* @__PURE__ */ u(
|
|
197
197
|
"div",
|
|
198
198
|
{
|
|
199
|
-
className:
|
|
199
|
+
className: g(
|
|
200
200
|
"min-h-10 rounded-md border border-d-input text-base ring-offset-d-background focus-within:ring-2 focus-within:ring-d-ring focus-within:ring-offset-2 md:text-sm",
|
|
201
201
|
{
|
|
202
|
-
"px-3 py-2":
|
|
203
|
-
"cursor-text": !E &&
|
|
202
|
+
"px-3 py-2": r.length !== 0,
|
|
203
|
+
"cursor-text": !E && r.length !== 0
|
|
204
204
|
},
|
|
205
205
|
B
|
|
206
206
|
),
|
|
207
207
|
onClick: () => {
|
|
208
208
|
var e;
|
|
209
|
-
E || (e =
|
|
209
|
+
E || (e = c == null ? void 0 : c.current) == null || e.focus();
|
|
210
210
|
},
|
|
211
|
-
children: /* @__PURE__ */
|
|
212
|
-
|
|
211
|
+
children: /* @__PURE__ */ V("div", { className: "relative flex flex-wrap gap-1", children: [
|
|
212
|
+
r.map((e) => /* @__PURE__ */ V(
|
|
213
213
|
ae,
|
|
214
214
|
{
|
|
215
|
-
className:
|
|
215
|
+
className: g(
|
|
216
216
|
"data-[disabled]:bg-d-secondary-foreground data-[disabled]:text-d-secondary data-[disabled]:hover:bg-d-secondary-foreground",
|
|
217
217
|
"data-[fixed]:bg-d-secondary-foreground data-[fixed]:text-d-secondary data-[fixed]:hover:bg-d-secondary-foreground",
|
|
218
218
|
S
|
|
@@ -225,8 +225,8 @@ const he = a.forwardRef(
|
|
|
225
225
|
"button",
|
|
226
226
|
{
|
|
227
227
|
type: "button",
|
|
228
|
-
className:
|
|
229
|
-
"ml-1 rounded-full outline-none ring-offset-d-background focus:ring-2 focus:ring-d-ring focus:ring-offset-2",
|
|
228
|
+
className: g(
|
|
229
|
+
"ml-1 rounded-full text-d-secondary-foreground outline-none ring-offset-d-background focus:ring-2 focus:ring-d-ring focus:ring-offset-2",
|
|
230
230
|
(E || e.fixed) && "hidden"
|
|
231
231
|
),
|
|
232
232
|
onKeyDown: (t) => {
|
|
@@ -236,7 +236,7 @@ const he = a.forwardRef(
|
|
|
236
236
|
t.preventDefault(), t.stopPropagation();
|
|
237
237
|
},
|
|
238
238
|
onClick: () => J(e),
|
|
239
|
-
children: /* @__PURE__ */ u(Y, { className: "h-3 w-3 text-d-secondary-foreground hover:text-foreground" })
|
|
239
|
+
children: /* @__PURE__ */ u(Y, { className: "h-3 w-3 text-d-secondary-foreground hover:text-d-foreground" })
|
|
240
240
|
}
|
|
241
241
|
)
|
|
242
242
|
]
|
|
@@ -247,52 +247,52 @@ const he = a.forwardRef(
|
|
|
247
247
|
ue.Input,
|
|
248
248
|
{
|
|
249
249
|
...s,
|
|
250
|
-
ref:
|
|
250
|
+
ref: c,
|
|
251
251
|
value: m,
|
|
252
252
|
disabled: E,
|
|
253
253
|
onValueChange: (e) => {
|
|
254
254
|
var t;
|
|
255
|
-
|
|
255
|
+
R(e), (t = s == null ? void 0 : s.onValueChange) == null || t.call(s, e);
|
|
256
256
|
},
|
|
257
257
|
onBlur: (e) => {
|
|
258
258
|
var t;
|
|
259
|
-
te ||
|
|
259
|
+
te || G(!1), (t = s == null ? void 0 : s.onBlur) == null || t.call(s, e);
|
|
260
260
|
},
|
|
261
261
|
onFocus: (e) => {
|
|
262
262
|
var t;
|
|
263
|
-
|
|
263
|
+
G(!0), (t = s == null ? void 0 : s.onFocus) == null || t.call(s, e);
|
|
264
264
|
},
|
|
265
|
-
placeholder: H &&
|
|
266
|
-
className:
|
|
265
|
+
placeholder: H && r.length !== 0 ? "" : f,
|
|
266
|
+
className: g(
|
|
267
267
|
"flex-1 bg-transparent outline-none placeholder:text-d-secondary-foreground",
|
|
268
268
|
{
|
|
269
269
|
"w-full": H,
|
|
270
|
-
"px-3 py-2":
|
|
271
|
-
"ml-1":
|
|
270
|
+
"px-3 py-2": r.length === 0,
|
|
271
|
+
"ml-1": r.length !== 0
|
|
272
272
|
},
|
|
273
273
|
s == null ? void 0 : s.className
|
|
274
274
|
)
|
|
275
275
|
}
|
|
276
276
|
),
|
|
277
277
|
/* @__PURE__ */ u(
|
|
278
|
-
"
|
|
278
|
+
"div",
|
|
279
279
|
{
|
|
280
|
-
|
|
280
|
+
className: g(
|
|
281
|
+
"absolute right-0 top-0 flex items-center justify-center rounded-full bg-d-secondary/20 hover:bg-d-secondary/30 p-1 cursor-pointer z-20 border",
|
|
282
|
+
(P || E || r.length < 1 || r.filter((e) => e.fixed).length === r.length) && "hidden"
|
|
283
|
+
),
|
|
281
284
|
onClick: () => {
|
|
282
|
-
O(
|
|
285
|
+
O(r.filter((e) => e.fixed)), l == null || l(r.filter((e) => e.fixed));
|
|
283
286
|
},
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
(P || E || l.length < 1 || l.filter((e) => e.fixed).length === l.length) && "hidden"
|
|
287
|
-
),
|
|
288
|
-
children: /* @__PURE__ */ u(Y, {})
|
|
287
|
+
"aria-label": "Clear selection",
|
|
288
|
+
children: /* @__PURE__ */ u(Y, { size: 12, className: "text-d-foreground" })
|
|
289
289
|
}
|
|
290
290
|
)
|
|
291
291
|
] })
|
|
292
292
|
}
|
|
293
293
|
),
|
|
294
|
-
/* @__PURE__ */ u("div", { className: "relative", children:
|
|
295
|
-
|
|
294
|
+
/* @__PURE__ */ u("div", { className: "relative", children: x && /* @__PURE__ */ u(
|
|
295
|
+
ce,
|
|
296
296
|
{
|
|
297
297
|
className: "absolute top-1 z-10 w-full rounded-md border bg-d-popover text-d-popover-foreground shadow-md outline-none animate-in",
|
|
298
298
|
onMouseLeave: () => {
|
|
@@ -303,30 +303,30 @@ const he = a.forwardRef(
|
|
|
303
303
|
},
|
|
304
304
|
onMouseUp: () => {
|
|
305
305
|
var e;
|
|
306
|
-
(e =
|
|
306
|
+
(e = c == null ? void 0 : c.current) == null || e.focus();
|
|
307
307
|
},
|
|
308
|
-
children: q ? /* @__PURE__ */ u(
|
|
308
|
+
children: q ? /* @__PURE__ */ u(U, { children: W }) : /* @__PURE__ */ V(U, { children: [
|
|
309
309
|
ne(),
|
|
310
|
-
|
|
310
|
+
le(),
|
|
311
311
|
!p && /* @__PURE__ */ u(K, { value: "-", className: "hidden" }),
|
|
312
|
-
Object.entries(se).map(([e, t]) => /* @__PURE__ */ u(ve, { heading: e, className: "h-full overflow-auto", children: /* @__PURE__ */ u(
|
|
312
|
+
Object.entries(se).map(([e, t]) => /* @__PURE__ */ u(ve, { heading: e, className: "h-full overflow-auto", children: /* @__PURE__ */ u(U, { children: t.map((d) => /* @__PURE__ */ u(
|
|
313
313
|
K,
|
|
314
314
|
{
|
|
315
315
|
value: d.label,
|
|
316
316
|
disabled: d.disable,
|
|
317
|
-
onMouseDown: (
|
|
318
|
-
|
|
317
|
+
onMouseDown: (j) => {
|
|
318
|
+
j.preventDefault(), j.stopPropagation();
|
|
319
319
|
},
|
|
320
320
|
onSelect: () => {
|
|
321
|
-
if (
|
|
322
|
-
k == null || k(
|
|
321
|
+
if (r.length >= X) {
|
|
322
|
+
k == null || k(r.length);
|
|
323
323
|
return;
|
|
324
324
|
}
|
|
325
|
-
|
|
326
|
-
const
|
|
327
|
-
O(
|
|
325
|
+
R("");
|
|
326
|
+
const j = [...r, d];
|
|
327
|
+
O(j), l == null || l(j);
|
|
328
328
|
},
|
|
329
|
-
className:
|
|
329
|
+
className: g(
|
|
330
330
|
"cursor-pointer",
|
|
331
331
|
d.disable && "cursor-default text-d-secondary-foreground"
|
|
332
332
|
),
|
|
@@ -343,8 +343,8 @@ const he = a.forwardRef(
|
|
|
343
343
|
] });
|
|
344
344
|
}
|
|
345
345
|
);
|
|
346
|
-
|
|
346
|
+
xe.displayName = "MultipleSelector";
|
|
347
347
|
export {
|
|
348
|
-
|
|
348
|
+
xe as MultipleSelector,
|
|
349
349
|
me as useDebounce
|
|
350
350
|
};
|