@pareto-engineering/design-system 2.0.0-alpha.14 → 2.0.0-alpha.18
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/b/Button/styles.scss +27 -2
- package/dist/cjs/c/ContentSlides/common/Navigator/Navigator.js +4 -3
- package/dist/cjs/f/common/Debugger/Debugger.js +1 -1
- package/dist/cjs/f/common/Label/Label.js +1 -1
- package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +1 -1
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +25 -6
- package/dist/cjs/f/fields/SelectInput/styles.scss +4 -4
- package/dist/cjs/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
- package/dist/cjs/f/fields/TextInput/TextInput.js +19 -5
- package/dist/cjs/f/fields/TextInput/styles.scss +3 -7
- package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +13 -6
- package/dist/es/b/Button/styles.scss +27 -2
- package/dist/es/c/ContentSlides/common/Navigator/Navigator.js +4 -3
- package/dist/es/f/common/Debugger/Debugger.js +1 -1
- package/dist/es/f/common/Label/Label.js +1 -1
- package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +1 -1
- package/dist/es/f/fields/SelectInput/SelectInput.js +25 -6
- package/dist/es/f/fields/SelectInput/styles.scss +4 -4
- package/dist/es/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
- package/dist/es/f/fields/TextInput/TextInput.js +19 -5
- package/dist/es/f/fields/TextInput/styles.scss +3 -7
- package/dist/es/f/fields/TextareaInput/TextareaInput.js +13 -6
- package/package.json +1 -1
- package/src/__snapshots__/Storyshots.test.js.snap +284 -79
- package/src/stories/b/Button.stories.jsx +5 -4
- package/src/stories/f/SelectInput.stories.jsx +29 -0
- package/src/stories/f/TextInput.stories.jsx +10 -0
- package/src/stories/f/TextareaInput.stories.jsx +40 -4
- package/src/ui/b/Button/Button.jsx +2 -1
- package/src/ui/b/Button/styles.scss +27 -2
- package/src/ui/c/ContentSlides/common/Navigator/Navigator.jsx +3 -2
- package/src/ui/f/common/Debugger/Debugger.jsx +1 -1
- package/src/ui/f/common/Label/Label.jsx +1 -1
- package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +1 -1
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +35 -5
- package/src/ui/f/fields/SelectInput/styles.scss +4 -4
- package/src/ui/f/fields/TaskRecommendationInput/TaskRecommendationInput.jsx +1 -1
- package/src/ui/f/fields/TextInput/TextInput.jsx +15 -2
- package/src/ui/f/fields/TextInput/styles.scss +3 -7
- package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +21 -10
|
@@ -7,6 +7,7 @@ $compact-padding: .6em .6em .48em;
|
|
|
7
7
|
$default-color:primary;
|
|
8
8
|
$font-weight:bold;
|
|
9
9
|
$default-margin:.5em;
|
|
10
|
+
$default-animation-time: .3s;
|
|
10
11
|
|
|
11
12
|
.#{bem.$base}.button {
|
|
12
13
|
background: var(--x, var(--#{$default-color}));
|
|
@@ -14,8 +15,8 @@ $default-margin:.5em;
|
|
|
14
15
|
border-radius: var(--theme-border-radius);
|
|
15
16
|
color: var(--on-x, var(--on-#{$default-color}));
|
|
16
17
|
display: inline-flex;
|
|
17
|
-
font-weight: 600;
|
|
18
18
|
font-family: var(--theme-default-paragraph);
|
|
19
|
+
font-weight: 600;
|
|
19
20
|
justify-content: space-between;
|
|
20
21
|
padding: $default-padding;
|
|
21
22
|
transition: all .25s;
|
|
@@ -24,6 +25,14 @@ $default-margin:.5em;
|
|
|
24
25
|
&::after {
|
|
25
26
|
content: "-->";
|
|
26
27
|
margin-left: $default-margin;
|
|
28
|
+
vertical-align: middle;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&:hover {
|
|
32
|
+
&::after {
|
|
33
|
+
--final-position: 50%;
|
|
34
|
+
animation: animateArrow $default-animation-time forwards;
|
|
35
|
+
}
|
|
27
36
|
}
|
|
28
37
|
}
|
|
29
38
|
|
|
@@ -31,6 +40,14 @@ $default-margin:.5em;
|
|
|
31
40
|
&::before {
|
|
32
41
|
content: "<--";
|
|
33
42
|
margin-right: $default-margin;
|
|
43
|
+
vertical-align: middle;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&:hover {
|
|
47
|
+
&::before {
|
|
48
|
+
--final-position: -50%;
|
|
49
|
+
animation: animateArrow $default-animation-time forwards;
|
|
50
|
+
}
|
|
34
51
|
}
|
|
35
52
|
}
|
|
36
53
|
|
|
@@ -46,7 +63,6 @@ $default-margin:.5em;
|
|
|
46
63
|
}
|
|
47
64
|
}
|
|
48
65
|
|
|
49
|
-
|
|
50
66
|
&.#{bem.$modifier-compact} {
|
|
51
67
|
padding: $compact-padding;
|
|
52
68
|
}
|
|
@@ -114,3 +130,12 @@ $default-margin:.5em;
|
|
|
114
130
|
}
|
|
115
131
|
|
|
116
132
|
|
|
133
|
+
@keyframes animateArrow {
|
|
134
|
+
from {
|
|
135
|
+
transform: translateX(0);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
to {
|
|
139
|
+
transform: translateX(var(--final-position));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -74,7 +74,8 @@ var Navigator = _ref => {
|
|
|
74
74
|
} else {
|
|
75
75
|
setNextStepIndex(stepsForward);
|
|
76
76
|
}
|
|
77
|
-
}
|
|
77
|
+
},
|
|
78
|
+
isCompact: true
|
|
78
79
|
}, "Next") : /*#__PURE__*/React.createElement("span", null));
|
|
79
80
|
};
|
|
80
81
|
|
|
@@ -136,8 +137,8 @@ Navigator.propTypes = {
|
|
|
136
137
|
};
|
|
137
138
|
Navigator.defaultProps = {
|
|
138
139
|
canMoveForward: true,
|
|
139
|
-
previousColor: '
|
|
140
|
-
nextColor: '
|
|
140
|
+
previousColor: 'main2',
|
|
141
|
+
nextColor: 'main2',
|
|
141
142
|
stepsForward: 1,
|
|
142
143
|
stepsBackwards: 1
|
|
143
144
|
};
|
|
@@ -47,7 +47,7 @@ var Debugger = _ref => {
|
|
|
47
47
|
style: style
|
|
48
48
|
}, /*#__PURE__*/React.createElement(_b.Button, {
|
|
49
49
|
onClick: toggleDebugger,
|
|
50
|
-
color: "
|
|
50
|
+
color: "main2"
|
|
51
51
|
}, isOpen ? 'Close FormDebugger' : 'Open FormDebugger'), isOpen && /*#__PURE__*/React.createElement("pre", {
|
|
52
52
|
className: "debuger-content"
|
|
53
53
|
}, JSON.stringify(formikContext, null, 2)));
|
|
@@ -38,13 +38,18 @@ var SelectInput = _ref => {
|
|
|
38
38
|
name,
|
|
39
39
|
label,
|
|
40
40
|
options,
|
|
41
|
+
validate,
|
|
42
|
+
description,
|
|
41
43
|
disabled // ...otherProps
|
|
42
44
|
|
|
43
45
|
} = _ref;
|
|
44
46
|
(0, React.useLayoutEffect)(() => {
|
|
45
47
|
Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
|
|
46
48
|
}, []);
|
|
47
|
-
var [field, meta] = (0, _formik.useField)(
|
|
49
|
+
var [field, meta] = (0, _formik.useField)({
|
|
50
|
+
name,
|
|
51
|
+
validate
|
|
52
|
+
});
|
|
48
53
|
return /*#__PURE__*/React.createElement("div", {
|
|
49
54
|
id: id,
|
|
50
55
|
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
@@ -56,6 +61,7 @@ var SelectInput = _ref => {
|
|
|
56
61
|
}, label), /*#__PURE__*/React.createElement("select", _extends({
|
|
57
62
|
className: "input v25 pv-v"
|
|
58
63
|
}, field, {
|
|
64
|
+
value: field.value || '',
|
|
59
65
|
id: name,
|
|
60
66
|
disabled: disabled
|
|
61
67
|
}), options.map(option => {
|
|
@@ -66,11 +72,13 @@ var SelectInput = _ref => {
|
|
|
66
72
|
} : option;
|
|
67
73
|
return /*#__PURE__*/React.createElement("option", {
|
|
68
74
|
key: newOption.value,
|
|
69
|
-
value: newOption.value
|
|
75
|
+
value: newOption.value,
|
|
76
|
+
disabled: (newOption === null || newOption === void 0 ? void 0 : newOption.disabled) || false
|
|
70
77
|
}, newOption.label);
|
|
71
|
-
})), meta.
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
})), (description || meta.touched && meta.error) && /*#__PURE__*/React.createElement(_common.FormDescription, {
|
|
79
|
+
isError: !!meta.error,
|
|
80
|
+
className: "v50 mt-v s-1"
|
|
81
|
+
}, meta.error || description));
|
|
74
82
|
};
|
|
75
83
|
|
|
76
84
|
SelectInput.propTypes = {
|
|
@@ -99,12 +107,23 @@ SelectInput.propTypes = {
|
|
|
99
107
|
*/
|
|
100
108
|
label: _propTypes.default.string,
|
|
101
109
|
|
|
110
|
+
/**
|
|
111
|
+
* The input field validator function
|
|
112
|
+
*/
|
|
113
|
+
validate: _propTypes.default.func,
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The select input description
|
|
117
|
+
*/
|
|
118
|
+
description: _propTypes.default.string,
|
|
119
|
+
|
|
102
120
|
/**
|
|
103
121
|
* The options of the select input
|
|
104
122
|
*/
|
|
105
123
|
options: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.shape({
|
|
106
124
|
value: _propTypes.default.string,
|
|
107
|
-
label: _propTypes.default.string
|
|
125
|
+
label: _propTypes.default.string,
|
|
126
|
+
disabled: _propTypes.default.bool
|
|
108
127
|
})])),
|
|
109
128
|
|
|
110
129
|
/**
|
|
@@ -14,16 +14,16 @@ $default-padding: 0.75em 0.75em 0.55em;
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
.input-label {
|
|
17
|
-
color: var(--
|
|
17
|
+
color: var(--main2);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.input {
|
|
21
|
-
background: var(--light-
|
|
22
|
-
color: var(--on-
|
|
21
|
+
background: var(--light-background2);
|
|
22
|
+
color: var(--on-background2);
|
|
23
23
|
padding: $default-padding;
|
|
24
24
|
|
|
25
25
|
&:focus {
|
|
26
|
-
background: var(--dark-
|
|
26
|
+
background: var(--dark-background2);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -123,7 +123,7 @@ TaskRecommendationInput.propTypes = {
|
|
|
123
123
|
image: _propTypes.default.string.isRequired
|
|
124
124
|
};
|
|
125
125
|
TaskRecommendationInput.defaultProps = {
|
|
126
|
-
color: '
|
|
126
|
+
color: 'main2'
|
|
127
127
|
};
|
|
128
128
|
|
|
129
129
|
var _default = /*#__PURE__*/(0, React.memo)(TaskRecommendationInput);
|
|
@@ -38,10 +38,12 @@ var TextInput = _ref => {
|
|
|
38
38
|
type,
|
|
39
39
|
name,
|
|
40
40
|
label,
|
|
41
|
+
labelColor,
|
|
41
42
|
validate,
|
|
42
43
|
oneInputLabel,
|
|
43
44
|
description,
|
|
44
|
-
disabled
|
|
45
|
+
disabled,
|
|
46
|
+
placeholder // ...otherProps
|
|
45
47
|
|
|
46
48
|
} = _ref;
|
|
47
49
|
(0, React.useLayoutEffect)(() => {
|
|
@@ -57,13 +59,15 @@ var TextInput = _ref => {
|
|
|
57
59
|
style: style // {...otherProps}
|
|
58
60
|
|
|
59
61
|
}, /*#__PURE__*/React.createElement(_common.FormLabel, {
|
|
60
|
-
className: [
|
|
61
|
-
name: name
|
|
62
|
+
className: [oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
|
|
63
|
+
name: name,
|
|
64
|
+
color: labelColor
|
|
62
65
|
}, label), /*#__PURE__*/React.createElement("input", _extends({
|
|
63
66
|
id: name,
|
|
64
67
|
className: "input ".concat(meta.touched && meta.error ? 'input-border-error' : 'input-border'),
|
|
65
68
|
type: type,
|
|
66
|
-
disabled: disabled
|
|
69
|
+
disabled: disabled,
|
|
70
|
+
placeholder: placeholder
|
|
67
71
|
}, field)), (description || meta.touched && meta.error) && /*#__PURE__*/React.createElement(_common.FormDescription, {
|
|
68
72
|
isError: !!meta.error,
|
|
69
73
|
className: "v50 mt-v s-1"
|
|
@@ -96,6 +100,11 @@ TextInput.propTypes = {
|
|
|
96
100
|
*/
|
|
97
101
|
label: _propTypes.default.string.isRequired,
|
|
98
102
|
|
|
103
|
+
/**
|
|
104
|
+
* The input label color
|
|
105
|
+
*/
|
|
106
|
+
labelColor: _propTypes.default.string,
|
|
107
|
+
|
|
99
108
|
/**
|
|
100
109
|
* The type of the input (html)
|
|
101
110
|
*/
|
|
@@ -119,7 +128,12 @@ TextInput.propTypes = {
|
|
|
119
128
|
/**
|
|
120
129
|
* Whether the text input should be disabled
|
|
121
130
|
*/
|
|
122
|
-
disabled: _propTypes.default.bool
|
|
131
|
+
disabled: _propTypes.default.bool,
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* The placeholder text for the input
|
|
135
|
+
*/
|
|
136
|
+
placeholder: _propTypes.default.string
|
|
123
137
|
};
|
|
124
138
|
TextInput.defaultProps = {
|
|
125
139
|
type: 'text',
|
|
@@ -9,17 +9,13 @@ $default-padding: 0.75em 0.75em 0.55em;
|
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
|
|
12
|
-
.input-label {
|
|
13
|
-
color: var(--main1);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
12
|
.input {
|
|
17
|
-
background: var(--light-
|
|
18
|
-
color: var(--on-
|
|
13
|
+
background: var(--light-background2);
|
|
14
|
+
color: var(--on-background2);
|
|
19
15
|
padding: $default-padding;
|
|
20
16
|
|
|
21
17
|
&:focus {
|
|
22
|
-
background: var(--dark-
|
|
18
|
+
background: var(--dark-background2);
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
21
|
}
|
|
@@ -43,7 +43,8 @@ var TextareaInput = _ref => {
|
|
|
43
43
|
textAreaColor,
|
|
44
44
|
labelColor,
|
|
45
45
|
description,
|
|
46
|
-
disabled
|
|
46
|
+
disabled,
|
|
47
|
+
placeholder // ...otherProps
|
|
47
48
|
|
|
48
49
|
} = _ref;
|
|
49
50
|
(0, React.useLayoutEffect)(() => {
|
|
@@ -55,16 +56,18 @@ var TextareaInput = _ref => {
|
|
|
55
56
|
});
|
|
56
57
|
return /*#__PURE__*/React.createElement("div", {
|
|
57
58
|
id: id,
|
|
58
|
-
className: [baseClassName, componentClassName, userClassName, "x-".concat(textAreaColor)
|
|
59
|
+
className: [baseClassName, componentClassName, userClassName, "x-".concat(textAreaColor)].filter(e => e).join(' '),
|
|
59
60
|
style: style // {...otherProps}
|
|
60
61
|
|
|
61
62
|
}, /*#__PURE__*/React.createElement(_common.FormLabel, {
|
|
62
|
-
className: [
|
|
63
|
-
name: name
|
|
63
|
+
className: [labelAsDescription ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
|
|
64
|
+
name: name,
|
|
65
|
+
color: labelColor
|
|
64
66
|
}, label), /*#__PURE__*/React.createElement("textarea", _extends({
|
|
65
67
|
id: textAreaId,
|
|
66
68
|
className: "textarea v50 pv-v ".concat(meta.touched && meta.error ? 'input-border-error' : 'input-border')
|
|
67
69
|
}, field, {
|
|
70
|
+
placeholder: placeholder,
|
|
68
71
|
rows: rows,
|
|
69
72
|
disabled: disabled
|
|
70
73
|
})), (description || meta.touched && meta.error) && /*#__PURE__*/React.createElement(_common.FormDescription, {
|
|
@@ -137,12 +140,16 @@ TextareaInput.propTypes = {
|
|
|
137
140
|
/**
|
|
138
141
|
* Whether the text area should be disabled
|
|
139
142
|
*/
|
|
140
|
-
disabled: _propTypes.default.bool
|
|
143
|
+
disabled: _propTypes.default.bool,
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* The textarea placeholder text
|
|
147
|
+
*/
|
|
148
|
+
placeholder: _propTypes.default.string
|
|
141
149
|
};
|
|
142
150
|
TextareaInput.defaultProps = {
|
|
143
151
|
rows: 3,
|
|
144
152
|
textAreaColor: 'background1',
|
|
145
|
-
labelColor: 'main1',
|
|
146
153
|
disabled: false
|
|
147
154
|
};
|
|
148
155
|
|
|
@@ -7,6 +7,7 @@ $compact-padding: .6em .6em .48em;
|
|
|
7
7
|
$default-color:primary;
|
|
8
8
|
$font-weight:bold;
|
|
9
9
|
$default-margin:.5em;
|
|
10
|
+
$default-animation-time: .3s;
|
|
10
11
|
|
|
11
12
|
.#{bem.$base}.button {
|
|
12
13
|
background: var(--x, var(--#{$default-color}));
|
|
@@ -14,8 +15,8 @@ $default-margin:.5em;
|
|
|
14
15
|
border-radius: var(--theme-border-radius);
|
|
15
16
|
color: var(--on-x, var(--on-#{$default-color}));
|
|
16
17
|
display: inline-flex;
|
|
17
|
-
font-weight: 600;
|
|
18
18
|
font-family: var(--theme-default-paragraph);
|
|
19
|
+
font-weight: 600;
|
|
19
20
|
justify-content: space-between;
|
|
20
21
|
padding: $default-padding;
|
|
21
22
|
transition: all .25s;
|
|
@@ -24,6 +25,14 @@ $default-margin:.5em;
|
|
|
24
25
|
&::after {
|
|
25
26
|
content: "-->";
|
|
26
27
|
margin-left: $default-margin;
|
|
28
|
+
vertical-align: middle;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&:hover {
|
|
32
|
+
&::after {
|
|
33
|
+
--final-position: 50%;
|
|
34
|
+
animation: animateArrow $default-animation-time forwards;
|
|
35
|
+
}
|
|
27
36
|
}
|
|
28
37
|
}
|
|
29
38
|
|
|
@@ -31,6 +40,14 @@ $default-margin:.5em;
|
|
|
31
40
|
&::before {
|
|
32
41
|
content: "<--";
|
|
33
42
|
margin-right: $default-margin;
|
|
43
|
+
vertical-align: middle;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&:hover {
|
|
47
|
+
&::before {
|
|
48
|
+
--final-position: -50%;
|
|
49
|
+
animation: animateArrow $default-animation-time forwards;
|
|
50
|
+
}
|
|
34
51
|
}
|
|
35
52
|
}
|
|
36
53
|
|
|
@@ -46,7 +63,6 @@ $default-margin:.5em;
|
|
|
46
63
|
}
|
|
47
64
|
}
|
|
48
65
|
|
|
49
|
-
|
|
50
66
|
&.#{bem.$modifier-compact} {
|
|
51
67
|
padding: $compact-padding;
|
|
52
68
|
}
|
|
@@ -114,3 +130,12 @@ $default-margin:.5em;
|
|
|
114
130
|
}
|
|
115
131
|
|
|
116
132
|
|
|
133
|
+
@keyframes animateArrow {
|
|
134
|
+
from {
|
|
135
|
+
transform: translateX(0);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
to {
|
|
139
|
+
transform: translateX(var(--final-position));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -56,7 +56,8 @@ const Navigator = ({
|
|
|
56
56
|
} else {
|
|
57
57
|
setNextStepIndex(stepsForward);
|
|
58
58
|
}
|
|
59
|
-
}
|
|
59
|
+
},
|
|
60
|
+
isCompact: true
|
|
60
61
|
}, "Next") : /*#__PURE__*/React.createElement("span", null));
|
|
61
62
|
};
|
|
62
63
|
|
|
@@ -118,8 +119,8 @@ Navigator.propTypes = {
|
|
|
118
119
|
};
|
|
119
120
|
Navigator.defaultProps = {
|
|
120
121
|
canMoveForward: true,
|
|
121
|
-
previousColor: '
|
|
122
|
-
nextColor: '
|
|
122
|
+
previousColor: 'main2',
|
|
123
|
+
nextColor: 'main2',
|
|
123
124
|
stepsForward: 1,
|
|
124
125
|
stepsBackwards: 1
|
|
125
126
|
};
|
|
@@ -31,7 +31,7 @@ const Debugger = ({
|
|
|
31
31
|
style: style
|
|
32
32
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
33
33
|
onClick: toggleDebugger,
|
|
34
|
-
color: "
|
|
34
|
+
color: "main2"
|
|
35
35
|
}, isOpen ? 'Close FormDebugger' : 'Open FormDebugger'), isOpen && /*#__PURE__*/React.createElement("pre", {
|
|
36
36
|
className: "debuger-content"
|
|
37
37
|
}, JSON.stringify(formikContext, null, 2)));
|
|
@@ -21,13 +21,18 @@ const SelectInput = ({
|
|
|
21
21
|
name,
|
|
22
22
|
label,
|
|
23
23
|
options,
|
|
24
|
+
validate,
|
|
25
|
+
description,
|
|
24
26
|
disabled // ...otherProps
|
|
25
27
|
|
|
26
28
|
}) => {
|
|
27
29
|
useLayoutEffect(() => {
|
|
28
30
|
import("./styles.scss");
|
|
29
31
|
}, []);
|
|
30
|
-
const [field, meta] = useField(
|
|
32
|
+
const [field, meta] = useField({
|
|
33
|
+
name,
|
|
34
|
+
validate
|
|
35
|
+
});
|
|
31
36
|
return /*#__PURE__*/React.createElement("div", {
|
|
32
37
|
id: id,
|
|
33
38
|
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
@@ -39,6 +44,7 @@ const SelectInput = ({
|
|
|
39
44
|
}, label), /*#__PURE__*/React.createElement("select", _extends({
|
|
40
45
|
className: "input v25 pv-v"
|
|
41
46
|
}, field, {
|
|
47
|
+
value: field.value || '',
|
|
42
48
|
id: name,
|
|
43
49
|
disabled: disabled
|
|
44
50
|
}), options.map(option => {
|
|
@@ -49,11 +55,13 @@ const SelectInput = ({
|
|
|
49
55
|
} : option;
|
|
50
56
|
return /*#__PURE__*/React.createElement("option", {
|
|
51
57
|
key: newOption.value,
|
|
52
|
-
value: newOption.value
|
|
58
|
+
value: newOption.value,
|
|
59
|
+
disabled: (newOption === null || newOption === void 0 ? void 0 : newOption.disabled) || false
|
|
53
60
|
}, newOption.label);
|
|
54
|
-
})), meta.
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
})), (description || meta.touched && meta.error) && /*#__PURE__*/React.createElement(FormDescription, {
|
|
62
|
+
isError: !!meta.error,
|
|
63
|
+
className: "v50 mt-v s-1"
|
|
64
|
+
}, meta.error || description));
|
|
57
65
|
};
|
|
58
66
|
|
|
59
67
|
SelectInput.propTypes = {
|
|
@@ -82,12 +90,23 @@ SelectInput.propTypes = {
|
|
|
82
90
|
*/
|
|
83
91
|
label: PropTypes.string,
|
|
84
92
|
|
|
93
|
+
/**
|
|
94
|
+
* The input field validator function
|
|
95
|
+
*/
|
|
96
|
+
validate: PropTypes.func,
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The select input description
|
|
100
|
+
*/
|
|
101
|
+
description: PropTypes.string,
|
|
102
|
+
|
|
85
103
|
/**
|
|
86
104
|
* The options of the select input
|
|
87
105
|
*/
|
|
88
106
|
options: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
|
|
89
107
|
value: PropTypes.string,
|
|
90
|
-
label: PropTypes.string
|
|
108
|
+
label: PropTypes.string,
|
|
109
|
+
disabled: PropTypes.bool
|
|
91
110
|
})])),
|
|
92
111
|
|
|
93
112
|
/**
|
|
@@ -14,16 +14,16 @@ $default-padding: 0.75em 0.75em 0.55em;
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
.input-label {
|
|
17
|
-
color: var(--
|
|
17
|
+
color: var(--main2);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.input {
|
|
21
|
-
background: var(--light-
|
|
22
|
-
color: var(--on-
|
|
21
|
+
background: var(--light-background2);
|
|
22
|
+
color: var(--on-background2);
|
|
23
23
|
padding: $default-padding;
|
|
24
24
|
|
|
25
25
|
&:focus {
|
|
26
|
-
background: var(--dark-
|
|
26
|
+
background: var(--dark-background2);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -21,10 +21,12 @@ const TextInput = ({
|
|
|
21
21
|
type,
|
|
22
22
|
name,
|
|
23
23
|
label,
|
|
24
|
+
labelColor,
|
|
24
25
|
validate,
|
|
25
26
|
oneInputLabel,
|
|
26
27
|
description,
|
|
27
|
-
disabled
|
|
28
|
+
disabled,
|
|
29
|
+
placeholder // ...otherProps
|
|
28
30
|
|
|
29
31
|
}) => {
|
|
30
32
|
useLayoutEffect(() => {
|
|
@@ -40,13 +42,15 @@ const TextInput = ({
|
|
|
40
42
|
style: style // {...otherProps}
|
|
41
43
|
|
|
42
44
|
}, /*#__PURE__*/React.createElement(FormLabel, {
|
|
43
|
-
className: [
|
|
44
|
-
name: name
|
|
45
|
+
className: [oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
|
|
46
|
+
name: name,
|
|
47
|
+
color: labelColor
|
|
45
48
|
}, label), /*#__PURE__*/React.createElement("input", _extends({
|
|
46
49
|
id: name,
|
|
47
50
|
className: `input ${meta.touched && meta.error ? 'input-border-error' : 'input-border'}`,
|
|
48
51
|
type: type,
|
|
49
|
-
disabled: disabled
|
|
52
|
+
disabled: disabled,
|
|
53
|
+
placeholder: placeholder
|
|
50
54
|
}, field)), (description || meta.touched && meta.error) && /*#__PURE__*/React.createElement(FormDescription, {
|
|
51
55
|
isError: !!meta.error,
|
|
52
56
|
className: "v50 mt-v s-1"
|
|
@@ -79,6 +83,11 @@ TextInput.propTypes = {
|
|
|
79
83
|
*/
|
|
80
84
|
label: PropTypes.string.isRequired,
|
|
81
85
|
|
|
86
|
+
/**
|
|
87
|
+
* The input label color
|
|
88
|
+
*/
|
|
89
|
+
labelColor: PropTypes.string,
|
|
90
|
+
|
|
82
91
|
/**
|
|
83
92
|
* The type of the input (html)
|
|
84
93
|
*/
|
|
@@ -102,7 +111,12 @@ TextInput.propTypes = {
|
|
|
102
111
|
/**
|
|
103
112
|
* Whether the text input should be disabled
|
|
104
113
|
*/
|
|
105
|
-
disabled: PropTypes.bool
|
|
114
|
+
disabled: PropTypes.bool,
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* The placeholder text for the input
|
|
118
|
+
*/
|
|
119
|
+
placeholder: PropTypes.string
|
|
106
120
|
};
|
|
107
121
|
TextInput.defaultProps = {
|
|
108
122
|
type: 'text',
|
|
@@ -9,17 +9,13 @@ $default-padding: 0.75em 0.75em 0.55em;
|
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
|
|
12
|
-
.input-label {
|
|
13
|
-
color: var(--main1);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
12
|
.input {
|
|
17
|
-
background: var(--light-
|
|
18
|
-
color: var(--on-
|
|
13
|
+
background: var(--light-background2);
|
|
14
|
+
color: var(--on-background2);
|
|
19
15
|
padding: $default-padding;
|
|
20
16
|
|
|
21
17
|
&:focus {
|
|
22
|
-
background: var(--dark-
|
|
18
|
+
background: var(--dark-background2);
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
21
|
}
|