bmi-next-brokers 2.4.4 → 2.4.5
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,5 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { ButtonSize, ButtonVariant } from '../Button';
|
|
3
|
+
import { IconConfig } from '../Button/Button';
|
|
3
4
|
type ModalButtonProps = {
|
|
4
5
|
show?: boolean;
|
|
5
6
|
text?: string;
|
|
@@ -10,6 +11,7 @@ type ModalButtonProps = {
|
|
|
10
11
|
loading?: boolean;
|
|
11
12
|
id?: string;
|
|
12
13
|
className?: string;
|
|
14
|
+
icon?: IconConfig;
|
|
13
15
|
};
|
|
14
16
|
/**
|
|
15
17
|
* Props del Modal
|
|
@@ -29,6 +31,9 @@ export interface ModalProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
29
31
|
withScroll?: boolean;
|
|
30
32
|
fullWidthFooter?: boolean;
|
|
31
33
|
helperElement?: React.ReactNode;
|
|
34
|
+
titleClassName?: string;
|
|
35
|
+
contentClassName?: string;
|
|
36
|
+
footerClassName?: string;
|
|
32
37
|
}
|
|
33
38
|
/**
|
|
34
39
|
* Modal con overlay, header, body y footer configurable.
|
|
@@ -109,5 +114,5 @@ export interface ModalProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
|
109
114
|
* }
|
|
110
115
|
* ```
|
|
111
116
|
*/
|
|
112
|
-
export declare const Modal: ({ isOpen, title, children, width, confirmButton, cancelButton, zIndex, className, style, onClickOverlay, onClose, closeModal, withScroll, fullWidthFooter, helperElement, ...props }: ModalProps) => React.ReactPortal | null;
|
|
117
|
+
export declare const Modal: ({ isOpen, title, children, width, confirmButton, cancelButton, zIndex, className, titleClassName, contentClassName, footerClassName, style, onClickOverlay, onClose, closeModal, withScroll, fullWidthFooter, helperElement, ...props }: ModalProps) => React.ReactPortal | null;
|
|
113
118
|
export {};
|
|
@@ -1,98 +1,107 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { Icon as
|
|
4
|
-
import { useScrollLock as
|
|
5
|
-
import { CloseContext as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { createPortal as
|
|
8
|
-
import '../../assets/index7.css';const
|
|
9
|
-
modalOverlay:
|
|
10
|
-
closing:
|
|
11
|
-
modalLayout:
|
|
12
|
-
modal:
|
|
13
|
-
modalHeader:
|
|
14
|
-
withBorder:
|
|
15
|
-
modalTitle:
|
|
16
|
-
closeIcon:
|
|
17
|
-
modalBody:
|
|
18
|
-
modalFooter:
|
|
19
|
-
buttonsDiv:
|
|
20
|
-
fullWidthFooter:
|
|
21
|
-
},
|
|
1
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as I, useState as v, useEffect as K } from "react";
|
|
3
|
+
import { Icon as Q } from "../../icons/Icon.js";
|
|
4
|
+
import { useScrollLock as U } from "../../hooks/useScrollLock.js";
|
|
5
|
+
import { CloseContext as c } from "../../hooks/useClose.js";
|
|
6
|
+
import { Button as S } from "../Button/Button.js";
|
|
7
|
+
import { createPortal as t } from "react-dom";
|
|
8
|
+
import '../../assets/index7.css';const u = "_modalOverlay_1hyzx_1", n = "_closing_1hyzx_15", B = "_modalLayout_1hyzx_37", ss = "_modal_1hyzx_1", es = "_modalHeader_1hyzx_57", ls = "_withBorder_1hyzx_65", as = "_modalTitle_1hyzx_70", ds = "_closeIcon_1hyzx_82", rs = "_modalBody_1hyzx_95", is = "_modalFooter_1hyzx_106", hs = "_buttonsDiv_1hyzx_111", os = "_fullWidthFooter_1hyzx_121", l = {
|
|
9
|
+
modalOverlay: u,
|
|
10
|
+
closing: n,
|
|
11
|
+
modalLayout: B,
|
|
12
|
+
modal: ss,
|
|
13
|
+
modalHeader: es,
|
|
14
|
+
withBorder: ls,
|
|
15
|
+
modalTitle: as,
|
|
16
|
+
closeIcon: ds,
|
|
17
|
+
modalBody: rs,
|
|
18
|
+
modalFooter: is,
|
|
19
|
+
buttonsDiv: hs,
|
|
20
|
+
fullWidthFooter: os
|
|
21
|
+
}, zs = ({
|
|
22
22
|
isOpen: m,
|
|
23
23
|
title: x,
|
|
24
24
|
children: b,
|
|
25
|
-
width:
|
|
25
|
+
width: k = 752,
|
|
26
26
|
confirmButton: s,
|
|
27
27
|
cancelButton: e,
|
|
28
|
-
zIndex:
|
|
29
|
-
className:
|
|
30
|
-
|
|
28
|
+
zIndex: L,
|
|
29
|
+
className: O,
|
|
30
|
+
titleClassName: g,
|
|
31
|
+
contentClassName: w,
|
|
32
|
+
footerClassName: z,
|
|
33
|
+
style: F,
|
|
31
34
|
onClickOverlay: y,
|
|
32
|
-
onClose:
|
|
33
|
-
closeModal:
|
|
34
|
-
withScroll:
|
|
35
|
-
fullWidthFooter:
|
|
36
|
-
helperElement:
|
|
37
|
-
...
|
|
35
|
+
onClose: h,
|
|
36
|
+
closeModal: H,
|
|
37
|
+
withScroll: f = !0,
|
|
38
|
+
fullWidthFooter: T = !1,
|
|
39
|
+
helperElement: W,
|
|
40
|
+
...D
|
|
38
41
|
}) => {
|
|
39
|
-
const
|
|
40
|
-
|
|
42
|
+
const $ = I(null), [R, p] = v(!1), _ = I(null), [j, A] = v(!1), [Y, P] = v(!1);
|
|
43
|
+
U(m);
|
|
41
44
|
const i = () => {
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
p(!0), setTimeout(() => {
|
|
46
|
+
H(), p(!1);
|
|
44
47
|
}, 250);
|
|
45
|
-
},
|
|
48
|
+
}, V = async (d) => {
|
|
46
49
|
var r;
|
|
47
|
-
(r =
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
},
|
|
50
|
+
(r = $.current) != null && r.contains(d.target) || y !== !1 && (typeof y == "function" && await y(), i());
|
|
51
|
+
}, X = async () => {
|
|
52
|
+
h !== !1 && (typeof h == "function" && await h(), i());
|
|
53
|
+
}, Z = async () => {
|
|
51
54
|
try {
|
|
52
55
|
s != null && s.action && await s.action(), i();
|
|
53
56
|
} catch {
|
|
54
57
|
return;
|
|
55
58
|
}
|
|
56
|
-
},
|
|
59
|
+
}, M = async () => {
|
|
57
60
|
try {
|
|
58
61
|
e != null && e.action && await e.action(), i();
|
|
59
62
|
} catch {
|
|
60
63
|
return;
|
|
61
64
|
}
|
|
62
|
-
},
|
|
63
|
-
return
|
|
65
|
+
}, q = e && Object.keys(e).length > 0, G = s && Object.keys(s).length > 0, C = q && (e.show ?? !0), N = G && (s.show ?? !0), J = `${l.modal} ${O || ""}`;
|
|
66
|
+
return K(() => {
|
|
64
67
|
if (!_.current) return;
|
|
65
68
|
const d = _.current, r = () => {
|
|
66
|
-
|
|
69
|
+
P(d.scrollTop > 0), A(d.scrollHeight > d.clientHeight);
|
|
67
70
|
};
|
|
68
71
|
r(), d.addEventListener("scroll", r);
|
|
69
|
-
const
|
|
70
|
-
return
|
|
71
|
-
d.removeEventListener("scroll", r),
|
|
72
|
+
const E = new ResizeObserver(r);
|
|
73
|
+
return E.observe(d), () => {
|
|
74
|
+
d.removeEventListener("scroll", r), E.disconnect();
|
|
72
75
|
};
|
|
73
|
-
}, [b]), m ?
|
|
76
|
+
}, [b]), m ? t(
|
|
74
77
|
/* @__PURE__ */ a(
|
|
75
78
|
"div",
|
|
76
79
|
{
|
|
77
|
-
className: `${l.modalOverlay} ${
|
|
78
|
-
style: { zIndex: 3e3 + (
|
|
79
|
-
onClick:
|
|
80
|
-
children: /* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
80
|
+
className: `${l.modalOverlay} ${R ? l.closing : ""}`,
|
|
81
|
+
style: { zIndex: 3e3 + (L || 0) },
|
|
82
|
+
onClick: V,
|
|
83
|
+
children: /* @__PURE__ */ o("div", { ref: $, className: l.modalLayout, children: [
|
|
84
|
+
/* @__PURE__ */ o(
|
|
82
85
|
"div",
|
|
83
86
|
{
|
|
84
|
-
className:
|
|
85
|
-
style: { maxWidth:
|
|
86
|
-
...
|
|
87
|
+
className: J,
|
|
88
|
+
style: { maxWidth: k, ...F },
|
|
89
|
+
...D,
|
|
87
90
|
children: [
|
|
88
|
-
/* @__PURE__ */
|
|
91
|
+
/* @__PURE__ */ o(
|
|
89
92
|
"div",
|
|
90
93
|
{
|
|
91
|
-
className: `${l.modalHeader} ${
|
|
94
|
+
className: `${l.modalHeader} ${Y ? l.withBorder : ""} `,
|
|
92
95
|
children: [
|
|
93
|
-
x && /* @__PURE__ */ a(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
x && /* @__PURE__ */ a(
|
|
97
|
+
"span",
|
|
98
|
+
{
|
|
99
|
+
className: `${l.modalTitle} ${g || ""}`,
|
|
100
|
+
children: x
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
h !== !1 && /* @__PURE__ */ a("div", { className: l.closeIcon, onClick: X, children: /* @__PURE__ */ a(
|
|
104
|
+
Q,
|
|
96
105
|
{
|
|
97
106
|
name: "Close",
|
|
98
107
|
width: 12,
|
|
@@ -106,47 +115,49 @@ import '../../assets/index7.css';const Q = "_modalOverlay_1hyzx_1", U = "_closin
|
|
|
106
115
|
/* @__PURE__ */ a(
|
|
107
116
|
"div",
|
|
108
117
|
{
|
|
109
|
-
className: l.modalBody
|
|
118
|
+
className: `${l.modalBody} ${w || ""}`,
|
|
110
119
|
style: {
|
|
111
|
-
overflowY:
|
|
120
|
+
overflowY: f ? "auto" : "hidden"
|
|
112
121
|
},
|
|
113
122
|
ref: _,
|
|
114
|
-
children: /* @__PURE__ */ a(
|
|
123
|
+
children: /* @__PURE__ */ a(c.Provider, { value: i, children: b })
|
|
115
124
|
}
|
|
116
125
|
),
|
|
117
|
-
(
|
|
126
|
+
(C || N) && /* @__PURE__ */ a(
|
|
118
127
|
"div",
|
|
119
128
|
{
|
|
120
|
-
className: `${l.modalFooter} ${
|
|
121
|
-
children: /* @__PURE__ */
|
|
129
|
+
className: `${l.modalFooter} ${j ? l.withBorder : ""}`,
|
|
130
|
+
children: /* @__PURE__ */ o(
|
|
122
131
|
"div",
|
|
123
132
|
{
|
|
124
|
-
className: `${l.buttonsDiv} ${
|
|
133
|
+
className: `${l.buttonsDiv} ${T ? l.fullWidthFooter : ""} ${z || ""}`,
|
|
125
134
|
children: [
|
|
126
|
-
|
|
127
|
-
|
|
135
|
+
C && /* @__PURE__ */ a(
|
|
136
|
+
S,
|
|
128
137
|
{
|
|
129
138
|
variant: (e == null ? void 0 : e.variant) || "outline",
|
|
130
|
-
onClick:
|
|
139
|
+
onClick: M,
|
|
131
140
|
disabled: (e == null ? void 0 : e.disabled) || !1,
|
|
132
141
|
size: (e == null ? void 0 : e.size) || "small",
|
|
133
142
|
loading: e == null ? void 0 : e.loading,
|
|
134
143
|
className: e == null ? void 0 : e.className,
|
|
144
|
+
icon: e.icon,
|
|
135
145
|
fullWidth: !0,
|
|
136
146
|
children: (e == null ? void 0 : e.text) || "Cancelar"
|
|
137
147
|
}
|
|
138
148
|
),
|
|
139
|
-
|
|
140
|
-
|
|
149
|
+
N && /* @__PURE__ */ a(
|
|
150
|
+
S,
|
|
141
151
|
{
|
|
142
152
|
type: "submit",
|
|
143
153
|
form: s == null ? void 0 : s.id,
|
|
144
154
|
variant: (s == null ? void 0 : s.variant) || "brand",
|
|
145
|
-
onClick:
|
|
155
|
+
onClick: Z,
|
|
146
156
|
disabled: (s == null ? void 0 : s.disabled) || !1,
|
|
147
157
|
size: (s == null ? void 0 : s.size) || "small",
|
|
148
158
|
loading: s == null ? void 0 : s.loading,
|
|
149
159
|
className: s == null ? void 0 : s.className,
|
|
160
|
+
icon: s.icon,
|
|
150
161
|
fullWidth: !0,
|
|
151
162
|
children: (s == null ? void 0 : s.text) || "Confirmar"
|
|
152
163
|
}
|
|
@@ -159,7 +170,7 @@ import '../../assets/index7.css';const Q = "_modalOverlay_1hyzx_1", U = "_closin
|
|
|
159
170
|
]
|
|
160
171
|
}
|
|
161
172
|
),
|
|
162
|
-
|
|
173
|
+
W
|
|
163
174
|
] })
|
|
164
175
|
}
|
|
165
176
|
),
|
|
@@ -167,5 +178,5 @@ import '../../assets/index7.css';const Q = "_modalOverlay_1hyzx_1", U = "_closin
|
|
|
167
178
|
) : null;
|
|
168
179
|
};
|
|
169
180
|
export {
|
|
170
|
-
|
|
181
|
+
zs as Modal
|
|
171
182
|
};
|
package/package.json
CHANGED