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