bmi-next-brokers 1.1.4 → 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.
- package/dist/assets/index7.css +1 -1
- package/dist/components/FileUpload/CompactFileUpload.d.ts +1 -0
- package/dist/components/FileUpload/CompactFileUpload.js +96 -95
- package/dist/components/FileUpload/FileUpload.d.ts +1 -0
- package/dist/components/FileUpload/FileUpload.js +129 -128
- package/dist/components/modal/index.d.ts +44 -29
- package/dist/components/modal/index.js +83 -65
- package/dist/icons/Icon.js +1 -1
- package/dist/icons/components/ArrowForward.d.ts +3 -0
- package/dist/icons/components/ArrowForward.js +10 -0
- package/dist/icons/components/index.d.ts +3 -2
- package/dist/icons/components/index.js +172 -170
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +190 -188
- package/dist/index-CYre5lRF.js +214 -0
- package/package.json +1 -1
- package/dist/index-CFSpGUXZ.js +0 -212
|
@@ -1,125 +1,126 @@
|
|
|
1
|
-
import { jsx as i, jsxs as g, Fragment as
|
|
2
|
-
import { useState as m, useRef as
|
|
3
|
-
import { Button as
|
|
1
|
+
import { jsx as i, jsxs as g, Fragment as T } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m, useRef as V, useEffect as Z } from "react";
|
|
3
|
+
import { Button as w } from "../Button/Button.js";
|
|
4
4
|
import { Icon as u } from "../../icons/Icon.js";
|
|
5
|
-
import { Spinner as
|
|
6
|
-
import '../../assets/FileUpload.css';const
|
|
7
|
-
inputContainer:
|
|
8
|
-
fullWidth:
|
|
9
|
-
label:
|
|
10
|
-
label_large:
|
|
11
|
-
label_disabled:
|
|
12
|
-
label_inverted:
|
|
13
|
-
label_inverted_disabled:
|
|
14
|
-
required:
|
|
15
|
-
required_disabled:
|
|
16
|
-
required_inverted:
|
|
17
|
-
required_inverted_disabled:
|
|
18
|
-
fileUploadContainer:
|
|
19
|
-
iconContainerLeft:
|
|
20
|
-
iconContainerRight:
|
|
21
|
-
dragOver:
|
|
22
|
-
variant_document:
|
|
23
|
-
icon:
|
|
24
|
-
variant_add:
|
|
25
|
-
disabled:
|
|
26
|
-
error:
|
|
27
|
-
success:
|
|
28
|
-
loading:
|
|
29
|
-
inverted:
|
|
30
|
-
uploadContent:
|
|
31
|
-
selectedFileContent:
|
|
32
|
-
withoutError:
|
|
33
|
-
selectedFileName:
|
|
34
|
-
selectedFileSize:
|
|
35
|
-
removeButton:
|
|
36
|
-
textContent:
|
|
37
|
-
dragText:
|
|
38
|
-
browseText:
|
|
39
|
-
hiddenInput:
|
|
40
|
-
helperText:
|
|
41
|
-
helperText_default:
|
|
42
|
-
helperText_compact:
|
|
43
|
-
helperText_disabled:
|
|
44
|
-
helperText_inverted:
|
|
45
|
-
helperText_inverted_disabled:
|
|
46
|
-
errorMessage:
|
|
47
|
-
errorMessage_default:
|
|
48
|
-
errorMessage_compact:
|
|
49
|
-
errorMessage_inverted:
|
|
50
|
-
selectedFilesContainer:
|
|
51
|
-
selectedFilesHeader:
|
|
52
|
-
selectedFilesText:
|
|
53
|
-
clearButton:
|
|
54
|
-
filesList:
|
|
55
|
-
fileItem:
|
|
56
|
-
fileName:
|
|
57
|
-
fileSize:
|
|
58
|
-
bigZIndex:
|
|
59
|
-
cancelIconWrapper:
|
|
60
|
-
fadeInSlideDown:
|
|
61
|
-
selectedFileInfo:
|
|
62
|
-
fadeInSlideUp:
|
|
63
|
-
successIconWrapper:
|
|
64
|
-
loadingIconWrapper:
|
|
65
|
-
fadeIn:
|
|
66
|
-
withSuccess:
|
|
67
|
-
withLoading:
|
|
68
|
-
errorText:
|
|
69
|
-
successText:
|
|
70
|
-
inlineFileContainer:
|
|
71
|
-
inlineFileIcon:
|
|
5
|
+
import { Spinner as y } from "../Spinner/Spinner.js";
|
|
6
|
+
import '../../assets/FileUpload.css';const G = "_inputContainer_1ejg3_1", J = "_fullWidth_1ejg3_8", K = "_label_1ejg3_12", P = "_label_large_1ejg3_20", Q = "_label_disabled_1ejg3_25", X = "_label_inverted_1ejg3_29", Y = "_label_inverted_disabled_1ejg3_33", ee = "_required_1ejg3_37", ne = "_required_disabled_1ejg3_42", te = "_required_inverted_1ejg3_46", ie = "_required_inverted_disabled_1ejg3_50", le = "_fileUploadContainer_1ejg3_54", se = "_iconContainerLeft_1ejg3_68", oe = "_iconContainerRight_1ejg3_76", re = "_dragOver_1ejg3_88", ae = "_variant_document_1ejg3_104", ce = "_icon_1ejg3_68", _e = "_variant_add_1ejg3_108", de = "_disabled_1ejg3_113", ge = "_error_1ejg3_124", ue = "_success_1ejg3_133", fe = "_loading_1ejg3_141", he = "_inverted_1ejg3_150", pe = "_uploadContent_1ejg3_176", je = "_selectedFileContent_1ejg3_188", me = "_withoutError_1ejg3_198", ve = "_selectedFileName_1ejg3_202", Fe = "_selectedFileSize_1ejg3_211", xe = "_removeButton_1ejg3_218", Ie = "_textContent_1ejg3_278", Ce = "_dragText_1ejg3_288", be = "_browseText_1ejg3_294", Te = "_hiddenInput_1ejg3_331", we = "_helperText_1ejg3_344", Ne = "_helperText_default_1ejg3_351", Se = "_helperText_compact_1ejg3_355", De = "_helperText_disabled_1ejg3_359", Ee = "_helperText_inverted_1ejg3_363", We = "_helperText_inverted_disabled_1ejg3_367", Le = "_errorMessage_1ejg3_372", Me = "_errorMessage_default_1ejg3_379", qe = "_errorMessage_compact_1ejg3_383", Ue = "_errorMessage_inverted_1ejg3_387", ze = "_selectedFilesContainer_1ejg3_392", Be = "_selectedFilesHeader_1ejg3_400", Ae = "_selectedFilesText_1ejg3_407", Oe = "_clearButton_1ejg3_413", $e = "_filesList_1ejg3_434", ke = "_fileItem_1ejg3_440", He = "_fileName_1ejg3_452", Re = "_fileSize_1ejg3_463", Ve = "_bigZIndex_1ejg3_504", Ze = "_cancelIconWrapper_1ejg3_508", ye = "_fadeInSlideDown_1ejg3_1", Ge = "_selectedFileInfo_1ejg3_524", Je = "_fadeInSlideUp_1ejg3_1", Ke = "_successIconWrapper_1ejg3_538", Pe = "_loadingIconWrapper_1ejg3_554", Qe = "_fadeIn_1ejg3_1", Xe = "_withSuccess_1ejg3_578", Ye = "_withLoading_1ejg3_592", en = "_errorText_1ejg3_606", nn = "_successText_1ejg3_622", tn = "_inlineFileContainer_1ejg3_684", ln = "_inlineFileIcon_1ejg3_693", sn = "_inlineFileInfo_1ejg3_720", on = "_inlineFileName_1ejg3_728", rn = "_inlineErrorText_1ejg3_737", an = "_inlineSuccessText_1ejg3_743", cn = "_inlineFileActions_1ejg3_749", _n = "_inlineActionIcon_1ejg3_756", dn = "_fadeInSlideUpCentered_1ejg3_1", e = {
|
|
7
|
+
inputContainer: G,
|
|
8
|
+
fullWidth: J,
|
|
9
|
+
label: K,
|
|
10
|
+
label_large: P,
|
|
11
|
+
label_disabled: Q,
|
|
12
|
+
label_inverted: X,
|
|
13
|
+
label_inverted_disabled: Y,
|
|
14
|
+
required: ee,
|
|
15
|
+
required_disabled: ne,
|
|
16
|
+
required_inverted: te,
|
|
17
|
+
required_inverted_disabled: ie,
|
|
18
|
+
fileUploadContainer: le,
|
|
19
|
+
iconContainerLeft: se,
|
|
20
|
+
iconContainerRight: oe,
|
|
21
|
+
dragOver: re,
|
|
22
|
+
variant_document: ae,
|
|
23
|
+
icon: ce,
|
|
24
|
+
variant_add: _e,
|
|
25
|
+
disabled: de,
|
|
26
|
+
error: ge,
|
|
27
|
+
success: ue,
|
|
28
|
+
loading: fe,
|
|
29
|
+
inverted: he,
|
|
30
|
+
uploadContent: pe,
|
|
31
|
+
selectedFileContent: je,
|
|
32
|
+
withoutError: me,
|
|
33
|
+
selectedFileName: ve,
|
|
34
|
+
selectedFileSize: Fe,
|
|
35
|
+
removeButton: xe,
|
|
36
|
+
textContent: Ie,
|
|
37
|
+
dragText: Ce,
|
|
38
|
+
browseText: be,
|
|
39
|
+
hiddenInput: Te,
|
|
40
|
+
helperText: we,
|
|
41
|
+
helperText_default: Ne,
|
|
42
|
+
helperText_compact: Se,
|
|
43
|
+
helperText_disabled: De,
|
|
44
|
+
helperText_inverted: Ee,
|
|
45
|
+
helperText_inverted_disabled: We,
|
|
46
|
+
errorMessage: Le,
|
|
47
|
+
errorMessage_default: Me,
|
|
48
|
+
errorMessage_compact: qe,
|
|
49
|
+
errorMessage_inverted: Ue,
|
|
50
|
+
selectedFilesContainer: ze,
|
|
51
|
+
selectedFilesHeader: Be,
|
|
52
|
+
selectedFilesText: Ae,
|
|
53
|
+
clearButton: Oe,
|
|
54
|
+
filesList: $e,
|
|
55
|
+
fileItem: ke,
|
|
56
|
+
fileName: He,
|
|
57
|
+
fileSize: Re,
|
|
58
|
+
bigZIndex: Ve,
|
|
59
|
+
cancelIconWrapper: Ze,
|
|
60
|
+
fadeInSlideDown: ye,
|
|
61
|
+
selectedFileInfo: Ge,
|
|
62
|
+
fadeInSlideUp: Je,
|
|
63
|
+
successIconWrapper: Ke,
|
|
64
|
+
loadingIconWrapper: Pe,
|
|
65
|
+
fadeIn: Qe,
|
|
66
|
+
withSuccess: Xe,
|
|
67
|
+
withLoading: Ye,
|
|
68
|
+
errorText: en,
|
|
69
|
+
successText: nn,
|
|
70
|
+
inlineFileContainer: tn,
|
|
71
|
+
inlineFileIcon: ln,
|
|
72
72
|
default: "_default_1ejg3_716",
|
|
73
|
-
inlineFileInfo:
|
|
74
|
-
inlineFileName:
|
|
75
|
-
inlineErrorText:
|
|
76
|
-
inlineSuccessText:
|
|
77
|
-
inlineFileActions:
|
|
78
|
-
inlineActionIcon:
|
|
79
|
-
fadeInSlideUpCentered:
|
|
80
|
-
},
|
|
81
|
-
variant:
|
|
82
|
-
helperText:
|
|
73
|
+
inlineFileInfo: sn,
|
|
74
|
+
inlineFileName: on,
|
|
75
|
+
inlineErrorText: rn,
|
|
76
|
+
inlineSuccessText: an,
|
|
77
|
+
inlineFileActions: cn,
|
|
78
|
+
inlineActionIcon: _n,
|
|
79
|
+
fadeInSlideUpCentered: dn
|
|
80
|
+
}, mn = ({
|
|
81
|
+
variant: N = "document",
|
|
82
|
+
helperText: S,
|
|
83
83
|
error: l,
|
|
84
84
|
success: r,
|
|
85
85
|
loading: s = !1,
|
|
86
86
|
disabled: c = !1,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
defaultFile: v = null,
|
|
88
|
+
inverted: D = !1,
|
|
89
|
+
dragText: E,
|
|
90
|
+
browseText: W = "Seleccionar archivo",
|
|
90
91
|
allowedTypes: _,
|
|
91
|
-
inspectFileFunction:
|
|
92
|
+
inspectFileFunction: L = () => {
|
|
92
93
|
console.warn(
|
|
93
94
|
"No hay función asignada para ver el archivo. Hay que pasarla al componente como prop inspectFileFunction."
|
|
94
95
|
);
|
|
95
96
|
},
|
|
96
|
-
maxFileSize:
|
|
97
|
+
maxFileSize: F,
|
|
97
98
|
onFileSelect: f,
|
|
98
|
-
fullWidth:
|
|
99
|
-
style:
|
|
99
|
+
fullWidth: x = !1,
|
|
100
|
+
style: M
|
|
100
101
|
}) => {
|
|
101
|
-
const [
|
|
102
|
-
|
|
102
|
+
const [q, h] = m(!1), [t, U] = m(v || null), [I, C] = m(!1), p = V(null);
|
|
103
|
+
Z(() => {
|
|
103
104
|
if (!t) return;
|
|
104
105
|
const n = [];
|
|
105
106
|
l && n.push("error"), r && n.push("success"), s && n.push("loading"), n.length > 1 && console.warn(
|
|
106
107
|
`⚠️ FileUpload: Múltiples estados detectados (${n.join(", ")}). Solo un estado debe estar activo a la vez.`
|
|
107
108
|
);
|
|
108
109
|
}, [l, r, s, t]);
|
|
109
|
-
const
|
|
110
|
+
const z = S, B = (n) => {
|
|
110
111
|
n.preventDefault(), c || h(!0);
|
|
111
|
-
}, B = (n) => {
|
|
112
|
-
n.preventDefault(), h(!1);
|
|
113
112
|
}, A = (n) => {
|
|
114
|
-
n.preventDefault();
|
|
113
|
+
n.preventDefault(), h(!1);
|
|
115
114
|
}, O = (n) => {
|
|
115
|
+
n.preventDefault();
|
|
116
|
+
}, $ = (n) => {
|
|
116
117
|
if (n.preventDefault(), h(!1), c) return;
|
|
117
118
|
const a = n.dataTransfer.files;
|
|
118
|
-
|
|
119
|
-
},
|
|
119
|
+
b(a);
|
|
120
|
+
}, k = (n) => {
|
|
120
121
|
const a = n.target.files;
|
|
121
|
-
|
|
122
|
-
},
|
|
122
|
+
b(a);
|
|
123
|
+
}, b = (n) => {
|
|
123
124
|
if (!n) return;
|
|
124
125
|
if (_ && _.length > 0)
|
|
125
126
|
for (let o = 0; o < n.length; o++) {
|
|
@@ -131,54 +132,54 @@ import '../../assets/FileUpload.css';const y = "_inputContainer_1ejg3_1", G = "_
|
|
|
131
132
|
return;
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
|
-
if (
|
|
135
|
+
if (F)
|
|
135
136
|
for (let o = 0; o < n.length; o++) {
|
|
136
137
|
const d = n[o];
|
|
137
|
-
if (d.size >
|
|
138
|
+
if (d.size > F) {
|
|
138
139
|
console.warn(`File ${d.name} exceeds maximum size`);
|
|
139
140
|
return;
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
143
|
const a = n ? n[0] : null;
|
|
143
|
-
|
|
144
|
+
U(a), f == null || f(
|
|
144
145
|
a ? (() => {
|
|
145
146
|
const o = new DataTransfer();
|
|
146
147
|
return o.items.add(a), o.files;
|
|
147
148
|
})() : null
|
|
148
149
|
);
|
|
149
|
-
},
|
|
150
|
+
}, H = () => {
|
|
150
151
|
!c && p.current && p.current.click();
|
|
151
|
-
},
|
|
152
|
+
}, R = [
|
|
152
153
|
e.fileUploadContainer,
|
|
153
|
-
|
|
154
|
-
e[`variant_${
|
|
154
|
+
x && e.fullWidth,
|
|
155
|
+
e[`variant_${N}`],
|
|
155
156
|
t && l ? e.error : "",
|
|
156
157
|
t && !l && s ? e.loading : "",
|
|
157
158
|
t && !l && !s && r ? e.success : "",
|
|
158
159
|
c ? e.disabled : "",
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
D ? e.inverted : "",
|
|
161
|
+
q ? e.dragOver : ""
|
|
161
162
|
].filter(Boolean).join(" ");
|
|
162
163
|
return /* @__PURE__ */ i(
|
|
163
164
|
"div",
|
|
164
165
|
{
|
|
165
|
-
className: `${e.inputContainer} ${
|
|
166
|
+
className: `${e.inputContainer} ${x ? e.fullWidth : ""}`,
|
|
166
167
|
children: /* @__PURE__ */ g(
|
|
167
168
|
"div",
|
|
168
169
|
{
|
|
169
|
-
className:
|
|
170
|
-
onDragEnter:
|
|
171
|
-
onDragLeave:
|
|
172
|
-
onDragOver:
|
|
173
|
-
onDrop:
|
|
170
|
+
className: R,
|
|
171
|
+
onDragEnter: B,
|
|
172
|
+
onDragLeave: A,
|
|
173
|
+
onDragOver: O,
|
|
174
|
+
onDrop: $,
|
|
174
175
|
onClick: t ? () => {
|
|
175
|
-
} :
|
|
176
|
-
style: { cursor: c ? "not-allowed" : "pointer", ...
|
|
176
|
+
} : H,
|
|
177
|
+
style: { cursor: c ? "not-allowed" : "pointer", ...M },
|
|
177
178
|
onMouseEnter: () => {
|
|
178
|
-
|
|
179
|
+
C(!0);
|
|
179
180
|
},
|
|
180
181
|
onMouseLeave: () => {
|
|
181
|
-
|
|
182
|
+
C(!1);
|
|
182
183
|
},
|
|
183
184
|
children: [
|
|
184
185
|
/* @__PURE__ */ i(
|
|
@@ -187,7 +188,7 @@ import '../../assets/FileUpload.css';const y = "_inputContainer_1ejg3_1", G = "_
|
|
|
187
188
|
ref: p,
|
|
188
189
|
type: "file",
|
|
189
190
|
className: e.hiddenInput,
|
|
190
|
-
onChange:
|
|
191
|
+
onChange: k,
|
|
191
192
|
disabled: c,
|
|
192
193
|
accept: _ == null ? void 0 : _.join(",")
|
|
193
194
|
}
|
|
@@ -195,7 +196,7 @@ import '../../assets/FileUpload.css';const y = "_inputContainer_1ejg3_1", G = "_
|
|
|
195
196
|
/* @__PURE__ */ g("div", { className: e.uploadContent, children: [
|
|
196
197
|
t && l && /* @__PURE__ */ i("div", { className: e.cancelIconWrapper, children: /* @__PURE__ */ i(u, { name: "CancelIcon", fill: "white", height: 30, width: 30 }) }),
|
|
197
198
|
t && !l && s && /* @__PURE__ */ i("div", { className: e.loadingIconWrapper, children: /* @__PURE__ */ i(
|
|
198
|
-
|
|
199
|
+
y,
|
|
199
200
|
{
|
|
200
201
|
size: 10,
|
|
201
202
|
color: "primary",
|
|
@@ -218,14 +219,14 @@ import '../../assets/FileUpload.css';const y = "_inputContainer_1ejg3_1", G = "_
|
|
|
218
219
|
] }) }),
|
|
219
220
|
t && l ? /* @__PURE__ */ i("p", { className: e.errorText, children: l }) : t && !s && r ? /* @__PURE__ */ i("p", { className: e.successText, children: r }) : null,
|
|
220
221
|
t && !l && !s && !r && /* @__PURE__ */ i(
|
|
221
|
-
|
|
222
|
+
w,
|
|
222
223
|
{
|
|
223
224
|
className: e.bigZIndex,
|
|
224
225
|
icon: {
|
|
225
226
|
name: "Visibility",
|
|
226
227
|
position: "before"
|
|
227
228
|
},
|
|
228
|
-
onClick:
|
|
229
|
+
onClick: L,
|
|
229
230
|
size: "small",
|
|
230
231
|
children: "Ver archivo"
|
|
231
232
|
}
|
|
@@ -233,29 +234,29 @@ import '../../assets/FileUpload.css';const y = "_inputContainer_1ejg3_1", G = "_
|
|
|
233
234
|
]
|
|
234
235
|
}
|
|
235
236
|
)
|
|
236
|
-
) : /* @__PURE__ */ i(
|
|
237
|
-
/* @__PURE__ */ i("span", { className: e.dragText, children:
|
|
237
|
+
) : /* @__PURE__ */ i(T, { children: /* @__PURE__ */ g("div", { className: e.textContent, children: [
|
|
238
|
+
/* @__PURE__ */ i("span", { className: e.dragText, children: E || z }),
|
|
238
239
|
/* @__PURE__ */ i(
|
|
239
|
-
|
|
240
|
+
w,
|
|
240
241
|
{
|
|
241
242
|
size: "small",
|
|
242
243
|
icon: {
|
|
243
244
|
name: "DownloadIcon",
|
|
244
245
|
position: "before"
|
|
245
246
|
},
|
|
246
|
-
children:
|
|
247
|
+
children: W
|
|
247
248
|
}
|
|
248
249
|
)
|
|
249
250
|
] }) })
|
|
250
251
|
] }),
|
|
251
|
-
/* @__PURE__ */ g(
|
|
252
|
+
/* @__PURE__ */ g(T, { children: [
|
|
252
253
|
/* @__PURE__ */ i("div", { className: e.iconContainerLeft, children: /* @__PURE__ */ i(
|
|
253
254
|
u,
|
|
254
255
|
{
|
|
255
256
|
name: "Documentos",
|
|
256
257
|
height: 140,
|
|
257
258
|
width: 140,
|
|
258
|
-
fill: t && l ? "#FEF2F2" :
|
|
259
|
+
fill: t && l ? "#FEF2F2" : I ? "#C4D5F1" : "#E0E9F8"
|
|
259
260
|
}
|
|
260
261
|
) }),
|
|
261
262
|
/* @__PURE__ */ i("div", { className: e.iconContainerRight, children: /* @__PURE__ */ i(
|
|
@@ -264,7 +265,7 @@ import '../../assets/FileUpload.css';const y = "_inputContainer_1ejg3_1", G = "_
|
|
|
264
265
|
name: "Documentos",
|
|
265
266
|
height: 140,
|
|
266
267
|
width: 140,
|
|
267
|
-
fill: t && l ? "#FEF2F2" :
|
|
268
|
+
fill: t && l ? "#FEF2F2" : I ? "#C4D5F1" : "#E0E9F8"
|
|
268
269
|
}
|
|
269
270
|
) })
|
|
270
271
|
] })
|
|
@@ -275,5 +276,5 @@ import '../../assets/FileUpload.css';const y = "_inputContainer_1ejg3_1", G = "_
|
|
|
275
276
|
);
|
|
276
277
|
};
|
|
277
278
|
export {
|
|
278
|
-
|
|
279
|
+
mn as FileUpload
|
|
279
280
|
};
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { ButtonSize, ButtonVariant } from '../Button';
|
|
3
|
+
type ModalButtonProps = {
|
|
4
|
+
show?: boolean;
|
|
5
|
+
text?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
action?: () => Promise<void> | void;
|
|
8
|
+
size?: ButtonSize;
|
|
9
|
+
variant?: ButtonVariant;
|
|
10
|
+
loading?: boolean;
|
|
11
|
+
};
|
|
2
12
|
/**
|
|
3
13
|
* Props del Modal
|
|
4
14
|
*/
|
|
@@ -7,10 +17,8 @@ export interface ModalProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
7
17
|
title?: string;
|
|
8
18
|
children?: React.ReactNode;
|
|
9
19
|
width?: number;
|
|
10
|
-
confirmButton
|
|
11
|
-
cancelButton
|
|
12
|
-
onConfirm?: () => Promise<void> | void;
|
|
13
|
-
onCancel?: () => Promise<void> | void;
|
|
20
|
+
confirmButton: ModalButtonProps;
|
|
21
|
+
cancelButton: ModalButtonProps;
|
|
14
22
|
zIndex?: number;
|
|
15
23
|
className?: string;
|
|
16
24
|
onClickOverlay?: (() => Promise<void> | void) | false;
|
|
@@ -18,32 +26,34 @@ export interface ModalProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
18
26
|
closeModal: () => void;
|
|
19
27
|
}
|
|
20
28
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
29
|
+
* Modal con overlay, header, body y footer configurable.
|
|
30
|
+
*
|
|
31
|
+
* Puedes pasar un objeto a `confirmButton` y `cancelButton` para controlar:
|
|
32
|
+
* - `show`: si se renderiza el botón (por defecto true)
|
|
33
|
+
* - `text`: texto del botón
|
|
34
|
+
* - `action`: función a ejecutar al hacer click
|
|
35
|
+
* - `variant`: variante visual del botón ("brand", "outline", etc.)
|
|
36
|
+
* - `size`: tamaño del botón ("small", "medium", "large")
|
|
37
|
+
* - `disabled`: deshabilita el botón
|
|
38
|
+
* - `loading`: muestra estado de carga en el botón
|
|
24
39
|
*
|
|
25
40
|
* @param isOpen - Controla la visibilidad del modal.
|
|
26
41
|
* @param title - Título que se muestra en el header del modal.
|
|
27
42
|
* @param children - Contenido del modal; puede ser cualquier componente React.
|
|
28
43
|
* @param width - Ancho del modal en píxeles. Por defecto 752.
|
|
29
|
-
* @param confirmButton -
|
|
30
|
-
* @param cancelButton -
|
|
31
|
-
* @param onConfirm - Callback opcional al pulsar el botón de confirmación.
|
|
32
|
-
* @param onCancel - Callback opcional al pulsar el botón de cancelación.
|
|
44
|
+
* @param confirmButton - Configuración del botón de confirmación.
|
|
45
|
+
* @param cancelButton - Configuración del botón de cancelación.
|
|
33
46
|
* @param zIndex - Número para controlar la superposición del modal.
|
|
34
47
|
* @param className - Clases CSS adicionales para el modal.
|
|
35
48
|
* @param style - Estilos inline adicionales para el contenedor del modal.
|
|
36
|
-
* @param onClickOverlay - Callback opcional al hacer click fuera del modal.
|
|
37
|
-
*
|
|
38
|
-
* @param onClose - Callback opcional al hacer click en el icono de cierre.
|
|
39
|
-
* Si se pasa `false`, no se renderiza el icono.
|
|
49
|
+
* @param onClickOverlay - Callback opcional al hacer click fuera del modal. Si se pasa `false`, el overlay no cierra el modal ni ejecuta acción.
|
|
50
|
+
* @param onClose - Callback opcional al pulsar el icono de cierre. Si se pasa `false`, no se renderiza el icono de cierre.
|
|
40
51
|
* @param closeModal - Función obligatoria que cierra el modal desde el exterior.
|
|
41
52
|
*
|
|
42
|
-
*
|
|
43
53
|
* @example
|
|
44
54
|
* ```tsx
|
|
45
55
|
* import { useState } from "react";
|
|
46
|
-
* import { Modal, Button } from "
|
|
56
|
+
* import { Modal, Button } from "bmi-next-brokers";
|
|
47
57
|
*
|
|
48
58
|
* export default function Example() {
|
|
49
59
|
* const [isOpen, setIsOpen] = useState(false);
|
|
@@ -60,21 +70,25 @@ export interface ModalProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
60
70
|
* closeModal={() => setIsOpen(false)}
|
|
61
71
|
* title="Ejemplo de Modal"
|
|
62
72
|
* width={500}
|
|
63
|
-
* confirmButton={
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
73
|
+
* confirmButton={{
|
|
74
|
+
* text: "Guardar",
|
|
75
|
+
* action: handleConfirm,
|
|
76
|
+
* variant: "brand",
|
|
77
|
+
* size: "small",
|
|
78
|
+
* loading: false
|
|
79
|
+
* }}
|
|
80
|
+
* cancelButton={{
|
|
81
|
+
* show: false, // no se renderiza
|
|
82
|
+
* text: "Cerrar",
|
|
83
|
+
* action: handleCancel,
|
|
84
|
+
* variant: "outline",
|
|
85
|
+
* size: "small",
|
|
86
|
+
* loading: false
|
|
87
|
+
* }}
|
|
67
88
|
* onClose={() => console.log("Click en el botón de cierre")}
|
|
68
89
|
* >
|
|
69
90
|
* <div style={{ padding: "16px 0" }}>
|
|
70
|
-
* <p>
|
|
71
|
-
* Este es un contenido de ejemplo dentro del modal. Puedes poner
|
|
72
|
-
* cualquier componente aquí: formularios, listas, tablas, etc.
|
|
73
|
-
* </p>
|
|
74
|
-
* <p>
|
|
75
|
-
* Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nisi vel
|
|
76
|
-
* consectetur interdum, aliquet nunc vitae convallis sapien.
|
|
77
|
-
* </p>
|
|
91
|
+
* <p>Contenido del modal...</p>
|
|
78
92
|
* </div>
|
|
79
93
|
* </Modal>
|
|
80
94
|
* </>
|
|
@@ -83,3 +97,4 @@ export interface ModalProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
83
97
|
* ```
|
|
84
98
|
*/
|
|
85
99
|
export declare const Modal: React.FC<ModalProps>;
|
|
100
|
+
export {};
|