@entur/dropdown 3.0.22 → 3.0.24
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/dropdown.cjs.development.js +402 -581
- package/dist/dropdown.cjs.development.js.map +1 -1
- package/dist/dropdown.cjs.production.min.js +1 -1
- package/dist/dropdown.cjs.production.min.js.map +1 -1
- package/dist/dropdown.esm.js +402 -581
- package/dist/dropdown.esm.js.map +1 -1
- package/dist/styles.css +22 -45
- package/package.json +21 -14
- package/CHANGELOG.md +0 -615
|
@@ -27,64 +27,55 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
27
27
|
reject(error);
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
30
|
if (info.done) {
|
|
32
31
|
resolve(value);
|
|
33
32
|
} else {
|
|
34
33
|
Promise.resolve(value).then(_next, _throw);
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
|
-
|
|
38
36
|
function _asyncToGenerator(fn) {
|
|
39
37
|
return function () {
|
|
40
38
|
var self = this,
|
|
41
|
-
|
|
39
|
+
args = arguments;
|
|
42
40
|
return new Promise(function (resolve, reject) {
|
|
43
41
|
var gen = fn.apply(self, args);
|
|
44
|
-
|
|
45
42
|
function _next(value) {
|
|
46
43
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
47
44
|
}
|
|
48
|
-
|
|
49
45
|
function _throw(err) {
|
|
50
46
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
51
47
|
}
|
|
52
|
-
|
|
53
48
|
_next(undefined);
|
|
54
49
|
});
|
|
55
50
|
};
|
|
56
51
|
}
|
|
57
|
-
|
|
58
52
|
function _extends() {
|
|
59
53
|
_extends = Object.assign || function (target) {
|
|
60
54
|
for (var i = 1; i < arguments.length; i++) {
|
|
61
55
|
var source = arguments[i];
|
|
62
|
-
|
|
63
56
|
for (var key in source) {
|
|
64
57
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
65
58
|
target[key] = source[key];
|
|
66
59
|
}
|
|
67
60
|
}
|
|
68
61
|
}
|
|
69
|
-
|
|
70
62
|
return target;
|
|
71
63
|
};
|
|
72
|
-
|
|
73
64
|
return _extends.apply(this, arguments);
|
|
74
65
|
}
|
|
75
|
-
|
|
66
|
+
function _objectDestructuringEmpty(obj) {
|
|
67
|
+
if (obj == null) throw new TypeError("Cannot destructure undefined");
|
|
68
|
+
}
|
|
76
69
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
77
70
|
if (source == null) return {};
|
|
78
71
|
var target = {};
|
|
79
72
|
var sourceKeys = Object.keys(source);
|
|
80
73
|
var key, i;
|
|
81
|
-
|
|
82
74
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
83
75
|
key = sourceKeys[i];
|
|
84
76
|
if (excluded.indexOf(key) >= 0) continue;
|
|
85
77
|
target[key] = source[key];
|
|
86
78
|
}
|
|
87
|
-
|
|
88
79
|
return target;
|
|
89
80
|
}
|
|
90
81
|
|
|
@@ -92,47 +83,41 @@ var _excluded$a = ["children", "onChange", "onInputValueChange", "highlightFirst
|
|
|
92
83
|
var DownshiftContext = /*#__PURE__*/React__default["default"].createContext(null);
|
|
93
84
|
var DownshiftProvider = function DownshiftProvider(_ref) {
|
|
94
85
|
var children = _ref.children,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
86
|
+
_ref$onChange = _ref.onChange,
|
|
87
|
+
onChange = _ref$onChange === void 0 ? function () {
|
|
88
|
+
return undefined;
|
|
89
|
+
} : _ref$onChange,
|
|
90
|
+
_ref$onInputValueChan = _ref.onInputValueChange,
|
|
91
|
+
onInputValueChange = _ref$onInputValueChan === void 0 ? function () {
|
|
92
|
+
return undefined;
|
|
93
|
+
} : _ref$onInputValueChan,
|
|
94
|
+
_ref$highlightFirstIt = _ref.highlightFirstItemOnOpen,
|
|
95
|
+
highlightFirstItemOnOpen = _ref$highlightFirstIt === void 0 ? false : _ref$highlightFirstIt,
|
|
96
|
+
className = _ref.className,
|
|
97
|
+
style = _ref.style,
|
|
98
|
+
_ref$searchable = _ref.searchable,
|
|
99
|
+
searchable = _ref$searchable === void 0 ? false : _ref$searchable,
|
|
100
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
|
111
101
|
var handleStateChange = function handleStateChange(changes, stateAndHelpers) {
|
|
112
102
|
if (changes.type === Downshift__default["default"].stateChangeTypes.controlledPropUpdatedSelectedItem) {
|
|
113
103
|
return;
|
|
114
104
|
}
|
|
115
|
-
|
|
116
105
|
if ('selectedItem' in changes) {
|
|
117
106
|
onChange(changes.selectedItem, stateAndHelpers);
|
|
118
107
|
} else if ('inputValue' in changes) {
|
|
119
108
|
onInputValueChange(changes.inputValue);
|
|
120
109
|
}
|
|
121
110
|
};
|
|
122
|
-
|
|
123
111
|
var stateReducer = function stateReducer(_, changes) {
|
|
124
112
|
var highlightFirstOnOpen = highlightFirstItemOnOpen && 'isOpen' in changes && changes.isOpen;
|
|
125
113
|
var highlightFirstItemIndex = highlightFirstOnOpen ? {
|
|
126
114
|
highlightedIndex: 0
|
|
127
115
|
} : {};
|
|
128
|
-
|
|
129
116
|
if (searchable) {
|
|
130
117
|
var type = changes.type;
|
|
131
|
-
|
|
132
118
|
switch (type) {
|
|
133
119
|
case '__autocomplete_change_input__':
|
|
134
120
|
return _extends({}, changes, highlightFirstItemIndex);
|
|
135
|
-
|
|
136
121
|
case '__autocomplete_click_item__':
|
|
137
122
|
case '__autocomplete_keydown_enter__':
|
|
138
123
|
case '__autocomplete_blur_input__':
|
|
@@ -142,7 +127,6 @@ var DownshiftProvider = function DownshiftProvider(_ref) {
|
|
|
142
127
|
// we will reset input field value to blank
|
|
143
128
|
inputValue: ''
|
|
144
129
|
}, highlightFirstItemIndex);
|
|
145
|
-
|
|
146
130
|
default:
|
|
147
131
|
return _extends({}, changes, highlightFirstItemIndex);
|
|
148
132
|
}
|
|
@@ -150,7 +134,6 @@ var DownshiftProvider = function DownshiftProvider(_ref) {
|
|
|
150
134
|
return _extends({}, changes, highlightFirstItemIndex);
|
|
151
135
|
}
|
|
152
136
|
};
|
|
153
|
-
|
|
154
137
|
return React__default["default"].createElement(Downshift__default["default"], _extends({
|
|
155
138
|
itemToString: function itemToString(item) {
|
|
156
139
|
return item ? item.label : '';
|
|
@@ -168,32 +151,29 @@ var DownshiftProvider = function DownshiftProvider(_ref) {
|
|
|
168
151
|
};
|
|
169
152
|
var useDownshift = function useDownshift() {
|
|
170
153
|
var context = React__default["default"].useContext(DownshiftContext);
|
|
171
|
-
|
|
172
154
|
if (!context) {
|
|
173
155
|
throw new Error('You need to wrap your component in a DownshiftProvider');
|
|
174
156
|
}
|
|
175
|
-
|
|
176
157
|
return context;
|
|
177
158
|
};
|
|
178
159
|
|
|
179
160
|
var _excluded$9 = ["items"];
|
|
180
161
|
var DropdownList$1 = function DropdownList(_ref) {
|
|
181
162
|
var items = _ref.items,
|
|
182
|
-
|
|
183
|
-
|
|
163
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$9);
|
|
184
164
|
var _useDownshift = useDownshift(),
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
165
|
+
highlightedIndex = _useDownshift.highlightedIndex,
|
|
166
|
+
isOpen = _useDownshift.isOpen,
|
|
167
|
+
selectedItem = _useDownshift.selectedItem,
|
|
168
|
+
getItemProps = _useDownshift.getItemProps,
|
|
169
|
+
getMenuProps = _useDownshift.getMenuProps;
|
|
191
170
|
return React__default["default"].createElement("ul", _extends({
|
|
192
171
|
className: classNames__default["default"]('eds-dropdown-list', {
|
|
193
172
|
'eds-dropdown-list--open': isOpen
|
|
194
173
|
})
|
|
195
174
|
}, getMenuProps(), rest), isOpen ? items.map(function (item, index) {
|
|
196
|
-
return (
|
|
175
|
+
return (
|
|
176
|
+
// eslint-disable-next-line react/jsx-key
|
|
197
177
|
React__default["default"].createElement("li", _extends({
|
|
198
178
|
className: classNames__default["default"]('eds-dropdown-list__item', {
|
|
199
179
|
'eds-dropdown-list__item--highlighted': highlightedIndex === index,
|
|
@@ -216,9 +196,8 @@ var DropdownList$1 = function DropdownList(_ref) {
|
|
|
216
196
|
|
|
217
197
|
var DropdownToggleButton$1 = function DropdownToggleButton() {
|
|
218
198
|
var _useDownshift = useDownshift(),
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
199
|
+
getToggleButtonProps = _useDownshift.getToggleButtonProps,
|
|
200
|
+
isOpen = _useDownshift.isOpen;
|
|
222
201
|
return React__default["default"].createElement("button", _extends({}, getToggleButtonProps({
|
|
223
202
|
className: classNames__default["default"]('eds-dropdown__toggle-button', {
|
|
224
203
|
'eds-dropdown__toggle-button--open': isOpen
|
|
@@ -232,9 +211,8 @@ var DropdownToggleButton$1 = function DropdownToggleButton() {
|
|
|
232
211
|
var _excluded$8 = ["className", "children"];
|
|
233
212
|
var DropdownLoadingDots = function DropdownLoadingDots(_ref) {
|
|
234
213
|
var className = _ref.className,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
214
|
+
children = _ref.children,
|
|
215
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
|
238
216
|
return React__default["default"].createElement("div", _extends({
|
|
239
217
|
className: classNames__default["default"]('eds-inline-spinner', className)
|
|
240
218
|
}, rest), React__default["default"].createElement(loader.LoadingDots, null), React__default["default"].createElement(a11y.VisuallyHidden, null, children));
|
|
@@ -243,24 +221,22 @@ var DropdownLoadingDots = function DropdownLoadingDots(_ref) {
|
|
|
243
221
|
var _excluded$7 = ["children", "className", "items", "loading", "loadingText", "placeholder", "style", "listStyle", "clearable", "label", "isFilled", "disableLabelAnimation"];
|
|
244
222
|
var BaseDropdown = function BaseDropdown(_ref) {
|
|
245
223
|
var children = _ref.children,
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
224
|
+
className = _ref.className,
|
|
225
|
+
items = _ref.items,
|
|
226
|
+
_ref$loading = _ref.loading,
|
|
227
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
228
|
+
_ref$loadingText = _ref.loadingText,
|
|
229
|
+
loadingText = _ref$loadingText === void 0 ? 'Loading...' : _ref$loadingText,
|
|
230
|
+
style = _ref.style,
|
|
231
|
+
listStyle = _ref.listStyle,
|
|
232
|
+
clearable = _ref.clearable,
|
|
233
|
+
label = _ref.label,
|
|
234
|
+
_ref$isFilled = _ref.isFilled,
|
|
235
|
+
isFilled = _ref$isFilled === void 0 ? false : _ref$isFilled,
|
|
236
|
+
disableLabelAnimation = _ref.disableLabelAnimation,
|
|
237
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
261
238
|
var _useDownshift = useDownshift(),
|
|
262
|
-
|
|
263
|
-
|
|
239
|
+
getLabelProps = _useDownshift.getLabelProps;
|
|
264
240
|
return React__default["default"].createElement("div", {
|
|
265
241
|
className: "eds-dropdown-wrapper",
|
|
266
242
|
style: style
|
|
@@ -284,14 +260,11 @@ var BaseDropdown = function BaseDropdown(_ref) {
|
|
|
284
260
|
}, listStyle)
|
|
285
261
|
}, rest)));
|
|
286
262
|
};
|
|
287
|
-
|
|
288
263
|
var ClearButton$1 = function ClearButton(_ref2) {
|
|
289
|
-
var props = _extends({}, _ref2);
|
|
290
|
-
|
|
264
|
+
var props = _extends({}, (_objectDestructuringEmpty(_ref2), _ref2));
|
|
291
265
|
var _useDownshift2 = useDownshift(),
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
266
|
+
clearSelection = _useDownshift2.clearSelection,
|
|
267
|
+
selectedItem = _useDownshift2.selectedItem;
|
|
295
268
|
return React__default["default"].createElement(React__default["default"].Fragment, null, selectedItem && React__default["default"].createElement("button", _extends({
|
|
296
269
|
className: "eds-dropdown__clear-button",
|
|
297
270
|
type: "button",
|
|
@@ -303,52 +276,46 @@ var ClearButton$1 = function ClearButton(_ref2) {
|
|
|
303
276
|
className: "eds-dropdown__divider"
|
|
304
277
|
}));
|
|
305
278
|
};
|
|
306
|
-
|
|
307
279
|
var Appendix$2 = function Appendix(_ref3) {
|
|
308
280
|
var clearable = _ref3.clearable,
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
281
|
+
loading = _ref3.loading,
|
|
282
|
+
loadingText = _ref3.loadingText,
|
|
283
|
+
readOnly = _ref3.readOnly;
|
|
313
284
|
if (loading) {
|
|
314
285
|
return React__default["default"].createElement(DropdownLoadingDots, null, loadingText);
|
|
315
286
|
}
|
|
316
|
-
|
|
317
287
|
if (readOnly) {
|
|
318
288
|
return null;
|
|
319
289
|
}
|
|
320
|
-
|
|
321
290
|
return clearable ? React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement(ClearButton$1, null), " ", React__default["default"].createElement(DropdownToggleButton$1, null)) : React__default["default"].createElement(DropdownToggleButton$1, null);
|
|
322
291
|
};
|
|
323
292
|
|
|
324
293
|
var _excluded$6 = ["disabled", "placeholder", "selectOnTab", "openOnFocus", "listStyle", "items", "label", "disableLabelAnimation", "loading", "loadingText", "className", "clearable"];
|
|
325
294
|
var RegularDropdown = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
|
|
326
295
|
var disabled = _ref.disabled,
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
296
|
+
_ref$placeholder = _ref.placeholder,
|
|
297
|
+
placeholder = _ref$placeholder === void 0 ? 'Vennligst velg' : _ref$placeholder,
|
|
298
|
+
_ref$selectOnTab = _ref.selectOnTab,
|
|
299
|
+
selectOnTab = _ref$selectOnTab === void 0 ? false : _ref$selectOnTab,
|
|
300
|
+
_ref$openOnFocus = _ref.openOnFocus,
|
|
301
|
+
openOnFocus = _ref$openOnFocus === void 0 ? false : _ref$openOnFocus,
|
|
302
|
+
listStyle = _ref.listStyle,
|
|
303
|
+
items = _ref.items,
|
|
304
|
+
label = _ref.label,
|
|
305
|
+
disableLabelAnimation = _ref.disableLabelAnimation,
|
|
306
|
+
loading = _ref.loading,
|
|
307
|
+
loadingText = _ref.loadingText,
|
|
308
|
+
className = _ref.className,
|
|
309
|
+
clearable = _ref.clearable,
|
|
310
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
343
311
|
var _useDownshift = useDownshift(),
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
312
|
+
getToggleButtonProps = _useDownshift.getToggleButtonProps,
|
|
313
|
+
selectedItem = _useDownshift.selectedItem,
|
|
314
|
+
selectHighlightedItem = _useDownshift.selectHighlightedItem,
|
|
315
|
+
openMenu = _useDownshift.openMenu,
|
|
316
|
+
isOpen = _useDownshift.isOpen,
|
|
317
|
+
highlightedIndex = _useDownshift.highlightedIndex,
|
|
318
|
+
setHighlightedIndex = _useDownshift.setHighlightedIndex;
|
|
352
319
|
return React__default["default"].createElement(BaseDropdown, _extends({
|
|
353
320
|
disabled: disabled,
|
|
354
321
|
listStyle: listStyle,
|
|
@@ -371,7 +338,6 @@ var RegularDropdown = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
371
338
|
if (selectOnTab && e.key === 'Tab') {
|
|
372
339
|
selectHighlightedItem();
|
|
373
340
|
}
|
|
374
|
-
|
|
375
341
|
if (isOpen) {
|
|
376
342
|
var keyDownValue = e.key;
|
|
377
343
|
var matchedItems = items.map(function (item, index) {
|
|
@@ -385,7 +351,6 @@ var RegularDropdown = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
385
351
|
var nextHighlightItem = matchedItems.find(function (item) {
|
|
386
352
|
return item.index > (highlightedIndex != null ? highlightedIndex : 0);
|
|
387
353
|
});
|
|
388
|
-
|
|
389
354
|
if (nextHighlightItem) {
|
|
390
355
|
setHighlightedIndex(nextHighlightItem.index);
|
|
391
356
|
} else if (matchedItems.length > 0) {
|
|
@@ -404,55 +369,49 @@ var RegularDropdown = /*#__PURE__*/React__default["default"].forwardRef(function
|
|
|
404
369
|
});
|
|
405
370
|
|
|
406
371
|
var _excluded$5 = ["disabled", "className", "items", "loading", "loadingText", "readOnly", "prepend", "selectOnTab", "openOnFocus", "listStyle", "clearable", "itemFilter", "label", "disableLabelAnimation", "placeholder"];
|
|
407
|
-
|
|
408
372
|
function LowerCaseFilterTest(item, input) {
|
|
409
373
|
if (!input) {
|
|
410
374
|
return true;
|
|
411
375
|
}
|
|
412
|
-
|
|
413
376
|
var sanitizeEscapeCharacters = input.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
414
377
|
var inputRegex = new RegExp(sanitizeEscapeCharacters, 'i');
|
|
415
378
|
return inputRegex.test(item.label);
|
|
416
379
|
}
|
|
417
|
-
|
|
418
380
|
var SearchableDropdown = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
|
|
419
381
|
var _ref$disabled = _ref.disabled,
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
382
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
383
|
+
className = _ref.className,
|
|
384
|
+
items = _ref.items,
|
|
385
|
+
loading = _ref.loading,
|
|
386
|
+
loadingText = _ref.loadingText,
|
|
387
|
+
_ref$readOnly = _ref.readOnly,
|
|
388
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
389
|
+
prepend = _ref.prepend,
|
|
390
|
+
_ref$selectOnTab = _ref.selectOnTab,
|
|
391
|
+
selectOnTab = _ref$selectOnTab === void 0 ? false : _ref$selectOnTab,
|
|
392
|
+
_ref$openOnFocus = _ref.openOnFocus,
|
|
393
|
+
openOnFocus = _ref$openOnFocus === void 0 ? false : _ref$openOnFocus,
|
|
394
|
+
listStyle = _ref.listStyle,
|
|
395
|
+
clearable = _ref.clearable,
|
|
396
|
+
_ref$itemFilter = _ref.itemFilter,
|
|
397
|
+
itemFilter = _ref$itemFilter === void 0 ? function (item, inputValue) {
|
|
398
|
+
return LowerCaseFilterTest(item, inputValue);
|
|
399
|
+
} : _ref$itemFilter,
|
|
400
|
+
label = _ref.label,
|
|
401
|
+
disableLabelAnimation = _ref.disableLabelAnimation,
|
|
402
|
+
placeholder = _ref.placeholder,
|
|
403
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
443
404
|
var _useDownshift = useDownshift(),
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
405
|
+
getInputProps = _useDownshift.getInputProps,
|
|
406
|
+
inputValue = _useDownshift.inputValue,
|
|
407
|
+
selectHighlightedItem = _useDownshift.selectHighlightedItem,
|
|
408
|
+
isOpen = _useDownshift.isOpen,
|
|
409
|
+
openMenu = _useDownshift.openMenu,
|
|
410
|
+
closeMenu = _useDownshift.closeMenu,
|
|
411
|
+
selectedItem = _useDownshift.selectedItem;
|
|
452
412
|
var _useState = React.useState(false),
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
413
|
+
hideSelectedItem = _useState[0],
|
|
414
|
+
setHideSelectedItem = _useState[1];
|
|
456
415
|
var inputRef = React.useRef(null);
|
|
457
416
|
var filteredItems = React__default["default"].useMemo(function () {
|
|
458
417
|
return items.filter(function (item) {
|
|
@@ -478,7 +437,6 @@ var SearchableDropdown = /*#__PURE__*/React__default["default"].forwardRef(funct
|
|
|
478
437
|
className: "eds-dropdown__searchable-selected-item",
|
|
479
438
|
onClick: function onClick() {
|
|
480
439
|
var _inputRef$current;
|
|
481
|
-
|
|
482
440
|
return (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
483
441
|
}
|
|
484
442
|
}, selectedItem.label)), React__default["default"].createElement("input", _extends({}, getInputProps(_extends({
|
|
@@ -504,10 +462,10 @@ var SearchableDropdown = /*#__PURE__*/React__default["default"].forwardRef(funct
|
|
|
504
462
|
|
|
505
463
|
var DropdownInputGroup = function DropdownInputGroup(_ref) {
|
|
506
464
|
var children = _ref.children,
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
465
|
+
feedback = _ref.feedback,
|
|
466
|
+
variant = _ref.variant,
|
|
467
|
+
className = _ref.className,
|
|
468
|
+
style = _ref.style;
|
|
511
469
|
return React__default["default"].createElement(form.VariantProvider, {
|
|
512
470
|
variant: variant
|
|
513
471
|
}, React__default["default"].createElement("div", {
|
|
@@ -526,19 +484,16 @@ var runtime = {exports: {}};
|
|
|
526
484
|
* This source code is licensed under the MIT license found in the
|
|
527
485
|
* LICENSE file in the root directory of this source tree.
|
|
528
486
|
*/
|
|
529
|
-
|
|
530
487
|
(function (module) {
|
|
531
488
|
var runtime = /*#__PURE__*/function (exports) {
|
|
532
489
|
|
|
533
490
|
var Op = Object.prototype;
|
|
534
491
|
var hasOwn = Op.hasOwnProperty;
|
|
535
492
|
var undefined$1; // More compressible than void 0.
|
|
536
|
-
|
|
537
493
|
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
538
494
|
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
539
495
|
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
540
496
|
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
541
|
-
|
|
542
497
|
function define(obj, key, value) {
|
|
543
498
|
Object.defineProperty(obj, key, {
|
|
544
499
|
value: value,
|
|
@@ -548,7 +503,6 @@ var runtime = {exports: {}};
|
|
|
548
503
|
});
|
|
549
504
|
return obj[key];
|
|
550
505
|
}
|
|
551
|
-
|
|
552
506
|
try {
|
|
553
507
|
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
554
508
|
define({}, "");
|
|
@@ -557,19 +511,20 @@ var runtime = {exports: {}};
|
|
|
557
511
|
return obj[key] = value;
|
|
558
512
|
};
|
|
559
513
|
}
|
|
560
|
-
|
|
561
514
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
562
515
|
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
563
516
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
564
517
|
var generator = Object.create(protoGenerator.prototype);
|
|
565
|
-
var context = new Context(tryLocsList || []);
|
|
566
|
-
// .throw, and .return methods.
|
|
518
|
+
var context = new Context(tryLocsList || []);
|
|
567
519
|
|
|
520
|
+
// The ._invoke method unifies the implementations of the .next,
|
|
521
|
+
// .throw, and .return methods.
|
|
568
522
|
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
569
523
|
return generator;
|
|
570
524
|
}
|
|
525
|
+
exports.wrap = wrap;
|
|
571
526
|
|
|
572
|
-
|
|
527
|
+
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
573
528
|
// record like context.tryEntries[i].completion. This interface could
|
|
574
529
|
// have been (and was previously) designed to take a closure to be
|
|
575
530
|
// invoked without arguments, but in all the cases we care about we
|
|
@@ -579,7 +534,6 @@ var runtime = {exports: {}};
|
|
|
579
534
|
// in every case, so we don't have to touch the arguments object. The
|
|
580
535
|
// only additional allocation required is the completion record, which
|
|
581
536
|
// has a stable shape and so hopefully should be cheap to allocate.
|
|
582
|
-
|
|
583
537
|
function tryCatch(fn, obj, arg) {
|
|
584
538
|
try {
|
|
585
539
|
return {
|
|
@@ -593,47 +547,44 @@ var runtime = {exports: {}};
|
|
|
593
547
|
};
|
|
594
548
|
}
|
|
595
549
|
}
|
|
596
|
-
|
|
597
550
|
var GenStateSuspendedStart = "suspendedStart";
|
|
598
551
|
var GenStateSuspendedYield = "suspendedYield";
|
|
599
552
|
var GenStateExecuting = "executing";
|
|
600
|
-
var GenStateCompleted = "completed";
|
|
553
|
+
var GenStateCompleted = "completed";
|
|
554
|
+
|
|
555
|
+
// Returning this object from the innerFn has the same effect as
|
|
601
556
|
// breaking out of the dispatch switch statement.
|
|
557
|
+
var ContinueSentinel = {};
|
|
602
558
|
|
|
603
|
-
|
|
559
|
+
// Dummy constructor functions that we use as the .constructor and
|
|
604
560
|
// .constructor.prototype properties for functions that return Generator
|
|
605
561
|
// objects. For full spec compliance, you may wish to configure your
|
|
606
562
|
// minifier not to mangle the names of these two functions.
|
|
607
|
-
|
|
608
563
|
function Generator() {}
|
|
609
|
-
|
|
610
564
|
function GeneratorFunction() {}
|
|
565
|
+
function GeneratorFunctionPrototype() {}
|
|
611
566
|
|
|
612
|
-
|
|
567
|
+
// This is a polyfill for %IteratorPrototype% for environments that
|
|
613
568
|
// don't natively support it.
|
|
614
|
-
|
|
615
|
-
|
|
616
569
|
var IteratorPrototype = {};
|
|
617
|
-
|
|
618
|
-
IteratorPrototype[iteratorSymbol] = function () {
|
|
570
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
619
571
|
return this;
|
|
620
|
-
};
|
|
621
|
-
|
|
572
|
+
});
|
|
622
573
|
var getProto = Object.getPrototypeOf;
|
|
623
574
|
var NativeIteratorPrototype = getProto && /*#__PURE__*/getProto( /*#__PURE__*/getProto( /*#__PURE__*/values([])));
|
|
624
|
-
|
|
625
575
|
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
626
576
|
// This environment has a native %IteratorPrototype%; use it instead
|
|
627
577
|
// of the polyfill.
|
|
628
578
|
IteratorPrototype = NativeIteratorPrototype;
|
|
629
579
|
}
|
|
630
|
-
|
|
631
580
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = /*#__PURE__*/Object.create(IteratorPrototype);
|
|
632
|
-
GeneratorFunction.prototype =
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
581
|
+
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
582
|
+
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
583
|
+
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
584
|
+
GeneratorFunction.displayName = /*#__PURE__*/define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
636
585
|
|
|
586
|
+
// Helper for defining the .next, .throw, and .return methods of the
|
|
587
|
+
// Iterator interface in terms of a single ._invoke method.
|
|
637
588
|
function defineIteratorMethods(prototype) {
|
|
638
589
|
["next", "throw", "return"].forEach(function (method) {
|
|
639
590
|
define(prototype, method, function (arg) {
|
|
@@ -641,14 +592,13 @@ var runtime = {exports: {}};
|
|
|
641
592
|
});
|
|
642
593
|
});
|
|
643
594
|
}
|
|
644
|
-
|
|
645
595
|
exports.isGeneratorFunction = function (genFun) {
|
|
646
596
|
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
647
|
-
return ctor ? ctor === GeneratorFunction ||
|
|
597
|
+
return ctor ? ctor === GeneratorFunction ||
|
|
598
|
+
// For the native GeneratorFunction constructor, the best we can
|
|
648
599
|
// do is to check its .name property.
|
|
649
600
|
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
650
601
|
};
|
|
651
|
-
|
|
652
602
|
exports.mark = function (genFun) {
|
|
653
603
|
if (Object.setPrototypeOf) {
|
|
654
604
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
@@ -656,31 +606,27 @@ var runtime = {exports: {}};
|
|
|
656
606
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
657
607
|
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
658
608
|
}
|
|
659
|
-
|
|
660
609
|
genFun.prototype = Object.create(Gp);
|
|
661
610
|
return genFun;
|
|
662
|
-
};
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
// Within the body of any async function, `await x` is transformed to
|
|
663
614
|
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
664
615
|
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
665
616
|
// meant to be awaited.
|
|
666
|
-
|
|
667
|
-
|
|
668
617
|
exports.awrap = function (arg) {
|
|
669
618
|
return {
|
|
670
619
|
__await: arg
|
|
671
620
|
};
|
|
672
621
|
};
|
|
673
|
-
|
|
674
622
|
function AsyncIterator(generator, PromiseImpl) {
|
|
675
623
|
function invoke(method, arg, resolve, reject) {
|
|
676
624
|
var record = tryCatch(generator[method], generator, arg);
|
|
677
|
-
|
|
678
625
|
if (record.type === "throw") {
|
|
679
626
|
reject(record.arg);
|
|
680
627
|
} else {
|
|
681
628
|
var result = record.arg;
|
|
682
629
|
var value = result.value;
|
|
683
|
-
|
|
684
630
|
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
685
631
|
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
686
632
|
invoke("next", value, resolve, reject);
|
|
@@ -688,7 +634,6 @@ var runtime = {exports: {}};
|
|
|
688
634
|
invoke("throw", err, resolve, reject);
|
|
689
635
|
});
|
|
690
636
|
}
|
|
691
|
-
|
|
692
637
|
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
693
638
|
// When a yielded Promise is resolved, its final value becomes
|
|
694
639
|
// the .value of the Promise<{value,done}> result for the
|
|
@@ -702,17 +647,15 @@ var runtime = {exports: {}};
|
|
|
702
647
|
});
|
|
703
648
|
}
|
|
704
649
|
}
|
|
705
|
-
|
|
706
650
|
var previousPromise;
|
|
707
|
-
|
|
708
651
|
function enqueue(method, arg) {
|
|
709
652
|
function callInvokeWithMethodAndArg() {
|
|
710
653
|
return new PromiseImpl(function (resolve, reject) {
|
|
711
654
|
invoke(method, arg, resolve, reject);
|
|
712
655
|
});
|
|
713
656
|
}
|
|
714
|
-
|
|
715
|
-
|
|
657
|
+
return previousPromise =
|
|
658
|
+
// If enqueue has been called before, then we want to wait until
|
|
716
659
|
// all previous Promises have been resolved before calling invoke,
|
|
717
660
|
// so that results are always delivered in the correct order. If
|
|
718
661
|
// enqueue has not been called before, then it is important to
|
|
@@ -724,26 +667,25 @@ var runtime = {exports: {}};
|
|
|
724
667
|
// execute code before the first await. Since we implement simple
|
|
725
668
|
// async functions in terms of async generators, it is especially
|
|
726
669
|
// important to get this right, even though it requires care.
|
|
727
|
-
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
670
|
+
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
671
|
+
// Avoid propagating failures to Promises returned by later
|
|
728
672
|
// invocations of the iterator.
|
|
729
673
|
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
730
|
-
}
|
|
731
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
732
|
-
|
|
674
|
+
}
|
|
733
675
|
|
|
676
|
+
// Define the unified helper method that is used to implement .next,
|
|
677
|
+
// .throw, and .return (see defineIteratorMethods).
|
|
734
678
|
this._invoke = enqueue;
|
|
735
679
|
}
|
|
736
|
-
|
|
737
680
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
738
|
-
|
|
739
|
-
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
|
681
|
+
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
740
682
|
return this;
|
|
741
|
-
};
|
|
683
|
+
});
|
|
684
|
+
exports.AsyncIterator = AsyncIterator;
|
|
742
685
|
|
|
743
|
-
|
|
686
|
+
// Note that simple async functions are implemented on top of
|
|
744
687
|
// AsyncIterator objects; they just return a Promise for the value of
|
|
745
688
|
// the final result produced by the iterator.
|
|
746
|
-
|
|
747
689
|
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
748
690
|
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
749
691
|
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
@@ -752,39 +694,32 @@ var runtime = {exports: {}};
|
|
|
752
694
|
return result.done ? result.value : iter.next();
|
|
753
695
|
});
|
|
754
696
|
};
|
|
755
|
-
|
|
756
697
|
function makeInvokeMethod(innerFn, self, context) {
|
|
757
698
|
var state = GenStateSuspendedStart;
|
|
758
699
|
return function invoke(method, arg) {
|
|
759
700
|
if (state === GenStateExecuting) {
|
|
760
701
|
throw new Error("Generator is already running");
|
|
761
702
|
}
|
|
762
|
-
|
|
763
703
|
if (state === GenStateCompleted) {
|
|
764
704
|
if (method === "throw") {
|
|
765
705
|
throw arg;
|
|
766
|
-
}
|
|
767
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
768
|
-
|
|
706
|
+
}
|
|
769
707
|
|
|
708
|
+
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
709
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
770
710
|
return doneResult();
|
|
771
711
|
}
|
|
772
|
-
|
|
773
712
|
context.method = method;
|
|
774
713
|
context.arg = arg;
|
|
775
|
-
|
|
776
714
|
while (true) {
|
|
777
715
|
var delegate = context.delegate;
|
|
778
|
-
|
|
779
716
|
if (delegate) {
|
|
780
717
|
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
781
|
-
|
|
782
718
|
if (delegateResult) {
|
|
783
719
|
if (delegateResult === ContinueSentinel) continue;
|
|
784
720
|
return delegateResult;
|
|
785
721
|
}
|
|
786
722
|
}
|
|
787
|
-
|
|
788
723
|
if (context.method === "next") {
|
|
789
724
|
// Setting context._sent for legacy support of Babel's
|
|
790
725
|
// function.sent implementation.
|
|
@@ -794,51 +729,44 @@ var runtime = {exports: {}};
|
|
|
794
729
|
state = GenStateCompleted;
|
|
795
730
|
throw context.arg;
|
|
796
731
|
}
|
|
797
|
-
|
|
798
732
|
context.dispatchException(context.arg);
|
|
799
733
|
} else if (context.method === "return") {
|
|
800
734
|
context.abrupt("return", context.arg);
|
|
801
735
|
}
|
|
802
|
-
|
|
803
736
|
state = GenStateExecuting;
|
|
804
737
|
var record = tryCatch(innerFn, self, context);
|
|
805
|
-
|
|
806
738
|
if (record.type === "normal") {
|
|
807
739
|
// If an exception is thrown from innerFn, we leave state ===
|
|
808
740
|
// GenStateExecuting and loop back for another invocation.
|
|
809
741
|
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
810
|
-
|
|
811
742
|
if (record.arg === ContinueSentinel) {
|
|
812
743
|
continue;
|
|
813
744
|
}
|
|
814
|
-
|
|
815
745
|
return {
|
|
816
746
|
value: record.arg,
|
|
817
747
|
done: context.done
|
|
818
748
|
};
|
|
819
749
|
} else if (record.type === "throw") {
|
|
820
|
-
state = GenStateCompleted;
|
|
750
|
+
state = GenStateCompleted;
|
|
751
|
+
// Dispatch the exception by looping back around to the
|
|
821
752
|
// context.dispatchException(context.arg) call above.
|
|
822
|
-
|
|
823
753
|
context.method = "throw";
|
|
824
754
|
context.arg = record.arg;
|
|
825
755
|
}
|
|
826
756
|
}
|
|
827
757
|
};
|
|
828
|
-
}
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
// Call delegate.iterator[context.method](context.arg) and handle the
|
|
829
761
|
// result, either by returning a { value, done } result from the
|
|
830
762
|
// delegate iterator, or by modifying context.method and context.arg,
|
|
831
763
|
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
832
|
-
|
|
833
|
-
|
|
834
764
|
function maybeInvokeDelegate(delegate, context) {
|
|
835
765
|
var method = delegate.iterator[context.method];
|
|
836
|
-
|
|
837
766
|
if (method === undefined$1) {
|
|
838
767
|
// A .throw or .return when the delegate iterator has no .throw
|
|
839
768
|
// method always terminates the yield* loop.
|
|
840
769
|
context.delegate = null;
|
|
841
|
-
|
|
842
770
|
if (context.method === "throw") {
|
|
843
771
|
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
844
772
|
if (delegate.iterator["return"]) {
|
|
@@ -847,51 +775,45 @@ var runtime = {exports: {}};
|
|
|
847
775
|
context.method = "return";
|
|
848
776
|
context.arg = undefined$1;
|
|
849
777
|
maybeInvokeDelegate(delegate, context);
|
|
850
|
-
|
|
851
778
|
if (context.method === "throw") {
|
|
852
779
|
// If maybeInvokeDelegate(context) changed context.method from
|
|
853
780
|
// "return" to "throw", let that override the TypeError below.
|
|
854
781
|
return ContinueSentinel;
|
|
855
782
|
}
|
|
856
783
|
}
|
|
857
|
-
|
|
858
784
|
context.method = "throw";
|
|
859
785
|
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
860
786
|
}
|
|
861
|
-
|
|
862
787
|
return ContinueSentinel;
|
|
863
788
|
}
|
|
864
|
-
|
|
865
789
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
866
|
-
|
|
867
790
|
if (record.type === "throw") {
|
|
868
791
|
context.method = "throw";
|
|
869
792
|
context.arg = record.arg;
|
|
870
793
|
context.delegate = null;
|
|
871
794
|
return ContinueSentinel;
|
|
872
795
|
}
|
|
873
|
-
|
|
874
796
|
var info = record.arg;
|
|
875
|
-
|
|
876
797
|
if (!info) {
|
|
877
798
|
context.method = "throw";
|
|
878
799
|
context.arg = new TypeError("iterator result is not an object");
|
|
879
800
|
context.delegate = null;
|
|
880
801
|
return ContinueSentinel;
|
|
881
802
|
}
|
|
882
|
-
|
|
883
803
|
if (info.done) {
|
|
884
804
|
// Assign the result of the finished delegate to the temporary
|
|
885
805
|
// variable specified by delegate.resultName (see delegateYield).
|
|
886
|
-
context[delegate.resultName] = info.value;
|
|
806
|
+
context[delegate.resultName] = info.value;
|
|
807
|
+
|
|
808
|
+
// Resume execution at the desired location (see delegateYield).
|
|
809
|
+
context.next = delegate.nextLoc;
|
|
887
810
|
|
|
888
|
-
|
|
811
|
+
// If context.method was "throw" but the delegate handled the
|
|
889
812
|
// exception, let the outer generator proceed normally. If
|
|
890
813
|
// context.method was "next", forget context.arg since it has been
|
|
891
814
|
// "consumed" by the delegate iterator. If context.method was
|
|
892
815
|
// "return", allow the original .return call to continue in the
|
|
893
816
|
// outer generator.
|
|
894
|
-
|
|
895
817
|
if (context.method !== "return") {
|
|
896
818
|
context.method = "next";
|
|
897
819
|
context.arg = undefined$1;
|
|
@@ -899,55 +821,49 @@ var runtime = {exports: {}};
|
|
|
899
821
|
} else {
|
|
900
822
|
// Re-yield the result returned by the delegate method.
|
|
901
823
|
return info;
|
|
902
|
-
}
|
|
903
|
-
// the outer generator.
|
|
904
|
-
|
|
824
|
+
}
|
|
905
825
|
|
|
826
|
+
// The delegate iterator is finished, so forget it and continue with
|
|
827
|
+
// the outer generator.
|
|
906
828
|
context.delegate = null;
|
|
907
829
|
return ContinueSentinel;
|
|
908
|
-
}
|
|
909
|
-
// unified ._invoke helper method.
|
|
910
|
-
|
|
830
|
+
}
|
|
911
831
|
|
|
832
|
+
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
833
|
+
// unified ._invoke helper method.
|
|
912
834
|
defineIteratorMethods(Gp);
|
|
913
|
-
define(Gp, toStringTagSymbol, "Generator");
|
|
835
|
+
define(Gp, toStringTagSymbol, "Generator");
|
|
836
|
+
|
|
837
|
+
// A Generator should always return itself as the iterator object when the
|
|
914
838
|
// @@iterator function is called on it. Some browsers' implementations of the
|
|
915
839
|
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
916
840
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
917
841
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
918
|
-
|
|
919
|
-
Gp[iteratorSymbol] = function () {
|
|
842
|
+
define(Gp, iteratorSymbol, function () {
|
|
920
843
|
return this;
|
|
921
|
-
};
|
|
922
|
-
|
|
923
|
-
Gp.toString = function () {
|
|
844
|
+
});
|
|
845
|
+
define(Gp, "toString", function () {
|
|
924
846
|
return "[object Generator]";
|
|
925
|
-
};
|
|
926
|
-
|
|
847
|
+
});
|
|
927
848
|
function pushTryEntry(locs) {
|
|
928
849
|
var entry = {
|
|
929
850
|
tryLoc: locs[0]
|
|
930
851
|
};
|
|
931
|
-
|
|
932
852
|
if (1 in locs) {
|
|
933
853
|
entry.catchLoc = locs[1];
|
|
934
854
|
}
|
|
935
|
-
|
|
936
855
|
if (2 in locs) {
|
|
937
856
|
entry.finallyLoc = locs[2];
|
|
938
857
|
entry.afterLoc = locs[3];
|
|
939
858
|
}
|
|
940
|
-
|
|
941
859
|
this.tryEntries.push(entry);
|
|
942
860
|
}
|
|
943
|
-
|
|
944
861
|
function resetTryEntry(entry) {
|
|
945
862
|
var record = entry.completion || {};
|
|
946
863
|
record.type = "normal";
|
|
947
864
|
delete record.arg;
|
|
948
865
|
entry.completion = record;
|
|
949
866
|
}
|
|
950
|
-
|
|
951
867
|
function Context(tryLocsList) {
|
|
952
868
|
// The root entry object (effectively a try statement without a catch
|
|
953
869
|
// or a finally block) gives us a place to store values thrown from
|
|
@@ -958,97 +874,84 @@ var runtime = {exports: {}};
|
|
|
958
874
|
tryLocsList.forEach(pushTryEntry, this);
|
|
959
875
|
this.reset(true);
|
|
960
876
|
}
|
|
961
|
-
|
|
962
877
|
exports.keys = function (object) {
|
|
963
878
|
var keys = [];
|
|
964
|
-
|
|
965
879
|
for (var key in object) {
|
|
966
880
|
keys.push(key);
|
|
967
881
|
}
|
|
882
|
+
keys.reverse();
|
|
968
883
|
|
|
969
|
-
|
|
884
|
+
// Rather than returning an object with a next method, we keep
|
|
970
885
|
// things simple and return the next function itself.
|
|
971
|
-
|
|
972
886
|
return function next() {
|
|
973
887
|
while (keys.length) {
|
|
974
888
|
var key = keys.pop();
|
|
975
|
-
|
|
976
889
|
if (key in object) {
|
|
977
890
|
next.value = key;
|
|
978
891
|
next.done = false;
|
|
979
892
|
return next;
|
|
980
893
|
}
|
|
981
|
-
}
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
// To avoid creating an additional object, we just hang the .value
|
|
982
897
|
// and .done properties off the next function object itself. This
|
|
983
898
|
// also ensures that the minifier will not anonymize the function.
|
|
984
|
-
|
|
985
|
-
|
|
986
899
|
next.done = true;
|
|
987
900
|
return next;
|
|
988
901
|
};
|
|
989
902
|
};
|
|
990
|
-
|
|
991
903
|
function values(iterable) {
|
|
992
904
|
if (iterable) {
|
|
993
905
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
994
|
-
|
|
995
906
|
if (iteratorMethod) {
|
|
996
907
|
return iteratorMethod.call(iterable);
|
|
997
908
|
}
|
|
998
|
-
|
|
999
909
|
if (typeof iterable.next === "function") {
|
|
1000
910
|
return iterable;
|
|
1001
911
|
}
|
|
1002
|
-
|
|
1003
912
|
if (!isNaN(iterable.length)) {
|
|
1004
913
|
var i = -1,
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
914
|
+
next = function next() {
|
|
915
|
+
while (++i < iterable.length) {
|
|
916
|
+
if (hasOwn.call(iterable, i)) {
|
|
917
|
+
next.value = iterable[i];
|
|
918
|
+
next.done = false;
|
|
919
|
+
return next;
|
|
920
|
+
}
|
|
1011
921
|
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
return next;
|
|
1017
|
-
};
|
|
1018
|
-
|
|
922
|
+
next.value = undefined$1;
|
|
923
|
+
next.done = true;
|
|
924
|
+
return next;
|
|
925
|
+
};
|
|
1019
926
|
return next.next = next;
|
|
1020
927
|
}
|
|
1021
|
-
}
|
|
1022
|
-
|
|
928
|
+
}
|
|
1023
929
|
|
|
930
|
+
// Return an iterator with no values.
|
|
1024
931
|
return {
|
|
1025
932
|
next: doneResult
|
|
1026
933
|
};
|
|
1027
934
|
}
|
|
1028
|
-
|
|
1029
935
|
exports.values = values;
|
|
1030
|
-
|
|
1031
936
|
function doneResult() {
|
|
1032
937
|
return {
|
|
1033
938
|
value: undefined$1,
|
|
1034
939
|
done: true
|
|
1035
940
|
};
|
|
1036
941
|
}
|
|
1037
|
-
|
|
1038
942
|
Context.prototype = {
|
|
1039
943
|
constructor: Context,
|
|
1040
944
|
reset: function reset(skipTempReset) {
|
|
1041
945
|
this.prev = 0;
|
|
1042
|
-
this.next = 0;
|
|
946
|
+
this.next = 0;
|
|
947
|
+
// Resetting context._sent for legacy support of Babel's
|
|
1043
948
|
// function.sent implementation.
|
|
1044
|
-
|
|
1045
949
|
this.sent = this._sent = undefined$1;
|
|
1046
950
|
this.done = false;
|
|
1047
951
|
this.delegate = null;
|
|
1048
952
|
this.method = "next";
|
|
1049
953
|
this.arg = undefined$1;
|
|
1050
954
|
this.tryEntries.forEach(resetTryEntry);
|
|
1051
|
-
|
|
1052
955
|
if (!skipTempReset) {
|
|
1053
956
|
for (var name in this) {
|
|
1054
957
|
// Not sure about the optimal order of these conditions:
|
|
@@ -1062,50 +965,40 @@ var runtime = {exports: {}};
|
|
|
1062
965
|
this.done = true;
|
|
1063
966
|
var rootEntry = this.tryEntries[0];
|
|
1064
967
|
var rootRecord = rootEntry.completion;
|
|
1065
|
-
|
|
1066
968
|
if (rootRecord.type === "throw") {
|
|
1067
969
|
throw rootRecord.arg;
|
|
1068
970
|
}
|
|
1069
|
-
|
|
1070
971
|
return this.rval;
|
|
1071
972
|
},
|
|
1072
973
|
dispatchException: function dispatchException(exception) {
|
|
1073
974
|
if (this.done) {
|
|
1074
975
|
throw exception;
|
|
1075
976
|
}
|
|
1076
|
-
|
|
1077
977
|
var context = this;
|
|
1078
|
-
|
|
1079
978
|
function handle(loc, caught) {
|
|
1080
979
|
record.type = "throw";
|
|
1081
980
|
record.arg = exception;
|
|
1082
981
|
context.next = loc;
|
|
1083
|
-
|
|
1084
982
|
if (caught) {
|
|
1085
983
|
// If the dispatched exception was caught by a catch block,
|
|
1086
984
|
// then let that catch block handle the exception normally.
|
|
1087
985
|
context.method = "next";
|
|
1088
986
|
context.arg = undefined$1;
|
|
1089
987
|
}
|
|
1090
|
-
|
|
1091
988
|
return !!caught;
|
|
1092
989
|
}
|
|
1093
|
-
|
|
1094
990
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1095
991
|
var entry = this.tryEntries[i];
|
|
1096
992
|
var record = entry.completion;
|
|
1097
|
-
|
|
1098
993
|
if (entry.tryLoc === "root") {
|
|
1099
994
|
// Exception thrown outside of any try block that could handle
|
|
1100
995
|
// it, so set the completion value of the entire function to
|
|
1101
996
|
// throw the exception.
|
|
1102
997
|
return handle("end");
|
|
1103
998
|
}
|
|
1104
|
-
|
|
1105
999
|
if (entry.tryLoc <= this.prev) {
|
|
1106
1000
|
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
1107
1001
|
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
1108
|
-
|
|
1109
1002
|
if (hasCatch && hasFinally) {
|
|
1110
1003
|
if (this.prev < entry.catchLoc) {
|
|
1111
1004
|
return handle(entry.catchLoc, true);
|
|
@@ -1129,36 +1022,30 @@ var runtime = {exports: {}};
|
|
|
1129
1022
|
abrupt: function abrupt(type, arg) {
|
|
1130
1023
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1131
1024
|
var entry = this.tryEntries[i];
|
|
1132
|
-
|
|
1133
1025
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
1134
1026
|
var finallyEntry = entry;
|
|
1135
1027
|
break;
|
|
1136
1028
|
}
|
|
1137
1029
|
}
|
|
1138
|
-
|
|
1139
1030
|
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
1140
1031
|
// Ignore the finally entry if control is not jumping to a
|
|
1141
1032
|
// location outside the try/catch block.
|
|
1142
1033
|
finallyEntry = null;
|
|
1143
1034
|
}
|
|
1144
|
-
|
|
1145
1035
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
1146
1036
|
record.type = type;
|
|
1147
1037
|
record.arg = arg;
|
|
1148
|
-
|
|
1149
1038
|
if (finallyEntry) {
|
|
1150
1039
|
this.method = "next";
|
|
1151
1040
|
this.next = finallyEntry.finallyLoc;
|
|
1152
1041
|
return ContinueSentinel;
|
|
1153
1042
|
}
|
|
1154
|
-
|
|
1155
1043
|
return this.complete(record);
|
|
1156
1044
|
},
|
|
1157
1045
|
complete: function complete(record, afterLoc) {
|
|
1158
1046
|
if (record.type === "throw") {
|
|
1159
1047
|
throw record.arg;
|
|
1160
1048
|
}
|
|
1161
|
-
|
|
1162
1049
|
if (record.type === "break" || record.type === "continue") {
|
|
1163
1050
|
this.next = record.arg;
|
|
1164
1051
|
} else if (record.type === "return") {
|
|
@@ -1168,13 +1055,11 @@ var runtime = {exports: {}};
|
|
|
1168
1055
|
} else if (record.type === "normal" && afterLoc) {
|
|
1169
1056
|
this.next = afterLoc;
|
|
1170
1057
|
}
|
|
1171
|
-
|
|
1172
1058
|
return ContinueSentinel;
|
|
1173
1059
|
},
|
|
1174
1060
|
finish: function finish(finallyLoc) {
|
|
1175
1061
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1176
1062
|
var entry = this.tryEntries[i];
|
|
1177
|
-
|
|
1178
1063
|
if (entry.finallyLoc === finallyLoc) {
|
|
1179
1064
|
this.complete(entry.completion, entry.afterLoc);
|
|
1180
1065
|
resetTryEntry(entry);
|
|
@@ -1185,21 +1070,18 @@ var runtime = {exports: {}};
|
|
|
1185
1070
|
"catch": function _catch(tryLoc) {
|
|
1186
1071
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1187
1072
|
var entry = this.tryEntries[i];
|
|
1188
|
-
|
|
1189
1073
|
if (entry.tryLoc === tryLoc) {
|
|
1190
1074
|
var record = entry.completion;
|
|
1191
|
-
|
|
1192
1075
|
if (record.type === "throw") {
|
|
1193
1076
|
var thrown = record.arg;
|
|
1194
1077
|
resetTryEntry(entry);
|
|
1195
1078
|
}
|
|
1196
|
-
|
|
1197
1079
|
return thrown;
|
|
1198
1080
|
}
|
|
1199
|
-
}
|
|
1200
|
-
// argument that corresponds to a known catch block.
|
|
1201
|
-
|
|
1081
|
+
}
|
|
1202
1082
|
|
|
1083
|
+
// The context.catch method must only be called with a location
|
|
1084
|
+
// argument that corresponds to a known catch block.
|
|
1203
1085
|
throw new Error("illegal catch attempt");
|
|
1204
1086
|
},
|
|
1205
1087
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
@@ -1208,43 +1090,46 @@ var runtime = {exports: {}};
|
|
|
1208
1090
|
resultName: resultName,
|
|
1209
1091
|
nextLoc: nextLoc
|
|
1210
1092
|
};
|
|
1211
|
-
|
|
1212
1093
|
if (this.method === "next") {
|
|
1213
1094
|
// Deliberately forget the last sent value so that we don't
|
|
1214
1095
|
// accidentally pass it on to the delegate.
|
|
1215
1096
|
this.arg = undefined$1;
|
|
1216
1097
|
}
|
|
1217
|
-
|
|
1218
1098
|
return ContinueSentinel;
|
|
1219
1099
|
}
|
|
1220
|
-
};
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1102
|
+
// Regardless of whether this script is executing as a CommonJS module
|
|
1221
1103
|
// or not, return the runtime object so that we can declare the variable
|
|
1222
1104
|
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
1223
1105
|
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
1224
|
-
|
|
1225
1106
|
return exports;
|
|
1226
|
-
}(
|
|
1107
|
+
}(
|
|
1108
|
+
// If this script is executing as a CommonJS module, use module.exports
|
|
1227
1109
|
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
1228
1110
|
// object. Either way, the resulting object will be used to initialize
|
|
1229
1111
|
// the regeneratorRuntime variable at the top of this file.
|
|
1230
1112
|
module.exports );
|
|
1231
|
-
|
|
1232
1113
|
try {
|
|
1233
1114
|
regeneratorRuntime = runtime;
|
|
1234
1115
|
} catch (accidentalStrictMode) {
|
|
1235
1116
|
// This module should not be running in strict mode, so the above
|
|
1236
1117
|
// assignment should always work unless something is misconfigured. Just
|
|
1237
|
-
// in case runtime.js accidentally runs in strict mode,
|
|
1118
|
+
// in case runtime.js accidentally runs in strict mode, in modern engines
|
|
1119
|
+
// we can explicitly access globalThis. In older engines we can escape
|
|
1238
1120
|
// strict mode using a global Function call. This could conceivably fail
|
|
1239
1121
|
// if a Content Security Policy forbids using Function, but in that case
|
|
1240
1122
|
// the proper solution is to fix the accidental strict mode problem. If
|
|
1241
1123
|
// you've misconfigured your bundler to force strict mode and applied a
|
|
1242
1124
|
// CSP to forbid Function, and you're not willing to fix either of those
|
|
1243
1125
|
// problems, please detail your unique predicament in a GitHub issue.
|
|
1244
|
-
|
|
1126
|
+
if (typeof globalThis === "object") {
|
|
1127
|
+
globalThis.regeneratorRuntime = runtime;
|
|
1128
|
+
} else {
|
|
1129
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
1130
|
+
}
|
|
1245
1131
|
}
|
|
1246
1132
|
})(runtime);
|
|
1247
|
-
|
|
1248
1133
|
var _regeneratorRuntime = runtime.exports;
|
|
1249
1134
|
|
|
1250
1135
|
var useNormalizedItems = function useNormalizedItems(items) {
|
|
@@ -1256,13 +1141,11 @@ var useNormalizedItems = function useNormalizedItems(items) {
|
|
|
1256
1141
|
label: item
|
|
1257
1142
|
};
|
|
1258
1143
|
}
|
|
1259
|
-
|
|
1260
1144
|
if (!('value' in item)) {
|
|
1261
1145
|
return _extends({}, item, {
|
|
1262
1146
|
value: item.label
|
|
1263
1147
|
});
|
|
1264
1148
|
}
|
|
1265
|
-
|
|
1266
1149
|
return item;
|
|
1267
1150
|
});
|
|
1268
1151
|
}, [items]);
|
|
@@ -1277,7 +1160,6 @@ var useIsMounted = function useIsMounted() {
|
|
|
1277
1160
|
}, []);
|
|
1278
1161
|
return isMountedRef.current;
|
|
1279
1162
|
};
|
|
1280
|
-
|
|
1281
1163
|
var reducer = function reducer(_state, action) {
|
|
1282
1164
|
switch (action.type) {
|
|
1283
1165
|
case 'request results':
|
|
@@ -1285,7 +1167,6 @@ var reducer = function reducer(_state, action) {
|
|
|
1285
1167
|
items: [],
|
|
1286
1168
|
loading: true
|
|
1287
1169
|
};
|
|
1288
|
-
|
|
1289
1170
|
case 'received results':
|
|
1290
1171
|
return {
|
|
1291
1172
|
items: action.payload,
|
|
@@ -1293,40 +1174,34 @@ var reducer = function reducer(_state, action) {
|
|
|
1293
1174
|
};
|
|
1294
1175
|
}
|
|
1295
1176
|
};
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
/** The list of items, or an async function that resolves the list of items */
|
|
1299
|
-
itemsOrItemsResolver,
|
|
1300
|
-
/** The time to wait after the input changes to the fetchItems method is called */
|
|
1177
|
+
var useResolvedItems = function useResolvedItems( /** The list of items, or an async function that resolves the list of items */
|
|
1178
|
+
itemsOrItemsResolver, /** The time to wait after the input changes to the fetchItems method is called */
|
|
1301
1179
|
debounceTimeout) {
|
|
1302
1180
|
if (debounceTimeout === void 0) {
|
|
1303
1181
|
debounceTimeout = 250;
|
|
1304
1182
|
}
|
|
1305
|
-
|
|
1306
|
-
|
|
1183
|
+
var isItemsFunction = typeof itemsOrItemsResolver === 'function';
|
|
1184
|
+
// Here, we normalize the itemsResolver argument to an async function, so we
|
|
1307
1185
|
// can use it without thinking about the differences later
|
|
1308
|
-
|
|
1309
1186
|
var itemsResolver = React__default["default"].useMemo(function () {
|
|
1310
1187
|
return isItemsFunction ? itemsOrItemsResolver : function () {
|
|
1311
1188
|
return Promise.resolve(itemsOrItemsResolver);
|
|
1312
1189
|
};
|
|
1313
1190
|
}, [itemsOrItemsResolver, isItemsFunction]);
|
|
1314
|
-
|
|
1315
1191
|
var _React$useReducer = React__default["default"].useReducer(reducer, {
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1192
|
+
items: isItemsFunction ? [] : itemsOrItemsResolver,
|
|
1193
|
+
loading: false
|
|
1194
|
+
}),
|
|
1195
|
+
_React$useReducer$ = _React$useReducer[0],
|
|
1196
|
+
items = _React$useReducer$.items,
|
|
1197
|
+
loading = _React$useReducer$.loading,
|
|
1198
|
+
dispatch = _React$useReducer[1];
|
|
1199
|
+
// This is a way to check whether or not the dropdown is still in the
|
|
1323
1200
|
// document. We use it below to make sure we're not updating the state of
|
|
1324
1201
|
// an unmounted component.
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
var isMounted = useIsMounted(); // Next, let's create the fetching function. This should be called whenever
|
|
1202
|
+
var isMounted = useIsMounted();
|
|
1203
|
+
// Next, let's create the fetching function. This should be called whenever
|
|
1328
1204
|
// the input value changes
|
|
1329
|
-
|
|
1330
1205
|
var fetchItems = React__default["default"].useCallback( /*#__PURE__*/function () {
|
|
1331
1206
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(inputValue) {
|
|
1332
1207
|
var resolvedItems;
|
|
@@ -1338,26 +1213,21 @@ debounceTimeout) {
|
|
|
1338
1213
|
_context.next = 2;
|
|
1339
1214
|
break;
|
|
1340
1215
|
}
|
|
1341
|
-
|
|
1342
1216
|
return _context.abrupt("return");
|
|
1343
|
-
|
|
1344
1217
|
case 2:
|
|
1345
1218
|
dispatch({
|
|
1346
1219
|
type: 'request results'
|
|
1347
1220
|
});
|
|
1348
1221
|
_context.next = 5;
|
|
1349
1222
|
return itemsResolver(inputValue);
|
|
1350
|
-
|
|
1351
1223
|
case 5:
|
|
1352
1224
|
resolvedItems = _context.sent;
|
|
1353
|
-
|
|
1354
1225
|
if (isMounted) {
|
|
1355
1226
|
dispatch({
|
|
1356
1227
|
type: 'received results',
|
|
1357
1228
|
payload: resolvedItems
|
|
1358
1229
|
});
|
|
1359
1230
|
}
|
|
1360
|
-
|
|
1361
1231
|
case 7:
|
|
1362
1232
|
case "end":
|
|
1363
1233
|
return _context.stop();
|
|
@@ -1365,7 +1235,6 @@ debounceTimeout) {
|
|
|
1365
1235
|
}
|
|
1366
1236
|
}, _callee);
|
|
1367
1237
|
}));
|
|
1368
|
-
|
|
1369
1238
|
return function (_x) {
|
|
1370
1239
|
return _ref.apply(this, arguments);
|
|
1371
1240
|
};
|
|
@@ -1387,38 +1256,36 @@ debounceTimeout) {
|
|
|
1387
1256
|
var _excluded$4 = ["highlightFirstItemOnOpen", "debounceTimeout", "disabled", "feedback", "items", "label", "loadingText", "onChange", "placeholder", "prepend", "readOnly", "searchable", "selectOnTab", "openOnFocus", "variant", "value", "clearable", "className", "style", "listStyle", "itemFilter", "disableLabelAnimation"];
|
|
1388
1257
|
var Dropdown = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
|
|
1389
1258
|
var highlightFirstItemOnOpen = _ref.highlightFirstItemOnOpen,
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1259
|
+
debounceTimeout = _ref.debounceTimeout,
|
|
1260
|
+
disabled = _ref.disabled,
|
|
1261
|
+
feedback = _ref.feedback,
|
|
1262
|
+
items = _ref.items,
|
|
1263
|
+
label = _ref.label,
|
|
1264
|
+
loadingText = _ref.loadingText,
|
|
1265
|
+
_ref$onChange = _ref.onChange,
|
|
1266
|
+
onChange = _ref$onChange === void 0 ? function () {
|
|
1267
|
+
return undefined;
|
|
1268
|
+
} : _ref$onChange,
|
|
1269
|
+
placeholder = _ref.placeholder,
|
|
1270
|
+
prepend = _ref.prepend,
|
|
1271
|
+
readOnly = _ref.readOnly,
|
|
1272
|
+
searchable = _ref.searchable,
|
|
1273
|
+
selectOnTab = _ref.selectOnTab,
|
|
1274
|
+
openOnFocus = _ref.openOnFocus,
|
|
1275
|
+
variant = _ref.variant,
|
|
1276
|
+
value = _ref.value,
|
|
1277
|
+
_ref$clearable = _ref.clearable,
|
|
1278
|
+
clearable = _ref$clearable === void 0 ? false : _ref$clearable,
|
|
1279
|
+
className = _ref.className,
|
|
1280
|
+
style = _ref.style,
|
|
1281
|
+
listStyle = _ref.listStyle,
|
|
1282
|
+
itemFilter = _ref.itemFilter,
|
|
1283
|
+
disableLabelAnimation = _ref.disableLabelAnimation,
|
|
1284
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
1417
1285
|
var _useResolvedItems = useResolvedItems(items, debounceTimeout),
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1286
|
+
normalizedItems = _useResolvedItems.items,
|
|
1287
|
+
loading = _useResolvedItems.loading,
|
|
1288
|
+
fetchItems = _useResolvedItems.fetchItems;
|
|
1422
1289
|
var selectedItem = value === undefined ? undefined : normalizedItems.find(function (item) {
|
|
1423
1290
|
return value === item.value;
|
|
1424
1291
|
}) || null;
|
|
@@ -1464,34 +1331,30 @@ var Dropdown = /*#__PURE__*/React__default["default"].forwardRef(function (_ref,
|
|
|
1464
1331
|
var _excluded$3 = ["className", "disabled", "readOnly", "items", "loadingText", "prepend", "style", "label", "variant", "feedback", "disableLabelAnimation"];
|
|
1465
1332
|
var NativeDropdown = function NativeDropdown(_ref) {
|
|
1466
1333
|
var className = _ref.className,
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1334
|
+
_ref$disabled = _ref.disabled,
|
|
1335
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
1336
|
+
_ref$readOnly = _ref.readOnly,
|
|
1337
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
1338
|
+
items = _ref.items,
|
|
1339
|
+
loadingText = _ref.loadingText,
|
|
1340
|
+
prepend = _ref.prepend,
|
|
1341
|
+
style = _ref.style,
|
|
1342
|
+
label = _ref.label,
|
|
1343
|
+
variant = _ref.variant,
|
|
1344
|
+
feedback = _ref.feedback,
|
|
1345
|
+
disableLabelAnimation = _ref.disableLabelAnimation,
|
|
1346
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
1481
1347
|
var _useResolvedItems = useResolvedItems(items),
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1348
|
+
normalizedItems = _useResolvedItems.items,
|
|
1349
|
+
loading = _useResolvedItems.loading;
|
|
1485
1350
|
var rightSideIcon = React__default["default"].createElement(icons.DownArrowIcon, {
|
|
1486
1351
|
inline: true
|
|
1487
1352
|
});
|
|
1488
|
-
|
|
1489
1353
|
if (disabled || readOnly) {
|
|
1490
1354
|
rightSideIcon = null;
|
|
1491
1355
|
} else if (loading) {
|
|
1492
1356
|
rightSideIcon = React__default["default"].createElement(DropdownLoadingDots, null, loadingText);
|
|
1493
1357
|
}
|
|
1494
|
-
|
|
1495
1358
|
var nativeDropdownId = utils.useRandomId('eds-native-dropdown');
|
|
1496
1359
|
return React__default["default"].createElement(form.BaseFormControl, {
|
|
1497
1360
|
disabled: disabled,
|
|
@@ -1520,22 +1383,18 @@ var NativeDropdown = function NativeDropdown(_ref) {
|
|
|
1520
1383
|
|
|
1521
1384
|
var _excluded$2 = ["items", "itemsSelectedLabel", "label", "feedback", "variant", "disabled", "readOnly", "onChange", "className", "clearable", "loading", "loadingText", "openOnFocus", "style", "listStyle", "initialSelectedItems", "debounceTimeout"];
|
|
1522
1385
|
var MultiSelectContext = /*#__PURE__*/React__default["default"].createContext(null);
|
|
1523
|
-
|
|
1524
1386
|
var useMultiSelectContext = function useMultiSelectContext() {
|
|
1525
1387
|
var context = React__default["default"].useContext(MultiSelectContext);
|
|
1526
|
-
|
|
1527
1388
|
if (!context) {
|
|
1528
1389
|
throw new Error('You need to wrap your component in a DownshiftProvider');
|
|
1529
1390
|
}
|
|
1530
|
-
|
|
1531
1391
|
return context;
|
|
1532
1392
|
};
|
|
1533
|
-
|
|
1534
|
-
|
|
1393
|
+
function stateReducer(state,
|
|
1394
|
+
//StateChangeOptions<NormalizedDropdownItemType>,
|
|
1535
1395
|
actionAndChanges) {
|
|
1536
1396
|
var changes = actionAndChanges.changes,
|
|
1537
|
-
|
|
1538
|
-
|
|
1397
|
+
type = actionAndChanges.type;
|
|
1539
1398
|
switch (type) {
|
|
1540
1399
|
case Downshift.useSelect.stateChangeTypes.MenuKeyDownEnter:
|
|
1541
1400
|
case Downshift.useSelect.stateChangeTypes.MenuKeyDownSpaceButton:
|
|
@@ -1544,96 +1403,84 @@ actionAndChanges) {
|
|
|
1544
1403
|
isOpen: true,
|
|
1545
1404
|
highlightedIndex: state.highlightedIndex
|
|
1546
1405
|
});
|
|
1547
|
-
|
|
1548
1406
|
default:
|
|
1549
1407
|
return changes;
|
|
1550
1408
|
}
|
|
1551
1409
|
}
|
|
1552
|
-
|
|
1553
1410
|
var MultiSelect = function MultiSelect(_ref) {
|
|
1554
1411
|
var input = _ref.items,
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1412
|
+
_ref$itemsSelectedLab = _ref.itemsSelectedLabel,
|
|
1413
|
+
itemsSelectedLabel = _ref$itemsSelectedLab === void 0 ? function (items) {
|
|
1414
|
+
return SelectedItemsLabel(items);
|
|
1415
|
+
} : _ref$itemsSelectedLab,
|
|
1416
|
+
label = _ref.label,
|
|
1417
|
+
feedback = _ref.feedback,
|
|
1418
|
+
variant = _ref.variant,
|
|
1419
|
+
disabled = _ref.disabled,
|
|
1420
|
+
_ref$readOnly = _ref.readOnly,
|
|
1421
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
1422
|
+
_ref$onChange = _ref.onChange,
|
|
1423
|
+
onChange = _ref$onChange === void 0 ? function () {
|
|
1424
|
+
return undefined;
|
|
1425
|
+
} : _ref$onChange,
|
|
1426
|
+
className = _ref.className,
|
|
1427
|
+
_ref$clearable = _ref.clearable,
|
|
1428
|
+
clearable = _ref$clearable === void 0 ? false : _ref$clearable,
|
|
1429
|
+
_ref$loading = _ref.loading,
|
|
1430
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
1431
|
+
_ref$loadingText = _ref.loadingText,
|
|
1432
|
+
loadingText = _ref$loadingText === void 0 ? '' : _ref$loadingText,
|
|
1433
|
+
_ref$openOnFocus = _ref.openOnFocus,
|
|
1434
|
+
openOnFocus = _ref$openOnFocus === void 0 ? false : _ref$openOnFocus,
|
|
1435
|
+
style = _ref.style,
|
|
1436
|
+
listStyle = _ref.listStyle,
|
|
1437
|
+
_ref$initialSelectedI = _ref.initialSelectedItems,
|
|
1438
|
+
initialSelectedItems = _ref$initialSelectedI === void 0 ? [] : _ref$initialSelectedI,
|
|
1439
|
+
debounceTimeout = _ref.debounceTimeout,
|
|
1440
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
1585
1441
|
var _useResolvedItems = useResolvedItems(input, debounceTimeout),
|
|
1586
|
-
|
|
1587
|
-
|
|
1442
|
+
items = _useResolvedItems.items;
|
|
1588
1443
|
var _useState = React.useState(initialSelectedItems),
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1444
|
+
selectedItems = _useState[0],
|
|
1445
|
+
setSelectedItems = _useState[1];
|
|
1592
1446
|
var reset = React__default["default"].useCallback(function () {
|
|
1593
1447
|
setSelectedItems([]);
|
|
1594
1448
|
}, []);
|
|
1595
|
-
|
|
1596
1449
|
function isSelected(selectedCheckboxItem) {
|
|
1597
1450
|
return selectedItems.some(function (selected) {
|
|
1598
1451
|
return selected.value === selectedCheckboxItem.value;
|
|
1599
1452
|
});
|
|
1600
1453
|
}
|
|
1601
|
-
|
|
1602
1454
|
var _useSelect = Downshift.useSelect(_extends({
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
}
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
setSelectedItems(_slicedItemList);
|
|
1625
|
-
onChange(_slicedItemList);
|
|
1455
|
+
items: items,
|
|
1456
|
+
stateReducer: stateReducer,
|
|
1457
|
+
selectedItem: null,
|
|
1458
|
+
onSelectedItemChange: function onSelectedItemChange(_ref2) {
|
|
1459
|
+
var selectedItem = _ref2.selectedItem;
|
|
1460
|
+
if (!selectedItem) {
|
|
1461
|
+
return;
|
|
1462
|
+
}
|
|
1463
|
+
var itemIsFound = isSelected(selectedItem);
|
|
1464
|
+
if (itemIsFound) {
|
|
1465
|
+
var slicedItemList = selectedItems.filter(function (item) {
|
|
1466
|
+
return item.value !== selectedItem.value;
|
|
1467
|
+
});
|
|
1468
|
+
setSelectedItems(slicedItemList);
|
|
1469
|
+
onChange(slicedItemList);
|
|
1470
|
+
} else {
|
|
1471
|
+
var _slicedItemList = [].concat(selectedItems, [selectedItem]);
|
|
1472
|
+
setSelectedItems(_slicedItemList);
|
|
1473
|
+
onChange(_slicedItemList);
|
|
1474
|
+
}
|
|
1626
1475
|
}
|
|
1627
|
-
}
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
openMenu = _useSelect.openMenu;
|
|
1636
|
-
|
|
1476
|
+
}, rest)),
|
|
1477
|
+
isOpen = _useSelect.isOpen,
|
|
1478
|
+
getToggleButtonProps = _useSelect.getToggleButtonProps,
|
|
1479
|
+
getLabelProps = _useSelect.getLabelProps,
|
|
1480
|
+
getMenuProps = _useSelect.getMenuProps,
|
|
1481
|
+
highlightedIndex = _useSelect.highlightedIndex,
|
|
1482
|
+
getItemProps = _useSelect.getItemProps,
|
|
1483
|
+
openMenu = _useSelect.openMenu;
|
|
1637
1484
|
var buttonText = selectedItems.length ? itemsSelectedLabel(selectedItems) : '';
|
|
1638
1485
|
var multiSelectId = utils.useRandomId('eds-multiselect');
|
|
1639
1486
|
return React__default["default"].createElement(MultiSelectContext.Provider, {
|
|
@@ -1710,13 +1557,10 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
1710
1557
|
})));
|
|
1711
1558
|
}))));
|
|
1712
1559
|
};
|
|
1713
|
-
|
|
1714
1560
|
var ClearButton = function ClearButton(_ref3) {
|
|
1715
|
-
var props = _extends({}, _ref3);
|
|
1716
|
-
|
|
1561
|
+
var props = _extends({}, (_objectDestructuringEmpty(_ref3), _ref3));
|
|
1717
1562
|
var _useMultiSelectContex = useMultiSelectContext(),
|
|
1718
|
-
|
|
1719
|
-
|
|
1563
|
+
reset = _useMultiSelectContex.reset;
|
|
1720
1564
|
return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement("button", _extends({
|
|
1721
1565
|
className: "eds-dropdown__clear-button",
|
|
1722
1566
|
type: "button",
|
|
@@ -1728,31 +1572,25 @@ var ClearButton = function ClearButton(_ref3) {
|
|
|
1728
1572
|
className: "eds-dropdown__divider"
|
|
1729
1573
|
}));
|
|
1730
1574
|
};
|
|
1731
|
-
|
|
1732
1575
|
var Appendix$1 = function Appendix(_ref4) {
|
|
1733
1576
|
var loading = _ref4.loading,
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1577
|
+
loadingText = _ref4.loadingText,
|
|
1578
|
+
readOnly = _ref4.readOnly,
|
|
1579
|
+
hasSelected = _ref4.hasSelected;
|
|
1738
1580
|
if (loading) {
|
|
1739
1581
|
return React__default["default"].createElement(DropdownLoadingDots, null, loadingText);
|
|
1740
1582
|
}
|
|
1741
|
-
|
|
1742
1583
|
if (readOnly) {
|
|
1743
1584
|
return null;
|
|
1744
1585
|
}
|
|
1745
|
-
|
|
1746
1586
|
return hasSelected ? React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement(ClearButton, null), React__default["default"].createElement(DropdownToggleButton, null)) : React__default["default"].createElement(DropdownToggleButton, null);
|
|
1747
1587
|
};
|
|
1748
|
-
|
|
1749
1588
|
var DropdownToggleButton = function DropdownToggleButton() {
|
|
1750
1589
|
var _useMultiSelectContex2 = useMultiSelectContext(),
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1590
|
+
getToggleButtonProps = _useMultiSelectContex2.getToggleButtonProps,
|
|
1591
|
+
isOpen = _useMultiSelectContex2.isOpen,
|
|
1592
|
+
openMenu = _useMultiSelectContex2.openMenu,
|
|
1593
|
+
openOnFocus = _useMultiSelectContex2.openOnFocus;
|
|
1756
1594
|
return React__default["default"].createElement("button", _extends({}, getToggleButtonProps({
|
|
1757
1595
|
className: classNames__default["default"]('eds-dropdown__toggle-button', {
|
|
1758
1596
|
'eds-dropdown__toggle-button--open': isOpen
|
|
@@ -1766,7 +1604,6 @@ var DropdownToggleButton = function DropdownToggleButton() {
|
|
|
1766
1604
|
type: "button"
|
|
1767
1605
|
}), React__default["default"].createElement(icons.DownArrowIcon, null));
|
|
1768
1606
|
};
|
|
1769
|
-
|
|
1770
1607
|
var CheckboxIcon = function CheckboxIcon() {
|
|
1771
1608
|
return React__default["default"].createElement("svg", {
|
|
1772
1609
|
className: "eds-checkbox-icon",
|
|
@@ -1779,7 +1616,6 @@ var CheckboxIcon = function CheckboxIcon() {
|
|
|
1779
1616
|
fill: "none"
|
|
1780
1617
|
}));
|
|
1781
1618
|
};
|
|
1782
|
-
|
|
1783
1619
|
function SelectedItemsLabel(items) {
|
|
1784
1620
|
return items.length < 3 ? items.map(function (item) {
|
|
1785
1621
|
return item.label;
|
|
@@ -1789,14 +1625,13 @@ function SelectedItemsLabel(items) {
|
|
|
1789
1625
|
var _excluded$1 = ["selectedItem", "isOpen", "getMenuProps", "getItemProps", "filteredItems", "highlightedIndex", "listStyle"];
|
|
1790
1626
|
var DropdownList = function DropdownList(_ref) {
|
|
1791
1627
|
var selectedItem = _ref.selectedItem,
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1628
|
+
isOpen = _ref.isOpen,
|
|
1629
|
+
getMenuProps = _ref.getMenuProps,
|
|
1630
|
+
getItemProps = _ref.getItemProps,
|
|
1631
|
+
filteredItems = _ref.filteredItems,
|
|
1632
|
+
highlightedIndex = _ref.highlightedIndex,
|
|
1633
|
+
listStyle = _ref.listStyle,
|
|
1634
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
1800
1635
|
return React__default["default"].createElement("ul", _extends({
|
|
1801
1636
|
className: classNames__default["default"]('eds-searchable-dropdown__list', {
|
|
1802
1637
|
'eds-searchable-dropdown__list--open': isOpen
|
|
@@ -1804,7 +1639,8 @@ var DropdownList = function DropdownList(_ref) {
|
|
|
1804
1639
|
}, getMenuProps(), {
|
|
1805
1640
|
style: _extends({}, rest.style, listStyle)
|
|
1806
1641
|
}), isOpen ? filteredItems.map(function (item, index) {
|
|
1807
|
-
return (
|
|
1642
|
+
return (
|
|
1643
|
+
// eslint-disable-next-line react/jsx-key
|
|
1808
1644
|
React__default["default"].createElement("li", _extends({
|
|
1809
1645
|
className: classNames__default["default"]('eds-searchable-dropdown__list__item', {
|
|
1810
1646
|
'eds-searchable-dropdown__list__item--highlighted': highlightedIndex === index,
|
|
@@ -1826,53 +1662,45 @@ var DropdownList = function DropdownList(_ref) {
|
|
|
1826
1662
|
};
|
|
1827
1663
|
|
|
1828
1664
|
var _excluded = ["items", "selectedItem", "onChange", "label", "placeholder", "clearable", "openOnFocus", "readonly", "feedback", "variant", "className", "listStyle"];
|
|
1829
|
-
|
|
1830
1665
|
function lowerCaseFilterTest(item, input) {
|
|
1831
1666
|
if (!input) {
|
|
1832
1667
|
return true;
|
|
1833
1668
|
}
|
|
1834
|
-
|
|
1835
1669
|
var sanitizeEscapeCharacters = input.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
1836
1670
|
var inputRegex = new RegExp(sanitizeEscapeCharacters, 'i');
|
|
1837
1671
|
return inputRegex.test(item.label);
|
|
1838
|
-
}
|
|
1672
|
+
}
|
|
1673
|
+
// TODO Husk å @deprecate searchable-prop-en til Dropdown når denne komponenten skal ha official release
|
|
1839
1674
|
// TODO Husk å generelt legge inn støtte for typeof value === string
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
1675
|
var SearchableDropdownBeta = function SearchableDropdownBeta(_ref) {
|
|
1843
1676
|
var _selectedItem$label;
|
|
1844
|
-
|
|
1845
1677
|
var items = _ref.items,
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1678
|
+
value = _ref.selectedItem,
|
|
1679
|
+
onChange = _ref.onChange,
|
|
1680
|
+
label = _ref.label,
|
|
1681
|
+
placeholder = _ref.placeholder,
|
|
1682
|
+
_ref$clearable = _ref.clearable,
|
|
1683
|
+
clearable = _ref$clearable === void 0 ? false : _ref$clearable,
|
|
1684
|
+
_ref$openOnFocus = _ref.openOnFocus,
|
|
1685
|
+
openOnFocus = _ref$openOnFocus === void 0 ? false : _ref$openOnFocus,
|
|
1686
|
+
_ref$readonly = _ref.readonly,
|
|
1687
|
+
readonly = _ref$readonly === void 0 ? false : _ref$readonly,
|
|
1688
|
+
feedback = _ref.feedback,
|
|
1689
|
+
_ref$variant = _ref.variant,
|
|
1690
|
+
variant = _ref$variant === void 0 ? 'info' : _ref$variant,
|
|
1691
|
+
className = _ref.className,
|
|
1692
|
+
listStyle = _ref.listStyle,
|
|
1693
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
1863
1694
|
var _React$useState = React__default["default"].useState(items),
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1695
|
+
filteredItems = _React$useState[0],
|
|
1696
|
+
setFilteredItems = _React$useState[1];
|
|
1867
1697
|
var _useState = React.useState(false),
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1698
|
+
hideSelectedItem = _useState[0],
|
|
1699
|
+
setHideSelectedItem = _useState[1];
|
|
1871
1700
|
var inputRef = React.useRef(null);
|
|
1872
1701
|
var stateReducer = React__default["default"].useCallback(function (_, actionAndChanges) {
|
|
1873
1702
|
var type = actionAndChanges.type,
|
|
1874
|
-
|
|
1875
|
-
|
|
1703
|
+
changes = actionAndChanges.changes;
|
|
1876
1704
|
switch (type) {
|
|
1877
1705
|
case Downshift.useCombobox.stateChangeTypes.ItemClick:
|
|
1878
1706
|
case Downshift.useCombobox.stateChangeTypes.InputKeyDownEnter:
|
|
@@ -1881,43 +1709,40 @@ var SearchableDropdownBeta = function SearchableDropdownBeta(_ref) {
|
|
|
1881
1709
|
return _extends({}, changes, changes.selectedItem && {
|
|
1882
1710
|
inputValue: ''
|
|
1883
1711
|
});
|
|
1884
|
-
|
|
1885
1712
|
default:
|
|
1886
1713
|
return changes;
|
|
1887
1714
|
}
|
|
1888
1715
|
}, []);
|
|
1889
|
-
|
|
1890
1716
|
var _useCombobox = Downshift.useCombobox(_extends({
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1717
|
+
onInputValueChange: function onInputValueChange(_ref2) {
|
|
1718
|
+
var inputValue = _ref2.inputValue;
|
|
1719
|
+
setFilteredItems(items.filter(function (item) {
|
|
1720
|
+
return lowerCaseFilterTest(item, inputValue);
|
|
1721
|
+
}));
|
|
1722
|
+
},
|
|
1723
|
+
items: filteredItems,
|
|
1724
|
+
itemToString: function itemToString(item) {
|
|
1725
|
+
if (item) return item.value;
|
|
1726
|
+
return '';
|
|
1727
|
+
},
|
|
1728
|
+
stateReducer: stateReducer,
|
|
1729
|
+
selectedItem: value,
|
|
1730
|
+
onSelectedItemChange: function onSelectedItemChange(_ref3) {
|
|
1731
|
+
var newSelectedItem = _ref3.selectedItem;
|
|
1732
|
+
return onChange(newSelectedItem != null ? newSelectedItem : null);
|
|
1733
|
+
}
|
|
1734
|
+
}, rest)),
|
|
1735
|
+
isOpen = _useCombobox.isOpen,
|
|
1736
|
+
getToggleButtonProps = _useCombobox.getToggleButtonProps,
|
|
1737
|
+
getLabelProps = _useCombobox.getLabelProps,
|
|
1738
|
+
getMenuProps = _useCombobox.getMenuProps,
|
|
1739
|
+
getInputProps = _useCombobox.getInputProps,
|
|
1740
|
+
getComboboxProps = _useCombobox.getComboboxProps,
|
|
1741
|
+
highlightedIndex = _useCombobox.highlightedIndex,
|
|
1742
|
+
getItemProps = _useCombobox.getItemProps,
|
|
1743
|
+
selectedItem = _useCombobox.selectedItem,
|
|
1744
|
+
openMenu = _useCombobox.openMenu,
|
|
1745
|
+
inputValue = _useCombobox.inputValue;
|
|
1921
1746
|
return React__default["default"].createElement("div", {
|
|
1922
1747
|
className: "eds-searchable-dropdown__wrapper"
|
|
1923
1748
|
}, React__default["default"].createElement(form.BaseFormControl, _extends({
|
|
@@ -1944,7 +1769,6 @@ var SearchableDropdownBeta = function SearchableDropdownBeta(_ref) {
|
|
|
1944
1769
|
className: "eds-searchable-dropdown__selected-item",
|
|
1945
1770
|
onClick: function onClick() {
|
|
1946
1771
|
var _inputRef$current;
|
|
1947
|
-
|
|
1948
1772
|
return (_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
1949
1773
|
}
|
|
1950
1774
|
}, selectedItem.label)), React__default["default"].createElement("input", _extends({
|
|
@@ -1969,15 +1793,13 @@ var SearchableDropdownBeta = function SearchableDropdownBeta(_ref) {
|
|
|
1969
1793
|
getItemProps: getItemProps
|
|
1970
1794
|
}));
|
|
1971
1795
|
};
|
|
1972
|
-
|
|
1973
1796
|
var Appendix = function Appendix(_ref4) {
|
|
1974
1797
|
var clearable = _ref4.clearable,
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1798
|
+
readOnly = _ref4.readOnly,
|
|
1799
|
+
getToggleButtonProps = _ref4.getToggleButtonProps,
|
|
1800
|
+
selectedItem = _ref4.selectedItem,
|
|
1801
|
+
isOpen = _ref4.isOpen,
|
|
1802
|
+
onChange = _ref4.onChange;
|
|
1981
1803
|
// TODO implement loading / async
|
|
1982
1804
|
// if (loading) {
|
|
1983
1805
|
// return <DropdownLoadingDots>{loadingText}</DropdownLoadingDots>;
|
|
@@ -1985,7 +1807,6 @@ var Appendix = function Appendix(_ref4) {
|
|
|
1985
1807
|
if (readOnly) {
|
|
1986
1808
|
return null;
|
|
1987
1809
|
}
|
|
1988
|
-
|
|
1989
1810
|
return React__default["default"].createElement("div", {
|
|
1990
1811
|
style: {
|
|
1991
1812
|
display: 'flex',
|