prometeo-design-system 3.1.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RecurrentDatePicker.es.js +1 -1
- package/dist/{Select-mdLPyy7g.js → Select-DW30oGym.js} +122 -115
- package/dist/Select.es.js +1 -1
- package/dist/SelectSearch.es.js +122 -116
- package/dist/components/Autocomplete/useAutocomplete.d.ts +1 -0
- package/dist/prometeo-design-system.es.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as r } from "./jsx-runtime-DKDX3adD.js";
|
|
2
2
|
import O, { useMemo as D, memo as b, useRef as M, useCallback as g, useState as L, useEffect as W } from "react";
|
|
3
3
|
import { D as I } from "./DatePicker-D1EwMGIN.js";
|
|
4
|
-
import { S as f } from "./Select-
|
|
4
|
+
import { S as f } from "./Select-DW30oGym.js";
|
|
5
5
|
import { I as R } from "./Input-EkMrxcNX.js";
|
|
6
6
|
import _ from "./CheckBox.es.js";
|
|
7
7
|
import { c as p } from "./cn-B6yFEsav.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as
|
|
1
|
+
import { j as a } from "./jsx-runtime-DKDX3adD.js";
|
|
2
2
|
import { c as f } from "./cn-B6yFEsav.js";
|
|
3
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";
|
|
@@ -28,7 +28,7 @@ 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: y = "default", tabIndex: p }) => /* @__PURE__ */
|
|
31
|
+
}, Ve = ({ id: e, label: n, onRemove: m, className: i, disabled: u, variant: y = "default", tabIndex: p }) => /* @__PURE__ */ a.jsxs(
|
|
32
32
|
"div",
|
|
33
33
|
{
|
|
34
34
|
tabIndex: p,
|
|
@@ -38,8 +38,8 @@ const at = {
|
|
|
38
38
|
u && Fe.container
|
|
39
39
|
),
|
|
40
40
|
children: [
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
m && /* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ a.jsx("span", { className: "truncate w-max ", children: n }),
|
|
42
|
+
m && /* @__PURE__ */ a.jsx(
|
|
43
43
|
"button",
|
|
44
44
|
{
|
|
45
45
|
onMouseDown: (D) => {
|
|
@@ -52,7 +52,7 @@ const at = {
|
|
|
52
52
|
),
|
|
53
53
|
type: "button",
|
|
54
54
|
tabIndex: p,
|
|
55
|
-
children: /* @__PURE__ */
|
|
55
|
+
children: /* @__PURE__ */ a.jsx(rt, { size: 18, className: f(u && Fe.icon) })
|
|
56
56
|
}
|
|
57
57
|
)
|
|
58
58
|
]
|
|
@@ -88,8 +88,8 @@ const qe = (e, n) => {
|
|
|
88
88
|
if (u.length > i.length) return !1;
|
|
89
89
|
const D = Math.floor(u.length * m);
|
|
90
90
|
if (D <= 0) return !1;
|
|
91
|
-
const g = (b,
|
|
92
|
-
const I = b.length, W =
|
|
91
|
+
const g = (b, E) => {
|
|
92
|
+
const I = b.length, W = E.length;
|
|
93
93
|
if (I === 0) return W;
|
|
94
94
|
if (W === 0) return I;
|
|
95
95
|
const A = new Array(W + 1);
|
|
@@ -98,15 +98,15 @@ const qe = (e, n) => {
|
|
|
98
98
|
let S = v - 1;
|
|
99
99
|
A[0] = v;
|
|
100
100
|
for (let z = 1; z <= W; z++) {
|
|
101
|
-
const se = A[z], K = b.charCodeAt(v - 1) ===
|
|
101
|
+
const se = A[z], K = b.charCodeAt(v - 1) === E.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
|
}
|
|
105
105
|
return A[W];
|
|
106
106
|
};
|
|
107
107
|
for (let b = 0; b <= i.length - u.length; b++) {
|
|
108
|
-
const
|
|
109
|
-
if (g(
|
|
108
|
+
const E = i.slice(b, b + u.length);
|
|
109
|
+
if (g(E, u) <= D) return !0;
|
|
110
110
|
}
|
|
111
111
|
return !1;
|
|
112
112
|
}, ut = (e) => {
|
|
@@ -170,7 +170,7 @@ const qe = (e, n) => {
|
|
|
170
170
|
)
|
|
171
171
|
};
|
|
172
172
|
function ct(e) {
|
|
173
|
-
const [n, m] = je(!1), [i, u] = je([]), [y, p] = je(""), D = ce(null), g = ce(null), b = ce(null),
|
|
173
|
+
const [n, m] = je(!1), [i, u] = je([]), [y, p] = je(""), D = ce(null), g = ce(null), b = ce(null), E = ce(null), I = ce(
|
|
174
174
|
() => {
|
|
175
175
|
}
|
|
176
176
|
), W = ce(null), A = ce(/* @__PURE__ */ new Set()), {
|
|
@@ -182,7 +182,7 @@ function ct(e) {
|
|
|
182
182
|
controls: V,
|
|
183
183
|
className: M,
|
|
184
184
|
placeholder: N,
|
|
185
|
-
optionValue:
|
|
185
|
+
optionValue: k,
|
|
186
186
|
optionLabel: de,
|
|
187
187
|
renderOption: J,
|
|
188
188
|
renderOptionGroupHeader: fe,
|
|
@@ -194,7 +194,7 @@ function ct(e) {
|
|
|
194
194
|
dropdownOptions: O,
|
|
195
195
|
helperComponent: ee,
|
|
196
196
|
errorComponent: Ce,
|
|
197
|
-
onRemoveOption:
|
|
197
|
+
onRemoveOption: ke,
|
|
198
198
|
onOptionClick: X,
|
|
199
199
|
onClose: Se,
|
|
200
200
|
onClear: me,
|
|
@@ -206,7 +206,7 @@ function ct(e) {
|
|
|
206
206
|
displayMode: we = "compact",
|
|
207
207
|
labelVariant: ie = "default",
|
|
208
208
|
disableOpenOnFocus: ze = !1,
|
|
209
|
-
emptyMessage:
|
|
209
|
+
emptyMessage: Ee = "No hay opciones disponibles"
|
|
210
210
|
} = e, { ref: Oe } = et(), { bind: ne, ref: Me } = Ze({
|
|
211
211
|
axis: "x",
|
|
212
212
|
cursor: { idle: "default", dragging: "grabbing" }
|
|
@@ -223,35 +223,35 @@ function ct(e) {
|
|
|
223
223
|
active: "absolute top-0 -translate-y-1/2 left-3 px-1 prometeo-fonts-body-small",
|
|
224
224
|
default: "absolute top-1/2 -translate-y-1/2 "
|
|
225
225
|
}
|
|
226
|
-
},
|
|
227
|
-
return t[ie][
|
|
226
|
+
}, s = n || pe ? "active" : "default";
|
|
227
|
+
return t[ie][s];
|
|
228
228
|
}, T = U(
|
|
229
229
|
(t) => ({
|
|
230
|
-
id: G(t,
|
|
231
|
-
value: G(t,
|
|
230
|
+
id: G(t, k),
|
|
231
|
+
value: G(t, k),
|
|
232
232
|
label: G(t, de)
|
|
233
233
|
}),
|
|
234
|
-
[
|
|
234
|
+
[k, de]
|
|
235
235
|
), Y = oe(() => ut(K), [K]), ge = oe(
|
|
236
236
|
() => Y.map(T),
|
|
237
237
|
[Y, T]
|
|
238
238
|
), r = oe(() => {
|
|
239
239
|
const t = [];
|
|
240
240
|
if (e.multiple)
|
|
241
|
-
e.value?.forEach((
|
|
241
|
+
e.value?.forEach((s) => {
|
|
242
242
|
const l = Y?.find(
|
|
243
|
-
(h) => G(h,
|
|
243
|
+
(h) => G(h, k) === s
|
|
244
244
|
);
|
|
245
245
|
l && t.push(l);
|
|
246
246
|
});
|
|
247
247
|
else {
|
|
248
|
-
const
|
|
249
|
-
(l) => G(l,
|
|
248
|
+
const s = Y?.find(
|
|
249
|
+
(l) => G(l, k) === e.value
|
|
250
250
|
);
|
|
251
|
-
|
|
251
|
+
s && t.push(s);
|
|
252
252
|
}
|
|
253
253
|
return t;
|
|
254
|
-
}, [e.value,
|
|
254
|
+
}, [e.value, k, Y, e.multiple]), o = oe(
|
|
255
255
|
() => r.map(T),
|
|
256
256
|
[r, T]
|
|
257
257
|
), c = oe(
|
|
@@ -259,16 +259,16 @@ function ct(e) {
|
|
|
259
259
|
[o]
|
|
260
260
|
), d = oe(() => {
|
|
261
261
|
const t = [];
|
|
262
|
-
return K.forEach((
|
|
263
|
-
const h =
|
|
262
|
+
return K.forEach((s, l) => {
|
|
263
|
+
const h = s, H = typeof h == "object" ? h?.options : [];
|
|
264
264
|
if (Array.isArray(H) && H.length > 0) {
|
|
265
|
-
const $ = h.label, P = G(
|
|
265
|
+
const $ = h.label, P = G(s, k), le = `__group-${String(P ?? l)}`, xe = {
|
|
266
266
|
id: le,
|
|
267
267
|
value: le,
|
|
268
268
|
label: typeof $ == "string" ? $ : String(P ?? `Grupo ${l + 1}`),
|
|
269
269
|
isGroupHeader: !0,
|
|
270
270
|
groupLabelNode: $,
|
|
271
|
-
originalOption:
|
|
271
|
+
originalOption: s,
|
|
272
272
|
groupData: {
|
|
273
273
|
groupOptions: H
|
|
274
274
|
}
|
|
@@ -277,10 +277,10 @@ function ct(e) {
|
|
|
277
277
|
J ? t.push(ye) : t.push(T(ye));
|
|
278
278
|
});
|
|
279
279
|
} else
|
|
280
|
-
J ? t.push(
|
|
280
|
+
J ? t.push(s) : t.push(T(s));
|
|
281
281
|
}), t;
|
|
282
|
-
}, [K,
|
|
283
|
-
(t,
|
|
282
|
+
}, [K, k, J, T]), w = U(
|
|
283
|
+
(t, s) => {
|
|
284
284
|
if (!t || t.length === 0) return;
|
|
285
285
|
const l = t.map(
|
|
286
286
|
(C) => T(C)
|
|
@@ -288,7 +288,7 @@ function ct(e) {
|
|
|
288
288
|
if (!e.multiple) {
|
|
289
289
|
const C = l[0];
|
|
290
290
|
if (!C) return;
|
|
291
|
-
const j = c.has(C.id), B =
|
|
291
|
+
const j = c.has(C.id), B = s ?? "toggle";
|
|
292
292
|
let Pe;
|
|
293
293
|
B === "select" || B === "toggle" && !j ? Pe = C : Pe = void 0, e.onChange?.(Pe, S);
|
|
294
294
|
return;
|
|
@@ -300,7 +300,7 @@ function ct(e) {
|
|
|
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)
|
|
303
|
-
), xe =
|
|
303
|
+
), xe = s ?? "toggle", ye = xe === "select" || xe === "toggle" && !le;
|
|
304
304
|
let _;
|
|
305
305
|
if (!ye)
|
|
306
306
|
_ = H.filter((C) => !P.has(C.id));
|
|
@@ -330,8 +330,8 @@ function ct(e) {
|
|
|
330
330
|
if (!e.multiple)
|
|
331
331
|
e.onChange?.(t, S);
|
|
332
332
|
else {
|
|
333
|
-
const
|
|
334
|
-
|
|
333
|
+
const s = e.value || [], l = [], h = s.includes(t.value);
|
|
334
|
+
s.forEach(($) => {
|
|
335
335
|
const P = ge.find(
|
|
336
336
|
(le) => le.value === $
|
|
337
337
|
);
|
|
@@ -342,31 +342,37 @@ function ct(e) {
|
|
|
342
342
|
}
|
|
343
343
|
};
|
|
344
344
|
const x = U(
|
|
345
|
-
(t,
|
|
346
|
-
X?.(t, S), I.current?.(t),
|
|
345
|
+
(t, s = !1) => {
|
|
346
|
+
X?.(t, S), I.current?.(t), s && (m(!1), Se?.());
|
|
347
347
|
},
|
|
348
348
|
[X, Se, S]
|
|
349
349
|
), R = (t) => {
|
|
350
|
-
t.preventDefault(), t.stopPropagation(), t.target.blur(), me?.(), e.multiple
|
|
350
|
+
if (t.preventDefault(), t.stopPropagation(), t.target.blur(), me?.(), e.multiple) {
|
|
351
|
+
const s = e.onChange;
|
|
352
|
+
s?.([], S);
|
|
353
|
+
} else {
|
|
354
|
+
const s = e.onChange;
|
|
355
|
+
s?.(void 0, S);
|
|
356
|
+
}
|
|
351
357
|
}, q = U(
|
|
352
358
|
(t) => {
|
|
353
359
|
e.multiple || e.onChange?.(void 0, S);
|
|
354
|
-
const
|
|
355
|
-
(h) => G(h,
|
|
360
|
+
const s = Y.find(
|
|
361
|
+
(h) => G(h, k) === t
|
|
356
362
|
);
|
|
357
|
-
if (!
|
|
358
|
-
const l = T(
|
|
359
|
-
X?.(l, S), I.current?.(l),
|
|
363
|
+
if (!s) return;
|
|
364
|
+
const l = T(s);
|
|
365
|
+
X?.(l, S), I.current?.(l), ke?.(s);
|
|
360
366
|
},
|
|
361
367
|
[
|
|
362
368
|
X,
|
|
363
|
-
|
|
369
|
+
ke,
|
|
364
370
|
Y,
|
|
365
371
|
S,
|
|
366
372
|
e.multiple,
|
|
367
373
|
e.onChange,
|
|
368
374
|
T,
|
|
369
|
-
|
|
375
|
+
k
|
|
370
376
|
]
|
|
371
377
|
), re = U(
|
|
372
378
|
(t) => {
|
|
@@ -376,17 +382,17 @@ function ct(e) {
|
|
|
376
382
|
);
|
|
377
383
|
ve(() => {
|
|
378
384
|
if (!n) return;
|
|
379
|
-
const t = (
|
|
380
|
-
const l =
|
|
381
|
-
if (
|
|
385
|
+
const t = (s) => {
|
|
386
|
+
const l = s.target;
|
|
387
|
+
if (s.type === "mousedown") {
|
|
382
388
|
if (D.current?.contains(l) || g.current?.contains(l)) return;
|
|
383
389
|
m(!1);
|
|
384
390
|
}
|
|
385
|
-
if (
|
|
391
|
+
if (s.type === "scroll") {
|
|
386
392
|
if (g.current?.contains(l)) return;
|
|
387
393
|
m(!1);
|
|
388
394
|
}
|
|
389
|
-
|
|
395
|
+
s.type === "resize" && m(!1);
|
|
390
396
|
};
|
|
391
397
|
return document.addEventListener("mousedown", t), window.addEventListener("scroll", t, !0), window.addEventListener("resize", t, !0), () => {
|
|
392
398
|
document.removeEventListener("mousedown", t), window.removeEventListener("scroll", t, !0), window.removeEventListener("resize", t, !0);
|
|
@@ -425,7 +431,7 @@ function ct(e) {
|
|
|
425
431
|
b.current?.focus();
|
|
426
432
|
}, 10));
|
|
427
433
|
};
|
|
428
|
-
return /* @__PURE__ */
|
|
434
|
+
return /* @__PURE__ */ a.jsxs(
|
|
429
435
|
"div",
|
|
430
436
|
{
|
|
431
437
|
className: f("relative bg-inherit select-none w-full", M),
|
|
@@ -433,8 +439,8 @@ function ct(e) {
|
|
|
433
439
|
draggable: !1,
|
|
434
440
|
style: Le,
|
|
435
441
|
children: [
|
|
436
|
-
/* @__PURE__ */
|
|
437
|
-
/* @__PURE__ */
|
|
442
|
+
/* @__PURE__ */ a.jsxs("div", { className: f("relative bg-inherit ", Q), children: [
|
|
443
|
+
/* @__PURE__ */ a.jsx(
|
|
438
444
|
"label",
|
|
439
445
|
{
|
|
440
446
|
htmlFor: v,
|
|
@@ -449,13 +455,13 @@ function ct(e) {
|
|
|
449
455
|
children: z
|
|
450
456
|
}
|
|
451
457
|
),
|
|
452
|
-
/* @__PURE__ */
|
|
458
|
+
/* @__PURE__ */ a.jsxs(
|
|
453
459
|
"div",
|
|
454
460
|
{
|
|
455
461
|
id: v,
|
|
456
462
|
tabIndex: 0,
|
|
457
463
|
role: "button",
|
|
458
|
-
ref:
|
|
464
|
+
ref: E,
|
|
459
465
|
onFocus: be,
|
|
460
466
|
onKeyDown: ue,
|
|
461
467
|
onClick: (t) => {
|
|
@@ -471,7 +477,7 @@ function ct(e) {
|
|
|
471
477
|
He
|
|
472
478
|
),
|
|
473
479
|
children: [
|
|
474
|
-
/* @__PURE__ */
|
|
480
|
+
/* @__PURE__ */ a.jsx(
|
|
475
481
|
"div",
|
|
476
482
|
{
|
|
477
483
|
className: f(
|
|
@@ -487,7 +493,7 @@ function ct(e) {
|
|
|
487
493
|
children: De ? Ne.createElement(
|
|
488
494
|
Z(
|
|
489
495
|
De,
|
|
490
|
-
(t,
|
|
496
|
+
(t, s) => t.disabled === s.disabled && t.multiple === s.multiple
|
|
491
497
|
),
|
|
492
498
|
{
|
|
493
499
|
disabled: te,
|
|
@@ -496,7 +502,7 @@ function ct(e) {
|
|
|
496
502
|
selectedOptions: r,
|
|
497
503
|
onRemoveOption: re
|
|
498
504
|
}
|
|
499
|
-
) : /* @__PURE__ */
|
|
505
|
+
) : /* @__PURE__ */ a.jsx(
|
|
500
506
|
Je,
|
|
501
507
|
{
|
|
502
508
|
displayMode: we,
|
|
@@ -512,8 +518,8 @@ function ct(e) {
|
|
|
512
518
|
)
|
|
513
519
|
}
|
|
514
520
|
),
|
|
515
|
-
/* @__PURE__ */
|
|
516
|
-
he && /* @__PURE__ */
|
|
521
|
+
/* @__PURE__ */ a.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
522
|
+
he && /* @__PURE__ */ a.jsx(
|
|
517
523
|
Xe,
|
|
518
524
|
{
|
|
519
525
|
size: "small",
|
|
@@ -521,15 +527,16 @@ function ct(e) {
|
|
|
521
527
|
className: " opacity-90"
|
|
522
528
|
}
|
|
523
529
|
),
|
|
524
|
-
pe && me && /* @__PURE__ */
|
|
530
|
+
pe && me && /* @__PURE__ */ a.jsx(
|
|
525
531
|
"button",
|
|
526
532
|
{
|
|
527
|
-
|
|
533
|
+
className: "z-100",
|
|
534
|
+
onClick: (t) => {
|
|
528
535
|
t.preventDefault(), t.stopPropagation(), R(t);
|
|
529
536
|
},
|
|
530
537
|
type: "button",
|
|
531
538
|
tabIndex: -1,
|
|
532
|
-
children: /* @__PURE__ */
|
|
539
|
+
children: /* @__PURE__ */ a.jsx(
|
|
533
540
|
ot,
|
|
534
541
|
{
|
|
535
542
|
size: 20,
|
|
@@ -541,7 +548,7 @@ function ct(e) {
|
|
|
541
548
|
)
|
|
542
549
|
}
|
|
543
550
|
),
|
|
544
|
-
/* @__PURE__ */
|
|
551
|
+
/* @__PURE__ */ a.jsx(
|
|
545
552
|
Ue,
|
|
546
553
|
{
|
|
547
554
|
size: 20,
|
|
@@ -557,15 +564,15 @@ function ct(e) {
|
|
|
557
564
|
}
|
|
558
565
|
)
|
|
559
566
|
] }),
|
|
560
|
-
n && /* @__PURE__ */
|
|
567
|
+
n && /* @__PURE__ */ a.jsx(
|
|
561
568
|
mt,
|
|
562
569
|
{
|
|
563
570
|
label: z,
|
|
564
571
|
isOpen: n,
|
|
565
572
|
disabled: te,
|
|
566
|
-
optionValue:
|
|
573
|
+
optionValue: k,
|
|
567
574
|
optionLabel: de,
|
|
568
|
-
emptyMessage:
|
|
575
|
+
emptyMessage: Ee,
|
|
569
576
|
labelVariant: ie,
|
|
570
577
|
renderOption: J,
|
|
571
578
|
renderOptionGroupHeader: fe,
|
|
@@ -579,7 +586,7 @@ function ct(e) {
|
|
|
579
586
|
options: d,
|
|
580
587
|
selectRef: D,
|
|
581
588
|
dropdownRef: g,
|
|
582
|
-
selectButtonRef:
|
|
589
|
+
selectButtonRef: E,
|
|
583
590
|
helperComponentRef: W,
|
|
584
591
|
onOptionClick: x,
|
|
585
592
|
onCloseDropdown: () => m(!1),
|
|
@@ -599,7 +606,7 @@ function ct(e) {
|
|
|
599
606
|
onGroupSelectChange: w
|
|
600
607
|
}
|
|
601
608
|
),
|
|
602
|
-
(Ce || ee) && /* @__PURE__ */
|
|
609
|
+
(Ce || ee) && /* @__PURE__ */ a.jsx("div", { className: "min-h-6", children: /* @__PURE__ */ a.jsx(
|
|
603
610
|
nt,
|
|
604
611
|
{
|
|
605
612
|
ref: W,
|
|
@@ -612,7 +619,7 @@ function ct(e) {
|
|
|
612
619
|
}
|
|
613
620
|
);
|
|
614
621
|
}
|
|
615
|
-
const dt = Z(ct, (e, n) => e.value === n.value && e.options === n.options && e.isLoading === n.isLoading && e.disabled === n.disabled && e.errorComponent === n.errorComponent && e.helperComponent === n.helperComponent && e.variant === n.variant && e.label === n.label && e.id === n.id && e.name === n.name && e.placeholder === n.placeholder && e.renderOptionContext === n.renderOptionContext && e.dropdownOptions?.controledSearchValue === n.dropdownOptions?.controledSearchValue && e.dropdownOptions?.isLoading === n.dropdownOptions?.isLoading),
|
|
622
|
+
const dt = Z(ct, (e, n) => e.value === n.value && e.options === n.options && e.isLoading === n.isLoading && e.disabled === n.disabled && e.errorComponent === n.errorComponent && e.helperComponent === n.helperComponent && e.variant === n.variant && e.label === n.label && e.id === n.id && e.name === n.name && e.placeholder === n.placeholder && e.renderOptionContext === n.renderOptionContext && e.dropdownOptions?.controledSearchValue === n.dropdownOptions?.controledSearchValue && e.dropdownOptions?.isLoading === n.dropdownOptions?.isLoading), kt = dt;
|
|
616
623
|
function ft({
|
|
617
624
|
footer: e,
|
|
618
625
|
isOpen: n,
|
|
@@ -624,7 +631,7 @@ function ft({
|
|
|
624
631
|
inputProps: D,
|
|
625
632
|
dropdownRef: g,
|
|
626
633
|
optionLabel: b,
|
|
627
|
-
optionValue:
|
|
634
|
+
optionValue: E,
|
|
628
635
|
searchValue: I,
|
|
629
636
|
labelVariant: W,
|
|
630
637
|
emptyMessage: A,
|
|
@@ -636,7 +643,7 @@ function ft({
|
|
|
636
643
|
searchInputRef: V,
|
|
637
644
|
setSearchValue: M,
|
|
638
645
|
dropdownHeight: N,
|
|
639
|
-
attachToParent:
|
|
646
|
+
attachToParent: k,
|
|
640
647
|
filteredOptions: de,
|
|
641
648
|
selectButtonRef: J,
|
|
642
649
|
onCloseDropdown: fe,
|
|
@@ -648,7 +655,7 @@ function ft({
|
|
|
648
655
|
onSearchValueChange: O,
|
|
649
656
|
isLoading: ee = !1,
|
|
650
657
|
hideSearchBar: Ce = !1,
|
|
651
|
-
inputSearchPlaceholder:
|
|
658
|
+
inputSearchPlaceholder: ke = "Buscar opciones",
|
|
652
659
|
enableGroupToggle: X = !0,
|
|
653
660
|
onGroupSelectChange: Se
|
|
654
661
|
}) {
|
|
@@ -660,7 +667,7 @@ function ft({
|
|
|
660
667
|
), ze = U(
|
|
661
668
|
(r) => !we.has(r),
|
|
662
669
|
[we]
|
|
663
|
-
),
|
|
670
|
+
), Ee = U(
|
|
664
671
|
(r, o) => {
|
|
665
672
|
ie((c) => {
|
|
666
673
|
const d = new Set(c), w = d.has(r);
|
|
@@ -693,7 +700,7 @@ function ft({
|
|
|
693
700
|
g.current.style.maxHeight = "0", g.current.style.opacity = "0", g.current.style.pointerEvents = "none";
|
|
694
701
|
return;
|
|
695
702
|
}
|
|
696
|
-
if (!
|
|
703
|
+
if (!k) {
|
|
697
704
|
const o = Me();
|
|
698
705
|
Ae(o), Oe(o.direction), ne(o.height);
|
|
699
706
|
}
|
|
@@ -701,7 +708,7 @@ function ft({
|
|
|
701
708
|
}
|
|
702
709
|
};
|
|
703
710
|
ve(() => {
|
|
704
|
-
|
|
711
|
+
k || !p.current || !n || Oe();
|
|
705
712
|
}, [ae]), ve(() => {
|
|
706
713
|
pe(n);
|
|
707
714
|
}, [n]), ve(() => {
|
|
@@ -725,11 +732,11 @@ function ft({
|
|
|
725
732
|
re(), R = ue;
|
|
726
733
|
return;
|
|
727
734
|
}
|
|
728
|
-
const
|
|
729
|
-
|
|
735
|
+
const s = be, l = G(
|
|
736
|
+
s,
|
|
730
737
|
b
|
|
731
738
|
), h = qe(String(l ?? ""), o);
|
|
732
|
-
R ? h && q.push(
|
|
739
|
+
R ? h && q.push(s) : h && x.push(s);
|
|
733
740
|
}), re(), x;
|
|
734
741
|
}
|
|
735
742
|
const c = [];
|
|
@@ -761,7 +768,7 @@ function ft({
|
|
|
761
768
|
if (K) {
|
|
762
769
|
K(), Q(
|
|
763
770
|
i.filter((r) => {
|
|
764
|
-
const o = v ? G(r,
|
|
771
|
+
const o = v ? G(r, E) : r.id;
|
|
765
772
|
return ae.has(o);
|
|
766
773
|
})
|
|
767
774
|
);
|
|
@@ -771,7 +778,7 @@ function ft({
|
|
|
771
778
|
}, [
|
|
772
779
|
i,
|
|
773
780
|
ae,
|
|
774
|
-
|
|
781
|
+
E,
|
|
775
782
|
K,
|
|
776
783
|
Q,
|
|
777
784
|
M,
|
|
@@ -821,7 +828,7 @@ function ft({
|
|
|
821
828
|
isLoading: !0,
|
|
822
829
|
renderContext: S
|
|
823
830
|
}
|
|
824
|
-
) : /* @__PURE__ */
|
|
831
|
+
) : /* @__PURE__ */ a.jsx(
|
|
825
832
|
Be,
|
|
826
833
|
{
|
|
827
834
|
multiple: !1,
|
|
@@ -834,7 +841,7 @@ function ft({
|
|
|
834
841
|
`skeleton-option-${// biome-ignore lint/suspicious/noArrayIndexKey: <>
|
|
835
842
|
o}`
|
|
836
843
|
)
|
|
837
|
-
), ge = /* @__PURE__ */
|
|
844
|
+
), ge = /* @__PURE__ */ a.jsx(
|
|
838
845
|
"div",
|
|
839
846
|
{
|
|
840
847
|
tabIndex: 0,
|
|
@@ -843,11 +850,11 @@ function ft({
|
|
|
843
850
|
className: f(
|
|
844
851
|
" z-100! w-full mt-1 bg-neutral-default-default border border-neutral-default-default rounded-lg shadow-lg",
|
|
845
852
|
" overflow-hidden focus-visible:bg-neutral-default-hover ",
|
|
846
|
-
|
|
853
|
+
k ? "absolute z-50 " : "fixed z-100 top-0 left-0",
|
|
847
854
|
he.direction === "up" ? "h-auto" : " h-max",
|
|
848
855
|
Ie
|
|
849
856
|
),
|
|
850
|
-
children: /* @__PURE__ */
|
|
857
|
+
children: /* @__PURE__ */ a.jsxs(
|
|
851
858
|
"div",
|
|
852
859
|
{
|
|
853
860
|
className: f(
|
|
@@ -859,7 +866,7 @@ function ft({
|
|
|
859
866
|
maxHeight: he.height
|
|
860
867
|
},
|
|
861
868
|
children: [
|
|
862
|
-
!Ce && /* @__PURE__ */
|
|
869
|
+
!Ce && /* @__PURE__ */ a.jsx(
|
|
863
870
|
tt,
|
|
864
871
|
{
|
|
865
872
|
name: "",
|
|
@@ -870,23 +877,23 @@ function ft({
|
|
|
870
877
|
disabled: y,
|
|
871
878
|
ref: V,
|
|
872
879
|
labelVariant: "static",
|
|
873
|
-
icon: /* @__PURE__ */
|
|
880
|
+
icon: /* @__PURE__ */ a.jsx(st, { size: 22 }),
|
|
874
881
|
isFetching: ee,
|
|
875
882
|
onKeyDown: $e,
|
|
876
883
|
onClear: Ge,
|
|
877
884
|
onChange: (r) => Te(r.target.value),
|
|
878
|
-
placeholder:
|
|
885
|
+
placeholder: ke,
|
|
879
886
|
className: " bg-neutral-medium-pressed",
|
|
880
887
|
...D
|
|
881
888
|
}
|
|
882
889
|
),
|
|
883
|
-
/* @__PURE__ */
|
|
890
|
+
/* @__PURE__ */ a.jsx("div", { className: " overflow-y-auto flex-1 max-h-max ", children: de.length === 0 ? ee ? /* @__PURE__ */ a.jsx("div", { className: "flex flex-col gap-1 overflow-hidden w-full", children: De || Y }) : /* @__PURE__ */ a.jsx("div", { className: "px-3 py-2 text-neutral-medium-default", children: I ? `No se encontraron resultados para "${I}"` : A }) : (() => {
|
|
884
891
|
let r = !0;
|
|
885
892
|
return de.map((o) => {
|
|
886
|
-
const c = o, d = !!(c || {}).isGroupHeader, w = v && !d ? G(o,
|
|
893
|
+
const c = o, d = !!(c || {}).isGroupHeader, w = v && !d ? G(o, E) : c.id, L = ae.has(w), x = (l) => !v || d ? l : {
|
|
887
894
|
id: w,
|
|
888
895
|
label: String(G(l, b)),
|
|
889
|
-
value: G(l,
|
|
896
|
+
value: G(l, E)
|
|
890
897
|
}, R = (l) => {
|
|
891
898
|
d || se(
|
|
892
899
|
x(o),
|
|
@@ -901,7 +908,7 @@ function ft({
|
|
|
901
908
|
const H = !!(h || {}).isGroupHeader;
|
|
902
909
|
return (
|
|
903
910
|
// biome-ignore lint/a11y/useSemanticElements: <>
|
|
904
|
-
/* @__PURE__ */
|
|
911
|
+
/* @__PURE__ */ a.jsx(
|
|
905
912
|
"div",
|
|
906
913
|
{
|
|
907
914
|
tabIndex: 0,
|
|
@@ -922,12 +929,12 @@ function ft({
|
|
|
922
929
|
const l = c.groupLabelNode ?? c.label, h = String(c.id), H = X === !1 ? !0 : ze(h);
|
|
923
930
|
r = H;
|
|
924
931
|
const $ = c.originalOption, P = c.groupData?.groupOptions ?? [], le = (_) => {
|
|
925
|
-
X &&
|
|
932
|
+
X && Ee(h, _);
|
|
926
933
|
}, xe = (_) => {
|
|
927
934
|
!P || P.length === 0 || Se && Se(P, _);
|
|
928
935
|
}, ye = P.filter(
|
|
929
|
-
(_) => ae.has(G(_,
|
|
930
|
-
).map((_) => String(G(_,
|
|
936
|
+
(_) => ae.has(G(_, E))
|
|
937
|
+
).map((_) => String(G(_, E)));
|
|
931
938
|
if (z) {
|
|
932
939
|
const _ = Z(
|
|
933
940
|
z,
|
|
@@ -947,14 +954,14 @@ function ft({
|
|
|
947
954
|
return re(C, c);
|
|
948
955
|
}
|
|
949
956
|
return re(
|
|
950
|
-
/* @__PURE__ */
|
|
951
|
-
/* @__PURE__ */
|
|
952
|
-
X && /* @__PURE__ */
|
|
957
|
+
/* @__PURE__ */ a.jsxs("div", { className: "px-3 py-2 text-neutral-medium-default font-medium text-sm w-full flex justify-between", children: [
|
|
958
|
+
/* @__PURE__ */ a.jsx("div", { children: l }),
|
|
959
|
+
X && /* @__PURE__ */ a.jsx(
|
|
953
960
|
"div",
|
|
954
961
|
{
|
|
955
962
|
className: "cursor-pointer",
|
|
956
|
-
onClick: () =>
|
|
957
|
-
children: /* @__PURE__ */
|
|
963
|
+
onClick: () => Ee(h),
|
|
964
|
+
children: /* @__PURE__ */ a.jsx(
|
|
958
965
|
Ue,
|
|
959
966
|
{
|
|
960
967
|
className: f(
|
|
@@ -984,7 +991,7 @@ function ft({
|
|
|
984
991
|
isLoading: ee,
|
|
985
992
|
renderContext: S
|
|
986
993
|
}
|
|
987
|
-
) : /* @__PURE__ */
|
|
994
|
+
) : /* @__PURE__ */ a.jsx(
|
|
988
995
|
Be,
|
|
989
996
|
{
|
|
990
997
|
disabled: y,
|
|
@@ -1001,10 +1008,10 @@ function ft({
|
|
|
1001
1008
|
);
|
|
1002
1009
|
if (!X)
|
|
1003
1010
|
return ue;
|
|
1004
|
-
const t = !r,
|
|
1005
|
-
return Ne.cloneElement(
|
|
1011
|
+
const t = !r, s = ue;
|
|
1012
|
+
return Ne.cloneElement(s, {
|
|
1006
1013
|
className: f(
|
|
1007
|
-
|
|
1014
|
+
s.props.className,
|
|
1008
1015
|
"overflow-hidden transition-[max-height] duration-300 ease-out",
|
|
1009
1016
|
t ? "max-h-0" : "max-h-[999px]"
|
|
1010
1017
|
)
|
|
@@ -1017,7 +1024,7 @@ function ft({
|
|
|
1017
1024
|
)
|
|
1018
1025
|
}
|
|
1019
1026
|
);
|
|
1020
|
-
return
|
|
1027
|
+
return k ? ge : Ye(ge, document.body);
|
|
1021
1028
|
}
|
|
1022
1029
|
const mt = Z(
|
|
1023
1030
|
ft,
|
|
@@ -1033,13 +1040,13 @@ const mt = Z(
|
|
|
1033
1040
|
}) => {
|
|
1034
1041
|
const p = (e || {})?.isGroupHeader;
|
|
1035
1042
|
if (y)
|
|
1036
|
-
return /* @__PURE__ */
|
|
1043
|
+
return /* @__PURE__ */ a.jsxs(
|
|
1037
1044
|
"div",
|
|
1038
1045
|
{
|
|
1039
1046
|
className: "flex gap-2 w-full px-3 py-2 cursor-wait",
|
|
1040
1047
|
children: [
|
|
1041
|
-
/* @__PURE__ */
|
|
1042
|
-
/* @__PURE__ */
|
|
1048
|
+
/* @__PURE__ */ a.jsx(Ke, { className: "size-6 aspect-square" }),
|
|
1049
|
+
/* @__PURE__ */ a.jsx(Ke, { className: "flex-1 h-6" })
|
|
1043
1050
|
]
|
|
1044
1051
|
},
|
|
1045
1052
|
e.id
|
|
@@ -1049,7 +1056,7 @@ const mt = Z(
|
|
|
1049
1056
|
}, g = p && e.groupLabelNode ? e.groupLabelNode : e.label;
|
|
1050
1057
|
return (
|
|
1051
1058
|
// biome-ignore lint/a11y/noStaticElementInteractions: no keyboard interaction needed
|
|
1052
|
-
/* @__PURE__ */
|
|
1059
|
+
/* @__PURE__ */ a.jsxs(
|
|
1053
1060
|
"div",
|
|
1054
1061
|
{
|
|
1055
1062
|
onMouseDown: D,
|
|
@@ -1060,8 +1067,8 @@ const mt = Z(
|
|
|
1060
1067
|
u && !p && "text-neutral-default-disabled hover:bg-neutral-default-default"
|
|
1061
1068
|
),
|
|
1062
1069
|
children: [
|
|
1063
|
-
i && !p && /* @__PURE__ */
|
|
1064
|
-
/* @__PURE__ */
|
|
1070
|
+
i && !p && /* @__PURE__ */ a.jsx(lt, { checked: n, disabled: u }),
|
|
1071
|
+
/* @__PURE__ */ a.jsx("span", { children: g })
|
|
1065
1072
|
]
|
|
1066
1073
|
},
|
|
1067
1074
|
e.id
|
|
@@ -1080,7 +1087,7 @@ const Je = Z(
|
|
|
1080
1087
|
multiple: u,
|
|
1081
1088
|
className: y,
|
|
1082
1089
|
disabled: p
|
|
1083
|
-
}) => e?.length === 0 ? n ? /* @__PURE__ */
|
|
1090
|
+
}) => e?.length === 0 ? n ? /* @__PURE__ */ a.jsx("span", { className: "text-neutral-medium-default opacity-50", children: n }) : null : i === "chips" && u ? /* @__PURE__ */ a.jsx("div", { className: f("flex items-center gap-1 ", y), children: e.map((D) => /* @__PURE__ */ a.jsx(
|
|
1084
1091
|
it,
|
|
1085
1092
|
{
|
|
1086
1093
|
tabIndex: -1,
|
|
@@ -1090,7 +1097,7 @@ const Je = Z(
|
|
|
1090
1097
|
disabled: p
|
|
1091
1098
|
},
|
|
1092
1099
|
D.id
|
|
1093
|
-
)) }) : e?.length === 1 ? /* @__PURE__ */
|
|
1100
|
+
)) }) : e?.length === 1 ? /* @__PURE__ */ a.jsx("span", { children: e[0].label }) : /* @__PURE__ */ a.jsxs("span", { children: [
|
|
1094
1101
|
e?.length,
|
|
1095
1102
|
" seleccionados"
|
|
1096
1103
|
] }),
|
|
@@ -1098,6 +1105,6 @@ const Je = Z(
|
|
|
1098
1105
|
);
|
|
1099
1106
|
Je.displayName = "DefaultSelectionDisplay";
|
|
1100
1107
|
export {
|
|
1101
|
-
|
|
1108
|
+
kt as S,
|
|
1102
1109
|
G as g
|
|
1103
1110
|
};
|
package/dist/Select.es.js
CHANGED
package/dist/SelectSearch.es.js
CHANGED
|
@@ -1,96 +1,95 @@
|
|
|
1
1
|
import { j as X } from "./jsx-runtime-DKDX3adD.js";
|
|
2
|
-
import { g as i, S as Y } from "./Select-
|
|
3
|
-
import { useState as
|
|
2
|
+
import { g as i, S as Y } from "./Select-DW30oGym.js";
|
|
3
|
+
import { useState as x, useRef as A, useEffect as b, useMemo as Z, useCallback as ee } from "react";
|
|
4
4
|
function le(e) {
|
|
5
5
|
const {
|
|
6
|
-
options:
|
|
6
|
+
options: O,
|
|
7
7
|
fetcher: u,
|
|
8
|
-
asyncMode:
|
|
9
|
-
disabled:
|
|
10
|
-
debounceDelay:
|
|
11
|
-
minCharacters:
|
|
8
|
+
asyncMode: S = "fetch_in_open",
|
|
9
|
+
disabled: _ = !1,
|
|
10
|
+
debounceDelay: E = 500,
|
|
11
|
+
minCharacters: w = 3,
|
|
12
12
|
optionLabel: h,
|
|
13
13
|
optionValue: s,
|
|
14
|
-
controlledValue:
|
|
15
|
-
isOpen:
|
|
16
|
-
inputRef:
|
|
17
|
-
name:
|
|
18
|
-
} = e || {},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}, [u]),
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, [c, f]), m(() => {
|
|
14
|
+
controlledValue: d,
|
|
15
|
+
isOpen: F,
|
|
16
|
+
inputRef: P,
|
|
17
|
+
name: T
|
|
18
|
+
} = e || {}, M = O ? O.filter((t) => t != null) : [], [p, y] = x(M || []), [D, I] = x(M || []), [c, N] = x(""), [W, C] = x(!1), [J, U] = x(!1), l = A(null), g = A(null), m = A(!1), V = A(u), L = e?.multiple === !0 || !1, k = A(L ? [] : void 0), [f, v] = x(L ? [] : void 0);
|
|
19
|
+
b(() => {
|
|
20
|
+
V.current = u;
|
|
21
|
+
}, [u]), b(() => {
|
|
22
|
+
if (L) {
|
|
23
|
+
const t = z(d, "value");
|
|
24
|
+
v(t);
|
|
25
|
+
} else
|
|
26
|
+
d != null ? v(d) : v(void 0);
|
|
27
|
+
}, [d]), b(() => {
|
|
28
|
+
k.current = d !== void 0 ? d : f;
|
|
29
|
+
}, [d, f]), b(() => {
|
|
31
30
|
if (e?.options) {
|
|
32
31
|
const t = e.options.filter((n) => n != null);
|
|
33
|
-
|
|
32
|
+
y(t), I(t);
|
|
34
33
|
}
|
|
35
34
|
}, [e?.options]);
|
|
36
35
|
const B = Z(() => (t, n) => new Promise((o, r) => {
|
|
37
|
-
|
|
38
|
-
}), [
|
|
39
|
-
const n =
|
|
36
|
+
l.current && clearTimeout(l.current), l.current = setTimeout(() => t(c).then(o).catch(r), n);
|
|
37
|
+
}), [c]), te = (t) => {
|
|
38
|
+
const n = d !== void 0, o = (r) => s ? i(r, s) : i(r, "id");
|
|
40
39
|
if (e?.multiple === !0) {
|
|
41
|
-
const r =
|
|
40
|
+
const r = k.current || [];
|
|
42
41
|
let a;
|
|
43
|
-
r.some((
|
|
42
|
+
r.some((R) => o(R) === o(t)) ? a = r.filter((R) => o(R) !== o(t)) : a = [...r, t], n ? (k.current = a, e?.onChange?.(a, T)) : (k.current = a, v(a), e?.onChange?.(a, T));
|
|
44
43
|
} else
|
|
45
|
-
n ? (
|
|
46
|
-
}, q = (t) => (e?.onFetchingStart?.(),
|
|
47
|
-
|
|
44
|
+
n ? (k.current = t, e?.onChange?.(t, T)) : (k.current = t, v(t), e?.onChange?.(t, T));
|
|
45
|
+
}, q = (t) => (e?.onFetchingStart?.(), V.current?.(t) || Promise.resolve([])), z = (t, n) => Array.isArray(t) ? (t.some((o) => typeof o != "object" || o === null) && console.debug(`El valor del ${n || "resultado del fetcher"} contiene elementos no válidos (null,undefined, no-object)`, t), t?.filter((o) => o != null) || []) : (console.debug(`El valor del ${n || "resultado del fetcher"} no es un Array (tipo de dato obtenido: ${typeof t})`), []), $ = ee((t, n) => t.length === 0 ? n : s ? n.filter((o) => !t.some((r) => i(r, s) === i(o, s))) : n.filter((o) => !t.some((r) => i(r, "id") === i(o, "id"))), [s]);
|
|
46
|
+
b(() => {
|
|
48
47
|
const t = e?.subscribeOpenChange;
|
|
49
48
|
if (!t) return;
|
|
50
49
|
const n = t((o) => {
|
|
51
|
-
|
|
50
|
+
U(o);
|
|
52
51
|
});
|
|
53
52
|
return () => {
|
|
54
53
|
n && n();
|
|
55
54
|
};
|
|
56
55
|
}, [e?.subscribeOpenChange]);
|
|
57
|
-
const G =
|
|
58
|
-
|
|
59
|
-
if (!
|
|
60
|
-
if (!
|
|
61
|
-
|
|
56
|
+
const G = F !== void 0 ? F : J;
|
|
57
|
+
b(() => {
|
|
58
|
+
if (!_ && V.current && S === "fetch_on_type") {
|
|
59
|
+
if (!c || c === "" || c.length < w) {
|
|
60
|
+
l.current && clearTimeout(l.current), C(!1);
|
|
62
61
|
return;
|
|
63
62
|
}
|
|
64
|
-
const t = B(q,
|
|
65
|
-
|
|
66
|
-
const o =
|
|
67
|
-
|
|
63
|
+
const t = B(q, E);
|
|
64
|
+
C(!0), t.then((n) => {
|
|
65
|
+
const o = z(n);
|
|
66
|
+
y(o);
|
|
68
67
|
}).finally(() => {
|
|
69
|
-
|
|
68
|
+
C(!1), e?.onFetchingEnd?.();
|
|
70
69
|
});
|
|
71
70
|
}
|
|
72
|
-
}, [
|
|
73
|
-
if (!
|
|
71
|
+
}, [S, c, _, E, B, w]), b(() => {
|
|
72
|
+
if (!_)
|
|
74
73
|
if (G) {
|
|
75
|
-
if (e?.onOpen?.(),
|
|
76
|
-
if (!
|
|
74
|
+
if (e?.onOpen?.(), S === "fetch_in_open") {
|
|
75
|
+
if (!V.current)
|
|
77
76
|
return;
|
|
78
|
-
|
|
79
|
-
const n =
|
|
80
|
-
|
|
77
|
+
C(!0), q().then((t) => {
|
|
78
|
+
const n = z(t);
|
|
79
|
+
y(() => {
|
|
81
80
|
const o = n.filter((r) => {
|
|
82
81
|
if (s)
|
|
83
82
|
return i(r, s) !== void 0;
|
|
84
83
|
});
|
|
85
|
-
return
|
|
84
|
+
return L && f.length > 0 ? [...$(f, o), ...f] : o;
|
|
86
85
|
});
|
|
87
86
|
}).finally(() => {
|
|
88
|
-
|
|
87
|
+
C(!1), e?.onFetchingEnd?.();
|
|
89
88
|
});
|
|
90
89
|
}
|
|
91
90
|
} else
|
|
92
91
|
e?.onClose?.();
|
|
93
|
-
}, [G,
|
|
92
|
+
}, [G, S, _]);
|
|
94
93
|
const H = (t, n) => t?.filter((o) => {
|
|
95
94
|
if (h)
|
|
96
95
|
return i(o, h)?.toLowerCase().includes(n.toLowerCase());
|
|
@@ -102,7 +101,7 @@ function le(e) {
|
|
|
102
101
|
case "number":
|
|
103
102
|
return r.toString().includes(n);
|
|
104
103
|
case "object":
|
|
105
|
-
return Object.values(r).some((
|
|
104
|
+
return Object.values(r).some((j) => j.toString()?.toLowerCase().includes(n.toLowerCase()));
|
|
106
105
|
default:
|
|
107
106
|
return !1;
|
|
108
107
|
}
|
|
@@ -111,16 +110,16 @@ function le(e) {
|
|
|
111
110
|
if (h)
|
|
112
111
|
return i(n, h) < i(o, h) ? -1 : 1;
|
|
113
112
|
{
|
|
114
|
-
const a = ["label", "name", "value"].find((
|
|
115
|
-
switch (typeof
|
|
113
|
+
const a = ["label", "name", "value"].find((K) => typeof n == "object" && Object.keys(n).includes(K)), j = n, R = o;
|
|
114
|
+
switch (typeof j) {
|
|
116
115
|
case "string":
|
|
117
|
-
return
|
|
116
|
+
return j < R ? -1 : 1;
|
|
118
117
|
case "number":
|
|
119
|
-
return
|
|
118
|
+
return j < R ? -1 : 1;
|
|
120
119
|
case "object":
|
|
121
120
|
if (a) {
|
|
122
|
-
const
|
|
123
|
-
return
|
|
121
|
+
const K = i(n, a), oe = i(o, a);
|
|
122
|
+
return K < oe ? -1 : 1;
|
|
124
123
|
} else
|
|
125
124
|
return 1;
|
|
126
125
|
default:
|
|
@@ -128,87 +127,92 @@ function le(e) {
|
|
|
128
127
|
}
|
|
129
128
|
}
|
|
130
129
|
}) || [], Q = (t) => {
|
|
131
|
-
const n = typeof
|
|
132
|
-
t.target === n?.current && (
|
|
133
|
-
|
|
134
|
-
},
|
|
130
|
+
const n = typeof P == "function" ? P() : P;
|
|
131
|
+
t.target === n?.current && (g.current && clearTimeout(g.current), m.current || (m.current = !0, e?.onTypeStart?.()), g.current = setTimeout(() => {
|
|
132
|
+
m.current = !1;
|
|
133
|
+
}, E));
|
|
135
134
|
};
|
|
136
|
-
return
|
|
137
|
-
if (
|
|
138
|
-
|
|
139
|
-
else if (
|
|
140
|
-
const t =
|
|
141
|
-
|
|
135
|
+
return b(() => {
|
|
136
|
+
if (c === "")
|
|
137
|
+
I(ne(p));
|
|
138
|
+
else if (L) {
|
|
139
|
+
const t = $(f, p);
|
|
140
|
+
I([...H(t, c), ...f]);
|
|
142
141
|
} else {
|
|
143
|
-
const t =
|
|
144
|
-
|
|
142
|
+
const t = $([f], p);
|
|
143
|
+
I([...H(t, c), f]);
|
|
145
144
|
}
|
|
146
|
-
}, [
|
|
145
|
+
}, [p]), b(() => (document.addEventListener("keydown", Q), () => {
|
|
147
146
|
document.removeEventListener("keydown", Q);
|
|
148
147
|
}), []), {
|
|
149
|
-
inputValue:
|
|
150
|
-
setInputValue:
|
|
148
|
+
inputValue: c,
|
|
149
|
+
setInputValue: N,
|
|
151
150
|
cleanInputValue: () => {
|
|
152
|
-
|
|
151
|
+
N("");
|
|
153
152
|
},
|
|
154
153
|
cleanOptions: () => {
|
|
155
|
-
|
|
154
|
+
L && y(f);
|
|
155
|
+
},
|
|
156
|
+
clearValue: () => {
|
|
157
|
+
v(L ? [] : void 0);
|
|
156
158
|
},
|
|
157
159
|
filteredOptions: D,
|
|
158
|
-
isLoading:
|
|
160
|
+
isLoading: W,
|
|
159
161
|
value: f,
|
|
160
|
-
setValue:
|
|
162
|
+
setValue: v,
|
|
161
163
|
onOptionClick: te
|
|
162
164
|
};
|
|
163
165
|
}
|
|
164
|
-
const
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
e.controls && (e.controls.current =
|
|
166
|
+
const fe = (e) => {
|
|
167
|
+
const O = A(null);
|
|
168
|
+
b(() => {
|
|
169
|
+
e.controls && (e.controls.current = O.current);
|
|
168
170
|
}, [e.controls]);
|
|
169
|
-
const { asyncMode: u = "fetch_in_open" } = e,
|
|
170
|
-
const
|
|
171
|
+
const { asyncMode: u = "fetch_in_open" } = e, S = (l, g, m) => {
|
|
172
|
+
const V = {
|
|
171
173
|
options: l.options,
|
|
172
174
|
fetcher: l.fetcher,
|
|
173
|
-
asyncMode:
|
|
175
|
+
asyncMode: g,
|
|
174
176
|
debounceDelay: l.debounceDelay,
|
|
175
177
|
minCharacters: l.minCharacters,
|
|
176
178
|
disabled: l.disabled,
|
|
177
179
|
optionValue: l.optionValue,
|
|
178
180
|
optionLabel: l.optionLabel,
|
|
179
181
|
onFetchingStart: () => {
|
|
180
|
-
|
|
182
|
+
g === "fetch_on_type" && m.current?.open();
|
|
181
183
|
},
|
|
182
184
|
onTypeStart: () => {
|
|
183
|
-
!l?.fetcher &&
|
|
185
|
+
!l?.fetcher && m.current?.open();
|
|
184
186
|
},
|
|
185
|
-
inputRef: () =>
|
|
186
|
-
subscribeOpenChange:
|
|
187
|
+
inputRef: () => m.current?.searchInputRef,
|
|
188
|
+
subscribeOpenChange: m.current?.subscribeOpenChange,
|
|
187
189
|
name: l.name
|
|
188
190
|
};
|
|
189
191
|
return l.multiple ? {
|
|
190
|
-
...
|
|
192
|
+
...V,
|
|
191
193
|
multiple: !0,
|
|
192
194
|
controlledValue: l.value,
|
|
193
195
|
onChange: l.onChange
|
|
194
196
|
} : {
|
|
195
|
-
...
|
|
197
|
+
...V,
|
|
196
198
|
multiple: !1,
|
|
197
199
|
controlledValue: l.value,
|
|
198
200
|
onChange: l.onChange
|
|
199
201
|
};
|
|
200
|
-
}, { inputValue:
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
}, { displayMode:
|
|
204
|
-
controledSearchValue:
|
|
205
|
-
onSearchValueChange: u === "fetch_on_type" ?
|
|
202
|
+
}, { inputValue: _, setInputValue: E, filteredOptions: w, isLoading: h, value: s, onOptionClick: d, cleanInputValue: F, cleanOptions: P, clearValue: T } = le(S(e, u, O)), M = ee(() => u === "fetch_on_type" ? h : !1, [u, h]), p = Z(() => e.multiple ? s.map((l) => i(l, e.optionValue)) : s ? i(s, e.optionValue) : void 0, [s, e.optionValue, e.multiple]), y = (l) => {
|
|
203
|
+
const g = w.find((m) => i(m, e.optionValue) === l.id);
|
|
204
|
+
g && d(g);
|
|
205
|
+
}, { displayMode: D = e.multiple ? "chips" : "compact", dropdownOptions: I, overflow: c = "scroll", onChange: N, onClear: W, ...C } = e.selectComponentProps || {}, J = {
|
|
206
|
+
controledSearchValue: _,
|
|
207
|
+
onSearchValueChange: u === "fetch_on_type" ? E : void 0,
|
|
206
208
|
onSearchClear: u === "fetch_on_type" ? () => {
|
|
207
|
-
|
|
209
|
+
F(), P();
|
|
208
210
|
} : void 0,
|
|
209
211
|
inputSearchPlaceholder: e.inputSearchPlaceholder,
|
|
210
|
-
isLoading:
|
|
211
|
-
...
|
|
212
|
+
isLoading: M(),
|
|
213
|
+
...I || {}
|
|
214
|
+
}, U = () => {
|
|
215
|
+
T(), e?.selectComponentProps?.onClear?.();
|
|
212
216
|
};
|
|
213
217
|
return e.multiple ? /* @__PURE__ */ X.jsx(
|
|
214
218
|
Y,
|
|
@@ -216,18 +220,19 @@ const de = (e) => {
|
|
|
216
220
|
disabled: e.disabled,
|
|
217
221
|
className: e.className,
|
|
218
222
|
name: e.name,
|
|
219
|
-
overflow:
|
|
220
|
-
...
|
|
223
|
+
overflow: c,
|
|
224
|
+
...C,
|
|
225
|
+
onClear: e?.selectComponentProps?.onClear && U,
|
|
221
226
|
multiple: !0,
|
|
222
|
-
value:
|
|
227
|
+
value: p,
|
|
223
228
|
label: e.label || "",
|
|
224
|
-
options:
|
|
229
|
+
options: w,
|
|
225
230
|
optionValue: e.optionValue,
|
|
226
231
|
optionLabel: e.optionLabel,
|
|
227
232
|
renderOption: e.renderOption,
|
|
228
|
-
onOptionClick:
|
|
229
|
-
displayMode:
|
|
230
|
-
controls:
|
|
233
|
+
onOptionClick: y,
|
|
234
|
+
displayMode: D,
|
|
235
|
+
controls: O,
|
|
231
236
|
emptyMessage: "Use el buscador para obtener las opciones disponibles",
|
|
232
237
|
dropdownOptions: J,
|
|
233
238
|
isLoading: u === "fetch_in_open" ? h : !1
|
|
@@ -236,20 +241,21 @@ const de = (e) => {
|
|
|
236
241
|
Y,
|
|
237
242
|
{
|
|
238
243
|
disabled: e.disabled,
|
|
239
|
-
...
|
|
244
|
+
...C,
|
|
245
|
+
onClear: U,
|
|
240
246
|
className: e.className,
|
|
241
|
-
overflow:
|
|
247
|
+
overflow: c,
|
|
242
248
|
name: e.name,
|
|
243
249
|
multiple: !1,
|
|
244
|
-
value:
|
|
250
|
+
value: p,
|
|
245
251
|
label: e.label || "",
|
|
246
|
-
options:
|
|
252
|
+
options: w,
|
|
247
253
|
optionValue: e.optionValue,
|
|
248
254
|
optionLabel: e.optionLabel,
|
|
249
255
|
renderOption: e.renderOption,
|
|
250
|
-
onOptionClick:
|
|
256
|
+
onOptionClick: y,
|
|
251
257
|
displayMode: "compact",
|
|
252
|
-
controls:
|
|
258
|
+
controls: O,
|
|
253
259
|
emptyMessage: "Use el buscador para obtener las opciones disponibles",
|
|
254
260
|
dropdownOptions: J,
|
|
255
261
|
isLoading: u === "fetch_in_open" ? h : !1
|
|
@@ -257,5 +263,5 @@ const de = (e) => {
|
|
|
257
263
|
);
|
|
258
264
|
};
|
|
259
265
|
export {
|
|
260
|
-
|
|
266
|
+
fe as default
|
|
261
267
|
};
|
|
@@ -34,6 +34,7 @@ export declare function useAutocomplete<T extends object>(options?: UseAutocompl
|
|
|
34
34
|
setInputValue: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
35
35
|
cleanInputValue: () => void;
|
|
36
36
|
cleanOptions: () => void;
|
|
37
|
+
clearValue: () => void;
|
|
37
38
|
filteredOptions: T[];
|
|
38
39
|
isLoading: boolean;
|
|
39
40
|
value: T | T[] | undefined;
|
|
@@ -13,7 +13,7 @@ import { default as Ke } from "./Menu.es.js";
|
|
|
13
13
|
import { default as Ye } from "./Pagination.es.js";
|
|
14
14
|
import { default as tt } from "./ProfilePictureUpload.es.js";
|
|
15
15
|
import { default as rt } from "./ProgressBar.es.js";
|
|
16
|
-
import { S as nt } from "./Select-
|
|
16
|
+
import { S as nt } from "./Select-DW30oGym.js";
|
|
17
17
|
import { default as it } from "./Spinner.es.js";
|
|
18
18
|
import { default as ct } from "./Steps.es.js";
|
|
19
19
|
import { default as dt } from "./SwipeContainer.es.js";
|