@contentful/field-editor-slug 1.5.19 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/SlugEditor.js
CHANGED
|
@@ -56,7 +56,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
56
56
|
function isSupportedFieldTypes(val) {
|
|
57
57
|
return val === 'Symbol';
|
|
58
58
|
}
|
|
59
|
-
function FieldConnectorCallback({ Component, value, disabled, setValue, errors, titleValue, isOptionalLocaleWithFallback, locale, createdAt, performUniqueCheck }) {
|
|
59
|
+
function FieldConnectorCallback({ Component, value, disabled, setValue, errors, titleValue, isOptionalLocaleWithFallback, locale, createdAt, performUniqueCheck, id }) {
|
|
60
60
|
const safeSetValue = _react.useCallback(async (...args)=>{
|
|
61
61
|
try {
|
|
62
62
|
await setValue(...args);
|
|
@@ -75,11 +75,12 @@ function FieldConnectorCallback({ Component, value, disabled, setValue, errors,
|
|
|
75
75
|
isOptionalLocaleWithFallback: isOptionalLocaleWithFallback,
|
|
76
76
|
isDisabled: disabled,
|
|
77
77
|
titleValue: titleValue,
|
|
78
|
-
setValue: safeSetValue
|
|
78
|
+
setValue: safeSetValue,
|
|
79
|
+
id: id
|
|
79
80
|
}));
|
|
80
81
|
}
|
|
81
82
|
function SlugEditor(props) {
|
|
82
|
-
const { field, parameters } = props;
|
|
83
|
+
const { field, parameters, id } = props;
|
|
83
84
|
const { locales, entry, space } = props.baseSdk;
|
|
84
85
|
if (!isSupportedFieldTypes(field.type)) {
|
|
85
86
|
throw new Error(`"${field.type}" field type is not supported by SlugEditor`);
|
|
@@ -132,7 +133,8 @@ function SlugEditor(props) {
|
|
|
132
133
|
createdAt: entrySys.createdAt,
|
|
133
134
|
locale: field.locale,
|
|
134
135
|
performUniqueCheck: performUniqueCheck,
|
|
135
|
-
key: `slug-editor-${externalReset}
|
|
136
|
+
key: `slug-editor-${externalReset}`,
|
|
137
|
+
id: id
|
|
136
138
|
});
|
|
137
139
|
}));
|
|
138
140
|
}
|
|
@@ -109,7 +109,7 @@ function useUniqueChecker(props) {
|
|
|
109
109
|
return status;
|
|
110
110
|
}
|
|
111
111
|
function SlugEditorFieldStatic(props) {
|
|
112
|
-
const { hasError, isDisabled, value, setValue, onChange, onBlur } = props;
|
|
112
|
+
const { hasError, isDisabled, value, setValue, onChange, onBlur, id } = props;
|
|
113
113
|
const status = useUniqueChecker(props);
|
|
114
114
|
return _react.createElement("div", {
|
|
115
115
|
className: _styles.inputContainer
|
|
@@ -120,6 +120,7 @@ function SlugEditorFieldStatic(props) {
|
|
|
120
120
|
isInvalid: hasError || status === 'duplicate',
|
|
121
121
|
isDisabled: isDisabled,
|
|
122
122
|
value: value || '',
|
|
123
|
+
id: id,
|
|
123
124
|
onChange: (e)=>{
|
|
124
125
|
setValue(e.target.value);
|
|
125
126
|
if (onChange) {
|
package/dist/esm/SlugEditor.js
CHANGED
|
@@ -5,7 +5,7 @@ import { TrackingFieldConnector } from './TrackingFieldConnector';
|
|
|
5
5
|
function isSupportedFieldTypes(val) {
|
|
6
6
|
return val === 'Symbol';
|
|
7
7
|
}
|
|
8
|
-
function FieldConnectorCallback({ Component, value, disabled, setValue, errors, titleValue, isOptionalLocaleWithFallback, locale, createdAt, performUniqueCheck }) {
|
|
8
|
+
function FieldConnectorCallback({ Component, value, disabled, setValue, errors, titleValue, isOptionalLocaleWithFallback, locale, createdAt, performUniqueCheck, id }) {
|
|
9
9
|
const safeSetValue = React.useCallback(async (...args)=>{
|
|
10
10
|
try {
|
|
11
11
|
await setValue(...args);
|
|
@@ -24,11 +24,12 @@ function FieldConnectorCallback({ Component, value, disabled, setValue, errors,
|
|
|
24
24
|
isOptionalLocaleWithFallback: isOptionalLocaleWithFallback,
|
|
25
25
|
isDisabled: disabled,
|
|
26
26
|
titleValue: titleValue,
|
|
27
|
-
setValue: safeSetValue
|
|
27
|
+
setValue: safeSetValue,
|
|
28
|
+
id: id
|
|
28
29
|
}));
|
|
29
30
|
}
|
|
30
31
|
export function SlugEditor(props) {
|
|
31
|
-
const { field, parameters } = props;
|
|
32
|
+
const { field, parameters, id } = props;
|
|
32
33
|
const { locales, entry, space } = props.baseSdk;
|
|
33
34
|
if (!isSupportedFieldTypes(field.type)) {
|
|
34
35
|
throw new Error(`"${field.type}" field type is not supported by SlugEditor`);
|
|
@@ -81,7 +82,8 @@ export function SlugEditor(props) {
|
|
|
81
82
|
createdAt: entrySys.createdAt,
|
|
82
83
|
locale: field.locale,
|
|
83
84
|
performUniqueCheck: performUniqueCheck,
|
|
84
|
-
key: `slug-editor-${externalReset}
|
|
85
|
+
key: `slug-editor-${externalReset}`,
|
|
86
|
+
id: id
|
|
85
87
|
});
|
|
86
88
|
}));
|
|
87
89
|
}
|
|
@@ -50,7 +50,7 @@ function useUniqueChecker(props) {
|
|
|
50
50
|
return status;
|
|
51
51
|
}
|
|
52
52
|
export function SlugEditorFieldStatic(props) {
|
|
53
|
-
const { hasError, isDisabled, value, setValue, onChange, onBlur } = props;
|
|
53
|
+
const { hasError, isDisabled, value, setValue, onChange, onBlur, id } = props;
|
|
54
54
|
const status = useUniqueChecker(props);
|
|
55
55
|
return React.createElement("div", {
|
|
56
56
|
className: styles.inputContainer
|
|
@@ -61,6 +61,7 @@ export function SlugEditorFieldStatic(props) {
|
|
|
61
61
|
isInvalid: hasError || status === 'duplicate',
|
|
62
62
|
isDisabled: isDisabled,
|
|
63
63
|
value: value || '',
|
|
64
|
+
id: id,
|
|
64
65
|
onChange: (e)=>{
|
|
65
66
|
setValue(e.target.value);
|
|
66
67
|
if (onChange) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { FieldAppSDK, FieldAPI } from '@contentful/app-sdk';
|
|
2
|
+
import type { FieldAppSDK, FieldAPI } from '@contentful/app-sdk';
|
|
3
3
|
export interface SlugEditorProps {
|
|
4
4
|
/**
|
|
5
5
|
* is the field disabled initially
|
|
@@ -10,6 +10,10 @@ export interface SlugEditorProps {
|
|
|
10
10
|
* sdk.field
|
|
11
11
|
*/
|
|
12
12
|
field: FieldAPI;
|
|
13
|
+
/**
|
|
14
|
+
* id used for associating the input field with its label
|
|
15
|
+
*/
|
|
16
|
+
id?: string;
|
|
13
17
|
parameters?: {
|
|
14
18
|
instance: {
|
|
15
19
|
trackingFieldId?: string;
|
|
@@ -9,6 +9,7 @@ interface SlugEditorFieldProps {
|
|
|
9
9
|
createdAt: string;
|
|
10
10
|
setValue: (value: string | null | undefined) => void;
|
|
11
11
|
performUniqueCheck: (value: string) => Promise<boolean>;
|
|
12
|
+
id?: string;
|
|
12
13
|
}
|
|
13
14
|
export declare function SlugEditorFieldStatic(props: SlugEditorFieldProps & {
|
|
14
15
|
onChange?: Function;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-slug",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@contentful/f36-components": "^4.70.0",
|
|
39
39
|
"@contentful/f36-icons": "^4.29.0",
|
|
40
40
|
"@contentful/f36-tokens": "^4.0.5",
|
|
41
|
-
"@contentful/field-editor-shared": "^2.4.
|
|
41
|
+
"@contentful/field-editor-shared": "^2.4.2",
|
|
42
42
|
"@types/speakingurl": "^13.0.2",
|
|
43
43
|
"emotion": "^10.0.17",
|
|
44
44
|
"lodash": "^4.17.15",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"registry": "https://npm.pkg.github.com/"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "6bee4a59a3c19a95d2cadde3ef0c78112788626e"
|
|
60
60
|
}
|