@pareto-engineering/design-system 2.0.0-alpha.22 → 2.0.0-alpha.23
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 +1 -1
- package/dist/cjs/f/common/Label/styles.scss +1 -1
- package/dist/cjs/f/fields/ChoicesInput/styles.scss +17 -2
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +13 -5
- package/dist/cjs/f/fields/SelectInput/styles.scss +13 -8
- package/dist/cjs/f/fields/TextInput/TextInput.js +10 -3
- package/dist/cjs/f/fields/TextInput/styles.scss +16 -3
- package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +3 -3
- package/dist/cjs/f/fields/TextareaInput/styles.scss +19 -6
- package/dist/cjs/f/fields/index.js +0 -24
- package/dist/cjs/form-reset.scss +1 -1
- package/dist/es/b/Button/styles.scss +1 -1
- package/dist/es/f/common/Label/styles.scss +1 -1
- package/dist/es/f/fields/ChoicesInput/styles.scss +17 -2
- package/dist/es/f/fields/SelectInput/SelectInput.js +13 -5
- package/dist/es/f/fields/SelectInput/styles.scss +13 -8
- package/dist/es/f/fields/TextInput/TextInput.js +10 -3
- package/dist/es/f/fields/TextInput/styles.scss +16 -3
- package/dist/es/f/fields/TextareaInput/TextareaInput.js +3 -3
- package/dist/es/f/fields/TextareaInput/styles.scss +19 -6
- package/dist/es/f/fields/index.js +0 -3
- package/dist/es/form-reset.scss +1 -1
- package/package.json +2 -2
- package/src/__snapshots__/Storyshots.test.js.snap +124 -378
- package/src/stories/f/SelectInput.stories.jsx +10 -8
- package/src/stories/f/TextInput.stories.jsx +7 -6
- package/src/stories/f/TextareaInput.stories.jsx +4 -4
- package/src/ui/b/Button/styles.scss +1 -1
- package/src/ui/f/common/Label/styles.scss +1 -1
- package/src/ui/f/fields/ChoicesInput/styles.scss +17 -2
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +10 -1
- package/src/ui/f/fields/SelectInput/styles.scss +13 -8
- package/src/ui/f/fields/TextInput/TextInput.jsx +9 -1
- package/src/ui/f/fields/TextInput/styles.scss +16 -3
- package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +3 -3
- package/src/ui/f/fields/TextareaInput/styles.scss +19 -6
- package/src/ui/f/fields/index.js +0 -3
- package/src/ui/form-reset.scss +1 -1
- package/src/stories/f/CheckboxInput.stories.jsx +0 -37
- package/src/stories/f/RadioInput.stories.jsx +0 -37
- package/src/stories/f/TaskRecommendationInput.stories.jsx +0 -38
- package/src/ui/f/fields/CheckboxInput/CheckboxInput.jsx +0 -107
- package/src/ui/f/fields/CheckboxInput/index.js +0 -2
- package/src/ui/f/fields/CheckboxInput/styles.scss +0 -28
- package/src/ui/f/fields/RadioInput/RadioInput.jsx +0 -112
- package/src/ui/f/fields/RadioInput/index.js +0 -2
- package/src/ui/f/fields/RadioInput/styles.scss +0 -26
- package/src/ui/f/fields/TaskRecommendationInput/TaskRecommendationInput.jsx +0 -130
- package/src/ui/f/fields/TaskRecommendationInput/index.js +0 -2
- package/src/ui/f/fields/TaskRecommendationInput/styles.scss +0 -41
|
@@ -13,10 +13,9 @@ export default {
|
|
|
13
13
|
decorators:[
|
|
14
14
|
(storyfn) => (
|
|
15
15
|
<Formik
|
|
16
|
-
initialValues={{ workType: '
|
|
16
|
+
initialValues={{ workType: '' }}
|
|
17
17
|
>
|
|
18
18
|
<Form>
|
|
19
|
-
|
|
20
19
|
{ storyfn() }
|
|
21
20
|
</Form>
|
|
22
21
|
</Formik>
|
|
@@ -32,7 +31,7 @@ export const Base = () => (
|
|
|
32
31
|
<SelectInput
|
|
33
32
|
name="workType"
|
|
34
33
|
label="Work Type"
|
|
35
|
-
options={['Work', 'Managing', 'Training']}
|
|
34
|
+
options={[{ value: '', label: 'Select an option', disabled: true }, 'Work', 'Managing', 'Training']}
|
|
36
35
|
/>
|
|
37
36
|
<FormDebugger />
|
|
38
37
|
</>
|
|
@@ -55,9 +54,7 @@ export const RequiredSelect = () => {
|
|
|
55
54
|
name="activity"
|
|
56
55
|
label="Activity Type"
|
|
57
56
|
options={[
|
|
58
|
-
{
|
|
59
|
-
value:'', label:'Select activity type', disabled:true,
|
|
60
|
-
},
|
|
57
|
+
{ value: '', label: 'Select an option', disabled: true },
|
|
61
58
|
{ value: 'review', label: 'Review' },
|
|
62
59
|
{ value: 'Approve', label: 'Approve' },
|
|
63
60
|
]}
|
|
@@ -73,6 +70,7 @@ export const Objects = () => (
|
|
|
73
70
|
name="workType"
|
|
74
71
|
label="Work Type"
|
|
75
72
|
options={[
|
|
73
|
+
{ value: '', label: 'Select an option', disabled: true },
|
|
76
74
|
{ value: '20th Aug 2020 to 19th Sept, 2020', label: '20th Aug 2020 to 19th Sept, 2020' },
|
|
77
75
|
{ value: '20th Sept 2020 to 19th Oct, 2020', label: '20th Sept 2020 to 19th Oct, 2020' },
|
|
78
76
|
]}
|
|
@@ -86,7 +84,9 @@ export const StringAndObjects = () => (
|
|
|
86
84
|
<SelectInput
|
|
87
85
|
name="workType"
|
|
88
86
|
label="Work Type"
|
|
89
|
-
options={[
|
|
87
|
+
options={[
|
|
88
|
+
{ value: '', label: 'Select an option', disabled: true },
|
|
89
|
+
'Work', 'Managing', 'Training',
|
|
90
90
|
{ value: '20th Aug 2020 to 19th Sept, 2020', label: '20th Aug 2020 to 19th Sept, 2020' },
|
|
91
91
|
{ value: '20th Sept 2020 to 19th Oct, 2020', label: '20th Sept 2020 to 19th Oct, 2020' },
|
|
92
92
|
]}
|
|
@@ -99,7 +99,9 @@ export const DisabledSelectInput = () => (
|
|
|
99
99
|
<SelectInput
|
|
100
100
|
name="workType"
|
|
101
101
|
label="Work Type"
|
|
102
|
-
options={[
|
|
102
|
+
options={[
|
|
103
|
+
{ value: '', label: 'Select an option', disabled: true },
|
|
104
|
+
'Work', 'Managing', 'Training',
|
|
103
105
|
{ value: '20th Aug 2020 to 19th Sept, 2020', label: '20th Aug 2020 to 19th Sept, 2020' },
|
|
104
106
|
{ value: '20th Sept 2020 to 19th Oct, 2020', label: '20th Sept 2020 to 19th Oct, 2020' },
|
|
105
107
|
]}
|
|
@@ -41,7 +41,7 @@ export const Base = () => {
|
|
|
41
41
|
return errorMessage
|
|
42
42
|
}
|
|
43
43
|
return (
|
|
44
|
-
<div className="
|
|
44
|
+
<div className=" u2 pb-u">
|
|
45
45
|
<TextInput
|
|
46
46
|
name="firstName"
|
|
47
47
|
label="What's your first name ?"
|
|
@@ -52,18 +52,19 @@ export const Base = () => {
|
|
|
52
52
|
)
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
export const
|
|
56
|
-
<div className="
|
|
55
|
+
export const Placeholder = () => (
|
|
56
|
+
<div className="u2 pb-u">
|
|
57
57
|
<TextInput
|
|
58
58
|
name="firstName"
|
|
59
59
|
label="What's your first name ?"
|
|
60
60
|
placeholder="First Name"
|
|
61
61
|
/>
|
|
62
|
+
<FormDebugger />
|
|
62
63
|
</div>
|
|
63
64
|
)
|
|
64
65
|
|
|
65
|
-
export const
|
|
66
|
-
<div className="
|
|
66
|
+
export const Disabled = () => (
|
|
67
|
+
<div className="u2 pb-u">
|
|
67
68
|
<TextInput
|
|
68
69
|
name="firstName"
|
|
69
70
|
label="What's your first name ?"
|
|
@@ -73,7 +74,7 @@ export const DisabledTextInput = () => (
|
|
|
73
74
|
)
|
|
74
75
|
|
|
75
76
|
export const DateTime = () => (
|
|
76
|
-
<div
|
|
77
|
+
<div>
|
|
77
78
|
<TextInput
|
|
78
79
|
name="date"
|
|
79
80
|
label="Select date"
|
|
@@ -29,7 +29,7 @@ export default {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export const Base = () => (
|
|
32
|
-
<div
|
|
32
|
+
<div>
|
|
33
33
|
<TextareaInput
|
|
34
34
|
name="feedback"
|
|
35
35
|
label="What can we improve on?"
|
|
@@ -39,7 +39,7 @@ export const Base = () => (
|
|
|
39
39
|
)
|
|
40
40
|
|
|
41
41
|
export const Placeholder = () => (
|
|
42
|
-
<div
|
|
42
|
+
<div>
|
|
43
43
|
<TextareaInput
|
|
44
44
|
name="feedback"
|
|
45
45
|
label="What can we improve on?"
|
|
@@ -61,7 +61,7 @@ export const Validation = () => {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
return (
|
|
64
|
-
<div
|
|
64
|
+
<div>
|
|
65
65
|
<TextareaInput
|
|
66
66
|
name="feedback"
|
|
67
67
|
label="What can we improve on?"
|
|
@@ -74,7 +74,7 @@ export const Validation = () => {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
export const Disabled = () => (
|
|
77
|
-
<div
|
|
77
|
+
<div>
|
|
78
78
|
<TextareaInput
|
|
79
79
|
name="feedback"
|
|
80
80
|
label="What can we improve on?"
|
|
@@ -16,7 +16,7 @@ $default-animation-time: .3s;
|
|
|
16
16
|
color: var(--on-x, var(--on-#{$default-color}));
|
|
17
17
|
display: inline-flex;
|
|
18
18
|
font-family: var(--theme-default-paragraph);
|
|
19
|
-
font-weight:
|
|
19
|
+
font-weight: 400;
|
|
20
20
|
justify-content: space-between;
|
|
21
21
|
padding: $default-padding;
|
|
22
22
|
transition: all .25s;
|
|
@@ -29,10 +29,21 @@ $default-transition:all .3s;
|
|
|
29
29
|
z-index: -1;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
input:disabled + label {
|
|
33
|
+
background-color: var(--dark-x);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
input:not(:disabled) + label {
|
|
37
|
+
&:hover {
|
|
38
|
+
border-color: var(--light-y);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
32
42
|
label {
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
border: var(--theme-border-style) var(--dark-x);
|
|
44
|
+
background: var(--light-x);
|
|
35
45
|
color: var(--on-x);
|
|
46
|
+
border-radius: var(--theme-border-radius);
|
|
36
47
|
display: block;
|
|
37
48
|
height: 100%;
|
|
38
49
|
padding: $default-padding;
|
|
@@ -44,6 +55,10 @@ $default-transition:all .3s;
|
|
|
44
55
|
input:checked + label {
|
|
45
56
|
background: var(--y);
|
|
46
57
|
color: var(--on-y);
|
|
58
|
+
|
|
59
|
+
&:hover {
|
|
60
|
+
border-color: var(--y);
|
|
61
|
+
}
|
|
47
62
|
}
|
|
48
63
|
}
|
|
49
64
|
}
|
|
@@ -26,6 +26,7 @@ const SelectInput = ({
|
|
|
26
26
|
style,
|
|
27
27
|
name,
|
|
28
28
|
label,
|
|
29
|
+
color,
|
|
29
30
|
options,
|
|
30
31
|
validate,
|
|
31
32
|
description,
|
|
@@ -47,6 +48,7 @@ const SelectInput = ({
|
|
|
47
48
|
|
|
48
49
|
componentClassName,
|
|
49
50
|
userClassName,
|
|
51
|
+
`y-${color}`,
|
|
50
52
|
]
|
|
51
53
|
.filter((e) => e)
|
|
52
54
|
.join(' ')}
|
|
@@ -54,7 +56,7 @@ const SelectInput = ({
|
|
|
54
56
|
// {...otherProps}
|
|
55
57
|
>
|
|
56
58
|
<FormLabel className="input-label" name={name}>{label}</FormLabel>
|
|
57
|
-
<select className="input
|
|
59
|
+
<select className="input" {...field} value={field.value || ''} id={name} disabled={disabled}>
|
|
58
60
|
{
|
|
59
61
|
options.map((option) => {
|
|
60
62
|
// i.e if option is a string like "blah", return { value: "blah", label: "blah" }
|
|
@@ -65,6 +67,7 @@ const SelectInput = ({
|
|
|
65
67
|
key={newOption.value}
|
|
66
68
|
value={newOption.value}
|
|
67
69
|
disabled={newOption?.disabled || false}
|
|
70
|
+
selected={newOption?.disabled || true}
|
|
68
71
|
>
|
|
69
72
|
{newOption.label}
|
|
70
73
|
</option>
|
|
@@ -135,10 +138,16 @@ SelectInput.propTypes = {
|
|
|
135
138
|
* Whether the select input should be disabled
|
|
136
139
|
*/
|
|
137
140
|
disabled:PropTypes.bool,
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The color of the select input
|
|
144
|
+
*/
|
|
145
|
+
color:PropTypes.string,
|
|
138
146
|
}
|
|
139
147
|
|
|
140
148
|
SelectInput.defaultProps = {
|
|
141
149
|
disabled:false,
|
|
150
|
+
color :'background2',
|
|
142
151
|
}
|
|
143
152
|
|
|
144
153
|
export default memo(SelectInput)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
@use "../../../form.scss";
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
$default-padding: 0.75em
|
|
8
|
+
$default-padding: 0.75em;
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
.#{bem.$base}.select-input {
|
|
@@ -13,17 +13,22 @@ $default-padding: 0.75em 0.75em 0.55em;
|
|
|
13
13
|
flex-direction: column;
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
.input-label {
|
|
17
|
-
color: var(--main2);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
16
|
.input {
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
border: var(--theme-border-style) var(--dark-y);
|
|
18
|
+
background: var(--light-y);
|
|
19
|
+
color:var(--on-y);
|
|
23
20
|
padding: $default-padding;
|
|
24
21
|
|
|
22
|
+
&:not(:disabled):hover{
|
|
23
|
+
border: var(--theme-border-style) var(--light-background4);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&:disabled {
|
|
27
|
+
background-color: var(--dark-y);
|
|
28
|
+
}
|
|
29
|
+
|
|
25
30
|
&:focus {
|
|
26
|
-
background: var(--
|
|
31
|
+
background: var(--y);
|
|
27
32
|
}
|
|
28
33
|
}
|
|
29
34
|
}
|
|
@@ -27,6 +27,7 @@ const TextInput = ({
|
|
|
27
27
|
type,
|
|
28
28
|
name,
|
|
29
29
|
label,
|
|
30
|
+
color,
|
|
30
31
|
labelColor,
|
|
31
32
|
validate,
|
|
32
33
|
oneInputLabel,
|
|
@@ -48,6 +49,7 @@ const TextInput = ({
|
|
|
48
49
|
baseClassName,
|
|
49
50
|
componentClassName,
|
|
50
51
|
userClassName,
|
|
52
|
+
`y-${color}`,
|
|
51
53
|
]
|
|
52
54
|
.filter((e) => e)
|
|
53
55
|
.join(' ')}
|
|
@@ -65,7 +67,7 @@ const TextInput = ({
|
|
|
65
67
|
</FormLabel>
|
|
66
68
|
<input
|
|
67
69
|
id={name}
|
|
68
|
-
className=
|
|
70
|
+
className="input"
|
|
69
71
|
type={type}
|
|
70
72
|
disabled={disabled}
|
|
71
73
|
placeholder={placeholder}
|
|
@@ -149,10 +151,16 @@ TextInput.propTypes = {
|
|
|
149
151
|
* The placeholder text for the input
|
|
150
152
|
*/
|
|
151
153
|
placeholder:PropTypes.string,
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The text input color
|
|
157
|
+
*/
|
|
158
|
+
color:PropTypes.string,
|
|
152
159
|
}
|
|
153
160
|
|
|
154
161
|
TextInput.defaultProps = {
|
|
155
162
|
type :'text',
|
|
163
|
+
color :'background2',
|
|
156
164
|
disabled:false,
|
|
157
165
|
}
|
|
158
166
|
|
|
@@ -10,12 +10,25 @@ $default-padding: 0.75em 0.75em 0.55em;
|
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
|
|
12
12
|
.input {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
border: var(--theme-border-style) var(--dark-y);
|
|
14
|
+
background: var(--light-y);
|
|
15
|
+
color: var(--on-y);
|
|
15
16
|
padding: $default-padding;
|
|
16
17
|
|
|
18
|
+
&::placeholder{
|
|
19
|
+
color: var(--metadata);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&:not(:disabled):hover{
|
|
23
|
+
border: var(--theme-border-style) var(--light-background4);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&:disabled {
|
|
27
|
+
background-color: var(--dark-y);
|
|
28
|
+
}
|
|
29
|
+
|
|
17
30
|
&:focus {
|
|
18
|
-
background: var(--
|
|
31
|
+
background: var(--light-background4);
|
|
19
32
|
}
|
|
20
33
|
}
|
|
21
34
|
}
|
|
@@ -52,7 +52,7 @@ const TextareaInput = ({
|
|
|
52
52
|
|
|
53
53
|
componentClassName,
|
|
54
54
|
userClassName,
|
|
55
|
-
`
|
|
55
|
+
`y-${textAreaColor}`,
|
|
56
56
|
]
|
|
57
57
|
.filter((e) => e)
|
|
58
58
|
.join(' ')}
|
|
@@ -70,7 +70,7 @@ const TextareaInput = ({
|
|
|
70
70
|
</FormLabel>
|
|
71
71
|
<textarea
|
|
72
72
|
id={textAreaId}
|
|
73
|
-
className=
|
|
73
|
+
className="textarea"
|
|
74
74
|
{...field}
|
|
75
75
|
placeholder={placeholder}
|
|
76
76
|
rows={rows}
|
|
@@ -163,7 +163,7 @@ TextareaInput.propTypes = {
|
|
|
163
163
|
|
|
164
164
|
TextareaInput.defaultProps = {
|
|
165
165
|
rows :3,
|
|
166
|
-
textAreaColor:'
|
|
166
|
+
textAreaColor:'background2',
|
|
167
167
|
disabled :false,
|
|
168
168
|
}
|
|
169
169
|
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
@use "@pareto-engineering/bem";
|
|
3
3
|
|
|
4
|
+
$default-padding: .5em;
|
|
5
|
+
|
|
4
6
|
.#{bem.$base}.text-area-input{
|
|
5
7
|
display: flex;
|
|
6
8
|
flex-direction: column;
|
|
7
9
|
|
|
8
10
|
.textarea {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
border: var(--theme-border-style) var(--dark-y);
|
|
12
|
+
background: var(--light-y);
|
|
13
|
+
color: var(--on-y);
|
|
14
|
+
padding: $default-padding;
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
&::placeholder{
|
|
17
|
+
color: var(--metadata);
|
|
14
18
|
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
19
|
|
|
20
|
+
&:not(:disabled):hover{
|
|
21
|
+
border: var(--theme-border-style) var(--light-background4);
|
|
22
|
+
}
|
|
18
23
|
|
|
24
|
+
&:disabled {
|
|
25
|
+
background-color: var(--dark-y);
|
|
26
|
+
}
|
|
19
27
|
|
|
28
|
+
&:focus {
|
|
29
|
+
background: var(--light-background4);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/ui/f/fields/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export { TextInput } from './TextInput'
|
|
2
2
|
export { SelectInput } from './SelectInput'
|
|
3
|
-
export { RadioInput } from './RadioInput'
|
|
4
|
-
export { CheckboxInput } from './CheckboxInput'
|
|
5
|
-
export { TaskRecommendationInput } from './TaskRecommendationInput'
|
|
6
3
|
export { ChoicesInput } from './ChoicesInput'
|
|
7
4
|
export { TextareaInput } from './TextareaInput'
|
|
8
5
|
export { RatingsInput } from './RatingsInput'
|
package/src/ui/form-reset.scss
CHANGED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
import * as React from 'react'
|
|
3
|
-
import { Formik, Form } from 'formik'
|
|
4
|
-
|
|
5
|
-
import { CheckboxInput, FormDebugger } from 'ui'
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title :'f/fields/CheckboxInput',
|
|
9
|
-
component :CheckboxInput,
|
|
10
|
-
subcomponents:{
|
|
11
|
-
// Item:CheckboxInput.Item
|
|
12
|
-
},
|
|
13
|
-
decorators:[
|
|
14
|
-
(storyfn) => (
|
|
15
|
-
<Formik
|
|
16
|
-
initialValues={{ businessTypes: [] }}
|
|
17
|
-
>
|
|
18
|
-
<Form>
|
|
19
|
-
{ storyfn() }
|
|
20
|
-
</Form>
|
|
21
|
-
</Formik>
|
|
22
|
-
),
|
|
23
|
-
],
|
|
24
|
-
argTypes:{
|
|
25
|
-
backgroundColor:{ control: 'color' },
|
|
26
|
-
},
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const Base = () => (
|
|
30
|
-
<div className="y-background1 b-y">
|
|
31
|
-
<CheckboxInput value="Business to customer" name="businessTypes">Business to customer</CheckboxInput>
|
|
32
|
-
<CheckboxInput value="Business to business" name="businessTypes">Business to business</CheckboxInput>
|
|
33
|
-
<CheckboxInput value="E-commerce" name="businessTypes">E-commerce</CheckboxInput>
|
|
34
|
-
<CheckboxInput value="Marketplace" name="businessTypes">Marketplace</CheckboxInput>
|
|
35
|
-
<FormDebugger />
|
|
36
|
-
</div>
|
|
37
|
-
)
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
import * as React from 'react'
|
|
3
|
-
import { Formik, Form } from 'formik'
|
|
4
|
-
|
|
5
|
-
import { RadioInput, FormDebugger } from 'ui'
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title :'f/fields/RadioInput',
|
|
9
|
-
component :RadioInput,
|
|
10
|
-
subcomponents:{
|
|
11
|
-
// Item:RadioInput.Item
|
|
12
|
-
},
|
|
13
|
-
decorators:[
|
|
14
|
-
(storyfn) => (
|
|
15
|
-
<Formik
|
|
16
|
-
initialValues={{ companySize: '' }}
|
|
17
|
-
>
|
|
18
|
-
<Form>
|
|
19
|
-
{ storyfn() }
|
|
20
|
-
</Form>
|
|
21
|
-
</Formik>
|
|
22
|
-
),
|
|
23
|
-
],
|
|
24
|
-
argTypes:{
|
|
25
|
-
backgroundColor:{ control: 'color' },
|
|
26
|
-
},
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const Base = () => (
|
|
30
|
-
<>
|
|
31
|
-
<RadioInput value="1-3" name="companySize">1-3</RadioInput>
|
|
32
|
-
<RadioInput value="4-7" name="companySize">4-7</RadioInput>
|
|
33
|
-
<RadioInput value="8-10" name="companySize">8-10</RadioInput>
|
|
34
|
-
<RadioInput value="11-20" name="companySize">11-20</RadioInput>
|
|
35
|
-
<FormDebugger />
|
|
36
|
-
</>
|
|
37
|
-
)
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
import * as React from 'react'
|
|
3
|
-
import { Formik, Form } from 'formik'
|
|
4
|
-
import { TaskRecommendationInput } from 'ui'
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title :'f/fields/TaskRecommendationInput',
|
|
8
|
-
component :TaskRecommendationInput,
|
|
9
|
-
subcomponents:{
|
|
10
|
-
// Item:TaskRecommendation.Item
|
|
11
|
-
},
|
|
12
|
-
decorators:[
|
|
13
|
-
(storyfn) => (
|
|
14
|
-
<Formik
|
|
15
|
-
initialValues={{ taskRecommendations: [] }}
|
|
16
|
-
>
|
|
17
|
-
<Form>
|
|
18
|
-
{ storyfn() }
|
|
19
|
-
</Form>
|
|
20
|
-
</Formik>
|
|
21
|
-
),
|
|
22
|
-
],
|
|
23
|
-
argTypes:{
|
|
24
|
-
backgroundColor:{ control: 'color' },
|
|
25
|
-
},
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const Base = () => (
|
|
29
|
-
<div className="y-background1 b-y v2 p-v" style={{ height: '100%' }}>
|
|
30
|
-
<TaskRecommendationInput
|
|
31
|
-
name="taskRecommendations"
|
|
32
|
-
value="businessTypes"
|
|
33
|
-
oneLiner="Build a list of contacts at businesses based on my criteria for potential customers"
|
|
34
|
-
label="Find potential business customers"
|
|
35
|
-
image="/Fundraising.svg"
|
|
36
|
-
/>
|
|
37
|
-
</div>
|
|
38
|
-
)
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
import * as React from 'react'
|
|
3
|
-
|
|
4
|
-
import { useLayoutEffect, memo } from 'react'
|
|
5
|
-
|
|
6
|
-
import { useField } from 'formik'
|
|
7
|
-
|
|
8
|
-
import PropTypes from 'prop-types'
|
|
9
|
-
|
|
10
|
-
import styleNames from '@pareto-engineering/bem'
|
|
11
|
-
|
|
12
|
-
import { FormLabel, FormDescription } from '../../common'
|
|
13
|
-
|
|
14
|
-
// Local Definitions
|
|
15
|
-
|
|
16
|
-
const baseClassName = styleNames.base
|
|
17
|
-
|
|
18
|
-
const componentClassName = 'checkbox-input'
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* This is the component description.
|
|
22
|
-
*/
|
|
23
|
-
const CheckboxInput = ({
|
|
24
|
-
id,
|
|
25
|
-
className:userClassName,
|
|
26
|
-
style,
|
|
27
|
-
children,
|
|
28
|
-
value,
|
|
29
|
-
name,
|
|
30
|
-
// ...otherProps
|
|
31
|
-
}) => {
|
|
32
|
-
useLayoutEffect(() => {
|
|
33
|
-
import('./styles.scss')
|
|
34
|
-
}, [])
|
|
35
|
-
|
|
36
|
-
const [field, meta] = useField(name)
|
|
37
|
-
|
|
38
|
-
const isOptionSelected = !!(field.value?.length > 0 && field.value.includes(value))
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<div
|
|
42
|
-
id={id}
|
|
43
|
-
className={[
|
|
44
|
-
|
|
45
|
-
baseClassName,
|
|
46
|
-
|
|
47
|
-
componentClassName,
|
|
48
|
-
userClassName,
|
|
49
|
-
]
|
|
50
|
-
.filter((e) => e)
|
|
51
|
-
.join(' ')}
|
|
52
|
-
style={style}
|
|
53
|
-
// {...otherProps}
|
|
54
|
-
>
|
|
55
|
-
<div
|
|
56
|
-
className={`${isOptionSelected ? 'selected' : 'not-selected'} input-content uc v1 pv-v`}
|
|
57
|
-
>
|
|
58
|
-
<FormLabel name={name}>
|
|
59
|
-
<input {...field} id={name} value={value} className="input" type="checkbox" />
|
|
60
|
-
<span>
|
|
61
|
-
{children}
|
|
62
|
-
</span>
|
|
63
|
-
</FormLabel>
|
|
64
|
-
</div>
|
|
65
|
-
{meta.error && meta.touched && <FormDescription error>{meta.error}</FormDescription>}
|
|
66
|
-
|
|
67
|
-
</div>
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
CheckboxInput.propTypes = {
|
|
72
|
-
/**
|
|
73
|
-
* The HTML id for this element
|
|
74
|
-
*/
|
|
75
|
-
id:PropTypes.string,
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* The HTML class names for this element
|
|
79
|
-
*/
|
|
80
|
-
className:PropTypes.string,
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* The input name (html - and Formik state)
|
|
84
|
-
*/
|
|
85
|
-
name:PropTypes.string.isRequired,
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* The input value
|
|
89
|
-
*/
|
|
90
|
-
value:PropTypes.string.isRequired,
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* The React-written, css properties for this element.
|
|
94
|
-
*/
|
|
95
|
-
style:PropTypes.objectOf(PropTypes.string),
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* The children JSX
|
|
99
|
-
*/
|
|
100
|
-
children:PropTypes.node,
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
CheckboxInput.defaultProps = {
|
|
104
|
-
// someProp:false
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export default memo(CheckboxInput)
|