@bison-lab/payload-blocks 3.21.0 → 3.23.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":"header-CTMSB4C0.mjs","names":[],"sources":["../src/fields/link.ts","../src/blocks/mega-menu/component.tsx","../src/blocks/mega-menu/header.tsx"],"sourcesContent":["import type { Condition, Field, GroupField, RowField } from \"payload\";\n\n/**\n * The import-map path of the link picker, `LinkField` in\n * `@bison-lab/payload-blocks/admin`.\n *\n * It sits on the row that holds a link's `type`, `page` and `href`, and\n * replaces those three inputs with one box: type to search published pages,\n * or paste a URL. Referenced here by package specifier, like\n * `MIN_ROWS_ARRAY_FIELD`; a site picks it up with `payload generate:importmap`.\n * Until it does, Payload logs the missing entry and renders the row as\n * nothing (a custom `Field` with no component behind it is an empty element,\n * not the stock fields), so the step is part of adopting this release.\n */\nexport const LINK_FIELD = \"@bison-lab/payload-blocks/admin#LinkField\";\n\nexport type LinkType = \"page\" | \"external\";\n\n/**\n * A page as the `page` relationship populates it: what `resolveLink` reads,\n * and what the picker shows. A site's generated `Page` is assignable to it.\n * `_status` is absent on a collection without drafts, which counts as\n * published.\n */\nexport interface LinkPageDoc {\n id: number | string;\n title?: string | null;\n slug?: string | null;\n _status?: (\"draft\" | \"published\") | null;\n}\n\n/** Where a link goes: the three fields the picker writes. */\nexport interface LinkDestination {\n /** `page` unless the editor pasted a URL. Rows saved before links had a type carry only `href`. */\n type?: LinkType | null;\n /** The page's id, or the page itself once a `depth >= 1` read populates it. */\n page?: LinkPageDoc | number | string | null;\n /** The pasted URL of an external link. */\n href?: string | null;\n}\n\n/** The shape `linkField`/`linkFields` produce once Payload generates types. */\nexport interface LinkValue extends LinkDestination {\n enabled?: boolean | null;\n label?: string | null;\n newTab?: boolean | null;\n}\n\n/**\n * Turns a link's destination into the `href` a renderer emits, or `null`\n * when there is nothing to point at, in which case the renderer shows the\n * label as text. A site passes its own (`RenderBlocks`' `resolveLink`) when\n * a page's path is not `/<slug>`: the package has no way to know a site's\n * routes, the same reason it takes an `imageComponent`.\n */\nexport type ResolveLink = (link: LinkDestination) => string | null;\n\n/**\n * The package's resolver: a published, populated page is `/<slug>`; an\n * external link is its `href` as typed.\n *\n * A page that did not populate is `null`: Payload hands the public read the\n * bare id when the reader may not see the page, which is what an unpublished\n * page looks like from the site. A populated page whose `_status` is `draft`\n * is `null` too, for a read that can see drafts. A row from before links had\n * a `type` is an external link by `linkTypeOf`, here, in the stock fields'\n * conditions and in the picker alike: the site keeps rendering its `href`,\n * the admin shows it as an External chip, and the site's migration to\n * `type: external` only makes the stored row say what every reader already\n * assumes.\n */\nexport function resolveLink(\n link: LinkDestination | null | undefined,\n): string | null {\n if (!link) return null;\n if (linkTypeOf(link) === \"page\") {\n const page = link.page;\n if (!page || typeof page !== \"object\") return null;\n if (page._status === \"draft\") return null;\n return page.slug ? `/${page.slug}` : null;\n }\n return link.href ? link.href : null;\n}\n\n/**\n * Preview resolver for the Header items kit. `LinkField` stores a page as\n * its id; the public `resolveLink` treats that as unpublished. The editor\n * looks the id up (or uses a populated draft) so the sticky bar still\n * shows the destination the picker chose.\n */\nexport function resolveAdminPreviewLink(\n link: LinkDestination | null | undefined,\n pages: ReadonlyMap<string, LinkPageDoc>,\n): string | null {\n const live = resolveLink(link);\n if (live) return live;\n if (!link || linkTypeOf(link) !== \"page\") return null;\n const page = link.page;\n if (page && typeof page === \"object\") {\n return page.slug ? `/${page.slug}` : null;\n }\n if (page == null) return null;\n const doc = pages.get(String(page));\n return doc?.slug ? `/${doc.slug}` : null;\n}\n\n/**\n * Which of the two stored destinations a row is using. `type` decides; a row\n * with no `type` yet (saved before links had one) is read by what it holds,\n * an `href` making it external, the same reading `resolveLink` and the picker\n * make, so all three agree on every row.\n */\nexport function linkTypeOf(link: LinkDestination | null | undefined): LinkType {\n if (link?.type === \"external\") return \"external\";\n if (link?.type === \"page\") return \"page\";\n return link?.href ? \"external\" : \"page\";\n}\n\nconst whenPage: Condition = (_data, siblingData) =>\n linkTypeOf(siblingData as LinkDestination) === \"page\";\n\nconst whenExternal: Condition = (_data, siblingData) =>\n linkTypeOf(siblingData as LinkDestination) === \"external\";\n\nexport interface LinkDestinationOptions {\n /** Require a destination. Defaults to `false`. */\n required?: boolean;\n /** The collection a page link points into. Defaults to `pages`. */\n pagesCollection?: string;\n}\n\n/**\n * Where a link goes, as stored: `type`, `page` and `href` in one row.\n *\n * The row carries the picker (`LINK_FIELD`), which replaces all three inputs\n * with one box. The stored fields are the website template's shape and stay\n * editable on their own: `page` shows for a page link, `href` for an external\n * one, and `required` binds whichever is active, since Payload skips\n * validation on a field whose condition is false. `page` offers published\n * rows only, and Payload re-checks that on publish, so a page that was\n * unpublished after being picked has to be picked again or republished.\n */\nexport function linkDestinationFields({\n required = false,\n pagesCollection = \"pages\",\n}: LinkDestinationOptions = {}): RowField[] {\n return [\n {\n type: \"row\",\n admin: { components: { Field: LINK_FIELD } },\n fields: [\n {\n name: \"type\",\n type: \"radio\",\n label: \"Goes to\",\n defaultValue: \"page\",\n options: [\n { label: \"Page\", value: \"page\" },\n { label: \"URL\", value: \"external\" },\n ],\n admin: { layout: \"horizontal\" },\n },\n {\n name: \"page\",\n type: \"relationship\",\n relationTo: pagesCollection,\n required,\n filterOptions: { _status: { equals: \"published\" } },\n admin: { condition: whenPage },\n },\n {\n name: \"href\",\n type: \"text\",\n label: \"URL\",\n required,\n admin: {\n condition: whenExternal,\n description:\n 'A full URL (\"https://example.com\"), \"mailto:\" or \"tel:\", or a site path (\"/contact\").',\n },\n },\n ],\n },\n ];\n}\n\nexport interface LinkFieldsOptions extends LinkDestinationOptions {\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 fields a call to action is made of, unwrapped: the destination row,\n * then the label and the new-tab flag.\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 pagesCollection,\n}: LinkFieldsOptions = {}): Field[] {\n return [\n ...linkDestinationFields({ required, pagesCollection }),\n { name: \"label\", type: \"text\", label: labelFieldLabel, required },\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","import {\n MegaMenuPanel,\n type MegaMenuColumn,\n type MegaMenuIcons,\n type MegaMenuLink,\n type MegaMenuPanelData,\n type MegaMenuSection,\n type MegaMenuMaxWidth,\n type MegaMenuVariants,\n type MegaMenuWidth,\n} from \"@bison-lab/ui\";\n\nimport { resolveLink, type LinkValue, type ResolveLink } from \"../../fields/link\";\nimport { renderLinkWith } from \"../../link\";\nimport type { BlockRendererProps } from \"../../render-blocks\";\nimport type { MegaMenuBlockData, MegaMenuLinkData } from \"../../types\";\n\n/**\n * A menu link needs both halves. Unlike a call to action, a link whose page\n * is missing or unpublished is dropped rather than shown as text: a menu\n * item that goes nowhere is worse than one fewer item.\n */\nfunction completeLink(\n row: MegaMenuLinkData,\n resolve: ResolveLink,\n): MegaMenuLink | null {\n const href = resolve(row);\n if (!row.label || !href) return null;\n return {\n label: row.label,\n href,\n ...(row.description ? { description: row.description } : {}),\n ...(row.variant ? { variant: row.variant } : {}),\n ...(row.icon ? { icon: row.icon } : {}),\n ...(row.newTab ? { newTab: true } : {}),\n };\n}\n\n/**\n * The row as `MegaMenuPanel` data, or `null` when there is nothing to open:\n * no columns, or columns whose links are not yet complete. Draft saves skip\n * validation, so a live preview genuinely hands this half-built rows.\n * `resolve` turns each link's page into a path; the package's own is the\n * default.\n */\nexport function megaMenuPanelFromRow(\n row: MegaMenuBlockData,\n resolve: ResolveLink = resolveLink,\n defaultMaxWidth: MegaMenuMaxWidth = \"standard\",\n): MegaMenuPanelData | null {\n const panel = row.panel;\n if (!panel?.columns?.length) return null;\n const columns: MegaMenuColumn[] = [];\n for (const column of panel.columns) {\n const sections: MegaMenuSection[] = [];\n for (const section of column.sections ?? []) {\n const links = (section.links ?? [])\n .map((link) => completeLink(link, resolve))\n .filter((link): link is MegaMenuLink => link !== null);\n if (!links.length) continue;\n sections.push({\n ...(section.eyebrow ? { eyebrow: section.eyebrow } : {}),\n display: section.display ?? \"list\",\n hideDescriptionsOnMobile: section.hideDescriptionsOnMobile ?? true,\n links,\n });\n }\n columns.push({\n width: Number(column.width ?? \"100\") as MegaMenuWidth,\n ...(column.divider ? { divider: true } : {}),\n sections,\n });\n }\n if (!columns.some((column) => column.sections.length)) return null;\n\n const overview = footerLink(panel.footer?.overview, resolve);\n const cta = footerLink(panel.footer?.cta, resolve);\n return {\n maxWidth: panel.maxWidth ?? defaultMaxWidth,\n columns,\n footer: {\n ...(overview ? { overview } : {}),\n ...(cta ? { cta } : {}),\n },\n };\n}\n\n/** A footer link, complete, or nothing: same rule as `completeLink`. */\nfunction footerLink(\n row: LinkValue | undefined,\n resolve: ResolveLink,\n): { label: string; href: string; newTab?: true } | null {\n const href = row ? resolve(row) : null;\n if (!row?.label || !href) return null;\n return {\n label: row.label,\n href,\n ...(row.newTab ? { newTab: true } : {}),\n };\n}\n\nexport interface MegaMenuBlockRendererProps\n extends BlockRendererProps<MegaMenuBlockData> {\n /** The look behind each `variants` value the site passed to `megaMenuBlock`. */\n variants?: MegaMenuVariants;\n /** The glyph behind each `icons` value the site passed to `megaMenuBlock`. */\n icons?: MegaMenuIcons;\n}\n\n/**\n * One panel, standing alone: what a live preview shows while the row is being\n * edited. A whole header goes through `headerItemsFromBlocks` instead.\n */\nexport function MegaMenuBlockRenderer({\n block,\n linkComponent,\n resolveLink: resolve,\n variants,\n icons,\n}: MegaMenuBlockRendererProps) {\n const panel = megaMenuPanelFromRow(block, resolve);\n if (!panel) return null;\n return (\n <MegaMenuPanel\n {...panel}\n variants={variants}\n icons={icons}\n renderLink={renderLinkWith(linkComponent)}\n />\n );\n}\n","import {\n megaMenuToFloatingNavItems,\n type FloatingNavItem,\n type MegaMenuIcons,\n type MegaMenuItem,\n type MegaMenuMaxWidth,\n type MegaMenuVariants,\n} from \"@bison-lab/ui\";\n\nimport type { ReactNode } from \"react\";\n\nimport { resolveLink, type LinkValue, type ResolveLink } from \"../../fields/link\";\nimport { newTabAttributes, renderLinkWith, type BlockLinkComponent } from \"../../link\";\nimport type { MegaMenuBlockData, NavigationSettingsData, NavLinkBlockData } from \"../../types\";\nimport { megaMenuPanelFromRow } from \"./component\";\n\n/** A row of a header global's `items`: either block, or whatever else a site added. */\nexport type HeaderBlockRow = MegaMenuBlockData | NavLinkBlockData;\n\nexport interface HeaderItemsOptions {\n variants?: MegaMenuVariants;\n icons?: MegaMenuIcons;\n /** Marks the current section; receives each item's `href`. */\n isActive?: (href: string) => boolean;\n /** The site's link adapter, applied to every link inside the panels. */\n linkComponent?: BlockLinkComponent;\n /** The site's resolver for page links; defaults to the package's `resolveLink`. */\n resolveLink?: ResolveLink;\n /** Fallback panel width when a mega menu row does not set `panel.maxWidth`. */\n defaultMaxWidth?: MegaMenuMaxWidth;\n}\n\n/** The Header global (or `getNavigation`'s `{ header, bar }`) as this helper reads it. */\nexport interface HeaderNavigationDoc {\n header?: { items?: unknown; cta?: LinkValue | null } | null;\n bar?: NavigationSettingsData | null;\n}\n\nexport interface HeaderFromNavigationOptions {\n icons?: MegaMenuIcons;\n isActive?: (href: string) => boolean;\n linkComponent?: BlockLinkComponent;\n /**\n * Featured-link looks from chrome roles (`megaMenuVariantsFromLooks`),\n * not a variants array on Header.\n */\n looks?: MegaMenuVariants;\n resolveLink?: ResolveLink;\n /** Holds the named item's panel open — a CMS live preview of the edited row. */\n openItem?: string;\n}\n\nexport interface HeaderFromNavigationProps {\n items: FloatingNavItem[];\n actions?: ReactNode;\n breakpoint: \"lg\";\n hideOnScroll: boolean;\n viewport: boolean;\n openItem?: string;\n}\n\n/**\n * A global's `items` as `FloatingNavBlock` items, so a site's header is one\n * call. Rows the bar cannot show are dropped rather than rendered broken: a\n * row with no label, a mega menu with nothing to open, and any block type a\n * site added that this package does not know.\n *\n * A `navLink` row's `newTab` is not carried: `FloatingNavItem` has no such\n * field, because the bar renders its own links. A bar item whose page is\n * missing or unpublished is dropped, like a panel link. A mega menu's\n * landing page goes through the same resolver: unpublished or missing\n * pages omit the trigger `href` and keep the panel.\n */\nexport function headerItemsFromBlocks(\n blocks: HeaderBlockRow[],\n {\n variants,\n icons,\n isActive,\n linkComponent,\n resolveLink: resolve = resolveLink,\n defaultMaxWidth = \"standard\",\n }: HeaderItemsOptions = {},\n): FloatingNavItem[] {\n const items: MegaMenuItem[] = [];\n for (const row of blocks) {\n if (!row.label) continue;\n if (row.blockType === \"navLink\") {\n const href = resolve(row);\n if (!href) continue;\n items.push({ label: row.label, href });\n } else if (row.blockType === \"megaMenu\") {\n const panel = megaMenuPanelFromRow(row, resolve, defaultMaxWidth);\n if (!panel) continue;\n const href = resolve(row);\n items.push({\n label: row.label,\n ...(href ? { href } : {}),\n panel,\n });\n }\n }\n return megaMenuToFloatingNavItems(\n { items },\n {\n isActive,\n variants,\n icons,\n ...(linkComponent ? { renderLink: renderLinkWith(linkComponent) } : {}),\n },\n );\n}\n\n/**\n * The Header global as `FloatingNavBlock` props: items through\n * `headerItemsFromBlocks`, `breakpoint: \"lg\"`, and bar behaviour from\n * the hidden `bar` group. Looks come from chrome roles (`looks`), not a\n * Header array. A site without the consume bump (SPI-99) never reads\n * these fields.\n */\nexport function headerFromNavigation(\n doc: HeaderNavigationDoc,\n {\n icons,\n isActive,\n linkComponent,\n looks,\n resolveLink: resolve,\n openItem,\n }: HeaderFromNavigationOptions = {},\n): HeaderFromNavigationProps {\n const raw = doc.header?.items;\n const items = Array.isArray(raw) ? (raw as HeaderBlockRow[]) : [];\n const defaultMaxWidth = doc.bar?.defaultMaxWidth ?? \"standard\";\n const resolveFn = resolve ?? resolveLink;\n const cta = doc.header?.cta;\n const ctaOn = cta?.enabled !== false;\n const ctaHref = ctaOn && cta ? resolveFn(cta) : null;\n const link = linkComponent ? renderLinkWith(linkComponent) : undefined;\n const tab = newTabAttributes(cta?.newTab);\n const actions =\n ctaOn && ctaHref && cta?.label\n ? link\n ? link({ href: ctaHref, children: cta.label, ...tab })\n : <a href={ctaHref} {...tab}>{cta.label}</a>\n : undefined;\n return {\n items: headerItemsFromBlocks(items, {\n variants: looks,\n icons,\n isActive,\n linkComponent,\n resolveLink: resolveFn,\n defaultMaxWidth,\n }),\n ...(actions ? { actions } : {}),\n breakpoint: \"lg\",\n hideOnScroll: doc.bar?.hideOnScroll ?? true,\n viewport: doc.bar?.viewport ?? false,\n ...(openItem ? { openItem } : {}),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAuEA,SAAgB,YACd,MACe;AACf,KAAI,CAAC,KAAM,QAAO;AAClB,KAAI,WAAW,KAAK,KAAK,QAAQ;EAC/B,MAAM,OAAO,KAAK;AAClB,MAAI,CAAC,QAAQ,OAAO,SAAS,SAAU,QAAO;AAC9C,MAAI,KAAK,YAAY,QAAS,QAAO;AACrC,SAAO,KAAK,OAAO,IAAI,KAAK,SAAS;;AAEvC,QAAO,KAAK,OAAO,KAAK,OAAO;;;;;;;;AASjC,SAAgB,wBACd,MACA,OACe;CACf,MAAM,OAAO,YAAY,KAAK;AAC9B,KAAI,KAAM,QAAO;AACjB,KAAI,CAAC,QAAQ,WAAW,KAAK,KAAK,OAAQ,QAAO;CACjD,MAAM,OAAO,KAAK;AAClB,KAAI,QAAQ,OAAO,SAAS,SAC1B,QAAO,KAAK,OA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jC"}
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { colorTokenField, lookField } from "@bison-lab/payload-core/theme";
2
- import { ArrayFieldValidation, Block, CollectionSlug, Condition, Field, GroupField, RowField, TextFieldSingleValidation, UploadField } from "payload";
2
+ import { ArrayFieldValidation, Block, CollectionSlug, Condition, Field, GroupField, RowField, UploadField } from "payload";
3
3
 
4
4
  //#region src/blocks/hero/config.d.ts
5
5
  /**
@@ -87,12 +87,9 @@ type MegaMenuWidthValue = (typeof MEGA_MENU_WIDTHS)[number];
87
87
  * The rule on `columns`: read as fractions, the widths must total 100%. It is
88
88
  * the array's own `validate`, so the editor sees the message as they build,
89
89
  * and Payload runs field validation again on publish (only draft saves skip
90
- * it), so nothing publishes with a short row. Skipped when Advanced has custom
91
- * widths on.
90
+ * it), so nothing publishes with a short row.
92
91
  */
93
92
  declare const validateColumnWidths: ArrayFieldValidation;
94
- /** The renderer would fall back to the preset silently; the editor should hear it here instead. */
95
- declare const validateRemWidth: TextFieldSingleValidation;
96
93
  declare function megaMenuBlock({
97
94
  variants,
98
95
  icons
@@ -165,6 +162,7 @@ interface LinkDestination {
165
162
  }
166
163
  /** The shape `linkField`/`linkFields` produce once Payload generates types. */
167
164
  interface LinkValue extends LinkDestination {
165
+ enabled?: boolean | null;
168
166
  label?: string | null;
169
167
  newTab?: boolean | null;
170
168
  }
@@ -321,13 +319,16 @@ declare function emptyRows(count: number): Record<string, never>[];
321
319
  * element, not the stock blocks UI), so the step is part of adopting this
322
320
  * release (SPI-99).
323
321
  *
324
- * Bar behaviour (hide on scroll, viewport, default panel width) ships on
325
- * Header Settings (`createNavigation`); a site without the consume bump
326
- * (SPI-99) never sees that tab. Featured looks stay on chrome roles
322
+ * Bar behaviour (hide on scroll, viewport, default panel width) stays
323
+ * on `createNavigation`'s hidden `bar` group; SPI-99 consumes
324
+ * `headerFromNavigation`. Featured looks stay on chrome roles
327
325
  * (BIS-85 / SPI-89). Payload's left nav stays until BIS-90. New page
328
326
  * blocks still ship stock nesting until those issues adopt this kit.
329
327
  */
330
328
  declare const NAV_ITEMS_FIELD = "@bison-lab/payload-blocks/admin#NavItemsField";
329
+ /** The Header document workspace: wraps DefaultEditView. SPI-99 generate:importmap. */
330
+ declare const ADMIN_WORKSPACE = "@bison-lab/payload-blocks/admin#AdminWorkspace";
331
+ declare const HEADER_WORKSPACE = "@bison-lab/payload-blocks/admin#AdminWorkspace";
331
332
  //#endregion
332
333
  //#region src/media.d.ts
333
334
  /**
@@ -556,7 +557,6 @@ interface MegaMenuSectionData {
556
557
  }
557
558
  interface MegaMenuColumnData {
558
559
  width?: ("25" | "33" | "50" | "66" | "75" | "100") | null;
559
- customWidth?: string | null;
560
560
  divider?: boolean | null;
561
561
  sections?: MegaMenuSectionData[] | null;
562
562
  id?: string | null;
@@ -571,16 +571,15 @@ interface MegaMenuBlockData extends BlockRow<"megaMenu">, LinkDestination {
571
571
  overview?: LinkValue;
572
572
  cta?: LinkValue;
573
573
  };
574
- customWidths?: boolean | null; /** In rem: "30" or "30rem". */
575
- customMaxWidth?: string | null;
576
574
  };
577
575
  }
578
576
  interface NavLinkBlockData extends BlockRow<"navLink">, LinkValue {}
579
577
  /**
580
- * Header Settings → `bar`. Featured looks are not here: they come from
581
- * chrome roles (BIS-85 / SPI-89). A site without the consume bump
582
- * (SPI-99) never sees these fields. Locked against `createNavigation`
583
- * in `configs.test.ts`.
578
+ * Header `bar` settings. Featured looks are not here: they come from
579
+ * chrome roles (BIS-85 / SPI-89). Hidden in the admin (BIS-121); a
580
+ * site without the consume bump (SPI-99) still reads them through
581
+ * `headerFromNavigation`. Locked against `createNavigation` in
582
+ * `configs.test.ts`.
584
583
  */
585
584
  interface NavigationSettingsData {
586
585
  hideOnScroll?: boolean | null;
@@ -663,5 +662,5 @@ declare function sampleImage({
663
662
  alt
664
663
  }: SampleImageOptions): MediaDoc;
665
664
  //#endregion
666
- export { type BisonBlockData, type BisonBlockType, type BlockSamples, FaqColumnsBlock, type FaqColumnsBlockData, type FaqColumnsItemData, type HeadingFieldsOptions, HeroBlock, type HeroBlockData, type ImageFieldOptions, LINK_FIELD, LinkBlock, type LinkDestination, type LinkDestinationOptions, type LinkFieldOptions, type LinkFieldsOptions, type LinkPageDoc, type LinkType, type LinkValue, MEGA_MENU_WIDTHS, MIN_ROWS_ARRAY_FIELD, type MediaDoc, type MediaValue, type MegaMenuBlockData, type MegaMenuBlockOptions, type MegaMenuColumnData, type MegaMenuLinkData, type MegaMenuOption, type MegaMenuSectionData, type MegaMenuWidthValue, NAV_ITEMS_FIELD, NapBlock, type NapBlockData, type NapDepartmentData, type NavLinkBlockData, type NavigationSettingsData, ProcessStepsBlock, type ProcessStepsBlockData, type ProcessStepsItemData, type ResolveLink, type ResolvedMedia, RichTextBlock, type RichTextBlockData, type RichTextContent, type SampleImageOptions, ShowcasePanelsBlock, type ShowcasePanelsBlockData, type ShowcasePanelsItemData, StatsBandBlock, type StatsBandBlockData, type StatsBandItemData, TestimonialMasonryBlock, type TestimonialMasonryBlockData, type TestimonialMasonryItemData, blockSamples, colorTokenField, emptyRows, headingFields, imageField, linkDestinationFields, linkField, linkFields, linkTypeOf, lookField, megaMenuBlock, megaMenuSampleOptions, resolveAdminPreviewLink, resolveLink, resolveMedia, sampleImage, validateColumnWidths, validateRemWidth };
665
+ export { ADMIN_WORKSPACE, type BisonBlockData, type BisonBlockType, type BlockSamples, FaqColumnsBlock, type FaqColumnsBlockData, type FaqColumnsItemData, HEADER_WORKSPACE, type HeadingFieldsOptions, HeroBlock, type HeroBlockData, type ImageFieldOptions, LINK_FIELD, LinkBlock, type LinkDestination, type LinkDestinationOptions, type LinkFieldOptions, type LinkFieldsOptions, type LinkPageDoc, type LinkType, type LinkValue, MEGA_MENU_WIDTHS, MIN_ROWS_ARRAY_FIELD, type MediaDoc, type MediaValue, type MegaMenuBlockData, type MegaMenuBlockOptions, type MegaMenuColumnData, type MegaMenuLinkData, type MegaMenuOption, type MegaMenuSectionData, type MegaMenuWidthValue, NAV_ITEMS_FIELD, NapBlock, type NapBlockData, type NapDepartmentData, type NavLinkBlockData, type NavigationSettingsData, ProcessStepsBlock, type ProcessStepsBlockData, type ProcessStepsItemData, type ResolveLink, type ResolvedMedia, RichTextBlock, type RichTextBlockData, type RichTextContent, type SampleImageOptions, ShowcasePanelsBlock, type ShowcasePanelsBlockData, type ShowcasePanelsItemData, StatsBandBlock, type StatsBandBlockData, type StatsBandItemData, TestimonialMasonryBlock, type TestimonialMasonryBlockData, type TestimonialMasonryItemData, blockSamples, colorTokenField, emptyRows, headingFields, imageField, linkDestinationFields, linkField, linkFields, linkTypeOf, lookField, megaMenuBlock, megaMenuSampleOptions, resolveAdminPreviewLink, resolveLink, resolveMedia, sampleImage, validateColumnWidths };
667
666
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/blocks/hero/config.ts","../src/blocks/rich-text/config.ts","../src/blocks/showcase-panels/config.ts","../src/blocks/process-steps/config.ts","../src/blocks/faq-columns/config.ts","../src/blocks/testimonial-masonry/config.ts","../src/blocks/nap/config.ts","../src/blocks/stats-band/config.ts","../src/blocks/mega-menu/config.ts","../src/fields/image.ts","../src/fields/link.ts","../src/fields/heading.ts","../src/fields/min-rows.ts","../src/fields/nav-items.ts","../src/media.ts","../src/types.ts","../src/samples.ts","../src/blocks/mega-menu/sample.ts","../src/sample-image.ts"],"mappings":";;;;;;;AAcA;;;;;;cAAa,SAAA,EAAW,KAAA;;;;cCXX,aAAA,EAAe,KAAA;;;;cCGf,mBAAA,EAAqB,KAAA;;;;cCArB,iBAAA,EAAmB,KAAA;;;;cCCnB,eAAA,EAAiB,KAAA;;;;cCCjB,uBAAA,EAAyB,KAAA;;;;;;ALMtC;;;;;cMFa,QAAA,EAAU,KAAA;;;;;;AJNvB;;;;;cKyCa,cAAA,EAAgB,KAAA;;;;;;APjC7B;;;;;;;;ACXA;;;UO0BiB,cAAA;EACf,KAAA;EACA,KAAA;AAA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Af5O7B;KgBCY,YAAA,WACJ,cAAA,GAAiB,OAAA,CAAQ,cAAA;EAAkB,SAAA,EAAW,CAAA;AAAA;;;Afb9D;;;;;;;;ACGA;;;;;cc4Ba,YAAA,EAAc,YAAA;;;;;;AhBpB3B;;ciBNa,qBAAA;;;;;;;;;;;;UCNI,kBAAA;;EAEf,KAAA;EACA,KAAA;EACA,MAAA;;EAEA,GAAA;AAAA;;;;AjBLF;;;;;;;;ACGA;;iBgB0BgB,WAAA,CAAA;EACd,KAAA;EACA,KAAA;EACA,MAAA;EACA;AAAA,GACC,kBAAA,GAAqB,QAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/blocks/hero/config.ts","../src/blocks/rich-text/config.ts","../src/blocks/showcase-panels/config.ts","../src/blocks/process-steps/config.ts","../src/blocks/faq-columns/config.ts","../src/blocks/testimonial-masonry/config.ts","../src/blocks/nap/config.ts","../src/blocks/stats-band/config.ts","../src/blocks/mega-menu/config.ts","../src/fields/image.ts","../src/fields/link.ts","../src/fields/heading.ts","../src/fields/min-rows.ts","../src/fields/nav-items.ts","../src/media.ts","../src/types.ts","../src/samples.ts","../src/blocks/mega-menu/sample.ts","../src/sample-image.ts"],"mappings":";;;;;;;AAcA;;;;;;cAAa,SAAA,EAAW,KAAA;;;;cCXX,aAAA,EAAe,KAAA;;;;cCGf,mBAAA,EAAqB,KAAA;;;;cCArB,iBAAA,EAAmB,KAAA;;;;cCCnB,eAAA,EAAiB,KAAA;;;;cCCjB,uBAAA,EAAyB,KAAA;;;;;;ALMtC;;;;;cMFa,QAAA,EAAU,KAAA;;;;;;AJNvB;;;;;cKyCa,cAAA,EAAgB,KAAA;;;;;;APjC7B;;;;;;;;ACXA;;;UOwBiB,cAAA;EACf,KAAA;EACA,KAAA;AAAA;AAAA,UAGe,oBAAA;EN1BJ;EM4BX,QAAA,GAAW,cAAA;;EAEX,KAAA,GAAQ,cAAA;AAAA;;cAIG,gBAAA;AAAA,KACD,kBAAA,WAA6B,gB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,kBAAA;;EAEf,KAAA;EACA,KAAA;EACA,MAAA;;EAEA,GAAA;AAAA;;;;AjBLF;;;;;;;;ACGA;;iBgB0BgB,WAAA,CAAA;EACd,KAAA;EACA,KAAA;EACA,MAAA;EACA;AAAA,GACC,kBAAA,GAAqB,QAAA"}
package/dist/index.mjs CHANGED
@@ -927,21 +927,6 @@ const StatsBandBlock = {
927
927
  ]
928
928
  };
929
929
  //#endregion
930
- //#region src/blocks/mega-menu/rem-width.ts
931
- /**
932
- * The one rule for a typed panel width, shared by the config's validator and
933
- * the renderer's reader so the two cannot drift: if the validator accepted a
934
- * value the renderer dropped, the editor would be back to a width that
935
- * silently does nothing. React-free, because `config.ts` ships from the Node
936
- * entry.
937
- */
938
- const REM_WIDTH = /^\s*(\d+(?:\.\d+)?)\s*(rem)?\s*$/;
939
- /** "30" and "30rem" both mean 30rem; anything else is not a width. */
940
- function remWidth(value) {
941
- const match = REM_WIDTH.exec(value ?? "");
942
- return match ? `${Number(match[1])}rem` : null;
943
- }
944
- //#endregion
945
930
  //#region src/blocks/mega-menu/config.ts
946
931
  /** The percent tokens a column can take, as Payload stores them. */
947
932
  const MEGA_MENU_WIDTHS = [
@@ -965,13 +950,12 @@ const TWELFTHS = {
965
950
  * The rule on `columns`: read as fractions, the widths must total 100%. It is
966
951
  * the array's own `validate`, so the editor sees the message as they build,
967
952
  * and Payload runs field validation again on publish (only draft saves skip
968
- * it), so nothing publishes with a short row. Skipped when Advanced has custom
969
- * widths on.
953
+ * it), so nothing publishes with a short row.
970
954
  */
971
955
  const validateColumnWidths = (value, options) => {
972
956
  const limits = rowLimits(value, options);
973
957
  if (limits !== true) return limits;
974
- if (options.siblingData?.customWidths || !value?.length) return true;
958
+ if (!value?.length) return true;
975
959
  const twelfths = value.reduce((sum, row) => sum + TWELFTHS[row?.width ?? "100"], 0);
976
960
  if (twelfths === 12) return true;
977
961
  return `The columns add up to ${Math.round(twelfths / 12 * 100)}%. They need to add up to 100%.`;
@@ -993,11 +977,6 @@ function ancestor(data, path, levels) {
993
977
  const whenSectionFeatured = (data, _siblingData, { path }) => ancestor(data, path, 3)?.display === "featured";
994
978
  /** A featured link's glyph comes from its variant, so `icon` is a list link's field. */
995
979
  const unlessSectionFeatured = (data, siblingData, ctx) => !whenSectionFeatured(data, siblingData, ctx);
996
- /** The renderer would fall back to the preset silently; the editor should hear it here instead. */
997
- const validateRemWidth = (value) => !value || remWidth(value) !== null ? true : "Type a width in rem, like 30 or 30rem.";
998
- /** `columns.N.width` → its panel, three segments up. */
999
- const whenCustomWidths = (data, _siblingData, { path }) => Boolean(ancestor(data, path, 3)?.customWidths);
1000
- const unlessCustomWidths = (data, siblingData, ctx) => !whenCustomWidths(data, siblingData, ctx);
1001
980
  function approvedSelect(name, options, admin) {
1002
981
  if (!options?.length) return [];
1003
982
  return [{
@@ -1088,16 +1067,7 @@ function megaMenuBlock({ variants, icons } = {}) {
1088
1067
  options: MEGA_MENU_WIDTHS.map((value) => ({
1089
1068
  label: `${value}%`,
1090
1069
  value
1091
- })),
1092
- admin: { condition: unlessCustomWidths }
1093
- },
1094
- {
1095
- name: "customWidth",
1096
- type: "text",
1097
- admin: {
1098
- description: "A CSS width: 13rem, 1fr, minmax(0, 1fr)",
1099
- condition: whenCustomWidths
1100
- }
1070
+ }))
1101
1071
  },
1102
1072
  {
1103
1073
  name: "divider",
@@ -1161,22 +1131,6 @@ function megaMenuBlock({ variants, icons } = {}) {
1161
1131
  name: "cta",
1162
1132
  label: "Call to action"
1163
1133
  })]
1164
- },
1165
- {
1166
- type: "collapsible",
1167
- label: "Advanced",
1168
- admin: { initCollapsed: true },
1169
- fields: [{
1170
- name: "customWidths",
1171
- type: "checkbox",
1172
- label: "Type a CSS width for each column instead of choosing a percentage",
1173
- defaultValue: false
1174
- }, {
1175
- name: "customMaxWidth",
1176
- type: "text",
1177
- validate: validateRemWidth,
1178
- admin: { description: "Panel width in rem, e.g. 30. Leave empty to use the preset above." }
1179
- }]
1180
1134
  }
1181
1135
  ]
1182
1136
  }
@@ -1207,13 +1161,16 @@ const LinkBlock = {
1207
1161
  * element, not the stock blocks UI), so the step is part of adopting this
1208
1162
  * release (SPI-99).
1209
1163
  *
1210
- * Bar behaviour (hide on scroll, viewport, default panel width) ships on
1211
- * Header Settings (`createNavigation`); a site without the consume bump
1212
- * (SPI-99) never sees that tab. Featured looks stay on chrome roles
1164
+ * Bar behaviour (hide on scroll, viewport, default panel width) stays
1165
+ * on `createNavigation`'s hidden `bar` group; SPI-99 consumes
1166
+ * `headerFromNavigation`. Featured looks stay on chrome roles
1213
1167
  * (BIS-85 / SPI-89). Payload's left nav stays until BIS-90. New page
1214
1168
  * blocks still ship stock nesting until those issues adopt this kit.
1215
1169
  */
1216
1170
  const NAV_ITEMS_FIELD = "@bison-lab/payload-blocks/admin#NavItemsField";
1171
+ /** The Header document workspace: wraps DefaultEditView. SPI-99 generate:importmap. */
1172
+ const ADMIN_WORKSPACE = "@bison-lab/payload-blocks/admin#AdminWorkspace";
1173
+ const HEADER_WORKSPACE = ADMIN_WORKSPACE;
1217
1174
  //#endregion
1218
1175
  //#region src/media.ts
1219
1176
  function isMediaDoc(value) {
@@ -1377,8 +1334,7 @@ const megaMenuSampleOptions = {
1377
1334
  /**
1378
1335
  * Spinal Simplicity's Patients panel as a saved row: two featured territories
1379
1336
  * in a 75% column, two rail sections in a divided 25% column, overview and
1380
- * CTA. Every field is set at least once; the Advanced fields are set but off,
1381
- * so the percent widths are what renders. Most links are site paths typed as
1337
+ * CTA. Every field is set at least once. Most links are site paths typed as
1382
1338
  * external links; Testimonials and the overview are page links carried
1383
1339
  * inline, as `depth: 1` would populate them, so the preview needs no pages
1384
1340
  * collection.
@@ -1395,7 +1351,6 @@ const megaMenuSample = {
1395
1351
  columns: [{
1396
1352
  id: "treatment",
1397
1353
  width: "75",
1398
- customWidth: "minmax(0, 1fr)",
1399
1354
  divider: false,
1400
1355
  sections: [{
1401
1356
  id: "territories",
@@ -1423,7 +1378,6 @@ const megaMenuSample = {
1423
1378
  }, {
1424
1379
  id: "rail",
1425
1380
  width: "25",
1426
- customWidth: "13rem",
1427
1381
  divider: true,
1428
1382
  sections: [{
1429
1383
  id: "outcomes",
@@ -1499,9 +1453,7 @@ const megaMenuSample = {
1499
1453
  href: "/find-a-doctor",
1500
1454
  newTab: false
1501
1455
  }
1502
- },
1503
- customWidths: false,
1504
- customMaxWidth: "42rem"
1456
+ }
1505
1457
  }
1506
1458
  };
1507
1459
  /** A plain bar item. */
@@ -1893,6 +1845,6 @@ const blockSamples = {
1893
1845
  navLink: navLinkSample
1894
1846
  };
1895
1847
  //#endregion
1896
- export { FaqColumnsBlock, HeroBlock, LINK_FIELD, LinkBlock, MEGA_MENU_WIDTHS, MIN_ROWS_ARRAY_FIELD, NAV_ITEMS_FIELD, NapBlock, ProcessStepsBlock, RichTextBlock, ShowcasePanelsBlock, StatsBandBlock, TestimonialMasonryBlock, blockSamples, colorTokenField, emptyRows, headingFields, imageField, linkDestinationFields, linkField, linkFields, linkTypeOf, lookField, megaMenuBlock, megaMenuSampleOptions, resolveAdminPreviewLink, resolveLink, resolveMedia, sampleImage, validateColumnWidths, validateRemWidth };
1848
+ export { ADMIN_WORKSPACE, FaqColumnsBlock, HEADER_WORKSPACE, HeroBlock, LINK_FIELD, LinkBlock, MEGA_MENU_WIDTHS, MIN_ROWS_ARRAY_FIELD, NAV_ITEMS_FIELD, NapBlock, ProcessStepsBlock, RichTextBlock, ShowcasePanelsBlock, StatsBandBlock, TestimonialMasonryBlock, blockSamples, colorTokenField, emptyRows, headingFields, imageField, linkDestinationFields, linkField, linkFields, linkTypeOf, lookField, megaMenuBlock, megaMenuSampleOptions, resolveAdminPreviewLink, resolveLink, resolveMedia, sampleImage, validateColumnWidths };
1897
1849
 
1898
1850
  //# sourceMappingURL=index.mjs.map