@pareto-engineering/design-system 2.0.0-alpha.64 → 2.0.0-alpha.66
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/dist/cjs/a/ContentTree/ContentTree.js +1 -1
- package/dist/cjs/f/common/Label/Label.js +10 -4
- package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +9 -2
- package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +8 -1
- package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +27 -6
- package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +23 -4
- package/dist/cjs/f/fields/QueryCombobox/styles.scss +2 -1
- package/dist/cjs/f/fields/QuerySelect/QuerySelect.js +8 -1
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +9 -2
- package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +9 -2
- package/dist/cjs/v3/Button/Button.js +70 -0
- package/dist/cjs/v3/Button/index.js +15 -0
- package/dist/cjs/v3/Button/styles.scss +9 -0
- package/dist/cjs/v3/index.js +13 -0
- package/dist/es/a/ContentTree/ContentTree.js +1 -1
- package/dist/es/f/common/Label/Label.js +10 -4
- package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +9 -2
- package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +8 -1
- package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +27 -7
- package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +23 -4
- package/dist/es/f/fields/QueryCombobox/styles.scss +2 -1
- package/dist/es/f/fields/QuerySelect/QuerySelect.js +8 -1
- package/dist/es/f/fields/SelectInput/SelectInput.js +9 -2
- package/dist/es/f/fields/TextareaInput/TextareaInput.js +9 -2
- package/dist/es/v3/Button/Button.js +54 -0
- package/dist/es/v3/Button/index.js +2 -0
- package/dist/es/v3/Button/styles.scss +9 -0
- package/dist/es/v3/index.js +1 -0
- package/package.json +1 -1
- package/src/__snapshots__/Storyshots.test.js.snap +682 -28
- package/src/stories/f/Checkbox.stories.jsx +1 -1
- package/src/stories/f/ChoicesInput.stories.jsx +8 -0
- package/src/stories/f/Label.stories.jsx +8 -3
- package/src/stories/f/QueryCombobox.stories.jsx +6 -0
- package/src/stories/f/QuerySelect.stories.jsx +8 -1
- package/src/stories/f/RatingsInput.stories.jsx +7 -0
- package/src/stories/f/SelectInput.stories.jsx +7 -0
- package/src/stories/f/TextInput.stories.jsx +7 -0
- package/src/stories/f/TextareaInput.stories.jsx +7 -0
- package/src/ui/a/ContentTree/ContentTree.jsx +1 -1
- package/src/ui/f/common/Label/Label.jsx +9 -3
- package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +7 -1
- package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +7 -0
- package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +26 -3
- package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +27 -1
- package/src/ui/f/fields/QueryCombobox/styles.scss +2 -1
- package/src/ui/f/fields/QuerySelect/QuerySelect.jsx +7 -0
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +7 -1
- package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +7 -0
|
@@ -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,
|
|
@@ -69,7 +70,9 @@ const MultipleCombobox = ({
|
|
|
69
70
|
getInputProps,
|
|
70
71
|
getComboboxProps,
|
|
71
72
|
highlightedIndex,
|
|
72
|
-
getItemProps
|
|
73
|
+
getItemProps,
|
|
74
|
+
inputValue,
|
|
75
|
+
setInputValue
|
|
73
76
|
} = useCombobox({
|
|
74
77
|
searchInputValue,
|
|
75
78
|
defaultHighlightedIndex: 0,
|
|
@@ -141,12 +144,16 @@ const MultipleCombobox = ({
|
|
|
141
144
|
}
|
|
142
145
|
}, [value]);
|
|
143
146
|
const parentRef = useRef(null);
|
|
147
|
+
|
|
148
|
+
const resetInputValue = () => setInputValue('');
|
|
149
|
+
|
|
144
150
|
return /*#__PURE__*/React.createElement("div", {
|
|
145
151
|
id: id,
|
|
146
152
|
className: [baseClassName, componentClassName, userClassName, `y-${color}`].filter(e => e).join(' '),
|
|
147
153
|
style: style
|
|
148
154
|
}, /*#__PURE__*/React.createElement(FormLabel, _extends({}, getLabelProps(), {
|
|
149
|
-
name: name
|
|
155
|
+
name: name,
|
|
156
|
+
optional: optional
|
|
150
157
|
}), label), (selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length) > 0 && /*#__PURE__*/React.createElement("div", {
|
|
151
158
|
className: "selected-items"
|
|
152
159
|
}, selectedItems.map((selectedItem, index) => /*#__PURE__*/React.createElement("div", _extends({
|
|
@@ -177,7 +184,14 @@ const MultipleCombobox = ({
|
|
|
177
184
|
disabled: disabled
|
|
178
185
|
})), isFetching && /*#__PURE__*/React.createElement(LoadingCircle, {
|
|
179
186
|
className: "x-main2"
|
|
180
|
-
})
|
|
187
|
+
}), inputValue.length > minLength && !isFetching && /*#__PURE__*/React.createElement(Button, {
|
|
188
|
+
isSimple: true,
|
|
189
|
+
isCompact: true,
|
|
190
|
+
color: "main2",
|
|
191
|
+
onClick: resetInputValue
|
|
192
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
193
|
+
className: "f-icons"
|
|
194
|
+
}, "Y"))), /*#__PURE__*/React.createElement(Popover, {
|
|
181
195
|
isOpen: isOpen,
|
|
182
196
|
parentRef: parentRef
|
|
183
197
|
}, /*#__PURE__*/React.createElement(Menu, _extends({
|
|
@@ -272,7 +286,12 @@ MultipleCombobox.propTypes = {
|
|
|
272
286
|
/**
|
|
273
287
|
* Whether the input filed shpuld be disabled
|
|
274
288
|
*/
|
|
275
|
-
disabled: PropTypes.bool
|
|
289
|
+
disabled: PropTypes.bool,
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Whether the input is optional or not
|
|
293
|
+
*/
|
|
294
|
+
optional: PropTypes.bool
|
|
276
295
|
};
|
|
277
296
|
MultipleCombobox.defaultProps = {// someProp: false
|
|
278
297
|
};
|
|
@@ -38,7 +38,8 @@ $default-loading-circle-displacement: 1em;
|
|
|
38
38
|
>.input-wrapper {
|
|
39
39
|
position: relative;
|
|
40
40
|
|
|
41
|
-
>.#{bem.$base}.loading-circle
|
|
41
|
+
>.#{bem.$base}.loading-circle,
|
|
42
|
+
>.#{bem.$base}.button {
|
|
42
43
|
position: absolute;
|
|
43
44
|
top: $default-loading-circle-displacement;
|
|
44
45
|
right: $default-loading-circle-displacement;
|
|
@@ -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,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useLayoutEffect } from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import styleNames from '@pareto-engineering/bem'; // Local Definitions
|
|
6
|
+
|
|
7
|
+
const baseClassName = styleNames.base;
|
|
8
|
+
const componentClassName = 'button';
|
|
9
|
+
/**
|
|
10
|
+
* This is the component description.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const Button = ({
|
|
14
|
+
id,
|
|
15
|
+
className: userClassName,
|
|
16
|
+
style,
|
|
17
|
+
children // ...otherProps
|
|
18
|
+
|
|
19
|
+
}) => {
|
|
20
|
+
useLayoutEffect(() => {
|
|
21
|
+
import("./styles.scss");
|
|
22
|
+
}, []);
|
|
23
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
id: id,
|
|
25
|
+
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
26
|
+
style: style // {...otherProps}
|
|
27
|
+
|
|
28
|
+
}, children);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
Button.propTypes = {
|
|
32
|
+
/**
|
|
33
|
+
* The HTML id for this element
|
|
34
|
+
*/
|
|
35
|
+
id: PropTypes.string,
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The HTML class names for this element
|
|
39
|
+
*/
|
|
40
|
+
className: PropTypes.string,
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The React-written, css properties for this element.
|
|
44
|
+
*/
|
|
45
|
+
style: PropTypes.objectOf(PropTypes.string),
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The children JSX
|
|
49
|
+
*/
|
|
50
|
+
children: PropTypes.node
|
|
51
|
+
};
|
|
52
|
+
Button.defaultProps = {// someProp:false
|
|
53
|
+
};
|
|
54
|
+
export default Button;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Button } from "./Button";
|