@pareto-engineering/design-system 0.0.1-alpha.67 → 0.0.1-alpha.70
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/config/global-setup.js +3 -0
- package/dist/cjs/a/Timestamp/Timestamp.js +139 -0
- package/dist/cjs/a/{RatingsInput/common/Rating → Timestamp}/index.js +3 -3
- package/dist/cjs/a/Timestamp/styles.scss +7 -0
- package/dist/cjs/a/index.js +9 -1
- package/dist/cjs/f/FormInput/FormInput.js +109 -0
- package/dist/cjs/{a/RatingsInput → f/FormInput}/index.js +3 -3
- package/dist/cjs/f/common/Label/Label.js +10 -3
- package/dist/cjs/f/common/Label/styles.scss +3 -3
- package/dist/cjs/f/fields/CheckboxInput/CheckboxInput.js +3 -1
- package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +32 -11
- package/dist/cjs/f/fields/ChoicesInput/common/Choice/Choice.js +10 -3
- package/dist/cjs/f/fields/ChoicesInput/styles.scss +32 -29
- package/dist/cjs/f/fields/RadioInput/RadioInput.js +3 -1
- package/dist/cjs/f/fields/RatingsInput/RatingsInput.js +3 -1
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +15 -5
- package/dist/cjs/{a/RatingsInput/common/Rating/Rating.js → f/fields/TaskRecommendationInput/TaskRecommendationInput.js} +57 -46
- package/dist/cjs/f/fields/TaskRecommendationInput/index.js +15 -0
- package/{src/ui/f/fields/TaskRecommendation → dist/cjs/f/fields/TaskRecommendationInput}/styles.scss +1 -1
- package/dist/cjs/f/fields/TextInput/TextInput.js +15 -5
- package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +151 -0
- package/dist/cjs/f/fields/TextareaInput/index.js +15 -0
- package/{src/ui/f/fields/TextArea → dist/cjs/f/fields/TextareaInput}/styles.scss +1 -1
- package/dist/cjs/f/fields/index.js +6 -6
- package/dist/cjs/f/index.js +14 -1
- package/dist/es/a/Timestamp/Timestamp.js +122 -0
- package/dist/es/a/Timestamp/index.js +2 -0
- package/dist/es/a/Timestamp/styles.scss +7 -0
- package/dist/es/a/index.js +2 -1
- package/dist/es/f/FormInput/FormInput.js +84 -0
- package/dist/es/f/FormInput/index.js +2 -0
- package/dist/es/f/common/Label/Label.js +10 -3
- package/dist/es/f/common/Label/styles.scss +3 -3
- package/dist/es/f/fields/CheckboxInput/CheckboxInput.js +2 -2
- package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +32 -13
- package/dist/es/f/fields/ChoicesInput/common/Choice/Choice.js +10 -3
- package/dist/es/f/fields/ChoicesInput/styles.scss +32 -29
- package/dist/es/f/fields/RadioInput/RadioInput.js +2 -2
- package/dist/es/f/fields/RatingsInput/RatingsInput.js +2 -2
- package/dist/es/f/fields/SelectInput/SelectInput.js +14 -6
- package/dist/es/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +111 -0
- package/dist/es/f/fields/TaskRecommendationInput/index.js +2 -0
- package/dist/es/f/fields/TaskRecommendationInput/styles.scss +37 -0
- package/dist/es/f/fields/TextInput/TextInput.js +14 -6
- package/dist/es/f/fields/TextareaInput/TextareaInput.js +132 -0
- package/dist/es/f/fields/TextareaInput/index.js +2 -0
- package/dist/es/f/fields/TextareaInput/styles.scss +19 -0
- package/dist/es/f/fields/index.js +2 -2
- package/dist/es/f/index.js +2 -1
- package/jest.config.js +2 -1
- package/package.json +1 -1
- package/src/__snapshots__/Storyshots.test.js.snap +1204 -383
- package/src/stories/a/Timestamp.stories.jsx +102 -0
- package/src/stories/f/ChoicesInput.stories.jsx +54 -6
- package/src/stories/f/FormInput.stories.jsx +187 -0
- package/src/stories/f/SelectInput.stories.jsx +14 -0
- package/src/stories/f/{TaskRecommendation.stories.jsx → TaskRecommendationInput.stories.jsx} +4 -4
- package/src/stories/f/TextInput.stories.jsx +10 -0
- package/src/stories/f/{TextArea.stories.jsx → TextareaInput.stories.jsx} +15 -5
- package/src/ui/a/Timestamp/Timestamp.jsx +168 -0
- package/src/ui/a/Timestamp/index.js +2 -0
- package/src/ui/a/Timestamp/styles.scss +7 -0
- package/src/ui/a/index.js +1 -0
- package/src/ui/f/FormInput/FormInput.jsx +121 -0
- package/src/ui/f/FormInput/index.js +2 -0
- package/src/ui/f/common/Label/Label.jsx +10 -2
- package/src/ui/f/common/Label/styles.scss +3 -3
- package/src/ui/f/fields/CheckboxInput/CheckboxInput.jsx +2 -2
- package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +37 -17
- package/src/ui/f/fields/ChoicesInput/common/Choice/Choice.jsx +6 -0
- package/src/ui/f/fields/ChoicesInput/styles.scss +32 -29
- package/src/ui/f/fields/RadioInput/RadioInput.jsx +2 -2
- package/src/ui/f/fields/RatingsInput/RatingsInput.jsx +2 -2
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +9 -4
- package/src/ui/f/fields/{TaskRecommendation/TaskRecommendation.jsx → TaskRecommendationInput/TaskRecommendationInput.jsx} +6 -6
- package/src/ui/f/fields/TaskRecommendationInput/index.js +2 -0
- package/src/ui/f/fields/TaskRecommendationInput/styles.scss +37 -0
- package/src/ui/f/fields/TextInput/TextInput.jsx +10 -3
- package/src/ui/f/fields/{TextArea/TextArea.jsx → TextareaInput/TextareaInput.jsx} +13 -6
- package/src/ui/f/fields/TextareaInput/index.js +2 -0
- package/src/ui/f/fields/TextareaInput/styles.scss +19 -0
- package/src/ui/f/fields/index.js +2 -2
- package/src/ui/f/index.js +1 -0
- package/dist/cjs/a/RatingsInput/RatingsInput.js +0 -88
- package/dist/cjs/a/RatingsInput/common/index.js +0 -13
- package/dist/cjs/a/RatingsInput/styles.scss +0 -35
- package/dist/es/a/RatingsInput/RatingsInput.js +0 -72
- package/dist/es/a/RatingsInput/common/Rating/Rating.js +0 -102
- package/dist/es/a/RatingsInput/common/Rating/index.js +0 -2
- package/dist/es/a/RatingsInput/common/index.js +0 -1
- package/dist/es/a/RatingsInput/index.js +0 -2
- package/dist/es/a/RatingsInput/styles.scss +0 -35
- package/src/ui/f/fields/TaskRecommendation/index.js +0 -2
- package/src/ui/f/fields/TextArea/index.js +0 -2
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { memo } from 'react'
|
|
5
|
+
|
|
6
|
+
import PropTypes from 'prop-types'
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
TextInput,
|
|
10
|
+
TextareaInput,
|
|
11
|
+
ChoicesInput,
|
|
12
|
+
SelectInput,
|
|
13
|
+
} from '../fields'
|
|
14
|
+
|
|
15
|
+
// Local Definitions
|
|
16
|
+
|
|
17
|
+
// const baseClassName = styleNames.base
|
|
18
|
+
|
|
19
|
+
const componentClassName = 'form-input'
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* This is the component description.
|
|
23
|
+
*/
|
|
24
|
+
const FormInput = ({
|
|
25
|
+
className,
|
|
26
|
+
type,
|
|
27
|
+
extraTypes,
|
|
28
|
+
disabled,
|
|
29
|
+
...otherProps
|
|
30
|
+
}) => {
|
|
31
|
+
const newClassName = [
|
|
32
|
+
className,
|
|
33
|
+
componentClassName,
|
|
34
|
+
].filter(Boolean).join(' ')
|
|
35
|
+
|
|
36
|
+
if (type === 'textarea') {
|
|
37
|
+
return (
|
|
38
|
+
<TextareaInput
|
|
39
|
+
className={newClassName}
|
|
40
|
+
disabled={disabled}
|
|
41
|
+
{...otherProps}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
if (type === 'choices') {
|
|
46
|
+
return (
|
|
47
|
+
<ChoicesInput
|
|
48
|
+
className={newClassName}
|
|
49
|
+
disabled={disabled}
|
|
50
|
+
{...otherProps}
|
|
51
|
+
/>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
if (type === 'select') {
|
|
55
|
+
return (
|
|
56
|
+
<SelectInput
|
|
57
|
+
className={newClassName}
|
|
58
|
+
disabled={disabled}
|
|
59
|
+
{...otherProps}
|
|
60
|
+
/>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
if (extraTypes?.[type]) {
|
|
64
|
+
const Component = extraTypes[type]
|
|
65
|
+
return (
|
|
66
|
+
<Component
|
|
67
|
+
className={newClassName}
|
|
68
|
+
disabled={disabled}
|
|
69
|
+
{...otherProps}
|
|
70
|
+
/>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
return (
|
|
74
|
+
<TextInput
|
|
75
|
+
className={newClassName}
|
|
76
|
+
disabled={disabled}
|
|
77
|
+
{...otherProps}
|
|
78
|
+
/>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
FormInput.propTypes = {
|
|
83
|
+
/**
|
|
84
|
+
* The HTML class names for this element
|
|
85
|
+
*/
|
|
86
|
+
className:PropTypes.string,
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The HTML class names for this element
|
|
90
|
+
*/
|
|
91
|
+
type:PropTypes.oneOf([
|
|
92
|
+
'text',
|
|
93
|
+
'email',
|
|
94
|
+
'password',
|
|
95
|
+
'number',
|
|
96
|
+
'date',
|
|
97
|
+
'datetime',
|
|
98
|
+
'month',
|
|
99
|
+
'tel',
|
|
100
|
+
'hidden',
|
|
101
|
+
'select',
|
|
102
|
+
'choices',
|
|
103
|
+
'textarea',
|
|
104
|
+
// to be removed
|
|
105
|
+
'extendedTypeInput',
|
|
106
|
+
]),
|
|
107
|
+
/**
|
|
108
|
+
* The object with external Input types that would make the form input extensible
|
|
109
|
+
*/
|
|
110
|
+
extraTypes:PropTypes.objectOf(PropTypes.func),
|
|
111
|
+
/**
|
|
112
|
+
* Whether the Form input input should be disabled
|
|
113
|
+
*/
|
|
114
|
+
disabled :PropTypes.bool,
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
FormInput.defaultProps = {
|
|
118
|
+
disabled:false,
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export default memo(FormInput)
|
|
@@ -22,6 +22,7 @@ const Label = ({
|
|
|
22
22
|
style,
|
|
23
23
|
children,
|
|
24
24
|
name,
|
|
25
|
+
color,
|
|
25
26
|
as:Wrapper,
|
|
26
27
|
// ...otherProps
|
|
27
28
|
}) => {
|
|
@@ -37,6 +38,7 @@ const Label = ({
|
|
|
37
38
|
baseClassName,
|
|
38
39
|
componentClassName,
|
|
39
40
|
userClassName,
|
|
41
|
+
`x-${color}`,
|
|
40
42
|
]
|
|
41
43
|
.filter((e) => e)
|
|
42
44
|
.join(' ')}
|
|
@@ -77,12 +79,18 @@ Label.propTypes = {
|
|
|
77
79
|
/**
|
|
78
80
|
* The html tag that acts as an input label
|
|
79
81
|
*/
|
|
80
|
-
as:PropTypes.node,
|
|
82
|
+
as :PropTypes.node,
|
|
83
|
+
/**
|
|
84
|
+
* The default color of the label
|
|
85
|
+
*/
|
|
86
|
+
color:PropTypes.string,
|
|
87
|
+
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
Label.defaultProps = {
|
|
84
91
|
// someProp:false
|
|
85
|
-
as:'label',
|
|
92
|
+
as :'label',
|
|
93
|
+
color:'main1',
|
|
86
94
|
}
|
|
87
95
|
|
|
88
96
|
export default Label
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
|
|
4
|
-
import { useLayoutEffect } from 'react'
|
|
4
|
+
import { useLayoutEffect, memo } from 'react'
|
|
5
5
|
|
|
6
6
|
import { useField } from 'formik'
|
|
7
7
|
|
|
@@ -104,4 +104,4 @@ CheckboxInput.defaultProps = {
|
|
|
104
104
|
// someProp:false
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
export default CheckboxInput
|
|
107
|
+
export default memo(CheckboxInput)
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
|
|
4
|
-
import { useLayoutEffect } from 'react'
|
|
4
|
+
import { useLayoutEffect, memo } from 'react'
|
|
5
5
|
|
|
6
6
|
import PropTypes from 'prop-types'
|
|
7
7
|
|
|
8
8
|
import styleNames from '@pareto-engineering/bem'
|
|
9
9
|
|
|
10
|
+
// Local Definitions
|
|
11
|
+
|
|
10
12
|
import { Choice } from './common'
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
import { FormLabel } from '../../common'
|
|
13
15
|
|
|
14
16
|
const baseClassName = styleNames.base
|
|
15
17
|
|
|
@@ -24,12 +26,14 @@ const ChoicesInput = ({
|
|
|
24
26
|
style,
|
|
25
27
|
name,
|
|
26
28
|
validate,
|
|
27
|
-
|
|
29
|
+
options,
|
|
28
30
|
multiple,
|
|
29
31
|
gridColumnsMobile,
|
|
30
32
|
gridColumnsDesktop,
|
|
31
33
|
color,
|
|
32
34
|
colorChecked,
|
|
35
|
+
label,
|
|
36
|
+
disabled,
|
|
33
37
|
// ...otherProps
|
|
34
38
|
}) => {
|
|
35
39
|
useLayoutEffect(() => {
|
|
@@ -58,16 +62,24 @@ const ChoicesInput = ({
|
|
|
58
62
|
}}
|
|
59
63
|
// {...otherProps}
|
|
60
64
|
>
|
|
61
|
-
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
{label && (
|
|
66
|
+
<FormLabel as="p">
|
|
67
|
+
{label}
|
|
68
|
+
</FormLabel>
|
|
69
|
+
)}
|
|
70
|
+
<div className="choices">
|
|
71
|
+
{ options.map((choice) => (
|
|
72
|
+
<Choice
|
|
73
|
+
key={choice.value}
|
|
74
|
+
name={name}
|
|
75
|
+
id={`${id}-${choice.value}`}
|
|
76
|
+
multiple={multiple}
|
|
77
|
+
validate={validate}
|
|
78
|
+
disabled={disabled}
|
|
79
|
+
{...choice}
|
|
80
|
+
/>
|
|
81
|
+
))}
|
|
82
|
+
</div>
|
|
71
83
|
</div>
|
|
72
84
|
)
|
|
73
85
|
}
|
|
@@ -96,9 +108,9 @@ ChoicesInput.propTypes = {
|
|
|
96
108
|
*/
|
|
97
109
|
validate:PropTypes.string,
|
|
98
110
|
/**
|
|
99
|
-
* The choices
|
|
111
|
+
* The choices input options
|
|
100
112
|
*/
|
|
101
|
-
|
|
113
|
+
options :PropTypes.arrayOf(PropTypes.shape({
|
|
102
114
|
value:PropTypes.string,
|
|
103
115
|
label:PropTypes.string,
|
|
104
116
|
})),
|
|
@@ -122,7 +134,14 @@ ChoicesInput.propTypes = {
|
|
|
122
134
|
* The selected choice color
|
|
123
135
|
*/
|
|
124
136
|
colorChecked :PropTypes.string,
|
|
125
|
-
|
|
137
|
+
/**
|
|
138
|
+
* The label of the choices input
|
|
139
|
+
*/
|
|
140
|
+
label :PropTypes.string,
|
|
141
|
+
/**
|
|
142
|
+
* Whether all the Choices inputs should be disabled
|
|
143
|
+
*/
|
|
144
|
+
disabled :PropTypes.bool,
|
|
126
145
|
}
|
|
127
146
|
|
|
128
147
|
ChoicesInput.defaultProps = {
|
|
@@ -130,6 +149,7 @@ ChoicesInput.defaultProps = {
|
|
|
130
149
|
gridColumnsDesktop:3,
|
|
131
150
|
color :'background',
|
|
132
151
|
colorChecked :'main1',
|
|
152
|
+
disabled :false,
|
|
133
153
|
}
|
|
134
154
|
|
|
135
|
-
export default ChoicesInput
|
|
155
|
+
export default memo(ChoicesInput)
|
|
@@ -26,6 +26,7 @@ const Choice = ({
|
|
|
26
26
|
value,
|
|
27
27
|
multiple,
|
|
28
28
|
validate,
|
|
29
|
+
disabled,
|
|
29
30
|
}) => {
|
|
30
31
|
const [field] = useField({ name, validate })
|
|
31
32
|
return (
|
|
@@ -47,6 +48,7 @@ const Choice = ({
|
|
|
47
48
|
name={name}
|
|
48
49
|
{...field}
|
|
49
50
|
value={value}
|
|
51
|
+
disabled={disabled}
|
|
50
52
|
/>
|
|
51
53
|
<label htmlFor={id} className={labelClassName} style={labelStyle}>
|
|
52
54
|
{ label }
|
|
@@ -99,6 +101,10 @@ Choice.propTypes = {
|
|
|
99
101
|
* The input field validator function
|
|
100
102
|
*/
|
|
101
103
|
validate :PropTypes.func,
|
|
104
|
+
/**
|
|
105
|
+
* Whether the radio or checkbox choice should be disabled
|
|
106
|
+
*/
|
|
107
|
+
disabled :PropTypes.bool,
|
|
102
108
|
}
|
|
103
109
|
|
|
104
110
|
export default Choice
|
|
@@ -9,39 +9,42 @@ $default-padding:var(--u, 1em);
|
|
|
9
9
|
$default-transition:all .3s;
|
|
10
10
|
|
|
11
11
|
.#{bem.$base}.choices-input {
|
|
12
|
-
display: grid;
|
|
13
|
-
gap: $default-grid-gap;
|
|
14
|
-
grid-template-columns: repeat(var(--grid-columns-mobile), 1fr);
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
.choice {
|
|
21
|
-
display: flex;
|
|
22
|
-
|
|
23
|
-
input {
|
|
24
|
-
opacity: 0;
|
|
25
|
-
position: absolute;
|
|
26
|
-
visibility: none;
|
|
27
|
-
z-index: -1;
|
|
28
|
-
}
|
|
13
|
+
.choices {
|
|
14
|
+
display: grid;
|
|
15
|
+
gap: $default-grid-gap;
|
|
16
|
+
grid-template-columns: repeat(var(--grid-columns-mobile), 1fr);
|
|
29
17
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
border-radius: var(--theme-border-radius);
|
|
33
|
-
color: var(--on-x);
|
|
34
|
-
display: block;
|
|
35
|
-
height: 100%;
|
|
36
|
-
padding: $default-padding;
|
|
37
|
-
transition: $default-transition;
|
|
38
|
-
width: 100%;
|
|
39
|
-
cursor: pointer;
|
|
18
|
+
@include mixins.media($from:$sm-md) {
|
|
19
|
+
grid-template-columns: repeat(var(--grid-columns-desktop), 1fr);
|
|
40
20
|
}
|
|
41
21
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
22
|
+
.choice {
|
|
23
|
+
display: flex;
|
|
24
|
+
|
|
25
|
+
input {
|
|
26
|
+
opacity: 0;
|
|
27
|
+
position: absolute;
|
|
28
|
+
visibility: none;
|
|
29
|
+
z-index: -1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
label {
|
|
33
|
+
background: var(--x);
|
|
34
|
+
border-radius: var(--theme-border-radius);
|
|
35
|
+
color: var(--on-x);
|
|
36
|
+
display: block;
|
|
37
|
+
height: 100%;
|
|
38
|
+
padding: $default-padding;
|
|
39
|
+
transition: $default-transition;
|
|
40
|
+
width: 100%;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
input:checked + label {
|
|
45
|
+
background: var(--y);
|
|
46
|
+
color: var(--on-y);
|
|
47
|
+
}
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
|
|
4
|
-
import { useLayoutEffect } from 'react'
|
|
4
|
+
import { useLayoutEffect, memo } from 'react'
|
|
5
5
|
|
|
6
6
|
import { useField } from 'formik'
|
|
7
7
|
|
|
@@ -109,4 +109,4 @@ RadioInput.defaultProps = {
|
|
|
109
109
|
// someProp:false
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
export default RadioInput
|
|
112
|
+
export default memo(RadioInput)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
|
|
4
|
-
import { useState, useLayoutEffect } from 'react'
|
|
4
|
+
import { useState, useLayoutEffect, memo } from 'react'
|
|
5
5
|
|
|
6
6
|
import PropTypes from 'prop-types'
|
|
7
7
|
|
|
@@ -116,4 +116,4 @@ RatingsInput.defaultProps = {
|
|
|
116
116
|
labelMax:'very satisfied.',
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
export default RatingsInput
|
|
119
|
+
export default memo(RatingsInput)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
|
|
4
|
-
import { useLayoutEffect } from 'react'
|
|
4
|
+
import { useLayoutEffect, memo } from 'react'
|
|
5
5
|
|
|
6
6
|
import { useField } from 'formik'
|
|
7
7
|
|
|
@@ -27,6 +27,7 @@ const SelectInput = ({
|
|
|
27
27
|
name,
|
|
28
28
|
label,
|
|
29
29
|
options,
|
|
30
|
+
disabled,
|
|
30
31
|
// ...otherProps
|
|
31
32
|
}) => {
|
|
32
33
|
useLayoutEffect(() => {
|
|
@@ -51,7 +52,7 @@ const SelectInput = ({
|
|
|
51
52
|
// {...otherProps}
|
|
52
53
|
>
|
|
53
54
|
<FormLabel className="input-label" name={name}>{label}</FormLabel>
|
|
54
|
-
<select className="input v25 pv-v" {...field} id={name}>
|
|
55
|
+
<select className="input v25 pv-v" {...field} id={name} disabled={disabled}>
|
|
55
56
|
{
|
|
56
57
|
options.map((option) => {
|
|
57
58
|
// i.e if option is a string like "blah", return { value: "blah", label: "blah" }
|
|
@@ -100,10 +101,14 @@ SelectInput.propTypes = {
|
|
|
100
101
|
[PropTypes.string, PropTypes.shape({ value: PropTypes.string, label: PropTypes.string })],
|
|
101
102
|
),
|
|
102
103
|
),
|
|
104
|
+
/**
|
|
105
|
+
* Whether the select input should be disabled
|
|
106
|
+
*/
|
|
107
|
+
disabled:PropTypes.bool,
|
|
103
108
|
}
|
|
104
109
|
|
|
105
110
|
SelectInput.defaultProps = {
|
|
106
|
-
|
|
111
|
+
disabled:false,
|
|
107
112
|
}
|
|
108
113
|
|
|
109
|
-
export default SelectInput
|
|
114
|
+
export default memo(SelectInput)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
|
|
4
|
-
import { useLayoutEffect } from 'react'
|
|
4
|
+
import { useLayoutEffect, memo } from 'react'
|
|
5
5
|
|
|
6
6
|
import PropTypes from 'prop-types'
|
|
7
7
|
|
|
@@ -15,12 +15,12 @@ import { FormLabel } from '../../common'
|
|
|
15
15
|
|
|
16
16
|
const baseClassName = styleNames.base
|
|
17
17
|
|
|
18
|
-
const componentClassName = 'task-recommendation'
|
|
18
|
+
const componentClassName = 'task-recommendation-input'
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* This is the component description.
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const TaskRecommendationInput = ({
|
|
24
24
|
id,
|
|
25
25
|
className:userClassName,
|
|
26
26
|
style,
|
|
@@ -80,7 +80,7 @@ const TaskRecommendation = ({
|
|
|
80
80
|
)
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
TaskRecommendationInput.propTypes = {
|
|
84
84
|
/**
|
|
85
85
|
* The HTML id for this element
|
|
86
86
|
*/
|
|
@@ -123,8 +123,8 @@ TaskRecommendation.propTypes = {
|
|
|
123
123
|
image :PropTypes.string.isRequired,
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
TaskRecommendationInput.defaultProps = {
|
|
127
127
|
color:'main2',
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
export default
|
|
130
|
+
export default memo(TaskRecommendationInput)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
@use "@pareto-engineering/bem";
|
|
3
|
+
|
|
4
|
+
.#{bem.$base}.task-recommendation-input {
|
|
5
|
+
|
|
6
|
+
.task-content {
|
|
7
|
+
border-radius: var(--theme-border-radius);
|
|
8
|
+
border: 1px solid var(--x);
|
|
9
|
+
height: 100%;
|
|
10
|
+
|
|
11
|
+
.task {
|
|
12
|
+
position: relative;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
justify-content: space-around;
|
|
16
|
+
align-items: center;
|
|
17
|
+
height: 100%;
|
|
18
|
+
|
|
19
|
+
.input {
|
|
20
|
+
appearance: none;
|
|
21
|
+
position: absolute;
|
|
22
|
+
left: 0;
|
|
23
|
+
top: 0;
|
|
24
|
+
bottom:0;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
width: 100%;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.image {
|
|
30
|
+
width: 7rem;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
|
|
4
|
-
import { useLayoutEffect } from 'react'
|
|
4
|
+
import { useLayoutEffect, memo } from 'react'
|
|
5
5
|
|
|
6
6
|
import PropTypes from 'prop-types'
|
|
7
7
|
|
|
@@ -30,6 +30,7 @@ const TextInput = ({
|
|
|
30
30
|
validate,
|
|
31
31
|
oneInputLabel,
|
|
32
32
|
description,
|
|
33
|
+
disabled,
|
|
33
34
|
// ...otherProps
|
|
34
35
|
}) => {
|
|
35
36
|
useLayoutEffect(() => {
|
|
@@ -64,6 +65,7 @@ const TextInput = ({
|
|
|
64
65
|
id={name}
|
|
65
66
|
className={`input ${meta.touched && meta.error ? 'input-border-error' : 'input-border'}`}
|
|
66
67
|
type={type}
|
|
68
|
+
disabled={disabled}
|
|
67
69
|
{...field}
|
|
68
70
|
/>
|
|
69
71
|
{(description || (meta.touched && meta.error))
|
|
@@ -129,10 +131,15 @@ TextInput.propTypes = {
|
|
|
129
131
|
* Input description
|
|
130
132
|
*/
|
|
131
133
|
description :PropTypes.string,
|
|
134
|
+
/**
|
|
135
|
+
* Whether the text input should be disabled
|
|
136
|
+
*/
|
|
137
|
+
disabled :PropTypes.bool,
|
|
132
138
|
}
|
|
133
139
|
|
|
134
140
|
TextInput.defaultProps = {
|
|
135
|
-
type:'text',
|
|
141
|
+
type :'text',
|
|
142
|
+
disabled:false,
|
|
136
143
|
}
|
|
137
144
|
|
|
138
|
-
export default TextInput
|
|
145
|
+
export default memo(TextInput)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
|
|
4
|
-
import { useLayoutEffect } from 'react'
|
|
4
|
+
import { useLayoutEffect, memo } from 'react'
|
|
5
5
|
|
|
6
6
|
import PropTypes from 'prop-types'
|
|
7
7
|
|
|
@@ -15,12 +15,12 @@ import { FormLabel, FormDescription } from '../../common'
|
|
|
15
15
|
|
|
16
16
|
const baseClassName = styleNames.base
|
|
17
17
|
|
|
18
|
-
const componentClassName = 'text-area'
|
|
18
|
+
const componentClassName = 'text-area-input'
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* This is the component description.
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const TextareaInput = ({
|
|
24
24
|
id,
|
|
25
25
|
className:userClassName,
|
|
26
26
|
style,
|
|
@@ -33,6 +33,7 @@ const TextArea = ({
|
|
|
33
33
|
textAreaColor,
|
|
34
34
|
labelColor,
|
|
35
35
|
description,
|
|
36
|
+
disabled,
|
|
36
37
|
// ...otherProps
|
|
37
38
|
}) => {
|
|
38
39
|
useLayoutEffect(() => {
|
|
@@ -72,6 +73,7 @@ const TextArea = ({
|
|
|
72
73
|
className={`textarea v50 pv-v ${meta.touched && meta.error ? 'input-border-error' : 'input-border'}`}
|
|
73
74
|
{...field}
|
|
74
75
|
rows={rows}
|
|
76
|
+
disabled={disabled}
|
|
75
77
|
>
|
|
76
78
|
{/* It was a dark and stormy night... */}
|
|
77
79
|
</textarea>
|
|
@@ -87,7 +89,7 @@ const TextArea = ({
|
|
|
87
89
|
)
|
|
88
90
|
}
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
TextareaInput.propTypes = {
|
|
91
93
|
/**
|
|
92
94
|
* The HTML id for this element
|
|
93
95
|
*/
|
|
@@ -141,12 +143,17 @@ TextArea.propTypes = {
|
|
|
141
143
|
* Text area description
|
|
142
144
|
*/
|
|
143
145
|
description :PropTypes.string,
|
|
146
|
+
/**
|
|
147
|
+
* Whether the text area should be disabled
|
|
148
|
+
*/
|
|
149
|
+
disabled :PropTypes.bool,
|
|
144
150
|
}
|
|
145
151
|
|
|
146
|
-
|
|
152
|
+
TextareaInput.defaultProps = {
|
|
147
153
|
rows :3,
|
|
148
154
|
textAreaColor:'background',
|
|
149
155
|
labelColor :'main1',
|
|
156
|
+
disabled :false,
|
|
150
157
|
}
|
|
151
158
|
|
|
152
|
-
export default
|
|
159
|
+
export default memo(TextareaInput)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
@use "@pareto-engineering/bem";
|
|
3
|
+
|
|
4
|
+
.#{bem.$base}.text-area-input{
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
|
|
8
|
+
.textarea {
|
|
9
|
+
background: var(--light-x);
|
|
10
|
+
color: var(--on-x);
|
|
11
|
+
|
|
12
|
+
&:focus {
|
|
13
|
+
background: var(--dark-x);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|