@pareto-engineering/design-system 4.0.0-alpha.34 → 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 +3 -3
- 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
|
@@ -20,7 +20,9 @@ const Label = ({
|
|
|
20
20
|
name,
|
|
21
21
|
color,
|
|
22
22
|
optional,
|
|
23
|
-
as: Wrapper
|
|
23
|
+
as: Wrapper,
|
|
24
|
+
columnSpan,
|
|
25
|
+
desktopColumnSpan
|
|
24
26
|
// ...otherProps
|
|
25
27
|
}) => {
|
|
26
28
|
useInsertionEffect(() => {
|
|
@@ -30,7 +32,11 @@ const Label = ({
|
|
|
30
32
|
htmlFor: Wrapper === 'label' ? name : undefined,
|
|
31
33
|
id: id,
|
|
32
34
|
className: [baseClassName, componentClassName, userClassName, `x-${color}`].filter(e => e).join(' '),
|
|
33
|
-
style:
|
|
35
|
+
style: {
|
|
36
|
+
...style,
|
|
37
|
+
'--column-span': columnSpan || 'var(--columns)',
|
|
38
|
+
'--column-span-md': desktopColumnSpan || 'var(--columns)'
|
|
39
|
+
}
|
|
34
40
|
// {...otherProps}
|
|
35
41
|
}, children, optional && ' (Optional)');
|
|
36
42
|
};
|
|
@@ -66,11 +72,19 @@ Label.propTypes = {
|
|
|
66
72
|
/**
|
|
67
73
|
* Whether the input should have an optional tag
|
|
68
74
|
*/
|
|
69
|
-
optional: PropTypes.bool
|
|
75
|
+
optional: PropTypes.bool,
|
|
76
|
+
/**
|
|
77
|
+
* How many columns the input should span
|
|
78
|
+
*/
|
|
79
|
+
columnSpan: PropTypes.number,
|
|
80
|
+
/**
|
|
81
|
+
* How many columns the input should span on desktop
|
|
82
|
+
*/
|
|
83
|
+
desktopColumnSpan: PropTypes.number
|
|
70
84
|
};
|
|
71
85
|
Label.defaultProps = {
|
|
72
86
|
as: 'label',
|
|
73
|
-
color: '
|
|
87
|
+
color: 'paragraph',
|
|
74
88
|
optional: false
|
|
75
89
|
};
|
|
76
90
|
export 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
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { Label as FormLabel } from "./Label";
|
|
2
2
|
export { Description as FormDescription } from "./Description";
|
|
3
|
-
export { Debugger as FormDebugger } from "./Debugger";
|
|
3
|
+
export { Debugger as FormDebugger } from "./Debugger";
|
|
4
|
+
export { InputWrapper } from "./InputWrapper";
|
|
@@ -5,7 +5,7 @@ import { useInsertionEffect } from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import styleNames from '@pareto-engineering/bem/exports';
|
|
7
7
|
import { useField } from 'formik';
|
|
8
|
-
import { FormLabel, FormDescription } from "../../common";
|
|
8
|
+
import { FormLabel, FormDescription, InputWrapper } from "../../common";
|
|
9
9
|
|
|
10
10
|
// Local Definitions
|
|
11
11
|
|
|
@@ -23,7 +23,12 @@ const Checkbox = ({
|
|
|
23
23
|
label,
|
|
24
24
|
description,
|
|
25
25
|
disabled,
|
|
26
|
-
optional
|
|
26
|
+
optional,
|
|
27
|
+
labelColor,
|
|
28
|
+
labelSpan,
|
|
29
|
+
desktopLabelSpan,
|
|
30
|
+
inputSpan,
|
|
31
|
+
desktopInputSpan
|
|
27
32
|
// ...otherProps
|
|
28
33
|
}) => {
|
|
29
34
|
useInsertionEffect(() => {
|
|
@@ -33,24 +38,29 @@ const Checkbox = ({
|
|
|
33
38
|
name,
|
|
34
39
|
type: 'checkbox'
|
|
35
40
|
});
|
|
36
|
-
return /*#__PURE__*/React.createElement(
|
|
41
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement(FormLabel, {
|
|
42
|
+
name: name,
|
|
43
|
+
color: labelColor,
|
|
44
|
+
optional: optional,
|
|
45
|
+
columnSpan: labelSpan,
|
|
46
|
+
desktopColumnSpan: desktopLabelSpan
|
|
47
|
+
// {...otherProps}
|
|
48
|
+
}, label), /*#__PURE__*/React.createElement(InputWrapper, {
|
|
37
49
|
id: id,
|
|
38
50
|
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
39
|
-
style: style
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
optional: optional
|
|
44
|
-
}, label), /*#__PURE__*/React.createElement("input", _extends({
|
|
51
|
+
style: style,
|
|
52
|
+
columnSpan: inputSpan,
|
|
53
|
+
desktopColumnSpan: desktopInputSpan
|
|
54
|
+
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
45
55
|
id: name,
|
|
46
56
|
className: "input",
|
|
47
57
|
type: "checkbox",
|
|
48
58
|
disabled: disabled
|
|
49
59
|
}, field)), /*#__PURE__*/React.createElement(FormDescription, {
|
|
50
|
-
className: "
|
|
60
|
+
className: "s-1",
|
|
51
61
|
description: description,
|
|
52
62
|
name: name
|
|
53
|
-
}));
|
|
63
|
+
})));
|
|
54
64
|
};
|
|
55
65
|
Checkbox.propTypes = {
|
|
56
66
|
/**
|
|
@@ -77,10 +87,30 @@ Checkbox.propTypes = {
|
|
|
77
87
|
* Whether the input should be disabled
|
|
78
88
|
*/
|
|
79
89
|
disabled: PropTypes.bool,
|
|
90
|
+
/**
|
|
91
|
+
* The color of the label
|
|
92
|
+
*/
|
|
93
|
+
labelColor: PropTypes.string,
|
|
80
94
|
/**
|
|
81
95
|
* The input label
|
|
82
96
|
*/
|
|
83
97
|
label: PropTypes.string,
|
|
98
|
+
/**
|
|
99
|
+
* The number of columns the label should span
|
|
100
|
+
*/
|
|
101
|
+
labelSpan: PropTypes.number,
|
|
102
|
+
/**
|
|
103
|
+
* The number of columns the input should span
|
|
104
|
+
*/
|
|
105
|
+
inputSpan: PropTypes.number,
|
|
106
|
+
/**
|
|
107
|
+
* The number of columns the label should span on desktop
|
|
108
|
+
*/
|
|
109
|
+
desktopLabelSpan: PropTypes.number,
|
|
110
|
+
/**
|
|
111
|
+
* The number of columns the input should span on desktop
|
|
112
|
+
*/
|
|
113
|
+
desktopInputSpan: PropTypes.number,
|
|
84
114
|
/**
|
|
85
115
|
* Whether the input should have an optional tag
|
|
86
116
|
*/
|
|
@@ -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
|
}
|
|
@@ -8,7 +8,7 @@ import styleNames from '@pareto-engineering/bem/exports';
|
|
|
8
8
|
// Local Definitions
|
|
9
9
|
|
|
10
10
|
import { Choice } from "./common";
|
|
11
|
-
import { FormDescription, FormLabel } from "../../common";
|
|
11
|
+
import { FormDescription, FormLabel, InputWrapper } from "../../common";
|
|
12
12
|
const baseClassName = styleNames.base;
|
|
13
13
|
const componentClassName = 'choices-input';
|
|
14
14
|
|
|
@@ -23,35 +23,39 @@ const ChoicesInput = ({
|
|
|
23
23
|
validate,
|
|
24
24
|
options,
|
|
25
25
|
multiple,
|
|
26
|
-
gridColumnsMobile,
|
|
27
|
-
gridColumnsDesktop,
|
|
28
26
|
color,
|
|
29
27
|
label,
|
|
28
|
+
labelColor,
|
|
30
29
|
optional,
|
|
31
30
|
disabled,
|
|
32
31
|
description,
|
|
33
32
|
spaceBetween,
|
|
33
|
+
labelSpan,
|
|
34
|
+
desktopLabelSpan,
|
|
35
|
+
inputSpan,
|
|
36
|
+
desktopInputSpan,
|
|
34
37
|
...otherProps
|
|
35
38
|
}) => {
|
|
36
39
|
useInsertionEffect(() => {
|
|
37
40
|
import("./styles.scss");
|
|
38
41
|
}, []);
|
|
39
|
-
return /*#__PURE__*/React.createElement(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
...style
|
|
46
|
-
}
|
|
42
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement(FormLabel, {
|
|
43
|
+
name: name,
|
|
44
|
+
color: labelColor,
|
|
45
|
+
optional: optional,
|
|
46
|
+
columnSpan: labelSpan,
|
|
47
|
+
desktopColumnSpan: desktopLabelSpan
|
|
47
48
|
// {...otherProps}
|
|
48
|
-
}, label
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
}, label), /*#__PURE__*/React.createElement(InputWrapper, {
|
|
50
|
+
id: id,
|
|
51
|
+
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
52
|
+
style: style,
|
|
53
|
+
columnSpan: inputSpan,
|
|
54
|
+
desktopColumnSpan: desktopInputSpan
|
|
55
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
52
56
|
className: ['choices', spaceBetween && 'space-between'].filter(Boolean).join(' ')
|
|
53
57
|
}, options.map(choice => /*#__PURE__*/React.createElement(Choice, _extends({
|
|
54
|
-
|
|
58
|
+
className: `x-${color}`,
|
|
55
59
|
key: choice.value,
|
|
56
60
|
name: name,
|
|
57
61
|
id: `${name}-${choice.value}`,
|
|
@@ -59,10 +63,10 @@ const ChoicesInput = ({
|
|
|
59
63
|
validate: validate,
|
|
60
64
|
disabled: disabled
|
|
61
65
|
}, otherProps, choice)))), /*#__PURE__*/React.createElement(FormDescription, {
|
|
62
|
-
className: "
|
|
66
|
+
className: "s-1",
|
|
63
67
|
description: description,
|
|
64
68
|
name: name
|
|
65
|
-
}));
|
|
69
|
+
})));
|
|
66
70
|
};
|
|
67
71
|
ChoicesInput.propTypes = {
|
|
68
72
|
/**
|
|
@@ -127,11 +131,29 @@ ChoicesInput.propTypes = {
|
|
|
127
131
|
/**
|
|
128
132
|
* The select input description
|
|
129
133
|
*/
|
|
130
|
-
description: PropTypes.string
|
|
134
|
+
description: PropTypes.string,
|
|
135
|
+
/**
|
|
136
|
+
* The number of columns the label should span
|
|
137
|
+
*/
|
|
138
|
+
labelSpan: PropTypes.number,
|
|
139
|
+
/**
|
|
140
|
+
* The number of columns the input should span
|
|
141
|
+
*/
|
|
142
|
+
inputSpan: PropTypes.number,
|
|
143
|
+
/**
|
|
144
|
+
* The number of columns the label should span on desktop
|
|
145
|
+
*/
|
|
146
|
+
desktopLabelSpan: PropTypes.number,
|
|
147
|
+
/**
|
|
148
|
+
* The number of columns the input should span on desktop
|
|
149
|
+
*/
|
|
150
|
+
desktopInputSpan: PropTypes.number,
|
|
151
|
+
/**
|
|
152
|
+
* The color of the label
|
|
153
|
+
*/
|
|
154
|
+
labelColor: PropTypes.string
|
|
131
155
|
};
|
|
132
156
|
ChoicesInput.defaultProps = {
|
|
133
|
-
gridColumnsMobile: 2,
|
|
134
|
-
gridColumnsDesktop: 3,
|
|
135
157
|
color: 'interactive',
|
|
136
158
|
disabled: false
|
|
137
159
|
};
|
|
@@ -44,7 +44,7 @@ const Choice = ({
|
|
|
44
44
|
disabled: disabled
|
|
45
45
|
})), /*#__PURE__*/React.createElement("label", {
|
|
46
46
|
htmlFor: id,
|
|
47
|
-
className: labelClassName,
|
|
47
|
+
className: [labelClassName, disabled && 'disabled'].filter(e => e).join(' '),
|
|
48
48
|
style: labelStyle
|
|
49
49
|
}, label));
|
|
50
50
|
};
|
|
@@ -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
|
}
|
|
@@ -18,6 +18,10 @@ const QueryChoices = ({
|
|
|
18
18
|
validate,
|
|
19
19
|
loadingOption,
|
|
20
20
|
extraVariables,
|
|
21
|
+
labelSpan,
|
|
22
|
+
desktopLabelSpan,
|
|
23
|
+
inputSpan,
|
|
24
|
+
desktopInputSpan,
|
|
21
25
|
...otherProps
|
|
22
26
|
}) => {
|
|
23
27
|
const [,, helpers] = useField({
|
|
@@ -70,7 +74,11 @@ const QueryChoices = ({
|
|
|
70
74
|
return /*#__PURE__*/React.createElement(ChoicesInput, _extends({
|
|
71
75
|
name: name,
|
|
72
76
|
validate: validate,
|
|
73
|
-
options: options
|
|
77
|
+
options: options,
|
|
78
|
+
labelSpan: labelSpan,
|
|
79
|
+
desktopLabelSpan: desktopLabelSpan,
|
|
80
|
+
inputSpan: inputSpan,
|
|
81
|
+
desktopInputSpan: desktopInputSpan
|
|
74
82
|
}, otherProps));
|
|
75
83
|
};
|
|
76
84
|
QueryChoices.propTypes = {
|
|
@@ -114,7 +122,23 @@ QueryChoices.propTypes = {
|
|
|
114
122
|
* The extra variables that might be required to be used in the query to fetch
|
|
115
123
|
* select options.
|
|
116
124
|
*/
|
|
117
|
-
extraVariables: PropTypes.objectOf(PropTypes.string)
|
|
125
|
+
extraVariables: PropTypes.objectOf(PropTypes.string),
|
|
126
|
+
/**
|
|
127
|
+
* The number of columns the label should span
|
|
128
|
+
*/
|
|
129
|
+
labelSpan: PropTypes.number,
|
|
130
|
+
/**
|
|
131
|
+
* The number of columns the input should span
|
|
132
|
+
*/
|
|
133
|
+
inputSpan: PropTypes.number,
|
|
134
|
+
/**
|
|
135
|
+
* The number of columns the label should span on desktop
|
|
136
|
+
*/
|
|
137
|
+
desktopLabelSpan: PropTypes.number,
|
|
138
|
+
/**
|
|
139
|
+
* The number of columns the input should span on desktop
|
|
140
|
+
*/
|
|
141
|
+
desktopInputSpan: PropTypes.number
|
|
118
142
|
};
|
|
119
143
|
QueryChoices.defaultProps = {
|
|
120
144
|
loadingOption: {
|
|
@@ -20,6 +20,7 @@ const QueryCombobox = ({
|
|
|
20
20
|
multiple,
|
|
21
21
|
name,
|
|
22
22
|
label,
|
|
23
|
+
labelColor,
|
|
23
24
|
color,
|
|
24
25
|
optional,
|
|
25
26
|
description,
|
|
@@ -30,7 +31,11 @@ const QueryCombobox = ({
|
|
|
30
31
|
optionsKeyMap,
|
|
31
32
|
minLength,
|
|
32
33
|
transformSearch,
|
|
33
|
-
validate
|
|
34
|
+
validate,
|
|
35
|
+
labelSpan,
|
|
36
|
+
desktopLabelSpan,
|
|
37
|
+
inputSpan,
|
|
38
|
+
desktopInputSpan
|
|
34
39
|
// ...otherProps
|
|
35
40
|
}) => {
|
|
36
41
|
useInsertionEffect(() => {
|
|
@@ -95,6 +100,7 @@ const QueryCombobox = ({
|
|
|
95
100
|
disabled,
|
|
96
101
|
name,
|
|
97
102
|
label,
|
|
103
|
+
labelColor,
|
|
98
104
|
optional,
|
|
99
105
|
description,
|
|
100
106
|
setValue,
|
|
@@ -103,7 +109,11 @@ const QueryCombobox = ({
|
|
|
103
109
|
isFetching,
|
|
104
110
|
className,
|
|
105
111
|
minLength,
|
|
106
|
-
transformSearch
|
|
112
|
+
transformSearch,
|
|
113
|
+
labelSpan,
|
|
114
|
+
desktopLabelSpan,
|
|
115
|
+
inputSpan,
|
|
116
|
+
desktopInputSpan
|
|
107
117
|
};
|
|
108
118
|
const Input = multiple ? MultipleCombobox : Combobox;
|
|
109
119
|
return /*#__PURE__*/React.createElement(Input, comboboxProps);
|
|
@@ -129,6 +139,10 @@ QueryCombobox.propTypes = {
|
|
|
129
139
|
* The label of the custom select input
|
|
130
140
|
*/
|
|
131
141
|
label: PropTypes.string,
|
|
142
|
+
/**
|
|
143
|
+
* The label color of the custom select input
|
|
144
|
+
*/
|
|
145
|
+
labelColor: PropTypes.string,
|
|
132
146
|
/**
|
|
133
147
|
* The custom select input description
|
|
134
148
|
*/
|
|
@@ -138,7 +152,7 @@ QueryCombobox.propTypes = {
|
|
|
138
152
|
*/
|
|
139
153
|
disabled: PropTypes.bool,
|
|
140
154
|
/**
|
|
141
|
-
* The base color of the
|
|
155
|
+
* The base color of the tiles
|
|
142
156
|
*/
|
|
143
157
|
color: PropTypes.string,
|
|
144
158
|
/**
|
|
@@ -187,7 +201,23 @@ QueryCombobox.propTypes = {
|
|
|
187
201
|
/*
|
|
188
202
|
* Whether the input is optional or not
|
|
189
203
|
*/
|
|
190
|
-
optional: PropTypes.bool
|
|
204
|
+
optional: PropTypes.bool,
|
|
205
|
+
/**
|
|
206
|
+
* The number of columns the label should span
|
|
207
|
+
*/
|
|
208
|
+
labelSpan: PropTypes.number,
|
|
209
|
+
/**
|
|
210
|
+
* The number of columns the input should span
|
|
211
|
+
*/
|
|
212
|
+
inputSpan: PropTypes.number,
|
|
213
|
+
/**
|
|
214
|
+
* The number of columns the label should span on desktop
|
|
215
|
+
*/
|
|
216
|
+
desktopLabelSpan: PropTypes.number,
|
|
217
|
+
/**
|
|
218
|
+
* The number of columns the input should span on desktop
|
|
219
|
+
*/
|
|
220
|
+
desktopInputSpan: PropTypes.number
|
|
191
221
|
};
|
|
192
222
|
QueryCombobox.defaultProps = {
|
|
193
223
|
optionsKeyMap: {
|
|
@@ -195,7 +225,7 @@ QueryCombobox.defaultProps = {
|
|
|
195
225
|
getLabel: node => node.name
|
|
196
226
|
},
|
|
197
227
|
multiple: false,
|
|
198
|
-
color: '
|
|
228
|
+
color: 'interactive',
|
|
199
229
|
searchVariable: 'search',
|
|
200
230
|
transformSearch: search => search,
|
|
201
231
|
minLength: 2,
|
|
@@ -8,6 +8,7 @@ import styleNames from '@pareto-engineering/bem/exports';
|
|
|
8
8
|
import { FormLabel, FormDescription } from "../../../..";
|
|
9
9
|
import { Popover, LoadingCircle } from "../../../../../a";
|
|
10
10
|
import { Button } from "../../../../../b";
|
|
11
|
+
import { InputWrapper } from "../../../../common";
|
|
11
12
|
|
|
12
13
|
// Local Definitions
|
|
13
14
|
|
|
@@ -23,6 +24,7 @@ const Combobox = ({
|
|
|
23
24
|
className: userClassName,
|
|
24
25
|
style,
|
|
25
26
|
label,
|
|
27
|
+
labelColor,
|
|
26
28
|
name,
|
|
27
29
|
options: items,
|
|
28
30
|
getOptions,
|
|
@@ -34,7 +36,11 @@ const Combobox = ({
|
|
|
34
36
|
isFetching,
|
|
35
37
|
transformSearch,
|
|
36
38
|
disabled,
|
|
37
|
-
optional
|
|
39
|
+
optional,
|
|
40
|
+
labelSpan,
|
|
41
|
+
desktopLabelSpan,
|
|
42
|
+
inputSpan,
|
|
43
|
+
desktopInputSpan
|
|
38
44
|
// ...otherProps
|
|
39
45
|
}) => {
|
|
40
46
|
const {
|
|
@@ -79,16 +85,20 @@ const Combobox = ({
|
|
|
79
85
|
}, [value]);
|
|
80
86
|
const parentRef = useRef(null);
|
|
81
87
|
const resetInputValue = () => setInputValue('');
|
|
82
|
-
return /*#__PURE__*/React.createElement(
|
|
88
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormLabel, _extends({}, getLabelProps(), {
|
|
89
|
+
name: name,
|
|
90
|
+
optional: optional,
|
|
91
|
+
color: labelColor,
|
|
92
|
+
columnSpan: labelSpan,
|
|
93
|
+
desktopColumnSpan: desktopLabelSpan
|
|
94
|
+
}), label), /*#__PURE__*/React.createElement(InputWrapper, _extends({
|
|
83
95
|
id: id,
|
|
84
|
-
className: [baseClassName, componentClassName, userClassName
|
|
96
|
+
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
85
97
|
style: style,
|
|
86
98
|
ref: parentRef
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}), label), /*#__PURE__*/React.createElement("div", _extends({}, getComboboxProps(), {
|
|
91
|
-
className: "input-wrapper"
|
|
99
|
+
}, getComboboxProps(), {
|
|
100
|
+
columnSpan: inputSpan,
|
|
101
|
+
desktopColumnSpan: desktopInputSpan
|
|
92
102
|
}), /*#__PURE__*/React.createElement("input", _extends({}, getInputProps(), {
|
|
93
103
|
className: "input",
|
|
94
104
|
disabled: disabled
|
|
@@ -101,19 +111,20 @@ const Combobox = ({
|
|
|
101
111
|
onClick: resetInputValue
|
|
102
112
|
}, /*#__PURE__*/React.createElement("span", {
|
|
103
113
|
className: "icon"
|
|
104
|
-
}, "Y"))
|
|
114
|
+
}, "Y")), /*#__PURE__*/React.createElement(FormDescription, {
|
|
115
|
+
className: "s-1",
|
|
116
|
+
description: description,
|
|
117
|
+
name: name
|
|
118
|
+
}), /*#__PURE__*/React.createElement(Popover, {
|
|
105
119
|
isOpen: isOpen,
|
|
106
120
|
parentRef: parentRef
|
|
107
121
|
}, /*#__PURE__*/React.createElement(Menu, _extends({
|
|
122
|
+
className: `y-${color}`,
|
|
108
123
|
isOpen: isOpen,
|
|
109
124
|
getItemProps: getItemProps,
|
|
110
125
|
highlightedIndex: highlightedIndex,
|
|
111
126
|
items: items
|
|
112
|
-
}, getMenuProps())))
|
|
113
|
-
className: "v50 mt-v s-1",
|
|
114
|
-
description: description,
|
|
115
|
-
name: name
|
|
116
|
-
}));
|
|
127
|
+
}, getMenuProps())))));
|
|
117
128
|
};
|
|
118
129
|
Combobox.propTypes = {
|
|
119
130
|
/**
|
|
@@ -183,6 +194,22 @@ Combobox.propTypes = {
|
|
|
183
194
|
*/
|
|
184
195
|
disabled: PropTypes.bool,
|
|
185
196
|
/**
|
|
197
|
+
* The number of columns the label should span
|
|
198
|
+
*/
|
|
199
|
+
labelSpan: PropTypes.number,
|
|
200
|
+
/**
|
|
201
|
+
* The number of columns the input should span
|
|
202
|
+
*/
|
|
203
|
+
inputSpan: PropTypes.number,
|
|
204
|
+
/**
|
|
205
|
+
* The number of columns the label should span on desktop
|
|
206
|
+
*/
|
|
207
|
+
desktopLabelSpan: PropTypes.number,
|
|
208
|
+
/**
|
|
209
|
+
* The number of columns the input should span on desktop
|
|
210
|
+
*/
|
|
211
|
+
desktopInputSpan: PropTypes.number,
|
|
212
|
+
/**
|
|
186
213
|
* Whether the input is optional or not
|
|
187
214
|
*/
|
|
188
215
|
optional: PropTypes.bool
|