@pareto-engineering/design-system 2.0.0-alpha.62 → 2.0.0-alpha.63
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/f/FormInput/FormInput.js +2 -1
- package/dist/cjs/f/common/Label/Label.js +1 -1
- package/dist/cjs/f/common/Label/styles.scss +1 -4
- package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +1 -1
- package/dist/cjs/f/fields/ChoicesInput/common/Choice/Choice.js +5 -2
- package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +12 -3
- package/dist/cjs/f/fields/QuerySelect/QuerySelect.js +12 -3
- package/dist/cjs/f/fields/RatingsInput/common/Rating/Rating.js +11 -2
- package/dist/es/f/FormInput/FormInput.js +2 -1
- package/dist/es/f/common/Label/Label.js +1 -1
- package/dist/es/f/common/Label/styles.scss +1 -4
- package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +1 -1
- package/dist/es/f/fields/ChoicesInput/common/Choice/Choice.js +5 -2
- package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +12 -3
- package/dist/es/f/fields/QuerySelect/QuerySelect.js +12 -3
- package/dist/es/f/fields/RatingsInput/common/Rating/Rating.js +11 -2
- package/package.json +1 -1
- package/src/__snapshots__/Storyshots.test.js.snap +583 -157
- package/src/stories/f/ChoicesInput.stories.jsx +38 -10
- package/src/ui/f/FormInput/FormInput.jsx +1 -0
- package/src/ui/f/common/Label/Label.jsx +1 -1
- package/src/ui/f/common/Label/styles.scss +1 -4
- package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +1 -1
- package/src/ui/f/fields/ChoicesInput/common/Choice/Choice.jsx +10 -2
- package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +7 -1
- package/src/ui/f/fields/QuerySelect/QuerySelect.jsx +7 -1
- package/src/ui/f/fields/RatingsInput/common/Rating/Rating.jsx +7 -1
|
@@ -19,7 +19,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
19
19
|
|
|
20
20
|
// Local Definitions
|
|
21
21
|
var baseClassName = _bem.default.base;
|
|
22
|
-
var componentClassName = 'label';
|
|
22
|
+
var componentClassName = 'form-label';
|
|
23
23
|
/**
|
|
24
24
|
* This is the component description.
|
|
25
25
|
*/
|
|
@@ -70,7 +70,7 @@ var ChoicesInput = _ref => {
|
|
|
70
70
|
}, options.map(choice => /*#__PURE__*/React.createElement(_common.Choice, _extends({
|
|
71
71
|
key: choice.value,
|
|
72
72
|
name: name,
|
|
73
|
-
id: "".concat(
|
|
73
|
+
id: "".concat(name, "-").concat(choice.value),
|
|
74
74
|
multiple: multiple,
|
|
75
75
|
validate: validate,
|
|
76
76
|
disabled: disabled
|
|
@@ -41,15 +41,18 @@ var Choice = _ref => {
|
|
|
41
41
|
validate,
|
|
42
42
|
disabled
|
|
43
43
|
} = _ref;
|
|
44
|
+
var type = multiple ? 'checkbox' : 'radio';
|
|
44
45
|
var [field] = (0, _formik.useField)({
|
|
45
46
|
name,
|
|
46
|
-
validate
|
|
47
|
+
validate,
|
|
48
|
+
type,
|
|
49
|
+
value
|
|
47
50
|
});
|
|
48
51
|
return /*#__PURE__*/React.createElement("div", {
|
|
49
52
|
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
50
53
|
style: style
|
|
51
54
|
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
52
|
-
type:
|
|
55
|
+
type: type,
|
|
53
56
|
id: id,
|
|
54
57
|
name: name
|
|
55
58
|
}, field, {
|
|
@@ -47,13 +47,17 @@ var QueryCombobox = _ref => {
|
|
|
47
47
|
extraVariables,
|
|
48
48
|
optionsKeyMap,
|
|
49
49
|
minLength,
|
|
50
|
-
transformSearch
|
|
50
|
+
transformSearch,
|
|
51
|
+
validate // ...otherProps
|
|
51
52
|
|
|
52
53
|
} = _ref;
|
|
53
54
|
(0, React.useLayoutEffect)(() => {
|
|
54
55
|
Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
|
|
55
56
|
}, []);
|
|
56
|
-
var [, meta, helpers] = (0, _formik.useField)(
|
|
57
|
+
var [, meta, helpers] = (0, _formik.useField)({
|
|
58
|
+
name,
|
|
59
|
+
validate
|
|
60
|
+
});
|
|
57
61
|
var {
|
|
58
62
|
setValue,
|
|
59
63
|
setError
|
|
@@ -217,7 +221,12 @@ QueryCombobox.propTypes = {
|
|
|
217
221
|
/**
|
|
218
222
|
* The function to transform the search input
|
|
219
223
|
*/
|
|
220
|
-
transformSearch: _propTypes.default.func
|
|
224
|
+
transformSearch: _propTypes.default.func,
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* The query combobox field validator function
|
|
228
|
+
*/
|
|
229
|
+
validate: _propTypes.default.func
|
|
221
230
|
};
|
|
222
231
|
QueryCombobox.defaultProps = {
|
|
223
232
|
optionsKeyMap: {
|
|
@@ -41,10 +41,14 @@ var QuerySelect = _ref => {
|
|
|
41
41
|
disabled,
|
|
42
42
|
color,
|
|
43
43
|
loadingOption,
|
|
44
|
-
defaultOption
|
|
44
|
+
defaultOption,
|
|
45
|
+
validate // ...otherProps
|
|
45
46
|
|
|
46
47
|
} = _ref;
|
|
47
|
-
var [,, helpers] = (0, _formik.useField)(
|
|
48
|
+
var [,, helpers] = (0, _formik.useField)({
|
|
49
|
+
name,
|
|
50
|
+
validate
|
|
51
|
+
});
|
|
48
52
|
var {
|
|
49
53
|
setError
|
|
50
54
|
} = helpers;
|
|
@@ -181,7 +185,12 @@ QuerySelect.propTypes = {
|
|
|
181
185
|
value: _propTypes.default.string.isRequired,
|
|
182
186
|
label: _propTypes.default.string.isRequired,
|
|
183
187
|
disabled: _propTypes.default.bool.isRequired
|
|
184
|
-
})
|
|
188
|
+
}),
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* The query select field validator function
|
|
192
|
+
*/
|
|
193
|
+
validate: _propTypes.default.func
|
|
185
194
|
};
|
|
186
195
|
QuerySelect.defaultProps = {
|
|
187
196
|
disabled: false,
|
|
@@ -38,12 +38,16 @@ var Rating = _ref => {
|
|
|
38
38
|
ratingId,
|
|
39
39
|
hover,
|
|
40
40
|
setHover,
|
|
41
|
+
validate,
|
|
41
42
|
activeBackgroundColor,
|
|
42
43
|
inactiveBackgroundColor,
|
|
43
44
|
showRatingValue // ...otherProps
|
|
44
45
|
|
|
45
46
|
} = _ref;
|
|
46
|
-
var [field] = (0, _formik.useField)(
|
|
47
|
+
var [field] = (0, _formik.useField)({
|
|
48
|
+
name,
|
|
49
|
+
validate
|
|
50
|
+
});
|
|
47
51
|
return /*#__PURE__*/React.createElement("div", {
|
|
48
52
|
id: id,
|
|
49
53
|
className: [baseClassName, componentClassName, userClassName, "x-".concat(activeBackgroundColor), "y-".concat(inactiveBackgroundColor)].filter(e => e).join(' '),
|
|
@@ -118,7 +122,12 @@ Rating.propTypes = {
|
|
|
118
122
|
/**
|
|
119
123
|
* Determines if the rating start value should be shown
|
|
120
124
|
*/
|
|
121
|
-
showRatingValue: _propTypes.default.bool
|
|
125
|
+
showRatingValue: _propTypes.default.bool,
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* The rating field validator function
|
|
129
|
+
*/
|
|
130
|
+
validate: _propTypes.default.func
|
|
122
131
|
};
|
|
123
132
|
Rating.defaultProps = {
|
|
124
133
|
activeBackgroundColor: 'main1',
|
|
@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import styleNames from '@pareto-engineering/bem'; // Local Definitions
|
|
6
6
|
|
|
7
7
|
const baseClassName = styleNames.base;
|
|
8
|
-
const componentClassName = 'label';
|
|
8
|
+
const componentClassName = 'form-label';
|
|
9
9
|
/**
|
|
10
10
|
* This is the component description.
|
|
11
11
|
*/
|
|
@@ -49,7 +49,7 @@ const ChoicesInput = ({
|
|
|
49
49
|
}, options.map(choice => /*#__PURE__*/React.createElement(Choice, _extends({
|
|
50
50
|
key: choice.value,
|
|
51
51
|
name: name,
|
|
52
|
-
id: `${
|
|
52
|
+
id: `${name}-${choice.value}`,
|
|
53
53
|
multiple: multiple,
|
|
54
54
|
validate: validate,
|
|
55
55
|
disabled: disabled
|
|
@@ -25,15 +25,18 @@ const Choice = ({
|
|
|
25
25
|
validate,
|
|
26
26
|
disabled
|
|
27
27
|
}) => {
|
|
28
|
+
const type = multiple ? 'checkbox' : 'radio';
|
|
28
29
|
const [field] = useField({
|
|
29
30
|
name,
|
|
30
|
-
validate
|
|
31
|
+
validate,
|
|
32
|
+
type,
|
|
33
|
+
value
|
|
31
34
|
});
|
|
32
35
|
return /*#__PURE__*/React.createElement("div", {
|
|
33
36
|
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
34
37
|
style: style
|
|
35
38
|
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
36
|
-
type:
|
|
39
|
+
type: type,
|
|
37
40
|
id: id,
|
|
38
41
|
name: name
|
|
39
42
|
}, field, {
|
|
@@ -26,13 +26,17 @@ const QueryCombobox = ({
|
|
|
26
26
|
extraVariables,
|
|
27
27
|
optionsKeyMap,
|
|
28
28
|
minLength,
|
|
29
|
-
transformSearch
|
|
29
|
+
transformSearch,
|
|
30
|
+
validate // ...otherProps
|
|
30
31
|
|
|
31
32
|
}) => {
|
|
32
33
|
useLayoutEffect(() => {
|
|
33
34
|
import("./styles.scss");
|
|
34
35
|
}, []);
|
|
35
|
-
const [, meta, helpers] = useField(
|
|
36
|
+
const [, meta, helpers] = useField({
|
|
37
|
+
name,
|
|
38
|
+
validate
|
|
39
|
+
});
|
|
36
40
|
const {
|
|
37
41
|
setValue,
|
|
38
42
|
setError
|
|
@@ -195,7 +199,12 @@ QueryCombobox.propTypes = {
|
|
|
195
199
|
/**
|
|
196
200
|
* The function to transform the search input
|
|
197
201
|
*/
|
|
198
|
-
transformSearch: PropTypes.func
|
|
202
|
+
transformSearch: PropTypes.func,
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* The query combobox field validator function
|
|
206
|
+
*/
|
|
207
|
+
validate: PropTypes.func
|
|
199
208
|
};
|
|
200
209
|
QueryCombobox.defaultProps = {
|
|
201
210
|
optionsKeyMap: {
|
|
@@ -23,10 +23,14 @@ const QuerySelect = ({
|
|
|
23
23
|
disabled,
|
|
24
24
|
color,
|
|
25
25
|
loadingOption,
|
|
26
|
-
defaultOption
|
|
26
|
+
defaultOption,
|
|
27
|
+
validate // ...otherProps
|
|
27
28
|
|
|
28
29
|
}) => {
|
|
29
|
-
const [,, helpers] = useField(
|
|
30
|
+
const [,, helpers] = useField({
|
|
31
|
+
name,
|
|
32
|
+
validate
|
|
33
|
+
});
|
|
30
34
|
const {
|
|
31
35
|
setError
|
|
32
36
|
} = helpers;
|
|
@@ -160,7 +164,12 @@ QuerySelect.propTypes = {
|
|
|
160
164
|
value: PropTypes.string.isRequired,
|
|
161
165
|
label: PropTypes.string.isRequired,
|
|
162
166
|
disabled: PropTypes.bool.isRequired
|
|
163
|
-
})
|
|
167
|
+
}),
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The query select field validator function
|
|
171
|
+
*/
|
|
172
|
+
validate: PropTypes.func
|
|
164
173
|
};
|
|
165
174
|
QuerySelect.defaultProps = {
|
|
166
175
|
disabled: false,
|
|
@@ -21,12 +21,16 @@ const Rating = ({
|
|
|
21
21
|
ratingId,
|
|
22
22
|
hover,
|
|
23
23
|
setHover,
|
|
24
|
+
validate,
|
|
24
25
|
activeBackgroundColor,
|
|
25
26
|
inactiveBackgroundColor,
|
|
26
27
|
showRatingValue // ...otherProps
|
|
27
28
|
|
|
28
29
|
}) => {
|
|
29
|
-
const [field] = useField(
|
|
30
|
+
const [field] = useField({
|
|
31
|
+
name,
|
|
32
|
+
validate
|
|
33
|
+
});
|
|
30
34
|
return /*#__PURE__*/React.createElement("div", {
|
|
31
35
|
id: id,
|
|
32
36
|
className: [baseClassName, componentClassName, userClassName, `x-${activeBackgroundColor}`, `y-${inactiveBackgroundColor}`].filter(e => e).join(' '),
|
|
@@ -101,7 +105,12 @@ Rating.propTypes = {
|
|
|
101
105
|
/**
|
|
102
106
|
* Determines if the rating start value should be shown
|
|
103
107
|
*/
|
|
104
|
-
showRatingValue: PropTypes.bool
|
|
108
|
+
showRatingValue: PropTypes.bool,
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The rating field validator function
|
|
112
|
+
*/
|
|
113
|
+
validate: PropTypes.func
|
|
105
114
|
};
|
|
106
115
|
Rating.defaultProps = {
|
|
107
116
|
activeBackgroundColor: 'main1',
|