@boxcustodia/library 2.0.0-alpha.32 → 2.0.0-alpha.34
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/components/button/button.cjs.js +1 -1
- package/dist/components/button/button.es.js +5 -5
- package/dist/components/combobox/combobox.cjs.js +1 -1
- package/dist/components/combobox/combobox.es.js +198 -218
- package/dist/components/select/select.cjs.js +1 -1
- package/dist/components/select/select.es.js +139 -159
- package/dist/src/components/combobox/combobox.d.ts +4 -16
- package/dist/src/components/select/select.d.ts +4 -17
- package/dist/src/utils/internal/index.d.ts +2 -0
- package/dist/src/utils/internal/item.d.ts +27 -0
- package/dist/utils/internal/item.cjs.js +1 -0
- package/dist/utils/internal/item.es.js +25 -0
- package/package.json +1 -1
- package/src/components/button/button.tsx +2 -2
- package/src/components/combobox/combobox.test.tsx +25 -0
- package/src/components/combobox/combobox.tsx +9 -43
- package/src/components/select/select.test.tsx +18 -0
- package/src/components/select/select.tsx +12 -46
- package/src/utils/internal/index.ts +2 -0
- package/src/utils/internal/item.ts +51 -0
|
@@ -1,56 +1,57 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as t, jsxs as p, Fragment as
|
|
2
|
+
import { jsx as t, jsxs as p, Fragment as P } from "react/jsx-runtime";
|
|
3
3
|
import * as x from "react";
|
|
4
4
|
import { Input as A, inputBaseClasses as B } from "../input/input.es.js";
|
|
5
|
-
import
|
|
5
|
+
import T from "../../node_modules/lucide-react/dist/esm/icons/chevrons-up-down.es.js";
|
|
6
6
|
import { useIsInsideFieldRoot as O } from "../field/field.es.js";
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import G from "../../node_modules/lucide-react/dist/esm/icons/x.es.js";
|
|
8
|
+
import { defaultGetId as H, defaultGetLabel as q } from "../../utils/internal/item.es.js";
|
|
9
|
+
import { useIsomorphicLayoutEffect as K } from "../../hooks/internal/use-isomorphic-layout-effect.es.js";
|
|
10
|
+
import { useComboboxFilter as X } from "../../node_modules/@base-ui/react/combobox/root/utils/useFilter.es.js";
|
|
11
|
+
import { ComboboxRoot as Q } from "../../node_modules/@base-ui/react/combobox/root/ComboboxRoot.es.js";
|
|
11
12
|
import { ComboboxInput as $ } from "../../node_modules/@base-ui/react/combobox/input/ComboboxInput.es.js";
|
|
12
|
-
import { cn as
|
|
13
|
-
import { ComboboxInputGroup as
|
|
14
|
-
import { ComboboxTrigger as
|
|
13
|
+
import { cn as b } from "../../lib/cn.es.js";
|
|
14
|
+
import { ComboboxInputGroup as U } from "../../node_modules/@base-ui/react/combobox/input-group/ComboboxInputGroup.es.js";
|
|
15
|
+
import { ComboboxTrigger as S } from "../../node_modules/@base-ui/react/combobox/trigger/ComboboxTrigger.es.js";
|
|
15
16
|
import { ComboboxValue as R } from "../../node_modules/@base-ui/react/combobox/value/ComboboxValue.es.js";
|
|
16
|
-
import { ComboboxPortal as
|
|
17
|
-
import { ComboboxPositioner as
|
|
18
|
-
import { ComboboxPopup as
|
|
19
|
-
import { ComboboxItem as
|
|
20
|
-
import { ComboboxItemIndicator as
|
|
21
|
-
import { Separator as
|
|
22
|
-
import { ComboboxGroup as
|
|
23
|
-
import { ComboboxGroupLabel as
|
|
24
|
-
import { ComboboxEmpty as
|
|
25
|
-
import { ComboboxRow as
|
|
26
|
-
import { ScrollArea as
|
|
27
|
-
import { ComboboxList as
|
|
28
|
-
import { ComboboxClear as
|
|
29
|
-
import { ComboboxStatus as
|
|
30
|
-
import { ComboboxCollection as
|
|
31
|
-
import { FieldValidity as
|
|
32
|
-
import { ComboboxChip as
|
|
33
|
-
import { ComboboxChipRemove as
|
|
34
|
-
import { ComboboxIcon as
|
|
35
|
-
import { ComboboxChips as
|
|
36
|
-
const
|
|
17
|
+
import { ComboboxPortal as J } from "../../node_modules/@base-ui/react/combobox/portal/ComboboxPortal.es.js";
|
|
18
|
+
import { ComboboxPositioner as Y } from "../../node_modules/@base-ui/react/combobox/positioner/ComboboxPositioner.es.js";
|
|
19
|
+
import { ComboboxPopup as Z } from "../../node_modules/@base-ui/react/combobox/popup/ComboboxPopup.es.js";
|
|
20
|
+
import { ComboboxItem as oo } from "../../node_modules/@base-ui/react/combobox/item/ComboboxItem.es.js";
|
|
21
|
+
import { ComboboxItemIndicator as eo } from "../../node_modules/@base-ui/react/combobox/item-indicator/ComboboxItemIndicator.es.js";
|
|
22
|
+
import { Separator as to } from "../../node_modules/@base-ui/react/separator/Separator.es.js";
|
|
23
|
+
import { ComboboxGroup as ro } from "../../node_modules/@base-ui/react/combobox/group/ComboboxGroup.es.js";
|
|
24
|
+
import { ComboboxGroupLabel as so } from "../../node_modules/@base-ui/react/combobox/group-label/ComboboxGroupLabel.es.js";
|
|
25
|
+
import { ComboboxEmpty as no } from "../../node_modules/@base-ui/react/combobox/empty/ComboboxEmpty.es.js";
|
|
26
|
+
import { ComboboxRow as io } from "../../node_modules/@base-ui/react/combobox/row/ComboboxRow.es.js";
|
|
27
|
+
import { ScrollArea as ao } from "../scroll-area/scroll-area.es.js";
|
|
28
|
+
import { ComboboxList as lo } from "../../node_modules/@base-ui/react/combobox/list/ComboboxList.es.js";
|
|
29
|
+
import { ComboboxClear as co } from "../../node_modules/@base-ui/react/combobox/clear/ComboboxClear.es.js";
|
|
30
|
+
import { ComboboxStatus as mo } from "../../node_modules/@base-ui/react/combobox/status/ComboboxStatus.es.js";
|
|
31
|
+
import { ComboboxCollection as bo } from "../../node_modules/@base-ui/react/combobox/collection/ComboboxCollection.es.js";
|
|
32
|
+
import { FieldValidity as uo } from "../../node_modules/@base-ui/react/field/validity/FieldValidity.es.js";
|
|
33
|
+
import { ComboboxChip as po } from "../../node_modules/@base-ui/react/combobox/chip/ComboboxChip.es.js";
|
|
34
|
+
import { ComboboxChipRemove as fo } from "../../node_modules/@base-ui/react/combobox/chip-remove/ComboboxChipRemove.es.js";
|
|
35
|
+
import { ComboboxIcon as xo } from "../../node_modules/@base-ui/react/combobox/icon/ComboboxIcon.es.js";
|
|
36
|
+
import { ComboboxChips as ho } from "../../node_modules/@base-ui/react/combobox/chips/ComboboxChips.es.js";
|
|
37
|
+
const y = x.createContext({
|
|
37
38
|
chipsRef: null,
|
|
38
39
|
multiple: !1
|
|
39
40
|
});
|
|
40
|
-
function
|
|
41
|
+
function go({
|
|
41
42
|
...o
|
|
42
43
|
}) {
|
|
43
44
|
const e = x.useRef(null);
|
|
44
|
-
return /* @__PURE__ */ t(
|
|
45
|
+
return /* @__PURE__ */ t(y.Provider, { value: { chipsRef: e, multiple: !!o.multiple }, children: /* @__PURE__ */ t(Q, { ...o }) });
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
+
function Co({
|
|
47
48
|
className: o,
|
|
48
49
|
...e
|
|
49
50
|
}) {
|
|
50
51
|
return /* @__PURE__ */ t(
|
|
51
52
|
$,
|
|
52
53
|
{
|
|
53
|
-
className:
|
|
54
|
+
className: b(
|
|
54
55
|
"min-w-12 flex-1 text-base outline-none placeholder:text-muted-foreground sm:text-sm [[data-slot=combobox-chip]+&]:ps-0.5",
|
|
55
56
|
o
|
|
56
57
|
),
|
|
@@ -59,17 +60,17 @@ function ho({
|
|
|
59
60
|
}
|
|
60
61
|
);
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function vo({
|
|
63
64
|
className: o,
|
|
64
65
|
showTrigger: e = !0,
|
|
65
66
|
showClear: r = !1,
|
|
66
67
|
startAddon: i,
|
|
67
68
|
triggerProps: a,
|
|
68
|
-
clearProps:
|
|
69
|
+
clearProps: s,
|
|
69
70
|
...l
|
|
70
71
|
}) {
|
|
71
72
|
return /* @__PURE__ */ p(
|
|
72
|
-
|
|
73
|
+
U,
|
|
73
74
|
{
|
|
74
75
|
className: "relative not-has-[>*.w-full]:w-fit w-full text-foreground has-disabled:opacity-64",
|
|
75
76
|
"data-slot": "combobox-input-group",
|
|
@@ -86,13 +87,13 @@ function go({
|
|
|
86
87
|
/* @__PURE__ */ t(
|
|
87
88
|
$,
|
|
88
89
|
{
|
|
89
|
-
className:
|
|
90
|
+
className: b(
|
|
90
91
|
i && "*:data-[slot=combobox-input]:ps-[calc(--spacing(8.5)-1px)] sm:*:data-[slot=combobox-input]:ps-[calc(--spacing(8)-1px)]",
|
|
91
92
|
"pr-6",
|
|
92
93
|
o
|
|
93
94
|
),
|
|
94
95
|
"data-slot": "combobox-input",
|
|
95
|
-
render: (
|
|
96
|
+
render: (n) => /* @__PURE__ */ t(A, { className: "has-disabled:opacity-100", nativeInput: !0, ...n }),
|
|
96
97
|
...l
|
|
97
98
|
}
|
|
98
99
|
),
|
|
@@ -102,20 +103,20 @@ function go({
|
|
|
102
103
|
showTrigger: e,
|
|
103
104
|
showClear: r,
|
|
104
105
|
triggerProps: a,
|
|
105
|
-
clearProps:
|
|
106
|
+
clearProps: s
|
|
106
107
|
}
|
|
107
108
|
)
|
|
108
109
|
]
|
|
109
110
|
}
|
|
110
111
|
);
|
|
111
112
|
}
|
|
112
|
-
function
|
|
113
|
+
function wo({
|
|
113
114
|
className: o,
|
|
114
115
|
children: e,
|
|
115
116
|
...r
|
|
116
117
|
}) {
|
|
117
118
|
return /* @__PURE__ */ t(
|
|
118
|
-
|
|
119
|
+
S,
|
|
119
120
|
{
|
|
120
121
|
className: o,
|
|
121
122
|
"data-slot": "combobox-trigger",
|
|
@@ -124,18 +125,18 @@ function Co({
|
|
|
124
125
|
}
|
|
125
126
|
);
|
|
126
127
|
}
|
|
127
|
-
function
|
|
128
|
+
function Ce({
|
|
128
129
|
className: o,
|
|
129
130
|
placeholder: e,
|
|
130
131
|
children: r,
|
|
131
132
|
showClear: i,
|
|
132
133
|
clearProps: a,
|
|
133
|
-
...
|
|
134
|
+
...s
|
|
134
135
|
}) {
|
|
135
136
|
const l = /* @__PURE__ */ t(
|
|
136
|
-
|
|
137
|
+
S,
|
|
137
138
|
{
|
|
138
|
-
className:
|
|
139
|
+
className: b(
|
|
139
140
|
"relative flex w-full items-center rounded-md border border-input bg-background px-3 py-2 pe-9 text-sm outline-none transition-shadow",
|
|
140
141
|
"focus-visible:border-ring",
|
|
141
142
|
"aria-invalid:border-error focus-visible:aria-invalid:ring-error/20",
|
|
@@ -144,7 +145,7 @@ function ge({
|
|
|
144
145
|
o
|
|
145
146
|
),
|
|
146
147
|
"data-slot": "combobox-select-trigger",
|
|
147
|
-
...
|
|
148
|
+
...s,
|
|
148
149
|
children: r ?? /* @__PURE__ */ t(R, { placeholder: e })
|
|
149
150
|
}
|
|
150
151
|
);
|
|
@@ -159,9 +160,9 @@ function ge({
|
|
|
159
160
|
]
|
|
160
161
|
}
|
|
161
162
|
) : /* @__PURE__ */ t(
|
|
162
|
-
|
|
163
|
+
S,
|
|
163
164
|
{
|
|
164
|
-
className:
|
|
165
|
+
className: b(
|
|
165
166
|
"relative flex w-full items-center rounded-md border border-input bg-background px-3 py-2 pe-9 text-sm outline-none transition-shadow",
|
|
166
167
|
"focus-visible:border-ring",
|
|
167
168
|
"aria-invalid:border-error focus-visible:aria-invalid:ring-error/20",
|
|
@@ -170,29 +171,29 @@ function ge({
|
|
|
170
171
|
o
|
|
171
172
|
),
|
|
172
173
|
"data-slot": "combobox-select-trigger",
|
|
173
|
-
...
|
|
174
|
-
children: r ?? /* @__PURE__ */ p(
|
|
174
|
+
...s,
|
|
175
|
+
children: r ?? /* @__PURE__ */ p(P, { children: [
|
|
175
176
|
/* @__PURE__ */ t(R, { placeholder: e }),
|
|
176
177
|
/* @__PURE__ */ t(
|
|
177
178
|
"div",
|
|
178
179
|
{
|
|
179
180
|
"aria-hidden": "true",
|
|
180
181
|
className: "pointer-events-none absolute end-0.5 top-1/2 inline-flex size-8 -translate-y-1/2 items-center justify-center text-muted-foreground opacity-80 sm:size-7 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4",
|
|
181
|
-
children: /* @__PURE__ */ t(
|
|
182
|
+
children: /* @__PURE__ */ t(T, {})
|
|
182
183
|
}
|
|
183
184
|
)
|
|
184
185
|
] })
|
|
185
186
|
}
|
|
186
187
|
);
|
|
187
188
|
}
|
|
188
|
-
function
|
|
189
|
+
function ve({
|
|
189
190
|
className: o,
|
|
190
191
|
...e
|
|
191
192
|
}) {
|
|
192
193
|
return /* @__PURE__ */ t("div", { className: "border-b p-2", "data-slot": "combobox-search-input-wrapper", children: /* @__PURE__ */ t(
|
|
193
194
|
$,
|
|
194
195
|
{
|
|
195
|
-
className:
|
|
196
|
+
className: b(
|
|
196
197
|
"flex h-9 w-full rounded-md bg-transparent text-base placeholder:text-muted-foreground outline-none disabled:cursor-not-allowed disabled:opacity-64 sm:h-8 sm:text-sm",
|
|
197
198
|
o
|
|
198
199
|
),
|
|
@@ -202,22 +203,22 @@ function Ce({
|
|
|
202
203
|
}
|
|
203
204
|
) });
|
|
204
205
|
}
|
|
205
|
-
function
|
|
206
|
+
function yo({
|
|
206
207
|
className: o,
|
|
207
208
|
children: e,
|
|
208
209
|
side: r = "bottom",
|
|
209
210
|
sideOffset: i = 4,
|
|
210
211
|
alignOffset: a,
|
|
211
|
-
align:
|
|
212
|
+
align: s = "start",
|
|
212
213
|
anchor: l,
|
|
213
|
-
portalProps:
|
|
214
|
+
portalProps: n,
|
|
214
215
|
...m
|
|
215
216
|
}) {
|
|
216
|
-
const { chipsRef: d } = x.useContext(
|
|
217
|
-
return /* @__PURE__ */ t(
|
|
218
|
-
|
|
217
|
+
const { chipsRef: d } = x.useContext(y);
|
|
218
|
+
return /* @__PURE__ */ t(J, { ...n, children: /* @__PURE__ */ t(
|
|
219
|
+
Y,
|
|
219
220
|
{
|
|
220
|
-
align:
|
|
221
|
+
align: s,
|
|
221
222
|
alignOffset: a,
|
|
222
223
|
anchor: l ?? d,
|
|
223
224
|
className: "z-50 select-none",
|
|
@@ -225,9 +226,9 @@ function vo({
|
|
|
225
226
|
side: r,
|
|
226
227
|
sideOffset: i,
|
|
227
228
|
children: /* @__PURE__ */ t(
|
|
228
|
-
|
|
229
|
+
Z,
|
|
229
230
|
{
|
|
230
|
-
className:
|
|
231
|
+
className: b(
|
|
231
232
|
"relative flex max-h-[min(var(--available-height),23rem)] min-w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) flex-1 flex-col rounded-lg border bg-popover not-dark:bg-clip-padding text-foreground shadow-lg/5",
|
|
232
233
|
"before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
|
|
233
234
|
"duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
@@ -242,15 +243,15 @@ function vo({
|
|
|
242
243
|
}
|
|
243
244
|
) });
|
|
244
245
|
}
|
|
245
|
-
function
|
|
246
|
+
function No({
|
|
246
247
|
className: o,
|
|
247
248
|
children: e,
|
|
248
249
|
...r
|
|
249
250
|
}) {
|
|
250
251
|
return /* @__PURE__ */ p(
|
|
251
|
-
|
|
252
|
+
oo,
|
|
252
253
|
{
|
|
253
|
-
className:
|
|
254
|
+
className: b(
|
|
254
255
|
"flex justify-between min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_1fr] items-center gap-2 rounded-sm py-1 px-2 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
255
256
|
o
|
|
256
257
|
),
|
|
@@ -258,7 +259,7 @@ function yo({
|
|
|
258
259
|
...r,
|
|
259
260
|
children: [
|
|
260
261
|
e,
|
|
261
|
-
/* @__PURE__ */ t(
|
|
262
|
+
/* @__PURE__ */ t(eo, { className: "col-end-1", children: /* @__PURE__ */ t(
|
|
262
263
|
"svg",
|
|
263
264
|
{
|
|
264
265
|
"aria-hidden": "true",
|
|
@@ -278,14 +279,14 @@ function yo({
|
|
|
278
279
|
}
|
|
279
280
|
);
|
|
280
281
|
}
|
|
281
|
-
function
|
|
282
|
+
function we({
|
|
282
283
|
className: o,
|
|
283
284
|
...e
|
|
284
285
|
}) {
|
|
285
286
|
return /* @__PURE__ */ t(
|
|
286
|
-
|
|
287
|
+
to,
|
|
287
288
|
{
|
|
288
|
-
className:
|
|
289
|
+
className: b("mx-2 my-1 h-px bg-border last:hidden", o),
|
|
289
290
|
"data-slot": "combobox-separator",
|
|
290
291
|
...e
|
|
291
292
|
}
|
|
@@ -296,22 +297,22 @@ function ye({
|
|
|
296
297
|
...e
|
|
297
298
|
}) {
|
|
298
299
|
return /* @__PURE__ */ t(
|
|
299
|
-
|
|
300
|
+
ro,
|
|
300
301
|
{
|
|
301
|
-
className:
|
|
302
|
+
className: b("[[role=group]+&]:mt-1.5", o),
|
|
302
303
|
"data-slot": "combobox-group",
|
|
303
304
|
...e
|
|
304
305
|
}
|
|
305
306
|
);
|
|
306
307
|
}
|
|
307
|
-
function
|
|
308
|
+
function Ne({
|
|
308
309
|
className: o,
|
|
309
310
|
...e
|
|
310
311
|
}) {
|
|
311
312
|
return /* @__PURE__ */ t(
|
|
312
|
-
|
|
313
|
+
so,
|
|
313
314
|
{
|
|
314
|
-
className:
|
|
315
|
+
className: b(
|
|
315
316
|
"px-2 py-1.5 font-medium text-muted-foreground text-xs",
|
|
316
317
|
o
|
|
317
318
|
),
|
|
@@ -320,14 +321,14 @@ function we({
|
|
|
320
321
|
}
|
|
321
322
|
);
|
|
322
323
|
}
|
|
323
|
-
function
|
|
324
|
+
function zo({
|
|
324
325
|
className: o,
|
|
325
326
|
...e
|
|
326
327
|
}) {
|
|
327
328
|
return /* @__PURE__ */ t(
|
|
328
|
-
|
|
329
|
+
no,
|
|
329
330
|
{
|
|
330
|
-
className:
|
|
331
|
+
className: b(
|
|
331
332
|
"not-empty:p-2 text-center text-base text-muted-foreground sm:text-sm",
|
|
332
333
|
o
|
|
333
334
|
),
|
|
@@ -336,12 +337,12 @@ function wo({
|
|
|
336
337
|
}
|
|
337
338
|
);
|
|
338
339
|
}
|
|
339
|
-
function
|
|
340
|
+
function ze({
|
|
340
341
|
className: o,
|
|
341
342
|
...e
|
|
342
343
|
}) {
|
|
343
344
|
return /* @__PURE__ */ t(
|
|
344
|
-
|
|
345
|
+
io,
|
|
345
346
|
{
|
|
346
347
|
className: o,
|
|
347
348
|
"data-slot": "combobox-row",
|
|
@@ -349,19 +350,19 @@ function Ne({
|
|
|
349
350
|
}
|
|
350
351
|
);
|
|
351
352
|
}
|
|
352
|
-
function
|
|
353
|
+
function _o({
|
|
353
354
|
...o
|
|
354
355
|
}) {
|
|
355
356
|
return /* @__PURE__ */ t(R, { "data-slot": "combobox-value", ...o });
|
|
356
357
|
}
|
|
357
|
-
function
|
|
358
|
+
function Io({
|
|
358
359
|
className: o,
|
|
359
360
|
...e
|
|
360
361
|
}) {
|
|
361
|
-
return /* @__PURE__ */ t(
|
|
362
|
-
|
|
362
|
+
return /* @__PURE__ */ t(ao, { scrollbarGutter: !0, scrollFade: !0, children: /* @__PURE__ */ t(
|
|
363
|
+
lo,
|
|
363
364
|
{
|
|
364
|
-
className:
|
|
365
|
+
className: b(
|
|
365
366
|
"not-empty:scroll-py-1 not-empty:px-1 not-empty:py-1 in-data-has-overflow-y:pe-3",
|
|
366
367
|
o
|
|
367
368
|
),
|
|
@@ -370,12 +371,12 @@ function zo({
|
|
|
370
371
|
}
|
|
371
372
|
) });
|
|
372
373
|
}
|
|
373
|
-
function
|
|
374
|
+
function So({
|
|
374
375
|
className: o,
|
|
375
376
|
...e
|
|
376
377
|
}) {
|
|
377
378
|
return /* @__PURE__ */ t(
|
|
378
|
-
|
|
379
|
+
co,
|
|
379
380
|
{
|
|
380
381
|
className: o,
|
|
381
382
|
"data-slot": "combobox-clear",
|
|
@@ -392,27 +393,27 @@ function k({
|
|
|
392
393
|
}) {
|
|
393
394
|
return !o && !e ? null : /* @__PURE__ */ p("div", { className: "text-muted-foreground hover:text-foreground transition-colors", children: [
|
|
394
395
|
o && /* @__PURE__ */ t(
|
|
395
|
-
|
|
396
|
+
wo,
|
|
396
397
|
{
|
|
397
|
-
className:
|
|
398
|
+
className: b(
|
|
398
399
|
L,
|
|
399
400
|
"text-muted-foreground has-[+[data-slot=combobox-clear]]:hidden"
|
|
400
401
|
),
|
|
401
402
|
...r,
|
|
402
|
-
children: /* @__PURE__ */ t(
|
|
403
|
+
children: /* @__PURE__ */ t(xo, { "data-slot": "combobox-icon", children: /* @__PURE__ */ t(T, {}) })
|
|
403
404
|
}
|
|
404
405
|
),
|
|
405
|
-
e && /* @__PURE__ */ t(
|
|
406
|
+
e && /* @__PURE__ */ t(So, { className: L, ...i, children: /* @__PURE__ */ t(G, {}) })
|
|
406
407
|
] });
|
|
407
408
|
}
|
|
408
|
-
function
|
|
409
|
+
function _e({
|
|
409
410
|
className: o,
|
|
410
411
|
...e
|
|
411
412
|
}) {
|
|
412
413
|
return /* @__PURE__ */ t(
|
|
413
|
-
|
|
414
|
+
mo,
|
|
414
415
|
{
|
|
415
|
-
className:
|
|
416
|
+
className: b(
|
|
416
417
|
"px-3 py-2 font-medium text-muted-foreground text-xs empty:m-0 empty:p-0",
|
|
417
418
|
o
|
|
418
419
|
),
|
|
@@ -421,20 +422,20 @@ function ze({
|
|
|
421
422
|
}
|
|
422
423
|
);
|
|
423
424
|
}
|
|
424
|
-
function
|
|
425
|
-
return /* @__PURE__ */ t(
|
|
425
|
+
function Ie(o) {
|
|
426
|
+
return /* @__PURE__ */ t(bo, { "data-slot": "combobox-collection", ...o });
|
|
426
427
|
}
|
|
427
|
-
function
|
|
428
|
+
function Ro({
|
|
428
429
|
className: o,
|
|
429
430
|
children: e,
|
|
430
431
|
startAddon: r,
|
|
431
432
|
...i
|
|
432
433
|
}) {
|
|
433
|
-
const { chipsRef: a } = x.useContext(
|
|
434
|
-
|
|
434
|
+
const { chipsRef: a } = x.useContext(y), s = O(), l = (n) => /* @__PURE__ */ p(
|
|
435
|
+
ho,
|
|
435
436
|
{
|
|
436
|
-
"aria-invalid":
|
|
437
|
-
className:
|
|
437
|
+
"aria-invalid": n,
|
|
438
|
+
className: b(
|
|
438
439
|
B,
|
|
439
440
|
"relative inline-flex pr-6 w-full flex-wrap gap-1",
|
|
440
441
|
"placeholder:text-muted-foreground",
|
|
@@ -460,138 +461,117 @@ function So({
|
|
|
460
461
|
]
|
|
461
462
|
}
|
|
462
463
|
);
|
|
463
|
-
return
|
|
464
|
+
return s ? /* @__PURE__ */ t(uo, { children: ({ validity: n }) => l(n.valid === !1 ? !0 : void 0) }) : l(void 0);
|
|
464
465
|
}
|
|
465
|
-
function
|
|
466
|
+
function $o({
|
|
466
467
|
children: o,
|
|
467
468
|
removeProps: e,
|
|
468
469
|
...r
|
|
469
470
|
}) {
|
|
470
471
|
return /* @__PURE__ */ p(
|
|
471
|
-
|
|
472
|
+
po,
|
|
472
473
|
{
|
|
473
474
|
className: "flex my-auto items-center pl-1 rounded-[calc(var(--radius-md)-1px)] bg-accent font-medium text-accent-foreground text-sm outline-none sm:text-xs/(--text-xs--line-height) [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5 h-6",
|
|
474
475
|
"data-slot": "combobox-chip",
|
|
475
476
|
...r,
|
|
476
477
|
children: [
|
|
477
478
|
o,
|
|
478
|
-
/* @__PURE__ */ t(
|
|
479
|
+
/* @__PURE__ */ t(ko, { ...e })
|
|
479
480
|
]
|
|
480
481
|
}
|
|
481
482
|
);
|
|
482
483
|
}
|
|
483
|
-
function
|
|
484
|
+
function ko(o) {
|
|
484
485
|
return /* @__PURE__ */ t(
|
|
485
|
-
|
|
486
|
+
fo,
|
|
486
487
|
{
|
|
487
488
|
"aria-label": "Quitar",
|
|
488
489
|
className: "h-full shrink-0 cursor-pointer px-1 opacity-80 hover:opacity-100 [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5",
|
|
489
490
|
"data-slot": "combobox-chip-remove",
|
|
490
491
|
...o,
|
|
491
|
-
children: /* @__PURE__ */ t(
|
|
492
|
+
children: /* @__PURE__ */ t(G, {})
|
|
492
493
|
}
|
|
493
494
|
);
|
|
494
495
|
}
|
|
495
|
-
const _ = 4,
|
|
496
|
-
function
|
|
497
|
-
const r = o -
|
|
496
|
+
const _ = 4, Eo = 24, Vo = 36, Lo = 68;
|
|
497
|
+
function I(o, e) {
|
|
498
|
+
const r = o - Eo - Vo;
|
|
498
499
|
let i = 0, a = 0;
|
|
499
|
-
for (let
|
|
500
|
-
const l = e[
|
|
501
|
-
if (i + (
|
|
502
|
-
i += (
|
|
500
|
+
for (let s = 0; s < e.length; s++) {
|
|
501
|
+
const l = e[s], n = s < e.length - 1;
|
|
502
|
+
if (i + (s > 0 ? _ : 0) + l + (n ? _ + Lo : 0) > r) break;
|
|
503
|
+
i += (s > 0 ? _ : 0) + l, a++;
|
|
503
504
|
}
|
|
504
505
|
return a;
|
|
505
506
|
}
|
|
506
|
-
function
|
|
507
|
-
const [r, i] = x.useState(null), a = x.useRef([]),
|
|
508
|
-
return
|
|
509
|
-
if (!
|
|
507
|
+
function Po(o, e) {
|
|
508
|
+
const [r, i] = x.useState(null), a = x.useRef([]), s = r === null || r.items !== o;
|
|
509
|
+
return K(() => {
|
|
510
|
+
if (!s) return;
|
|
510
511
|
const l = e?.current;
|
|
511
512
|
if (!l) return;
|
|
512
|
-
const
|
|
513
|
-
a.current = Array.from(
|
|
513
|
+
const n = l.querySelectorAll('[data-slot="combobox-chip"]');
|
|
514
|
+
a.current = Array.from(n).map(
|
|
514
515
|
(d) => d.offsetWidth
|
|
515
516
|
);
|
|
516
|
-
const m =
|
|
517
|
+
const m = I(
|
|
517
518
|
l.clientWidth,
|
|
518
519
|
a.current
|
|
519
520
|
);
|
|
520
521
|
i({ items: o, visible: m });
|
|
521
|
-
}, [
|
|
522
|
+
}, [s, o, e]), x.useEffect(() => {
|
|
522
523
|
const l = a.current.length > 0 && a.current.every((f) => f === 0);
|
|
523
|
-
if (!
|
|
524
|
-
const
|
|
525
|
-
if (!
|
|
526
|
-
const m =
|
|
524
|
+
if (!s && !l) return;
|
|
525
|
+
const n = e?.current;
|
|
526
|
+
if (!n) return;
|
|
527
|
+
const m = n.querySelectorAll('[data-slot="combobox-chip"]');
|
|
527
528
|
if (!m.length) return;
|
|
528
529
|
const d = Array.from(m).map(
|
|
529
530
|
(f) => f.offsetWidth
|
|
530
531
|
);
|
|
531
532
|
if (d.every((f) => f === 0)) return;
|
|
532
533
|
a.current = d;
|
|
533
|
-
const h =
|
|
534
|
+
const h = I(n.clientWidth, d);
|
|
534
535
|
i(
|
|
535
536
|
(f) => f ? { ...f, visible: h } : { items: o, visible: h }
|
|
536
537
|
);
|
|
537
|
-
}, [
|
|
538
|
+
}, [s, o, e]), x.useEffect(() => {
|
|
538
539
|
const l = e?.current;
|
|
539
540
|
if (!l) return;
|
|
540
|
-
const
|
|
541
|
+
const n = new ResizeObserver(() => {
|
|
541
542
|
if (!a.current.length) return;
|
|
542
|
-
const m =
|
|
543
|
+
const m = I(
|
|
543
544
|
l.clientWidth,
|
|
544
545
|
a.current
|
|
545
546
|
);
|
|
546
547
|
i((d) => d ? { ...d, visible: m } : null);
|
|
547
548
|
});
|
|
548
|
-
return
|
|
549
|
-
}, [e]), { visibleCount: r?.visible ?? o, isMeasuring:
|
|
549
|
+
return n.observe(l), () => n.disconnect();
|
|
550
|
+
}, [e]), { visibleCount: r?.visible ?? o, isMeasuring: s };
|
|
550
551
|
}
|
|
551
|
-
function
|
|
552
|
+
function To({
|
|
552
553
|
value: o,
|
|
553
554
|
getLabel: e,
|
|
554
555
|
getId: r
|
|
555
556
|
}) {
|
|
556
|
-
const { chipsRef: i } = x.useContext(
|
|
557
|
-
return /* @__PURE__ */ p(
|
|
558
|
-
l.map((m) => /* @__PURE__ */ t(
|
|
559
|
-
|
|
557
|
+
const { chipsRef: i } = x.useContext(y), { visibleCount: a, isMeasuring: s } = Po(o.length, i), l = s ? o : o.slice(0, a), n = s ? 0 : o.length - a;
|
|
558
|
+
return /* @__PURE__ */ p(P, { children: [
|
|
559
|
+
l.map((m) => /* @__PURE__ */ t($o, { "aria-label": e(m), children: e(m) }, r(m))),
|
|
560
|
+
n > 0 && /* @__PURE__ */ p("span", { className: "flex items-center whitespace-nowrap px-1 text-sm text-muted-foreground", children: [
|
|
560
561
|
"+",
|
|
561
|
-
|
|
562
|
+
n,
|
|
562
563
|
" más"
|
|
563
564
|
] })
|
|
564
565
|
] });
|
|
565
566
|
}
|
|
566
|
-
function
|
|
567
|
-
if (o == null) return "";
|
|
568
|
-
if (typeof o == "string" || typeof o == "number") return String(o);
|
|
569
|
-
if (typeof o == "object") {
|
|
570
|
-
const e = o;
|
|
571
|
-
if ("label" in e) return String(e.label);
|
|
572
|
-
if ("name" in e) return String(e.name);
|
|
573
|
-
if ("title" in e) return String(e.title);
|
|
574
|
-
}
|
|
575
|
-
return String(o);
|
|
576
|
-
}
|
|
577
|
-
function Po(o) {
|
|
578
|
-
if (o == null) return "";
|
|
579
|
-
if (typeof o == "string" || typeof o == "number") return String(o);
|
|
580
|
-
if (typeof o == "object") {
|
|
581
|
-
const e = o;
|
|
582
|
-
if ("id" in e) return String(e.id);
|
|
583
|
-
if ("value" in e) return String(e.value);
|
|
584
|
-
}
|
|
585
|
-
return String(o);
|
|
586
|
-
}
|
|
587
|
-
function To({
|
|
567
|
+
function Go({
|
|
588
568
|
placeholder: o,
|
|
589
569
|
showClear: e,
|
|
590
570
|
startAddon: r,
|
|
591
571
|
className: i
|
|
592
572
|
}) {
|
|
593
573
|
return /* @__PURE__ */ t(
|
|
594
|
-
|
|
574
|
+
vo,
|
|
595
575
|
{
|
|
596
576
|
className: i,
|
|
597
577
|
placeholder: o,
|
|
@@ -600,18 +580,18 @@ function To({
|
|
|
600
580
|
}
|
|
601
581
|
);
|
|
602
582
|
}
|
|
603
|
-
function
|
|
583
|
+
function jo({
|
|
604
584
|
getLabel: o,
|
|
605
585
|
getId: e,
|
|
606
586
|
showClear: r,
|
|
607
587
|
startAddon: i,
|
|
608
588
|
className: a
|
|
609
589
|
}) {
|
|
610
|
-
return /* @__PURE__ */ p(
|
|
611
|
-
/* @__PURE__ */ t(
|
|
612
|
-
|
|
590
|
+
return /* @__PURE__ */ p(Ro, { className: a, startAddon: i, children: [
|
|
591
|
+
/* @__PURE__ */ t(_o, { children: (s) => /* @__PURE__ */ t(
|
|
592
|
+
To,
|
|
613
593
|
{
|
|
614
|
-
value:
|
|
594
|
+
value: s,
|
|
615
595
|
getLabel: o,
|
|
616
596
|
getId: e
|
|
617
597
|
}
|
|
@@ -625,54 +605,54 @@ function Se(o) {
|
|
|
625
605
|
getLabel: r,
|
|
626
606
|
getId: i,
|
|
627
607
|
renderItem: a,
|
|
628
|
-
placeholder:
|
|
608
|
+
placeholder: s,
|
|
629
609
|
emptyText: l = "Sin resultados.",
|
|
630
|
-
multiple:
|
|
610
|
+
multiple: n,
|
|
631
611
|
onValueChange: m,
|
|
632
612
|
value: d,
|
|
633
613
|
defaultValue: h,
|
|
634
614
|
startAddon: f,
|
|
635
615
|
classNames: g,
|
|
636
616
|
showClear: E = !0,
|
|
637
|
-
searchable:
|
|
617
|
+
searchable: j = !0,
|
|
638
618
|
...F
|
|
639
|
-
} = o, N = r ??
|
|
619
|
+
} = o, N = r ?? q, C = i ?? H, v = (c) => String(C(c)), w = (c) => e.find((u) => v(u) === c) ?? null, V = x.useRef(!1);
|
|
640
620
|
if (process.env.NODE_ENV !== "production" && !V.current) {
|
|
641
|
-
const c = /* @__PURE__ */ new Set(),
|
|
621
|
+
const c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set();
|
|
642
622
|
for (const M of e) {
|
|
643
623
|
const z = v(M);
|
|
644
|
-
c.has(z) &&
|
|
624
|
+
c.has(z) && u.add(z), c.add(z);
|
|
645
625
|
}
|
|
646
|
-
|
|
647
|
-
`[Combobox] Multiple items resolve to the same id (${[...
|
|
626
|
+
u.size > 0 && (V.current = !0, console.warn(
|
|
627
|
+
`[Combobox] Multiple items resolve to the same id (${[...u].join(", ")}). Provide a \`getId\` that returns a unique value per item.`
|
|
648
628
|
));
|
|
649
629
|
}
|
|
650
|
-
const W =
|
|
630
|
+
const W = n ? d?.map((c) => w(String(c))).filter(Boolean) : d == null ? d : w(String(d)), D = n ? h?.map((c) => w(String(c))).filter(Boolean) : h == null ? void 0 : w(String(h));
|
|
651
631
|
return /* @__PURE__ */ p(
|
|
652
|
-
|
|
632
|
+
go,
|
|
653
633
|
{
|
|
654
634
|
items: e,
|
|
655
635
|
itemToStringLabel: N,
|
|
656
636
|
itemToStringValue: C,
|
|
657
|
-
multiple:
|
|
637
|
+
multiple: n,
|
|
658
638
|
onValueChange: (c) => {
|
|
659
|
-
if (
|
|
660
|
-
const
|
|
661
|
-
m?.(
|
|
639
|
+
if (n) {
|
|
640
|
+
const u = c ?? [];
|
|
641
|
+
m?.(u.map(C), u);
|
|
662
642
|
} else {
|
|
663
|
-
const
|
|
664
|
-
m?.(
|
|
643
|
+
const u = c ?? null;
|
|
644
|
+
m?.(u ? C(u) : null, u);
|
|
665
645
|
}
|
|
666
646
|
},
|
|
667
647
|
value: W,
|
|
668
648
|
defaultValue: D,
|
|
669
|
-
isItemEqualToValue: (c,
|
|
649
|
+
isItemEqualToValue: (c, u) => v(c) === v(u),
|
|
670
650
|
autoHighlight: !0,
|
|
671
651
|
loopFocus: !0,
|
|
672
652
|
...F,
|
|
673
653
|
children: [
|
|
674
|
-
|
|
675
|
-
|
|
654
|
+
n ? /* @__PURE__ */ t(
|
|
655
|
+
jo,
|
|
676
656
|
{
|
|
677
657
|
getLabel: N,
|
|
678
658
|
getId: C,
|
|
@@ -681,32 +661,32 @@ function Se(o) {
|
|
|
681
661
|
className: g?.chips
|
|
682
662
|
}
|
|
683
663
|
) : /* @__PURE__ */ t(
|
|
684
|
-
|
|
664
|
+
Go,
|
|
685
665
|
{
|
|
686
|
-
placeholder:
|
|
666
|
+
placeholder: s,
|
|
687
667
|
showClear: E,
|
|
688
668
|
startAddon: f,
|
|
689
669
|
className: g?.input
|
|
690
670
|
}
|
|
691
671
|
),
|
|
692
|
-
/* @__PURE__ */ p(
|
|
693
|
-
|
|
672
|
+
/* @__PURE__ */ p(yo, { className: g?.popup, children: [
|
|
673
|
+
n && j && /* @__PURE__ */ t(
|
|
694
674
|
"div",
|
|
695
675
|
{
|
|
696
676
|
className: "border-b p-2",
|
|
697
677
|
"data-slot": "combobox-chips-input-wrapper",
|
|
698
678
|
children: /* @__PURE__ */ t(
|
|
699
|
-
|
|
679
|
+
Co,
|
|
700
680
|
{
|
|
701
681
|
className: g?.chipsInput,
|
|
702
|
-
placeholder:
|
|
682
|
+
placeholder: s
|
|
703
683
|
}
|
|
704
684
|
)
|
|
705
685
|
}
|
|
706
686
|
),
|
|
707
|
-
/* @__PURE__ */ t(
|
|
708
|
-
/* @__PURE__ */ t(
|
|
709
|
-
|
|
687
|
+
/* @__PURE__ */ t(zo, { className: g?.empty, children: l }),
|
|
688
|
+
/* @__PURE__ */ t(Io, { className: g?.list, children: (c) => /* @__PURE__ */ t(
|
|
689
|
+
No,
|
|
710
690
|
{
|
|
711
691
|
value: c,
|
|
712
692
|
className: g?.item,
|
|
@@ -719,30 +699,30 @@ function Se(o) {
|
|
|
719
699
|
}
|
|
720
700
|
);
|
|
721
701
|
}
|
|
722
|
-
const
|
|
702
|
+
const Re = X;
|
|
723
703
|
export {
|
|
724
704
|
Se as Combobox,
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
705
|
+
$o as ComboboxChip,
|
|
706
|
+
ko as ComboboxChipRemove,
|
|
707
|
+
Ro as ComboboxChips,
|
|
708
|
+
Co as ComboboxChipsInput,
|
|
709
|
+
So as ComboboxClear,
|
|
710
|
+
Ie as ComboboxCollection,
|
|
711
|
+
y as ComboboxContext,
|
|
712
|
+
zo as ComboboxEmpty,
|
|
733
713
|
ye as ComboboxGroup,
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
714
|
+
Ne as ComboboxGroupLabel,
|
|
715
|
+
vo as ComboboxInput,
|
|
716
|
+
No as ComboboxItem,
|
|
717
|
+
Io as ComboboxList,
|
|
718
|
+
yo as ComboboxPopup,
|
|
719
|
+
go as ComboboxRoot,
|
|
720
|
+
ze as ComboboxRow,
|
|
721
|
+
ve as ComboboxSearchInput,
|
|
722
|
+
Ce as ComboboxSelectTrigger,
|
|
723
|
+
we as ComboboxSeparator,
|
|
724
|
+
_e as ComboboxStatus,
|
|
725
|
+
wo as ComboboxTrigger,
|
|
726
|
+
_o as ComboboxValue,
|
|
727
|
+
Re as useComboboxFilter
|
|
748
728
|
};
|