bmi-next-brokers 3.1.4 → 3.1.6
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/assets/Button.css +1 -1
- package/dist/components/Button/Button.d.ts +6 -1
- package/dist/components/Button/Button.js +69 -55
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/SearchableInputGroup/index.js +31 -31
- package/dist/components/Select/Select.js +68 -67
- package/package.json +1 -1
package/dist/assets/Button.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._button_efl15_1{position:relative;border:none;border-radius:1000px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;font-family:var(--font-regular);font-weight:100;transition:all .2s ease-in-out;width:fit-content}._content_efl15_15{display:inline-flex;align-items:center;justify-content:center;gap:8px}._button_efl15_1:disabled{opacity:.3;cursor:not-allowed}._small_efl15_28{padding:4px 12px;font-size:14px;height:30px}._medium_efl15_34{padding:4px 10px;font-size:16px;height:36px}._large_efl15_40{padding:4px 14px;font-size:18px;height:42px}._extraLarge_efl15_46{padding:4px 16px;font-size:20px;height:48px}._brand_efl15_53{background:var(--Fill-Brand-Inverted-Active, #2054a5);color:#fff}._brand_efl15_53:hover:not(:disabled){background:var(--Fill-Brand-Inverted-Hover, #4f88d9)}._brand_efl15_53:active:not(:disabled){box-shadow:0 0 0 var(--Focused_Stroke, 4px) var(--ui-blue-800, #16396f)}._outline_efl15_66{background-color:transparent;color:var(--Stroke-Brand-Active, #2054a5);border:1px solid var(--Stroke-Brand-Active, #2054a5)}._outline_efl15_66:hover:not(:disabled){border:2px solid var(--Stroke-Brand-Hover, #4f88d9);color:var(--Stroke-Brand-Hover, #4f88d9)}._outline_efl15_66:active{background:var(--Content-Brand-Inverted-Active, #eef3fc);border:none!important;box-shadow:0 0 0 var(--Focused_Stroke, 4px) var(--brand-Azul-digital-BMI-500, #2054a5)}._outlineRed_efl15_84{background-color:transparent;color:var(--Stroke-Danger-Active, #c53030);border:1px solid var(--Stroke-Danger-Active, #c53030)}._outlineRed_efl15_84:hover:not(:disabled){border:2px solid var(--Stroke-Danger-Hover, #e53e3e);color:var(--Stroke-Danger-Hover, #e53e3e)}._outlineRed_efl15_84:active:not(:disabled){background:var(--Content-Danger-Inverted-Active, #fff5f5);border:none!important;box-shadow:0 0 0 var(--Focused_Stroke, 4px) var(--Stroke-Danger-Active, #c53030)}._ghost_efl15_102{background-color:transparent;color:var(--Content-Brand-Default-Active, #2054a5);border:none}._ghost_efl15_102:hover:not(:disabled){font-family:var(--font-medium)}._ghost_efl15_102:active:not(:disabled){background:var(--Fill-Disabled-Default, #f8fafc);box-shadow:0 0 0 var(--Focused_Stroke, 4px) var(--brand-Azul-digital-BMI-500, #2054a5)}._textLink_efl15_119{background-color:transparent;color:var(--Content-Brand-Default-Active, #2054a5);border:none;text-decoration:underline}._textLink_efl15_119:hover:not(:disabled){font-family:var(--font-medium)}._textLink_efl15_119:active:not(:disabled){background:var(--Fill-Disabled-Default, #f8fafc);box-shadow:0 0 0 var(--Focused_Stroke, 4px) var(--brand-Azul-digital-BMI-500, #2054a5)}._secondary_efl15_136{background-color:var(--ui-blue-100);color:var(--Content-Brand-Default-Active, #2054a5);border:none}._button_efl15_1._inverted_efl15_143 svg path{fill:currentColor!important}._button_efl15_1._inverted_efl15_143._brand_efl15_53{background:#fff!important;color:#2054a5!important}._button_efl15_1._inverted_efl15_143._brand_efl15_53:hover:not(:disabled){background:#eef3fc!important;color:#1b468a!important}._button_efl15_1._inverted_efl15_143._brand_efl15_53:active:not(:disabled){box-shadow:0 0 0 3px var(--ui-blue-400, #7eaae6)}._button_efl15_1._inverted_efl15_143._outline_efl15_66{background-color:transparent!important;border:1px solid var(--Stroke-Brand-Active, #fff)}._button_efl15_1._inverted_efl15_143._outline_efl15_66:not(:disabled){border:1px solid var(--Stroke-Brand-Active, #fff);color:var(--Stroke-Brand-Active, #fff);background-color:transparent!important}._button_efl15_1._inverted_efl15_143._outline_efl15_66:hover:not(:disabled){border:2px solid var(--Stroke-Brand-Active, #fff);color:#f8f9fa!important;background-color:transparent!important}._button_efl15_1._inverted_efl15_143._outline_efl15_66:active:not(:disabled){border:2px solid var(--Stroke-Brand-Active, #fff);box-shadow:0 0 0 3px var(--ui-blue-400, #7eaae6)}._button_efl15_1._inverted_efl15_143._ghost_efl15_102{background-color:transparent!important;color:#fff!important;border:none!important}._button_efl15_1._inverted_efl15_143._ghost_efl15_102:hover:not(:disabled){background-color:#ffffff1a!important;color:var(--Stroke-Brand-Innactive, #2054a5)}._button_efl15_1._inverted_efl15_143._textLink_efl15_119{background-color:transparent!important;color:#fff!important;border:none!important;text-decoration:underline!important}._button_efl15_1._inverted_efl15_143._textLink_efl15_119:hover:not(:disabled){color:#f8f9fa!important;background-color:transparent!important}._fullWidth_efl15_209{width:100%}._squaredBorder_efl15_213{border-radius:12px!important}._stack_efl15_220{display:grid;place-items:center}._stack_efl15_220>*{grid-area:1 / 1}._spinner_efl15_225{display:flex;justify-content:center;align-items:center;white-space:nowrap}
|
|
@@ -7,12 +7,17 @@ export interface IconConfig {
|
|
|
7
7
|
name: IconName;
|
|
8
8
|
position: "before" | "after";
|
|
9
9
|
}
|
|
10
|
+
export interface LoadingMessageConfig {
|
|
11
|
+
text: string;
|
|
12
|
+
position?: "before" | "after";
|
|
13
|
+
}
|
|
10
14
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
11
15
|
children: React.ReactNode;
|
|
12
16
|
variant?: ButtonVariant;
|
|
13
17
|
size?: ButtonSize;
|
|
14
18
|
disabled?: boolean;
|
|
15
19
|
loading?: boolean;
|
|
20
|
+
loadingMessage?: LoadingMessageConfig;
|
|
16
21
|
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
17
22
|
className?: string;
|
|
18
23
|
type?: "button" | "submit" | "reset";
|
|
@@ -21,4 +26,4 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
21
26
|
fullWidth?: boolean;
|
|
22
27
|
squared?: boolean;
|
|
23
28
|
}
|
|
24
|
-
export declare const Button: ({ children, variant, size, disabled, loading, onClick, className, type, icon, inverted, fullWidth, squared, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare const Button: ({ children, variant, size, disabled, loading, loadingMessage, onClick, className, type, icon, inverted, fullWidth, squared, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,80 +1,94 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Icon as
|
|
3
|
-
import { Spinner as
|
|
4
|
-
import '../../assets/Button.css';const
|
|
5
|
-
button:
|
|
6
|
-
content:
|
|
7
|
-
small:
|
|
8
|
-
medium:
|
|
9
|
-
large:
|
|
1
|
+
import { jsx as n, jsxs as o, Fragment as a } from "react/jsx-runtime";
|
|
2
|
+
import { Icon as B } from "../../icons/Icon.js";
|
|
3
|
+
import { Spinner as v } from "../Spinner/Spinner.js";
|
|
4
|
+
import '../../assets/Button.css';const q = "_button_efl15_1", N = "_content_efl15_15", R = "_small_efl15_28", W = "_medium_efl15_34", $ = "_large_efl15_40", j = "_extraLarge_efl15_46", C = "_brand_efl15_53", E = "_outline_efl15_66", S = "_outlineRed_efl15_84", F = "_ghost_efl15_102", w = "_textLink_efl15_119", I = "_secondary_efl15_136", A = "_inverted_efl15_143", D = "_fullWidth_efl15_209", G = "_squaredBorder_efl15_213", H = "_stack_efl15_220", J = "_spinner_efl15_225", e = {
|
|
5
|
+
button: q,
|
|
6
|
+
content: N,
|
|
7
|
+
small: R,
|
|
8
|
+
medium: W,
|
|
9
|
+
large: $,
|
|
10
10
|
extraLarge: j,
|
|
11
11
|
brand: C,
|
|
12
|
-
outline:
|
|
12
|
+
outline: E,
|
|
13
13
|
outlineRed: S,
|
|
14
|
-
ghost:
|
|
14
|
+
ghost: F,
|
|
15
15
|
textLink: w,
|
|
16
|
-
secondary:
|
|
17
|
-
inverted:
|
|
18
|
-
fullWidth:
|
|
19
|
-
squaredBorder:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
secondary: I,
|
|
17
|
+
inverted: A,
|
|
18
|
+
fullWidth: D,
|
|
19
|
+
squaredBorder: G,
|
|
20
|
+
stack: H,
|
|
21
|
+
spinner: J
|
|
22
|
+
}, Q = ({
|
|
23
|
+
children: s,
|
|
24
|
+
variant: i = "brand",
|
|
25
|
+
size: r = "medium",
|
|
26
|
+
disabled: f = !1,
|
|
27
|
+
loading: l = !1,
|
|
28
|
+
loadingMessage: t,
|
|
29
|
+
onClick: u,
|
|
30
|
+
className: m,
|
|
29
31
|
type: b = "button",
|
|
30
|
-
icon:
|
|
31
|
-
inverted:
|
|
32
|
-
fullWidth:
|
|
33
|
-
squared:
|
|
34
|
-
...
|
|
32
|
+
icon: _,
|
|
33
|
+
inverted: h = !1,
|
|
34
|
+
fullWidth: p = !1,
|
|
35
|
+
squared: x = !1,
|
|
36
|
+
...k
|
|
35
37
|
}) => {
|
|
36
|
-
const
|
|
38
|
+
const L = [
|
|
37
39
|
e.button,
|
|
38
|
-
|
|
39
|
-
e[
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
].filter(Boolean).join(" "),
|
|
44
|
-
if (!
|
|
45
|
-
const
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
] }) : /* @__PURE__ */
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
i === "outline-red" ? e.outlineRed : e[i],
|
|
41
|
+
e[r],
|
|
42
|
+
h ? e.inverted : "",
|
|
43
|
+
p ? e.fullWidth : "",
|
|
44
|
+
m
|
|
45
|
+
].filter(Boolean).join(" "), c = r === "small" ? 16 : r === "large" ? 20 : r === "extraLarge" ? 24 : 18, y = () => {
|
|
46
|
+
if (!_) return s;
|
|
47
|
+
const d = /* @__PURE__ */ n(B, { name: _.name, width: c, height: c });
|
|
48
|
+
return _.position === "before" ? /* @__PURE__ */ o(a, { children: [
|
|
49
|
+
d,
|
|
50
|
+
s
|
|
51
|
+
] }) : /* @__PURE__ */ o(a, { children: [
|
|
52
|
+
s,
|
|
53
|
+
d
|
|
52
54
|
] });
|
|
53
55
|
};
|
|
54
|
-
return /* @__PURE__ */
|
|
56
|
+
return /* @__PURE__ */ n(
|
|
55
57
|
"button",
|
|
56
58
|
{
|
|
57
59
|
type: b,
|
|
58
|
-
disabled:
|
|
59
|
-
onClick:
|
|
60
|
-
className: `${
|
|
61
|
-
...
|
|
62
|
-
children: [
|
|
63
|
-
|
|
60
|
+
disabled: f || l,
|
|
61
|
+
onClick: u,
|
|
62
|
+
className: `${L} ${x ? e.squaredBorder : ""}`,
|
|
63
|
+
...k,
|
|
64
|
+
children: /* @__PURE__ */ o("span", { className: e.stack, children: [
|
|
65
|
+
l && /* @__PURE__ */ o("span", { className: `${e.spinner} ${e.content}`, children: [
|
|
66
|
+
(t == null ? void 0 : t.position) === "before" && /* @__PURE__ */ n("span", { children: t.text }),
|
|
67
|
+
/* @__PURE__ */ n(
|
|
68
|
+
v,
|
|
69
|
+
{
|
|
70
|
+
thickness: 1.5,
|
|
71
|
+
size: c,
|
|
72
|
+
backgroundColor: "#E2E8F0",
|
|
73
|
+
roundedStroke: !0
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
t && t.position !== "before" && /* @__PURE__ */ n("span", { children: t.text })
|
|
77
|
+
] }),
|
|
64
78
|
/* @__PURE__ */ n(
|
|
65
79
|
"span",
|
|
66
80
|
{
|
|
67
81
|
style: {
|
|
68
|
-
visibility:
|
|
82
|
+
visibility: l ? "hidden" : "visible"
|
|
69
83
|
},
|
|
70
84
|
className: e.content,
|
|
71
|
-
children:
|
|
85
|
+
children: y()
|
|
72
86
|
}
|
|
73
87
|
)
|
|
74
|
-
]
|
|
88
|
+
] })
|
|
75
89
|
}
|
|
76
90
|
);
|
|
77
91
|
};
|
|
78
92
|
export {
|
|
79
|
-
|
|
93
|
+
Q as Button
|
|
80
94
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Button } from './Button';
|
|
2
|
-
export type { ButtonProps, ButtonVariant, ButtonSize } from './Button';
|
|
2
|
+
export type { ButtonProps, ButtonVariant, ButtonSize, LoadingMessageConfig, } from './Button';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as O, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as _, useRef as x, useMemo as Y, useEffect as $ } from "react";
|
|
3
3
|
import { createPortal as Z } from "react-dom";
|
|
4
4
|
import { Input as z } from "../Input/Input.js";
|
|
5
5
|
import { s as e } from "../../Select.module-DaH0FOvY.js";
|
|
6
6
|
import { useBTC as I } from "../../hooks/btcContext/useBtcContext.js";
|
|
7
7
|
import { useDropdownPosition as R } from "../../hooks/useDropdownPosition.js";
|
|
8
|
-
import '../../assets/index4.css';const rr = "_container_1kajw_1", nr = "_inputs_1kajw_7", tr = "_inputWrapper_1kajw_13",
|
|
8
|
+
import '../../assets/index4.css';const rr = "_container_1kajw_1", nr = "_inputs_1kajw_7", tr = "_inputWrapper_1kajw_13", C = {
|
|
9
9
|
container: rr,
|
|
10
10
|
inputs: nr,
|
|
11
11
|
inputWrapper: tr
|
|
@@ -13,53 +13,53 @@ import '../../assets/index4.css';const rr = "_container_1kajw_1", nr = "_inputs_
|
|
|
13
13
|
fields: u,
|
|
14
14
|
selectedItem: s = null,
|
|
15
15
|
options: a = [],
|
|
16
|
-
onSearch:
|
|
17
|
-
onSelect:
|
|
16
|
+
onSearch: f,
|
|
17
|
+
onSelect: S,
|
|
18
18
|
onReset: c,
|
|
19
19
|
noResultMessage: W = "No se encontraron resultados",
|
|
20
|
-
disabled:
|
|
20
|
+
disabled: E = !1,
|
|
21
21
|
btc: F = !1,
|
|
22
22
|
size: m = "medium",
|
|
23
|
-
className:
|
|
23
|
+
className: K,
|
|
24
24
|
containerClassName: L,
|
|
25
25
|
...P
|
|
26
26
|
}) => {
|
|
27
|
-
const { btc: T } = I(), M = F ?? T,
|
|
27
|
+
const { btc: T } = I(), M = F ?? T, g = !!f, [b, h] = _(!1), [j, V] = _(
|
|
28
28
|
{}
|
|
29
|
-
), [o,
|
|
30
|
-
if (!o || !l ||
|
|
29
|
+
), [o, v] = _(null), k = x(null), w = x(null), N = x({}), D = x({}), q = b && !E, l = o ? j[o] ?? "" : "", Q = (r) => typeof r == "string" ? r.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, "").toLowerCase() : "", y = Y(() => {
|
|
30
|
+
if (!o || !l || g) return a;
|
|
31
31
|
const r = u.find((t) => t.key === o);
|
|
32
32
|
if (!r) return a;
|
|
33
33
|
const n = r.columnKey ?? r.key;
|
|
34
34
|
return a.filter(
|
|
35
35
|
(t) => Q(String(t[n] ?? "")).includes(Q(l))
|
|
36
36
|
);
|
|
37
|
-
}, [a, l, o,
|
|
38
|
-
isOpen:
|
|
39
|
-
containerRef:
|
|
40
|
-
dropdownRef:
|
|
37
|
+
}, [a, l, o, g]), A = R({
|
|
38
|
+
isOpen: b,
|
|
39
|
+
containerRef: k,
|
|
40
|
+
dropdownRef: w,
|
|
41
41
|
size: m,
|
|
42
42
|
optionsLength: y.length
|
|
43
43
|
});
|
|
44
|
-
|
|
44
|
+
$(() => {
|
|
45
45
|
const r = (n) => {
|
|
46
|
-
|
|
46
|
+
k.current && !k.current.contains(n.target) && w.current && !w.current.contains(n.target) && (h(!1), v(null));
|
|
47
47
|
};
|
|
48
48
|
return document.addEventListener("mousedown", r), () => document.removeEventListener("mousedown", r);
|
|
49
|
-
}, []),
|
|
49
|
+
}, []), $(() => {
|
|
50
50
|
if (!o) return;
|
|
51
|
-
const r = l.trim(), n = (
|
|
52
|
-
s && r.length > 0 && (y.some(
|
|
51
|
+
const r = l.trim(), n = (N.current[o] ?? "").trim();
|
|
52
|
+
!g && s && r.length > 0 && (y.some(
|
|
53
53
|
(p) => u.every((d) => {
|
|
54
54
|
const B = d.columnKey ?? d.key;
|
|
55
55
|
return String(p[B] ?? "") === String(s[B] ?? "");
|
|
56
56
|
})
|
|
57
|
-
) || c == null || c()), r === "" && n.length > 0 && s && (c == null || c()),
|
|
58
|
-
...
|
|
57
|
+
) || c == null || c()), r === "" && n.length > 0 && s && (c == null || c()), N.current = {
|
|
58
|
+
...N.current,
|
|
59
59
|
[o]: l
|
|
60
60
|
};
|
|
61
|
-
}, [l, o, s, y]),
|
|
62
|
-
if (!s) return;
|
|
61
|
+
}, [l, o, s, y]), $(() => {
|
|
62
|
+
if (!s || g) return;
|
|
63
63
|
a.some(
|
|
64
64
|
(n) => u.every((t) => {
|
|
65
65
|
const p = t.columnKey ?? t.key;
|
|
@@ -68,12 +68,12 @@ import '../../assets/index4.css';const rr = "_container_1kajw_1", nr = "_inputs_
|
|
|
68
68
|
) || c == null || c();
|
|
69
69
|
}, [a]);
|
|
70
70
|
const G = (r, n) => {
|
|
71
|
-
V((t) => ({ ...t, [r]: n })),
|
|
71
|
+
V((t) => ({ ...t, [r]: n })), v(r), h(!0), f == null || f(r, n);
|
|
72
72
|
}, H = (r) => {
|
|
73
|
-
|
|
73
|
+
v(r), b || h(!0);
|
|
74
74
|
}, J = (r) => {
|
|
75
75
|
var n, t;
|
|
76
|
-
|
|
76
|
+
S == null || S(r), h(!1), v(null), o && ((t = (n = D.current[o]) == null ? void 0 : n.querySelector("input")) == null || t.blur());
|
|
77
77
|
}, U = (r) => s ? u.every((n) => {
|
|
78
78
|
const t = n.columnKey ?? n.key;
|
|
79
79
|
return String(r[t] ?? "") === String(s[t] ?? "");
|
|
@@ -89,18 +89,18 @@ import '../../assets/index4.css';const rr = "_container_1kajw_1", nr = "_inputs_
|
|
|
89
89
|
return /* @__PURE__ */ O(
|
|
90
90
|
"div",
|
|
91
91
|
{
|
|
92
|
-
ref:
|
|
93
|
-
className: [
|
|
92
|
+
ref: k,
|
|
93
|
+
className: [C.container, L].filter(Boolean).join(" "),
|
|
94
94
|
children: [
|
|
95
95
|
/* @__PURE__ */ i(
|
|
96
96
|
"div",
|
|
97
97
|
{
|
|
98
|
-
className: `${
|
|
98
|
+
className: `${C.inputs} ${K || ""}`,
|
|
99
99
|
...P,
|
|
100
100
|
children: u.map((r) => /* @__PURE__ */ i(
|
|
101
101
|
"div",
|
|
102
102
|
{
|
|
103
|
-
className:
|
|
103
|
+
className: C.inputWrapper,
|
|
104
104
|
ref: (n) => {
|
|
105
105
|
D.current[r.key] = n;
|
|
106
106
|
},
|
|
@@ -114,7 +114,7 @@ import '../../assets/index4.css';const rr = "_container_1kajw_1", nr = "_inputs_
|
|
|
114
114
|
onFocus: () => H(r.key),
|
|
115
115
|
icon: "SearchIcon",
|
|
116
116
|
size: m,
|
|
117
|
-
disabled:
|
|
117
|
+
disabled: E,
|
|
118
118
|
btc: M
|
|
119
119
|
}
|
|
120
120
|
)
|
|
@@ -127,7 +127,7 @@ import '../../assets/index4.css';const rr = "_container_1kajw_1", nr = "_inputs_
|
|
|
127
127
|
/* @__PURE__ */ i(
|
|
128
128
|
"div",
|
|
129
129
|
{
|
|
130
|
-
ref:
|
|
130
|
+
ref: w,
|
|
131
131
|
className: [
|
|
132
132
|
e.dropdown,
|
|
133
133
|
e[m],
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as p, jsx as l, Fragment as G } from "react/jsx-runtime";
|
|
2
|
-
import { useState as J, useRef as
|
|
2
|
+
import { useState as J, useRef as I, useEffect as K, useMemo as de } from "react";
|
|
3
3
|
import { createPortal as Re } from "react-dom";
|
|
4
4
|
import { s as e } from "../../Select.module-DaH0FOvY.js";
|
|
5
|
-
import { Icon as
|
|
5
|
+
import { Icon as V } from "../../icons/Icon.js";
|
|
6
6
|
import { HelperText as We } from "../helperText/index.js";
|
|
7
7
|
import { FieldError as xe } from "../fieldError/index.js";
|
|
8
8
|
import { useIsMediaQuery as Pe } from "../../hooks/useMediaQuery.js";
|
|
@@ -13,26 +13,26 @@ import { useBTC as Me } from "../../hooks/btcContext/useBtcContext.js";
|
|
|
13
13
|
import { useDropdownPosition as Be } from "../../hooks/useDropdownPosition.js";
|
|
14
14
|
const nr = ({
|
|
15
15
|
size: s = "medium",
|
|
16
|
-
label:
|
|
16
|
+
label: F,
|
|
17
17
|
error: U,
|
|
18
|
-
helperText:
|
|
19
|
-
icon:
|
|
18
|
+
helperText: j,
|
|
19
|
+
icon: _,
|
|
20
20
|
className: ue,
|
|
21
21
|
required: me,
|
|
22
|
-
placeholder:
|
|
22
|
+
placeholder: M = "Seleccionar...",
|
|
23
23
|
options: O = [],
|
|
24
24
|
value: h,
|
|
25
25
|
onChange: a,
|
|
26
|
-
onSearchInput:
|
|
26
|
+
onSearchInput: B,
|
|
27
27
|
disabled: v = !1,
|
|
28
28
|
inverted: g = !1,
|
|
29
29
|
dynamicIcon: fe = !1,
|
|
30
30
|
showPlaceholderIcon: he = !1,
|
|
31
31
|
btc: X,
|
|
32
|
-
columnHeaders:
|
|
32
|
+
columnHeaders: T,
|
|
33
33
|
searchable: pe = !1,
|
|
34
34
|
noSearchResult: Y = "No se encontraron resultados",
|
|
35
|
-
searchAndCheckbox:
|
|
35
|
+
searchAndCheckbox: Q = !1,
|
|
36
36
|
customBorderColor: Z,
|
|
37
37
|
responsive: ge = !1,
|
|
38
38
|
title: $e,
|
|
@@ -40,7 +40,7 @@ const nr = ({
|
|
|
40
40
|
highlightMatch: Ne = !1,
|
|
41
41
|
...Se
|
|
42
42
|
}) => {
|
|
43
|
-
const
|
|
43
|
+
const D = !!B, { btc: ve } = Me(), ye = X ?? ve, [i, y] = J(!1), [m, be] = J(""), c = pe || Q, $ = Q, A = I(null), Oe = I(null), R = I(null), z = I(null), b = I(null), [C, w] = J([]), De = i && !v, Ce = Pe(`(max-width: ${we}px)`), W = ge && Ce && !v;
|
|
44
44
|
K(() => {
|
|
45
45
|
if ($)
|
|
46
46
|
if (Array.isArray(h) && h.length > 0) {
|
|
@@ -59,61 +59,62 @@ const nr = ({
|
|
|
59
59
|
} else
|
|
60
60
|
w((r) => r.length === 0 ? r : []);
|
|
61
61
|
}, [h, O, $]);
|
|
62
|
-
const
|
|
62
|
+
const k = C.map((r) => r.value), o = C[0] ?? null, N = (r) => typeof r == "string" ? r.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, "").toLowerCase() : "", ee = I("");
|
|
63
63
|
K(() => {
|
|
64
64
|
if (!c) return;
|
|
65
65
|
const r = m.trim(), n = ee.current.trim();
|
|
66
66
|
if ($) {
|
|
67
|
-
if (r.length > 0) {
|
|
68
|
-
const d =
|
|
67
|
+
if (r.length > 0 && !D) {
|
|
68
|
+
const d = C.filter(
|
|
69
69
|
(u) => N(u.label).includes(N(r))
|
|
70
70
|
), t = d.map((u) => u.value);
|
|
71
|
-
d.length !==
|
|
71
|
+
d.length !== C.length && (w(d), a && a(t));
|
|
72
72
|
}
|
|
73
73
|
r === "" && n.length > 0 && (w([]), a && a([]));
|
|
74
74
|
} else
|
|
75
|
-
o && r.length > 0 && !N(o.label).includes(N(r)) && (w([]), a && a("")), r === "" && n.length > 0 && (w([]), a && a(""));
|
|
75
|
+
!D && o && r.length > 0 && !N(o.label).includes(N(r)) && (w([]), a && a("")), r === "" && n.length > 0 && (w([]), a && a(""));
|
|
76
76
|
ee.current = m;
|
|
77
77
|
}, [
|
|
78
78
|
m,
|
|
79
79
|
o,
|
|
80
|
-
|
|
80
|
+
C,
|
|
81
81
|
$,
|
|
82
82
|
c,
|
|
83
|
+
D,
|
|
83
84
|
a
|
|
84
85
|
]);
|
|
85
|
-
const re = de(() => c ? i ? m : !$ && o ? o.label : $ &&
|
|
86
|
+
const re = de(() => c ? i ? m : !$ && o ? o.label : $ && k.length > 0 ? `${k.length} ${k.length === 1 ? "seleccionado" : "seleccionados"}` : "" : "", [
|
|
86
87
|
c,
|
|
87
88
|
i,
|
|
88
89
|
m,
|
|
89
90
|
o,
|
|
90
|
-
|
|
91
|
+
k,
|
|
91
92
|
$
|
|
92
|
-
]), te = (r) =>
|
|
93
|
+
]), te = (r) => C.some((n) => n.value === r), x = de(() => !c || !m || D ? O : O.filter(
|
|
93
94
|
(r) => N(r.label).includes(N(m))
|
|
94
|
-
), [O, m, c,
|
|
95
|
+
), [O, m, c, D]), E = (() => {
|
|
95
96
|
if (U) return U;
|
|
96
|
-
if (c && m && m.trim().length > 0 &&
|
|
97
|
+
if (c && m && m.trim().length > 0 && x.length === 0 && !i && !h)
|
|
97
98
|
return Y;
|
|
98
99
|
})();
|
|
99
100
|
K(() => {
|
|
100
101
|
const r = (n) => {
|
|
101
|
-
A.current && !A.current.contains(n.target) &&
|
|
102
|
+
A.current && !A.current.contains(n.target) && R.current && !R.current.contains(n.target) && y(!1);
|
|
102
103
|
};
|
|
103
104
|
return document.addEventListener("mousedown", r), () => {
|
|
104
105
|
document.removeEventListener("mousedown", r);
|
|
105
106
|
};
|
|
106
|
-
}, [c,
|
|
107
|
+
}, [c, D, o]);
|
|
107
108
|
const Le = [
|
|
108
109
|
e.select,
|
|
109
110
|
ye && e.btc,
|
|
110
111
|
e[s],
|
|
111
|
-
|
|
112
|
+
E ? e.error : "",
|
|
112
113
|
v ? e.disabled : "",
|
|
113
114
|
i ? e.open : "",
|
|
114
115
|
g ? e.inverted : "",
|
|
115
116
|
ue
|
|
116
|
-
].filter(Boolean).join(" "),
|
|
117
|
+
].filter(Boolean).join(" "), L = s === "small" ? 16 : s === "large" ? 20 : s === "extraLarge" ? 24 : 18, ne = fe && (o != null && o.icon) && !(c && i) ? o.icon : _, Ie = () => {
|
|
117
118
|
var r;
|
|
118
119
|
v || (y(!i), c && !i && (se(), (r = b.current) == null || r.focus()));
|
|
119
120
|
}, q = (r, n = !0) => {
|
|
@@ -125,20 +126,20 @@ const nr = ({
|
|
|
125
126
|
a(r), n && y(!1);
|
|
126
127
|
}, le = (r) => {
|
|
127
128
|
const n = r.target.value;
|
|
128
|
-
be(n), i || y(!0),
|
|
129
|
+
be(n), i || y(!0), B && B(n);
|
|
129
130
|
}, se = () => {
|
|
130
131
|
i || y(!0);
|
|
131
132
|
}, _e = (r) => {
|
|
132
|
-
|
|
133
|
+
W && (r.preventDefault(), r.stopPropagation()), c && (r.stopPropagation(), i || (y(!0), b.current && (b.current.readOnly = !1, b.current.focus())));
|
|
133
134
|
}, H = (r, n) => {
|
|
134
135
|
if (!Ne || !n.trim()) return r;
|
|
135
136
|
const d = N(r), t = N(n.trim());
|
|
136
137
|
if (!d.includes(t)) return r;
|
|
137
138
|
const u = [], f = [];
|
|
138
|
-
for (let
|
|
139
|
-
const Qe = N(r[
|
|
139
|
+
for (let P = 0; P < r.length; P++) {
|
|
140
|
+
const Qe = N(r[P]);
|
|
140
141
|
for (let oe = 0; oe < Qe.length; oe++)
|
|
141
|
-
f.push(
|
|
142
|
+
f.push(P);
|
|
142
143
|
}
|
|
143
144
|
const S = d.indexOf(t), Te = S + t.length - 1, ae = f[S], ie = f[Te] + 1;
|
|
144
145
|
return u.push(r.slice(0, ae)), u.push(
|
|
@@ -147,12 +148,12 @@ const nr = ({
|
|
|
147
148
|
}, ke = Be({
|
|
148
149
|
isOpen: i,
|
|
149
150
|
containerRef: z,
|
|
150
|
-
dropdownRef:
|
|
151
|
+
dropdownRef: R,
|
|
151
152
|
size: s,
|
|
152
|
-
optionsLength:
|
|
153
|
-
label:
|
|
154
|
-
helperText:
|
|
155
|
-
displayError:
|
|
153
|
+
optionsLength: x.length,
|
|
154
|
+
label: F,
|
|
155
|
+
helperText: j,
|
|
156
|
+
displayError: E
|
|
156
157
|
}), ce = ({
|
|
157
158
|
insideDrawer: r = !1,
|
|
158
159
|
handleOptionClickProp: n
|
|
@@ -160,15 +161,15 @@ const nr = ({
|
|
|
160
161
|
const d = (t) => {
|
|
161
162
|
n ? n(t) : q(t);
|
|
162
163
|
};
|
|
163
|
-
return
|
|
164
|
+
return x.length > 0 ? x.map((t, u) => /* @__PURE__ */ p(
|
|
164
165
|
"div",
|
|
165
166
|
{
|
|
166
|
-
className: `${e.option} ${r ? e.isDrawer : ""} ${te(t.value) ? e.optionSelected : ""} ${g ? e.option_inverted : ""} ${t.columns ? e.optionTable : ""} ${
|
|
167
|
+
className: `${e.option} ${r ? e.isDrawer : ""} ${te(t.value) ? e.optionSelected : ""} ${g ? e.option_inverted : ""} ${t.columns ? e.optionTable : ""} ${Q ? e.optionWithCheckbox : ""}`,
|
|
167
168
|
onClick: (f) => {
|
|
168
169
|
f.stopPropagation(), d(t.value);
|
|
169
170
|
},
|
|
170
171
|
children: [
|
|
171
|
-
|
|
172
|
+
Q && /* @__PURE__ */ l(
|
|
172
173
|
"input",
|
|
173
174
|
{
|
|
174
175
|
type: "checkbox",
|
|
@@ -178,7 +179,7 @@ const nr = ({
|
|
|
178
179
|
className: e.optionCheckbox
|
|
179
180
|
}
|
|
180
181
|
),
|
|
181
|
-
t.columns ? /* @__PURE__ */ l(G, { children:
|
|
182
|
+
t.columns ? /* @__PURE__ */ l(G, { children: T && Object.entries(T).map(([f, S]) => /* @__PURE__ */ p("div", { className: e.tableColumn, children: [
|
|
182
183
|
/* @__PURE__ */ l("div", { className: `${e.columnHeader} ${e[s]}`, children: S }),
|
|
183
184
|
/* @__PURE__ */ l("div", { className: `${e.columnValue} ${e[s]}`, children: H(
|
|
184
185
|
String(t.columns[f] ?? ""),
|
|
@@ -187,12 +188,12 @@ const nr = ({
|
|
|
187
188
|
] }, f)) }) : (
|
|
188
189
|
//opción tiene descripción
|
|
189
190
|
t.description ? /* @__PURE__ */ p("div", { className: e.optionWithDescriptionWrapper, children: [
|
|
190
|
-
(t.icon ||
|
|
191
|
-
|
|
191
|
+
(t.icon || _) && /* @__PURE__ */ l(
|
|
192
|
+
V,
|
|
192
193
|
{
|
|
193
|
-
name: t.icon ||
|
|
194
|
-
width:
|
|
195
|
-
height:
|
|
194
|
+
name: t.icon || _,
|
|
195
|
+
width: L,
|
|
196
|
+
height: L
|
|
196
197
|
}
|
|
197
198
|
),
|
|
198
199
|
/* @__PURE__ */ p("div", { className: e.optionWithDescription, children: [
|
|
@@ -200,12 +201,12 @@ const nr = ({
|
|
|
200
201
|
/* @__PURE__ */ l("span", { className: e.optionWithDescriptionValue, children: t.description })
|
|
201
202
|
] })
|
|
202
203
|
] }) : /* @__PURE__ */ p(G, { children: [
|
|
203
|
-
(t.icon ||
|
|
204
|
-
|
|
204
|
+
(t.icon || _) && /* @__PURE__ */ l("div", { className: e.optionIcon, children: /* @__PURE__ */ l(
|
|
205
|
+
V,
|
|
205
206
|
{
|
|
206
|
-
name: t.icon ||
|
|
207
|
-
width:
|
|
208
|
-
height:
|
|
207
|
+
name: t.icon || _,
|
|
208
|
+
width: L,
|
|
209
|
+
height: L
|
|
209
210
|
}
|
|
210
211
|
) }),
|
|
211
212
|
/* @__PURE__ */ l("div", { style: { whiteSpace: "pre-line", lineHeight: 1.25 }, children: H(t.label, m) })
|
|
@@ -222,7 +223,7 @@ const nr = ({
|
|
|
222
223
|
return /* @__PURE__ */ l(
|
|
223
224
|
"div",
|
|
224
225
|
{
|
|
225
|
-
className: `${e.dropdown} ${e.isDrawer} ${e[s]} ${g ? e.dropdown_inverted : ""} ${
|
|
226
|
+
className: `${e.dropdown} ${e.isDrawer} ${e[s]} ${g ? e.dropdown_inverted : ""} ${T ? e.dropdownTable : ""} ${c ? e.dropdownSearchable : ""}`,
|
|
226
227
|
children: /* @__PURE__ */ l(
|
|
227
228
|
ce,
|
|
228
229
|
{
|
|
@@ -240,12 +241,12 @@ const nr = ({
|
|
|
240
241
|
className: `${e.selectContainer} ${s === "medium" ? e.selectContainer_medium : s === "large" ? e.selectContainer_large : s === "extraLarge" ? e.selectContainer_extraLarge : ""} ${v ? e.disabled : ""}`,
|
|
241
242
|
...Se,
|
|
242
243
|
children: [
|
|
243
|
-
|
|
244
|
+
F && /* @__PURE__ */ p(
|
|
244
245
|
"label",
|
|
245
246
|
{
|
|
246
247
|
className: `${e.label} ${s === "large" ? e.label_large : ""} ${s === "extraLarge" ? e.label_extraLarge : ""} ${g ? e.label_inverted : ""} ${v ? e.disabled : ""} `,
|
|
247
248
|
children: [
|
|
248
|
-
|
|
249
|
+
F,
|
|
249
250
|
/* @__PURE__ */ l(
|
|
250
251
|
"span",
|
|
251
252
|
{
|
|
@@ -271,11 +272,11 @@ const nr = ({
|
|
|
271
272
|
{
|
|
272
273
|
className: `${e.icon} ${g ? e.icon_inverted : ""}`,
|
|
273
274
|
children: /* @__PURE__ */ l(
|
|
274
|
-
|
|
275
|
+
V,
|
|
275
276
|
{
|
|
276
277
|
name: c ? "SearchIcon" : ne,
|
|
277
|
-
width:
|
|
278
|
-
height:
|
|
278
|
+
width: L,
|
|
279
|
+
height: L
|
|
279
280
|
}
|
|
280
281
|
)
|
|
281
282
|
}
|
|
@@ -285,27 +286,27 @@ const nr = ({
|
|
|
285
286
|
{
|
|
286
287
|
ref: b,
|
|
287
288
|
value: re,
|
|
288
|
-
className: `${e.selectInput} ${!o && !i &&
|
|
289
|
-
placeholder:
|
|
289
|
+
className: `${e.selectInput} ${!o && !i && k.length === 0 ? e.placeholder : ""}`,
|
|
290
|
+
placeholder: M,
|
|
290
291
|
onChange: le,
|
|
291
292
|
onFocus: se,
|
|
292
293
|
onClick: _e,
|
|
293
294
|
onTouchStart: () => {
|
|
294
|
-
!
|
|
295
|
+
!W && b.current && (b.current.readOnly = !1);
|
|
295
296
|
},
|
|
296
297
|
disabled: v,
|
|
297
|
-
readOnly:
|
|
298
|
+
readOnly: W || !i
|
|
298
299
|
}
|
|
299
300
|
) : /* @__PURE__ */ l(
|
|
300
301
|
"span",
|
|
301
302
|
{
|
|
302
303
|
className: `${e.selectValue} ${o ? "" : e.placeholder}`,
|
|
303
|
-
children: o ? o.label :
|
|
304
|
+
children: o ? o.label : M
|
|
304
305
|
}
|
|
305
306
|
)
|
|
306
307
|
] }),
|
|
307
308
|
/* @__PURE__ */ l(
|
|
308
|
-
|
|
309
|
+
V,
|
|
309
310
|
{
|
|
310
311
|
name: "ArrowDown",
|
|
311
312
|
width: 16,
|
|
@@ -316,7 +317,7 @@ const nr = ({
|
|
|
316
317
|
]
|
|
317
318
|
}
|
|
318
319
|
),
|
|
319
|
-
|
|
320
|
+
W ? /* @__PURE__ */ p(
|
|
320
321
|
Ve,
|
|
321
322
|
{
|
|
322
323
|
className: e.drawerSelect,
|
|
@@ -329,7 +330,7 @@ const nr = ({
|
|
|
329
330
|
c && /* @__PURE__ */ l("div", { className: e.drawerSearchInput, children: /* @__PURE__ */ l(
|
|
330
331
|
je,
|
|
331
332
|
{
|
|
332
|
-
placeholder:
|
|
333
|
+
placeholder: M,
|
|
333
334
|
size: s,
|
|
334
335
|
icon: "SearchIcon",
|
|
335
336
|
value: re,
|
|
@@ -344,8 +345,8 @@ const nr = ({
|
|
|
344
345
|
/* @__PURE__ */ l(
|
|
345
346
|
"div",
|
|
346
347
|
{
|
|
347
|
-
ref:
|
|
348
|
-
className: `${e.dropdown} ${e[s]} ${e.dropdownPortal} ${g ? e.dropdown_inverted : ""} ${
|
|
348
|
+
ref: R,
|
|
349
|
+
className: `${e.dropdown} ${e[s]} ${e.dropdownPortal} ${g ? e.dropdown_inverted : ""} ${T ? e.dropdownTable : ""} ${c ? e.dropdownSearchable : ""}`,
|
|
349
350
|
style: ke,
|
|
350
351
|
children: /* @__PURE__ */ l(ce, {})
|
|
351
352
|
}
|
|
@@ -353,8 +354,8 @@ const nr = ({
|
|
|
353
354
|
document.getElementById("root") || document.body
|
|
354
355
|
)
|
|
355
356
|
] }),
|
|
356
|
-
|
|
357
|
-
|
|
357
|
+
E && /* @__PURE__ */ l(xe, { message: E, size: s, inverted: g }),
|
|
358
|
+
j && !E && /* @__PURE__ */ l(We, { message: j, size: s, inverted: g })
|
|
358
359
|
]
|
|
359
360
|
}
|
|
360
361
|
);
|
package/package.json
CHANGED