@pareto-engineering/design-system 2.0.0-alpha.65 → 2.0.0-alpha.67
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/a/Popover/Popover.js +1 -1
- package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +17 -3
- package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +14 -2
- package/dist/cjs/f/fields/QueryCombobox/styles.scss +2 -1
- 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/a/Popover/Popover.js +1 -1
- package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +17 -4
- package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +14 -2
- package/dist/es/f/fields/QueryCombobox/styles.scss +2 -1
- 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 +12 -1
- package/src/ui/a/ContentTree/ContentTree.jsx +1 -1
- package/src/ui/a/Popover/Popover.jsx +1 -1
- package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +15 -2
- package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +16 -0
- package/src/ui/f/fields/QueryCombobox/styles.scss +2 -1
|
@@ -73,7 +73,7 @@ ContentTree.propTypes = {
|
|
|
73
73
|
* The reference to the parent element.
|
|
74
74
|
*/
|
|
75
75
|
target: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
|
|
76
|
-
current: _propTypes.default.instanceOf(
|
|
76
|
+
current: _propTypes.default.instanceOf(String)
|
|
77
77
|
})])
|
|
78
78
|
};
|
|
79
79
|
ContentTree.defaultProps = {
|
|
@@ -119,7 +119,7 @@ Popover.propTypes = {
|
|
|
119
119
|
* The reference to the parent element
|
|
120
120
|
*/
|
|
121
121
|
parentRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
|
|
122
|
-
current: _propTypes.default.instanceOf(
|
|
122
|
+
current: _propTypes.default.instanceOf(String)
|
|
123
123
|
})])
|
|
124
124
|
};
|
|
125
125
|
Popover.defaultProps = {
|
|
@@ -17,6 +17,8 @@ var _ = require("../../../..");
|
|
|
17
17
|
|
|
18
18
|
var _a = require("../../../../../a");
|
|
19
19
|
|
|
20
|
+
var _b = require("../../../../../b");
|
|
21
|
+
|
|
20
22
|
var _Menu = require("../Menu");
|
|
21
23
|
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -57,6 +59,8 @@ var Combobox = _ref => {
|
|
|
57
59
|
isOpen,
|
|
58
60
|
selectItem,
|
|
59
61
|
selectedItem,
|
|
62
|
+
inputValue,
|
|
63
|
+
setInputValue,
|
|
60
64
|
getLabelProps,
|
|
61
65
|
getMenuProps,
|
|
62
66
|
getInputProps,
|
|
@@ -69,9 +73,9 @@ var Combobox = _ref => {
|
|
|
69
73
|
itemToString: item => item ? item.label : '',
|
|
70
74
|
onInputValueChange: _ref2 => {
|
|
71
75
|
var {
|
|
72
|
-
inputValue
|
|
76
|
+
inputValue: searchInputValue
|
|
73
77
|
} = _ref2;
|
|
74
|
-
var transformedInput = transformSearch(
|
|
78
|
+
var transformedInput = transformSearch(searchInputValue);
|
|
75
79
|
|
|
76
80
|
if (transformedInput.length > minLength) {
|
|
77
81
|
getOptions(transformedInput);
|
|
@@ -92,6 +96,9 @@ var Combobox = _ref => {
|
|
|
92
96
|
}
|
|
93
97
|
}, [value]);
|
|
94
98
|
var parentRef = (0, React.useRef)(null);
|
|
99
|
+
|
|
100
|
+
var resetInputValue = () => setInputValue('');
|
|
101
|
+
|
|
95
102
|
return /*#__PURE__*/React.createElement("div", {
|
|
96
103
|
id: id,
|
|
97
104
|
className: [baseClassName, componentClassName, userClassName, "y-".concat(color)].filter(e => e).join(' '),
|
|
@@ -107,7 +114,14 @@ var Combobox = _ref => {
|
|
|
107
114
|
disabled: disabled
|
|
108
115
|
})), isFetching && /*#__PURE__*/React.createElement(_a.LoadingCircle, {
|
|
109
116
|
className: "x-main2"
|
|
110
|
-
})
|
|
117
|
+
}), inputValue.length > minLength && !isFetching && /*#__PURE__*/React.createElement(_b.Button, {
|
|
118
|
+
isSimple: true,
|
|
119
|
+
isCompact: true,
|
|
120
|
+
color: "main2",
|
|
121
|
+
onClick: resetInputValue
|
|
122
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
123
|
+
className: "f-icons"
|
|
124
|
+
}, "Y"))), /*#__PURE__*/React.createElement(_a.Popover, {
|
|
111
125
|
isOpen: isOpen,
|
|
112
126
|
parentRef: parentRef
|
|
113
127
|
}, /*#__PURE__*/React.createElement(_Menu.Menu, _extends({
|
|
@@ -95,7 +95,9 @@ var MultipleCombobox = _ref => {
|
|
|
95
95
|
getInputProps,
|
|
96
96
|
getComboboxProps,
|
|
97
97
|
highlightedIndex,
|
|
98
|
-
getItemProps
|
|
98
|
+
getItemProps,
|
|
99
|
+
inputValue,
|
|
100
|
+
setInputValue
|
|
99
101
|
} = (0, _downshift.useCombobox)({
|
|
100
102
|
searchInputValue,
|
|
101
103
|
defaultHighlightedIndex: 0,
|
|
@@ -169,6 +171,9 @@ var MultipleCombobox = _ref => {
|
|
|
169
171
|
}
|
|
170
172
|
}, [value]);
|
|
171
173
|
var parentRef = (0, React.useRef)(null);
|
|
174
|
+
|
|
175
|
+
var resetInputValue = () => setInputValue('');
|
|
176
|
+
|
|
172
177
|
return /*#__PURE__*/React.createElement("div", {
|
|
173
178
|
id: id,
|
|
174
179
|
className: [baseClassName, componentClassName, userClassName, "y-".concat(color)].filter(e => e).join(' '),
|
|
@@ -206,7 +211,14 @@ var MultipleCombobox = _ref => {
|
|
|
206
211
|
disabled: disabled
|
|
207
212
|
})), isFetching && /*#__PURE__*/React.createElement(_a.LoadingCircle, {
|
|
208
213
|
className: "x-main2"
|
|
209
|
-
})
|
|
214
|
+
}), inputValue.length > minLength && !isFetching && /*#__PURE__*/React.createElement(_b.Button, {
|
|
215
|
+
isSimple: true,
|
|
216
|
+
isCompact: true,
|
|
217
|
+
color: "main2",
|
|
218
|
+
onClick: resetInputValue
|
|
219
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
220
|
+
className: "f-icons"
|
|
221
|
+
}, "Y"))), /*#__PURE__*/React.createElement(_a.Popover, {
|
|
210
222
|
isOpen: isOpen,
|
|
211
223
|
parentRef: parentRef
|
|
212
224
|
}, /*#__PURE__*/React.createElement(_Menu.Menu, _extends({
|
|
@@ -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;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _bem = _interopRequireDefault(require("@pareto-engineering/bem"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
// Local Definitions
|
|
21
|
+
var baseClassName = _bem.default.base;
|
|
22
|
+
var componentClassName = 'button';
|
|
23
|
+
/**
|
|
24
|
+
* This is the component description.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
var Button = _ref => {
|
|
28
|
+
var {
|
|
29
|
+
id,
|
|
30
|
+
className: userClassName,
|
|
31
|
+
style,
|
|
32
|
+
children // ...otherProps
|
|
33
|
+
|
|
34
|
+
} = _ref;
|
|
35
|
+
(0, React.useLayoutEffect)(() => {
|
|
36
|
+
Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
|
|
37
|
+
}, []);
|
|
38
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
id: id,
|
|
40
|
+
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
41
|
+
style: style // {...otherProps}
|
|
42
|
+
|
|
43
|
+
}, children);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
Button.propTypes = {
|
|
47
|
+
/**
|
|
48
|
+
* The HTML id for this element
|
|
49
|
+
*/
|
|
50
|
+
id: _propTypes.default.string,
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The HTML class names for this element
|
|
54
|
+
*/
|
|
55
|
+
className: _propTypes.default.string,
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The React-written, css properties for this element.
|
|
59
|
+
*/
|
|
60
|
+
style: _propTypes.default.objectOf(_propTypes.default.string),
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The children JSX
|
|
64
|
+
*/
|
|
65
|
+
children: _propTypes.default.node
|
|
66
|
+
};
|
|
67
|
+
Button.defaultProps = {// someProp:false
|
|
68
|
+
};
|
|
69
|
+
var _default = Button;
|
|
70
|
+
exports.default = _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Button", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _Button.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _Button = _interopRequireDefault(require("./Button"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -58,7 +58,7 @@ ContentTree.propTypes = {
|
|
|
58
58
|
* The reference to the parent element.
|
|
59
59
|
*/
|
|
60
60
|
target: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
61
|
-
current: PropTypes.instanceOf(
|
|
61
|
+
current: PropTypes.instanceOf(String)
|
|
62
62
|
})])
|
|
63
63
|
};
|
|
64
64
|
ContentTree.defaultProps = {
|
|
@@ -104,7 +104,7 @@ Popover.propTypes = {
|
|
|
104
104
|
* The reference to the parent element
|
|
105
105
|
*/
|
|
106
106
|
parentRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
107
|
-
current: PropTypes.instanceOf(
|
|
107
|
+
current: PropTypes.instanceOf(String)
|
|
108
108
|
})])
|
|
109
109
|
};
|
|
110
110
|
Popover.defaultProps = {
|
|
@@ -7,7 +7,8 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import { useCombobox } from 'downshift';
|
|
8
8
|
import styleNames from '@pareto-engineering/bem';
|
|
9
9
|
import { FormLabel, FormDescription } from "../../../..";
|
|
10
|
-
import { Popover, LoadingCircle } from "../../../../../a";
|
|
10
|
+
import { Popover, LoadingCircle } from "../../../../../a";
|
|
11
|
+
import { Button } from "../../../../../b"; // Local Definitions
|
|
11
12
|
|
|
12
13
|
import { Menu } from "../Menu";
|
|
13
14
|
const baseClassName = styleNames.base;
|
|
@@ -39,6 +40,8 @@ const Combobox = ({
|
|
|
39
40
|
isOpen,
|
|
40
41
|
selectItem,
|
|
41
42
|
selectedItem,
|
|
43
|
+
inputValue,
|
|
44
|
+
setInputValue,
|
|
42
45
|
getLabelProps,
|
|
43
46
|
getMenuProps,
|
|
44
47
|
getInputProps,
|
|
@@ -50,9 +53,9 @@ const Combobox = ({
|
|
|
50
53
|
initialSelectedItem: value,
|
|
51
54
|
itemToString: item => item ? item.label : '',
|
|
52
55
|
onInputValueChange: ({
|
|
53
|
-
inputValue
|
|
56
|
+
inputValue: searchInputValue
|
|
54
57
|
}) => {
|
|
55
|
-
const transformedInput = transformSearch(
|
|
58
|
+
const transformedInput = transformSearch(searchInputValue);
|
|
56
59
|
|
|
57
60
|
if (transformedInput.length > minLength) {
|
|
58
61
|
getOptions(transformedInput);
|
|
@@ -73,6 +76,9 @@ const Combobox = ({
|
|
|
73
76
|
}
|
|
74
77
|
}, [value]);
|
|
75
78
|
const parentRef = useRef(null);
|
|
79
|
+
|
|
80
|
+
const resetInputValue = () => setInputValue('');
|
|
81
|
+
|
|
76
82
|
return /*#__PURE__*/React.createElement("div", {
|
|
77
83
|
id: id,
|
|
78
84
|
className: [baseClassName, componentClassName, userClassName, `y-${color}`].filter(e => e).join(' '),
|
|
@@ -88,7 +94,14 @@ const Combobox = ({
|
|
|
88
94
|
disabled: disabled
|
|
89
95
|
})), isFetching && /*#__PURE__*/React.createElement(LoadingCircle, {
|
|
90
96
|
className: "x-main2"
|
|
91
|
-
})
|
|
97
|
+
}), inputValue.length > minLength && !isFetching && /*#__PURE__*/React.createElement(Button, {
|
|
98
|
+
isSimple: true,
|
|
99
|
+
isCompact: true,
|
|
100
|
+
color: "main2",
|
|
101
|
+
onClick: resetInputValue
|
|
102
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
103
|
+
className: "f-icons"
|
|
104
|
+
}, "Y"))), /*#__PURE__*/React.createElement(Popover, {
|
|
92
105
|
isOpen: isOpen,
|
|
93
106
|
parentRef: parentRef
|
|
94
107
|
}, /*#__PURE__*/React.createElement(Menu, _extends({
|
|
@@ -70,7 +70,9 @@ const MultipleCombobox = ({
|
|
|
70
70
|
getInputProps,
|
|
71
71
|
getComboboxProps,
|
|
72
72
|
highlightedIndex,
|
|
73
|
-
getItemProps
|
|
73
|
+
getItemProps,
|
|
74
|
+
inputValue,
|
|
75
|
+
setInputValue
|
|
74
76
|
} = useCombobox({
|
|
75
77
|
searchInputValue,
|
|
76
78
|
defaultHighlightedIndex: 0,
|
|
@@ -142,6 +144,9 @@ const MultipleCombobox = ({
|
|
|
142
144
|
}
|
|
143
145
|
}, [value]);
|
|
144
146
|
const parentRef = useRef(null);
|
|
147
|
+
|
|
148
|
+
const resetInputValue = () => setInputValue('');
|
|
149
|
+
|
|
145
150
|
return /*#__PURE__*/React.createElement("div", {
|
|
146
151
|
id: id,
|
|
147
152
|
className: [baseClassName, componentClassName, userClassName, `y-${color}`].filter(e => e).join(' '),
|
|
@@ -179,7 +184,14 @@ const MultipleCombobox = ({
|
|
|
179
184
|
disabled: disabled
|
|
180
185
|
})), isFetching && /*#__PURE__*/React.createElement(LoadingCircle, {
|
|
181
186
|
className: "x-main2"
|
|
182
|
-
})
|
|
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, {
|
|
183
195
|
isOpen: isOpen,
|
|
184
196
|
parentRef: parentRef
|
|
185
197
|
}, /*#__PURE__*/React.createElement(Menu, _extends({
|
|
@@ -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;
|
|
@@ -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";
|
package/package.json
CHANGED
|
@@ -3729,7 +3729,7 @@ exports[`Storyshots a/Timestamp Distance Format 1`] = `
|
|
|
3729
3729
|
className="base timestamp"
|
|
3730
3730
|
onClick={[Function]}
|
|
3731
3731
|
>
|
|
3732
|
-
|
|
3732
|
+
about 2 months ago
|
|
3733
3733
|
</p>
|
|
3734
3734
|
`;
|
|
3735
3735
|
|
|
@@ -14449,6 +14449,17 @@ exports[`Storyshots f/fields/QueryCombobox Single Select With Default Formik Sta
|
|
|
14449
14449
|
onKeyDown={[Function]}
|
|
14450
14450
|
value="Apple"
|
|
14451
14451
|
/>
|
|
14452
|
+
<button
|
|
14453
|
+
className="base button x-main2 modifierCompact modifierSimple"
|
|
14454
|
+
onClick={[Function]}
|
|
14455
|
+
type="button"
|
|
14456
|
+
>
|
|
14457
|
+
<span
|
|
14458
|
+
className="f-icons"
|
|
14459
|
+
>
|
|
14460
|
+
Y
|
|
14461
|
+
</span>
|
|
14462
|
+
</button>
|
|
14452
14463
|
</div>
|
|
14453
14464
|
<div
|
|
14454
14465
|
className="base popover x-background1 bottom left"
|
|
@@ -13,6 +13,8 @@ import { FormLabel, FormDescription } from 'ui/f'
|
|
|
13
13
|
|
|
14
14
|
import { Popover, LoadingCircle } from 'ui/a'
|
|
15
15
|
|
|
16
|
+
import { Button } from 'ui/b'
|
|
17
|
+
|
|
16
18
|
// Local Definitions
|
|
17
19
|
|
|
18
20
|
import { Menu } from '../Menu'
|
|
@@ -47,6 +49,8 @@ const Combobox = ({
|
|
|
47
49
|
isOpen,
|
|
48
50
|
selectItem,
|
|
49
51
|
selectedItem,
|
|
52
|
+
inputValue,
|
|
53
|
+
setInputValue,
|
|
50
54
|
getLabelProps,
|
|
51
55
|
getMenuProps,
|
|
52
56
|
getInputProps,
|
|
@@ -57,8 +61,8 @@ const Combobox = ({
|
|
|
57
61
|
items,
|
|
58
62
|
initialSelectedItem:value,
|
|
59
63
|
itemToString :(item) => (item ? item.label : ''),
|
|
60
|
-
onInputValueChange :({ inputValue }) => {
|
|
61
|
-
const transformedInput = transformSearch(
|
|
64
|
+
onInputValueChange :({ inputValue:searchInputValue }) => {
|
|
65
|
+
const transformedInput = transformSearch(searchInputValue)
|
|
62
66
|
if (transformedInput.length > minLength) {
|
|
63
67
|
getOptions(transformedInput)
|
|
64
68
|
}
|
|
@@ -82,6 +86,8 @@ const Combobox = ({
|
|
|
82
86
|
|
|
83
87
|
const parentRef = useRef(null)
|
|
84
88
|
|
|
89
|
+
const resetInputValue = () => setInputValue('')
|
|
90
|
+
|
|
85
91
|
return (
|
|
86
92
|
<div
|
|
87
93
|
id={id}
|
|
@@ -111,6 +117,13 @@ const Combobox = ({
|
|
|
111
117
|
{isFetching && (
|
|
112
118
|
<LoadingCircle className="x-main2" />
|
|
113
119
|
)}
|
|
120
|
+
{inputValue.length > minLength && !isFetching && (
|
|
121
|
+
<Button isSimple isCompact color="main2" onClick={resetInputValue}>
|
|
122
|
+
<span className="f-icons">
|
|
123
|
+
Y
|
|
124
|
+
</span>
|
|
125
|
+
</Button>
|
|
126
|
+
)}
|
|
114
127
|
</div>
|
|
115
128
|
|
|
116
129
|
<Popover
|
|
@@ -84,6 +84,8 @@ const MultipleCombobox = ({
|
|
|
84
84
|
getComboboxProps,
|
|
85
85
|
highlightedIndex,
|
|
86
86
|
getItemProps,
|
|
87
|
+
inputValue,
|
|
88
|
+
setInputValue,
|
|
87
89
|
} = useCombobox({
|
|
88
90
|
searchInputValue,
|
|
89
91
|
defaultHighlightedIndex:0, // after selection, highlight the first item.
|
|
@@ -145,6 +147,8 @@ const MultipleCombobox = ({
|
|
|
145
147
|
|
|
146
148
|
const parentRef = useRef(null)
|
|
147
149
|
|
|
150
|
+
const resetInputValue = () => setInputValue('')
|
|
151
|
+
|
|
148
152
|
return (
|
|
149
153
|
<div
|
|
150
154
|
id={id}
|
|
@@ -204,6 +208,18 @@ const MultipleCombobox = ({
|
|
|
204
208
|
{isFetching && (
|
|
205
209
|
<LoadingCircle className="x-main2" />
|
|
206
210
|
)}
|
|
211
|
+
{inputValue.length > minLength && !isFetching && (
|
|
212
|
+
<Button
|
|
213
|
+
isSimple
|
|
214
|
+
isCompact
|
|
215
|
+
color="main2"
|
|
216
|
+
onClick={resetInputValue}
|
|
217
|
+
>
|
|
218
|
+
<span className="f-icons">
|
|
219
|
+
Y
|
|
220
|
+
</span>
|
|
221
|
+
</Button>
|
|
222
|
+
)}
|
|
207
223
|
</div>
|
|
208
224
|
|
|
209
225
|
<Popover
|
|
@@ -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;
|