@pareto-engineering/design-system 4.0.0-alpha.35 → 4.0.0-alpha.36
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/common/InputWrapper/InputWrapper.js +74 -0
- package/dist/cjs/f/common/InputWrapper/index.js +13 -0
- package/dist/cjs/f/common/InputWrapper/styles.scss +13 -0
- package/dist/cjs/f/common/Label/Label.js +18 -4
- package/dist/cjs/f/common/Label/styles.scss +8 -2
- package/dist/cjs/f/common/index.js +8 -1
- package/dist/cjs/f/fields/Checkbox/Checkbox.js +40 -10
- package/dist/cjs/f/fields/Checkbox/styles.scss +6 -8
- package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +42 -20
- package/dist/cjs/f/fields/ChoicesInput/common/Choice/Choice.js +1 -1
- package/dist/cjs/f/fields/ChoicesInput/styles.scss +50 -35
- package/dist/cjs/f/fields/QueryChoices/QueryChoices.js +26 -2
- package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +35 -5
- package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +41 -14
- package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +33 -23
- package/dist/cjs/f/fields/QueryCombobox/styles.scss +58 -28
- package/dist/cjs/f/fields/QuerySelect/QuerySelect.js +17 -3
- package/dist/cjs/f/fields/RatingsInput/RatingsInput.js +41 -19
- package/dist/cjs/f/fields/RatingsInput/common/Rating/Rating.js +3 -3
- package/dist/cjs/f/fields/RatingsInput/styles.scss +6 -13
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +45 -15
- package/dist/cjs/f/fields/SelectInput/styles.scss +40 -18
- package/dist/cjs/f/fields/TextInput/TextInput.js +38 -16
- package/dist/cjs/f/fields/TextInput/styles.scss +28 -22
- package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +42 -21
- package/dist/cjs/f/fields/TextareaInput/styles.scss +42 -27
- package/dist/es/f/common/InputWrapper/InputWrapper.js +66 -0
- package/dist/es/f/common/InputWrapper/index.js +2 -0
- package/dist/es/f/common/InputWrapper/styles.scss +13 -0
- package/dist/es/f/common/Label/Label.js +18 -4
- package/dist/es/f/common/Label/styles.scss +8 -2
- package/dist/es/f/common/index.js +2 -1
- package/dist/es/f/fields/Checkbox/Checkbox.js +41 -11
- package/dist/es/f/fields/Checkbox/styles.scss +6 -8
- package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +43 -21
- package/dist/es/f/fields/ChoicesInput/common/Choice/Choice.js +1 -1
- package/dist/es/f/fields/ChoicesInput/styles.scss +50 -35
- package/dist/es/f/fields/QueryChoices/QueryChoices.js +26 -2
- package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +35 -5
- package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +41 -14
- package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +33 -23
- package/dist/es/f/fields/QueryCombobox/styles.scss +58 -28
- package/dist/es/f/fields/QuerySelect/QuerySelect.js +17 -3
- package/dist/es/f/fields/RatingsInput/RatingsInput.js +42 -20
- package/dist/es/f/fields/RatingsInput/common/Rating/Rating.js +3 -3
- package/dist/es/f/fields/RatingsInput/styles.scss +6 -13
- package/dist/es/f/fields/SelectInput/SelectInput.js +46 -16
- package/dist/es/f/fields/SelectInput/styles.scss +40 -18
- package/dist/es/f/fields/TextInput/TextInput.js +39 -17
- package/dist/es/f/fields/TextInput/styles.scss +28 -22
- package/dist/es/f/fields/TextareaInput/TextareaInput.js +43 -22
- package/dist/es/f/fields/TextareaInput/styles.scss +42 -27
- package/package.json +2 -2
- package/src/stories/f/Checkbox.stories.jsx +22 -7
- package/src/stories/f/ChoicesInput.stories.jsx +21 -7
- package/src/stories/f/QueryChoices.stories.jsx +20 -4
- package/src/stories/f/QueryCombobox.stories.jsx +25 -13
- package/src/stories/f/QuerySelect.stories.jsx +20 -5
- package/src/stories/f/RatingsInput.stories.jsx +16 -2
- package/src/stories/f/SelectInput.stories.jsx +20 -5
- package/src/stories/f/TextInput.stories.jsx +23 -9
- package/src/stories/f/TextareaInput.stories.jsx +16 -2
- package/src/ui/f/common/InputWrapper/InputWrapper.jsx +89 -0
- package/src/ui/f/common/InputWrapper/index.js +2 -0
- package/src/ui/f/common/InputWrapper/styles.scss +13 -0
- package/src/ui/f/common/Label/Label.jsx +18 -2
- package/src/ui/f/common/Label/styles.scss +8 -2
- package/src/ui/f/common/index.js +1 -0
- package/src/ui/f/fields/Checkbox/Checkbox.jsx +65 -27
- package/src/ui/f/fields/Checkbox/styles.scss +6 -8
- package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +75 -47
- package/src/ui/f/fields/ChoicesInput/common/Choice/Choice.jsx +10 -3
- package/src/ui/f/fields/ChoicesInput/styles.scss +50 -35
- package/src/ui/f/fields/QueryChoices/QueryChoices.jsx +28 -0
- package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +37 -2
- package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +67 -38
- package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +81 -66
- package/src/ui/f/fields/QueryCombobox/styles.scss +58 -28
- package/src/ui/f/fields/QuerySelect/QuerySelect.jsx +16 -1
- package/src/ui/f/fields/RatingsInput/RatingsInput.jsx +55 -28
- package/src/ui/f/fields/RatingsInput/common/Rating/Rating.jsx +3 -3
- package/src/ui/f/fields/RatingsInput/styles.scss +6 -13
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +88 -49
- package/src/ui/f/fields/SelectInput/styles.scss +40 -18
- package/src/ui/f/fields/TextInput/TextInput.jsx +52 -29
- package/src/ui/f/fields/TextInput/styles.scss +28 -22
- package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +65 -43
- package/src/ui/f/fields/TextareaInput/styles.scss +42 -27
- package/tests/__snapshots__/Storyshots.test.js.snap +4698 -3122
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } /* @pareto-engineering/generator-front 1.0.12 */
|
|
13
|
+
// Local Definitions
|
|
14
|
+
|
|
15
|
+
const baseClassName = _exports.default.base;
|
|
16
|
+
const componentClassName = 'input-wrapper';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* This is the component description.
|
|
20
|
+
*/
|
|
21
|
+
const InputWrapper = _ref => {
|
|
22
|
+
let {
|
|
23
|
+
id,
|
|
24
|
+
className: userClassName,
|
|
25
|
+
style,
|
|
26
|
+
children,
|
|
27
|
+
columnSpan,
|
|
28
|
+
desktopColumnSpan
|
|
29
|
+
// ...otherProps
|
|
30
|
+
} = _ref;
|
|
31
|
+
(0, React.useInsertionEffect)(() => {
|
|
32
|
+
Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
|
|
33
|
+
}, []);
|
|
34
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
id: id,
|
|
36
|
+
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
37
|
+
style: {
|
|
38
|
+
...style,
|
|
39
|
+
'--column-span': columnSpan || 'var(--columns)',
|
|
40
|
+
'--column-span-md': desktopColumnSpan || 'var(--columns)'
|
|
41
|
+
}
|
|
42
|
+
}, children);
|
|
43
|
+
};
|
|
44
|
+
InputWrapper.propTypes = {
|
|
45
|
+
/**
|
|
46
|
+
* The HTML id for this element
|
|
47
|
+
*/
|
|
48
|
+
id: _propTypes.default.string,
|
|
49
|
+
/**
|
|
50
|
+
* The HTML class names for this element
|
|
51
|
+
*/
|
|
52
|
+
className: _propTypes.default.string,
|
|
53
|
+
/**
|
|
54
|
+
* The React-written, css properties for this element.
|
|
55
|
+
*/
|
|
56
|
+
style: _propTypes.default.objectOf(_propTypes.default.string),
|
|
57
|
+
/**
|
|
58
|
+
* The children JSX
|
|
59
|
+
*/
|
|
60
|
+
children: _propTypes.default.node,
|
|
61
|
+
/**
|
|
62
|
+
* How many columns the input should span
|
|
63
|
+
*/
|
|
64
|
+
columnSpan: _propTypes.default.number,
|
|
65
|
+
/**
|
|
66
|
+
* How many columns the input should span on desktop
|
|
67
|
+
*/
|
|
68
|
+
desktopColumnSpan: _propTypes.default.number
|
|
69
|
+
};
|
|
70
|
+
InputWrapper.defaultProps = {
|
|
71
|
+
// as :'label',
|
|
72
|
+
};
|
|
73
|
+
var _default = InputWrapper;
|
|
74
|
+
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "InputWrapper", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _InputWrapper.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _InputWrapper = _interopRequireDefault(require("./InputWrapper"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
|
|
3
|
+
@use "@pareto-engineering/bem";
|
|
4
|
+
@use "@pareto-engineering/styles/src/mixins";
|
|
5
|
+
@use "@pareto-engineering/styles/src/globals" as *;
|
|
6
|
+
|
|
7
|
+
.#{bem.$base}.input-wrapper {
|
|
8
|
+
grid-column: span var(--column-span);
|
|
9
|
+
|
|
10
|
+
@include mixins.media($from: $sm-md) {
|
|
11
|
+
grid-column: span var(--column-span-md);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -27,7 +27,9 @@ const Label = _ref => {
|
|
|
27
27
|
name,
|
|
28
28
|
color,
|
|
29
29
|
optional,
|
|
30
|
-
as: Wrapper
|
|
30
|
+
as: Wrapper,
|
|
31
|
+
columnSpan,
|
|
32
|
+
desktopColumnSpan
|
|
31
33
|
// ...otherProps
|
|
32
34
|
} = _ref;
|
|
33
35
|
(0, React.useInsertionEffect)(() => {
|
|
@@ -37,7 +39,11 @@ const Label = _ref => {
|
|
|
37
39
|
htmlFor: Wrapper === 'label' ? name : undefined,
|
|
38
40
|
id: id,
|
|
39
41
|
className: [baseClassName, componentClassName, userClassName, `x-${color}`].filter(e => e).join(' '),
|
|
40
|
-
style:
|
|
42
|
+
style: {
|
|
43
|
+
...style,
|
|
44
|
+
'--column-span': columnSpan || 'var(--columns)',
|
|
45
|
+
'--column-span-md': desktopColumnSpan || 'var(--columns)'
|
|
46
|
+
}
|
|
41
47
|
// {...otherProps}
|
|
42
48
|
}, children, optional && ' (Optional)');
|
|
43
49
|
};
|
|
@@ -73,11 +79,19 @@ Label.propTypes = {
|
|
|
73
79
|
/**
|
|
74
80
|
* Whether the input should have an optional tag
|
|
75
81
|
*/
|
|
76
|
-
optional: _propTypes.default.bool
|
|
82
|
+
optional: _propTypes.default.bool,
|
|
83
|
+
/**
|
|
84
|
+
* How many columns the input should span
|
|
85
|
+
*/
|
|
86
|
+
columnSpan: _propTypes.default.number,
|
|
87
|
+
/**
|
|
88
|
+
* How many columns the input should span on desktop
|
|
89
|
+
*/
|
|
90
|
+
desktopColumnSpan: _propTypes.default.number
|
|
77
91
|
};
|
|
78
92
|
Label.defaultProps = {
|
|
79
93
|
as: 'label',
|
|
80
|
-
color: '
|
|
94
|
+
color: 'paragraph',
|
|
81
95
|
optional: false
|
|
82
96
|
};
|
|
83
97
|
var _default = Label;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
|
|
3
3
|
@use "@pareto-engineering/bem";
|
|
4
|
-
@use "
|
|
4
|
+
@use "@pareto-engineering/styles/src/mixins";
|
|
5
|
+
@use "@pareto-engineering/styles/src/globals" as *;
|
|
5
6
|
|
|
6
7
|
.#{bem.$base}.form-label {
|
|
7
|
-
color: var(--
|
|
8
|
+
color: var(--x);
|
|
9
|
+
grid-column: span var(--column-span);
|
|
10
|
+
|
|
11
|
+
@include mixins.media($from: $sm-md) {
|
|
12
|
+
grid-column: span var(--column-span-md);
|
|
13
|
+
}
|
|
8
14
|
}
|
|
@@ -21,6 +21,13 @@ Object.defineProperty(exports, "FormLabel", {
|
|
|
21
21
|
return _Label.Label;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "InputWrapper", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _InputWrapper.InputWrapper;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
var _Label = require("./Label");
|
|
25
31
|
var _Description = require("./Description");
|
|
26
|
-
var _Debugger = require("./Debugger");
|
|
32
|
+
var _Debugger = require("./Debugger");
|
|
33
|
+
var _InputWrapper = require("./InputWrapper");
|
|
@@ -30,7 +30,12 @@ const Checkbox = _ref => {
|
|
|
30
30
|
label,
|
|
31
31
|
description,
|
|
32
32
|
disabled,
|
|
33
|
-
optional
|
|
33
|
+
optional,
|
|
34
|
+
labelColor,
|
|
35
|
+
labelSpan,
|
|
36
|
+
desktopLabelSpan,
|
|
37
|
+
inputSpan,
|
|
38
|
+
desktopInputSpan
|
|
34
39
|
// ...otherProps
|
|
35
40
|
} = _ref;
|
|
36
41
|
(0, React.useInsertionEffect)(() => {
|
|
@@ -40,24 +45,29 @@ const Checkbox = _ref => {
|
|
|
40
45
|
name,
|
|
41
46
|
type: 'checkbox'
|
|
42
47
|
});
|
|
43
|
-
return /*#__PURE__*/React.createElement(
|
|
48
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement(_common.FormLabel, {
|
|
49
|
+
name: name,
|
|
50
|
+
color: labelColor,
|
|
51
|
+
optional: optional,
|
|
52
|
+
columnSpan: labelSpan,
|
|
53
|
+
desktopColumnSpan: desktopLabelSpan
|
|
54
|
+
// {...otherProps}
|
|
55
|
+
}, label), /*#__PURE__*/React.createElement(_common.InputWrapper, {
|
|
44
56
|
id: id,
|
|
45
57
|
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
46
|
-
style: style
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
optional: optional
|
|
51
|
-
}, label), /*#__PURE__*/React.createElement("input", _extends({
|
|
58
|
+
style: style,
|
|
59
|
+
columnSpan: inputSpan,
|
|
60
|
+
desktopColumnSpan: desktopInputSpan
|
|
61
|
+
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
52
62
|
id: name,
|
|
53
63
|
className: "input",
|
|
54
64
|
type: "checkbox",
|
|
55
65
|
disabled: disabled
|
|
56
66
|
}, field)), /*#__PURE__*/React.createElement(_common.FormDescription, {
|
|
57
|
-
className: "
|
|
67
|
+
className: "s-1",
|
|
58
68
|
description: description,
|
|
59
69
|
name: name
|
|
60
|
-
}));
|
|
70
|
+
})));
|
|
61
71
|
};
|
|
62
72
|
Checkbox.propTypes = {
|
|
63
73
|
/**
|
|
@@ -84,10 +94,30 @@ Checkbox.propTypes = {
|
|
|
84
94
|
* Whether the input should be disabled
|
|
85
95
|
*/
|
|
86
96
|
disabled: _propTypes.default.bool,
|
|
97
|
+
/**
|
|
98
|
+
* The color of the label
|
|
99
|
+
*/
|
|
100
|
+
labelColor: _propTypes.default.string,
|
|
87
101
|
/**
|
|
88
102
|
* The input label
|
|
89
103
|
*/
|
|
90
104
|
label: _propTypes.default.string,
|
|
105
|
+
/**
|
|
106
|
+
* The number of columns the label should span
|
|
107
|
+
*/
|
|
108
|
+
labelSpan: _propTypes.default.number,
|
|
109
|
+
/**
|
|
110
|
+
* The number of columns the input should span
|
|
111
|
+
*/
|
|
112
|
+
inputSpan: _propTypes.default.number,
|
|
113
|
+
/**
|
|
114
|
+
* The number of columns the label should span on desktop
|
|
115
|
+
*/
|
|
116
|
+
desktopLabelSpan: _propTypes.default.number,
|
|
117
|
+
/**
|
|
118
|
+
* The number of columns the input should span on desktop
|
|
119
|
+
*/
|
|
120
|
+
desktopInputSpan: _propTypes.default.number,
|
|
91
121
|
/**
|
|
92
122
|
* Whether the input should have an optional tag
|
|
93
123
|
*/
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
|
|
3
3
|
@use "@pareto-engineering/bem";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
@use "@pareto-engineering/styles/src/mixins";
|
|
5
|
+
@use "@pareto-engineering/styles/src/globals" as *;
|
|
6
6
|
|
|
7
7
|
.#{bem.$base}.checkbox {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.#{bem.$base}.label {
|
|
13
|
-
margin-bottom: $default-margin;
|
|
8
|
+
&.#{bem.$base}.input-wrapper {
|
|
9
|
+
align-items: flex-start;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
14
12
|
}
|
|
15
13
|
}
|
|
@@ -28,35 +28,39 @@ const ChoicesInput = _ref => {
|
|
|
28
28
|
validate,
|
|
29
29
|
options,
|
|
30
30
|
multiple,
|
|
31
|
-
gridColumnsMobile,
|
|
32
|
-
gridColumnsDesktop,
|
|
33
31
|
color,
|
|
34
32
|
label,
|
|
33
|
+
labelColor,
|
|
35
34
|
optional,
|
|
36
35
|
disabled,
|
|
37
36
|
description,
|
|
38
37
|
spaceBetween,
|
|
38
|
+
labelSpan,
|
|
39
|
+
desktopLabelSpan,
|
|
40
|
+
inputSpan,
|
|
41
|
+
desktopInputSpan,
|
|
39
42
|
...otherProps
|
|
40
43
|
} = _ref;
|
|
41
44
|
(0, React.useInsertionEffect)(() => {
|
|
42
45
|
Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
|
|
43
46
|
}, []);
|
|
44
|
-
return /*#__PURE__*/React.createElement(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
...style
|
|
51
|
-
}
|
|
47
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement(_common2.FormLabel, {
|
|
48
|
+
name: name,
|
|
49
|
+
color: labelColor,
|
|
50
|
+
optional: optional,
|
|
51
|
+
columnSpan: labelSpan,
|
|
52
|
+
desktopColumnSpan: desktopLabelSpan
|
|
52
53
|
// {...otherProps}
|
|
53
|
-
}, label
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
}, label), /*#__PURE__*/React.createElement(_common2.InputWrapper, {
|
|
55
|
+
id: id,
|
|
56
|
+
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
57
|
+
style: style,
|
|
58
|
+
columnSpan: inputSpan,
|
|
59
|
+
desktopColumnSpan: desktopInputSpan
|
|
60
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
57
61
|
className: ['choices', spaceBetween && 'space-between'].filter(Boolean).join(' ')
|
|
58
62
|
}, options.map(choice => /*#__PURE__*/React.createElement(_common.Choice, _extends({
|
|
59
|
-
|
|
63
|
+
className: `x-${color}`,
|
|
60
64
|
key: choice.value,
|
|
61
65
|
name: name,
|
|
62
66
|
id: `${name}-${choice.value}`,
|
|
@@ -64,10 +68,10 @@ const ChoicesInput = _ref => {
|
|
|
64
68
|
validate: validate,
|
|
65
69
|
disabled: disabled
|
|
66
70
|
}, otherProps, choice)))), /*#__PURE__*/React.createElement(_common2.FormDescription, {
|
|
67
|
-
className: "
|
|
71
|
+
className: "s-1",
|
|
68
72
|
description: description,
|
|
69
73
|
name: name
|
|
70
|
-
}));
|
|
74
|
+
})));
|
|
71
75
|
};
|
|
72
76
|
ChoicesInput.propTypes = {
|
|
73
77
|
/**
|
|
@@ -132,11 +136,29 @@ ChoicesInput.propTypes = {
|
|
|
132
136
|
/**
|
|
133
137
|
* The select input description
|
|
134
138
|
*/
|
|
135
|
-
description: _propTypes.default.string
|
|
139
|
+
description: _propTypes.default.string,
|
|
140
|
+
/**
|
|
141
|
+
* The number of columns the label should span
|
|
142
|
+
*/
|
|
143
|
+
labelSpan: _propTypes.default.number,
|
|
144
|
+
/**
|
|
145
|
+
* The number of columns the input should span
|
|
146
|
+
*/
|
|
147
|
+
inputSpan: _propTypes.default.number,
|
|
148
|
+
/**
|
|
149
|
+
* The number of columns the label should span on desktop
|
|
150
|
+
*/
|
|
151
|
+
desktopLabelSpan: _propTypes.default.number,
|
|
152
|
+
/**
|
|
153
|
+
* The number of columns the input should span on desktop
|
|
154
|
+
*/
|
|
155
|
+
desktopInputSpan: _propTypes.default.number,
|
|
156
|
+
/**
|
|
157
|
+
* The color of the label
|
|
158
|
+
*/
|
|
159
|
+
labelColor: _propTypes.default.string
|
|
136
160
|
};
|
|
137
161
|
ChoicesInput.defaultProps = {
|
|
138
|
-
gridColumnsMobile: 2,
|
|
139
|
-
gridColumnsDesktop: 3,
|
|
140
162
|
color: 'interactive',
|
|
141
163
|
disabled: false
|
|
142
164
|
};
|
|
@@ -51,7 +51,7 @@ const Choice = _ref => {
|
|
|
51
51
|
disabled: disabled
|
|
52
52
|
})), /*#__PURE__*/React.createElement("label", {
|
|
53
53
|
htmlFor: id,
|
|
54
|
-
className: labelClassName,
|
|
54
|
+
className: [labelClassName, disabled && 'disabled'].filter(e => e).join(' '),
|
|
55
55
|
style: labelStyle
|
|
56
56
|
}, label));
|
|
57
57
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
/* stylelint-disable selector-max-compound-selectors -- exception */
|
|
3
|
+
/* stylelint-disable max-nesting-depth -- exception */
|
|
3
4
|
|
|
4
5
|
@use "@pareto-engineering/bem";
|
|
5
6
|
@use "@pareto-engineering/styles/src/mixins";
|
|
@@ -9,52 +10,66 @@ $default-flex-separator:calc(1em / 2) calc(.75em / 2);
|
|
|
9
10
|
$default-transition:var(--theme-default-transition);
|
|
10
11
|
$default-label-padding: .3em 1em calc(2em - .3em);
|
|
11
12
|
$default-label-height: .5em;
|
|
13
|
+
$default-input-border-radius: var(--theme-default-input-border-radius);
|
|
14
|
+
$default-border: var(--theme-default-input-border);
|
|
15
|
+
$hover-border: var(--theme-hover-input-border);
|
|
16
|
+
$focus-border: var(--theme-focus-input-border);
|
|
17
|
+
$default-background: var(--theme-default-input-background);
|
|
18
|
+
$disabled-background: var(--theme-disabled-input-background);
|
|
12
19
|
|
|
13
20
|
.#{bem.$base}.choices-input {
|
|
14
|
-
|
|
21
|
+
&.#{bem.$base}.input-wrapper {
|
|
15
22
|
display: flex;
|
|
16
|
-
flex-
|
|
17
|
-
gap: $default-flex-separator;
|
|
23
|
+
flex-direction: column;
|
|
18
24
|
|
|
19
|
-
|
|
20
|
-
justify-content: space-between;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
>.choice {
|
|
25
|
+
> .choices {
|
|
24
26
|
display: flex;
|
|
27
|
+
flex-wrap: wrap;
|
|
28
|
+
gap: $default-flex-separator;
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
position: absolute;
|
|
29
|
-
visibility: none;
|
|
30
|
-
z-index: -1;
|
|
30
|
+
&.space-between {
|
|
31
|
+
justify-content: space-between;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
34
|
+
>.choice {
|
|
35
|
+
display: flex;
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
display: block;
|
|
43
|
-
height: $default-label-height;
|
|
44
|
-
max-width: 100%;
|
|
45
|
-
padding: $default-label-padding;
|
|
46
|
-
position: relative;
|
|
47
|
-
transition: $default-transition;
|
|
48
|
-
white-space: nowrap;
|
|
49
|
-
|
|
50
|
-
&:hover {
|
|
51
|
-
box-shadow: var(--theme-default-input-box-shadow);
|
|
37
|
+
input {
|
|
38
|
+
opacity: 0;
|
|
39
|
+
position: absolute;
|
|
40
|
+
visibility: none;
|
|
41
|
+
z-index: -1;
|
|
52
42
|
}
|
|
53
|
-
}
|
|
54
43
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
44
|
+
input:disabled + label {
|
|
45
|
+
background-color: $disabled-background;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
> label {
|
|
49
|
+
background-color: $default-background;
|
|
50
|
+
border: $default-border;
|
|
51
|
+
border-radius: $default-input-border-radius;
|
|
52
|
+
color: var(--paragraph);
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
display: block;
|
|
55
|
+
height: $default-label-height;
|
|
56
|
+
max-width: 100%;
|
|
57
|
+
padding: $default-label-padding;
|
|
58
|
+
position: relative;
|
|
59
|
+
transition: $default-transition;
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
|
|
62
|
+
&:not(.disabled) {
|
|
63
|
+
&:hover {
|
|
64
|
+
border: $hover-border;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
input:checked + label {
|
|
70
|
+
background: var(--x);
|
|
71
|
+
color: var(--on-x);
|
|
72
|
+
}
|
|
58
73
|
}
|
|
59
74
|
}
|
|
60
75
|
}
|
|
@@ -25,6 +25,10 @@ const QueryChoices = _ref => {
|
|
|
25
25
|
validate,
|
|
26
26
|
loadingOption,
|
|
27
27
|
extraVariables,
|
|
28
|
+
labelSpan,
|
|
29
|
+
desktopLabelSpan,
|
|
30
|
+
inputSpan,
|
|
31
|
+
desktopInputSpan,
|
|
28
32
|
...otherProps
|
|
29
33
|
} = _ref;
|
|
30
34
|
const [,, helpers] = (0, _formik.useField)({
|
|
@@ -80,7 +84,11 @@ const QueryChoices = _ref => {
|
|
|
80
84
|
return /*#__PURE__*/React.createElement(_ChoicesInput.ChoicesInput, _extends({
|
|
81
85
|
name: name,
|
|
82
86
|
validate: validate,
|
|
83
|
-
options: options
|
|
87
|
+
options: options,
|
|
88
|
+
labelSpan: labelSpan,
|
|
89
|
+
desktopLabelSpan: desktopLabelSpan,
|
|
90
|
+
inputSpan: inputSpan,
|
|
91
|
+
desktopInputSpan: desktopInputSpan
|
|
84
92
|
}, otherProps));
|
|
85
93
|
};
|
|
86
94
|
QueryChoices.propTypes = {
|
|
@@ -124,7 +132,23 @@ QueryChoices.propTypes = {
|
|
|
124
132
|
* The extra variables that might be required to be used in the query to fetch
|
|
125
133
|
* select options.
|
|
126
134
|
*/
|
|
127
|
-
extraVariables: _propTypes.default.objectOf(_propTypes.default.string)
|
|
135
|
+
extraVariables: _propTypes.default.objectOf(_propTypes.default.string),
|
|
136
|
+
/**
|
|
137
|
+
* The number of columns the label should span
|
|
138
|
+
*/
|
|
139
|
+
labelSpan: _propTypes.default.number,
|
|
140
|
+
/**
|
|
141
|
+
* The number of columns the input should span
|
|
142
|
+
*/
|
|
143
|
+
inputSpan: _propTypes.default.number,
|
|
144
|
+
/**
|
|
145
|
+
* The number of columns the label should span on desktop
|
|
146
|
+
*/
|
|
147
|
+
desktopLabelSpan: _propTypes.default.number,
|
|
148
|
+
/**
|
|
149
|
+
* The number of columns the input should span on desktop
|
|
150
|
+
*/
|
|
151
|
+
desktopInputSpan: _propTypes.default.number
|
|
128
152
|
};
|
|
129
153
|
QueryChoices.defaultProps = {
|
|
130
154
|
loadingOption: {
|
|
@@ -24,6 +24,7 @@ const QueryCombobox = _ref => {
|
|
|
24
24
|
multiple,
|
|
25
25
|
name,
|
|
26
26
|
label,
|
|
27
|
+
labelColor,
|
|
27
28
|
color,
|
|
28
29
|
optional,
|
|
29
30
|
description,
|
|
@@ -34,7 +35,11 @@ const QueryCombobox = _ref => {
|
|
|
34
35
|
optionsKeyMap,
|
|
35
36
|
minLength,
|
|
36
37
|
transformSearch,
|
|
37
|
-
validate
|
|
38
|
+
validate,
|
|
39
|
+
labelSpan,
|
|
40
|
+
desktopLabelSpan,
|
|
41
|
+
inputSpan,
|
|
42
|
+
desktopInputSpan
|
|
38
43
|
// ...otherProps
|
|
39
44
|
} = _ref;
|
|
40
45
|
(0, React.useInsertionEffect)(() => {
|
|
@@ -102,6 +107,7 @@ const QueryCombobox = _ref => {
|
|
|
102
107
|
disabled,
|
|
103
108
|
name,
|
|
104
109
|
label,
|
|
110
|
+
labelColor,
|
|
105
111
|
optional,
|
|
106
112
|
description,
|
|
107
113
|
setValue,
|
|
@@ -110,7 +116,11 @@ const QueryCombobox = _ref => {
|
|
|
110
116
|
isFetching,
|
|
111
117
|
className,
|
|
112
118
|
minLength,
|
|
113
|
-
transformSearch
|
|
119
|
+
transformSearch,
|
|
120
|
+
labelSpan,
|
|
121
|
+
desktopLabelSpan,
|
|
122
|
+
inputSpan,
|
|
123
|
+
desktopInputSpan
|
|
114
124
|
};
|
|
115
125
|
const Input = multiple ? _common.MultipleCombobox : _common.Combobox;
|
|
116
126
|
return /*#__PURE__*/React.createElement(Input, comboboxProps);
|
|
@@ -136,6 +146,10 @@ QueryCombobox.propTypes = {
|
|
|
136
146
|
* The label of the custom select input
|
|
137
147
|
*/
|
|
138
148
|
label: _propTypes.default.string,
|
|
149
|
+
/**
|
|
150
|
+
* The label color of the custom select input
|
|
151
|
+
*/
|
|
152
|
+
labelColor: _propTypes.default.string,
|
|
139
153
|
/**
|
|
140
154
|
* The custom select input description
|
|
141
155
|
*/
|
|
@@ -145,7 +159,7 @@ QueryCombobox.propTypes = {
|
|
|
145
159
|
*/
|
|
146
160
|
disabled: _propTypes.default.bool,
|
|
147
161
|
/**
|
|
148
|
-
* The base color of the
|
|
162
|
+
* The base color of the tiles
|
|
149
163
|
*/
|
|
150
164
|
color: _propTypes.default.string,
|
|
151
165
|
/**
|
|
@@ -194,7 +208,23 @@ QueryCombobox.propTypes = {
|
|
|
194
208
|
/*
|
|
195
209
|
* Whether the input is optional or not
|
|
196
210
|
*/
|
|
197
|
-
optional: _propTypes.default.bool
|
|
211
|
+
optional: _propTypes.default.bool,
|
|
212
|
+
/**
|
|
213
|
+
* The number of columns the label should span
|
|
214
|
+
*/
|
|
215
|
+
labelSpan: _propTypes.default.number,
|
|
216
|
+
/**
|
|
217
|
+
* The number of columns the input should span
|
|
218
|
+
*/
|
|
219
|
+
inputSpan: _propTypes.default.number,
|
|
220
|
+
/**
|
|
221
|
+
* The number of columns the label should span on desktop
|
|
222
|
+
*/
|
|
223
|
+
desktopLabelSpan: _propTypes.default.number,
|
|
224
|
+
/**
|
|
225
|
+
* The number of columns the input should span on desktop
|
|
226
|
+
*/
|
|
227
|
+
desktopInputSpan: _propTypes.default.number
|
|
198
228
|
};
|
|
199
229
|
QueryCombobox.defaultProps = {
|
|
200
230
|
optionsKeyMap: {
|
|
@@ -202,7 +232,7 @@ QueryCombobox.defaultProps = {
|
|
|
202
232
|
getLabel: node => node.name
|
|
203
233
|
},
|
|
204
234
|
multiple: false,
|
|
205
|
-
color: '
|
|
235
|
+
color: 'interactive',
|
|
206
236
|
searchVariable: 'search',
|
|
207
237
|
transformSearch: search => search,
|
|
208
238
|
minLength: 2,
|