@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.
Files changed (94) hide show
  1. package/config/global-setup.js +3 -0
  2. package/dist/cjs/a/Timestamp/Timestamp.js +139 -0
  3. package/dist/cjs/a/{RatingsInput/common/Rating → Timestamp}/index.js +3 -3
  4. package/dist/cjs/a/Timestamp/styles.scss +7 -0
  5. package/dist/cjs/a/index.js +9 -1
  6. package/dist/cjs/f/FormInput/FormInput.js +109 -0
  7. package/dist/cjs/{a/RatingsInput → f/FormInput}/index.js +3 -3
  8. package/dist/cjs/f/common/Label/Label.js +10 -3
  9. package/dist/cjs/f/common/Label/styles.scss +3 -3
  10. package/dist/cjs/f/fields/CheckboxInput/CheckboxInput.js +3 -1
  11. package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +32 -11
  12. package/dist/cjs/f/fields/ChoicesInput/common/Choice/Choice.js +10 -3
  13. package/dist/cjs/f/fields/ChoicesInput/styles.scss +32 -29
  14. package/dist/cjs/f/fields/RadioInput/RadioInput.js +3 -1
  15. package/dist/cjs/f/fields/RatingsInput/RatingsInput.js +3 -1
  16. package/dist/cjs/f/fields/SelectInput/SelectInput.js +15 -5
  17. package/dist/cjs/{a/RatingsInput/common/Rating/Rating.js → f/fields/TaskRecommendationInput/TaskRecommendationInput.js} +57 -46
  18. package/dist/cjs/f/fields/TaskRecommendationInput/index.js +15 -0
  19. package/{src/ui/f/fields/TaskRecommendation → dist/cjs/f/fields/TaskRecommendationInput}/styles.scss +1 -1
  20. package/dist/cjs/f/fields/TextInput/TextInput.js +15 -5
  21. package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +151 -0
  22. package/dist/cjs/f/fields/TextareaInput/index.js +15 -0
  23. package/{src/ui/f/fields/TextArea → dist/cjs/f/fields/TextareaInput}/styles.scss +1 -1
  24. package/dist/cjs/f/fields/index.js +6 -6
  25. package/dist/cjs/f/index.js +14 -1
  26. package/dist/es/a/Timestamp/Timestamp.js +122 -0
  27. package/dist/es/a/Timestamp/index.js +2 -0
  28. package/dist/es/a/Timestamp/styles.scss +7 -0
  29. package/dist/es/a/index.js +2 -1
  30. package/dist/es/f/FormInput/FormInput.js +84 -0
  31. package/dist/es/f/FormInput/index.js +2 -0
  32. package/dist/es/f/common/Label/Label.js +10 -3
  33. package/dist/es/f/common/Label/styles.scss +3 -3
  34. package/dist/es/f/fields/CheckboxInput/CheckboxInput.js +2 -2
  35. package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +32 -13
  36. package/dist/es/f/fields/ChoicesInput/common/Choice/Choice.js +10 -3
  37. package/dist/es/f/fields/ChoicesInput/styles.scss +32 -29
  38. package/dist/es/f/fields/RadioInput/RadioInput.js +2 -2
  39. package/dist/es/f/fields/RatingsInput/RatingsInput.js +2 -2
  40. package/dist/es/f/fields/SelectInput/SelectInput.js +14 -6
  41. package/dist/es/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +111 -0
  42. package/dist/es/f/fields/TaskRecommendationInput/index.js +2 -0
  43. package/dist/es/f/fields/TaskRecommendationInput/styles.scss +37 -0
  44. package/dist/es/f/fields/TextInput/TextInput.js +14 -6
  45. package/dist/es/f/fields/TextareaInput/TextareaInput.js +132 -0
  46. package/dist/es/f/fields/TextareaInput/index.js +2 -0
  47. package/dist/es/f/fields/TextareaInput/styles.scss +19 -0
  48. package/dist/es/f/fields/index.js +2 -2
  49. package/dist/es/f/index.js +2 -1
  50. package/jest.config.js +2 -1
  51. package/package.json +1 -1
  52. package/src/__snapshots__/Storyshots.test.js.snap +1204 -383
  53. package/src/stories/a/Timestamp.stories.jsx +102 -0
  54. package/src/stories/f/ChoicesInput.stories.jsx +54 -6
  55. package/src/stories/f/FormInput.stories.jsx +187 -0
  56. package/src/stories/f/SelectInput.stories.jsx +14 -0
  57. package/src/stories/f/{TaskRecommendation.stories.jsx → TaskRecommendationInput.stories.jsx} +4 -4
  58. package/src/stories/f/TextInput.stories.jsx +10 -0
  59. package/src/stories/f/{TextArea.stories.jsx → TextareaInput.stories.jsx} +15 -5
  60. package/src/ui/a/Timestamp/Timestamp.jsx +168 -0
  61. package/src/ui/a/Timestamp/index.js +2 -0
  62. package/src/ui/a/Timestamp/styles.scss +7 -0
  63. package/src/ui/a/index.js +1 -0
  64. package/src/ui/f/FormInput/FormInput.jsx +121 -0
  65. package/src/ui/f/FormInput/index.js +2 -0
  66. package/src/ui/f/common/Label/Label.jsx +10 -2
  67. package/src/ui/f/common/Label/styles.scss +3 -3
  68. package/src/ui/f/fields/CheckboxInput/CheckboxInput.jsx +2 -2
  69. package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +37 -17
  70. package/src/ui/f/fields/ChoicesInput/common/Choice/Choice.jsx +6 -0
  71. package/src/ui/f/fields/ChoicesInput/styles.scss +32 -29
  72. package/src/ui/f/fields/RadioInput/RadioInput.jsx +2 -2
  73. package/src/ui/f/fields/RatingsInput/RatingsInput.jsx +2 -2
  74. package/src/ui/f/fields/SelectInput/SelectInput.jsx +9 -4
  75. package/src/ui/f/fields/{TaskRecommendation/TaskRecommendation.jsx → TaskRecommendationInput/TaskRecommendationInput.jsx} +6 -6
  76. package/src/ui/f/fields/TaskRecommendationInput/index.js +2 -0
  77. package/src/ui/f/fields/TaskRecommendationInput/styles.scss +37 -0
  78. package/src/ui/f/fields/TextInput/TextInput.jsx +10 -3
  79. package/src/ui/f/fields/{TextArea/TextArea.jsx → TextareaInput/TextareaInput.jsx} +13 -6
  80. package/src/ui/f/fields/TextareaInput/index.js +2 -0
  81. package/src/ui/f/fields/TextareaInput/styles.scss +19 -0
  82. package/src/ui/f/fields/index.js +2 -2
  83. package/src/ui/f/index.js +1 -0
  84. package/dist/cjs/a/RatingsInput/RatingsInput.js +0 -88
  85. package/dist/cjs/a/RatingsInput/common/index.js +0 -13
  86. package/dist/cjs/a/RatingsInput/styles.scss +0 -35
  87. package/dist/es/a/RatingsInput/RatingsInput.js +0 -72
  88. package/dist/es/a/RatingsInput/common/Rating/Rating.js +0 -102
  89. package/dist/es/a/RatingsInput/common/Rating/index.js +0 -2
  90. package/dist/es/a/RatingsInput/common/index.js +0 -1
  91. package/dist/es/a/RatingsInput/index.js +0 -2
  92. package/dist/es/a/RatingsInput/styles.scss +0 -35
  93. package/src/ui/f/fields/TaskRecommendation/index.js +0 -2
  94. 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,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as TextareaInput } from "./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 { TaskRecommendation } from "./TaskRecommendation";
5
+ export { TaskRecommendationInput } from "./TaskRecommendationInput";
6
6
  export { ChoicesInput } from "./ChoicesInput";
7
- export { TextArea } from "./TextArea";
7
+ export { TextareaInput } from "./TextareaInput";
8
8
  export { RatingsInput } from "./RatingsInput";
@@ -1,2 +1,3 @@
1
1
  export * from "./common";
2
- export * from "./fields";
2
+ export * from "./fields";
3
+ export { FormInput } from "./FormInput";
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pareto-engineering/design-system",
3
- "version": "0.0.1-alpha.67",
3
+ "version": "0.0.1-alpha.70",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",