quirk-ui 0.1.192 → 0.1.193
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('../../../index.css');require('../../../index11.css');const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../index.css');require('../../../index11.css');const e=require("react/jsx-runtime"),k=require("react"),q=require("@portabletext/react"),w=require("../AnimatedSpan/index.cjs");;/* empty css */require("../../../core/components/Avatar/index.cjs");require("../../../core/context/ModalContext.cjs");require("../../../core/components/Checkbox/index.cjs");const L=require("../../../core/components/Text/index.cjs"),h=require("../../../core/components/Heading/index.cjs");require("react-dom");const B=require("../../../core/components/Table/index.cjs");require("../../../core/components/Tabs/index.cjs");require("../../../core/tokens/theme.cjs");const H=require("next/image"),S=require("../../hooks/useMediaQuery.cjs"),b="_container_1glyt_1",z="_divider_1glyt_32",F="_richTextImage_1glyt_50",I="_richTextLink_1glyt_58",W="_spacerSmall_1glyt_72",C="_spacerMedium_1glyt_77",P="_spacerLarge_1glyt_82",U="_codeBlock_1glyt_110",A="_codeBlockWrapper_1glyt_119",E="_codeFilename_1glyt_131",i={container:b,divider:z,richTextImage:F,richTextLink:I,spacerSmall:W,spacerMedium:C,spacerLarge:P,codeBlock:U,codeBlockWrapper:A,codeFilename:E};function Q(t){return{normal:({children:n})=>e.jsx(L.Text,{className:t,children:n}),h1:({children:n})=>e.jsx(h.Heading,{className:t,level:1,children:n}),h2:({children:n})=>e.jsx(h.Heading,{className:t,level:2,children:n}),h3:({children:n})=>e.jsx(h.Heading,{className:t,level:3,children:n}),h4:({children:n})=>e.jsx(h.Heading,{className:t,level:4,children:n}),h5:({children:n})=>e.jsx(h.Heading,{className:t,level:5,children:n}),h6:({children:n})=>e.jsx(h.Heading,{className:t,level:6,children:n}),quote:({children:n})=>e.jsx("blockquote",{className:t,children:n})}}const D={strong:({children:t})=>e.jsx("strong",{children:t}),em:({children:t})=>e.jsx("em",{children:t}),number:({children:t})=>e.jsx("span",{className:"inlineNumber",children:t}),left:({children:t})=>e.jsx("span",{className:"textLeft",children:t}),center:({children:t})=>e.jsx("span",{className:"textCenter",children:t}),right:({children:t})=>e.jsx("span",{className:"textRight",children:t}),inlineCode:({children:t})=>e.jsx("code",{children:t}),link:({children:t,value:n})=>{var s;const{linkType:r,internalUrl:l,externalUrl:m,email:d,phone:p,blank:_}=n??{};let a="#";return r==="external"&&m?a=m:r==="internal"&&((s=l==null?void 0:l.slug)!=null&&s.current)?a=`/${l.slug.current}`:r==="email"&&d?a=`mailto:${d}`:r==="phone"&&p&&(a=`tel:${p.replace(/\s/g,"")}`),e.jsx("a",{href:a,target:_?"_blank":void 0,rel:r==="external"?"noopener noreferrer":void 0,className:i.richTextLink,children:t})},textSize:({children:t,value:n})=>{const r=n!=null&&n.size?`text-${n.size}`:"";return e.jsx("span",{className:r,children:t})}};function G({baseClassName:t,previousTextRef:n,textOverride:r,animateText:l,isMobile:m}){const d=({children:s,value:c})=>{if(!c)return e.jsx(e.Fragment,{children:s});const{colorClass:o}=c;return r?l?e.jsx(w.AnimatedSpan,{className:o,text:r,prevText:n.current},"animated-span"):e.jsx("span",{className:o,children:r}):e.jsx("span",{className:o,children:s})},p=({children:s=[]})=>{const c=k.Children.count(s);return e.jsx("ul",{style:{columnCount:m?1:c>7?2:1},className:t,children:s})};let _;const a=()=>_;return _={marks:{...D,coloredText:d},block:Q(t),list:{bullet:p},types:{image:({value:s})=>{var o,j,x,T,y;if(!(s!=null&&s.imageUrls))return null;const c=((o=s.asset)==null?void 0:o.altText)||"Content image";return e.jsxs("figure",{className:`${t??""} ${i.richTextImage}`,children:[e.jsx(H,{src:s.imageUrls.medium,alt:c,width:1e3,height:800,style:{maxWidth:"100%",height:"auto"}}),(((j=s.asset)==null?void 0:j.title)||((x=s.asset)==null?void 0:x.description))&&e.jsxs("figcaption",{children:[((T=s.asset)==null?void 0:T.title)&&e.jsx("strong",{children:s.asset.title}),((y=s.asset)==null?void 0:y.description)&&e.jsx("p",{children:s.asset.description})]})]})},divider:()=>e.jsx("hr",{className:i.divider}),spacer:({value:s})=>{const c=(s==null?void 0:s.style)||"medium",o={small:i.spacerSmall,medium:i.spacerMedium,large:i.spacerLarge};return e.jsx("span",{className:o[c]??i.spacerMedium})},table:({value:s})=>{var $,N;if(!(($=s==null?void 0:s.rows)!=null&&$.length))return null;const{hasHeadingRow:c}=s,o=c?s.rows[0]:null,j=c?s.rows.slice(1):s.rows,x=o||j[0];if(!((N=x==null?void 0:x.cells)!=null&&N.length))return null;const T=x.cells.map((M,u)=>{var f;return{header:o?e.jsx(q.PortableText,{value:(f=o.cells[u])==null?void 0:f.content,components:a()}):`Column ${u+1}`,accessor:`col${u}`,cellRenderer:g=>g?e.jsx(q.PortableText,{value:g,components:a()}):null}}),y=j.map(M=>{var f;const u={};return(f=M.cells)==null||f.forEach((g,R)=>{u[`col${R}`]=g==null?void 0:g.content}),u});return e.jsx(B.Table,{hasHeadingRow:c,data:y,columns:T,className:`${t??""} ${c?"hasHeadingRow":""}`})},code:({value:s})=>s!=null&&s.code?e.jsxs("div",{className:`${i.codeBlockWrapper} ${t??""}`,children:[s.filename&&e.jsx("div",{className:i.codeFilename,children:s.filename}),e.jsx("pre",{className:i.codeBlock,children:e.jsx("code",{children:s.code})})]}):null}},_}const J=({blocks:t,className:n,textOverride:r,animateText:l})=>{const m=S.useMediaQuery("(max-width: 767px)"),d=k.useRef(r);k.useEffect(()=>{d.current=r},[r]);const p=k.useMemo(()=>G({baseClassName:n,previousTextRef:d,textOverride:r,animateText:l,isMobile:m}),[n,r,l,m]);return t?typeof t=="string"?e.jsx(L.Text,{className:n,children:t}):e.jsx("div",{className:`${i.container} portableTextContainer`,children:e.jsx(q.PortableText,{value:t,components:p})}):null};exports.RichText=J;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as n, jsxs as N, Fragment as S } from "react/jsx-runtime";
|
|
2
2
|
import z, { useRef as F, useEffect as I, useMemo as W } from "react";
|
|
3
|
-
import { PortableText as
|
|
3
|
+
import { PortableText as $ } from "@portabletext/react";
|
|
4
4
|
import { AnimatedSpan as C } from "../AnimatedSpan/index.mjs";
|
|
5
5
|
import '../../../index.css';import '../../../index11.css';/* empty css */
|
|
6
6
|
import "../../../core/components/Avatar/index.mjs";
|
|
@@ -26,197 +26,197 @@ const q = "_container_1glyt_1", E = "_divider_1glyt_32", b = "_richTextImage_1gl
|
|
|
26
26
|
codeBlockWrapper: J,
|
|
27
27
|
codeFilename: K
|
|
28
28
|
};
|
|
29
|
-
function X(
|
|
29
|
+
function X(t) {
|
|
30
30
|
return {
|
|
31
|
-
normal: ({ children:
|
|
32
|
-
h1: ({ children:
|
|
33
|
-
h2: ({ children:
|
|
34
|
-
h3: ({ children:
|
|
35
|
-
h4: ({ children:
|
|
36
|
-
h5: ({ children:
|
|
37
|
-
h6: ({ children:
|
|
38
|
-
quote: ({ children:
|
|
31
|
+
normal: ({ children: r }) => /* @__PURE__ */ n(B, { className: t, children: r }),
|
|
32
|
+
h1: ({ children: r }) => /* @__PURE__ */ n(_, { className: t, level: 1, children: r }),
|
|
33
|
+
h2: ({ children: r }) => /* @__PURE__ */ n(_, { className: t, level: 2, children: r }),
|
|
34
|
+
h3: ({ children: r }) => /* @__PURE__ */ n(_, { className: t, level: 3, children: r }),
|
|
35
|
+
h4: ({ children: r }) => /* @__PURE__ */ n(_, { className: t, level: 4, children: r }),
|
|
36
|
+
h5: ({ children: r }) => /* @__PURE__ */ n(_, { className: t, level: 5, children: r }),
|
|
37
|
+
h6: ({ children: r }) => /* @__PURE__ */ n(_, { className: t, level: 6, children: r }),
|
|
38
|
+
quote: ({ children: r }) => /* @__PURE__ */ n("blockquote", { className: t, children: r })
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
const Y = {
|
|
42
|
-
strong: ({ children:
|
|
43
|
-
em: ({ children:
|
|
44
|
-
number: ({ children:
|
|
45
|
-
left: ({ children:
|
|
46
|
-
center: ({ children:
|
|
47
|
-
right: ({ children:
|
|
48
|
-
inlineCode: ({ children:
|
|
49
|
-
link: ({ children:
|
|
50
|
-
var
|
|
51
|
-
const { linkType: o, internalUrl: l, externalUrl:
|
|
52
|
-
let
|
|
53
|
-
return o === "external" &&
|
|
42
|
+
strong: ({ children: t }) => /* @__PURE__ */ n("strong", { children: t }),
|
|
43
|
+
em: ({ children: t }) => /* @__PURE__ */ n("em", { children: t }),
|
|
44
|
+
number: ({ children: t }) => /* @__PURE__ */ n("span", { className: "inlineNumber", children: t }),
|
|
45
|
+
left: ({ children: t }) => /* @__PURE__ */ n("span", { className: "textLeft", children: t }),
|
|
46
|
+
center: ({ children: t }) => /* @__PURE__ */ n("span", { className: "textCenter", children: t }),
|
|
47
|
+
right: ({ children: t }) => /* @__PURE__ */ n("span", { className: "textRight", children: t }),
|
|
48
|
+
inlineCode: ({ children: t }) => /* @__PURE__ */ n("code", { children: t }),
|
|
49
|
+
link: ({ children: t, value: r }) => {
|
|
50
|
+
var e;
|
|
51
|
+
const { linkType: o, internalUrl: l, externalUrl: m, email: p, phone: g, blank: u } = r ?? {};
|
|
52
|
+
let a = "#";
|
|
53
|
+
return o === "external" && m ? a = m : o === "internal" && ((e = l == null ? void 0 : l.slug) != null && e.current) ? a = `/${l.slug.current}` : o === "email" && p ? a = `mailto:${p}` : o === "phone" && g && (a = `tel:${g.replace(/\s/g, "")}`), /* @__PURE__ */ n(
|
|
54
54
|
"a",
|
|
55
55
|
{
|
|
56
|
-
href:
|
|
57
|
-
target:
|
|
56
|
+
href: a,
|
|
57
|
+
target: u ? "_blank" : void 0,
|
|
58
58
|
rel: o === "external" ? "noopener noreferrer" : void 0,
|
|
59
59
|
className: i.richTextLink,
|
|
60
|
-
children:
|
|
60
|
+
children: t
|
|
61
61
|
}
|
|
62
62
|
);
|
|
63
63
|
},
|
|
64
|
-
textSize: ({ children:
|
|
65
|
-
const o =
|
|
66
|
-
return /* @__PURE__ */
|
|
64
|
+
textSize: ({ children: t, value: r }) => {
|
|
65
|
+
const o = r != null && r.size ? `text-${r.size}` : "";
|
|
66
|
+
return /* @__PURE__ */ n("span", { className: o, children: t });
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
function Z({
|
|
70
|
-
baseClassName:
|
|
71
|
-
previousTextRef:
|
|
70
|
+
baseClassName: t,
|
|
71
|
+
previousTextRef: r,
|
|
72
72
|
textOverride: o,
|
|
73
73
|
animateText: l,
|
|
74
|
-
isMobile:
|
|
74
|
+
isMobile: m
|
|
75
75
|
}) {
|
|
76
|
-
const
|
|
77
|
-
children:
|
|
76
|
+
const p = ({
|
|
77
|
+
children: e,
|
|
78
78
|
value: s
|
|
79
79
|
}) => {
|
|
80
|
-
if (!s) return /* @__PURE__ */
|
|
80
|
+
if (!s) return /* @__PURE__ */ n(S, { children: e });
|
|
81
81
|
const { colorClass: c } = s;
|
|
82
|
-
return o ? l ? /* @__PURE__ */
|
|
82
|
+
return o ? l ? /* @__PURE__ */ n(
|
|
83
83
|
C,
|
|
84
84
|
{
|
|
85
85
|
className: c,
|
|
86
86
|
text: o,
|
|
87
|
-
prevText:
|
|
87
|
+
prevText: r.current
|
|
88
88
|
},
|
|
89
89
|
"animated-span"
|
|
90
|
-
) : /* @__PURE__ */
|
|
91
|
-
},
|
|
92
|
-
const s = z.Children.count(
|
|
93
|
-
return /* @__PURE__ */
|
|
90
|
+
) : /* @__PURE__ */ n("span", { className: c, children: o }) : /* @__PURE__ */ n("span", { className: c, children: e });
|
|
91
|
+
}, g = ({ children: e = [] }) => {
|
|
92
|
+
const s = z.Children.count(e);
|
|
93
|
+
return /* @__PURE__ */ n(
|
|
94
94
|
"ul",
|
|
95
95
|
{
|
|
96
|
-
style: { columnCount:
|
|
97
|
-
className:
|
|
98
|
-
children:
|
|
96
|
+
style: { columnCount: m ? 1 : s > 7 ? 2 : 1 },
|
|
97
|
+
className: t,
|
|
98
|
+
children: e
|
|
99
99
|
}
|
|
100
100
|
);
|
|
101
101
|
};
|
|
102
|
-
let
|
|
103
|
-
const
|
|
104
|
-
return
|
|
102
|
+
let u;
|
|
103
|
+
const a = () => u;
|
|
104
|
+
return u = {
|
|
105
105
|
marks: {
|
|
106
106
|
...Y,
|
|
107
|
-
coloredText:
|
|
107
|
+
coloredText: p
|
|
108
108
|
},
|
|
109
|
-
block: X(
|
|
109
|
+
block: X(t),
|
|
110
110
|
list: {
|
|
111
|
-
bullet:
|
|
111
|
+
bullet: g
|
|
112
112
|
},
|
|
113
113
|
types: {
|
|
114
114
|
// ── Inline image ────────────────────────────────────────────────────
|
|
115
|
-
image: ({ value:
|
|
116
|
-
var c,
|
|
117
|
-
if (!(
|
|
118
|
-
const s = ((c =
|
|
119
|
-
return /* @__PURE__ */
|
|
120
|
-
/* @__PURE__ */
|
|
115
|
+
image: ({ value: e }) => {
|
|
116
|
+
var c, x, d, y, T;
|
|
117
|
+
if (!(e != null && e.imageUrls)) return null;
|
|
118
|
+
const s = ((c = e.asset) == null ? void 0 : c.altText) || "Content image";
|
|
119
|
+
return /* @__PURE__ */ N("figure", { className: `${t ?? ""} ${i.richTextImage}`, children: [
|
|
120
|
+
/* @__PURE__ */ n(
|
|
121
121
|
H,
|
|
122
122
|
{
|
|
123
|
-
src:
|
|
123
|
+
src: e.imageUrls.medium,
|
|
124
124
|
alt: s,
|
|
125
125
|
width: 1e3,
|
|
126
126
|
height: 800,
|
|
127
127
|
style: { maxWidth: "100%", height: "auto" }
|
|
128
128
|
}
|
|
129
129
|
),
|
|
130
|
-
(((
|
|
131
|
-
((
|
|
132
|
-
((
|
|
130
|
+
(((x = e.asset) == null ? void 0 : x.title) || ((d = e.asset) == null ? void 0 : d.description)) && /* @__PURE__ */ N("figcaption", { children: [
|
|
131
|
+
((y = e.asset) == null ? void 0 : y.title) && /* @__PURE__ */ n("strong", { children: e.asset.title }),
|
|
132
|
+
((T = e.asset) == null ? void 0 : T.description) && /* @__PURE__ */ n("p", { children: e.asset.description })
|
|
133
133
|
] })
|
|
134
134
|
] });
|
|
135
135
|
},
|
|
136
136
|
// ── Divider ─────────────────────────────────────────────────────────
|
|
137
|
-
divider: () => /* @__PURE__ */
|
|
137
|
+
divider: () => /* @__PURE__ */ n("hr", { className: i.divider }),
|
|
138
138
|
// ── Spacer ──────────────────────────────────────────────────────────
|
|
139
|
-
spacer: ({ value:
|
|
140
|
-
const s = (
|
|
139
|
+
spacer: ({ value: e }) => {
|
|
140
|
+
const s = (e == null ? void 0 : e.style) || "medium", c = {
|
|
141
141
|
small: i.spacerSmall,
|
|
142
142
|
medium: i.spacerMedium,
|
|
143
143
|
large: i.spacerLarge
|
|
144
144
|
};
|
|
145
|
-
return /* @__PURE__ */
|
|
145
|
+
return /* @__PURE__ */ n("span", { className: c[s] ?? i.spacerMedium });
|
|
146
146
|
},
|
|
147
147
|
// ── Table ────────────────────────────────────────────────────────────
|
|
148
|
-
table: ({ value:
|
|
148
|
+
table: ({ value: e }) => {
|
|
149
149
|
var L, M;
|
|
150
|
-
if (!((L =
|
|
151
|
-
const { hasHeadingRow: s } =
|
|
152
|
-
if (!((M =
|
|
153
|
-
const
|
|
154
|
-
var
|
|
150
|
+
if (!((L = e == null ? void 0 : e.rows) != null && L.length)) return null;
|
|
151
|
+
const { hasHeadingRow: s } = e, c = s ? e.rows[0] : null, x = s ? e.rows.slice(1) : e.rows, d = c || x[0];
|
|
152
|
+
if (!((M = d == null ? void 0 : d.cells) != null && M.length)) return null;
|
|
153
|
+
const y = d.cells.map((w, h) => {
|
|
154
|
+
var k;
|
|
155
155
|
return {
|
|
156
|
-
header: c ? /* @__PURE__ */
|
|
157
|
-
|
|
156
|
+
header: c ? /* @__PURE__ */ n(
|
|
157
|
+
$,
|
|
158
158
|
{
|
|
159
|
-
value: (
|
|
160
|
-
components:
|
|
159
|
+
value: (k = c.cells[h]) == null ? void 0 : k.content,
|
|
160
|
+
components: a()
|
|
161
161
|
}
|
|
162
162
|
) : `Column ${h + 1}`,
|
|
163
163
|
accessor: `col${h}`,
|
|
164
|
-
cellRenderer: (f) => f ? /* @__PURE__ */
|
|
165
|
-
|
|
164
|
+
cellRenderer: (f) => f ? /* @__PURE__ */ n(
|
|
165
|
+
$,
|
|
166
166
|
{
|
|
167
167
|
value: f,
|
|
168
|
-
components:
|
|
168
|
+
components: a()
|
|
169
169
|
}
|
|
170
170
|
) : null
|
|
171
171
|
};
|
|
172
|
-
}),
|
|
173
|
-
var
|
|
172
|
+
}), T = x.map((w) => {
|
|
173
|
+
var k;
|
|
174
174
|
const h = {};
|
|
175
|
-
return (
|
|
175
|
+
return (k = w.cells) == null || k.forEach((f, R) => {
|
|
176
176
|
h[`col${R}`] = f == null ? void 0 : f.content;
|
|
177
177
|
}), h;
|
|
178
178
|
});
|
|
179
|
-
return /* @__PURE__ */
|
|
179
|
+
return /* @__PURE__ */ n(
|
|
180
180
|
j,
|
|
181
181
|
{
|
|
182
182
|
hasHeadingRow: s,
|
|
183
|
-
data:
|
|
184
|
-
columns:
|
|
185
|
-
className: `${
|
|
183
|
+
data: T,
|
|
184
|
+
columns: y,
|
|
185
|
+
className: `${t ?? ""} ${s ? "hasHeadingRow" : ""}`
|
|
186
186
|
}
|
|
187
187
|
);
|
|
188
188
|
},
|
|
189
189
|
// ── Code block ──────────────────────────────────────────────────────
|
|
190
|
-
code: ({ value:
|
|
191
|
-
|
|
192
|
-
/* @__PURE__ */
|
|
190
|
+
code: ({ value: e }) => e != null && e.code ? /* @__PURE__ */ N("div", { className: `${i.codeBlockWrapper} ${t ?? ""}`, children: [
|
|
191
|
+
e.filename && /* @__PURE__ */ n("div", { className: i.codeFilename, children: e.filename }),
|
|
192
|
+
/* @__PURE__ */ n("pre", { className: i.codeBlock, children: /* @__PURE__ */ n("code", { children: e.code }) })
|
|
193
193
|
] }) : null
|
|
194
194
|
}
|
|
195
|
-
},
|
|
195
|
+
}, u;
|
|
196
196
|
}
|
|
197
197
|
const ge = ({
|
|
198
|
-
blocks:
|
|
199
|
-
className:
|
|
198
|
+
blocks: t,
|
|
199
|
+
className: r,
|
|
200
200
|
textOverride: o,
|
|
201
201
|
animateText: l
|
|
202
202
|
}) => {
|
|
203
|
-
const
|
|
203
|
+
const m = U("(max-width: 767px)"), p = F(o);
|
|
204
204
|
I(() => {
|
|
205
|
-
|
|
205
|
+
p.current = o;
|
|
206
206
|
}, [o]);
|
|
207
|
-
const
|
|
207
|
+
const g = W(
|
|
208
208
|
() => Z({
|
|
209
|
-
baseClassName:
|
|
210
|
-
previousTextRef:
|
|
209
|
+
baseClassName: r,
|
|
210
|
+
previousTextRef: p,
|
|
211
211
|
textOverride: o,
|
|
212
212
|
animateText: l,
|
|
213
|
-
isMobile:
|
|
213
|
+
isMobile: m
|
|
214
214
|
}),
|
|
215
215
|
// previousTextRef intentionally omitted — it's a stable ref object.
|
|
216
216
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
217
|
-
[
|
|
217
|
+
[r, o, l, m]
|
|
218
218
|
);
|
|
219
|
-
return
|
|
219
|
+
return t ? typeof t == "string" ? /* @__PURE__ */ n(B, { className: r, children: t }) : /* @__PURE__ */ n("div", { className: `${i.container} portableTextContainer`, children: /* @__PURE__ */ n($, { value: t, components: g }) }) : null;
|
|
220
220
|
};
|
|
221
221
|
export {
|
|
222
222
|
ge as RichText
|