@brightlocal/ui-components 2.23.0 → 2.24.1
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/AI_USAGE.md +1 -1
- package/README.md +3 -2
- package/component-meta.json +116 -25
- package/deprecations.json +22 -0
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +6 -9
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +151 -156
- package/dist/brand-illustration-motif.cjs +1 -0
- package/dist/brand-illustration-motif.d.ts +55 -0
- package/dist/brand-illustration-motif.d.ts.map +1 -0
- package/dist/brand-illustration-motif.js +67 -0
- package/dist/chart.cjs +7 -7
- package/dist/chart.d.ts +287 -2
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +408 -152
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +14 -1
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +387 -376
- package/dist/data-table.cjs +1 -0
- package/dist/{blocks/data-table.d.ts → data-table.d.ts} +159 -4
- package/dist/data-table.d.ts.map +1 -0
- package/dist/data-table.js +721 -0
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +16 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +23 -7
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +32 -2
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +179 -109
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +526 -511
- package/dist/label.cjs +1 -1
- package/dist/label.d.ts +9 -0
- package/dist/label.d.ts.map +1 -1
- package/dist/label.js +26 -22
- package/dist/lib/spring-settle.cjs +1 -0
- package/dist/lib/spring-settle.d.ts +20 -0
- package/dist/lib/spring-settle.d.ts.map +1 -0
- package/dist/lib/spring-settle.js +4 -0
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +3 -2
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +22 -11
- package/dist/loading.cjs +1 -1
- package/dist/loading.d.ts +2 -1
- package/dist/loading.d.ts.map +1 -1
- package/dist/loading.js +106 -85
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +16 -1
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +112 -79
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +29 -0
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +2 -2
- package/dist/text-reveal-motion.cjs +1 -1
- package/dist/text-reveal-motion.d.ts.map +1 -1
- package/dist/text-reveal-motion.js +236 -219
- package/dist/typography.cjs +1 -1
- package/dist/typography.d.ts +20 -4
- package/dist/typography.d.ts.map +1 -1
- package/dist/typography.js +263 -228
- package/package.json +2 -14
- package/src/blocks/sidebar.tsx +11 -23
- package/src/components/alert.tsx +1 -4
- package/src/components/brand-illustration-motif.tsx +143 -0
- package/src/components/chart.tsx +632 -1
- package/src/components/combobox.tsx +47 -0
- package/src/{blocks → components}/data-table.tsx +270 -16
- package/src/components/field.tsx +31 -0
- package/src/components/global-layout.tsx +144 -5
- package/src/components/label.tsx +13 -1
- package/src/components/link.tsx +13 -1
- package/src/components/loading.tsx +71 -38
- package/src/components/select.tsx +82 -2
- package/src/components/table.tsx +31 -2
- package/src/components/text-reveal-motion.tsx +90 -64
- package/src/components/typography.tsx +74 -18
- package/src/index.ts +2 -1
- package/src/lib/spring-settle.ts +19 -0
- package/dist/blocks/data-table.cjs +0 -1
- package/dist/blocks/data-table.d.ts.map +0 -1
- package/dist/blocks/data-table.js +0 -654
package/dist/combobox.js
CHANGED
|
@@ -1,112 +1,123 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsx as d, jsxs as B, Fragment as Z } from "react/jsx-runtime";
|
|
2
|
+
import * as e from "react";
|
|
3
3
|
import { Check as Y, ChevronsUpDown as ee } from "@brightlocal/icons";
|
|
4
4
|
import { useVirtualizer as te } from "@tanstack/react-virtual";
|
|
5
5
|
import { cva as oe } from "class-variance-authority";
|
|
6
6
|
import { defaultFilter as K } from "cmdk";
|
|
7
|
-
import { cn as
|
|
8
|
-
import { useDevWarning as
|
|
7
|
+
import { cn as T } from "@brightlocal/ui-components/lib/utils";
|
|
8
|
+
import { useDevWarning as H } from "@brightlocal/ui-components/lib/use-dev-warning";
|
|
9
9
|
import { Popover as re, PopoverContent as ne, PopoverTrigger as ae } from "@brightlocal/ui-components/popover";
|
|
10
10
|
import { Command as se, CommandEmpty as ie, CommandGroup as le, CommandInput as ue, CommandItem as ce, CommandList as de, CommandSeparator as fe } from "@brightlocal/ui-components/command";
|
|
11
|
-
const J =
|
|
11
|
+
const J = e.createContext(null), Q = e.createContext(null);
|
|
12
12
|
function _() {
|
|
13
|
-
const
|
|
14
|
-
if (!
|
|
13
|
+
const t = e.useContext(J);
|
|
14
|
+
if (!t)
|
|
15
15
|
throw new Error("Combobox components must be used within a <Combobox>");
|
|
16
|
-
return
|
|
16
|
+
return t;
|
|
17
17
|
}
|
|
18
18
|
function Fe({
|
|
19
|
-
value:
|
|
19
|
+
value: t,
|
|
20
20
|
onValueChange: r,
|
|
21
|
-
open:
|
|
21
|
+
open: a,
|
|
22
22
|
onOpenChange: o,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
onClose: s,
|
|
24
|
+
shouldFilter: f = !0,
|
|
25
|
+
disabled: l = !1,
|
|
26
|
+
itemToStringValue: c,
|
|
26
27
|
children: m
|
|
27
28
|
}) {
|
|
28
|
-
const [
|
|
29
|
+
const [v, D] = e.useState(""), [x, b] = e.useState(!1), [S, E] = e.useState(
|
|
29
30
|
() => /* @__PURE__ */ new Map()
|
|
30
|
-
), [
|
|
31
|
+
), [C, L] = e.useState(""), [V, y] = e.useState(void 0), w = t !== void 0, M = a !== void 0, R = w ? t : v, k = M ? a : x, N = e.useCallback(
|
|
31
32
|
(h) => {
|
|
32
|
-
h ||
|
|
33
|
+
h || L(""), M || b(h), o?.(h);
|
|
33
34
|
},
|
|
34
|
-
[
|
|
35
|
-
),
|
|
35
|
+
[M, o]
|
|
36
|
+
), p = e.useCallback(
|
|
36
37
|
(h) => {
|
|
37
|
-
w ||
|
|
38
|
+
w || D(h), r?.(h);
|
|
38
39
|
},
|
|
39
40
|
[w, r]
|
|
40
|
-
),
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
), I = e.useRef(s);
|
|
42
|
+
e.useEffect(() => {
|
|
43
|
+
I.current = s;
|
|
44
|
+
}, [s]);
|
|
45
|
+
const A = e.useRef(k);
|
|
46
|
+
e.useEffect(() => {
|
|
47
|
+
A.current && !k && I.current?.(), A.current = k;
|
|
48
|
+
}, [k]), e.useEffect(() => () => {
|
|
49
|
+
A.current && I.current?.();
|
|
43
50
|
}, []);
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
const u = e.useRef(/* @__PURE__ */ new Map()), F = e.useRef(!1), O = e.useRef(!0);
|
|
52
|
+
e.useEffect(() => () => {
|
|
53
|
+
O.current = !1;
|
|
54
|
+
}, []);
|
|
55
|
+
const j = e.useCallback(() => {
|
|
56
|
+
F.current || (F.current = !0, queueMicrotask(() => {
|
|
57
|
+
F.current = !1, O.current && E(new Map(u.current));
|
|
47
58
|
}));
|
|
48
|
-
}, []),
|
|
49
|
-
(h,
|
|
50
|
-
|
|
59
|
+
}, []), $ = e.useCallback(
|
|
60
|
+
(h, n) => {
|
|
61
|
+
u.current.get(h) !== n && (u.current.set(h, n), j());
|
|
51
62
|
},
|
|
52
|
-
[
|
|
53
|
-
),
|
|
63
|
+
[j]
|
|
64
|
+
), z = e.useCallback(
|
|
54
65
|
(h) => {
|
|
55
|
-
for (const [
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
for (const [n, i] of h)
|
|
67
|
+
u.current.set(n, i);
|
|
68
|
+
E(new Map(u.current));
|
|
58
69
|
},
|
|
59
70
|
[]
|
|
60
|
-
), q =
|
|
61
|
-
|
|
62
|
-
q.current =
|
|
63
|
-
}, [
|
|
64
|
-
const
|
|
71
|
+
), q = e.useRef(R);
|
|
72
|
+
e.useLayoutEffect(() => {
|
|
73
|
+
q.current = R;
|
|
74
|
+
}, [R]);
|
|
75
|
+
const U = e.useCallback(
|
|
65
76
|
(h) => {
|
|
66
|
-
h !== q.current &&
|
|
77
|
+
h !== q.current && u.current.has(h) && (u.current.delete(h), j());
|
|
67
78
|
},
|
|
68
|
-
[
|
|
69
|
-
),
|
|
70
|
-
() =>
|
|
71
|
-
[
|
|
72
|
-
),
|
|
79
|
+
[j]
|
|
80
|
+
), G = e.useMemo(
|
|
81
|
+
() => c ? (h, n, i) => K(c(h), n, i) : K,
|
|
82
|
+
[c]
|
|
83
|
+
), W = e.useMemo(
|
|
73
84
|
() => ({
|
|
74
|
-
open:
|
|
75
|
-
setOpen:
|
|
76
|
-
value:
|
|
77
|
-
onValueChange:
|
|
78
|
-
shouldFilter:
|
|
79
|
-
disabled:
|
|
80
|
-
itemLabels:
|
|
81
|
-
registerItem:
|
|
82
|
-
registerItemsSync:
|
|
83
|
-
unregisterItem:
|
|
84
|
-
itemToStringValue:
|
|
85
|
-
filterFn:
|
|
86
|
-
searchValue:
|
|
87
|
-
setSearchValue:
|
|
88
|
-
activeDescendantId:
|
|
89
|
-
setActiveDescendantId:
|
|
85
|
+
open: k,
|
|
86
|
+
setOpen: N,
|
|
87
|
+
value: R,
|
|
88
|
+
onValueChange: p,
|
|
89
|
+
shouldFilter: f,
|
|
90
|
+
disabled: l,
|
|
91
|
+
itemLabels: S,
|
|
92
|
+
registerItem: $,
|
|
93
|
+
registerItemsSync: z,
|
|
94
|
+
unregisterItem: U,
|
|
95
|
+
itemToStringValue: c,
|
|
96
|
+
filterFn: G,
|
|
97
|
+
searchValue: C,
|
|
98
|
+
setSearchValue: L,
|
|
99
|
+
activeDescendantId: V,
|
|
100
|
+
setActiveDescendantId: y
|
|
90
101
|
}),
|
|
91
102
|
[
|
|
103
|
+
k,
|
|
104
|
+
N,
|
|
105
|
+
R,
|
|
106
|
+
p,
|
|
107
|
+
f,
|
|
108
|
+
l,
|
|
92
109
|
S,
|
|
93
|
-
D,
|
|
94
|
-
E,
|
|
95
|
-
V,
|
|
96
|
-
i,
|
|
97
|
-
c,
|
|
98
|
-
d,
|
|
99
|
-
F,
|
|
100
|
-
O,
|
|
101
110
|
$,
|
|
102
|
-
s,
|
|
103
111
|
z,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
112
|
+
U,
|
|
113
|
+
c,
|
|
114
|
+
G,
|
|
115
|
+
C,
|
|
116
|
+
V,
|
|
117
|
+
y
|
|
107
118
|
]
|
|
108
119
|
);
|
|
109
|
-
return /* @__PURE__ */
|
|
120
|
+
return /* @__PURE__ */ d(J.Provider, { value: W, children: /* @__PURE__ */ d(re, { open: k, onOpenChange: N, children: m }) });
|
|
110
121
|
}
|
|
111
122
|
const be = oe([
|
|
112
123
|
// Base layout
|
|
@@ -131,43 +142,43 @@ const be = oe([
|
|
|
131
142
|
"transition-[background-color,border-color,box-shadow] duration-200 ease-out",
|
|
132
143
|
// Icon styles
|
|
133
144
|
"[&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
134
|
-
]), me =
|
|
145
|
+
]), me = e.forwardRef(
|
|
135
146
|
({
|
|
136
|
-
className:
|
|
147
|
+
className: t,
|
|
137
148
|
dataHook: r,
|
|
138
|
-
error:
|
|
149
|
+
error: a,
|
|
139
150
|
trackingEl: o,
|
|
140
|
-
trackingLabel:
|
|
141
|
-
children:
|
|
142
|
-
...
|
|
143
|
-
},
|
|
144
|
-
const { open:
|
|
145
|
-
return /* @__PURE__ */
|
|
151
|
+
trackingLabel: s,
|
|
152
|
+
children: f,
|
|
153
|
+
...l
|
|
154
|
+
}, c) => {
|
|
155
|
+
const { open: m, disabled: v, value: D } = _(), x = e.useId(), b = !D, S = a || l["aria-invalid"] === !0 || l["aria-invalid"] === "true";
|
|
156
|
+
return /* @__PURE__ */ d(ae, { asChild: !0, children: /* @__PURE__ */ B(
|
|
146
157
|
"button",
|
|
147
158
|
{
|
|
148
|
-
ref:
|
|
149
|
-
"aria-controls":
|
|
150
|
-
"aria-expanded":
|
|
159
|
+
ref: c,
|
|
160
|
+
"aria-controls": m ? x : void 0,
|
|
161
|
+
"aria-expanded": m,
|
|
151
162
|
"aria-haspopup": "listbox",
|
|
152
|
-
"aria-invalid":
|
|
153
|
-
className:
|
|
163
|
+
"aria-invalid": S ? "true" : void 0,
|
|
164
|
+
className: T(
|
|
154
165
|
be(),
|
|
155
|
-
|
|
156
|
-
|
|
166
|
+
S && "border-destructive-40 dark:border-destructive-40 focus-visible:border-destructive-40 dark:focus-visible:border-destructive-40 focus-visible:shadow-destructive data-[state=open]:border-destructive-40 dark:data-[state=open]:border-destructive-40 data-[state=open]:shadow-destructive",
|
|
167
|
+
t
|
|
157
168
|
),
|
|
158
169
|
"data-hook": r,
|
|
159
|
-
"data-placeholder":
|
|
170
|
+
"data-placeholder": b,
|
|
160
171
|
"data-slot": "combobox-trigger",
|
|
161
|
-
"data-state":
|
|
172
|
+
"data-state": m ? "open" : "closed",
|
|
162
173
|
"data-tracking-el": o || "combobox-trigger",
|
|
163
|
-
"data-tracking-label":
|
|
164
|
-
disabled: v ||
|
|
174
|
+
"data-tracking-label": s,
|
|
175
|
+
disabled: v || l.disabled,
|
|
165
176
|
role: "combobox",
|
|
166
177
|
type: "button",
|
|
167
|
-
...
|
|
178
|
+
...l,
|
|
168
179
|
children: [
|
|
169
|
-
|
|
170
|
-
/* @__PURE__ */
|
|
180
|
+
f,
|
|
181
|
+
/* @__PURE__ */ d(
|
|
171
182
|
ee,
|
|
172
183
|
{
|
|
173
184
|
"aria-hidden": "true",
|
|
@@ -180,469 +191,469 @@ const be = oe([
|
|
|
180
191
|
}
|
|
181
192
|
);
|
|
182
193
|
me.displayName = "ComboboxTrigger";
|
|
183
|
-
function pe(
|
|
184
|
-
return
|
|
194
|
+
function pe(t) {
|
|
195
|
+
return t != null && typeof t == "object" && "value" in t && typeof t.value == "string";
|
|
185
196
|
}
|
|
186
|
-
function X(
|
|
197
|
+
function X(t, r, a) {
|
|
187
198
|
if (r)
|
|
188
199
|
return {
|
|
189
200
|
getValue: r,
|
|
190
|
-
getLabel:
|
|
191
|
-
hasDistinctLabel: !!
|
|
201
|
+
getLabel: a ?? r,
|
|
202
|
+
hasDistinctLabel: !!a
|
|
192
203
|
};
|
|
193
|
-
const o =
|
|
204
|
+
const o = t[0];
|
|
194
205
|
if (!pe(o)) return null;
|
|
195
|
-
const
|
|
206
|
+
const s = (c) => c.value, f = "label" in o && typeof o.label == "string";
|
|
196
207
|
return {
|
|
197
|
-
getValue:
|
|
198
|
-
getLabel:
|
|
199
|
-
hasDistinctLabel:
|
|
208
|
+
getValue: s,
|
|
209
|
+
getLabel: a ?? (f ? (c) => String(c.label) : s),
|
|
210
|
+
hasDistinctLabel: f || !!a
|
|
200
211
|
};
|
|
201
212
|
}
|
|
202
213
|
function Ae({
|
|
203
|
-
placeholder:
|
|
214
|
+
placeholder: t,
|
|
204
215
|
className: r,
|
|
205
|
-
displayValue:
|
|
216
|
+
displayValue: a,
|
|
206
217
|
items: o,
|
|
207
|
-
getItemValue:
|
|
208
|
-
getItemLabel:
|
|
218
|
+
getItemValue: s,
|
|
219
|
+
getItemLabel: f
|
|
209
220
|
}) {
|
|
210
|
-
const { value:
|
|
211
|
-
() => o ? X(o,
|
|
212
|
-
[o,
|
|
221
|
+
const { value: l, itemLabels: c } = _(), m = e.useMemo(
|
|
222
|
+
() => o ? X(o, s, f) : null,
|
|
223
|
+
[o, s, f]
|
|
213
224
|
);
|
|
214
|
-
|
|
215
|
-
() => !!o && o.length > 0 && !
|
|
225
|
+
H(
|
|
226
|
+
() => !!o && o.length > 0 && !m,
|
|
216
227
|
"ComboboxValue: could not infer `getItemValue` from item shape. Pass `getItemValue` explicitly, or use items with a `value` string property.",
|
|
217
|
-
[o,
|
|
228
|
+
[o, m]
|
|
218
229
|
);
|
|
219
|
-
const v =
|
|
220
|
-
o.map((x) => [
|
|
221
|
-
), [o,
|
|
222
|
-
return /* @__PURE__ */
|
|
230
|
+
const v = e.useMemo(() => !o || !m ? null : new Map(
|
|
231
|
+
o.map((x) => [m.getValue(x), m.getLabel(x)])
|
|
232
|
+
), [o, m]), D = l ? v?.get(l) || c.get(l) || a?.(l) || l : t;
|
|
233
|
+
return /* @__PURE__ */ d(
|
|
223
234
|
"span",
|
|
224
235
|
{
|
|
225
|
-
className:
|
|
236
|
+
className: T(
|
|
226
237
|
"overflow-hidden text-base leading-normal font-medium text-ellipsis whitespace-nowrap",
|
|
227
238
|
r
|
|
228
239
|
),
|
|
229
240
|
"data-slot": "combobox-value",
|
|
230
|
-
children:
|
|
241
|
+
children: D
|
|
231
242
|
}
|
|
232
243
|
);
|
|
233
244
|
}
|
|
234
245
|
function Te({
|
|
235
|
-
dataHook:
|
|
246
|
+
dataHook: t,
|
|
236
247
|
className: r,
|
|
237
|
-
children:
|
|
248
|
+
children: a,
|
|
238
249
|
align: o = "start",
|
|
239
|
-
side:
|
|
240
|
-
sideOffset:
|
|
241
|
-
avoidCollisions:
|
|
242
|
-
hideList:
|
|
243
|
-
ariaLabel:
|
|
250
|
+
side: s = "bottom",
|
|
251
|
+
sideOffset: f,
|
|
252
|
+
avoidCollisions: l,
|
|
253
|
+
hideList: c = !1,
|
|
254
|
+
ariaLabel: m
|
|
244
255
|
}) {
|
|
245
|
-
const { open: v, shouldFilter:
|
|
256
|
+
const { open: v, shouldFilter: D, filterFn: x, itemToStringValue: b } = _(), [S, E] = e.useState(
|
|
246
257
|
null
|
|
247
|
-
), C =
|
|
248
|
-
if (C.current?.(), C.current = null, !
|
|
249
|
-
let
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
},
|
|
253
|
-
|
|
258
|
+
), C = e.useRef(null), L = e.useCallback((y) => {
|
|
259
|
+
if (C.current?.(), C.current = null, !y) return;
|
|
260
|
+
let w = !1;
|
|
261
|
+
const M = (p) => {
|
|
262
|
+
w || (p === "top" || p === "bottom") && (w = !0, R.disconnect(), E(p));
|
|
263
|
+
}, R = new MutationObserver(() => {
|
|
264
|
+
M(y.getAttribute("data-side"));
|
|
254
265
|
});
|
|
255
|
-
|
|
266
|
+
R.observe(y, {
|
|
256
267
|
attributes: !0,
|
|
257
268
|
attributeFilter: ["data-side"]
|
|
258
269
|
});
|
|
259
|
-
let
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
270
|
+
let k = 0, N = 0;
|
|
271
|
+
k = requestAnimationFrame(() => {
|
|
272
|
+
N = requestAnimationFrame(() => {
|
|
273
|
+
M(y.getAttribute("data-side"));
|
|
263
274
|
});
|
|
264
275
|
}), C.current = () => {
|
|
265
|
-
|
|
276
|
+
w = !0, R.disconnect(), cancelAnimationFrame(k), cancelAnimationFrame(N);
|
|
266
277
|
};
|
|
267
278
|
}, []);
|
|
268
|
-
|
|
279
|
+
e.useEffect(() => {
|
|
269
280
|
if (!v) {
|
|
270
281
|
C.current?.(), C.current = null;
|
|
271
|
-
const
|
|
272
|
-
return () => clearTimeout(
|
|
282
|
+
const y = setTimeout(() => E(null), 150);
|
|
283
|
+
return () => clearTimeout(y);
|
|
273
284
|
}
|
|
274
285
|
}, [v]);
|
|
275
|
-
const
|
|
276
|
-
return /* @__PURE__ */
|
|
286
|
+
const V = b ? x : void 0;
|
|
287
|
+
return /* @__PURE__ */ d(
|
|
277
288
|
ne,
|
|
278
289
|
{
|
|
279
|
-
ref:
|
|
290
|
+
ref: L,
|
|
280
291
|
align: o,
|
|
281
|
-
"aria-label":
|
|
282
|
-
avoidCollisions:
|
|
283
|
-
className:
|
|
292
|
+
"aria-label": m ?? "Options",
|
|
293
|
+
avoidCollisions: l,
|
|
294
|
+
className: T(
|
|
284
295
|
"flex max-h-[var(--radix-popover-content-available-height)] w-[var(--radix-popover-trigger-width)] flex-col overflow-hidden p-0",
|
|
285
296
|
r
|
|
286
297
|
),
|
|
287
298
|
collisionPadding: 4,
|
|
288
299
|
"data-slot": "combobox-popover",
|
|
289
|
-
side:
|
|
290
|
-
sideOffset:
|
|
291
|
-
children: /* @__PURE__ */
|
|
300
|
+
side: S ?? s,
|
|
301
|
+
sideOffset: f,
|
|
302
|
+
children: /* @__PURE__ */ d(
|
|
292
303
|
se,
|
|
293
304
|
{
|
|
294
|
-
className:
|
|
305
|
+
className: T(
|
|
295
306
|
"min-h-0 flex-1 border-0 shadow-none",
|
|
296
307
|
"[&_[data-slot='command-input-wrapper']]:shrink-0",
|
|
297
|
-
|
|
308
|
+
c && "[&_[data-slot='command-input-wrapper']]:border-b-0"
|
|
298
309
|
),
|
|
299
310
|
"data-slot": "combobox-command",
|
|
300
|
-
dataHook:
|
|
301
|
-
filter:
|
|
302
|
-
shouldFilter:
|
|
303
|
-
children:
|
|
311
|
+
dataHook: t || "combobox-command",
|
|
312
|
+
filter: V,
|
|
313
|
+
shouldFilter: D,
|
|
314
|
+
children: a
|
|
304
315
|
}
|
|
305
316
|
)
|
|
306
317
|
}
|
|
307
318
|
);
|
|
308
319
|
}
|
|
309
|
-
const xe =
|
|
310
|
-
const { setSearchValue:
|
|
320
|
+
const xe = e.forwardRef(({ debounceMs: t, onValueChange: r, ...a }, o) => {
|
|
321
|
+
const { setSearchValue: s, shouldFilter: f, activeDescendantId: l } = _(), c = e.useRef(
|
|
311
322
|
void 0
|
|
312
323
|
);
|
|
313
|
-
|
|
314
|
-
() => !!(
|
|
324
|
+
H(
|
|
325
|
+
() => !!(t && t > 0 && f),
|
|
315
326
|
`debounceMs is set on <ComboboxInput> but shouldFilter is true (default).
|
|
316
327
|
Debounce is designed for async/server-driven search where the consumer controls the items list.
|
|
317
328
|
Set shouldFilter={false} on <Combobox> for async search, or remove debounceMs for client-side filtering.`,
|
|
318
|
-
[
|
|
319
|
-
),
|
|
320
|
-
() => !!(
|
|
329
|
+
[t, f]
|
|
330
|
+
), H(
|
|
331
|
+
() => !!(t && t > 0 && a.value !== void 0),
|
|
321
332
|
"debounceMs is set on <ComboboxInput> together with a controlled `value` prop.\nThe debounced onValueChange callback cannot update the controlled value synchronously, so the input will appear to lag behind typing.\nRemove `value` to let the input manage its own display, or remove debounceMs if you need a controlled input.",
|
|
322
|
-
[
|
|
323
|
-
),
|
|
324
|
-
|
|
333
|
+
[t, a.value]
|
|
334
|
+
), e.useEffect(() => () => {
|
|
335
|
+
c.current && clearTimeout(c.current);
|
|
325
336
|
}, []);
|
|
326
|
-
const
|
|
337
|
+
const m = e.useCallback(
|
|
327
338
|
(v) => {
|
|
328
|
-
|
|
339
|
+
s(v), t && t > 0 ? (clearTimeout(c.current), c.current = setTimeout(() => {
|
|
329
340
|
r?.(v);
|
|
330
|
-
},
|
|
341
|
+
}, t)) : r?.(v);
|
|
331
342
|
},
|
|
332
|
-
[
|
|
343
|
+
[t, r, s]
|
|
333
344
|
);
|
|
334
|
-
return /* @__PURE__ */
|
|
345
|
+
return /* @__PURE__ */ d(
|
|
335
346
|
ue,
|
|
336
347
|
{
|
|
337
348
|
ref: o,
|
|
338
|
-
"aria-activedescendant":
|
|
349
|
+
"aria-activedescendant": l,
|
|
339
350
|
"data-slot": "combobox-input",
|
|
340
|
-
onValueChange:
|
|
341
|
-
...
|
|
351
|
+
onValueChange: m,
|
|
352
|
+
...a
|
|
342
353
|
}
|
|
343
354
|
);
|
|
344
355
|
});
|
|
345
356
|
xe.displayName = "ComboboxInput";
|
|
346
|
-
const he =
|
|
357
|
+
const he = e.forwardRef(({ className: t, ...r }, a) => /* @__PURE__ */ d(
|
|
347
358
|
de,
|
|
348
359
|
{
|
|
349
|
-
ref:
|
|
350
|
-
className:
|
|
360
|
+
ref: a,
|
|
361
|
+
className: T("scrollbar min-h-0 flex-1", t),
|
|
351
362
|
"data-slot": "combobox-list",
|
|
352
363
|
...r
|
|
353
364
|
}
|
|
354
365
|
));
|
|
355
366
|
he.displayName = "ComboboxList";
|
|
356
367
|
function ge({
|
|
357
|
-
items:
|
|
368
|
+
items: t,
|
|
358
369
|
getItemValue: r,
|
|
359
|
-
getItemLabel:
|
|
370
|
+
getItemLabel: a,
|
|
360
371
|
getItemKeywords: o,
|
|
361
|
-
estimateSize:
|
|
362
|
-
overscan:
|
|
363
|
-
children:
|
|
364
|
-
renderEmpty:
|
|
365
|
-
className:
|
|
372
|
+
estimateSize: s = 36,
|
|
373
|
+
overscan: f = 5,
|
|
374
|
+
children: l,
|
|
375
|
+
renderEmpty: c,
|
|
376
|
+
className: m,
|
|
366
377
|
dataHook: v
|
|
367
|
-
},
|
|
368
|
-
const x =
|
|
369
|
-
() => X(
|
|
370
|
-
[
|
|
371
|
-
),
|
|
372
|
-
() => x?.getValue ?? ((
|
|
373
|
-
if (typeof
|
|
374
|
-
return String(
|
|
378
|
+
}, D) {
|
|
379
|
+
const x = e.useMemo(
|
|
380
|
+
() => X(t, r, a),
|
|
381
|
+
[t, r, a]
|
|
382
|
+
), b = e.useMemo(
|
|
383
|
+
() => x?.getValue ?? ((n) => {
|
|
384
|
+
if (typeof n == "string" || typeof n == "number")
|
|
385
|
+
return String(n);
|
|
375
386
|
throw new Error(
|
|
376
387
|
"[BrightLocal DS] ComboboxVirtualList: `getItemValue` is required for non-primitive items without a `value` property."
|
|
377
388
|
);
|
|
378
389
|
}),
|
|
379
390
|
[x]
|
|
380
|
-
),
|
|
381
|
-
() => x?.getLabel ??
|
|
382
|
-
[x,
|
|
391
|
+
), S = e.useMemo(
|
|
392
|
+
() => x?.getLabel ?? b,
|
|
393
|
+
[x, b]
|
|
383
394
|
);
|
|
384
|
-
|
|
385
|
-
() => !x &&
|
|
395
|
+
H(
|
|
396
|
+
() => !x && t.length > 0,
|
|
386
397
|
"ComboboxVirtualList: could not infer `getItemValue` from item shape. Pass `getItemValue` explicitly, or use items with a `value` string property.",
|
|
387
|
-
[x,
|
|
398
|
+
[x, t.length]
|
|
388
399
|
);
|
|
389
|
-
const
|
|
400
|
+
const E = e.useRef(null), {
|
|
390
401
|
value: C,
|
|
391
|
-
onValueChange:
|
|
392
|
-
setOpen:
|
|
393
|
-
shouldFilter:
|
|
394
|
-
searchValue:
|
|
395
|
-
filterFn:
|
|
396
|
-
setActiveDescendantId:
|
|
397
|
-
registerItemsSync:
|
|
398
|
-
unregisterItem:
|
|
399
|
-
} = _(), [
|
|
400
|
-
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
|
|
402
|
+
onValueChange: L,
|
|
403
|
+
setOpen: V,
|
|
404
|
+
shouldFilter: y,
|
|
405
|
+
searchValue: w,
|
|
406
|
+
filterFn: M,
|
|
407
|
+
setActiveDescendantId: R,
|
|
408
|
+
registerItemsSync: k,
|
|
409
|
+
unregisterItem: N
|
|
410
|
+
} = _(), [p, I] = e.useState(0), A = e.useId();
|
|
411
|
+
e.useImperativeHandle(D, () => E.current, []), e.useLayoutEffect(() => {
|
|
412
|
+
const n = t.map((i) => [
|
|
413
|
+
b(i),
|
|
414
|
+
S(i)
|
|
404
415
|
]);
|
|
405
|
-
return
|
|
406
|
-
for (const
|
|
407
|
-
|
|
416
|
+
return k(n), () => {
|
|
417
|
+
for (const i of t)
|
|
418
|
+
N(b(i));
|
|
408
419
|
};
|
|
409
|
-
}, [
|
|
410
|
-
const
|
|
411
|
-
if (!
|
|
412
|
-
const
|
|
413
|
-
for (const
|
|
414
|
-
let g = x?.hasDistinctLabel ? K(
|
|
420
|
+
}, [t, b, S, k, N]);
|
|
421
|
+
const u = e.useMemo(() => {
|
|
422
|
+
if (!y || !w.trim()) return t;
|
|
423
|
+
const n = [];
|
|
424
|
+
for (const i of t) {
|
|
425
|
+
let g = x?.hasDistinctLabel ? K(S(i), w) : M(b(i), w);
|
|
415
426
|
if (o)
|
|
416
|
-
for (const
|
|
417
|
-
g = Math.max(g, K(
|
|
418
|
-
g > 0 &&
|
|
427
|
+
for (const P of o(i))
|
|
428
|
+
g = Math.max(g, K(P, w));
|
|
429
|
+
g > 0 && n.push({ item: i, score: g });
|
|
419
430
|
}
|
|
420
|
-
return
|
|
431
|
+
return n.sort((i, g) => g.score - i.score), n.map((i) => i.item);
|
|
421
432
|
}, [
|
|
422
|
-
|
|
423
|
-
w,
|
|
433
|
+
t,
|
|
424
434
|
y,
|
|
425
|
-
|
|
426
|
-
|
|
435
|
+
w,
|
|
436
|
+
b,
|
|
437
|
+
S,
|
|
427
438
|
o,
|
|
428
|
-
|
|
439
|
+
M,
|
|
429
440
|
x?.hasDistinctLabel
|
|
430
441
|
]), F = te({
|
|
431
|
-
count:
|
|
432
|
-
getScrollElement: () =>
|
|
433
|
-
estimateSize: () =>
|
|
434
|
-
overscan:
|
|
435
|
-
}), O =
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}, [
|
|
439
|
-
const
|
|
440
|
-
|
|
441
|
-
if (
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
}, [C,
|
|
445
|
-
const $ =
|
|
446
|
-
|
|
447
|
-
$.current &&
|
|
448
|
-
}, [
|
|
449
|
-
const
|
|
442
|
+
count: u.length,
|
|
443
|
+
getScrollElement: () => E.current,
|
|
444
|
+
estimateSize: () => s,
|
|
445
|
+
overscan: f
|
|
446
|
+
}), O = p >= 0 && p < u.length ? b(u[p]) : null;
|
|
447
|
+
e.useEffect(() => {
|
|
448
|
+
I(0);
|
|
449
|
+
}, [w, u.length]);
|
|
450
|
+
const j = e.useRef(!1);
|
|
451
|
+
e.useEffect(() => {
|
|
452
|
+
if (j.current || !C) return;
|
|
453
|
+
const n = u.findIndex((i) => b(i) === C);
|
|
454
|
+
n >= 0 && (I(n), F.scrollToIndex(n, { align: "center" }), j.current = !0);
|
|
455
|
+
}, [C, u, b, F]);
|
|
456
|
+
const $ = e.useRef(!1);
|
|
457
|
+
e.useEffect(() => {
|
|
458
|
+
$.current && p >= 0 && p < u.length && F.scrollToIndex(p, { align: "auto" }), $.current = !1;
|
|
459
|
+
}, [p, u.length, F]), e.useEffect(() => {
|
|
460
|
+
const n = E.current?.closest(
|
|
450
461
|
'[data-slot="combobox-command"]'
|
|
451
462
|
);
|
|
452
|
-
if (!
|
|
453
|
-
const
|
|
463
|
+
if (!n) return;
|
|
464
|
+
const i = (g) => {
|
|
454
465
|
switch (g.key) {
|
|
455
466
|
case "ArrowDown":
|
|
456
|
-
g.preventDefault(), g.stopPropagation(), $.current = !0,
|
|
457
|
-
(
|
|
467
|
+
g.preventDefault(), g.stopPropagation(), $.current = !0, I(
|
|
468
|
+
(P) => P < u.length - 1 ? P + 1 : P
|
|
458
469
|
);
|
|
459
470
|
break;
|
|
460
471
|
case "ArrowUp":
|
|
461
|
-
g.preventDefault(), g.stopPropagation(), $.current = !0,
|
|
472
|
+
g.preventDefault(), g.stopPropagation(), $.current = !0, I((P) => P > 0 ? P - 1 : P);
|
|
462
473
|
break;
|
|
463
474
|
case "Enter":
|
|
464
|
-
if (g.preventDefault(), g.stopPropagation(),
|
|
465
|
-
const
|
|
466
|
-
|
|
475
|
+
if (g.preventDefault(), g.stopPropagation(), p >= 0 && p < u.length) {
|
|
476
|
+
const P = b(u[p]);
|
|
477
|
+
L(P === C ? "" : P), V(!1);
|
|
467
478
|
}
|
|
468
479
|
break;
|
|
469
480
|
case "Home":
|
|
470
|
-
g.preventDefault(), g.stopPropagation(), $.current = !0,
|
|
481
|
+
g.preventDefault(), g.stopPropagation(), $.current = !0, I(0);
|
|
471
482
|
break;
|
|
472
483
|
case "End":
|
|
473
|
-
g.preventDefault(), g.stopPropagation(), $.current = !0,
|
|
484
|
+
g.preventDefault(), g.stopPropagation(), $.current = !0, I(u.length - 1);
|
|
474
485
|
break;
|
|
475
486
|
}
|
|
476
487
|
};
|
|
477
|
-
return
|
|
478
|
-
}, [
|
|
479
|
-
const z =
|
|
480
|
-
const
|
|
481
|
-
return
|
|
482
|
-
|
|
483
|
-
}),
|
|
484
|
-
}, [
|
|
485
|
-
(
|
|
486
|
-
const
|
|
487
|
-
|
|
488
|
+
return n.addEventListener("keydown", i, { capture: !0 }), () => n.removeEventListener("keydown", i, { capture: !0 });
|
|
489
|
+
}, [u, p, C, L, V, b]);
|
|
490
|
+
const z = e.useMemo(() => {
|
|
491
|
+
const n = /* @__PURE__ */ new Map();
|
|
492
|
+
return u.forEach((i, g) => {
|
|
493
|
+
n.set(b(i), g);
|
|
494
|
+
}), n;
|
|
495
|
+
}, [u, b]), q = e.useCallback(
|
|
496
|
+
(n) => {
|
|
497
|
+
const i = z.get(n);
|
|
498
|
+
i !== void 0 && I(i);
|
|
488
499
|
},
|
|
489
500
|
[z]
|
|
490
|
-
),
|
|
491
|
-
(
|
|
501
|
+
), U = e.useCallback(
|
|
502
|
+
(n) => (z.get(n) ?? 0) + 1,
|
|
492
503
|
[z]
|
|
493
|
-
),
|
|
504
|
+
), G = u.length, W = e.useMemo(
|
|
494
505
|
() => ({
|
|
495
506
|
activeValue: O,
|
|
496
|
-
onItemPointerMove:
|
|
497
|
-
idPrefix:
|
|
498
|
-
filteredCount:
|
|
499
|
-
getItemPosition:
|
|
507
|
+
onItemPointerMove: q,
|
|
508
|
+
idPrefix: A,
|
|
509
|
+
filteredCount: G,
|
|
510
|
+
getItemPosition: U
|
|
500
511
|
}),
|
|
501
|
-
[O,
|
|
502
|
-
),
|
|
503
|
-
return
|
|
512
|
+
[O, q, A, G, U]
|
|
513
|
+
), h = O != null ? `${A}item-${O}` : void 0;
|
|
514
|
+
return e.useEffect(() => (R(h), () => R(void 0)), [h, R]), u.length === 0 ? /* @__PURE__ */ d(
|
|
504
515
|
"div",
|
|
505
516
|
{
|
|
506
|
-
ref:
|
|
507
|
-
className:
|
|
517
|
+
ref: E,
|
|
518
|
+
className: T(
|
|
508
519
|
"scrollbar max-h-[300px] min-h-0 flex-1 scroll-py-1 overflow-x-hidden overflow-y-auto py-1",
|
|
509
|
-
|
|
520
|
+
m
|
|
510
521
|
),
|
|
511
522
|
"data-hook": v,
|
|
512
523
|
"data-slot": "combobox-virtual-list",
|
|
513
524
|
role: "listbox",
|
|
514
|
-
children:
|
|
525
|
+
children: c
|
|
515
526
|
}
|
|
516
|
-
) : /* @__PURE__ */
|
|
527
|
+
) : /* @__PURE__ */ d(Q.Provider, { value: W, children: /* @__PURE__ */ d(
|
|
517
528
|
"div",
|
|
518
529
|
{
|
|
519
|
-
ref:
|
|
520
|
-
className:
|
|
530
|
+
ref: E,
|
|
531
|
+
className: T(
|
|
521
532
|
"scrollbar max-h-[300px] min-h-0 flex-1 scroll-py-1 overflow-x-hidden overflow-y-auto py-1",
|
|
522
|
-
|
|
533
|
+
m
|
|
523
534
|
),
|
|
524
535
|
"data-hook": v,
|
|
525
536
|
"data-slot": "combobox-virtual-list",
|
|
526
537
|
role: "listbox",
|
|
527
|
-
children: /* @__PURE__ */
|
|
538
|
+
children: /* @__PURE__ */ d(
|
|
528
539
|
"div",
|
|
529
540
|
{
|
|
530
541
|
className: "relative w-full",
|
|
531
542
|
style: { height: `${F.getTotalSize()}px` },
|
|
532
|
-
children: F.getVirtualItems().map((
|
|
543
|
+
children: F.getVirtualItems().map((n) => /* @__PURE__ */ d(
|
|
533
544
|
"div",
|
|
534
545
|
{
|
|
535
546
|
ref: F.measureElement,
|
|
536
547
|
className: "absolute top-0 left-0 w-full px-2",
|
|
537
|
-
"data-index":
|
|
548
|
+
"data-index": n.index,
|
|
538
549
|
style: {
|
|
539
|
-
transform: `translateY(${
|
|
550
|
+
transform: `translateY(${n.start}px)`
|
|
540
551
|
},
|
|
541
|
-
children:
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
552
|
+
children: l(
|
|
553
|
+
u[n.index],
|
|
554
|
+
n.index,
|
|
555
|
+
w
|
|
545
556
|
)
|
|
546
557
|
},
|
|
547
|
-
|
|
558
|
+
n.key
|
|
548
559
|
))
|
|
549
560
|
}
|
|
550
561
|
)
|
|
551
562
|
}
|
|
552
563
|
) });
|
|
553
564
|
}
|
|
554
|
-
const $e =
|
|
565
|
+
const $e = e.forwardRef(ge), ve = e.forwardRef((t, r) => /* @__PURE__ */ d(ie, { ref: r, "data-slot": "combobox-empty", ...t }));
|
|
555
566
|
ve.displayName = "ComboboxEmpty";
|
|
556
|
-
const Ce =
|
|
557
|
-
const o =
|
|
558
|
-
return
|
|
567
|
+
const Ce = e.forwardRef(({ children: t, ...r }, a) => {
|
|
568
|
+
const o = e.useRef(null);
|
|
569
|
+
return H(
|
|
559
570
|
() => o.current ? o.current.querySelectorAll('[data-slot="combobox-item"]').length >= 100 : !1,
|
|
560
571
|
`ComboboxGroup contains 100+ items. Use <ComboboxVirtualList> for large datasets to avoid DOM bloat and slow renders.
|
|
561
572
|
Import: import { ComboboxVirtualList } from "@brightlocal/ui-components/combobox"`,
|
|
562
|
-
[
|
|
563
|
-
), /* @__PURE__ */
|
|
573
|
+
[t]
|
|
574
|
+
), /* @__PURE__ */ d(
|
|
564
575
|
le,
|
|
565
576
|
{
|
|
566
|
-
ref: (
|
|
567
|
-
o.current =
|
|
577
|
+
ref: (s) => {
|
|
578
|
+
o.current = s, typeof a == "function" ? a(s) : a && (a.current = s);
|
|
568
579
|
},
|
|
569
580
|
"data-slot": "combobox-group",
|
|
570
581
|
...r,
|
|
571
|
-
children:
|
|
582
|
+
children: t
|
|
572
583
|
}
|
|
573
584
|
);
|
|
574
585
|
});
|
|
575
586
|
Ce.displayName = "ComboboxGroup";
|
|
576
|
-
function we(
|
|
587
|
+
function we(t, r, a) {
|
|
577
588
|
if (!r || !r.trim())
|
|
578
|
-
return
|
|
589
|
+
return t;
|
|
579
590
|
const o = new RegExp(
|
|
580
591
|
`(${r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})`,
|
|
581
592
|
"gi"
|
|
582
|
-
),
|
|
583
|
-
return /* @__PURE__ */
|
|
584
|
-
(
|
|
593
|
+
), s = t.split(o);
|
|
594
|
+
return /* @__PURE__ */ d("span", { children: s.map(
|
|
595
|
+
(f, l) => l % 2 === 1 ? /* @__PURE__ */ d("span", { className: a, children: f }, l) : /* @__PURE__ */ d(e.Fragment, { children: f }, l)
|
|
585
596
|
) });
|
|
586
597
|
}
|
|
587
|
-
const ye =
|
|
598
|
+
const ye = e.forwardRef(
|
|
588
599
|
({
|
|
589
|
-
value:
|
|
600
|
+
value: t,
|
|
590
601
|
label: r,
|
|
591
|
-
dataHook:
|
|
602
|
+
dataHook: a,
|
|
592
603
|
children: o,
|
|
593
|
-
className:
|
|
594
|
-
highlight:
|
|
595
|
-
highlightClassName:
|
|
596
|
-
keywords:
|
|
597
|
-
onSelect:
|
|
604
|
+
className: s,
|
|
605
|
+
highlight: f,
|
|
606
|
+
highlightClassName: l,
|
|
607
|
+
keywords: c,
|
|
608
|
+
onSelect: m,
|
|
598
609
|
...v
|
|
599
|
-
},
|
|
600
|
-
const { value: x, onValueChange:
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
}, [
|
|
604
|
-
const
|
|
605
|
-
|
|
606
|
-
if (!
|
|
607
|
-
return
|
|
608
|
-
}, [
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
},
|
|
610
|
+
}, D) => {
|
|
611
|
+
const { value: x, onValueChange: b, setOpen: S, registerItem: E, unregisterItem: C } = _(), L = e.useContext(Q), V = x === t, y = e.useMemo(() => r || (typeof o == "string" ? o : typeof o == "number" ? String(o) : t), [r, o, t]), w = e.useRef(E), M = e.useRef(C);
|
|
612
|
+
e.useEffect(() => {
|
|
613
|
+
w.current = E, M.current = C;
|
|
614
|
+
}, [E, C]);
|
|
615
|
+
const R = !!L;
|
|
616
|
+
e.useEffect(() => {
|
|
617
|
+
if (!R)
|
|
618
|
+
return w.current(t, y), () => M.current(t);
|
|
619
|
+
}, [t, y, R]);
|
|
620
|
+
const k = () => {
|
|
621
|
+
b(t === x ? "" : t), S(!1), m?.(t);
|
|
622
|
+
}, N = () => f && typeof o == "string" ? we(
|
|
612
623
|
o,
|
|
613
|
-
|
|
614
|
-
|
|
624
|
+
f,
|
|
625
|
+
l || "text-sm leading-normal font-semibold"
|
|
615
626
|
) : o;
|
|
616
|
-
if (
|
|
617
|
-
const
|
|
627
|
+
if (L) {
|
|
628
|
+
const p = L.activeValue === t, I = !!v.disabled;
|
|
618
629
|
return /* @__PURE__ */ B(
|
|
619
630
|
"div",
|
|
620
631
|
{
|
|
621
|
-
ref:
|
|
622
|
-
"aria-disabled":
|
|
623
|
-
"aria-posinset":
|
|
624
|
-
"aria-selected":
|
|
625
|
-
"aria-setsize":
|
|
626
|
-
className:
|
|
632
|
+
ref: D,
|
|
633
|
+
"aria-disabled": I || void 0,
|
|
634
|
+
"aria-posinset": L.getItemPosition(t),
|
|
635
|
+
"aria-selected": V,
|
|
636
|
+
"aria-setsize": L.filteredCount,
|
|
637
|
+
className: T(
|
|
627
638
|
"data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground relative flex cursor-default items-center justify-between gap-2 rounded-sm px-2 py-3 text-sm outline-hidden select-none",
|
|
628
639
|
"[&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
629
|
-
|
|
630
|
-
|
|
640
|
+
I && "pointer-events-none opacity-50",
|
|
641
|
+
s
|
|
631
642
|
),
|
|
632
|
-
"data-highlighted":
|
|
633
|
-
"data-hook":
|
|
643
|
+
"data-highlighted": p || void 0,
|
|
644
|
+
"data-hook": a,
|
|
634
645
|
"data-slot": "combobox-item",
|
|
635
|
-
id: `${
|
|
646
|
+
id: `${L.idPrefix}item-${t}`,
|
|
636
647
|
role: "option",
|
|
637
648
|
tabIndex: -1,
|
|
638
|
-
onClick:
|
|
639
|
-
onKeyDown:
|
|
640
|
-
(
|
|
649
|
+
onClick: I ? void 0 : k,
|
|
650
|
+
onKeyDown: I ? void 0 : (A) => {
|
|
651
|
+
(A.key === "Enter" || A.key === " ") && k();
|
|
641
652
|
},
|
|
642
|
-
onPointerMove:
|
|
653
|
+
onPointerMove: I ? void 0 : () => L.onItemPointerMove(t),
|
|
643
654
|
children: [
|
|
644
|
-
|
|
645
|
-
|
|
655
|
+
N(),
|
|
656
|
+
V && /* @__PURE__ */ d(
|
|
646
657
|
Y,
|
|
647
658
|
{
|
|
648
659
|
"aria-hidden": "true",
|
|
@@ -656,17 +667,17 @@ const ye = t.forwardRef(
|
|
|
656
667
|
return /* @__PURE__ */ B(
|
|
657
668
|
ce,
|
|
658
669
|
{
|
|
659
|
-
ref:
|
|
660
|
-
className:
|
|
670
|
+
ref: D,
|
|
671
|
+
className: T("justify-between", s),
|
|
661
672
|
"data-slot": "combobox-item",
|
|
662
|
-
dataHook:
|
|
663
|
-
keywords:
|
|
664
|
-
value:
|
|
665
|
-
onSelect:
|
|
673
|
+
dataHook: a,
|
|
674
|
+
keywords: c ? [y, ...c] : [y],
|
|
675
|
+
value: t,
|
|
676
|
+
onSelect: k,
|
|
666
677
|
...v,
|
|
667
678
|
children: [
|
|
668
|
-
|
|
669
|
-
|
|
679
|
+
N(),
|
|
680
|
+
V && /* @__PURE__ */ d(
|
|
670
681
|
Y,
|
|
671
682
|
{
|
|
672
683
|
"aria-hidden": "true",
|
|
@@ -679,32 +690,32 @@ const ye = t.forwardRef(
|
|
|
679
690
|
}
|
|
680
691
|
);
|
|
681
692
|
ye.displayName = "ComboboxItem";
|
|
682
|
-
const ke =
|
|
693
|
+
const ke = e.forwardRef((t, r) => /* @__PURE__ */ d(fe, { ref: r, "data-slot": "combobox-separator", ...t }));
|
|
683
694
|
ke.displayName = "ComboboxSeparator";
|
|
684
|
-
function
|
|
685
|
-
className:
|
|
695
|
+
function Oe({
|
|
696
|
+
className: t,
|
|
686
697
|
children: r,
|
|
687
|
-
loadingText:
|
|
698
|
+
loadingText: a
|
|
688
699
|
}) {
|
|
689
|
-
return /* @__PURE__ */
|
|
700
|
+
return /* @__PURE__ */ d(
|
|
690
701
|
"div",
|
|
691
702
|
{
|
|
692
703
|
"aria-live": "polite",
|
|
693
|
-
className:
|
|
704
|
+
className: T(
|
|
694
705
|
"text-muted-foreground flex items-center justify-center gap-2 py-6 text-sm",
|
|
695
|
-
|
|
706
|
+
t
|
|
696
707
|
),
|
|
697
708
|
"data-slot": "combobox-loading",
|
|
698
709
|
role: "status",
|
|
699
710
|
children: r || /* @__PURE__ */ B(Z, { children: [
|
|
700
|
-
/* @__PURE__ */
|
|
711
|
+
/* @__PURE__ */ d(
|
|
701
712
|
"div",
|
|
702
713
|
{
|
|
703
714
|
"aria-hidden": "true",
|
|
704
715
|
className: "size-4 animate-spin rounded-full border-2 border-current border-t-transparent [animation-duration:0.6s]"
|
|
705
716
|
}
|
|
706
717
|
),
|
|
707
|
-
|
|
718
|
+
a ?? "Loading..."
|
|
708
719
|
] })
|
|
709
720
|
}
|
|
710
721
|
);
|
|
@@ -717,7 +728,7 @@ export {
|
|
|
717
728
|
xe as ComboboxInput,
|
|
718
729
|
ye as ComboboxItem,
|
|
719
730
|
he as ComboboxList,
|
|
720
|
-
|
|
731
|
+
Oe as ComboboxLoading,
|
|
721
732
|
ke as ComboboxSeparator,
|
|
722
733
|
me as ComboboxTrigger,
|
|
723
734
|
Ae as ComboboxValue,
|