bmi-next-brokers 2.5.8 → 2.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Select/Select.js +61 -58
- package/dist/main.d.ts +1 -0
- package/package.json +1 -1
|
@@ -6,8 +6,8 @@ import { Icon as W } 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";
|
|
9
|
-
import { Drawer as
|
|
10
|
-
import { useClose as
|
|
9
|
+
import { Drawer as Ve } from "../drawer/index.js";
|
|
10
|
+
import { useClose as Fe } from "../../hooks/useClose.js";
|
|
11
11
|
import { Input as je } from "../Input/Input.js";
|
|
12
12
|
import { useBTC as Me } from "../../hooks/btcContext/useBtcContext.js";
|
|
13
13
|
import { useDropdownPosition as Be } from "../../hooks/useDropdownPosition.js";
|
|
@@ -19,12 +19,12 @@ const nr = ({
|
|
|
19
19
|
icon: L,
|
|
20
20
|
className: ue,
|
|
21
21
|
required: me,
|
|
22
|
-
placeholder:
|
|
23
|
-
options:
|
|
22
|
+
placeholder: V = "Seleccionar...",
|
|
23
|
+
options: y = [],
|
|
24
24
|
value: f,
|
|
25
25
|
onChange: i,
|
|
26
|
-
onSearchInput:
|
|
27
|
-
disabled:
|
|
26
|
+
onSearchInput: F,
|
|
27
|
+
disabled: v = !1,
|
|
28
28
|
inverted: g = !1,
|
|
29
29
|
dynamicIcon: he = !1,
|
|
30
30
|
showPlaceholderIcon: fe = !1,
|
|
@@ -40,32 +40,35 @@ const nr = ({
|
|
|
40
40
|
highlightMatch: Ne = !1,
|
|
41
41
|
...Se
|
|
42
42
|
}) => {
|
|
43
|
-
const j = !!
|
|
43
|
+
const j = !!F, { btc: ve } = Me(), be = X ?? ve, [a, b] = J(!1), [m, ye] = J(""), s = pe || E, $ = E, M = C(null), Oe = C(null), T = C(null), z = C(null), B = C(null), [O, w] = J([]), De = a && !v, Ce = Pe(`(max-width: ${we}px)`), A = ge && Ce && !v;
|
|
44
44
|
K(() => {
|
|
45
45
|
if ($)
|
|
46
46
|
if (Array.isArray(f) && f.length > 0) {
|
|
47
|
-
const r =
|
|
48
|
-
w((n) =>
|
|
47
|
+
const r = y.filter((n) => f.includes(n.value)), t = r.map((n) => n.value);
|
|
48
|
+
w((n) => {
|
|
49
|
+
const u = n.map((S) => S.value);
|
|
50
|
+
return u.length === r.length && r.every((S) => u.includes(S.value)) ? n : r;
|
|
51
|
+
}), (t.length !== f.length || !t.every((n) => f.includes(n))) && i && i(t);
|
|
49
52
|
} else
|
|
50
53
|
w((r) => r.length === 0 ? r : []);
|
|
51
54
|
else if (f) {
|
|
52
|
-
const r =
|
|
55
|
+
const r = y.find((t) => t.value === f);
|
|
53
56
|
r ? w(
|
|
54
57
|
(t) => t.length === 1 && t[0].value === r.value ? t : [r]
|
|
55
58
|
) : (w((t) => t.length === 0 ? t : []), i && i(""));
|
|
56
59
|
} else
|
|
57
60
|
w((r) => r.length === 0 ? r : []);
|
|
58
|
-
}, [f,
|
|
59
|
-
const I =
|
|
61
|
+
}, [f, y, $]);
|
|
62
|
+
const I = O.map((r) => r.value), o = O[0] ?? null, N = (r) => typeof r == "string" ? r.normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, "").toLowerCase() : "", ee = C("");
|
|
60
63
|
K(() => {
|
|
61
64
|
if (!s) return;
|
|
62
65
|
const r = m.trim(), t = ee.current.trim();
|
|
63
66
|
if ($) {
|
|
64
67
|
if (r.length > 0) {
|
|
65
|
-
const d =
|
|
66
|
-
(
|
|
67
|
-
), n = d.map((
|
|
68
|
-
d.length !==
|
|
68
|
+
const d = O.filter(
|
|
69
|
+
(u) => N(u.label).includes(N(r))
|
|
70
|
+
), n = d.map((u) => u.value);
|
|
71
|
+
d.length !== O.length && (w(d), i && i(n));
|
|
69
72
|
}
|
|
70
73
|
r === "" && t.length > 0 && (w([]), i && i([]));
|
|
71
74
|
} else
|
|
@@ -74,7 +77,7 @@ const nr = ({
|
|
|
74
77
|
}, [
|
|
75
78
|
m,
|
|
76
79
|
o,
|
|
77
|
-
|
|
80
|
+
O,
|
|
78
81
|
$,
|
|
79
82
|
s,
|
|
80
83
|
i
|
|
@@ -86,16 +89,16 @@ const nr = ({
|
|
|
86
89
|
o,
|
|
87
90
|
I,
|
|
88
91
|
$
|
|
89
|
-
]), te = (r) =>
|
|
92
|
+
]), te = (r) => O.some((t) => t.value === r), Q = de(() => !s || !m || j ? y : y.filter(
|
|
90
93
|
(r) => N(r.label).includes(N(m))
|
|
91
|
-
), [
|
|
94
|
+
), [y, m, s, j]), _ = (() => {
|
|
92
95
|
if (U) return U;
|
|
93
96
|
if (s && m && m.trim().length > 0 && Q.length === 0 && !a && !f)
|
|
94
97
|
return Y;
|
|
95
98
|
})();
|
|
96
99
|
K(() => {
|
|
97
100
|
const r = (t) => {
|
|
98
|
-
M.current && !M.current.contains(t.target) && T.current && !T.current.contains(t.target) &&
|
|
101
|
+
M.current && !M.current.contains(t.target) && T.current && !T.current.contains(t.target) && b(!1);
|
|
99
102
|
};
|
|
100
103
|
return document.addEventListener("mousedown", r), () => {
|
|
101
104
|
document.removeEventListener("mousedown", r);
|
|
@@ -106,27 +109,27 @@ const nr = ({
|
|
|
106
109
|
be && e.btc,
|
|
107
110
|
e[c],
|
|
108
111
|
_ ? e.error : "",
|
|
109
|
-
|
|
112
|
+
v ? e.disabled : "",
|
|
110
113
|
a ? e.open : "",
|
|
111
114
|
g ? e.inverted : "",
|
|
112
115
|
ue
|
|
113
|
-
].filter(Boolean).join(" "),
|
|
116
|
+
].filter(Boolean).join(" "), D = c === "small" ? 16 : c === "large" ? 20 : c === "extraLarge" ? 24 : 18, ne = he && (o != null && o.icon) && !(s && a) ? o.icon : L, Ie = () => {
|
|
114
117
|
var r;
|
|
115
|
-
|
|
118
|
+
v || (b(!a), s && !a && (se(), (r = B.current) == null || r.focus()));
|
|
116
119
|
}, q = (r, t = !0) => {
|
|
117
120
|
if (i)
|
|
118
121
|
if ($) {
|
|
119
|
-
const d = Array.isArray(f) ? f : [],
|
|
120
|
-
i(
|
|
122
|
+
const d = Array.isArray(f) ? f : [], u = d.includes(r) ? d.filter((h) => h !== r) : [...d, r];
|
|
123
|
+
i(u);
|
|
121
124
|
} else
|
|
122
|
-
i(r), t &&
|
|
125
|
+
i(r), t && b(!1);
|
|
123
126
|
}, le = (r) => {
|
|
124
127
|
const t = r.target.value;
|
|
125
|
-
ye(t), a ||
|
|
128
|
+
ye(t), a || b(!0), F && F(t);
|
|
126
129
|
}, se = () => {
|
|
127
|
-
a ||
|
|
130
|
+
a || b(!0);
|
|
128
131
|
}, _e = (r) => {
|
|
129
|
-
A && (r.preventDefault(), r.stopPropagation()), s && (r.stopPropagation(), a || (
|
|
132
|
+
A && (r.preventDefault(), r.stopPropagation()), s && (r.stopPropagation(), a || (b(!0), setTimeout(() => {
|
|
130
133
|
var t;
|
|
131
134
|
(t = B.current) == null || t.focus();
|
|
132
135
|
}, 0)));
|
|
@@ -134,16 +137,16 @@ const nr = ({
|
|
|
134
137
|
if (!Ne || !t.trim()) return r;
|
|
135
138
|
const d = N(r), n = N(t.trim());
|
|
136
139
|
if (!d.includes(n)) return r;
|
|
137
|
-
const
|
|
140
|
+
const u = [], h = [];
|
|
138
141
|
for (let R = 0; R < r.length; R++) {
|
|
139
142
|
const Qe = N(r[R]);
|
|
140
143
|
for (let oe = 0; oe < Qe.length; oe++)
|
|
141
|
-
|
|
144
|
+
h.push(R);
|
|
142
145
|
}
|
|
143
|
-
const
|
|
144
|
-
return
|
|
146
|
+
const S = d.indexOf(n), Te = S + n.length - 1, ie = h[S], ae = h[Te] + 1;
|
|
147
|
+
return u.push(r.slice(0, ie)), u.push(
|
|
145
148
|
/* @__PURE__ */ l("mark", { className: e.highlight, children: r.slice(ie, ae) }, "highlight")
|
|
146
|
-
),
|
|
149
|
+
), u.push(r.slice(ae)), /* @__PURE__ */ l(G, { children: u });
|
|
147
150
|
}, ke = Be({
|
|
148
151
|
isOpen: a,
|
|
149
152
|
containerRef: z,
|
|
@@ -161,12 +164,12 @@ const nr = ({
|
|
|
161
164
|
const d = (n) => {
|
|
162
165
|
t ? t(n) : q(n);
|
|
163
166
|
};
|
|
164
|
-
return Q.length > 0 ? Q.map((n,
|
|
167
|
+
return Q.length > 0 ? Q.map((n, u) => /* @__PURE__ */ p(
|
|
165
168
|
"div",
|
|
166
169
|
{
|
|
167
170
|
className: `${e.option} ${r ? e.isDrawer : ""} ${te(n.value) ? e.optionSelected : ""} ${g ? e.option_inverted : ""} ${n.columns ? e.optionTable : ""} ${E ? e.optionWithCheckbox : ""}`,
|
|
168
|
-
onClick: (
|
|
169
|
-
|
|
171
|
+
onClick: (h) => {
|
|
172
|
+
h.stopPropagation(), d(n.value);
|
|
170
173
|
},
|
|
171
174
|
children: [
|
|
172
175
|
E && /* @__PURE__ */ l(
|
|
@@ -175,25 +178,25 @@ const nr = ({
|
|
|
175
178
|
type: "checkbox",
|
|
176
179
|
checked: te(n.value),
|
|
177
180
|
onChange: () => q(n.value),
|
|
178
|
-
onClick: (
|
|
181
|
+
onClick: (h) => h.stopPropagation(),
|
|
179
182
|
className: e.optionCheckbox
|
|
180
183
|
}
|
|
181
184
|
),
|
|
182
|
-
n.columns ? /* @__PURE__ */ l(G, { children: k && Object.entries(k).map(([
|
|
183
|
-
/* @__PURE__ */ l("div", { className: `${e.columnHeader} ${e[c]}`, children:
|
|
185
|
+
n.columns ? /* @__PURE__ */ l(G, { children: k && Object.entries(k).map(([h, S]) => /* @__PURE__ */ p("div", { className: e.tableColumn, children: [
|
|
186
|
+
/* @__PURE__ */ l("div", { className: `${e.columnHeader} ${e[c]}`, children: S }),
|
|
184
187
|
/* @__PURE__ */ l("div", { className: `${e.columnValue} ${e[c]}`, children: H(
|
|
185
|
-
String(n.columns[
|
|
188
|
+
String(n.columns[h] ?? ""),
|
|
186
189
|
m
|
|
187
190
|
) })
|
|
188
|
-
] },
|
|
191
|
+
] }, h)) }) : (
|
|
189
192
|
//opción tiene descripción
|
|
190
193
|
n.description ? /* @__PURE__ */ p("div", { className: e.optionWithDescriptionWrapper, children: [
|
|
191
194
|
(n.icon || L) && /* @__PURE__ */ l(
|
|
192
195
|
W,
|
|
193
196
|
{
|
|
194
197
|
name: n.icon || L,
|
|
195
|
-
width:
|
|
196
|
-
height:
|
|
198
|
+
width: D,
|
|
199
|
+
height: D
|
|
197
200
|
}
|
|
198
201
|
),
|
|
199
202
|
/* @__PURE__ */ p("div", { className: e.optionWithDescription, children: [
|
|
@@ -205,8 +208,8 @@ const nr = ({
|
|
|
205
208
|
W,
|
|
206
209
|
{
|
|
207
210
|
name: n.icon || L,
|
|
208
|
-
width:
|
|
209
|
-
height:
|
|
211
|
+
width: D,
|
|
212
|
+
height: D
|
|
210
213
|
}
|
|
211
214
|
) }),
|
|
212
215
|
/* @__PURE__ */ l("div", { style: { whiteSpace: "pre-line", lineHeight: 1.25 }, children: H(n.label, m) })
|
|
@@ -214,10 +217,10 @@ const nr = ({
|
|
|
214
217
|
)
|
|
215
218
|
]
|
|
216
219
|
},
|
|
217
|
-
|
|
220
|
+
u
|
|
218
221
|
)) : /* @__PURE__ */ l("span", { className: e.noResults, children: Y });
|
|
219
222
|
}, Ee = () => {
|
|
220
|
-
const r =
|
|
223
|
+
const r = Fe(), t = (d) => {
|
|
221
224
|
q(d, !1), $ || r();
|
|
222
225
|
};
|
|
223
226
|
return /* @__PURE__ */ l(
|
|
@@ -238,13 +241,13 @@ const nr = ({
|
|
|
238
241
|
"div",
|
|
239
242
|
{
|
|
240
243
|
ref: z,
|
|
241
|
-
className: `${e.selectContainer} ${c === "medium" ? e.selectContainer_medium : c === "large" ? e.selectContainer_large : c === "extraLarge" ? e.selectContainer_extraLarge : ""} ${
|
|
244
|
+
className: `${e.selectContainer} ${c === "medium" ? e.selectContainer_medium : c === "large" ? e.selectContainer_large : c === "extraLarge" ? e.selectContainer_extraLarge : ""} ${v ? e.disabled : ""}`,
|
|
242
245
|
...Se,
|
|
243
246
|
children: [
|
|
244
247
|
x && /* @__PURE__ */ p(
|
|
245
248
|
"label",
|
|
246
249
|
{
|
|
247
|
-
className: `${e.label} ${c === "large" ? e.label_large : ""} ${c === "extraLarge" ? e.label_extraLarge : ""} ${g ? e.label_inverted : ""} ${
|
|
250
|
+
className: `${e.label} ${c === "large" ? e.label_large : ""} ${c === "extraLarge" ? e.label_extraLarge : ""} ${g ? e.label_inverted : ""} ${v ? e.disabled : ""} `,
|
|
248
251
|
children: [
|
|
249
252
|
x,
|
|
250
253
|
/* @__PURE__ */ l(
|
|
@@ -275,8 +278,8 @@ const nr = ({
|
|
|
275
278
|
W,
|
|
276
279
|
{
|
|
277
280
|
name: s ? "SearchIcon" : ne,
|
|
278
|
-
width:
|
|
279
|
-
height:
|
|
281
|
+
width: D,
|
|
282
|
+
height: D
|
|
280
283
|
}
|
|
281
284
|
)
|
|
282
285
|
}
|
|
@@ -287,18 +290,18 @@ const nr = ({
|
|
|
287
290
|
ref: B,
|
|
288
291
|
value: re,
|
|
289
292
|
className: `${e.selectInput} ${!o && !a && I.length === 0 ? e.placeholder : ""}`,
|
|
290
|
-
placeholder:
|
|
293
|
+
placeholder: V,
|
|
291
294
|
onChange: le,
|
|
292
295
|
onFocus: se,
|
|
293
296
|
onClick: _e,
|
|
294
|
-
disabled:
|
|
297
|
+
disabled: v,
|
|
295
298
|
readOnly: A || !a
|
|
296
299
|
}
|
|
297
300
|
) : /* @__PURE__ */ l(
|
|
298
301
|
"span",
|
|
299
302
|
{
|
|
300
303
|
className: `${e.selectValue} ${o ? "" : e.placeholder}`,
|
|
301
|
-
children: o ? o.label :
|
|
304
|
+
children: o ? o.label : V
|
|
302
305
|
}
|
|
303
306
|
)
|
|
304
307
|
] }),
|
|
@@ -315,19 +318,19 @@ const nr = ({
|
|
|
315
318
|
}
|
|
316
319
|
),
|
|
317
320
|
A ? /* @__PURE__ */ p(
|
|
318
|
-
|
|
321
|
+
Ve,
|
|
319
322
|
{
|
|
320
323
|
className: e.drawerSelect,
|
|
321
324
|
headerClassName: e.drawerSelectHeader,
|
|
322
325
|
isOpen: a,
|
|
323
|
-
setIsOpen:
|
|
326
|
+
setIsOpen: b,
|
|
324
327
|
title: $e,
|
|
325
328
|
zIndex: 1,
|
|
326
329
|
children: [
|
|
327
330
|
s && /* @__PURE__ */ l("div", { className: e.drawerSearchInput, children: /* @__PURE__ */ l(
|
|
328
331
|
je,
|
|
329
332
|
{
|
|
330
|
-
placeholder:
|
|
333
|
+
placeholder: V,
|
|
331
334
|
icon: "SearchIcon",
|
|
332
335
|
value: re,
|
|
333
336
|
onChange: le,
|
package/dist/main.d.ts
CHANGED
|
@@ -43,3 +43,4 @@ export type { SpinnerProps, SpinnerColor } from './components/Spinner';
|
|
|
43
43
|
export type { Step } from './components/stepper';
|
|
44
44
|
export type { ToastProps, ToastType, ToastPosition } from './components/Toast';
|
|
45
45
|
export type { ModalProps } from './components/modal';
|
|
46
|
+
export type { SearchableInputGroupProps, SearchableInputGroupField, } from './components/SearchableInputGroup';
|
package/package.json
CHANGED