@contentful/field-editor-json 4.4.3-canary.28 → 4.4.3-canary.32
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/JsonEditor.js +6 -6
- package/dist/cjs/JsonEditorField.js +2 -2
- package/dist/cjs/JsonEditorToolbar.js +6 -6
- package/dist/cjs/JsonInvalidStatus.js +2 -2
- package/dist/cjs/utils.js +5 -5
- package/dist/esm/JsonEditor.js +6 -6
- package/dist/esm/JsonEditorField.js +2 -2
- package/dist/esm/JsonEditorToolbar.js +6 -6
- package/dist/esm/JsonInvalidStatus.js +2 -2
- package/package.json +4 -4
package/dist/cjs/JsonEditor.js
CHANGED
|
@@ -151,24 +151,24 @@ function ConnectedJsonEditor({ initialValue, setValue, disabled }) {
|
|
|
151
151
|
]
|
|
152
152
|
}));
|
|
153
153
|
}, []);
|
|
154
|
-
return
|
|
154
|
+
return _react.createElement("div", {
|
|
155
155
|
"data-test-id": "json-editor"
|
|
156
|
-
},
|
|
156
|
+
}, _react.createElement(_JsonEditorToolbar.JsonEditorToolbar, {
|
|
157
157
|
isRedoDisabled: disabled || state.redoStack.length === 0,
|
|
158
158
|
isUndoDisabled: disabled || state.undoStack.length === 0,
|
|
159
159
|
onUndo: onUndo,
|
|
160
160
|
onRedo: onRedo
|
|
161
|
-
}),
|
|
161
|
+
}), _react.createElement(_JsonEditorField.JsonEditorField, {
|
|
162
162
|
value: state.value,
|
|
163
163
|
onChange: onChange,
|
|
164
164
|
isDisabled: disabled
|
|
165
|
-
}), !state.isValidJson &&
|
|
165
|
+
}), !state.isValidJson && _react.createElement(_JsonInvalidStatus.JsonInvalidStatus, null));
|
|
166
166
|
}
|
|
167
167
|
function JsonEditor(props) {
|
|
168
|
-
return
|
|
168
|
+
return _react.createElement(_fieldeditorshared.FieldConnector, {
|
|
169
169
|
field: props.field,
|
|
170
170
|
isInitiallyDisabled: props.isInitiallyDisabled
|
|
171
|
-
}, ({ value, disabled, setValue, externalReset })
|
|
171
|
+
}, ({ value, disabled, setValue, externalReset })=>_react.createElement(ConnectedJsonEditor, {
|
|
172
172
|
key: `json-editor-${externalReset}`,
|
|
173
173
|
initialValue: value,
|
|
174
174
|
disabled: disabled,
|
|
@@ -101,12 +101,12 @@ const styles = {
|
|
|
101
101
|
})
|
|
102
102
|
};
|
|
103
103
|
function JsonEditorField(props) {
|
|
104
|
-
return
|
|
104
|
+
return _react.createElement("div", {
|
|
105
105
|
className: (0, _css.cx)(styles.root, {
|
|
106
106
|
disabled: props.isDisabled
|
|
107
107
|
}),
|
|
108
108
|
"data-test-id": "json-editor-code-mirror"
|
|
109
|
-
},
|
|
109
|
+
}, _react.createElement(_reactcodemirror.default, {
|
|
110
110
|
value: props.value,
|
|
111
111
|
onChange: props.onChange,
|
|
112
112
|
theme: "light",
|
|
@@ -77,14 +77,14 @@ const styles = {
|
|
|
77
77
|
})
|
|
78
78
|
};
|
|
79
79
|
function JsonEditorToolbar(props) {
|
|
80
|
-
return
|
|
80
|
+
return _react.createElement("div", {
|
|
81
81
|
className: styles.toolbar
|
|
82
|
-
},
|
|
82
|
+
}, _react.createElement(_f36components.Flex, {
|
|
83
83
|
alignItems: "center"
|
|
84
|
-
},
|
|
84
|
+
}, _react.createElement(_f36components.Button, {
|
|
85
85
|
className: styles.arrowButton,
|
|
86
86
|
variant: "transparent",
|
|
87
|
-
startIcon:
|
|
87
|
+
startIcon: _react.createElement(_f36icons.ArrowUUpLeftIcon, {
|
|
88
88
|
size: "small"
|
|
89
89
|
}),
|
|
90
90
|
size: "small",
|
|
@@ -93,11 +93,11 @@ function JsonEditorToolbar(props) {
|
|
|
93
93
|
onClick: ()=>{
|
|
94
94
|
props.onUndo();
|
|
95
95
|
}
|
|
96
|
-
}, "Undo"),
|
|
96
|
+
}, "Undo"), _react.createElement(_f36components.Button, {
|
|
97
97
|
className: styles.arrowButton,
|
|
98
98
|
variant: "transparent",
|
|
99
99
|
size: "small",
|
|
100
|
-
startIcon:
|
|
100
|
+
startIcon: _react.createElement(_f36icons.ArrowUUpRightIcon, {
|
|
101
101
|
size: "small"
|
|
102
102
|
}),
|
|
103
103
|
isDisabled: props.isRedoDisabled,
|
|
@@ -60,13 +60,13 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
60
60
|
return newObj;
|
|
61
61
|
}
|
|
62
62
|
function JsonInvalidStatus() {
|
|
63
|
-
return
|
|
63
|
+
return _react.createElement("div", {
|
|
64
64
|
role: "status",
|
|
65
65
|
"data-test-id": "json-editor.invalid-json",
|
|
66
66
|
className: (0, _css.css)({
|
|
67
67
|
marginTop: _f36tokens.default.spacingS
|
|
68
68
|
})
|
|
69
|
-
},
|
|
69
|
+
}, _react.createElement(_f36components.ValidationMessage, null, _core.i18n._({
|
|
70
70
|
id: "FieldEditors.Json.JsonInvalidStatus.InvalidJsonMessage",
|
|
71
71
|
message: "This is not valid JSON"
|
|
72
72
|
})));
|
package/dist/cjs/utils.js
CHANGED
|
@@ -5,20 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
SPACE_INDENT_COUNT
|
|
12
|
+
get SPACE_INDENT_COUNT () {
|
|
13
13
|
return SPACE_INDENT_COUNT;
|
|
14
14
|
},
|
|
15
|
-
isValidJson
|
|
15
|
+
get isValidJson () {
|
|
16
16
|
return isValidJson;
|
|
17
17
|
},
|
|
18
|
-
parseJSON
|
|
18
|
+
get parseJSON () {
|
|
19
19
|
return parseJSON;
|
|
20
20
|
},
|
|
21
|
-
stringifyJSON
|
|
21
|
+
get stringifyJSON () {
|
|
22
22
|
return stringifyJSON;
|
|
23
23
|
}
|
|
24
24
|
});
|
package/dist/esm/JsonEditor.js
CHANGED
|
@@ -95,24 +95,24 @@ function ConnectedJsonEditor({ initialValue, setValue, disabled }) {
|
|
|
95
95
|
]
|
|
96
96
|
}));
|
|
97
97
|
}, []);
|
|
98
|
-
return
|
|
98
|
+
return React.createElement("div", {
|
|
99
99
|
"data-test-id": "json-editor"
|
|
100
|
-
},
|
|
100
|
+
}, React.createElement(JsonEditorToolbar, {
|
|
101
101
|
isRedoDisabled: disabled || state.redoStack.length === 0,
|
|
102
102
|
isUndoDisabled: disabled || state.undoStack.length === 0,
|
|
103
103
|
onUndo: onUndo,
|
|
104
104
|
onRedo: onRedo
|
|
105
|
-
}),
|
|
105
|
+
}), React.createElement(JsonEditorField, {
|
|
106
106
|
value: state.value,
|
|
107
107
|
onChange: onChange,
|
|
108
108
|
isDisabled: disabled
|
|
109
|
-
}), !state.isValidJson &&
|
|
109
|
+
}), !state.isValidJson && React.createElement(JsonInvalidStatus, null));
|
|
110
110
|
}
|
|
111
111
|
export default function JsonEditor(props) {
|
|
112
|
-
return
|
|
112
|
+
return React.createElement(FieldConnector, {
|
|
113
113
|
field: props.field,
|
|
114
114
|
isInitiallyDisabled: props.isInitiallyDisabled
|
|
115
|
-
}, ({ value, disabled, setValue, externalReset })
|
|
115
|
+
}, ({ value, disabled, setValue, externalReset })=>React.createElement(ConnectedJsonEditor, {
|
|
116
116
|
key: `json-editor-${externalReset}`,
|
|
117
117
|
initialValue: value,
|
|
118
118
|
disabled: disabled,
|
|
@@ -45,12 +45,12 @@ const styles = {
|
|
|
45
45
|
})
|
|
46
46
|
};
|
|
47
47
|
export function JsonEditorField(props) {
|
|
48
|
-
return
|
|
48
|
+
return React.createElement("div", {
|
|
49
49
|
className: cx(styles.root, {
|
|
50
50
|
disabled: props.isDisabled
|
|
51
51
|
}),
|
|
52
52
|
"data-test-id": "json-editor-code-mirror"
|
|
53
|
-
},
|
|
53
|
+
}, React.createElement(CodeMirror, {
|
|
54
54
|
value: props.value,
|
|
55
55
|
onChange: props.onChange,
|
|
56
56
|
theme: "light",
|
|
@@ -21,14 +21,14 @@ const styles = {
|
|
|
21
21
|
})
|
|
22
22
|
};
|
|
23
23
|
export function JsonEditorToolbar(props) {
|
|
24
|
-
return
|
|
24
|
+
return React.createElement("div", {
|
|
25
25
|
className: styles.toolbar
|
|
26
|
-
},
|
|
26
|
+
}, React.createElement(Flex, {
|
|
27
27
|
alignItems: "center"
|
|
28
|
-
},
|
|
28
|
+
}, React.createElement(Button, {
|
|
29
29
|
className: styles.arrowButton,
|
|
30
30
|
variant: "transparent",
|
|
31
|
-
startIcon:
|
|
31
|
+
startIcon: React.createElement(ArrowUUpLeftIcon, {
|
|
32
32
|
size: "small"
|
|
33
33
|
}),
|
|
34
34
|
size: "small",
|
|
@@ -37,11 +37,11 @@ export function JsonEditorToolbar(props) {
|
|
|
37
37
|
onClick: ()=>{
|
|
38
38
|
props.onUndo();
|
|
39
39
|
}
|
|
40
|
-
}, "Undo"),
|
|
40
|
+
}, "Undo"), React.createElement(Button, {
|
|
41
41
|
className: styles.arrowButton,
|
|
42
42
|
variant: "transparent",
|
|
43
43
|
size: "small",
|
|
44
|
-
startIcon:
|
|
44
|
+
startIcon: React.createElement(ArrowUUpRightIcon, {
|
|
45
45
|
size: "small"
|
|
46
46
|
}),
|
|
47
47
|
isDisabled: props.isRedoDisabled,
|
|
@@ -4,13 +4,13 @@ import tokens from '@contentful/f36-tokens';
|
|
|
4
4
|
import { css } from '@emotion/css';
|
|
5
5
|
import { i18n as $_i18n } from "@lingui/core";
|
|
6
6
|
export function JsonInvalidStatus() {
|
|
7
|
-
return
|
|
7
|
+
return React.createElement("div", {
|
|
8
8
|
role: "status",
|
|
9
9
|
"data-test-id": "json-editor.invalid-json",
|
|
10
10
|
className: css({
|
|
11
11
|
marginTop: tokens.spacingS
|
|
12
12
|
})
|
|
13
|
-
},
|
|
13
|
+
}, React.createElement(ValidationMessage, null, $_i18n._({
|
|
14
14
|
id: "FieldEditors.Json.JsonInvalidStatus.InvalidJsonMessage",
|
|
15
15
|
message: "This is not valid JSON"
|
|
16
16
|
})));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-json",
|
|
3
|
-
"version": "4.4.3-canary.
|
|
3
|
+
"version": "4.4.3-canary.32+b08f6bb1",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@contentful/f36-components": "^6.7.1",
|
|
43
43
|
"@contentful/f36-icons": "^6.7.1",
|
|
44
44
|
"@contentful/f36-tokens": "^6.1.2",
|
|
45
|
-
"@contentful/field-editor-shared": "^4.6.3-canary.
|
|
45
|
+
"@contentful/field-editor-shared": "^4.6.3-canary.32+b08f6bb1",
|
|
46
46
|
"@emotion/css": "^11.13.5",
|
|
47
47
|
"@types/react-codemirror": "1.0.11",
|
|
48
48
|
"@uiw/react-codemirror": "^4.11.4",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@contentful/field-editor-test-utils": "^3.2.1",
|
|
53
|
-
"@lingui/core": "5.
|
|
53
|
+
"@lingui/core": "5.9.5"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@lingui/core": "^5.3.0",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"prettier --write"
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "b08f6bb183f055ef2f1b306f43c05e83dc475583"
|
|
70
70
|
}
|