quirk-ui 0.0.455 → 0.0.457
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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../assets/index33.css');const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../assets/index33.css');const e=require("react/jsx-runtime"),r=require("react"),_=require("react-dom"),h=require("../../../x-Dft9NVe_.cjs"),j="_overlay_140ia_1",x="_modal_140ia_16",b="_closeButton_140ia_26",g="_content_140ia_37",o={overlay:j,modal:x,closeButton:b,content:g};function $({content:u,trigger:m,isOpen:c,onOpen:n,onClose:s,className:i}){const[t,f]=r.useState(!1),a=c!==void 0,d=a?c:t,l=()=>{a?t?s==null||s():n==null||n():f(!d)};r.useEffect(()=>{if(typeof document<"u")return document.body.style.overflow=t?"hidden":"",()=>{document.body.style.overflow=""}},[t]);const y=d?e.jsx("div",{className:o.overlay,onClick:l,children:e.jsxs("div",{className:`${i??""} ${o.modal}`,onClick:v=>v.stopPropagation(),children:[e.jsx("button",{"aria-label":"Close",className:`${o.closeButton} modalClose`,onClick:l,children:e.jsx(h.X,{size:21})}),e.jsx("div",{className:`${o.content} modalContent`,children:u})]})}):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:i??void 0,onClick:l,children:m}),typeof window<"u"&&_.createPortal(y,document.body)]})}exports.Modal=$;
|
|
@@ -1,47 +1,54 @@
|
|
|
1
|
-
import { jsxs as r, Fragment as
|
|
2
|
-
import { useState as p } from "react";
|
|
3
|
-
import { createPortal as
|
|
1
|
+
import { jsxs as r, Fragment as _, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as h, useEffect as p } from "react";
|
|
3
|
+
import { createPortal as b } from "react-dom";
|
|
4
4
|
import { X as C } from "../../../x-CnsEH4Ox.js";
|
|
5
|
-
import '../../../assets/index33.css';const g = "_overlay_140ia_1", k = "_modal_140ia_16",
|
|
5
|
+
import '../../../assets/index33.css';const g = "_overlay_140ia_1", k = "_modal_140ia_16", w = "_closeButton_140ia_26", B = "_content_140ia_37", e = {
|
|
6
6
|
overlay: g,
|
|
7
7
|
modal: k,
|
|
8
|
-
closeButton:
|
|
9
|
-
content:
|
|
8
|
+
closeButton: w,
|
|
9
|
+
content: B
|
|
10
10
|
};
|
|
11
|
-
function
|
|
11
|
+
function P({
|
|
12
12
|
content: m,
|
|
13
|
-
trigger:
|
|
14
|
-
isOpen:
|
|
15
|
-
onOpen:
|
|
13
|
+
trigger: f,
|
|
14
|
+
isOpen: i,
|
|
15
|
+
onOpen: n,
|
|
16
16
|
onClose: l,
|
|
17
|
-
className:
|
|
17
|
+
className: s
|
|
18
18
|
}) {
|
|
19
|
-
const [
|
|
20
|
-
|
|
21
|
-
}
|
|
19
|
+
const [t, u] = h(!1), a = i !== void 0, d = a ? i : t, c = () => {
|
|
20
|
+
a ? t ? l == null || l() : n == null || n() : u(!d);
|
|
21
|
+
};
|
|
22
|
+
p(() => {
|
|
23
|
+
if (typeof document < "u")
|
|
24
|
+
return document.body.style.overflow = t ? "hidden" : "", () => {
|
|
25
|
+
document.body.style.overflow = "";
|
|
26
|
+
};
|
|
27
|
+
}, [t]);
|
|
28
|
+
const v = d ? /* @__PURE__ */ o("div", { className: e.overlay, onClick: c, children: /* @__PURE__ */ r(
|
|
22
29
|
"div",
|
|
23
30
|
{
|
|
24
|
-
className: `${
|
|
25
|
-
onClick: (
|
|
31
|
+
className: `${s ?? ""} ${e.modal}`,
|
|
32
|
+
onClick: (y) => y.stopPropagation(),
|
|
26
33
|
children: [
|
|
27
34
|
/* @__PURE__ */ o(
|
|
28
35
|
"button",
|
|
29
36
|
{
|
|
30
37
|
"aria-label": "Close",
|
|
31
|
-
className: `${
|
|
32
|
-
onClick:
|
|
38
|
+
className: `${e.closeButton} modalClose`,
|
|
39
|
+
onClick: c,
|
|
33
40
|
children: /* @__PURE__ */ o(C, { size: 21 })
|
|
34
41
|
}
|
|
35
42
|
),
|
|
36
|
-
/* @__PURE__ */ o("div", { className: `${
|
|
43
|
+
/* @__PURE__ */ o("div", { className: `${e.content} modalContent`, children: m })
|
|
37
44
|
]
|
|
38
45
|
}
|
|
39
46
|
) }) : null;
|
|
40
|
-
return /* @__PURE__ */ r(
|
|
41
|
-
/* @__PURE__ */ o("div", { className:
|
|
42
|
-
typeof window < "u" &&
|
|
47
|
+
return /* @__PURE__ */ r(_, { children: [
|
|
48
|
+
/* @__PURE__ */ o("div", { className: s ?? void 0, onClick: c, children: f }),
|
|
49
|
+
typeof window < "u" && b(v, document.body)
|
|
43
50
|
] });
|
|
44
51
|
}
|
|
45
52
|
export {
|
|
46
|
-
|
|
53
|
+
P as Modal
|
|
47
54
|
};
|