@contentful/field-editor-checkbox 1.4.4 → 1.4.6
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.
|
@@ -41,7 +41,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
41
41
|
if (cache && cache.has(obj)) {
|
|
42
42
|
return cache.get(obj);
|
|
43
43
|
}
|
|
44
|
-
var newObj = {
|
|
44
|
+
var newObj = {
|
|
45
|
+
__proto__: null
|
|
46
|
+
};
|
|
45
47
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
46
48
|
for(var key in obj){
|
|
47
49
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -99,7 +101,7 @@ const getInvalidValues = (field, values, options)=>{
|
|
|
99
101
|
};
|
|
100
102
|
function CheckboxEditor(props) {
|
|
101
103
|
const [id] = (0, _react.useState)(()=>(0, _nanoid.nanoid)(6));
|
|
102
|
-
const { field
|
|
104
|
+
const { field, locales } = props;
|
|
103
105
|
const options = getOptions(field, id);
|
|
104
106
|
const misconfigured = options.length === 0;
|
|
105
107
|
if (misconfigured) {
|
|
@@ -111,7 +113,7 @@ function CheckboxEditor(props) {
|
|
|
111
113
|
isEmptyValue: isEmptyListValue,
|
|
112
114
|
field: field,
|
|
113
115
|
isInitiallyDisabled: props.isInitiallyDisabled
|
|
114
|
-
}, ({ disabled
|
|
116
|
+
}, ({ disabled, value, setValue })=>{
|
|
115
117
|
const values = value || [];
|
|
116
118
|
const addValue = (value)=>{
|
|
117
119
|
const newValues = [
|
|
@@ -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)) {
|
|
@@ -62,7 +64,7 @@ describe('CheckboxEditor', ()=>{
|
|
|
62
64
|
}
|
|
63
65
|
};
|
|
64
66
|
});
|
|
65
|
-
const { getByTestId
|
|
67
|
+
const { getByTestId, queryByTestId } = (0, _react1.render)(_react.createElement(_CheckboxEditor.CheckboxEditor, {
|
|
66
68
|
field: field,
|
|
67
69
|
locales: (0, _fieldeditortestutils.createFakeLocalesAPI)(),
|
|
68
70
|
isInitiallyDisabled: false
|
|
@@ -90,7 +92,7 @@ describe('CheckboxEditor', ()=>{
|
|
|
90
92
|
}
|
|
91
93
|
};
|
|
92
94
|
});
|
|
93
|
-
const { container
|
|
95
|
+
const { container } = (0, _react1.render)(_react.createElement(_CheckboxEditor.CheckboxEditor, {
|
|
94
96
|
field: field,
|
|
95
97
|
locales: (0, _fieldeditortestutils.createFakeLocalesAPI)(),
|
|
96
98
|
isInitiallyDisabled: false
|
|
@@ -123,7 +125,7 @@ describe('CheckboxEditor', ()=>{
|
|
|
123
125
|
}
|
|
124
126
|
};
|
|
125
127
|
});
|
|
126
|
-
const { container
|
|
128
|
+
const { container } = (0, _react1.render)(_react.createElement(_CheckboxEditor.CheckboxEditor, {
|
|
127
129
|
field: field,
|
|
128
130
|
locales: (0, _fieldeditortestutils.createFakeLocalesAPI)(),
|
|
129
131
|
isInitiallyDisabled: false
|
|
@@ -177,7 +179,7 @@ describe('CheckboxEditor', ()=>{
|
|
|
177
179
|
field.setValue([
|
|
178
180
|
'mango'
|
|
179
181
|
]);
|
|
180
|
-
const { getByTestId
|
|
182
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_CheckboxEditor.CheckboxEditor, {
|
|
181
183
|
field: field,
|
|
182
184
|
locales: (0, _fieldeditortestutils.createFakeLocalesAPI)(),
|
|
183
185
|
isInitiallyDisabled: false
|
|
@@ -208,7 +210,7 @@ describe('CheckboxEditor', ()=>{
|
|
|
208
210
|
};
|
|
209
211
|
});
|
|
210
212
|
const locales = (0, _fieldeditortestutils.createFakeLocalesAPI)();
|
|
211
|
-
const { findAllByTestId
|
|
213
|
+
const { findAllByTestId } = (0, _react1.render)(_react.createElement("div", null, _react.createElement(_CheckboxEditor.CheckboxEditor, {
|
|
212
214
|
field: field,
|
|
213
215
|
locales: locales,
|
|
214
216
|
isInitiallyDisabled: false
|
package/dist/cjs/styles.js
CHANGED
|
@@ -12,14 +12,14 @@ _export(exports, {
|
|
|
12
12
|
form: function() {
|
|
13
13
|
return form;
|
|
14
14
|
},
|
|
15
|
-
rightToLeft: function() {
|
|
16
|
-
return rightToLeft;
|
|
17
|
-
},
|
|
18
15
|
invalidText: function() {
|
|
19
16
|
return invalidText;
|
|
20
17
|
},
|
|
21
18
|
removeBtn: function() {
|
|
22
19
|
return removeBtn;
|
|
20
|
+
},
|
|
21
|
+
rightToLeft: function() {
|
|
22
|
+
return rightToLeft;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
const _f36tokens = _interop_require_default(require("@contentful/f36-tokens"));
|
|
@@ -47,7 +47,7 @@ const getInvalidValues = (field, values, options)=>{
|
|
|
47
47
|
};
|
|
48
48
|
export function CheckboxEditor(props) {
|
|
49
49
|
const [id] = useState(()=>nanoid(6));
|
|
50
|
-
const { field
|
|
50
|
+
const { field, locales } = props;
|
|
51
51
|
const options = getOptions(field, id);
|
|
52
52
|
const misconfigured = options.length === 0;
|
|
53
53
|
if (misconfigured) {
|
|
@@ -59,7 +59,7 @@ export function CheckboxEditor(props) {
|
|
|
59
59
|
isEmptyValue: isEmptyListValue,
|
|
60
60
|
field: field,
|
|
61
61
|
isInitiallyDisabled: props.isInitiallyDisabled
|
|
62
|
-
}, ({ disabled
|
|
62
|
+
}, ({ disabled, value, setValue })=>{
|
|
63
63
|
const values = value || [];
|
|
64
64
|
const addValue = (value)=>{
|
|
65
65
|
const newValues = [
|
|
@@ -19,7 +19,7 @@ describe('CheckboxEditor', ()=>{
|
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
});
|
|
22
|
-
const { getByTestId
|
|
22
|
+
const { getByTestId, queryByTestId } = render(React.createElement(CheckboxEditor, {
|
|
23
23
|
field: field,
|
|
24
24
|
locales: createFakeLocalesAPI(),
|
|
25
25
|
isInitiallyDisabled: false
|
|
@@ -47,7 +47,7 @@ describe('CheckboxEditor', ()=>{
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
});
|
|
50
|
-
const { container
|
|
50
|
+
const { container } = render(React.createElement(CheckboxEditor, {
|
|
51
51
|
field: field,
|
|
52
52
|
locales: createFakeLocalesAPI(),
|
|
53
53
|
isInitiallyDisabled: false
|
|
@@ -80,7 +80,7 @@ describe('CheckboxEditor', ()=>{
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
});
|
|
83
|
-
const { container
|
|
83
|
+
const { container } = render(React.createElement(CheckboxEditor, {
|
|
84
84
|
field: field,
|
|
85
85
|
locales: createFakeLocalesAPI(),
|
|
86
86
|
isInitiallyDisabled: false
|
|
@@ -134,7 +134,7 @@ describe('CheckboxEditor', ()=>{
|
|
|
134
134
|
field.setValue([
|
|
135
135
|
'mango'
|
|
136
136
|
]);
|
|
137
|
-
const { getByTestId
|
|
137
|
+
const { getByTestId } = render(React.createElement(CheckboxEditor, {
|
|
138
138
|
field: field,
|
|
139
139
|
locales: createFakeLocalesAPI(),
|
|
140
140
|
isInitiallyDisabled: false
|
|
@@ -165,7 +165,7 @@ describe('CheckboxEditor', ()=>{
|
|
|
165
165
|
};
|
|
166
166
|
});
|
|
167
167
|
const locales = createFakeLocalesAPI();
|
|
168
|
-
const { findAllByTestId
|
|
168
|
+
const { findAllByTestId } = render(React.createElement("div", null, React.createElement(CheckboxEditor, {
|
|
169
169
|
field: field,
|
|
170
170
|
locales: locales,
|
|
171
171
|
isInitiallyDisabled: false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-checkbox",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.6",
|
|
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.3.23",
|
|
39
39
|
"@contentful/f36-tokens": "^4.0.0",
|
|
40
|
-
"@contentful/field-editor-shared": "^1.4.
|
|
40
|
+
"@contentful/field-editor-shared": "^1.4.6",
|
|
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.7"
|
|
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": "894934e9a2888aeb0a894cfebea3e034ba830f2a"
|
|
54
54
|
}
|