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