quirk-ui 0.1.49 → 0.1.51
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 +52 -52
- 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_ueo6t_2",C="_fadeIn_ueo6t_1",D="_modal_ueo6t_18",P="_slideUp_ueo6t_1",U="_trigger_ueo6t_65",A="_closeButton_ueo6t_72",F="_title_ueo6t_102",K="_content_ueo6t_112",s={overlay:T,fadeIn:C,modal:D,slideUp:P,"size-sm":"_size-sm_ueo6t_38","size-md":"_size-md_ueo6t_43","size-lg":"_size-lg_ueo6t_48","size-xl":"_size-xl_ueo6t_53","size-full":"_size-full_ueo6t_58",trigger:U,closeButton:A,title:F,content:K},X=()=>{typeof document<"u"&&(document.body.style.overflow="hidden")},b=()=>{typeof document<"u"&&(document.body.style.overflow="")};function G({content:x,trigger:k,isOpen:v,onOpen:l,onClose:i,size:z="md",closeOnEscape:y=!0,closeOnOverlayClick:j=!0,showCloseButton:p=!0,className:w,overlayClassName:$,style:E,title:f}){const[N,g]=r.useState(!1),_=r.useRef(null),m=v!==void 0,t=m?v:N,q=()=>{m||g(!0),l==null||l()},d=()=>{m||g(!1),i==null||i()},S=()=>{t?d():q()},I=()=>{j&&d()};r.useEffect(()=>{if(!y||!t)return;const o=c=>{c.key==="Escape"&&d()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[t,y]),r.useEffect(()=>(t?X():b(),()=>b()),[t]),r.useEffect(()=>{if(!t||!_.current)return;const o=_.current,c=o.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),n=c[0],a=c[c.length-1],h=u=>{u.key==="Tab"&&(u.shiftKey?document.activeElement===n&&(u.preventDefault(),a==null||a.focus()):document.activeElement===a&&(u.preventDefault(),n==null||n.focus()))};return o.addEventListener("keydown",h),n==null||n.focus(),()=>{o.removeEventListener("keydown",h)}},[t]);const B=s[`size-${z}`]||"",L=t?e.jsx("div",{className:`${s.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:s.closeButton,onClick:d,type:"button",children:e.jsx(R.X,{size:20})}),e.jsxs("div",{ref:_,className:`${s.modal} ${w??""}`.trim(),style:E,onClick:o=>o.stopPropagation(),children:[f&&e.jsx("div",{className:s.title,id:"modal-title",children:f}),e.jsx("div",{className:s.content,children:x})]})]})}):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:s.trigger,onClick:S,children:k}),typeof window<"u"&&M.createPortal(L,document.body)]})}exports.Modal=G;
|
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
import { jsxs as _, Fragment 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 j, 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_ueo6t_2", F = "_fadeIn_ueo6t_1", K = "_modal_ueo6t_18", M = "_slideUp_ueo6t_1", X = "_trigger_ueo6t_65", G = "_closeButton_ueo6t_72", H = "_title_ueo6t_102", J = "_content_ueo6t_112", n = {
|
|
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_ueo6t_38",
|
|
11
|
+
"size-md": "_size-md_ueo6t_43",
|
|
12
|
+
"size-lg": "_size-lg_ueo6t_48",
|
|
13
|
+
"size-xl": "_size-xl_ueo6t_53",
|
|
14
|
+
"size-full": "_size-full_ueo6t_58",
|
|
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
|
+
}, k = () => {
|
|
22
22
|
typeof document < "u" && (document.body.style.overflow = "");
|
|
23
23
|
};
|
|
24
24
|
function O({
|
|
25
|
-
content:
|
|
26
|
-
trigger:
|
|
25
|
+
content: p,
|
|
26
|
+
trigger: z,
|
|
27
27
|
isOpen: y,
|
|
28
28
|
onOpen: l,
|
|
29
29
|
onClose: i,
|
|
30
|
-
size:
|
|
30
|
+
size: w = "md",
|
|
31
31
|
closeOnEscape: h = !0,
|
|
32
|
-
closeOnOverlayClick:
|
|
33
|
-
showCloseButton:
|
|
34
|
-
className:
|
|
35
|
-
overlayClassName:
|
|
36
|
-
style:
|
|
37
|
-
title:
|
|
32
|
+
closeOnOverlayClick: x = !0,
|
|
33
|
+
showCloseButton: N = !0,
|
|
34
|
+
className: $,
|
|
35
|
+
overlayClassName: E,
|
|
36
|
+
style: I,
|
|
37
|
+
title: u
|
|
38
38
|
}) {
|
|
39
|
-
const [
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
}, L = () => {
|
|
44
|
-
e ? c() : B();
|
|
39
|
+
const [B, g] = D(!1), f = P(null), m = y !== void 0, e = m ? y : B, L = () => {
|
|
40
|
+
m || g(!0), l == null || l();
|
|
41
|
+
}, r = () => {
|
|
42
|
+
m || g(!1), i == null || i();
|
|
45
43
|
}, S = () => {
|
|
46
|
-
|
|
44
|
+
e ? r() : L();
|
|
45
|
+
}, C = () => {
|
|
46
|
+
x && 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() : k(), () => k()), [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
|
-
),
|
|
59
|
-
|
|
58
|
+
), o = c[0], d = c[c.length - 1], b = (a) => {
|
|
59
|
+
a.key === "Tab" && (a.shiftKey ? document.activeElement === o && (a.preventDefault(), d == null || d.focus()) : document.activeElement === d && (a.preventDefault(), o == null || o.focus()));
|
|
60
60
|
};
|
|
61
|
-
return t.addEventListener("keydown", b),
|
|
61
|
+
return t.addEventListener("keydown", b), o == null || o.focus(), () => {
|
|
62
62
|
t.removeEventListener("keydown", b);
|
|
63
63
|
};
|
|
64
64
|
}, [e]);
|
|
65
|
-
const
|
|
65
|
+
const T = n[`size-${w}`] || "", U = e ? /* @__PURE__ */ s(
|
|
66
66
|
"div",
|
|
67
67
|
{
|
|
68
|
-
className: `${
|
|
69
|
-
onClick:
|
|
68
|
+
className: `${n.overlay} ${E ?? ""}`.trim(),
|
|
69
|
+
onClick: C,
|
|
70
70
|
role: "dialog",
|
|
71
71
|
"aria-modal": "true",
|
|
72
|
-
"aria-labelledby":
|
|
73
|
-
children: /* @__PURE__ */ _("div", { className: `${
|
|
74
|
-
|
|
72
|
+
"aria-labelledby": u ? "modal-title" : void 0,
|
|
73
|
+
children: /* @__PURE__ */ _("div", { className: `${T} modalContentContainer`, children: [
|
|
74
|
+
N && /* @__PURE__ */ s(
|
|
75
75
|
"button",
|
|
76
76
|
{
|
|
77
77
|
"aria-label": "Close",
|
|
78
|
-
className:
|
|
79
|
-
onClick:
|
|
78
|
+
className: n.closeButton,
|
|
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:
|
|
88
|
-
className: `${
|
|
89
|
-
style:
|
|
87
|
+
ref: f,
|
|
88
|
+
className: `${n.modal} ${$ ?? ""}`.trim(),
|
|
89
|
+
style: I,
|
|
90
90
|
onClick: (t) => t.stopPropagation(),
|
|
91
91
|
children: [
|
|
92
|
-
|
|
93
|
-
/* @__PURE__ */
|
|
92
|
+
u && /* @__PURE__ */ s("div", { className: n.title, id: "modal-title", children: u }),
|
|
93
|
+
/* @__PURE__ */ s("div", { className: n.content, children: p })
|
|
94
94
|
]
|
|
95
95
|
}
|
|
96
96
|
)
|
|
97
97
|
] })
|
|
98
98
|
}
|
|
99
99
|
) : null;
|
|
100
|
-
return /* @__PURE__ */ _(
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
typeof window < "u" &&
|
|
100
|
+
return /* @__PURE__ */ _(j, { children: [
|
|
101
|
+
/* @__PURE__ */ s("div", { className: n.trigger, onClick: S, children: z }),
|
|
102
|
+
typeof window < "u" && R(U, 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_ueo6t_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_ueo6t_1 .2s ease;padding:var(--spacing-md, 1rem);overflow-y:auto}.modalContentContainer{position:relative;display:flex;flex-direction:column;top:5rem}._modal_ueo6t_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_ueo6t_1 .3s ease;box-shadow:var(--shadow-xl, 0 20px 25px -5px rgba(0, 0, 0, .1))}._size-sm_ueo6t_38{width:90%;max-width:400px}._size-md_ueo6t_43{width:90%;max-width:600px}._size-lg_ueo6t_48{width:90%;max-width:800px}._size-xl_ueo6t_53{width:90%;max-width:1200px}._size-full_ueo6t_58{width:95%;height:95vh;max-height:95vh}._trigger_ueo6t_65{width:auto;display:inline-block;cursor:pointer}._closeButton_ueo6t_72{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_ueo6t_72:hover{background-color:var(--color-secondary-10, #f5f5f5);color:var(--color-text-primary, #333)}._closeButton_ueo6t_72:focus-visible{outline:2px solid var(--color-primary-100, #007bff);outline-offset:2px}._title_ueo6t_102{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_ueo6t_112{color:var(--color-text-primary, #333);line-height:var(--line-height-normal, 1.5)}._content_ueo6t_112 video{width:100%;max-width:100%;height:auto;border-radius:var(--radius-md, .5rem)}._content_ueo6t_112 img{max-width:100%;height:auto;border-radius:var(--radius-md, .5rem)}@keyframes _fadeIn_ueo6t_1{0%{opacity:0}to{opacity:1}}@keyframes _slideUp_ueo6t_1{0%{opacity:0;transform:translateY(30px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@media (max-width: 768px){._modal_ueo6t_18{padding:var(--spacing-lg, 1.5rem);max-height:85vh}._size-sm_ueo6t_38,._size-md_ueo6t_43,._size-lg_ueo6t_48,._size-xl_ueo6t_53{width:95%}._title_ueo6t_102{font-size:var(--font-size-lg, 1.25rem);padding-right:var(--spacing-lg, 1.5rem)}}@media (max-width: 480px){._overlay_ueo6t_2{padding:var(--spacing-sm, .5rem)}._modal_ueo6t_18{padding:var(--spacing-md, 1rem);max-height:90vh}._closeButton_ueo6t_72{top:var(--spacing-sm, .5rem);right:var(--spacing-sm, .5rem)}._title_ueo6t_102{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