quirk-ui 0.1.50 → 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.
|
@@ -1 +1 @@
|
|
|
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="
|
|
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,49 +1,49 @@
|
|
|
1
|
-
import { jsxs as _, Fragment as
|
|
1
|
+
import { jsxs as _, Fragment as j, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { useState as D, useRef as P, useEffect as v } from "react";
|
|
3
3
|
import { createPortal as R } from "react-dom";
|
|
4
4
|
import { X as q } from "../../../x-CnsEH4Ox.js";
|
|
5
|
-
import '../../../index35.css';const A = "
|
|
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:
|
|
32
|
+
closeOnOverlayClick: x = !0,
|
|
33
|
+
showCloseButton: N = !0,
|
|
34
|
+
className: $,
|
|
35
|
+
overlayClassName: E,
|
|
36
|
+
style: I,
|
|
37
37
|
title: u
|
|
38
38
|
}) {
|
|
39
|
-
const [
|
|
39
|
+
const [B, g] = D(!1), f = P(null), m = y !== void 0, e = m ? y : B, L = () => {
|
|
40
40
|
m || g(!0), l == null || l();
|
|
41
41
|
}, r = () => {
|
|
42
42
|
m || g(!1), i == null || i();
|
|
43
|
-
}, L = () => {
|
|
44
|
-
e ? r() : B();
|
|
45
43
|
}, S = () => {
|
|
46
|
-
|
|
44
|
+
e ? r() : L();
|
|
45
|
+
}, C = () => {
|
|
46
|
+
x && r();
|
|
47
47
|
};
|
|
48
48
|
v(() => {
|
|
49
49
|
if (!h || !e) return;
|
|
@@ -51,31 +51,31 @@ function O({
|
|
|
51
51
|
c.key === "Escape" && r();
|
|
52
52
|
};
|
|
53
53
|
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
54
|
-
}, [e, h]), v(() => (e ? Q() :
|
|
54
|
+
}, [e, h]), v(() => (e ? Q() : k(), () => k()), [e]), v(() => {
|
|
55
55
|
if (!e || !f.current) return;
|
|
56
56
|
const t = f.current, c = t.querySelectorAll(
|
|
57
57
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
58
|
-
),
|
|
59
|
-
a.key === "Tab" && (a.shiftKey ? document.activeElement ===
|
|
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",
|
|
62
|
-
t.removeEventListener("keydown",
|
|
61
|
+
return t.addEventListener("keydown", b), o == null || o.focus(), () => {
|
|
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
72
|
"aria-labelledby": u ? "modal-title" : void 0,
|
|
73
|
-
children: /* @__PURE__ */ _("div", { className: `${
|
|
74
|
-
|
|
73
|
+
children: /* @__PURE__ */ _("div", { className: `${T} modalContentContainer`, children: [
|
|
74
|
+
N && /* @__PURE__ */ s(
|
|
75
75
|
"button",
|
|
76
76
|
{
|
|
77
77
|
"aria-label": "Close",
|
|
78
|
-
className:
|
|
78
|
+
className: n.closeButton,
|
|
79
79
|
onClick: r,
|
|
80
80
|
type: "button",
|
|
81
81
|
children: /* @__PURE__ */ s(q, { size: 20 })
|
|
@@ -85,21 +85,21 @@ function O({
|
|
|
85
85
|
"div",
|
|
86
86
|
{
|
|
87
87
|
ref: f,
|
|
88
|
-
className: `${
|
|
89
|
-
style:
|
|
88
|
+
className: `${n.modal} ${$ ?? ""}`.trim(),
|
|
89
|
+
style: I,
|
|
90
90
|
onClick: (t) => t.stopPropagation(),
|
|
91
91
|
children: [
|
|
92
|
-
u && /* @__PURE__ */ s("div", { className:
|
|
93
|
-
/* @__PURE__ */ s("div", { className:
|
|
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__ */ s("div", { className:
|
|
102
|
-
typeof window < "u" && R(
|
|
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 {
|
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)}}
|