bmi-next-brokers 3.0.5 → 3.0.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/Switch.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._switch_o6vju_1{--switch-bg: var(--ui-blue-100);--switch-active-bg: #2054a5;--switch-active-text: #ffffff;--switch-inactive-text: #2054a5;--switch-inset: 4px;--switch-pad-y: 7px;--switch-pad-x: 12px;--switch-font: 16px;--switch-line-height: 19.2px;position:relative;display:flex;flex-direction:row;gap:0;padding:var(--switch-inset);border-radius:1000px;background:var(--switch-bg);width:fit-content}._switch_o6vju_1._fullWidth_o6vju_24{width:100%}._switch_o6vju_1._fullWidth_o6vju_24 ._option_o6vju_28{flex:1}._extraSmall_o6vju_33{--switch-inset: 3px;--switch-pad-y: 6px;--switch-pad-x: 12px;--switch-font: 12px;--switch-line-height: 14.4px}._small_o6vju_41{--switch-inset: 3px;--switch-pad-y: 6px;--switch-pad-x: 12px;--switch-font: 14px;--switch-line-height: 16.8px}._large_o6vju_49{--switch-inset: 4px;--switch-pad-y: 10px;--switch-pad-x: 16px;--switch-font: 18px;--switch-line-height: 21.6px}._extraLarge_o6vju_57{--switch-inset: 6px;--switch-pad-y: 6px;--switch-pad-x: 14px;--switch-font: 20px;--switch-line-height: 24px}._switch_o6vju_1 ._indicator_o6vju_66{position:absolute;top:var(--switch-inset);bottom:var(--switch-inset);left:0;background:#2054a5;border-radius:1000px;transition:transform .42s cubic-bezier(.34,1.56,.64,1),width .42s cubic-bezier(.34,1.56,.64,1);pointer-events:none;z-index:0}._switch_o6vju_1._simple_o6vju_82 ._indicator_o6vju_66{transition:transform .22s ease,width .22s ease}._switch_o6vju_1._simple_o6vju_82 ._option_o6vju_28._active_o6vju_88 ._label_o6vju_88{animation:none}._switch_o6vju_1 ._option_o6vju_28{position:relative;z-index:1;border:none;background:transparent;color:var(--switch-inactive-text);font-family:var(--font-medium);font-size:var(--switch-font);line-height:var(--switch-line-height);cursor:pointer;transition:color .25s ease,transform .25s ease;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:4px;padding:var(--switch-pad-y) var(--switch-pad-x);border-radius:1000px}._switch_o6vju_1 ._option_o6vju_28:active{transform:scale(.94)}._switch_o6vju_1 ._option_o6vju_28._active_o6vju_88{color:var(--switch-active-text)}._switch_o6vju_1 ._option_o6vju_28._active_o6vju_88 ._label_o6vju_88{animation:_pop_o6vju_1 .32s ease}@keyframes _pop_o6vju_1{0%{transform:scale(1)}45%{transform:scale(1.12)}to{transform:scale(1)}}._switch_o6vju_1 ._label_o6vju_88{line-height:5px}
|
|
@@ -29,7 +29,9 @@ export interface SwitchProps {
|
|
|
29
29
|
background?: string;
|
|
30
30
|
/** si false, cada opción se adapta a su contenido; por defecto true (todas al ancho de la más larga) */
|
|
31
31
|
equalWidth?: boolean;
|
|
32
|
+
/** ancho de 100% */
|
|
33
|
+
fullWidth?: boolean;
|
|
32
34
|
/** estilos inline aplicados a todos los botones de opción */
|
|
33
35
|
optionStyle?: React.CSSProperties;
|
|
34
36
|
}
|
|
35
|
-
export declare const Switch: ({ options, active, onChange, size, simpleAnimation, iconSize, className, activeColor, activeTextColor, inactiveTextColor, background, equalWidth, optionStyle, }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export declare const Switch: ({ options, active, onChange, size, simpleAnimation, iconSize, className, activeColor, activeTextColor, inactiveTextColor, background, equalWidth, fullWidth, optionStyle, }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,110 +1,112 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as p, useState as
|
|
3
|
-
import { Icon as
|
|
4
|
-
import '../../assets/Switch.css';const
|
|
5
|
-
switch: "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { jsxs as b, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as p, useState as k, useLayoutEffect as D } from "react";
|
|
3
|
+
import { Icon as R } from "../../icons/Icon.js";
|
|
4
|
+
import '../../assets/Switch.css';const T = "_fullWidth_o6vju_24", Z = "_option_o6vju_28", z = "_extraSmall_o6vju_33", B = "_small_o6vju_41", K = "_large_o6vju_49", O = "_extraLarge_o6vju_57", V = "_indicator_o6vju_66", X = "_simple_o6vju_82", Y = "_active_o6vju_88", A = "_label_o6vju_88", F = "_pop_o6vju_1", r = {
|
|
5
|
+
switch: "_switch_o6vju_1",
|
|
6
|
+
fullWidth: T,
|
|
7
|
+
option: Z,
|
|
8
|
+
extraSmall: z,
|
|
9
|
+
small: B,
|
|
10
|
+
large: K,
|
|
11
|
+
extraLarge: O,
|
|
12
|
+
indicator: V,
|
|
13
|
+
simple: X,
|
|
14
|
+
active: Y,
|
|
15
|
+
label: A,
|
|
16
|
+
pop: F
|
|
17
|
+
}, G = {
|
|
17
18
|
extraSmall: 15,
|
|
18
19
|
small: 15,
|
|
19
20
|
medium: 19,
|
|
20
21
|
large: 19,
|
|
21
22
|
extraLarge: 19
|
|
22
|
-
},
|
|
23
|
+
}, Q = ({
|
|
23
24
|
options: d = [],
|
|
24
|
-
active:
|
|
25
|
-
onChange:
|
|
25
|
+
active: i = 0,
|
|
26
|
+
onChange: c,
|
|
26
27
|
size: h = "medium",
|
|
27
|
-
simpleAnimation:
|
|
28
|
-
iconSize:
|
|
29
|
-
className:
|
|
30
|
-
activeColor:
|
|
31
|
-
activeTextColor:
|
|
32
|
-
inactiveTextColor:
|
|
33
|
-
background:
|
|
34
|
-
equalWidth:
|
|
35
|
-
|
|
28
|
+
simpleAnimation: _ = !1,
|
|
29
|
+
iconSize: W,
|
|
30
|
+
className: I = "",
|
|
31
|
+
activeColor: v,
|
|
32
|
+
activeTextColor: w,
|
|
33
|
+
inactiveTextColor: j,
|
|
34
|
+
background: x,
|
|
35
|
+
equalWidth: y = !0,
|
|
36
|
+
fullWidth: E = !1,
|
|
37
|
+
optionStyle: N
|
|
36
38
|
}) => {
|
|
37
|
-
const
|
|
39
|
+
const u = p([]), L = p(i), a = p(null), [S, $] = k({
|
|
38
40
|
left: 0,
|
|
39
41
|
width: 0
|
|
40
42
|
});
|
|
41
|
-
|
|
42
|
-
const t =
|
|
43
|
+
D(() => {
|
|
44
|
+
const t = u.current[i], e = u.current[L.current];
|
|
43
45
|
if (!t) return;
|
|
44
|
-
const
|
|
45
|
-
(
|
|
46
|
+
const l = u.current.filter(
|
|
47
|
+
(s) => s !== null
|
|
46
48
|
);
|
|
47
|
-
if (
|
|
48
|
-
const
|
|
49
|
-
|
|
49
|
+
if (l.forEach((s) => s.style.width = "auto"), y) {
|
|
50
|
+
const s = Math.max(...l.map((o) => o.offsetWidth));
|
|
51
|
+
l.forEach((o) => o.style.width = `${s}px`);
|
|
50
52
|
}
|
|
51
|
-
const
|
|
52
|
-
if (!
|
|
53
|
-
const
|
|
54
|
-
|
|
53
|
+
const f = () => $({ left: t.offsetLeft, width: t.offsetWidth });
|
|
54
|
+
if (!_ && e && e !== t) {
|
|
55
|
+
const s = Math.min(e.offsetLeft, t.offsetLeft), o = Math.max(
|
|
56
|
+
e.offsetLeft + e.offsetWidth,
|
|
55
57
|
t.offsetLeft + t.offsetWidth
|
|
56
58
|
);
|
|
57
|
-
|
|
59
|
+
$({ left: s, width: o - s }), a.current && clearTimeout(a.current), a.current = setTimeout(f, 160);
|
|
58
60
|
} else
|
|
59
|
-
|
|
60
|
-
return
|
|
61
|
-
|
|
61
|
+
f();
|
|
62
|
+
return L.current = i, () => {
|
|
63
|
+
a.current && clearTimeout(a.current);
|
|
62
64
|
};
|
|
63
|
-
}, [
|
|
64
|
-
const
|
|
65
|
-
...
|
|
66
|
-
...
|
|
67
|
-
...
|
|
68
|
-
...
|
|
65
|
+
}, [i, d, _, y]);
|
|
66
|
+
const g = W ?? G[h], M = {
|
|
67
|
+
...v && { "--switch-active-bg": v },
|
|
68
|
+
...w && { "--switch-active-text": w },
|
|
69
|
+
...j && { "--switch-inactive-text": j },
|
|
70
|
+
...x && { "--switch-bg": x }
|
|
69
71
|
};
|
|
70
|
-
return /* @__PURE__ */
|
|
72
|
+
return /* @__PURE__ */ b(
|
|
71
73
|
"div",
|
|
72
74
|
{
|
|
73
|
-
className: `${
|
|
75
|
+
className: `${r.switch} ${r[h]} ${_ ? r.simple : ""} ${E ? r.fullWidth : ""} ${I}`,
|
|
74
76
|
style: M,
|
|
75
77
|
children: [
|
|
76
|
-
/* @__PURE__ */
|
|
78
|
+
/* @__PURE__ */ m(
|
|
77
79
|
"span",
|
|
78
80
|
{
|
|
79
|
-
className:
|
|
81
|
+
className: r.indicator,
|
|
80
82
|
style: {
|
|
81
|
-
transform: `translateX(${
|
|
82
|
-
width: `${
|
|
83
|
+
transform: `translateX(${S.left}px)`,
|
|
84
|
+
width: `${S.width}px`
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
),
|
|
86
|
-
d.map((t,
|
|
87
|
-
const
|
|
88
|
-
return /* @__PURE__ */
|
|
88
|
+
d.map((t, e) => {
|
|
89
|
+
const l = typeof t == "string", f = l ? t : t.label, s = l ? null : t.icon, o = i === e;
|
|
90
|
+
return /* @__PURE__ */ b(
|
|
89
91
|
"div",
|
|
90
92
|
{
|
|
91
|
-
ref: (
|
|
92
|
-
|
|
93
|
+
ref: (n) => {
|
|
94
|
+
u.current[e] = n;
|
|
93
95
|
},
|
|
94
96
|
role: "button",
|
|
95
97
|
tabIndex: 0,
|
|
96
|
-
onClick: () =>
|
|
97
|
-
onKeyDown: (
|
|
98
|
-
(
|
|
98
|
+
onClick: () => c == null ? void 0 : c(e),
|
|
99
|
+
onKeyDown: (n) => {
|
|
100
|
+
(n.key === "Enter" || n.key === " ") && (n.preventDefault(), c == null || c(e));
|
|
99
101
|
},
|
|
100
|
-
className: `${
|
|
101
|
-
style:
|
|
102
|
+
className: `${r.option} ${o ? r.active : ""}`,
|
|
103
|
+
style: N,
|
|
102
104
|
children: [
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
s && /* @__PURE__ */ m(R, { name: s, size: g }),
|
|
106
|
+
f && /* @__PURE__ */ m("p", { className: r.label, children: f })
|
|
105
107
|
]
|
|
106
108
|
},
|
|
107
|
-
|
|
109
|
+
e
|
|
108
110
|
);
|
|
109
111
|
})
|
|
110
112
|
]
|
|
@@ -112,5 +114,5 @@ import '../../assets/Switch.css';const R = "_extraSmall_3r5ra_25", T = "_small_3
|
|
|
112
114
|
);
|
|
113
115
|
};
|
|
114
116
|
export {
|
|
115
|
-
|
|
117
|
+
Q as Switch
|
|
116
118
|
};
|
package/package.json
CHANGED