@contentful/field-editor-single-line 1.3.6 → 1.3.7
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.
|
@@ -33,7 +33,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
33
33
|
if (cache && cache.has(obj)) {
|
|
34
34
|
return cache.get(obj);
|
|
35
35
|
}
|
|
36
|
-
var newObj = {
|
|
36
|
+
var newObj = {
|
|
37
|
+
__proto__: null
|
|
38
|
+
};
|
|
37
39
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
38
40
|
for(var key in obj){
|
|
39
41
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -55,7 +57,7 @@ function isSupportedFieldTypes(val) {
|
|
|
55
57
|
return val === 'Symbol' || val === 'Text';
|
|
56
58
|
}
|
|
57
59
|
function SingleLineEditor(props) {
|
|
58
|
-
const { field
|
|
60
|
+
const { field, locales } = props;
|
|
59
61
|
if (!isSupportedFieldTypes(field.type)) {
|
|
60
62
|
throw new Error(`"${field.type}" field type is not supported by SingleLineEditor`);
|
|
61
63
|
}
|
|
@@ -66,7 +68,7 @@ function SingleLineEditor(props) {
|
|
|
66
68
|
field: field,
|
|
67
69
|
isInitiallyDisabled: props.isInitiallyDisabled,
|
|
68
70
|
isDisabled: props.isDisabled
|
|
69
|
-
}, ({ value
|
|
71
|
+
}, ({ value, errors, disabled, setValue })=>{
|
|
70
72
|
return _react.createElement("div", {
|
|
71
73
|
"data-test-id": "single-line-editor"
|
|
72
74
|
}, _react.createElement(_f36components.TextInput, {
|
|
@@ -28,7 +28,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
28
28
|
if (cache && cache.has(obj)) {
|
|
29
29
|
return cache.get(obj);
|
|
30
30
|
}
|
|
31
|
-
var newObj = {
|
|
31
|
+
var newObj = {
|
|
32
|
+
__proto__: null
|
|
33
|
+
};
|
|
32
34
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
33
35
|
for(var key in obj){
|
|
34
36
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -76,7 +78,7 @@ describe('SingleLineEditor', ()=>{
|
|
|
76
78
|
}
|
|
77
79
|
};
|
|
78
80
|
});
|
|
79
|
-
const { getByTestId
|
|
81
|
+
const { getByTestId, getByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
|
|
80
82
|
field: field,
|
|
81
83
|
isInitiallyDisabled: false,
|
|
82
84
|
locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
|
|
@@ -95,7 +97,7 @@ describe('SingleLineEditor', ()=>{
|
|
|
95
97
|
type: 'Symbol'
|
|
96
98
|
};
|
|
97
99
|
});
|
|
98
|
-
const { getByTestId
|
|
100
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
|
|
99
101
|
field: field,
|
|
100
102
|
isInitiallyDisabled: false,
|
|
101
103
|
locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
|
|
@@ -131,7 +133,7 @@ describe('SingleLineEditor', ()=>{
|
|
|
131
133
|
id: 'field-id'
|
|
132
134
|
};
|
|
133
135
|
});
|
|
134
|
-
const { getByText
|
|
136
|
+
const { getByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
|
|
135
137
|
field: field,
|
|
136
138
|
isInitiallyDisabled: false,
|
|
137
139
|
locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
|
|
@@ -147,7 +149,7 @@ describe('SingleLineEditor', ()=>{
|
|
|
147
149
|
id: 'field-id'
|
|
148
150
|
};
|
|
149
151
|
});
|
|
150
|
-
const { getByText
|
|
152
|
+
const { getByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
|
|
151
153
|
field: field,
|
|
152
154
|
isInitiallyDisabled: false,
|
|
153
155
|
locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
|
|
@@ -171,7 +173,7 @@ describe('SingleLineEditor', ()=>{
|
|
|
171
173
|
id: 'field-id'
|
|
172
174
|
};
|
|
173
175
|
});
|
|
174
|
-
const { getByText
|
|
176
|
+
const { getByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
|
|
175
177
|
field: field,
|
|
176
178
|
isInitiallyDisabled: false,
|
|
177
179
|
locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
|
|
@@ -194,7 +196,7 @@ describe('SingleLineEditor', ()=>{
|
|
|
194
196
|
id: 'field-id'
|
|
195
197
|
};
|
|
196
198
|
});
|
|
197
|
-
const { getByText
|
|
199
|
+
const { getByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
|
|
198
200
|
field: field,
|
|
199
201
|
isInitiallyDisabled: false,
|
|
200
202
|
locales: (0, _fieldeditortestutils.createFakeLocalesAPI)()
|
|
@@ -218,7 +220,7 @@ describe('SingleLineEditor', ()=>{
|
|
|
218
220
|
id: 'field-id'
|
|
219
221
|
};
|
|
220
222
|
});
|
|
221
|
-
const { getByText
|
|
223
|
+
const { getByText, queryByText } = (0, _react1.render)(_react.createElement(_SingleLineEditor.SingleLineEditor, {
|
|
222
224
|
field: field,
|
|
223
225
|
withCharValidation: false,
|
|
224
226
|
isInitiallyDisabled: false,
|
package/dist/cjs/styles.js
CHANGED
|
@@ -9,11 +9,11 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
validationRow: function() {
|
|
13
|
-
return validationRow;
|
|
14
|
-
},
|
|
15
12
|
rightToLeft: function() {
|
|
16
13
|
return rightToLeft;
|
|
14
|
+
},
|
|
15
|
+
validationRow: function() {
|
|
16
|
+
return validationRow;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
|
|
@@ -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
|
|
9
|
+
const { field, locales } = props;
|
|
10
10
|
if (!isSupportedFieldTypes(field.type)) {
|
|
11
11
|
throw new Error(`"${field.type}" field type is not supported by SingleLineEditor`);
|
|
12
12
|
}
|
|
@@ -17,7 +17,7 @@ export function SingleLineEditor(props) {
|
|
|
17
17
|
field: field,
|
|
18
18
|
isInitiallyDisabled: props.isInitiallyDisabled,
|
|
19
19
|
isDisabled: props.isDisabled
|
|
20
|
-
}, ({ value
|
|
20
|
+
}, ({ value, errors, disabled, setValue })=>{
|
|
21
21
|
return React.createElement("div", {
|
|
22
22
|
"data-test-id": "single-line-editor"
|
|
23
23
|
}, React.createElement(TextInput, {
|
|
@@ -33,7 +33,7 @@ describe('SingleLineEditor', ()=>{
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
});
|
|
36
|
-
const { getByTestId
|
|
36
|
+
const { getByTestId, getByText } = render(React.createElement(SingleLineEditor, {
|
|
37
37
|
field: field,
|
|
38
38
|
isInitiallyDisabled: false,
|
|
39
39
|
locales: createFakeLocalesAPI()
|
|
@@ -52,7 +52,7 @@ describe('SingleLineEditor', ()=>{
|
|
|
52
52
|
type: 'Symbol'
|
|
53
53
|
};
|
|
54
54
|
});
|
|
55
|
-
const { getByTestId
|
|
55
|
+
const { getByTestId } = render(React.createElement(SingleLineEditor, {
|
|
56
56
|
field: field,
|
|
57
57
|
isInitiallyDisabled: false,
|
|
58
58
|
locales: createFakeLocalesAPI()
|
|
@@ -88,7 +88,7 @@ describe('SingleLineEditor', ()=>{
|
|
|
88
88
|
id: 'field-id'
|
|
89
89
|
};
|
|
90
90
|
});
|
|
91
|
-
const { getByText
|
|
91
|
+
const { getByText } = render(React.createElement(SingleLineEditor, {
|
|
92
92
|
field: field,
|
|
93
93
|
isInitiallyDisabled: false,
|
|
94
94
|
locales: createFakeLocalesAPI()
|
|
@@ -104,7 +104,7 @@ describe('SingleLineEditor', ()=>{
|
|
|
104
104
|
id: 'field-id'
|
|
105
105
|
};
|
|
106
106
|
});
|
|
107
|
-
const { getByText
|
|
107
|
+
const { getByText } = render(React.createElement(SingleLineEditor, {
|
|
108
108
|
field: field,
|
|
109
109
|
isInitiallyDisabled: false,
|
|
110
110
|
locales: createFakeLocalesAPI()
|
|
@@ -128,7 +128,7 @@ describe('SingleLineEditor', ()=>{
|
|
|
128
128
|
id: 'field-id'
|
|
129
129
|
};
|
|
130
130
|
});
|
|
131
|
-
const { getByText
|
|
131
|
+
const { getByText } = render(React.createElement(SingleLineEditor, {
|
|
132
132
|
field: field,
|
|
133
133
|
isInitiallyDisabled: false,
|
|
134
134
|
locales: createFakeLocalesAPI()
|
|
@@ -151,7 +151,7 @@ describe('SingleLineEditor', ()=>{
|
|
|
151
151
|
id: 'field-id'
|
|
152
152
|
};
|
|
153
153
|
});
|
|
154
|
-
const { getByText
|
|
154
|
+
const { getByText } = render(React.createElement(SingleLineEditor, {
|
|
155
155
|
field: field,
|
|
156
156
|
isInitiallyDisabled: false,
|
|
157
157
|
locales: createFakeLocalesAPI()
|
|
@@ -175,7 +175,7 @@ describe('SingleLineEditor', ()=>{
|
|
|
175
175
|
id: 'field-id'
|
|
176
176
|
};
|
|
177
177
|
});
|
|
178
|
-
const { getByText
|
|
178
|
+
const { getByText, queryByText } = render(React.createElement(SingleLineEditor, {
|
|
179
179
|
field: field,
|
|
180
180
|
withCharValidation: false,
|
|
181
181
|
isInitiallyDisabled: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-single-line",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.7",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@contentful/f36-components": "^4.0.27",
|
|
39
39
|
"@contentful/f36-tokens": "^4.0.0",
|
|
40
|
-
"@contentful/field-editor-shared": "^1.4.
|
|
40
|
+
"@contentful/field-editor-shared": "^1.4.5",
|
|
41
41
|
"emotion": "^10.0.17",
|
|
42
42
|
"lodash": "^4.17.15"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@contentful/field-editor-test-utils": "^1.4.
|
|
45
|
+
"@contentful/field-editor-test-utils": "^1.4.6"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": ">=16.8.0"
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"registry": "https://npm.pkg.github.com/"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "142d2039f023bf4ced956aae1dd08b27c35fdbaa"
|
|
54
54
|
}
|