@sth87/shadcn-design-system 0.2.0 → 0.2.2
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/AI_CONTEXT.md +4 -0
- package/dist/cjs/components/Select/Select.cjs +1 -1
- package/dist/cjs/components/Table/data-table-column-header.cjs +1 -1
- package/dist/cjs/components/Table/data-table.cjs +1 -1
- package/dist/cjs/packages/ui/src/components/combobox.cjs +1 -1
- package/dist/cjs/packages/ui/src/components/select.cjs +1 -1
- package/dist/cjs/packages/ui/src/components/table.cjs +1 -1
- package/dist/cjs/styles/index.css +1 -1
- package/dist/esm/components/Select/Select.js +138 -115
- package/dist/esm/components/Table/data-table-column-header.js +50 -25
- package/dist/esm/components/Table/data-table.js +77 -55
- package/dist/esm/packages/ui/src/components/combobox.js +57 -43
- package/dist/esm/packages/ui/src/components/select.js +163 -148
- package/dist/esm/packages/ui/src/components/table.js +23 -14
- package/dist/esm/styles/index.css +1 -1
- package/dist/types/components/Select/Select.d.ts +8 -0
- package/dist/types/components/Select/Select.d.ts.map +1 -1
- package/dist/types/components/Table/data-table-column-header.d.ts.map +1 -1
- package/dist/types/components/Table/data-table.d.ts +5 -0
- package/dist/types/components/Table/data-table.d.ts.map +1 -1
- package/dist/types/packages/ui/src/components/combobox.d.ts +5 -1
- package/dist/types/packages/ui/src/components/combobox.d.ts.map +1 -1
- package/dist/types/packages/ui/src/components/select.d.ts +4 -1
- package/dist/types/packages/ui/src/components/select.d.ts.map +1 -1
- package/dist/types/packages/ui/src/components/table.d.ts +4 -1
- package/dist/types/packages/ui/src/components/table.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as a, jsx as d, Fragment as f } from "react/jsx-runtime";
|
|
2
2
|
import * as b from "react";
|
|
3
|
-
import { ChevronUp as
|
|
4
|
-
import { cva as
|
|
5
|
-
import { Command as
|
|
6
|
-
import { Popover as
|
|
7
|
-
import { cn as
|
|
8
|
-
import { Label as
|
|
9
|
-
const
|
|
3
|
+
import { ChevronUp as I, ChevronDown as S, X as V, LoaderCircle as z, Check as D } from "lucide-react";
|
|
4
|
+
import { cva as E } from "class-variance-authority";
|
|
5
|
+
import { Command as F, CommandInput as G, CommandList as T, CommandEmpty as U, CommandGroup as X, CommandItem as q } from "./command.js";
|
|
6
|
+
import { Popover as A, PopoverTrigger as B, PopoverContent as J } from "./popover.js";
|
|
7
|
+
import { cn as i } from "../lib/utils.js";
|
|
8
|
+
import { Label as v } from "./label.js";
|
|
9
|
+
const K = E(
|
|
10
10
|
"ds:justify-between ds:relative ds:dark:bg-background ds:dark:hover:bg-input/50 ds:border-input ds:w-full ds:min-w-0 ds:rounded-md ds:border ds:border-border ds:bg-transparent ds:shadow-xs ds:transition-[color,box-shadow] ds:outline-none ds:file:inline-flex ds:file:h-7 ds:file:border-0 ds:file:bg-transparent ds:file:text-sm ds:file:font-medium ds:disabled:pointer-events-none ds:disabled:cursor-not-allowed ds:disabled:opacity-50 ds:focus-visible:border-ring ds:focus-visible:ring-ring/50 ds:focus-visible:ring-[3px] ds:aria-invalid:ring-destructive/20 ds:dark:aria-invalid:ring-destructive/40 ds:aria-invalid:border-destructive",
|
|
11
11
|
{
|
|
12
12
|
variants: {
|
|
@@ -30,45 +30,49 @@ const X = S(
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
|
-
function
|
|
33
|
+
function H({
|
|
34
34
|
value: t,
|
|
35
35
|
options: o,
|
|
36
36
|
placeHolder: l,
|
|
37
|
-
emptyText:
|
|
37
|
+
emptyText: h,
|
|
38
38
|
onChange: c,
|
|
39
|
+
onSearchChange: x,
|
|
40
|
+
shouldFilter: w,
|
|
41
|
+
loading: y = !1,
|
|
42
|
+
loadingText: C,
|
|
39
43
|
clearable: m,
|
|
40
|
-
className:
|
|
44
|
+
className: N,
|
|
41
45
|
dropdownClassName: u,
|
|
42
|
-
children:
|
|
46
|
+
children: k,
|
|
43
47
|
size: e,
|
|
44
|
-
state:
|
|
45
|
-
searchable:
|
|
48
|
+
state: j = "default",
|
|
49
|
+
searchable: L = !0,
|
|
46
50
|
tagRender: p,
|
|
47
51
|
disabled: r,
|
|
48
|
-
...
|
|
52
|
+
...O
|
|
49
53
|
}) {
|
|
50
|
-
const [n, g] = b.useState(!1),
|
|
54
|
+
const [n, g] = b.useState(!1), P = b.useCallback(
|
|
51
55
|
(s) => {
|
|
52
56
|
r || g(s);
|
|
53
57
|
},
|
|
54
58
|
[r]
|
|
55
59
|
);
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */ d(
|
|
58
|
-
|
|
60
|
+
return /* @__PURE__ */ a(A, { open: n, onOpenChange: P, modal: !0, children: [
|
|
61
|
+
/* @__PURE__ */ d(B, { asChild: !0, ...O, disabled: r, children: k ?? /* @__PURE__ */ a(
|
|
62
|
+
v,
|
|
59
63
|
{
|
|
60
64
|
"aria-disabled": r || void 0,
|
|
61
65
|
"data-disabled": r || void 0,
|
|
62
|
-
className:
|
|
63
|
-
|
|
66
|
+
className: i(
|
|
67
|
+
K({ size: e, state: j }),
|
|
64
68
|
r && "ds:pointer-events-none ds:cursor-not-allowed ds:opacity-50",
|
|
65
|
-
|
|
69
|
+
N
|
|
66
70
|
),
|
|
67
71
|
children: [
|
|
68
72
|
/* @__PURE__ */ d(
|
|
69
73
|
"span",
|
|
70
74
|
{
|
|
71
|
-
className:
|
|
75
|
+
className: i(
|
|
72
76
|
"ds:truncate ds:w-full ds:inline-block ds:align-middle ds:text-left",
|
|
73
77
|
{
|
|
74
78
|
"ds:pr-8": m
|
|
@@ -78,9 +82,9 @@ function W({
|
|
|
78
82
|
}
|
|
79
83
|
),
|
|
80
84
|
n && /* @__PURE__ */ d(
|
|
81
|
-
|
|
85
|
+
I,
|
|
82
86
|
{
|
|
83
|
-
className:
|
|
87
|
+
className: i(
|
|
84
88
|
"ds:z-10 ds:opacity-50",
|
|
85
89
|
{
|
|
86
90
|
"ds:size-4 ds:min-w-4": e === "sm" || e === "xs",
|
|
@@ -91,9 +95,9 @@ function W({
|
|
|
91
95
|
}
|
|
92
96
|
),
|
|
93
97
|
!n && /* @__PURE__ */ d(
|
|
94
|
-
|
|
98
|
+
S,
|
|
95
99
|
{
|
|
96
|
-
className:
|
|
100
|
+
className: i(
|
|
97
101
|
"ds:z-10 ds:opacity-50",
|
|
98
102
|
{
|
|
99
103
|
"ds:size-4 ds:min-w-4": e === "sm" || e === "xs",
|
|
@@ -107,46 +111,56 @@ function W({
|
|
|
107
111
|
}
|
|
108
112
|
) }),
|
|
109
113
|
m && t && !r && /* @__PURE__ */ d(
|
|
110
|
-
|
|
114
|
+
v,
|
|
111
115
|
{
|
|
112
116
|
onClick: (s) => {
|
|
113
117
|
s.stopPropagation(), c?.("");
|
|
114
118
|
},
|
|
115
119
|
className: "ds:absolute ds:right-11 ds:top-1/2 ds:-translate-y-1/2 ds:rounded-sm ds:p-1 ds:text-muted-foreground ds:hover:bg-accent ds:hover:text-accent-foreground ds:cursor-pointer ds:size-6 ds:opacity-50",
|
|
116
|
-
children: /* @__PURE__ */ d(
|
|
120
|
+
children: /* @__PURE__ */ d(V, { className: "ds:h-4 ds:w-4" })
|
|
117
121
|
}
|
|
118
122
|
),
|
|
119
123
|
/* @__PURE__ */ d(
|
|
120
|
-
|
|
124
|
+
J,
|
|
121
125
|
{
|
|
122
|
-
className:
|
|
126
|
+
className: i("ds:p-0 ds:w-(--radix-popover-trigger-width)"),
|
|
123
127
|
onInteractOutside: (s) => {
|
|
124
128
|
s.target.closest('[data-slot="popover-trigger"]') && s.preventDefault();
|
|
125
129
|
},
|
|
126
|
-
children: /* @__PURE__ */
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
children: /* @__PURE__ */ a(F, { shouldFilter: w, children: [
|
|
131
|
+
L && /* @__PURE__ */ d(
|
|
132
|
+
G,
|
|
133
|
+
{
|
|
134
|
+
placeholder: l,
|
|
135
|
+
className: "ds:h-9",
|
|
136
|
+
onValueChange: x
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
/* @__PURE__ */ d(T, { children: y ? /* @__PURE__ */ a("div", { className: "ds:flex ds:items-center ds:justify-center ds:gap-2 ds:py-6 ds:text-sm ds:text-muted-foreground", children: [
|
|
140
|
+
/* @__PURE__ */ d(z, { className: "ds:size-4 ds:animate-spin" }),
|
|
141
|
+
C ?? "Loading..."
|
|
142
|
+
] }) : /* @__PURE__ */ a(f, { children: [
|
|
143
|
+
/* @__PURE__ */ d(U, { children: h || "Not found" }),
|
|
144
|
+
/* @__PURE__ */ d(X, { children: o?.map((s) => /* @__PURE__ */ a(
|
|
145
|
+
q,
|
|
132
146
|
{
|
|
133
147
|
value: String(s.label),
|
|
134
148
|
onSelect: s?.disabled ? void 0 : () => {
|
|
135
149
|
c?.(s.value), g(!1);
|
|
136
150
|
},
|
|
137
|
-
className:
|
|
151
|
+
className: i(
|
|
138
152
|
s?.disabled && "ds:opacity-50 ds:cursor-not-allowed ds:grayscale",
|
|
139
153
|
t === s.value && "ds:bg-primary/10 ds:dark:bg-primary/20"
|
|
140
154
|
),
|
|
141
155
|
children: [
|
|
142
|
-
p ? p(s) : /* @__PURE__ */
|
|
156
|
+
p ? p(s) : /* @__PURE__ */ a(f, { children: [
|
|
143
157
|
s.icon && /* @__PURE__ */ d("span", { className: "ds:mr-2 ds:max-w-4 ds:max-h-4", children: s.icon }),
|
|
144
158
|
s.label
|
|
145
159
|
] }),
|
|
146
160
|
/* @__PURE__ */ d(
|
|
147
|
-
|
|
161
|
+
D,
|
|
148
162
|
{
|
|
149
|
-
className:
|
|
163
|
+
className: i(
|
|
150
164
|
"ds:ml-auto",
|
|
151
165
|
t === s.value ? "ds:opacity-100" : "ds:opacity-0"
|
|
152
166
|
// So sánh theo value
|
|
@@ -157,12 +171,12 @@ function W({
|
|
|
157
171
|
},
|
|
158
172
|
s.value
|
|
159
173
|
)) })
|
|
160
|
-
] })
|
|
174
|
+
] }) })
|
|
161
175
|
] })
|
|
162
176
|
}
|
|
163
177
|
)
|
|
164
178
|
] });
|
|
165
179
|
}
|
|
166
180
|
export {
|
|
167
|
-
|
|
181
|
+
H as Combobox
|
|
168
182
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { ChevronUp as
|
|
1
|
+
import { jsx as s, jsxs as u, Fragment as V } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronUp as L, ChevronDown as W, XIcon as E, LoaderCircle as D, CheckIcon as F } from "lucide-react";
|
|
3
3
|
import { cva as G } from "class-variance-authority";
|
|
4
|
-
import { cn as
|
|
5
|
-
import { Command as I, CommandList as
|
|
6
|
-
import { Popover as
|
|
4
|
+
import { cn as x } from "../lib/utils.js";
|
|
5
|
+
import { Command as I, CommandList as j, CommandInput as R, CommandEmpty as q, CommandGroup as H, CommandItem as U, CommandSeparator as X } from "./command.js";
|
|
6
|
+
import { Popover as B, PopoverTrigger as J, PopoverContent as K } from "./popover.js";
|
|
7
7
|
import * as P from "react";
|
|
8
|
-
import { useState as N, useCallback as
|
|
9
|
-
import { Badge as
|
|
10
|
-
import { Label as
|
|
11
|
-
const
|
|
8
|
+
import { useState as N, useCallback as k, createContext as Q, useRef as A, useEffect as Y, useContext as Z } from "react";
|
|
9
|
+
import { Badge as O } from "./badge.js";
|
|
10
|
+
import { Label as $ } from "./label.js";
|
|
11
|
+
const T = G(
|
|
12
12
|
"ds:flex ds:h-auto ds:w-fit ds:items-center ds:justify-between ds:gap-2 ds:overflow-hidden ds:rounded-md ds:border ds:bg-transparent ds:shadow-xs ds:transition-[color,box-shadow] ds:outline-none ds:focus-visible:ring-[3px] ds:disabled:cursor-not-allowed ds:disabled:opacity-50 ds:data-[placeholder]:text-muted-foreground ds:dark:bg-background ds:dark:hover:bg-input/50 ds:[&_svg]:pointer-events-none ds:[&_svg]:shrink-0 ds:[&_svg:not([class*='size-'])]:size-4 ds:[&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
13
13
|
{
|
|
14
14
|
variants: {
|
|
@@ -31,86 +31,86 @@ const $ = G(
|
|
|
31
31
|
state: "default"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
), _ =
|
|
35
|
-
function
|
|
34
|
+
), _ = Q(null);
|
|
35
|
+
function ae({
|
|
36
36
|
children: e,
|
|
37
|
-
values:
|
|
38
|
-
defaultValues:
|
|
39
|
-
onValuesChange:
|
|
37
|
+
values: n,
|
|
38
|
+
defaultValues: a,
|
|
39
|
+
onValuesChange: r
|
|
40
40
|
}) {
|
|
41
|
-
const [
|
|
42
|
-
new Set(
|
|
43
|
-
),
|
|
44
|
-
function b(
|
|
41
|
+
const [o, d] = N(!1), [l, m] = N(
|
|
42
|
+
new Set(n ?? a)
|
|
43
|
+
), y = n ? new Set(n) : l, [g, w] = N(/* @__PURE__ */ new Map());
|
|
44
|
+
function b(p) {
|
|
45
45
|
const f = (h) => {
|
|
46
|
-
const
|
|
47
|
-
return
|
|
46
|
+
const t = new Set(h);
|
|
47
|
+
return t.has(p) ? t.delete(p) : t.add(p), t;
|
|
48
48
|
};
|
|
49
|
-
|
|
49
|
+
m(f), r?.([...f(y)]);
|
|
50
50
|
}
|
|
51
|
-
const C =
|
|
52
|
-
|
|
51
|
+
const C = k((p, f) => {
|
|
52
|
+
w((h) => h.get(p) === f ? h : new Map(h).set(p, f));
|
|
53
53
|
}, []);
|
|
54
|
-
return /* @__PURE__ */
|
|
54
|
+
return /* @__PURE__ */ s(
|
|
55
55
|
_,
|
|
56
56
|
{
|
|
57
57
|
value: {
|
|
58
|
-
open:
|
|
58
|
+
open: o,
|
|
59
59
|
setOpen: d,
|
|
60
|
-
selectedValues:
|
|
60
|
+
selectedValues: y,
|
|
61
61
|
toggleValue: b,
|
|
62
62
|
items: g,
|
|
63
63
|
onItemAdded: C
|
|
64
64
|
},
|
|
65
|
-
children: /* @__PURE__ */
|
|
65
|
+
children: /* @__PURE__ */ s(B, { open: o, onOpenChange: d, children: e })
|
|
66
66
|
}
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function ce({
|
|
70
70
|
className: e,
|
|
71
|
-
dropdownClassName:
|
|
72
|
-
children:
|
|
73
|
-
size:
|
|
74
|
-
state:
|
|
71
|
+
dropdownClassName: n,
|
|
72
|
+
children: a,
|
|
73
|
+
size: r,
|
|
74
|
+
state: o = "default",
|
|
75
75
|
disabled: d,
|
|
76
|
-
...
|
|
76
|
+
...l
|
|
77
77
|
}) {
|
|
78
|
-
const { open:
|
|
79
|
-
return /* @__PURE__ */
|
|
80
|
-
|
|
78
|
+
const { open: m } = z();
|
|
79
|
+
return /* @__PURE__ */ s(J, { asChild: !0, disabled: d, children: /* @__PURE__ */ u(
|
|
80
|
+
$,
|
|
81
81
|
{
|
|
82
82
|
"aria-disabled": d || void 0,
|
|
83
83
|
"data-disabled": d || void 0,
|
|
84
|
-
className:
|
|
85
|
-
|
|
84
|
+
className: x(
|
|
85
|
+
T({ size: r, state: o }),
|
|
86
86
|
d && "ds:pointer-events-none ds:cursor-not-allowed ds:opacity-50",
|
|
87
87
|
e
|
|
88
88
|
),
|
|
89
89
|
children: [
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
a,
|
|
91
|
+
m && /* @__PURE__ */ s(
|
|
92
|
+
L,
|
|
93
93
|
{
|
|
94
|
-
className:
|
|
94
|
+
className: x(
|
|
95
95
|
"ds:z-10 ds:opacity-50",
|
|
96
96
|
{
|
|
97
|
-
"ds:size-4":
|
|
98
|
-
"ds:size-5":
|
|
97
|
+
"ds:size-4": r === "sm" || r === "xs",
|
|
98
|
+
"ds:size-5": r === "lg" || r === "xl"
|
|
99
99
|
},
|
|
100
|
-
|
|
100
|
+
n
|
|
101
101
|
)
|
|
102
102
|
}
|
|
103
103
|
),
|
|
104
|
-
!
|
|
105
|
-
|
|
104
|
+
!m && /* @__PURE__ */ s(
|
|
105
|
+
W,
|
|
106
106
|
{
|
|
107
|
-
className:
|
|
107
|
+
className: x(
|
|
108
108
|
"ds:z-10 ds:opacity-50",
|
|
109
109
|
{
|
|
110
|
-
"ds:size-4":
|
|
111
|
-
"ds:size-5":
|
|
110
|
+
"ds:size-4": r === "sm" || r === "xs",
|
|
111
|
+
"ds:size-5": r === "lg" || r === "xl"
|
|
112
112
|
},
|
|
113
|
-
|
|
113
|
+
n
|
|
114
114
|
)
|
|
115
115
|
}
|
|
116
116
|
)
|
|
@@ -118,97 +118,97 @@ function ae({
|
|
|
118
118
|
}
|
|
119
119
|
) });
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function ue({
|
|
122
122
|
placeholder: e,
|
|
123
|
-
clickToRemove:
|
|
124
|
-
className:
|
|
125
|
-
overflowBehavior:
|
|
126
|
-
...
|
|
123
|
+
clickToRemove: n = !0,
|
|
124
|
+
className: a,
|
|
125
|
+
overflowBehavior: r = "wrap-when-open",
|
|
126
|
+
...o
|
|
127
127
|
}) {
|
|
128
|
-
const { selectedValues: d, toggleValue:
|
|
128
|
+
const { selectedValues: d, toggleValue: l, items: m, open: y } = z(), [g, w] = N(0), b = A(null), C = A(null), p = r === "wrap" || r === "wrap-when-open" && y, f = k(() => {
|
|
129
129
|
if (b.current == null) return;
|
|
130
|
-
const
|
|
130
|
+
const t = b.current, i = C.current, v = t.querySelectorAll(
|
|
131
131
|
"[data-selected-item]"
|
|
132
132
|
);
|
|
133
|
-
|
|
133
|
+
i != null && (i.style.display = "none"), v.forEach((c) => c.style.removeProperty("display"));
|
|
134
134
|
let S = 0;
|
|
135
|
-
for (let
|
|
136
|
-
const M = v[
|
|
137
|
-
if (
|
|
135
|
+
for (let c = v.length - 1; c >= 0; c--) {
|
|
136
|
+
const M = v[c];
|
|
137
|
+
if (t.scrollWidth <= t.clientWidth)
|
|
138
138
|
break;
|
|
139
|
-
S = v.length -
|
|
139
|
+
S = v.length - c, M.style.display = "none", i?.style.removeProperty("display");
|
|
140
140
|
}
|
|
141
|
-
|
|
142
|
-
}, []), h =
|
|
143
|
-
(
|
|
144
|
-
b.current =
|
|
145
|
-
const
|
|
146
|
-
return
|
|
147
|
-
|
|
141
|
+
w(S);
|
|
142
|
+
}, []), h = k(
|
|
143
|
+
(t) => {
|
|
144
|
+
b.current = t;
|
|
145
|
+
const i = new ResizeObserver(f);
|
|
146
|
+
return i.observe(t), () => {
|
|
147
|
+
i.disconnect(), b.current = null;
|
|
148
148
|
};
|
|
149
149
|
},
|
|
150
150
|
[f]
|
|
151
151
|
);
|
|
152
|
-
return d.size === 0 && e ? /* @__PURE__ */
|
|
152
|
+
return d.size === 0 && e ? /* @__PURE__ */ s("span", { className: "ds:min-w-0 ds:overflow-hidden ds:font-normal ds:text-muted-foreground", children: e }) : /* @__PURE__ */ u(
|
|
153
153
|
"div",
|
|
154
154
|
{
|
|
155
|
-
...
|
|
155
|
+
...o,
|
|
156
156
|
ref: h,
|
|
157
|
-
className:
|
|
157
|
+
className: x(
|
|
158
158
|
"ds:flex ds:w-fit ds:gap-1.5 ds:overflow-hidden",
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
p && "ds:h-full ds:flex-wrap",
|
|
160
|
+
a
|
|
161
161
|
),
|
|
162
162
|
children: [
|
|
163
|
-
[...d].filter((
|
|
164
|
-
const
|
|
165
|
-
S.stopPropagation(),
|
|
163
|
+
[...d].filter((t) => m.has(t)).map((t) => {
|
|
164
|
+
const i = m.get(t), v = (S) => {
|
|
165
|
+
S.stopPropagation(), l(t);
|
|
166
166
|
};
|
|
167
|
-
if (P.isValidElement(
|
|
168
|
-
const S = typeof
|
|
169
|
-
key:
|
|
170
|
-
onClick:
|
|
171
|
-
className:
|
|
172
|
-
|
|
167
|
+
if (P.isValidElement(i)) {
|
|
168
|
+
const S = typeof i.type == "string" && ["div", "span", "button", "a"].includes(i.type), c = i, M = S ? {
|
|
169
|
+
key: t,
|
|
170
|
+
onClick: n ? v : void 0,
|
|
171
|
+
className: x(
|
|
172
|
+
c.props.className,
|
|
173
173
|
"ds:group ds:flex ds:items-center ds:gap-1 ds:whitespace-nowrap ds:hover:scale-105 ds:transition-transform",
|
|
174
174
|
{
|
|
175
|
-
"ds:cursor-pointer":
|
|
175
|
+
"ds:cursor-pointer": n
|
|
176
176
|
}
|
|
177
177
|
),
|
|
178
178
|
"data-selected-item": !0
|
|
179
179
|
} : {
|
|
180
|
-
key:
|
|
180
|
+
key: t,
|
|
181
181
|
"data-selected-item": !0
|
|
182
182
|
};
|
|
183
183
|
return P.cloneElement(
|
|
184
|
-
|
|
184
|
+
c,
|
|
185
185
|
M,
|
|
186
|
-
/* @__PURE__ */
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
/* @__PURE__ */ u(V, { children: [
|
|
187
|
+
c.props.children,
|
|
188
|
+
n && /* @__PURE__ */ s(E, { className: "ds:size-2 ds:text-muted-foreground ds:group-hover:text-destructive" })
|
|
189
189
|
] })
|
|
190
190
|
);
|
|
191
191
|
}
|
|
192
|
-
return /* @__PURE__ */
|
|
193
|
-
|
|
192
|
+
return /* @__PURE__ */ u(
|
|
193
|
+
O,
|
|
194
194
|
{
|
|
195
195
|
variant: "outline",
|
|
196
196
|
"data-selected-item": !0,
|
|
197
197
|
className: "ds:group ds:flex ds:items-center ds:gap-1",
|
|
198
|
-
onClick:
|
|
198
|
+
onClick: n ? v : void 0,
|
|
199
199
|
children: [
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
i,
|
|
201
|
+
n && /* @__PURE__ */ s(E, { className: "ds:size-2 ds:text-muted-foreground ds:group-hover:text-destructive" })
|
|
202
202
|
]
|
|
203
203
|
},
|
|
204
|
-
|
|
204
|
+
t
|
|
205
205
|
);
|
|
206
206
|
}),
|
|
207
|
-
/* @__PURE__ */
|
|
208
|
-
|
|
207
|
+
/* @__PURE__ */ u(
|
|
208
|
+
O,
|
|
209
209
|
{
|
|
210
210
|
style: {
|
|
211
|
-
display: g > 0 && !
|
|
211
|
+
display: g > 0 && !p ? "block" : "none"
|
|
212
212
|
},
|
|
213
213
|
variant: "outline",
|
|
214
214
|
ref: C,
|
|
@@ -222,60 +222,75 @@ function ce({
|
|
|
222
222
|
}
|
|
223
223
|
);
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function me({
|
|
226
226
|
search: e = !0,
|
|
227
|
-
|
|
228
|
-
|
|
227
|
+
onSearchChange: n,
|
|
228
|
+
loading: a = !1,
|
|
229
|
+
loadingText: r,
|
|
230
|
+
children: o,
|
|
231
|
+
...d
|
|
229
232
|
}) {
|
|
230
|
-
const
|
|
231
|
-
return /* @__PURE__ */
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
/* @__PURE__ */
|
|
234
|
-
|
|
233
|
+
const l = typeof e == "object" ? !0 : e;
|
|
234
|
+
return /* @__PURE__ */ u(V, { children: [
|
|
235
|
+
/* @__PURE__ */ s("div", { style: { display: "none" }, children: /* @__PURE__ */ s(I, { children: /* @__PURE__ */ s(j, { children: o }) }) }),
|
|
236
|
+
/* @__PURE__ */ s(K, { className: "ds:min-w-[var(--radix-popover-trigger-width)] ds:p-0", children: /* @__PURE__ */ u(I, { ...d, children: [
|
|
237
|
+
l ? /* @__PURE__ */ s(
|
|
235
238
|
R,
|
|
236
239
|
{
|
|
237
|
-
placeholder: typeof e == "object" ? e.placeholder : void 0
|
|
240
|
+
placeholder: typeof e == "object" ? e.placeholder : void 0,
|
|
241
|
+
onValueChange: n
|
|
242
|
+
}
|
|
243
|
+
) : /* @__PURE__ */ s(
|
|
244
|
+
"button",
|
|
245
|
+
{
|
|
246
|
+
type: "button",
|
|
247
|
+
"aria-label": "Search",
|
|
248
|
+
autoFocus: !0,
|
|
249
|
+
className: "ds:sr-only"
|
|
238
250
|
}
|
|
239
|
-
)
|
|
240
|
-
/* @__PURE__ */
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
] })
|
|
251
|
+
),
|
|
252
|
+
/* @__PURE__ */ s(j, { children: a ? /* @__PURE__ */ u("div", { className: "ds:flex ds:items-center ds:justify-center ds:gap-2 ds:py-6 ds:text-sm ds:text-muted-foreground", children: [
|
|
253
|
+
/* @__PURE__ */ s(D, { className: "ds:size-4 ds:animate-spin" }),
|
|
254
|
+
r ?? "Loading..."
|
|
255
|
+
] }) : /* @__PURE__ */ u(V, { children: [
|
|
256
|
+
l && /* @__PURE__ */ s(q, { children: typeof e == "object" ? e.emptyMessage : void 0 }),
|
|
257
|
+
o
|
|
258
|
+
] }) })
|
|
244
259
|
] }) })
|
|
245
260
|
] });
|
|
246
261
|
}
|
|
247
|
-
function
|
|
262
|
+
function pe({
|
|
248
263
|
value: e,
|
|
249
|
-
children:
|
|
250
|
-
badgeLabel:
|
|
251
|
-
onSelect:
|
|
252
|
-
icon:
|
|
264
|
+
children: n,
|
|
265
|
+
badgeLabel: a,
|
|
266
|
+
onSelect: r,
|
|
267
|
+
icon: o,
|
|
253
268
|
tagRender: d,
|
|
254
|
-
...
|
|
269
|
+
...l
|
|
255
270
|
}) {
|
|
256
|
-
const { toggleValue:
|
|
257
|
-
return
|
|
258
|
-
g(e,
|
|
259
|
-
}, [e,
|
|
260
|
-
|
|
271
|
+
const { toggleValue: m, selectedValues: y, onItemAdded: g } = z(), w = y.has(e);
|
|
272
|
+
return Y(() => {
|
|
273
|
+
g(e, a ?? n);
|
|
274
|
+
}, [e, n, g, a]), /* @__PURE__ */ u(
|
|
275
|
+
U,
|
|
261
276
|
{
|
|
262
|
-
...
|
|
263
|
-
onSelect:
|
|
264
|
-
|
|
277
|
+
...l,
|
|
278
|
+
onSelect: l?.disabled ? void 0 : () => {
|
|
279
|
+
m(e), r?.(e);
|
|
265
280
|
},
|
|
266
|
-
className:
|
|
267
|
-
|
|
268
|
-
|
|
281
|
+
className: x(
|
|
282
|
+
l?.disabled && "ds:opacity-50 ds:cursor-not-allowed ds:grayscale",
|
|
283
|
+
w && "ds:bg-primary/10 ds:dark:bg-primary/20"
|
|
269
284
|
),
|
|
270
285
|
children: [
|
|
271
|
-
!d &&
|
|
272
|
-
|
|
273
|
-
/* @__PURE__ */
|
|
286
|
+
!d && o && /* @__PURE__ */ s("span", { className: "ds:mr-2 ds:max-w-4 ds:max-h-4", children: o }),
|
|
287
|
+
n,
|
|
288
|
+
/* @__PURE__ */ s(
|
|
274
289
|
F,
|
|
275
290
|
{
|
|
276
|
-
className:
|
|
291
|
+
className: x(
|
|
277
292
|
"ds:mr-2 ds:ml-auto ds:size-4",
|
|
278
|
-
|
|
293
|
+
w ? "ds:opacity-100" : "ds:opacity-0"
|
|
279
294
|
)
|
|
280
295
|
}
|
|
281
296
|
)
|
|
@@ -283,14 +298,14 @@ function me({
|
|
|
283
298
|
}
|
|
284
299
|
);
|
|
285
300
|
}
|
|
286
|
-
function pe(e) {
|
|
287
|
-
return /* @__PURE__ */ r(H, { ...e });
|
|
288
|
-
}
|
|
289
301
|
function fe(e) {
|
|
290
|
-
return /* @__PURE__ */
|
|
302
|
+
return /* @__PURE__ */ s(H, { ...e });
|
|
303
|
+
}
|
|
304
|
+
function ge(e) {
|
|
305
|
+
return /* @__PURE__ */ s(X, { ...e });
|
|
291
306
|
}
|
|
292
|
-
function
|
|
293
|
-
const e =
|
|
307
|
+
function z() {
|
|
308
|
+
const e = Z(_);
|
|
294
309
|
if (e == null)
|
|
295
310
|
throw new Error(
|
|
296
311
|
"useMultiSelectContext must be used within a MultiSelectContext"
|
|
@@ -298,11 +313,11 @@ function k() {
|
|
|
298
313
|
return e;
|
|
299
314
|
}
|
|
300
315
|
export {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
316
|
+
ae as MultiSelect,
|
|
317
|
+
me as MultiSelectContent,
|
|
318
|
+
fe as MultiSelectGroup,
|
|
319
|
+
pe as MultiSelectItem,
|
|
320
|
+
ge as MultiSelectSeparator,
|
|
321
|
+
ce as MultiSelectTrigger,
|
|
322
|
+
ue as MultiSelectValue
|
|
308
323
|
};
|