@contentful/field-editor-tags 1.5.5 → 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.
- package/dist/cjs/TagsEditor.js +8 -8
- package/dist/cjs/TagsEditorConstraints.js +2 -2
- package/dist/cjs/TagsEditorContainer.js +2 -2
- package/dist/cjs/TagsEditorContainer.spec.js +4 -4
- package/dist/esm/TagsEditor.js +8 -8
- package/dist/esm/TagsEditorConstraints.js +2 -2
- package/dist/esm/TagsEditorContainer.js +2 -2
- package/dist/esm/TagsEditorContainer.spec.js +4 -4
- package/package.json +6 -4
package/dist/cjs/TagsEditor.js
CHANGED
|
@@ -93,7 +93,7 @@ const SortablePill = ({ id, label, index, disabled, onRemove })=>{
|
|
|
93
93
|
}) : '',
|
|
94
94
|
transition
|
|
95
95
|
};
|
|
96
|
-
return _react.default.createElement(_f36components.Pill, {
|
|
96
|
+
return /*#__PURE__*/ _react.default.createElement(_f36components.Pill, {
|
|
97
97
|
ref: setNodeRef,
|
|
98
98
|
testId: "tag-editor-pill",
|
|
99
99
|
className: (0, _emotion.cx)(styles.pill, {
|
|
@@ -107,7 +107,7 @@ const SortablePill = ({ id, label, index, disabled, onRemove })=>{
|
|
|
107
107
|
}
|
|
108
108
|
},
|
|
109
109
|
onDrag: _noop.default,
|
|
110
|
-
dragHandleComponent: _react.default.createElement(_f36components.DragHandle, {
|
|
110
|
+
dragHandleComponent: /*#__PURE__*/ _react.default.createElement(_f36components.DragHandle, {
|
|
111
111
|
ref: setActivatorNodeRef,
|
|
112
112
|
variant: "transparent",
|
|
113
113
|
label: "",
|
|
@@ -143,9 +143,9 @@ function TagsEditor(props) {
|
|
|
143
143
|
itemsMap,
|
|
144
144
|
onUpdate
|
|
145
145
|
]);
|
|
146
|
-
return _react.default.createElement("div", {
|
|
146
|
+
return /*#__PURE__*/ _react.default.createElement("div", {
|
|
147
147
|
"data-test-id": "tag-editor-container"
|
|
148
|
-
}, _react.default.createElement(_f36components.TextInput, {
|
|
148
|
+
}, /*#__PURE__*/ _react.default.createElement(_f36components.TextInput, {
|
|
149
149
|
testId: "tag-editor-input",
|
|
150
150
|
id: id,
|
|
151
151
|
className: styles.input,
|
|
@@ -166,21 +166,21 @@ function TagsEditor(props) {
|
|
|
166
166
|
onChange: (e)=>{
|
|
167
167
|
setPendingValue(e.target.value);
|
|
168
168
|
}
|
|
169
|
-
}), _react.default.createElement(_core.DndContext, {
|
|
169
|
+
}), /*#__PURE__*/ _react.default.createElement(_core.DndContext, {
|
|
170
170
|
onDragEnd: swapItems,
|
|
171
171
|
modifiers: [
|
|
172
172
|
_modifiers.restrictToParentElement
|
|
173
173
|
]
|
|
174
|
-
}, _react.default.createElement(_sortable.SortableContext, {
|
|
174
|
+
}, /*#__PURE__*/ _react.default.createElement(_sortable.SortableContext, {
|
|
175
175
|
items: itemsMap
|
|
176
|
-
}, itemsMap.map((item, index)
|
|
176
|
+
}, itemsMap.map((item, index)=>/*#__PURE__*/ _react.default.createElement(SortablePill, {
|
|
177
177
|
key: item.id,
|
|
178
178
|
id: item.id,
|
|
179
179
|
label: item.value,
|
|
180
180
|
index: index,
|
|
181
181
|
disabled: isDisabled,
|
|
182
182
|
onRemove: ()=>removeItem(index)
|
|
183
|
-
})))), constraints && constraintsType && _react.default.createElement(_TagsEditorConstraints.TagsEditorConstraints, {
|
|
183
|
+
})))), constraints && constraintsType && /*#__PURE__*/ _react.default.createElement(_TagsEditorConstraints.TagsEditorConstraints, {
|
|
184
184
|
constraints: constraints,
|
|
185
185
|
constraintsType: constraintsType
|
|
186
186
|
}));
|
|
@@ -54,7 +54,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
54
54
|
}
|
|
55
55
|
function TagsEditorConstraints(props) {
|
|
56
56
|
const { constraintsType, constraints } = props;
|
|
57
|
-
return _react.createElement(_f36components.Text, {
|
|
57
|
+
return /*#__PURE__*/ _react.createElement(_f36components.Text, {
|
|
58
58
|
as: "p",
|
|
59
59
|
fontColor: "gray600",
|
|
60
60
|
marginBottom: "none",
|
|
@@ -63,5 +63,5 @@ function TagsEditorConstraints(props) {
|
|
|
63
63
|
fontStyle: 'italic'
|
|
64
64
|
}),
|
|
65
65
|
testId: "tag-editor-constraints"
|
|
66
|
-
}, constraintsType === 'min' && _react.createElement("span", null, "Requires at least ", constraints.min, " ", constraints.min === 1 ? 'tag' : 'tags'), constraintsType === 'max' && _react.createElement("span", null, "Requires no more than ", constraints.max, " ", constraints.max === 1 ? 'tag' : 'tags'), constraintsType === 'min-max' && constraints.max !== constraints.min && _react.createElement("span", null, "Requires between ", constraints.min, " and ", constraints.max, " tags"), constraintsType === 'min-max' && constraints.max === constraints.min && _react.createElement("span", null, "Requires exactly ", constraints.max, " ", constraints.max === 1 ? 'tag' : 'tags'));
|
|
66
|
+
}, constraintsType === 'min' && /*#__PURE__*/ _react.createElement("span", null, "Requires at least ", constraints.min, " ", constraints.min === 1 ? 'tag' : 'tags'), constraintsType === 'max' && /*#__PURE__*/ _react.createElement("span", null, "Requires no more than ", constraints.max, " ", constraints.max === 1 ? 'tag' : 'tags'), constraintsType === 'min-max' && constraints.max !== constraints.min && /*#__PURE__*/ _react.createElement("span", null, "Requires between ", constraints.min, " and ", constraints.max, " tags"), constraintsType === 'min-max' && constraints.max === constraints.min && /*#__PURE__*/ _react.createElement("span", null, "Requires exactly ", constraints.max, " ", constraints.max === 1 ? 'tag' : 'tags'));
|
|
67
67
|
}
|
|
@@ -81,14 +81,14 @@ function TagsEditorContainer({ isInitiallyDisabled, field, id }) {
|
|
|
81
81
|
const sizeValidations = validations.filter((validation)=>validation.size).map((validation)=>validation.size);
|
|
82
82
|
const constraints = sizeValidations.length > 0 ? sizeValidations[0] : {};
|
|
83
83
|
const constraintsType = getConstraintsType(constraints);
|
|
84
|
-
return _react.createElement(_fieldeditorshared.FieldConnector, {
|
|
84
|
+
return /*#__PURE__*/ _react.createElement(_fieldeditorshared.FieldConnector, {
|
|
85
85
|
field: field,
|
|
86
86
|
isInitiallyDisabled: isInitiallyDisabled,
|
|
87
87
|
isEmptyValue: isEmptyTagsValue,
|
|
88
88
|
debounce: 0
|
|
89
89
|
}, ({ disabled, value, errors, setValue })=>{
|
|
90
90
|
const items = value || [];
|
|
91
|
-
return _react.createElement(_TagsEditor.TagsEditor, {
|
|
91
|
+
return /*#__PURE__*/ _react.createElement(_TagsEditor.TagsEditor, {
|
|
92
92
|
id: id,
|
|
93
93
|
constraints: constraints,
|
|
94
94
|
constraintsType: constraintsType,
|
|
@@ -90,7 +90,7 @@ describe('TagsEditor', ()=>{
|
|
|
90
90
|
validations: []
|
|
91
91
|
};
|
|
92
92
|
});
|
|
93
|
-
const renderResult = (0, _react1.render)(_react.createElement(_TagsEditorContainer.TagsEditorContainer, {
|
|
93
|
+
const renderResult = (0, _react1.render)(/*#__PURE__*/ _react.createElement(_TagsEditorContainer.TagsEditorContainer, {
|
|
94
94
|
field: field,
|
|
95
95
|
isInitiallyDisabled: false
|
|
96
96
|
}));
|
|
@@ -110,7 +110,7 @@ describe('TagsEditor', ()=>{
|
|
|
110
110
|
validations: []
|
|
111
111
|
};
|
|
112
112
|
}, initialValue);
|
|
113
|
-
const renderResult = (0, _react1.render)(_react.createElement(_TagsEditorContainer.TagsEditorContainer, {
|
|
113
|
+
const renderResult = (0, _react1.render)(/*#__PURE__*/ _react.createElement(_TagsEditorContainer.TagsEditorContainer, {
|
|
114
114
|
field: field,
|
|
115
115
|
isInitiallyDisabled: false
|
|
116
116
|
}));
|
|
@@ -180,7 +180,7 @@ describe('TagsEditor', ()=>{
|
|
|
180
180
|
]
|
|
181
181
|
};
|
|
182
182
|
});
|
|
183
|
-
const { getByTestId } = (0, _react1.render)(_react.createElement(_TagsEditorContainer.TagsEditorContainer, {
|
|
183
|
+
const { getByTestId } = (0, _react1.render)(/*#__PURE__*/ _react.createElement(_TagsEditorContainer.TagsEditorContainer, {
|
|
184
184
|
field: field,
|
|
185
185
|
isInitiallyDisabled: false
|
|
186
186
|
}));
|
|
@@ -198,7 +198,7 @@ describe('TagsEditor', ()=>{
|
|
|
198
198
|
validations: []
|
|
199
199
|
};
|
|
200
200
|
});
|
|
201
|
-
const renderResult = (0, _react1.render)(_react.createElement(_TagsEditorContainer.TagsEditorContainer, {
|
|
201
|
+
const renderResult = (0, _react1.render)(/*#__PURE__*/ _react.createElement(_TagsEditorContainer.TagsEditorContainer, {
|
|
202
202
|
field: field,
|
|
203
203
|
isInitiallyDisabled: false
|
|
204
204
|
}));
|
package/dist/esm/TagsEditor.js
CHANGED
|
@@ -37,7 +37,7 @@ const SortablePill = ({ id, label, index, disabled, onRemove })=>{
|
|
|
37
37
|
}) : '',
|
|
38
38
|
transition
|
|
39
39
|
};
|
|
40
|
-
return React.createElement(Pill, {
|
|
40
|
+
return /*#__PURE__*/ React.createElement(Pill, {
|
|
41
41
|
ref: setNodeRef,
|
|
42
42
|
testId: "tag-editor-pill",
|
|
43
43
|
className: cx(styles.pill, {
|
|
@@ -51,7 +51,7 @@ const SortablePill = ({ id, label, index, disabled, onRemove })=>{
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
onDrag: noop,
|
|
54
|
-
dragHandleComponent: React.createElement(DragHandle, {
|
|
54
|
+
dragHandleComponent: /*#__PURE__*/ React.createElement(DragHandle, {
|
|
55
55
|
ref: setActivatorNodeRef,
|
|
56
56
|
variant: "transparent",
|
|
57
57
|
label: "",
|
|
@@ -87,9 +87,9 @@ export function TagsEditor(props) {
|
|
|
87
87
|
itemsMap,
|
|
88
88
|
onUpdate
|
|
89
89
|
]);
|
|
90
|
-
return React.createElement("div", {
|
|
90
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
91
91
|
"data-test-id": "tag-editor-container"
|
|
92
|
-
}, React.createElement(TextInput, {
|
|
92
|
+
}, /*#__PURE__*/ React.createElement(TextInput, {
|
|
93
93
|
testId: "tag-editor-input",
|
|
94
94
|
id: id,
|
|
95
95
|
className: styles.input,
|
|
@@ -110,21 +110,21 @@ export function TagsEditor(props) {
|
|
|
110
110
|
onChange: (e)=>{
|
|
111
111
|
setPendingValue(e.target.value);
|
|
112
112
|
}
|
|
113
|
-
}), React.createElement(DndContext, {
|
|
113
|
+
}), /*#__PURE__*/ React.createElement(DndContext, {
|
|
114
114
|
onDragEnd: swapItems,
|
|
115
115
|
modifiers: [
|
|
116
116
|
restrictToParentElement
|
|
117
117
|
]
|
|
118
|
-
}, React.createElement(SortableContext, {
|
|
118
|
+
}, /*#__PURE__*/ React.createElement(SortableContext, {
|
|
119
119
|
items: itemsMap
|
|
120
|
-
}, itemsMap.map((item, index)
|
|
120
|
+
}, itemsMap.map((item, index)=>/*#__PURE__*/ React.createElement(SortablePill, {
|
|
121
121
|
key: item.id,
|
|
122
122
|
id: item.id,
|
|
123
123
|
label: item.value,
|
|
124
124
|
index: index,
|
|
125
125
|
disabled: isDisabled,
|
|
126
126
|
onRemove: ()=>removeItem(index)
|
|
127
|
-
})))), constraints && constraintsType && React.createElement(TagsEditorConstraints, {
|
|
127
|
+
})))), constraints && constraintsType && /*#__PURE__*/ React.createElement(TagsEditorConstraints, {
|
|
128
128
|
constraints: constraints,
|
|
129
129
|
constraintsType: constraintsType
|
|
130
130
|
}));
|
|
@@ -3,7 +3,7 @@ import { Text } from '@contentful/f36-components';
|
|
|
3
3
|
import { css } from 'emotion';
|
|
4
4
|
export function TagsEditorConstraints(props) {
|
|
5
5
|
const { constraintsType, constraints } = props;
|
|
6
|
-
return React.createElement(Text, {
|
|
6
|
+
return /*#__PURE__*/ React.createElement(Text, {
|
|
7
7
|
as: "p",
|
|
8
8
|
fontColor: "gray600",
|
|
9
9
|
marginBottom: "none",
|
|
@@ -12,5 +12,5 @@ export function TagsEditorConstraints(props) {
|
|
|
12
12
|
fontStyle: 'italic'
|
|
13
13
|
}),
|
|
14
14
|
testId: "tag-editor-constraints"
|
|
15
|
-
}, constraintsType === 'min' && React.createElement("span", null, "Requires at least ", constraints.min, " ", constraints.min === 1 ? 'tag' : 'tags'), constraintsType === 'max' && React.createElement("span", null, "Requires no more than ", constraints.max, " ", constraints.max === 1 ? 'tag' : 'tags'), constraintsType === 'min-max' && constraints.max !== constraints.min && React.createElement("span", null, "Requires between ", constraints.min, " and ", constraints.max, " tags"), constraintsType === 'min-max' && constraints.max === constraints.min && React.createElement("span", null, "Requires exactly ", constraints.max, " ", constraints.max === 1 ? 'tag' : 'tags'));
|
|
15
|
+
}, constraintsType === 'min' && /*#__PURE__*/ React.createElement("span", null, "Requires at least ", constraints.min, " ", constraints.min === 1 ? 'tag' : 'tags'), constraintsType === 'max' && /*#__PURE__*/ React.createElement("span", null, "Requires no more than ", constraints.max, " ", constraints.max === 1 ? 'tag' : 'tags'), constraintsType === 'min-max' && constraints.max !== constraints.min && /*#__PURE__*/ React.createElement("span", null, "Requires between ", constraints.min, " and ", constraints.max, " tags"), constraintsType === 'min-max' && constraints.max === constraints.min && /*#__PURE__*/ React.createElement("span", null, "Requires exactly ", constraints.max, " ", constraints.max === 1 ? 'tag' : 'tags'));
|
|
16
16
|
}
|
|
@@ -25,14 +25,14 @@ export function TagsEditorContainer({ isInitiallyDisabled, field, id }) {
|
|
|
25
25
|
const sizeValidations = validations.filter((validation)=>validation.size).map((validation)=>validation.size);
|
|
26
26
|
const constraints = sizeValidations.length > 0 ? sizeValidations[0] : {};
|
|
27
27
|
const constraintsType = getConstraintsType(constraints);
|
|
28
|
-
return React.createElement(FieldConnector, {
|
|
28
|
+
return /*#__PURE__*/ React.createElement(FieldConnector, {
|
|
29
29
|
field: field,
|
|
30
30
|
isInitiallyDisabled: isInitiallyDisabled,
|
|
31
31
|
isEmptyValue: isEmptyTagsValue,
|
|
32
32
|
debounce: 0
|
|
33
33
|
}, ({ disabled, value, errors, setValue })=>{
|
|
34
34
|
const items = value || [];
|
|
35
|
-
return React.createElement(TagsEditor, {
|
|
35
|
+
return /*#__PURE__*/ React.createElement(TagsEditor, {
|
|
36
36
|
id: id,
|
|
37
37
|
constraints: constraints,
|
|
38
38
|
constraintsType: constraintsType,
|
|
@@ -45,7 +45,7 @@ describe('TagsEditor', ()=>{
|
|
|
45
45
|
validations: []
|
|
46
46
|
};
|
|
47
47
|
});
|
|
48
|
-
const renderResult = render(React.createElement(TagsEditorContainer, {
|
|
48
|
+
const renderResult = render(/*#__PURE__*/ React.createElement(TagsEditorContainer, {
|
|
49
49
|
field: field,
|
|
50
50
|
isInitiallyDisabled: false
|
|
51
51
|
}));
|
|
@@ -65,7 +65,7 @@ describe('TagsEditor', ()=>{
|
|
|
65
65
|
validations: []
|
|
66
66
|
};
|
|
67
67
|
}, initialValue);
|
|
68
|
-
const renderResult = render(React.createElement(TagsEditorContainer, {
|
|
68
|
+
const renderResult = render(/*#__PURE__*/ React.createElement(TagsEditorContainer, {
|
|
69
69
|
field: field,
|
|
70
70
|
isInitiallyDisabled: false
|
|
71
71
|
}));
|
|
@@ -135,7 +135,7 @@ describe('TagsEditor', ()=>{
|
|
|
135
135
|
]
|
|
136
136
|
};
|
|
137
137
|
});
|
|
138
|
-
const { getByTestId } = render(React.createElement(TagsEditorContainer, {
|
|
138
|
+
const { getByTestId } = render(/*#__PURE__*/ React.createElement(TagsEditorContainer, {
|
|
139
139
|
field: field,
|
|
140
140
|
isInitiallyDisabled: false
|
|
141
141
|
}));
|
|
@@ -153,7 +153,7 @@ describe('TagsEditor', ()=>{
|
|
|
153
153
|
validations: []
|
|
154
154
|
};
|
|
155
155
|
});
|
|
156
|
-
const renderResult = render(React.createElement(TagsEditorContainer, {
|
|
156
|
+
const renderResult = render(/*#__PURE__*/ React.createElement(TagsEditorContainer, {
|
|
157
157
|
field: field,
|
|
158
158
|
isInitiallyDisabled: false
|
|
159
159
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-tags",
|
|
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",
|
|
@@ -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.
|
|
41
|
+
"@contentful/field-editor-shared": "^2.8.0",
|
|
42
42
|
"@dnd-kit/core": "^6.0.8",
|
|
43
43
|
"@dnd-kit/modifiers": "^7.0.0",
|
|
44
44
|
"@dnd-kit/sortable": "^8.0.0",
|
|
@@ -46,13 +46,15 @@
|
|
|
46
46
|
"lodash": "^4.17.15"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@contentful/field-editor-test-utils": "^1.5.2"
|
|
49
|
+
"@contentful/field-editor-test-utils": "^1.5.2",
|
|
50
|
+
"@lingui/core": "5.3.0"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
53
|
+
"@lingui/core": "^5.3.0",
|
|
52
54
|
"react": ">=16.8.0"
|
|
53
55
|
},
|
|
54
56
|
"publishConfig": {
|
|
55
57
|
"registry": "https://npm.pkg.github.com/"
|
|
56
58
|
},
|
|
57
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "a86f67a6d507eb7c8c7a38b4312380361bdbebbb"
|
|
58
60
|
}
|