quirk-ui 0.1.193 → 0.1.194
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.
- package/dist/main.d.ts +6 -1
- package/dist/next/ui/PortableTextRenderer/index.cjs +1 -1
- package/dist/next/ui/PortableTextRenderer/index.mjs +156 -129
- package/dist/next/utils/blockRenderers.cjs +1 -1
- package/dist/next/utils/blockRenderers.mjs +14 -12
- package/dist/next.d.ts +6 -1
- package/package.json +1 -1
package/dist/main.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ import { PageProps } from './sanity/types/page';
|
|
|
42
42
|
import { PageSection } from './sanity/types/pageSection';
|
|
43
43
|
import { PortableTextBlock } from '@portabletext/types';
|
|
44
44
|
import { PortableTextBlock as PortableTextBlock_2 } from '@portabletext/react';
|
|
45
|
+
import { PortableTextComponents } from '@portabletext/react';
|
|
45
46
|
import { QuoteBlockProps } from './next/blocks/QuoteBlock/QuoteBlock.types';
|
|
46
47
|
import { QuoteBlockProps as QuoteBlockProps_2 } from './QuoteBlock.types';
|
|
47
48
|
import { ReactNode } from 'react';
|
|
@@ -1594,7 +1595,7 @@ export { RenderLinkProps }
|
|
|
1594
1595
|
* <HeroBlock {...section} renderRichText={renderRichText} />
|
|
1595
1596
|
* <CardGridBlock {...section} renderRichText={renderRichText} />
|
|
1596
1597
|
*/
|
|
1597
|
-
export declare function renderRichText({ blocks, className, textOverride, animateText, }: RenderRichTextProps_3): default_2.ReactElement | null;
|
|
1598
|
+
export declare function renderRichText({ blocks, className, textOverride, animateText, components, }: RenderRichTextProps_3): default_2.ReactElement | null;
|
|
1598
1599
|
|
|
1599
1600
|
export { RenderRichTextProps }
|
|
1600
1601
|
|
|
@@ -1645,6 +1646,10 @@ declare interface RichTextProps {
|
|
|
1645
1646
|
className?: string;
|
|
1646
1647
|
textOverride?: string;
|
|
1647
1648
|
animateText?: boolean;
|
|
1649
|
+
/** Optional component overrides merged on top of the defaults.
|
|
1650
|
+
* Use this to add custom marks, block styles, or types per-project
|
|
1651
|
+
* without modifying the library. Uses @portabletext/react mergeComponents. */
|
|
1652
|
+
components?: Partial<PortableTextComponents>;
|
|
1648
1653
|
}
|
|
1649
1654
|
|
|
1650
1655
|
export { SanityCategory }
|
|
@@ -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"),T=require("react"),q=require("@portabletext/react"),R=require("../AnimatedSpan/index.cjs");;/* empty css */require("../../../core/components/Avatar/index.cjs");require("../../../core/context/ModalContext.cjs");require("../../../core/components/Checkbox/index.cjs");const b=require("../../../core/components/Text/index.cjs"),_=require("../../../core/components/Heading/index.cjs");require("react-dom");const w=require("../../../core/components/Table/index.cjs");require("../../../core/components/Tabs/index.cjs");require("../../../core/tokens/theme.cjs");const B=require("next/image"),H=require("../../hooks/useMediaQuery.cjs"),I="_container_1glyt_1",S="_divider_1glyt_32",z="_richTextImage_1glyt_50",F="_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",a={container:I,divider:S,richTextImage:z,richTextLink:F,spacerSmall:W,spacerMedium:C,spacerLarge:P,codeBlock:U,codeBlockWrapper:A,codeFilename:E};function Q(t){return{normal:({children:n})=>e.jsx(b.Text,{className:t,children:n}),h1:({children:n})=>e.jsx(_.Heading,{className:t,level:1,children:n}),h2:({children:n})=>e.jsx(_.Heading,{className:t,level:2,children:n}),h3:({children:n})=>e.jsx(_.Heading,{className:t,level:3,children:n}),h4:({children:n})=>e.jsx(_.Heading,{className:t,level:4,children:n}),h5:({children:n})=>e.jsx(_.Heading,{className:t,level:5,children:n}),h6:({children:n})=>e.jsx(_.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:m,externalUrl:c,email:x,phone:d,blank:p}=n??{};let i="#";return r==="external"&&c?i=c:r==="internal"&&((s=m==null?void 0:m.slug)!=null&&s.current)?i=`/${m.slug.current}`:r==="email"&&x?i=`mailto:${x}`:r==="phone"&&d&&(i=`tel:${d.replace(/\s/g,"")}`),e.jsx("a",{href:i,target:p?"_blank":void 0,rel:r==="external"?"noopener noreferrer":void 0,className:a.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:m,isMobile:c}){const x=({children:s,value:o})=>{if(!o)return e.jsx(e.Fragment,{children:s});const{colorClass:l}=o;return r?m?e.jsx(R.AnimatedSpan,{className:l,text:r,prevText:n.current},"animated-span"):e.jsx("span",{className:l,children:r}):e.jsx("span",{className:l,children:s})},d=({children:s=[]})=>{const o=T.Children.count(s);return e.jsx("ul",{style:{columnCount:c?1:o>7?2:1},className:t,children:s})};let p;const i=()=>p;return p={marks:{...D,coloredText:x},block:Q(t),list:{bullet:d},types:{image:({value:s})=>{var l,j,u,k,y;if(!(s!=null&&s.imageUrls))return null;const o=((l=s.asset)==null?void 0:l.altText)||"Content image";return e.jsxs("figure",{className:`${t??""} ${a.richTextImage}`,children:[e.jsx(B,{src:s.imageUrls.medium,alt:o,width:1e3,height:800,style:{maxWidth:"100%",height:"auto"}}),(((j=s.asset)==null?void 0:j.title)||((u=s.asset)==null?void 0:u.description))&&e.jsxs("figcaption",{children:[((k=s.asset)==null?void 0:k.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:a.divider}),spacer:({value:s})=>{const o=(s==null?void 0:s.style)||"medium",l={small:a.spacerSmall,medium:a.spacerMedium,large:a.spacerLarge};return e.jsx("span",{className:l[o]??a.spacerMedium})},table:({value:s})=>{var $,N;if(!(($=s==null?void 0:s.rows)!=null&&$.length))return null;const{hasHeadingRow:o}=s,l=o?s.rows[0]:null,j=o?s.rows.slice(1):s.rows,u=l||j[0];if(!((N=u==null?void 0:u.cells)!=null&&N.length))return null;const k=u.cells.map((M,g)=>{var f;return{header:l?e.jsx(q.PortableText,{value:(f=l.cells[g])==null?void 0:f.content,components:i()}):`Column ${g+1}`,accessor:`col${g}`,cellRenderer:h=>h?e.jsx(q.PortableText,{value:h,components:i()}):null}}),y=j.map(M=>{var f;const g={};return(f=M.cells)==null||f.forEach((h,L)=>{g[`col${L}`]=h==null?void 0:h.content}),g});return e.jsx(w.Table,{hasHeadingRow:o,data:y,columns:k,className:`${t??""} ${o?"hasHeadingRow":""}`})},code:({value:s})=>s!=null&&s.code?e.jsxs("div",{className:`${a.codeBlockWrapper} ${t??""}`,children:[s.filename&&e.jsx("div",{className:a.codeFilename,children:s.filename}),e.jsx("pre",{className:a.codeBlock,children:e.jsx("code",{children:s.code})})]}):null}},p}const J=({blocks:t,className:n,textOverride:r,animateText:m,components:c})=>{const x=H.useMediaQuery("(max-width: 767px)"),d=T.useRef(r);T.useEffect(()=>{d.current=r},[r]);const p=T.useMemo(()=>{const i=G({baseClassName:n,previousTextRef:d,textOverride:r,animateText:m,isMobile:x});return c?{...i,...c.marks&&{marks:{...i.marks,...c.marks}},...c.block&&{block:{...i.block,...c.block}},...c.types&&{types:{...i.types,...c.types}},...c.list&&{list:{...i.list,...c.list}},...c.listItem&&{listItem:{...i.listItem,...c.listItem}}}:i},[n,r,m,x,c]);return t?typeof t=="string"?e.jsx(b.Text,{className:n,children:t}):e.jsx("div",{className:`${a.container} portableTextContainer`,children:e.jsx(q.PortableText,{value:t,components:p})}):null};exports.RichText=J;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as s, jsxs as N, Fragment as R } from "react/jsx-runtime";
|
|
2
|
+
import b, { useRef as S, useEffect as z, useMemo as F } from "react";
|
|
3
3
|
import { PortableText as $ } from "@portabletext/react";
|
|
4
|
-
import { AnimatedSpan as
|
|
4
|
+
import { AnimatedSpan as W } from "../AnimatedSpan/index.mjs";
|
|
5
5
|
import '../../../index.css';import '../../../index11.css';/* empty css */
|
|
6
6
|
import "../../../core/components/Avatar/index.mjs";
|
|
7
7
|
import "../../../core/context/ModalContext.mjs";
|
|
@@ -9,15 +9,15 @@ import "../../../core/components/Checkbox/index.mjs";
|
|
|
9
9
|
import { Text as B } from "../../../core/components/Text/index.mjs";
|
|
10
10
|
import { Heading as _ } from "../../../core/components/Heading/index.mjs";
|
|
11
11
|
import "react-dom";
|
|
12
|
-
import { Table as
|
|
12
|
+
import { Table as C } from "../../../core/components/Table/index.mjs";
|
|
13
13
|
import "../../../core/components/Tabs/index.mjs";
|
|
14
14
|
import "../../../core/tokens/theme.mjs";
|
|
15
|
-
import
|
|
16
|
-
import { useMediaQuery as
|
|
17
|
-
const
|
|
18
|
-
container:
|
|
19
|
-
divider:
|
|
20
|
-
richTextImage:
|
|
15
|
+
import j from "next/image";
|
|
16
|
+
import { useMediaQuery as H } from "../../hooks/useMediaQuery.mjs";
|
|
17
|
+
const U = "_container_1glyt_1", q = "_divider_1glyt_32", E = "_richTextImage_1glyt_50", A = "_richTextLink_1glyt_58", P = "_spacerSmall_1glyt_72", Q = "_spacerMedium_1glyt_77", D = "_spacerLarge_1glyt_82", G = "_codeBlock_1glyt_110", J = "_codeBlockWrapper_1glyt_119", K = "_codeFilename_1glyt_131", a = {
|
|
18
|
+
container: U,
|
|
19
|
+
divider: q,
|
|
20
|
+
richTextImage: E,
|
|
21
21
|
richTextLink: A,
|
|
22
22
|
spacerSmall: P,
|
|
23
23
|
spacerMedium: Q,
|
|
@@ -26,198 +26,225 @@ 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(e) {
|
|
30
30
|
return {
|
|
31
|
-
normal: ({ children: r }) => /* @__PURE__ */
|
|
32
|
-
h1: ({ children: r }) => /* @__PURE__ */
|
|
33
|
-
h2: ({ children: r }) => /* @__PURE__ */
|
|
34
|
-
h3: ({ children: r }) => /* @__PURE__ */
|
|
35
|
-
h4: ({ children: r }) => /* @__PURE__ */
|
|
36
|
-
h5: ({ children: r }) => /* @__PURE__ */
|
|
37
|
-
h6: ({ children: r }) => /* @__PURE__ */
|
|
38
|
-
quote: ({ children: r }) => /* @__PURE__ */
|
|
31
|
+
normal: ({ children: r }) => /* @__PURE__ */ s(B, { className: e, children: r }),
|
|
32
|
+
h1: ({ children: r }) => /* @__PURE__ */ s(_, { className: e, level: 1, children: r }),
|
|
33
|
+
h2: ({ children: r }) => /* @__PURE__ */ s(_, { className: e, level: 2, children: r }),
|
|
34
|
+
h3: ({ children: r }) => /* @__PURE__ */ s(_, { className: e, level: 3, children: r }),
|
|
35
|
+
h4: ({ children: r }) => /* @__PURE__ */ s(_, { className: e, level: 4, children: r }),
|
|
36
|
+
h5: ({ children: r }) => /* @__PURE__ */ s(_, { className: e, level: 5, children: r }),
|
|
37
|
+
h6: ({ children: r }) => /* @__PURE__ */ s(_, { className: e, level: 6, children: r }),
|
|
38
|
+
quote: ({ children: r }) => /* @__PURE__ */ s("blockquote", { className: e, 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:
|
|
52
|
-
let
|
|
53
|
-
return
|
|
42
|
+
strong: ({ children: e }) => /* @__PURE__ */ s("strong", { children: e }),
|
|
43
|
+
em: ({ children: e }) => /* @__PURE__ */ s("em", { children: e }),
|
|
44
|
+
number: ({ children: e }) => /* @__PURE__ */ s("span", { className: "inlineNumber", children: e }),
|
|
45
|
+
left: ({ children: e }) => /* @__PURE__ */ s("span", { className: "textLeft", children: e }),
|
|
46
|
+
center: ({ children: e }) => /* @__PURE__ */ s("span", { className: "textCenter", children: e }),
|
|
47
|
+
right: ({ children: e }) => /* @__PURE__ */ s("span", { className: "textRight", children: e }),
|
|
48
|
+
inlineCode: ({ children: e }) => /* @__PURE__ */ s("code", { children: e }),
|
|
49
|
+
link: ({ children: e, value: r }) => {
|
|
50
|
+
var t;
|
|
51
|
+
const { linkType: n, internalUrl: m, externalUrl: c, email: p, phone: d, blank: g } = r ?? {};
|
|
52
|
+
let o = "#";
|
|
53
|
+
return n === "external" && c ? o = c : n === "internal" && ((t = m == null ? void 0 : m.slug) != null && t.current) ? o = `/${m.slug.current}` : n === "email" && p ? o = `mailto:${p}` : n === "phone" && d && (o = `tel:${d.replace(/\s/g, "")}`), /* @__PURE__ */ s(
|
|
54
54
|
"a",
|
|
55
55
|
{
|
|
56
|
-
href:
|
|
57
|
-
target:
|
|
58
|
-
rel:
|
|
59
|
-
className:
|
|
60
|
-
children:
|
|
56
|
+
href: o,
|
|
57
|
+
target: g ? "_blank" : void 0,
|
|
58
|
+
rel: n === "external" ? "noopener noreferrer" : void 0,
|
|
59
|
+
className: a.richTextLink,
|
|
60
|
+
children: e
|
|
61
61
|
}
|
|
62
62
|
);
|
|
63
63
|
},
|
|
64
|
-
textSize: ({ children:
|
|
65
|
-
const
|
|
66
|
-
return /* @__PURE__ */
|
|
64
|
+
textSize: ({ children: e, value: r }) => {
|
|
65
|
+
const n = r != null && r.size ? `text-${r.size}` : "";
|
|
66
|
+
return /* @__PURE__ */ s("span", { className: n, children: e });
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
function Z({
|
|
70
|
-
baseClassName:
|
|
70
|
+
baseClassName: e,
|
|
71
71
|
previousTextRef: r,
|
|
72
|
-
textOverride:
|
|
73
|
-
animateText:
|
|
74
|
-
isMobile:
|
|
72
|
+
textOverride: n,
|
|
73
|
+
animateText: m,
|
|
74
|
+
isMobile: c
|
|
75
75
|
}) {
|
|
76
76
|
const p = ({
|
|
77
|
-
children:
|
|
78
|
-
value:
|
|
77
|
+
children: t,
|
|
78
|
+
value: i
|
|
79
79
|
}) => {
|
|
80
|
-
if (!
|
|
81
|
-
const { colorClass:
|
|
82
|
-
return
|
|
83
|
-
|
|
80
|
+
if (!i) return /* @__PURE__ */ s(R, { children: t });
|
|
81
|
+
const { colorClass: l } = i;
|
|
82
|
+
return n ? m ? /* @__PURE__ */ s(
|
|
83
|
+
W,
|
|
84
84
|
{
|
|
85
|
-
className:
|
|
86
|
-
text:
|
|
85
|
+
className: l,
|
|
86
|
+
text: n,
|
|
87
87
|
prevText: r.current
|
|
88
88
|
},
|
|
89
89
|
"animated-span"
|
|
90
|
-
) : /* @__PURE__ */
|
|
91
|
-
},
|
|
92
|
-
const
|
|
93
|
-
return /* @__PURE__ */
|
|
90
|
+
) : /* @__PURE__ */ s("span", { className: l, children: n }) : /* @__PURE__ */ s("span", { className: l, children: t });
|
|
91
|
+
}, d = ({ children: t = [] }) => {
|
|
92
|
+
const i = b.Children.count(t);
|
|
93
|
+
return /* @__PURE__ */ s(
|
|
94
94
|
"ul",
|
|
95
95
|
{
|
|
96
|
-
style: { columnCount:
|
|
97
|
-
className:
|
|
98
|
-
children:
|
|
96
|
+
style: { columnCount: c ? 1 : i > 7 ? 2 : 1 },
|
|
97
|
+
className: e,
|
|
98
|
+
children: t
|
|
99
99
|
}
|
|
100
100
|
);
|
|
101
101
|
};
|
|
102
|
-
let
|
|
103
|
-
const
|
|
104
|
-
return
|
|
102
|
+
let g;
|
|
103
|
+
const o = () => g;
|
|
104
|
+
return g = {
|
|
105
105
|
marks: {
|
|
106
106
|
...Y,
|
|
107
107
|
coloredText: p
|
|
108
108
|
},
|
|
109
|
-
block: X(
|
|
109
|
+
block: X(e),
|
|
110
110
|
list: {
|
|
111
|
-
bullet:
|
|
111
|
+
bullet: d
|
|
112
112
|
},
|
|
113
113
|
types: {
|
|
114
114
|
// ── Inline image ────────────────────────────────────────────────────
|
|
115
|
-
image: ({ value:
|
|
116
|
-
var
|
|
117
|
-
if (!(
|
|
118
|
-
const
|
|
119
|
-
return /* @__PURE__ */ N("figure", { className: `${
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
|
|
115
|
+
image: ({ value: t }) => {
|
|
116
|
+
var l, k, h, y, T;
|
|
117
|
+
if (!(t != null && t.imageUrls)) return null;
|
|
118
|
+
const i = ((l = t.asset) == null ? void 0 : l.altText) || "Content image";
|
|
119
|
+
return /* @__PURE__ */ N("figure", { className: `${e ?? ""} ${a.richTextImage}`, children: [
|
|
120
|
+
/* @__PURE__ */ s(
|
|
121
|
+
j,
|
|
122
122
|
{
|
|
123
|
-
src:
|
|
124
|
-
alt:
|
|
123
|
+
src: t.imageUrls.medium,
|
|
124
|
+
alt: i,
|
|
125
125
|
width: 1e3,
|
|
126
126
|
height: 800,
|
|
127
127
|
style: { maxWidth: "100%", height: "auto" }
|
|
128
128
|
}
|
|
129
129
|
),
|
|
130
|
-
(((
|
|
131
|
-
((y =
|
|
132
|
-
((T =
|
|
130
|
+
(((k = t.asset) == null ? void 0 : k.title) || ((h = t.asset) == null ? void 0 : h.description)) && /* @__PURE__ */ N("figcaption", { children: [
|
|
131
|
+
((y = t.asset) == null ? void 0 : y.title) && /* @__PURE__ */ s("strong", { children: t.asset.title }),
|
|
132
|
+
((T = t.asset) == null ? void 0 : T.description) && /* @__PURE__ */ s("p", { children: t.asset.description })
|
|
133
133
|
] })
|
|
134
134
|
] });
|
|
135
135
|
},
|
|
136
136
|
// ── Divider ─────────────────────────────────────────────────────────
|
|
137
|
-
divider: () => /* @__PURE__ */
|
|
137
|
+
divider: () => /* @__PURE__ */ s("hr", { className: a.divider }),
|
|
138
138
|
// ── Spacer ──────────────────────────────────────────────────────────
|
|
139
|
-
spacer: ({ value:
|
|
140
|
-
const
|
|
141
|
-
small:
|
|
142
|
-
medium:
|
|
143
|
-
large:
|
|
139
|
+
spacer: ({ value: t }) => {
|
|
140
|
+
const i = (t == null ? void 0 : t.style) || "medium", l = {
|
|
141
|
+
small: a.spacerSmall,
|
|
142
|
+
medium: a.spacerMedium,
|
|
143
|
+
large: a.spacerLarge
|
|
144
144
|
};
|
|
145
|
-
return /* @__PURE__ */
|
|
145
|
+
return /* @__PURE__ */ s("span", { className: l[i] ?? a.spacerMedium });
|
|
146
146
|
},
|
|
147
147
|
// ── Table ────────────────────────────────────────────────────────────
|
|
148
|
-
table: ({ value:
|
|
148
|
+
table: ({ value: t }) => {
|
|
149
149
|
var L, M;
|
|
150
|
-
if (!((L =
|
|
151
|
-
const { hasHeadingRow:
|
|
152
|
-
if (!((M =
|
|
153
|
-
const y =
|
|
154
|
-
var
|
|
150
|
+
if (!((L = t == null ? void 0 : t.rows) != null && L.length)) return null;
|
|
151
|
+
const { hasHeadingRow: i } = t, l = i ? t.rows[0] : null, k = i ? t.rows.slice(1) : t.rows, h = l || k[0];
|
|
152
|
+
if (!((M = h == null ? void 0 : h.cells) != null && M.length)) return null;
|
|
153
|
+
const y = h.cells.map((w, f) => {
|
|
154
|
+
var x;
|
|
155
155
|
return {
|
|
156
|
-
header:
|
|
156
|
+
header: l ? /* @__PURE__ */ s(
|
|
157
157
|
$,
|
|
158
158
|
{
|
|
159
|
-
value: (
|
|
160
|
-
components:
|
|
159
|
+
value: (x = l.cells[f]) == null ? void 0 : x.content,
|
|
160
|
+
components: o()
|
|
161
161
|
}
|
|
162
|
-
) : `Column ${
|
|
163
|
-
accessor: `col${
|
|
164
|
-
cellRenderer: (
|
|
162
|
+
) : `Column ${f + 1}`,
|
|
163
|
+
accessor: `col${f}`,
|
|
164
|
+
cellRenderer: (u) => u ? /* @__PURE__ */ s(
|
|
165
165
|
$,
|
|
166
166
|
{
|
|
167
|
-
value:
|
|
168
|
-
components:
|
|
167
|
+
value: u,
|
|
168
|
+
components: o()
|
|
169
169
|
}
|
|
170
170
|
) : null
|
|
171
171
|
};
|
|
172
|
-
}), T =
|
|
173
|
-
var
|
|
174
|
-
const
|
|
175
|
-
return (
|
|
176
|
-
|
|
177
|
-
}),
|
|
172
|
+
}), T = k.map((w) => {
|
|
173
|
+
var x;
|
|
174
|
+
const f = {};
|
|
175
|
+
return (x = w.cells) == null || x.forEach((u, I) => {
|
|
176
|
+
f[`col${I}`] = u == null ? void 0 : u.content;
|
|
177
|
+
}), f;
|
|
178
178
|
});
|
|
179
|
-
return /* @__PURE__ */
|
|
180
|
-
|
|
179
|
+
return /* @__PURE__ */ s(
|
|
180
|
+
C,
|
|
181
181
|
{
|
|
182
|
-
hasHeadingRow:
|
|
182
|
+
hasHeadingRow: i,
|
|
183
183
|
data: T,
|
|
184
184
|
columns: y,
|
|
185
|
-
className: `${
|
|
185
|
+
className: `${e ?? ""} ${i ? "hasHeadingRow" : ""}`
|
|
186
186
|
}
|
|
187
187
|
);
|
|
188
188
|
},
|
|
189
189
|
// ── Code block ──────────────────────────────────────────────────────
|
|
190
|
-
code: ({ value:
|
|
191
|
-
|
|
192
|
-
/* @__PURE__ */
|
|
190
|
+
code: ({ value: t }) => t != null && t.code ? /* @__PURE__ */ N("div", { className: `${a.codeBlockWrapper} ${e ?? ""}`, children: [
|
|
191
|
+
t.filename && /* @__PURE__ */ s("div", { className: a.codeFilename, children: t.filename }),
|
|
192
|
+
/* @__PURE__ */ s("pre", { className: a.codeBlock, children: /* @__PURE__ */ s("code", { children: t.code }) })
|
|
193
193
|
] }) : null
|
|
194
194
|
}
|
|
195
|
-
},
|
|
195
|
+
}, g;
|
|
196
196
|
}
|
|
197
|
-
const
|
|
198
|
-
blocks:
|
|
197
|
+
const gt = ({
|
|
198
|
+
blocks: e,
|
|
199
199
|
className: r,
|
|
200
|
-
textOverride:
|
|
201
|
-
animateText:
|
|
200
|
+
textOverride: n,
|
|
201
|
+
animateText: m,
|
|
202
|
+
components: c
|
|
202
203
|
}) => {
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}, [
|
|
207
|
-
const g =
|
|
208
|
-
() =>
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
204
|
+
const p = H("(max-width: 767px)"), d = S(n);
|
|
205
|
+
z(() => {
|
|
206
|
+
d.current = n;
|
|
207
|
+
}, [n]);
|
|
208
|
+
const g = F(
|
|
209
|
+
() => {
|
|
210
|
+
const o = Z({
|
|
211
|
+
baseClassName: r,
|
|
212
|
+
previousTextRef: d,
|
|
213
|
+
textOverride: n,
|
|
214
|
+
animateText: m,
|
|
215
|
+
isMobile: p
|
|
216
|
+
});
|
|
217
|
+
return c ? {
|
|
218
|
+
...o,
|
|
219
|
+
...c.marks && {
|
|
220
|
+
marks: { ...o.marks, ...c.marks }
|
|
221
|
+
},
|
|
222
|
+
...c.block && {
|
|
223
|
+
block: {
|
|
224
|
+
...o.block,
|
|
225
|
+
...c.block
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
...c.types && {
|
|
229
|
+
types: { ...o.types, ...c.types }
|
|
230
|
+
},
|
|
231
|
+
...c.list && {
|
|
232
|
+
list: { ...o.list, ...c.list }
|
|
233
|
+
},
|
|
234
|
+
...c.listItem && {
|
|
235
|
+
listItem: {
|
|
236
|
+
...o.listItem,
|
|
237
|
+
...c.listItem
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
} : o;
|
|
241
|
+
},
|
|
215
242
|
// previousTextRef intentionally omitted — it's a stable ref object.
|
|
216
243
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
217
|
-
[r,
|
|
244
|
+
[r, n, m, p, c]
|
|
218
245
|
);
|
|
219
|
-
return
|
|
246
|
+
return e ? typeof e == "string" ? /* @__PURE__ */ s(B, { className: r, children: e }) : /* @__PURE__ */ s("div", { className: `${a.container} portableTextContainer`, children: /* @__PURE__ */ s($, { value: e, components: g }) }) : null;
|
|
220
247
|
};
|
|
221
248
|
export {
|
|
222
|
-
|
|
249
|
+
gt as RichText
|
|
223
250
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),l=require("../ui/PortableTextRenderer/index.cjs"),o=require("../ui/CallToAction/index.cjs");function x(e){return e.flatMap(r=>r.children??[]).map(r=>r.text??"").join("")}function c({blocks:e,className:r,textOverride:n,animateText:t,components:u}){return e!=null&&e.length?i.jsx(l.RichText,{blocks:e,className:r,textOverride:n,animateText:t,components:u}):null}function a({alignment:e,spacing:r,items:n,className:t}){return n!=null&&n.length?i.jsx(o.CallToAction,{alignment:e,items:n,className:t,spacing:r}):null}exports.extractText=x;exports.renderCallToAction=a;exports.renderRichText=c;
|
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { RichText as
|
|
3
|
-
import { CallToAction as
|
|
4
|
-
function
|
|
2
|
+
import { RichText as f } from "../ui/PortableTextRenderer/index.mjs";
|
|
3
|
+
import { CallToAction as i } from "../ui/CallToAction/index.mjs";
|
|
4
|
+
function p(r) {
|
|
5
5
|
return r.flatMap((n) => n.children ?? []).map((n) => n.text ?? "").join("");
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function h({
|
|
8
8
|
blocks: r,
|
|
9
9
|
className: n,
|
|
10
10
|
textOverride: t,
|
|
11
|
-
animateText: e
|
|
11
|
+
animateText: e,
|
|
12
|
+
components: u
|
|
12
13
|
}) {
|
|
13
14
|
return r != null && r.length ? /* @__PURE__ */ o(
|
|
14
|
-
|
|
15
|
+
f,
|
|
15
16
|
{
|
|
16
17
|
blocks: r,
|
|
17
18
|
className: n,
|
|
18
19
|
textOverride: t,
|
|
19
|
-
animateText: e
|
|
20
|
+
animateText: e,
|
|
21
|
+
components: u
|
|
20
22
|
}
|
|
21
23
|
) : null;
|
|
22
24
|
}
|
|
23
|
-
function
|
|
25
|
+
function T({
|
|
24
26
|
alignment: r,
|
|
25
27
|
spacing: n,
|
|
26
28
|
items: t,
|
|
27
29
|
className: e
|
|
28
30
|
}) {
|
|
29
31
|
return t != null && t.length ? /* @__PURE__ */ o(
|
|
30
|
-
|
|
32
|
+
i,
|
|
31
33
|
{
|
|
32
34
|
alignment: r,
|
|
33
35
|
items: t,
|
|
@@ -37,7 +39,7 @@ function h({
|
|
|
37
39
|
) : null;
|
|
38
40
|
}
|
|
39
41
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
p as extractText,
|
|
43
|
+
T as renderCallToAction,
|
|
44
|
+
h as renderRichText
|
|
43
45
|
};
|
package/dist/next.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ import { MarkdownBlockProps } from './next/blocks/MarkdownBlock/MarkdownBlock.ty
|
|
|
29
29
|
import { MarkdownBlockProps as MarkdownBlockProps_2 } from './MarkdownBlock.types';
|
|
30
30
|
import { PortableTextBlock } from '@portabletext/react';
|
|
31
31
|
import { PortableTextBlock as PortableTextBlock_2 } from '@portabletext/types';
|
|
32
|
+
import { PortableTextComponents } from '@portabletext/react';
|
|
32
33
|
import { QuoteBlockProps } from './next/blocks/QuoteBlock/QuoteBlock.types';
|
|
33
34
|
import { QuoteBlockProps as QuoteBlockProps_2 } from './QuoteBlock.types';
|
|
34
35
|
import { RenderCallToActionProps } from '../../../core/types/renderers';
|
|
@@ -282,7 +283,7 @@ export declare function renderCallToAction({ alignment, spacing, items, classNam
|
|
|
282
283
|
* <HeroBlock {...section} renderRichText={renderRichText} />
|
|
283
284
|
* <CardGridBlock {...section} renderRichText={renderRichText} />
|
|
284
285
|
*/
|
|
285
|
-
export declare function renderRichText({ blocks, className, textOverride, animateText, }: RenderRichTextProps): default_2.ReactElement | null;
|
|
286
|
+
export declare function renderRichText({ blocks, className, textOverride, animateText, components, }: RenderRichTextProps): default_2.ReactElement | null;
|
|
286
287
|
|
|
287
288
|
export { RenderRichTextProps }
|
|
288
289
|
|
|
@@ -325,6 +326,10 @@ declare interface RichTextProps {
|
|
|
325
326
|
className?: string;
|
|
326
327
|
textOverride?: string;
|
|
327
328
|
animateText?: boolean;
|
|
329
|
+
/** Optional component overrides merged on top of the defaults.
|
|
330
|
+
* Use this to add custom marks, block styles, or types per-project
|
|
331
|
+
* without modifying the library. Uses @portabletext/react mergeComponents. */
|
|
332
|
+
components?: Partial<PortableTextComponents>;
|
|
328
333
|
}
|
|
329
334
|
|
|
330
335
|
export declare function SegmentCard({ eyebrow, title, description, image, callToAction, onHover, onLeave, renderImage, renderRichText, }: SegmentCardProps): JSX.Element;
|