@bison-lab/payload-core 4.35.0 → 4.36.1

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 (52) hide show
  1. package/README.md +23 -1
  2. package/dist/admin.mjs +5 -2
  3. package/dist/admin.mjs.map +1 -1
  4. package/dist/block-library.d.mts +1 -1
  5. package/dist/{block-thumbnails-VRxpSXw1.mjs → block-thumbnails-DXOUzGjY.mjs} +1 -1
  6. package/dist/{block-thumbnails-VRxpSXw1.mjs.map → block-thumbnails-DXOUzGjY.mjs.map} +1 -1
  7. package/dist/block-thumbnails-cli.mjs +1 -1
  8. package/dist/block-thumbnails.mjs +1 -1
  9. package/dist/{catalogue-CEfYwTSK.d.mts → catalogue-PvKGCih7.d.mts} +1 -1
  10. package/dist/{catalogue-CEfYwTSK.d.mts.map → catalogue-PvKGCih7.d.mts.map} +1 -1
  11. package/dist/{facet-field-BvQp8Hzh.d.mts → facet-field-CZbLDAQz.d.mts} +1 -1
  12. package/dist/{facet-field-BvQp8Hzh.d.mts.map → facet-field-CZbLDAQz.d.mts.map} +1 -1
  13. package/dist/index.d.mts +6 -6
  14. package/dist/index.d.mts.map +1 -1
  15. package/dist/index.mjs +113 -6
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/locale-CFWfB4wP.mjs +12 -0
  18. package/dist/locale-CFWfB4wP.mjs.map +1 -0
  19. package/dist/locale-CxFNy8ex.d.mts +15 -0
  20. package/dist/locale-CxFNy8ex.d.mts.map +1 -0
  21. package/dist/metadata.d.mts +1 -1
  22. package/dist/navigation.d.mts +3 -2
  23. package/dist/navigation.mjs +1 -1
  24. package/dist/og.d.mts +2 -2
  25. package/dist/og.mjs +1 -1
  26. package/dist/{preview-Cgbh9eAq.d.mts → preview-v-GlYuqa.d.mts} +2 -2
  27. package/dist/{preview-Cgbh9eAq.d.mts.map → preview-v-GlYuqa.d.mts.map} +1 -1
  28. package/dist/{published-Dsg-HX-v.d.mts → published-B3IYStMQ.d.mts} +7 -4
  29. package/dist/published-B3IYStMQ.d.mts.map +1 -0
  30. package/dist/{published-BLXCep6Z.d.mts → published-Cow49CSZ.d.mts} +7 -3
  31. package/dist/published-Cow49CSZ.d.mts.map +1 -0
  32. package/dist/{published-CEuK5ym6.mjs → published-DACERo16.mjs} +13 -5
  33. package/dist/published-DACERo16.mjs.map +1 -0
  34. package/dist/{published-DgAzpDSG.mjs → published-DefZv9na.mjs} +8 -3
  35. package/dist/published-DefZv9na.mjs.map +1 -0
  36. package/dist/taxonomy.d.mts +1 -1
  37. package/dist/theme.d.mts +5 -4
  38. package/dist/theme.d.mts.map +1 -1
  39. package/dist/theme.mjs +1 -1
  40. package/dist/{title-C8ppEDlc.d.mts → title-DFKu53nG.d.mts} +1 -1
  41. package/dist/{title-C8ppEDlc.d.mts.map → title-DFKu53nG.d.mts.map} +1 -1
  42. package/dist/{types-D6jQql5Z.d.mts → types-B7Hy1Ho-.d.mts} +1 -1
  43. package/dist/{types-D6jQql5Z.d.mts.map → types-B7Hy1Ho-.d.mts.map} +1 -1
  44. package/dist/wireframe-cli.mjs +1 -1
  45. package/dist/{wireframe-sJW8Q4NS.mjs → wireframe-xcJNJzBf.mjs} +1 -1
  46. package/dist/{wireframe-sJW8Q4NS.mjs.map → wireframe-xcJNJzBf.mjs.map} +1 -1
  47. package/dist/wireframe.mjs +1 -1
  48. package/package.json +3 -3
  49. package/dist/published-BLXCep6Z.d.mts.map +0 -1
  50. package/dist/published-CEuK5ym6.mjs.map +0 -1
  51. package/dist/published-DgAzpDSG.mjs.map +0 -1
  52. package/dist/published-Dsg-HX-v.d.mts.map +0 -1
package/README.md CHANGED
@@ -693,7 +693,9 @@ Postgres's 63-character identifier cap the same way `nav` did. Both sit
693
693
  in `admin.group: "Navigation"` until a Developer moves them from Admin
694
694
  nav. One Features tick (`navigation`, passed as a `createFeatures`
695
695
  extra). Publish still needs the Publish tick. `getNavigation({ payload,
696
- draft })` finds both and returns `{ header, footer, bar }`.
696
+ draft })` finds both and returns `{ header, footer, bar }`; a site with
697
+ more than one locale adds `locale` (and `fallbackLocale`) so the labels
698
+ read in it.
697
699
 
698
700
  ```ts
699
701
  import { createNavigation } from "@bison-lab/payload-core";
@@ -813,6 +815,26 @@ list (Media) wraps the same `Page`. Run `payload generate:importmap` and
813
815
  `{ slug: "questions", label: "FAQ Library" }` the same way Navigation is
814
816
  added.
815
817
 
818
+ ## Multiple locales
819
+
820
+ The words fields are `localized` (#277): a page's `title`, the SEO meta
821
+ title and description (and the plugin's share image, its own setting), a
822
+ FAQ Library `question`, `answer` and `answerText`, a taxonomy term's
823
+ `name`, Header and Footer link labels, footer section headings and the
824
+ text below the logo, and a Media `alt`. Slugs, links, social URLs and
825
+ settings are shared. A single-locale site sees no schema change: the
826
+ adapters only add `_locales` tables when the config has `localization`.
827
+ `getNavigation` and `getPublishedIdentity` take the request's `locale` and
828
+ `fallbackLocale` (`LocaleRead`, exported from `./navigation` and
829
+ `./theme`). `src/__tests__/localized.test.ts` lists the localized paths.
830
+ Header and Footer carry `fillFromOwnLocale` (`src/own-locale.ts`) as a
831
+ `beforeOperation` hook: Payload reads a global's original document with
832
+ the request's fallback locale, so without it a second-locale save copies
833
+ every label the editor left empty from the default locale and `required`
834
+ never refuses (#285). It fills omitted values from the saved locale
835
+ only, and a value that locale never had becomes `null`.
836
+ See [Multiple locales](https://payload.bisonlab.ai/site/localization/).
837
+
816
838
  ## No generated types
817
839
 
818
840
  The package cannot import a site's `payload-types`, so the shapes it reads
package/dist/admin.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { a as pageEditorLooks, c as colorDocFromState, n as clampIslandHeight, o as pageEditorTokens, r as islandHeightOf, s as SYSTEM_COLOR_KEYS, u as stateFromColorDoc } from "./island-97l5VY8l.mjs";
3
- import { ArrayField, Button, CheckboxInput, DefaultCell, FieldDescription, FieldError, FieldLabel, Link, Logout, NavGroup, NavToggler, SelectField, fieldBaseClass, useAllFormFields, useAuth, useBulkUpload, useConfig, useDocumentInfo, useEntityVisibility, 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, useAllFormFields, useAuth, useBulkUpload, useConfig, useDocumentInfo, useEntityVisibility, useField, useForm, useFormFields, useListDrawerContext, useListQuery, useLocale, 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";
@@ -3239,13 +3239,16 @@ const SlugField = ({ field, path, readOnly }) => {
3239
3239
  const [active, setActive] = useState(-1);
3240
3240
  const [leafDraft, setLeafDraft] = useState(null);
3241
3241
  const creatingFolder = parent.value === NEW_FOLDER_PARENT;
3242
+ const { code: locale } = useLocale();
3243
+ const followsTitle = !config.localization || locale === config.localization.defaultLocale;
3242
3244
  const setSlug = slug.setValue;
3243
3245
  const slugValue = slug.value ?? "";
3244
3246
  useEffect(() => {
3245
- if (root || slugLocked || typeof title !== "string") return;
3247
+ if (root || slugLocked || !followsTitle || typeof title !== "string") return;
3246
3248
  const next = composeSlug(parent.value, title, newFolder.value);
3247
3249
  if (next !== slugValue) setSlug(next);
3248
3250
  }, [
3251
+ followsTitle,
3249
3252
  newFolder.value,
3250
3253
  parent.value,
3251
3254
  root,