prometeo-design-system 4.2.5 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Avatar.es.js +41 -40
- package/dist/CardProfile-C1F83KJV.js +280 -0
- package/dist/CardProfile.es.js +3 -291
- package/dist/CheckBox.es.js +21 -24
- package/dist/DialogModal.es.js +46 -52
- package/dist/Icons/UserAvatar.es.js +4 -4
- package/dist/Input.es.js +72 -73
- package/dist/NotificationCard.es.js +21 -27
- package/dist/PlainTooltip.es.js +19 -19
- package/dist/PyrionLayout.es.js +786 -879
- package/dist/Scrollable.es.js +127 -201
- package/dist/Select.es.js +47 -47
- package/dist/SelectSearch.es.js +83 -85
- package/dist/TabLinks.es.js +121 -2
- package/dist/TicketCard.es.js +2 -2
- package/dist/badge-CbqYNrl4.js +87 -0
- package/dist/components/Avatar/Avatar.d.ts +4 -2
- package/dist/components/CardProfile/CardProfile.d.ts +4 -7
- package/dist/components/DropZone/useFileDropzone.d.ts +1 -9
- package/dist/components/Layout/LayoutGeneric.d.ts +6 -0
- package/dist/components/NotificationCard/NotificationCard.d.ts +2 -3
- package/dist/components/PyrionNavigationDrawer/PLNotificationsList.d.ts +2 -5
- package/dist/components/PyrionNavigationDrawer/PLSidebar.d.ts +1 -3
- package/dist/components/PyrionNavigationDrawer/PLSidebarContent.d.ts +0 -2
- package/dist/components/PyrionNavigationDrawer/PLayoutBase.d.ts +0 -2
- package/dist/components/PyrionNavigationDrawer/PyrionLayout.d.ts +1 -3
- package/dist/components/Scrollable/Scrollable.d.ts +0 -19
- package/dist/components/Sidebar/SecondaryBar/SecondaryBar.d.ts +32 -0
- package/dist/components/Sidebar/SecondaryBar/hooks/useSecondaryBarAnimation.d.ts +2 -0
- package/dist/components/Sidebar/SecondaryBar/index.d.ts +1 -0
- package/dist/components/Sidebar/SidebarComposable.d.ts +43 -0
- package/dist/components/Sidebar/components/NavigationLink.d.ts +11 -0
- package/dist/components/Sidebar/components/company-logo.d.ts +5 -0
- package/dist/components/Sidebar/components/nav-actions.d.ts +7 -0
- package/dist/components/Sidebar/components/nav-links.d.ts +7 -0
- package/dist/components/Sidebar/context/SidebarContext.d.ts +13 -0
- package/dist/components/Sidebar/hooks/SidebarProvider.d.ts +3 -0
- package/dist/components/Sidebar/hooks/useNavBarActions.d.ts +9 -0
- package/dist/components/Sidebar/hooks/useNavBarCollapse.d.ts +4 -0
- package/dist/components/Sidebar/hooks/useNavLinks.d.ts +32 -0
- package/dist/components/Sidebar/hooks/useSidebarHook.d.ts +13 -0
- package/dist/components/Sidebar/index.d.ts +12 -0
- package/dist/components/Sidebar/ui/useNavbarAnimation.d.ts +2 -0
- package/dist/components/TabLinks/TabLinks.d.ts +0 -19
- package/dist/components/UserCard/UserCard.d.ts +2 -3
- package/dist/hooks/useLabelBackground.d.ts +0 -1
- package/dist/index.d.ts +16 -0
- package/dist/prometeo-design-system.es.js +2906 -119
- package/dist/styles.css +1 -1
- package/dist/useLabelBackground-BDIHUdND.js +26 -0
- package/package.json +2 -2
- package/src/styles/base.css +46 -0
- package/dist/TabLinks-DxqprStp.js +0 -147
- package/dist/UserCard.d.ts +0 -6
- package/dist/UserCard.es.js +0 -28
- package/dist/badge-BEx-0Q-K.js +0 -35
- package/dist/exports/UserCard.d.ts +0 -2
- package/dist/useLabelBackground-D5SzHhl_.js +0 -32
package/dist/Select.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { j as a } from "./jsx-runtime-GkKLlHH4.js";
|
|
2
2
|
import { c as d } from "./cn-B6yFEsav.js";
|
|
3
|
-
import
|
|
3
|
+
import we, { memo as J, useState as Ne, useRef as ae, useMemo as te, useCallback as _, useEffect as he, 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";
|
|
7
|
-
import { u as et } from "./useLabelBackground-
|
|
7
|
+
import { u as et } from "./useLabelBackground-BDIHUdND.js";
|
|
8
8
|
import { H as tt } from "./HelperComponent-ljsn0xD6.js";
|
|
9
9
|
import { Close as nt } from "./Icons/Close.es.js";
|
|
10
10
|
import rt from "./CheckBox.es.js";
|
|
@@ -127,7 +127,7 @@ function ct(e) {
|
|
|
127
127
|
}
|
|
128
128
|
), je = ae(null), pe = ae(/* @__PURE__ */ new Set()), {
|
|
129
129
|
id: G,
|
|
130
|
-
name:
|
|
130
|
+
name: w,
|
|
131
131
|
label: ge,
|
|
132
132
|
height: be,
|
|
133
133
|
options: Q,
|
|
@@ -242,7 +242,7 @@ function ct(e) {
|
|
|
242
242
|
if (!m) return;
|
|
243
243
|
const z = l.has(m.id), A = o ?? "toggle";
|
|
244
244
|
let T;
|
|
245
|
-
A === "select" || A === "toggle" && !z ? T = m : T = void 0, e.onChange?.(T,
|
|
245
|
+
A === "select" || A === "toggle" && !z ? T = m : T = void 0, e.onChange?.(T, w);
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
248
|
const i = e.value || [], f = [];
|
|
@@ -253,18 +253,18 @@ function ct(e) {
|
|
|
253
253
|
const D = new Set(f.map((m) => m.id)), M = new Set(c.map((m) => m.id)), I = c.every(
|
|
254
254
|
(m) => D.has(m.id)
|
|
255
255
|
), fe = o ?? "toggle", me = fe === "select" || fe === "toggle" && !I;
|
|
256
|
-
let
|
|
256
|
+
let Se;
|
|
257
257
|
if (!me)
|
|
258
|
-
|
|
258
|
+
Se = f.filter((m) => !M.has(m.id));
|
|
259
259
|
else {
|
|
260
260
|
const m = new Map(
|
|
261
261
|
f.map((z) => [z.id, z])
|
|
262
262
|
);
|
|
263
263
|
c.forEach((z) => {
|
|
264
264
|
m.set(z.id, z);
|
|
265
|
-
}),
|
|
265
|
+
}), Se = Array.from(m.values());
|
|
266
266
|
}
|
|
267
|
-
e.onChange?.(
|
|
267
|
+
e.onChange?.(Se, w);
|
|
268
268
|
},
|
|
269
269
|
[
|
|
270
270
|
e.multiple,
|
|
@@ -273,14 +273,14 @@ function ct(e) {
|
|
|
273
273
|
Ce,
|
|
274
274
|
l,
|
|
275
275
|
L,
|
|
276
|
-
|
|
276
|
+
w
|
|
277
277
|
]
|
|
278
278
|
), C = _(() => {
|
|
279
279
|
h((t) => !t);
|
|
280
280
|
}, []);
|
|
281
281
|
B.current = (t) => {
|
|
282
282
|
if (!e.multiple)
|
|
283
|
-
e.onChange?.(t,
|
|
283
|
+
e.onChange?.(t, w);
|
|
284
284
|
else {
|
|
285
285
|
const o = e.value || [], c = [], i = o.includes(t.value);
|
|
286
286
|
o.forEach((D) => {
|
|
@@ -290,37 +290,37 @@ function ct(e) {
|
|
|
290
290
|
M && c.push(M);
|
|
291
291
|
});
|
|
292
292
|
const f = i ? c.filter((D) => D.value !== t.value) : [...c, t];
|
|
293
|
-
e.onChange?.(f,
|
|
293
|
+
e.onChange?.(f, w);
|
|
294
294
|
}
|
|
295
295
|
};
|
|
296
|
-
const
|
|
296
|
+
const S = _(
|
|
297
297
|
(t, o = !1) => {
|
|
298
|
-
q?.(t,
|
|
298
|
+
q?.(t, w), B.current?.(t), o && (h(!1), ke?.());
|
|
299
299
|
},
|
|
300
|
-
[q, ke,
|
|
300
|
+
[q, ke, w]
|
|
301
301
|
), x = (t) => {
|
|
302
302
|
if (t.preventDefault(), t.stopPropagation(), t.target.blur(), ye?.(), e.multiple) {
|
|
303
303
|
const o = e.onChange;
|
|
304
|
-
o?.([],
|
|
304
|
+
o?.([], w);
|
|
305
305
|
} else {
|
|
306
306
|
const o = e.onChange;
|
|
307
|
-
o?.(void 0,
|
|
307
|
+
o?.(void 0, w);
|
|
308
308
|
}
|
|
309
309
|
}, O = _(
|
|
310
310
|
(t) => {
|
|
311
|
-
e.multiple || e.onChange?.(void 0,
|
|
311
|
+
e.multiple || e.onChange?.(void 0, w);
|
|
312
312
|
const o = R.find(
|
|
313
313
|
(i) => k(i, N) === t
|
|
314
314
|
);
|
|
315
315
|
if (!o) return;
|
|
316
316
|
const c = L(o);
|
|
317
|
-
q?.(c,
|
|
317
|
+
q?.(c, w), B.current?.(c), Oe?.(o);
|
|
318
318
|
},
|
|
319
319
|
[
|
|
320
320
|
q,
|
|
321
321
|
Oe,
|
|
322
322
|
R,
|
|
323
|
-
|
|
323
|
+
w,
|
|
324
324
|
e.multiple,
|
|
325
325
|
e.onChange,
|
|
326
326
|
L,
|
|
@@ -366,13 +366,13 @@ function ct(e) {
|
|
|
366
366
|
h(!1);
|
|
367
367
|
},
|
|
368
368
|
toggle: () => h((t) => !t),
|
|
369
|
-
handleOptionSelect:
|
|
369
|
+
handleOptionSelect: S,
|
|
370
370
|
subscribeOpenChange: (t) => (pe.current.add(t), () => {
|
|
371
371
|
pe.current.delete(t);
|
|
372
372
|
}),
|
|
373
373
|
searchInputRef: P
|
|
374
374
|
}),
|
|
375
|
-
[n,
|
|
375
|
+
[n, S]
|
|
376
376
|
);
|
|
377
377
|
const ee = (t) => {
|
|
378
378
|
t.preventDefault(), t.stopPropagation(), t.target.matches(":focus-visible") && !Me && !n && (h(!0), setTimeout(() => {
|
|
@@ -433,7 +433,7 @@ function ct(e) {
|
|
|
433
433
|
"div",
|
|
434
434
|
{
|
|
435
435
|
className: d(
|
|
436
|
-
"flex-1 overflow-x-auto overflow-y-hidden px-1 prometeo-scrollbar-none
|
|
436
|
+
"flex-1 overflow-x-auto overflow-y-hidden px-1 prometeo-scrollbar-none "
|
|
437
437
|
),
|
|
438
438
|
ref: Pe,
|
|
439
439
|
onPointerUp: V.onPointerUp,
|
|
@@ -442,7 +442,7 @@ function ct(e) {
|
|
|
442
442
|
onPointerLeave: V.onPointerLeave,
|
|
443
443
|
onPointerCancel: V.onPointerCancel,
|
|
444
444
|
onClickCapture: V.onClickCapture,
|
|
445
|
-
children: De ?
|
|
445
|
+
children: De ? we.createElement(
|
|
446
446
|
J(
|
|
447
447
|
De,
|
|
448
448
|
(t, o) => t.disabled === o.disabled && t.multiple === o.multiple
|
|
@@ -540,7 +540,7 @@ function ct(e) {
|
|
|
540
540
|
dropdownRef: p,
|
|
541
541
|
selectButtonRef: W,
|
|
542
542
|
helperComponentRef: je,
|
|
543
|
-
onOptionClick:
|
|
543
|
+
onOptionClick: S,
|
|
544
544
|
onCloseDropdown: () => h(!1),
|
|
545
545
|
searchValue: _e,
|
|
546
546
|
setSearchValue: b,
|
|
@@ -589,7 +589,7 @@ function ft({
|
|
|
589
589
|
labelVariant: je,
|
|
590
590
|
emptyMessage: pe,
|
|
591
591
|
renderOption: G,
|
|
592
|
-
renderOptionContext:
|
|
592
|
+
renderOptionContext: w,
|
|
593
593
|
renderOptionGroupHeader: ge,
|
|
594
594
|
onOptionClick: be,
|
|
595
595
|
onSearchClear: Q,
|
|
@@ -646,8 +646,8 @@ function ft({
|
|
|
646
646
|
}, ue = () => {
|
|
647
647
|
if (!p.current || !b.current) return ie;
|
|
648
648
|
const r = b.current.getBoundingClientRect(), l = window.innerHeight - (window.innerHeight - r.top), s = window.innerHeight - r.bottom, u = s >= le, C = l >= le;
|
|
649
|
-
let
|
|
650
|
-
return u ? (
|
|
649
|
+
let S = "down", x;
|
|
650
|
+
return u ? (S = "down", x = le) : C ? (S = "up", x = le) : s > l ? (S = "down", x = s - 16) : (S = "up", x = l - 16), { direction: S, height: x };
|
|
651
651
|
}, $e = (r) => {
|
|
652
652
|
if (!(!p.current || !b.current)) {
|
|
653
653
|
if (p.current.style.transition = "max-height 0.2s ease,opacity 0.2s ease", !r) {
|
|
@@ -695,18 +695,18 @@ function ft({
|
|
|
695
695
|
}
|
|
696
696
|
const s = [];
|
|
697
697
|
let u = null, C = [];
|
|
698
|
-
const
|
|
698
|
+
const S = () => {
|
|
699
699
|
u && C.length > 0 && s.push(u, ...C), u = null, C = [];
|
|
700
700
|
};
|
|
701
701
|
return r.forEach((x) => {
|
|
702
702
|
if (typeof x != "object" || x === null) return;
|
|
703
703
|
if ((x || {})?.isGroupHeader) {
|
|
704
|
-
|
|
704
|
+
S(), u = x;
|
|
705
705
|
return;
|
|
706
706
|
}
|
|
707
707
|
const O = Fe(x.label, l);
|
|
708
708
|
u ? O && C.push(x) : O && s.push(x);
|
|
709
|
-
}),
|
|
709
|
+
}), S(), s;
|
|
710
710
|
}, _e = (r) => {
|
|
711
711
|
const l = Ge(y, r);
|
|
712
712
|
if (U(l), j) {
|
|
@@ -769,7 +769,7 @@ function ft({
|
|
|
769
769
|
F.current?.focus(), se();
|
|
770
770
|
}, 10);
|
|
771
771
|
}, Ce = Array.from({ length: 5 }).map(
|
|
772
|
-
(r, l) => G ?
|
|
772
|
+
(r, l) => G ? we.createElement(
|
|
773
773
|
J(G, (s, u) => s.isSelected === u.isSelected && s.option === u.option && s.disabled === u.disabled && s.multiple === u.multiple && s.renderContext === u.renderContext),
|
|
774
774
|
{
|
|
775
775
|
key: `skeleton-option-${l}`,
|
|
@@ -780,7 +780,7 @@ function ft({
|
|
|
780
780
|
},
|
|
781
781
|
disabled: !1,
|
|
782
782
|
isLoading: !0,
|
|
783
|
-
renderContext:
|
|
783
|
+
renderContext: w
|
|
784
784
|
}
|
|
785
785
|
) : /* @__PURE__ */ a.jsx(
|
|
786
786
|
Ke,
|
|
@@ -807,13 +807,13 @@ function ft({
|
|
|
807
807
|
N ? "absolute z-50 " : "fixed z-100 top-0 left-0",
|
|
808
808
|
ie.direction === "up" ? "h-auto" : " h-max",
|
|
809
809
|
ze,
|
|
810
|
-
"
|
|
810
|
+
"min-w-max"
|
|
811
811
|
),
|
|
812
812
|
children: /* @__PURE__ */ a.jsxs(
|
|
813
813
|
"div",
|
|
814
814
|
{
|
|
815
815
|
className: d(
|
|
816
|
-
"flex flex-col",
|
|
816
|
+
"flex flex-col ",
|
|
817
817
|
xe ? "p-0" : "p-2 pt-0 gap-2"
|
|
818
818
|
),
|
|
819
819
|
style: {
|
|
@@ -842,10 +842,10 @@ function ft({
|
|
|
842
842
|
...H
|
|
843
843
|
}
|
|
844
844
|
),
|
|
845
|
-
/* @__PURE__ */ a.jsx("div", { className: " overflow-y-auto flex-1 max-h-max
|
|
845
|
+
/* @__PURE__ */ a.jsx("div", { className: " overflow-y-auto flex-1 max-h-max ", children: oe.length === 0 ? X ? /* @__PURE__ */ a.jsx("div", { className: "flex flex-col gap-1 overflow-hidden w-full", children: De || Ce }) : /* @__PURE__ */ a.jsx("div", { className: "px-3 py-2 text-neutral-medium-default", children: B ? `No se encontraron resultados para "${B}"` : pe }) : (() => {
|
|
846
846
|
let r = !0;
|
|
847
847
|
return oe.map((l) => {
|
|
848
|
-
const s = l, u = !!(s || {}).isGroupHeader, C = G && !u ? k(l, W) : s.id,
|
|
848
|
+
const s = l, u = !!(s || {}).isGroupHeader, C = G && !u ? k(l, W) : s.id, S = re.has(C), x = (i) => !G || u ? i : {
|
|
849
849
|
id: C,
|
|
850
850
|
label: String(k(i, P)),
|
|
851
851
|
value: k(i, W)
|
|
@@ -871,7 +871,7 @@ function ft({
|
|
|
871
871
|
onKeyDown: (M) => R(M, f),
|
|
872
872
|
className: d(
|
|
873
873
|
!D && !v && "focus-visible:bg-neutral-medium-hover outline-none hover:bg-neutral-medium-hover",
|
|
874
|
-
|
|
874
|
+
S && "bg-neutral-medium-selected",
|
|
875
875
|
v && "cursor-default pointer-events-none"
|
|
876
876
|
),
|
|
877
877
|
children: i
|
|
@@ -887,14 +887,14 @@ function ft({
|
|
|
887
887
|
q && Le(f, m);
|
|
888
888
|
}, me = (m) => {
|
|
889
889
|
!I || I.length === 0 || ye && ye(I, m);
|
|
890
|
-
},
|
|
890
|
+
}, Se = I.filter(
|
|
891
891
|
(m) => re.has(k(m, W))
|
|
892
892
|
).map((m) => String(k(m, W)));
|
|
893
893
|
if (ge) {
|
|
894
894
|
const m = J(
|
|
895
895
|
ge,
|
|
896
896
|
(A, T) => A.label === T.label && A.group === T.group && A.groupOptions === T.groupOptions && A.disabled === T.disabled && A.multiple === T.multiple && A.expanded === T.expanded && A.renderContext === T.renderContext
|
|
897
|
-
), z =
|
|
897
|
+
), z = we.createElement(m, {
|
|
898
898
|
group: M,
|
|
899
899
|
label: i,
|
|
900
900
|
groupOptions: I,
|
|
@@ -903,8 +903,8 @@ function ft({
|
|
|
903
903
|
expanded: D,
|
|
904
904
|
toggleGroup: fe,
|
|
905
905
|
selectGroup: me,
|
|
906
|
-
renderContext:
|
|
907
|
-
groupSelectedIds:
|
|
906
|
+
renderContext: w,
|
|
907
|
+
groupSelectedIds: Se
|
|
908
908
|
});
|
|
909
909
|
return ee(z, s);
|
|
910
910
|
}
|
|
@@ -931,7 +931,7 @@ function ft({
|
|
|
931
931
|
s
|
|
932
932
|
);
|
|
933
933
|
}
|
|
934
|
-
const de = G ?
|
|
934
|
+
const de = G ? we.createElement(
|
|
935
935
|
J(
|
|
936
936
|
G,
|
|
937
937
|
(i, f) => i.isSelected === f.isSelected && i.option === f.option && i.disabled === f.disabled && i.multiple === f.multiple && i.renderContext === f.renderContext
|
|
@@ -939,12 +939,12 @@ function ft({
|
|
|
939
939
|
{
|
|
940
940
|
key: C,
|
|
941
941
|
option: l,
|
|
942
|
-
isSelected:
|
|
942
|
+
isSelected: S,
|
|
943
943
|
multiple: g,
|
|
944
944
|
onSelect: O,
|
|
945
945
|
disabled: v,
|
|
946
946
|
isLoading: X,
|
|
947
|
-
renderContext:
|
|
947
|
+
renderContext: w
|
|
948
948
|
}
|
|
949
949
|
) : /* @__PURE__ */ a.jsx(
|
|
950
950
|
Ke,
|
|
@@ -952,7 +952,7 @@ function ft({
|
|
|
952
952
|
disabled: v,
|
|
953
953
|
multiple: g,
|
|
954
954
|
isLoading: X,
|
|
955
|
-
isSelected:
|
|
955
|
+
isSelected: S,
|
|
956
956
|
onSelect: Z,
|
|
957
957
|
option: l
|
|
958
958
|
},
|
|
@@ -964,7 +964,7 @@ function ft({
|
|
|
964
964
|
if (!q)
|
|
965
965
|
return t;
|
|
966
966
|
const o = !r, c = t;
|
|
967
|
-
return
|
|
967
|
+
return we.cloneElement(c, {
|
|
968
968
|
className: d(
|
|
969
969
|
c.props.className,
|
|
970
970
|
"overflow-hidden transition-[max-height] duration-300 ease-out",
|
|
@@ -1039,7 +1039,7 @@ const Je = J(
|
|
|
1039
1039
|
multiple: g,
|
|
1040
1040
|
className: v,
|
|
1041
1041
|
disabled: b
|
|
1042
|
-
}) => e?.length === 0 ? n ? /* @__PURE__ */ a.jsx("span", { className: "text-neutral-medium-default line-clamp-1", children: n }) : null : y === "chips" && g ? /* @__PURE__ */ a.jsx("div", { className: d("flex items-center gap-1 ", v), children: e.map((H) => /* @__PURE__ */ a.jsx(
|
|
1042
|
+
}) => e?.length === 0 ? n ? /* @__PURE__ */ a.jsx("span", { className: "text-neutral-medium-default opacity-50 line-clamp-1", children: n }) : null : y === "chips" && g ? /* @__PURE__ */ a.jsx("div", { className: d("flex items-center gap-1 ", v), children: e.map((H) => /* @__PURE__ */ a.jsx(
|
|
1043
1043
|
it,
|
|
1044
1044
|
{
|
|
1045
1045
|
tabIndex: -1,
|
package/dist/SelectSearch.es.js
CHANGED
|
@@ -1,117 +1,117 @@
|
|
|
1
1
|
import { j as Y } from "./jsx-runtime-GkKLlHH4.js";
|
|
2
2
|
import { g as i } from "./utils-X4-h3cum.js";
|
|
3
|
-
import { useState as A, useRef as E, useEffect as b, useMemo as ee, useCallback as
|
|
3
|
+
import { useState as A, useRef as E, useEffect as b, useMemo as ee, useCallback as te } from "react";
|
|
4
4
|
import Z from "./Select.es.js";
|
|
5
5
|
function re(e) {
|
|
6
6
|
const {
|
|
7
|
-
options:
|
|
7
|
+
options: p,
|
|
8
8
|
fetcher: d,
|
|
9
9
|
asyncMode: _ = "fetch_in_open",
|
|
10
10
|
disabled: w = !1,
|
|
11
11
|
debounceDelay: P = 500,
|
|
12
12
|
minCharacters: T = 3,
|
|
13
13
|
optionLabel: h,
|
|
14
|
-
optionValue:
|
|
14
|
+
optionValue: s,
|
|
15
15
|
controlledValue: f,
|
|
16
16
|
isOpen: F,
|
|
17
|
-
inputRef:
|
|
17
|
+
inputRef: y,
|
|
18
18
|
name: I
|
|
19
|
-
} = e || {}, M =
|
|
19
|
+
} = e || {}, M = p ? p.filter((t) => t != null) : [], [V, g] = A(M || []), [D, k] = A(M || []), [c, N] = A(""), [W, C] = A(!1), [J, U] = A(!1), l = E(null), O = E(null), m = E(!1), L = E(d), S = e?.multiple === !0 || !1, j = E(S ? [] : void 0), [a, v] = A(S ? [] : void 0);
|
|
20
20
|
b(() => {
|
|
21
|
-
|
|
21
|
+
L.current = d;
|
|
22
22
|
}, [d]), b(() => {
|
|
23
|
-
if (
|
|
24
|
-
const
|
|
25
|
-
|
|
23
|
+
if (S) {
|
|
24
|
+
const t = z(f, "value");
|
|
25
|
+
v(t);
|
|
26
26
|
} else
|
|
27
|
-
f != null ?
|
|
27
|
+
f != null ? v(f) : v(void 0);
|
|
28
28
|
}, [f]), b(() => {
|
|
29
29
|
j.current = f !== void 0 ? f : a;
|
|
30
30
|
}, [f, a]), b(() => {
|
|
31
31
|
if (e?.options) {
|
|
32
|
-
const
|
|
33
|
-
g(
|
|
32
|
+
const t = e.options.filter((n) => n != null);
|
|
33
|
+
g(t), k(t);
|
|
34
34
|
}
|
|
35
35
|
}, [e?.options]);
|
|
36
|
-
const B = ee(() => (
|
|
37
|
-
l.current && clearTimeout(l.current), l.current = setTimeout(() =>
|
|
38
|
-
}), [
|
|
39
|
-
const
|
|
36
|
+
const B = ee(() => (t, n) => new Promise((o, r) => {
|
|
37
|
+
l.current && clearTimeout(l.current), l.current = setTimeout(() => t(c).then(o).catch(r), n);
|
|
38
|
+
}), [c]), ne = (t) => {
|
|
39
|
+
const n = f !== void 0, o = (r) => s ? i(r, s) : i(r, "id");
|
|
40
40
|
if (e?.multiple === !0) {
|
|
41
41
|
const r = j.current || [];
|
|
42
42
|
let u;
|
|
43
|
-
r.some((x) => o(x) === o(
|
|
43
|
+
r.some((x) => o(x) === o(t)) ? u = r.filter((x) => o(x) !== o(t)) : u = [...r, t], n ? (j.current = u, e?.onChange?.(u, I)) : (j.current = u, v(u), e?.onChange?.(u, I));
|
|
44
44
|
} else
|
|
45
|
-
|
|
46
|
-
}, q = (
|
|
45
|
+
n ? (j.current = t, e?.onChange?.(t, I)) : (j.current = t, v(t), e?.onChange?.(t, I));
|
|
46
|
+
}, q = (t) => (e?.onFetchingStart?.(), L.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})`), []), $ = te((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]);
|
|
47
47
|
b(() => {
|
|
48
|
-
const
|
|
49
|
-
if (!
|
|
50
|
-
const
|
|
48
|
+
const t = e?.subscribeOpenChange;
|
|
49
|
+
if (!t) return;
|
|
50
|
+
const n = t((o) => {
|
|
51
51
|
U(o);
|
|
52
52
|
});
|
|
53
53
|
return () => {
|
|
54
|
-
|
|
54
|
+
n && n();
|
|
55
55
|
};
|
|
56
56
|
}, [e?.subscribeOpenChange]);
|
|
57
57
|
const G = F !== void 0 ? F : J;
|
|
58
58
|
b(() => {
|
|
59
|
-
if (!w &&
|
|
60
|
-
if (!
|
|
61
|
-
l.current && clearTimeout(l.current),
|
|
59
|
+
if (!w && L.current && _ === "fetch_on_type") {
|
|
60
|
+
if (!c || c === "" || c.length < T) {
|
|
61
|
+
l.current && clearTimeout(l.current), C(!1);
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
const o = z(
|
|
64
|
+
const t = B(q, P);
|
|
65
|
+
C(!0), t.then((n) => {
|
|
66
|
+
const o = z(n);
|
|
67
67
|
g(o);
|
|
68
68
|
}).finally(() => {
|
|
69
|
-
|
|
69
|
+
C(!1), e?.onFetchingEnd?.();
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
}, [_,
|
|
72
|
+
}, [_, c, w, P, B, T]), b(() => {
|
|
73
73
|
if (!w)
|
|
74
74
|
if (G) {
|
|
75
75
|
if (e?.onOpen?.(), _ === "fetch_in_open") {
|
|
76
|
-
if (!
|
|
76
|
+
if (!L.current)
|
|
77
77
|
return;
|
|
78
|
-
|
|
79
|
-
const
|
|
78
|
+
C(!0), q().then((t) => {
|
|
79
|
+
const n = z(t);
|
|
80
80
|
g(() => {
|
|
81
|
-
const o =
|
|
82
|
-
if (
|
|
83
|
-
return i(r,
|
|
81
|
+
const o = n.filter((r) => {
|
|
82
|
+
if (s)
|
|
83
|
+
return i(r, s) !== void 0;
|
|
84
84
|
});
|
|
85
|
-
return
|
|
85
|
+
return S && a.length > 0 ? [...$(a, o), ...a] : o;
|
|
86
86
|
});
|
|
87
87
|
}).finally(() => {
|
|
88
|
-
|
|
88
|
+
C(!1), e?.onFetchingEnd?.();
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
} else
|
|
92
92
|
e?.onClose?.();
|
|
93
93
|
}, [G, _, w]);
|
|
94
|
-
const H = (
|
|
94
|
+
const H = (t, n) => t?.filter((o) => {
|
|
95
95
|
if (h)
|
|
96
|
-
return i(o, h)?.toLowerCase().includes(
|
|
96
|
+
return i(o, h)?.toLowerCase().includes(n.toLowerCase());
|
|
97
97
|
{
|
|
98
98
|
const r = o;
|
|
99
99
|
switch (typeof r) {
|
|
100
100
|
case "string":
|
|
101
|
-
return r?.toLowerCase().includes(
|
|
101
|
+
return r?.toLowerCase().includes(n.toLowerCase());
|
|
102
102
|
case "number":
|
|
103
|
-
return r.toString().includes(
|
|
103
|
+
return r.toString().includes(n);
|
|
104
104
|
case "object":
|
|
105
|
-
return Object.values(r).some((R) => R.toString()?.toLowerCase().includes(
|
|
105
|
+
return Object.values(r).some((R) => R.toString()?.toLowerCase().includes(n.toLowerCase()));
|
|
106
106
|
default:
|
|
107
107
|
return !1;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
}) || [], oe = (
|
|
110
|
+
}) || [], oe = (t) => t?.sort((n, o) => {
|
|
111
111
|
if (h)
|
|
112
|
-
return i(
|
|
112
|
+
return i(n, h) < i(o, h) ? -1 : 1;
|
|
113
113
|
{
|
|
114
|
-
const u = ["label", "name", "value"].find((K) => typeof
|
|
114
|
+
const u = ["label", "name", "value"].find((K) => typeof n == "object" && Object.keys(n).includes(K)), R = n, x = o;
|
|
115
115
|
switch (typeof R) {
|
|
116
116
|
case "string":
|
|
117
117
|
return R < x ? -1 : 1;
|
|
@@ -119,7 +119,7 @@ function re(e) {
|
|
|
119
119
|
return R < x ? -1 : 1;
|
|
120
120
|
case "object":
|
|
121
121
|
if (u) {
|
|
122
|
-
const K = i(
|
|
122
|
+
const K = i(n, u), le = i(o, u);
|
|
123
123
|
return K < le ? -1 : 1;
|
|
124
124
|
} else
|
|
125
125
|
return 1;
|
|
@@ -127,21 +127,21 @@ function re(e) {
|
|
|
127
127
|
return 1;
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
}) || [], Q = (
|
|
131
|
-
const
|
|
132
|
-
|
|
130
|
+
}) || [], Q = (t) => {
|
|
131
|
+
const n = typeof y == "function" ? y() : y;
|
|
132
|
+
t.target === n?.current && (O.current && clearTimeout(O.current), m.current || (m.current = !0, e?.onTypeStart?.()), O.current = setTimeout(() => {
|
|
133
133
|
m.current = !1;
|
|
134
134
|
}, P));
|
|
135
135
|
};
|
|
136
136
|
b(() => {
|
|
137
|
-
if (
|
|
137
|
+
if (c === "")
|
|
138
138
|
k(oe(V));
|
|
139
|
-
else if (
|
|
140
|
-
const
|
|
141
|
-
k([...H(
|
|
139
|
+
else if (S) {
|
|
140
|
+
const t = $(a, V);
|
|
141
|
+
k([...H(t, c), ...a]);
|
|
142
142
|
} else {
|
|
143
|
-
const
|
|
144
|
-
k([...H(
|
|
143
|
+
const t = $([a], V);
|
|
144
|
+
k([...H(t, c), a]);
|
|
145
145
|
}
|
|
146
146
|
}, [V]), b(() => (document.addEventListener("keydown", Q), () => {
|
|
147
147
|
document.removeEventListener("keydown", Q);
|
|
@@ -150,31 +150,31 @@ function re(e) {
|
|
|
150
150
|
N("");
|
|
151
151
|
};
|
|
152
152
|
return {
|
|
153
|
-
inputValue:
|
|
153
|
+
inputValue: c,
|
|
154
154
|
setInputValue: N,
|
|
155
155
|
cleanInputValue: X,
|
|
156
156
|
cleanOptions: () => {
|
|
157
|
-
if (
|
|
157
|
+
if (S)
|
|
158
158
|
g(a);
|
|
159
159
|
else {
|
|
160
|
-
const
|
|
161
|
-
g(
|
|
160
|
+
const t = a;
|
|
161
|
+
g(t ? [t] : []);
|
|
162
162
|
}
|
|
163
163
|
X();
|
|
164
164
|
},
|
|
165
165
|
clearValue: () => {
|
|
166
|
-
|
|
166
|
+
v(S ? [] : void 0);
|
|
167
167
|
},
|
|
168
168
|
filteredOptions: D,
|
|
169
169
|
isLoading: W,
|
|
170
170
|
value: a,
|
|
171
|
-
setValue:
|
|
172
|
-
onOptionClick:
|
|
171
|
+
setValue: v,
|
|
172
|
+
onOptionClick: ne
|
|
173
173
|
};
|
|
174
174
|
}
|
|
175
175
|
const he = (e) => {
|
|
176
|
-
const
|
|
177
|
-
const
|
|
176
|
+
const p = E(null), { asyncMode: d = "fetch_in_open" } = e, _ = (l, O, m) => {
|
|
177
|
+
const L = {
|
|
178
178
|
options: l.options,
|
|
179
179
|
fetcher: l.fetcher,
|
|
180
180
|
asyncMode: O,
|
|
@@ -194,36 +194,36 @@ const he = (e) => {
|
|
|
194
194
|
name: l.name
|
|
195
195
|
};
|
|
196
196
|
return l.multiple ? {
|
|
197
|
-
...
|
|
197
|
+
...L,
|
|
198
198
|
multiple: !0,
|
|
199
199
|
controlledValue: l.value,
|
|
200
200
|
onChange: l.onChange
|
|
201
201
|
} : {
|
|
202
|
-
...
|
|
202
|
+
...L,
|
|
203
203
|
multiple: !1,
|
|
204
204
|
controlledValue: l.value,
|
|
205
205
|
onChange: l.onChange
|
|
206
206
|
};
|
|
207
|
-
}, { inputValue: w, setInputValue: P, filteredOptions: T, isLoading: h, value:
|
|
207
|
+
}, { inputValue: w, setInputValue: P, filteredOptions: T, isLoading: h, value: s, onOptionClick: f, cleanInputValue: F, cleanOptions: y, clearValue: I } = re(_(e, d, p));
|
|
208
208
|
b(() => {
|
|
209
|
-
!e.controls || !
|
|
210
|
-
...
|
|
209
|
+
!e.controls || !p.current || (e.controls.current = {
|
|
210
|
+
...p.current,
|
|
211
211
|
cleanOptions: () => {
|
|
212
|
-
|
|
212
|
+
y();
|
|
213
213
|
}
|
|
214
214
|
});
|
|
215
|
-
}, [e.controls,
|
|
216
|
-
const M =
|
|
215
|
+
}, [e.controls, y]);
|
|
216
|
+
const M = te(
|
|
217
217
|
() => d === "fetch_on_type" ? h : !1,
|
|
218
218
|
[d, h]
|
|
219
|
-
), V = ee(() => e.multiple ?
|
|
219
|
+
), V = ee(() => e.multiple ? s.map((l) => i(l, e.optionValue)) : s ? i(s, e.optionValue) : void 0, [s, e.optionValue, e.multiple]), g = (l) => {
|
|
220
220
|
const O = T.find((m) => i(m, e.optionValue) === l.id);
|
|
221
221
|
O && f(O);
|
|
222
|
-
}, { displayMode: D = e.multiple ? "chips" : "compact", dropdownOptions: k, overflow:
|
|
222
|
+
}, { displayMode: D = e.multiple ? "chips" : "compact", dropdownOptions: k, overflow: c = "scroll", onChange: N, onClear: W, ...C } = e.selectComponentProps || {}, J = {
|
|
223
223
|
controledSearchValue: w,
|
|
224
224
|
onSearchValueChange: d === "fetch_on_type" ? P : void 0,
|
|
225
225
|
onSearchClear: d === "fetch_on_type" ? () => {
|
|
226
|
-
F(),
|
|
226
|
+
F(), y();
|
|
227
227
|
} : void 0,
|
|
228
228
|
inputSearchPlaceholder: e.inputSearchPlaceholder,
|
|
229
229
|
isLoading: M(),
|
|
@@ -238,8 +238,8 @@ const he = (e) => {
|
|
|
238
238
|
disabled: e.disabled,
|
|
239
239
|
className: e.className,
|
|
240
240
|
name: e.name,
|
|
241
|
-
overflow:
|
|
242
|
-
...
|
|
241
|
+
overflow: c,
|
|
242
|
+
...C,
|
|
243
243
|
onClear: e?.selectComponentProps?.onClear && U,
|
|
244
244
|
multiple: !0,
|
|
245
245
|
value: V,
|
|
@@ -248,10 +248,9 @@ const he = (e) => {
|
|
|
248
248
|
optionValue: e.optionValue,
|
|
249
249
|
optionLabel: e.optionLabel,
|
|
250
250
|
renderOption: e.renderOption,
|
|
251
|
-
renderSelection: e.renderSelection,
|
|
252
251
|
onOptionClick: g,
|
|
253
252
|
displayMode: D,
|
|
254
|
-
controls:
|
|
253
|
+
controls: p,
|
|
255
254
|
emptyMessage: "Use el buscador para obtener las opciones disponibles",
|
|
256
255
|
dropdownOptions: J,
|
|
257
256
|
isLoading: d === "fetch_in_open" ? h : !1
|
|
@@ -260,10 +259,10 @@ const he = (e) => {
|
|
|
260
259
|
Z,
|
|
261
260
|
{
|
|
262
261
|
disabled: e.disabled,
|
|
263
|
-
...
|
|
262
|
+
...C,
|
|
264
263
|
onClear: U,
|
|
265
264
|
className: e.className,
|
|
266
|
-
overflow:
|
|
265
|
+
overflow: c,
|
|
267
266
|
name: e.name,
|
|
268
267
|
multiple: !1,
|
|
269
268
|
value: V,
|
|
@@ -272,10 +271,9 @@ const he = (e) => {
|
|
|
272
271
|
optionValue: e.optionValue,
|
|
273
272
|
optionLabel: e.optionLabel,
|
|
274
273
|
renderOption: e.renderOption,
|
|
275
|
-
renderSelection: e.renderSelection,
|
|
276
274
|
onOptionClick: g,
|
|
277
275
|
displayMode: "compact",
|
|
278
|
-
controls:
|
|
276
|
+
controls: p,
|
|
279
277
|
emptyMessage: "Use el buscador para obtener las opciones disponibles",
|
|
280
278
|
dropdownOptions: J,
|
|
281
279
|
isLoading: d === "fetch_in_open" ? h : !1
|