@bison-lab/payload-blocks 3.20.0 → 3.22.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.
package/README.md CHANGED
@@ -365,38 +365,41 @@ globals: [
365
365
 
366
366
  Then `payload generate:types`, `payload generate:importmap`, and
367
367
  `payload migrate:create`. Until the import map includes
368
- `@bison-lab/payload-blocks/admin#NavItemsField`, the items field renders
368
+ `@bison-lab/payload-blocks/admin#NavItemsField` and
369
+ `@bison-lab/payload-blocks/admin#AdminWorkspace`, those slots render
369
370
  as nothing, not the stock blocks UI.
370
371
 
371
- An editor sees a rail of bar items (Link vs Mega type cards from
372
- `@bison-lab/admin-ui`), destinations
373
- through `LINK_FIELD`, a two-up column builder, and a sticky
374
- `FloatingNavBlock` preview under the published theme. Advanced CSS
375
- column widths stay on the schema so existing rows do not migrate; the
376
- kit does not render them. The column widths, read as fractions, must add
377
- up to 100%: the rule is the array's own `validate`, so the editor sees
372
+ An editor opening Header sees the admin workspace: title strip (Payload
373
+ status / Save draft / Publish), a 300px item rail, and a canvas with a
374
+ sticky kit preview of the bar (Theme Identity lockup when one exists). Destinations
375
+ go through `LINK_FIELD`. The Header button is the rail slot that
376
+ writes `header.cta` (off until the editor enables it; label and destination
377
+ are required to save while it is on). Column widths, read as fractions, must add up to
378
+ 100%: the rule is the array's own `validate`, so the editor sees
378
379
  "The columns add up to 75%. They need to add up to 100%." as they build,
379
- and the global's publish refuses the same. Custom widths skip it. The
380
- mega trigger's landing page is now the same `type` / `page` / `href`
381
- picker as every other destination — a schema change, so sites run
382
- `payload migrate:create`.
380
+ and the global's publish refuses the same. A panel is narrow, standard,
381
+ or wide. The mega trigger's landing page is the same `type` / `page` /
382
+ `href` picker as every other destination.
383
383
 
384
- In the site header, one call turns the rows into `FloatingNavBlock` items.
385
- The variants and icons here are the looks behind the values above:
384
+ In the site header, one call turns the fetched Header global into
385
+ `FloatingNavBlock` props. Looks come from chrome roles
386
+ (`megaMenuVariantsFromLooks`), not a list on Header:
386
387
 
387
388
  ```tsx
388
389
  'use client'
389
- import { FloatingNavBlock } from '@bison-lab/ui'
390
- import { headerItemsFromBlocks } from '@bison-lab/payload-blocks/react'
390
+ import { FloatingNavBlock, megaMenuVariantsFromLooks } from '@bison-lab/ui'
391
+ import { headerFromNavigation } from '@bison-lab/payload-blocks/react'
391
392
  import { usePathname } from 'next/navigation'
392
393
 
393
- export function SiteHeader({ items }: { items: Navigation['items'] }) {
394
+ export function SiteHeader({ doc }: { doc: Navigation }) {
394
395
  const pathname = usePathname()
395
396
  return (
396
397
  <FloatingNavBlock
397
- breakpoint="lg" // the panel flattens below lg; the bar must switch there too
398
- items={headerItemsFromBlocks(items, {
399
- variants: { lumbar: { chip: '…', title: '…', icon: <Marker region="lumbar" /> }, si: { … } },
398
+ {...headerFromNavigation(doc, {
399
+ looks: megaMenuVariantsFromLooks(['lumbar', 'si'], {
400
+ lumbar: <Marker region="lumbar" />,
401
+ si: <Marker region="si" />,
402
+ }),
400
403
  icons: { help: <CircleHelp className="size-4" aria-hidden /> },
401
404
  isActive: (href) => pathname.startsWith(href),
402
405
  linkComponent: NextBlockLink,
@@ -407,6 +410,20 @@ export function SiteHeader({ items }: { items: Navigation['items'] }) {
407
410
  }
408
411
  ```
409
412
 
413
+ `headerItemsFromBlocks` is still the items half. Public headers must
414
+ call `headerFromNavigation` so hidden `bar` defaults reach the bar.
415
+
416
+ ## Navigation settings
417
+
418
+ Bar behaviour stays on the Header schema (`bar.hideOnScroll`,
419
+ `bar.viewport`, `bar.defaultMaxWidth`) and is hidden in the admin.
420
+ The workspace canvas is the Header preview — do not leave a split
421
+ live-preview iframe. The kit editor holds the edited mega row open
422
+ through `openItem`. Featured looks stay on the chrome-role registry
423
+ (BIS-85 / SPI-89) — Header has no `variants` array. The Spinal consume
424
+ is SPI-99. After this schema change run `payload generate:importmap`,
425
+ `payload generate:types`, and `payload migrate:create`.
426
+
410
427
  `MegaMenuBlockRenderer` renders one panel on its own, which is what a live
411
428
  preview of the row wants; it is not a page block and has no place in the
412
429
  registry. A row with no columns, or whose columns hold no complete links,
package/dist/admin.d.mts CHANGED
@@ -1,6 +1,14 @@
1
1
 
2
- import { ArrayFieldClientComponent, BlocksFieldClientComponent, RowFieldClientComponent } from "payload";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+ import { ArrayFieldClientComponent, BlocksFieldClientComponent, DocumentViewClientProps, RowFieldClientComponent } from "payload";
3
4
 
5
+ //#region src/admin/admin-workspace.d.ts
6
+ /**
7
+ * Wraps Payload's DefaultEditView so Header (and later kit editors)
8
+ * become the mockup workspace. Does not mount a second Form.
9
+ */
10
+ declare function AdminWorkspace(props: DocumentViewClientProps): react_jsx_runtime0.JSX.Element;
11
+ //#endregion
4
12
  //#region src/admin/link-field.d.ts
5
13
  declare const LinkField: RowFieldClientComponent;
6
14
  //#endregion
@@ -29,5 +37,5 @@ declare const MinRowsArrayField: ArrayFieldClientComponent;
29
37
  //#region src/admin/nav-items-field.d.ts
30
38
  declare const NavItemsField: BlocksFieldClientComponent;
31
39
  //#endregion
32
- export { LinkField, MinRowsArrayField, NavItemsField };
40
+ export { AdminWorkspace, LinkField, MinRowsArrayField, NavItemsField };
33
41
  //# sourceMappingURL=admin.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"admin.d.mts","names":[],"sources":["../src/admin/link-field.tsx","../src/admin/min-rows-array-field.tsx","../src/admin/nav-items-field.tsx"],"mappings":";;;;cAuEa,SAAA,EAAW,uBAAA;;;;;AAAxB;;;;;;;;AChDA;;;;;;;;ACqKA;cDrKa,iBAAA,EAAmB,yBAAA;;;cCqKnB,aAAA,EAAe,0BAAA"}
1
+ {"version":3,"file":"admin.d.mts","names":[],"sources":["../src/admin/admin-workspace.tsx","../src/admin/link-field.tsx","../src/admin/min-rows-array-field.tsx","../src/admin/nav-items-field.tsx"],"mappings":";;;;;;;;AAWA;iBAAgB,cAAA,CAAe,KAAA,EAAO,uBAAA,GAAuB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;cC4DhD,SAAA,EAAW,uBAAA;;;;;;AD5DxB;;;;;;;;;;;;;AC4DA;;;cChDa,iBAAA,EAAmB,yBAAA;;;cC6MnB,aAAA,EAAe,0BAAA"}