prometeo-design-system 3.0.7 → 3.0.9
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as s } from "./jsx-runtime-DKDX3adD.js";
|
|
2
2
|
import { c as f } from "./cn-B6yFEsav.js";
|
|
3
|
-
import Ne, { memo as Z, useState as
|
|
3
|
+
import Ne, { memo as Z, useState as je, useRef as ce, useMemo as oe, useCallback as U, useEffect as ve, useImperativeHandle as Qe } from "react";
|
|
4
4
|
import Xe from "./Spinner.es.js";
|
|
5
5
|
import { createPortal as Ye } from "react-dom";
|
|
6
6
|
import { u as Ze } from "./useDragScroll-CHN9OMwn.js";
|
|
@@ -28,13 +28,13 @@ const at = {
|
|
|
28
28
|
}, Fe = {
|
|
29
29
|
icon: " text-neutral-default-disabled",
|
|
30
30
|
container: " border-neutral-strong-default text-neutral-default-disabled"
|
|
31
|
-
}, Ve = ({ id: e, label: n, onRemove: m, className: i, disabled: u, variant:
|
|
31
|
+
}, Ve = ({ id: e, label: n, onRemove: m, className: i, disabled: u, variant: x = "default", tabIndex: p }) => /* @__PURE__ */ s.jsxs(
|
|
32
32
|
"div",
|
|
33
33
|
{
|
|
34
|
-
tabIndex:
|
|
34
|
+
tabIndex: p,
|
|
35
35
|
className: f(
|
|
36
36
|
"inline-flex max-w-[calc(50%-0.25rem)] items-center gap-1 px-2 py-1 bg-inherit text-xs rounded-lg border h-[30px]",
|
|
37
|
-
at[
|
|
37
|
+
at[x].container,
|
|
38
38
|
u && Fe.container
|
|
39
39
|
),
|
|
40
40
|
children: [
|
|
@@ -42,8 +42,8 @@ const at = {
|
|
|
42
42
|
m && /* @__PURE__ */ s.jsx(
|
|
43
43
|
"button",
|
|
44
44
|
{
|
|
45
|
-
onMouseDown: (
|
|
46
|
-
u || (
|
|
45
|
+
onMouseDown: (D) => {
|
|
46
|
+
u || (D.stopPropagation(), D.preventDefault(), m?.(e));
|
|
47
47
|
},
|
|
48
48
|
className: f(
|
|
49
49
|
"shrink-0 p-0.5 transition-all duration-200 hover:text-neutral-default-hover cursor-pointer z-50 text-neutral-default-default hover:scale-105",
|
|
@@ -51,7 +51,7 @@ const at = {
|
|
|
51
51
|
i
|
|
52
52
|
),
|
|
53
53
|
type: "button",
|
|
54
|
-
tabIndex:
|
|
54
|
+
tabIndex: p,
|
|
55
55
|
children: /* @__PURE__ */ s.jsx(rt, { size: 18, className: f(u && Fe.icon) })
|
|
56
56
|
}
|
|
57
57
|
)
|
|
@@ -76,29 +76,29 @@ const qe = (e, n) => {
|
|
|
76
76
|
if (!n) return !0;
|
|
77
77
|
const m = 0.1, i = String(e).toLowerCase(), u = String(n).toLowerCase().trim();
|
|
78
78
|
if (i.includes(u)) return !0;
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
for (const b of
|
|
79
|
+
const x = u.split(/\s+/).filter(Boolean), p = x.filter((b) => /^\d+$/.test(b));
|
|
80
|
+
if (x.length > 1 || p.length > 0) {
|
|
81
|
+
for (const b of p)
|
|
82
82
|
if (!new RegExp(`(^|\\D)${b}(\\D|$)`).test(i)) return !1;
|
|
83
|
-
for (const b of
|
|
83
|
+
for (const b of x)
|
|
84
84
|
if (!/^\d+$/.test(b) && !i.includes(b))
|
|
85
85
|
return !1;
|
|
86
86
|
return !0;
|
|
87
87
|
}
|
|
88
88
|
if (u.length > i.length) return !1;
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
91
|
-
const
|
|
89
|
+
const D = Math.floor(u.length * m);
|
|
90
|
+
if (D <= 0) return !1;
|
|
91
|
+
const g = (b, k) => {
|
|
92
92
|
const I = b.length, W = k.length;
|
|
93
93
|
if (I === 0) return W;
|
|
94
94
|
if (W === 0) return I;
|
|
95
95
|
const A = new Array(W + 1);
|
|
96
|
-
for (let
|
|
97
|
-
for (let
|
|
98
|
-
let S =
|
|
99
|
-
A[0] =
|
|
96
|
+
for (let y = 0; y <= W; y++) A[y] = y;
|
|
97
|
+
for (let y = 1; y <= I; y++) {
|
|
98
|
+
let S = y - 1;
|
|
99
|
+
A[0] = y;
|
|
100
100
|
for (let z = 1; z <= W; z++) {
|
|
101
|
-
const se = A[z], K = b.charCodeAt(
|
|
101
|
+
const se = A[z], K = b.charCodeAt(y - 1) === k.charCodeAt(z - 1) ? 0 : 1, V = A[z] + 1, M = A[z - 1] + 1, N = S + K;
|
|
102
102
|
A[z] = V < M ? V < N ? V : N : M < N ? M : N, S = se;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -106,14 +106,14 @@ const qe = (e, n) => {
|
|
|
106
106
|
};
|
|
107
107
|
for (let b = 0; b <= i.length - u.length; b++) {
|
|
108
108
|
const k = i.slice(b, b + u.length);
|
|
109
|
-
if (
|
|
109
|
+
if (g(k, u) <= D) return !0;
|
|
110
110
|
}
|
|
111
111
|
return !1;
|
|
112
112
|
}, ut = (e) => {
|
|
113
113
|
const n = [], m = (i) => {
|
|
114
114
|
i.forEach((u) => {
|
|
115
|
-
const
|
|
116
|
-
Array.isArray(
|
|
115
|
+
const x = u, p = typeof x == "object" ? x?.options : [];
|
|
116
|
+
Array.isArray(p) && p.length > 0 ? m(p) : n.push(u);
|
|
117
117
|
});
|
|
118
118
|
};
|
|
119
119
|
return m(e), n;
|
|
@@ -170,11 +170,11 @@ const qe = (e, n) => {
|
|
|
170
170
|
)
|
|
171
171
|
};
|
|
172
172
|
function ct(e) {
|
|
173
|
-
const [n, m] =
|
|
173
|
+
const [n, m] = je(!1), [i, u] = je([]), [x, p] = je(""), D = ce(null), g = ce(null), b = ce(null), k = ce(null), I = ce(
|
|
174
174
|
() => {
|
|
175
175
|
}
|
|
176
176
|
), W = ce(null), A = ce(/* @__PURE__ */ new Set()), {
|
|
177
|
-
id:
|
|
177
|
+
id: y,
|
|
178
178
|
name: S,
|
|
179
179
|
label: z,
|
|
180
180
|
height: se,
|
|
@@ -186,7 +186,7 @@ function ct(e) {
|
|
|
186
186
|
optionLabel: de,
|
|
187
187
|
renderOption: J,
|
|
188
188
|
renderOptionGroupHeader: fe,
|
|
189
|
-
renderSelection:
|
|
189
|
+
renderSelection: De,
|
|
190
190
|
renderOptionContext: Ie,
|
|
191
191
|
buttonClassName: He,
|
|
192
192
|
dropdownClassName: ae,
|
|
@@ -210,9 +210,9 @@ function ct(e) {
|
|
|
210
210
|
} = e, { ref: Oe } = et(), { bind: ne, ref: Me } = Ze({
|
|
211
211
|
axis: "x",
|
|
212
212
|
cursor: { idle: "default", dragging: "grabbing" }
|
|
213
|
-
}), pe = e.multiple ? Array.isArray(e.value) && e.value.length > 0 : e.value !== void 0 && e.value !== null && e.value !== "", Le = {}, Te = oe(() => ie === "static" && N ? N : "", [ie, N]), Ge = oe(
|
|
214
|
-
() => O?.controledSearchValue ||
|
|
215
|
-
[O?.controledSearchValue,
|
|
213
|
+
}), pe = e.multiple ? Array.isArray(e.value) && e.value.length > 0 && e.value.every((t) => t != null && t !== "") : e.value !== void 0 && e.value !== null && e.value !== "", Le = {}, Te = oe(() => ie === "static" && N ? N : "", [ie, N]), Ge = oe(
|
|
214
|
+
() => O?.controledSearchValue || x,
|
|
215
|
+
[O?.controledSearchValue, x]
|
|
216
216
|
), $e = () => {
|
|
217
217
|
const t = {
|
|
218
218
|
static: {
|
|
@@ -240,7 +240,7 @@ function ct(e) {
|
|
|
240
240
|
if (e.multiple)
|
|
241
241
|
e.value?.forEach((a) => {
|
|
242
242
|
const l = Y?.find(
|
|
243
|
-
(
|
|
243
|
+
(h) => G(h, E) === a
|
|
244
244
|
);
|
|
245
245
|
l && t.push(l);
|
|
246
246
|
});
|
|
@@ -260,9 +260,9 @@ function ct(e) {
|
|
|
260
260
|
), d = oe(() => {
|
|
261
261
|
const t = [];
|
|
262
262
|
return K.forEach((a, l) => {
|
|
263
|
-
const
|
|
263
|
+
const h = a, H = typeof h == "object" ? h?.options : [];
|
|
264
264
|
if (Array.isArray(H) && H.length > 0) {
|
|
265
|
-
const $ =
|
|
265
|
+
const $ = h.label, P = G(a, E), le = `__group-${String(P ?? l)}`, xe = {
|
|
266
266
|
id: le,
|
|
267
267
|
value: le,
|
|
268
268
|
label: typeof $ == "string" ? $ : String(P ?? `Grupo ${l + 1}`),
|
|
@@ -288,15 +288,15 @@ function ct(e) {
|
|
|
288
288
|
if (!e.multiple) {
|
|
289
289
|
const C = l[0];
|
|
290
290
|
if (!C) return;
|
|
291
|
-
const
|
|
291
|
+
const j = c.has(C.id), B = a ?? "toggle";
|
|
292
292
|
let Pe;
|
|
293
|
-
B === "select" || B === "toggle" && !
|
|
293
|
+
B === "select" || B === "toggle" && !j ? Pe = C : Pe = void 0, e.onChange?.(Pe, S);
|
|
294
294
|
return;
|
|
295
295
|
}
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
const
|
|
299
|
-
|
|
296
|
+
const h = e.value || [], H = [];
|
|
297
|
+
h.forEach((C) => {
|
|
298
|
+
const j = ge.find((B) => B.value === C);
|
|
299
|
+
j && H.push(j);
|
|
300
300
|
});
|
|
301
301
|
const $ = new Set(H.map((C) => C.id)), P = new Set(l.map((C) => C.id)), le = l.every(
|
|
302
302
|
(C) => $.has(C.id)
|
|
@@ -306,10 +306,10 @@ function ct(e) {
|
|
|
306
306
|
_ = H.filter((C) => !P.has(C.id));
|
|
307
307
|
else {
|
|
308
308
|
const C = new Map(
|
|
309
|
-
H.map((
|
|
309
|
+
H.map((j) => [j.id, j])
|
|
310
310
|
);
|
|
311
|
-
l.forEach((
|
|
312
|
-
C.set(
|
|
311
|
+
l.forEach((j) => {
|
|
312
|
+
C.set(j.id, j);
|
|
313
313
|
}), _ = Array.from(C.values());
|
|
314
314
|
}
|
|
315
315
|
e.onChange?.(_, S);
|
|
@@ -330,18 +330,18 @@ function ct(e) {
|
|
|
330
330
|
if (!e.multiple)
|
|
331
331
|
e.onChange?.(t, S);
|
|
332
332
|
else {
|
|
333
|
-
const a = e.value || [], l = [],
|
|
333
|
+
const a = e.value || [], l = [], h = a.includes(t.value);
|
|
334
334
|
a.forEach(($) => {
|
|
335
335
|
const P = ge.find(
|
|
336
336
|
(le) => le.value === $
|
|
337
337
|
);
|
|
338
338
|
P && l.push(P);
|
|
339
339
|
});
|
|
340
|
-
const H =
|
|
340
|
+
const H = h ? l.filter(($) => $.value !== t.value) : [...l, t];
|
|
341
341
|
e.onChange?.(H, S);
|
|
342
342
|
}
|
|
343
343
|
};
|
|
344
|
-
const
|
|
344
|
+
const v = U(
|
|
345
345
|
(t, a = !1) => {
|
|
346
346
|
X?.(t, S), I.current?.(t), a && (m(!1), Se?.());
|
|
347
347
|
},
|
|
@@ -352,7 +352,7 @@ function ct(e) {
|
|
|
352
352
|
(t) => {
|
|
353
353
|
e.multiple || e.onChange?.(void 0, S);
|
|
354
354
|
const a = Y.find(
|
|
355
|
-
(
|
|
355
|
+
(h) => G(h, E) === t
|
|
356
356
|
);
|
|
357
357
|
if (!a) return;
|
|
358
358
|
const l = T(a);
|
|
@@ -379,11 +379,11 @@ function ct(e) {
|
|
|
379
379
|
const t = (a) => {
|
|
380
380
|
const l = a.target;
|
|
381
381
|
if (a.type === "mousedown") {
|
|
382
|
-
if (
|
|
382
|
+
if (D.current?.contains(l) || g.current?.contains(l)) return;
|
|
383
383
|
m(!1);
|
|
384
384
|
}
|
|
385
385
|
if (a.type === "scroll") {
|
|
386
|
-
if (
|
|
386
|
+
if (g.current?.contains(l)) return;
|
|
387
387
|
m(!1);
|
|
388
388
|
}
|
|
389
389
|
a.type === "resize" && m(!1);
|
|
@@ -408,13 +408,13 @@ function ct(e) {
|
|
|
408
408
|
n && m(!1);
|
|
409
409
|
},
|
|
410
410
|
toggle: () => m((t) => !t),
|
|
411
|
-
handleOptionSelect:
|
|
411
|
+
handleOptionSelect: v,
|
|
412
412
|
subscribeOpenChange: (t) => (A.current.add(t), () => {
|
|
413
413
|
A.current.delete(t);
|
|
414
414
|
}),
|
|
415
415
|
searchInputRef: b
|
|
416
416
|
}),
|
|
417
|
-
[n,
|
|
417
|
+
[n, v]
|
|
418
418
|
);
|
|
419
419
|
const be = (t) => {
|
|
420
420
|
t.preventDefault(), t.stopPropagation(), t.target.matches(":focus-visible") && !ze && !n && (m(!0), setTimeout(() => {
|
|
@@ -429,7 +429,7 @@ function ct(e) {
|
|
|
429
429
|
"div",
|
|
430
430
|
{
|
|
431
431
|
className: f("relative bg-inherit select-none w-full", M),
|
|
432
|
-
ref:
|
|
432
|
+
ref: D,
|
|
433
433
|
draggable: !1,
|
|
434
434
|
style: Le,
|
|
435
435
|
children: [
|
|
@@ -437,7 +437,7 @@ function ct(e) {
|
|
|
437
437
|
/* @__PURE__ */ s.jsx(
|
|
438
438
|
"label",
|
|
439
439
|
{
|
|
440
|
-
htmlFor:
|
|
440
|
+
htmlFor: y,
|
|
441
441
|
ref: Oe,
|
|
442
442
|
className: f(
|
|
443
443
|
"left-3 pointer-events-none bg-inherit z-10",
|
|
@@ -452,7 +452,7 @@ function ct(e) {
|
|
|
452
452
|
/* @__PURE__ */ s.jsxs(
|
|
453
453
|
"div",
|
|
454
454
|
{
|
|
455
|
-
id:
|
|
455
|
+
id: y,
|
|
456
456
|
tabIndex: 0,
|
|
457
457
|
role: "button",
|
|
458
458
|
ref: k,
|
|
@@ -484,9 +484,9 @@ function ct(e) {
|
|
|
484
484
|
onPointerLeave: ne.onPointerLeave,
|
|
485
485
|
onPointerCancel: ne.onPointerCancel,
|
|
486
486
|
onClickCapture: ne.onClickCapture,
|
|
487
|
-
children:
|
|
487
|
+
children: De ? Ne.createElement(
|
|
488
488
|
Z(
|
|
489
|
-
|
|
489
|
+
De,
|
|
490
490
|
(t, a) => t.disabled === a.disabled && t.multiple === a.multiple
|
|
491
491
|
),
|
|
492
492
|
{
|
|
@@ -577,14 +577,14 @@ function ct(e) {
|
|
|
577
577
|
setFilteredOptions: u,
|
|
578
578
|
renderOptionContext: Ie,
|
|
579
579
|
options: d,
|
|
580
|
-
selectRef:
|
|
581
|
-
dropdownRef:
|
|
580
|
+
selectRef: D,
|
|
581
|
+
dropdownRef: g,
|
|
582
582
|
selectButtonRef: k,
|
|
583
583
|
helperComponentRef: W,
|
|
584
|
-
onOptionClick:
|
|
584
|
+
onOptionClick: v,
|
|
585
585
|
onCloseDropdown: () => m(!1),
|
|
586
586
|
searchValue: Ge,
|
|
587
|
-
setSearchValue:
|
|
587
|
+
setSearchValue: p,
|
|
588
588
|
searchInputRef: b,
|
|
589
589
|
isLoading: O?.isLoading,
|
|
590
590
|
onSearchClear: O?.onSearchClear,
|
|
@@ -619,16 +619,16 @@ function ft({
|
|
|
619
619
|
label: m,
|
|
620
620
|
options: i,
|
|
621
621
|
multiple: u,
|
|
622
|
-
disabled:
|
|
623
|
-
selectRef:
|
|
624
|
-
inputProps:
|
|
625
|
-
dropdownRef:
|
|
622
|
+
disabled: x,
|
|
623
|
+
selectRef: p,
|
|
624
|
+
inputProps: D,
|
|
625
|
+
dropdownRef: g,
|
|
626
626
|
optionLabel: b,
|
|
627
627
|
optionValue: k,
|
|
628
628
|
searchValue: I,
|
|
629
629
|
labelVariant: W,
|
|
630
630
|
emptyMessage: A,
|
|
631
|
-
renderOption:
|
|
631
|
+
renderOption: y,
|
|
632
632
|
renderOptionContext: S,
|
|
633
633
|
renderOptionGroupHeader: z,
|
|
634
634
|
onOptionClick: se,
|
|
@@ -640,7 +640,7 @@ function ft({
|
|
|
640
640
|
filteredOptions: de,
|
|
641
641
|
selectButtonRef: J,
|
|
642
642
|
onCloseDropdown: fe,
|
|
643
|
-
loadingComponent:
|
|
643
|
+
loadingComponent: De,
|
|
644
644
|
dropdownClassName: Ie,
|
|
645
645
|
helperComponentRef: He,
|
|
646
646
|
selectedOptionsIds: ae,
|
|
@@ -652,10 +652,10 @@ function ft({
|
|
|
652
652
|
enableGroupToggle: X = !0,
|
|
653
653
|
onGroupSelectChange: Se
|
|
654
654
|
}) {
|
|
655
|
-
const me = e ? 380 : 320, te = W === "static" ? m !== "" ? -20 : 4 : 7, F = U(() => N ? N.endsWith("px") ? Number(N.replace("px", "")) : N.endsWith("vh") ? window.innerHeight * Number(N.replace("vh", "")) / 100 : N.endsWith("%") ? window.innerHeight * Number(N.replace("%", "")) / 100 : me : me, [N, me])(), [he, Ae] =
|
|
655
|
+
const me = e ? 380 : 320, te = W === "static" ? m !== "" ? -20 : 4 : 7, F = U(() => N ? N.endsWith("px") ? Number(N.replace("px", "")) : N.endsWith("vh") ? window.innerHeight * Number(N.replace("vh", "")) / 100 : N.endsWith("%") ? window.innerHeight * Number(N.replace("%", "")) / 100 : me : me, [N, me])(), [he, Ae] = je({
|
|
656
656
|
direction: "down",
|
|
657
657
|
height: F
|
|
658
|
-
}), [we, ie] =
|
|
658
|
+
}), [we, ie] = je(
|
|
659
659
|
() => /* @__PURE__ */ new Set()
|
|
660
660
|
), ze = U(
|
|
661
661
|
(r) => !we.has(r),
|
|
@@ -669,39 +669,39 @@ function ft({
|
|
|
669
669
|
},
|
|
670
670
|
[]
|
|
671
671
|
), Oe = (r) => {
|
|
672
|
-
if (!
|
|
673
|
-
const o =
|
|
672
|
+
if (!g.current || !p.current) return;
|
|
673
|
+
const o = p.current.getBoundingClientRect();
|
|
674
674
|
switch (r || he.direction) {
|
|
675
675
|
case "down":
|
|
676
|
-
|
|
676
|
+
g.current.style.top = `${o.top + o.height - (He?.current?.offsetHeight ? He?.current?.offsetHeight + 4 : 0)}px`;
|
|
677
677
|
break;
|
|
678
678
|
case "up":
|
|
679
|
-
|
|
679
|
+
g.current.style.top = "auto", g.current.style.bottom = `${window.innerHeight - o.top + te}px`;
|
|
680
680
|
break;
|
|
681
681
|
}
|
|
682
|
-
|
|
682
|
+
g.current.style.left = `${o.left}px`, g.current.style.width = `${o.width}px`;
|
|
683
683
|
}, ne = (r) => {
|
|
684
|
-
|
|
684
|
+
g.current && (g.current.style.maxHeight = `${r}px`);
|
|
685
685
|
}, Me = () => {
|
|
686
|
-
if (!
|
|
687
|
-
const r =
|
|
688
|
-
let L = "down",
|
|
689
|
-
return d ? (L = "down",
|
|
686
|
+
if (!g.current || !p.current) return he;
|
|
687
|
+
const r = p.current.getBoundingClientRect(), o = window.innerHeight - (window.innerHeight - r.top), c = window.innerHeight - r.bottom, d = c >= F, w = o >= F;
|
|
688
|
+
let L = "down", v;
|
|
689
|
+
return d ? (L = "down", v = F) : w ? (L = "up", v = F) : c > o ? (L = "down", v = c - 16) : (L = "up", v = o - 16), { direction: L, height: v };
|
|
690
690
|
}, pe = (r) => {
|
|
691
|
-
if (!(!
|
|
692
|
-
if (
|
|
693
|
-
|
|
691
|
+
if (!(!g.current || !p.current)) {
|
|
692
|
+
if (g.current.style.transition = "max-height 0.2s ease,opacity 0.2s ease", !r) {
|
|
693
|
+
g.current.style.maxHeight = "0", g.current.style.opacity = "0", g.current.style.pointerEvents = "none";
|
|
694
694
|
return;
|
|
695
695
|
}
|
|
696
696
|
if (!E) {
|
|
697
697
|
const o = Me();
|
|
698
698
|
Ae(o), Oe(o.direction), ne(o.height);
|
|
699
699
|
}
|
|
700
|
-
|
|
700
|
+
g.current.style.opacity = "1", g.current.style.pointerEvents = "auto";
|
|
701
701
|
}
|
|
702
702
|
};
|
|
703
703
|
ve(() => {
|
|
704
|
-
E || !
|
|
704
|
+
E || !p.current || !n || Oe();
|
|
705
705
|
}, [ae]), ve(() => {
|
|
706
706
|
pe(n);
|
|
707
707
|
}, [n]), ve(() => {
|
|
@@ -713,11 +713,11 @@ function ft({
|
|
|
713
713
|
}, [i]);
|
|
714
714
|
const Le = (r, o) => {
|
|
715
715
|
if (!o) return r;
|
|
716
|
-
if (
|
|
717
|
-
const
|
|
716
|
+
if (y) {
|
|
717
|
+
const v = [];
|
|
718
718
|
let R = null, q = [];
|
|
719
719
|
const re = () => {
|
|
720
|
-
R && q.length > 0 &&
|
|
720
|
+
R && q.length > 0 && v.push(R, ...q), R = null, q = [];
|
|
721
721
|
};
|
|
722
722
|
return r.forEach((be) => {
|
|
723
723
|
const ue = be;
|
|
@@ -728,22 +728,22 @@ function ft({
|
|
|
728
728
|
const a = be, l = G(
|
|
729
729
|
a,
|
|
730
730
|
b
|
|
731
|
-
),
|
|
732
|
-
R ?
|
|
733
|
-
}), re(),
|
|
731
|
+
), h = qe(String(l ?? ""), o);
|
|
732
|
+
R ? h && q.push(a) : h && v.push(a);
|
|
733
|
+
}), re(), v;
|
|
734
734
|
}
|
|
735
735
|
const c = [];
|
|
736
736
|
let d = null, w = [];
|
|
737
737
|
const L = () => {
|
|
738
738
|
d && w.length > 0 && c.push(d, ...w), d = null, w = [];
|
|
739
739
|
};
|
|
740
|
-
return r.forEach((
|
|
741
|
-
if (
|
|
742
|
-
L(), d =
|
|
740
|
+
return r.forEach((v) => {
|
|
741
|
+
if (v.isGroupHeader) {
|
|
742
|
+
L(), d = v;
|
|
743
743
|
return;
|
|
744
744
|
}
|
|
745
|
-
const R = qe(
|
|
746
|
-
d ? R && w.push(
|
|
745
|
+
const R = qe(v.label, o);
|
|
746
|
+
d ? R && w.push(v) : R && c.push(v);
|
|
747
747
|
}), L(), c;
|
|
748
748
|
}, Te = (r) => {
|
|
749
749
|
const o = Le(i, r);
|
|
@@ -760,7 +760,7 @@ function ft({
|
|
|
760
760
|
if (K) {
|
|
761
761
|
K(), Q(
|
|
762
762
|
i.filter((r) => {
|
|
763
|
-
const o =
|
|
763
|
+
const o = y ? G(r, k) : r.id;
|
|
764
764
|
return ae.has(o);
|
|
765
765
|
})
|
|
766
766
|
);
|
|
@@ -774,16 +774,16 @@ function ft({
|
|
|
774
774
|
K,
|
|
775
775
|
Q,
|
|
776
776
|
M,
|
|
777
|
-
|
|
777
|
+
y
|
|
778
778
|
]), $e = (r) => {
|
|
779
|
-
r.key === "ArrowDown" ? (r.preventDefault(),
|
|
779
|
+
r.key === "ArrowDown" ? (r.preventDefault(), g.current?.querySelector(
|
|
780
780
|
"[role=listitem]"
|
|
781
781
|
)?.focus()) : (r.key === "Tab" || r.key === "Escape") && setTimeout(() => {
|
|
782
782
|
J.current?.focus(), fe();
|
|
783
783
|
}, 10);
|
|
784
784
|
}, T = (r, o) => {
|
|
785
785
|
const c = Array.from(
|
|
786
|
-
|
|
786
|
+
g.current?.querySelectorAll("[role=listitem]") || []
|
|
787
787
|
), d = c.indexOf(r.currentTarget);
|
|
788
788
|
if (r.key === "ArrowDown") {
|
|
789
789
|
r.preventDefault();
|
|
@@ -797,7 +797,7 @@ function ft({
|
|
|
797
797
|
c[w]?.focus();
|
|
798
798
|
}
|
|
799
799
|
else if (r.key === "Enter" || r.key === " ") {
|
|
800
|
-
if (r.preventDefault(), o.isGroupHeader ||
|
|
800
|
+
if (r.preventDefault(), o.isGroupHeader || x) return;
|
|
801
801
|
se(o, !u), u || setTimeout(() => {
|
|
802
802
|
J.current?.focus(), fe();
|
|
803
803
|
}, 10);
|
|
@@ -807,8 +807,8 @@ function ft({
|
|
|
807
807
|
J.current?.focus(), fe();
|
|
808
808
|
}, 10);
|
|
809
809
|
}, Y = Array.from({ length: 5 }).map(
|
|
810
|
-
(r, o) =>
|
|
811
|
-
Z(
|
|
810
|
+
(r, o) => y ? Ne.createElement(
|
|
811
|
+
Z(y, (c, d) => c.isSelected === d.isSelected && c.option === d.option && c.disabled === d.disabled && c.multiple === d.multiple && c.renderContext === d.renderContext),
|
|
812
812
|
{
|
|
813
813
|
key: `skeleton-option-${o}`,
|
|
814
814
|
option: { id: o, label: "", value: "" },
|
|
@@ -837,7 +837,7 @@ function ft({
|
|
|
837
837
|
"div",
|
|
838
838
|
{
|
|
839
839
|
tabIndex: 0,
|
|
840
|
-
ref:
|
|
840
|
+
ref: g,
|
|
841
841
|
style: { opacity: "0" },
|
|
842
842
|
className: f(
|
|
843
843
|
" z-100! w-full mt-1 bg-neutral-default-default border border-neutral-default-default rounded-lg shadow-lg",
|
|
@@ -866,7 +866,7 @@ function ft({
|
|
|
866
866
|
size: "small",
|
|
867
867
|
tabIndex: 0,
|
|
868
868
|
value: I,
|
|
869
|
-
disabled:
|
|
869
|
+
disabled: x,
|
|
870
870
|
ref: V,
|
|
871
871
|
labelVariant: "static",
|
|
872
872
|
icon: /* @__PURE__ */ s.jsx(st, { size: 22 }),
|
|
@@ -876,19 +876,19 @@ function ft({
|
|
|
876
876
|
onChange: (r) => Te(r.target.value),
|
|
877
877
|
placeholder: Ee,
|
|
878
878
|
className: " bg-neutral-medium-pressed",
|
|
879
|
-
...
|
|
879
|
+
...D
|
|
880
880
|
}
|
|
881
881
|
),
|
|
882
|
-
/* @__PURE__ */ s.jsx("div", { className: " overflow-y-auto flex-1 max-h-max ", children: de.length === 0 ? ee ? /* @__PURE__ */ s.jsx("div", { className: "flex flex-col gap-1 overflow-hidden w-full", children:
|
|
882
|
+
/* @__PURE__ */ s.jsx("div", { className: " overflow-y-auto flex-1 max-h-max ", children: de.length === 0 ? ee ? /* @__PURE__ */ s.jsx("div", { className: "flex flex-col gap-1 overflow-hidden w-full", children: De || Y }) : /* @__PURE__ */ s.jsx("div", { className: "px-3 py-2 text-neutral-medium-default", children: I ? `No se encontraron resultados para "${I}"` : A }) : (() => {
|
|
883
883
|
let r = !0;
|
|
884
884
|
return de.map((o) => {
|
|
885
|
-
const c = o, d = !!c.isGroupHeader, w =
|
|
885
|
+
const c = o, d = !!c.isGroupHeader, w = y && !d ? G(o, k) : c.id, L = ae.has(w), v = (l) => !y || d ? l : {
|
|
886
886
|
id: w,
|
|
887
887
|
label: String(G(l, b)),
|
|
888
888
|
value: G(l, k)
|
|
889
889
|
}, R = (l) => {
|
|
890
890
|
d || se(
|
|
891
|
-
|
|
891
|
+
v(o),
|
|
892
892
|
l === void 0 ? !u : l
|
|
893
893
|
);
|
|
894
894
|
}, q = (l) => {
|
|
@@ -896,8 +896,8 @@ function ft({
|
|
|
896
896
|
if (!M) return;
|
|
897
897
|
M(""), Q(i);
|
|
898
898
|
}
|
|
899
|
-
}, re = (l,
|
|
900
|
-
const H = !!
|
|
899
|
+
}, re = (l, h) => {
|
|
900
|
+
const H = !!h.isGroupHeader;
|
|
901
901
|
return (
|
|
902
902
|
// biome-ignore lint/a11y/useSemanticElements: <>
|
|
903
903
|
/* @__PURE__ */ s.jsx(
|
|
@@ -905,23 +905,23 @@ function ft({
|
|
|
905
905
|
{
|
|
906
906
|
tabIndex: 0,
|
|
907
907
|
role: "listitem",
|
|
908
|
-
onKeyDown: ($) => T($,
|
|
908
|
+
onKeyDown: ($) => T($, h),
|
|
909
909
|
className: f(
|
|
910
|
-
!H && !
|
|
910
|
+
!H && !x && "focus-visible:bg-neutral-medium-hover outline-none hover:bg-neutral-medium-hover",
|
|
911
911
|
L && "bg-neutral-medium-selected",
|
|
912
|
-
|
|
912
|
+
x && "cursor-default pointer-events-none"
|
|
913
913
|
),
|
|
914
914
|
children: l
|
|
915
915
|
},
|
|
916
|
-
|
|
916
|
+
h.id
|
|
917
917
|
)
|
|
918
918
|
);
|
|
919
919
|
};
|
|
920
920
|
if (d) {
|
|
921
|
-
const l = c.groupLabelNode ?? c.label,
|
|
921
|
+
const l = c.groupLabelNode ?? c.label, h = String(c.id), H = X === !1 ? !0 : ze(h);
|
|
922
922
|
r = H;
|
|
923
923
|
const $ = c.originalOption, P = c.groupData?.groupOptions ?? [], le = (_) => {
|
|
924
|
-
X && ke(
|
|
924
|
+
X && ke(h, _);
|
|
925
925
|
}, xe = (_) => {
|
|
926
926
|
!P || P.length === 0 || Se && Se(P, _);
|
|
927
927
|
}, ye = P.filter(
|
|
@@ -930,13 +930,13 @@ function ft({
|
|
|
930
930
|
if (z) {
|
|
931
931
|
const _ = Z(
|
|
932
932
|
z,
|
|
933
|
-
(
|
|
933
|
+
(j, B) => j.label === B.label && j.group === B.group && j.groupOptions === B.groupOptions && j.disabled === B.disabled && j.multiple === B.multiple && j.expanded === B.expanded && j.renderContext === B.renderContext
|
|
934
934
|
), C = Ne.createElement(_, {
|
|
935
935
|
group: $,
|
|
936
936
|
label: l,
|
|
937
937
|
groupOptions: P,
|
|
938
938
|
multiple: u,
|
|
939
|
-
disabled:
|
|
939
|
+
disabled: x,
|
|
940
940
|
expanded: H,
|
|
941
941
|
toggleGroup: le,
|
|
942
942
|
selectGroup: xe,
|
|
@@ -952,7 +952,7 @@ function ft({
|
|
|
952
952
|
"div",
|
|
953
953
|
{
|
|
954
954
|
className: "cursor-pointer",
|
|
955
|
-
onClick: () => ke(
|
|
955
|
+
onClick: () => ke(h),
|
|
956
956
|
children: /* @__PURE__ */ s.jsx(
|
|
957
957
|
Ue,
|
|
958
958
|
{
|
|
@@ -968,10 +968,10 @@ function ft({
|
|
|
968
968
|
c
|
|
969
969
|
);
|
|
970
970
|
}
|
|
971
|
-
const be =
|
|
971
|
+
const be = y ? Ne.createElement(
|
|
972
972
|
Z(
|
|
973
|
-
|
|
974
|
-
(l,
|
|
973
|
+
y,
|
|
974
|
+
(l, h) => l.isSelected === h.isSelected && l.option === h.option && l.disabled === h.disabled && l.multiple === h.multiple && l.renderContext === h.renderContext
|
|
975
975
|
),
|
|
976
976
|
{
|
|
977
977
|
key: w,
|
|
@@ -979,14 +979,14 @@ function ft({
|
|
|
979
979
|
isSelected: L,
|
|
980
980
|
multiple: u,
|
|
981
981
|
onSelect: R,
|
|
982
|
-
disabled:
|
|
982
|
+
disabled: x,
|
|
983
983
|
isLoading: ee,
|
|
984
984
|
renderContext: S
|
|
985
985
|
}
|
|
986
986
|
) : /* @__PURE__ */ s.jsx(
|
|
987
987
|
Be,
|
|
988
988
|
{
|
|
989
|
-
disabled:
|
|
989
|
+
disabled: x,
|
|
990
990
|
multiple: u,
|
|
991
991
|
isLoading: ee,
|
|
992
992
|
isSelected: L,
|
|
@@ -996,7 +996,7 @@ function ft({
|
|
|
996
996
|
w
|
|
997
997
|
), ue = re(
|
|
998
998
|
be,
|
|
999
|
-
|
|
999
|
+
v(o)
|
|
1000
1000
|
);
|
|
1001
1001
|
if (!X)
|
|
1002
1002
|
return ue;
|
|
@@ -1028,10 +1028,10 @@ const mt = Z(
|
|
|
1028
1028
|
onSelect: m,
|
|
1029
1029
|
multiple: i,
|
|
1030
1030
|
disabled: u,
|
|
1031
|
-
isLoading:
|
|
1031
|
+
isLoading: x
|
|
1032
1032
|
}) => {
|
|
1033
|
-
const
|
|
1034
|
-
if (
|
|
1033
|
+
const p = e.isGroupHeader;
|
|
1034
|
+
if (x)
|
|
1035
1035
|
return /* @__PURE__ */ s.jsxs(
|
|
1036
1036
|
"div",
|
|
1037
1037
|
{
|
|
@@ -1043,24 +1043,24 @@ const mt = Z(
|
|
|
1043
1043
|
},
|
|
1044
1044
|
e.id
|
|
1045
1045
|
);
|
|
1046
|
-
const
|
|
1047
|
-
b.preventDefault(), b.stopPropagation(), !(u ||
|
|
1048
|
-
},
|
|
1046
|
+
const D = (b) => {
|
|
1047
|
+
b.preventDefault(), b.stopPropagation(), !(u || p) && m?.(e);
|
|
1048
|
+
}, g = p && e.groupLabelNode ? e.groupLabelNode : e.label;
|
|
1049
1049
|
return (
|
|
1050
1050
|
// biome-ignore lint/a11y/noStaticElementInteractions: no keyboard interaction needed
|
|
1051
1051
|
/* @__PURE__ */ s.jsxs(
|
|
1052
1052
|
"div",
|
|
1053
1053
|
{
|
|
1054
|
-
onMouseDown:
|
|
1054
|
+
onMouseDown: D,
|
|
1055
1055
|
className: f(
|
|
1056
1056
|
"px-3 py-2 flex items-center transition-colors text-neutral-default-default ",
|
|
1057
|
-
|
|
1058
|
-
!
|
|
1059
|
-
u && !
|
|
1057
|
+
p ? "cursor-default text-neutral-medium-default" : "cursor-pointer",
|
|
1058
|
+
!p && (n ? " text-primary-default-default" : "hover:bg-neutral-medium-hover text-neutral-default-hover"),
|
|
1059
|
+
u && !p && "text-neutral-default-disabled hover:bg-neutral-default-default"
|
|
1060
1060
|
),
|
|
1061
1061
|
children: [
|
|
1062
|
-
i && !
|
|
1063
|
-
/* @__PURE__ */ s.jsx("span", { children:
|
|
1062
|
+
i && !p && /* @__PURE__ */ s.jsx(lt, { checked: n, disabled: u }),
|
|
1063
|
+
/* @__PURE__ */ s.jsx("span", { children: g })
|
|
1064
1064
|
]
|
|
1065
1065
|
},
|
|
1066
1066
|
e.id
|
|
@@ -1077,18 +1077,18 @@ const Je = Z(
|
|
|
1077
1077
|
onRemoveOption: m,
|
|
1078
1078
|
displayMode: i,
|
|
1079
1079
|
multiple: u,
|
|
1080
|
-
className:
|
|
1081
|
-
disabled:
|
|
1082
|
-
}) => e?.length === 0 ? n ? /* @__PURE__ */ s.jsx("span", { className: "text-neutral-medium-default opacity-50", children: n }) : null : i === "chips" && u ? /* @__PURE__ */ s.jsx("div", { className: f("flex items-center gap-1 ",
|
|
1080
|
+
className: x,
|
|
1081
|
+
disabled: p
|
|
1082
|
+
}) => e?.length === 0 ? n ? /* @__PURE__ */ s.jsx("span", { className: "text-neutral-medium-default opacity-50", children: n }) : null : i === "chips" && u ? /* @__PURE__ */ s.jsx("div", { className: f("flex items-center gap-1 ", x), children: e.map((D) => /* @__PURE__ */ s.jsx(
|
|
1083
1083
|
it,
|
|
1084
1084
|
{
|
|
1085
1085
|
tabIndex: -1,
|
|
1086
|
-
id:
|
|
1087
|
-
label:
|
|
1086
|
+
id: D.id,
|
|
1087
|
+
label: D.label,
|
|
1088
1088
|
onRemove: m,
|
|
1089
|
-
disabled:
|
|
1089
|
+
disabled: p
|
|
1090
1090
|
},
|
|
1091
|
-
|
|
1091
|
+
D.id
|
|
1092
1092
|
)) }) : e?.length === 1 ? /* @__PURE__ */ s.jsx("span", { children: e[0].label }) : /* @__PURE__ */ s.jsxs("span", { children: [
|
|
1093
1093
|
e?.length,
|
|
1094
1094
|
" seleccionados"
|