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="_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
+ "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 U, jsx as s } from "react/jsx-runtime";
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 = "_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 = {
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-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",
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
- }, b = () => {
21
+ }, k = () => {
22
22
  typeof document < "u" && (document.body.style.overflow = "");
23
23
  };
24
24
  function O({
25
- content: k,
26
- trigger: p,
25
+ content: p,
26
+ trigger: z,
27
27
  isOpen: y,
28
28
  onOpen: l,
29
29
  onClose: i,
30
- size: z = "md",
30
+ size: w = "md",
31
31
  closeOnEscape: h = !0,
32
- closeOnOverlayClick: w = !0,
33
- showCloseButton: x = !0,
34
- className: N,
35
- overlayClassName: $,
36
- style: E,
32
+ closeOnOverlayClick: x = !0,
33
+ showCloseButton: N = !0,
34
+ className: $,
35
+ overlayClassName: E,
36
+ style: I,
37
37
  title: u
38
38
  }) {
39
- const [I, g] = D(!1), f = P(null), m = y !== void 0, e = m ? y : I, B = () => {
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
- w && r();
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() : b(), () => b()), [e]), v(() => {
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
- ), 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()));
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", j), n == null || n.focus(), () => {
62
- t.removeEventListener("keydown", j);
61
+ return t.addEventListener("keydown", b), o == null || o.focus(), () => {
62
+ t.removeEventListener("keydown", b);
63
63
  };
64
64
  }, [e]);
65
- const C = o[`size-${z}`] || "", T = e ? /* @__PURE__ */ s(
65
+ const T = n[`size-${w}`] || "", U = e ? /* @__PURE__ */ s(
66
66
  "div",
67
67
  {
68
- className: `${o.overlay} ${$ ?? ""}`.trim(),
69
- onClick: S,
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: `${C} modalContentContainer`, children: [
74
- x && /* @__PURE__ */ s(
73
+ children: /* @__PURE__ */ _("div", { className: `${T} modalContentContainer`, children: [
74
+ N && /* @__PURE__ */ s(
75
75
  "button",
76
76
  {
77
77
  "aria-label": "Close",
78
- className: o.closeButton,
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: `${o.modal} ${N ?? ""}`.trim(),
89
- style: E,
88
+ className: `${n.modal} ${$ ?? ""}`.trim(),
89
+ style: I,
90
90
  onClick: (t) => t.stopPropagation(),
91
91
  children: [
92
- u && /* @__PURE__ */ s("div", { className: o.title, id: "modal-title", children: u }),
93
- /* @__PURE__ */ s("div", { className: o.content, children: k })
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__ */ _(U, { children: [
101
- /* @__PURE__ */ s("div", { className: o.trigger, onClick: L, children: p }),
102
- typeof window < "u" && R(T, document.body)
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
- ._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)}}
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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quirk-ui",
3
3
  "private": false,
4
- "version": "0.1.50",
4
+ "version": "0.1.51",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {