laif-ds 0.1.88 → 0.1.89
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 +2 -5
- package/dist/_virtual/index4.js +5 -5
- package/dist/_virtual/index5.js +5 -5
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/components/ui/app-multiple-select-dropdown.js +20 -18
- package/dist/components/ui/app-select.js +54 -34
- package/dist/components/ui/async-select.js +70 -71
- package/dist/components/ui/button.js +34 -34
- package/dist/components/ui/calendar.js +2 -2
- package/dist/components/ui/date-picker.js +7 -7
- package/dist/components/ui/input.js +10 -11
- package/dist/components/ui/multiple-selector.js +54 -52
- package/dist/components/ui/select.js +22 -17
- package/dist/components/ui/switch.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/node_modules/eventemitter3/index.js +1 -1
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/recharts/es6/util/Events.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/node_modules/use-sync-external-store/shim/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as r, jsxs as c } from "react/jsx-runtime";
|
|
3
3
|
import { Root as v } from "../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
4
|
-
import { cva as
|
|
4
|
+
import { cva as m } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
5
5
|
import { cn as l } from "../../lib/utils.js";
|
|
6
6
|
import { Icon as u } from "./icon.js";
|
|
7
|
-
const
|
|
8
|
-
"cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-d-ring focus-visible:ring-d-ring/50 focus-visible:ring-[3px] aria-invalid:ring-d-destructive/20 dark:aria-invalid:ring-d-destructive/40 aria-invalid:border-d-destructive
|
|
7
|
+
const b = m(
|
|
8
|
+
"cursor-pointer inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-d-ring focus-visible:ring-d-ring/50 focus-visible:ring-[3px] aria-invalid:ring-d-destructive/20 dark:aria-invalid:ring-d-destructive/40 aria-invalid:border-d-destructive transition-all duration-200 ease-out transform-gpu active:scale-[0.98] active:shadow-sm overflow-hidden relative group",
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
12
|
-
default: "bg-d-primary text-d-primary-foreground shadow-xs hover:bg-d-primary/90",
|
|
13
|
-
destructive: "bg-d-destructive text-white shadow-xs hover:bg-d-destructive/90 focus-visible:ring-d-destructive/20 dark:focus-visible:ring-d-destructive/40 dark:bg-d-destructive/60",
|
|
14
|
-
outline: "border bg-d-background shadow-xs hover:bg-d-accent hover:text-d-accent-foreground dark:bg-d-input/30 dark:border-d-input dark:hover:bg-d-input/50",
|
|
15
|
-
"outline-primary": "border !border-d-primary bg-d-background shadow-xs text-d-primary/80 hover:!text-d-primary",
|
|
16
|
-
secondary: "bg-d-secondary text-d-secondary-foreground shadow-xs hover:bg-d-secondary/80 hover:text-d-secondary-foreground",
|
|
12
|
+
default: "bg-d-primary text-d-primary-foreground shadow-xs hover:bg-d-primary/90 hover:shadow-d-primary/25 before:absolute before:inset-0 before:bg-gradient-to-r before:from-transparent before:via-white/20 before:to-transparent before:translate-x-[-100%] hover:before:translate-x-[100%] before:transition-transform before:duration-700 before:ease-out",
|
|
13
|
+
destructive: "bg-d-destructive text-white shadow-xs hover:bg-d-destructive/90 hover:shadow-d-destructive/25 focus-visible:ring-d-destructive/20 dark:focus-visible:ring-d-destructive/40 dark:bg-d-destructive/60 before:absolute before:inset-0 before:bg-gradient-to-r before:from-transparent before:via-white/20 before:to-transparent before:translate-x-[-100%] hover:before:translate-x-[100%] before:transition-transform before:duration-700 before:ease-out",
|
|
14
|
+
outline: "border bg-d-background shadow-xs hover:bg-d-accent hover:text-d-accent-foreground hover:border-d-accent dark:bg-d-input/30 dark:border-d-input dark:hover:bg-d-input/50",
|
|
15
|
+
"outline-primary": "border !border-d-primary bg-d-background shadow-xs text-d-primary/80 hover:!text-d-primary hover:bg-d-primary/5 hover:border-d-primary/80 ",
|
|
16
|
+
secondary: "bg-d-secondary text-d-secondary-foreground shadow-xs hover:bg-d-secondary/80 hover:text-d-secondary-foreground ",
|
|
17
17
|
ghost: "hover:bg-d-accent hover:text-d-accent-foreground dark:hover:bg-d-accent",
|
|
18
18
|
link: "text-d-primary underline-offset-4 hover:underline"
|
|
19
19
|
},
|
|
@@ -30,42 +30,42 @@ const m = h(
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
|
-
function
|
|
34
|
-
className:
|
|
35
|
-
variant:
|
|
36
|
-
size:
|
|
37
|
-
asChild:
|
|
33
|
+
function w({
|
|
34
|
+
className: o,
|
|
35
|
+
variant: a,
|
|
36
|
+
size: e,
|
|
37
|
+
asChild: d = !1,
|
|
38
38
|
iconLeft: n,
|
|
39
|
-
iconRight:
|
|
40
|
-
isLoading:
|
|
39
|
+
iconRight: s,
|
|
40
|
+
isLoading: f = !1,
|
|
41
41
|
...t
|
|
42
42
|
}) {
|
|
43
|
-
const
|
|
44
|
-
return
|
|
45
|
-
|
|
43
|
+
const i = d ? v : "button";
|
|
44
|
+
return d ? /* @__PURE__ */ r(
|
|
45
|
+
i,
|
|
46
46
|
{
|
|
47
47
|
"data-slot": "button",
|
|
48
|
-
className: l(
|
|
48
|
+
className: l(b({ variant: a, size: e, className: o })),
|
|
49
49
|
...t
|
|
50
50
|
}
|
|
51
51
|
) : /* @__PURE__ */ c(
|
|
52
|
-
|
|
52
|
+
i,
|
|
53
53
|
{
|
|
54
54
|
"data-slot": "button",
|
|
55
|
-
className: l(
|
|
55
|
+
className: l(b({ variant: a, size: e, className: o }), "relative"),
|
|
56
56
|
...t,
|
|
57
57
|
children: [
|
|
58
|
-
|
|
58
|
+
f ? /* @__PURE__ */ c(
|
|
59
59
|
"svg",
|
|
60
60
|
{
|
|
61
61
|
className: "mr-1 -ml-1 animate-spin",
|
|
62
62
|
xmlns: "http://www.w3.org/2000/svg",
|
|
63
63
|
fill: "none",
|
|
64
64
|
viewBox: "0 0 24 24",
|
|
65
|
-
width:
|
|
66
|
-
height:
|
|
65
|
+
width: e === "sm" ? 14 : e === "lg" ? 20 : 16,
|
|
66
|
+
height: e === "sm" ? 14 : e === "lg" ? 20 : 16,
|
|
67
67
|
children: [
|
|
68
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ r(
|
|
69
69
|
"circle",
|
|
70
70
|
{
|
|
71
71
|
className: "opacity-25",
|
|
@@ -76,7 +76,7 @@ function k({
|
|
|
76
76
|
strokeWidth: "4"
|
|
77
77
|
}
|
|
78
78
|
),
|
|
79
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ r(
|
|
80
80
|
"path",
|
|
81
81
|
{
|
|
82
82
|
className: "opacity-75",
|
|
@@ -86,19 +86,19 @@ function k({
|
|
|
86
86
|
)
|
|
87
87
|
]
|
|
88
88
|
}
|
|
89
|
-
) : n && /* @__PURE__ */
|
|
89
|
+
) : n && /* @__PURE__ */ r(
|
|
90
90
|
u,
|
|
91
91
|
{
|
|
92
92
|
name: n,
|
|
93
|
-
size:
|
|
93
|
+
size: e === "default" ? "md" : e === "sm" ? "xs" : "sm"
|
|
94
94
|
}
|
|
95
95
|
),
|
|
96
96
|
t.children,
|
|
97
|
-
|
|
97
|
+
s && /* @__PURE__ */ r(
|
|
98
98
|
u,
|
|
99
99
|
{
|
|
100
|
-
name:
|
|
101
|
-
size:
|
|
100
|
+
name: s,
|
|
101
|
+
size: e === "default" ? "md" : e === "sm" ? "xs" : "sm"
|
|
102
102
|
}
|
|
103
103
|
)
|
|
104
104
|
]
|
|
@@ -106,6 +106,6 @@ function k({
|
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
108
|
export {
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
w as Button,
|
|
110
|
+
b as buttonVariants
|
|
111
111
|
};
|
|
@@ -64,7 +64,7 @@ function B({
|
|
|
64
64
|
t.dropdowns
|
|
65
65
|
),
|
|
66
66
|
dropdown_root: e(
|
|
67
|
-
"relative has-focus:border-ring border border-d-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
|
|
67
|
+
"relative has-focus:border-ring border border-d-input shadow-xs has-focus:ring-d-ring/50 has-focus:ring-[3px] rounded-md",
|
|
68
68
|
t.dropdown_root
|
|
69
69
|
),
|
|
70
70
|
dropdown: e("absolute inset-0 opacity-0", t.dropdown),
|
|
@@ -159,7 +159,7 @@ function v({
|
|
|
159
159
|
"data-range-end": r.range_end,
|
|
160
160
|
"data-range-middle": r.range_middle,
|
|
161
161
|
className: e(
|
|
162
|
-
"data-[selected-single=true]:bg-d-primary data-[selected-single=true]:text-d-primary-foreground data-[range-middle=true]:bg-d-accent data-[range-middle=true]:text-d-accent-foreground data-[range-start=true]:bg-d-primary data-[range-start=true]:text-d-primary-foreground data-[range-end=true]:bg-d-primary data-[range-end=true]:text-d-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-d-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[1px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
|
|
162
|
+
"data-[selected-single=true]:bg-d-primary data-[selected-single=true]:text-d-primary-foreground data-[range-middle=true]:bg-d-accent data-[range-middle=true]:text-d-accent-foreground data-[range-start=true]:bg-d-primary data-[range-start=true]:text-d-primary-foreground data-[range-end=true]:bg-d-primary data-[range-end=true]:text-d-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-d-ring/50 dark:hover:text-d-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[1px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",
|
|
163
163
|
s.day,
|
|
164
164
|
c
|
|
165
165
|
),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import * as
|
|
2
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import * as c from "react";
|
|
4
4
|
import { cn as g } from "../../lib/utils.js";
|
|
5
5
|
import { buttonVariants as x } from "./button.js";
|
|
6
6
|
import { Icon as h } from "./icon.js";
|
|
@@ -17,20 +17,20 @@ function E({
|
|
|
17
17
|
disabled: t = !1,
|
|
18
18
|
size: o = "default"
|
|
19
19
|
}) {
|
|
20
|
-
const [r, i] =
|
|
21
|
-
|
|
20
|
+
const [r, i] = c.useState(n);
|
|
21
|
+
c.useEffect(() => {
|
|
22
22
|
i(n);
|
|
23
23
|
}, [n]);
|
|
24
24
|
const p = (s) => {
|
|
25
25
|
i(s), a && a(s);
|
|
26
26
|
};
|
|
27
|
-
return /* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ d(w, { open: t ? !1 : void 0, children: [
|
|
28
28
|
/* @__PURE__ */ e(P, { asChild: !0, children: /* @__PURE__ */ e(
|
|
29
29
|
"div",
|
|
30
30
|
{
|
|
31
31
|
className: g(
|
|
32
32
|
x({ variant: u, size: o }),
|
|
33
|
-
"border-d-input text-d-foreground hover:bg-d-accent bg-d-input ring-offset-background data-[placeholder]:text-d-muted-foreground focus:ring-ring flex items-center justify-between border px-3 py-2 font-normal whitespace-nowrap shadow-sm focus:ring-1 focus:outline-none [&>span]:line-clamp-1",
|
|
33
|
+
"border-d-input text-d-foreground hover:bg-d-accent bg-d-input ring-offset-background data-[placeholder]:text-d-muted-foreground focus:ring-d-ring flex items-center justify-between border px-3 py-2 font-normal whitespace-nowrap shadow-sm focus:ring-1 focus:outline-none [&>span]:line-clamp-1",
|
|
34
34
|
!r && "text-d-muted-foreground",
|
|
35
35
|
t && "cursor-not-allowed opacity-50",
|
|
36
36
|
f,
|
|
@@ -42,7 +42,7 @@ function E({
|
|
|
42
42
|
tabIndex: t ? -1 : 0,
|
|
43
43
|
onClick: t ? void 0 : () => {
|
|
44
44
|
},
|
|
45
|
-
children: /* @__PURE__ */
|
|
45
|
+
children: /* @__PURE__ */ d("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
46
46
|
/* @__PURE__ */ e(
|
|
47
47
|
h,
|
|
48
48
|
{
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
3
3
|
import * as x from "react";
|
|
4
4
|
import { cva as g } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
5
|
-
import { cn as
|
|
5
|
+
import { cn as s } from "../../lib/utils.js";
|
|
6
6
|
import { Label as v } from "./label.js";
|
|
7
7
|
import { Icon as l } from "./icon.js";
|
|
8
8
|
const b = g(
|
|
9
|
-
"file:text-d-foreground placeholder:text-d-muted-foreground selection:bg-d-primary selection:text-d-primary-foreground border-d-input flex w-full min-w-0 rounded-md border bg-d-input px-3 py-1 text-base shadow-sm transition-
|
|
9
|
+
"file:text-d-foreground placeholder:text-d-muted-foreground selection:bg-d-primary selection:text-d-primary-foreground border-d-input flex w-full min-w-0 rounded-md border bg-d-input px-3 py-1 text-base shadow-sm transition-all duration-200 outline-none file:inline-flex file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:cursor-not-allowed disabled:opacity-50 md:text-sm hover:shadow-md",
|
|
10
10
|
{
|
|
11
11
|
variants: {
|
|
12
12
|
size: {
|
|
@@ -27,14 +27,14 @@ const b = g(
|
|
|
27
27
|
labelClassName: u,
|
|
28
28
|
id: p,
|
|
29
29
|
iconLeft: i,
|
|
30
|
-
iconRight:
|
|
30
|
+
iconRight: d,
|
|
31
31
|
size: t,
|
|
32
32
|
...f
|
|
33
33
|
}, c) => {
|
|
34
34
|
const n = p || (r ? `input-${Math.random().toString(36).substring(2, 9)}` : void 0);
|
|
35
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ a("div", { className: s("space-y-1.5", o), children: [
|
|
36
36
|
r && /* @__PURE__ */ e(v, { htmlFor: n, className: u, children: r }),
|
|
37
|
-
/* @__PURE__ */
|
|
37
|
+
/* @__PURE__ */ a("div", { className: "relative w-full", children: [
|
|
38
38
|
i && /* @__PURE__ */ e("div", { className: "text-d-muted-foreground pointer-events-none absolute top-1/2 left-3 -translate-y-1/2", children: /* @__PURE__ */ e(l, { name: i, size: t === "lg" ? "sm" : "xs" }) }),
|
|
39
39
|
/* @__PURE__ */ e(
|
|
40
40
|
"input",
|
|
@@ -42,19 +42,18 @@ const b = g(
|
|
|
42
42
|
id: n,
|
|
43
43
|
type: m,
|
|
44
44
|
"data-slot": "input",
|
|
45
|
-
className:
|
|
45
|
+
className: s(
|
|
46
46
|
b({ size: t }),
|
|
47
|
-
"focus-visible:ring-ring focus-visible:ring-1 focus-visible:outline-none",
|
|
47
|
+
"focus-visible:ring-d-ring focus-visible:ring-1 focus-visible:outline-none",
|
|
48
48
|
"aria-invalid:ring-d-destructive/20 dark:aria-invalid:ring-d-destructive/40 aria-invalid:border-d-destructive",
|
|
49
|
-
"shadow-sm",
|
|
50
49
|
i ? t !== "lg" ? "pl-9" : "pl-10" : "",
|
|
51
|
-
|
|
50
|
+
d ? t !== "lg" ? "pr-9" : "pr-10" : ""
|
|
52
51
|
),
|
|
53
52
|
ref: c,
|
|
54
53
|
...f
|
|
55
54
|
}
|
|
56
55
|
),
|
|
57
|
-
|
|
56
|
+
d && /* @__PURE__ */ e("div", { className: "text-d-muted-foreground pointer-events-none absolute top-1/2 right-3 -translate-y-1/2", children: /* @__PURE__ */ e(l, { name: d, size: t === "lg" ? "sm" : "xs" }) })
|
|
58
57
|
] })
|
|
59
58
|
] });
|
|
60
59
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as r, jsxs as L, Fragment as G } from "react/jsx-runtime";
|
|
3
|
-
import { Command as
|
|
3
|
+
import { Command as ae, useCommandState as ce } from "../../node_modules/cmdk/dist/index.js";
|
|
4
4
|
import * as o from "react";
|
|
5
5
|
import { useEffect as C, forwardRef as fe } from "react";
|
|
6
|
-
import { Popover as me, PopoverTrigger as
|
|
6
|
+
import { Popover as me, PopoverTrigger as ge, PopoverContent as he } from "./popover.js";
|
|
7
7
|
import { Badge as pe } from "./badge.js";
|
|
8
8
|
import { CommandItem as I, Command as q, CommandList as ve, CommandGroup as be } from "./command.js";
|
|
9
9
|
import { cn as p } from "../../lib/utils.js";
|
|
10
|
-
import { Label as
|
|
11
|
-
import { Icon as
|
|
10
|
+
import { Label as we } from "./label.js";
|
|
11
|
+
import { Icon as xe } from "./icon.js";
|
|
12
12
|
import Ne from "../../node_modules/lucide-react/dist/esm/icons/x.js";
|
|
13
13
|
function ye(s, l) {
|
|
14
|
-
const [i,
|
|
14
|
+
const [i, a] = o.useState(s);
|
|
15
15
|
return C(() => {
|
|
16
|
-
const
|
|
16
|
+
const u = setTimeout(() => a(s), l);
|
|
17
17
|
return () => {
|
|
18
|
-
clearTimeout(
|
|
18
|
+
clearTimeout(u);
|
|
19
19
|
};
|
|
20
20
|
}, [s, l]), i;
|
|
21
21
|
}
|
|
@@ -27,26 +27,26 @@ function T(s, l) {
|
|
|
27
27
|
"": s
|
|
28
28
|
};
|
|
29
29
|
const i = {};
|
|
30
|
-
return s.forEach((
|
|
31
|
-
const
|
|
32
|
-
i[
|
|
30
|
+
return s.forEach((a) => {
|
|
31
|
+
const u = a[l] || "";
|
|
32
|
+
i[u] || (i[u] = []), i[u].push(a);
|
|
33
33
|
}), i;
|
|
34
34
|
}
|
|
35
35
|
function Ce(s, l) {
|
|
36
36
|
const i = JSON.parse(JSON.stringify(s));
|
|
37
|
-
for (const [
|
|
38
|
-
i[
|
|
37
|
+
for (const [a, u] of Object.entries(i))
|
|
38
|
+
i[a] = u.filter(
|
|
39
39
|
(V) => !l.find((c) => c.value === V.value)
|
|
40
40
|
);
|
|
41
41
|
return i;
|
|
42
42
|
}
|
|
43
43
|
function Ee(s, l) {
|
|
44
44
|
for (const [, i] of Object.entries(s))
|
|
45
|
-
if (i.some((
|
|
45
|
+
if (i.some((a) => l.find((u) => u.value === a.value)))
|
|
46
46
|
return !0;
|
|
47
47
|
return !1;
|
|
48
48
|
}
|
|
49
|
-
const Q = fe(({ className: s, ...l }, i) => ce((
|
|
49
|
+
const Q = fe(({ className: s, ...l }, i) => ce((u) => u.filtered.count === 0) ? /* @__PURE__ */ r(
|
|
50
50
|
"div",
|
|
51
51
|
{
|
|
52
52
|
ref: i,
|
|
@@ -62,8 +62,8 @@ const Oe = o.forwardRef(
|
|
|
62
62
|
value: s,
|
|
63
63
|
onChange: l,
|
|
64
64
|
placeholder: i,
|
|
65
|
-
defaultOptions:
|
|
66
|
-
options:
|
|
65
|
+
defaultOptions: a = [],
|
|
66
|
+
options: u,
|
|
67
67
|
delay: V,
|
|
68
68
|
onSearch: c,
|
|
69
69
|
onSearchSync: X,
|
|
@@ -84,23 +84,23 @@ const Oe = o.forwardRef(
|
|
|
84
84
|
hideClearAllButton: ee = !1,
|
|
85
85
|
label: W
|
|
86
86
|
}, te) => {
|
|
87
|
-
const
|
|
87
|
+
const g = o.useRef(null), [f, S] = o.useState(!1), [ne, z] = o.useState(!1), [H, $] = o.useState(!1), [re, oe] = o.useState(
|
|
88
88
|
void 0
|
|
89
89
|
), j = o.useRef(null), F = o.useRef(null), [t, y] = o.useState(s || []), [b, J] = o.useState(
|
|
90
|
-
T(
|
|
91
|
-
), [
|
|
90
|
+
T(a, v)
|
|
91
|
+
), [h, K] = o.useState(""), w = ye(h, V || 500);
|
|
92
92
|
o.useImperativeHandle(
|
|
93
93
|
te,
|
|
94
94
|
() => ({
|
|
95
95
|
selectedValue: [...t],
|
|
96
|
-
input:
|
|
97
|
-
focus: () =>
|
|
96
|
+
input: g.current,
|
|
97
|
+
focus: () => g?.current?.focus(),
|
|
98
98
|
reset: () => y([])
|
|
99
99
|
}),
|
|
100
100
|
[t]
|
|
101
101
|
);
|
|
102
|
-
const
|
|
103
|
-
j.current && !j.current.contains(e.target) &&
|
|
102
|
+
const x = (e) => {
|
|
103
|
+
j.current && !j.current.contains(e.target) && g.current && !g.current.contains(e.target) && (S(!1), g.current.blur());
|
|
104
104
|
}, M = o.useCallback(
|
|
105
105
|
(e) => {
|
|
106
106
|
const n = t.filter((d) => d.value !== e.value);
|
|
@@ -109,53 +109,53 @@ const Oe = o.forwardRef(
|
|
|
109
109
|
[l, t]
|
|
110
110
|
), se = o.useCallback(
|
|
111
111
|
(e) => {
|
|
112
|
-
const n =
|
|
112
|
+
const n = g.current;
|
|
113
113
|
n && ((e.key === "Delete" || e.key === "Backspace") && n.value === "" && t.length > 0 && (t[t.length - 1].fixed || M(t[t.length - 1])), e.key === "Escape" && n.blur());
|
|
114
114
|
},
|
|
115
115
|
[M, t]
|
|
116
116
|
);
|
|
117
117
|
C(() => {
|
|
118
118
|
if (typeof document < "u")
|
|
119
|
-
return f ? (document.addEventListener("mousedown",
|
|
120
|
-
document.removeEventListener("mousedown",
|
|
119
|
+
return f ? (document.addEventListener("mousedown", x), document.addEventListener("touchend", x)) : (document.removeEventListener("mousedown", x), document.removeEventListener("touchend", x)), () => {
|
|
120
|
+
document.removeEventListener("mousedown", x), document.removeEventListener("touchend", x);
|
|
121
121
|
};
|
|
122
|
-
}, [f,
|
|
122
|
+
}, [f, x]), C(() => {
|
|
123
123
|
s && y(s);
|
|
124
124
|
}, [s]), C(() => {
|
|
125
|
-
if (!
|
|
125
|
+
if (!u || c)
|
|
126
126
|
return;
|
|
127
|
-
const e = T(
|
|
127
|
+
const e = T(u || [], v);
|
|
128
128
|
JSON.stringify(e) !== JSON.stringify(b) && J(e);
|
|
129
|
-
}, [
|
|
129
|
+
}, [a, u, v, c, b]), C(() => {
|
|
130
130
|
const e = () => {
|
|
131
|
-
const d = X?.(
|
|
131
|
+
const d = X?.(w);
|
|
132
132
|
J(T(d || [], v));
|
|
133
133
|
};
|
|
134
134
|
(async () => {
|
|
135
|
-
!X || !f || (R && e(),
|
|
135
|
+
!X || !f || (R && e(), w && e());
|
|
136
136
|
})();
|
|
137
|
-
}, [
|
|
137
|
+
}, [w, v, f, R]), C(() => {
|
|
138
138
|
const e = async () => {
|
|
139
139
|
$(!0);
|
|
140
|
-
const d = await c?.(
|
|
140
|
+
const d = await c?.(w);
|
|
141
141
|
J(T(d || [], v)), $(!1);
|
|
142
142
|
};
|
|
143
143
|
(async () => {
|
|
144
|
-
!c || !f || (R && await e(),
|
|
144
|
+
!c || !f || (R && await e(), w && await e());
|
|
145
145
|
})();
|
|
146
|
-
}, [
|
|
146
|
+
}, [w, v, f, R]), o.useEffect(() => {
|
|
147
147
|
if (f && F.current) {
|
|
148
148
|
const e = F.current.getBoundingClientRect();
|
|
149
149
|
oe(e.width);
|
|
150
150
|
}
|
|
151
151
|
}, [f]);
|
|
152
152
|
const le = () => {
|
|
153
|
-
if (!E || Ee(b, [{ value:
|
|
153
|
+
if (!E || Ee(b, [{ value: h, label: h }]) || t.find((n) => n.value === h))
|
|
154
154
|
return;
|
|
155
155
|
const e = /* @__PURE__ */ r(
|
|
156
156
|
I,
|
|
157
157
|
{
|
|
158
|
-
value:
|
|
158
|
+
value: h,
|
|
159
159
|
className: "cursor-pointer",
|
|
160
160
|
onMouseDown: (n) => {
|
|
161
161
|
n.preventDefault(), n.stopPropagation();
|
|
@@ -169,10 +169,10 @@ const Oe = o.forwardRef(
|
|
|
169
169
|
const d = [...t, { value: n, label: n }];
|
|
170
170
|
y(d), l?.(d);
|
|
171
171
|
},
|
|
172
|
-
children: `Create "${
|
|
172
|
+
children: `Create "${h}"`
|
|
173
173
|
}
|
|
174
174
|
);
|
|
175
|
-
if (!c &&
|
|
175
|
+
if (!c && h.length > 0 || c && w.length > 0 && !H)
|
|
176
176
|
return e;
|
|
177
177
|
}, ie = o.useCallback(() => {
|
|
178
178
|
if (D)
|
|
@@ -180,14 +180,14 @@ const Oe = o.forwardRef(
|
|
|
180
180
|
}, [E, D, c, b]), de = o.useMemo(
|
|
181
181
|
() => Ce(b, t),
|
|
182
182
|
[b, t]
|
|
183
|
-
),
|
|
183
|
+
), ue = o.useCallback(() => {
|
|
184
184
|
if (m?.filter)
|
|
185
185
|
return m.filter;
|
|
186
186
|
if (E)
|
|
187
187
|
return (e, n) => e.toLowerCase().includes(n.toLowerCase()) ? 1 : -1;
|
|
188
188
|
}, [E, m?.filter]);
|
|
189
189
|
return /* @__PURE__ */ L("div", { className: "flex flex-col space-y-1.5", children: [
|
|
190
|
-
W && /* @__PURE__ */ r(
|
|
190
|
+
W && /* @__PURE__ */ r(we, { children: W }),
|
|
191
191
|
/* @__PURE__ */ r(
|
|
192
192
|
q,
|
|
193
193
|
{
|
|
@@ -201,15 +201,17 @@ const Oe = o.forwardRef(
|
|
|
201
201
|
m?.className
|
|
202
202
|
),
|
|
203
203
|
shouldFilter: m?.shouldFilter !== void 0 ? m.shouldFilter : !c,
|
|
204
|
-
filter:
|
|
204
|
+
filter: ue(),
|
|
205
205
|
children: /* @__PURE__ */ L(me, { open: f, onOpenChange: S, children: [
|
|
206
|
-
/* @__PURE__ */ r(
|
|
206
|
+
/* @__PURE__ */ r(ge, { asChild: !0, children: /* @__PURE__ */ r(
|
|
207
207
|
"div",
|
|
208
208
|
{
|
|
209
209
|
ref: F,
|
|
210
210
|
className: p(
|
|
211
|
-
|
|
212
|
-
"
|
|
211
|
+
"border-d-input ring-offset-d-background min-h-10 rounded-md border text-base md:text-sm",
|
|
212
|
+
"focus-within:outline-none",
|
|
213
|
+
"focus-visible-within:ring-d-ring focus-visible-within:ring-1",
|
|
214
|
+
f && "ring-d-ring ring-1",
|
|
213
215
|
{
|
|
214
216
|
"px-3 py-2": t.length !== 0,
|
|
215
217
|
"cursor-text": !N && t.length !== 0,
|
|
@@ -253,11 +255,11 @@ const Oe = o.forwardRef(
|
|
|
253
255
|
e.value
|
|
254
256
|
)),
|
|
255
257
|
/* @__PURE__ */ r(
|
|
256
|
-
|
|
258
|
+
ae.Input,
|
|
257
259
|
{
|
|
258
260
|
...O,
|
|
259
|
-
ref:
|
|
260
|
-
value:
|
|
261
|
+
ref: g,
|
|
262
|
+
value: h,
|
|
261
263
|
disabled: N,
|
|
262
264
|
onValueChange: (e) => {
|
|
263
265
|
K(e), O?.onValueChange?.(e);
|
|
@@ -292,7 +294,7 @@ const Oe = o.forwardRef(
|
|
|
292
294
|
},
|
|
293
295
|
"aria-label": "Clear selection",
|
|
294
296
|
children: /* @__PURE__ */ r(
|
|
295
|
-
|
|
297
|
+
xe,
|
|
296
298
|
{
|
|
297
299
|
name: "X",
|
|
298
300
|
size: "xs",
|
|
@@ -305,7 +307,7 @@ const Oe = o.forwardRef(
|
|
|
305
307
|
}
|
|
306
308
|
) }),
|
|
307
309
|
/* @__PURE__ */ r(
|
|
308
|
-
|
|
310
|
+
he,
|
|
309
311
|
{
|
|
310
312
|
className: "border-none p-0 shadow-lg",
|
|
311
313
|
style: { width: re },
|
|
@@ -321,7 +323,7 @@ const Oe = o.forwardRef(
|
|
|
321
323
|
z(!0);
|
|
322
324
|
},
|
|
323
325
|
onMouseUp: () => {
|
|
324
|
-
|
|
326
|
+
g?.current?.focus();
|
|
325
327
|
},
|
|
326
328
|
children: H ? /* @__PURE__ */ r(G, { children: Y }) : /* @__PURE__ */ L(G, { children: [
|
|
327
329
|
ie(),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
3
3
|
import * as c from "react";
|
|
4
4
|
import { Root as p, Group as f, Value as g, Trigger as x, Icon as h, Portal as v, Content as b, Viewport as y, Label as S, Item as w, ItemIndicator as z, ItemText as N, Separator as C, ScrollUpButton as I, ScrollDownButton as _ } from "../../node_modules/@radix-ui/react-select/dist/index.js";
|
|
5
|
-
import { cn as
|
|
5
|
+
import { cn as r } from "../../lib/utils.js";
|
|
6
6
|
import { Label as j } from "./label.js";
|
|
7
7
|
import u from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
|
|
8
8
|
import k from "../../node_modules/lucide-react/dist/esm/icons/check.js";
|
|
@@ -11,12 +11,12 @@ function q({
|
|
|
11
11
|
size: t = "default",
|
|
12
12
|
label: a,
|
|
13
13
|
className: s,
|
|
14
|
-
labelClassName:
|
|
14
|
+
labelClassName: o,
|
|
15
15
|
...d
|
|
16
16
|
}) {
|
|
17
17
|
const n = c.useId();
|
|
18
|
-
return /* @__PURE__ */ i("div", { className:
|
|
19
|
-
a && /* @__PURE__ */ e(j, { htmlFor: n, className:
|
|
18
|
+
return /* @__PURE__ */ i("div", { className: r("space-y-1.5", s), children: [
|
|
19
|
+
a && /* @__PURE__ */ e(j, { htmlFor: n, className: o, children: a }),
|
|
20
20
|
/* @__PURE__ */ e(m.Provider, { value: { size: t, id: n }, children: /* @__PURE__ */ e(p, { "data-slot": "select", ...d }) })
|
|
21
21
|
] });
|
|
22
22
|
}
|
|
@@ -35,7 +35,7 @@ function H({
|
|
|
35
35
|
className: t,
|
|
36
36
|
size: a,
|
|
37
37
|
children: s,
|
|
38
|
-
...
|
|
38
|
+
...o
|
|
39
39
|
}) {
|
|
40
40
|
const { size: d, id: n } = L(), l = a || d;
|
|
41
41
|
return /* @__PURE__ */ i(
|
|
@@ -44,17 +44,22 @@ function H({
|
|
|
44
44
|
id: n,
|
|
45
45
|
"data-slot": "select-trigger",
|
|
46
46
|
"data-size": l,
|
|
47
|
-
className:
|
|
48
|
-
"border-d-input ring-offset-background data-[placeholder]:text-d-muted-foreground
|
|
47
|
+
className: r(
|
|
48
|
+
"border-d-input ring-offset-background data-[placeholder]:text-d-muted-foreground bg-d-input flex items-center justify-between rounded-md border px-3 py-2 whitespace-nowrap shadow-sm focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
49
|
+
"focus-visible:ring-d-ring focus-visible:ring-1",
|
|
50
|
+
// Ring solo con tastiera
|
|
51
|
+
"data-[state=open]:ring-d-ring data-[state=open]:ring-1",
|
|
52
|
+
// Ring quando dropdown è aperto
|
|
49
53
|
"aria-invalid:ring-d-destructive/20 dark:aria-invalid:ring-d-destructive/40 aria-invalid:border-d-destructive",
|
|
50
54
|
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
51
55
|
"*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2",
|
|
56
|
+
"transition-all duration-300",
|
|
52
57
|
l === "default" && "h-9 text-sm",
|
|
53
58
|
l === "sm" && "h-8 text-xs",
|
|
54
59
|
l === "lg" && "h-10 text-lg",
|
|
55
60
|
t
|
|
56
61
|
),
|
|
57
|
-
...
|
|
62
|
+
...o,
|
|
58
63
|
children: [
|
|
59
64
|
s,
|
|
60
65
|
/* @__PURE__ */ e(h, { asChild: !0, children: /* @__PURE__ */ e(u, { className: "size-4 opacity-50" }) })
|
|
@@ -66,25 +71,25 @@ function J({
|
|
|
66
71
|
className: t,
|
|
67
72
|
children: a,
|
|
68
73
|
position: s = "popper",
|
|
69
|
-
...
|
|
74
|
+
...o
|
|
70
75
|
}) {
|
|
71
76
|
return /* @__PURE__ */ e(v, { children: /* @__PURE__ */ i(
|
|
72
77
|
b,
|
|
73
78
|
{
|
|
74
79
|
"data-slot": "select-content",
|
|
75
|
-
className:
|
|
80
|
+
className: r(
|
|
76
81
|
"bg-d-popover text-d-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-d-border relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
|
|
77
82
|
s === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
78
83
|
t
|
|
79
84
|
),
|
|
80
85
|
position: s,
|
|
81
|
-
...
|
|
86
|
+
...o,
|
|
82
87
|
children: [
|
|
83
88
|
/* @__PURE__ */ e(D, {}),
|
|
84
89
|
/* @__PURE__ */ e(
|
|
85
90
|
y,
|
|
86
91
|
{
|
|
87
|
-
className:
|
|
92
|
+
className: r(
|
|
88
93
|
"p-1",
|
|
89
94
|
s === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
90
95
|
),
|
|
@@ -104,7 +109,7 @@ function K({
|
|
|
104
109
|
S,
|
|
105
110
|
{
|
|
106
111
|
"data-slot": "select-label",
|
|
107
|
-
className:
|
|
112
|
+
className: r(
|
|
108
113
|
"text-d-secondary-foreground px-2 py-1.5 text-xs",
|
|
109
114
|
t
|
|
110
115
|
),
|
|
@@ -121,7 +126,7 @@ function M({
|
|
|
121
126
|
w,
|
|
122
127
|
{
|
|
123
128
|
"data-slot": "select-item",
|
|
124
|
-
className:
|
|
129
|
+
className: r(
|
|
125
130
|
"focus:bg-d-accent focus:text-d-accent-foreground [&_svg:not([class*='text-'])]:text-d-secondary-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
126
131
|
t
|
|
127
132
|
),
|
|
@@ -141,7 +146,7 @@ function O({
|
|
|
141
146
|
C,
|
|
142
147
|
{
|
|
143
148
|
"data-slot": "select-separator",
|
|
144
|
-
className:
|
|
149
|
+
className: r(
|
|
145
150
|
"bg-d-border pointer-events-none -mx-1 my-1 h-px",
|
|
146
151
|
t
|
|
147
152
|
),
|
|
@@ -157,7 +162,7 @@ function D({
|
|
|
157
162
|
I,
|
|
158
163
|
{
|
|
159
164
|
"data-slot": "select-scroll-up-button",
|
|
160
|
-
className:
|
|
165
|
+
className: r(
|
|
161
166
|
"flex cursor-default items-center justify-center py-1",
|
|
162
167
|
t
|
|
163
168
|
),
|
|
@@ -174,7 +179,7 @@ function R({
|
|
|
174
179
|
_,
|
|
175
180
|
{
|
|
176
181
|
"data-slot": "select-scroll-down-button",
|
|
177
|
-
className:
|
|
182
|
+
className: r(
|
|
178
183
|
"flex cursor-default items-center justify-center py-1",
|
|
179
184
|
t
|
|
180
185
|
),
|