@contentful/default-field-editors 1.3.3 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/cjs/Field.js +204 -0
  2. package/dist/cjs/Field.spec.js +124 -0
  3. package/dist/cjs/FieldWrapper.js +92 -0
  4. package/dist/cjs/FieldWrapper.spec.js +111 -0
  5. package/dist/cjs/FieldWrapper.styles.js +48 -0
  6. package/dist/cjs/__mocks__/styles.js +11 -0
  7. package/dist/cjs/getDefaultWidgetId.js +15 -0
  8. package/dist/cjs/index.js +24 -0
  9. package/dist/cjs/types.js +4 -0
  10. package/dist/esm/Field.js +155 -0
  11. package/dist/esm/Field.spec.js +81 -0
  12. package/dist/esm/FieldWrapper.js +43 -0
  13. package/dist/esm/FieldWrapper.spec.js +68 -0
  14. package/dist/esm/FieldWrapper.styles.js +33 -0
  15. package/dist/esm/__mocks__/styles.js +1 -0
  16. package/dist/esm/getDefaultWidgetId.js +5 -0
  17. package/dist/esm/index.js +3 -0
  18. package/dist/esm/types.js +1 -0
  19. package/dist/{Field.d.ts → types/Field.d.ts} +12 -12
  20. package/dist/types/Field.spec.d.ts +1 -0
  21. package/dist/{FieldWrapper.d.ts → types/FieldWrapper.d.ts} +17 -17
  22. package/dist/types/FieldWrapper.spec.d.ts +1 -0
  23. package/dist/{FieldWrapper.styles.d.ts → types/FieldWrapper.styles.d.ts} +5 -5
  24. package/dist/{__mocks__ → types/__mocks__}/styles.d.ts +2 -2
  25. package/dist/{getDefaultWidgetId.d.ts → types/getDefaultWidgetId.d.ts} +3 -3
  26. package/dist/{index.d.ts → types/index.d.ts} +4 -4
  27. package/dist/{types.d.ts → types/types.d.ts} +45 -45
  28. package/package.json +44 -30
  29. package/dist/default-field-editors.cjs.development.js +0 -215
  30. package/dist/default-field-editors.cjs.development.js.map +0 -1
  31. package/dist/default-field-editors.cjs.production.min.js +0 -2
  32. package/dist/default-field-editors.cjs.production.min.js.map +0 -1
  33. package/dist/default-field-editors.esm.js +0 -207
  34. package/dist/default-field-editors.esm.js.map +0 -1
  35. package/dist/index.js +0 -8
@@ -0,0 +1,155 @@
1
+ import * as React from 'react';
2
+ import { BooleanEditor } from '@contentful/field-editor-boolean';
3
+ import { CheckboxEditor } from '@contentful/field-editor-checkbox';
4
+ import { DateEditor } from '@contentful/field-editor-date';
5
+ import { DropdownEditor } from '@contentful/field-editor-dropdown';
6
+ import { JsonEditor } from '@contentful/field-editor-json';
7
+ import { ListEditor } from '@contentful/field-editor-list';
8
+ import { LocationEditor } from '@contentful/field-editor-location';
9
+ import { MarkdownEditor } from '@contentful/field-editor-markdown';
10
+ import { MultipleLineEditor } from '@contentful/field-editor-multiple-line';
11
+ import { NumberEditor } from '@contentful/field-editor-number';
12
+ import { RadioEditor } from '@contentful/field-editor-radio';
13
+ import { RatingEditor } from '@contentful/field-editor-rating';
14
+ import { MultipleEntryReferenceEditor, MultipleMediaEditor, SingleEntryReferenceEditor, SingleMediaEditor } from '@contentful/field-editor-reference';
15
+ import { RichTextEditor } from '@contentful/field-editor-rich-text';
16
+ import { SingleLineEditor } from '@contentful/field-editor-single-line';
17
+ import { SlugEditor } from '@contentful/field-editor-slug';
18
+ import { TagsEditor } from '@contentful/field-editor-tags';
19
+ import { UrlEditor } from '@contentful/field-editor-url';
20
+ import { getDefaultWidgetId } from './getDefaultWidgetId';
21
+ const widgetComponents = {
22
+ multipleLine: [
23
+ MultipleLineEditor
24
+ ],
25
+ boolean: [
26
+ BooleanEditor
27
+ ],
28
+ objectEditor: [
29
+ JsonEditor
30
+ ],
31
+ datePicker: [
32
+ DateEditor
33
+ ],
34
+ locationEditor: [
35
+ LocationEditor
36
+ ],
37
+ checkbox: [
38
+ CheckboxEditor
39
+ ],
40
+ listInput: [
41
+ ListEditor
42
+ ],
43
+ rating: [
44
+ RatingEditor
45
+ ],
46
+ radio: [
47
+ RadioEditor
48
+ ],
49
+ tagEditor: [
50
+ TagsEditor
51
+ ],
52
+ numberEditor: [
53
+ NumberEditor
54
+ ],
55
+ urlEditor: [
56
+ UrlEditor
57
+ ],
58
+ slugEditor: [
59
+ SlugEditor
60
+ ],
61
+ singleLine: [
62
+ SingleLineEditor
63
+ ],
64
+ dropdown: [
65
+ DropdownEditor
66
+ ],
67
+ entryLinkEditor: [
68
+ SingleEntryReferenceEditor,
69
+ {
70
+ viewType: 'link',
71
+ hasCardEditActions: true
72
+ }
73
+ ],
74
+ entryCardEditor: [
75
+ SingleEntryReferenceEditor,
76
+ {
77
+ viewType: 'card',
78
+ hasCardEditActions: true
79
+ }
80
+ ],
81
+ entryLinksEditor: [
82
+ MultipleEntryReferenceEditor,
83
+ {
84
+ viewType: 'link',
85
+ hasCardEditActions: true
86
+ }
87
+ ],
88
+ entryCardsEditor: [
89
+ MultipleEntryReferenceEditor,
90
+ {
91
+ viewType: 'card',
92
+ hasCardEditActions: true
93
+ }
94
+ ],
95
+ assetLinkEditor: [
96
+ SingleMediaEditor,
97
+ {
98
+ viewType: 'link'
99
+ }
100
+ ],
101
+ assetLinksEditor: [
102
+ MultipleMediaEditor,
103
+ {
104
+ viewType: 'link'
105
+ }
106
+ ],
107
+ assetGalleryEditor: [
108
+ MultipleMediaEditor,
109
+ {
110
+ viewType: 'card'
111
+ }
112
+ ],
113
+ richTextEditor: [
114
+ RichTextEditor
115
+ ],
116
+ markdown: [
117
+ MarkdownEditor
118
+ ]
119
+ };
120
+ export const Field = (props)=>{
121
+ const { sdk , widgetId: possiblyUndefinedWidgetId , isInitiallyDisabled =false , renderFieldEditor , getOptions } = props;
122
+ const field = sdk.field;
123
+ const locales = sdk.locales;
124
+ const widgetId = possiblyUndefinedWidgetId ?? getDefaultWidgetId(sdk);
125
+ if (renderFieldEditor) {
126
+ const customEditor = renderFieldEditor(widgetId, sdk, isInitiallyDisabled);
127
+ if (customEditor) {
128
+ return customEditor;
129
+ }
130
+ }
131
+ const options = getOptions ? getOptions(widgetId, sdk) : {};
132
+ const referenceEditorParams = sdk.parameters && 'instance' in sdk.parameters ? sdk.parameters : {
133
+ instance: {
134
+ showCreateEntityAction: true,
135
+ showLinkEntityAction: true
136
+ }
137
+ };
138
+ if (!widgetComponents[widgetId]) return null;
139
+ const [WidgetComponent, widgetStaticProps] = widgetComponents[widgetId];
140
+ const widgetComponentProps = {
141
+ sdk,
142
+ field,
143
+ locales,
144
+ isInitiallyDisabled,
145
+ parameters: referenceEditorParams,
146
+ ...widgetStaticProps,
147
+ ...options[widgetId]
148
+ };
149
+ const baseSdk = widgetId === 'slugEditor' ? sdk : undefined;
150
+ return React.createElement(WidgetComponent, {
151
+ key: sdk.field.locale,
152
+ ...widgetComponentProps,
153
+ baseSdk: baseSdk
154
+ });
155
+ };
@@ -0,0 +1,81 @@
1
+ import * as React from 'react';
2
+ import { SingleEntryReferenceEditor } from '@contentful/field-editor-reference';
3
+ import { createFakeFieldAPI, createFakeLocalesAPI } from '@contentful/field-editor-test-utils';
4
+ import '@testing-library/jest-dom/extend-expect';
5
+ import { cleanup, configure, render } from '@testing-library/react';
6
+ import { Field } from './Field';
7
+ configure({
8
+ testIdAttribute: 'data-test-id'
9
+ });
10
+ jest.mock('@contentful/field-editor-reference', ()=>({
11
+ SingleEntryReferenceEditor: jest.fn(()=>React.createElement("div", null, "mock"))
12
+ }));
13
+ const getSdk = (customize, initialValue)=>{
14
+ const [field] = createFakeFieldAPI(customize, initialValue);
15
+ const sdk = {
16
+ field,
17
+ locales: createFakeLocalesAPI((locales)=>{
18
+ locales.available.push('de');
19
+ return locales;
20
+ })
21
+ };
22
+ return sdk;
23
+ };
24
+ describe('Field', ()=>{
25
+ afterEach(cleanup);
26
+ it('renders custom field editor specified by renderFieldEditor', ()=>{
27
+ const sdk = getSdk();
28
+ const { queryByTestId } = render(React.createElement(Field, {
29
+ sdk: sdk,
30
+ isInitiallyDisabled: false,
31
+ widgetId: "customEditor",
32
+ renderFieldEditor: ()=>{
33
+ return React.createElement("div", {
34
+ "data-test-id": "customEditor"
35
+ }, "custom editor");
36
+ }
37
+ }));
38
+ expect(queryByTestId('customEditor')).toBeInTheDocument();
39
+ });
40
+ it('renders with specified options', ()=>{
41
+ const sdk = getSdk();
42
+ const options = {
43
+ entryLinkEditor: {
44
+ onAction: jest.fn(),
45
+ renderCustomCard: jest.fn()
46
+ }
47
+ };
48
+ render(React.createElement(Field, {
49
+ sdk: sdk,
50
+ isInitiallyDisabled: false,
51
+ widgetId: "entryLinkEditor",
52
+ getOptions: ()=>options
53
+ }));
54
+ expect(SingleEntryReferenceEditor.mock.calls[0][0]).toMatchObject({
55
+ onAction: options.entryLinkEditor.onAction,
56
+ renderCustomCard: options.entryLinkEditor.renderCustomCard
57
+ });
58
+ });
59
+ it('re-renders single field editor when locale changes', ()=>{
60
+ const props = {
61
+ isInitiallyDisabled: false,
62
+ widgetId: 'singleLine'
63
+ };
64
+ const { container , rerender } = render(React.createElement(Field, {
65
+ ...props,
66
+ sdk: getSdk((field)=>{
67
+ field.locale = 'en-US';
68
+ return field;
69
+ }, 'english value')
70
+ }));
71
+ expect(container.querySelector('input')?.value).toBe('english value');
72
+ rerender(React.createElement(Field, {
73
+ ...props,
74
+ sdk: getSdk((field)=>{
75
+ field.locale = 'de';
76
+ return field;
77
+ }, 'german value')
78
+ }));
79
+ expect(container.querySelector('input')?.value).toBe('german value');
80
+ });
81
+ });
@@ -0,0 +1,43 @@
1
+ import * as React from 'react';
2
+ import { FormControl } from '@contentful/f36-components';
3
+ import { ValidationErrors } from '@contentful/field-editor-validation-errors';
4
+ import { cx } from 'emotion';
5
+ import { styles } from './FieldWrapper.styles';
6
+ export const FieldWrapper = function(props) {
7
+ const { ids } = props.sdk;
8
+ const defaultGetEntryUrl = (entry)=>`/spaces/${ids.space}/environments/${ids.environmentAlias || ids.environment}/entries/${entry.sys.id}`;
9
+ const { name , sdk , className , children , renderHeading , renderHelpText , showFocusBar =true , getEntryURL =defaultGetEntryUrl } = props;
10
+ const { field } = sdk;
11
+ const helpText = (sdk.parameters?.instance)?.helpText ?? '';
12
+ const [hasErrors, setHasErrors] = React.useState(false);
13
+ React.useEffect(()=>{
14
+ return field.onSchemaErrorsChanged((errors)=>{
15
+ setHasErrors((errors || []).length > 0);
16
+ });
17
+ }, [
18
+ field
19
+ ]);
20
+ const fieldControlId = [
21
+ field.id,
22
+ field.locale,
23
+ sdk.contentType?.sys?.id
24
+ ].filter((item)=>item).join('-');
25
+ return React.createElement(FormControl, {
26
+ id: fieldControlId,
27
+ testId: "entity-field-controls",
28
+ "data-test-id": "entity-field-controls",
29
+ className: cx(showFocusBar && styles.withFocusBar, className),
30
+ "aria-invalid": hasErrors,
31
+ isRequired: field.required
32
+ }, renderHeading ? renderHeading(name) : React.createElement(FormControl.Label, {
33
+ className: styles.label
34
+ }, name), children, React.createElement(ValidationErrors, {
35
+ field: field,
36
+ space: sdk.space,
37
+ locales: sdk.locales,
38
+ getEntryURL: getEntryURL || defaultGetEntryUrl
39
+ }), renderHelpText ? renderHelpText(helpText) : React.createElement(FormControl.HelpText, {
40
+ testId: "field-hint",
41
+ className: styles.helpText
42
+ }, helpText));
43
+ };
@@ -0,0 +1,68 @@
1
+ import * as React from 'react';
2
+ import { createFakeFieldAPI, createFakeLocalesAPI } from '@contentful/field-editor-test-utils';
3
+ import '@testing-library/jest-dom/extend-expect';
4
+ import { act, cleanup, configure, render } from '@testing-library/react';
5
+ import { FieldWrapper } from './FieldWrapper';
6
+ configure({
7
+ testIdAttribute: 'data-test-id'
8
+ });
9
+ const [field, emitter] = createFakeFieldAPI();
10
+ const sdk = {
11
+ contentType: {
12
+ sys: {
13
+ id: 'content-type-id'
14
+ }
15
+ },
16
+ field,
17
+ locales: createFakeLocalesAPI()
18
+ };
19
+ const getEntryURL = ()=>'';
20
+ describe('Field', ()=>{
21
+ afterEach(cleanup);
22
+ it('renders children, label, validation errors and help text', ()=>{
23
+ sdk.parameters = {
24
+ instance: {
25
+ helpText: 'help'
26
+ }
27
+ };
28
+ const { queryByTestId } = render(React.createElement(FieldWrapper, {
29
+ name: "field",
30
+ sdk: sdk,
31
+ getEntryURL: getEntryURL
32
+ }, React.createElement("div", {
33
+ "data-test-id": "children"
34
+ }, "children")));
35
+ act(()=>{
36
+ emitter.emit('onSchemaErrorsChanged', [
37
+ 'error'
38
+ ]);
39
+ });
40
+ expect(queryByTestId('entity-field-controls')).toBeInTheDocument();
41
+ expect(queryByTestId('cf-ui-form-label')).toBeInTheDocument();
42
+ expect(queryByTestId('children')).toBeInTheDocument();
43
+ expect(queryByTestId('validation-errors')).toBeInTheDocument();
44
+ expect(queryByTestId('field-hint')).toBeInTheDocument();
45
+ });
46
+ it('renders custom label', ()=>{
47
+ const { queryByTestId } = render(React.createElement(FieldWrapper, {
48
+ name: "field",
49
+ sdk: sdk,
50
+ getEntryURL: getEntryURL,
51
+ renderHeading: ()=>React.createElement("div", {
52
+ "data-test-id": "custom-label"
53
+ }, "custom label")
54
+ }, React.createElement("div", null, "children")));
55
+ expect(queryByTestId('custom-label')).toBeInTheDocument();
56
+ });
57
+ it('renders custom help text', ()=>{
58
+ const { queryByTestId } = render(React.createElement(FieldWrapper, {
59
+ name: "field",
60
+ sdk: sdk,
61
+ getEntryURL: getEntryURL,
62
+ renderHelpText: ()=>React.createElement("div", {
63
+ "data-test-id": "custom-hint"
64
+ }, "custom hint")
65
+ }, React.createElement("div", null, "children")));
66
+ expect(queryByTestId('custom-hint')).toBeInTheDocument();
67
+ });
68
+ });
@@ -0,0 +1,33 @@
1
+ import tokens from '@contentful/f36-tokens';
2
+ import { css } from 'emotion';
3
+ export const styles = {
4
+ withFocusBar: css({
5
+ marginLeft: tokens.spacingL,
6
+ marginRight: tokens.spacingL,
7
+ marginBottom: '29px',
8
+ marginTop: '19px',
9
+ paddingLeft: tokens.spacingM,
10
+ borderLeft: `3px solid ${tokens.gray300}`,
11
+ transition: 'border-color 0.18s linear',
12
+ '&:focus-within': {
13
+ borderColor: tokens.colorPrimary
14
+ },
15
+ '&[aria-invalid="true"]': {
16
+ borderLeftColor: tokens.red500
17
+ }
18
+ }),
19
+ label: css({
20
+ display: 'flex',
21
+ width: '100%',
22
+ maxWidth: '800px',
23
+ color: tokens.gray500,
24
+ fontSize: tokens.fontSizeM,
25
+ fontWeight: tokens.fontWeightNormal,
26
+ lineHeight: tokens.lineHeightDefault,
27
+ whiteSpace: 'pre-wrap'
28
+ }),
29
+ helpText: css({
30
+ margin: `${tokens.spacingXs} 0`,
31
+ fontStyle: 'italic'
32
+ })
33
+ };
@@ -0,0 +1 @@
1
+ export default {};
@@ -0,0 +1,5 @@
1
+ import { editorInterfaceDefaults } from 'contentful-management';
2
+ export function getDefaultWidgetId(sdk) {
3
+ const field = sdk.field;
4
+ return editorInterfaceDefaults.default.getDefaultControlOfField(field).widgetId;
5
+ }
@@ -0,0 +1,3 @@
1
+ export { Field } from './Field';
2
+ export { FieldWrapper } from './FieldWrapper';
3
+ export { getDefaultWidgetId } from './getDefaultWidgetId';
@@ -0,0 +1 @@
1
+ export { };
@@ -1,12 +1,12 @@
1
- import * as React from 'react';
2
- import type { FieldExtensionSDK } from '@contentful/field-editor-shared';
3
- import type { EditorOptions, WidgetType } from './types';
4
- declare type FieldProps = {
5
- sdk: FieldExtensionSDK;
6
- widgetId?: WidgetType;
7
- isInitiallyDisabled?: boolean;
8
- renderFieldEditor?: (widgetId: WidgetType, sdk: FieldExtensionSDK, isInitiallyDisabled: boolean) => JSX.Element | false;
9
- getOptions?: (widgetId: WidgetType, sdk: FieldExtensionSDK) => EditorOptions;
10
- };
11
- export declare const Field: React.FC<FieldProps>;
12
- export {};
1
+ import * as React from 'react';
2
+ import type { FieldExtensionSDK } from '@contentful/field-editor-shared';
3
+ import type { EditorOptions, WidgetType } from './types';
4
+ type FieldProps = {
5
+ sdk: FieldExtensionSDK;
6
+ widgetId?: WidgetType;
7
+ isInitiallyDisabled?: boolean;
8
+ renderFieldEditor?: (widgetId: WidgetType, sdk: FieldExtensionSDK, isInitiallyDisabled: boolean) => JSX.Element | false;
9
+ getOptions?: (widgetId: WidgetType, sdk: FieldExtensionSDK) => EditorOptions;
10
+ };
11
+ export declare const Field: React.FC<FieldProps>;
12
+ export {};
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -1,17 +1,17 @@
1
- import * as React from 'react';
2
- import type { FieldExtensionSDK, Entry } from '@contentful/field-editor-shared';
3
- declare type FieldWrapperProps = {
4
- name: string;
5
- sdk: FieldExtensionSDK;
6
- /**
7
- * Generates a link to another entry with the same value when a "non unique" validation error occurs
8
- */
9
- getEntryURL?: (entry: Entry) => string;
10
- className?: string;
11
- showFocusBar?: boolean;
12
- children: React.ReactNode;
13
- renderHeading?: (name: string) => JSX.Element | null;
14
- renderHelpText?: (helpText: string) => JSX.Element | null;
15
- };
16
- export declare const FieldWrapper: React.FC<FieldWrapperProps>;
17
- export {};
1
+ import * as React from 'react';
2
+ import type { FieldExtensionSDK, Entry } from '@contentful/field-editor-shared';
3
+ type FieldWrapperProps = {
4
+ name: string;
5
+ sdk: FieldExtensionSDK;
6
+ /**
7
+ * Generates a link to another entry with the same value when a "non unique" validation error occurs
8
+ */
9
+ getEntryURL?: (entry: Entry) => string;
10
+ className?: string;
11
+ showFocusBar?: boolean;
12
+ children: React.ReactNode;
13
+ renderHeading?: (name: string) => JSX.Element | null;
14
+ renderHelpText?: (helpText: string) => JSX.Element | null;
15
+ };
16
+ export declare const FieldWrapper: React.FC<FieldWrapperProps>;
17
+ export {};
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
@@ -1,5 +1,5 @@
1
- export declare const styles: {
2
- withFocusBar: string;
3
- label: string;
4
- helpText: string;
5
- };
1
+ export declare const styles: {
2
+ withFocusBar: string;
3
+ label: string;
4
+ helpText: string;
5
+ };
@@ -1,2 +1,2 @@
1
- declare const _default: {};
2
- export default _default;
1
+ declare const _default: {};
2
+ export default _default;
@@ -1,3 +1,3 @@
1
- import type { FieldExtensionSDK } from '@contentful/field-editor-shared';
2
- import type { WidgetType } from './types';
3
- export declare function getDefaultWidgetId(sdk: Pick<FieldExtensionSDK, 'field' | 'contentType'>): WidgetType;
1
+ import type { FieldExtensionSDK } from '@contentful/field-editor-shared';
2
+ import type { WidgetType } from './types';
3
+ export declare function getDefaultWidgetId(sdk: Pick<FieldExtensionSDK, 'field' | 'contentType'>): WidgetType;
@@ -1,4 +1,4 @@
1
- export { Field } from './Field';
2
- export { FieldWrapper } from './FieldWrapper';
3
- export type { WidgetType, EditorOptions } from './types';
4
- export { getDefaultWidgetId } from './getDefaultWidgetId';
1
+ export { Field } from './Field';
2
+ export { FieldWrapper } from './FieldWrapper';
3
+ export type { WidgetType, EditorOptions } from './types';
4
+ export { getDefaultWidgetId } from './getDefaultWidgetId';
@@ -1,45 +1,45 @@
1
- import { BooleanEditor } from '@contentful/field-editor-boolean';
2
- import { CheckboxEditor } from '@contentful/field-editor-checkbox';
3
- import { DateEditor } from '@contentful/field-editor-date';
4
- import { DropdownEditor } from '@contentful/field-editor-dropdown';
5
- import { JsonEditor } from '@contentful/field-editor-json';
6
- import { ListEditor } from '@contentful/field-editor-list';
7
- import { LocationEditor } from '@contentful/field-editor-location';
8
- import { MarkdownEditor } from '@contentful/field-editor-markdown';
9
- import { MultipleLineEditor } from '@contentful/field-editor-multiple-line';
10
- import { RadioEditor } from '@contentful/field-editor-radio';
11
- import { RatingEditor } from '@contentful/field-editor-rating';
12
- import { MultipleEntryReferenceEditor, MultipleMediaEditor, SingleEntryReferenceEditor, SingleMediaEditor } from '@contentful/field-editor-reference';
13
- import { RichTextEditor } from '@contentful/field-editor-rich-text';
14
- import { SingleLineEditor } from '@contentful/field-editor-single-line';
15
- import { SlugEditor } from '@contentful/field-editor-slug';
16
- import { TagsEditor } from '@contentful/field-editor-tags';
17
- import { NumberEditor } from '@contentful/field-editor-number';
18
- import { UrlEditor } from '@contentful/field-editor-url';
19
- export declare type WidgetType = 'multipleLine' | 'boolean' | 'objectEditor' | 'datePicker' | 'locationEditor' | 'checkbox' | 'listInput' | 'rating' | 'radio' | 'tagEditor' | 'numberEditor' | 'urlEditor' | 'slugEditor' | 'singleLine' | 'dropdown' | 'entryLinkEditor' | 'entryCardEditor' | 'entryLinksEditor' | 'entryCardsEditor' | 'assetLinkEditor' | 'assetLinksEditor' | 'assetGalleryEditor' | 'richTextEditor' | 'markdown' | string;
20
- export declare type EditorOptions = {
21
- multipleLine?: Partial<Parameters<typeof MultipleLineEditor>[0]>;
22
- boolean?: Partial<Parameters<typeof BooleanEditor>[0]>;
23
- entryCardEditor?: Partial<Parameters<typeof SingleEntryReferenceEditor>[0]>;
24
- objectEditor?: Partial<Parameters<typeof JsonEditor>[0]>;
25
- datePicker?: Partial<Parameters<typeof DateEditor>[0]>;
26
- locationEditor?: Partial<Parameters<typeof LocationEditor>[0]>;
27
- checkbox?: Partial<Parameters<typeof CheckboxEditor>[0]>;
28
- listInput?: Partial<Parameters<typeof ListEditor>[0]>;
29
- rating?: Partial<Parameters<typeof RatingEditor>[0]>;
30
- radio?: Partial<Parameters<typeof RadioEditor>[0]>;
31
- tagEditor?: Partial<Parameters<typeof TagsEditor>[0]>;
32
- numberEditor?: Partial<Parameters<typeof NumberEditor>[0]>;
33
- urlEditor?: Partial<Parameters<typeof UrlEditor>[0]>;
34
- slugEditor?: Partial<Parameters<typeof SlugEditor>[0]>;
35
- singleLine?: Partial<Parameters<typeof SingleLineEditor>[0]>;
36
- dropdown?: Partial<Parameters<typeof DropdownEditor>[0]>;
37
- entryLinkEditor?: Partial<Parameters<typeof SingleEntryReferenceEditor>[0]>;
38
- entryLinksEditor?: Partial<Parameters<typeof MultipleEntryReferenceEditor>[0]>;
39
- entryCardsEditor?: Partial<Parameters<typeof MultipleEntryReferenceEditor>[0]>;
40
- assetLinkEditor?: Partial<Parameters<typeof SingleMediaEditor>[0]>;
41
- assetLinksEditor?: Partial<Parameters<typeof MultipleMediaEditor>[0]>;
42
- assetGalleryEditor?: Partial<Parameters<typeof MultipleMediaEditor>[0]>;
43
- richTextEditor?: Partial<Parameters<typeof RichTextEditor>[0]>;
44
- markdown?: Partial<Parameters<typeof MarkdownEditor>[0]>;
45
- };
1
+ import { BooleanEditor } from '@contentful/field-editor-boolean';
2
+ import { CheckboxEditor } from '@contentful/field-editor-checkbox';
3
+ import { DateEditor } from '@contentful/field-editor-date';
4
+ import { DropdownEditor } from '@contentful/field-editor-dropdown';
5
+ import { JsonEditor } from '@contentful/field-editor-json';
6
+ import { ListEditor } from '@contentful/field-editor-list';
7
+ import { LocationEditor } from '@contentful/field-editor-location';
8
+ import { MarkdownEditor } from '@contentful/field-editor-markdown';
9
+ import { MultipleLineEditor } from '@contentful/field-editor-multiple-line';
10
+ import { NumberEditor } from '@contentful/field-editor-number';
11
+ import { RadioEditor } from '@contentful/field-editor-radio';
12
+ import { RatingEditor } from '@contentful/field-editor-rating';
13
+ import { MultipleEntryReferenceEditor, MultipleMediaEditor, SingleEntryReferenceEditor, SingleMediaEditor } from '@contentful/field-editor-reference';
14
+ import { RichTextEditor } from '@contentful/field-editor-rich-text';
15
+ import { SingleLineEditor } from '@contentful/field-editor-single-line';
16
+ import { SlugEditor } from '@contentful/field-editor-slug';
17
+ import { TagsEditor } from '@contentful/field-editor-tags';
18
+ import { UrlEditor } from '@contentful/field-editor-url';
19
+ export type WidgetType = 'multipleLine' | 'boolean' | 'objectEditor' | 'datePicker' | 'locationEditor' | 'checkbox' | 'listInput' | 'rating' | 'radio' | 'tagEditor' | 'numberEditor' | 'urlEditor' | 'slugEditor' | 'singleLine' | 'dropdown' | 'entryLinkEditor' | 'entryCardEditor' | 'entryLinksEditor' | 'entryCardsEditor' | 'assetLinkEditor' | 'assetLinksEditor' | 'assetGalleryEditor' | 'richTextEditor' | 'markdown' | string;
20
+ export type EditorOptions = {
21
+ multipleLine?: Partial<Parameters<typeof MultipleLineEditor>[0]>;
22
+ boolean?: Partial<Parameters<typeof BooleanEditor>[0]>;
23
+ entryCardEditor?: Partial<Parameters<typeof SingleEntryReferenceEditor>[0]>;
24
+ objectEditor?: Partial<Parameters<typeof JsonEditor>[0]>;
25
+ datePicker?: Partial<Parameters<typeof DateEditor>[0]>;
26
+ locationEditor?: Partial<Parameters<typeof LocationEditor>[0]>;
27
+ checkbox?: Partial<Parameters<typeof CheckboxEditor>[0]>;
28
+ listInput?: Partial<Parameters<typeof ListEditor>[0]>;
29
+ rating?: Partial<Parameters<typeof RatingEditor>[0]>;
30
+ radio?: Partial<Parameters<typeof RadioEditor>[0]>;
31
+ tagEditor?: Partial<Parameters<typeof TagsEditor>[0]>;
32
+ numberEditor?: Partial<Parameters<typeof NumberEditor>[0]>;
33
+ urlEditor?: Partial<Parameters<typeof UrlEditor>[0]>;
34
+ slugEditor?: Partial<Parameters<typeof SlugEditor>[0]>;
35
+ singleLine?: Partial<Parameters<typeof SingleLineEditor>[0]>;
36
+ dropdown?: Partial<Parameters<typeof DropdownEditor>[0]>;
37
+ entryLinkEditor?: Partial<Parameters<typeof SingleEntryReferenceEditor>[0]>;
38
+ entryLinksEditor?: Partial<Parameters<typeof MultipleEntryReferenceEditor>[0]>;
39
+ entryCardsEditor?: Partial<Parameters<typeof MultipleEntryReferenceEditor>[0]>;
40
+ assetLinkEditor?: Partial<Parameters<typeof SingleMediaEditor>[0]>;
41
+ assetLinksEditor?: Partial<Parameters<typeof MultipleMediaEditor>[0]>;
42
+ assetGalleryEditor?: Partial<Parameters<typeof MultipleMediaEditor>[0]>;
43
+ richTextEditor?: Partial<Parameters<typeof RichTextEditor>[0]>;
44
+ markdown?: Partial<Parameters<typeof MarkdownEditor>[0]>;
45
+ };