@bison-lab/payload-core 4.9.2 → 4.11.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
@@ -18,7 +18,7 @@ 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
+ ## Seven entry points, and why
22
22
 
23
23
  | Import | Contents | Runs where |
24
24
  | ---------------------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
@@ -26,6 +26,7 @@ lockstep.
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. |
29
30
  | `@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
31
  | `@bison-lab/payload-core/react` | `ThemePreview` (legacy; Theme has no preview pane) | Client. Kept so an older site import does not break. |
31
32
 
@@ -381,6 +382,55 @@ createBlockLibrary({
381
382
  `access.update` defaults to `isAdmin`. Pass `access` to change who may
382
383
  edit availability. Then `payload generate:importmap` and `payload migrate:create`.
383
384
 
385
+ ### Section controls
386
+
387
+ Every page block carries the same four section settings (Background,
388
+ Spacing, Anchor, Hidden; `withSectionSettings` in payload-blocks). Which
389
+ of them a block *offers* is data, not code: four ticks under Enabled on
390
+ each card, stored on the row as `sectionControls`, so turning one control
391
+ off for one block is a Save, not a release. The words are the fold's. A
392
+ tick off hides the control in the editor and the renderer ignores its
393
+ stored value (payload-blocks, BIS-138). The four columns on every page
394
+ block stay; no page schema moves when a tick changes.
395
+
396
+ The row is seeded from the catalogue entry's `sectionControls`, and a key
397
+ the entry leaves out follows its `kind`: a **hero** offers Anchor only
398
+ (Background would fight the hero's own tone, Spacing is header clearance,
399
+ and a hidden hero is a published page with no opening), a **section**
400
+ offers all four, a **navbar** none and draws no ticks. The package blocks
401
+ are written out that way in the catalogue. A site extra passes its own the
402
+ same way it passes `sample`:
403
+
404
+ ```ts
405
+ createBlockLibrary({
406
+ previewPath: (slug) => `/block-library/${slug}`,
407
+ blocks: [
408
+ { slug: "ctaBand", label: "Doctor finder", category: "cta", kind: "section",
409
+ sectionControls: { spacing: false } },
410
+ ],
411
+ });
412
+ ```
413
+
414
+ `stampBlockLibrary` keeps a stored tick and fills a row that has none from
415
+ the entry, so a block that arrives in a later release gets its default
416
+ without a migration beyond the new columns. `validateBlockLibrary` refuses
417
+ Hidden on a hero row; the card locks that tick. A disabled block keeps its
418
+ ticks; they matter again when it is re-enabled. Off is off for Admin;
419
+ Developer is not special here.
420
+
421
+ Reading them: `sectionControlsFromLibrary(doc, extras?)` maps every slug
422
+ to its controls: the stored ticks when the document holds the row (a site
423
+ extra's saved row included, without the site passing anything), else the
424
+ catalogue default; a slug in neither is absent from the map, and a
425
+ consumer treats that as every control. `getSectionControls(payload)` reads
426
+ the Global (access overridden) and maps it, for a page route to hand
427
+ `RenderBlocks` as `sectionControls`; it takes a site extra's catalogue
428
+ default from the registered Global's config
429
+ (`blockLibraryEntriesFromConfig`), so the Block Settings fold and the page
430
+ agree on every block. Both are on `@bison-lab/payload-core/block-library`,
431
+ so a page route never loads the SEO plugin for them. Adding the columns is
432
+ a schema change: run `payload migrate:create`.
433
+
384
434
  ## Pages, users, and media
385
435
 
386
436
  `createPages`, `createUsers`, `createMedia`, `slugField`,
package/dist/admin.d.mts CHANGED
@@ -265,7 +265,9 @@ declare function AdminNavItemRowLabel(): react_jsx_runtime0.JSX.Element;
265
265
  /**
266
266
  * Payload's select of collections or globals. Subscribes to sibling Type
267
267
  * with `useField` so the list updates when Type changes — `getDataByPath`
268
- * does not re-render this field.
268
+ * does not re-render this field. Offers only what Payload would paint for
269
+ * this login: the client config has no `admin.hidden`, so visibility
270
+ * comes from `useEntityVisibility`.
269
271
  */
270
272
  declare const AdminNavEntityField: TextFieldClientComponent;
271
273
  //#endregion
@@ -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,YA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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;;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C,uBAAA;EACf,WAAA;EACA,OAAA;AAAA;;;UC5Be,aAAA;EACf,eAAA,GAAkB,uBAAA;AAAA;;;A9BGpB;;;iB8B6CgB,QAAA,CAAA;EAAW;AAAA,GAAmB,aAAA,GAAa,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;iBCnD3C,gBAAA,CAAA,GAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;iBCGhB,oBAAA,CAAA,GAAoB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;;;AhCGpC;ciCCa,mBAAA,EAAqB,wBAAA;;;;;;;;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"}
package/dist/admin.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { a as colorDocFromState, i as SYSTEM_COLOR_KEYS, n as pageEditorLooks, r as pageEditorTokens, s as stateFromColorDoc } from "./looks-BbL309kO.mjs";
3
- import { ArrayField, Button, CheckboxInput, DefaultCell, FieldDescription, FieldError, FieldLabel, Link, Logout, NavGroup, NavToggler, SelectField, fieldBaseClass, useAuth, useBulkUpload, useConfig, useField, useForm, useFormFields, useListDrawerContext, useListQuery, useModal, useNav, useRowLabel, useStepNav } from "@payloadcms/ui";
3
+ import { ArrayField, Button, CheckboxInput, DefaultCell, FieldDescription, FieldError, FieldLabel, Link, Logout, NavGroup, NavToggler, SelectField, fieldBaseClass, useAuth, useBulkUpload, useConfig, useEntityVisibility, useField, useForm, useFormFields, useListDrawerContext, useListQuery, useModal, useNav, useRowLabel, useStepNav } from "@payloadcms/ui";
4
4
  import { GREY_SCALES, SHADE_STEPS, contrastForeground, contrastRatio, createColorScale, deriveDarkPalette, deriveLightPalette, hexToHSL, hslToString, includedShadeSteps, isThemeHex, presetHints, regenerateColorScale, setColorScaleInclude, updateColorScale } from "@bison-lab/tokens";
5
5
  import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -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);
@@ -4153,8 +4255,13 @@ function DocumentCreateNew({ path }) {
4153
4255
  const ADMIN_NAV_SLUG = "admin-nav";
4154
4256
  //#endregion
4155
4257
  //#region src/admin-nav/resolve.ts
4156
- function sidebarGroup(group) {
4157
- if (group === false) return false;
4258
+ /**
4259
+ * `group: false` and `hidden: true` are both "never on the sidebar".
4260
+ * A function `hidden` is per viewer and arrives as `visibleEntities`.
4261
+ */
4262
+ function sidebarGroup(entity) {
4263
+ if (entity.admin?.group === false || entity.admin?.hidden === true) return false;
4264
+ const group = entity.admin?.group;
4158
4265
  if (typeof group === "string") return group;
4159
4266
  return "";
4160
4267
  }
@@ -4173,13 +4280,13 @@ function catalog(config) {
4173
4280
  type: "collection",
4174
4281
  slug: entity.slug,
4175
4282
  label: entityLabel(entity, "collection"),
4176
- group: sidebarGroup(entity.admin?.group)
4283
+ group: sidebarGroup(entity)
4177
4284
  }));
4178
4285
  const globals = (config.globals ?? []).map((entity) => ({
4179
4286
  type: "global",
4180
4287
  slug: entity.slug,
4181
4288
  label: entityLabel(entity, "global"),
4182
- group: sidebarGroup(entity.admin?.group)
4289
+ group: sidebarGroup(entity)
4183
4290
  }));
4184
4291
  return [...collections, ...globals];
4185
4292
  }
@@ -4364,12 +4471,25 @@ function entityType(type) {
4364
4471
  return type === "global" ? "global" : "collection";
4365
4472
  }
4366
4473
  /**
4474
+ * `admin.hidden: true` is hidden for every login, so no sidebar can carry
4475
+ * it. A function `hidden` depends on the viewer and is left to
4476
+ * `visibleEntities`, which Payload evaluates per request.
4477
+ */
4478
+ function isAlwaysHidden(entity) {
4479
+ return entity.admin?.group === false || entity.admin?.hidden === true;
4480
+ }
4481
+ /**
4367
4482
  * Collections or globals a Developer may pin. Sibling Type decides which
4368
- * list. `group: false` stays off — those entities are not on the sidebar.
4483
+ * list. `group: false` and `hidden: true` stay off — those entities are
4484
+ * not on the sidebar. `visibleEntities` (Payload's per-user list, from
4485
+ * `useEntityVisibility`) narrows it further when given: the client config
4486
+ * drops `admin.hidden`, so a function `hidden` is only known there.
4369
4487
  */
4370
- function adminNavEntityOptions(config, type) {
4488
+ function adminNavEntityOptions(config, type, visibleEntities) {
4371
4489
  const kind = entityType(type);
4372
- return (kind === "global" ? config.globals ?? [] : config.collections ?? []).filter((entity) => entity.admin?.group !== false).map((entity) => ({
4490
+ const entities = kind === "global" ? config.globals ?? [] : config.collections ?? [];
4491
+ const visible = visibleEntities ? new Set(kind === "global" ? visibleEntities.globals ?? [] : visibleEntities.collections ?? []) : null;
4492
+ return entities.filter((entity) => !isAlwaysHidden(entity)).filter((entity) => visible === null || visible.has(entity.slug)).map((entity) => ({
4373
4493
  value: entity.slug,
4374
4494
  label: kind === "global" ? typeof entity.label === "string" && entity.label ? entity.label : entity.slug : typeof entity.labels?.plural === "string" && entity.labels.plural ? entity.labels.plural : entity.slug
4375
4495
  }));
@@ -4395,12 +4515,15 @@ function AdminNavItemRowLabel() {
4395
4515
  /**
4396
4516
  * Payload's select of collections or globals. Subscribes to sibling Type
4397
4517
  * with `useField` so the list updates when Type changes — `getDataByPath`
4398
- * does not re-render this field.
4518
+ * does not re-render this field. Offers only what Payload would paint for
4519
+ * this login: the client config has no `admin.hidden`, so visibility
4520
+ * comes from `useEntityVisibility`.
4399
4521
  */
4400
4522
  const AdminNavEntityField = ({ field, path, permissions, readOnly, schemaPath }) => {
4401
4523
  const { value: type } = useField({ path: path.replace(/\.slug$/, ".type") });
4402
4524
  const { config } = useConfig();
4403
- const options = adminNavEntityOptions(config, type);
4525
+ const { visibleEntities } = useEntityVisibility();
4526
+ const options = adminNavEntityOptions(config, type, visibleEntities);
4404
4527
  return /* @__PURE__ */ jsx(SelectField, {
4405
4528
  field: {
4406
4529
  name: field.name,