quirk-ui 0.0.466 → 0.0.467

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