payload 1.1.28-beta.0 → 1.2.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 (127) hide show
  1. package/CHANGELOG.md +116 -97
  2. package/components/fields/Select.ts +1 -1
  3. package/dist/admin/components/elements/ReactSelect/index.js +2 -2
  4. package/dist/admin/components/elements/VersionsCount/index.js +1 -1
  5. package/dist/admin/components/elements/WhereBuilder/Condition/Text/index.js +5 -1
  6. package/dist/admin/components/forms/Form/buildStateFromSchema/addFieldStatePromise.d.ts +3 -3
  7. package/dist/admin/components/forms/Form/buildStateFromSchema/addFieldStatePromise.js +7 -7
  8. package/dist/admin/components/forms/Form/buildStateFromSchema/index.d.ts +2 -2
  9. package/dist/admin/components/forms/Form/buildStateFromSchema/index.js +2 -2
  10. package/dist/admin/components/forms/Form/buildStateFromSchema/iterateFields.d.ts +3 -3
  11. package/dist/admin/components/forms/Form/buildStateFromSchema/iterateFields.js +2 -2
  12. package/dist/admin/components/forms/Form/index.js +4 -4
  13. package/dist/admin/components/forms/field-types/Array/index.js +2 -2
  14. package/dist/admin/components/forms/field-types/Blocks/index.js +2 -2
  15. package/dist/admin/components/forms/field-types/Relationship/AddNew/Modal/index.js +2 -2
  16. package/dist/admin/components/forms/field-types/RichText/elements/link/Button.js +2 -2
  17. package/dist/admin/components/forms/field-types/RichText/elements/link/Element.js +3 -3
  18. package/dist/admin/components/forms/field-types/RichText/elements/upload/Element/EditModal/index.js +2 -2
  19. package/dist/admin/components/forms/field-types/Select/Input.js +13 -3
  20. package/dist/admin/components/forms/field-types/Textarea/Input.js +1 -1
  21. package/dist/admin/components/forms/field-types/Textarea/index.scss +3 -6
  22. package/dist/admin/components/forms/useField/index.js +2 -2
  23. package/dist/admin/components/utilities/I18n/index.js +4 -1
  24. package/dist/admin/components/views/Account/index.js +10 -5
  25. package/dist/admin/components/views/Global/index.js +5 -5
  26. package/dist/admin/components/views/Login/index.js +1 -1
  27. package/dist/admin/components/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +1 -1
  28. package/dist/admin/components/views/Version/RenderFieldsToDiff/fields/Nested/index.js +15 -9
  29. package/dist/admin/components/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +5 -2
  30. package/dist/admin/components/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts +5 -0
  31. package/dist/admin/components/views/Version/RenderFieldsToDiff/fields/Select/index.js +34 -0
  32. package/dist/admin/components/views/Version/RenderFieldsToDiff/fields/Select/index.scss +10 -0
  33. package/dist/admin/components/views/Version/RenderFieldsToDiff/fields/Text/index.js +3 -2
  34. package/dist/admin/components/views/Version/RenderFieldsToDiff/fields/index.js +3 -2
  35. package/dist/admin/components/views/Versions/index.js +1 -1
  36. package/dist/admin/components/views/collections/Edit/Auth/APIKey.js +2 -2
  37. package/dist/admin/components/views/collections/Edit/Default.js +5 -2
  38. package/dist/admin/components/views/collections/Edit/SetStepNav.d.ts +7 -0
  39. package/dist/admin/components/views/collections/Edit/SetStepNav.js +31 -0
  40. package/dist/admin/components/views/collections/Edit/index.js +6 -40
  41. package/dist/admin/hooks/usePayloadAPI.js +3 -1
  42. package/dist/auth/executeAccess.js +3 -3
  43. package/dist/auth/getExecuteStaticAccess.js +2 -2
  44. package/dist/auth/operations/forgotPassword.js +5 -5
  45. package/dist/auth/operations/local/forgotPassword.js +3 -1
  46. package/dist/auth/operations/local/login.js +3 -1
  47. package/dist/auth/operations/local/resetPassword.js +3 -1
  48. package/dist/auth/operations/local/unlock.js +3 -1
  49. package/dist/auth/operations/login.js +4 -4
  50. package/dist/auth/operations/logout.js +2 -2
  51. package/dist/auth/operations/refresh.js +2 -2
  52. package/dist/auth/operations/registerFirstUser.js +2 -2
  53. package/dist/auth/sendVerificationEmail.js +3 -3
  54. package/dist/collections/operations/create.js +4 -4
  55. package/dist/collections/operations/delete.js +6 -6
  56. package/dist/collections/operations/findByID.js +4 -4
  57. package/dist/collections/operations/findVersionByID.js +5 -5
  58. package/dist/collections/operations/local/create.js +3 -1
  59. package/dist/collections/operations/local/delete.js +3 -1
  60. package/dist/collections/operations/local/find.js +3 -1
  61. package/dist/collections/operations/local/findByID.js +3 -1
  62. package/dist/collections/operations/local/findVersionByID.js +3 -1
  63. package/dist/collections/operations/local/findVersions.js +5 -2
  64. package/dist/collections/operations/local/restoreVersion.js +4 -2
  65. package/dist/collections/operations/local/update.js +5 -2
  66. package/dist/collections/operations/restoreVersion.js +5 -5
  67. package/dist/collections/operations/update.js +6 -6
  68. package/dist/collections/requestHandlers/create.js +2 -2
  69. package/dist/collections/requestHandlers/delete.js +2 -2
  70. package/dist/collections/requestHandlers/restoreVersion.js +2 -2
  71. package/dist/collections/requestHandlers/update.js +4 -4
  72. package/dist/errors/AuthenticationError.d.ts +2 -2
  73. package/dist/errors/AuthenticationError.js +3 -3
  74. package/dist/errors/ErrorDeletingFile.d.ts +2 -2
  75. package/dist/errors/ErrorDeletingFile.js +3 -3
  76. package/dist/errors/FileUploadError.d.ts +2 -2
  77. package/dist/errors/FileUploadError.js +3 -3
  78. package/dist/errors/Forbidden.d.ts +2 -2
  79. package/dist/errors/Forbidden.js +3 -3
  80. package/dist/errors/LockedAuth.d.ts +2 -2
  81. package/dist/errors/LockedAuth.js +3 -3
  82. package/dist/errors/MissingFile.d.ts +2 -2
  83. package/dist/errors/MissingFile.js +3 -3
  84. package/dist/errors/NotFound.d.ts +2 -2
  85. package/dist/errors/NotFound.js +3 -3
  86. package/dist/errors/UnathorizedError.d.ts +2 -2
  87. package/dist/errors/UnathorizedError.js +3 -3
  88. package/dist/errors/ValidationError.d.ts +2 -2
  89. package/dist/errors/ValidationError.js +3 -3
  90. package/dist/express/middleware/i18n.js +3 -3
  91. package/dist/express/types.d.ts +2 -1
  92. package/dist/fields/config/types.d.ts +2 -2
  93. package/dist/fields/hooks/beforeChange/index.js +2 -2
  94. package/dist/fields/hooks/beforeChange/promise.js +8 -2
  95. package/dist/fields/validations.js +51 -51
  96. package/dist/fields/validations.spec.js +2 -3
  97. package/dist/globals/operations/findVersionByID.js +5 -5
  98. package/dist/globals/operations/local/findOne.js +5 -1
  99. package/dist/globals/operations/local/findVersionByID.js +5 -1
  100. package/dist/globals/operations/local/findVersions.js +5 -1
  101. package/dist/globals/operations/local/restoreVersion.js +5 -1
  102. package/dist/globals/operations/local/update.js +5 -1
  103. package/dist/globals/operations/restoreVersion.js +3 -3
  104. package/dist/globals/requestHandlers/restoreVersion.js +2 -2
  105. package/dist/globals/requestHandlers/update.js +4 -4
  106. package/dist/preferences/operations/delete.js +2 -2
  107. package/dist/preferences/operations/findOne.js +2 -2
  108. package/dist/preferences/operations/update.js +2 -2
  109. package/dist/preferences/requestHandlers/delete.js +2 -2
  110. package/dist/preferences/requestHandlers/findOne.js +2 -2
  111. package/dist/preferences/requestHandlers/update.js +2 -2
  112. package/dist/translations/en.json +2 -0
  113. package/dist/translations/index.d.ts +5 -0
  114. package/dist/translations/init.d.ts +2 -2
  115. package/dist/translations/init.js +4 -1
  116. package/dist/translations/it.json +18 -15
  117. package/dist/uploads/generateFileData.js +3 -3
  118. package/dist/uploads/uploadFiles.d.ts +2 -2
  119. package/dist/uploads/uploadFiles.js +3 -3
  120. package/dist/versions/drafts/saveCollectionDraft.js +4 -3
  121. package/dist/versions/drafts/saveGlobalDraft.js +4 -3
  122. package/dist/versions/ensurePublishedCollectionVersion.js +2 -1
  123. package/dist/versions/ensurePublishedGlobalVersion.js +2 -1
  124. package/docs/authentication/config.mdx +1 -1
  125. package/docs/configuration/i18n.mdx +2 -2
  126. package/docs/fields/overview.mdx +1 -1
  127. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,131 +1,150 @@
1
1
 
2
2
 
3
- ## [1.1.28-beta.0](https://github.com/payloadcms/payload/compare/v1.1.26...v1.1.28-beta.0) (2022-11-17)
3
+ ## [1.2.1](https://github.com/payloadcms/payload/compare/v1.2.0...v1.2.1) (2022-11-22)
4
4
 
5
5
 
6
6
  ### Bug Fixes
7
7
 
8
- * allow label to be set to false ([858fc86](https://github.com/payloadcms/payload/commit/858fc86af895f25a091f1b5b729d04c86f654601))
9
- * autosave slug regression ([b1f3ce9](https://github.com/payloadcms/payload/commit/b1f3ce9735743b8056633d98fb94353e6f4c08e6))
10
- * build errors ([65f0e1c](https://github.com/payloadcms/payload/commit/65f0e1caace193f034139e331883d01d8eb92d2c))
11
- * components optional chaining ([d5e725c](https://github.com/payloadcms/payload/commit/d5e725c608588e96b974291fa86d5e89dea9060d))
12
- * corrects exported custom component type ([2878b4b](https://github.com/payloadcms/payload/commit/2878b4b1bec5c0c9997c1ba2a080640d4d3f8e5f))
13
- * corrects type for CollapsibleLabel example type, adjusts custom component filenames ([ccb4231](https://github.com/payloadcms/payload/commit/ccb42319abf0679d998e15b6b47fff3ce95d4ca1))
14
- * getTranslation fallback ([d82a6be](https://github.com/payloadcms/payload/commit/d82a6be5012a355d0eed98ac57c79a6f1d3c7f32))
15
- * radio and select fields show translated value in list view ([13d225f](https://github.com/payloadcms/payload/commit/13d225ff086c8913a8954dd83e658af5859028bc))
16
- * sets pointer-events to none so the entire label bar is clickable ([e458087](https://github.com/payloadcms/payload/commit/e458087a55cbbad29ca3568ca4c089aaee49693a))
17
- * translation formatting ([d9ddca9](https://github.com/payloadcms/payload/commit/d9ddca9d1b7276a1ed3603ceb78399bd45624032))
18
- * translation typos ([0ed38d4](https://github.com/payloadcms/payload/commit/0ed38d47081b351e70854cc11bdb0efe1ec971ac))
19
- * type error ([6a5bd24](https://github.com/payloadcms/payload/commit/6a5bd24fd125464522b9d27e724efa435fb621a4))
8
+ * adjusts styles to allow error bg to fill textarea ([2e57b76](https://github.com/payloadcms/payload/commit/2e57b76df01acf7ed1ce5fcb824ef5f96d11621d))
9
+ * allows patching global drafts [#1415](https://github.com/payloadcms/payload/issues/1415) ([25822a9](https://github.com/payloadcms/payload/commit/25822a91b1e4f2bf4804f15947d211138d696219))
10
+ * dynamically sets stepnav from default edit view ([40c8778](https://github.com/payloadcms/payload/commit/40c87784b0c6281c599b6d2a46a27b70b0568c30))
11
+ * ensures drafts operations saves as draft [#1415](https://github.com/payloadcms/payload/issues/1415) ([fc16ffe](https://github.com/payloadcms/payload/commit/fc16ffefdb354ea023462d784cdac7ab6fcc26d3))
12
+ * flattens locales before versioning published docs [#1415](https://github.com/payloadcms/payload/issues/1415) ([f700f51](https://github.com/payloadcms/payload/commit/f700f51f2bcdd657d1fab6b6d83ac00a11ed870d))
13
+ * **i18n:** version count ([#1465](https://github.com/payloadcms/payload/issues/1465)) ([075b7e9](https://github.com/payloadcms/payload/commit/075b7e9f02498ea253cf270654dcce0f11ec1f93))
14
+ * Increase textarea click area ([c303913](https://github.com/payloadcms/payload/commit/c303913e61881a3b0d90615dda905b20347d6f1e))
15
+ * invalid query string user account request ([#1478](https://github.com/payloadcms/payload/issues/1478)) ([400cb9b](https://github.com/payloadcms/payload/commit/400cb9b6bcfd09c39cb6aa438daad876d12e8e13))
16
+ * removes incorrectly import/export option type - [#1441](https://github.com/payloadcms/payload/issues/1441) ([ed01a17](https://github.com/payloadcms/payload/commit/ed01a176210a02a32874f4d0d1c5206d9a772e7e))
17
+ * rendering of localized select value ([1d1d249](https://github.com/payloadcms/payload/commit/1d1d2493aa08db4c300c01e72ccb6c11e03f9e09))
18
+ * sanitizes select values on the server, allowing isClearable selects to be cleared without error ([699ca14](https://github.com/payloadcms/payload/commit/699ca14434eeff3025cffd3f6e00efada80e021f))
19
+ * translate version comparison view field labels ([#1470](https://github.com/payloadcms/payload/issues/1470)) ([8123585](https://github.com/payloadcms/payload/commit/8123585592b9a53ef746f17476b36a2661cca025))
20
+ * versionCount was broken & other i18n improvements ([#1450](https://github.com/payloadcms/payload/issues/1450)) ([078c28b](https://github.com/payloadcms/payload/commit/078c28bd5fd08fd17a0b0b360e904f51fe8a2e98))
21
+ * versions tests ([af6a7aa](https://github.com/payloadcms/payload/commit/af6a7aa9e850c0817ea40d755f51255ccf0938c2))
20
22
 
21
23
 
22
24
  ### Features
23
25
 
24
- * add Dutch translations ([#1418](https://github.com/payloadcms/payload/issues/1418)) ([c58ed21](https://github.com/payloadcms/payload/commit/c58ed213c6a879612e0ebe6ac11a4b0f4ab95a1d))
25
- * Add french translations ([#1421](https://github.com/payloadcms/payload/issues/1421)) ([118886e](https://github.com/payloadcms/payload/commit/118886e2ef073464fde432243a9205ce92762282))
26
- * add i18n to admin panel ([d910045](https://github.com/payloadcms/payload/commit/d910045102b2e80c12c96f13941d8d624abbecf5))
27
- * add i18n to local api ([f143f72](https://github.com/payloadcms/payload/commit/f143f724fee85b51697ad54110a0920a398baced))
28
- * Add Italian Translations ([#1335](https://github.com/payloadcms/payload/issues/1335)) ([97c28c8](https://github.com/payloadcms/payload/commit/97c28c809614962a1be795082ed84dbfc2299e79))
29
- * Add Japanese Translations ([#1351](https://github.com/payloadcms/payload/issues/1351)) ([522576c](https://github.com/payloadcms/payload/commit/522576c2b98368f14fe0bf945c703f866bb7646b))
30
- * add language select input to account ([ccee1d8](https://github.com/payloadcms/payload/commit/ccee1d84d4247dc894bf15227728cbb29f924d21))
31
- * add polish translations ([#1328](https://github.com/payloadcms/payload/issues/1328)) ([7e218fe](https://github.com/payloadcms/payload/commit/7e218feb911bcda312f2732266a63c3eccb285a2))
32
- * Add Russian Translations ([#1334](https://github.com/payloadcms/payload/issues/1334)) ([9980765](https://github.com/payloadcms/payload/commit/99807657ba97d68c5d3457794745d4182715abfa))
33
- * Add Spanish Translations ([#1327](https://github.com/payloadcms/payload/issues/1327)) ([edf6877](https://github.com/payloadcms/payload/commit/edf687792489fbc969ba0a0f0f6aab69f637cebe))
34
- * Add swedish translations ([#1429](https://github.com/payloadcms/payload/issues/1429)) ([ba8f739](https://github.com/payloadcms/payload/commit/ba8f7390cabc514735c76c32266be792b0f4596d))
35
- * add Vietnamese translation for the admin panel ([#1346](https://github.com/payloadcms/payload/issues/1346)) ([47f45fa](https://github.com/payloadcms/payload/commit/47f45fae150779ec319bbb35b91469baaa308688))
36
- * adds docs example ([2bf0fff](https://github.com/payloadcms/payload/commit/2bf0fffa0dd83f395aa3318b3baba1e22dd58b51))
37
- * adds playwright tests for array fields ([57a8c35](https://github.com/payloadcms/payload/commit/57a8c352e44750d1785b65074c15812dc8226585))
38
- * allow custom translations in payload config ([16d1c53](https://github.com/payloadcms/payload/commit/16d1c53b8d18c2924644103713b4d785757764dd))
39
- * collection and globals description support i18n ([f39898b](https://github.com/payloadcms/payload/commit/f39898b784cd1fe252fdaeaf97d242a3afef2f36))
40
- * converts rowHeader to collapsibleLabel, extends data passed to functions/components ([13ec1e0](https://github.com/payloadcms/payload/commit/13ec1e0398d2a9ce1aeddc5692008173acfde45e))
41
- * customizable header-labels ([d45de99](https://github.com/payloadcms/payload/commit/d45de99956273c59e6d1a3a11c7cce36f3d123f6))
42
- * fields translations ([a7008de](https://github.com/payloadcms/payload/commit/a7008def47d8701d371d0f312148d98259a607d4))
43
- * GraphQL schema uses names and slugs instead of labels, introduces graphQL names for compatibility ([508faa0](https://github.com/payloadcms/payload/commit/508faa05b20adfd5d218dbb4cb56db890e8c4345))
44
- * i18n base field labels ([fd675f9](https://github.com/payloadcms/payload/commit/fd675f9341bbd9461c418a03ed837c577fdb1ed9))
45
- * i18n errors ([25294d1](https://github.com/payloadcms/payload/commit/25294d1e8b10d7e516fda5894062836fc9ae312f))
46
- * i18n labels blocks ([650d8ab](https://github.com/payloadcms/payload/commit/650d8aba0efe4ddd9e561b78d932fe250be077a4))
47
- * i18n labels, descriptions, placeholders, tabs and nav groups ([ca18afc](https://github.com/payloadcms/payload/commit/ca18afcd994bb3b56548b9c6e10e81907e2542ef))
48
- * i18n translated auth emails, request handlers, operations ([4c6847d](https://github.com/payloadcms/payload/commit/4c6847d303c38c34f31c1508ba52e80828aef733))
49
- * make translations for german language ([#1331](https://github.com/payloadcms/payload/issues/1331)) ([cdfcd0f](https://github.com/payloadcms/payload/commit/cdfcd0f216e40654234e331d47e47bd70f08c459))
50
- * make typescript interface configurable for globals and collections and default to slugs instead of labels ([1ecf2a9](https://github.com/payloadcms/payload/commit/1ecf2a9a06fa334dd9af31600bdefa73d9c0410b))
51
- * nav group translations ([a61748a](https://github.com/payloadcms/payload/commit/a61748a233f968c6b339d3816b0497a459791ac0))
52
- * simplifies collapsible label API, adds e2e tests ([d9df98f](https://github.com/payloadcms/payload/commit/d9df98ff22041908fc2ce0972c844116edd409be))
53
- * specifies component names for arrays/collapsibles, simplifies threaded data ([b74ea21](https://github.com/payloadcms/payload/commit/b74ea218ca47ce9db9d20586dbbce73e4ce0f917))
54
- * translation of elements ([3820840](https://github.com/payloadcms/payload/commit/382084051db5d09b95eef1731b3f94708c5caace))
55
- * translation of views ([9d966cf](https://github.com/payloadcms/payload/commit/9d966cf368a42254e0900f997f2def4a0d972b14))
56
- * translations upload and list ([3d88b61](https://github.com/payloadcms/payload/commit/3d88b618fa3bd5cc5288b05b6ffc1bc25caf9150))
57
- * translations: authentication, upload, edit, theme ([24d356e](https://github.com/payloadcms/payload/commit/24d356e3f662ad3288b17439b62fc8a6cf3d9552))
58
- * validation i18n ([cd38e9d](https://github.com/payloadcms/payload/commit/cd38e9d8ac4ea53112a698e5596f158b464354a0))
59
-
60
-
61
- ### BREAKING CHANGES
62
-
63
- * labels are no longer used for generating typescript interface names. To prevent breaking changes, set the property with the new configuration option
64
- * GraphQL queries and mutation names are no longer based on the labels and could change if you make use of labels that differ from the slug. Consider using new graphQL properties on collections and graphQLName on globals as a way to set the name explicitly to maintain existing GraphQL implementations.
26
+ * add i18n to option labels in version comparison ([#1477](https://github.com/payloadcms/payload/issues/1477)) ([7b6a9ed](https://github.com/payloadcms/payload/commit/7b6a9ede6e3a72e7e64358cb88946b16153d8dc6))
27
+ * exports field types properly ([7c6d6fd](https://github.com/payloadcms/payload/commit/7c6d6fd1caeb25e1a871fa1b9cecc53be8a2a7a1))
65
28
 
66
- ## [1.1.27-beta.0](https://github.com/payloadcms/payload/compare/v1.1.26...v1.1.27-beta.0) (2022-11-17)
29
+ # [1.2.0](https://github.com/payloadcms/payload/compare/v1.1.26...v1.2.0) (2022-11-18)
67
30
 
68
31
 
69
- ### Bug Fixes
32
+ ### 🐛 Bug Fixes
70
33
 
71
- * allow label to be set to false ([858fc86](https://github.com/payloadcms/payload/commit/858fc86af895f25a091f1b5b729d04c86f654601))
72
- * autosave slug regression ([b1f3ce9](https://github.com/payloadcms/payload/commit/b1f3ce9735743b8056633d98fb94353e6f4c08e6))
73
34
  * build errors ([65f0e1c](https://github.com/payloadcms/payload/commit/65f0e1caace193f034139e331883d01d8eb92d2c))
74
35
  * components optional chaining ([d5e725c](https://github.com/payloadcms/payload/commit/d5e725c608588e96b974291fa86d5e89dea9060d))
75
36
  * corrects exported custom component type ([2878b4b](https://github.com/payloadcms/payload/commit/2878b4b1bec5c0c9997c1ba2a080640d4d3f8e5f))
76
37
  * corrects type for CollapsibleLabel example type, adjusts custom component filenames ([ccb4231](https://github.com/payloadcms/payload/commit/ccb42319abf0679d998e15b6b47fff3ce95d4ca1))
77
- * getTranslation fallback ([d82a6be](https://github.com/payloadcms/payload/commit/d82a6be5012a355d0eed98ac57c79a6f1d3c7f32))
78
- * radio and select fields show translated value in list view ([13d225f](https://github.com/payloadcms/payload/commit/13d225ff086c8913a8954dd83e658af5859028bc))
79
38
  * sets pointer-events to none so the entire label bar is clickable ([e458087](https://github.com/payloadcms/payload/commit/e458087a55cbbad29ca3568ca4c089aaee49693a))
80
- * translation formatting ([d9ddca9](https://github.com/payloadcms/payload/commit/d9ddca9d1b7276a1ed3603ceb78399bd45624032))
81
- * translation typos ([0ed38d4](https://github.com/payloadcms/payload/commit/0ed38d47081b351e70854cc11bdb0efe1ec971ac))
82
- * type error ([6a5bd24](https://github.com/payloadcms/payload/commit/6a5bd24fd125464522b9d27e724efa435fb621a4))
83
39
 
84
40
 
85
- ### Features
41
+ ### ✨ Features
86
42
 
87
- * add Dutch translations ([#1418](https://github.com/payloadcms/payload/issues/1418)) ([c58ed21](https://github.com/payloadcms/payload/commit/c58ed213c6a879612e0ebe6ac11a4b0f4ab95a1d))
88
- * Add french translations ([#1421](https://github.com/payloadcms/payload/issues/1421)) ([118886e](https://github.com/payloadcms/payload/commit/118886e2ef073464fde432243a9205ce92762282))
89
- * add i18n to admin panel ([d910045](https://github.com/payloadcms/payload/commit/d910045102b2e80c12c96f13941d8d624abbecf5))
90
- * add i18n to local api ([f143f72](https://github.com/payloadcms/payload/commit/f143f724fee85b51697ad54110a0920a398baced))
91
- * Add Italian Translations ([#1335](https://github.com/payloadcms/payload/issues/1335)) ([97c28c8](https://github.com/payloadcms/payload/commit/97c28c809614962a1be795082ed84dbfc2299e79))
92
- * Add Japanese Translations ([#1351](https://github.com/payloadcms/payload/issues/1351)) ([522576c](https://github.com/payloadcms/payload/commit/522576c2b98368f14fe0bf945c703f866bb7646b))
93
- * add language select input to account ([ccee1d8](https://github.com/payloadcms/payload/commit/ccee1d84d4247dc894bf15227728cbb29f924d21))
94
- * add polish translations ([#1328](https://github.com/payloadcms/payload/issues/1328)) ([7e218fe](https://github.com/payloadcms/payload/commit/7e218feb911bcda312f2732266a63c3eccb285a2))
95
- * Add Russian Translations ([#1334](https://github.com/payloadcms/payload/issues/1334)) ([9980765](https://github.com/payloadcms/payload/commit/99807657ba97d68c5d3457794745d4182715abfa))
96
- * Add Spanish Translations ([#1327](https://github.com/payloadcms/payload/issues/1327)) ([edf6877](https://github.com/payloadcms/payload/commit/edf687792489fbc969ba0a0f0f6aab69f637cebe))
97
- * Add swedish translations ([#1429](https://github.com/payloadcms/payload/issues/1429)) ([ba8f739](https://github.com/payloadcms/payload/commit/ba8f7390cabc514735c76c32266be792b0f4596d))
98
- * add Vietnamese translation for the admin panel ([#1346](https://github.com/payloadcms/payload/issues/1346)) ([47f45fa](https://github.com/payloadcms/payload/commit/47f45fae150779ec319bbb35b91469baaa308688))
43
+ * add i18n to admin panel ([#1326](https://github.com/payloadcms/payload/issues/1326)) ([bab34d8](https://github.com/payloadcms/payload/commit/bab34d82f5fddad32ceafd116ad97e87cab4c862))
99
44
  * adds docs example ([2bf0fff](https://github.com/payloadcms/payload/commit/2bf0fffa0dd83f395aa3318b3baba1e22dd58b51))
100
45
  * adds playwright tests for array fields ([57a8c35](https://github.com/payloadcms/payload/commit/57a8c352e44750d1785b65074c15812dc8226585))
101
- * allow custom translations in payload config ([16d1c53](https://github.com/payloadcms/payload/commit/16d1c53b8d18c2924644103713b4d785757764dd))
102
- * collection and globals description support i18n ([f39898b](https://github.com/payloadcms/payload/commit/f39898b784cd1fe252fdaeaf97d242a3afef2f36))
103
46
  * converts rowHeader to collapsibleLabel, extends data passed to functions/components ([13ec1e0](https://github.com/payloadcms/payload/commit/13ec1e0398d2a9ce1aeddc5692008173acfde45e))
104
47
  * customizable header-labels ([d45de99](https://github.com/payloadcms/payload/commit/d45de99956273c59e6d1a3a11c7cce36f3d123f6))
105
- * fields translations ([a7008de](https://github.com/payloadcms/payload/commit/a7008def47d8701d371d0f312148d98259a607d4))
106
- * GraphQL schema uses names and slugs instead of labels, introduces graphQL names for compatibility ([508faa0](https://github.com/payloadcms/payload/commit/508faa05b20adfd5d218dbb4cb56db890e8c4345))
107
- * i18n base field labels ([fd675f9](https://github.com/payloadcms/payload/commit/fd675f9341bbd9461c418a03ed837c577fdb1ed9))
108
- * i18n errors ([25294d1](https://github.com/payloadcms/payload/commit/25294d1e8b10d7e516fda5894062836fc9ae312f))
109
- * i18n labels blocks ([650d8ab](https://github.com/payloadcms/payload/commit/650d8aba0efe4ddd9e561b78d932fe250be077a4))
110
- * i18n labels, descriptions, placeholders, tabs and nav groups ([ca18afc](https://github.com/payloadcms/payload/commit/ca18afcd994bb3b56548b9c6e10e81907e2542ef))
111
- * i18n translated auth emails, request handlers, operations ([4c6847d](https://github.com/payloadcms/payload/commit/4c6847d303c38c34f31c1508ba52e80828aef733))
112
- * make translations for german language ([#1331](https://github.com/payloadcms/payload/issues/1331)) ([cdfcd0f](https://github.com/payloadcms/payload/commit/cdfcd0f216e40654234e331d47e47bd70f08c459))
113
- * make typescript interface configurable for globals and collections and default to slugs instead of labels ([1ecf2a9](https://github.com/payloadcms/payload/commit/1ecf2a9a06fa334dd9af31600bdefa73d9c0410b))
114
- * nav group translations ([a61748a](https://github.com/payloadcms/payload/commit/a61748a233f968c6b339d3816b0497a459791ac0))
115
48
  * simplifies collapsible label API, adds e2e tests ([d9df98f](https://github.com/payloadcms/payload/commit/d9df98ff22041908fc2ce0972c844116edd409be))
116
49
  * specifies component names for arrays/collapsibles, simplifies threaded data ([b74ea21](https://github.com/payloadcms/payload/commit/b74ea218ca47ce9db9d20586dbbce73e4ce0f917))
117
- * translation of elements ([3820840](https://github.com/payloadcms/payload/commit/382084051db5d09b95eef1731b3f94708c5caace))
118
- * translation of views ([9d966cf](https://github.com/payloadcms/payload/commit/9d966cf368a42254e0900f997f2def4a0d972b14))
119
- * translations upload and list ([3d88b61](https://github.com/payloadcms/payload/commit/3d88b618fa3bd5cc5288b05b6ffc1bc25caf9150))
120
- * translations: authentication, upload, edit, theme ([24d356e](https://github.com/payloadcms/payload/commit/24d356e3f662ad3288b17439b62fc8a6cf3d9552))
121
- * validation i18n ([cd38e9d](https://github.com/payloadcms/payload/commit/cd38e9d8ac4ea53112a698e5596f158b464354a0))
122
50
 
123
51
 
124
- ### BREAKING CHANGES
52
+ ### 🚨 BREAKING CHANGES
53
+
54
+ * You ***might*** need to update your config. This change affects `collections`, `globals` and `block fields` with custom labeling.
55
+ * **Collections:** are affected if you have a custom `labels.singular` defined that differs from your collection slug.
56
+ ```typescript
57
+ // ExampleCollection.ts
58
+
59
+ // Before
60
+ const ExampleCollection: CollectionConfig = {
61
+ slug: 'case-studies',
62
+ labels: {
63
+ // Before Payload used `labels.singular` to generate types/graphQL schema
64
+ singular: 'Project',
65
+ plural: 'Projects',
66
+ },
67
+ }
68
+
69
+ // After
70
+ const ExampleCollection: CollectionConfig = {
71
+ // Now Payload uses `slug` to generate types/graphQL schema
72
+ slug: 'case-studies',
73
+ labels: {
74
+ singular: 'Project',
75
+ plural: 'Projects',
76
+ },
77
+ // To override the usage of slug in graphQL schema generation
78
+ graphQL: {
79
+ singularName: 'Project',
80
+ pluralName: 'Projects',
81
+ },
82
+ // To override the usage of slug in type file generation
83
+ typescript: {
84
+ interface: 'Project',
85
+ }
86
+ }
87
+ ```
88
+ * **Globals:** are affected if you have a `label` defined that differs from your global slug.
89
+ ```typescript
90
+ // ExampleGlobal.ts
91
+
92
+ // Before
93
+ const ExampleGlobal: GlobalConfig = {
94
+ slug: 'footer',
95
+ // Before Payload used `label` to generate types/graphQL schema
96
+ label: 'Page Footer',
97
+ }
98
+
99
+ // After
100
+ const ExampleGlobal: GlobalConfig = {
101
+ // Now Payload uses `slug` to generate types/graphQL schema
102
+ slug: 'footer',
103
+ label: 'Page Footer',
104
+ // To override the usage of slug in graphQL schema generation
105
+ graphQL: {
106
+ name: 'PageFooter',
107
+ },
108
+ // To override the usage of slug in type file generation
109
+ typescript: {
110
+ interface: 'PageFooter',
111
+ },
112
+ }
113
+ ```
114
+ * **Block Fields:** are affected if you have a `label` defined that differs from your block slug.
115
+ ```typescript
116
+ // ExampleBlock.ts
117
+
118
+ // Before
119
+ const ExampleBlock: Block = {
120
+ slug: 'content',
121
+ // Before Payload used `label` to generate graphQL schema
122
+ label: 'Content Block',
123
+ }
124
+
125
+ // After
126
+ const ExampleBlock: Block = {
127
+ // Now Payload uses `slug` to generate graphQL schema
128
+ slug: 'content',
129
+ label: 'Content Block',
130
+ // To override the usage of slug in graphQL schema generation
131
+ graphQL: {
132
+ singularName: 'ContentBlock',
133
+ },
134
+ }
135
+ ```
136
+ **Breaking changes recap**:
137
+ - On Collections
138
+ - Use `graphQL.singularName`, `graphQL.pluralName` for GraphQL schema names.
139
+ - Use `typescript.interface` for typescript generation name.
140
+
141
+ - On Globals
142
+ - Use `graphQL.name` for GraphQL Schema name.
143
+ - Use `typescript.interface` for typescript generation name.
144
+
145
+ - On Blocks (within Block fields)
146
+ - Use `graphQL.singularName` for graphQL schema names.
125
147
 
126
- * labels are no longer used for generating typescript interface names. To prevent breaking changes, set the property with the new configuration option
127
- * GraphQL queries and mutation names are no longer based on the labels and could change if you make use of labels that differ from the slug. Consider using new graphQL properties on collections and graphQLName on globals as a way to set the name explicitly to maintain existing GraphQL implementations.
128
-
129
148
  ## [1.1.26](https://github.com/payloadcms/payload/compare/v1.1.25...v1.1.26) (2022-11-15)
130
149
 
131
150
 
@@ -1,2 +1,2 @@
1
1
  // eslint-disable-next-line import/named
2
- export { Props, Option } from '../../dist/admin/components/forms/field-types/Select/types';
2
+ export { Props } from '../../dist/admin/components/forms/field-types/Select/types';
@@ -24,8 +24,8 @@ const SortableMultiValue = SortableElement((props) => {
24
24
  const SortableMultiValueLabel = SortableHandle((props) => React.createElement(components.MultiValueLabel, { ...props }));
25
25
  const SortableSelect = SortableContainer(Select);
26
26
  const ReactSelect = (props) => {
27
- const { className, showError = false, options, onChange, value, disabled = false, placeholder, isSearchable = true, isClearable, isMulti, isSortable, filterOption = undefined, } = props;
28
- const { i18n } = useTranslation();
27
+ const { t, i18n } = useTranslation();
28
+ const { className, showError = false, options, onChange, value, disabled = false, placeholder = t('general:selectValue'), isSearchable = true, isClearable, isMulti, isSortable, filterOption = undefined, } = props;
29
29
  const classes = [
30
30
  className,
31
31
  'react-select',
@@ -33,6 +33,6 @@ const VersionsCount = ({ collection, global, id }) => {
33
33
  const versionCount = ((versions === null || versions === void 0 ? void 0 : versions.totalDocs) || 0) + initialVersionsCount;
34
34
  return (React.createElement("div", { className: baseClass },
35
35
  versionCount === 0 && t('versionCount_none'),
36
- versionCount > 0 && (React.createElement(Button, { className: `${baseClass}__button`, buttonStyle: "none", el: "link", to: versionsURL }, t('versionCount', { count: versionCount })))));
36
+ versionCount > 0 && (React.createElement(Button, { className: `${baseClass}__button`, buttonStyle: "none", el: "link", to: versionsURL }, t(versionCount === 1 ? 'versionCount_one' : 'versionCount_many', { count: versionCount })))));
37
37
  };
38
38
  export default VersionsCount;
@@ -1,5 +1,9 @@
1
1
  import React from 'react';
2
+ import { useTranslation } from 'react-i18next';
2
3
  import './index.scss';
3
4
  const baseClass = 'condition-value-text';
4
- const Text = ({ onChange, value }) => (React.createElement("input", { placeholder: "Enter a value", className: baseClass, type: "text", onChange: (e) => onChange(e.target.value), value: value || '' }));
5
+ const Text = ({ onChange, value }) => {
6
+ const { t } = useTranslation('general');
7
+ return (React.createElement("input", { placeholder: t('enterAValue'), className: baseClass, type: "text", onChange: (e) => onChange(e.target.value), value: value || '' }));
8
+ };
5
9
  export default Text;
@@ -1,4 +1,4 @@
1
- import { i18n as Ii18n } from 'i18next';
1
+ import type { TFunction } from 'i18next';
2
2
  import { User } from '../../../../../auth';
3
3
  import { NonPresentationalField } from '../../../../../fields/config/types';
4
4
  import { Fields, Data } from '../types';
@@ -14,7 +14,7 @@ declare type Args = {
14
14
  operation: 'create' | 'update';
15
15
  data: Data;
16
16
  fullData: Data;
17
- i18n: Ii18n;
17
+ t: TFunction;
18
18
  };
19
- export declare const addFieldStatePromise: ({ field, locale, user, state, path, passesCondition, fullData, data, fieldPromises, id, operation, i18n, }: Args) => Promise<void>;
19
+ export declare const addFieldStatePromise: ({ field, locale, user, state, path, passesCondition, fullData, data, fieldPromises, id, operation, t, }: Args) => Promise<void>;
20
20
  export {};
@@ -3,7 +3,7 @@ import ObjectID from 'bson-objectid';
3
3
  import { fieldAffectsData, fieldHasSubFields, tabHasName, } from '../../../../../fields/config/types';
4
4
  import getValueWithDefault from '../../../../../fields/getDefaultValue';
5
5
  import { iterateFields } from './iterateFields';
6
- export const addFieldStatePromise = async ({ field, locale, user, state, path, passesCondition, fullData, data, fieldPromises, id, operation, i18n, }) => {
6
+ export const addFieldStatePromise = async ({ field, locale, user, state, path, passesCondition, fullData, data, fieldPromises, id, operation, t, }) => {
7
7
  var _a;
8
8
  if (fieldAffectsData(field)) {
9
9
  const fieldState = {
@@ -27,7 +27,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
27
27
  siblingData: data,
28
28
  id,
29
29
  operation,
30
- i18n,
30
+ t,
31
31
  });
32
32
  }
33
33
  if (typeof validationResult === 'string') {
@@ -59,7 +59,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
59
59
  id,
60
60
  locale,
61
61
  operation,
62
- i18n,
62
+ t,
63
63
  });
64
64
  });
65
65
  // Add values to field state
@@ -105,7 +105,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
105
105
  operation,
106
106
  fieldPromises,
107
107
  id,
108
- i18n,
108
+ t,
109
109
  });
110
110
  }
111
111
  });
@@ -132,7 +132,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
132
132
  path: `${path}${field.name}.`,
133
133
  locale,
134
134
  user,
135
- i18n,
135
+ t,
136
136
  });
137
137
  break;
138
138
  }
@@ -159,7 +159,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
159
159
  id,
160
160
  locale,
161
161
  operation,
162
- i18n,
162
+ t,
163
163
  });
164
164
  }
165
165
  else if (field.type === 'tabs') {
@@ -176,7 +176,7 @@ export const addFieldStatePromise = async ({ field, locale, user, state, path, p
176
176
  id,
177
177
  locale,
178
178
  operation,
179
- i18n,
179
+ t,
180
180
  });
181
181
  });
182
182
  }
@@ -1,4 +1,4 @@
1
- import { i18n as Ii18n } from 'i18next';
1
+ import type { TFunction } from 'i18next';
2
2
  import { User } from '../../../../../auth';
3
3
  import { Field as FieldSchema } from '../../../../../fields/config/types';
4
4
  import { Fields, Data } from '../types';
@@ -10,7 +10,7 @@ declare type Args = {
10
10
  id?: string | number;
11
11
  operation?: 'create' | 'update';
12
12
  locale: string;
13
- i18n: Ii18n;
13
+ t: TFunction;
14
14
  };
15
15
  declare const buildStateFromSchema: (args: Args) => Promise<Fields>;
16
16
  export default buildStateFromSchema;
@@ -1,6 +1,6 @@
1
1
  import { iterateFields } from './iterateFields';
2
2
  const buildStateFromSchema = async (args) => {
3
- const { fieldSchema, data: fullData = {}, user, id, operation, locale, i18n, } = args;
3
+ const { fieldSchema, data: fullData = {}, user, id, operation, locale, t, } = args;
4
4
  if (fieldSchema) {
5
5
  const fieldPromises = [];
6
6
  const state = {};
@@ -16,7 +16,7 @@ const buildStateFromSchema = async (args) => {
16
16
  data: fullData,
17
17
  fullData,
18
18
  parentPassesCondition: true,
19
- i18n,
19
+ t,
20
20
  });
21
21
  await Promise.all(fieldPromises);
22
22
  return state;
@@ -1,4 +1,4 @@
1
- import { i18n as Ii18n } from 'i18next';
1
+ import type { TFunction } from 'i18next';
2
2
  import { User } from '../../../../../auth';
3
3
  import { Field as FieldSchema } from '../../../../../fields/config/types';
4
4
  import { Fields, Data } from '../types';
@@ -14,7 +14,7 @@ declare type Args = {
14
14
  fieldPromises: Promise<void>[];
15
15
  id: string | number;
16
16
  operation: 'create' | 'update';
17
- i18n: Ii18n;
17
+ t: TFunction;
18
18
  };
19
- export declare const iterateFields: ({ fields, data, parentPassesCondition, path, fullData, user, locale, operation, fieldPromises, id, state, i18n, }: Args) => void;
19
+ export declare const iterateFields: ({ fields, data, parentPassesCondition, path, fullData, user, locale, operation, fieldPromises, id, state, t, }: Args) => void;
20
20
  export {};
@@ -1,6 +1,6 @@
1
1
  import { fieldIsPresentationalOnly, } from '../../../../../fields/config/types';
2
2
  import { addFieldStatePromise } from './addFieldStatePromise';
3
- export const iterateFields = ({ fields, data, parentPassesCondition, path = '', fullData, user, locale, operation, fieldPromises, id, state, i18n, }) => {
3
+ export const iterateFields = ({ fields, data, parentPassesCondition, path = '', fullData, user, locale, operation, fieldPromises, id, state, t, }) => {
4
4
  fields.forEach((field) => {
5
5
  var _a, _b;
6
6
  const initialData = data;
@@ -18,7 +18,7 @@ export const iterateFields = ({ fields, data, parentPassesCondition, path = '',
18
18
  field,
19
19
  passesCondition,
20
20
  data,
21
- i18n,
21
+ t,
22
22
  }));
23
23
  }
24
24
  });
@@ -65,7 +65,7 @@ const Form = (props) => {
65
65
  user,
66
66
  id,
67
67
  operation,
68
- i18n,
68
+ t,
69
69
  });
70
70
  }
71
71
  if (typeof validationResult === 'string') {
@@ -81,7 +81,7 @@ const Form = (props) => {
81
81
  dispatchFields({ type: 'REPLACE_STATE', state: validatedFieldState });
82
82
  }
83
83
  return isValid;
84
- }, [contextRef, id, user, operation, i18n, dispatchFields]);
84
+ }, [contextRef, id, user, operation, t, dispatchFields]);
85
85
  const submit = useCallback(async (options = {}, e) => {
86
86
  const { overrides = {}, action: actionToUse = action, method: methodToUse = method, skipValidation, } = options;
87
87
  if (disabled) {
@@ -256,10 +256,10 @@ const Form = (props) => {
256
256
  return formData;
257
257
  }, [contextRef]);
258
258
  const reset = useCallback(async (fieldSchema, data) => {
259
- const state = await buildStateFromSchema({ fieldSchema, data, user, id, operation, locale, i18n });
259
+ const state = await buildStateFromSchema({ fieldSchema, data, user, id, operation, locale, t });
260
260
  contextRef.current = { ...initContextState };
261
261
  dispatchFields({ type: 'REPLACE_STATE', state });
262
- }, [id, user, operation, locale, i18n, dispatchFields]);
262
+ }, [id, user, operation, locale, t, dispatchFields]);
263
263
  contextRef.current.submit = submit;
264
264
  contextRef.current.getFields = getFields;
265
265
  contextRef.current.getField = getField;
@@ -63,14 +63,14 @@ const ArrayFieldType = (props) => {
63
63
  disableFormData: (rows === null || rows === void 0 ? void 0 : rows.length) > 0,
64
64
  });
65
65
  const addRow = useCallback(async (rowIndex) => {
66
- const subFieldState = await buildStateFromSchema({ fieldSchema: fields, operation, id, user, locale, i18n });
66
+ const subFieldState = await buildStateFromSchema({ fieldSchema: fields, operation, id, user, locale, t });
67
67
  dispatchFields({ type: 'ADD_ROW', rowIndex, subFieldState, path });
68
68
  dispatchRows({ type: 'ADD', rowIndex });
69
69
  setModified(true);
70
70
  setTimeout(() => {
71
71
  scrollToID(`${path}-row-${rowIndex + 1}`);
72
72
  }, 0);
73
- }, [dispatchRows, dispatchFields, fields, path, operation, id, user, locale, setModified, i18n]);
73
+ }, [dispatchRows, dispatchFields, fields, path, operation, id, user, locale, setModified, t]);
74
74
  const duplicateRow = useCallback(async (rowIndex) => {
75
75
  dispatchFields({ type: 'DUPLICATE_ROW', rowIndex, path });
76
76
  dispatchRows({ type: 'ADD', rowIndex });
@@ -63,14 +63,14 @@ const BlocksField = (props) => {
63
63
  }, []);
64
64
  const addRow = useCallback(async (rowIndex, blockType) => {
65
65
  const block = blocks.find((potentialBlock) => potentialBlock.slug === blockType);
66
- const subFieldState = await buildStateFromSchema({ fieldSchema: block.fields, operation, id, user, locale, i18n });
66
+ const subFieldState = await buildStateFromSchema({ fieldSchema: block.fields, operation, id, user, locale, t });
67
67
  dispatchFields({ type: 'ADD_ROW', rowIndex, subFieldState, path, blockType });
68
68
  dispatchRows({ type: 'ADD', rowIndex, blockType });
69
69
  setModified(true);
70
70
  setTimeout(() => {
71
71
  scrollToID(`${path}-row-${rowIndex + 1}`);
72
72
  }, 0);
73
- }, [blocks, operation, id, user, locale, i18n, dispatchFields, path, setModified]);
73
+ }, [blocks, operation, id, user, locale, t, dispatchFields, path, setModified]);
74
74
  const duplicateRow = useCallback(async (rowIndex, blockType) => {
75
75
  dispatchFields({ type: 'DUPLICATE_ROW', rowIndex, path });
76
76
  dispatchRows({ type: 'ADD', rowIndex, blockType });
@@ -29,11 +29,11 @@ export const AddNewRelationModal = ({ modalCollection, onSave, modalSlug }) => {
29
29
  const modalAction = `${serverURL}${api}/${modalCollection.slug}?locale=${locale}&depth=0&fallback-locale=null`;
30
30
  useEffect(() => {
31
31
  const buildState = async () => {
32
- const state = await buildStateFromSchema({ fieldSchema: modalCollection.fields, data: {}, user, operation: 'create', locale, i18n });
32
+ const state = await buildStateFromSchema({ fieldSchema: modalCollection.fields, data: {}, user, operation: 'create', locale, t });
33
33
  setInitialState(state);
34
34
  };
35
35
  buildState();
36
- }, [modalCollection, locale, user, i18n]);
36
+ }, [modalCollection, locale, user, t]);
37
37
  useEffect(() => {
38
38
  setIsAnimated(true);
39
39
  }, []);
@@ -19,7 +19,7 @@ export const LinkButton = ({ fieldProps }) => {
19
19
  var _a, _b;
20
20
  const customFieldSchema = (_b = (_a = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.admin) === null || _a === void 0 ? void 0 : _a.link) === null || _b === void 0 ? void 0 : _b.fields;
21
21
  const modalSlug = `${baseModalSlug}-${fieldProps.path}`;
22
- const { i18n } = useTranslation();
22
+ const { t } = useTranslation();
23
23
  const config = useConfig();
24
24
  const editor = useSlate();
25
25
  const { user } = useAuth();
@@ -61,7 +61,7 @@ export const LinkButton = ({ fieldProps }) => {
61
61
  const data = {
62
62
  text: editor.selection ? Editor.string(editor, editor.selection) : '',
63
63
  };
64
- const state = await buildStateFromSchema({ fieldSchema, data, user, operation: 'create', locale, i18n });
64
+ const state = await buildStateFromSchema({ fieldSchema, data, user, operation: 'create', locale, t });
65
65
  setInitialState(state);
66
66
  }
67
67
  }
@@ -25,7 +25,7 @@ export const LinkElement = ({ attributes, children, element, editorRef, fieldPro
25
25
  const config = useConfig();
26
26
  const { user } = useAuth();
27
27
  const locale = useLocale();
28
- const { t, i18n } = useTranslation('fields');
28
+ const { t } = useTranslation('fields');
29
29
  const { openModal, toggleModal } = useModal();
30
30
  const [renderModal, setRenderModal] = useState(false);
31
31
  const [renderPopup, setRenderPopup] = useState(false);
@@ -67,11 +67,11 @@ export const LinkElement = ({ attributes, children, element, editorRef, fieldPro
67
67
  newTab: element.newTab,
68
68
  fields: deepCopyObject(element.fields),
69
69
  };
70
- const state = await buildStateFromSchema({ fieldSchema, data, user, operation: 'update', locale, i18n });
70
+ const state = await buildStateFromSchema({ fieldSchema, data, user, operation: 'update', locale, t });
71
71
  setInitialState(state);
72
72
  };
73
73
  awaitInitialState();
74
- }, [renderModal, element, fieldSchema, user, locale, i18n]);
74
+ }, [renderModal, element, fieldSchema, user, locale, t]);
75
75
  return (React.createElement("span", { className: baseClass, ...attributes },
76
76
  React.createElement("span", { style: { userSelect: 'none' }, contentEditable: false },
77
77
  renderModal && (React.createElement(EditModal, { modalSlug: modalSlug, fieldSchema: fieldSchema, close: () => {
@@ -31,11 +31,11 @@ export const EditModal = ({ slug, closeModal, relatedCollectionConfig, fieldSche
31
31
  }, [closeModal, editor, element]);
32
32
  useEffect(() => {
33
33
  const awaitInitialState = async () => {
34
- const state = await buildStateFromSchema({ fieldSchema, data: { ...(element === null || element === void 0 ? void 0 : element.fields) || {} }, user, operation: 'update', locale, i18n });
34
+ const state = await buildStateFromSchema({ fieldSchema, data: { ...(element === null || element === void 0 ? void 0 : element.fields) || {} }, user, operation: 'update', locale, t });
35
35
  setInitialState(state);
36
36
  };
37
37
  awaitInitialState();
38
- }, [fieldSchema, element.fields, user, locale, i18n]);
38
+ }, [fieldSchema, element.fields, user, locale, t]);
39
39
  return (React.createElement(Modal, { slug: slug, className: baseClass },
40
40
  React.createElement(MinimalTemplate, { width: "wide" },
41
41
  React.createElement("header", { className: `${baseClass}__header` },
@@ -18,10 +18,20 @@ const SelectInput = (props) => {
18
18
  ].filter(Boolean).join(' ');
19
19
  let valueToRender;
20
20
  if (hasMany && Array.isArray(value)) {
21
- valueToRender = value.map((val) => options.find((option) => option.value === val));
21
+ valueToRender = value.map((val) => {
22
+ const matchingOption = options.find((option) => option.value === val);
23
+ return {
24
+ label: getTranslation(matchingOption.label, i18n),
25
+ value: matchingOption.value,
26
+ };
27
+ });
22
28
  }
23
- else {
24
- valueToRender = options.find((option) => option.value === value);
29
+ else if (value) {
30
+ const matchingOption = options.find((option) => option.value === value);
31
+ valueToRender = {
32
+ label: getTranslation(matchingOption.label, i18n),
33
+ value: matchingOption.value,
34
+ };
25
35
  }
26
36
  return (React.createElement("div", { id: `field-${path.replace(/\./gi, '__')}`, className: classes, style: {
27
37
  ...style,