@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,84 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { memo } from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { TextInput, TextareaInput, ChoicesInput, SelectInput } from "../fields"; // Local Definitions
|
|
8
|
+
// const baseClassName = styleNames.base
|
|
9
|
+
|
|
10
|
+
const componentClassName = 'form-input';
|
|
11
|
+
/**
|
|
12
|
+
* This is the component description.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const FormInput = ({
|
|
16
|
+
className,
|
|
17
|
+
type,
|
|
18
|
+
extraTypes,
|
|
19
|
+
disabled,
|
|
20
|
+
...otherProps
|
|
21
|
+
}) => {
|
|
22
|
+
const newClassName = [className, componentClassName].filter(Boolean).join(' ');
|
|
23
|
+
|
|
24
|
+
if (type === 'textarea') {
|
|
25
|
+
return /*#__PURE__*/React.createElement(TextareaInput, _extends({
|
|
26
|
+
className: newClassName,
|
|
27
|
+
disabled: disabled
|
|
28
|
+
}, otherProps));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (type === 'choices') {
|
|
32
|
+
return /*#__PURE__*/React.createElement(ChoicesInput, _extends({
|
|
33
|
+
className: newClassName,
|
|
34
|
+
disabled: disabled
|
|
35
|
+
}, otherProps));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (type === 'select') {
|
|
39
|
+
return /*#__PURE__*/React.createElement(SelectInput, _extends({
|
|
40
|
+
className: newClassName,
|
|
41
|
+
disabled: disabled
|
|
42
|
+
}, otherProps));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (extraTypes !== null && extraTypes !== void 0 && extraTypes[type]) {
|
|
46
|
+
const Component = extraTypes[type];
|
|
47
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
48
|
+
className: newClassName,
|
|
49
|
+
disabled: disabled
|
|
50
|
+
}, otherProps));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return /*#__PURE__*/React.createElement(TextInput, _extends({
|
|
54
|
+
className: newClassName,
|
|
55
|
+
disabled: disabled
|
|
56
|
+
}, otherProps));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
FormInput.propTypes = {
|
|
60
|
+
/**
|
|
61
|
+
* The HTML class names for this element
|
|
62
|
+
*/
|
|
63
|
+
className: PropTypes.string,
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The HTML class names for this element
|
|
67
|
+
*/
|
|
68
|
+
type: PropTypes.oneOf(['text', 'email', 'password', 'number', 'date', 'datetime', 'month', 'tel', 'hidden', 'select', 'choices', 'textarea', // to be removed
|
|
69
|
+
'extendedTypeInput']),
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The object with external Input types that would make the form input extensible
|
|
73
|
+
*/
|
|
74
|
+
extraTypes: PropTypes.objectOf(PropTypes.func),
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Whether the Form input input should be disabled
|
|
78
|
+
*/
|
|
79
|
+
disabled: PropTypes.bool
|
|
80
|
+
};
|
|
81
|
+
FormInput.defaultProps = {
|
|
82
|
+
disabled: false
|
|
83
|
+
};
|
|
84
|
+
export default /*#__PURE__*/memo(FormInput);
|
|
@@ -16,6 +16,7 @@ const Label = ({
|
|
|
16
16
|
style,
|
|
17
17
|
children,
|
|
18
18
|
name,
|
|
19
|
+
color,
|
|
19
20
|
as: Wrapper // ...otherProps
|
|
20
21
|
|
|
21
22
|
}) => {
|
|
@@ -25,7 +26,7 @@ const Label = ({
|
|
|
25
26
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
26
27
|
htmlFor: Wrapper === 'label' ? name : undefined,
|
|
27
28
|
id: id,
|
|
28
|
-
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
29
|
+
className: [baseClassName, componentClassName, userClassName, `x-${color}`].filter(e => e).join(' '),
|
|
29
30
|
style: style // {...otherProps}
|
|
30
31
|
|
|
31
32
|
}, children);
|
|
@@ -60,10 +61,16 @@ Label.propTypes = {
|
|
|
60
61
|
/**
|
|
61
62
|
* The html tag that acts as an input label
|
|
62
63
|
*/
|
|
63
|
-
as: PropTypes.node
|
|
64
|
+
as: PropTypes.node,
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The default color of the label
|
|
68
|
+
*/
|
|
69
|
+
color: PropTypes.string
|
|
64
70
|
};
|
|
65
71
|
Label.defaultProps = {
|
|
66
72
|
// someProp:false
|
|
67
|
-
as: 'label'
|
|
73
|
+
as: 'label',
|
|
74
|
+
color: 'main1'
|
|
68
75
|
};
|
|
69
76
|
export default Label;
|
|
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { useLayoutEffect } from 'react';
|
|
5
|
+
import { useLayoutEffect, memo } from 'react';
|
|
6
6
|
import { useField } from 'formik';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import styleNames from '@pareto-engineering/bem';
|
|
@@ -82,4 +82,4 @@ CheckboxInput.propTypes = {
|
|
|
82
82
|
};
|
|
83
83
|
CheckboxInput.defaultProps = {// someProp:false
|
|
84
84
|
};
|
|
85
|
-
export default CheckboxInput;
|
|
85
|
+
export default /*#__PURE__*/memo(CheckboxInput);
|
|
@@ -2,11 +2,12 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { useLayoutEffect } from 'react';
|
|
5
|
+
import { useLayoutEffect, memo } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import styleNames from '@pareto-engineering/bem';
|
|
8
|
-
import { Choice } from "./common"; // Local Definitions
|
|
7
|
+
import styleNames from '@pareto-engineering/bem'; // Local Definitions
|
|
9
8
|
|
|
9
|
+
import { Choice } from "./common";
|
|
10
|
+
import { FormLabel } from "../../common";
|
|
10
11
|
const baseClassName = styleNames.base;
|
|
11
12
|
const componentClassName = 'choices-input';
|
|
12
13
|
/**
|
|
@@ -19,12 +20,14 @@ const ChoicesInput = ({
|
|
|
19
20
|
style,
|
|
20
21
|
name,
|
|
21
22
|
validate,
|
|
22
|
-
|
|
23
|
+
options,
|
|
23
24
|
multiple,
|
|
24
25
|
gridColumnsMobile,
|
|
25
26
|
gridColumnsDesktop,
|
|
26
27
|
color,
|
|
27
|
-
colorChecked
|
|
28
|
+
colorChecked,
|
|
29
|
+
label,
|
|
30
|
+
disabled // ...otherProps
|
|
28
31
|
|
|
29
32
|
}) => {
|
|
30
33
|
useLayoutEffect(() => {
|
|
@@ -39,13 +42,18 @@ const ChoicesInput = ({
|
|
|
39
42
|
...style
|
|
40
43
|
} // {...otherProps}
|
|
41
44
|
|
|
42
|
-
},
|
|
45
|
+
}, label && /*#__PURE__*/React.createElement(FormLabel, {
|
|
46
|
+
as: "p"
|
|
47
|
+
}, label), /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: "choices"
|
|
49
|
+
}, options.map(choice => /*#__PURE__*/React.createElement(Choice, _extends({
|
|
43
50
|
key: choice.value,
|
|
44
51
|
name: name,
|
|
45
52
|
id: `${id}-${choice.value}`,
|
|
46
53
|
multiple: multiple,
|
|
47
|
-
validate: validate
|
|
48
|
-
|
|
54
|
+
validate: validate,
|
|
55
|
+
disabled: disabled
|
|
56
|
+
}, choice)))));
|
|
49
57
|
};
|
|
50
58
|
|
|
51
59
|
ChoicesInput.propTypes = {
|
|
@@ -75,9 +83,9 @@ ChoicesInput.propTypes = {
|
|
|
75
83
|
validate: PropTypes.string,
|
|
76
84
|
|
|
77
85
|
/**
|
|
78
|
-
* The choices
|
|
86
|
+
* The choices input options
|
|
79
87
|
*/
|
|
80
|
-
|
|
88
|
+
options: PropTypes.arrayOf(PropTypes.shape({
|
|
81
89
|
value: PropTypes.string,
|
|
82
90
|
label: PropTypes.string
|
|
83
91
|
})),
|
|
@@ -105,12 +113,23 @@ ChoicesInput.propTypes = {
|
|
|
105
113
|
/**
|
|
106
114
|
* The selected choice color
|
|
107
115
|
*/
|
|
108
|
-
colorChecked: PropTypes.string
|
|
116
|
+
colorChecked: PropTypes.string,
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The label of the choices input
|
|
120
|
+
*/
|
|
121
|
+
label: PropTypes.string,
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Whether all the Choices inputs should be disabled
|
|
125
|
+
*/
|
|
126
|
+
disabled: PropTypes.bool
|
|
109
127
|
};
|
|
110
128
|
ChoicesInput.defaultProps = {
|
|
111
129
|
gridColumnsMobile: 2,
|
|
112
130
|
gridColumnsDesktop: 3,
|
|
113
131
|
color: 'background',
|
|
114
|
-
colorChecked: 'main1'
|
|
132
|
+
colorChecked: 'main1',
|
|
133
|
+
disabled: false
|
|
115
134
|
};
|
|
116
|
-
export default ChoicesInput;
|
|
135
|
+
export default /*#__PURE__*/memo(ChoicesInput);
|
|
@@ -22,7 +22,8 @@ const Choice = ({
|
|
|
22
22
|
labelStyle,
|
|
23
23
|
value,
|
|
24
24
|
multiple,
|
|
25
|
-
validate
|
|
25
|
+
validate,
|
|
26
|
+
disabled
|
|
26
27
|
}) => {
|
|
27
28
|
const [field] = useField({
|
|
28
29
|
name,
|
|
@@ -36,7 +37,8 @@ const Choice = ({
|
|
|
36
37
|
id: id,
|
|
37
38
|
name: name
|
|
38
39
|
}, field, {
|
|
39
|
-
value: value
|
|
40
|
+
value: value,
|
|
41
|
+
disabled: disabled
|
|
40
42
|
})), /*#__PURE__*/React.createElement("label", {
|
|
41
43
|
htmlFor: id,
|
|
42
44
|
className: labelClassName,
|
|
@@ -93,6 +95,11 @@ Choice.propTypes = {
|
|
|
93
95
|
/**
|
|
94
96
|
* The input field validator function
|
|
95
97
|
*/
|
|
96
|
-
validate: PropTypes.func
|
|
98
|
+
validate: PropTypes.func,
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Whether the radio or checkbox choice should be disabled
|
|
102
|
+
*/
|
|
103
|
+
disabled: PropTypes.bool
|
|
97
104
|
};
|
|
98
105
|
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
|
}
|
|
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { useLayoutEffect } from 'react';
|
|
5
|
+
import { useLayoutEffect, memo } from 'react';
|
|
6
6
|
import { useField } from 'formik';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import styleNames from '@pareto-engineering/bem';
|
|
@@ -87,4 +87,4 @@ RadioInput.propTypes = {
|
|
|
87
87
|
};
|
|
88
88
|
RadioInput.defaultProps = {// someProp:false
|
|
89
89
|
};
|
|
90
|
-
export default RadioInput;
|
|
90
|
+
export default /*#__PURE__*/memo(RadioInput);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useState, useLayoutEffect } from 'react';
|
|
3
|
+
import { useState, useLayoutEffect, memo } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import styleNames from '@pareto-engineering/bem'; // Local Definitions
|
|
6
6
|
|
|
@@ -100,4 +100,4 @@ RatingsInput.defaultProps = {
|
|
|
100
100
|
labelMin: 'not satisfied.',
|
|
101
101
|
labelMax: 'very satisfied.'
|
|
102
102
|
};
|
|
103
|
-
export default RatingsInput;
|
|
103
|
+
export default /*#__PURE__*/memo(RatingsInput);
|
|
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { useLayoutEffect } from 'react';
|
|
5
|
+
import { useLayoutEffect, memo } from 'react';
|
|
6
6
|
import { useField } from 'formik';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import styleNames from '@pareto-engineering/bem';
|
|
@@ -20,7 +20,8 @@ const SelectInput = ({
|
|
|
20
20
|
style,
|
|
21
21
|
name,
|
|
22
22
|
label,
|
|
23
|
-
options
|
|
23
|
+
options,
|
|
24
|
+
disabled // ...otherProps
|
|
24
25
|
|
|
25
26
|
}) => {
|
|
26
27
|
useLayoutEffect(() => {
|
|
@@ -38,7 +39,8 @@ const SelectInput = ({
|
|
|
38
39
|
}, label), /*#__PURE__*/React.createElement("select", _extends({
|
|
39
40
|
className: "input v25 pv-v"
|
|
40
41
|
}, field, {
|
|
41
|
-
id: name
|
|
42
|
+
id: name,
|
|
43
|
+
disabled: disabled
|
|
42
44
|
}), options.map(option => {
|
|
43
45
|
// i.e if option is a string like "blah", return { value: "blah", label: "blah" }
|
|
44
46
|
const newOption = typeof option === 'string' ? {
|
|
@@ -86,8 +88,14 @@ SelectInput.propTypes = {
|
|
|
86
88
|
options: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
|
|
87
89
|
value: PropTypes.string,
|
|
88
90
|
label: PropTypes.string
|
|
89
|
-
})]))
|
|
91
|
+
})])),
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Whether the select input should be disabled
|
|
95
|
+
*/
|
|
96
|
+
disabled: PropTypes.bool
|
|
90
97
|
};
|
|
91
|
-
SelectInput.defaultProps = {
|
|
98
|
+
SelectInput.defaultProps = {
|
|
99
|
+
disabled: false
|
|
92
100
|
};
|
|
93
|
-
export default SelectInput;
|
|
101
|
+
export default /*#__PURE__*/memo(SelectInput);
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { useLayoutEffect, memo } from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { useField } from 'formik';
|
|
8
|
+
import styleNames from '@pareto-engineering/bem';
|
|
9
|
+
import { FormLabel } from "../../common"; // Local Definitions
|
|
10
|
+
|
|
11
|
+
const baseClassName = styleNames.base;
|
|
12
|
+
const componentClassName = 'task-recommendation-input';
|
|
13
|
+
/**
|
|
14
|
+
* This is the component description.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const TaskRecommendationInput = ({
|
|
18
|
+
id,
|
|
19
|
+
className: userClassName,
|
|
20
|
+
style,
|
|
21
|
+
name,
|
|
22
|
+
value,
|
|
23
|
+
oneLiner,
|
|
24
|
+
label,
|
|
25
|
+
color,
|
|
26
|
+
image // ...otherProps
|
|
27
|
+
|
|
28
|
+
}) => {
|
|
29
|
+
var _field$value;
|
|
30
|
+
|
|
31
|
+
useLayoutEffect(() => {
|
|
32
|
+
import("./styles.scss");
|
|
33
|
+
}, []);
|
|
34
|
+
const [field] = useField(name);
|
|
35
|
+
const isOptionSelected = !!(((_field$value = field.value) === null || _field$value === void 0 ? void 0 : _field$value.length) > 0 && field.value.includes(value));
|
|
36
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
id: id,
|
|
38
|
+
className: [baseClassName, componentClassName, userClassName, `x-${color}`].filter(e => e).join(' '),
|
|
39
|
+
style: style // {...otherProps}
|
|
40
|
+
|
|
41
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: `task-content ${isOptionSelected ? 'b-x' : 'b-on-x'}`
|
|
43
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
className: "v1 p-v task"
|
|
45
|
+
}, /*#__PURE__*/React.createElement(FormLabel, {
|
|
46
|
+
className: `uc mb-v ${isOptionSelected ? 'c-on-x' : 'c-x'}`,
|
|
47
|
+
name: name
|
|
48
|
+
}, label), /*#__PURE__*/React.createElement("input", _extends({}, field, {
|
|
49
|
+
value: value,
|
|
50
|
+
id: name,
|
|
51
|
+
className: "input",
|
|
52
|
+
type: "checkbox"
|
|
53
|
+
})), /*#__PURE__*/React.createElement("img", {
|
|
54
|
+
className: "image",
|
|
55
|
+
src: image,
|
|
56
|
+
alt: "img"
|
|
57
|
+
}), /*#__PURE__*/React.createElement("p", {
|
|
58
|
+
className: ['uc u2 mt-u', isOptionSelected && 'c-on-x'].filter(e => e).join(' ')
|
|
59
|
+
}, oneLiner))));
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
TaskRecommendationInput.propTypes = {
|
|
63
|
+
/**
|
|
64
|
+
* The HTML id for this element
|
|
65
|
+
*/
|
|
66
|
+
id: PropTypes.string,
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The HTML class names for this element
|
|
70
|
+
*/
|
|
71
|
+
className: PropTypes.string,
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The React-written, css properties for this element.
|
|
75
|
+
*/
|
|
76
|
+
style: PropTypes.objectOf(PropTypes.string),
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The name of the input
|
|
80
|
+
*/
|
|
81
|
+
name: PropTypes.string.isRequired,
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The value of the input
|
|
85
|
+
*/
|
|
86
|
+
value: PropTypes.string.isRequired,
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The task one liner description
|
|
90
|
+
*/
|
|
91
|
+
oneLiner: PropTypes.string.isRequired,
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The task label
|
|
95
|
+
*/
|
|
96
|
+
label: PropTypes.string.isRequired,
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The color
|
|
100
|
+
*/
|
|
101
|
+
color: PropTypes.string,
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Task image
|
|
105
|
+
*/
|
|
106
|
+
image: PropTypes.string.isRequired
|
|
107
|
+
};
|
|
108
|
+
TaskRecommendationInput.defaultProps = {
|
|
109
|
+
color: 'main2'
|
|
110
|
+
};
|
|
111
|
+
export default /*#__PURE__*/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
|
+
|
|
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { useLayoutEffect } from 'react';
|
|
5
|
+
import { useLayoutEffect, memo } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import styleNames from '@pareto-engineering/bem';
|
|
8
8
|
import { useField } from 'formik';
|
|
@@ -23,7 +23,8 @@ const TextInput = ({
|
|
|
23
23
|
label,
|
|
24
24
|
validate,
|
|
25
25
|
oneInputLabel,
|
|
26
|
-
description
|
|
26
|
+
description,
|
|
27
|
+
disabled // ...otherProps
|
|
27
28
|
|
|
28
29
|
}) => {
|
|
29
30
|
useLayoutEffect(() => {
|
|
@@ -44,7 +45,8 @@ const TextInput = ({
|
|
|
44
45
|
}, label), /*#__PURE__*/React.createElement("input", _extends({
|
|
45
46
|
id: name,
|
|
46
47
|
className: `input ${meta.touched && meta.error ? 'input-border-error' : 'input-border'}`,
|
|
47
|
-
type: type
|
|
48
|
+
type: type,
|
|
49
|
+
disabled: disabled
|
|
48
50
|
}, field)), (description || meta.touched && meta.error) && /*#__PURE__*/React.createElement(FormDescription, {
|
|
49
51
|
isError: !!meta.error,
|
|
50
52
|
className: "v50 mt-v s-1"
|
|
@@ -95,9 +97,15 @@ TextInput.propTypes = {
|
|
|
95
97
|
/**
|
|
96
98
|
* Input description
|
|
97
99
|
*/
|
|
98
|
-
description: PropTypes.string
|
|
100
|
+
description: PropTypes.string,
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Whether the text input should be disabled
|
|
104
|
+
*/
|
|
105
|
+
disabled: PropTypes.bool
|
|
99
106
|
};
|
|
100
107
|
TextInput.defaultProps = {
|
|
101
|
-
type: 'text'
|
|
108
|
+
type: 'text',
|
|
109
|
+
disabled: false
|
|
102
110
|
};
|
|
103
|
-
export default TextInput;
|
|
111
|
+
export default /*#__PURE__*/memo(TextInput);
|