payload 1.2.0 → 1.2.2

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 (138) hide show
  1. package/CHANGELOG.md +161 -16
  2. package/components/fields/Array.ts +1 -2
  3. package/components/fields/Blocks.ts +1 -2
  4. package/components/fields/Cell.ts +1 -1
  5. package/components/fields/Checkbox.ts +1 -2
  6. package/components/fields/Code.ts +1 -2
  7. package/components/fields/DateTime.ts +1 -2
  8. package/components/fields/Email.ts +1 -2
  9. package/components/fields/Group.ts +1 -2
  10. package/components/fields/Number.ts +1 -2
  11. package/components/fields/Password.ts +1 -2
  12. package/components/fields/RadioGroup/RadioInput.ts +1 -2
  13. package/components/fields/RadioGroup/index.ts +1 -2
  14. package/components/fields/Relationship.ts +1 -2
  15. package/components/fields/RichText.ts +1 -2
  16. package/components/fields/Row.ts +1 -2
  17. package/components/fields/Select.ts +1 -2
  18. package/components/fields/Text.ts +1 -2
  19. package/components/fields/Textarea.ts +1 -2
  20. package/components/fields/Upload.ts +1 -2
  21. package/components/views/Cell.ts +1 -2
  22. package/components/views/Edit.ts +1 -2
  23. package/components/views/List.ts +1 -2
  24. package/dist/admin/components/elements/ReactSelect/index.js +4 -4
  25. package/dist/admin/components/elements/ReactSelect/types.d.ts +11 -10
  26. package/dist/admin/components/elements/Status/index.js +1 -1
  27. package/dist/admin/components/elements/VersionsCount/index.js +1 -1
  28. package/dist/admin/components/elements/WhereBuilder/Condition/Text/index.js +5 -1
  29. package/dist/admin/components/forms/Form/context.d.ts +15 -0
  30. package/dist/admin/components/forms/Form/context.js +16 -1
  31. package/dist/admin/components/forms/field-types/Blocks/SectionTitle/index.scss +3 -2
  32. package/dist/admin/components/forms/field-types/Blocks/index.js +1 -1
  33. package/dist/admin/components/forms/field-types/Code/Code.js +3 -4
  34. package/dist/admin/components/forms/field-types/Code/index.scss +177 -78
  35. package/dist/admin/components/forms/field-types/Relationship/AddNew/index.js +0 -1
  36. package/dist/admin/components/forms/field-types/Relationship/GetFilterOptions/index.d.ts +11 -0
  37. package/dist/admin/components/forms/field-types/Relationship/GetFilterOptions/index.js +37 -0
  38. package/dist/admin/components/forms/field-types/Relationship/findOptionsByValue.d.ts +8 -0
  39. package/dist/admin/components/forms/field-types/Relationship/findOptionsByValue.js +29 -0
  40. package/dist/admin/components/forms/field-types/Relationship/index.js +89 -139
  41. package/dist/admin/components/forms/field-types/Relationship/optionsReducer.d.ts +2 -2
  42. package/dist/admin/components/forms/field-types/Relationship/optionsReducer.js +2 -29
  43. package/dist/admin/components/forms/field-types/Relationship/types.d.ts +14 -2
  44. package/dist/admin/components/forms/field-types/RichText/elements/link/Element.js +3 -3
  45. package/dist/admin/components/forms/field-types/RichText/elements/link/index.scss +2 -1
  46. package/dist/admin/components/forms/field-types/RichText/elements/upload/Button/index.js +1 -1
  47. package/dist/admin/components/forms/field-types/Row/index.js +1 -1
  48. package/dist/admin/components/forms/field-types/Select/Input.d.ts +2 -2
  49. package/dist/admin/components/forms/field-types/Select/Input.js +13 -3
  50. package/dist/admin/components/forms/field-types/Textarea/Input.js +1 -1
  51. package/dist/admin/components/forms/field-types/Textarea/index.scss +3 -6
  52. package/dist/admin/components/forms/useField/index.d.ts +5 -0
  53. package/dist/admin/components/forms/useField/index.js +5 -0
  54. package/dist/admin/components/utilities/I18n/index.js +1 -1
  55. package/dist/admin/components/views/Account/index.js +6 -1
  56. package/dist/admin/components/views/Global/index.scss +31 -24
  57. package/dist/admin/components/views/Login/index.js +1 -1
  58. package/dist/admin/components/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +1 -1
  59. package/dist/admin/components/views/Version/RenderFieldsToDiff/fields/Nested/index.js +15 -9
  60. package/dist/admin/components/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +5 -2
  61. package/dist/admin/components/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts +5 -0
  62. package/dist/admin/components/views/Version/RenderFieldsToDiff/fields/Select/index.js +34 -0
  63. package/dist/admin/components/views/Version/RenderFieldsToDiff/fields/Select/index.scss +10 -0
  64. package/dist/admin/components/views/Version/RenderFieldsToDiff/fields/Text/index.js +3 -2
  65. package/dist/admin/components/views/Version/RenderFieldsToDiff/fields/index.js +3 -2
  66. package/dist/admin/components/views/Versions/index.js +1 -1
  67. package/dist/admin/components/views/collections/Edit/Default.js +2 -0
  68. package/dist/admin/components/views/collections/Edit/SetStepNav.d.ts +7 -0
  69. package/dist/admin/components/views/collections/Edit/SetStepNav.js +31 -0
  70. package/dist/admin/components/views/collections/Edit/index.js +2 -36
  71. package/dist/admin/components/views/collections/Edit/index.scss +19 -4
  72. package/dist/admin/hooks/usePayloadAPI.js +3 -1
  73. package/dist/collections/buildSchema.js +5 -1
  74. package/dist/collections/config/types.d.ts +16 -3
  75. package/dist/collections/operations/find.js +11 -6
  76. package/dist/collections/operations/findVersions.js +4 -5
  77. package/dist/collections/operations/update.js +8 -9
  78. package/dist/collections/requestHandlers/find.js +4 -3
  79. package/dist/collections/requestHandlers/update.js +3 -3
  80. package/dist/config/schema.js +2 -2
  81. package/dist/config/types.d.ts +269 -6
  82. package/dist/config/types.js +1 -1
  83. package/dist/email/build.js +2 -2
  84. package/dist/express/types.d.ts +26 -2
  85. package/dist/fields/config/sanitize.spec.js +5 -5
  86. package/dist/fields/config/types.d.ts +3 -3
  87. package/dist/fields/hooks/afterRead/relationshipPopulationPromise.js +73 -21
  88. package/dist/fields/hooks/beforeChange/promise.js +7 -1
  89. package/dist/globals/operations/findVersions.js +4 -5
  90. package/dist/globals/operations/update.js +4 -4
  91. package/dist/globals/requestHandlers/update.js +3 -3
  92. package/dist/graphql/schema/fieldToWhereInputSchemaMap.js +7 -7
  93. package/dist/graphql/schema/operators.d.ts +1 -0
  94. package/dist/graphql/schema/operators.js +2 -1
  95. package/dist/mongoose/types.d.ts +3 -3
  96. package/dist/translations/de.json +100 -100
  97. package/dist/translations/en.json +3 -1
  98. package/dist/translations/es.json +1 -1
  99. package/dist/translations/fr.json +1 -1
  100. package/dist/translations/index.d.ts +5 -0
  101. package/dist/translations/it.json +19 -16
  102. package/dist/translations/my.json +1 -1
  103. package/dist/translations/nl.json +1 -1
  104. package/dist/translations/pl.json +1 -1
  105. package/dist/translations/pt.json +1 -1
  106. package/dist/translations/ru.json +1 -1
  107. package/dist/translations/sv.json +1 -1
  108. package/dist/translations/vi.json +1 -1
  109. package/dist/utilities/isNumber.d.ts +1 -0
  110. package/dist/utilities/isNumber.js +8 -0
  111. package/dist/versions/drafts/saveCollectionDraft.js +4 -3
  112. package/dist/versions/drafts/saveGlobalDraft.js +4 -3
  113. package/dist/versions/ensurePublishedCollectionVersion.js +2 -1
  114. package/dist/versions/ensurePublishedGlobalVersion.js +2 -1
  115. package/dist/versions/getLatestCollectionVersion.d.ts +10 -0
  116. package/dist/versions/getLatestCollectionVersion.js +27 -0
  117. package/dist/versions/getLatestGlobalVersion.d.ts +10 -0
  118. package/dist/versions/getLatestGlobalVersion.js +27 -0
  119. package/docs/admin/components.mdx +1 -5
  120. package/docs/authentication/config.mdx +1 -1
  121. package/docs/configuration/globals.mdx +12 -12
  122. package/docs/configuration/i18n.mdx +1 -1
  123. package/docs/fields/array.mdx +14 -14
  124. package/docs/fields/blocks.mdx +1 -1
  125. package/docs/fields/checkbox.mdx +2 -2
  126. package/docs/fields/code.mdx +1 -1
  127. package/docs/fields/date.mdx +1 -1
  128. package/docs/fields/email.mdx +1 -1
  129. package/docs/fields/number.mdx +1 -1
  130. package/docs/fields/radio.mdx +1 -1
  131. package/docs/fields/relationship.mdx +1 -1
  132. package/docs/fields/rich-text.mdx +1 -1
  133. package/docs/fields/select.mdx +2 -2
  134. package/docs/fields/text.mdx +2 -2
  135. package/docs/fields/textarea.mdx +1 -1
  136. package/docs/fields/upload.mdx +51 -17
  137. package/docs/production/preventing-abuse.mdx +6 -6
  138. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -1,10 +1,74 @@
1
1
 
2
2
 
3
- # [1.2.0](https://github.com/payloadcms/payload/compare/v1.1.26...v1.2.0) (2022-11-18)
3
+ ## [1.2.2](https://github.com/payloadcms/payload/compare/v1.2.1...v1.2.2) (2022-12-02)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * adds contain operators for text/email/radio fields ([4c37af6](https://github.com/payloadcms/payload/commit/4c37af6f10dcfd77b5aec963bc5f84a178942143))
9
+ * adjusts how limit is set, both in options and paginates limit ([a718010](https://github.com/payloadcms/payload/commit/a71801006cbc4b989d5057a5f04e8e8e0a6dbeed))
10
+ * aligns mongoose PaginatedDocs type with actual lib type ([dce2081](https://github.com/payloadcms/payload/commit/dce208166337a8e47cc41301c9c5be0854199eaa))
11
+ * allows for form controlled relationship fields to be populated ([e4435bb](https://github.com/payloadcms/payload/commit/e4435bb8bd13fd7122124fb6e171f4bd1cce819c))
12
+ * allows for limit bypass on version find operations ([891f00d](https://github.com/payloadcms/payload/commit/891f00d05cd57d9387dd25be81daa3de99e315ed))
13
+ * blockName grows in all browsers ([03c2ab5](https://github.com/payloadcms/payload/commit/03c2ab52a89817e94ec9a7b4339e807d995e04f6))
14
+ * corrects skipValidation ([e6f1c6f](https://github.com/payloadcms/payload/commit/e6f1c6fc7bb56fe5a858b405c3bf799a46ac57f4))
15
+ * dynamic relationship filterOptions ([99c1f41](https://github.com/payloadcms/payload/commit/99c1f41e306a11547965fd938fa5607787243003))
16
+ * ensures enums cannot query on partial matches ([ec51929](https://github.com/payloadcms/payload/commit/ec51929b1af0b2c1138aa315d106b52f7e771779))
17
+ * german translation optimizations ([#1485](https://github.com/payloadcms/payload/issues/1485)) ([e9d2163](https://github.com/payloadcms/payload/commit/e9d21636011ac084fa26ffbea199fc766fe19b25))
18
+ * handle multiple locales in relationship population ([#1452](https://github.com/payloadcms/payload/issues/1452)) ([04c689c](https://github.com/payloadcms/payload/commit/04c689c5b04bc91020eb682b97721eba213836d2))
19
+ * **i18n:** requiresAtLeast variable in de.json ([#1556](https://github.com/payloadcms/payload/issues/1556)) ([47fd0d9](https://github.com/payloadcms/payload/commit/47fd0d9ec4aa62335d505a0bfba0305355a318ca))
20
+ * ignore validation when unpublishing, do not allow restore with invalid form state ([77ab542](https://github.com/payloadcms/payload/commit/77ab54243ab1857f4f430be4f8c4dc51e15f94ca))
21
+ * indexSortableFields timestamp fields [#1506](https://github.com/payloadcms/payload/issues/1506) ([#1537](https://github.com/payloadcms/payload/issues/1537)) ([7aada3c](https://github.com/payloadcms/payload/commit/7aada3c746603b91bbb4fadf953f36e23fba5121))
22
+ * infinite rerenders, accounts for hasMany false ([16d00e8](https://github.com/payloadcms/payload/commit/16d00e87c2f8b63e695e46ccbf279ad90621dc17))
23
+ * moves relationship field useEffect into async reducer action ([54ef40a](https://github.com/payloadcms/payload/commit/54ef40a335905f7295f847c68762f7fe06bccc30))
24
+ * moves sharp types from devDeps to deps ([b3d526b](https://github.com/payloadcms/payload/commit/b3d526b59a275a1f58a76322a588ba8a6370f26b))
25
+ * reverts async reducer and resolves infinite effect ([a9da81f](https://github.com/payloadcms/payload/commit/a9da81f18cf9e6eba67187a3a2735b267949e0ae))
26
+ * sanitize number query params before passing to find operation ([c8d1b9f](https://github.com/payloadcms/payload/commit/c8d1b9f88af62ad1ab927ca3d035fa4c031989f1))
27
+ * translate select field option labels ([#1476](https://github.com/payloadcms/payload/issues/1476)) ([3a9dc9e](https://github.com/payloadcms/payload/commit/3a9dc9ef68374692c3314651bee6e1b00ae55f17))
28
+ * update drafts includes latest version changes ([48989d0](https://github.com/payloadcms/payload/commit/48989d0f6ed086dc60dc94165a4e0ca8120f9b1a))
29
+ * updates code field css ([3eebd66](https://github.com/payloadcms/payload/commit/3eebd6613f66f3cac38e00cfd94e80b2999cf791))
30
+ * updates syntax colors for light theme ([dbfe7ca](https://github.com/payloadcms/payload/commit/dbfe7ca6e61e3a93baabc378f52835af9e53fd38))
31
+ * uses baseClass in code field ([d03f0ae](https://github.com/payloadcms/payload/commit/d03f0aef8423597aceb36ddbbb1cc63033d0066d))
32
+
33
+
34
+ ### Features
35
+
36
+ * decouples limit from pagination, allows for no limit query ([f7ce0c6](https://github.com/payloadcms/payload/commit/f7ce0c615d76035ee48ef32047613ab1415deb44))
37
+ * improve typescript comments ([#1467](https://github.com/payloadcms/payload/issues/1467)) ([5bd8657](https://github.com/payloadcms/payload/commit/5bd86571cada5791003bbfa84183f5b300649533))
38
+ * log email transport error messages ([#1469](https://github.com/payloadcms/payload/issues/1469)) ([a90a1a9](https://github.com/payloadcms/payload/commit/a90a1a9e19bb54eb6d88129b5e2cb6483e22db61))
39
+ * removes theme provider and updates background for code fields ([1a6c9a3](https://github.com/payloadcms/payload/commit/1a6c9a3e181930a6f45027fecc5313e8d7228c71))
40
+
41
+ ## [1.2.1](https://github.com/payloadcms/payload/compare/v1.2.0...v1.2.1) (2022-11-22)
4
42
 
5
43
 
6
44
  ### Bug Fixes
7
45
 
46
+ * adjusts styles to allow error bg to fill textarea ([2e57b76](https://github.com/payloadcms/payload/commit/2e57b76df01acf7ed1ce5fcb824ef5f96d11621d))
47
+ * allows patching global drafts [#1415](https://github.com/payloadcms/payload/issues/1415) ([25822a9](https://github.com/payloadcms/payload/commit/25822a91b1e4f2bf4804f15947d211138d696219))
48
+ * dynamically sets stepnav from default edit view ([40c8778](https://github.com/payloadcms/payload/commit/40c87784b0c6281c599b6d2a46a27b70b0568c30))
49
+ * ensures drafts operations saves as draft [#1415](https://github.com/payloadcms/payload/issues/1415) ([fc16ffe](https://github.com/payloadcms/payload/commit/fc16ffefdb354ea023462d784cdac7ab6fcc26d3))
50
+ * flattens locales before versioning published docs [#1415](https://github.com/payloadcms/payload/issues/1415) ([f700f51](https://github.com/payloadcms/payload/commit/f700f51f2bcdd657d1fab6b6d83ac00a11ed870d))
51
+ * **i18n:** version count ([#1465](https://github.com/payloadcms/payload/issues/1465)) ([075b7e9](https://github.com/payloadcms/payload/commit/075b7e9f02498ea253cf270654dcce0f11ec1f93))
52
+ * Increase textarea click area ([c303913](https://github.com/payloadcms/payload/commit/c303913e61881a3b0d90615dda905b20347d6f1e))
53
+ * invalid query string user account request ([#1478](https://github.com/payloadcms/payload/issues/1478)) ([400cb9b](https://github.com/payloadcms/payload/commit/400cb9b6bcfd09c39cb6aa438daad876d12e8e13))
54
+ * removes incorrectly import/export option type - [#1441](https://github.com/payloadcms/payload/issues/1441) ([ed01a17](https://github.com/payloadcms/payload/commit/ed01a176210a02a32874f4d0d1c5206d9a772e7e))
55
+ * rendering of localized select value ([1d1d249](https://github.com/payloadcms/payload/commit/1d1d2493aa08db4c300c01e72ccb6c11e03f9e09))
56
+ * sanitizes select values on the server, allowing isClearable selects to be cleared without error ([699ca14](https://github.com/payloadcms/payload/commit/699ca14434eeff3025cffd3f6e00efada80e021f))
57
+ * translate version comparison view field labels ([#1470](https://github.com/payloadcms/payload/issues/1470)) ([8123585](https://github.com/payloadcms/payload/commit/8123585592b9a53ef746f17476b36a2661cca025))
58
+ * versionCount was broken & other i18n improvements ([#1450](https://github.com/payloadcms/payload/issues/1450)) ([078c28b](https://github.com/payloadcms/payload/commit/078c28bd5fd08fd17a0b0b360e904f51fe8a2e98))
59
+ * versions tests ([af6a7aa](https://github.com/payloadcms/payload/commit/af6a7aa9e850c0817ea40d755f51255ccf0938c2))
60
+
61
+
62
+ ### Features
63
+
64
+ * add i18n to option labels in version comparison ([#1477](https://github.com/payloadcms/payload/issues/1477)) ([7b6a9ed](https://github.com/payloadcms/payload/commit/7b6a9ede6e3a72e7e64358cb88946b16153d8dc6))
65
+ * exports field types properly ([7c6d6fd](https://github.com/payloadcms/payload/commit/7c6d6fd1caeb25e1a871fa1b9cecc53be8a2a7a1))
66
+
67
+ # [1.2.0](https://github.com/payloadcms/payload/compare/v1.1.26...v1.2.0) (2022-11-18)
68
+
69
+
70
+ ### 🐛 Bug Fixes
71
+
8
72
  * build errors ([65f0e1c](https://github.com/payloadcms/payload/commit/65f0e1caace193f034139e331883d01d8eb92d2c))
9
73
  * components optional chaining ([d5e725c](https://github.com/payloadcms/payload/commit/d5e725c608588e96b974291fa86d5e89dea9060d))
10
74
  * corrects exported custom component type ([2878b4b](https://github.com/payloadcms/payload/commit/2878b4b1bec5c0c9997c1ba2a080640d4d3f8e5f))
@@ -12,7 +76,7 @@
12
76
  * sets pointer-events to none so the entire label bar is clickable ([e458087](https://github.com/payloadcms/payload/commit/e458087a55cbbad29ca3568ca4c089aaee49693a))
13
77
 
14
78
 
15
- ### Features
79
+ ### ✨ Features
16
80
 
17
81
  * add i18n to admin panel ([#1326](https://github.com/payloadcms/payload/issues/1326)) ([bab34d8](https://github.com/payloadcms/payload/commit/bab34d82f5fddad32ceafd116ad97e87cab4c862))
18
82
  * adds docs example ([2bf0fff](https://github.com/payloadcms/payload/commit/2bf0fffa0dd83f395aa3318b3baba1e22dd58b51))
@@ -23,21 +87,102 @@
23
87
  * specifies component names for arrays/collapsibles, simplifies threaded data ([b74ea21](https://github.com/payloadcms/payload/commit/b74ea218ca47ce9db9d20586dbbce73e4ce0f917))
24
88
 
25
89
 
26
- ### BREAKING CHANGES
27
-
28
- * If you assigned labels to collections, globals or block names, you need to update your config! Your GraphQL schema and generated Typescript interfaces may have changed. Payload no longer uses labels for code based naming. To prevent breaking changes to your GraphQL API and typescript types in your project, you can assign the below properties to match what Payload previously generated for you from labels.
29
-
30
- On Collections
31
- Use `graphQL.singularName`, `graphQL.pluralName` for GraphQL schema names.
32
- Use `typescript.interface` for typescript generation name.
90
+ ### 🚨 BREAKING CHANGES
91
+
92
+ * You ***might*** need to update your config. This change affects `collections`, `globals` and `block fields` with custom labeling.
93
+ * **Collections:** are affected if you have a custom `labels.singular` defined that differs from your collection slug.
94
+ ```typescript
95
+ // ExampleCollection.ts
96
+
97
+ // Before
98
+ const ExampleCollection: CollectionConfig = {
99
+ slug: 'case-studies',
100
+ labels: {
101
+ // Before Payload used `labels.singular` to generate types/graphQL schema
102
+ singular: 'Project',
103
+ plural: 'Projects',
104
+ },
105
+ }
106
+
107
+ // After
108
+ const ExampleCollection: CollectionConfig = {
109
+ // Now Payload uses `slug` to generate types/graphQL schema
110
+ slug: 'case-studies',
111
+ labels: {
112
+ singular: 'Project',
113
+ plural: 'Projects',
114
+ },
115
+ // To override the usage of slug in graphQL schema generation
116
+ graphQL: {
117
+ singularName: 'Project',
118
+ pluralName: 'Projects',
119
+ },
120
+ // To override the usage of slug in type file generation
121
+ typescript: {
122
+ interface: 'Project',
123
+ }
124
+ }
125
+ ```
126
+ * **Globals:** are affected if you have a `label` defined that differs from your global slug.
127
+ ```typescript
128
+ // ExampleGlobal.ts
129
+
130
+ // Before
131
+ const ExampleGlobal: GlobalConfig = {
132
+ slug: 'footer',
133
+ // Before Payload used `label` to generate types/graphQL schema
134
+ label: 'Page Footer',
135
+ }
136
+
137
+ // After
138
+ const ExampleGlobal: GlobalConfig = {
139
+ // Now Payload uses `slug` to generate types/graphQL schema
140
+ slug: 'footer',
141
+ label: 'Page Footer',
142
+ // To override the usage of slug in graphQL schema generation
143
+ graphQL: {
144
+ name: 'PageFooter',
145
+ },
146
+ // To override the usage of slug in type file generation
147
+ typescript: {
148
+ interface: 'PageFooter',
149
+ },
150
+ }
151
+ ```
152
+ * **Block Fields:** are affected if you have a `label` defined that differs from your block slug.
153
+ ```typescript
154
+ // ExampleBlock.ts
155
+
156
+ // Before
157
+ const ExampleBlock: Block = {
158
+ slug: 'content',
159
+ // Before Payload used `label` to generate graphQL schema
160
+ label: 'Content Block',
161
+ }
162
+
163
+ // After
164
+ const ExampleBlock: Block = {
165
+ // Now Payload uses `slug` to generate graphQL schema
166
+ slug: 'content',
167
+ label: 'Content Block',
168
+ // To override the usage of slug in graphQL schema generation
169
+ graphQL: {
170
+ singularName: 'ContentBlock',
171
+ },
172
+ }
173
+ ```
174
+ **Breaking changes recap**:
175
+ - On Collections
176
+ - Use `graphQL.singularName`, `graphQL.pluralName` for GraphQL schema names.
177
+ - Use `typescript.interface` for typescript generation name.
178
+
179
+ - On Globals
180
+ - Use `graphQL.name` for GraphQL Schema name.
181
+ - Use `typescript.interface` for typescript generation name.
182
+
183
+ - On Blocks (within Block fields)
184
+ - Use `graphQL.singularName` for graphQL schema names.
33
185
 
34
- On Globals
35
- Use `graphQL.name` for GraphQL Schema name.
36
- Use `typescript.interface` for typescript generation name.
37
-
38
- On Blocks (within Block fields)
39
- Use `graphQL.singularName` for graphQL schema names.
40
-
41
186
  ## [1.1.26](https://github.com/payloadcms/payload/compare/v1.1.25...v1.1.26) (2022-11-15)
42
187
 
43
188
 
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props, RenderArrayProps } from '../../dist/admin/components/forms/field-types/Array/types';
1
+ export type { Props } from '../../dist/admin/components/forms/field-types/Array/types';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props, RenderBlockProps } from '../../dist/admin/components/forms/field-types/Blocks/types';
1
+ export type { Props } from '../../dist/admin/components/forms/field-types/Blocks/types';
@@ -1 +1 @@
1
- export { Props } from '../../dist/admin/components/views/collections/List/Cell/types';
1
+ export type { Props } from '../../dist/admin/components/views/collections/List/Cell/types';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props } from '../../dist/admin/components/forms/field-types/Checkbox/types';
1
+ export type { Props } from '../../dist/admin/components/forms/field-types/Checkbox/types';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props } from '../../dist/admin/components/forms/field-types/Code/types';
1
+ export type { Props } from '../../dist/admin/components/forms/field-types/Code/types';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props } from '../../dist/admin/components/forms/field-types/DateTime/types';
1
+ export type { Props } from '../../dist/admin/components/forms/field-types/DateTime/types';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props } from '../../dist/admin/components/forms/field-types/Email/types';
1
+ export type { Props } from '../../dist/admin/components/forms/field-types/Email/types';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props } from '../../dist/admin/components/forms/field-types/Group/types';
1
+ export type { Props } from '../../dist/admin/components/forms/field-types/Group/types';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props } from '../../dist/admin/components/forms/field-types/Number/types';
1
+ export type { Props } from '../../dist/admin/components/forms/field-types/Number/types';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props } from '../../dist/admin/components/forms/field-types/Password/types';
1
+ export type { Props } from '../../dist/admin/components/forms/field-types/Password/types';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props } from '../../../dist/admin/components/forms/field-types/RadioGroup/RadioInput/types';
1
+ export type { Props } from '../../../dist/admin/components/forms/field-types/RadioGroup/RadioInput/types';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props } from '../../../dist/admin/components/forms/field-types/RadioGroup/types';
1
+ export type { Props } from '../../../dist/admin/components/forms/field-types/RadioGroup/types';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props, Option, ValueWithRelation } from '../../dist/admin/components/forms/field-types/Relationship/types';
1
+ export type { Props, Option, ValueWithRelation } from '../../dist/admin/components/forms/field-types/Relationship/types';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props } from '../../dist/admin/components/forms/field-types/RichText/types';
1
+ export type { Props } from '../../dist/admin/components/forms/field-types/RichText/types';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props } from '../../dist/admin/components/forms/field-types/Row/types';
1
+ export type { Props } from '../../dist/admin/components/forms/field-types/Row/types';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props, Option } from '../../dist/admin/components/forms/field-types/Select/types';
1
+ export type { Props } from '../../dist/admin/components/forms/field-types/Select/types';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props } from '../../dist/admin/components/forms/field-types/Text/types';
1
+ export type { Props } from '../../dist/admin/components/forms/field-types/Text/types';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props } from '../../dist/admin/components/forms/field-types/Textarea/types';
1
+ export type { Props } from '../../dist/admin/components/forms/field-types/Textarea/types';
@@ -1,2 +1 @@
1
- // eslint-disable-next-line import/named
2
- export { Props } from '../../dist/admin/components/forms/field-types/Upload/types';
1
+ export type { Props } from '../../dist/admin/components/forms/field-types/Upload/types';
@@ -1,3 +1,2 @@
1
1
  export { default as Cell } from '../../dist/admin/components/views/collections/List/Cell';
2
- // eslint-disable-next-line import/named
3
- export { Props } from '../../dist/admin/components/views/collections/List/Cell/types';
2
+ export type { Props } from '../../dist/admin/components/views/collections/List/Cell/types';
@@ -1,3 +1,2 @@
1
1
  export { default as Edit } from '../../dist/admin/components/views/collections/Edit/Default';
2
- // eslint-disable-next-line import/named
3
- export { Props } from '../../dist/admin/components/views/collections/Edit/types';
2
+ export type { Props } from '../../dist/admin/components/views/collections/Edit/types';
@@ -1,3 +1,2 @@
1
1
  export { default as List } from '../../dist/admin/components/views/collections/List/Default';
2
- // eslint-disable-next-line import/named
3
- export { Props } from '../../dist/admin/components/views/collections/Edit/types';
2
+ export type { Props } from '../../dist/admin/components/views/collections/Edit/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 = true, isMulti, isSortable, filterOption = undefined, isLoading, onMenuOpen, } = props;
29
29
  const classes = [
30
30
  className,
31
31
  'react-select',
@@ -47,7 +47,7 @@ const ReactSelect = (props) => {
47
47
  // small fix for https://github.com/clauderic/react-sortable-hoc/pull/352:
48
48
  getHelperDimensions: ({ node }) => node.getBoundingClientRect(),
49
49
  // react-select props:
50
- placeholder: getTranslation(placeholder, i18n), ...props, value: value, onChange: onChange, disabled: disabled ? 'disabled' : undefined, className: classes, classNamePrefix: "rs", captureMenuScroll: true, options: options, isSearchable: isSearchable, isClearable: isClearable, components: {
50
+ placeholder: getTranslation(placeholder, i18n), ...props, value: value, onChange: onChange, disabled: disabled ? 'disabled' : undefined, className: classes, classNamePrefix: "rs", captureMenuScroll: true, options: options, isSearchable: isSearchable, isClearable: isClearable, isLoading: isLoading, onMenuOpen: onMenuOpen, components: {
51
51
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
52
52
  // @ts-ignore We're failing to provide a required index prop to SortableElement
53
53
  MultiValue: SortableMultiValue,
@@ -55,6 +55,6 @@ const ReactSelect = (props) => {
55
55
  DropdownIndicator: Chevron,
56
56
  }, filterOption: filterOption }));
57
57
  }
58
- return (React.createElement(Select, { placeholder: getTranslation(placeholder, i18n), captureMenuScroll: true, ...props, value: value, onChange: onChange, disabled: disabled ? 'disabled' : undefined, components: { DropdownIndicator: Chevron }, className: classes, classNamePrefix: "rs", options: options, isSearchable: isSearchable, isClearable: isClearable, filterOption: filterOption }));
58
+ return (React.createElement(Select, { isLoading: isLoading, placeholder: getTranslation(placeholder, i18n), captureMenuScroll: true, ...props, value: value, onChange: onChange, disabled: disabled ? 'disabled' : undefined, components: { DropdownIndicator: Chevron }, className: classes, classNamePrefix: "rs", options: options, isSearchable: isSearchable, isClearable: isClearable, filterOption: filterOption, onMenuOpen: onMenuOpen }));
59
59
  };
60
60
  export default ReactSelect;
@@ -1,21 +1,22 @@
1
- import { OptionsType, GroupedOptionsType } from 'react-select';
2
- export declare type Options = OptionsType<Value> | GroupedOptionsType<Value>;
3
- export declare type OptionType = {
4
- [key: string]: any;
1
+ export declare type Option = {
2
+ [key: string]: unknown;
3
+ value: unknown;
5
4
  };
6
- export declare type Value = {
5
+ export declare type OptionGroup = {
7
6
  label: string;
8
- value: string | null;
9
- options?: Options;
7
+ options: Option[];
10
8
  };
11
9
  export declare type Props = {
12
10
  className?: string;
13
- value?: Value | Value[];
11
+ value?: Option | Option[];
14
12
  onChange?: (value: any) => void;
13
+ onMenuOpen?: () => void;
15
14
  disabled?: boolean;
16
15
  showError?: boolean;
17
- options: Options;
16
+ options: Option[] | OptionGroup[];
18
17
  isMulti?: boolean;
18
+ isLoading?: boolean;
19
+ isOptionSelected?: any;
19
20
  isSortable?: boolean;
20
21
  isDisabled?: boolean;
21
22
  onInputChange?: (val: string) => void;
@@ -26,6 +27,6 @@ export declare type Props = {
26
27
  filterOption?: (({ label, value, data }: {
27
28
  label: string;
28
29
  value: string;
29
- data: OptionType;
30
+ data: Option;
30
31
  }, search: string) => boolean) | undefined;
31
32
  };
@@ -77,7 +77,7 @@ const Status = () => {
77
77
  getVersions();
78
78
  }
79
79
  else {
80
- toast.error(t('unPublishingDocument'));
80
+ toast.error(t('error:unPublishingDocument'));
81
81
  }
82
82
  setProcessing(false);
83
83
  if (action === 'revert') {
@@ -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;
@@ -6,11 +6,26 @@ declare const SubmittedContext: import("react").Context<boolean>;
6
6
  declare const ProcessingContext: import("react").Context<boolean>;
7
7
  declare const ModifiedContext: import("react").Context<boolean>;
8
8
  declare const FormFieldsContext: import("use-context-selector").Context<FormFieldsContextType>;
9
+ /**
10
+ * Get the state of the form, can be used to submit & validate the form.
11
+ *
12
+ * @see https://payloadcms.com/docs/admin/hooks#useform
13
+ */
9
14
  declare const useForm: () => Context;
10
15
  declare const useWatchForm: () => Context;
11
16
  declare const useFormSubmitted: () => boolean;
12
17
  declare const useFormProcessing: () => boolean;
13
18
  declare const useFormModified: () => boolean;
19
+ /**
20
+ * Get and set the value of a form field based on a selector
21
+ *
22
+ * @see https://payloadcms.com/docs/admin/hooks#useformfields
23
+ */
14
24
  declare const useFormFields: <Value = unknown>(selector: (context: FormFieldsContextType) => Value) => Value;
25
+ /**
26
+ * Get the state of all form fields.
27
+ *
28
+ * @see https://payloadcms.com/docs/admin/hooks#useallformfields
29
+ */
15
30
  declare const useAllFormFields: () => FormFieldsContextType;
16
31
  export { SubmittedContext, ProcessingContext, ModifiedContext, useFormSubmitted, useFormProcessing, useFormModified, useForm, FormContext, FormFieldsContext, useFormFields, useAllFormFields, FormWatchContext, useWatchForm, };
@@ -15,6 +15,11 @@ const ModifiedContext = (0, react_1.createContext)(false);
15
15
  exports.ModifiedContext = ModifiedContext;
16
16
  const FormFieldsContext = (0, use_context_selector_1.createContext)([{}, () => null]);
17
17
  exports.FormFieldsContext = FormFieldsContext;
18
+ /**
19
+ * Get the state of the form, can be used to submit & validate the form.
20
+ *
21
+ * @see https://payloadcms.com/docs/admin/hooks#useform
22
+ */
18
23
  const useForm = () => (0, react_1.useContext)(FormContext);
19
24
  exports.useForm = useForm;
20
25
  const useWatchForm = () => (0, react_1.useContext)(FormWatchContext);
@@ -25,8 +30,18 @@ const useFormProcessing = () => (0, react_1.useContext)(ProcessingContext);
25
30
  exports.useFormProcessing = useFormProcessing;
26
31
  const useFormModified = () => (0, react_1.useContext)(ModifiedContext);
27
32
  exports.useFormModified = useFormModified;
33
+ /**
34
+ * Get and set the value of a form field based on a selector
35
+ *
36
+ * @see https://payloadcms.com/docs/admin/hooks#useformfields
37
+ */
28
38
  const useFormFields = (selector) => (0, use_context_selector_1.useContextSelector)(FormFieldsContext, selector);
29
39
  exports.useFormFields = useFormFields;
40
+ /**
41
+ * Get the state of all form fields.
42
+ *
43
+ * @see https://payloadcms.com/docs/admin/hooks#useallformfields
44
+ */
30
45
  const useAllFormFields = () => (0, use_context_selector_1.useContext)(FormFieldsContext);
31
46
  exports.useAllFormFields = useAllFormFields;
32
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udGV4dC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9hZG1pbi9jb21wb25lbnRzL2Zvcm1zL0Zvcm0vY29udGV4dC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxpQ0FBa0Q7QUFDbEQsK0RBQWdJO0FBR2hJLE1BQU0sV0FBVyxHQUFHLElBQUEscUJBQWEsRUFBQyxFQUFhLENBQUMsQ0FBQztBQXdCL0Msa0NBQVc7QUF2QmIsTUFBTSxnQkFBZ0IsR0FBRyxJQUFBLHFCQUFhLEVBQUMsRUFBYSxDQUFDLENBQUM7QUEyQnBELDRDQUFnQjtBQTFCbEIsTUFBTSxnQkFBZ0IsR0FBRyxJQUFBLHFCQUFhLEVBQUMsS0FBSyxDQUFDLENBQUM7QUFlNUMsNENBQWdCO0FBZGxCLE1BQU0saUJBQWlCLEdBQUcsSUFBQSxxQkFBYSxFQUFDLEtBQUssQ0FBQyxDQUFDO0FBZTdDLDhDQUFpQjtBQWRuQixNQUFNLGVBQWUsR0FBRyxJQUFBLHFCQUFhLEVBQUMsS0FBSyxDQUFDLENBQUM7QUFlM0MsMENBQWU7QUFkakIsTUFBTSxpQkFBaUIsR0FBRyxJQUFBLG9DQUFxQixFQUF3QixDQUFDLEVBQUUsRUFBRSxHQUFHLEVBQUUsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDO0FBb0J2Riw4Q0FBaUI7QUFsQm5CLE1BQU0sT0FBTyxHQUFHLEdBQVksRUFBRSxDQUFDLElBQUEsa0JBQVUsRUFBQyxXQUFXLENBQUMsQ0FBQztBQWdCckQsMEJBQU87QUFmVCxNQUFNLFlBQVksR0FBRyxHQUFZLEVBQUUsQ0FBQyxJQUFBLGtCQUFVLEVBQUMsZ0JBQWdCLENBQUMsQ0FBQztBQXFCL0Qsb0NBQVk7QUFwQmQsTUFBTSxnQkFBZ0IsR0FBRyxHQUFZLEVBQUUsQ0FBQyxJQUFBLGtCQUFVLEVBQUMsZ0JBQWdCLENBQUMsQ0FBQztBQVduRSw0Q0FBZ0I7QUFWbEIsTUFBTSxpQkFBaUIsR0FBRyxHQUFZLEVBQUUsQ0FBQyxJQUFBLGtCQUFVLEVBQUMsaUJBQWlCLENBQUMsQ0FBQztBQVdyRSw4Q0FBaUI7QUFWbkIsTUFBTSxlQUFlLEdBQUcsR0FBWSxFQUFFLENBQUMsSUFBQSxrQkFBVSxFQUFDLGVBQWUsQ0FBQyxDQUFDO0FBV2pFLDBDQUFlO0FBVGpCLE1BQU0sYUFBYSxHQUFHLENBQWtCLFFBQW1ELEVBQVMsRUFBRSxDQUFDLElBQUEseUNBQWtCLEVBQUMsaUJBQWlCLEVBQUUsUUFBUSxDQUFDLENBQUM7QUFhckosc0NBQWE7QUFaZixNQUFNLGdCQUFnQixHQUFHLEdBQTBCLEVBQUUsQ0FBQyxJQUFBLGlDQUFjLEVBQUMsaUJBQWlCLENBQUMsQ0FBQztBQWF0Riw0Q0FBZ0IifQ==
47
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udGV4dC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9hZG1pbi9jb21wb25lbnRzL2Zvcm1zL0Zvcm0vY29udGV4dC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxpQ0FBa0Q7QUFDbEQsK0RBQWdJO0FBR2hJLE1BQU0sV0FBVyxHQUFHLElBQUEscUJBQWEsRUFBQyxFQUFhLENBQUMsQ0FBQztBQXlDL0Msa0NBQVc7QUF4Q2IsTUFBTSxnQkFBZ0IsR0FBRyxJQUFBLHFCQUFhLEVBQUMsRUFBYSxDQUFDLENBQUM7QUE0Q3BELDRDQUFnQjtBQTNDbEIsTUFBTSxnQkFBZ0IsR0FBRyxJQUFBLHFCQUFhLEVBQUMsS0FBSyxDQUFDLENBQUM7QUFnQzVDLDRDQUFnQjtBQS9CbEIsTUFBTSxpQkFBaUIsR0FBRyxJQUFBLHFCQUFhLEVBQUMsS0FBSyxDQUFDLENBQUM7QUFnQzdDLDhDQUFpQjtBQS9CbkIsTUFBTSxlQUFlLEdBQUcsSUFBQSxxQkFBYSxFQUFDLEtBQUssQ0FBQyxDQUFDO0FBZ0MzQywwQ0FBZTtBQS9CakIsTUFBTSxpQkFBaUIsR0FBRyxJQUFBLG9DQUFxQixFQUF3QixDQUFDLEVBQUUsRUFBRSxHQUFHLEVBQUUsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDO0FBcUN2Riw4Q0FBaUI7QUFuQ25COzs7O0dBSUc7QUFDSCxNQUFNLE9BQU8sR0FBRyxHQUFZLEVBQUUsQ0FBQyxJQUFBLGtCQUFVLEVBQUMsV0FBVyxDQUFDLENBQUM7QUE0QnJELDBCQUFPO0FBM0JULE1BQU0sWUFBWSxHQUFHLEdBQVksRUFBRSxDQUFDLElBQUEsa0JBQVUsRUFBQyxnQkFBZ0IsQ0FBQyxDQUFDO0FBaUMvRCxvQ0FBWTtBQWhDZCxNQUFNLGdCQUFnQixHQUFHLEdBQVksRUFBRSxDQUFDLElBQUEsa0JBQVUsRUFBQyxnQkFBZ0IsQ0FBQyxDQUFDO0FBdUJuRSw0Q0FBZ0I7QUF0QmxCLE1BQU0saUJBQWlCLEdBQUcsR0FBWSxFQUFFLENBQUMsSUFBQSxrQkFBVSxFQUFDLGlCQUFpQixDQUFDLENBQUM7QUF1QnJFLDhDQUFpQjtBQXRCbkIsTUFBTSxlQUFlLEdBQUcsR0FBWSxFQUFFLENBQUMsSUFBQSxrQkFBVSxFQUFDLGVBQWUsQ0FBQyxDQUFDO0FBdUJqRSwwQ0FBZTtBQXBCakI7Ozs7R0FJRztBQUNILE1BQU0sYUFBYSxHQUFHLENBQWtCLFFBQW1ELEVBQVMsRUFBRSxDQUFDLElBQUEseUNBQWtCLEVBQUMsaUJBQWlCLEVBQUUsUUFBUSxDQUFDLENBQUM7QUFtQnJKLHNDQUFhO0FBakJmOzs7O0dBSUc7QUFDSCxNQUFNLGdCQUFnQixHQUFHLEdBQTBCLEVBQUUsQ0FBQyxJQUFBLGlDQUFjLEVBQUMsaUJBQWlCLENBQUMsQ0FBQztBQWF0Riw0Q0FBZ0IifQ==
@@ -24,7 +24,8 @@
24
24
  color: var(--theme-elevation-800);
25
25
  background-color: transparent;
26
26
  border: none;
27
- width: auto;
27
+ width: 100%;
28
+ text-overflow: ellipsis;
28
29
  resize: none;
29
30
  appearance: none;
30
31
  position: absolute;
@@ -46,4 +47,4 @@
46
47
  box-shadow: none;
47
48
  }
48
49
  }
49
- }
50
+ }
@@ -195,7 +195,7 @@ const BlocksField = (props) => {
195
195
  }
196
196
  return null;
197
197
  }),
198
- (rows.length < minRows || (required && rows.length === 0)) && (React.createElement(Banner, { type: "error" }, t('requiresAtLeast', {
198
+ (rows.length < minRows || (required && rows.length === 0)) && (React.createElement(Banner, { type: "error" }, t('validation:requiresAtLeast', {
199
199
  count: minRows,
200
200
  label: getTranslation(minRows === 1 || typeof minRows === 'undefined' ? labels.singular : labels.plural, i18n),
201
201
  }))),
@@ -17,6 +17,7 @@ import Error from '../../Error';
17
17
  import FieldDescription from '../../FieldDescription';
18
18
  import { code } from '../../../../../fields/validations';
19
19
  import './index.scss';
20
+ const baseClass = 'code-field';
20
21
  const Code = (props) => {
21
22
  const { path: pathFromProps, name, required, validate = code, admin: { readOnly, style, className, width, language, description, condition, } = {}, label, } = props;
22
23
  const [highlighter] = useState(() => {
@@ -35,8 +36,8 @@ const Code = (props) => {
35
36
  condition,
36
37
  });
37
38
  const classes = [
39
+ baseClass,
38
40
  'field-type',
39
- 'code',
40
41
  className,
41
42
  showError && 'error',
42
43
  readOnly && 'read-only',
@@ -47,9 +48,7 @@ const Code = (props) => {
47
48
  } },
48
49
  React.createElement(Error, { showError: showError, message: errorMessage }),
49
50
  React.createElement(Label, { htmlFor: `field-${path}`, label: label, required: required }),
50
- React.createElement(Editor, { id: `field-${path.replace(/\./gi, '__')}`, value: value || '', onValueChange: readOnly ? () => null : setValue, highlight: highlighter, padding: 25, style: {
51
- backgroundColor: 'var(--theme-base-850)',
52
- color: 'var(--theme-base-0)',
51
+ React.createElement(Editor, { className: `${baseClass}__input`, id: `field-${path.replace(/\./gi, '__')}`, value: value || '', onValueChange: readOnly ? () => null : setValue, highlight: highlighter, padding: 25, style: {
53
52
  fontFamily: '"Consolas", "Monaco", monospace',
54
53
  fontSize: 12,
55
54
  pointerEvents: readOnly ? 'none' : 'auto',