@contentful/default-field-editors 1.3.2 → 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.
- package/dist/cjs/Field.js +204 -0
- package/dist/cjs/Field.spec.js +124 -0
- package/dist/cjs/FieldWrapper.js +92 -0
- package/dist/cjs/FieldWrapper.spec.js +111 -0
- package/dist/cjs/FieldWrapper.styles.js +48 -0
- package/dist/cjs/__mocks__/styles.js +11 -0
- package/dist/cjs/getDefaultWidgetId.js +15 -0
- package/dist/cjs/index.js +24 -0
- package/dist/cjs/types.js +4 -0
- package/dist/esm/Field.js +155 -0
- package/dist/esm/Field.spec.js +81 -0
- package/dist/esm/FieldWrapper.js +43 -0
- package/dist/esm/FieldWrapper.spec.js +68 -0
- package/dist/esm/FieldWrapper.styles.js +33 -0
- package/dist/esm/__mocks__/styles.js +1 -0
- package/dist/esm/getDefaultWidgetId.js +5 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/types.js +1 -0
- package/dist/{Field.d.ts → types/Field.d.ts} +12 -12
- package/dist/types/Field.spec.d.ts +1 -0
- package/dist/{FieldWrapper.d.ts → types/FieldWrapper.d.ts} +17 -17
- package/dist/types/FieldWrapper.spec.d.ts +1 -0
- package/dist/{FieldWrapper.styles.d.ts → types/FieldWrapper.styles.d.ts} +5 -5
- package/dist/{__mocks__ → types/__mocks__}/styles.d.ts +2 -2
- package/dist/{getDefaultWidgetId.d.ts → types/getDefaultWidgetId.d.ts} +3 -3
- package/dist/{index.d.ts → types/index.d.ts} +4 -4
- package/dist/{types.d.ts → types/types.d.ts} +45 -45
- package/package.json +44 -30
- package/CHANGELOG.md +0 -1110
- package/dist/default-field-editors.cjs.development.js +0 -215
- package/dist/default-field-editors.cjs.development.js.map +0 -1
- package/dist/default-field-editors.cjs.production.min.js +0 -2
- package/dist/default-field-editors.cjs.production.min.js.map +0 -1
- package/dist/default-field-editors.esm.js +0 -207
- package/dist/default-field-editors.esm.js.map +0 -1
- package/dist/index.js +0 -8
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
|
-
|
|
7
|
-
var React = require('react');
|
|
8
|
-
var fieldEditorBoolean = require('@contentful/field-editor-boolean');
|
|
9
|
-
var fieldEditorRadio = require('@contentful/field-editor-radio');
|
|
10
|
-
var fieldEditorRating = require('@contentful/field-editor-rating');
|
|
11
|
-
var fieldEditorCheckbox = require('@contentful/field-editor-checkbox');
|
|
12
|
-
var fieldEditorDate = require('@contentful/field-editor-date');
|
|
13
|
-
var fieldEditorDropdown = require('@contentful/field-editor-dropdown');
|
|
14
|
-
var fieldEditorJson = require('@contentful/field-editor-json');
|
|
15
|
-
var fieldEditorList = require('@contentful/field-editor-list');
|
|
16
|
-
var fieldEditorLocation = require('@contentful/field-editor-location');
|
|
17
|
-
var fieldEditorMarkdown = require('@contentful/field-editor-markdown');
|
|
18
|
-
var fieldEditorMultipleLine = require('@contentful/field-editor-multiple-line');
|
|
19
|
-
var fieldEditorNumber = require('@contentful/field-editor-number');
|
|
20
|
-
var fieldEditorReference = require('@contentful/field-editor-reference');
|
|
21
|
-
var fieldEditorRichText = require('@contentful/field-editor-rich-text');
|
|
22
|
-
var fieldEditorSingleLine = require('@contentful/field-editor-single-line');
|
|
23
|
-
var fieldEditorSlug = require('@contentful/field-editor-slug');
|
|
24
|
-
var fieldEditorTags = require('@contentful/field-editor-tags');
|
|
25
|
-
var fieldEditorUrl = require('@contentful/field-editor-url');
|
|
26
|
-
var contentfulManagement = require('contentful-management');
|
|
27
|
-
var f36Components = require('@contentful/f36-components');
|
|
28
|
-
var fieldEditorValidationErrors = require('@contentful/field-editor-validation-errors');
|
|
29
|
-
var emotion = require('emotion');
|
|
30
|
-
var tokens = _interopDefault(require('@contentful/f36-tokens'));
|
|
31
|
-
|
|
32
|
-
function getDefaultWidgetId(sdk) {
|
|
33
|
-
const field = sdk.field; // @ts-expect-error FieldExtensionSDK.field doesn't include all the
|
|
34
|
-
// properties of ContentFields type. It should be fixed
|
|
35
|
-
|
|
36
|
-
return contentfulManagement.editorInterfaceDefaults.default.getDefaultControlOfField(field).widgetId;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const widgetComponents = {
|
|
40
|
-
multipleLine: [fieldEditorMultipleLine.MultipleLineEditor],
|
|
41
|
-
boolean: [fieldEditorBoolean.BooleanEditor],
|
|
42
|
-
objectEditor: [fieldEditorJson.JsonEditor],
|
|
43
|
-
datePicker: [fieldEditorDate.DateEditor],
|
|
44
|
-
locationEditor: [fieldEditorLocation.LocationEditor],
|
|
45
|
-
checkbox: [fieldEditorCheckbox.CheckboxEditor],
|
|
46
|
-
listInput: [fieldEditorList.ListEditor],
|
|
47
|
-
rating: [fieldEditorRating.RatingEditor],
|
|
48
|
-
radio: [fieldEditorRadio.RadioEditor],
|
|
49
|
-
tagEditor: [fieldEditorTags.TagsEditor],
|
|
50
|
-
numberEditor: [fieldEditorNumber.NumberEditor],
|
|
51
|
-
urlEditor: [fieldEditorUrl.UrlEditor],
|
|
52
|
-
slugEditor: [fieldEditorSlug.SlugEditor],
|
|
53
|
-
singleLine: [fieldEditorSingleLine.SingleLineEditor],
|
|
54
|
-
dropdown: [fieldEditorDropdown.DropdownEditor],
|
|
55
|
-
entryLinkEditor: [fieldEditorReference.SingleEntryReferenceEditor, {
|
|
56
|
-
viewType: 'link',
|
|
57
|
-
hasCardEditActions: true
|
|
58
|
-
}],
|
|
59
|
-
entryCardEditor: [fieldEditorReference.SingleEntryReferenceEditor, {
|
|
60
|
-
viewType: 'card',
|
|
61
|
-
hasCardEditActions: true
|
|
62
|
-
}],
|
|
63
|
-
entryLinksEditor: [fieldEditorReference.MultipleEntryReferenceEditor, {
|
|
64
|
-
viewType: 'link',
|
|
65
|
-
hasCardEditActions: true
|
|
66
|
-
}],
|
|
67
|
-
entryCardsEditor: [fieldEditorReference.MultipleEntryReferenceEditor, {
|
|
68
|
-
viewType: 'card',
|
|
69
|
-
hasCardEditActions: true
|
|
70
|
-
}],
|
|
71
|
-
assetLinkEditor: [fieldEditorReference.SingleMediaEditor, {
|
|
72
|
-
viewType: 'link'
|
|
73
|
-
}],
|
|
74
|
-
assetLinksEditor: [fieldEditorReference.MultipleMediaEditor, {
|
|
75
|
-
viewType: 'link'
|
|
76
|
-
}],
|
|
77
|
-
assetGalleryEditor: [fieldEditorReference.MultipleMediaEditor, {
|
|
78
|
-
viewType: 'card'
|
|
79
|
-
}],
|
|
80
|
-
richTextEditor: [fieldEditorRichText.RichTextEditor],
|
|
81
|
-
markdown: [fieldEditorMarkdown.MarkdownEditor]
|
|
82
|
-
};
|
|
83
|
-
const Field = props => {
|
|
84
|
-
const {
|
|
85
|
-
sdk,
|
|
86
|
-
widgetId: possiblyUndefinedWidgetId,
|
|
87
|
-
isInitiallyDisabled = false,
|
|
88
|
-
renderFieldEditor,
|
|
89
|
-
getOptions
|
|
90
|
-
} = props;
|
|
91
|
-
const field = sdk.field;
|
|
92
|
-
const locales = sdk.locales;
|
|
93
|
-
const widgetId = possiblyUndefinedWidgetId ?? getDefaultWidgetId(sdk);
|
|
94
|
-
|
|
95
|
-
if (renderFieldEditor) {
|
|
96
|
-
const customEditor = renderFieldEditor(widgetId, sdk, isInitiallyDisabled);
|
|
97
|
-
|
|
98
|
-
if (customEditor) {
|
|
99
|
-
return customEditor;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const options = getOptions ? getOptions(widgetId, sdk) : {};
|
|
104
|
-
const referenceEditorParams = sdk.parameters && 'instance' in sdk.parameters ? sdk.parameters : {
|
|
105
|
-
instance: {
|
|
106
|
-
showCreateEntityAction: true,
|
|
107
|
-
showLinkEntityAction: true
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
if (!widgetComponents[widgetId]) return null;
|
|
111
|
-
const [WidgetComponent, widgetStaticProps] = widgetComponents[widgetId];
|
|
112
|
-
const widgetComponentProps = {
|
|
113
|
-
sdk,
|
|
114
|
-
field,
|
|
115
|
-
locales,
|
|
116
|
-
isInitiallyDisabled,
|
|
117
|
-
parameters: referenceEditorParams,
|
|
118
|
-
...widgetStaticProps,
|
|
119
|
-
// @ts-expect-error
|
|
120
|
-
...options[widgetId]
|
|
121
|
-
};
|
|
122
|
-
const baseSdk = widgetId === 'slugEditor' ? sdk : undefined;
|
|
123
|
-
return React.createElement(WidgetComponent, {
|
|
124
|
-
key: sdk.field.locale,
|
|
125
|
-
...widgetComponentProps,
|
|
126
|
-
baseSdk: baseSdk
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const styles = {
|
|
131
|
-
withFocusBar: /*#__PURE__*/emotion.css({
|
|
132
|
-
marginLeft: tokens.spacingL,
|
|
133
|
-
marginRight: tokens.spacingL,
|
|
134
|
-
marginBottom: '29px',
|
|
135
|
-
marginTop: '19px',
|
|
136
|
-
paddingLeft: tokens.spacingM,
|
|
137
|
-
borderLeft: `3px solid ${tokens.gray300}`,
|
|
138
|
-
transition: 'border-color 0.18s linear',
|
|
139
|
-
'&:focus-within': {
|
|
140
|
-
borderColor: tokens.colorPrimary
|
|
141
|
-
},
|
|
142
|
-
'&[aria-invalid="true"]': {
|
|
143
|
-
borderLeftColor: tokens.red500
|
|
144
|
-
}
|
|
145
|
-
}),
|
|
146
|
-
label: /*#__PURE__*/emotion.css({
|
|
147
|
-
display: 'flex',
|
|
148
|
-
width: '100%',
|
|
149
|
-
maxWidth: '800px',
|
|
150
|
-
color: tokens.gray500,
|
|
151
|
-
fontSize: tokens.fontSizeM,
|
|
152
|
-
fontWeight: tokens.fontWeightNormal,
|
|
153
|
-
lineHeight: tokens.lineHeightDefault,
|
|
154
|
-
whiteSpace: 'pre-wrap'
|
|
155
|
-
}),
|
|
156
|
-
helpText: /*#__PURE__*/emotion.css({
|
|
157
|
-
margin: `${tokens.spacingXs} 0`,
|
|
158
|
-
fontStyle: 'italic'
|
|
159
|
-
})
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
const FieldWrapper = function (props) {
|
|
163
|
-
var _sdk$parameters, _sdk$parameters$insta, _sdk$contentType, _sdk$contentType$sys;
|
|
164
|
-
|
|
165
|
-
const {
|
|
166
|
-
ids
|
|
167
|
-
} = props.sdk;
|
|
168
|
-
|
|
169
|
-
const defaultGetEntryUrl = entry => `/spaces/${ids.space}/environments/${ids.environmentAlias || ids.environment}/entries/${entry.sys.id}`;
|
|
170
|
-
|
|
171
|
-
const {
|
|
172
|
-
name,
|
|
173
|
-
sdk,
|
|
174
|
-
className,
|
|
175
|
-
children,
|
|
176
|
-
renderHeading,
|
|
177
|
-
renderHelpText,
|
|
178
|
-
showFocusBar = true,
|
|
179
|
-
getEntryURL = defaultGetEntryUrl
|
|
180
|
-
} = props;
|
|
181
|
-
const {
|
|
182
|
-
field
|
|
183
|
-
} = sdk;
|
|
184
|
-
const helpText = ((_sdk$parameters = sdk.parameters) == null ? void 0 : (_sdk$parameters$insta = _sdk$parameters.instance) == null ? void 0 : _sdk$parameters$insta.helpText) ?? '';
|
|
185
|
-
const [hasErrors, setHasErrors] = React.useState(false);
|
|
186
|
-
React.useEffect(() => {
|
|
187
|
-
return field.onSchemaErrorsChanged(errors => {
|
|
188
|
-
setHasErrors((errors || []).length > 0);
|
|
189
|
-
});
|
|
190
|
-
}, [field]);
|
|
191
|
-
const fieldControlId = [field.id, field.locale, (_sdk$contentType = sdk.contentType) == null ? void 0 : (_sdk$contentType$sys = _sdk$contentType.sys) == null ? void 0 : _sdk$contentType$sys.id].filter(item => item).join('-');
|
|
192
|
-
return React.createElement(f36Components.FormControl, {
|
|
193
|
-
id: fieldControlId,
|
|
194
|
-
testId: "entity-field-controls",
|
|
195
|
-
"data-test-id": "entity-field-controls",
|
|
196
|
-
className: emotion.cx(showFocusBar && styles.withFocusBar, className),
|
|
197
|
-
"aria-invalid": hasErrors,
|
|
198
|
-
isRequired: field.required
|
|
199
|
-
}, renderHeading ? renderHeading(name) : React.createElement(f36Components.FormControl.Label, {
|
|
200
|
-
className: styles.label
|
|
201
|
-
}, name), children, React.createElement(fieldEditorValidationErrors.ValidationErrors, {
|
|
202
|
-
field: field,
|
|
203
|
-
space: sdk.space,
|
|
204
|
-
locales: sdk.locales,
|
|
205
|
-
getEntryURL: getEntryURL || defaultGetEntryUrl
|
|
206
|
-
}), renderHelpText ? renderHelpText(helpText) : React.createElement(f36Components.FormControl.HelpText, {
|
|
207
|
-
testId: "field-hint",
|
|
208
|
-
className: styles.helpText
|
|
209
|
-
}, helpText));
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
exports.Field = Field;
|
|
213
|
-
exports.FieldWrapper = FieldWrapper;
|
|
214
|
-
exports.getDefaultWidgetId = getDefaultWidgetId;
|
|
215
|
-
//# sourceMappingURL=default-field-editors.cjs.development.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-field-editors.cjs.development.js","sources":["../src/getDefaultWidgetId.ts","../src/Field.tsx","../src/FieldWrapper.styles.ts","../src/FieldWrapper.tsx"],"sourcesContent":["import type { FieldExtensionSDK } from '@contentful/field-editor-shared';\nimport { editorInterfaceDefaults } from 'contentful-management';\n\nimport type { WidgetType } from './types';\n\nexport function getDefaultWidgetId(\n sdk: Pick<FieldExtensionSDK, 'field' | 'contentType'>\n): WidgetType {\n const field = sdk.field;\n\n // @ts-expect-error FieldExtensionSDK.field doesn't include all the\n // properties of ContentFields type. It should be fixed\n return editorInterfaceDefaults.default.getDefaultControlOfField(field).widgetId;\n}\n","import * as React from 'react';\n\nimport { BooleanEditor } from '@contentful/field-editor-boolean';\nimport { RadioEditor } from '@contentful/field-editor-radio';\nimport { RatingEditor } from '@contentful/field-editor-rating';\nimport { CheckboxEditor } from '@contentful/field-editor-checkbox';\nimport { DateEditor } from '@contentful/field-editor-date';\nimport { DropdownEditor } from '@contentful/field-editor-dropdown';\nimport { JsonEditor } from '@contentful/field-editor-json';\nimport { ListEditor } from '@contentful/field-editor-list';\nimport { LocationEditor } from '@contentful/field-editor-location';\nimport { MarkdownEditor } from '@contentful/field-editor-markdown';\nimport { MultipleLineEditor } from '@contentful/field-editor-multiple-line';\nimport { NumberEditor } from '@contentful/field-editor-number';\nimport {\n SingleEntryReferenceEditor,\n MultipleEntryReferenceEditor,\n SingleMediaEditor,\n MultipleMediaEditor,\n} from '@contentful/field-editor-reference';\nimport { RichTextEditor } from '@contentful/field-editor-rich-text';\nimport type { FieldExtensionSDK } from '@contentful/field-editor-shared';\nimport { SingleLineEditor } from '@contentful/field-editor-single-line';\nimport { SlugEditor } from '@contentful/field-editor-slug';\nimport { TagsEditor } from '@contentful/field-editor-tags';\nimport { UrlEditor } from '@contentful/field-editor-url';\n\nimport { getDefaultWidgetId } from './getDefaultWidgetId';\nimport type { EditorOptions, WidgetType } from './types';\n\ntype FieldProps = {\n sdk: FieldExtensionSDK;\n widgetId?: WidgetType;\n isInitiallyDisabled?: boolean;\n renderFieldEditor?: (\n widgetId: WidgetType,\n sdk: FieldExtensionSDK,\n isInitiallyDisabled: boolean\n ) => JSX.Element | false;\n getOptions?: (widgetId: WidgetType, sdk: FieldExtensionSDK) => EditorOptions;\n};\n\nconst widgetComponents: Record<string, [React.ComponentType<any>, any?]> = {\n multipleLine: [MultipleLineEditor],\n boolean: [BooleanEditor],\n objectEditor: [JsonEditor],\n datePicker: [DateEditor],\n locationEditor: [LocationEditor],\n checkbox: [CheckboxEditor],\n listInput: [ListEditor],\n rating: [RatingEditor],\n radio: [RadioEditor],\n tagEditor: [TagsEditor],\n numberEditor: [NumberEditor],\n urlEditor: [UrlEditor],\n slugEditor: [SlugEditor],\n singleLine: [SingleLineEditor],\n dropdown: [DropdownEditor],\n entryLinkEditor: [SingleEntryReferenceEditor, { viewType: 'link', hasCardEditActions: true }],\n entryCardEditor: [SingleEntryReferenceEditor, { viewType: 'card', hasCardEditActions: true }],\n entryLinksEditor: [MultipleEntryReferenceEditor, { viewType: 'link', hasCardEditActions: true }],\n entryCardsEditor: [MultipleEntryReferenceEditor, { viewType: 'card', hasCardEditActions: true }],\n assetLinkEditor: [SingleMediaEditor, { viewType: 'link' }],\n assetLinksEditor: [MultipleMediaEditor, { viewType: 'link' }],\n assetGalleryEditor: [MultipleMediaEditor, { viewType: 'card' }],\n richTextEditor: [RichTextEditor],\n markdown: [MarkdownEditor],\n};\n\nexport const Field: React.FC<FieldProps> = (props: FieldProps) => {\n const {\n sdk,\n widgetId: possiblyUndefinedWidgetId,\n isInitiallyDisabled = false,\n renderFieldEditor,\n getOptions,\n } = props;\n const field = sdk.field;\n const locales = sdk.locales;\n\n const widgetId = possiblyUndefinedWidgetId ?? getDefaultWidgetId(sdk);\n\n if (renderFieldEditor) {\n const customEditor = renderFieldEditor(widgetId, sdk, isInitiallyDisabled);\n if (customEditor) {\n return customEditor;\n }\n }\n\n const options = getOptions ? getOptions(widgetId, sdk) : {};\n const referenceEditorParams =\n sdk.parameters && 'instance' in sdk.parameters\n ? sdk.parameters\n : {\n instance: {\n showCreateEntityAction: true,\n showLinkEntityAction: true,\n },\n };\n\n if (!widgetComponents[widgetId]) return null;\n\n const [WidgetComponent, widgetStaticProps] = widgetComponents[widgetId];\n\n const widgetComponentProps = {\n sdk,\n field,\n locales,\n isInitiallyDisabled,\n parameters: referenceEditorParams,\n ...widgetStaticProps,\n // @ts-expect-error\n ...options[widgetId],\n };\n\n const baseSdk = widgetId === 'slugEditor' ? sdk : undefined;\n\n return <WidgetComponent key={sdk.field.locale} {...widgetComponentProps} baseSdk={baseSdk} />;\n};\n","import tokens from '@contentful/f36-tokens';\nimport { css } from 'emotion';\n\nexport const styles = {\n withFocusBar: css({\n marginLeft: tokens.spacingL,\n marginRight: tokens.spacingL,\n marginBottom: '29px',\n marginTop: '19px',\n paddingLeft: tokens.spacingM,\n borderLeft: `3px solid ${tokens.gray300}`,\n transition: 'border-color 0.18s linear',\n '&:focus-within': {\n borderColor: tokens.colorPrimary,\n },\n '&[aria-invalid=\"true\"]': {\n borderLeftColor: tokens.red500,\n },\n }),\n label: css({\n display: 'flex',\n width: '100%',\n maxWidth: '800px',\n color: tokens.gray500,\n fontSize: tokens.fontSizeM,\n fontWeight: tokens.fontWeightNormal,\n lineHeight: tokens.lineHeightDefault,\n whiteSpace: 'pre-wrap',\n }),\n helpText: css({\n margin: `${tokens.spacingXs} 0`,\n fontStyle: 'italic',\n }),\n};\n","import * as React from 'react';\n\nimport { FormControl } from '@contentful/f36-components';\nimport type { FieldExtensionSDK, Entry } from '@contentful/field-editor-shared';\nimport { ValidationErrors } from '@contentful/field-editor-validation-errors';\nimport { cx } from 'emotion';\n\nimport { styles } from './FieldWrapper.styles';\n\ntype FieldWrapperProps = {\n name: string;\n sdk: FieldExtensionSDK;\n /**\n * Generates a link to another entry with the same value when a \"non unique\" validation error occurs\n */\n getEntryURL?: (entry: Entry) => string;\n className?: string;\n showFocusBar?: boolean;\n children: React.ReactNode;\n renderHeading?: (name: string) => JSX.Element | null;\n renderHelpText?: (helpText: string) => JSX.Element | null;\n};\n\nexport const FieldWrapper: React.FC<FieldWrapperProps> = function (props: FieldWrapperProps) {\n const { ids } = props.sdk;\n const defaultGetEntryUrl = (entry: Entry) =>\n `/spaces/${ids.space}/environments/${ids.environmentAlias || ids.environment}/entries/${\n entry.sys.id\n }`;\n const {\n name,\n sdk,\n className,\n children,\n renderHeading,\n renderHelpText,\n showFocusBar = true,\n getEntryURL = defaultGetEntryUrl,\n } = props;\n const { field } = sdk;\n const helpText = (sdk.parameters?.instance as any)?.helpText ?? '';\n\n const [hasErrors, setHasErrors] = React.useState(false);\n React.useEffect(() => {\n return field.onSchemaErrorsChanged((errors: unknown[]) => {\n setHasErrors((errors || []).length > 0);\n });\n }, [field]);\n\n const fieldControlId = [field.id, field.locale, sdk.contentType?.sys?.id]\n .filter((item) => item)\n .join('-');\n\n return (\n <FormControl\n id={fieldControlId}\n testId=\"entity-field-controls\"\n data-test-id=\"entity-field-controls\"\n className={cx(showFocusBar && styles.withFocusBar, className)}\n aria-invalid={hasErrors}\n isRequired={field.required}>\n {renderHeading ? (\n renderHeading(name)\n ) : (\n <FormControl.Label className={styles.label}>{name}</FormControl.Label>\n )}\n\n {children}\n\n <ValidationErrors\n field={field}\n space={sdk.space}\n locales={sdk.locales}\n getEntryURL={getEntryURL || defaultGetEntryUrl}\n />\n\n {renderHelpText ? (\n renderHelpText(helpText)\n ) : (\n <FormControl.HelpText testId=\"field-hint\" className={styles.helpText}>\n {helpText}\n </FormControl.HelpText>\n )}\n </FormControl>\n );\n};\n"],"names":["getDefaultWidgetId","sdk","field","editorInterfaceDefaults","default","getDefaultControlOfField","widgetId","widgetComponents","multipleLine","MultipleLineEditor","boolean","BooleanEditor","objectEditor","JsonEditor","datePicker","DateEditor","locationEditor","LocationEditor","checkbox","CheckboxEditor","listInput","ListEditor","rating","RatingEditor","radio","RadioEditor","tagEditor","TagsEditor","numberEditor","NumberEditor","urlEditor","UrlEditor","slugEditor","SlugEditor","singleLine","SingleLineEditor","dropdown","DropdownEditor","entryLinkEditor","SingleEntryReferenceEditor","viewType","hasCardEditActions","entryCardEditor","entryLinksEditor","MultipleEntryReferenceEditor","entryCardsEditor","assetLinkEditor","SingleMediaEditor","assetLinksEditor","MultipleMediaEditor","assetGalleryEditor","richTextEditor","RichTextEditor","markdown","MarkdownEditor","Field","props","possiblyUndefinedWidgetId","isInitiallyDisabled","renderFieldEditor","getOptions","locales","customEditor","options","referenceEditorParams","parameters","instance","showCreateEntityAction","showLinkEntityAction","WidgetComponent","widgetStaticProps","widgetComponentProps","baseSdk","undefined","React","key","locale","styles","withFocusBar","css","marginLeft","tokens","spacingL","marginRight","marginBottom","marginTop","paddingLeft","spacingM","borderLeft","gray300","transition","borderColor","colorPrimary","borderLeftColor","red500","label","display","width","maxWidth","color","gray500","fontSize","fontSizeM","fontWeight","fontWeightNormal","lineHeight","lineHeightDefault","whiteSpace","helpText","margin","spacingXs","fontStyle","FieldWrapper","ids","defaultGetEntryUrl","entry","space","environmentAlias","environment","sys","id","name","className","children","renderHeading","renderHelpText","showFocusBar","getEntryURL","hasErrors","setHasErrors","onSchemaErrorsChanged","errors","length","fieldControlId","contentType","filter","item","join","FormControl","testId","cx","isRequired","required","Label","ValidationErrors","HelpText"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAKgBA,mBACdC;AAEA,QAAMC,KAAK,GAAGD,GAAG,CAACC,KAAlB;AAGA;;AACA,SAAOC,4CAAuB,CAACC,OAAxB,CAAgCC,wBAAhC,CAAyDH,KAAzD,EAAgEI,QAAvE;AACD;;AC6BD,MAAMC,gBAAgB,GAAqD;AACzEC,EAAAA,YAAY,EAAE,CAACC,0CAAD,CAD2D;AAEzEC,EAAAA,OAAO,EAAE,CAACC,gCAAD,CAFgE;AAGzEC,EAAAA,YAAY,EAAE,CAACC,0BAAD,CAH2D;AAIzEC,EAAAA,UAAU,EAAE,CAACC,0BAAD,CAJ6D;AAKzEC,EAAAA,cAAc,EAAE,CAACC,kCAAD,CALyD;AAMzEC,EAAAA,QAAQ,EAAE,CAACC,kCAAD,CAN+D;AAOzEC,EAAAA,SAAS,EAAE,CAACC,0BAAD,CAP8D;AAQzEC,EAAAA,MAAM,EAAE,CAACC,8BAAD,CARiE;AASzEC,EAAAA,KAAK,EAAE,CAACC,4BAAD,CATkE;AAUzEC,EAAAA,SAAS,EAAE,CAACC,0BAAD,CAV8D;AAWzEC,EAAAA,YAAY,EAAE,CAACC,8BAAD,CAX2D;AAYzEC,EAAAA,SAAS,EAAE,CAACC,wBAAD,CAZ8D;AAazEC,EAAAA,UAAU,EAAE,CAACC,0BAAD,CAb6D;AAczEC,EAAAA,UAAU,EAAE,CAACC,sCAAD,CAd6D;AAezEC,EAAAA,QAAQ,EAAE,CAACC,kCAAD,CAf+D;AAgBzEC,EAAAA,eAAe,EAAE,CAACC,+CAAD,EAA6B;AAAEC,IAAAA,QAAQ,EAA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eEjD,mBAAA,CAACsE,4CAAD;AACE9I,IAAAA,KAAK,EAAEA;AACPkH,IAAAA,KAAK,EAAEnH,GAAG,CAACmH;AACXvD,IAAAA,OAAO,EAAE5D,GAAG,CAAC4D;AACbkE,IAAAA,WAAW,EAAEA,WAAW,IAAIb;GAJ9B,CAfF,EAsBGW,cAAc,GACbA,cAAc,CAACjB,QAAD,CADD,GAGblC,mBAAA,CAACgE,yBAAW,CAACO,QAAb;AAAsBN,IAAAA,MAAM,EAAC;AAAajB,IAAAA,SAAS,EAAE7C,MAAM,CAAC+B;GAA5D,EACGA,QADH,CAzBJ,CADF;AAgCD,CA9DM;;;;;;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),i=require("@contentful/field-editor-boolean"),r=require("@contentful/field-editor-radio"),n=require("@contentful/field-editor-rating"),o=require("@contentful/field-editor-checkbox"),l=require("@contentful/field-editor-date"),d=require("@contentful/field-editor-dropdown"),a=require("@contentful/field-editor-json"),s=require("@contentful/field-editor-list"),c=require("@contentful/field-editor-location"),u=require("@contentful/field-editor-markdown"),f=require("@contentful/field-editor-multiple-line"),E=require("@contentful/field-editor-number"),p=require("@contentful/field-editor-reference"),g=require("@contentful/field-editor-rich-text"),m=require("@contentful/field-editor-single-line"),y=require("@contentful/field-editor-slug"),h=require("@contentful/field-editor-tags"),q=require("@contentful/field-editor-url"),w=require("contentful-management"),k=require("@contentful/f36-components"),x=require("@contentful/field-editor-validation-errors"),b=require("emotion"),L=(e=require("@contentful/f36-tokens"))&&"object"==typeof e&&"default"in e?e.default:e;function v(e){return w.editorInterfaceDefaults.default.getDefaultControlOfField(e.field).widgetId}const T={multipleLine:[f.MultipleLineEditor],boolean:[i.BooleanEditor],objectEditor:[a.JsonEditor],datePicker:[l.DateEditor],locationEditor:[c.LocationEditor],checkbox:[o.CheckboxEditor],listInput:[s.ListEditor],rating:[n.RatingEditor],radio:[r.RadioEditor],tagEditor:[h.TagsEditor],numberEditor:[E.NumberEditor],urlEditor:[q.UrlEditor],slugEditor:[y.SlugEditor],singleLine:[m.SingleLineEditor],dropdown:[d.DropdownEditor],entryLinkEditor:[p.SingleEntryReferenceEditor,{viewType:"link",hasCardEditActions:!0}],entryCardEditor:[p.SingleEntryReferenceEditor,{viewType:"card",hasCardEditActions:!0}],entryLinksEditor:[p.MultipleEntryReferenceEditor,{viewType:"link",hasCardEditActions:!0}],entryCardsEditor:[p.MultipleEntryReferenceEditor,{viewType:"card",hasCardEditActions:!0}],assetLinkEditor:[p.SingleMediaEditor,{viewType:"link"}],assetLinksEditor:[p.MultipleMediaEditor,{viewType:"link"}],assetGalleryEditor:[p.MultipleMediaEditor,{viewType:"card"}],richTextEditor:[g.RichTextEditor],markdown:[u.MarkdownEditor]},C={withFocusBar:b.css({marginLeft:L.spacingL,marginRight:L.spacingL,marginBottom:"29px",marginTop:"19px",paddingLeft:L.spacingM,borderLeft:"3px solid "+L.gray300,transition:"border-color 0.18s linear","&:focus-within":{borderColor:L.colorPrimary},'&[aria-invalid="true"]':{borderLeftColor:L.red500}}),label:b.css({display:"flex",width:"100%",maxWidth:"800px",color:L.gray500,fontSize:L.fontSizeM,fontWeight:L.fontWeightNormal,lineHeight:L.lineHeightDefault,whiteSpace:"pre-wrap"}),helpText:b.css({margin:L.spacingXs+" 0",fontStyle:"italic"})};exports.Field=e=>{const{sdk:i,widgetId:r,isInitiallyDisabled:n=!1,renderFieldEditor:o,getOptions:l}=e,d=i.field,a=i.locales,s=r??v(i);if(o){const e=o(s,i,n);if(e)return e}const c=l?l(s,i):{},u=i.parameters&&"instance"in i.parameters?i.parameters:{instance:{showCreateEntityAction:!0,showLinkEntityAction:!0}};if(!T[s])return null;const[f,E]=T[s],p={sdk:i,field:d,locales:a,isInitiallyDisabled:n,parameters:u,...E,...c[s]};return t.createElement(f,{key:i.field.locale,...p,baseSdk:"slugEditor"===s?i:void 0})},exports.FieldWrapper=function(e){var i,r,n,o;const{ids:l}=e.sdk,d=e=>`/spaces/${l.space}/environments/${l.environmentAlias||l.environment}/entries/${e.sys.id}`,{name:a,sdk:s,className:c,children:u,renderHeading:f,renderHelpText:E,showFocusBar:p=!0,getEntryURL:g=d}=e,{field:m}=s,y=(null==(i=s.parameters)||null==(r=i.instance)?void 0:r.helpText)??"",[h,q]=t.useState(!1);t.useEffect(()=>m.onSchemaErrorsChanged(e=>{q((e||[]).length>0)}),[m]);const w=[m.id,m.locale,null==(n=s.contentType)||null==(o=n.sys)?void 0:o.id].filter(e=>e).join("-");return t.createElement(k.FormControl,{id:w,testId:"entity-field-controls","data-test-id":"entity-field-controls",className:b.cx(p&&C.withFocusBar,c),"aria-invalid":h,isRequired:m.required},f?f(a):t.createElement(k.FormControl.Label,{className:C.label},a),u,t.createElement(x.ValidationErrors,{field:m,space:s.space,locales:s.locales,getEntryURL:g||d}),E?E(y):t.createElement(k.FormControl.HelpText,{testId:"field-hint",className:C.helpText},y))},exports.getDefaultWidgetId=v;
|
|
2
|
-
//# sourceMappingURL=default-field-editors.cjs.production.min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-field-editors.cjs.production.min.js","sources":["../src/getDefaultWidgetId.ts","../src/Field.tsx","../src/FieldWrapper.styles.ts","../src/FieldWrapper.tsx"],"sourcesContent":["import type { FieldExtensionSDK } from '@contentful/field-editor-shared';\nimport { editorInterfaceDefaults } from 'contentful-management';\n\nimport type { WidgetType } from './types';\n\nexport function getDefaultWidgetId(\n sdk: Pick<FieldExtensionSDK, 'field' | 'contentType'>\n): WidgetType {\n const field = sdk.field;\n\n // @ts-expect-error FieldExtensionSDK.field doesn't include all the\n // properties of ContentFields type. It should be fixed\n return editorInterfaceDefaults.default.getDefaultControlOfField(field).widgetId;\n}\n","import * as React from 'react';\n\nimport { BooleanEditor } from '@contentful/field-editor-boolean';\nimport { RadioEditor } from '@contentful/field-editor-radio';\nimport { RatingEditor } from '@contentful/field-editor-rating';\nimport { CheckboxEditor } from '@contentful/field-editor-checkbox';\nimport { DateEditor } from '@contentful/field-editor-date';\nimport { DropdownEditor } from '@contentful/field-editor-dropdown';\nimport { JsonEditor } from '@contentful/field-editor-json';\nimport { ListEditor } from '@contentful/field-editor-list';\nimport { LocationEditor } from '@contentful/field-editor-location';\nimport { MarkdownEditor } from '@contentful/field-editor-markdown';\nimport { MultipleLineEditor } from '@contentful/field-editor-multiple-line';\nimport { NumberEditor } from '@contentful/field-editor-number';\nimport {\n SingleEntryReferenceEditor,\n MultipleEntryReferenceEditor,\n SingleMediaEditor,\n MultipleMediaEditor,\n} from '@contentful/field-editor-reference';\nimport { RichTextEditor } from '@contentful/field-editor-rich-text';\nimport type { FieldExtensionSDK } from '@contentful/field-editor-shared';\nimport { SingleLineEditor } from '@contentful/field-editor-single-line';\nimport { SlugEditor } from '@contentful/field-editor-slug';\nimport { TagsEditor } from '@contentful/field-editor-tags';\nimport { UrlEditor } from '@contentful/field-editor-url';\n\nimport { getDefaultWidgetId } from './getDefaultWidgetId';\nimport type { EditorOptions, WidgetType } from './types';\n\ntype FieldProps = {\n sdk: FieldExtensionSDK;\n widgetId?: WidgetType;\n isInitiallyDisabled?: boolean;\n renderFieldEditor?: (\n widgetId: WidgetType,\n sdk: FieldExtensionSDK,\n isInitiallyDisabled: boolean\n ) => JSX.Element | false;\n getOptions?: (widgetId: WidgetType, sdk: FieldExtensionSDK) => EditorOptions;\n};\n\nconst widgetComponents: Record<string, [React.ComponentType<any>, any?]> = {\n multipleLine: [MultipleLineEditor],\n boolean: [BooleanEditor],\n objectEditor: [JsonEditor],\n datePicker: [DateEditor],\n locationEditor: [LocationEditor],\n checkbox: [CheckboxEditor],\n listInput: [ListEditor],\n rating: [RatingEditor],\n radio: [RadioEditor],\n tagEditor: [TagsEditor],\n numberEditor: [NumberEditor],\n urlEditor: [UrlEditor],\n slugEditor: [SlugEditor],\n singleLine: [SingleLineEditor],\n dropdown: [DropdownEditor],\n entryLinkEditor: [SingleEntryReferenceEditor, { viewType: 'link', hasCardEditActions: true }],\n entryCardEditor: [SingleEntryReferenceEditor, { viewType: 'card', hasCardEditActions: true }],\n entryLinksEditor: [MultipleEntryReferenceEditor, { viewType: 'link', hasCardEditActions: true }],\n entryCardsEditor: [MultipleEntryReferenceEditor, { viewType: 'card', hasCardEditActions: true }],\n assetLinkEditor: [SingleMediaEditor, { viewType: 'link' }],\n assetLinksEditor: [MultipleMediaEditor, { viewType: 'link' }],\n assetGalleryEditor: [MultipleMediaEditor, { viewType: 'card' }],\n richTextEditor: [RichTextEditor],\n markdown: [MarkdownEditor],\n};\n\nexport const Field: React.FC<FieldProps> = (props: FieldProps) => {\n const {\n sdk,\n widgetId: possiblyUndefinedWidgetId,\n isInitiallyDisabled = false,\n renderFieldEditor,\n getOptions,\n } = props;\n const field = sdk.field;\n const locales = sdk.locales;\n\n const widgetId = possiblyUndefinedWidgetId ?? getDefaultWidgetId(sdk);\n\n if (renderFieldEditor) {\n const customEditor = renderFieldEditor(widgetId, sdk, isInitiallyDisabled);\n if (customEditor) {\n return customEditor;\n }\n }\n\n const options = getOptions ? getOptions(widgetId, sdk) : {};\n const referenceEditorParams =\n sdk.parameters && 'instance' in sdk.parameters\n ? sdk.parameters\n : {\n instance: {\n showCreateEntityAction: true,\n showLinkEntityAction: true,\n },\n };\n\n if (!widgetComponents[widgetId]) return null;\n\n const [WidgetComponent, widgetStaticProps] = widgetComponents[widgetId];\n\n const widgetComponentProps = {\n sdk,\n field,\n locales,\n isInitiallyDisabled,\n parameters: referenceEditorParams,\n ...widgetStaticProps,\n // @ts-expect-error\n ...options[widgetId],\n };\n\n const baseSdk = widgetId === 'slugEditor' ? sdk : undefined;\n\n return <WidgetComponent key={sdk.field.locale} {...widgetComponentProps} baseSdk={baseSdk} />;\n};\n","import tokens from '@contentful/f36-tokens';\nimport { css } from 'emotion';\n\nexport const styles = {\n withFocusBar: css({\n marginLeft: tokens.spacingL,\n marginRight: tokens.spacingL,\n marginBottom: '29px',\n marginTop: '19px',\n paddingLeft: tokens.spacingM,\n borderLeft: `3px solid ${tokens.gray300}`,\n transition: 'border-color 0.18s linear',\n '&:focus-within': {\n borderColor: tokens.colorPrimary,\n },\n '&[aria-invalid=\"true\"]': {\n borderLeftColor: tokens.red500,\n },\n }),\n label: css({\n display: 'flex',\n width: '100%',\n maxWidth: '800px',\n color: tokens.gray500,\n fontSize: tokens.fontSizeM,\n fontWeight: tokens.fontWeightNormal,\n lineHeight: tokens.lineHeightDefault,\n whiteSpace: 'pre-wrap',\n }),\n helpText: css({\n margin: `${tokens.spacingXs} 0`,\n fontStyle: 'italic',\n }),\n};\n","import * as React from 'react';\n\nimport { FormControl } from '@contentful/f36-components';\nimport type { FieldExtensionSDK, Entry } from '@contentful/field-editor-shared';\nimport { ValidationErrors } from '@contentful/field-editor-validation-errors';\nimport { cx } from 'emotion';\n\nimport { styles } from './FieldWrapper.styles';\n\ntype FieldWrapperProps = {\n name: string;\n sdk: FieldExtensionSDK;\n /**\n * Generates a link to another entry with the same value when a \"non unique\" validation error occurs\n */\n getEntryURL?: (entry: Entry) => string;\n className?: string;\n showFocusBar?: boolean;\n children: React.ReactNode;\n renderHeading?: (name: string) => JSX.Element | null;\n renderHelpText?: (helpText: string) => JSX.Element | null;\n};\n\nexport const FieldWrapper: React.FC<FieldWrapperProps> = function (props: FieldWrapperProps) {\n const { ids } = props.sdk;\n const defaultGetEntryUrl = (entry: Entry) =>\n `/spaces/${ids.space}/environments/${ids.environmentAlias || ids.environment}/entries/${\n entry.sys.id\n }`;\n const {\n name,\n sdk,\n className,\n children,\n renderHeading,\n renderHelpText,\n showFocusBar = true,\n getEntryURL = defaultGetEntryUrl,\n } = props;\n const { field } = sdk;\n const helpText = (sdk.parameters?.instance as any)?.helpText ?? '';\n\n const [hasErrors, setHasErrors] = React.useState(false);\n React.useEffect(() => {\n return field.onSchemaErrorsChanged((errors: unknown[]) => {\n setHasErrors((errors || []).length > 0);\n });\n }, [field]);\n\n const fieldControlId = [field.id, field.locale, sdk.contentType?.sys?.id]\n .filter((item) => item)\n .join('-');\n\n return (\n <FormControl\n id={fieldControlId}\n testId=\"entity-field-controls\"\n data-test-id=\"entity-field-controls\"\n className={cx(showFocusBar && styles.withFocusBar, className)}\n aria-invalid={hasErrors}\n isRequired={field.required}>\n {renderHeading ? (\n renderHeading(name)\n ) : (\n <FormControl.Label className={styles.label}>{name}</FormControl.Label>\n )}\n\n {children}\n\n <ValidationErrors\n field={field}\n space={sdk.space}\n locales={sdk.locales}\n getEntryURL={getEntryURL || defaultGetEntryUrl}\n />\n\n {renderHelpText ? (\n renderHelpText(helpText)\n ) : (\n <FormControl.HelpText testId=\"field-hint\" className={styles.helpText}>\n {helpText}\n </FormControl.HelpText>\n )}\n </FormControl>\n );\n};\n"],"names":["getDefaultWidgetId","sdk","editorInterfaceDefaults","default","getDefaultControlOfField","field","widgetId","widgetComponents","multipleLine","MultipleLineEditor","boolean","BooleanEditor","objectEditor","JsonEditor","datePicker","DateEditor","locationEditor","LocationEditor","checkbox","CheckboxEditor","listInput","ListEditor","rating","RatingEditor","radio","RadioEditor","tagEditor","TagsEditor","numberEditor","NumberEditor","urlEditor","UrlEditor","slugEditor","SlugEditor","singleLine","SingleLineEditor","dropdown","DropdownEditor","entryLinkEditor","SingleEntryReferenceEditor","viewType","hasCardEditActions","entryCardEditor","entryLinksEditor","MultipleEntryReferenceEditor","entryCardsEditor","assetLinkEditor","SingleMediaEditor","assetLinksEditor","MultipleMediaEditor","assetGalleryEditor","richTextEditor","RichTextEditor","markdown","MarkdownEditor","styles","withFocusBar","css","marginLeft","tokens","spacingL","marginRight","marginBottom","marginTop","paddingLeft","spacingM","borderLeft","gray300","transition","borderColor","colorPrimary","borderLeftColor","red500","label","display","width","maxWidth","color","gray500","fontSize","fontSizeM","fontWeight","fontWeightNormal","lineHeight","lineHeightDefault","whiteSpace","helpText","margin","spacingXs","fontStyle","props","possiblyUndefinedWidgetId","isInitiallyDisabled","renderFieldEditor","getOptions","locales","customEditor","options","referenceEditorParams","parameters","instance","showCreateEntityAction","showLinkEntityAction","WidgetComponent","widgetStaticProps","widgetComponentProps","React","key","locale","baseSdk","undefined","ids","defaultGetEntryUrl","entry","space","environmentAlias","environment","sys","id","name","className","children","renderHeading","renderHelpText","showFocusBar","getEntryURL","hasErrors","setHasErrors","onSchemaErrorsChanged","errors","length","fieldControlId","contentType","_sdk$contentType","_sdk$contentType$sys","filter","item","join","FormControl","testId","cx","isRequired","required","Label","ValidationErrors","HelpText"],"mappings":"4oCAKgBA,EACdC,UAMOC,0BAAwBC,QAAQC,yBAJzBH,EAAII,OAIqDC,SC8BzE,MAAMC,EAAqE,CACzEC,aAAc,CAACC,sBACfC,QAAS,CAACC,iBACVC,aAAc,CAACC,cACfC,WAAY,CAACC,cACbC,eAAgB,CAACC,kBACjBC,SAAU,CAACC,kBACXC,UAAW,CAACC,cACZC,OAAQ,CAACC,gBACTC,MAAO,CAACC,eACRC,UAAW,CAACC,cACZC,aAAc,CAACC,gBACfC,UAAW,CAACC,aACZC,WAAY,CAACC,cACbC,WAAY,CAACC,oBACbC,SAAU,CAACC,kBACXC,gBAAiB,CAACC,6BAA4B,CAAEC,SAAU,OAAQC,oBAAoB,IACtFC,gBAAiB,CAACH,6BAA4B,CAAEC,SAAU,OAAQC,oBAAoB,IACtFE,iBAAkB,CAACC,+BAA8B,CAAEJ,SAAU,OAAQC,oBAAoB,IACzFI,iBAAkB,CAACD,+BAA8B,CAAEJ,SAAU,OAAQC,oBAAoB,IACzFK,gBAAiB,CAACC,oBAAmB,CAAEP,SAAU,SACjDQ,iBAAkB,CAACC,sBAAqB,CAAET,SAAU,SACpDU,mBAAoB,CAACD,sBAAqB,CAAET,SAAU,SACtDW,eAAgB,CAACC,kBACjBC,SAAU,CAACC,mBC/DAC,EAAS,CACpBC,aAAcC,MAAI,CAChBC,WAAYC,EAAOC,SACnBC,YAAaF,EAAOC,SACpBE,aAAc,OACdC,UAAW,OACXC,YAAaL,EAAOM,SACpBC,wBAAyBP,EAAOQ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A,EAAcb,GACZtB,GACErF,MAAEA,GAAUJ,EACZqF,YAAYrF,EAAIkG,wBAAYC,mBAAkBd,WAAY,IAEzDwC,EAAWC,GAAgBrB,YAAe,GACjDA,YAAgB,IACPrG,EAAM2H,sBAAuBC,IAClCF,GAAcE,GAAU,IAAIC,OAAS,KAEtC,CAAC7H,UAEE8H,EAAiB,CAAC9H,EAAMiH,GAAIjH,EAAMuG,gBAAQ3G,EAAImI,uBAAJC,EAAiBhB,YAAjBiB,EAAsBhB,IACnEiB,OAAQC,GAASA,GACjBC,KAAK,YAGN/B,gBAACgC,eACCpB,GAAIa,EACJQ,OAAO,uCACM,wBACbnB,UAAWoB,KAAGhB,GAAgBrE,EAAOC,aAAcgE,kBACrCM,EACde,WAAYxI,EAAMyI,UACjBpB,EACCA,EAAcH,GAEdb,gBAACgC,cAAYK,OAAMvB,UAAWjE,EAAOkB,OAAQ8C,GAG9CE,EAEDf,gBAACsC,oBACC3I,MAAOA,EACP6G,MAAOjH,EAAIiH,MACXnB,QAAS9F,EAAI8F,QACb8B,YAAaA,GAAeb,IAG7BW,EACCA,EAAerC,GAEfoB,gBAACgC,cAAYO,UAASN,OAAO,aAAanB,UAAWjE,EAAO+B,UACzDA"}
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { createElement, useState, useEffect } from 'react';
|
|
2
|
-
import { BooleanEditor } from '@contentful/field-editor-boolean';
|
|
3
|
-
import { RadioEditor } from '@contentful/field-editor-radio';
|
|
4
|
-
import { RatingEditor } from '@contentful/field-editor-rating';
|
|
5
|
-
import { CheckboxEditor } from '@contentful/field-editor-checkbox';
|
|
6
|
-
import { DateEditor } from '@contentful/field-editor-date';
|
|
7
|
-
import { DropdownEditor } from '@contentful/field-editor-dropdown';
|
|
8
|
-
import { JsonEditor } from '@contentful/field-editor-json';
|
|
9
|
-
import { ListEditor } from '@contentful/field-editor-list';
|
|
10
|
-
import { LocationEditor } from '@contentful/field-editor-location';
|
|
11
|
-
import { MarkdownEditor } from '@contentful/field-editor-markdown';
|
|
12
|
-
import { MultipleLineEditor } from '@contentful/field-editor-multiple-line';
|
|
13
|
-
import { NumberEditor } from '@contentful/field-editor-number';
|
|
14
|
-
import { SingleEntryReferenceEditor, MultipleEntryReferenceEditor, SingleMediaEditor, MultipleMediaEditor } 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 { editorInterfaceDefaults } from 'contentful-management';
|
|
21
|
-
import { FormControl } from '@contentful/f36-components';
|
|
22
|
-
import { ValidationErrors } from '@contentful/field-editor-validation-errors';
|
|
23
|
-
import { css, cx } from 'emotion';
|
|
24
|
-
import tokens from '@contentful/f36-tokens';
|
|
25
|
-
|
|
26
|
-
function getDefaultWidgetId(sdk) {
|
|
27
|
-
const field = sdk.field; // @ts-expect-error FieldExtensionSDK.field doesn't include all the
|
|
28
|
-
// properties of ContentFields type. It should be fixed
|
|
29
|
-
|
|
30
|
-
return editorInterfaceDefaults.default.getDefaultControlOfField(field).widgetId;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const widgetComponents = {
|
|
34
|
-
multipleLine: [MultipleLineEditor],
|
|
35
|
-
boolean: [BooleanEditor],
|
|
36
|
-
objectEditor: [JsonEditor],
|
|
37
|
-
datePicker: [DateEditor],
|
|
38
|
-
locationEditor: [LocationEditor],
|
|
39
|
-
checkbox: [CheckboxEditor],
|
|
40
|
-
listInput: [ListEditor],
|
|
41
|
-
rating: [RatingEditor],
|
|
42
|
-
radio: [RadioEditor],
|
|
43
|
-
tagEditor: [TagsEditor],
|
|
44
|
-
numberEditor: [NumberEditor],
|
|
45
|
-
urlEditor: [UrlEditor],
|
|
46
|
-
slugEditor: [SlugEditor],
|
|
47
|
-
singleLine: [SingleLineEditor],
|
|
48
|
-
dropdown: [DropdownEditor],
|
|
49
|
-
entryLinkEditor: [SingleEntryReferenceEditor, {
|
|
50
|
-
viewType: 'link',
|
|
51
|
-
hasCardEditActions: true
|
|
52
|
-
}],
|
|
53
|
-
entryCardEditor: [SingleEntryReferenceEditor, {
|
|
54
|
-
viewType: 'card',
|
|
55
|
-
hasCardEditActions: true
|
|
56
|
-
}],
|
|
57
|
-
entryLinksEditor: [MultipleEntryReferenceEditor, {
|
|
58
|
-
viewType: 'link',
|
|
59
|
-
hasCardEditActions: true
|
|
60
|
-
}],
|
|
61
|
-
entryCardsEditor: [MultipleEntryReferenceEditor, {
|
|
62
|
-
viewType: 'card',
|
|
63
|
-
hasCardEditActions: true
|
|
64
|
-
}],
|
|
65
|
-
assetLinkEditor: [SingleMediaEditor, {
|
|
66
|
-
viewType: 'link'
|
|
67
|
-
}],
|
|
68
|
-
assetLinksEditor: [MultipleMediaEditor, {
|
|
69
|
-
viewType: 'link'
|
|
70
|
-
}],
|
|
71
|
-
assetGalleryEditor: [MultipleMediaEditor, {
|
|
72
|
-
viewType: 'card'
|
|
73
|
-
}],
|
|
74
|
-
richTextEditor: [RichTextEditor],
|
|
75
|
-
markdown: [MarkdownEditor]
|
|
76
|
-
};
|
|
77
|
-
const Field = props => {
|
|
78
|
-
const {
|
|
79
|
-
sdk,
|
|
80
|
-
widgetId: possiblyUndefinedWidgetId,
|
|
81
|
-
isInitiallyDisabled = false,
|
|
82
|
-
renderFieldEditor,
|
|
83
|
-
getOptions
|
|
84
|
-
} = props;
|
|
85
|
-
const field = sdk.field;
|
|
86
|
-
const locales = sdk.locales;
|
|
87
|
-
const widgetId = possiblyUndefinedWidgetId ?? getDefaultWidgetId(sdk);
|
|
88
|
-
|
|
89
|
-
if (renderFieldEditor) {
|
|
90
|
-
const customEditor = renderFieldEditor(widgetId, sdk, isInitiallyDisabled);
|
|
91
|
-
|
|
92
|
-
if (customEditor) {
|
|
93
|
-
return customEditor;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const options = getOptions ? getOptions(widgetId, sdk) : {};
|
|
98
|
-
const referenceEditorParams = sdk.parameters && 'instance' in sdk.parameters ? sdk.parameters : {
|
|
99
|
-
instance: {
|
|
100
|
-
showCreateEntityAction: true,
|
|
101
|
-
showLinkEntityAction: true
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
if (!widgetComponents[widgetId]) return null;
|
|
105
|
-
const [WidgetComponent, widgetStaticProps] = widgetComponents[widgetId];
|
|
106
|
-
const widgetComponentProps = {
|
|
107
|
-
sdk,
|
|
108
|
-
field,
|
|
109
|
-
locales,
|
|
110
|
-
isInitiallyDisabled,
|
|
111
|
-
parameters: referenceEditorParams,
|
|
112
|
-
...widgetStaticProps,
|
|
113
|
-
// @ts-expect-error
|
|
114
|
-
...options[widgetId]
|
|
115
|
-
};
|
|
116
|
-
const baseSdk = widgetId === 'slugEditor' ? sdk : undefined;
|
|
117
|
-
return createElement(WidgetComponent, {
|
|
118
|
-
key: sdk.field.locale,
|
|
119
|
-
...widgetComponentProps,
|
|
120
|
-
baseSdk: baseSdk
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const styles = {
|
|
125
|
-
withFocusBar: /*#__PURE__*/css({
|
|
126
|
-
marginLeft: tokens.spacingL,
|
|
127
|
-
marginRight: tokens.spacingL,
|
|
128
|
-
marginBottom: '29px',
|
|
129
|
-
marginTop: '19px',
|
|
130
|
-
paddingLeft: tokens.spacingM,
|
|
131
|
-
borderLeft: `3px solid ${tokens.gray300}`,
|
|
132
|
-
transition: 'border-color 0.18s linear',
|
|
133
|
-
'&:focus-within': {
|
|
134
|
-
borderColor: tokens.colorPrimary
|
|
135
|
-
},
|
|
136
|
-
'&[aria-invalid="true"]': {
|
|
137
|
-
borderLeftColor: tokens.red500
|
|
138
|
-
}
|
|
139
|
-
}),
|
|
140
|
-
label: /*#__PURE__*/css({
|
|
141
|
-
display: 'flex',
|
|
142
|
-
width: '100%',
|
|
143
|
-
maxWidth: '800px',
|
|
144
|
-
color: tokens.gray500,
|
|
145
|
-
fontSize: tokens.fontSizeM,
|
|
146
|
-
fontWeight: tokens.fontWeightNormal,
|
|
147
|
-
lineHeight: tokens.lineHeightDefault,
|
|
148
|
-
whiteSpace: 'pre-wrap'
|
|
149
|
-
}),
|
|
150
|
-
helpText: /*#__PURE__*/css({
|
|
151
|
-
margin: `${tokens.spacingXs} 0`,
|
|
152
|
-
fontStyle: 'italic'
|
|
153
|
-
})
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const FieldWrapper = function (props) {
|
|
157
|
-
var _sdk$parameters, _sdk$parameters$insta, _sdk$contentType, _sdk$contentType$sys;
|
|
158
|
-
|
|
159
|
-
const {
|
|
160
|
-
ids
|
|
161
|
-
} = props.sdk;
|
|
162
|
-
|
|
163
|
-
const defaultGetEntryUrl = entry => `/spaces/${ids.space}/environments/${ids.environmentAlias || ids.environment}/entries/${entry.sys.id}`;
|
|
164
|
-
|
|
165
|
-
const {
|
|
166
|
-
name,
|
|
167
|
-
sdk,
|
|
168
|
-
className,
|
|
169
|
-
children,
|
|
170
|
-
renderHeading,
|
|
171
|
-
renderHelpText,
|
|
172
|
-
showFocusBar = true,
|
|
173
|
-
getEntryURL = defaultGetEntryUrl
|
|
174
|
-
} = props;
|
|
175
|
-
const {
|
|
176
|
-
field
|
|
177
|
-
} = sdk;
|
|
178
|
-
const helpText = ((_sdk$parameters = sdk.parameters) == null ? void 0 : (_sdk$parameters$insta = _sdk$parameters.instance) == null ? void 0 : _sdk$parameters$insta.helpText) ?? '';
|
|
179
|
-
const [hasErrors, setHasErrors] = useState(false);
|
|
180
|
-
useEffect(() => {
|
|
181
|
-
return field.onSchemaErrorsChanged(errors => {
|
|
182
|
-
setHasErrors((errors || []).length > 0);
|
|
183
|
-
});
|
|
184
|
-
}, [field]);
|
|
185
|
-
const fieldControlId = [field.id, field.locale, (_sdk$contentType = sdk.contentType) == null ? void 0 : (_sdk$contentType$sys = _sdk$contentType.sys) == null ? void 0 : _sdk$contentType$sys.id].filter(item => item).join('-');
|
|
186
|
-
return createElement(FormControl, {
|
|
187
|
-
id: fieldControlId,
|
|
188
|
-
testId: "entity-field-controls",
|
|
189
|
-
"data-test-id": "entity-field-controls",
|
|
190
|
-
className: cx(showFocusBar && styles.withFocusBar, className),
|
|
191
|
-
"aria-invalid": hasErrors,
|
|
192
|
-
isRequired: field.required
|
|
193
|
-
}, renderHeading ? renderHeading(name) : createElement(FormControl.Label, {
|
|
194
|
-
className: styles.label
|
|
195
|
-
}, name), children, createElement(ValidationErrors, {
|
|
196
|
-
field: field,
|
|
197
|
-
space: sdk.space,
|
|
198
|
-
locales: sdk.locales,
|
|
199
|
-
getEntryURL: getEntryURL || defaultGetEntryUrl
|
|
200
|
-
}), renderHelpText ? renderHelpText(helpText) : createElement(FormControl.HelpText, {
|
|
201
|
-
testId: "field-hint",
|
|
202
|
-
className: styles.helpText
|
|
203
|
-
}, helpText));
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
export { Field, FieldWrapper, getDefaultWidgetId };
|
|
207
|
-
//# sourceMappingURL=default-field-editors.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-field-editors.esm.js","sources":["../src/getDefaultWidgetId.ts","../src/Field.tsx","../src/FieldWrapper.styles.ts","../src/FieldWrapper.tsx"],"sourcesContent":["import type { FieldExtensionSDK } from '@contentful/field-editor-shared';\nimport { editorInterfaceDefaults } from 'contentful-management';\n\nimport type { WidgetType } from './types';\n\nexport function getDefaultWidgetId(\n sdk: Pick<FieldExtensionSDK, 'field' | 'contentType'>\n): WidgetType {\n const field = sdk.field;\n\n // @ts-expect-error FieldExtensionSDK.field doesn't include all the\n // properties of ContentFields type. It should be fixed\n return editorInterfaceDefaults.default.getDefaultControlOfField(field).widgetId;\n}\n","import * as React from 'react';\n\nimport { BooleanEditor } from '@contentful/field-editor-boolean';\nimport { RadioEditor } from '@contentful/field-editor-radio';\nimport { RatingEditor } from '@contentful/field-editor-rating';\nimport { CheckboxEditor } from '@contentful/field-editor-checkbox';\nimport { DateEditor } from '@contentful/field-editor-date';\nimport { DropdownEditor } from '@contentful/field-editor-dropdown';\nimport { JsonEditor } from '@contentful/field-editor-json';\nimport { ListEditor } from '@contentful/field-editor-list';\nimport { LocationEditor } from '@contentful/field-editor-location';\nimport { MarkdownEditor } from '@contentful/field-editor-markdown';\nimport { MultipleLineEditor } from '@contentful/field-editor-multiple-line';\nimport { NumberEditor } from '@contentful/field-editor-number';\nimport {\n SingleEntryReferenceEditor,\n MultipleEntryReferenceEditor,\n SingleMediaEditor,\n MultipleMediaEditor,\n} from '@contentful/field-editor-reference';\nimport { RichTextEditor } from '@contentful/field-editor-rich-text';\nimport type { FieldExtensionSDK } from '@contentful/field-editor-shared';\nimport { SingleLineEditor } from '@contentful/field-editor-single-line';\nimport { SlugEditor } from '@contentful/field-editor-slug';\nimport { TagsEditor } from '@contentful/field-editor-tags';\nimport { UrlEditor } from '@contentful/field-editor-url';\n\nimport { getDefaultWidgetId } from './getDefaultWidgetId';\nimport type { EditorOptions, WidgetType } from './types';\n\ntype FieldProps = {\n sdk: FieldExtensionSDK;\n widgetId?: WidgetType;\n isInitiallyDisabled?: boolean;\n renderFieldEditor?: (\n widgetId: WidgetType,\n sdk: FieldExtensionSDK,\n isInitiallyDisabled: boolean\n ) => JSX.Element | false;\n getOptions?: (widgetId: WidgetType, sdk: FieldExtensionSDK) => EditorOptions;\n};\n\nconst widgetComponents: Record<string, [React.ComponentType<any>, any?]> = {\n multipleLine: [MultipleLineEditor],\n boolean: [BooleanEditor],\n objectEditor: [JsonEditor],\n datePicker: [DateEditor],\n locationEditor: [LocationEditor],\n checkbox: [CheckboxEditor],\n listInput: [ListEditor],\n rating: [RatingEditor],\n radio: [RadioEditor],\n tagEditor: [TagsEditor],\n numberEditor: [NumberEditor],\n urlEditor: [UrlEditor],\n slugEditor: [SlugEditor],\n singleLine: [SingleLineEditor],\n dropdown: [DropdownEditor],\n entryLinkEditor: [SingleEntryReferenceEditor, { viewType: 'link', hasCardEditActions: true }],\n entryCardEditor: [SingleEntryReferenceEditor, { viewType: 'card', hasCardEditActions: true }],\n entryLinksEditor: [MultipleEntryReferenceEditor, { viewType: 'link', hasCardEditActions: true }],\n entryCardsEditor: [MultipleEntryReferenceEditor, { viewType: 'card', hasCardEditActions: true }],\n assetLinkEditor: [SingleMediaEditor, { viewType: 'link' }],\n assetLinksEditor: [MultipleMediaEditor, { viewType: 'link' }],\n assetGalleryEditor: [MultipleMediaEditor, { viewType: 'card' }],\n richTextEditor: [RichTextEditor],\n markdown: [MarkdownEditor],\n};\n\nexport const Field: React.FC<FieldProps> = (props: FieldProps) => {\n const {\n sdk,\n widgetId: possiblyUndefinedWidgetId,\n isInitiallyDisabled = false,\n renderFieldEditor,\n getOptions,\n } = props;\n const field = sdk.field;\n const locales = sdk.locales;\n\n const widgetId = possiblyUndefinedWidgetId ?? getDefaultWidgetId(sdk);\n\n if (renderFieldEditor) {\n const customEditor = renderFieldEditor(widgetId, sdk, isInitiallyDisabled);\n if (customEditor) {\n return customEditor;\n }\n }\n\n const options = getOptions ? getOptions(widgetId, sdk) : {};\n const referenceEditorParams =\n sdk.parameters && 'instance' in sdk.parameters\n ? sdk.parameters\n : {\n instance: {\n showCreateEntityAction: true,\n showLinkEntityAction: true,\n },\n };\n\n if (!widgetComponents[widgetId]) return null;\n\n const [WidgetComponent, widgetStaticProps] = widgetComponents[widgetId];\n\n const widgetComponentProps = {\n sdk,\n field,\n locales,\n isInitiallyDisabled,\n parameters: referenceEditorParams,\n ...widgetStaticProps,\n // @ts-expect-error\n ...options[widgetId],\n };\n\n const baseSdk = widgetId === 'slugEditor' ? sdk : undefined;\n\n return <WidgetComponent key={sdk.field.locale} {...widgetComponentProps} baseSdk={baseSdk} />;\n};\n","import tokens from '@contentful/f36-tokens';\nimport { css } from 'emotion';\n\nexport const styles = {\n withFocusBar: css({\n marginLeft: tokens.spacingL,\n marginRight: tokens.spacingL,\n marginBottom: '29px',\n marginTop: '19px',\n paddingLeft: tokens.spacingM,\n borderLeft: `3px solid ${tokens.gray300}`,\n transition: 'border-color 0.18s linear',\n '&:focus-within': {\n borderColor: tokens.colorPrimary,\n },\n '&[aria-invalid=\"true\"]': {\n borderLeftColor: tokens.red500,\n },\n }),\n label: css({\n display: 'flex',\n width: '100%',\n maxWidth: '800px',\n color: tokens.gray500,\n fontSize: tokens.fontSizeM,\n fontWeight: tokens.fontWeightNormal,\n lineHeight: tokens.lineHeightDefault,\n whiteSpace: 'pre-wrap',\n }),\n helpText: css({\n margin: `${tokens.spacingXs} 0`,\n fontStyle: 'italic',\n }),\n};\n","import * as React from 'react';\n\nimport { FormControl } from '@contentful/f36-components';\nimport type { FieldExtensionSDK, Entry } from '@contentful/field-editor-shared';\nimport { ValidationErrors } from '@contentful/field-editor-validation-errors';\nimport { cx } from 'emotion';\n\nimport { styles } from './FieldWrapper.styles';\n\ntype FieldWrapperProps = {\n name: string;\n sdk: FieldExtensionSDK;\n /**\n * Generates a link to another entry with the same value when a \"non unique\" validation error occurs\n */\n getEntryURL?: (entry: Entry) => string;\n className?: string;\n showFocusBar?: boolean;\n children: React.ReactNode;\n renderHeading?: (name: string) => JSX.Element | null;\n renderHelpText?: (helpText: string) => JSX.Element | null;\n};\n\nexport const FieldWrapper: React.FC<FieldWrapperProps> = function (props: FieldWrapperProps) {\n const { ids } = props.sdk;\n const defaultGetEntryUrl = (entry: Entry) =>\n `/spaces/${ids.space}/environments/${ids.environmentAlias || ids.environment}/entries/${\n entry.sys.id\n }`;\n const {\n name,\n sdk,\n className,\n children,\n renderHeading,\n renderHelpText,\n showFocusBar = true,\n getEntryURL = defaultGetEntryUrl,\n } = props;\n const { field } = sdk;\n const helpText = (sdk.parameters?.instance as any)?.helpText ?? '';\n\n const [hasErrors, setHasErrors] = React.useState(false);\n React.useEffect(() => {\n return field.onSchemaErrorsChanged((errors: unknown[]) => {\n setHasErrors((errors || []).length > 0);\n });\n }, [field]);\n\n const fieldControlId = [field.id, field.locale, sdk.contentType?.sys?.id]\n .filter((item) => item)\n .join('-');\n\n return (\n <FormControl\n id={fieldControlId}\n testId=\"entity-field-controls\"\n data-test-id=\"entity-field-controls\"\n className={cx(showFocusBar && styles.withFocusBar, className)}\n aria-invalid={hasErrors}\n isRequired={field.required}>\n {renderHeading ? (\n renderHeading(name)\n ) : (\n <FormControl.Label className={styles.label}>{name}</FormControl.Label>\n )}\n\n {children}\n\n <ValidationErrors\n field={field}\n space={sdk.space}\n locales={sdk.locales}\n getEntryURL={getEntryURL || defaultGetEntryUrl}\n />\n\n {renderHelpText ? (\n renderHelpText(helpText)\n ) : (\n <FormControl.HelpText testId=\"field-hint\" className={styles.helpText}>\n {helpText}\n </FormControl.HelpText>\n )}\n </FormControl>\n );\n};\n"],"names":["getDefaultWidgetId","sdk","field","editorInterfaceDefaults","default","getDefaultControlOfField","widgetId","widgetComponents","multipleLine","MultipleLineEditor","boolean","BooleanEditor","objectEditor","JsonEditor","datePicker","DateEditor","locationEditor","LocationEditor","checkbox","CheckboxEditor","listInput","ListEditor","rating","RatingEditor","radio","RadioEditor","tagEditor","TagsEditor","numberEditor","NumberEditor","urlEditor","UrlEditor","slugEditor","SlugEditor","singleLine","SingleLineEditor","dropdown","DropdownEditor","entryLinkEditor","SingleEntryReferenceEditor","viewType","hasCardEditActions","entryCardEditor","entryLinksEditor","MultipleEntryReferenceEditor","entryCardsEditor","assetLinkEditor","SingleMediaEditor","assetLinksEditor","MultipleMediaEditor","assetGalleryEditor","richTextEditor","RichTextEditor","markdown","MarkdownEditor","Field","props","possiblyUndefinedWidgetId","isInitiallyDisabled","renderFieldEditor","getOptions","locales","customEditor","options","referenceEditorParams","parameters","instance","showCreateEntityAction","showLinkEntityAction","WidgetComponent","widgetStaticProps","widgetComponentProps","baseSdk","undefined","React","key","locale","styles","withFocusBar","css","marginLeft","tokens","spacingL","marginRight","marginBottom","marginTop","paddingLeft","spacingM","borderLeft","gray300","transition","borderColor","colorPrimary","borderLeftColor","red500","label","display","width","maxWidth","color","gray500","fontSize","fontSizeM","fontWeight","fontWeightNormal","lineHeight","lineHeightDefault","whiteSpace","helpText","margin","spacingXs","fontStyle","FieldWrapper","ids","defaultGetEntryUrl","entry","space","environmentAlias","environment","sys","id","name","className","children","renderHeading","renderHelpText","showFocusBar","getEntryURL","hasErrors","setHasErrors","onSchemaErrorsChanged","errors","length","fieldControlId","contentType","filter","item","join","FormControl","testId","cx","isRequired","required","Label","ValidationErrors","HelpText"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;SAKgBA,mBACdC;AAEA,QAAMC,KAAK,GAAGD,GAAG,CAACC,KAAlB;AAGA;;AACA,SAAOC,uBAAuB,CAACC,OAAxB,CAAgCC,wBAAhC,CAAyDH,KAAzD,EAAgEI,QAAvE;AACD;;AC6BD,MAAMC,gBAAgB,GAAqD;AACzEC,EAAAA,YAAY,EAAE,CAACC,kBAAD,CAD2D;AAEzEC,EAAAA,OAAO,EAAE,CAACC,aAAD,CAFgE;AAGzEC,EAAAA,YAAY,EAAE,CAACC,UAAD,CAH2D;AAIzEC,EAAAA,UAAU,EAAE,CAACC,UAAD,CAJ6D;AAKzEC,EAAAA,cAAc,EAAE,CAACC,cAAD,CALyD;AAMzEC,EAAAA,QAAQ,EAAE,CAACC,cAAD,CAN+D;AAOzEC,EAAAA,SAAS,EAAE,CAACC,UAAD,CAP8D;AAQzEC,EAAAA,MAAM,EAAE,CAACC,YAAD,CARiE;AASzEC,EAAAA,KAAK,EAAE,CAACC,WAAD,CATkE;AAUzEC,EAAAA,SAAS,EAAE,CAACC,UAAD,CAV8D;AAWzEC,EAAAA,YAAY,EAAE,CAACC,YAAD,CAX2D;AAYzEC,EAAAA,SAAS,EAAE,CAACC,SAAD,CAZ8D;AAazEC,EAAAA,UAAU,EAAE,CAACC,UAAD,CAb6D;AAczEC,EAAAA,UAAU,EA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