@contentful/field-editor-single-line 1.5.4 → 1.6.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.
|
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "SingleLineEditor", {
|
|
|
8
8
|
return SingleLineEditor;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
11
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
12
|
const _f36components = require("@contentful/f36-components");
|
|
13
13
|
const _fieldeditorshared = require("@contentful/field-editor-shared");
|
|
14
|
-
const _styles = _interop_require_wildcard(require("./styles"));
|
|
14
|
+
const _styles = /*#__PURE__*/ _interop_require_wildcard(require("./styles"));
|
|
15
15
|
function _getRequireWildcardCache(nodeInterop) {
|
|
16
16
|
if (typeof WeakMap !== "function") return null;
|
|
17
17
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -57,7 +57,7 @@ function isSupportedFieldTypes(val) {
|
|
|
57
57
|
return val === 'Symbol' || val === 'Text';
|
|
58
58
|
}
|
|
59
59
|
function SingleLineEditor(props) {
|
|
60
|
-
const { field, isDisabled, isInitiallyDisabled = true, locales, onBlur, onFocus, withCharInformation = true, withCharValidation = true } = props;
|
|
60
|
+
const { field, isDisabled, isInitiallyDisabled = true, locales, onBlur, onFocus, withCharInformation = true, withCharValidation = true, id } = props;
|
|
61
61
|
if (!isSupportedFieldTypes(field.type)) {
|
|
62
62
|
throw new Error(`"${field.type}" field type is not supported by SingleLineEditor`);
|
|
63
63
|
}
|
|
@@ -73,6 +73,7 @@ function SingleLineEditor(props) {
|
|
|
73
73
|
return _react.createElement("div", {
|
|
74
74
|
"data-test-id": "single-line-editor"
|
|
75
75
|
}, _react.createElement(_f36components.TextInput, {
|
|
76
|
+
id: id,
|
|
76
77
|
className: direction === 'rtl' ? _styles.rightToLeft : '',
|
|
77
78
|
isRequired: field.required,
|
|
78
79
|
isInvalid: errors.length > 0,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
const _react = _interop_require_wildcard(require("react"));
|
|
5
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
6
6
|
const _fieldeditortestutils = require("@contentful/field-editor-test-utils");
|
|
7
7
|
const _react1 = require("@testing-library/react");
|
|
8
8
|
require("@testing-library/jest-dom/extend-expect");
|
package/dist/cjs/styles.js
CHANGED
|
@@ -16,7 +16,7 @@ _export(exports, {
|
|
|
16
16
|
return validationRow;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
|
|
19
|
+
const _f36tokens = /*#__PURE__*/ _interop_require_default(require("@contentful/f36-tokens"));
|
|
20
20
|
const _emotion = require("emotion");
|
|
21
21
|
function _interop_require_default(obj) {
|
|
22
22
|
return obj && obj.__esModule ? obj : {
|
|
@@ -6,7 +6,7 @@ function isSupportedFieldTypes(val) {
|
|
|
6
6
|
return val === 'Symbol' || val === 'Text';
|
|
7
7
|
}
|
|
8
8
|
export function SingleLineEditor(props) {
|
|
9
|
-
const { field, isDisabled, isInitiallyDisabled = true, locales, onBlur, onFocus, withCharInformation = true, withCharValidation = true } = props;
|
|
9
|
+
const { field, isDisabled, isInitiallyDisabled = true, locales, onBlur, onFocus, withCharInformation = true, withCharValidation = true, id } = props;
|
|
10
10
|
if (!isSupportedFieldTypes(field.type)) {
|
|
11
11
|
throw new Error(`"${field.type}" field type is not supported by SingleLineEditor`);
|
|
12
12
|
}
|
|
@@ -22,6 +22,7 @@ export function SingleLineEditor(props) {
|
|
|
22
22
|
return React.createElement("div", {
|
|
23
23
|
"data-test-id": "single-line-editor"
|
|
24
24
|
}, React.createElement(TextInput, {
|
|
25
|
+
id: id,
|
|
25
26
|
className: direction === 'rtl' ? styles.rightToLeft : '',
|
|
26
27
|
isRequired: field.required,
|
|
27
28
|
isInvalid: errors.length > 0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { FieldAPI, LocalesAPI } from '@contentful/field-editor-shared';
|
|
2
|
+
import { type FieldAPI, type LocalesAPI } from '@contentful/field-editor-shared';
|
|
3
3
|
export interface SingleLineEditorProps {
|
|
4
4
|
/**
|
|
5
5
|
* is the field disabled initially
|
|
@@ -33,5 +33,9 @@ export interface SingleLineEditorProps {
|
|
|
33
33
|
* focus event handler
|
|
34
34
|
*/
|
|
35
35
|
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
36
|
+
/**
|
|
37
|
+
* id used for associating the input field with its label
|
|
38
|
+
*/
|
|
39
|
+
id?: string;
|
|
36
40
|
}
|
|
37
41
|
export declare function SingleLineEditor(props: SingleLineEditorProps): React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-single-line",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@contentful/f36-components": "^4.70.0",
|
|
39
39
|
"@contentful/f36-tokens": "^4.0.5",
|
|
40
|
-
"@contentful/field-editor-shared": "^2.4.
|
|
40
|
+
"@contentful/field-editor-shared": "^2.4.1",
|
|
41
41
|
"emotion": "^10.0.17",
|
|
42
42
|
"lodash": "^4.17.15"
|
|
43
43
|
},
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"registry": "https://npm.pkg.github.com/"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "7ec565308c8d4da384b8fec6f5d840bdf6d4927d"
|
|
54
54
|
}
|