payload 1.2.1 → 1.2.3

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 (109) hide show
  1. package/CHANGELOG.md +47 -2
  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 +3 -3
  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/forms/Form/context.d.ts +15 -0
  28. package/dist/admin/components/forms/Form/context.js +16 -1
  29. package/dist/admin/components/forms/field-types/Blocks/SectionTitle/index.scss +3 -2
  30. package/dist/admin/components/forms/field-types/Blocks/index.js +1 -1
  31. package/dist/admin/components/forms/field-types/Code/Code.js +3 -4
  32. package/dist/admin/components/forms/field-types/Code/index.scss +177 -78
  33. package/dist/admin/components/forms/field-types/Relationship/AddNew/index.js +0 -1
  34. package/dist/admin/components/forms/field-types/Relationship/GetFilterOptions/index.d.ts +11 -0
  35. package/dist/admin/components/forms/field-types/Relationship/GetFilterOptions/index.js +37 -0
  36. package/dist/admin/components/forms/field-types/Relationship/findOptionsByValue.d.ts +8 -0
  37. package/dist/admin/components/forms/field-types/Relationship/findOptionsByValue.js +29 -0
  38. package/dist/admin/components/forms/field-types/Relationship/index.js +89 -139
  39. package/dist/admin/components/forms/field-types/Relationship/optionsReducer.d.ts +2 -2
  40. package/dist/admin/components/forms/field-types/Relationship/optionsReducer.js +2 -29
  41. package/dist/admin/components/forms/field-types/Relationship/types.d.ts +14 -2
  42. package/dist/admin/components/forms/field-types/RichText/elements/link/Element.js +3 -3
  43. package/dist/admin/components/forms/field-types/RichText/elements/link/index.scss +2 -1
  44. package/dist/admin/components/forms/field-types/RichText/elements/upload/Button/index.js +1 -1
  45. package/dist/admin/components/forms/field-types/Row/index.js +1 -1
  46. package/dist/admin/components/forms/field-types/Select/Input.d.ts +2 -2
  47. package/dist/admin/components/forms/useField/index.d.ts +5 -0
  48. package/dist/admin/components/forms/useField/index.js +5 -0
  49. package/dist/admin/components/utilities/I18n/index.js +1 -1
  50. package/dist/admin/components/views/Account/Default.js +1 -1
  51. package/dist/admin/components/views/Global/index.scss +31 -24
  52. package/dist/admin/components/views/collections/Edit/Auth/index.js +1 -1
  53. package/dist/admin/components/views/collections/Edit/index.scss +19 -4
  54. package/dist/collections/buildSchema.js +5 -1
  55. package/dist/collections/config/types.d.ts +16 -3
  56. package/dist/collections/operations/find.js +11 -6
  57. package/dist/collections/operations/findVersions.js +4 -5
  58. package/dist/collections/operations/update.js +13 -11
  59. package/dist/collections/requestHandlers/find.js +4 -3
  60. package/dist/config/schema.js +2 -2
  61. package/dist/config/types.d.ts +269 -6
  62. package/dist/config/types.js +1 -1
  63. package/dist/email/build.js +2 -2
  64. package/dist/express/types.d.ts +26 -2
  65. package/dist/fields/config/sanitize.spec.js +5 -5
  66. package/dist/fields/config/types.d.ts +3 -3
  67. package/dist/fields/hooks/afterRead/relationshipPopulationPromise.js +73 -21
  68. package/dist/globals/operations/findVersions.js +4 -5
  69. package/dist/globals/operations/update.js +4 -4
  70. package/dist/graphql/schema/fieldToWhereInputSchemaMap.js +7 -7
  71. package/dist/graphql/schema/operators.d.ts +1 -0
  72. package/dist/graphql/schema/operators.js +2 -1
  73. package/dist/mongoose/types.d.ts +3 -3
  74. package/dist/translations/de.json +100 -100
  75. package/dist/translations/en.json +1 -1
  76. package/dist/translations/es.json +1 -1
  77. package/dist/translations/fr.json +1 -1
  78. package/dist/translations/it.json +1 -1
  79. package/dist/translations/my.json +1 -1
  80. package/dist/translations/nl.json +1 -1
  81. package/dist/translations/pl.json +1 -1
  82. package/dist/translations/pt.json +1 -1
  83. package/dist/translations/ru.json +1 -1
  84. package/dist/translations/sv.json +1 -1
  85. package/dist/translations/vi.json +1 -1
  86. package/dist/utilities/isNumber.d.ts +1 -0
  87. package/dist/utilities/isNumber.js +8 -0
  88. package/dist/versions/getLatestCollectionVersion.d.ts +11 -0
  89. package/dist/versions/getLatestCollectionVersion.js +27 -0
  90. package/dist/versions/getLatestGlobalVersion.d.ts +10 -0
  91. package/dist/versions/getLatestGlobalVersion.js +27 -0
  92. package/docs/admin/components.mdx +1 -5
  93. package/docs/configuration/globals.mdx +12 -12
  94. package/docs/fields/array.mdx +14 -14
  95. package/docs/fields/blocks.mdx +1 -1
  96. package/docs/fields/checkbox.mdx +2 -2
  97. package/docs/fields/code.mdx +1 -1
  98. package/docs/fields/date.mdx +1 -1
  99. package/docs/fields/email.mdx +1 -1
  100. package/docs/fields/number.mdx +1 -1
  101. package/docs/fields/radio.mdx +1 -1
  102. package/docs/fields/relationship.mdx +1 -1
  103. package/docs/fields/rich-text.mdx +1 -1
  104. package/docs/fields/select.mdx +2 -2
  105. package/docs/fields/text.mdx +2 -2
  106. package/docs/fields/textarea.mdx +1 -1
  107. package/docs/fields/upload.mdx +51 -17
  108. package/docs/production/preventing-abuse.mdx +6 -6
  109. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
 
2
2
 
3
+ ## [1.2.3](https://github.com/payloadcms/payload/compare/v1.2.2...v1.2.3) (2022-12-02)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * reset password regression ([#1574](https://github.com/payloadcms/payload/issues/1574)) ([396ea0b](https://github.com/payloadcms/payload/commit/396ea0bd53dc9e1ae1e348d6fe1eb3c36232b35b))
9
+
10
+ ## [1.2.2](https://github.com/payloadcms/payload/compare/v1.2.1...v1.2.2) (2022-12-02)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * adds contain operators for text/email/radio fields ([4c37af6](https://github.com/payloadcms/payload/commit/4c37af6f10dcfd77b5aec963bc5f84a178942143))
16
+ * adjusts how limit is set, both in options and paginates limit ([a718010](https://github.com/payloadcms/payload/commit/a71801006cbc4b989d5057a5f04e8e8e0a6dbeed))
17
+ * aligns mongoose PaginatedDocs type with actual lib type ([dce2081](https://github.com/payloadcms/payload/commit/dce208166337a8e47cc41301c9c5be0854199eaa))
18
+ * allows for form controlled relationship fields to be populated ([e4435bb](https://github.com/payloadcms/payload/commit/e4435bb8bd13fd7122124fb6e171f4bd1cce819c))
19
+ * allows for limit bypass on version find operations ([891f00d](https://github.com/payloadcms/payload/commit/891f00d05cd57d9387dd25be81daa3de99e315ed))
20
+ * blockName grows in all browsers ([03c2ab5](https://github.com/payloadcms/payload/commit/03c2ab52a89817e94ec9a7b4339e807d995e04f6))
21
+ * corrects skipValidation ([e6f1c6f](https://github.com/payloadcms/payload/commit/e6f1c6fc7bb56fe5a858b405c3bf799a46ac57f4))
22
+ * dynamic relationship filterOptions ([99c1f41](https://github.com/payloadcms/payload/commit/99c1f41e306a11547965fd938fa5607787243003))
23
+ * ensures enums cannot query on partial matches ([ec51929](https://github.com/payloadcms/payload/commit/ec51929b1af0b2c1138aa315d106b52f7e771779))
24
+ * german translation optimizations ([#1485](https://github.com/payloadcms/payload/issues/1485)) ([e9d2163](https://github.com/payloadcms/payload/commit/e9d21636011ac084fa26ffbea199fc766fe19b25))
25
+ * handle multiple locales in relationship population ([#1452](https://github.com/payloadcms/payload/issues/1452)) ([04c689c](https://github.com/payloadcms/payload/commit/04c689c5b04bc91020eb682b97721eba213836d2))
26
+ * **i18n:** requiresAtLeast variable in de.json ([#1556](https://github.com/payloadcms/payload/issues/1556)) ([47fd0d9](https://github.com/payloadcms/payload/commit/47fd0d9ec4aa62335d505a0bfba0305355a318ca))
27
+ * ignore validation when unpublishing, do not allow restore with invalid form state ([77ab542](https://github.com/payloadcms/payload/commit/77ab54243ab1857f4f430be4f8c4dc51e15f94ca))
28
+ * 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))
29
+ * infinite rerenders, accounts for hasMany false ([16d00e8](https://github.com/payloadcms/payload/commit/16d00e87c2f8b63e695e46ccbf279ad90621dc17))
30
+ * moves relationship field useEffect into async reducer action ([54ef40a](https://github.com/payloadcms/payload/commit/54ef40a335905f7295f847c68762f7fe06bccc30))
31
+ * moves sharp types from devDeps to deps ([b3d526b](https://github.com/payloadcms/payload/commit/b3d526b59a275a1f58a76322a588ba8a6370f26b))
32
+ * reverts async reducer and resolves infinite effect ([a9da81f](https://github.com/payloadcms/payload/commit/a9da81f18cf9e6eba67187a3a2735b267949e0ae))
33
+ * sanitize number query params before passing to find operation ([c8d1b9f](https://github.com/payloadcms/payload/commit/c8d1b9f88af62ad1ab927ca3d035fa4c031989f1))
34
+ * translate select field option labels ([#1476](https://github.com/payloadcms/payload/issues/1476)) ([3a9dc9e](https://github.com/payloadcms/payload/commit/3a9dc9ef68374692c3314651bee6e1b00ae55f17))
35
+ * update drafts includes latest version changes ([48989d0](https://github.com/payloadcms/payload/commit/48989d0f6ed086dc60dc94165a4e0ca8120f9b1a))
36
+ * updates code field css ([3eebd66](https://github.com/payloadcms/payload/commit/3eebd6613f66f3cac38e00cfd94e80b2999cf791))
37
+ * updates syntax colors for light theme ([dbfe7ca](https://github.com/payloadcms/payload/commit/dbfe7ca6e61e3a93baabc378f52835af9e53fd38))
38
+ * uses baseClass in code field ([d03f0ae](https://github.com/payloadcms/payload/commit/d03f0aef8423597aceb36ddbbb1cc63033d0066d))
39
+
40
+
41
+ ### Features
42
+
43
+ * decouples limit from pagination, allows for no limit query ([f7ce0c6](https://github.com/payloadcms/payload/commit/f7ce0c615d76035ee48ef32047613ab1415deb44))
44
+ * improve typescript comments ([#1467](https://github.com/payloadcms/payload/issues/1467)) ([5bd8657](https://github.com/payloadcms/payload/commit/5bd86571cada5791003bbfa84183f5b300649533))
45
+ * log email transport error messages ([#1469](https://github.com/payloadcms/payload/issues/1469)) ([a90a1a9](https://github.com/payloadcms/payload/commit/a90a1a9e19bb54eb6d88129b5e2cb6483e22db61))
46
+ * removes theme provider and updates background for code fields ([1a6c9a3](https://github.com/payloadcms/payload/commit/1a6c9a3e181930a6f45027fecc5313e8d7228c71))
47
+
3
48
  ## [1.2.1](https://github.com/payloadcms/payload/compare/v1.2.0...v1.2.1) (2022-11-22)
4
49
 
5
50
 
@@ -24,8 +69,8 @@
24
69
  ### Features
25
70
 
26
71
  * 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))
28
-
72
+ * exports field types properly ([7c6d6fd](https://github.com/payloadcms/payload/commit/7c6d6fd1caeb25e1a871fa1b9cecc53be8a2a7a1))
73
+
29
74
  # [1.2.0](https://github.com/payloadcms/payload/compare/v1.1.26...v1.2.0) (2022-11-18)
30
75
 
31
76
 
@@ -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 } 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';
@@ -25,7 +25,7 @@ const SortableMultiValueLabel = SortableHandle((props) => React.createElement(co
25
25
  const SortableSelect = SortableContainer(Select);
26
26
  const ReactSelect = (props) => {
27
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;
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') {
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udGV4dC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9hZG1pbi9jb21wb25lbnRzL2Zvcm1zL0Zvcm0vY29udGV4dC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxpQ0FBa0Q7QUFDbEQsK0RBQWdJO0FBR2hJLE1BQU0sV0FBVyxHQUFHLElBQUEscUJBQWEsRUFBQyxFQUFhLENBQUMsQ0FBQztBQXdCL0Msa0NBQVc7QUF2QmIsTUFBTSxnQkFBZ0IsR0FBRyxJQUFBLHFCQUFhLEVBQUMsRUFBYSxDQUFDLENBQUM7QUEyQnBELDRDQUFnQjtBQTFCbEIsTUFBTSxnQkFBZ0IsR0FBRyxJQUFBLHFCQUFhLEVBQUMsS0FBSyxDQUFDLENBQUM7QUFlNUMsNENBQWdCO0FBZGxCLE1BQU0saUJBQWlCLEdBQUcsSUFBQSxxQkFBYSxFQUFDLEtBQUssQ0FBQyxDQUFDO0FBZT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RUFBQyxnQkFBZ0IsQ0FBQyxDQUFDO0FBaUMvRCxvQ0FBWTtBQWhDZCxNQUFNLGdCQUFnQixHQUFHLEdBQVksRUFBRSxDQUFDLElBQUEsa0JBQVUsRUFBQyxnQkFBZ0IsQ0FBQyxDQUFDO0FBdUJuRSw0Q0FBZ0I7QUF0QmxCLE1BQU0saUJBQWlCLEdBQUcsR0FBWSxFQUFFLENBQUMsSUFBQSxrQkFBVSxFQUFDLGlCQUFpQixDQUFDLENBQUM7QUF1QnJFLDhDQUFpQjtBQXRCbkIsTUFBTSxlQUFlLEdBQUcsR0FBWSxFQUFFLENBQUMsSUFBQSxrQkFBVSxFQUFDLGVBQWUsQ0FBQyxDQUFDO0FBdUJqRSwwQ0FBZTtBQXBCakI7Ozs7R0FJRztBQUNILE1BQU0sYUFBYSxHQUFHLENBQWtCLFFBQW1ELEVBQVMsRUFBRSxDQUFDLElBQUEseUNBQWtCLEVBQUMsaUJBQWlCLEVBQUUsUUFBUSxDQUFDLENBQUM7QUFtQnJKLHNDQUFhO0FBakJmOzs7O0dBSUc7QUFDSCxNQUFNLGdCQUFnQixHQUFHLEdBQTBCLEVBQUUsQ0FBQyxJQUFBLGlDQUFjLEVBQUMsaUJBQWlCLENBQUMsQ0FBQztBQWF0Riw0Q0FBZ0IifQ==
@@ -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',