bmi-next-brokers 2.4.1 → 2.4.3

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.
@@ -20,6 +20,7 @@ export interface CompactFileUploadProps extends React.InputHTMLAttributes<HTMLIn
20
20
  onSuccessAction?: () => void;
21
21
  onInvalidTypeAction?: () => void;
22
22
  maxFileSize?: number;
23
+ onInvalidSizeAction?: () => void;
23
24
  onFileSelect?: (files: FileList | null) => void | Promise<void>;
24
25
  statusIconBorderRadius?: string;
25
26
  customIcon?: IconName;
@@ -27,4 +28,4 @@ export interface CompactFileUploadProps extends React.InputHTMLAttributes<HTMLIn
27
28
  fullWidth?: boolean;
28
29
  clearFileText?: string;
29
30
  }
30
- export declare const CompactFileUpload: ({ variant, label, error, success, warning, loading, defaultFile, disabled, inverted, browseText, clearFileText, allowedTypes, inspectFileFunction, onInvalidTypeAction, maxFileSize, onFileSelect, onSuccessAction, statusIconBorderRadius, customIcon, customInspectIcon, fullWidth, ...props }: CompactFileUploadProps) => import("react/jsx-runtime").JSX.Element;
31
+ export declare const CompactFileUpload: ({ variant, label, error, success, warning, loading, defaultFile, disabled, inverted, browseText, clearFileText, allowedTypes, inspectFileFunction, onInvalidTypeAction, maxFileSize, onInvalidSizeAction, onFileSelect, onSuccessAction, statusIconBorderRadius, customIcon, customInspectIcon, fullWidth, ...props }: CompactFileUploadProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,147 +1,148 @@
1
- import { jsx as e, jsxs as s, Fragment as k } from "react/jsx-runtime";
2
- import { useState as T, useRef as X, useEffect as W } from "react";
1
+ import { jsx as e, jsxs as s, Fragment as T } from "react/jsx-runtime";
2
+ import { useState as W, useRef as Z, useEffect as L } from "react";
3
3
  import { Icon as h } from "../../icons/Icon.js";
4
- import { Spinner as Y } from "../Spinner/Spinner.js";
5
- import { Button as L } from "../Button/Button.js";
6
- import '../../assets/CompactFileUpload.css';const Z = "_inputContainer_4x7bg_1", tt = "_compactFileUploadContainer_4x7bg_9", et = "_fullWidth_4x7bg_26", nt = "_dragOver_4x7bg_35", at = "_variant_document_4x7bg_41", ct = "_icon_4x7bg_41", ot = "_variant_add_4x7bg_45", it = "_disabled_4x7bg_50", lt = "_error_4x7bg_61", st = "_warning_4x7bg_69", rt = "_inverted_4x7bg_78", mt = "_uploadContent_4x7bg_103", dt = "_textContent_4x7bg_113", pt = "_dragText_4x7bg_123", _t = "_hiddenInput_4x7bg_153", ht = "_compactFileContent_4x7bg_166", ut = "_compactFileIcon_4x7bg_174", gt = "_compactIconBackground_4x7bg_182", xt = "_compactFileText_4x7bg_190", ft = "_compactLabel_4x7bg_202", vt = "_compactFileName_4x7bg_209", bt = "_compactStatusText_4x7bg_210", Ct = "_success_4x7bg_221", Nt = "_loading_4x7bg_229", Ft = "_addIconWrapper_4x7bg_233", It = "_browseText_4x7bg_239", wt = "_compactVisibilityIcon_4x7bg_246", Dt = "_compactActions_4x7bg_255", yt = "_deleteText_4x7bg_262", t = {
7
- inputContainer: Z,
8
- compactFileUploadContainer: tt,
9
- fullWidth: et,
4
+ import { Spinner as z } from "../Spinner/Spinner.js";
5
+ import { Button as j } from "../Button/Button.js";
6
+ import '../../assets/CompactFileUpload.css';const tt = "_inputContainer_4x7bg_1", et = "_compactFileUploadContainer_4x7bg_9", at = "_fullWidth_4x7bg_26", nt = "_dragOver_4x7bg_35", ct = "_variant_document_4x7bg_41", ot = "_icon_4x7bg_41", it = "_variant_add_4x7bg_45", lt = "_disabled_4x7bg_50", st = "_error_4x7bg_61", rt = "_warning_4x7bg_69", mt = "_inverted_4x7bg_78", dt = "_uploadContent_4x7bg_103", pt = "_textContent_4x7bg_113", _t = "_dragText_4x7bg_123", ht = "_hiddenInput_4x7bg_153", ut = "_compactFileContent_4x7bg_166", gt = "_compactFileIcon_4x7bg_174", xt = "_compactIconBackground_4x7bg_182", ft = "_compactFileText_4x7bg_190", bt = "_compactLabel_4x7bg_202", vt = "_compactFileName_4x7bg_209", Ct = "_compactStatusText_4x7bg_210", Nt = "_success_4x7bg_221", Ft = "_loading_4x7bg_229", It = "_addIconWrapper_4x7bg_233", wt = "_browseText_4x7bg_239", Dt = "_compactVisibilityIcon_4x7bg_246", yt = "_compactActions_4x7bg_255", $t = "_deleteText_4x7bg_262", t = {
7
+ inputContainer: tt,
8
+ compactFileUploadContainer: et,
9
+ fullWidth: at,
10
10
  dragOver: nt,
11
- variant_document: at,
12
- icon: ct,
13
- variant_add: ot,
14
- disabled: it,
15
- error: lt,
16
- warning: st,
17
- inverted: rt,
18
- uploadContent: mt,
19
- textContent: dt,
20
- dragText: pt,
21
- hiddenInput: _t,
22
- compactFileContent: ht,
23
- compactFileIcon: ut,
24
- compactIconBackground: gt,
25
- compactFileText: xt,
26
- compactLabel: ft,
11
+ variant_document: ct,
12
+ icon: ot,
13
+ variant_add: it,
14
+ disabled: lt,
15
+ error: st,
16
+ warning: rt,
17
+ inverted: mt,
18
+ uploadContent: dt,
19
+ textContent: pt,
20
+ dragText: _t,
21
+ hiddenInput: ht,
22
+ compactFileContent: ut,
23
+ compactFileIcon: gt,
24
+ compactIconBackground: xt,
25
+ compactFileText: ft,
26
+ compactLabel: bt,
27
27
  compactFileName: vt,
28
- compactStatusText: bt,
29
- success: Ct,
30
- loading: Nt,
31
- addIconWrapper: Ft,
32
- browseText: It,
33
- compactVisibilityIcon: wt,
34
- compactActions: Dt,
35
- deleteText: yt
36
- }, Bt = ({
37
- variant: j = "document",
28
+ compactStatusText: Ct,
29
+ success: Nt,
30
+ loading: Ft,
31
+ addIconWrapper: It,
32
+ browseText: wt,
33
+ compactVisibilityIcon: Dt,
34
+ compactActions: yt,
35
+ deleteText: $t
36
+ }, Et = ({
37
+ variant: B = "document",
38
38
  label: u,
39
39
  error: o,
40
- success: a,
40
+ success: n,
41
41
  warning: g,
42
42
  loading: c,
43
- defaultFile: I = null,
43
+ defaultFile: w = null,
44
44
  disabled: m = !1,
45
- inverted: B = !1,
46
- browseText: E = "Seleccionar archivo",
45
+ inverted: E = !1,
46
+ browseText: O = "Seleccionar archivo",
47
47
  clearFileText: x = "Eliminar",
48
48
  allowedTypes: d,
49
- inspectFileFunction: O = () => {
49
+ inspectFileFunction: R = () => {
50
50
  console.warn(
51
51
  "No hay función asignada para ver el archivo. Hay que pasarla al componente como prop inspectFileFunction."
52
52
  );
53
53
  },
54
54
  onInvalidTypeAction: f,
55
- maxFileSize: w,
55
+ maxFileSize: D,
56
+ onInvalidSizeAction: b,
56
57
  onFileSelect: v,
57
- onSuccessAction: b,
58
- statusIconBorderRadius: D = "50%",
59
- customIcon: R = "Documentos",
60
- customInspectIcon: A = "Visibility",
61
- fullWidth: S = !1,
62
- ...U
58
+ onSuccessAction: C,
59
+ statusIconBorderRadius: y = "50%",
60
+ customIcon: U = "Documentos",
61
+ customInspectIcon: V = "Visibility",
62
+ fullWidth: M = !1,
63
+ ...A
63
64
  }) => {
64
- const [V, C] = T(!1), [i, N] = T(null), _ = X(null);
65
- W(() => {
66
- N(I ?? null);
67
- }, [I]), W(() => {
65
+ const [S, N] = W(!1), [i, F] = W(null), _ = Z(null);
66
+ L(() => {
67
+ F(w ?? null);
68
+ }, [w]), L(() => {
68
69
  if (!i) return;
69
- const n = [];
70
- o && n.push("error"), a && n.push("success"), c && n.push("loading"), n.length > 1 && console.warn(
71
- `⚠️ CompactFileUpload: Múltiples estados detectados (${n.join(", ")}). Solo un estado debe estar activo a la vez.`
70
+ const a = [];
71
+ o && a.push("error"), n && a.push("success"), c && a.push("loading"), a.length > 1 && console.warn(
72
+ `⚠️ CompactFileUpload: Múltiples estados detectados (${a.join(", ")}). Solo un estado debe estar activo a la vez.`
72
73
  );
73
- }, [o, a, c, i]);
74
- const M = (n) => {
75
- n.preventDefault(), m || C(!0);
76
- }, z = (n) => {
77
- n.preventDefault(), C(!1);
78
- }, q = (n) => {
79
- n.preventDefault();
80
- }, H = (n) => {
81
- if (n.preventDefault(), C(!1), m) return;
82
- const r = n.dataTransfer.files;
83
- y(r);
84
- }, P = async (n) => {
85
- const r = n.target.files;
86
- y(r);
87
- }, y = async (n) => {
88
- if (!n) return;
74
+ }, [o, n, c, i]);
75
+ const q = (a) => {
76
+ a.preventDefault(), m || N(!0);
77
+ }, H = (a) => {
78
+ a.preventDefault(), N(!1);
79
+ }, P = (a) => {
80
+ a.preventDefault();
81
+ }, G = (a) => {
82
+ if (a.preventDefault(), N(!1), m) return;
83
+ const r = a.dataTransfer.files;
84
+ $(r);
85
+ }, J = async (a) => {
86
+ const r = a.target.files;
87
+ $(r);
88
+ }, $ = async (a) => {
89
+ if (!a) return;
89
90
  if (d && d.length > 0)
90
- for (let l = 0; l < n.length; l++) {
91
- const p = n[l];
91
+ for (let l = 0; l < a.length; l++) {
92
+ const p = a[l];
92
93
  if (!d.some(
93
- (F) => F.startsWith(".") ? p.name.toLowerCase().endsWith(F.toLowerCase()) : p.type === F
94
+ (I) => I.startsWith(".") ? p.name.toLowerCase().endsWith(I.toLowerCase()) : p.type === I
94
95
  )) {
95
96
  f == null || f(), console.warn(`File ${p.name} is not an allowed type`);
96
97
  return;
97
98
  }
98
99
  }
99
- if (w)
100
- for (let l = 0; l < n.length; l++) {
101
- const p = n[l];
102
- if (p.size > w) {
103
- console.warn(`File ${p.name} exceeds maximum size`);
100
+ if (D)
101
+ for (let l = 0; l < a.length; l++) {
102
+ const p = a[l];
103
+ if (p.size > D) {
104
+ b == null || b(), console.warn(`File ${p.name} exceeds maximum size`);
104
105
  return;
105
106
  }
106
107
  }
107
- const r = n ? n[0] : null;
108
- N(r), await (v == null ? void 0 : v(
108
+ const r = a ? a[0] : null;
109
+ F(r), await (v == null ? void 0 : v(
109
110
  r ? (() => {
110
111
  const l = new DataTransfer();
111
112
  return l.items.add(r), l.files;
112
113
  })() : null
113
114
  ));
114
- }, G = () => {
115
- !i && !m && _.current && _.current.click();
116
- }, $ = () => {
117
- N(null), _.current && (_.current.value = "");
118
- }, J = () => {
119
- $();
120
115
  }, K = () => {
121
- b == null || b(), $();
122
- }, Q = [
116
+ !i && !m && _.current && _.current.click();
117
+ }, k = () => {
118
+ F(null), _.current && (_.current.value = "");
119
+ }, Q = () => {
120
+ k();
121
+ }, X = () => {
122
+ C == null || C(), k();
123
+ }, Y = [
123
124
  t.compactFileUploadContainer,
124
- S && t.fullWidth,
125
- t[`variant_${j}`],
125
+ M && t.fullWidth,
126
+ t[`variant_${B}`],
126
127
  !i && g ? t.warning : "",
127
- i && !c && !a && o ? t.error : "",
128
- i && !o && !a && c ? t.loading : "",
129
- i && !o && !c && a ? t.success : "",
128
+ i && !c && !n && o ? t.error : "",
129
+ i && !o && !n && c ? t.loading : "",
130
+ i && !o && !c && n ? t.success : "",
130
131
  m ? t.disabled : "",
131
- B ? t.inverted : "",
132
- V ? t.dragOver : ""
132
+ E ? t.inverted : "",
133
+ S ? t.dragOver : ""
133
134
  ].filter(Boolean).join(" ");
134
135
  return /* @__PURE__ */ e("div", { className: t.inputContainer, children: /* @__PURE__ */ s(
135
136
  "div",
136
137
  {
137
- className: Q,
138
- onDragEnter: M,
139
- onDragLeave: z,
140
- onDragOver: q,
141
- onDrop: H,
142
- onClick: G,
138
+ className: Y,
139
+ onDragEnter: q,
140
+ onDragLeave: H,
141
+ onDragOver: P,
142
+ onDrop: G,
143
+ onClick: K,
143
144
  style: { cursor: m ? "not-allowed" : "pointer" },
144
- ...U,
145
+ ...A,
145
146
  children: [
146
147
  /* @__PURE__ */ e(
147
148
  "input",
@@ -149,7 +150,7 @@ import '../../assets/CompactFileUpload.css';const Z = "_inputContainer_4x7bg_1",
149
150
  ref: _,
150
151
  type: "file",
151
152
  className: t.hiddenInput,
152
- onChange: P,
153
+ onChange: J,
153
154
  disabled: m,
154
155
  accept: d == null ? void 0 : d.join(",")
155
156
  }
@@ -162,8 +163,8 @@ import '../../assets/CompactFileUpload.css';const Z = "_inputContainer_4x7bg_1",
162
163
  {
163
164
  className: t.compactIconBackground,
164
165
  style: {
165
- background: o && !c ? "#DC2626" : c ? "#2054A5" : a ? "#65A30D" : "#2054A5",
166
- borderRadius: D
166
+ background: o && !c ? "#DC2626" : c ? "#2054A5" : n ? "#65A30D" : "#2054A5",
167
+ borderRadius: y
167
168
  },
168
169
  children: c ? /* @__PURE__ */ e(
169
170
  "div",
@@ -175,7 +176,7 @@ import '../../assets/CompactFileUpload.css';const Z = "_inputContainer_4x7bg_1",
175
176
  margin: "4px"
176
177
  },
177
178
  children: /* @__PURE__ */ e(
178
- Y,
179
+ z,
179
180
  {
180
181
  size: 10,
181
182
  color: "primary",
@@ -196,7 +197,7 @@ import '../../assets/CompactFileUpload.css';const Z = "_inputContainer_4x7bg_1",
196
197
  children: /* @__PURE__ */ e(
197
198
  h,
198
199
  {
199
- name: o ? "CancelIcon" : a ? "CheckIcon" : R,
200
+ name: o ? "CancelIcon" : n ? "CheckIcon" : U,
200
201
  fill: "white",
201
202
  height: 20,
202
203
  width: 20
@@ -207,37 +208,37 @@ import '../../assets/CompactFileUpload.css';const Z = "_inputContainer_4x7bg_1",
207
208
  }
208
209
  ) }),
209
210
  /* @__PURE__ */ s("div", { className: t.compactFileText, children: [
210
- !o && !c && !a && /* @__PURE__ */ s(k, { children: [
211
+ !o && !c && !n && /* @__PURE__ */ s(T, { children: [
211
212
  u && /* @__PURE__ */ e("span", { className: `small1Medium ${t.compactLabel}`, children: u }),
212
213
  /* @__PURE__ */ e("span", { className: `small3Regular ${t.compactFileName}`, children: i == null ? void 0 : i.name })
213
214
  ] }),
214
- (o || c || a) && /* @__PURE__ */ e(
215
+ (o || c || n) && /* @__PURE__ */ e(
215
216
  "span",
216
217
  {
217
218
  className: `
218
219
  small1Medium
219
220
  ${t.compactFileName}
220
221
  ${o && t.error}
221
- ${a && t.success}
222
+ ${n && t.success}
222
223
  ${c && t.loading}
223
224
  `,
224
225
  children: i == null ? void 0 : i.name
225
226
  }
226
227
  ),
227
228
  o && /* @__PURE__ */ e("span", { className: `small3Regular ${t.compactStatusText}`, children: o }),
228
- a && !c && /* @__PURE__ */ e("span", { className: `small3Regular ${t.compactStatusText}`, children: a }),
229
+ n && !c && /* @__PURE__ */ e("span", { className: `small3Regular ${t.compactStatusText}`, children: n }),
229
230
  c && /* @__PURE__ */ e("span", { className: `small3Regular ${t.compactStatusText}`, children: c })
230
231
  ] }),
231
232
  /* @__PURE__ */ s("div", { className: t.compactActions, children: [
232
- !o && !c && !a && /* @__PURE__ */ e(
233
+ !o && !c && !n && /* @__PURE__ */ e(
233
234
  "div",
234
235
  {
235
236
  className: t.compactVisibilityIcon,
236
- onClick: O,
237
+ onClick: R,
237
238
  children: /* @__PURE__ */ e(
238
239
  h,
239
240
  {
240
- name: A,
241
+ name: V,
241
242
  fill: "#2054A5",
242
243
  height: 24,
243
244
  width: 24
@@ -245,16 +246,16 @@ import '../../assets/CompactFileUpload.css';const Z = "_inputContainer_4x7bg_1",
245
246
  )
246
247
  }
247
248
  ),
248
- (o || a) && /* @__PURE__ */ e(
249
- L,
249
+ (o || n) && /* @__PURE__ */ e(
250
+ j,
250
251
  {
251
252
  variant: x ? "outline" : "ghost",
252
253
  icon: {
253
254
  name: "CancelIcon",
254
255
  position: "before"
255
256
  },
256
- onClick: (n) => {
257
- n.stopPropagation(), a ? K() : J();
257
+ onClick: (a) => {
258
+ a.stopPropagation(), n ? X() : Q();
258
259
  },
259
260
  children: x || ""
260
261
  }
@@ -268,7 +269,7 @@ import '../../assets/CompactFileUpload.css';const Z = "_inputContainer_4x7bg_1",
268
269
  className: t.compactIconBackground,
269
270
  style: {
270
271
  background: "#EA580C",
271
- borderRadius: D
272
+ borderRadius: y
272
273
  },
273
274
  children: /* @__PURE__ */ e(
274
275
  "div",
@@ -302,7 +303,7 @@ import '../../assets/CompactFileUpload.css';const Z = "_inputContainer_4x7bg_1",
302
303
  /* @__PURE__ */ e("span", { className: `small3Regular ${t.compactStatusText}`, children: g })
303
304
  ] }),
304
305
  /* @__PURE__ */ e("div", { className: t.compactActions, children: /* @__PURE__ */ e(
305
- L,
306
+ j,
306
307
  {
307
308
  variant: "outline",
308
309
  icon: {
@@ -312,7 +313,7 @@ import '../../assets/CompactFileUpload.css';const Z = "_inputContainer_4x7bg_1",
312
313
  children: "Subir doc"
313
314
  }
314
315
  ) })
315
- ] }) : /* @__PURE__ */ e(k, { children: /* @__PURE__ */ s("div", { className: t.textContent, children: [
316
+ ] }) : /* @__PURE__ */ e(T, { children: /* @__PURE__ */ s("div", { className: t.textContent, children: [
316
317
  /* @__PURE__ */ e(
317
318
  "div",
318
319
  {
@@ -323,12 +324,12 @@ import '../../assets/CompactFileUpload.css';const Z = "_inputContainer_4x7bg_1",
323
324
  children: /* @__PURE__ */ e("div", { style: { marginTop: "3px" }, children: /* @__PURE__ */ e(h, { name: "Add", fill: "white", height: 27, width: 27 }) })
324
325
  }
325
326
  ),
326
- /* @__PURE__ */ e("span", { className: `small1Medium ${t.browseText}`, children: E })
327
+ /* @__PURE__ */ e("span", { className: `small1Medium ${t.browseText}`, children: O })
327
328
  ] }) }) })
328
329
  ]
329
330
  }
330
331
  ) });
331
332
  };
332
333
  export {
333
- Bt as CompactFileUpload
334
+ Et as CompactFileUpload
334
335
  };
@@ -16,7 +16,8 @@ export interface FileUploadProps extends React.HTMLAttributes<HTMLSpanElement> {
16
16
  inspectFileFunction?: () => void;
17
17
  onInvalidTypeAction?: () => void;
18
18
  maxFileSize?: number;
19
+ onInvalidSizeAction?: () => void;
19
20
  onFileSelect?: (files: FileList | null) => void;
20
21
  fullWidth?: boolean;
21
22
  }
22
- export declare const FileUpload: ({ variant, helperText, error, success, loading, disabled, defaultFile, inverted, dragText, browseText, allowedTypes, inspectFileFunction, onInvalidTypeAction, maxFileSize, onFileSelect, fullWidth, style, }: FileUploadProps) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const FileUpload: ({ variant, helperText, error, success, loading, disabled, defaultFile, inverted, dragText, browseText, allowedTypes, inspectFileFunction, onInvalidTypeAction, maxFileSize, onInvalidSizeAction, onFileSelect, fullWidth, style, }: FileUploadProps) => import("react/jsx-runtime").JSX.Element;