quirk-ui 0.1.209 → 0.1.210
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('../../../index38.css');const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../index38.css');const e=require("react/jsx-runtime"),i=require("react"),L=require("react-dom"),R=require("../../../x-Dft9NVe_.cjs"),P="_overlay_6t5hy_2",A="_fadeIn_6t5hy_1",F="_container_6t5hy_19",K="_modal_6t5hy_49",X="_slideUp_6t5hy_1",G="_closeButton_6t5hy_60",H="_title_6t5hy_87",J="_content_6t5hy_97",Q="_intro_6t5hy_116",V="_trigger_6t5hy_123",W="_fadeOut_6t5hy_1",Z="_closing_6t5hy_170",O="_slideUpSheet_6t5hy_1",ee="_slideDownSheet_6t5hy_1",o={overlay:P,fadeIn:A,container:F,"size-sm":"_size-sm_6t5hy_26","size-md":"_size-md_6t5hy_30","size-lg":"_size-lg_6t5hy_34","size-xl":"_size-xl_6t5hy_38","size-full":"_size-full_6t5hy_42",modal:K,slideUp:X,closeButton:G,title:H,content:J,intro:Q,trigger:V,fadeOut:W,closing:Z,slideUpSheet:O,slideDownSheet:ee},te=()=>{if(typeof document>"u")return;const s=window.scrollY;document.body.style.position="fixed",document.body.style.top=`-${s}px`,document.body.style.width="100%",document.body.style.overflowY="scroll"},k=()=>{if(typeof document>"u")return;const s=Math.abs(parseInt(document.body.style.top||"0",10));document.body.style.position="",document.body.style.top="",document.body.style.width="",document.body.style.overflowY="",s&&window.scrollTo(0,s)};function oe({content:s,trigger:z,isOpen:h,onOpen:c,onClose:y,size:S="md",closeOnEscape:g=!0,closeOnOverlayClick:$=!0,showCloseButton:E=!0,className:j,overlayClassName:T,style:C,formData:v,renderForm:b}){const[I,p]=i.useState(!1),[_,w]=i.useState(!1),f=i.useRef(null),m=h!==void 0,n=m?h:I,q=()=>{m||p(!0),c==null||c()},d=()=>{w(!0),setTimeout(()=>{w(!1),m?y==null||y():p(!1)},300)},N=()=>n?d():q(),U=()=>{$&&d()};i.useEffect(()=>{if(!g||!n)return;const t=r=>{r.key==="Escape"&&d()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[n,g]),i.useEffect(()=>(n?te():k(),()=>k()),[n]),i.useEffect(()=>{if(!n||!f.current)return;const t=f.current;t.scrollTop=0;const r=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),l=r[0],a=r[r.length-1],x=u=>{u.key==="Tab"&&(u.shiftKey?document.activeElement===l&&(u.preventDefault(),a==null||a.focus()):document.activeElement===a&&(u.preventDefault(),l==null||l.focus()))};t.addEventListener("keydown",x);const Y=setTimeout(()=>l==null?void 0:l.focus(),50);return()=>{t.removeEventListener("keydown",x),clearTimeout(Y)}},[n]);const B=o[`size-${S}`]??"",D=s!==void 0?s:e.jsx(e.Fragment,{children:v&&b?b(v):null}),M=n||_?e.jsx("div",{className:`${o.overlay} ${_?o.closing:""} ${T??""}`.trim(),onClick:U,role:"dialog","aria-modal":"true",children:e.jsxs("div",{className:`${B} ${o.container} ${_?o.closing:""}`,children:[E&&e.jsx("button",{"aria-label":"Close",className:o.closeButton,onClick:d,type:"button",children:e.jsx(R.X,{size:20})}),e.jsx("div",{ref:f,className:`${o.modal} ${j??""}`.trim(),style:C,onClick:t=>t.stopPropagation(),children:e.jsx("div",{className:o.content,children:D})})]})}):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:o.trigger,onClick:N,children:z}),typeof window<"u"&&L.createPortal(M,document.body)]})}exports.Modal=oe;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { X
|
|
5
|
-
import '../../../index38.css';const
|
|
6
|
-
overlay:
|
|
1
|
+
import { jsx as l, Fragment as z, jsxs as x } from "react/jsx-runtime";
|
|
2
|
+
import { useState as S, useRef as A, useEffect as f } from "react";
|
|
3
|
+
import { createPortal as K } from "react-dom";
|
|
4
|
+
import { X } from "../../../x-CnsEH4Ox.js";
|
|
5
|
+
import '../../../index38.css';const F = "_overlay_6t5hy_2", G = "_fadeIn_6t5hy_1", H = "_container_6t5hy_19", J = "_modal_6t5hy_49", Q = "_slideUp_6t5hy_1", V = "_closeButton_6t5hy_60", W = "_title_6t5hy_87", Z = "_content_6t5hy_97", O = "_intro_6t5hy_116", ee = "_trigger_6t5hy_123", te = "_fadeOut_6t5hy_1", oe = "_closing_6t5hy_170", ne = "_slideUpSheet_6t5hy_1", se = "_slideDownSheet_6t5hy_1", t = {
|
|
6
|
+
overlay: F,
|
|
7
7
|
fadeIn: G,
|
|
8
8
|
container: H,
|
|
9
|
-
"size-sm": "_size-
|
|
10
|
-
"size-md": "_size-
|
|
11
|
-
"size-lg": "_size-
|
|
12
|
-
"size-xl": "_size-
|
|
13
|
-
"size-full": "_size-
|
|
9
|
+
"size-sm": "_size-sm_6t5hy_26",
|
|
10
|
+
"size-md": "_size-md_6t5hy_30",
|
|
11
|
+
"size-lg": "_size-lg_6t5hy_34",
|
|
12
|
+
"size-xl": "_size-xl_6t5hy_38",
|
|
13
|
+
"size-full": "_size-full_6t5hy_42",
|
|
14
14
|
modal: J,
|
|
15
15
|
slideUp: Q,
|
|
16
16
|
closeButton: V,
|
|
@@ -18,30 +18,29 @@ import '../../../index38.css';const X = "_overlay_1dim9_2", G = "_fadeIn_1dim9_1
|
|
|
18
18
|
content: Z,
|
|
19
19
|
intro: O,
|
|
20
20
|
trigger: ee,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
slideDownSheet: ie
|
|
21
|
+
fadeOut: te,
|
|
22
|
+
closing: oe,
|
|
23
|
+
slideUpSheet: ne,
|
|
24
|
+
slideDownSheet: se
|
|
26
25
|
}, le = () => {
|
|
27
26
|
if (typeof document > "u") return;
|
|
28
27
|
const n = window.scrollY;
|
|
29
28
|
document.body.style.position = "fixed", document.body.style.top = `-${n}px`, document.body.style.width = "100%", document.body.style.overflowY = "scroll";
|
|
30
|
-
},
|
|
29
|
+
}, $ = () => {
|
|
31
30
|
if (typeof document > "u") return;
|
|
32
31
|
const n = Math.abs(parseInt(document.body.style.top || "0", 10));
|
|
33
32
|
document.body.style.position = "", document.body.style.top = "", document.body.style.width = "", document.body.style.overflowY = "", n && window.scrollTo(0, n);
|
|
34
33
|
};
|
|
35
|
-
function
|
|
34
|
+
function ae({
|
|
36
35
|
content: n,
|
|
37
|
-
trigger:
|
|
38
|
-
isOpen:
|
|
39
|
-
onOpen:
|
|
40
|
-
onClose:
|
|
41
|
-
size:
|
|
42
|
-
closeOnEscape:
|
|
43
|
-
closeOnOverlayClick:
|
|
44
|
-
showCloseButton:
|
|
36
|
+
trigger: E,
|
|
37
|
+
isOpen: h,
|
|
38
|
+
onOpen: i,
|
|
39
|
+
onClose: u,
|
|
40
|
+
size: T = "md",
|
|
41
|
+
closeOnEscape: v = !0,
|
|
42
|
+
closeOnOverlayClick: C = !0,
|
|
43
|
+
showCloseButton: I = !0,
|
|
45
44
|
className: N,
|
|
46
45
|
overlayClassName: U,
|
|
47
46
|
style: B,
|
|
@@ -51,66 +50,66 @@ function me({
|
|
|
51
50
|
formData: p,
|
|
52
51
|
renderForm: g
|
|
53
52
|
}) {
|
|
54
|
-
const [Y, b] =
|
|
55
|
-
|
|
56
|
-
},
|
|
53
|
+
const [Y, b] = S(!1), [y, w] = S(!1), _ = A(null), m = h !== void 0, o = m ? h : Y, D = () => {
|
|
54
|
+
m || b(!0), i == null || i();
|
|
55
|
+
}, d = () => {
|
|
57
56
|
w(!0), setTimeout(() => {
|
|
58
|
-
w(!1),
|
|
57
|
+
w(!1), m ? u == null || u() : b(!1);
|
|
59
58
|
}, 300);
|
|
60
|
-
}, L = () => o ?
|
|
61
|
-
|
|
59
|
+
}, L = () => o ? d() : D(), j = () => {
|
|
60
|
+
C && d();
|
|
62
61
|
};
|
|
63
|
-
|
|
64
|
-
if (!
|
|
65
|
-
const e = (
|
|
66
|
-
|
|
62
|
+
f(() => {
|
|
63
|
+
if (!v || !o) return;
|
|
64
|
+
const e = (c) => {
|
|
65
|
+
c.key === "Escape" && d();
|
|
67
66
|
};
|
|
68
67
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
69
|
-
}, [o,
|
|
68
|
+
}, [o, v]), f(() => (o ? le() : $(), () => $()), [o]), f(() => {
|
|
70
69
|
if (!o || !_.current) return;
|
|
71
70
|
const e = _.current;
|
|
72
71
|
e.scrollTop = 0;
|
|
73
|
-
const
|
|
72
|
+
const c = e.querySelectorAll(
|
|
74
73
|
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
75
|
-
), s =
|
|
74
|
+
), s = c[0], r = c[c.length - 1], k = (a) => {
|
|
76
75
|
a.key === "Tab" && (a.shiftKey ? document.activeElement === s && (a.preventDefault(), r == null || r.focus()) : document.activeElement === r && (a.preventDefault(), s == null || s.focus()));
|
|
77
76
|
};
|
|
78
77
|
e.addEventListener("keydown", k);
|
|
79
|
-
const
|
|
78
|
+
const q = setTimeout(() => s == null ? void 0 : s.focus(), 50);
|
|
80
79
|
return () => {
|
|
81
|
-
e.removeEventListener("keydown", k), clearTimeout(
|
|
80
|
+
e.removeEventListener("keydown", k), clearTimeout(q);
|
|
82
81
|
};
|
|
83
82
|
}, [o]);
|
|
84
|
-
const
|
|
83
|
+
const M = t[`size-${T}`] ?? "", P = n !== void 0 ? n : /* @__PURE__ */ l(z, { children: p && g ? g(p) : null }), R = o || y ? /* @__PURE__ */ l(
|
|
85
84
|
"div",
|
|
86
85
|
{
|
|
87
|
-
className: `${t.overlay} ${
|
|
88
|
-
onClick:
|
|
86
|
+
className: `${t.overlay} ${y ? t.closing : ""} ${U ?? ""}`.trim(),
|
|
87
|
+
onClick: j,
|
|
89
88
|
role: "dialog",
|
|
90
89
|
"aria-modal": "true",
|
|
91
90
|
children: /* @__PURE__ */ x(
|
|
92
91
|
"div",
|
|
93
92
|
{
|
|
94
|
-
className: `${
|
|
93
|
+
className: `${M} ${t.container} ${y ? t.closing : ""}`,
|
|
95
94
|
children: [
|
|
96
|
-
|
|
95
|
+
I && /* @__PURE__ */ l(
|
|
97
96
|
"button",
|
|
98
97
|
{
|
|
99
98
|
"aria-label": "Close",
|
|
100
99
|
className: t.closeButton,
|
|
101
|
-
onClick:
|
|
100
|
+
onClick: d,
|
|
102
101
|
type: "button",
|
|
103
|
-
children: /* @__PURE__ */
|
|
102
|
+
children: /* @__PURE__ */ l(X, { size: 20 })
|
|
104
103
|
}
|
|
105
104
|
),
|
|
106
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ l(
|
|
107
106
|
"div",
|
|
108
107
|
{
|
|
109
108
|
ref: _,
|
|
110
109
|
className: `${t.modal} ${N ?? ""}`.trim(),
|
|
111
110
|
style: B,
|
|
112
111
|
onClick: (e) => e.stopPropagation(),
|
|
113
|
-
children: /* @__PURE__ */
|
|
112
|
+
children: /* @__PURE__ */ l("div", { className: t.content, children: P })
|
|
114
113
|
}
|
|
115
114
|
)
|
|
116
115
|
]
|
|
@@ -119,10 +118,10 @@ function me({
|
|
|
119
118
|
}
|
|
120
119
|
) : null;
|
|
121
120
|
return /* @__PURE__ */ x(z, { children: [
|
|
122
|
-
/* @__PURE__ */
|
|
123
|
-
typeof window < "u" &&
|
|
121
|
+
/* @__PURE__ */ l("div", { className: t.trigger, onClick: L, children: E }),
|
|
122
|
+
typeof window < "u" && K(R, document.body)
|
|
124
123
|
] });
|
|
125
124
|
}
|
|
126
125
|
export {
|
|
127
|
-
|
|
126
|
+
ae as Modal
|
|
128
127
|
};
|
package/dist/index38.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._overlay_6t5hy_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_6t5hy_1 .2s ease;padding:var(--spacing-md, 1rem);overflow-y:auto}._container_6t5hy_19{position:relative;display:flex;flex-direction:column}._size-sm_6t5hy_26{width:90%;max-width:400px}._size-md_6t5hy_30{width:90%;max-width:600px}._size-lg_6t5hy_34{width:90%;max-width:800px}._size-xl_6t5hy_38{width:90%;max-width:1200px}._size-full_6t5hy_42{width:95%;height:95dvh;max-height:95dvh}._modal_6t5hy_49{position:relative;background-color:var(--color-background, #fff);border-radius:var(--radius-lg, .5rem);padding:var(--spacing-xl, 2rem);max-height:90dvh;overflow-y:auto;animation:_slideUp_6t5hy_1 .3s ease}._closeButton_6t5hy_60{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_6t5hy_60:hover{background-color:var(--color-secondary-10, #f5f5f5);color:var(--color-text-primary, #333)}._closeButton_6t5hy_60:focus-visible{outline:2px solid var(--color-primary-100, #007bff);outline-offset:2px}._title_6t5hy_87{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_6t5hy_97{color:var(--color-text-primary, #333);line-height:var(--line-height-normal, 1.5);display:flex;flex-direction:column;gap:var(--spacing-xl)}._content_6t5hy_97 video,._content_6t5hy_97 img{max-width:100%;height:auto;border-radius:var(--radius-md, .5rem)}._content_6t5hy_97 video{width:100%}._intro_6t5hy_116{margin-bottom:var(--spacing-lg, 1.5rem);padding-bottom:var(--spacing-lg, 1.5rem);border-bottom:1px solid var(--color-border, #e5e7eb)}._trigger_6t5hy_123{width:auto;display:inline-block;cursor:pointer}@keyframes _fadeIn_6t5hy_1{0%{opacity:0}to{opacity:1}}@keyframes _fadeOut_6t5hy_1{0%{opacity:1}to{opacity:0}}@keyframes _slideUp_6t5hy_1{0%{opacity:0;transform:translateY(30px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@media (max-width: 767px){._overlay_6t5hy_2{align-items:flex-end;justify-content:stretch;padding:0;overflow:hidden}._overlay_6t5hy_2._closing_6t5hy_170{animation:_fadeOut_6t5hy_1 .3s ease forwards}._container_6t5hy_19{width:100%;max-width:100%;max-height:92dvh;display:flex;flex-direction:column;border-radius:var(--radius-lg, .5rem) var(--radius-lg, .5rem) 0 0;background-color:var(--color-background, #fff);animation:_slideUpSheet_6t5hy_1 .3s cubic-bezier(.16,1,.3,1) forwards}._container_6t5hy_19._closing_6t5hy_170{animation:_slideDownSheet_6t5hy_1 .3s cubic-bezier(.16,1,.3,1) forwards}._size-sm_6t5hy_26,._size-md_6t5hy_30,._size-lg_6t5hy_34,._size-xl_6t5hy_38,._size-full_6t5hy_42{width:100%;max-width:100%;height:100%;max-height:92dvh}._closeButton_6t5hy_60{color:var(--color-text-primary, #333);align-self:flex-end;margin:var(--spacing-sm)}._modal_6t5hy_49{border-radius:var(--radius-lg, .5rem) var(--radius-lg, .5rem) 0 0;padding:2.5rem var(--spacing-lg) var(--spacing-lg, 1.5rem);flex:1;overflow-y:scroll;-webkit-overflow-scrolling:touch;max-height:none;animation:none;transform:none;overscroll-behavior:contain;position:absolute;height:100%}._content_6t5hy_97{height:unset;width:100%}._title_6t5hy_87{font-size:var(--font-size-lg, 1.25rem);padding-right:0}}@keyframes _slideUpSheet_6t5hy_1{0%{transform:translateY(150%);opacity:.75}to{transform:translateY(0);opacity:1}}@keyframes _slideDownSheet_6t5hy_1{0%{transform:translateY(0);opacity:1}to{transform:translateY(100%);opacity:0}}
|