quirk-ui 0.1.151 → 0.1.152

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"),a=require("react"),C=require("react-dom"),F=require("../../../x-Dft9NVe_.cjs"),K="_overlay_1pdac_2",X="_fadeIn_1pdac_1",B="_container_1pdac_19",G="_modal_1pdac_49",H="_slideUp_1pdac_1",J="_closeButton_1pdac_60",Q="_title_1pdac_87",V="_content_1pdac_97",W="_intro_1pdac_114",Y="_trigger_1pdac_121",t={overlay:K,fadeIn:X,container:B,"size-sm":"_size-sm_1pdac_26","size-md":"_size-md_1pdac_30","size-lg":"_size-lg_1pdac_34","size-xl":"_size-xl_1pdac_38","size-full":"_size-full_1pdac_42",modal:G,slideUp:H,closeButton:J,title:Q,content:V,intro:W,trigger:Y},Z=()=>{typeof document<"u"&&(document.body.style.overflow="hidden")},E=()=>{typeof document<"u"&&(document.body.style.overflow="")};function T({content:y,trigger:k,isOpen:p,onOpen:l,onClose:o,size:$="md",closeOnEscape:g=!0,closeOnOverlayClick:w=!0,showCloseButton:N=!0,className:q,overlayClassName:S,style:I,title:f,richTextBlocks:i,renderRichText:b,formData:h,renderForm:z}){const[L,j]=a.useState(!1),m=a.useRef(null),v=p!==void 0,n=v?p:L,M=()=>{v||j(!0),l==null||l()},r=()=>{v||j(!1),o==null||o()},P=()=>n?r():M(),R=()=>{w&&r()};a.useEffect(()=>{if(!g||!n)return;const s=d=>{d.key==="Escape"&&r()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[n,g]),a.useEffect(()=>(n?Z():E(),()=>E()),[n]),a.useEffect(()=>{if(!n||!m.current)return;const s=m.current,d=s.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),c=d[0],u=d[d.length-1],x=_=>{_.key==="Tab"&&(_.shiftKey?document.activeElement===c&&(_.preventDefault(),u==null||u.focus()):document.activeElement===u&&(_.preventDefault(),c==null||c.focus()))};return s.addEventListener("keydown",x),c==null||c.focus(),()=>s.removeEventListener("keydown",x)},[n]);const U=t[`size-${$}`]??"",D=y!==void 0?y:e.jsxs(e.Fragment,{children:[i!=null&&i.length&&b?e.jsx("div",{className:t.intro,children:b({blocks:i})}):null,h&&z?z(h):null]}),A=n?e.jsx("div",{className:`${t.overlay} ${S??""}`.trim(),onClick:R,role:"dialog","aria-modal":"true","aria-labelledby":f?"modal-title":void 0,children:e.jsxs("div",{className:`${U} ${t.container}`,children:[N&&e.jsx("button",{"aria-label":"Close",className:t.closeButton,onClick:r,type:"button",children:e.jsx(F.X,{size:20})}),e.jsxs("div",{ref:m,className:`${t.modal} ${q??""}`.trim(),style:I,onClick:s=>s.stopPropagation(),children:[f&&e.jsx("div",{className:t.title,id:"modal-title",children:f}),e.jsx("div",{className:t.content,children:D})]})]})}):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:t.trigger,onClick:P,children:k}),typeof window<"u"&&C.createPortal(A,document.body)]})}exports.Modal=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../index38.css');const e=require("react/jsx-runtime"),d=require("react"),C=require("react-dom"),F=require("../../../x-Dft9NVe_.cjs"),K="_overlay_1u4kf_2",X="_fadeIn_1u4kf_1",B="_container_1u4kf_19",G="_modal_1u4kf_49",H="_slideUp_1u4kf_1",J="_closeButton_1u4kf_60",Q="_title_1u4kf_87",V="_content_1u4kf_97",W="_trigger_1u4kf_117",t={overlay:K,fadeIn:X,container:B,"size-sm":"_size-sm_1u4kf_26","size-md":"_size-md_1u4kf_30","size-lg":"_size-lg_1u4kf_34","size-xl":"_size-xl_1u4kf_38","size-full":"_size-full_1u4kf_42",modal:G,slideUp:H,closeButton:J,title:Q,content:V,trigger:W},Y=()=>{typeof document<"u"&&(document.body.style.overflow="hidden")},E=()=>{typeof document<"u"&&(document.body.style.overflow="")};function Z({content:y,trigger:p,isOpen:k,onOpen:o,onClose:i,size:$="md",closeOnEscape:g=!0,closeOnOverlayClick:w=!0,showCloseButton:N=!0,className:q,overlayClassName:S,style:I,title:_,richTextBlocks:a,renderRichText:b,formData:h,renderForm:z}){const[L,j]=d.useState(!1),m=d.useRef(null),v=k!==void 0,n=v?k:L,M=()=>{v||j(!0),o==null||o()},r=()=>{v||j(!1),i==null||i()},P=()=>n?r():M(),R=()=>{w&&r()};d.useEffect(()=>{if(!g||!n)return;const s=c=>{c.key==="Escape"&&r()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[n,g]),d.useEffect(()=>(n?Y():E(),()=>E()),[n]),d.useEffect(()=>{if(!n||!m.current)return;const s=m.current,c=s.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),l=c[0],u=c[c.length-1],x=f=>{f.key==="Tab"&&(f.shiftKey?document.activeElement===l&&(f.preventDefault(),u==null||u.focus()):document.activeElement===u&&(f.preventDefault(),l==null||l.focus()))};return s.addEventListener("keydown",x),l==null||l.focus(),()=>s.removeEventListener("keydown",x)},[n]);const U=t[`size-${$}`]??"",D=y!==void 0?y:e.jsxs(e.Fragment,{children:[a!=null&&a.length&&b?e.jsx("div",{className:t.intro,children:b({blocks:a})}):null,h&&z?z(h):null]}),A=n?e.jsx("div",{className:`${t.overlay} ${S??""}`.trim(),onClick:R,role:"dialog","aria-modal":"true","aria-labelledby":_?"modal-title":void 0,children:e.jsxs("div",{className:`${U} ${t.container}`,children:[N&&e.jsx("button",{"aria-label":"Close",className:t.closeButton,onClick:r,type:"button",children:e.jsx(F.X,{size:20})}),e.jsxs("div",{ref:m,className:`${t.modal} ${q??""}`.trim(),style:I,onClick:s=>s.stopPropagation(),children:[_&&e.jsx("div",{className:t.title,id:"modal-title",children:_}),e.jsx("div",{className:t.content,children:D})]})]})}):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:t.trigger,onClick:P,children:p}),typeof window<"u"&&C.createPortal(A,document.body)]})}exports.Modal=Z;
@@ -1,34 +1,33 @@
1
- import { jsxs as m, Fragment as N, jsx as o } from "react/jsx-runtime";
2
- import { useState as X, useRef as B, useEffect as v } from "react";
1
+ import { jsxs as f, Fragment as N, jsx as o } from "react/jsx-runtime";
2
+ import { useState as X, useRef as B, useEffect as y } from "react";
3
3
  import { createPortal as F } from "react-dom";
4
4
  import { X as G } from "../../../x-CnsEH4Ox.js";
5
- import '../../../index38.css';const H = "_overlay_1pdac_2", J = "_fadeIn_1pdac_1", Q = "_container_1pdac_19", V = "_modal_1pdac_49", W = "_slideUp_1pdac_1", Y = "_closeButton_1pdac_60", Z = "_title_1pdac_87", T = "_content_1pdac_97", O = "_intro_1pdac_114", ee = "_trigger_1pdac_121", e = {
5
+ import '../../../index38.css';const H = "_overlay_1u4kf_2", J = "_fadeIn_1u4kf_1", Q = "_container_1u4kf_19", V = "_modal_1u4kf_49", W = "_slideUp_1u4kf_1", Y = "_closeButton_1u4kf_60", Z = "_title_1u4kf_87", T = "_content_1u4kf_97", O = "_trigger_1u4kf_117", e = {
6
6
  overlay: H,
7
7
  fadeIn: J,
8
8
  container: Q,
9
- "size-sm": "_size-sm_1pdac_26",
10
- "size-md": "_size-md_1pdac_30",
11
- "size-lg": "_size-lg_1pdac_34",
12
- "size-xl": "_size-xl_1pdac_38",
13
- "size-full": "_size-full_1pdac_42",
9
+ "size-sm": "_size-sm_1u4kf_26",
10
+ "size-md": "_size-md_1u4kf_30",
11
+ "size-lg": "_size-lg_1u4kf_34",
12
+ "size-xl": "_size-xl_1u4kf_38",
13
+ "size-full": "_size-full_1u4kf_42",
14
14
  modal: V,
15
15
  slideUp: W,
16
16
  closeButton: Y,
17
17
  title: Z,
18
18
  content: T,
19
- intro: O,
20
- trigger: ee
21
- }, te = () => {
19
+ trigger: O
20
+ }, ee = () => {
22
21
  typeof document < "u" && (document.body.style.overflow = "hidden");
23
22
  }, $ = () => {
24
23
  typeof document < "u" && (document.body.style.overflow = "");
25
24
  };
26
- function ce({
27
- content: y,
25
+ function ie({
26
+ content: k,
28
27
  trigger: I,
29
28
  isOpen: g,
30
- onOpen: d,
31
- onClose: c,
29
+ onOpen: i,
30
+ onClose: s,
32
31
  size: L = "md",
33
32
  closeOnEscape: b = !0,
34
33
  closeOnOverlayClick: S = !0,
@@ -36,37 +35,37 @@ function ce({
36
35
  className: j,
37
36
  overlayClassName: x,
38
37
  style: P,
39
- title: _,
40
- richTextBlocks: i,
38
+ title: m,
39
+ richTextBlocks: c,
41
40
  renderRichText: h,
42
- formData: z,
43
- renderForm: k
41
+ formData: p,
42
+ renderForm: z
44
43
  }) {
45
- const [q, E] = X(!1), f = B(null), p = g !== void 0, t = p ? g : q, A = () => {
46
- p || E(!0), d == null || d();
47
- }, s = () => {
48
- p || E(!1), c == null || c();
49
- }, C = () => t ? s() : A(), D = () => {
50
- S && s();
44
+ const [q, E] = X(!1), _ = B(null), v = g !== void 0, t = v ? g : q, A = () => {
45
+ v || E(!0), i == null || i();
46
+ }, a = () => {
47
+ v || E(!1), s == null || s();
48
+ }, C = () => t ? a() : A(), D = () => {
49
+ S && a();
51
50
  };
52
- v(() => {
51
+ y(() => {
53
52
  if (!b || !t) return;
54
- const n = (a) => {
55
- a.key === "Escape" && s();
53
+ const n = (d) => {
54
+ d.key === "Escape" && a();
56
55
  };
57
56
  return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
58
- }, [t, b]), v(() => (t ? te() : $(), () => $()), [t]), v(() => {
59
- if (!t || !f.current) return;
60
- const n = f.current, a = n.querySelectorAll(
57
+ }, [t, b]), y(() => (t ? ee() : $(), () => $()), [t]), y(() => {
58
+ if (!t || !_.current) return;
59
+ const n = _.current, d = n.querySelectorAll(
61
60
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
62
- ), l = a[0], r = a[a.length - 1], w = (u) => {
61
+ ), l = d[0], r = d[d.length - 1], w = (u) => {
63
62
  u.key === "Tab" && (u.shiftKey ? document.activeElement === l && (u.preventDefault(), r == null || r.focus()) : document.activeElement === r && (u.preventDefault(), l == null || l.focus()));
64
63
  };
65
64
  return n.addEventListener("keydown", w), l == null || l.focus(), () => n.removeEventListener("keydown", w);
66
65
  }, [t]);
67
- const K = e[`size-${L}`] ?? "", M = y !== void 0 ? y : /* @__PURE__ */ m(N, { children: [
68
- i != null && i.length && h ? /* @__PURE__ */ o("div", { className: e.intro, children: h({ blocks: i }) }) : null,
69
- z && k ? k(z) : null
66
+ const K = e[`size-${L}`] ?? "", M = k !== void 0 ? k : /* @__PURE__ */ f(N, { children: [
67
+ c != null && c.length && h ? /* @__PURE__ */ o("div", { className: e.intro, children: h({ blocks: c }) }) : null,
68
+ p && z ? z(p) : null
70
69
  ] }), R = t ? /* @__PURE__ */ o(
71
70
  "div",
72
71
  {
@@ -74,27 +73,27 @@ function ce({
74
73
  onClick: D,
75
74
  role: "dialog",
76
75
  "aria-modal": "true",
77
- "aria-labelledby": _ ? "modal-title" : void 0,
78
- children: /* @__PURE__ */ m("div", { className: `${K} ${e.container}`, children: [
76
+ "aria-labelledby": m ? "modal-title" : void 0,
77
+ children: /* @__PURE__ */ f("div", { className: `${K} ${e.container}`, children: [
79
78
  U && /* @__PURE__ */ o(
80
79
  "button",
81
80
  {
82
81
  "aria-label": "Close",
83
82
  className: e.closeButton,
84
- onClick: s,
83
+ onClick: a,
85
84
  type: "button",
86
85
  children: /* @__PURE__ */ o(G, { size: 20 })
87
86
  }
88
87
  ),
89
- /* @__PURE__ */ m(
88
+ /* @__PURE__ */ f(
90
89
  "div",
91
90
  {
92
- ref: f,
91
+ ref: _,
93
92
  className: `${e.modal} ${j ?? ""}`.trim(),
94
93
  style: P,
95
94
  onClick: (n) => n.stopPropagation(),
96
95
  children: [
97
- _ && /* @__PURE__ */ o("div", { className: e.title, id: "modal-title", children: _ }),
96
+ m && /* @__PURE__ */ o("div", { className: e.title, id: "modal-title", children: m }),
98
97
  /* @__PURE__ */ o("div", { className: e.content, children: M })
99
98
  ]
100
99
  }
@@ -102,11 +101,11 @@ function ce({
102
101
  ] })
103
102
  }
104
103
  ) : null;
105
- return /* @__PURE__ */ m(N, { children: [
104
+ return /* @__PURE__ */ f(N, { children: [
106
105
  /* @__PURE__ */ o("div", { className: e.trigger, onClick: C, children: I }),
107
106
  typeof window < "u" && F(R, document.body)
108
107
  ] });
109
108
  }
110
109
  export {
111
- ce as Modal
110
+ ie as Modal
112
111
  };
package/dist/index38.css CHANGED
@@ -1 +1 @@
1
- ._overlay_1pdac_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_1pdac_1 .2s ease;padding:var(--spacing-md, 1rem);overflow-y:auto}._container_1pdac_19{position:relative;display:flex;flex-direction:column}._size-sm_1pdac_26{width:90%;max-width:400px}._size-md_1pdac_30{width:90%;max-width:600px}._size-lg_1pdac_34{width:90%;max-width:800px}._size-xl_1pdac_38{width:90%;max-width:1200px}._size-full_1pdac_42{width:95%;height:95dvh;max-height:95dvh}._modal_1pdac_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_1pdac_1 .3s ease}._closeButton_1pdac_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_1pdac_60:hover{background-color:var(--color-secondary-10, #f5f5f5);color:var(--color-text-primary, #333)}._closeButton_1pdac_60:focus-visible{outline:2px solid var(--color-primary-100, #007bff);outline-offset:2px}._title_1pdac_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_1pdac_97{color:var(--color-text-primary, #333);line-height:var(--line-height-normal, 1.5)}._content_1pdac_97 video,._content_1pdac_97 img{max-width:100%;height:auto;border-radius:var(--radius-md, .5rem)}._content_1pdac_97 video{width:100%}._intro_1pdac_114{margin-bottom:var(--spacing-lg, 1.5rem);padding-bottom:var(--spacing-lg, 1.5rem);border-bottom:1px solid var(--color-border, #e5e7eb)}._trigger_1pdac_121{width:auto;display:inline-block;cursor:pointer}@keyframes _fadeIn_1pdac_1{0%{opacity:0}to{opacity:1}}@keyframes _slideUp_1pdac_1{0%{opacity:0;transform:translateY(30px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@media (max-width: 768px){._modal_1pdac_49{padding:var(--spacing-lg, 1.5rem);max-height:85dvh}._size-sm_1pdac_26,._size-md_1pdac_30,._size-lg_1pdac_34,._size-xl_1pdac_38{width:95%}._title_1pdac_87{font-size:var(--font-size-lg, 1.25rem);padding-right:var(--spacing-lg, 1.5rem)}}@media (max-width: 480px){._overlay_1pdac_2{padding:var(--spacing-sm, .5rem)}._modal_1pdac_49{padding:var(--spacing-md, 1rem);max-height:90dvh}._title_1pdac_87{font-size:var(--font-size-md, 1rem);margin-bottom:var(--spacing-md, 1rem)}}
1
+ ._overlay_1u4kf_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_1u4kf_1 .2s ease;padding:var(--spacing-md, 1rem);overflow-y:auto}._container_1u4kf_19{position:relative;display:flex;flex-direction:column}._size-sm_1u4kf_26{width:90%;max-width:400px}._size-md_1u4kf_30{width:90%;max-width:600px}._size-lg_1u4kf_34{width:90%;max-width:800px}._size-xl_1u4kf_38{width:90%;max-width:1200px}._size-full_1u4kf_42{width:95%;height:95dvh;max-height:95dvh}._modal_1u4kf_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_1u4kf_1 .3s ease}._closeButton_1u4kf_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_1u4kf_60:hover{background-color:var(--color-secondary-10, #f5f5f5);color:var(--color-text-primary, #333)}._closeButton_1u4kf_60:focus-visible{outline:2px solid var(--color-primary-100, #007bff);outline-offset:2px}._title_1u4kf_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_1u4kf_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_1u4kf_97 video,._content_1u4kf_97 img{max-width:100%;height:auto;border-radius:var(--radius-md, .5rem)}._content_1u4kf_97 video{width:100%}._trigger_1u4kf_117{width:auto;display:inline-block;cursor:pointer}@keyframes _fadeIn_1u4kf_1{0%{opacity:0}to{opacity:1}}@keyframes _slideUp_1u4kf_1{0%{opacity:0;transform:translateY(30px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}@media (max-width: 768px){._modal_1u4kf_49{padding:var(--spacing-lg, 1.5rem);max-height:85dvh}._size-sm_1u4kf_26,._size-md_1u4kf_30,._size-lg_1u4kf_34,._size-xl_1u4kf_38{width:95%}._title_1u4kf_87{font-size:var(--font-size-lg, 1.25rem);padding-right:var(--spacing-lg, 1.5rem)}}@media (max-width: 480px){._overlay_1u4kf_2{padding:var(--spacing-sm, .5rem)}._modal_1u4kf_49{padding:var(--spacing-md, 1rem);max-height:90dvh}._title_1u4kf_87{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.151",
4
+ "version": "0.1.152",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {