@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,132 @@
|
|
|
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 styleNames from '@pareto-engineering/bem';
|
|
8
|
+
import { useField } from 'formik'; // Local Definitions
|
|
9
|
+
|
|
10
|
+
import { FormLabel, FormDescription } from "../../common";
|
|
11
|
+
const baseClassName = styleNames.base;
|
|
12
|
+
const componentClassName = 'text-area-input';
|
|
13
|
+
/**
|
|
14
|
+
* This is the component description.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const TextareaInput = ({
|
|
18
|
+
id,
|
|
19
|
+
className: userClassName,
|
|
20
|
+
style,
|
|
21
|
+
name,
|
|
22
|
+
label,
|
|
23
|
+
validate,
|
|
24
|
+
labelAsDescription,
|
|
25
|
+
textAreaId,
|
|
26
|
+
rows,
|
|
27
|
+
textAreaColor,
|
|
28
|
+
labelColor,
|
|
29
|
+
description,
|
|
30
|
+
disabled // ...otherProps
|
|
31
|
+
|
|
32
|
+
}) => {
|
|
33
|
+
useLayoutEffect(() => {
|
|
34
|
+
import("./styles.scss");
|
|
35
|
+
}, []);
|
|
36
|
+
const [field, meta] = useField({
|
|
37
|
+
name,
|
|
38
|
+
validate
|
|
39
|
+
});
|
|
40
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
id: id,
|
|
42
|
+
className: [baseClassName, componentClassName, userClassName, `x-${textAreaColor}`, `y-${labelColor}`].filter(e => e).join(' '),
|
|
43
|
+
style: style // {...otherProps}
|
|
44
|
+
|
|
45
|
+
}, /*#__PURE__*/React.createElement(FormLabel, {
|
|
46
|
+
className: ['c-y', labelAsDescription ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
|
|
47
|
+
name: name
|
|
48
|
+
}, label), /*#__PURE__*/React.createElement("textarea", _extends({
|
|
49
|
+
id: textAreaId,
|
|
50
|
+
className: `textarea v50 pv-v ${meta.touched && meta.error ? 'input-border-error' : 'input-border'}`
|
|
51
|
+
}, field, {
|
|
52
|
+
rows: rows,
|
|
53
|
+
disabled: disabled
|
|
54
|
+
})), (description || meta.touched && meta.error) && /*#__PURE__*/React.createElement(FormDescription, {
|
|
55
|
+
isError: !!meta.error,
|
|
56
|
+
className: "v50 mt-v s-1"
|
|
57
|
+
}, meta.error || description), ' ');
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
TextareaInput.propTypes = {
|
|
61
|
+
/**
|
|
62
|
+
* The HTML id for this element
|
|
63
|
+
*/
|
|
64
|
+
id: PropTypes.string,
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The HTML class names for this element
|
|
68
|
+
*/
|
|
69
|
+
className: PropTypes.string,
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The React-written, css properties for this element.
|
|
73
|
+
*/
|
|
74
|
+
style: PropTypes.objectOf(PropTypes.string),
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The input name (html - and Formik state)
|
|
78
|
+
*/
|
|
79
|
+
name: PropTypes.string.isRequired,
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The input label
|
|
83
|
+
*/
|
|
84
|
+
label: PropTypes.string.isRequired,
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The input value validator function
|
|
88
|
+
*/
|
|
89
|
+
validate: PropTypes.func,
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* If the text area depends on it's label's text as the default description
|
|
93
|
+
*/
|
|
94
|
+
labelAsDescription: PropTypes.bool,
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The textarea id
|
|
98
|
+
*/
|
|
99
|
+
textAreaId: PropTypes.string,
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The number of rows int the text area
|
|
103
|
+
*/
|
|
104
|
+
rows: PropTypes.number,
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Text area base color
|
|
108
|
+
*/
|
|
109
|
+
textAreaColor: PropTypes.string,
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Label base color
|
|
113
|
+
*/
|
|
114
|
+
labelColor: PropTypes.string,
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Text area description
|
|
118
|
+
*/
|
|
119
|
+
description: PropTypes.string,
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Whether the text area should be disabled
|
|
123
|
+
*/
|
|
124
|
+
disabled: PropTypes.bool
|
|
125
|
+
};
|
|
126
|
+
TextareaInput.defaultProps = {
|
|
127
|
+
rows: 3,
|
|
128
|
+
textAreaColor: 'background',
|
|
129
|
+
labelColor: 'main1',
|
|
130
|
+
disabled: false
|
|
131
|
+
};
|
|
132
|
+
export default /*#__PURE__*/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
|
+
|
|
@@ -2,7 +2,7 @@ export { TextInput } from "./TextInput";
|
|
|
2
2
|
export { SelectInput } from "./SelectInput";
|
|
3
3
|
export { RadioInput } from "./RadioInput";
|
|
4
4
|
export { CheckboxInput } from "./CheckboxInput";
|
|
5
|
-
export {
|
|
5
|
+
export { TaskRecommendationInput } from "./TaskRecommendationInput";
|
|
6
6
|
export { ChoicesInput } from "./ChoicesInput";
|
|
7
|
-
export {
|
|
7
|
+
export { TextareaInput } from "./TextareaInput";
|
|
8
8
|
export { RatingsInput } from "./RatingsInput";
|
package/dist/es/f/index.js
CHANGED
package/jest.config.js
CHANGED
|
@@ -17,7 +17,8 @@ module.exports = {
|
|
|
17
17
|
'^.+\\.[tj]sx?$':'babel-jest',
|
|
18
18
|
'^.+\\.mdx$' :'@storybook/addon-docs/jest-transform-mdx',
|
|
19
19
|
},
|
|
20
|
-
setupFiles:['<rootDir>/config/test-setup.js'],
|
|
20
|
+
setupFiles :['<rootDir>/config/test-setup.js'],
|
|
21
21
|
testEnvironment:'jsdom',
|
|
22
22
|
// transformIgnorePatterns: [`node_modules/(?!${esModules})`],
|
|
23
|
+
globalSetup :'<rootDir>/config/global-setup.js',
|
|
23
24
|
}
|