@bison-lab/payload-blocks 2.0.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/fields/image.ts","../src/fields/link.ts","../src/blocks/hero/config.ts","../src/blocks/rich-text/config.ts","../src/blocks/showcase-panels/config.ts","../src/blocks/process-steps/config.ts","../src/fields/heading.ts","../src/blocks/faq-columns/config.ts","../src/blocks/testimonial-masonry/config.ts","../src/blocks/nap/config.ts","../src/media.ts"],"sourcesContent":["import type { CollectionSlug, UploadField } from \"payload\";\n\n/**\n * Payload's `UploadField` is a union over the polymorphic (`relationTo: [...]`)\n * and `hasMany` variants. A block image is neither, and narrowing here is what\n * lets `imageField({ name: 'portrait' })` stay type-checked at the call site.\n */\ntype MediaUploadField = Extract<\n UploadField,\n { hasMany?: false; relationTo: CollectionSlug }\n>;\n\nexport interface ImageFieldOptions extends Partial<MediaUploadField> {\n /**\n * The upload collection to point at. Every Bison Lab site names it `media`,\n * but a site that does not can say so without forking the field.\n */\n relationTo?: CollectionSlug;\n}\n\n/**\n * A single image from the site's upload collection, for any block with a\n * picture in it.\n *\n * Optional unless the block says otherwise: `imageField({ name: 'portrait',\n * required: true })`. `admin` is replaced, not merged, so a block that passes\n * its own description writes the whole thing.\n */\nexport function imageField(overrides: ImageFieldOptions = {}): MediaUploadField {\n return {\n name: \"image\",\n type: \"upload\",\n relationTo: \"media\" as CollectionSlug,\n // Payload stars a required field and says nothing about an optional one,\n // so an optional image says so itself, and only then.\n ...(overrides.required ? {} : { admin: { description: \"Optional.\" } }),\n ...overrides,\n } as MediaUploadField;\n}\n","import type { Field, GroupField } from \"payload\";\n\nexport interface LinkFieldsOptions {\n /** Require the label and destination. Defaults to `false`. */\n required?: boolean;\n /** Wording for the visible text field. Defaults to \"Label\". */\n labelFieldLabel?: string;\n}\n\n/**\n * The three fields a call to action is made of, unwrapped.\n *\n * `href` is plain text rather than a relationship to a `pages` row: a block in\n * this package has to work on a site whose page collection is named something\n * else, or which links out more often than in. Resolving an internal reference\n * is the site's job.\n *\n * `newTab` drives `target=\"_blank\"` *and* the matching `rel`, which is why no\n * renderer takes one without the other.\n */\nexport function linkFields({\n required = false,\n labelFieldLabel = \"Label\",\n}: LinkFieldsOptions = {}): Field[] {\n return [\n { name: \"label\", type: \"text\", label: labelFieldLabel, required },\n {\n name: \"href\",\n type: \"text\",\n required,\n admin: {\n description:\n 'A site path (\"/contact\") or a full URL (\"https://example.com\").',\n },\n },\n {\n name: \"newTab\",\n type: \"checkbox\",\n label: \"Open in a new tab\",\n defaultValue: false,\n },\n ];\n}\n\nexport interface LinkFieldOptions extends LinkFieldsOptions {\n /** Field name. Defaults to `link`. */\n name?: string;\n label?: GroupField[\"label\"];\n admin?: GroupField[\"admin\"];\n}\n\n/** `linkFields()` as one named group, for a block with a single CTA. */\nexport function linkField({\n name = \"link\",\n label,\n admin,\n ...rest\n}: LinkFieldOptions = {}): GroupField {\n return {\n name,\n type: \"group\",\n fields: linkFields(rest),\n ...(label === undefined ? {} : { label }),\n ...(admin === undefined ? {} : { admin }),\n };\n}\n\n/** The shape `linkField`/`linkFields` produce once Payload generates types. */\nexport interface LinkValue {\n label?: string | null;\n href?: string | null;\n newTab?: boolean | null;\n}\n","import type { Block } from \"payload\";\n\nimport { imageField } from \"../../fields/image\";\nimport { linkFields } from \"../../fields/link\";\n\n/**\n * The band a page opens with.\n *\n * Unlike every other block here this one has no `@bison-lab/ui` counterpart:\n * a hero is where a site's brand is loudest, and the shipped renderer is\n * deliberately plain markup so a site can swap in its own by overriding this\n * one registry entry. The *fields* are the shared part — that is what makes a\n * page portable between sites.\n */\nexport const HeroBlock: Block = {\n slug: \"hero\",\n interfaceName: \"HeroBlock\",\n labels: { singular: \"Hero\", plural: \"Heroes\" },\n fields: [\n {\n name: \"eyebrow\",\n type: \"text\",\n admin: { description: \"Small label above the heading. Optional.\" },\n },\n { name: \"heading\", type: \"text\", required: true },\n { name: \"body\", type: \"textarea\" },\n {\n name: \"tone\",\n type: \"select\",\n defaultValue: \"sweep\",\n options: [\n { label: \"Sweep (brand gradient)\", value: \"sweep\" },\n { label: \"Dark (flat brand band)\", value: \"dark\" },\n { label: \"Light (page background)\", value: \"light\" },\n ],\n admin: {\n description:\n \"How the band is painted. Sites map these to their own surfaces.\",\n },\n },\n imageField({ admin: { description: \"Optional background or lead image.\" } }),\n {\n name: \"links\",\n type: \"array\",\n // Two is the point at which a hero stops having a primary action.\n maxRows: 2,\n labels: { singular: \"Call to action\", plural: \"Calls to action\" },\n fields: linkFields({ required: true }),\n },\n ],\n};\n","import type { Block } from \"payload\";\n\n/** A prose section: one Lexical document at reading measure. */\nexport const RichTextBlock: Block = {\n slug: \"richText\",\n interfaceName: \"RichTextBlock\",\n labels: { singular: \"Rich Text\", plural: \"Rich Text\" },\n fields: [{ name: \"content\", type: \"richText\", required: true }],\n};\n","import type { Block } from \"payload\";\n\nimport { imageField } from \"../../fields/image\";\n\n/** Expanding panels, one per service or product line. */\nexport const ShowcasePanelsBlock: Block = {\n slug: \"showcasePanels\",\n interfaceName: \"ShowcasePanelsBlock\",\n labels: { singular: \"Showcase Panels\", plural: \"Showcase Panels\" },\n fields: [\n {\n name: \"items\",\n type: \"array\",\n required: true,\n // The layout is designed around 3-6 panels: fewer and the accordion\n // reads as a mistake, more and each collapsed spine is unreadable.\n minRows: 3,\n maxRows: 6,\n labels: { singular: \"Panel\", plural: \"Panels\" },\n fields: [\n { name: \"title\", type: \"text\", required: true },\n {\n name: \"summary\",\n type: \"textarea\",\n required: true,\n admin: { description: \"Revealed when the panel expands.\" },\n },\n imageField({ required: true }),\n {\n name: \"href\",\n type: \"text\",\n admin: {\n description: 'Optional \"read more\" destination for this panel.',\n },\n },\n {\n name: \"numeral\",\n type: \"text\",\n admin: {\n description:\n 'Overrides the spine numeral (\"01\", \"II\"). Leave empty to number automatically.',\n },\n },\n ],\n },\n {\n name: \"spineVariant\",\n type: \"select\",\n defaultValue: \"numbered\",\n options: [\n { label: \"Numbered (01, 02)\", value: \"numbered\" },\n { label: \"Volume (I, II)\", value: \"volume\" },\n { label: \"Minimal (no numeral)\", value: \"minimal\" },\n ],\n },\n {\n name: \"watermark\",\n type: \"text\",\n admin: { description: 'Faint mark behind the panels, e.g. a brand word.' },\n },\n {\n name: \"defaultActiveIndex\",\n type: \"number\",\n defaultValue: 0,\n min: 0,\n admin: { description: \"Which panel is open on load, counting from 0.\" },\n },\n {\n name: \"ariaLabel\",\n type: \"text\",\n admin: {\n description:\n 'Names the region for screen readers. Defaults to \"Showcase panels\".',\n },\n },\n {\n name: \"labels\",\n type: \"group\",\n admin: { description: \"Overrides for the panel state text.\" },\n fields: [\n { name: \"selected\", type: \"text\" },\n { name: \"preview\", type: \"text\" },\n ],\n },\n ],\n};\n","import type { Block } from \"payload\";\n\nimport { imageField } from \"../../fields/image\";\n\n/** An ordered walkthrough that advances on its own. */\nexport const ProcessStepsBlock: Block = {\n slug: \"processSteps\",\n interfaceName: \"ProcessStepsBlock\",\n labels: { singular: \"Process Steps\", plural: \"Process Steps\" },\n fields: [\n {\n name: \"items\",\n type: \"array\",\n required: true,\n // Same reasoning as the showcase panels: the step rail is designed\n // around 3-6 entries, in order.\n minRows: 3,\n maxRows: 6,\n labels: { singular: \"Step\", plural: \"Steps\" },\n fields: [\n { name: \"title\", type: \"text\", required: true },\n { name: \"description\", type: \"textarea\", required: true },\n imageField({ required: true }),\n {\n name: \"step\",\n type: \"number\",\n min: 1,\n admin: {\n description:\n \"Overrides the displayed number. Leave empty to number by position.\",\n },\n },\n ],\n },\n {\n name: \"autoAdvance\",\n type: \"checkbox\",\n defaultValue: true,\n admin: {\n description:\n \"Advance on a timer. Always off for visitors who prefer reduced motion.\",\n },\n },\n {\n name: \"autoAdvanceDuration\",\n type: \"number\",\n defaultValue: 6000,\n min: 1000,\n admin: { description: \"Milliseconds each step holds before advancing.\" },\n },\n { name: \"pauseOnHover\", type: \"checkbox\", defaultValue: true },\n {\n name: \"defaultActiveIndex\",\n type: \"number\",\n defaultValue: 0,\n min: 0,\n admin: { description: \"Which step is active on load, counting from 0.\" },\n },\n {\n name: \"ariaLabel\",\n type: \"text\",\n admin: {\n description:\n 'Names the region for screen readers. Defaults to \"Process steps\".',\n },\n },\n {\n name: \"labels\",\n type: \"group\",\n admin: { description: \"Overrides for the play/pause control text.\" },\n fields: [\n { name: \"pause\", type: \"text\" },\n { name: \"resume\", type: \"text\" },\n ],\n },\n ],\n};\n","import type { Field } from \"payload\";\n\nexport interface HeadingFieldsOptions {\n /** Require the section heading. Defaults to `true`. */\n required?: boolean;\n /** Description shown under the eyebrow input. */\n eyebrowDescription?: string;\n}\n\n/**\n * The eyebrow / title / description trio every marketing band opens with.\n *\n * They are three top-level fields rather than a group: editors read a section\n * heading as the first thing in the block, and burying it one collapse deep\n * puts the least-optional copy behind a click. The field names match the\n * `@bison-lab/ui` prop names so the renderers stay a pass-through.\n */\nexport function headingFields({\n required = true,\n eyebrowDescription = \"Small label above the heading. Leave empty to hide the row.\",\n}: HeadingFieldsOptions = {}): Field[] {\n return [\n {\n name: \"eyebrow\",\n type: \"text\",\n admin: { description: eyebrowDescription },\n },\n { name: \"title\", type: \"text\", required },\n { name: \"description\", type: \"textarea\" },\n ];\n}\n","import type { Block } from \"payload\";\n\nimport { headingFields } from \"../../fields/heading\";\n\n/** A sticky intro beside a column of questions. */\nexport const FaqColumnsBlock: Block = {\n slug: \"faqColumns\",\n interfaceName: \"FaqColumnsBlock\",\n labels: { singular: \"FAQ Columns\", plural: \"FAQ Columns\" },\n fields: [\n ...headingFields(),\n {\n name: \"items\",\n type: \"array\",\n required: true,\n minRows: 1,\n labels: { singular: \"Question\", plural: \"Questions\" },\n fields: [\n { name: \"question\", type: \"text\", required: true },\n {\n name: \"answer\",\n // Plain text on purpose. A Lexical answer would pull\n // `@payloadcms/richtext-lexical` into the `./react` entry, which\n // every consumer loads; the `richText` block is where prose with\n // links and lists belongs.\n type: \"textarea\",\n required: true,\n },\n ],\n },\n {\n name: \"cta\",\n type: \"group\",\n label: \"Call to action\",\n admin: {\n description: \"Shown under the intro. Leave the link empty to hide it.\",\n },\n fields: [\n {\n name: \"title\",\n type: \"text\",\n admin: { description: 'Lead-in line, e.g. \"Still have questions?\".' },\n },\n { name: \"linkText\", type: \"text\" },\n { name: \"href\", type: \"text\" },\n {\n name: \"newTab\",\n type: \"checkbox\",\n label: \"Open in a new tab\",\n defaultValue: false,\n },\n ],\n },\n {\n name: \"sticky\",\n type: \"checkbox\",\n defaultValue: true,\n admin: { description: \"Pin the intro column while the answers scroll.\" },\n },\n {\n name: \"type\",\n type: \"select\",\n defaultValue: \"single\",\n options: [\n { label: \"One answer open at a time\", value: \"single\" },\n { label: \"Several answers open at once\", value: \"multiple\" },\n ],\n },\n {\n name: \"collapsible\",\n type: \"checkbox\",\n defaultValue: true,\n admin: {\n description: \"Allow the open answer to be closed again. Single mode only.\",\n },\n },\n ],\n};\n","import type { Block } from \"payload\";\n\nimport { headingFields } from \"../../fields/heading\";\nimport { imageField } from \"../../fields/image\";\nimport { linkField } from \"../../fields/link\";\n\n/** Quotes in a masonry grid, clipped behind a fade once there are enough. */\nexport const TestimonialMasonryBlock: Block = {\n slug: \"testimonialMasonry\",\n interfaceName: \"TestimonialMasonryBlock\",\n labels: { singular: \"Testimonial Masonry\", plural: \"Testimonial Masonry\" },\n fields: [\n ...headingFields(),\n {\n name: \"items\",\n type: \"array\",\n required: true,\n minRows: 1,\n labels: { singular: \"Testimonial\", plural: \"Testimonials\" },\n fields: [\n { name: \"content\", type: \"textarea\", required: true, label: \"Quote\" },\n {\n name: \"author\",\n type: \"group\",\n fields: [\n { name: \"name\", type: \"text\", required: true },\n {\n name: \"title\",\n type: \"text\",\n admin: {\n description: 'Role or organisation, e.g. \"Orthopaedic surgeon\".',\n },\n },\n imageField({\n name: \"avatar\",\n admin: {\n description:\n \"Optional. Initials from the name are used when empty.\",\n },\n }),\n ],\n },\n ],\n },\n linkField({\n label: \"Link\",\n admin: {\n description:\n \"Shown under the fade, once there are enough quotes to clip.\",\n },\n }),\n {\n name: \"minItemsForFade\",\n type: \"number\",\n defaultValue: 7,\n min: 1,\n admin: {\n description:\n \"How many quotes before the grid clips and the bottom fade appears.\",\n },\n },\n {\n name: \"maxVisibleRows\",\n type: \"number\",\n min: 1,\n admin: { description: \"Rows shown before the fade. Optional.\" },\n },\n ],\n};\n","import type { Block } from \"payload\";\n\n/**\n * Name, address, phone — the block local SEO is graded on.\n *\n * The `e164` phone number is a separate field from the displayed one because\n * `NapBlock` uses it, and only it, for the `tel:` href and the JSON-LD\n * `telephone`. A prettified string can never silently become an unreachable\n * link.\n */\nexport const NapBlock: Block = {\n slug: \"nap\",\n interfaceName: \"NapBlock\",\n labels: { singular: \"Name, Address, Phone\", plural: \"Name, Address, Phone\" },\n fields: [\n { name: \"businessName\", type: \"text\", required: true, label: \"Business name\" },\n {\n name: \"businessType\",\n type: \"text\",\n required: true,\n defaultValue: \"LocalBusiness\",\n admin: {\n description:\n 'schema.org type, e.g. \"MedicalBusiness\", \"Chiropractor\", \"LocalBusiness\".',\n },\n },\n {\n name: \"address\",\n type: \"group\",\n fields: [\n { name: \"streetAddress\", type: \"text\", required: true },\n { name: \"addressLocality\", type: \"text\", required: true, label: \"City\" },\n {\n name: \"addressRegion\",\n type: \"text\",\n required: true,\n label: \"State or region\",\n },\n { name: \"postalCode\", type: \"text\", required: true },\n {\n name: \"addressCountry\",\n type: \"text\",\n defaultValue: \"US\",\n admin: { description: \"ISO 3166-1 alpha-2, e.g. US.\" },\n },\n ],\n },\n {\n name: \"departments\",\n type: \"array\",\n required: true,\n minRows: 1,\n labels: { singular: \"Department\", plural: \"Departments\" },\n admin: {\n description:\n \"A single-location business has one entry, usually named after the business.\",\n },\n fields: [\n { name: \"name\", type: \"text\", required: true },\n {\n name: \"departmentType\",\n type: \"text\",\n admin: {\n description:\n \"schema.org type for this department. Falls back to the business type.\",\n },\n },\n {\n name: \"phoneE164\",\n type: \"text\",\n required: true,\n label: \"Phone (E.164)\",\n admin: {\n description:\n 'Dialable form, e.g. \"+15551234567\". This is what the tel: link and the structured data use.',\n },\n },\n {\n name: \"phoneDisplay\",\n type: \"text\",\n label: \"Phone (as displayed)\",\n admin: {\n description:\n \"Optional. US numbers are formatted automatically when this is empty.\",\n },\n },\n ],\n },\n {\n name: \"url\",\n type: \"text\",\n admin: { description: \"Canonical URL for the business. Optional.\" },\n },\n {\n name: \"showName\",\n type: \"checkbox\",\n defaultValue: true,\n admin: {\n description:\n \"Turn off when a heading above the block already names the business.\",\n },\n },\n {\n name: \"headingLevel\",\n type: \"select\",\n defaultValue: \"h2\",\n options: [\n { label: \"H2\", value: \"h2\" },\n { label: \"H3\", value: \"h3\" },\n { label: \"H4\", value: \"h4\" },\n ],\n admin: { description: \"Keeps the page's heading order intact.\" },\n },\n {\n name: \"emitJsonLd\",\n type: \"checkbox\",\n defaultValue: true,\n label: \"Emit structured data\",\n admin: {\n description:\n \"Adds a schema.org LocalBusiness script. Turn off if the page emits its own.\",\n },\n },\n ],\n};\n","/**\n * The upload side of the boundary.\n *\n * A Payload upload field holds either the row's id or, once depth resolves it,\n * the whole document. Neither shape can be imported from here: `Media` is\n * generated per site, and this package must never reach for a site's\n * `payload-types`. So the doc is described structurally, and every renderer\n * goes through `resolveMedia` rather than reading `.url` itself.\n */\n\n/**\n * The subset of a Payload upload document a block renderer actually reads.\n * Every site's generated `Media` interface is assignable to this, whatever\n * else it carries.\n *\n * Deliberately no index signature: TypeScript refuses to assign an interface\n * to a type with one, and a site's generated `Media` is always an interface.\n * An index signature here would break exactly the structural match this type\n * exists to provide.\n */\nexport interface MediaDoc {\n url?: string | null;\n alt?: string | null;\n width?: number | null;\n height?: number | null;\n}\n\n/** What an upload field holds before and after `depth` populates it. */\nexport type MediaValue = number | string | MediaDoc | null | undefined;\n\n/** A resolved image, in the shape every `@bison-lab/ui` block asks for. */\nexport interface ResolvedMedia {\n src: string;\n alt: string;\n width?: number;\n height?: number;\n}\n\nfunction isMediaDoc(value: MediaValue): value is MediaDoc {\n return typeof value === \"object\" && value !== null;\n}\n\n/**\n * Narrows an upload value to something renderable, or `undefined`.\n *\n * `undefined` covers three cases a renderer must treat identically: the field\n * is empty, `depth: 0` left it as a bare id, or the document exists but has no\n * `url` yet (an upload mid-flight). A renderer that gets `undefined` omits the\n * image rather than emitting a broken `<img>`.\n *\n * `alt` is always a string: the media collection requires it, but a draft saved\n * before that validation ran can still reach a renderer, and an `alt` of\n * `undefined` would silently drop the attribute entirely.\n */\nexport function resolveMedia(value: MediaValue): ResolvedMedia | undefined {\n if (!isMediaDoc(value)) return undefined;\n const { url, alt, width, height } = value;\n if (typeof url !== \"string\" || url.length === 0) return undefined;\n return {\n src: url,\n alt: typeof alt === \"string\" ? alt : \"\",\n ...(typeof width === \"number\" ? { width } : {}),\n ...(typeof height === \"number\" ? { height } : {}),\n };\n}\n"],"mappings":";;;;;;;;;AA4BA,SAAgB,WAAW,YAA+B,EAAE,EAAoB;AAC9E,QAAO;EACL,MAAM;EACN,MAAM;EACN,YAAY;EAGZ,GAAI,UAAU,WAAW,EAAE,GAAG,EAAE,OAAO,EAAE,aAAa,aAAa,EAAE;EACrE,GAAG;EACJ;;;;;;;;;;;;;;;ACjBH,SAAgB,WAAW,EACzB,WAAW,OACX,kBAAkB,YACG,EAAE,EAAW;AAClC,QAAO;EACL;GAAE,MAAM;GAAS,MAAM;GAAQ,OAAO;GAAiB;GAAU;EACjE;GACE,MAAM;GACN,MAAM;GACN;GACA,OAAO,EACL,aACE,uEACH;GACF;EACD;GACE,MAAM;GACN,MAAM;GACN,OAAO;GACP,cAAc;GACf;EACF;;;AAWH,SAAgB,UAAU,EACxB,OAAO,QACP,OACA,OACA,GAAG,SACiB,EAAE,EAAc;AACpC,QAAO;EACL;EACA,MAAM;EACN,QAAQ,WAAW,KAAK;EACxB,GAAI,UAAU,KAAA,IAAY,EAAE,GAAG,EAAE,OAAO;EACxC,GAAI,UAA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O,EACL,aACE,+EACH;GACF;EACF;CACF;;;ACtFD,SAAS,WAAW,OAAsC;AACxD,QAAO,OAAO,UAAU,YAAY,UAAU;;;;;;;;;;;;;;AAehD,SAAgB,aAAa,OAA8C;AACzE,KAAI,CAAC,WAAW,MAAM,CAAE,QAAO,KAAA;CAC/B,MAAM,EAAE,KAAK,KAAK,OAAO,WAAW;AACpC,KAAI,OAAO,QAAQ,YAAY,IAAI,WAAW,EAAG,QAAO,KAAA;AACxD,QAAO;EACL,KAAK;EACL,KAAK,OAAO,QAAQ,WAAW,MAAM;EACrC,GAAI,OAAO,UAAU,WAAW,EAAE,OAAO,GAAG,EAAE;EAC9C,GAAI,OAAO,WAAW,WAAW,EAAE,QAAQ,GAAG,EAAE;EACjD"}
@@ -0,0 +1,53 @@
1
+
2
+ import { c as BlockLike, d as DEFAULT_CONTAINER, f as RenderBlocks, g as DefaultBlockImage, h as BlockImageProps, i as ProcessStepsBlockData, l as BlockRegistryFor, m as BlockImageComponent, n as HeroBlockData, o as ShowcasePanelsBlockData, p as RenderBlocksProps, r as NapBlockData, s as TestimonialMasonryBlockData, t as FaqColumnsBlockData, u as BlockRendererProps } from "./types-BvRvDCDT.mjs";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
+
5
+ //#region src/blocks/hero/component.d.ts
6
+ /**
7
+ * The package's hero: deliberately plain.
8
+ *
9
+ * A hero is where a site's brand is loudest, so this exists to make a page
10
+ * render at all, not to be the final answer. A site overrides this one registry
11
+ * entry with its own and keeps every other block.
12
+ */
13
+ declare function HeroBlockRenderer({
14
+ block,
15
+ index,
16
+ containerClassName,
17
+ imageComponent: Image
18
+ }: BlockRendererProps<HeroBlockData>): react_jsx_runtime0.JSX.Element;
19
+ //#endregion
20
+ //#region src/blocks/showcase-panels/component.d.ts
21
+ declare function ShowcasePanelsBlockRenderer({
22
+ block,
23
+ containerClassName,
24
+ imageComponent: Image
25
+ }: BlockRendererProps<ShowcasePanelsBlockData>): react_jsx_runtime0.JSX.Element | null;
26
+ //#endregion
27
+ //#region src/blocks/process-steps/component.d.ts
28
+ declare function ProcessStepsBlockRenderer({
29
+ block,
30
+ containerClassName,
31
+ imageComponent: Image
32
+ }: BlockRendererProps<ProcessStepsBlockData>): react_jsx_runtime0.JSX.Element | null;
33
+ //#endregion
34
+ //#region src/blocks/faq-columns/component.d.ts
35
+ declare function FaqColumnsBlockRenderer({
36
+ block,
37
+ containerClassName
38
+ }: BlockRendererProps<FaqColumnsBlockData>): react_jsx_runtime0.JSX.Element | null;
39
+ //#endregion
40
+ //#region src/blocks/testimonial-masonry/component.d.ts
41
+ declare function TestimonialMasonryBlockRenderer({
42
+ block,
43
+ containerClassName
44
+ }: BlockRendererProps<TestimonialMasonryBlockData>): react_jsx_runtime0.JSX.Element | null;
45
+ //#endregion
46
+ //#region src/blocks/nap/component.d.ts
47
+ declare function NapBlockRenderer({
48
+ block,
49
+ containerClassName
50
+ }: BlockRendererProps<NapBlockData>): react_jsx_runtime0.JSX.Element | null;
51
+ //#endregion
52
+ export { type BlockImageComponent, type BlockImageProps, type BlockLike, type BlockRegistryFor, type BlockRendererProps, DEFAULT_CONTAINER, DefaultBlockImage, FaqColumnsBlockRenderer, HeroBlockRenderer, NapBlockRenderer, ProcessStepsBlockRenderer, RenderBlocks, type RenderBlocksProps, ShowcasePanelsBlockRenderer, TestimonialMasonryBlockRenderer };
53
+ //# sourceMappingURL=react.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.mts","names":[],"sources":["../src/blocks/hero/component.tsx","../src/blocks/showcase-panels/component.tsx","../src/blocks/process-steps/component.tsx","../src/blocks/faq-columns/component.tsx","../src/blocks/testimonial-masonry/component.tsx","../src/blocks/nap/component.tsx"],"mappings":";;;;;;;AAwBA;;;;;iBAAgB,iBAAA,CAAA;EACd,KAAA;EACA,KAAA;EACA,kBAAA;EACA,cAAA,EAAgB;AAAA,GACf,kBAAA,CAAmB,aAAA,IAAc,kBAAA,CAAA,GAAA,CAAA,OAAA;;;iBCtBpB,2BAAA,CAAA;EACd,KAAA;EACA,kBAAA;EACA,cAAA,EAAgB;AAAA,GACf,kBAAA,CAAmB,uBAAA,IAAwB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;iBCJ9B,yBAAA,CAAA;EACd,KAAA;EACA,kBAAA;EACA,cAAA,EAAgB;AAAA,GACf,kBAAA,CAAmB,qBAAA,IAAsB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;iBCL5B,uBAAA,CAAA;EACd,KAAA;EACA;AAAA,GACC,kBAAA,CAAmB,mBAAA,IAAoB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;iBCF1B,+BAAA,CAAA;EACd,KAAA;EACA;AAAA,GACC,kBAAA,CAAmB,2BAAA,IAA4B,kBAAA,CAAA,GAAA,CAAA,OAAA;;;iBCClC,gBAAA,CAAA;EACd,KAAA;EACA;AAAA,GACC,kBAAA,CAAmB,YAAA,IAAa,kBAAA,CAAA,GAAA,CAAA,OAAA"}
package/dist/react.mjs ADDED
@@ -0,0 +1,370 @@
1
+ "use client";
2
+ import { t as cx } from "./cx-BKHSv3xT.mjs";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { Button, FAQColumnsBlock, JsonLd, NapBlock, ProcessStepsBlock, ShowcasePanelsBlock, TestimonialMasonry } from "@bison-lab/ui";
5
+ //#region src/image.tsx
6
+ /**
7
+ * The fallback when no `imageComponent` is supplied: a plain `<img>`. Correct
8
+ * everywhere and optimised nowhere, which is the right default for a package
9
+ * that cannot know what framework it landed in.
10
+ */
11
+ function DefaultBlockImage({ src, alt, width, height, className, sizes, priority }) {
12
+ return /* @__PURE__ */ jsx("img", {
13
+ src,
14
+ alt,
15
+ width,
16
+ height,
17
+ className,
18
+ sizes,
19
+ loading: priority ? "eager" : "lazy",
20
+ decoding: "async"
21
+ });
22
+ }
23
+ //#endregion
24
+ //#region src/render-blocks.tsx
25
+ /** Fallback page measure for a site that does not pass its own. */
26
+ const DEFAULT_CONTAINER = "mx-auto w-full max-w-7xl px-6";
27
+ /**
28
+ * A row saved against a block that has since left the config has no renderer.
29
+ * It is dropped before anything is counted, so its neighbours see each other,
30
+ * not a gap: the block after it gets the real `prevType`, a run of one type is
31
+ * not broken by it, and the block before it is still `isLast` when it ends the
32
+ * page.
33
+ */
34
+ function renderable(blocks, registry) {
35
+ return blocks.flatMap((block) => {
36
+ const Renderer = registry[block.blockType];
37
+ return Renderer ? [{
38
+ block,
39
+ Renderer
40
+ }] : [];
41
+ });
42
+ }
43
+ /** Position of each block within its run of consecutive same-type blocks. */
44
+ function runIndexes(blocks) {
45
+ const out = [];
46
+ for (let i = 0; i < blocks.length; i += 1) out.push(i > 0 && blocks[i - 1].blockType === blocks[i].blockType ? out[i - 1] + 1 : 0);
47
+ return out;
48
+ }
49
+ /**
50
+ * Renders a page's blocks in order through the registry. A Server Component:
51
+ * it only maps and looks up, and each renderer decides its own nature.
52
+ */
53
+ function RenderBlocks({ blocks, registry, containerClassName = DEFAULT_CONTAINER, imageComponent = DefaultBlockImage }) {
54
+ const rows = renderable(blocks, registry);
55
+ const runs = runIndexes(rows.map((row) => row.block));
56
+ return /* @__PURE__ */ jsx(Fragment, { children: rows.map(({ block, Renderer }, index) => /* @__PURE__ */ jsx(Renderer, {
57
+ block,
58
+ index,
59
+ prevType: index > 0 ? rows[index - 1].block.blockType : void 0,
60
+ runIndex: runs[index],
61
+ isLast: index === rows.length - 1,
62
+ containerClassName,
63
+ imageComponent
64
+ }, block.id ?? index)) });
65
+ }
66
+ //#endregion
67
+ //#region src/media.ts
68
+ function isMediaDoc(value) {
69
+ return typeof value === "object" && value !== null;
70
+ }
71
+ /**
72
+ * Narrows an upload value to something renderable, or `undefined`.
73
+ *
74
+ * `undefined` covers three cases a renderer must treat identically: the field
75
+ * is empty, `depth: 0` left it as a bare id, or the document exists but has no
76
+ * `url` yet (an upload mid-flight). A renderer that gets `undefined` omits the
77
+ * image rather than emitting a broken `<img>`.
78
+ *
79
+ * `alt` is always a string: the media collection requires it, but a draft saved
80
+ * before that validation ran can still reach a renderer, and an `alt` of
81
+ * `undefined` would silently drop the attribute entirely.
82
+ */
83
+ function resolveMedia(value) {
84
+ if (!isMediaDoc(value)) return void 0;
85
+ const { url, alt, width, height } = value;
86
+ if (typeof url !== "string" || url.length === 0) return void 0;
87
+ return {
88
+ src: url,
89
+ alt: typeof alt === "string" ? alt : "",
90
+ ...typeof width === "number" ? { width } : {},
91
+ ...typeof height === "number" ? { height } : {}
92
+ };
93
+ }
94
+ //#endregion
95
+ //#region src/blocks/hero/component.tsx
96
+ /**
97
+ * How each tone paints. Semantic tokens only — a site's brand reaches these
98
+ * through its theme, never through a class named here.
99
+ */
100
+ const TONES = {
101
+ sweep: "bg-primary text-primary-foreground",
102
+ dark: "bg-foreground text-background",
103
+ light: "bg-background text-foreground"
104
+ };
105
+ /**
106
+ * The package's hero: deliberately plain.
107
+ *
108
+ * A hero is where a site's brand is loudest, so this exists to make a page
109
+ * render at all, not to be the final answer. A site overrides this one registry
110
+ * entry with its own and keeps every other block.
111
+ */
112
+ function HeroBlockRenderer({ block, index, containerClassName, imageComponent: Image }) {
113
+ const image = resolveMedia(block.image);
114
+ const links = (block.links ?? []).filter((link) => link.href && link.label);
115
+ const tone = TONES[block.tone ?? "sweep"];
116
+ return /* @__PURE__ */ jsxs("section", {
117
+ className: cx("relative isolate overflow-hidden", tone),
118
+ children: [image ? /* @__PURE__ */ jsx("div", {
119
+ className: "absolute inset-0 -z-10 opacity-25",
120
+ children: /* @__PURE__ */ jsx(Image, {
121
+ src: image.src,
122
+ alt: "",
123
+ width: image.width,
124
+ height: image.height,
125
+ className: "h-full w-full object-cover",
126
+ sizes: "100vw",
127
+ priority: index === 0
128
+ })
129
+ }) : null, /* @__PURE__ */ jsx("div", {
130
+ className: cx(containerClassName, "py-20 lg:py-28"),
131
+ children: /* @__PURE__ */ jsxs("div", {
132
+ className: "max-w-3xl",
133
+ children: [
134
+ block.eyebrow ? /* @__PURE__ */ jsx("p", {
135
+ className: "text-sm font-semibold tracking-widest uppercase opacity-80",
136
+ children: block.eyebrow
137
+ }) : null,
138
+ /* @__PURE__ */ jsx("h1", {
139
+ className: "mt-3 text-4xl font-bold tracking-tight text-balance lg:text-5xl",
140
+ children: block.heading
141
+ }),
142
+ block.body ? /* @__PURE__ */ jsx("p", {
143
+ className: "mt-6 max-w-2xl text-lg leading-relaxed opacity-90",
144
+ children: block.body
145
+ }) : null,
146
+ links.length > 0 ? /* @__PURE__ */ jsx("div", {
147
+ className: "mt-8 flex flex-wrap gap-3",
148
+ children: links.map((link, i) => /* @__PURE__ */ jsx(Button, {
149
+ asChild: true,
150
+ variant: i === 0 ? "default" : "outline",
151
+ children: /* @__PURE__ */ jsx("a", {
152
+ href: link.href,
153
+ ...link.newTab ? {
154
+ target: "_blank",
155
+ rel: "noreferrer noopener"
156
+ } : {},
157
+ children: link.label
158
+ })
159
+ }, `${link.href}-${i}`))
160
+ }) : null
161
+ ]
162
+ })
163
+ })]
164
+ });
165
+ }
166
+ //#endregion
167
+ //#region src/blocks/showcase-panels/component.tsx
168
+ function ShowcasePanelsBlockRenderer({ block, containerClassName, imageComponent: Image }) {
169
+ const dims = [];
170
+ const items = [];
171
+ for (const [i, row] of (block.items ?? []).entries()) {
172
+ const image = resolveMedia(row.image);
173
+ if (!image) continue;
174
+ dims.push(image);
175
+ items.push({
176
+ id: row.id ?? String(i),
177
+ title: row.title ?? "",
178
+ summary: row.summary ?? "",
179
+ image: {
180
+ src: image.src,
181
+ alt: image.alt
182
+ },
183
+ ...row.href ? { href: row.href } : {},
184
+ ...row.numeral ? { numeral: row.numeral } : {}
185
+ });
186
+ }
187
+ if (items.length === 0) return null;
188
+ return /* @__PURE__ */ jsx("section", {
189
+ className: cx(containerClassName, "py-16 lg:py-24"),
190
+ children: /* @__PURE__ */ jsx(ShowcasePanelsBlock, {
191
+ items,
192
+ spineVariant: block.spineVariant ?? "numbered",
193
+ defaultActiveIndex: Math.min(Math.max(block.defaultActiveIndex ?? 0, 0), items.length - 1),
194
+ ...block.watermark ? { watermark: block.watermark } : {},
195
+ ...block.ariaLabel ? { ariaLabel: block.ariaLabel } : {},
196
+ ...block.labels?.selected || block.labels?.preview ? { labels: {
197
+ ...block.labels.selected ? { selected: block.labels.selected } : {},
198
+ ...block.labels.preview ? { preview: block.labels.preview } : {}
199
+ } } : {},
200
+ renderImage: (item, i) => /* @__PURE__ */ jsx(Image, {
201
+ src: item.image.src,
202
+ alt: item.image.alt ?? "",
203
+ width: dims[i]?.width,
204
+ height: dims[i]?.height,
205
+ className: "absolute inset-0 h-full w-full object-cover",
206
+ sizes: "(min-width: 1024px) 50vw, 100vw"
207
+ })
208
+ })
209
+ });
210
+ }
211
+ //#endregion
212
+ //#region src/blocks/process-steps/component.tsx
213
+ function ProcessStepsBlockRenderer({ block, containerClassName, imageComponent: Image }) {
214
+ const dims = [];
215
+ const items = [];
216
+ for (const [i, row] of (block.items ?? []).entries()) {
217
+ const image = resolveMedia(row.image);
218
+ if (!image) continue;
219
+ dims.push(image);
220
+ items.push({
221
+ id: row.id ?? String(i),
222
+ title: row.title ?? "",
223
+ description: row.description ?? "",
224
+ image: {
225
+ src: image.src,
226
+ alt: image.alt
227
+ },
228
+ ...typeof row.step === "number" ? { step: row.step } : {}
229
+ });
230
+ }
231
+ if (items.length === 0) return null;
232
+ return /* @__PURE__ */ jsx("section", {
233
+ className: cx(containerClassName, "py-16 lg:py-24"),
234
+ children: /* @__PURE__ */ jsx(ProcessStepsBlock, {
235
+ items,
236
+ autoAdvance: block.autoAdvance ?? true,
237
+ autoAdvanceDuration: block.autoAdvanceDuration ?? 6e3,
238
+ pauseOnHover: block.pauseOnHover ?? true,
239
+ defaultActiveIndex: Math.min(Math.max(block.defaultActiveIndex ?? 0, 0), items.length - 1),
240
+ ...block.ariaLabel ? { ariaLabel: block.ariaLabel } : {},
241
+ ...block.labels?.pause || block.labels?.resume ? { labels: {
242
+ ...block.labels.pause ? { pause: block.labels.pause } : {},
243
+ ...block.labels.resume ? { resume: block.labels.resume } : {}
244
+ } } : {},
245
+ renderImage: (item, i) => /* @__PURE__ */ jsx(Image, {
246
+ src: item.image.src,
247
+ alt: item.image.alt ?? "",
248
+ width: dims[i]?.width,
249
+ height: dims[i]?.height,
250
+ className: "size-full object-cover",
251
+ sizes: "(min-width: 768px) 66vw, 100vw"
252
+ })
253
+ })
254
+ });
255
+ }
256
+ //#endregion
257
+ //#region src/blocks/faq-columns/component.tsx
258
+ function FaqColumnsBlockRenderer({ block, containerClassName }) {
259
+ const items = (block.items ?? []).filter((row) => row.question && row.answer).map((row, i) => ({
260
+ id: row.id ?? String(i),
261
+ question: row.question,
262
+ answer: /* @__PURE__ */ jsx("span", {
263
+ className: "whitespace-pre-line",
264
+ children: row.answer
265
+ })
266
+ }));
267
+ if (items.length === 0) return null;
268
+ const cta = block.cta;
269
+ const hasCta = Boolean(cta?.href && cta?.linkText);
270
+ return /* @__PURE__ */ jsx("section", { children: /* @__PURE__ */ jsx("div", {
271
+ className: cx(containerClassName, "py-16 lg:py-24"),
272
+ children: /* @__PURE__ */ jsx(FAQColumnsBlock, {
273
+ className: "py-0 md:py-0",
274
+ containerClassName: "max-w-none px-0 sm:px-0",
275
+ items,
276
+ title: block.title ?? "",
277
+ ...block.eyebrow ? { eyebrow: block.eyebrow } : {},
278
+ ...block.description ? { description: block.description } : {},
279
+ sticky: block.sticky ?? true,
280
+ type: block.type ?? "single",
281
+ collapsible: block.collapsible ?? true,
282
+ ...hasCta && cta ? { cta: {
283
+ title: cta.title ?? "",
284
+ linkText: cta.linkText,
285
+ href: cta.href,
286
+ newTab: cta.newTab ?? false
287
+ } } : {}
288
+ })
289
+ }) });
290
+ }
291
+ //#endregion
292
+ //#region src/blocks/testimonial-masonry/component.tsx
293
+ function TestimonialMasonryBlockRenderer({ block, containerClassName }) {
294
+ const items = (block.items ?? []).filter((row) => row.content && row.author?.name).map((row, i) => {
295
+ const avatar = resolveMedia(row.author?.avatar);
296
+ return {
297
+ id: row.id ?? String(i),
298
+ content: row.content,
299
+ author: {
300
+ name: row.author?.name,
301
+ ...row.author?.title ? { title: row.author.title } : {},
302
+ ...avatar ? { avatarUrl: avatar.src } : {}
303
+ }
304
+ };
305
+ });
306
+ if (items.length === 0) return null;
307
+ const link = block.link;
308
+ const hasLink = Boolean(link?.href && link?.label);
309
+ return /* @__PURE__ */ jsx("section", {
310
+ className: "bg-accent",
311
+ children: /* @__PURE__ */ jsx("div", {
312
+ className: cx(containerClassName, "py-16 lg:py-24"),
313
+ children: /* @__PURE__ */ jsx(TestimonialMasonry, {
314
+ className: "bg-transparent px-0 lg:px-0",
315
+ containerClassName: "max-w-none px-0 py-0 sm:py-0 md:px-0 md:py-0",
316
+ items,
317
+ title: block.title ?? "",
318
+ ...block.eyebrow ? { eyebrow: block.eyebrow } : {},
319
+ ...block.description ? { description: block.description } : {},
320
+ ...typeof block.minItemsForFade === "number" ? { minItemsForFade: block.minItemsForFade } : {},
321
+ ...typeof block.maxVisibleRows === "number" ? { maxVisibleRows: block.maxVisibleRows } : {},
322
+ ...hasLink && link ? { link: {
323
+ label: link.label,
324
+ href: link.href,
325
+ newTab: link.newTab ?? false
326
+ } } : {}
327
+ })
328
+ })
329
+ });
330
+ }
331
+ //#endregion
332
+ //#region src/blocks/nap/component.tsx
333
+ function NapBlockRenderer({ block, containerClassName }) {
334
+ const address = block.address;
335
+ const departments = (block.departments ?? []).filter((row) => row.name && row.phoneE164).map((row, i) => ({
336
+ id: row.id ?? String(i),
337
+ name: row.name,
338
+ ...row.departmentType ? { type: row.departmentType } : {},
339
+ phone: {
340
+ e164: row.phoneE164,
341
+ ...row.phoneDisplay ? { display: row.phoneDisplay } : {}
342
+ }
343
+ }));
344
+ if (!block.businessName || !address?.streetAddress || departments.length === 0) return null;
345
+ const record = {
346
+ name: block.businessName,
347
+ type: block.businessType ?? "LocalBusiness",
348
+ address: {
349
+ streetAddress: address.streetAddress,
350
+ addressLocality: address.addressLocality ?? "",
351
+ addressRegion: address.addressRegion ?? "",
352
+ postalCode: address.postalCode ?? "",
353
+ ...address.addressCountry ? { addressCountry: address.addressCountry } : {}
354
+ },
355
+ departments,
356
+ ...block.url ? { url: block.url } : {}
357
+ };
358
+ return /* @__PURE__ */ jsx("section", { children: /* @__PURE__ */ jsxs("div", {
359
+ className: cx(containerClassName, "py-16 lg:py-24"),
360
+ children: [/* @__PURE__ */ jsx(NapBlock, {
361
+ record,
362
+ showName: block.showName ?? true,
363
+ headingLevel: block.headingLevel ?? "h2"
364
+ }), block.emitJsonLd === false ? null : /* @__PURE__ */ jsx(JsonLd, { data: record })]
365
+ }) });
366
+ }
367
+ //#endregion
368
+ export { DEFAULT_CONTAINER, DefaultBlockImage, FaqColumnsBlockRenderer, HeroBlockRenderer, NapBlockRenderer, ProcessStepsBlockRenderer, RenderBlocks, ShowcasePanelsBlockRenderer, TestimonialMasonryBlockRenderer };
369
+
370
+ //# sourceMappingURL=react.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.mjs","names":[],"sources":["../src/image.tsx","../src/render-blocks.tsx","../src/media.ts","../src/blocks/hero/component.tsx","../src/blocks/showcase-panels/component.tsx","../src/blocks/process-steps/component.tsx","../src/blocks/faq-columns/component.tsx","../src/blocks/testimonial-masonry/component.tsx","../src/blocks/nap/component.tsx"],"sourcesContent":["import type { ComponentType } from \"react\";\n\n/**\n * The image injection point.\n *\n * The package deliberately does not depend on `next` — a Payload site is not\n * necessarily a Next.js site, and `next/image` needs per-site configuration\n * (`remotePatterns` for the media route) that a package cannot supply. So\n * renderers never construct an image element themselves; they render the\n * component they were handed. A Next site writes one adapter around\n * `next/image` and every block gets optimisation from it.\n *\n * This is a *component type*, not a render function, on purpose: a Server\n * Component may pass a client component reference across the boundary, but not\n * a closure. `imageComponent` therefore survives the trip from a server page\n * into these client renderers, where a `renderImage` callback would not.\n */\n\nexport interface BlockImageProps {\n src: string;\n /** Always a string — see `resolveMedia`. Empty means decorative. */\n alt: string;\n width?: number;\n height?: number;\n className?: string;\n /** Passed through to `next/image`'s `sizes`; ignored by the default. */\n sizes?: string;\n /** Set on the one image above the fold, typically the hero's. */\n priority?: boolean;\n}\n\nexport type BlockImageComponent = ComponentType<BlockImageProps>;\n\n/**\n * The fallback when no `imageComponent` is supplied: a plain `<img>`. Correct\n * everywhere and optimised nowhere, which is the right default for a package\n * that cannot know what framework it landed in.\n */\nexport function DefaultBlockImage({\n src,\n alt,\n width,\n height,\n className,\n sizes,\n priority,\n}: BlockImageProps) {\n return (\n <img\n src={src}\n alt={alt}\n width={width}\n height={height}\n className={className}\n sizes={sizes}\n loading={priority ? \"eager\" : \"lazy\"}\n decoding=\"async\"\n />\n );\n}\n","import type { ComponentType, ReactElement } from \"react\";\n\nimport { type BlockImageComponent, DefaultBlockImage } from \"./image\";\n\n/** The minimum a row must be for the dispatch to place it. */\nexport interface BlockLike {\n blockType: string;\n id?: string | null;\n}\n\n/**\n * What every renderer is handed.\n *\n * The neighbour props let a block adapt to what sits around it: `prevType` to\n * close a seam against the block above, `runIndex` to alternate surfaces across\n * back-to-back blocks of one type, `isLast` because the final block sits\n * against the site footer.\n *\n * `containerClassName` and `imageComponent` are the two things a package block\n * cannot decide for itself — the site's page measure, and how an image gets\n * optimised. Both arrive already defaulted, so a renderer never checks them.\n */\nexport interface BlockRendererProps<B extends BlockLike = BlockLike> {\n block: B;\n /** Position on the page, hero included. */\n index: number;\n /** The type of the block before this one; absent on the first block. */\n prevType?: string;\n /** Position within a run of consecutive same-type blocks, from 0. */\n runIndex: number;\n isLast: boolean;\n /** The site's page measure, for the band wrapper. */\n containerClassName: string;\n /** How this block turns a resolved image into an element. */\n imageComponent: BlockImageComponent;\n}\n\n/**\n * One renderer per block type, each typed to its own block.\n *\n * Written as a mapped type over the union so `hero` gets `HeroBlockData`, not\n * the whole union. A site writes `satisfies BlockRegistryFor<AnyBlock>` where\n * `AnyBlock` comes off its *generated* `Page` type — that is the compile-time\n * layout lock, and it has to stay in the site, because only the site has\n * generated types. The registry is a parameter here for exactly that reason.\n */\nexport type BlockRegistryFor<B extends BlockLike> = {\n [K in B[\"blockType\"]]: ComponentType<\n BlockRendererProps<Extract<B, { blockType: K }>>\n >;\n};\n\n/** Fallback page measure for a site that does not pass its own. */\nexport const DEFAULT_CONTAINER = \"mx-auto w-full max-w-7xl px-6\";\n\ntype LooseRenderer = ComponentType<BlockRendererProps<BlockLike>>;\n\n/**\n * A row saved against a block that has since left the config has no renderer.\n * It is dropped before anything is counted, so its neighbours see each other,\n * not a gap: the block after it gets the real `prevType`, a run of one type is\n * not broken by it, and the block before it is still `isLast` when it ends the\n * page.\n */\nfunction renderable(\n blocks: BlockLike[],\n registry: Record<string, LooseRenderer | undefined>,\n): { block: BlockLike; Renderer: LooseRenderer }[] {\n return blocks.flatMap((block) => {\n const Renderer = registry[block.blockType];\n return Renderer ? [{ block, Renderer }] : [];\n });\n}\n\n/** Position of each block within its run of consecutive same-type blocks. */\nfunction runIndexes(blocks: BlockLike[]): number[] {\n const out: number[] = [];\n for (let i = 0; i < blocks.length; i += 1) {\n out.push(\n i > 0 && blocks[i - 1].blockType === blocks[i].blockType\n ? out[i - 1] + 1\n : 0,\n );\n }\n return out;\n}\n\nexport interface RenderBlocksProps<B extends BlockLike> {\n /** Pass `[...page.hero, ...page.layout]`, so the hero counts as index 0. */\n blocks: B[];\n registry: BlockRegistryFor<B>;\n /** The site's page measure. Defaults to `DEFAULT_CONTAINER`. */\n containerClassName?: string;\n /** Defaults to a plain `<img>`; a Next site passes a `next/image` adapter. */\n imageComponent?: BlockImageComponent;\n}\n\n/**\n * Renders a page's blocks in order through the registry. A Server Component:\n * it only maps and looks up, and each renderer decides its own nature.\n */\nexport function RenderBlocks<B extends BlockLike>({\n blocks,\n registry,\n containerClassName = DEFAULT_CONTAINER,\n imageComponent = DefaultBlockImage,\n}: RenderBlocksProps<B>): ReactElement {\n const rows = renderable(\n blocks,\n // The mapped registry type is per-block, and the dispatch is not; the\n // lookup below is what guarantees each renderer only ever sees its own\n // block type, and no signature can express that to the compiler.\n registry as unknown as Record<string, LooseRenderer | undefined>,\n );\n const runs = runIndexes(rows.map((row) => row.block));\n return (\n <>\n {rows.map(({ block, Renderer }, index) => (\n <Renderer\n key={block.id ?? index}\n block={block}\n index={index}\n prevType={index > 0 ? rows[index - 1].block.blockType : undefined}\n runIndex={runs[index]}\n isLast={index === rows.length - 1}\n containerClassName={containerClassName}\n imageComponent={imageComponent}\n />\n ))}\n </>\n );\n}\n","/**\n * The upload side of the boundary.\n *\n * A Payload upload field holds either the row's id or, once depth resolves it,\n * the whole document. Neither shape can be imported from here: `Media` is\n * generated per site, and this package must never reach for a site's\n * `payload-types`. So the doc is described structurally, and every renderer\n * goes through `resolveMedia` rather than reading `.url` itself.\n */\n\n/**\n * The subset of a Payload upload document a block renderer actually reads.\n * Every site's generated `Media` interface is assignable to this, whatever\n * else it carries.\n *\n * Deliberately no index signature: TypeScript refuses to assign an interface\n * to a type with one, and a site's generated `Media` is always an interface.\n * An index signature here would break exactly the structural match this type\n * exists to provide.\n */\nexport interface MediaDoc {\n url?: string | null;\n alt?: string | null;\n width?: number | null;\n height?: number | null;\n}\n\n/** What an upload field holds before and after `depth` populates it. */\nexport type MediaValue = number | string | MediaDoc | null | undefined;\n\n/** A resolved image, in the shape every `@bison-lab/ui` block asks for. */\nexport interface ResolvedMedia {\n src: string;\n alt: string;\n width?: number;\n height?: number;\n}\n\nfunction isMediaDoc(value: MediaValue): value is MediaDoc {\n return typeof value === \"object\" && value !== null;\n}\n\n/**\n * Narrows an upload value to something renderable, or `undefined`.\n *\n * `undefined` covers three cases a renderer must treat identically: the field\n * is empty, `depth: 0` left it as a bare id, or the document exists but has no\n * `url` yet (an upload mid-flight). A renderer that gets `undefined` omits the\n * image rather than emitting a broken `<img>`.\n *\n * `alt` is always a string: the media collection requires it, but a draft saved\n * before that validation ran can still reach a renderer, and an `alt` of\n * `undefined` would silently drop the attribute entirely.\n */\nexport function resolveMedia(value: MediaValue): ResolvedMedia | undefined {\n if (!isMediaDoc(value)) return undefined;\n const { url, alt, width, height } = value;\n if (typeof url !== \"string\" || url.length === 0) return undefined;\n return {\n src: url,\n alt: typeof alt === \"string\" ? alt : \"\",\n ...(typeof width === \"number\" ? { width } : {}),\n ...(typeof height === \"number\" ? { height } : {}),\n };\n}\n","import { Button } from \"@bison-lab/ui\";\n\nimport { cx } from \"../../cx\";\nimport { resolveMedia } from \"../../media\";\nimport type { BlockRendererProps } from \"../../render-blocks\";\nimport type { HeroBlockData } from \"../../types\";\n\n/**\n * How each tone paints. Semantic tokens only — a site's brand reaches these\n * through its theme, never through a class named here.\n */\nconst TONES = {\n sweep: \"bg-primary text-primary-foreground\",\n dark: \"bg-foreground text-background\",\n light: \"bg-background text-foreground\",\n} as const;\n\n/**\n * The package's hero: deliberately plain.\n *\n * A hero is where a site's brand is loudest, so this exists to make a page\n * render at all, not to be the final answer. A site overrides this one registry\n * entry with its own and keeps every other block.\n */\nexport function HeroBlockRenderer({\n block,\n index,\n containerClassName,\n imageComponent: Image,\n}: BlockRendererProps<HeroBlockData>) {\n const image = resolveMedia(block.image);\n const links = (block.links ?? []).filter((link) => link.href && link.label);\n const tone = TONES[block.tone ?? \"sweep\"];\n\n return (\n <section className={cx(\"relative isolate overflow-hidden\", tone)}>\n {image ? (\n <div className=\"absolute inset-0 -z-10 opacity-25\">\n <Image\n src={image.src}\n alt=\"\"\n width={image.width}\n height={image.height}\n className=\"h-full w-full object-cover\"\n sizes=\"100vw\"\n // The hero is the page's LCP element whenever it opens the page.\n priority={index === 0}\n />\n </div>\n ) : null}\n <div className={cx(containerClassName, \"py-20 lg:py-28\")}>\n <div className=\"max-w-3xl\">\n {block.eyebrow ? (\n <p className=\"text-sm font-semibold tracking-widest uppercase opacity-80\">\n {block.eyebrow}\n </p>\n ) : null}\n <h1 className=\"mt-3 text-4xl font-bold tracking-tight text-balance lg:text-5xl\">\n {block.heading}\n </h1>\n {block.body ? (\n <p className=\"mt-6 max-w-2xl text-lg leading-relaxed opacity-90\">\n {block.body}\n </p>\n ) : null}\n {links.length > 0 ? (\n <div className=\"mt-8 flex flex-wrap gap-3\">\n {links.map((link, i) => (\n <Button\n key={`${link.href}-${i}`}\n asChild\n variant={i === 0 ? \"default\" : \"outline\"}\n >\n <a\n href={link.href as string}\n {...(link.newTab\n ? { target: \"_blank\", rel: \"noreferrer noopener\" }\n : {})}\n >\n {link.label}\n </a>\n </Button>\n ))}\n </div>\n ) : null}\n </div>\n </div>\n </section>\n );\n}\n","import { ShowcasePanelsBlock, type ShowcasePanelItem } from \"@bison-lab/ui\";\n\nimport { cx } from \"../../cx\";\nimport { resolveMedia, type ResolvedMedia } from \"../../media\";\nimport type { BlockRendererProps } from \"../../render-blocks\";\nimport type { ShowcasePanelsBlockData } from \"../../types\";\n\nexport function ShowcasePanelsBlockRenderer({\n block,\n containerClassName,\n imageComponent: Image,\n}: BlockRendererProps<ShowcasePanelsBlockData>) {\n // A panel without a picture has nothing to expand into, so a row whose\n // upload has not resolved is dropped rather than rendered empty. `dims`\n // stays index-aligned with `items` so the image callback can reach the\n // width and height the library's own prop shape has no room for.\n const dims: ResolvedMedia[] = [];\n const items: ShowcasePanelItem[] = [];\n for (const [i, row] of (block.items ?? []).entries()) {\n const image = resolveMedia(row.image);\n if (!image) continue;\n dims.push(image);\n items.push({\n id: row.id ?? String(i),\n title: row.title ?? \"\",\n summary: row.summary ?? \"\",\n image: { src: image.src, alt: image.alt },\n ...(row.href ? { href: row.href } : {}),\n ...(row.numeral ? { numeral: row.numeral } : {}),\n });\n }\n if (items.length === 0) return null;\n\n return (\n <section className={cx(containerClassName, \"py-16 lg:py-24\")}>\n <ShowcasePanelsBlock\n items={items}\n spineVariant={block.spineVariant ?? \"numbered\"}\n defaultActiveIndex={Math.min(\n Math.max(block.defaultActiveIndex ?? 0, 0),\n items.length - 1,\n )}\n {...(block.watermark ? { watermark: block.watermark } : {})}\n {...(block.ariaLabel ? { ariaLabel: block.ariaLabel } : {})}\n {...(block.labels?.selected || block.labels?.preview\n ? {\n labels: {\n ...(block.labels.selected\n ? { selected: block.labels.selected }\n : {}),\n ...(block.labels.preview\n ? { preview: block.labels.preview }\n : {}),\n },\n }\n : {})}\n renderImage={(item, i) => (\n <Image\n src={item.image.src}\n alt={item.image.alt ?? \"\"}\n width={dims[i]?.width}\n height={dims[i]?.height}\n className=\"absolute inset-0 h-full w-full object-cover\"\n sizes=\"(min-width: 1024px) 50vw, 100vw\"\n />\n )}\n />\n </section>\n );\n}\n","import { ProcessStepsBlock, type ProcessStepItem } from \"@bison-lab/ui\";\n\nimport { cx } from \"../../cx\";\nimport { resolveMedia, type ResolvedMedia } from \"../../media\";\nimport type { BlockRendererProps } from \"../../render-blocks\";\nimport type { ProcessStepsBlockData } from \"../../types\";\n\nexport function ProcessStepsBlockRenderer({\n block,\n containerClassName,\n imageComponent: Image,\n}: BlockRendererProps<ProcessStepsBlockData>) {\n // Same rule as the showcase panels: a step is its picture, so an unresolved\n // upload drops the row instead of rendering a hole in the rail.\n const dims: ResolvedMedia[] = [];\n const items: ProcessStepItem[] = [];\n for (const [i, row] of (block.items ?? []).entries()) {\n const image = resolveMedia(row.image);\n if (!image) continue;\n dims.push(image);\n items.push({\n id: row.id ?? String(i),\n title: row.title ?? \"\",\n description: row.description ?? \"\",\n image: { src: image.src, alt: image.alt },\n ...(typeof row.step === \"number\" ? { step: row.step } : {}),\n });\n }\n if (items.length === 0) return null;\n\n return (\n <section className={cx(containerClassName, \"py-16 lg:py-24\")}>\n <ProcessStepsBlock\n items={items}\n autoAdvance={block.autoAdvance ?? true}\n autoAdvanceDuration={block.autoAdvanceDuration ?? 6000}\n pauseOnHover={block.pauseOnHover ?? true}\n defaultActiveIndex={Math.min(\n Math.max(block.defaultActiveIndex ?? 0, 0),\n items.length - 1,\n )}\n {...(block.ariaLabel ? { ariaLabel: block.ariaLabel } : {})}\n {...(block.labels?.pause || block.labels?.resume\n ? {\n labels: {\n ...(block.labels.pause ? { pause: block.labels.pause } : {}),\n ...(block.labels.resume ? { resume: block.labels.resume } : {}),\n },\n }\n : {})}\n renderImage={(item, i) => (\n <Image\n src={item.image.src}\n alt={item.image.alt ?? \"\"}\n width={dims[i]?.width}\n height={dims[i]?.height}\n className=\"size-full object-cover\"\n sizes=\"(min-width: 768px) 66vw, 100vw\"\n />\n )}\n />\n </section>\n );\n}\n","import { FAQColumnsBlock, type FAQItem } from \"@bison-lab/ui\";\n\nimport { cx } from \"../../cx\";\nimport type { BlockRendererProps } from \"../../render-blocks\";\nimport type { FaqColumnsBlockData } from \"../../types\";\n\nexport function FaqColumnsBlockRenderer({\n block,\n containerClassName,\n}: BlockRendererProps<FaqColumnsBlockData>) {\n const items: FAQItem[] = (block.items ?? [])\n .filter((row) => row.question && row.answer)\n .map((row, i) => ({\n id: row.id ?? String(i),\n question: row.question as string,\n // The field is a textarea, so blank lines are the editor's paragraph\n // breaks and have to survive into the DOM.\n answer: <span className=\"whitespace-pre-line\">{row.answer}</span>,\n }));\n if (items.length === 0) return null;\n\n const cta = block.cta;\n const hasCta = Boolean(cta?.href && cta?.linkText);\n\n return (\n <section>\n <div className={cx(containerClassName, \"py-16 lg:py-24\")}>\n <FAQColumnsBlock\n // The site measure is on the wrapper above; the block's own\n // container and vertical rhythm are reset so they cannot fight it.\n className=\"py-0 md:py-0\"\n containerClassName=\"max-w-none px-0 sm:px-0\"\n items={items}\n title={block.title ?? \"\"}\n {...(block.eyebrow ? { eyebrow: block.eyebrow } : {})}\n {...(block.description ? { description: block.description } : {})}\n sticky={block.sticky ?? true}\n type={block.type ?? \"single\"}\n collapsible={block.collapsible ?? true}\n {...(hasCta && cta\n ? {\n cta: {\n title: cta.title ?? \"\",\n linkText: cta.linkText as string,\n href: cta.href as string,\n newTab: cta.newTab ?? false,\n },\n }\n : {})}\n />\n </div>\n </section>\n );\n}\n","import { TestimonialMasonry, type TestimonialItem } from \"@bison-lab/ui\";\n\nimport { cx } from \"../../cx\";\nimport { resolveMedia } from \"../../media\";\nimport type { BlockRendererProps } from \"../../render-blocks\";\nimport type { TestimonialMasonryBlockData } from \"../../types\";\n\nexport function TestimonialMasonryBlockRenderer({\n block,\n containerClassName,\n}: BlockRendererProps<TestimonialMasonryBlockData>) {\n const items: TestimonialItem[] = (block.items ?? [])\n .filter((row) => row.content && row.author?.name)\n .map((row, i) => {\n const avatar = resolveMedia(row.author?.avatar);\n return {\n id: row.id ?? String(i),\n content: row.content as string,\n author: {\n name: row.author?.name as string,\n ...(row.author?.title ? { title: row.author.title } : {}),\n // The library falls back to initials when this is absent, which is\n // why an unresolved upload must not become an empty string.\n ...(avatar ? { avatarUrl: avatar.src } : {}),\n },\n };\n });\n if (items.length === 0) return null;\n\n const link = block.link;\n const hasLink = Boolean(link?.href && link?.label);\n\n return (\n // The band's surface is full-bleed; only its contents sit at the measure.\n <section className=\"bg-accent\">\n <div className={cx(containerClassName, \"py-16 lg:py-24\")}>\n <TestimonialMasonry\n className=\"bg-transparent px-0 lg:px-0\"\n containerClassName=\"max-w-none px-0 py-0 sm:py-0 md:px-0 md:py-0\"\n items={items}\n title={block.title ?? \"\"}\n {...(block.eyebrow ? { eyebrow: block.eyebrow } : {})}\n {...(block.description ? { description: block.description } : {})}\n {...(typeof block.minItemsForFade === \"number\"\n ? { minItemsForFade: block.minItemsForFade }\n : {})}\n {...(typeof block.maxVisibleRows === \"number\"\n ? { maxVisibleRows: block.maxVisibleRows }\n : {})}\n {...(hasLink && link\n ? {\n link: {\n label: link.label as string,\n href: link.href as string,\n newTab: link.newTab ?? false,\n },\n }\n : {})}\n />\n </div>\n </section>\n );\n}\n","import {\n JsonLd,\n NapBlock,\n type NapDepartment,\n type NapRecord,\n} from \"@bison-lab/ui\";\n\nimport { cx } from \"../../cx\";\nimport type { BlockRendererProps } from \"../../render-blocks\";\nimport type { NapBlockData } from \"../../types\";\n\nexport function NapBlockRenderer({\n block,\n containerClassName,\n}: BlockRendererProps<NapBlockData>) {\n const address = block.address;\n const departments: NapDepartment[] = (block.departments ?? [])\n // `phoneE164` is what becomes the `tel:` href and the structured data's\n // `telephone`, so a department without one is not publishable as a NAP\n // entry at all — dropping it beats emitting an unreachable number.\n .filter((row) => row.name && row.phoneE164)\n .map((row, i) => ({\n id: row.id ?? String(i),\n name: row.name as string,\n ...(row.departmentType ? { type: row.departmentType } : {}),\n phone: {\n e164: row.phoneE164 as string,\n ...(row.phoneDisplay ? { display: row.phoneDisplay } : {}),\n },\n }));\n\n if (!block.businessName || !address?.streetAddress || departments.length === 0)\n return null;\n\n const record: NapRecord = {\n name: block.businessName,\n type: block.businessType ?? \"LocalBusiness\",\n address: {\n streetAddress: address.streetAddress,\n addressLocality: address.addressLocality ?? \"\",\n addressRegion: address.addressRegion ?? \"\",\n postalCode: address.postalCode ?? \"\",\n ...(address.addressCountry\n ? { addressCountry: address.addressCountry }\n : {}),\n },\n departments,\n ...(block.url ? { url: block.url } : {}),\n };\n\n return (\n <section>\n <div className={cx(containerClassName, \"py-16 lg:py-24\")}>\n <NapBlock\n record={record}\n showName={block.showName ?? true}\n headingLevel={block.headingLevel ?? \"h2\"}\n />\n {block.emitJsonLd === false ? null : <JsonLd data={record} />}\n </div>\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;AAsCA,SAAgB,kBAAkB,EAChC,KACA,KACA,OACA,QACA,WACA,OACA,YACkB;AAClB,QACE,oBAAC,OAAD;EACO;EACA;EACE;EACC;EACG;EACJ;EACP,SAAS,WAAW,UAAU;EAC9B,UAAS;EACT,CAAA;;;;;ACJN,MAAa,oBAAoB;;;;;;;;AAWjC,SAAS,WACP,QACA,UACiD;AACjD,QAAO,OAAO,SAAS,UAAU;EAC/B,MAAM,WAAW,SAAS,MAAM;AAChC,SAAO,WAAW,CAAC;GAAE;GAAO;GAAU,CAAC,GAAG,EAAE;GAC5C;;;AAIJ,SAAS,WAAW,QAA+B;CACjD,MAAM,MAAgB,EAAE;AACxB,MAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK,EACtC,KAAI,KACF,IAAI,KAAK,OAAO,IAAI,GAAG,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AiB,QAAQ,mBAAmB;GAC5C,eAAe,QAAQ,iBAAiB;GACxC,YAAY,QAAQ,cAAc;GAClC,GAAI,QAAQ,iBACR,EAAE,gBAAgB,QAAQ,gBAAgB,GAC1C,EAAE;GACP;EACD;EACA,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,KAAK,GAAG,EAAE;EACxC;AAED,QACE,oBAAC,WAAD,EAAA,UACE,qBAAC,OAAD;EAAK,WAAW,GAAG,oBAAoB,iBAAiB;YAAxD,CACE,oBAAC,UAAD;GACU;GACR,UAAU,MAAM,YAAY;GAC5B,cAAc,MAAM,gBAAgB;GACpC,CAAA,EACD,MAAM,eAAe,QAAQ,OAAO,oBAAC,QAAD,EAAQ,MAAM,QAAU,CAAA,CACzD;KACE,CAAA"}
@@ -0,0 +1,24 @@
1
+
2
+ import { a as RichTextBlockData, u as BlockRendererProps } from "./types-BvRvDCDT.mjs";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
+
5
+ //#region src/blocks/rich-text/component.d.ts
6
+ /**
7
+ * A Lexical document as prose.
8
+ *
9
+ * This is the one renderer that needs `@payloadcms/richtext-lexical`, which is
10
+ * why it ships from its own entry (`@bison-lab/payload-blocks/rich-text`)
11
+ * rather than the `./react` barrel every consumer loads.
12
+ *
13
+ * The cast at the boundary is the price of the package's no-generated-types
14
+ * rule: `RichTextContent` describes the document structurally so a site's
15
+ * generated block type matches it, and Lexical's own type is the same shape
16
+ * with tighter unions.
17
+ */
18
+ declare function RichTextBlockRenderer({
19
+ block,
20
+ containerClassName
21
+ }: BlockRendererProps<RichTextBlockData>): react_jsx_runtime0.JSX.Element | null;
22
+ //#endregion
23
+ export { RichTextBlockRenderer };
24
+ //# sourceMappingURL=rich-text.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rich-text.d.mts","names":[],"sources":["../src/blocks/rich-text/component.tsx"],"mappings":";;;;;;;AAmBA;;;;;;;;;;iBAAgB,qBAAA,CAAA;EACd,KAAA;EACA;AAAA,GACC,kBAAA,CAAmB,iBAAA,IAAkB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ import { t as cx } from "./cx-BKHSv3xT.mjs";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { RichText } from "@payloadcms/richtext-lexical/react";
5
+ //#region src/blocks/rich-text/component.tsx
6
+ /**
7
+ * A Lexical document as prose.
8
+ *
9
+ * This is the one renderer that needs `@payloadcms/richtext-lexical`, which is
10
+ * why it ships from its own entry (`@bison-lab/payload-blocks/rich-text`)
11
+ * rather than the `./react` barrel every consumer loads.
12
+ *
13
+ * The cast at the boundary is the price of the package's no-generated-types
14
+ * rule: `RichTextContent` describes the document structurally so a site's
15
+ * generated block type matches it, and Lexical's own type is the same shape
16
+ * with tighter unions.
17
+ */
18
+ function RichTextBlockRenderer({ block, containerClassName }) {
19
+ if (!block.content) return null;
20
+ return /* @__PURE__ */ jsx("section", {
21
+ className: cx(containerClassName, "py-16 lg:py-20"),
22
+ children: /* @__PURE__ */ jsx(RichText, {
23
+ data: block.content,
24
+ className: "max-w-prose"
25
+ })
26
+ });
27
+ }
28
+ //#endregion
29
+ export { RichTextBlockRenderer };
30
+
31
+ //# sourceMappingURL=rich-text.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rich-text.mjs","names":[],"sources":["../src/blocks/rich-text/component.tsx"],"sourcesContent":["import { RichText } from \"@payloadcms/richtext-lexical/react\";\nimport type { SerializedEditorState } from \"@payloadcms/richtext-lexical/lexical\";\n\nimport { cx } from \"../../cx\";\nimport type { BlockRendererProps } from \"../../render-blocks\";\nimport type { RichTextBlockData } from \"../../types\";\n\n/**\n * A Lexical document as prose.\n *\n * This is the one renderer that needs `@payloadcms/richtext-lexical`, which is\n * why it ships from its own entry (`@bison-lab/payload-blocks/rich-text`)\n * rather than the `./react` barrel every consumer loads.\n *\n * The cast at the boundary is the price of the package's no-generated-types\n * rule: `RichTextContent` describes the document structurally so a site's\n * generated block type matches it, and Lexical's own type is the same shape\n * with tighter unions.\n */\nexport function RichTextBlockRenderer({\n block,\n containerClassName,\n}: BlockRendererProps<RichTextBlockData>) {\n if (!block.content) return null;\n return (\n <section className={cx(containerClassName, \"py-16 lg:py-20\")}>\n <RichText\n data={block.content as unknown as SerializedEditorState}\n className=\"max-w-prose\"\n />\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,SAAgB,sBAAsB,EACpC,OACA,sBACwC;AACxC,KAAI,CAAC,MAAM,QAAS,QAAO;AAC3B,QACE,oBAAC,WAAD;EAAS,WAAW,GAAG,oBAAoB,iBAAiB;YAC1D,oBAAC,UAAD;GACE,MAAM,MAAM;GACZ,WAAU;GACV,CAAA;EACM,CAAA"}