quirk-ui 0.1.49 → 0.1.50
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/core/components/Modal/index.cjs +1 -1
- package/dist/core/components/Modal/index.mjs +37 -37
- package/dist/core/context/ThemeContext.cjs +1 -1
- package/dist/core/context/ThemeContext.mjs +25 -29
- package/dist/index35.css +1 -1
- package/dist/main.d.ts +1 -0
- package/dist/next.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../index35.css');const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../index35.css');const e=require("react/jsx-runtime"),r=require("react"),M=require("react-dom"),R=require("../../../x-Dft9NVe_.cjs"),T="_overlay_j87ne_2",C="_fadeIn_j87ne_1",D="_modal_j87ne_18",P="_slideUp_j87ne_1",U="_trigger_j87ne_61",A="_closeButton_j87ne_68",F="_title_j87ne_98",K="_content_j87ne_108",l={overlay:T,fadeIn:C,modal:D,slideUp:P,"size-sm":"_size-sm_j87ne_38","size-md":"_size-md_j87ne_42","size-lg":"_size-lg_j87ne_46","size-xl":"_size-xl_j87ne_50","size-full":"_size-full_j87ne_54",trigger:U,closeButton:A,title:F,content:K},X=()=>{typeof document<"u"&&(document.body.style.overflow="hidden")},h=()=>{typeof document<"u"&&(document.body.style.overflow="")};function G({content:b,trigger:x,isOpen:v,onOpen:o,onClose:i,size:k="md",closeOnEscape:y=!0,closeOnOverlayClick:z=!0,showCloseButton:p=!0,className:w,overlayClassName:$,style:E,title:f}){const[N,j]=r.useState(!1),_=r.useRef(null),m=v!==void 0,t=m?v:N,q=()=>{m||j(!0),o==null||o()},d=()=>{m||j(!1),i==null||i()},S=()=>{t?d():q()},I=()=>{z&&d()};r.useEffect(()=>{if(!y||!t)return;const n=c=>{c.key==="Escape"&&d()};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[t,y]),r.useEffect(()=>(t?X():h(),()=>h()),[t]),r.useEffect(()=>{if(!t||!_.current)return;const n=_.current,c=n.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),s=c[0],a=c[c.length-1],g=u=>{u.key==="Tab"&&(u.shiftKey?document.activeElement===s&&(u.preventDefault(),a==null||a.focus()):document.activeElement===a&&(u.preventDefault(),s==null||s.focus()))};return n.addEventListener("keydown",g),s==null||s.focus(),()=>{n.removeEventListener("keydown",g)}},[t]);const B=l[`size-${k}`]||"",L=t?e.jsx("div",{className:`${l.overlay} ${$??""}`.trim(),onClick:I,role:"dialog","aria-modal":"true","aria-labelledby":f?"modal-title":void 0,children:e.jsxs("div",{className:`${B} modalContentContainer`,children:[p&&e.jsx("button",{"aria-label":"Close",className:l.closeButton,onClick:d,type:"button",children:e.jsx(R.X,{size:20})}),e.jsxs("div",{ref:_,className:`${l.modal} ${w??""}`.trim(),style:E,onClick:n=>n.stopPropagation(),children:[f&&e.jsx("div",{className:l.title,id:"modal-title",children:f}),e.jsx("div",{className:l.content,children:b})]})]})}):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:l.trigger,onClick:S,children:x}),typeof window<"u"&&M.createPortal(L,document.body)]})}exports.Modal=G;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { jsxs as _, Fragment as U, jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { X as
|
|
5
|
-
import '../../../index35.css';const A = "
|
|
1
|
+
import { jsxs as _, Fragment as U, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useState as D, useRef as P, useEffect as v } from "react";
|
|
3
|
+
import { createPortal as R } from "react-dom";
|
|
4
|
+
import { X as q } from "../../../x-CnsEH4Ox.js";
|
|
5
|
+
import '../../../index35.css';const A = "_overlay_j87ne_2", F = "_fadeIn_j87ne_1", K = "_modal_j87ne_18", M = "_slideUp_j87ne_1", X = "_trigger_j87ne_61", G = "_closeButton_j87ne_68", H = "_title_j87ne_98", J = "_content_j87ne_108", o = {
|
|
6
6
|
overlay: A,
|
|
7
7
|
fadeIn: F,
|
|
8
8
|
modal: K,
|
|
9
9
|
slideUp: M,
|
|
10
|
-
"size-sm": "_size-
|
|
11
|
-
"size-md": "_size-
|
|
12
|
-
"size-lg": "_size-
|
|
13
|
-
"size-xl": "_size-
|
|
14
|
-
"size-full": "_size-
|
|
10
|
+
"size-sm": "_size-sm_j87ne_38",
|
|
11
|
+
"size-md": "_size-md_j87ne_42",
|
|
12
|
+
"size-lg": "_size-lg_j87ne_46",
|
|
13
|
+
"size-xl": "_size-xl_j87ne_50",
|
|
14
|
+
"size-full": "_size-full_j87ne_54",
|
|
15
15
|
trigger: X,
|
|
16
16
|
closeButton: G,
|
|
17
17
|
title: H,
|
|
18
18
|
content: J
|
|
19
19
|
}, Q = () => {
|
|
20
20
|
typeof document < "u" && (document.body.style.overflow = "hidden");
|
|
21
|
-
},
|
|
21
|
+
}, b = () => {
|
|
22
22
|
typeof document < "u" && (document.body.style.overflow = "");
|
|
23
23
|
};
|
|
24
24
|
function O({
|
|
@@ -34,63 +34,63 @@ function O({
|
|
|
34
34
|
className: N,
|
|
35
35
|
overlayClassName: $,
|
|
36
36
|
style: E,
|
|
37
|
-
title:
|
|
37
|
+
title: u
|
|
38
38
|
}) {
|
|
39
|
-
const [I, g] =
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
|
|
39
|
+
const [I, g] = D(!1), f = P(null), m = y !== void 0, e = m ? y : I, B = () => {
|
|
40
|
+
m || g(!0), l == null || l();
|
|
41
|
+
}, r = () => {
|
|
42
|
+
m || g(!1), i == null || i();
|
|
43
43
|
}, L = () => {
|
|
44
|
-
e ?
|
|
44
|
+
e ? r() : B();
|
|
45
45
|
}, S = () => {
|
|
46
|
-
w &&
|
|
46
|
+
w && r();
|
|
47
47
|
};
|
|
48
48
|
v(() => {
|
|
49
49
|
if (!h || !e) return;
|
|
50
|
-
const t = (
|
|
51
|
-
|
|
50
|
+
const t = (c) => {
|
|
51
|
+
c.key === "Escape" && r();
|
|
52
52
|
};
|
|
53
53
|
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
54
|
-
}, [e, h]), v(() => (e ? Q() :
|
|
55
|
-
if (!e || !
|
|
56
|
-
const t =
|
|
54
|
+
}, [e, h]), v(() => (e ? Q() : b(), () => b()), [e]), v(() => {
|
|
55
|
+
if (!e || !f.current) return;
|
|
56
|
+
const t = f.current, c = t.querySelectorAll(
|
|
57
57
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
58
|
-
), n =
|
|
59
|
-
|
|
58
|
+
), n = c[0], d = c[c.length - 1], j = (a) => {
|
|
59
|
+
a.key === "Tab" && (a.shiftKey ? document.activeElement === n && (a.preventDefault(), d == null || d.focus()) : document.activeElement === d && (a.preventDefault(), n == null || n.focus()));
|
|
60
60
|
};
|
|
61
|
-
return t.addEventListener("keydown",
|
|
62
|
-
t.removeEventListener("keydown",
|
|
61
|
+
return t.addEventListener("keydown", j), n == null || n.focus(), () => {
|
|
62
|
+
t.removeEventListener("keydown", j);
|
|
63
63
|
};
|
|
64
64
|
}, [e]);
|
|
65
|
-
const C = o[`size-${z}`] || "", T = e ? /* @__PURE__ */
|
|
65
|
+
const C = o[`size-${z}`] || "", T = e ? /* @__PURE__ */ s(
|
|
66
66
|
"div",
|
|
67
67
|
{
|
|
68
68
|
className: `${o.overlay} ${$ ?? ""}`.trim(),
|
|
69
69
|
onClick: S,
|
|
70
70
|
role: "dialog",
|
|
71
71
|
"aria-modal": "true",
|
|
72
|
-
"aria-labelledby":
|
|
72
|
+
"aria-labelledby": u ? "modal-title" : void 0,
|
|
73
73
|
children: /* @__PURE__ */ _("div", { className: `${C} modalContentContainer`, children: [
|
|
74
|
-
x && /* @__PURE__ */
|
|
74
|
+
x && /* @__PURE__ */ s(
|
|
75
75
|
"button",
|
|
76
76
|
{
|
|
77
77
|
"aria-label": "Close",
|
|
78
78
|
className: o.closeButton,
|
|
79
|
-
onClick:
|
|
79
|
+
onClick: r,
|
|
80
80
|
type: "button",
|
|
81
|
-
children: /* @__PURE__ */
|
|
81
|
+
children: /* @__PURE__ */ s(q, { size: 20 })
|
|
82
82
|
}
|
|
83
83
|
),
|
|
84
84
|
/* @__PURE__ */ _(
|
|
85
85
|
"div",
|
|
86
86
|
{
|
|
87
|
-
ref:
|
|
87
|
+
ref: f,
|
|
88
88
|
className: `${o.modal} ${N ?? ""}`.trim(),
|
|
89
89
|
style: E,
|
|
90
90
|
onClick: (t) => t.stopPropagation(),
|
|
91
91
|
children: [
|
|
92
|
-
|
|
93
|
-
/* @__PURE__ */
|
|
92
|
+
u && /* @__PURE__ */ s("div", { className: o.title, id: "modal-title", children: u }),
|
|
93
|
+
/* @__PURE__ */ s("div", { className: o.content, children: k })
|
|
94
94
|
]
|
|
95
95
|
}
|
|
96
96
|
)
|
|
@@ -98,8 +98,8 @@ function O({
|
|
|
98
98
|
}
|
|
99
99
|
) : null;
|
|
100
100
|
return /* @__PURE__ */ _(U, { children: [
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
typeof window < "u" &&
|
|
101
|
+
/* @__PURE__ */ s("div", { className: o.trigger, onClick: L, children: p }),
|
|
102
|
+
typeof window < "u" && R(T, document.body)
|
|
103
103
|
] });
|
|
104
104
|
}
|
|
105
105
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),e=require("react"),m=e.createContext(void 0);function h({children:t}){const[o,u]=e.useState("light"),[n,a]=e.useState(!1);e.useEffect(()=>{const i=document.documentElement.getAttribute("data-theme")==="dark"?"dark":"light";u(i),a(!0)},[]);const r=e.useCallback(s=>{u(s),localStorage.setItem("theme-mode",s),document.documentElement.setAttribute("data-theme",s)},[]),c=e.useCallback(()=>{r(o==="light"?"dark":"light")},[o,r]),d=e.useMemo(()=>({mode:o,mounted:n,toggleTheme:c,setTheme:r}),[o,n,c,r]);return l.jsx(m.Provider,{value:d,children:t})}function g(){const t=e.useContext(m);if(!t)throw new Error("useTheme must be used within AppThemeProvider");return t}exports.AppThemeProvider=h;exports.useTheme=g;
|
|
@@ -1,34 +1,30 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
o(e === "light" ? "dark" : "light");
|
|
20
|
-
}, [e, o]), d = f(
|
|
21
|
-
() => ({ mode: e, toggleTheme: n, setTheme: o }),
|
|
22
|
-
[e, n, o]
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as f, useContext as g, useState as u, useEffect as p, useCallback as c, useMemo as T } from "react";
|
|
3
|
+
const d = f(void 0);
|
|
4
|
+
function k({ children: e }) {
|
|
5
|
+
const [t, m] = u("light"), [n, a] = u(!1);
|
|
6
|
+
p(() => {
|
|
7
|
+
const h = document.documentElement.getAttribute(
|
|
8
|
+
"data-theme"
|
|
9
|
+
) === "dark" ? "dark" : "light";
|
|
10
|
+
m(h), a(!0);
|
|
11
|
+
}, []);
|
|
12
|
+
const o = c((r) => {
|
|
13
|
+
m(r), localStorage.setItem("theme-mode", r), document.documentElement.setAttribute("data-theme", r);
|
|
14
|
+
}, []), s = c(() => {
|
|
15
|
+
o(t === "light" ? "dark" : "light");
|
|
16
|
+
}, [t, o]), i = T(
|
|
17
|
+
() => ({ mode: t, mounted: n, toggleTheme: s, setTheme: o }),
|
|
18
|
+
[t, n, s, o]
|
|
23
19
|
);
|
|
24
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ l(d.Provider, { value: i, children: e });
|
|
25
21
|
}
|
|
26
|
-
function
|
|
27
|
-
const
|
|
28
|
-
if (!
|
|
29
|
-
return
|
|
22
|
+
function x() {
|
|
23
|
+
const e = g(d);
|
|
24
|
+
if (!e) throw new Error("useTheme must be used within AppThemeProvider");
|
|
25
|
+
return e;
|
|
30
26
|
}
|
|
31
27
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
k as AppThemeProvider,
|
|
29
|
+
x as useTheme
|
|
34
30
|
};
|
package/dist/index35.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._overlay_j87ne_2{position:fixed;top:0;left:0;width:100vw;height:100vh;background-color:#00000080;display:flex;align-items:center;justify-content:center;z-index:1000;animation:_fadeIn_j87ne_1 .2s ease;padding:var(--spacing-md, 1rem);overflow-y:auto}.modalContentContainer{position:relative;display:flex;flex-direction:column;top:5rem}._modal_j87ne_18{position:relative;background-color:var(--color-background, #fff);border-radius:var(--radius-lg, .5rem);padding:var(--spacing-xl, 2rem);max-height:90vh;overflow-y:auto;animation:_slideUp_j87ne_1 .3s ease;box-shadow:var(--shadow-xl, 0 20px 25px -5px rgba(0, 0, 0, .1))}._size-sm_j87ne_38{width:clamp(90%,90%,400px)}._size-md_j87ne_42{width:clamp(90%,90%,600px)}._size-lg_j87ne_46{width:clamp(90%,90%,800px)}._size-xl_j87ne_50{width:clamp(90%,90%,1200px)}._size-full_j87ne_54{width:95%;height:95vh;max-height:95vh}._trigger_j87ne_61{width:auto;display:inline-block;cursor:pointer}._closeButton_j87ne_68{background:none;border:none;cursor:pointer;padding:var(--spacing-xs, .25rem);margin-bottom:var(--spacing-xs);border-radius:var(--radius-sm, .25rem);color:#fff;transition:all .2s ease;display:flex;align-items:center;justify-content:center;align-self:flex-end;z-index:1}._closeButton_j87ne_68:hover{background-color:var(--color-secondary-10, #f5f5f5);color:var(--color-text-primary, #333)}._closeButton_j87ne_68:focus-visible{outline:2px solid var(--color-primary-100, #007bff);outline-offset:2px}._title_j87ne_98{font-size:var(--font-size-xl, 1.5rem);font-weight:var(--font-weight-bold, 700);color:var(--color-heading, #111);margin-bottom:var(--spacing-lg, 1.5rem);padding-right:var(--spacing-xl, 2rem);line-height:var(--line-height-heading, 1.2)}._content_j87ne_108{color:var(--color-text-primary, #333);line-height:var(--line-height-normal, 1.5)}._content_j87ne_108 video{width:100%;max-width:100%;height:auto;border-radius:var(--radius-md, .5rem)}._content_j87ne_108 img{max-width:100%;height:auto;border-radius:var(--radius-md, .5rem)}@keyframes _fadeIn_j87ne_1{0%{opacity:0}to{opacity:1}}@keyframes _slideUp_j87ne_1{0%{opacity:0;transform:translateY(30px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@media (max-width: 768px){._modal_j87ne_18{padding:var(--spacing-lg, 1.5rem);max-height:85vh}._size-sm_j87ne_38,._size-md_j87ne_42,._size-lg_j87ne_46,._size-xl_j87ne_50{width:95%}._title_j87ne_98{font-size:var(--font-size-lg, 1.25rem);padding-right:var(--spacing-lg, 1.5rem)}}@media (max-width: 480px){._overlay_j87ne_2{padding:var(--spacing-sm, .5rem)}._modal_j87ne_18{padding:var(--spacing-md, 1rem);max-height:90vh}._closeButton_j87ne_68{top:var(--spacing-sm, .5rem);right:var(--spacing-sm, .5rem)}._title_j87ne_98{font-size:var(--font-size-md, 1rem);margin-bottom:var(--spacing-md, 1rem)}}
|
package/dist/main.d.ts
CHANGED
package/dist/next.d.ts
CHANGED