bmi-next-brokers 1.1.5 → 1.1.7

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.
@@ -7,6 +7,7 @@ export interface CompactFileUploadProps {
7
7
  required?: boolean;
8
8
  error?: string;
9
9
  success?: string;
10
+ defaultFile?: File;
10
11
  loading?: boolean;
11
12
  disabled?: boolean;
12
13
  inverted?: boolean;
@@ -1,78 +1,79 @@
1
- import { jsx as e, jsxs as _, Fragment as F } from "react/jsx-runtime";
2
- import { useState as N, useRef as W, useEffect as j } from "react";
1
+ import { jsx as e, jsxs as _, Fragment as N } from "react/jsx-runtime";
2
+ import { useState as D, useRef as j, useEffect as $ } from "react";
3
3
  import { Icon as u } from "../../icons/Icon.js";
4
- import { Spinner as $ } from "../Spinner/Spinner.js";
5
- import '../../assets/CompactFileUpload.css';const z = "_inputContainer_ta4er_1", R = "_compactFileUploadContainer_ta4er_8", q = "_dragOver_ta4er_26", H = "_variant_document_ta4er_32", M = "_icon_ta4er_32", S = "_variant_add_ta4er_36", Y = "_disabled_ta4er_41", G = "_error_ta4er_52", J = "_success_ta4er_60", K = "_loading_ta4er_68", P = "_inverted_ta4er_77", Q = "_uploadContent_ta4er_102", X = "_textContent_ta4er_112", Z = "_dragText_ta4er_121", tt = "_hiddenInput_ta4er_151", et = "_compactFileContent_ta4er_164", at = "_compactFileIcon_ta4er_172", nt = "_compactIconBackground_ta4er_182", ct = "_compactErrorText_ta4er_191", ot = "_compactSuccessText_ta4er_191", it = "_compactLabel_ta4er_191", rt = "_compactFileText_ta4er_191", lt = "_compactFileName_ta4er_203", st = "_addIconWrapper_ta4er_239", dt = "_compactVisibilityIcon_ta4er_245", pt = "_compactActions_ta4er_261", mt = "_compactDeleteAction_ta4er_268", _t = "_deleteText_ta4er_279", t = {
6
- inputContainer: z,
7
- compactFileUploadContainer: R,
8
- dragOver: q,
9
- variant_document: H,
10
- icon: M,
11
- variant_add: S,
12
- disabled: Y,
13
- error: G,
14
- success: J,
15
- loading: K,
16
- inverted: P,
17
- uploadContent: Q,
18
- textContent: X,
19
- dragText: Z,
20
- hiddenInput: tt,
21
- compactFileContent: et,
4
+ import { Spinner as z } from "../Spinner/Spinner.js";
5
+ import '../../assets/CompactFileUpload.css';const R = "_inputContainer_ta4er_1", q = "_compactFileUploadContainer_ta4er_8", H = "_dragOver_ta4er_26", M = "_variant_document_ta4er_32", S = "_icon_ta4er_32", Y = "_variant_add_ta4er_36", G = "_disabled_ta4er_41", J = "_error_ta4er_52", K = "_success_ta4er_60", P = "_loading_ta4er_68", Q = "_inverted_ta4er_77", X = "_uploadContent_ta4er_102", Z = "_textContent_ta4er_112", tt = "_dragText_ta4er_121", et = "_hiddenInput_ta4er_151", nt = "_compactFileContent_ta4er_164", at = "_compactFileIcon_ta4er_172", ct = "_compactIconBackground_ta4er_182", ot = "_compactErrorText_ta4er_191", it = "_compactSuccessText_ta4er_191", rt = "_compactLabel_ta4er_191", lt = "_compactFileText_ta4er_191", st = "_compactFileName_ta4er_203", dt = "_addIconWrapper_ta4er_239", pt = "_compactVisibilityIcon_ta4er_245", mt = "_compactActions_ta4er_261", _t = "_compactDeleteAction_ta4er_268", ht = "_deleteText_ta4er_279", t = {
6
+ inputContainer: R,
7
+ compactFileUploadContainer: q,
8
+ dragOver: H,
9
+ variant_document: M,
10
+ icon: S,
11
+ variant_add: Y,
12
+ disabled: G,
13
+ error: J,
14
+ success: K,
15
+ loading: P,
16
+ inverted: Q,
17
+ uploadContent: X,
18
+ textContent: Z,
19
+ dragText: tt,
20
+ hiddenInput: et,
21
+ compactFileContent: nt,
22
22
  compactFileIcon: at,
23
- compactIconBackground: nt,
24
- compactErrorText: ct,
25
- compactSuccessText: ot,
26
- compactLabel: it,
27
- compactFileText: rt,
28
- compactFileName: lt,
29
- addIconWrapper: st,
30
- compactVisibilityIcon: dt,
31
- compactActions: pt,
32
- compactDeleteAction: mt,
33
- deleteText: _t
34
- }, gt = ({
35
- variant: D = "document",
23
+ compactIconBackground: ct,
24
+ compactErrorText: ot,
25
+ compactSuccessText: it,
26
+ compactLabel: rt,
27
+ compactFileText: lt,
28
+ compactFileName: st,
29
+ addIconWrapper: dt,
30
+ compactVisibilityIcon: pt,
31
+ compactActions: mt,
32
+ compactDeleteAction: _t,
33
+ deleteText: ht
34
+ }, xt = ({
35
+ variant: T = "document",
36
36
  label: C,
37
- error: n,
37
+ error: a,
38
38
  success: c,
39
39
  loading: o = !1,
40
+ defaultFile: g = null,
40
41
  disabled: s = !1,
41
- inverted: T = !1,
42
- browseText: A = "Seleccionar archivo",
42
+ inverted: A = !1,
43
+ browseText: k = "Seleccionar archivo",
43
44
  allowedTypes: d,
44
- inspectFileFunction: k = () => {
45
+ inspectFileFunction: y = () => {
45
46
  console.warn("No hay función asignada para ver el archivo. Hay que pasarla al componente como prop inspectFileFunction.");
46
47
  },
47
- maxFileSize: g,
48
+ maxFileSize: x,
48
49
  onFileSelect: p
49
50
  }) => {
50
- const [y, f] = N(!1), [r, x] = N(null), h = W(null);
51
- j(() => {
51
+ const [b, f] = D(!1), [r, I] = D(g || null), h = j(null);
52
+ $(() => {
52
53
  if (!r) return;
53
- const a = [];
54
- n && a.push("error"), c && a.push("success"), o && a.push("loading"), a.length > 1 && console.warn(
55
- `⚠️ CompactFileUpload: Múltiples estados detectados (${a.join(", ")}). Solo un estado debe estar activo a la vez.`
54
+ const n = [];
55
+ a && n.push("error"), c && n.push("success"), o && n.push("loading"), n.length > 1 && console.warn(
56
+ `⚠️ CompactFileUpload: Múltiples estados detectados (${n.join(", ")}). Solo un estado debe estar activo a la vez.`
56
57
  );
57
- }, [n, c, o, r]);
58
- const b = (a) => {
59
- a.preventDefault(), s || f(!0);
60
- }, E = (a) => {
61
- a.preventDefault(), f(!1);
62
- }, w = (a) => {
63
- a.preventDefault();
64
- }, L = (a) => {
65
- if (a.preventDefault(), f(!1), s) return;
66
- const l = a.dataTransfer.files;
67
- I(l);
68
- }, O = (a) => {
69
- const l = a.target.files;
70
- I(l);
71
- }, I = (a) => {
72
- if (!a) return;
58
+ }, [a, c, o, r]);
59
+ const E = (n) => {
60
+ n.preventDefault(), s || f(!0);
61
+ }, w = (n) => {
62
+ n.preventDefault(), f(!1);
63
+ }, L = (n) => {
64
+ n.preventDefault();
65
+ }, O = (n) => {
66
+ if (n.preventDefault(), f(!1), s) return;
67
+ const l = n.dataTransfer.files;
68
+ F(l);
69
+ }, B = (n) => {
70
+ const l = n.target.files;
71
+ F(l);
72
+ }, F = (n) => {
73
+ if (!n) return;
73
74
  if (d && d.length > 0)
74
- for (let i = 0; i < a.length; i++) {
75
- const m = a[i];
75
+ for (let i = 0; i < n.length; i++) {
76
+ const m = n[i];
76
77
  if (!d.some(
77
78
  (v) => v.startsWith(".") ? m.name.toLowerCase().endsWith(v.toLowerCase()) : m.type === v
78
79
  )) {
@@ -80,43 +81,43 @@ import '../../assets/CompactFileUpload.css';const z = "_inputContainer_ta4er_1",
80
81
  return;
81
82
  }
82
83
  }
83
- if (g)
84
- for (let i = 0; i < a.length; i++) {
85
- const m = a[i];
86
- if (m.size > g) {
84
+ if (x)
85
+ for (let i = 0; i < n.length; i++) {
86
+ const m = n[i];
87
+ if (m.size > x) {
87
88
  console.warn(`File ${m.name} exceeds maximum size`);
88
89
  return;
89
90
  }
90
91
  }
91
- const l = a ? a[0] : null;
92
- x(l), p == null || p(l ? (() => {
92
+ const l = n ? n[0] : null;
93
+ I(l), p == null || p(l ? (() => {
93
94
  const i = new DataTransfer();
94
95
  return i.items.add(l), i.files;
95
96
  })() : null);
96
- }, B = () => {
97
- !s && h.current && h.current.click();
98
97
  }, V = () => {
99
- x(null), h.current && (h.current.value = ""), p == null || p(null);
100
- }, U = [
98
+ !s && h.current && h.current.click();
99
+ }, U = () => {
100
+ I(null), h.current && (h.current.value = ""), p == null || p(null);
101
+ }, W = [
101
102
  t.compactFileUploadContainer,
102
- t[`variant_${D}`],
103
- r && n ? t.error : "",
104
- r && !n && o ? t.loading : "",
105
- r && !n && !o && c ? t.success : "",
103
+ t[`variant_${T}`],
104
+ r && a ? t.error : "",
105
+ r && !a && o ? t.loading : "",
106
+ r && !a && !o && c ? t.success : "",
106
107
  s ? t.disabled : "",
107
- T ? t.inverted : "",
108
- y ? t.dragOver : ""
108
+ A ? t.inverted : "",
109
+ b ? t.dragOver : ""
109
110
  ].filter(Boolean).join(" ");
110
111
  return /* @__PURE__ */ e("div", { className: t.inputContainer, children: /* @__PURE__ */ _(
111
112
  "div",
112
113
  {
113
- className: U,
114
- onDragEnter: b,
115
- onDragLeave: E,
116
- onDragOver: w,
117
- onDrop: L,
114
+ className: W,
115
+ onDragEnter: E,
116
+ onDragLeave: w,
117
+ onDragOver: L,
118
+ onDrop: O,
118
119
  onClick: r ? () => {
119
- } : B,
120
+ } : V,
120
121
  style: { cursor: s ? "not-allowed" : "pointer" },
121
122
  children: [
122
123
  /* @__PURE__ */ e(
@@ -125,7 +126,7 @@ import '../../assets/CompactFileUpload.css';const z = "_inputContainer_ta4er_1",
125
126
  ref: h,
126
127
  type: "file",
127
128
  className: t.hiddenInput,
128
- onChange: O,
129
+ onChange: B,
129
130
  disabled: s,
130
131
  accept: d == null ? void 0 : d.join(",")
131
132
  }
@@ -134,24 +135,24 @@ import '../../assets/CompactFileUpload.css';const z = "_inputContainer_ta4er_1",
134
135
  // Compact layout - simple text with left icon
135
136
  /* @__PURE__ */ _("div", { className: t.compactFileContent, children: [
136
137
  /* @__PURE__ */ e("div", { className: t.compactFileIcon, children: /* @__PURE__ */ e("div", { className: t.compactIconBackground, style: {
137
- background: n ? "#DC2626" : o ? "#2054A5" : c ? "#65A30D" : "#2054A5"
138
- }, children: o ? /* @__PURE__ */ e("div", { style: { marginTop: "5px" }, children: /* @__PURE__ */ e($, { size: 10, color: "primary", backgroundColor: "#A2BFEC", highlightColor: "#EEF3FC", thickness: 3 }) }) : /* @__PURE__ */ e("div", { style: { marginTop: "6px" }, children: /* @__PURE__ */ e(
138
+ background: a ? "#DC2626" : o ? "#2054A5" : c ? "#65A30D" : "#2054A5"
139
+ }, children: o ? /* @__PURE__ */ e("div", { style: { marginTop: "5px" }, children: /* @__PURE__ */ e(z, { size: 10, color: "primary", backgroundColor: "#A2BFEC", highlightColor: "#EEF3FC", thickness: 3 }) }) : /* @__PURE__ */ e("div", { style: { marginTop: "6px" }, children: /* @__PURE__ */ e(
139
140
  u,
140
141
  {
141
- name: n ? "CancelIcon" : c ? "CheckIcon" : "Documentos",
142
+ name: a ? "CancelIcon" : c ? "CheckIcon" : "Documentos",
142
143
  fill: "white",
143
144
  height: 22,
144
145
  width: 22
145
146
  }
146
147
  ) }) }) }),
147
148
  /* @__PURE__ */ _("div", { className: t.compactFileText, children: [
148
- !n && !o && !c && C && /* @__PURE__ */ e("span", { className: t.compactLabel, children: C }),
149
+ !a && !o && !c && C && /* @__PURE__ */ e("span", { className: t.compactLabel, children: C }),
149
150
  /* @__PURE__ */ e("span", { className: t.compactFileName, children: r.name }),
150
- n && /* @__PURE__ */ e("span", { className: t.compactErrorText, children: n }),
151
+ a && /* @__PURE__ */ e("span", { className: t.compactErrorText, children: a }),
151
152
  !o && c && /* @__PURE__ */ e("span", { className: t.compactSuccessText, children: c })
152
153
  ] }),
153
154
  /* @__PURE__ */ _("div", { className: t.compactActions, children: [
154
- !n && !o && !c && /* @__PURE__ */ e("div", { className: t.compactVisibilityIcon, onClick: k, children: /* @__PURE__ */ e(
155
+ !a && !o && !c && /* @__PURE__ */ e("div", { className: t.compactVisibilityIcon, onClick: y, children: /* @__PURE__ */ e(
155
156
  u,
156
157
  {
157
158
  name: "Visibility",
@@ -160,7 +161,7 @@ import '../../assets/CompactFileUpload.css';const z = "_inputContainer_ta4er_1",
160
161
  width: 20
161
162
  }
162
163
  ) }),
163
- (n || c || o) && /* @__PURE__ */ e("div", { className: t.compactDeleteAction, onClick: V, children: n ? /* @__PURE__ */ e("span", { className: t.deleteText, children: "Eliminar" }) : c ? /* @__PURE__ */ e(
164
+ (a || c || o) && /* @__PURE__ */ e("div", { className: t.compactDeleteAction, onClick: U, children: a ? /* @__PURE__ */ e("span", { className: t.deleteText, children: "Eliminar" }) : c ? /* @__PURE__ */ e(
164
165
  u,
165
166
  {
166
167
  name: "CancelIcon",
@@ -168,7 +169,7 @@ import '../../assets/CompactFileUpload.css';const z = "_inputContainer_ta4er_1",
168
169
  height: 16,
169
170
  width: 16
170
171
  }
171
- ) : o ? /* @__PURE__ */ _(F, { children: [
172
+ ) : o ? /* @__PURE__ */ _(N, { children: [
172
173
  /* @__PURE__ */ e(
173
174
  u,
174
175
  {
@@ -184,7 +185,7 @@ import '../../assets/CompactFileUpload.css';const z = "_inputContainer_ta4er_1",
184
185
  ] }) : null })
185
186
  ] })
186
187
  ] })
187
- ) : /* @__PURE__ */ e(F, { children: /* @__PURE__ */ _("div", { className: t.textContent, children: [
188
+ ) : /* @__PURE__ */ e(N, { children: /* @__PURE__ */ _("div", { className: t.textContent, children: [
188
189
  /* @__PURE__ */ e(
189
190
  "div",
190
191
  {
@@ -203,12 +204,12 @@ import '../../assets/CompactFileUpload.css';const z = "_inputContainer_ta4er_1",
203
204
  ) })
204
205
  }
205
206
  ),
206
- /* @__PURE__ */ e("span", { children: A })
207
+ /* @__PURE__ */ e("span", { children: k })
207
208
  ] }) }) })
208
209
  ]
209
210
  }
210
211
  ) });
211
212
  };
212
213
  export {
213
- gt as CompactFileUpload
214
+ xt as CompactFileUpload
214
215
  };
@@ -8,6 +8,7 @@ export interface FileUploadProps extends React.HTMLAttributes<HTMLSpanElement> {
8
8
  success?: string;
9
9
  loading?: boolean;
10
10
  disabled?: boolean;
11
+ defaultFile?: File;
11
12
  inverted?: boolean;
12
13
  dragText?: string;
13
14
  browseText?: string;