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 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"),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
+ "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 n, jsxs as N, Fragment as S } from "react/jsx-runtime";
2
- import z, { useRef as F, useEffect as I, useMemo as W } from "react";
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 C } from "../AnimatedSpan/index.mjs";
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 j } from "../../../core/components/Table/index.mjs";
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 H from "next/image";
16
- import { useMediaQuery as U } from "../../hooks/useMediaQuery.mjs";
17
- const q = "_container_1glyt_1", E = "_divider_1glyt_32", b = "_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", i = {
18
- container: q,
19
- divider: E,
20
- richTextImage: b,
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(t) {
29
+ function X(e) {
30
30
  return {
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 })
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: 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(
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: a,
57
- target: u ? "_blank" : void 0,
58
- rel: o === "external" ? "noopener noreferrer" : void 0,
59
- className: i.richTextLink,
60
- children: t
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: t, value: r }) => {
65
- const o = r != null && r.size ? `text-${r.size}` : "";
66
- return /* @__PURE__ */ n("span", { className: o, children: t });
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: t,
70
+ baseClassName: e,
71
71
  previousTextRef: r,
72
- textOverride: o,
73
- animateText: l,
74
- isMobile: m
72
+ textOverride: n,
73
+ animateText: m,
74
+ isMobile: c
75
75
  }) {
76
76
  const p = ({
77
- children: e,
78
- value: s
77
+ children: t,
78
+ value: i
79
79
  }) => {
80
- if (!s) return /* @__PURE__ */ n(S, { children: e });
81
- const { colorClass: c } = s;
82
- return o ? l ? /* @__PURE__ */ n(
83
- C,
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: c,
86
- text: o,
85
+ className: l,
86
+ text: n,
87
87
  prevText: r.current
88
88
  },
89
89
  "animated-span"
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(
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: m ? 1 : s > 7 ? 2 : 1 },
97
- className: t,
98
- children: e
96
+ style: { columnCount: c ? 1 : i > 7 ? 2 : 1 },
97
+ className: e,
98
+ children: t
99
99
  }
100
100
  );
101
101
  };
102
- let u;
103
- const a = () => u;
104
- return u = {
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(t),
109
+ block: X(e),
110
110
  list: {
111
- bullet: g
111
+ bullet: d
112
112
  },
113
113
  types: {
114
114
  // ── Inline image ────────────────────────────────────────────────────
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
- H,
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: e.imageUrls.medium,
124
- alt: s,
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
- (((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 })
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__ */ n("hr", { className: i.divider }),
137
+ divider: () => /* @__PURE__ */ s("hr", { className: a.divider }),
138
138
  // ── Spacer ──────────────────────────────────────────────────────────
139
- spacer: ({ value: e }) => {
140
- const s = (e == null ? void 0 : e.style) || "medium", c = {
141
- small: i.spacerSmall,
142
- medium: i.spacerMedium,
143
- large: i.spacerLarge
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__ */ n("span", { className: c[s] ?? i.spacerMedium });
145
+ return /* @__PURE__ */ s("span", { className: l[i] ?? a.spacerMedium });
146
146
  },
147
147
  // ── Table ────────────────────────────────────────────────────────────
148
- table: ({ value: e }) => {
148
+ table: ({ value: t }) => {
149
149
  var L, M;
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;
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: c ? /* @__PURE__ */ n(
156
+ header: l ? /* @__PURE__ */ s(
157
157
  $,
158
158
  {
159
- value: (k = c.cells[h]) == null ? void 0 : k.content,
160
- components: a()
159
+ value: (x = l.cells[f]) == null ? void 0 : x.content,
160
+ components: o()
161
161
  }
162
- ) : `Column ${h + 1}`,
163
- accessor: `col${h}`,
164
- cellRenderer: (f) => f ? /* @__PURE__ */ n(
162
+ ) : `Column ${f + 1}`,
163
+ accessor: `col${f}`,
164
+ cellRenderer: (u) => u ? /* @__PURE__ */ s(
165
165
  $,
166
166
  {
167
- value: f,
168
- components: a()
167
+ value: u,
168
+ components: o()
169
169
  }
170
170
  ) : null
171
171
  };
172
- }), T = x.map((w) => {
173
- var k;
174
- const h = {};
175
- return (k = w.cells) == null || k.forEach((f, R) => {
176
- h[`col${R}`] = f == null ? void 0 : f.content;
177
- }), h;
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__ */ n(
180
- j,
179
+ return /* @__PURE__ */ s(
180
+ C,
181
181
  {
182
- hasHeadingRow: s,
182
+ hasHeadingRow: i,
183
183
  data: T,
184
184
  columns: y,
185
- className: `${t ?? ""} ${s ? "hasHeadingRow" : ""}`
185
+ className: `${e ?? ""} ${i ? "hasHeadingRow" : ""}`
186
186
  }
187
187
  );
188
188
  },
189
189
  // ── Code block ──────────────────────────────────────────────────────
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 }) })
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
- }, u;
195
+ }, g;
196
196
  }
197
- const ge = ({
198
- blocks: t,
197
+ const gt = ({
198
+ blocks: e,
199
199
  className: r,
200
- textOverride: o,
201
- animateText: l
200
+ textOverride: n,
201
+ animateText: m,
202
+ components: c
202
203
  }) => {
203
- const m = U("(max-width: 767px)"), p = F(o);
204
- I(() => {
205
- p.current = o;
206
- }, [o]);
207
- const g = W(
208
- () => Z({
209
- baseClassName: r,
210
- previousTextRef: p,
211
- textOverride: o,
212
- animateText: l,
213
- isMobile: m
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, o, l, m]
244
+ [r, n, m, p, c]
218
245
  );
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;
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
- ge as RichText
249
+ gt as RichText
223
250
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),u=require("../ui/PortableTextRenderer/index.cjs"),l=require("../ui/CallToAction/index.cjs");function o(e){return e.flatMap(r=>r.children??[]).map(r=>r.text??"").join("")}function x({blocks:e,className:r,textOverride:n,animateText:t}){return e!=null&&e.length?i.jsx(u.RichText,{blocks:e,className:r,textOverride:n,animateText:t}):null}function c({alignment:e,spacing:r,items:n,className:t}){return n!=null&&n.length?i.jsx(l.CallToAction,{alignment:e,items:n,className:t,spacing:r}):null}exports.extractText=o;exports.renderCallToAction=c;exports.renderRichText=x;
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 u } from "../ui/PortableTextRenderer/index.mjs";
3
- import { CallToAction as f } from "../ui/CallToAction/index.mjs";
4
- function a(r) {
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 p({
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
- u,
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 h({
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
- f,
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
- a as extractText,
41
- h as renderCallToAction,
42
- p as renderRichText
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;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quirk-ui",
3
3
  "private": false,
4
- "version": "0.1.193",
4
+ "version": "0.1.194",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {