bmi-next-brokers 2.7.0 → 2.7.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.
@@ -1,4 +1,4 @@
1
- import { jsxs as v, jsx as l, Fragment as R } from "react/jsx-runtime";
1
+ import { jsxs as v, jsx as r, Fragment as R } from "react/jsx-runtime";
2
2
  import { useState as S, useRef as E, useEffect as T } from "react";
3
3
  import { createPortal as U } from "react-dom";
4
4
  import { s as e } from "../../Input.module-CvbQKI27.js";
@@ -6,34 +6,32 @@ import { Icon as _ } from "../../icons/Icon.js";
6
6
  import { FieldError as W } from "../fieldError/index.js";
7
7
  import { HelperText as X } from "../helperText/index.js";
8
8
  import { useBTC as G } from "../../hooks/btcContext/useBtcContext.js";
9
- const F = (a, d, s = !1) => {
9
+ const F = (a, h, s = !1) => {
10
10
  let o = a.replace(
11
11
  /{{([^}]+)}}/g,
12
- (u, n) => `<span class="${d}" data-variable="${n}" contenteditable="false"></span>`
12
+ (d, l) => `<span class="${h}" data-variable="${l}" contenteditable="false"></span>`
13
13
  );
14
14
  return s && (o = o.replace(/\n/g, "<br>")), o;
15
- }, P = (a, d = !1) => {
15
+ }, P = (a, h = !1) => {
16
16
  let s = "", o = !0;
17
- const u = (n, x = !1) => {
18
- if (n.nodeType === Node.TEXT_NODE)
19
- s += n.textContent ?? "";
20
- else if (n instanceof HTMLElement) {
21
- const i = n.tagName.toUpperCase();
22
- n.dataset.variable ? s += `{{${n.dataset.variable}}}` : i === "BR" ? d && (s += `
23
- `) : x && (i === "DIV" || i === "P") ? (d && !o && (s += `
24
- `), o = !1, n.childNodes.forEach((c) => u(c, !1))) : n.childNodes.forEach((c) => u(c, !1));
17
+ const d = (l, x = !1) => {
18
+ if (l.nodeType === Node.TEXT_NODE)
19
+ s += l.textContent ?? "";
20
+ else if (l instanceof HTMLElement) {
21
+ const i = l.tagName.toUpperCase();
22
+ l.dataset.variable ? s += `{{${l.dataset.variable}}}` : i === "BR" ? h && (s += `
23
+ `) : x && (i === "DIV" || i === "P") ? (h && !o && (s += `
24
+ `), o = !1, l.childNodes.forEach((c) => d(c, !1))) : l.childNodes.forEach((c) => d(c, !1));
25
25
  }
26
26
  };
27
- return a.childNodes.forEach((n) => u(n, !0)), d ? s.split(`
28
- `).map((n) => n.trim()).filter((n) => n !== "").join(`
29
- `) : s;
27
+ return a.childNodes.forEach((l) => d(l, !0)), s;
30
28
  }, A = ({
31
29
  value: a = "",
32
- placeholder: d,
30
+ placeholder: h,
33
31
  className: s,
34
32
  style: o,
35
- disabled: u,
36
- onChange: n,
33
+ disabled: d,
34
+ onChange: l,
37
35
  onFocus: x,
38
36
  renderVariable: i,
39
37
  multiline: c = !1
@@ -42,7 +40,7 @@ const F = (a, d, s = !1) => {
42
40
  const y = t.querySelectorAll("[data-variable]");
43
41
  I(
44
42
  Array.from(y).map(
45
- (b) => U(/* @__PURE__ */ l(R, { children: i(b.dataset.variable) }), b)
43
+ (b) => U(/* @__PURE__ */ r(R, { children: i(b.dataset.variable) }), b)
46
44
  )
47
45
  );
48
46
  };
@@ -57,23 +55,23 @@ const F = (a, d, s = !1) => {
57
55
  return;
58
56
  }
59
57
  if (P(t, c) !== a && (t.innerHTML = F(a, e.variableSpan, c), $(t), document.activeElement === t)) {
60
- const b = document.createRange(), f = window.getSelection();
61
- b.selectNodeContents(t), b.collapse(!1), f == null || f.removeAllRanges(), f == null || f.addRange(b);
58
+ const b = document.createRange(), u = window.getSelection();
59
+ b.selectNodeContents(t), b.collapse(!1), u == null || u.removeAllRanges(), u == null || u.addRange(b);
62
60
  }
63
61
  }, [a]), /* @__PURE__ */ v(R, { children: [
64
- /* @__PURE__ */ l(
62
+ /* @__PURE__ */ r(
65
63
  "div",
66
64
  {
67
65
  ref: g,
68
- contentEditable: !u,
66
+ contentEditable: !d,
69
67
  suppressContentEditableWarning: !0,
70
- "data-placeholder": d,
68
+ "data-placeholder": h,
71
69
  className: s,
72
70
  style: o,
73
71
  onInput: () => {
74
72
  m.current = !0;
75
73
  const t = g.current;
76
- t && (n == null || n({
74
+ t && (l == null || l({
77
75
  target: { value: P(t, c) }
78
76
  }));
79
77
  },
@@ -89,11 +87,11 @@ const F = (a, d, s = !1) => {
89
87
  ] });
90
88
  }, ne = ({
91
89
  size: a = "medium",
92
- label: d,
90
+ label: h,
93
91
  error: s,
94
92
  helperText: o,
95
- icon: u,
96
- className: n,
93
+ icon: d,
94
+ className: l,
97
95
  required: x,
98
96
  inverted: i = !1,
99
97
  btc: c,
@@ -103,47 +101,47 @@ const F = (a, d, s = !1) => {
103
101
  variableMode: I,
104
102
  renderVariable: $,
105
103
  multiline: w = !1,
106
- ...r
104
+ ...n
107
105
  }) => {
108
- const [t, y] = S(!1), b = m === "password", f = m === "date", H = m === "textarea", C = E(null), { btc: j } = G(), k = c ?? j, B = () => {
106
+ const [t, y] = S(!1), b = m === "password", u = m === "date", H = m === "textarea", C = E(null), { btc: k } = G(), B = c ?? k, K = () => {
109
107
  if (m !== "textarea") return;
110
- const h = C.current;
111
- h && (h.style.height = "auto");
112
- }, K = () => {
113
- const h = C.current;
114
- h && (h.style.height = "auto", h.style.height = h.scrollHeight + "px");
115
- }, V = (h) => {
116
- h.key === "Enter" && !w && h.preventDefault();
108
+ const f = C.current;
109
+ f && (f.style.height = "auto");
110
+ }, V = () => {
111
+ const f = C.current;
112
+ f && (f.style.height = "auto", f.style.height = f.scrollHeight + "px");
113
+ }, j = (f) => {
114
+ f.key === "Enter" && !w && f.preventDefault();
117
115
  };
118
116
  T(() => {
119
- B();
117
+ K();
120
118
  }, []);
121
119
  const M = [
122
120
  e.input,
123
121
  e[a],
124
- k && e.btc,
122
+ B && e.btc,
125
123
  s ? e.error : "",
126
124
  i ? e.inverted : "",
127
- n
125
+ l
128
126
  ].filter(Boolean).join(" "), D = [
129
127
  e.hiddenInput,
130
128
  s ? e.hiddenInputError : "",
131
- f ? e.dateInput : ""
129
+ u ? e.dateInput : ""
132
130
  ].filter(Boolean).join(" "), p = a === "small" ? 16 : a === "large" ? 20 : a === "extraLarge" ? 24 : 18, q = () => {
133
131
  y(!t);
134
132
  }, L = `${e.textArea} ${e[`textArea_${a}`]} ${e.hiddenInput} ${s ? e.hiddenInputError : ""} ${I ? ` ${e.textArea_variableMode}` : ""}`, O = `${D} ${e.variableInputDiv} ${e[a]}`;
135
133
  return /* @__PURE__ */ v(
136
134
  "div",
137
135
  {
138
- className: `${e.inputContainer} ${a === "medium" ? e.inputContainer_medium : a === "large" ? e.inputContainer_large : a === "extraLarge" ? e.inputContainer_extraLarge : ""} ${r.disabled ? e.disabled : ""}`,
136
+ className: `${e.inputContainer} ${a === "medium" ? e.inputContainer_medium : a === "large" ? e.inputContainer_large : a === "extraLarge" ? e.inputContainer_extraLarge : ""} ${n.disabled ? e.disabled : ""}`,
139
137
  children: [
140
- d && /* @__PURE__ */ v(
138
+ h && /* @__PURE__ */ v(
141
139
  "label",
142
140
  {
143
- className: `${e.label} ${a === "large" ? e.label_large : ""} ${a === "extraLarge" ? e.label_extraLarge : ""} ${i ? e.label_inverted : ""} ${r.disabled ? e.disabled : ""}`,
141
+ className: `${e.label} ${a === "large" ? e.label_large : ""} ${a === "extraLarge" ? e.label_extraLarge : ""} ${i ? e.label_inverted : ""} ${n.disabled ? e.disabled : ""}`,
144
142
  children: [
145
- d,
146
- /* @__PURE__ */ l(
143
+ h,
144
+ /* @__PURE__ */ r(
147
145
  "span",
148
146
  {
149
147
  className: `${e.required} ${i ? e.required_inverted : ""}`,
@@ -156,7 +154,7 @@ const F = (a, d, s = !1) => {
156
154
  /* @__PURE__ */ v(
157
155
  "div",
158
156
  {
159
- className: `${e.inputWrapper} ${r.disabled ? e.disabled : ""}`,
157
+ className: `${e.inputWrapper} ${n.disabled ? e.disabled : ""}`,
160
158
  children: [
161
159
  /* @__PURE__ */ v(
162
160
  "div",
@@ -164,73 +162,73 @@ const F = (a, d, s = !1) => {
164
162
  className: M,
165
163
  ref: C,
166
164
  style: {
167
- ...r.style,
165
+ ...n.style,
168
166
  ...N && { borderColor: N }
169
167
  },
170
168
  children: [
171
- (g || u) && /* @__PURE__ */ v("div", { className: e.prefixIcon, children: [
172
- g && /* @__PURE__ */ l("span", { className: e.prefix, children: g }),
173
- u && !f && /* @__PURE__ */ l(
169
+ (g || d) && /* @__PURE__ */ v("div", { className: e.prefixIcon, children: [
170
+ g && /* @__PURE__ */ r("span", { className: e.prefix, children: g }),
171
+ d && !u && /* @__PURE__ */ r(
174
172
  "div",
175
173
  {
176
174
  className: `${e.icon} ${i ? e.icon_inverted : ""} `,
177
- children: /* @__PURE__ */ l(_, { name: u, width: p, height: p })
175
+ children: /* @__PURE__ */ r(_, { name: d, width: p, height: p })
178
176
  }
179
177
  )
180
178
  ] }),
181
- H ? I && $ ? /* @__PURE__ */ l(
179
+ H ? I && $ ? /* @__PURE__ */ r(
182
180
  A,
183
181
  {
184
182
  className: L,
185
- value: r.value,
186
- placeholder: r.placeholder,
187
- style: r.style,
188
- disabled: r.disabled,
189
- onChange: r.onChange,
190
- onFocus: r.onFocus,
183
+ value: n.value,
184
+ placeholder: n.placeholder,
185
+ style: n.style,
186
+ disabled: n.disabled,
187
+ onChange: n.onChange,
188
+ onFocus: n.onFocus,
191
189
  renderVariable: $,
192
190
  multiline: w
193
191
  }
194
- ) : /* @__PURE__ */ l(
192
+ ) : /* @__PURE__ */ r(
195
193
  "textarea",
196
194
  {
197
195
  className: L,
198
- onChange: K,
199
- onKeyDown: V,
200
- ...r
196
+ onChange: V,
197
+ onKeyDown: j,
198
+ ...n
201
199
  }
202
- ) : I && $ ? /* @__PURE__ */ l(
200
+ ) : I && $ ? /* @__PURE__ */ r(
203
201
  A,
204
202
  {
205
203
  className: O,
206
- value: r.value,
207
- placeholder: r.placeholder,
208
- disabled: r.disabled,
209
- onChange: r.onChange,
210
- onFocus: r.onFocus,
204
+ value: n.value,
205
+ placeholder: n.placeholder,
206
+ disabled: n.disabled,
207
+ onChange: n.onChange,
208
+ onFocus: n.onFocus,
211
209
  renderVariable: $,
212
210
  multiline: w
213
211
  }
214
- ) : /* @__PURE__ */ l(
212
+ ) : /* @__PURE__ */ r(
215
213
  "input",
216
214
  {
217
215
  className: D,
218
216
  type: b ? t ? "text" : "password" : m,
219
- ...r
217
+ ...n
220
218
  }
221
219
  )
222
220
  ]
223
221
  }
224
222
  ),
225
- b && /* @__PURE__ */ l(
223
+ b && /* @__PURE__ */ r(
226
224
  "button",
227
225
  {
228
226
  type: "button",
229
227
  className: `${e.passwordToggle} ${i ? e.passwordToggle_inverted : ""}`,
230
228
  onClick: q,
231
- disabled: r.disabled,
229
+ disabled: n.disabled,
232
230
  "aria-label": t ? "Ocultar contraseña" : "Mostrar contraseña",
233
- children: /* @__PURE__ */ l(
231
+ children: /* @__PURE__ */ r(
234
232
  _,
235
233
  {
236
234
  name: t ? "VisibilityOff" : "Visibility",
@@ -240,11 +238,11 @@ const F = (a, d, s = !1) => {
240
238
  )
241
239
  }
242
240
  ),
243
- f && /* @__PURE__ */ l(
241
+ u && /* @__PURE__ */ r(
244
242
  "div",
245
243
  {
246
244
  className: `${e.dateIcon} ${i ? e.dateIcon_inverted : ""} ${s ? e.dateIcon_error : ""} ${s && i ? e.dateIcon_inverted_error : ""}`,
247
- children: /* @__PURE__ */ l(
245
+ children: /* @__PURE__ */ r(
248
246
  _,
249
247
  {
250
248
  name: "CalendarIcon",
@@ -257,8 +255,8 @@ const F = (a, d, s = !1) => {
257
255
  ]
258
256
  }
259
257
  ),
260
- s && /* @__PURE__ */ l(W, { size: a, message: s }),
261
- o && !s && /* @__PURE__ */ l(X, { message: o, size: a, inverted: i })
258
+ s && /* @__PURE__ */ r(W, { size: a, message: s }),
259
+ o && !s && /* @__PURE__ */ r(X, { message: o, size: a, inverted: i })
262
260
  ]
263
261
  }
264
262
  );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bmi-next-brokers",
3
3
  "description": "Componentes de UI para proyecto BMI Next Brokers",
4
- "version": "2.7.0",
4
+ "version": "2.7.1",
5
5
  "author": "BMI Ahorro España",
6
6
  "contributors": [
7
7
  "José Ramón Jiménez <jrjimenez@bmicos.com>",