@bison-lab/payload-core 4.10.1 → 4.12.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.
Files changed (34) hide show
  1. package/README.md +61 -2
  2. package/dist/admin.d.mts +21 -7
  3. package/dist/admin.d.mts.map +1 -1
  4. package/dist/admin.mjs +106 -4
  5. package/dist/admin.mjs.map +1 -1
  6. package/dist/block-library.d.mts +2 -0
  7. package/dist/block-library.mjs +2 -0
  8. package/dist/catalogue-9MO2jy69.d.mts +197 -0
  9. package/dist/catalogue-9MO2jy69.d.mts.map +1 -0
  10. package/dist/facet-field-DHpNdS_u.d.mts +28 -0
  11. package/dist/facet-field-DHpNdS_u.d.mts.map +1 -0
  12. package/dist/facet-field-Di1kNyzH.mjs +22 -0
  13. package/dist/facet-field-Di1kNyzH.mjs.map +1 -0
  14. package/dist/index.d.mts +12 -108
  15. package/dist/index.d.mts.map +1 -1
  16. package/dist/index.mjs +16 -206
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/metadata.d.mts +1 -1
  19. package/dist/navigation.d.mts +1 -1
  20. package/dist/navigation.mjs +1 -1
  21. package/dist/{preview-DtBDy2kv.d.mts → preview-D-Psltpf.d.mts} +1 -1
  22. package/dist/{preview-DtBDy2kv.d.mts.map → preview-D-Psltpf.d.mts.map} +1 -1
  23. package/dist/published-BjmUCpdY.mjs +376 -0
  24. package/dist/published-BjmUCpdY.mjs.map +1 -0
  25. package/dist/{published-BvTPQqAF.mjs → published-CcW9bqLJ.mjs} +1 -1
  26. package/dist/{published-BvTPQqAF.mjs.map → published-CcW9bqLJ.mjs.map} +1 -1
  27. package/dist/{published-y1Nrly7r.d.mts → published-DhARD4W8.d.mts} +1 -1
  28. package/dist/{published-y1Nrly7r.d.mts.map → published-DhARD4W8.d.mts.map} +1 -1
  29. package/dist/taxonomy.d.mts +2 -0
  30. package/dist/taxonomy.mjs +2 -0
  31. package/dist/theme.d.mts +1 -1
  32. package/dist/{title-sWwcCqHT.d.mts → title-7VASfaFO.d.mts} +1 -1
  33. package/dist/{title-sWwcCqHT.d.mts.map → title-7VASfaFO.d.mts.map} +1 -1
  34. package/package.json +10 -2
package/README.md CHANGED
@@ -18,14 +18,16 @@ and `react` are needed for admin fields; `@bison-lab/ui` and
18
18
  Pin the plugin to the same version as `payload`; Payload releases them in
19
19
  lockstep.
20
20
 
21
- ## Six entry points, and why
21
+ ## Eight entry points, and why
22
22
 
23
23
  | Import | Contents | Runs where |
24
24
  | ---------------------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
25
- | `@bison-lab/payload-core` | `seoPlugin`, `createTheme`, `createBrandAssets`, `createRoles`, `createFeatures`, `createBlockLibrary`, `createPages`, `createUsers`, `createMedia`, `createRedirects`, `createQuestions`, `createTaxonomy`, `createAdminNav`, `adminNav`, `createNavigation`, `adminOnlyApiTab`, `documentTitleActions`, `listAlign`, `seedTheme`, `seedRoles`, `seedFeatures`, predicates, `lookField`, `colorTokenField`, import-map strings, title and text helpers, types | Node. What `payload.config.ts` imports; it loads the plugin. |
25
+ | `@bison-lab/payload-core` | `seoPlugin`, `createTheme`, `createBrandAssets`, `createRoles`, `createFeatures`, `createBlockLibrary`, `createPages`, `createUsers`, `createMedia`, `createRedirects`, `createQuestions`, `createTaxonomy`, `facetField`, `createAdminNav`, `adminNav`, `createNavigation`, `adminOnlyApiTab`, `documentTitleActions`, `listAlign`, `seedTheme`, `seedRoles`, `seedFeatures`, predicates, `lookField`, `colorTokenField`, import-map strings, title and text helpers, types | Node. What `payload.config.ts` imports; it loads the plugin. |
26
26
  | `@bison-lab/payload-core/metadata` | `pageMetadata`, the title helpers, the same types | Server. What a page route imports; it does not load the plugin. |
27
27
  | `@bison-lab/payload-core/theme` | `getPublishedTheme`, `getPublishedIdentity`, `themeConfigFromDoc`, `themeHead`, `themeHeadFromDoc` | Server. What a root layout imports; it does not load the plugin or React. |
28
28
  | `@bison-lab/payload-core/navigation` | `getNavigation`, the Header and Footer slugs | Server. What a site header imports; it does not load the plugin or React. |
29
+ | `@bison-lab/payload-core/block-library` | `getSectionControls`, `sectionControlsFromLibrary`, `SectionControls`, the catalogue readers | Server. What a page route and the Block Settings fold import; it does not load the plugin or React. |
30
+ | `@bison-lab/payload-core/taxonomy` | `facetField`, `FacetEntry` | Anywhere. What a block config imports to tag content from a taxonomy; no plugin, no React, so a browser bundle can take it (`@bison-lab/payload-blocks` main entry reaches the docs island and Storybook). |
29
31
  | `@bison-lab/payload-core/admin` | Theme fields, the Roles and Features matrices, the Block library field, Admin nav, the Users Roles checklist, and the FAQ Library list | Admin. Referenced by import-map string; `generate:importmap` writes it. |
30
32
  | `@bison-lab/payload-core/react` | `ThemePreview` (legacy; Theme has no preview pane) | Client. Kept so an older site import does not break. |
31
33
 
@@ -381,6 +383,55 @@ createBlockLibrary({
381
383
  `access.update` defaults to `isAdmin`. Pass `access` to change who may
382
384
  edit availability. Then `payload generate:importmap` and `payload migrate:create`.
383
385
 
386
+ ### Section controls
387
+
388
+ Every page block carries the same four section settings (Background,
389
+ Spacing, Anchor, Hidden; `withSectionSettings` in payload-blocks). Which
390
+ of them a block *offers* is data, not code: four ticks under Enabled on
391
+ each card, stored on the row as `sectionControls`, so turning one control
392
+ off for one block is a Save, not a release. The words are the fold's. A
393
+ tick off hides the control in the editor and the renderer ignores its
394
+ stored value (payload-blocks, BIS-138). The four columns on every page
395
+ block stay; no page schema moves when a tick changes.
396
+
397
+ The row is seeded from the catalogue entry's `sectionControls`, and a key
398
+ the entry leaves out follows its `kind`: a **hero** offers Anchor only
399
+ (Background would fight the hero's own tone, Spacing is header clearance,
400
+ and a hidden hero is a published page with no opening), a **section**
401
+ offers all four, a **navbar** none and draws no ticks. The package blocks
402
+ are written out that way in the catalogue. A site extra passes its own the
403
+ same way it passes `sample`:
404
+
405
+ ```ts
406
+ createBlockLibrary({
407
+ previewPath: (slug) => `/block-library/${slug}`,
408
+ blocks: [
409
+ { slug: "ctaBand", label: "Doctor finder", category: "cta", kind: "section",
410
+ sectionControls: { spacing: false } },
411
+ ],
412
+ });
413
+ ```
414
+
415
+ `stampBlockLibrary` keeps a stored tick and fills a row that has none from
416
+ the entry, so a block that arrives in a later release gets its default
417
+ without a migration beyond the new columns. `validateBlockLibrary` refuses
418
+ Hidden on a hero row; the card locks that tick. A disabled block keeps its
419
+ ticks; they matter again when it is re-enabled. Off is off for Admin;
420
+ Developer is not special here.
421
+
422
+ Reading them: `sectionControlsFromLibrary(doc, extras?)` maps every slug
423
+ to its controls: the stored ticks when the document holds the row (a site
424
+ extra's saved row included, without the site passing anything), else the
425
+ catalogue default; a slug in neither is absent from the map, and a
426
+ consumer treats that as every control. `getSectionControls(payload)` reads
427
+ the Global (access overridden) and maps it, for a page route to hand
428
+ `RenderBlocks` as `sectionControls`; it takes a site extra's catalogue
429
+ default from the registered Global's config
430
+ (`blockLibraryEntriesFromConfig`), so the Block Settings fold and the page
431
+ agree on every block. Both are on `@bison-lab/payload-core/block-library`,
432
+ so a page route never loads the SEO plugin for them. Adding the columns is
433
+ a schema change: run `payload migrate:create`.
434
+
384
435
  ## Pages, users, and media
385
436
 
386
437
  `createPages`, `createUsers`, `createMedia`, `slugField`,
@@ -550,6 +601,14 @@ createQuestions({
550
601
  });
551
602
  ```
552
603
 
604
+ Each `organizeBy` entry's field is `facetField(entry)`: a stock
605
+ `relationship`, `hasMany`, onto `collection`, with Payload's default
606
+ `allowCreate`, so "Add new" shows only to a user with create access on the
607
+ terms collection. It is exported from the main entry and from
608
+ `./taxonomy`; tag any other content from the same taxonomy with it
609
+ (`createResourcesBlock({ facets })` in payload-blocks does). Only `name`,
610
+ `label` and `collection` are read.
611
+
553
612
  The list view is `@bison-lab/payload-core/admin#QuestionsList`. It wraps
554
613
  `Page` from `@bison-lab/admin-ui` so the column is Payload's `--gutter-h`,
555
614
  the same inset Media and Pages use — not a mockup max-width. A later kit
package/dist/admin.d.mts CHANGED
@@ -271,6 +271,21 @@ declare function AdminNavItemRowLabel(): react_jsx_runtime0.JSX.Element;
271
271
  */
272
272
  declare const AdminNavEntityField: TextFieldClientComponent;
273
273
  //#endregion
274
+ //#region src/taxonomy/facet-field.d.ts
275
+ /**
276
+ * One taxonomy axis a document is tagged on: the field it writes and the
277
+ * terms collection it picks from. A FAQ Library `organizeBy` entry is one,
278
+ * and so is a Resources block facet.
279
+ */
280
+ interface FacetEntry {
281
+ /** Relationship field name. Must be a valid Payload field name. */
282
+ name: string;
283
+ /** Field label in the admin. */
284
+ label: string;
285
+ /** Terms collection slug. */
286
+ collection: string;
287
+ }
288
+ //#endregion
274
289
  //#region src/questions/types.d.ts
275
290
  /**
276
291
  * Theme family for chips on a linked facet. The list fetches this
@@ -288,13 +303,12 @@ interface OrganizeByLook {
288
303
  /** Theme family field. Default `family`. */
289
304
  family?: string;
290
305
  }
291
- interface OrganizeByEntry {
292
- /** FAQ relationship field name. Must be a valid Payload field name. */
293
- name: string;
294
- /** Filters, table heading, and Manage column. */
295
- label: string;
296
- /** Terms collection slug. */
297
- collection: string;
306
+ /**
307
+ * A facet (`name`, `label`, `collection`; the field is `facetField`) plus
308
+ * what only the FAQ Library list reads. `label` is also the list's filter,
309
+ * table heading, and Manage column.
310
+ */
311
+ interface OrganizeByEntry extends FacetEntry {
298
312
  /**
299
313
  * When true, Manage organization can add and delete terms. Default
300
314
  * false — linked collections stay read-only here.
@@ -1 +1 @@
1
- {"version":3,"file":"admin.d.mts","names":[],"sources":["../src/admin/color-field.tsx","../src/admin/color-scale-field.tsx","../src/admin/library-field.tsx","../src/admin/font-field.tsx","../src/admin/pairing-field.tsx","../src/admin/appearance-field.tsx","../src/admin/grey-scale-field.tsx","../src/admin/contrast-report.tsx","../src/admin/section-heading.tsx","../src/admin/publish-child.tsx","../src/admin/save-button.tsx","../src/admin/preview-mode.tsx","../src/admin/identity-fallback.tsx","../src/admin/look-field.tsx","../src/admin/roles-matrix-field.tsx","../src/admin/roles-row-label.tsx","../src/admin/role-slug-field.tsx","../src/admin/slug-field.tsx","../src/admin/page-title-cell.tsx","../src/admin/page-slug-cell.tsx","../src/admin/required-page-cell.tsx","../src/admin/role-name-field.tsx","../src/admin/roles-field.tsx","../src/admin/roles-grants-field.tsx","../src/admin/features-matrix-field.tsx","../src/admin/block-library-field.tsx","../src/admin/document-title-actions.tsx","../src/admin/list-align-styles.tsx","../src/admin/document-create-new.tsx","../src/admin-nav/types.ts","../src/admin/admin-nav.tsx","../src/admin/admin-nav-row-label.tsx","../src/admin/admin-nav-item-row-label.tsx","../src/admin/admin-nav-entity-field.tsx","../src/questions/types.ts","../src/admin/questions-list.tsx","../src/admin/media-alt-autofill.tsx","../src/admin/media-list-view.tsx"],"mappings":";;;;;;;;;;;cAWa,UAAA,EAAY,wBAAA;;;;;;;;cCuBZ,eAAA,EAAiB,yBAAA;;;;;;;;;cCMjB,YAAA,EAAc,yBAAA;;;;;;;;;cCtBd,SAAA,EAAW,0BAAA;;;;;;;cCNX,YAAA,EAAc,sBAAA;;;;;;;cCCd,eAAA,EAAiB,yBAAA;;;ALF9B;;;;AAAA,cM4Da,cAAA,EAAgB,0BAAA;;;;;;;cCnDhB,cAAA,EAAgB,sBAAA;;;;;;cCbhB,cAAA,EAAgB,sBAAA;;;cC0IhB,YAAA,EAAc,sBAAA;;;;;;;;iBCtIX,qBAAA,CAAA;;AVAhB;;;iBUQgB,eAAA,CAAA,GAAe,kBAAA,CAAA,GAAA,CAAA,OAAA;;iBA0Bf,gBAAA,CAAA,GAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;KCpCpB,gBAAA;AAAA,iBAgDI,mBAAA,CAAoB,IAAA,EAAM,gBAAA;;;;;;;cCjD7B,gBAAA,EAAkB,sBAAA;;;;;;;cCIlB,SAAA,EAAW,wBAAA;;;;;;;;cCqBX,gBAAA,EAAkB,yBAAA;;;;;;iBC1Bf,aAAA,CAAA,GAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;cCChB,aAAA,EAAe,wBAAA;;;;;;;;;cC4Bf,SAAA,EAAW,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A;;;;;;;;AjCDlC;UkCFiB,cAAA;;EAEf,MAAA;ElCyED;EkCvEC,IAAA;;EAEA,KAAA;EjCmBW;EiCjBX,MAAA;AAAA;AAAA,UAGe,eAAA;EjCiEhB;EiC/DC,IAAA;;EAEA,KAAA;EhCgBW;EgCdX,UAAA;;;;;EAKA,MAAA;;EAEA,IAAA,GAAO,cAAA;AAAA;;;iBCyKO,aAAA,CACd,KAAA,EAAO,mBAAA;EAAwB,UAAA,YAAsB,eAAA;AAAA,IAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;iBChM1D,gBAAA,CAAA;EAAmB;AAAA;EAAU,IAAA;AAAA;;;iBCkH7B,aAAA,CAAc,KAAA,EAAO,mBAAA,GAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"admin.d.mts","names":[],"sources":["../src/admin/color-field.tsx","../src/admin/color-scale-field.tsx","../src/admin/library-field.tsx","../src/admin/font-field.tsx","../src/admin/pairing-field.tsx","../src/admin/appearance-field.tsx","../src/admin/grey-scale-field.tsx","../src/admin/contrast-report.tsx","../src/admin/section-heading.tsx","../src/admin/publish-child.tsx","../src/admin/save-button.tsx","../src/admin/preview-mode.tsx","../src/admin/identity-fallback.tsx","../src/admin/look-field.tsx","../src/admin/roles-matrix-field.tsx","../src/admin/roles-row-label.tsx","../src/admin/role-slug-field.tsx","../src/admin/slug-field.tsx","../src/admin/page-title-cell.tsx","../src/admin/page-slug-cell.tsx","../src/admin/required-page-cell.tsx","../src/admin/role-name-field.tsx","../src/admin/roles-field.tsx","../src/admin/roles-grants-field.tsx","../src/admin/features-matrix-field.tsx","../src/admin/block-library-field.tsx","../src/admin/document-title-actions.tsx","../src/admin/list-align-styles.tsx","../src/admin/document-create-new.tsx","../src/admin-nav/types.ts","../src/admin/admin-nav.tsx","../src/admin/admin-nav-row-label.tsx","../src/admin/admin-nav-item-row-label.tsx","../src/admin/admin-nav-entity-field.tsx","../src/taxonomy/facet-field.ts","../src/questions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A,YAAsB,eAAA;AAAA,IAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;iBChM1D,gBAAA,CAAA;EAAmB;AAAA;EAAU,IAAA;AAAA;;;iBCkH7B,aAAA,CAAc,KAAA,EAAO,mBAAA,GAAmB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
package/dist/admin.mjs CHANGED
@@ -3800,6 +3800,70 @@ const FeaturesMatrixField = (props) => {
3800
3800
  });
3801
3801
  };
3802
3802
  //#endregion
3803
+ //#region src/block-library/controls.ts
3804
+ /**
3805
+ * Which of the four section settings a block offers its editors. The
3806
+ * settings group on every page block keeps all four fields, so the page
3807
+ * schema never moves; a tick off hides the control in the editor and the
3808
+ * renderer ignores its stored value (payload-blocks, BIS-138). The choice
3809
+ * lives on the Block library row, seeded from the catalogue, so turning
3810
+ * one control off for one block is a Save, not a release (BIS-136).
3811
+ */
3812
+ const SECTION_CONTROL_KEYS = [
3813
+ "background",
3814
+ "spacing",
3815
+ "anchor",
3816
+ "hidden"
3817
+ ];
3818
+ /** The words the settings fold uses, so the ticks read as the controls they hide. */
3819
+ const SECTION_CONTROL_LABELS = {
3820
+ background: "Background",
3821
+ spacing: "Spacing",
3822
+ anchor: "Anchor",
3823
+ hidden: "Hidden"
3824
+ };
3825
+ /** A section: every control. Also what a slug no catalogue knows gets. */
3826
+ const DEFAULT_SECTION_CONTROLS = {
3827
+ background: true,
3828
+ spacing: true,
3829
+ anchor: true,
3830
+ hidden: true
3831
+ };
3832
+ /**
3833
+ * A hero: Anchor only. Background would compete with the hero's own tone,
3834
+ * Spacing is header clearance the editor should not change, and a hidden
3835
+ * hero is a published page with no opening.
3836
+ */
3837
+ const HERO_SECTION_CONTROLS = {
3838
+ background: false,
3839
+ spacing: false,
3840
+ anchor: true,
3841
+ hidden: false
3842
+ };
3843
+ /** A navbar is not a section; the ticks do not render on its card. */
3844
+ const NO_SECTION_CONTROLS = {
3845
+ background: false,
3846
+ spacing: false,
3847
+ anchor: false,
3848
+ hidden: false
3849
+ };
3850
+ function defaultSectionControls(kind) {
3851
+ if (kind === "hero") return { ...HERO_SECTION_CONTROLS };
3852
+ if (kind === "navbar") return { ...NO_SECTION_CONTROLS };
3853
+ return { ...DEFAULT_SECTION_CONTROLS };
3854
+ }
3855
+ /**
3856
+ * Reads four booleans off a stored or partial value, taking `fallback` for
3857
+ * any key that is absent or not a boolean. A row saved before the columns
3858
+ * existed, or an entry that names only one key, resolves this way.
3859
+ */
3860
+ function sectionControlsOf(value, fallback) {
3861
+ const source = value && typeof value === "object" ? value : {};
3862
+ const out = { ...fallback };
3863
+ for (const key of SECTION_CONTROL_KEYS) if (typeof source[key] === "boolean") out[key] = source[key];
3864
+ return out;
3865
+ }
3866
+ //#endregion
3803
3867
  //#region src/block-library/types.ts
3804
3868
  const BLOCK_LIBRARY_SLUG = "block-library";
3805
3869
  const BLOCK_LIBRARY_CATEGORIES = [
@@ -3846,7 +3910,7 @@ const BLOCK_LIBRARY_CATEGORIES = [
3846
3910
  ];
3847
3911
  //#endregion
3848
3912
  //#region src/admin/block-library-field.tsx
3849
- const LIST_CSS$1 = `.bl-block-library{display:grid;grid-template-columns:12rem 1fr;gap:1.5rem;align-items:start}.bl-block-library__rail{display:flex;flex-direction:column;gap:.25rem}.bl-block-library__rail button{text-align:left;background:transparent;border:0;padding:.4rem .6rem;border-radius:8px;cursor:pointer}.bl-block-library__rail button[aria-current=true]{background:var(--theme-elevation-100,#f1f5f9);font-weight:650}.bl-block-library__card{display:flex;flex-direction:column;gap:.5rem;margin-block-end:1.25rem}.bl-block-library__card header{display:flex;justify-content:space-between;align-items:center;gap:1rem}.bl-block-library__refusal{margin:0;color:var(--theme-error-500,#b91c1c)}.bl-block-library__drafts{margin:.5rem 0 0;padding-inline-start:1.25rem}.bl-block-library iframe{width:100%;height:720px;border:1px solid var(--theme-elevation-150,#e2e8f0);border-radius:12px;background:var(--theme-elevation-0,#fff)}`;
3913
+ const LIST_CSS$1 = `.bl-block-library{display:grid;grid-template-columns:12rem 1fr;gap:1.5rem;align-items:start}.bl-block-library__rail{display:flex;flex-direction:column;gap:.25rem}.bl-block-library__rail button{text-align:left;background:transparent;border:0;padding:.4rem .6rem;border-radius:8px;cursor:pointer}.bl-block-library__rail button[aria-current=true]{background:var(--theme-elevation-100,#f1f5f9);font-weight:650}.bl-block-library__card{display:flex;flex-direction:column;gap:.5rem;margin-block-end:1.25rem}.bl-block-library__card header{display:flex;justify-content:space-between;align-items:center;gap:1rem}.bl-block-library__controls{display:flex;flex-wrap:wrap;gap:.25rem 1.25rem;margin:0;padding:0;border:0}.bl-block-library__controls legend{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.bl-block-library__control{display:inline-flex;align-items:center;gap:.5rem;font-size:13px}.bl-block-library__control[data-locked]{color:var(--theme-elevation-400,#94a3b8)}.bl-block-library__refusal{margin:0;color:var(--theme-error-500,#b91c1c)}.bl-block-library__drafts{margin:.5rem 0 0;padding-inline-start:1.25rem}.bl-block-library iframe{width:100%;height:720px;border:1px solid var(--theme-elevation-150,#e2e8f0);border-radius:12px;background:var(--theme-elevation-0,#fff)}`;
3850
3914
  function holderLabel(holder) {
3851
3915
  const title = holder.title?.trim() || "Untitled";
3852
3916
  const slug = holder.slug?.trim();
@@ -3858,6 +3922,40 @@ function refusalOf(label, usage) {
3858
3922
  function isUsage(value) {
3859
3923
  return Boolean(value) && typeof value === "object" && Array.isArray(value.published) && Array.isArray(value.drafts);
3860
3924
  }
3925
+ /**
3926
+ * The four ticks under Enabled: which section settings the block offers.
3927
+ * Not drawn on a navbar. Hidden is locked off on a hero (a page cannot
3928
+ * publish without its hero). A disabled block keeps its ticks; they matter
3929
+ * again when it is re-enabled.
3930
+ */
3931
+ function SectionControlTicks({ row, onChange }) {
3932
+ if (row.kind === "navbar") return null;
3933
+ const controls = sectionControlsOf(row.sectionControls, defaultSectionControls(row.kind));
3934
+ const locked = (key) => key === "hidden" && row.kind === "hero";
3935
+ return /* @__PURE__ */ jsxs("fieldset", {
3936
+ className: "bl-block-library__controls",
3937
+ children: [/* @__PURE__ */ jsxs("legend", { children: [
3938
+ "Section settings ",
3939
+ row.label,
3940
+ " offers"
3941
+ ] }), SECTION_CONTROL_KEYS.map((key) => /* @__PURE__ */ jsxs("label", {
3942
+ className: "bl-block-library__control",
3943
+ ...locked(key) ? { "data-locked": "" } : {},
3944
+ children: [/* @__PURE__ */ jsx(Checkbox, {
3945
+ checked: locked(key) ? false : controls[key],
3946
+ disabled: locked(key),
3947
+ "aria-label": SECTION_CONTROL_LABELS[key],
3948
+ onCheckedChange: (checked) => onChange({
3949
+ ...controls,
3950
+ [key]: checked === true
3951
+ })
3952
+ }), /* @__PURE__ */ jsx("span", {
3953
+ "aria-hidden": true,
3954
+ children: SECTION_CONTROL_LABELS[key]
3955
+ })]
3956
+ }, key))]
3957
+ });
3958
+ }
3861
3959
  function LibraryCard({ path, index, row, setRow, src, toggle, usageURL }) {
3862
3960
  const { setValue: setEnabled } = useField({ path: `${path}.${index}.enabled` });
3863
3961
  const [refusal, setRefusal] = useState(null);
@@ -3865,7 +3963,7 @@ function LibraryCard({ path, index, row, setRow, src, toggle, usageURL }) {
3865
3963
  const [checking, setChecking] = useState(false);
3866
3964
  const apply = (enabled) => {
3867
3965
  setEnabled(enabled);
3868
- setRow(index, enabled);
3966
+ setRow(index, { enabled });
3869
3967
  };
3870
3968
  /**
3871
3969
  * Off asks the server where the slug is used. Published refuses; drafts
@@ -3901,6 +3999,10 @@ function LibraryCard({ path, index, row, setRow, src, toggle, usageURL }) {
3901
3999
  } else turnOff();
3902
4000
  }
3903
4001
  }) : null] }),
4002
+ /* @__PURE__ */ jsx(SectionControlTicks, {
4003
+ row,
4004
+ onChange: (sectionControls) => setRow(index, { sectionControls })
4005
+ }),
3904
4006
  refusal ? /* @__PURE__ */ jsx("p", {
3905
4007
  className: "bl-block-library__refusal",
3906
4008
  role: "alert",
@@ -3963,9 +4065,9 @@ const BlockLibraryField = (props) => {
3963
4065
  const rows = loaded.length > 0 ? loaded : seeded;
3964
4066
  const rowsRef = useRef(rows);
3965
4067
  rowsRef.current = rows;
3966
- const setRow = useCallback((index, enabled) => setValue(rowsRef.current.map((entry, i) => i === index ? {
4068
+ const setRow = useCallback((index, patch) => setValue(rowsRef.current.map((entry, i) => i === index ? {
3967
4069
  ...entry,
3968
- enabled
4070
+ ...patch
3969
4071
  } : entry)), [setValue]);
3970
4072
  useEffect(() => {
3971
4073
  if (loaded.length === 0 && seeded.length > 0) setValue(seeded);