@pareto-engineering/design-system 2.0.0-alpha.64 → 2.0.0-alpha.65

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 (35) hide show
  1. package/dist/cjs/f/common/Label/Label.js +10 -4
  2. package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +9 -2
  3. package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +8 -1
  4. package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +10 -3
  5. package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +9 -2
  6. package/dist/cjs/f/fields/QuerySelect/QuerySelect.js +8 -1
  7. package/dist/cjs/f/fields/SelectInput/SelectInput.js +9 -2
  8. package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +9 -2
  9. package/dist/es/f/common/Label/Label.js +10 -4
  10. package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +9 -2
  11. package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +8 -1
  12. package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +10 -3
  13. package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +9 -2
  14. package/dist/es/f/fields/QuerySelect/QuerySelect.js +8 -1
  15. package/dist/es/f/fields/SelectInput/SelectInput.js +9 -2
  16. package/dist/es/f/fields/TextareaInput/TextareaInput.js +9 -2
  17. package/package.json +1 -1
  18. package/src/__snapshots__/Storyshots.test.js.snap +670 -27
  19. package/src/stories/f/Checkbox.stories.jsx +1 -1
  20. package/src/stories/f/ChoicesInput.stories.jsx +8 -0
  21. package/src/stories/f/Label.stories.jsx +8 -3
  22. package/src/stories/f/QueryCombobox.stories.jsx +6 -0
  23. package/src/stories/f/QuerySelect.stories.jsx +8 -1
  24. package/src/stories/f/RatingsInput.stories.jsx +7 -0
  25. package/src/stories/f/SelectInput.stories.jsx +7 -0
  26. package/src/stories/f/TextInput.stories.jsx +7 -0
  27. package/src/stories/f/TextareaInput.stories.jsx +7 -0
  28. package/src/ui/f/common/Label/Label.jsx +9 -3
  29. package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +7 -1
  30. package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +7 -0
  31. package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +11 -1
  32. package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +11 -1
  33. package/src/ui/f/fields/QuerySelect/QuerySelect.jsx +7 -0
  34. package/src/ui/f/fields/SelectInput/SelectInput.jsx +7 -1
  35. package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +7 -0
@@ -32,6 +32,7 @@ var Label = _ref => {
32
32
  children,
33
33
  name,
34
34
  color,
35
+ optional,
35
36
  as: Wrapper // ...otherProps
36
37
 
37
38
  } = _ref;
@@ -44,7 +45,7 @@ var Label = _ref => {
44
45
  className: [baseClassName, componentClassName, userClassName, "x-".concat(color)].filter(e => e).join(' '),
45
46
  style: style // {...otherProps}
46
47
 
47
- }, children);
48
+ }, children, optional && '(Optional)');
48
49
  };
49
50
 
50
51
  Label.propTypes = {
@@ -81,12 +82,17 @@ Label.propTypes = {
81
82
  /**
82
83
  * The default color of the label
83
84
  */
84
- color: _propTypes.default.string
85
+ color: _propTypes.default.string,
86
+
87
+ /**
88
+ * Whether the input should have an optional tag
89
+ */
90
+ optional: _propTypes.default.bool
85
91
  };
86
92
  Label.defaultProps = {
87
- // someProp:false
88
93
  as: 'label',
89
- color: 'main2'
94
+ color: 'main2',
95
+ optional: false
90
96
  };
91
97
  var _default = Label;
92
98
  exports.default = _default;
@@ -49,6 +49,7 @@ var ChoicesInput = _ref => {
49
49
  color,
50
50
  colorChecked,
51
51
  label,
52
+ optional,
52
53
  disabled // ...otherProps
53
54
 
54
55
  } = _ref;
@@ -64,7 +65,8 @@ var ChoicesInput = _ref => {
64
65
  }, style) // {...otherProps}
65
66
 
66
67
  }, label && /*#__PURE__*/React.createElement(_common2.FormLabel, {
67
- as: "p"
68
+ as: "p",
69
+ optional: optional
68
70
  }, label), /*#__PURE__*/React.createElement("div", {
69
71
  className: "choices"
70
72
  }, options.map(choice => /*#__PURE__*/React.createElement(_common.Choice, _extends({
@@ -144,7 +146,12 @@ ChoicesInput.propTypes = {
144
146
  /**
145
147
  * Whether all the Choices inputs should be disabled
146
148
  */
147
- disabled: _propTypes.default.bool
149
+ disabled: _propTypes.default.bool,
150
+
151
+ /**
152
+ * Whether the input is optional or not
153
+ */
154
+ optional: _propTypes.default.bool
148
155
  };
149
156
  ChoicesInput.defaultProps = {
150
157
  gridColumnsMobile: 2,
@@ -40,6 +40,7 @@ var QueryCombobox = _ref => {
40
40
  name,
41
41
  label,
42
42
  color,
43
+ optional,
43
44
  description,
44
45
  disabled,
45
46
  debounceMs,
@@ -117,6 +118,7 @@ var QueryCombobox = _ref => {
117
118
  disabled,
118
119
  name,
119
120
  label,
121
+ optional,
120
122
  description,
121
123
  setValue,
122
124
  value,
@@ -226,7 +228,12 @@ QueryCombobox.propTypes = {
226
228
  /**
227
229
  * The query combobox field validator function
228
230
  */
229
- validate: _propTypes.default.func
231
+ validate: _propTypes.default.func,
232
+
233
+ /*
234
+ * Whether the input is optional or not
235
+ */
236
+ optional: _propTypes.default.bool
230
237
  };
231
238
  QueryCombobox.defaultProps = {
232
239
  optionsKeyMap: {
@@ -49,7 +49,8 @@ var Combobox = _ref => {
49
49
  minLength,
50
50
  isFetching,
51
51
  transformSearch,
52
- disabled // ...otherProps
52
+ disabled,
53
+ optional // ...otherProps
53
54
 
54
55
  } = _ref;
55
56
  var {
@@ -97,7 +98,8 @@ var Combobox = _ref => {
97
98
  style: style,
98
99
  ref: parentRef
99
100
  }, /*#__PURE__*/React.createElement(_.FormLabel, _extends({}, getLabelProps(), {
100
- name: name
101
+ name: name,
102
+ optional: optional
101
103
  }), label), /*#__PURE__*/React.createElement("div", _extends({}, getComboboxProps(), {
102
104
  className: "input-wrapper"
103
105
  }), /*#__PURE__*/React.createElement("input", _extends({}, getInputProps(), {
@@ -200,7 +202,12 @@ Combobox.propTypes = {
200
202
  /**
201
203
  * Whether the input filed shpuld be disabled
202
204
  */
203
- disabled: _propTypes.default.bool
205
+ disabled: _propTypes.default.bool,
206
+
207
+ /**
208
+ * Whether the input is optional or not
209
+ */
210
+ optional: _propTypes.default.bool
204
211
  };
205
212
  Combobox.defaultProps = {// someProp: false
206
213
  };
@@ -57,6 +57,7 @@ var MultipleCombobox = _ref => {
57
57
  style,
58
58
  label,
59
59
  name,
60
+ optional,
60
61
  options: items,
61
62
  getOptions,
62
63
  setValue,
@@ -173,7 +174,8 @@ var MultipleCombobox = _ref => {
173
174
  className: [baseClassName, componentClassName, userClassName, "y-".concat(color)].filter(e => e).join(' '),
174
175
  style: style
175
176
  }, /*#__PURE__*/React.createElement(_.FormLabel, _extends({}, getLabelProps(), {
176
- name: name
177
+ name: name,
178
+ optional: optional
177
179
  }), label), (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) > 0 && /*#__PURE__*/React.createElement("div", {
178
180
  className: "selected-items"
179
181
  }, selectedItems.map((selectedItem, index) => /*#__PURE__*/React.createElement("div", _extends({
@@ -299,7 +301,12 @@ MultipleCombobox.propTypes = {
299
301
  /**
300
302
  * Whether the input filed shpuld be disabled
301
303
  */
302
- disabled: _propTypes.default.bool
304
+ disabled: _propTypes.default.bool,
305
+
306
+ /**
307
+ * Whether the input is optional or not
308
+ */
309
+ optional: _propTypes.default.bool
303
310
  };
304
311
  MultipleCombobox.defaultProps = {// someProp: false
305
312
  };
@@ -34,6 +34,7 @@ var QuerySelect = _ref => {
34
34
  style,
35
35
  name,
36
36
  label,
37
+ optional,
37
38
  query,
38
39
  variables,
39
40
  optionsKeyMap,
@@ -97,6 +98,7 @@ var QuerySelect = _ref => {
97
98
  style: style,
98
99
  name: name,
99
100
  label: label,
101
+ optional: optional,
100
102
  color: color,
101
103
  description: description,
102
104
  disabled: isFetching || disabled,
@@ -190,7 +192,12 @@ QuerySelect.propTypes = {
190
192
  /**
191
193
  * The query select field validator function
192
194
  */
193
- validate: _propTypes.default.func
195
+ validate: _propTypes.default.func,
196
+
197
+ /*
198
+ * Whether the input is optional or not
199
+ */
200
+ optional: _propTypes.default.bool
194
201
  };
195
202
  QuerySelect.defaultProps = {
196
203
  disabled: false,
@@ -42,6 +42,7 @@ var SelectInput = _ref => {
42
42
  color,
43
43
  options,
44
44
  validate,
45
+ optional,
45
46
  description,
46
47
  disabled,
47
48
  isLoading,
@@ -61,7 +62,8 @@ var SelectInput = _ref => {
61
62
  style: style // {...otherProps}
62
63
 
63
64
  }, /*#__PURE__*/React.createElement(_common.FormLabel, {
64
- name: name
65
+ name: name,
66
+ optional: optional
65
67
  }, label), /*#__PURE__*/React.createElement("div", {
66
68
  className: "select-wrapper"
67
69
  }, /*#__PURE__*/React.createElement("select", _extends({
@@ -154,7 +156,12 @@ SelectInput.propTypes = {
154
156
  /**
155
157
  * The autoComplete value that the browser should watch for the input
156
158
  */
157
- autoComplete: _propTypes.default.string
159
+ autoComplete: _propTypes.default.string,
160
+
161
+ /**
162
+ * Whether the input is optional or not
163
+ */
164
+ optional: _propTypes.default.bool
158
165
  };
159
166
  SelectInput.defaultProps = {
160
167
  disabled: false,
@@ -40,6 +40,7 @@ var TextareaInput = _ref => {
40
40
  labelAsDescription,
41
41
  textAreaId,
42
42
  rows,
43
+ optional,
43
44
  textAreaColor,
44
45
  labelColor,
45
46
  description,
@@ -64,7 +65,8 @@ var TextareaInput = _ref => {
64
65
  }, /*#__PURE__*/React.createElement(_common.FormLabel, {
65
66
  className: [labelAsDescription ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
66
67
  name: name,
67
- color: labelColor
68
+ color: labelColor,
69
+ optional: optional
68
70
  }, label), /*#__PURE__*/React.createElement("textarea", _extends({
69
71
  id: textAreaId,
70
72
  className: "textarea"
@@ -163,7 +165,12 @@ TextareaInput.propTypes = {
163
165
  * Whether to disable or allow only a certain method of resizing the area
164
166
  * Textarea docs - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea
165
167
  */
166
- resize: _propTypes.default.string
168
+ resize: _propTypes.default.string,
169
+
170
+ /**
171
+ * Whether the input is optional or not
172
+ */
173
+ optional: _propTypes.default.bool
167
174
  };
168
175
  TextareaInput.defaultProps = {
169
176
  rows: 3,
@@ -17,6 +17,7 @@ const Label = ({
17
17
  children,
18
18
  name,
19
19
  color,
20
+ optional,
20
21
  as: Wrapper // ...otherProps
21
22
 
22
23
  }) => {
@@ -29,7 +30,7 @@ const Label = ({
29
30
  className: [baseClassName, componentClassName, userClassName, `x-${color}`].filter(e => e).join(' '),
30
31
  style: style // {...otherProps}
31
32
 
32
- }, children);
33
+ }, children, optional && '(Optional)');
33
34
  };
34
35
 
35
36
  Label.propTypes = {
@@ -66,11 +67,16 @@ Label.propTypes = {
66
67
  /**
67
68
  * The default color of the label
68
69
  */
69
- color: PropTypes.string
70
+ color: PropTypes.string,
71
+
72
+ /**
73
+ * Whether the input should have an optional tag
74
+ */
75
+ optional: PropTypes.bool
70
76
  };
71
77
  Label.defaultProps = {
72
- // someProp:false
73
78
  as: 'label',
74
- color: 'main2'
79
+ color: 'main2',
80
+ optional: false
75
81
  };
76
82
  export default Label;
@@ -27,6 +27,7 @@ const ChoicesInput = ({
27
27
  color,
28
28
  colorChecked,
29
29
  label,
30
+ optional,
30
31
  disabled // ...otherProps
31
32
 
32
33
  }) => {
@@ -43,7 +44,8 @@ const ChoicesInput = ({
43
44
  } // {...otherProps}
44
45
 
45
46
  }, label && /*#__PURE__*/React.createElement(FormLabel, {
46
- as: "p"
47
+ as: "p",
48
+ optional: optional
47
49
  }, label), /*#__PURE__*/React.createElement("div", {
48
50
  className: "choices"
49
51
  }, options.map(choice => /*#__PURE__*/React.createElement(Choice, _extends({
@@ -123,7 +125,12 @@ ChoicesInput.propTypes = {
123
125
  /**
124
126
  * Whether all the Choices inputs should be disabled
125
127
  */
126
- disabled: PropTypes.bool
128
+ disabled: PropTypes.bool,
129
+
130
+ /**
131
+ * Whether the input is optional or not
132
+ */
133
+ optional: PropTypes.bool
127
134
  };
128
135
  ChoicesInput.defaultProps = {
129
136
  gridColumnsMobile: 2,
@@ -19,6 +19,7 @@ const QueryCombobox = ({
19
19
  name,
20
20
  label,
21
21
  color,
22
+ optional,
22
23
  description,
23
24
  disabled,
24
25
  debounceMs,
@@ -95,6 +96,7 @@ const QueryCombobox = ({
95
96
  disabled,
96
97
  name,
97
98
  label,
99
+ optional,
98
100
  description,
99
101
  setValue,
100
102
  value,
@@ -204,7 +206,12 @@ QueryCombobox.propTypes = {
204
206
  /**
205
207
  * The query combobox field validator function
206
208
  */
207
- validate: PropTypes.func
209
+ validate: PropTypes.func,
210
+
211
+ /*
212
+ * Whether the input is optional or not
213
+ */
214
+ optional: PropTypes.bool
208
215
  };
209
216
  QueryCombobox.defaultProps = {
210
217
  optionsKeyMap: {
@@ -31,7 +31,8 @@ const Combobox = ({
31
31
  minLength,
32
32
  isFetching,
33
33
  transformSearch,
34
- disabled // ...otherProps
34
+ disabled,
35
+ optional // ...otherProps
35
36
 
36
37
  }) => {
37
38
  const {
@@ -78,7 +79,8 @@ const Combobox = ({
78
79
  style: style,
79
80
  ref: parentRef
80
81
  }, /*#__PURE__*/React.createElement(FormLabel, _extends({}, getLabelProps(), {
81
- name: name
82
+ name: name,
83
+ optional: optional
82
84
  }), label), /*#__PURE__*/React.createElement("div", _extends({}, getComboboxProps(), {
83
85
  className: "input-wrapper"
84
86
  }), /*#__PURE__*/React.createElement("input", _extends({}, getInputProps(), {
@@ -181,7 +183,12 @@ Combobox.propTypes = {
181
183
  /**
182
184
  * Whether the input filed shpuld be disabled
183
185
  */
184
- disabled: PropTypes.bool
186
+ disabled: PropTypes.bool,
187
+
188
+ /**
189
+ * Whether the input is optional or not
190
+ */
191
+ optional: PropTypes.bool
185
192
  };
186
193
  Combobox.defaultProps = {// someProp: false
187
194
  };
@@ -32,6 +32,7 @@ const MultipleCombobox = ({
32
32
  style,
33
33
  label,
34
34
  name,
35
+ optional,
35
36
  options: items,
36
37
  getOptions,
37
38
  setValue,
@@ -146,7 +147,8 @@ const MultipleCombobox = ({
146
147
  className: [baseClassName, componentClassName, userClassName, `y-${color}`].filter(e => e).join(' '),
147
148
  style: style
148
149
  }, /*#__PURE__*/React.createElement(FormLabel, _extends({}, getLabelProps(), {
149
- name: name
150
+ name: name,
151
+ optional: optional
150
152
  }), label), (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) > 0 && /*#__PURE__*/React.createElement("div", {
151
153
  className: "selected-items"
152
154
  }, selectedItems.map((selectedItem, index) => /*#__PURE__*/React.createElement("div", _extends({
@@ -272,7 +274,12 @@ MultipleCombobox.propTypes = {
272
274
  /**
273
275
  * Whether the input filed shpuld be disabled
274
276
  */
275
- disabled: PropTypes.bool
277
+ disabled: PropTypes.bool,
278
+
279
+ /**
280
+ * Whether the input is optional or not
281
+ */
282
+ optional: PropTypes.bool
276
283
  };
277
284
  MultipleCombobox.defaultProps = {// someProp: false
278
285
  };
@@ -16,6 +16,7 @@ const QuerySelect = ({
16
16
  style,
17
17
  name,
18
18
  label,
19
+ optional,
19
20
  query,
20
21
  variables,
21
22
  optionsKeyMap,
@@ -76,6 +77,7 @@ const QuerySelect = ({
76
77
  style: style,
77
78
  name: name,
78
79
  label: label,
80
+ optional: optional,
79
81
  color: color,
80
82
  description: description,
81
83
  disabled: isFetching || disabled,
@@ -169,7 +171,12 @@ QuerySelect.propTypes = {
169
171
  /**
170
172
  * The query select field validator function
171
173
  */
172
- validate: PropTypes.func
174
+ validate: PropTypes.func,
175
+
176
+ /*
177
+ * Whether the input is optional or not
178
+ */
179
+ optional: PropTypes.bool
173
180
  };
174
181
  QuerySelect.defaultProps = {
175
182
  disabled: false,
@@ -24,6 +24,7 @@ const SelectInput = ({
24
24
  color,
25
25
  options,
26
26
  validate,
27
+ optional,
27
28
  description,
28
29
  disabled,
29
30
  isLoading,
@@ -43,7 +44,8 @@ const SelectInput = ({
43
44
  style: style // {...otherProps}
44
45
 
45
46
  }, /*#__PURE__*/React.createElement(FormLabel, {
46
- name: name
47
+ name: name,
48
+ optional: optional
47
49
  }, label), /*#__PURE__*/React.createElement("div", {
48
50
  className: "select-wrapper"
49
51
  }, /*#__PURE__*/React.createElement("select", _extends({
@@ -136,7 +138,12 @@ SelectInput.propTypes = {
136
138
  /**
137
139
  * The autoComplete value that the browser should watch for the input
138
140
  */
139
- autoComplete: PropTypes.string
141
+ autoComplete: PropTypes.string,
142
+
143
+ /**
144
+ * Whether the input is optional or not
145
+ */
146
+ optional: PropTypes.bool
140
147
  };
141
148
  SelectInput.defaultProps = {
142
149
  disabled: false,
@@ -24,6 +24,7 @@ const TextareaInput = ({
24
24
  labelAsDescription,
25
25
  textAreaId,
26
26
  rows,
27
+ optional,
27
28
  textAreaColor,
28
29
  labelColor,
29
30
  description,
@@ -48,7 +49,8 @@ const TextareaInput = ({
48
49
  }, /*#__PURE__*/React.createElement(FormLabel, {
49
50
  className: [labelAsDescription ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
50
51
  name: name,
51
- color: labelColor
52
+ color: labelColor,
53
+ optional: optional
52
54
  }, label), /*#__PURE__*/React.createElement("textarea", _extends({
53
55
  id: textAreaId,
54
56
  className: "textarea"
@@ -147,7 +149,12 @@ TextareaInput.propTypes = {
147
149
  * Whether to disable or allow only a certain method of resizing the area
148
150
  * Textarea docs - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea
149
151
  */
150
- resize: PropTypes.string
152
+ resize: PropTypes.string,
153
+
154
+ /**
155
+ * Whether the input is optional or not
156
+ */
157
+ optional: PropTypes.bool
151
158
  };
152
159
  TextareaInput.defaultProps = {
153
160
  rows: 3,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pareto-engineering/design-system",
3
- "version": "2.0.0-alpha.64",
3
+ "version": "2.0.0-alpha.65",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",