@lanaco/lnc-react-ui 4.0.181 → 4.0.182
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/Modal.cjs +2 -2
- package/dist/Modal.js +102 -102
- package/package.json +1 -1
package/dist/Modal.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),y=require("react"),o=require("./index-BpbMKBf_.cjs"),C=require("./emotion-styled.browser.esm-BtEseadx.cjs"),_=require("./Icon.cjs"),w=require("./utils-RnrgDDZP.cjs"),V=require("./index-41nUb2kP.cjs"),L=require("./motion-B_VPZaJq.cjs"),G=require("./emotion-element-f0de968e.browser.esm-B7k6i6lC.cjs"),N=require("./index-DZoWlChs.cjs"),x="5rem",h="3.8rem",i="1.5rem",W=(e,n,a)=>n&&a?e=="FULL"?`calc(100dvh - ${h} - ${x})`:`calc(100dvh - ${h} - ${x} - ${i})`:n?e=="FULL"?`calc(100dvh - ${h})`:`calc(100dvh - ${h} - ${i})`:a?e=="FULL"?`calc(100dvh - ${x})`:`calc(100dvh - ${x} - ${i})`:e=="FULL"?"100dvh":`calc(100dvh - ${i})`,X=e=>e=="FULL"?"100vw":`calc(100vw - ${i})`,J=(e,n,a)=>e=="FULL"?"0":`${n?"0":"16px"} 0 ${a?"0":"16px"} 0`,K=C.styled(L.motion.div)`
|
|
2
2
|
position: ${e=>e.scrollOverlay==!0?"absolute":"fixed"};
|
|
3
3
|
top: 0;
|
|
4
4
|
left: 0;
|
|
@@ -81,4 +81,4 @@
|
|
|
81
81
|
width: 100%;
|
|
82
82
|
background-color: ${e=>e.overlayColor};
|
|
83
83
|
z-index: 3;
|
|
84
|
-
`,A=y.forwardRef((e,
|
|
84
|
+
`,A=y.forwardRef((e,n)=>{const{portalElement:a=document.body,isOpen:c=!1,header:p,footer:l,scrollOverlay:s=!1,overlay:d=!0,overlayColor:u="rgba(0, 0, 0, 0.3)",showCloseButton:m=!0,onOpen:f=()=>{},onClose:g=()=>{},zIndex:O=1e3,size:$="fluid",clickOutsideToClose:b=!0,className:T="",style:D={},overlayProps:P,overlayAnimation:F={animate:{opacity:1},exit:{opacity:0},initial:{opacity:0},transition:{type:"spring",duration:.6}},modalAnimation:U={animate:{opacity:1},exit:{opacity:0},initial:{opacity:0},transition:{type:"spring",duration:.6}},onFinishOpen:H=()=>{},children:z,rest:M}=e,R=y.useRef(),[v,k]=y.useState(c);let B={theme:G.useTheme(),size:$,zIndex:O,className:T,style:D};const q=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation(),t.target===t.currentTarget&&b&&j(t)};y.useImperativeHandle(n,()=>({open(){S()},close(){j()},isOpen(){return v}}));const S=t=>{k(!0),f(t)},j=t=>{k(!1),g(t)};return y.useEffect(()=>{v===!0&&H()},[v]),r.jsx(r.Fragment,{children:v&&r.jsx(r.Fragment,{children:a?r.jsx(r.Fragment,{children:V.reactDomExports.createPortal(r.jsx(E,{ref:R,overlay:d,scrollOverlay:s,onClickOutsideModal:q,overlayColor:u,overlayProps:P,overlayAnimation:F,modalAnimation:U,themeProps:B,showCloseButton:m,close:j,header:p,footer:l,isOpen:c,...M,children:z}),a)}):r.jsx(E,{ref:R,overlay:d,scrollOverlay:s,onClickOutsideModal:q,overlayColor:u,overlayProps:P,overlayAnimation:F,modalAnimation:U,themeProps:B,showCloseButton:m,close:j,header:p,footer:l,isOpen:c,...M,children:z})})})}),E=y.forwardRef(({overlay:e,scrollOverlay:n,onClickOutsideModal:a,overlayColor:c,overlayProps:p,overlayAnimation:l,modalAnimation:s,themeProps:d,showCloseButton:u,header:m,footer:f,close:g,isOpen:O,children:$,...b},T)=>r.jsx(N.AnimatePresence,{children:e?r.jsxs(r.Fragment,{children:[r.jsx(Z,{scrollOverlay:n,onClick:a,overlayColor:c,...p,...l}),r.jsx(K,{...d,onClick:a,scrollOverlay:n,overlayColor:c,isOpen:O,...p,...l,children:r.jsx(I,{ref:T,themeProps:d,scrollOverlay:n,modalAnimation:s,showCloseButton:u,close:g,header:m,footer:f,...b,children:$})})]}):r.jsx(I,{ref:T,themeProps:d,modalAnimation:s,showCloseButton:u,close:g,header:m,footer:f,...b,children:$})})),I=y.forwardRef(({themeProps:e,scrollOverlay:n,modalAnimation:a,showCloseButton:c,close:p,header:l,footer:s,children:d,...u},m)=>r.jsx(N.AnimatePresence,{children:r.jsxs(Q,{ref:m,...e,...a,header:l,footer:s,scrollOverlay:n,...u,className:`modal-lnc-container ${e==null?void 0:e.className}`,children:[c&&r.jsx(Y,{...e,className:"modal-lnc-times",onClick:p,children:r.jsx(_,{icon:"times"})}),l&&r.jsx("div",{className:"lnc-modal-header",children:l}),r.jsx("div",{className:"lnc-modal-content",children:d}),s&&r.jsx("div",{className:"lnc-modal-footer",children:s})]})}));A.propTypes={portalElement:o.PropTypes.any,isOpen:o.PropTypes.bool,header:o.PropTypes.oneOfType([o.PropTypes.string,o.PropTypes.element]),footer:o.PropTypes.oneOfType([o.PropTypes.string,o.PropTypes.element]),showCloseButton:o.PropTypes.bool,overlay:o.PropTypes.bool,scrollOverlay:o.PropTypes.bool,onOpen:o.PropTypes.func,onClose:o.PropTypes.func,zIndex:o.PropTypes.number,clickOutsideToClose:o.PropTypes.bool,overlayColor:o.PropTypes.string,overlayAnimation:o.PropTypes.object,modalAnimation:o.PropTypes.object,className:o.PropTypes.string,style:o.PropTypes.object,size:o.PropTypes.oneOf(["fluid","xs","s","m","l","xl","full"]),overlayProps:o.PropTypes.any};const ee={FLUID:"max-content",XS:"320px",S:"412px",M:"672px",L:"1112px",XL:"1376px",FULL:"100vw"};module.exports=A;
|
package/dist/Modal.js
CHANGED
|
@@ -4,11 +4,11 @@ import { P as o } from "./index-CblbdqjE.js";
|
|
|
4
4
|
import { s as C } from "./emotion-styled.browser.esm-BNN1dTl3.js";
|
|
5
5
|
import K from "./Icon.js";
|
|
6
6
|
import { b as w } from "./utils-Dc5zIpaz.js";
|
|
7
|
-
import { r as
|
|
7
|
+
import { r as P } from "./index-B1vKwsDE.js";
|
|
8
8
|
import { m as M } from "./motion-Ckekul_K.js";
|
|
9
|
-
import { u as
|
|
9
|
+
import { u as Q } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js";
|
|
10
10
|
import { A as S } from "./index-D-c5IxDk.js";
|
|
11
|
-
const f = "5rem", h = "3.8rem",
|
|
11
|
+
const f = "5rem", h = "3.8rem", l = "1.5rem", Y = (e, n, a) => n && a ? e == "FULL" ? `calc(100dvh - ${h} - ${f})` : `calc(100dvh - ${h} - ${f} - ${l})` : n ? e == "FULL" ? `calc(100dvh - ${h})` : `calc(100dvh - ${h} - ${l})` : a ? e == "FULL" ? `calc(100dvh - ${f})` : `calc(100dvh - ${f} - ${l})` : e == "FULL" ? "100dvh" : `calc(100dvh - ${l})`, Z = (e) => e == "FULL" ? "100vw" : `calc(100vw - ${l})`, ee = (e, n, a) => e == "FULL" ? "0" : `${n ? "0" : "16px"} 0 ${a ? "0" : "16px"} 0`, oe = C(M.div)`
|
|
12
12
|
position: ${(e) => e.scrollOverlay == !0 ? "absolute" : "fixed"};
|
|
13
13
|
top: 0;
|
|
14
14
|
left: 0;
|
|
@@ -25,7 +25,7 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Z = (e, r, n) => r && n ? e == "FU
|
|
|
25
25
|
background-color: ${(e) => w(e.theme, "Modal", "default", "enabled", "bg")};
|
|
26
26
|
z-index: ${(e) => e.zIndex};
|
|
27
27
|
width: ${(e) => le[e.size.toUpperCase()]};
|
|
28
|
-
max-width: ${(e) =>
|
|
28
|
+
max-width: ${(e) => Z(e.size.toUpperCase())};
|
|
29
29
|
box-shadow: 0px 20px 25px -5px rgba(0, 0, 0, 0.1),
|
|
30
30
|
0px 10px 10px -5px rgba(0, 0, 0, 0.04);
|
|
31
31
|
border-radius: ${(e) => e.size.toUpperCase() != "FULL" ? "16px" : "0"};
|
|
@@ -36,7 +36,7 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Z = (e, r, n) => r && n ? e == "FU
|
|
|
36
36
|
& .lnc-modal-header {
|
|
37
37
|
max-height: ${h};
|
|
38
38
|
overflow: hidden;
|
|
39
|
-
padding: ${
|
|
39
|
+
padding: ${l} ${l} 0 ${l};
|
|
40
40
|
}
|
|
41
41
|
& .lnc-modal-header > h1,
|
|
42
42
|
h2,
|
|
@@ -55,14 +55,14 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Z = (e, r, n) => r && n ? e == "FU
|
|
|
55
55
|
flex-direction: column;
|
|
56
56
|
justify-content: space-between;
|
|
57
57
|
scrollbar-width: thin;
|
|
58
|
-
${(e) => e.scrollOverlay == !1 && `max-height: ${
|
|
58
|
+
${(e) => e.scrollOverlay == !1 && `max-height: ${Y(
|
|
59
59
|
e.size.toUpperCase(),
|
|
60
60
|
e.header,
|
|
61
61
|
e.footer
|
|
62
62
|
)};`}
|
|
63
63
|
overflow: auto;
|
|
64
64
|
margin: ${(e) => ee(e.size, e.header, e.footer)};
|
|
65
|
-
padding: 0 ${
|
|
65
|
+
padding: 0 ${l} 0 ${l};
|
|
66
66
|
}
|
|
67
67
|
`, re = C.div`
|
|
68
68
|
position: absolute;
|
|
@@ -115,16 +115,16 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Z = (e, r, n) => r && n ? e == "FU
|
|
|
115
115
|
width: 100%;
|
|
116
116
|
background-color: ${(e) => e.overlayColor};
|
|
117
117
|
z-index: 3;
|
|
118
|
-
`, ae = z((e,
|
|
118
|
+
`, ae = z((e, n) => {
|
|
119
119
|
const {
|
|
120
|
-
portalElement:
|
|
121
|
-
isOpen:
|
|
122
|
-
header:
|
|
123
|
-
footer:
|
|
124
|
-
scrollOverlay:
|
|
125
|
-
overlay:
|
|
126
|
-
overlayColor:
|
|
127
|
-
showCloseButton:
|
|
120
|
+
portalElement: a = document.body,
|
|
121
|
+
isOpen: s = !1,
|
|
122
|
+
header: m,
|
|
123
|
+
footer: i,
|
|
124
|
+
scrollOverlay: c = !1,
|
|
125
|
+
overlay: d = !0,
|
|
126
|
+
overlayColor: p = "rgba(0, 0, 0, 0.3)",
|
|
127
|
+
showCloseButton: u = !0,
|
|
128
128
|
onOpen: g = () => {
|
|
129
129
|
},
|
|
130
130
|
onClose: x = () => {
|
|
@@ -132,7 +132,7 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Z = (e, r, n) => r && n ? e == "FU
|
|
|
132
132
|
zIndex: U = 1e3,
|
|
133
133
|
size: y = "fluid",
|
|
134
134
|
clickOutsideToClose: $ = !0,
|
|
135
|
-
className:
|
|
135
|
+
className: b = "",
|
|
136
136
|
style: G = {},
|
|
137
137
|
overlayProps: F,
|
|
138
138
|
overlayAnimation: k = {
|
|
@@ -155,12 +155,12 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Z = (e, r, n) => r && n ? e == "FU
|
|
|
155
155
|
},
|
|
156
156
|
children: T,
|
|
157
157
|
rest: I
|
|
158
|
-
} = e, E = X(), [
|
|
159
|
-
let j = { theme:
|
|
160
|
-
const A = (
|
|
161
|
-
|
|
158
|
+
} = e, E = X(), [v, N] = V(s);
|
|
159
|
+
let j = { theme: Q(), size: y, zIndex: U, className: b, style: G };
|
|
160
|
+
const A = (r) => {
|
|
161
|
+
r == null || r.preventDefault(), r == null || r.stopPropagation(), r.target === r.currentTarget && $ && O(r);
|
|
162
162
|
};
|
|
163
|
-
q(
|
|
163
|
+
q(n, () => ({
|
|
164
164
|
open() {
|
|
165
165
|
W();
|
|
166
166
|
},
|
|
@@ -168,108 +168,108 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Z = (e, r, n) => r && n ? e == "FU
|
|
|
168
168
|
O();
|
|
169
169
|
},
|
|
170
170
|
isOpen() {
|
|
171
|
-
return
|
|
171
|
+
return v;
|
|
172
172
|
}
|
|
173
173
|
}));
|
|
174
|
-
const W = (
|
|
175
|
-
N(!0), g(
|
|
176
|
-
}, O = (
|
|
177
|
-
N(!1), x(
|
|
174
|
+
const W = (r) => {
|
|
175
|
+
N(!0), g(r);
|
|
176
|
+
}, O = (r) => {
|
|
177
|
+
N(!1), x(r);
|
|
178
178
|
};
|
|
179
179
|
return J(() => {
|
|
180
|
-
|
|
181
|
-
}, [
|
|
180
|
+
v === !0 && _();
|
|
181
|
+
}, [v]), /* @__PURE__ */ t(L, { children: v && /* @__PURE__ */ t(L, { children: a ? /* @__PURE__ */ t(L, { children: P.createPortal(
|
|
182
182
|
/* @__PURE__ */ t(
|
|
183
|
-
|
|
183
|
+
D,
|
|
184
184
|
{
|
|
185
185
|
ref: E,
|
|
186
|
-
overlay:
|
|
187
|
-
scrollOverlay:
|
|
186
|
+
overlay: d,
|
|
187
|
+
scrollOverlay: c,
|
|
188
188
|
onClickOutsideModal: A,
|
|
189
|
-
overlayColor:
|
|
189
|
+
overlayColor: p,
|
|
190
190
|
overlayProps: F,
|
|
191
191
|
overlayAnimation: k,
|
|
192
192
|
modalAnimation: B,
|
|
193
193
|
themeProps: j,
|
|
194
|
-
showCloseButton:
|
|
194
|
+
showCloseButton: u,
|
|
195
195
|
close: O,
|
|
196
|
-
header:
|
|
197
|
-
footer:
|
|
198
|
-
isOpen:
|
|
196
|
+
header: m,
|
|
197
|
+
footer: i,
|
|
198
|
+
isOpen: s,
|
|
199
199
|
...I,
|
|
200
200
|
children: T
|
|
201
201
|
}
|
|
202
202
|
),
|
|
203
|
-
|
|
203
|
+
a
|
|
204
204
|
) }) : /* @__PURE__ */ t(
|
|
205
|
-
|
|
205
|
+
D,
|
|
206
206
|
{
|
|
207
207
|
ref: E,
|
|
208
|
-
overlay:
|
|
209
|
-
scrollOverlay:
|
|
208
|
+
overlay: d,
|
|
209
|
+
scrollOverlay: c,
|
|
210
210
|
onClickOutsideModal: A,
|
|
211
|
-
overlayColor:
|
|
211
|
+
overlayColor: p,
|
|
212
212
|
overlayProps: F,
|
|
213
213
|
overlayAnimation: k,
|
|
214
214
|
modalAnimation: B,
|
|
215
215
|
themeProps: j,
|
|
216
|
-
showCloseButton:
|
|
216
|
+
showCloseButton: u,
|
|
217
217
|
close: O,
|
|
218
|
-
header:
|
|
219
|
-
footer:
|
|
220
|
-
isOpen:
|
|
218
|
+
header: m,
|
|
219
|
+
footer: i,
|
|
220
|
+
isOpen: s,
|
|
221
221
|
...I,
|
|
222
222
|
children: T
|
|
223
223
|
}
|
|
224
224
|
) }) });
|
|
225
|
-
}),
|
|
225
|
+
}), D = z(
|
|
226
226
|
({
|
|
227
227
|
overlay: e,
|
|
228
|
-
scrollOverlay:
|
|
229
|
-
onClickOutsideModal:
|
|
230
|
-
overlayColor:
|
|
231
|
-
overlayProps:
|
|
232
|
-
overlayAnimation:
|
|
233
|
-
modalAnimation:
|
|
234
|
-
themeProps:
|
|
235
|
-
showCloseButton:
|
|
236
|
-
header:
|
|
228
|
+
scrollOverlay: n,
|
|
229
|
+
onClickOutsideModal: a,
|
|
230
|
+
overlayColor: s,
|
|
231
|
+
overlayProps: m,
|
|
232
|
+
overlayAnimation: i,
|
|
233
|
+
modalAnimation: c,
|
|
234
|
+
themeProps: d,
|
|
235
|
+
showCloseButton: p,
|
|
236
|
+
header: u,
|
|
237
237
|
footer: g,
|
|
238
238
|
close: x,
|
|
239
239
|
isOpen: U,
|
|
240
240
|
children: y,
|
|
241
241
|
...$
|
|
242
|
-
},
|
|
242
|
+
}, b) => /* @__PURE__ */ t(S, { children: e ? /* @__PURE__ */ R(L, { children: [
|
|
243
243
|
/* @__PURE__ */ t(
|
|
244
244
|
ne,
|
|
245
245
|
{
|
|
246
|
-
scrollOverlay:
|
|
247
|
-
onClick:
|
|
248
|
-
overlayColor:
|
|
249
|
-
...
|
|
250
|
-
...
|
|
246
|
+
scrollOverlay: n,
|
|
247
|
+
onClick: a,
|
|
248
|
+
overlayColor: s,
|
|
249
|
+
...m,
|
|
250
|
+
...i
|
|
251
251
|
}
|
|
252
252
|
),
|
|
253
253
|
/* @__PURE__ */ t(
|
|
254
254
|
oe,
|
|
255
255
|
{
|
|
256
|
-
...s,
|
|
257
|
-
onClick: n,
|
|
258
|
-
scrollOverlay: r,
|
|
259
|
-
overlayColor: c,
|
|
260
|
-
isOpen: U,
|
|
261
256
|
...d,
|
|
262
|
-
|
|
257
|
+
onClick: a,
|
|
258
|
+
scrollOverlay: n,
|
|
259
|
+
overlayColor: s,
|
|
260
|
+
isOpen: U,
|
|
261
|
+
...m,
|
|
262
|
+
...i,
|
|
263
263
|
children: /* @__PURE__ */ t(
|
|
264
|
-
|
|
264
|
+
H,
|
|
265
265
|
{
|
|
266
|
-
ref:
|
|
267
|
-
themeProps:
|
|
268
|
-
scrollOverlay:
|
|
269
|
-
modalAnimation:
|
|
270
|
-
showCloseButton:
|
|
266
|
+
ref: b,
|
|
267
|
+
themeProps: d,
|
|
268
|
+
scrollOverlay: n,
|
|
269
|
+
modalAnimation: c,
|
|
270
|
+
showCloseButton: p,
|
|
271
271
|
close: x,
|
|
272
|
-
header:
|
|
272
|
+
header: u,
|
|
273
273
|
footer: g,
|
|
274
274
|
...$,
|
|
275
275
|
children: y
|
|
@@ -278,54 +278,54 @@ const f = "5rem", h = "3.8rem", a = "1.5rem", Z = (e, r, n) => r && n ? e == "FU
|
|
|
278
278
|
}
|
|
279
279
|
)
|
|
280
280
|
] }) : /* @__PURE__ */ t(
|
|
281
|
-
|
|
281
|
+
H,
|
|
282
282
|
{
|
|
283
|
-
ref:
|
|
284
|
-
themeProps:
|
|
285
|
-
modalAnimation:
|
|
286
|
-
showCloseButton:
|
|
283
|
+
ref: b,
|
|
284
|
+
themeProps: d,
|
|
285
|
+
modalAnimation: c,
|
|
286
|
+
showCloseButton: p,
|
|
287
287
|
close: x,
|
|
288
|
-
header:
|
|
288
|
+
header: u,
|
|
289
289
|
footer: g,
|
|
290
290
|
...$,
|
|
291
291
|
children: y
|
|
292
292
|
}
|
|
293
293
|
) })
|
|
294
|
-
),
|
|
294
|
+
), H = z(
|
|
295
295
|
({
|
|
296
296
|
themeProps: e,
|
|
297
|
-
scrollOverlay:
|
|
298
|
-
modalAnimation:
|
|
299
|
-
showCloseButton:
|
|
300
|
-
close:
|
|
301
|
-
header:
|
|
302
|
-
footer:
|
|
303
|
-
children:
|
|
304
|
-
...
|
|
305
|
-
},
|
|
297
|
+
scrollOverlay: n,
|
|
298
|
+
modalAnimation: a,
|
|
299
|
+
showCloseButton: s,
|
|
300
|
+
close: m,
|
|
301
|
+
header: i,
|
|
302
|
+
footer: c,
|
|
303
|
+
children: d,
|
|
304
|
+
...p
|
|
305
|
+
}, u) => /* @__PURE__ */ t(S, { children: /* @__PURE__ */ R(
|
|
306
306
|
te,
|
|
307
307
|
{
|
|
308
|
-
ref:
|
|
308
|
+
ref: u,
|
|
309
309
|
...e,
|
|
310
|
-
...
|
|
311
|
-
header:
|
|
312
|
-
footer:
|
|
313
|
-
scrollOverlay:
|
|
314
|
-
...
|
|
310
|
+
...a,
|
|
311
|
+
header: i,
|
|
312
|
+
footer: c,
|
|
313
|
+
scrollOverlay: n,
|
|
314
|
+
...p,
|
|
315
315
|
className: `modal-lnc-container ${e == null ? void 0 : e.className}`,
|
|
316
316
|
children: [
|
|
317
|
-
|
|
317
|
+
s && /* @__PURE__ */ t(
|
|
318
318
|
re,
|
|
319
319
|
{
|
|
320
320
|
...e,
|
|
321
321
|
className: "modal-lnc-times",
|
|
322
|
-
onClick:
|
|
322
|
+
onClick: m,
|
|
323
323
|
children: /* @__PURE__ */ t(K, { icon: "times" })
|
|
324
324
|
}
|
|
325
325
|
),
|
|
326
|
-
|
|
327
|
-
/* @__PURE__ */ t("div", { className: "lnc-modal-content", children:
|
|
328
|
-
|
|
326
|
+
i && /* @__PURE__ */ t("div", { className: "lnc-modal-header", children: i }),
|
|
327
|
+
/* @__PURE__ */ t("div", { className: "lnc-modal-content", children: d }),
|
|
328
|
+
c && /* @__PURE__ */ t("div", { className: "lnc-modal-footer", children: c })
|
|
329
329
|
]
|
|
330
330
|
}
|
|
331
331
|
) })
|