@splunk/react-ui 4.40.0 → 4.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/Calendar.js +548 -744
  3. package/Date.js +158 -161
  4. package/FormRows.js +93 -97
  5. package/Link.js +21 -19
  6. package/MIGRATION.mdx +24 -3
  7. package/Menu.js +1 -1
  8. package/MessageBar.js +59 -57
  9. package/Multiselect.js +1161 -1278
  10. package/RadioBar.js +19 -15
  11. package/ResultsMenu.js +1208 -1028
  12. package/Select.js +857 -957
  13. package/Slider.js +346 -300
  14. package/SlidingPanels.js +166 -148
  15. package/TabBar.js +187 -172
  16. package/TabLayout.js +8 -8
  17. package/Table.js +7 -3
  18. package/TransitionOpen.js +44 -65
  19. package/package.json +2 -2
  20. package/types/src/ButtonSimple/ButtonSimple.d.ts +1 -1
  21. package/types/src/Calendar/Calendar.d.ts +28 -30
  22. package/types/src/Calendar/MonthHeader.d.ts +12 -22
  23. package/types/src/Color/Color.d.ts +2 -2
  24. package/types/src/Date/Date.d.ts +18 -19
  25. package/types/src/File/File.d.ts +1 -1
  26. package/types/src/FormRows/FormRows.d.ts +5 -60
  27. package/types/src/FormRows/Row.d.ts +1 -1
  28. package/types/src/Link/Link.d.ts +7 -0
  29. package/types/src/Link/index.d.ts +1 -0
  30. package/types/src/Menu/Item.d.ts +1 -1
  31. package/types/src/Menu/Menu.d.ts +1 -1
  32. package/types/src/Multiselect/Option.d.ts +1 -1
  33. package/types/src/Number/Number.d.ts +2 -2
  34. package/types/src/RadioBar/RadioBar.d.ts +2 -2
  35. package/types/src/ResultsMenu/VirtualizedResultsMenu/VirtualizedResultsMenu.d.ts +1 -1
  36. package/types/src/ResultsMenu/VirtualizedResultsMenu/injectVirtualizedItem.d.ts +2 -0
  37. package/types/src/Search/Option.d.ts +1 -1
  38. package/types/src/Select/Option.d.ts +5 -1
  39. package/types/src/Select/OptionBase.d.ts +41 -23
  40. package/types/src/Select/SelectAllOption.d.ts +6 -2
  41. package/types/src/Select/SelectBase.d.ts +2 -30
  42. package/types/src/Slider/Slider.d.ts +7 -16
  43. package/types/src/SlidingPanels/SlidingPanels.d.ts +4 -3
  44. package/types/src/TabBar/TabBar.d.ts +10 -2
  45. package/types/src/TabBar/TabBarContext.d.ts +1 -0
  46. package/types/src/TabBar/docs/examples/IconsAbove.d.ts +2 -0
  47. package/types/src/TabBar/docs/examples/IconsLeft.d.ts +2 -0
  48. package/types/src/TabBar/docs/examples/VerticalIconsAbove.d.ts +2 -0
  49. package/types/src/TabBar/docs/examples/VerticalIconsLeft.d.ts +2 -0
  50. package/types/src/TabLayout/TabLayout.d.ts +4 -2
  51. package/types/src/Table/Row.d.ts +0 -2
  52. package/types/src/Table/Table.d.ts +0 -2
  53. package/types/src/Table/docs/examples/Complex.d.ts +14 -3
  54. package/types/src/Text/Text.d.ts +2 -2
  55. package/types/src/TextArea/TextArea.d.ts +2 -2
  56. package/types/src/Typography/Typography.d.ts +4 -2
  57. package/types/src/TabBar/docs/examples/IconsInline.d.ts +0 -2
  58. package/types/src/TabBar/docs/examples/IconsSmall.d.ts +0 -2
  59. package/types/src/TabBar/docs/examples/VerticalSmallIcons.d.ts +0 -2
  60. package/types/src/Table/docs/examples/prisma/Complex.d.ts +0 -48
  61. /package/types/src/Table/docs/examples/{prisma/RowActions.d.ts → RowActions.d.ts} +0 -0
package/Select.js CHANGED
@@ -127,10 +127,10 @@
127
127
  n.r(r);
128
128
  // EXPORTS
129
129
  n.d(r, {
130
- Divider: () => /* reexport */ A.Divider,
131
- Heading: () => /* reexport */ A.Heading,
132
- Option: () => /* reexport */ Nt,
133
- default: () => /* reexport */ un
130
+ Divider: () => /* reexport */ T.Divider,
131
+ Heading: () => /* reexport */ T.Heading,
132
+ Option: () => /* reexport */ _t,
133
+ default: () => /* reexport */ Zt
134
134
  });
135
135
  // EXTERNAL MODULE: external "react"
136
136
  var e = n(9497);
@@ -162,8 +162,8 @@
162
162
  const g = require("lodash/pick");
163
163
  var O = n.n(g);
164
164
  // CONCATENATED MODULE: external "lodash/uniq"
165
- const w = require("lodash/uniq");
166
- var S = n.n(w);
165
+ const S = require("lodash/uniq");
166
+ var w = n.n(S);
167
167
  // CONCATENATED MODULE: external "lodash/without"
168
168
  const C = require("lodash/without");
169
169
  var k = n.n(C);
@@ -171,28 +171,28 @@
171
171
  const x = require("@splunk/react-ui/Dropdown");
172
172
  var j = n.n(x);
173
173
  // CONCATENATED MODULE: external "@splunk/react-ui/Link"
174
- const E = require("@splunk/react-ui/Link");
175
- var P = n.n(E);
174
+ const P = require("@splunk/react-ui/Link");
175
+ var E = n.n(P);
176
176
  // CONCATENATED MODULE: external "@splunk/react-ui/Menu"
177
- const A = require("@splunk/react-ui/Menu");
177
+ const T = require("@splunk/react-ui/Menu");
178
178
  // CONCATENATED MODULE: external "@splunk/react-ui/ResultsMenu"
179
- const T = require("@splunk/react-ui/ResultsMenu");
180
- var I = n.n(T);
179
+ const R = require("@splunk/react-ui/ResultsMenu");
180
+ var A = n.n(R);
181
181
  // CONCATENATED MODULE: external "@splunk/react-ui/Text"
182
182
  const _ = require("@splunk/react-ui/Text");
183
- var M = n.n(_);
183
+ var L = n.n(_);
184
184
  // CONCATENATED MODULE: external "@splunk/react-ui/usePrevious"
185
- const R = require("@splunk/react-ui/usePrevious");
186
- var L = n.n(R);
185
+ const M = require("@splunk/react-ui/usePrevious");
186
+ var I = n.n(M);
187
187
  // CONCATENATED MODULE: external "@splunk/ui-utils/filter"
188
- const V = require("@splunk/ui-utils/filter");
188
+ const q = require("@splunk/ui-utils/filter");
189
189
  // CONCATENATED MODULE: external "@splunk/ui-utils/id"
190
- const q = require("@splunk/ui-utils/id");
190
+ const B = require("@splunk/ui-utils/id");
191
191
  // CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
192
- const B = require("@splunk/ui-utils/keyboard");
192
+ const D = require("@splunk/ui-utils/keyboard");
193
193
  // CONCATENATED MODULE: external "@splunk/react-icons/CaretSmallDown"
194
- const D = require("@splunk/react-icons/CaretSmallDown");
195
- var N = n.n(D);
194
+ const V = require("@splunk/react-icons/CaretSmallDown");
195
+ var N = n.n(V);
196
196
  // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Caret"
197
197
  const K = require("@splunk/react-icons/enterprise/Caret");
198
198
  var F = n.n(K);
@@ -255,105 +255,39 @@
255
255
  }, Z.apply(null, arguments);
256
256
  }
257
257
  function ee(e, t) {
258
- if (null == e) return {};
259
- var n, r, o = te(e, t);
258
+ var n = Object.keys(e);
260
259
  if (Object.getOwnPropertySymbols) {
261
- var l = Object.getOwnPropertySymbols(e);
262
- for (r = 0; r < l.length; r++) {
263
- n = l[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (o[n] = e[n]);
264
- }
265
- }
266
- return o;
267
- }
268
- function te(e, t) {
269
- if (null == e) return {};
270
- var n = {};
271
- for (var r in e) {
272
- if ({}.hasOwnProperty.call(e, r)) {
273
- if (t.includes(r)) continue;
274
- n[r] = e[r];
275
- }
260
+ var r = Object.getOwnPropertySymbols(e);
261
+ t && (r = r.filter((function(t) {
262
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
263
+ }))), n.push.apply(n, r);
276
264
  }
277
265
  return n;
278
266
  }
279
- function ne(e, t) {
280
- if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
281
- }
282
- function re(e, t) {
283
- for (var n = 0; n < t.length; n++) {
284
- var r = t[n];
285
- r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
286
- Object.defineProperty(e, de(r.key), r);
267
+ function te(e) {
268
+ for (var t = 1; t < arguments.length; t++) {
269
+ var n = null != arguments[t] ? arguments[t] : {};
270
+ t % 2 ? ee(Object(n), !0).forEach((function(t) {
271
+ ne(e, t, n[t]);
272
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : ee(Object(n)).forEach((function(t) {
273
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
274
+ }));
287
275
  }
288
- }
289
- function oe(e, t, n) {
290
- return t && re(e.prototype, t), n && re(e, n), Object.defineProperty(e, "prototype", {
291
- writable: !1
292
- }), e;
293
- }
294
- function le(e, t) {
295
- if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
296
- e.prototype = Object.create(t && t.prototype, {
297
- constructor: {
298
- value: e,
299
- writable: !0,
300
- configurable: !0
301
- }
302
- }), Object.defineProperty(e, "prototype", {
303
- writable: !1
304
- }), t && ae(e, t);
305
- }
306
- function ae(e, t) {
307
- return ae = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
308
- return e.__proto__ = t, e;
309
- }, ae(e, t);
310
- }
311
- function ie(e) {
312
- var t = se();
313
- return function() {
314
- var n, r = fe(e);
315
- if (t) {
316
- var o = fe(this).constructor;
317
- n = Reflect.construct(r, arguments, o);
318
- } else n = r.apply(this, arguments);
319
- return ue(this, n);
320
- };
321
- }
322
- function ue(e, t) {
323
- if (t && ("object" == Y(t) || "function" == typeof t)) return t;
324
- if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
325
- return ce(e);
326
- }
327
- function ce(e) {
328
- if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
329
276
  return e;
330
277
  }
331
- function se() {
332
- try {
333
- var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
334
- } catch (e) {}
335
- return (se = function t() {
336
- return !!e;
337
- })();
338
- }
339
- function fe(e) {
340
- return fe = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
341
- return e.__proto__ || Object.getPrototypeOf(e);
342
- }, fe(e);
343
- }
344
- function pe(e, t, n) {
345
- return (t = de(t)) in e ? Object.defineProperty(e, t, {
278
+ function ne(e, t, n) {
279
+ return (t = re(t)) in e ? Object.defineProperty(e, t, {
346
280
  value: n,
347
281
  enumerable: !0,
348
282
  configurable: !0,
349
283
  writable: !0
350
284
  }) : e[t] = n, e;
351
285
  }
352
- function de(e) {
353
- var t = ve(e, "string");
286
+ function re(e) {
287
+ var t = oe(e, "string");
354
288
  return "symbol" == Y(t) ? t : t + "";
355
289
  }
356
- function ve(e, t) {
290
+ function oe(e, t) {
357
291
  if ("object" != Y(e) || !e) return e;
358
292
  var n = e[Symbol.toPrimitive];
359
293
  if (void 0 !== n) {
@@ -363,13 +297,36 @@
363
297
  }
364
298
  return ("string" === t ? String : Number)(e);
365
299
  }
366
- var be = {
300
+ function le(e, t) {
301
+ if (null == e) return {};
302
+ var n, r, o = ae(e, t);
303
+ if (Object.getOwnPropertySymbols) {
304
+ var l = Object.getOwnPropertySymbols(e);
305
+ for (r = 0; r < l.length; r++) {
306
+ n = l[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (o[n] = e[n]);
307
+ }
308
+ }
309
+ return o;
310
+ }
311
+ function ae(e, t) {
312
+ if (null == e) return {};
313
+ var n = {};
314
+ for (var r in e) {
315
+ if ({}.hasOwnProperty.call(e, r)) {
316
+ if (t.includes(r)) continue;
317
+ n[r] = e[r];
318
+ }
319
+ }
320
+ return n;
321
+ }
322
+ var ie = {
367
323
  /** @private */
368
324
  active: l().bool,
369
325
  children: l().node,
370
326
  description: l().string,
371
327
  descriptionPosition: l().oneOf([ "right", "bottom" ]),
372
328
  disabled: l().bool,
329
+ elementRef: l().oneOfType([ l().func, l().object ]),
373
330
  hidden: l().bool,
374
331
  icon: l().node,
375
332
  label: l().string.isRequired,
@@ -390,88 +347,43 @@
390
347
  truncate: l().bool,
391
348
  value: l().oneOfType([ l().string, l().number, l().bool ]).isRequired
392
349
  };
393
- var me = {
394
- descriptionPosition: "bottom",
395
- disabled: false,
396
- multiple: false,
397
- role: "option",
398
- selected: false,
399
- truncate: false
400
- };
401
350
  /**
402
- * An option within a `Multiselect`. This inherits from
403
- * [PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent)
404
- * so any elements passed to it must also be pure.
405
- */ var ye = function(e) {
406
- le(r, e);
407
- var n = ie(r);
408
- function r() {
409
- var e;
410
- ne(this, r);
411
- for (var t = arguments.length, o = new Array(t), l = 0; l < t; l++) {
412
- o[l] = arguments[l];
413
- }
414
- e = n.call.apply(n, [ this ].concat(o));
415
- pe(ce(e), "c", null);
416
- pe(ce(e), "handleClick", (function(t) {
417
- var n = e.props, r = n.onClick, o = n.value, l = n.disabled;
418
- if (!l) {
419
- r === null || r === void 0 ? void 0 : r(t, {
420
- value: o
421
- });
422
- }
423
- }));
424
- pe(ce(e), "handleMount", (function(t) {
425
- e.c = t;
426
- }));
427
- return e;
428
- }
429
- // @docs-props-type OptionPropsBase
430
- oe(r, [ {
431
- key: "scrollIntoViewIfNeeded",
432
- // eslint-disable-next-line react/no-unused-class-component-methods
433
- value: function e() {
434
- var t;
435
- (t = this.c) === null || t === void 0 ? void 0 : t.scrollIntoViewIfNeeded();
436
- }
437
- /**
438
- * Place focus on the button.
439
- */
440
- // eslint-disable-next-line react/no-unused-class-component-methods
441
- }, {
442
- key: "focus",
443
- value: function e() {
444
- var t;
445
- (t = this.c) === null || t === void 0 ? void 0 : t.focus();
446
- }
447
- }, {
448
- key: "render",
449
- value: function e() {
450
- var n = this.props, r = n.value, o = n.children, l = n.label, a = n.multiple, i = n.role, u = n.icon, c = ee(n, [ "value", "children", "label", "multiple", "role", "icon" ]);
451
- var s = r.toString();
452
-
453
- return t().createElement(A.Item, Z({
454
- "data-test-value": r,
455
- "data-test": "option",
456
- ref: this.handleMount
457
- }, c, {
458
- selectable: true,
459
- selectableAppearance: a ? "checkbox" : "checkmark",
460
- onClick: this.handleClick,
461
- role: i,
462
- value: s,
463
- startAdornment: u
464
- }), o || l);
351
+ * An option within a `Multiselect`.
352
+ */ function ue(n) {
353
+ var r = n.children, o = n.descriptionPosition, l = o === void 0 ? "bottom" : o, a = n.disabled, i = n.elementRef, u = n.icon, c = n.label, s = n.multiple, f = n.onClick, p = n.role, d = p === void 0 ? "option" : p, v = n.value, b = le(n, [ "children", "descriptionPosition", "disabled", "elementRef", "icon", "label", "multiple", "onClick", "role", "value" ]);
354
+ // @docs-props-type OptionPropsBase
355
+ var m = (0, e.useCallback)((function(e) {
356
+ if (!a) {
357
+ f === null || f === void 0 ? void 0 : f(e, {
358
+ value: v
359
+ });
465
360
  }
466
- } ]);
467
- return r;
468
- }(e.PureComponent);
469
- pe(ye, "propTypes", be);
470
- pe(ye, "defaultProps", me);
471
- pe(ye, "type", A.Item);
472
- /* harmony default export */ const he = ye;
361
+ }), [ a, f, v ]);
362
+ var y = v.toString();
363
+ var h = te({
364
+ descriptionPosition: l,
365
+ disabled: a
366
+ }, b);
367
+
368
+ return t().createElement(T.Item, Z({
369
+ "data-test-value": v,
370
+ "data-test": "option",
371
+ elementRef: i
372
+ }, h, {
373
+ selectable: true,
374
+ selectableAppearance: s ? "checkbox" : "checkmark",
375
+ startAdornment: u,
376
+ onClick: m,
377
+ role: d,
378
+ value: y
379
+ }), r || c);
380
+ }
381
+ ue.propTypes = ie;
382
+ ue.type = T.Item;
383
+ // For components to distinguish if their children are Options or Headings/Dividers
384
+ /* harmony default export */ const ce = ue;
473
385
  // CONCATENATED MODULE: ./src/Select/SelectAllOption.tsx
474
- var ge = {
386
+ var se = {
475
387
  active: l().bool,
476
388
  changedToggle: l().bool,
477
389
  elementRef: l().oneOfType([ l().func, l().object ]),
@@ -481,13 +393,14 @@
481
393
  selected: l().oneOf([ false, true, "some" ]),
482
394
  totalCount: l().number
483
395
  };
484
- var Oe = t().forwardRef((function(e, n) {
485
- var r = e.active, o = e.id, l = e.onClick, a = e.selectAllLabel, i = e.totalCount, u = e.changedToggle, c = e.selected;
396
+ function fe(e) {
397
+ var n = e.active, r = e.elementRef, o = e.id, l = e.onClick, a = e.selectAllLabel, i = e.totalCount, u = e.changedToggle, c = e.selected;
486
398
  // When toggle is changed the total count is not displayed anymore so the count is now shown in the Select all menu item
487
399
  var s = u ? " (".concat(i === null || i === void 0 ? void 0 : i.toString(), ")") : "";
488
400
 
489
- return t().createElement(he, {
490
- active: r,
401
+ return t().createElement(ce, {
402
+ active: n,
403
+ elementRef: r,
491
404
  "aria-keyshortcuts": "Control+A",
492
405
  "data-test": "select-all",
493
406
  description: "".concat(s, " Ctrl-a"),
@@ -497,23 +410,22 @@
497
410
  label: a,
498
411
  multiple: true,
499
412
  onClick: l,
500
- ref: n,
501
413
  role: "menuitemcheckbox",
502
414
  selected: c,
503
415
  tabIndex: -1,
504
416
  value: "selectAll"
505
417
  });
506
- }));
507
- Oe.propTypes = ge;
508
- /* harmony default export */ const we = Oe;
418
+ }
419
+ fe.propTypes = se;
420
+ /* harmony default export */ const pe = fe;
509
421
  // CONCATENATED MODULE: external "styled-components"
510
- const Se = require("styled-components");
511
- var Ce = n.n(Se);
422
+ const de = require("styled-components");
423
+ var ve = n.n(de);
512
424
  // CONCATENATED MODULE: external "@splunk/react-ui/Button"
513
- const ke = require("@splunk/react-ui/Button");
514
- var xe = n.n(ke);
425
+ const be = require("@splunk/react-ui/Button");
426
+ var me = n.n(be);
515
427
  // CONCATENATED MODULE: ./src/Select/SelectBaseStyles.ts
516
- var je = Ce()(xe()).withConfig({
428
+ var ye = ve()(me()).withConfig({
517
429
  displayName: "SelectBaseStyles__StyledButton",
518
430
  componentId: "sc-16cj7sk-0"
519
431
  })([ "&[data-inline]{width:", ";}", "" ], (function(e) {
@@ -523,22 +435,22 @@
523
435
  var t = e.$multiple;
524
436
  return !t && "flex-grow: 0;";
525
437
  }));
526
- var Ee = Ce().span.withConfig({
438
+ var he = ve().span.withConfig({
527
439
  displayName: "SelectBaseStyles__StyledLinkIcon",
528
440
  componentId: "sc-16cj7sk-1"
529
441
  })([ "padding-right:2px;" ]);
530
- var Pe = Ce().span.withConfig({
442
+ var ge = ve().span.withConfig({
531
443
  displayName: "SelectBaseStyles__StyledLinkCaret",
532
444
  componentId: "sc-16cj7sk-2"
533
445
  })([ "padding-left:2px;" ]);
534
- var Ae = Ce().div.withConfig({
446
+ var Oe = ve().div.withConfig({
535
447
  displayName: "SelectBaseStyles__StyledFilter",
536
448
  componentId: "sc-16cj7sk-3"
537
449
  })([ "padding:", ";min-width:160px;" ], (0, H.pick)({
538
450
  enterprise: "8px",
539
451
  prisma: "10px 16px"
540
452
  }));
541
- var Te = Ce().span.withConfig({
453
+ var Se = ve().span.withConfig({
542
454
  displayName: "SelectBaseStyles__StyledSearchIconWrapper",
543
455
  componentId: "sc-16cj7sk-4"
544
456
  })([ "color:", ";pointer-events:none;padding:", ";" ], (0, H.pick)({
@@ -551,18 +463,18 @@
551
463
  comfortable: "0 8px",
552
464
  compact: "0 6px"
553
465
  }));
554
- var Ie = Ce().span.withConfig({
466
+ var we = ve().span.withConfig({
555
467
  displayName: "SelectBaseStyles__StyledCount",
556
468
  componentId: "sc-16cj7sk-5"
557
469
  })([ "padding-right:", ";" ], H.variables.spacingXSmall);
558
- var _e = Ce()(P()).withConfig({
470
+ var Ce = ve()(E()).withConfig({
559
471
  displayName: "SelectBaseStyles__StyledControlsLink",
560
472
  componentId: "sc-16cj7sk-6"
561
473
  })([ "margin-right:20px;", ";" ], (function(e) {
562
474
  var t = e.$disabled;
563
- return t && (0, Se.css)([ "color:", ";" ], H.variables.contentColorDisabled);
475
+ return t && (0, de.css)([ "color:", ";" ], H.variables.contentColorDisabled);
564
476
  }));
565
- var Me = Ce().div.withConfig({
477
+ var ke = ve().div.withConfig({
566
478
  displayName: "SelectBaseStyles__StyledToggleAllControls",
567
479
  componentId: "sc-16cj7sk-7"
568
480
  })([ "padding:", ";", "" ], (0, H.pick)({
@@ -570,29 +482,29 @@
570
482
  prisma: "10px 16px"
571
483
  }), (0, H.pickVariant)("$placement", {
572
484
  above: {
573
- enterprise: (0, Se.css)([ "border-top:", ";" ], H.variables.border),
574
- prisma: (0, Se.css)([ "border-top:1px solid ", ";" ], H.variables.neutral200)
485
+ enterprise: (0, de.css)([ "border-top:", ";" ], H.variables.border),
486
+ prisma: (0, de.css)([ "border-top:1px solid ", ";" ], H.variables.neutral200)
575
487
  },
576
488
  below: {
577
- enterprise: (0, Se.css)([ "border-bottom:", ";" ], H.variables.border),
578
- prisma: (0, Se.css)([ "border-bottom:1px solid ", ";" ], H.variables.neutral200)
489
+ enterprise: (0, de.css)([ "border-bottom:", ";" ], H.variables.border),
490
+ prisma: (0, de.css)([ "border-bottom:1px solid ", ";" ], H.variables.neutral200)
579
491
  }
580
492
  }));
581
493
  // EXTERNAL MODULE: ./src/useControlled/index.ts + 1 modules
582
- var Re = n(2907);
494
+ var xe = n(2907);
583
495
  // CONCATENATED MODULE: ./src/utils/fuzzyMatch.ts
584
496
  // A utility for matching keyboard characters to list values
585
- var Le = function e(t, n) {
497
+ var je = function e(t, n) {
586
498
  return t ? t.label.charAt(n).toLowerCase() : "";
587
499
  };
588
- var Ve = function e(t, n) {
500
+ var Pe = function e(t, n) {
589
501
  if (!t.length) {
590
502
  return t;
591
503
  }
592
504
  var r = null;
593
505
  var o = false;
594
506
  var l = t.filter((function(e) {
595
- var t = Le(e, n.index);
507
+ var t = je(e, n.index);
596
508
  if (t === n.value) {
597
509
  o = true;
598
510
  return true;
@@ -600,7 +512,7 @@
600
512
  // If we haven't found a match yet, keep track of the next closest match.
601
513
  // Secondary matching looks for the closest character of a higher value, and failing that, closest of a lower value.
602
514
  if (!o) {
603
- var l = Le(r, n.index);
515
+ var l = je(r, n.index);
604
516
  if (!l) {
605
517
  r = e;
606
518
  } else if (t > n.value) {
@@ -617,9 +529,27 @@
617
529
  }));
618
530
  return l.length === 0 && r ? [ r ] : l;
619
531
  };
532
+ // CONCATENATED MODULE: ./src/utils/scrollIntoViewIfNeeded.ts
533
+ // A utility that attempts to move an element into view by scrolling it's derived parent.
534
+ var Ee = function e(t) {
535
+ if (!t) {
536
+ return;
537
+ }
538
+ var n = t.offsetParent;
539
+ if (!n) {
540
+ return;
541
+ }
542
+ // Below the bottom of the container.
543
+ if (n.scrollTop + n.clientHeight < t.offsetTop + t.clientHeight) {
544
+ n.scrollTop = t.offsetTop + t.clientHeight - n.clientHeight;
545
+ // Above the top of the container.
546
+ } else if (n.scrollTop > t.offsetTop) {
547
+ n.scrollTop = t.offsetTop;
548
+ }
549
+ };
620
550
  // CONCATENATED MODULE: ./src/utils/ssrDocument.ts
621
551
  /* eslint-disable @typescript-eslint/no-empty-function */
622
- var qe = {
552
+ var Te = {
623
553
  body: {
624
554
  appendChild: function e() {
625
555
  return [];
@@ -673,14 +603,14 @@
673
603
  search: ""
674
604
  }
675
605
  };
676
- function Be() {
677
- var e = typeof document !== "undefined" ? document : qe;
606
+ function Re() {
607
+ var e = typeof document !== "undefined" ? document : Te;
678
608
  return e;
679
609
  }
680
610
  // CONCATENATED MODULE: ./src/utils/ssrWindow.ts
681
611
  /* eslint-disable @typescript-eslint/no-empty-function */
682
- var De = {
683
- document: qe,
612
+ var Ae = {
613
+ document: Te,
684
614
  navigator: {
685
615
  userAgent: ""
686
616
  },
@@ -734,25 +664,25 @@
734
664
  clearTimeout(t);
735
665
  }
736
666
  };
737
- function Ne() {
738
- var e = typeof window !== "undefined" ? window : De;
667
+ function _e() {
668
+ var e = typeof window !== "undefined" ? window : Ae;
739
669
  return e;
740
670
  }
741
671
  // CONCATENATED MODULE: ./src/Select/SelectBase.tsx
742
- function Ke(e) {
743
- return ze(e) || He(e) || Je(e) || Fe();
672
+ function Le(e) {
673
+ return qe(e) || Ie(e) || Ne(e) || Me();
744
674
  }
745
- function Fe() {
675
+ function Me() {
746
676
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
747
677
  }
748
- function He(e) {
678
+ function Ie(e) {
749
679
  if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
750
680
  }
751
- function ze(e) {
752
- if (Array.isArray(e)) return Xe(e);
681
+ function qe(e) {
682
+ if (Array.isArray(e)) return Ke(e);
753
683
  }
754
- function $e() {
755
- return $e = Object.assign ? Object.assign.bind() : function(e) {
684
+ function Be() {
685
+ return Be = Object.assign ? Object.assign.bind() : function(e) {
756
686
  for (var t = 1; t < arguments.length; t++) {
757
687
  var n = arguments[t];
758
688
  for (var r in n) {
@@ -760,29 +690,29 @@
760
690
  }
761
691
  }
762
692
  return e;
763
- }, $e.apply(null, arguments);
693
+ }, Be.apply(null, arguments);
764
694
  }
765
- function We(e, t) {
766
- return Qe(e) || Ge(e, t) || Je(e, t) || Ue();
695
+ function De(e, t) {
696
+ return He(e) || Fe(e, t) || Ne(e, t) || Ve();
767
697
  }
768
- function Ue() {
698
+ function Ve() {
769
699
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
770
700
  }
771
- function Je(e, t) {
701
+ function Ne(e, t) {
772
702
  if (e) {
773
- if ("string" == typeof e) return Xe(e, t);
703
+ if ("string" == typeof e) return Ke(e, t);
774
704
  var n = {}.toString.call(e).slice(8, -1);
775
- return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Xe(e, t) : void 0;
705
+ return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Ke(e, t) : void 0;
776
706
  }
777
707
  }
778
- function Xe(e, t) {
708
+ function Ke(e, t) {
779
709
  (null == t || t > e.length) && (t = e.length);
780
710
  for (var n = 0, r = Array(t); n < t; n++) {
781
711
  r[n] = e[n];
782
712
  }
783
713
  return r;
784
714
  }
785
- function Ge(e, t) {
715
+ function Fe(e, t) {
786
716
  var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
787
717
  if (null != n) {
788
718
  var r, o, l, a, i = [], u = !0, c = !1;
@@ -804,12 +734,12 @@
804
734
  return i;
805
735
  }
806
736
  }
807
- function Qe(e) {
737
+ function He(e) {
808
738
  if (Array.isArray(e)) return e;
809
739
  }
810
- function Ye(e, t) {
740
+ function ze(e, t) {
811
741
  if (null == e) return {};
812
- var n, r, o = Ze(e, t);
742
+ var n, r, o = $e(e, t);
813
743
  if (Object.getOwnPropertySymbols) {
814
744
  var l = Object.getOwnPropertySymbols(e);
815
745
  for (r = 0; r < l.length; r++) {
@@ -818,7 +748,7 @@
818
748
  }
819
749
  return o;
820
750
  }
821
- function Ze(e, t) {
751
+ function $e(e, t) {
822
752
  if (null == e) return {};
823
753
  var n = {};
824
754
  for (var r in e) {
@@ -829,15 +759,15 @@
829
759
  }
830
760
  return n;
831
761
  }
832
- function et(e) {
762
+ function We(e) {
833
763
  "@babel/helpers - typeof";
834
- return et = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
764
+ return We = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
835
765
  return typeof e;
836
766
  } : function(e) {
837
767
  return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
838
- }, et(e);
768
+ }, We(e);
839
769
  }
840
- function tt(e, t) {
770
+ function Ue(e, t) {
841
771
  var n = Object.keys(e);
842
772
  if (Object.getOwnPropertySymbols) {
843
773
  var r = Object.getOwnPropertySymbols(e);
@@ -847,40 +777,40 @@
847
777
  }
848
778
  return n;
849
779
  }
850
- function nt(e) {
780
+ function Je(e) {
851
781
  for (var t = 1; t < arguments.length; t++) {
852
782
  var n = null != arguments[t] ? arguments[t] : {};
853
- t % 2 ? tt(Object(n), !0).forEach((function(t) {
854
- rt(e, t, n[t]);
855
- })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : tt(Object(n)).forEach((function(t) {
783
+ t % 2 ? Ue(Object(n), !0).forEach((function(t) {
784
+ Xe(e, t, n[t]);
785
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Ue(Object(n)).forEach((function(t) {
856
786
  Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
857
787
  }));
858
788
  }
859
789
  return e;
860
790
  }
861
- function rt(e, t, n) {
862
- return (t = ot(t)) in e ? Object.defineProperty(e, t, {
791
+ function Xe(e, t, n) {
792
+ return (t = Ge(t)) in e ? Object.defineProperty(e, t, {
863
793
  value: n,
864
794
  enumerable: !0,
865
795
  configurable: !0,
866
796
  writable: !0
867
797
  }) : e[t] = n, e;
868
798
  }
869
- function ot(e) {
870
- var t = lt(e, "string");
871
- return "symbol" == et(t) ? t : t + "";
799
+ function Ge(e) {
800
+ var t = Qe(e, "string");
801
+ return "symbol" == We(t) ? t : t + "";
872
802
  }
873
- function lt(e, t) {
874
- if ("object" != et(e) || !e) return e;
803
+ function Qe(e, t) {
804
+ if ("object" != We(e) || !e) return e;
875
805
  var n = e[Symbol.toPrimitive];
876
806
  if (void 0 !== n) {
877
807
  var r = n.call(e, t || "default");
878
- if ("object" != et(r)) return r;
808
+ if ("object" != We(r)) return r;
879
809
  throw new TypeError("@@toPrimitive must return a primitive value.");
880
810
  }
881
811
  return ("string" === t ? String : Number)(e);
882
812
  }
883
- var at = {
813
+ var Ye = {
884
814
  allowKeyMatching: l().bool,
885
815
  allowNewValues: l().bool,
886
816
  animateLoading: l().bool,
@@ -929,57 +859,57 @@
929
859
  /** @private. */
930
860
  virtualization: l().number
931
861
  };
932
- var it = h()((function(e) {
862
+ var Ze = h()((function(e) {
933
863
  return [ e ];
934
864
  }));
935
865
  // preserve separate widths for single vs. multi mode
936
- var ut = h()((function(e) {
866
+ var et = h()((function(e) {
937
867
  var t = e.anchorWidth, n = e.isMultiple, r = e.maxHeight, o = e.menuStyle;
938
- return n ? nt({
868
+ return n ? Je({
939
869
  width: Math.max(t !== null && t !== void 0 ? t : 0, 200),
940
870
  maxHeight: r
941
- }, o) : nt({
871
+ }, o) : Je({
942
872
  minWidth: t !== null && t !== void 0 ? t : undefined,
943
873
  maxWidth: Math.max(t !== null && t !== void 0 ? t : 0, 300),
944
874
  maxHeight: r
945
875
  }, o);
946
876
  }));
947
- var ct = [ "clickAway", "escapeKey", "offScreen", "tabKey", "toggleClick" ];
948
- function st(e) {
877
+ var tt = [ "clickAway", "escapeKey", "offScreen", "tabKey", "toggleClick" ];
878
+ function nt(e) {
949
879
  return e && i()(e.props, "value");
950
880
  }
951
- function ft(e, t) {
952
- return "".concat(et(e), "-").concat(e, "-").concat(t);
881
+ function rt(e, t) {
882
+ return "".concat(We(e), "-").concat(e, "-").concat(t);
953
883
  }
954
- var pt = [ "append", "error", "prepend" ];
955
- var dt = (0, u._)("No matches");
956
- var vt = (0, u._)("Select...");
957
- var bt = function e(n) {
884
+ var ot = [ "append", "error", "prepend" ];
885
+ var lt = (0, u._)("No matches");
886
+ var at = (0, u._)("Select...");
887
+ var it = function e(n) {
958
888
  var r = n.activeItemId, o = n.filterKeyword, l = n.hasChildren, a = n.inputId, i = n.inputRef, c = n.menuListboxId, s = n.multiple, f = n.onClearAll, p = n.onSelectAll, d = n.onTextBlur, v = n.onTextChange, b = n.onTextFocus, m = n.onTextKeyDown, y = n.optionSelection, h = n.placement, g = n.selectAllAppearance, O = n.textHasFocus;
959
- var w = (0, u._)("Select all options".concat(y.current === "all" ? " disabled" : ""));
960
- var S = (0, u._)("Clear all options".concat(y.current === "none" ? " disabled" : ""));
889
+ var S = (0, u._)("Select all options".concat(y.current === "all" ? " disabled" : ""));
890
+ var w = (0, u._)("Clear all options".concat(y.current === "none" ? " disabled" : ""));
961
891
  // only visually disable these as opposed to fully disabling to avoid losing keyboard focus - see SUI-2731
962
- var C = t().createElement(Me, {
892
+ var C = t().createElement(ke, {
963
893
  $placement: h,
964
894
  key: "selectAll"
965
- }, t().createElement(_e, {
895
+ }, t().createElement(Ce, {
966
896
  $disabled: y.current === "all",
967
- "aria-label": w,
897
+ "aria-label": S,
968
898
  onClick: p,
969
899
  "data-test": "select-all"
970
- }, o ? (0, u._)("Select all Matches") : (0, u._)("Select all")), t().createElement(_e, {
900
+ }, o ? (0, u._)("Select all Matches") : (0, u._)("Select all")), t().createElement(Ce, {
971
901
  $disabled: y.current === "none",
972
- "aria-label": S,
902
+ "aria-label": w,
973
903
  onClick: f,
974
904
  "data-test": "clear-all"
975
905
  }, o ? (0, u._)("Clear all Matches") : (0, u._)("Clear all")));
976
906
 
977
907
  return t().createElement("div", {
978
908
  key: "controls"
979
- }, t().createElement(Ae, {
909
+ }, t().createElement(Oe, {
980
910
  key: "filter",
981
911
  "data-test": "filter"
982
- }, t().createElement(M(), {
912
+ }, t().createElement(L(), {
983
913
  value: o,
984
914
  autoCapitalize: "off",
985
915
  autoComplete: "off",
@@ -1000,225 +930,11 @@
1000
930
  inputRef: i,
1001
931
  inputId: a,
1002
932
  canClear: true,
1003
- startAdornment: t().createElement(Te, null, t().createElement(Q, null))
933
+ startAdornment: t().createElement(Se, null, t().createElement(Q, null))
1004
934
  })), s && l && g === "buttongroup" && C);
1005
935
  };
1006
- var mt = false;
1007
- var yt = function n(r) {
1008
- var o = r.activeIndex, l = r.activeItemId, a = r.allowKeyMatching, i = r.allowNewValues, c = r.availableMatchOptions, s = r.availableOptionCount, f = r.children, d = r.currentValues, b = r.filter, m = r.filterKeyword, y = r.firstSelectedOptionIndex, h = r.isLoadingOptions, g = r.multiple, O = r.newTopValues, w = r.onActiveOptionMount, S = r.onClearAll, C = r.onClick, k = r.onKeyDown, x = r.onOptionMount, j = r.onScrollBottom, E = r.onSelectAll, P = r.optionSelection, T = r.selectAllAppearance, I = r.selectedOptionCount, _ = r.setActiveValue, M = r.setAvailableMatchOptions, R = r.setAvailableOptionCount, L = r.setDisplayedValues, q = r.setFirstSelectedOptionIndex, B = r.setOptionSelection, D = r.setSelectedOptionCount, N = r.textHasFocus, K = r.toggle;
1009
- R(0);
1010
- q(undefined);
1011
- D(0);
1012
- _(undefined);
1013
- M([]);
1014
- var F;
1015
- var H = 0;
1016
- var z = false;
1017
- // used to avoid overwriting the selected item ref in multiple mode
1018
- var $;
1019
- var W = e.Children.toArray(f).reduce((function(n, r, o) {
1020
- // ignore Headings and Dividers
1021
- if (!st(r)) {
1022
- n.push(r);
1023
- return n;
1024
- }
1025
- var l = r.props, i = l.disabled, u = l.hidden, s = l.label, f = l.value;
1026
- // Find out if the search string exactly matches a value
1027
- if (f === m) {
1028
- F = true;
1029
- }
1030
- var p = d && d.indexOf(f) >= 0;
1031
- var v = !!p && !i && !$;
1032
- var y = a && !g && !b && !h && !j;
1033
- var w = ft(f, s);
1034
- var S = -1;
1035
- if (y && !i && !u) {
1036
- c.current.push({
1037
- label: s,
1038
- value: f
1039
- });
1040
- S = c.current.length - 1;
1041
- }
1042
- // Format the Menu.Item
1043
- var E = (0, e.cloneElement)(r, {
1044
- key: r.key || o,
1045
- onClick: C,
1046
- onKeyDown: y ? function(e) {
1047
- return k(e, S);
1048
- } : undefined,
1049
- selected: p,
1050
- multiple: g,
1051
- role: "option",
1052
- ref: function e(t) {
1053
- return x(t, w, v);
1054
- }
1055
- });
1056
- if (v) {
1057
- $ = true;
1058
- }
1059
- if (O && O.indexOf(f) >= 0) {
1060
- if (H === 0) {
1061
- n.splice(H, 0, t().createElement(A.Divider, {
1062
- key: "topDivider"
1063
- }));
1064
- z = true;
1065
- }
1066
- n.splice(H, 0, E);
1067
- H += 1;
1068
- } else {
1069
- n.push(E);
1070
- }
1071
- return n;
1072
- }), []);
1073
- // In multiple mode, add missing items
1074
- if (g) {
1075
- v()(d, (function(e) {
1076
- var n = p()(W, (function(t) {
1077
- return st(t) && t.props && t.props.value === e;
1078
- }));
1079
- if (!n) {
1080
- if (e === m) {
1081
- F = true;
1082
- }
1083
- var r = O && O.indexOf(e) >= 0;
1084
- var o = O.length;
1085
- if (H === 0) {
1086
- W.splice(0, 0, t().createElement(A.Divider, {
1087
- key: "topDivider"
1088
- }));
1089
- H += 1;
1090
- z = true;
1091
- }
1092
- W.splice(r ? 0 : o + 1, 0, t().createElement(he, {
1093
- label: String(e),
1094
- value: e,
1095
- key: "missing-value-".concat(e),
1096
- onClick: C,
1097
- multiple: g,
1098
- selected: true
1099
- }));
1100
- if (r) {
1101
- H += 1;
1102
- }
1103
- }
1104
- }));
1105
- }
1106
- var U = b === "controlled";
1107
- // Filter the items
1108
- var J = (0, V.stringToKeywords)(m);
1109
- W = U ? W : W.filter((function(e) {
1110
- if (st(e)) {
1111
- return (0, V.testPhrase)(e.props.label, J);
1112
- }
1113
- return true;
1114
- // Keep all headers and non-interactive options
1115
- })).map((function(t) {
1116
- if (!st(t)) {
1117
- return t;
1118
- }
1119
- // highlight matched text
1120
- var n = J && (0, V.keywordLocations)(t.props.label, J);
1121
-
1122
- return (0, e.cloneElement)(t, {
1123
- matchRanges: n || undefined
1124
- });
1125
- }));
1126
- // Add the option to add the new value
1127
- if (i && !F && m) {
1128
- var X = z ? H + 1 : H;
1129
- W.splice(X, 0, t().createElement(he, {
1130
- label: "".concat(m, " (new value)"),
1131
- value: m,
1132
- key: "newValue",
1133
- multiple: g,
1134
- onClick: C
1135
- }));
1136
- }
1137
- // When selectAll is a menu item, add an offset so that activeItem accounts for the extra selectAll option.
1138
- var G = T === "checkbox" && g && W.length > 1 ? 1 : 0;
1139
- var Q = true;
1140
- // Highlight the selected Items and remove hidden
1141
- W = W.reduce((function(t, n) {
1142
- // ignore Dividers & Headings
1143
- if (!st(n)) {
1144
- t.push(n);
1145
- return t;
1146
- }
1147
- // Ignore any hidden items
1148
- if (n.props && n.props.hidden) {
1149
- return t;
1150
- }
1151
- if (n.props.selected && !n.props.disabled && y.current == null) {
1152
- q(s.current);
1153
- }
1154
- var r = G === o;
1155
- G += 1;
1156
- R(s.current + 1);
1157
- D(I.current + (n.props.selected ? 1 : 0));
1158
- if (n.key !== "newValue" && !n.props.disabled && !n.props.selected) {
1159
- Q = false;
1160
- }
1161
- if (!r || !N) {
1162
- t.push(n);
1163
- return t;
1164
- }
1165
- if (!n.props.disabled) {
1166
- _(n.props.value);
1167
- }
1168
- var a = (0, e.cloneElement)(n, {
1169
- active: r,
1170
- id: l,
1171
- ref: w
1172
- });
1173
- t.push(a);
1174
- return t;
1175
- }), []);
1176
- B(I.current === 0 && "none" || Q && "all" || "some");
1177
- // add select all option
1178
- if (T === "checkbox" && g && s.current > 0) {
1179
- var Y;
1180
- if (P.current === "all") {
1181
- if (m === "") {
1182
- Y = (0, u._)("Clear all");
1183
- } else {
1184
- Y = (0, u._)("Clear all matches");
1185
- }
1186
- } else if (m === "") {
1187
- Y = (0, u._)("Select all");
1188
- } else {
1189
- Y = (0, u._)("Select all matches");
1190
- }
1191
- if (o === 0 && N) {
1192
- _("selectAll");
1193
- }
1194
- W.unshift( t().createElement(we, {
1195
- active: o === 0,
1196
- changedToggle: !!K,
1197
- id: o === 0 ? l : undefined,
1198
- onClick: P.current === "all" ? S : E,
1199
- selectAllLabel: Y,
1200
- selected: P.current === "all" || P.current !== "none" && "some",
1201
- totalCount: d.length,
1202
- tabIndex: -1,
1203
- ref: w
1204
- }), t().createElement(A.Divider, {
1205
- key: "selectAllDivider"
1206
- }));
1207
- }
1208
- L(W.reduce((function(e, t) {
1209
- if (st(t)) {
1210
- e.push(t.props.value);
1211
- }
1212
- return e;
1213
- }), []));
1214
- mt = W.some((function(e) {
1215
- return st(e);
1216
- }));
1217
- // eslint-disable-next-line react/jsx-no-useless-fragment
1218
-
1219
- return t().createElement(t().Fragment, null, W);
1220
- };
1221
- var ht = function e(t) {
936
+ var ut = false;
937
+ var ct = function e(t) {
1222
938
  var n = t.prefixLabel, r = t.label, o = t.suffixLabel;
1223
939
  var l = r;
1224
940
  if (n) {
@@ -1229,219 +945,196 @@
1229
945
  }
1230
946
  return l;
1231
947
  };
1232
- function gt(n) {
1233
- var r = n.appearance, o = n.append, l = n.children, a = n.currentValues, i = a === void 0 ? [] : a, c = n.describedBy, s = n.disabled, f = n.elementRef, d = n.error, v = n.inline, b = n.labelText, m = n.labelledBy, y = n.multiple, h = n.onClick, g = n.placeholder, w = n.prefixLabel, S = n.prepend, C = n.required, k = n.suffixLabel, x = n.toggle, j = n.toggleContent, E = Ye(n, [ "appearance", "append", "children", "currentValues", "describedBy", "disabled", "elementRef", "error", "inline", "labelText", "labelledBy", "multiple", "onClick", "placeholder", "prefixLabel", "prepend", "required", "suffixLabel", "toggle", "toggleContent" ]);
1234
- var A;
948
+ function st(n) {
949
+ var r = n.appearance, o = n.append, l = n.children, a = n.currentValues, i = a === void 0 ? [] : a, c = n.describedBy, s = n.disabled, f = n.elementRef, d = n.error, v = n.inline, b = n.labelText, m = n.labelledBy, y = n.multiple, h = n.onClick, g = n.placeholder, S = n.prefixLabel, w = n.prepend, C = n.required, k = n.suffixLabel, x = n.toggle, j = n.toggleContent, P = ze(n, [ "appearance", "append", "children", "currentValues", "describedBy", "disabled", "elementRef", "error", "inline", "labelText", "labelledBy", "multiple", "onClick", "placeholder", "prefixLabel", "prepend", "required", "suffixLabel", "toggle", "toggleContent" ]);
1235
950
  var T;
1236
- var I = [];
951
+ var R;
952
+ var A = [];
1237
953
  // Generate buttonLabels
1238
954
  var _ = e.Children.toArray(l);
1239
- var M = i.reduce((function(e, t, n, r) {
955
+ var L = i.reduce((function(e, t, n, r) {
1240
956
  var o = p()(_, (function(e) {
1241
- return st(e) && e.props.value === t;
957
+ return nt(e) && e.props.value === t;
1242
958
  }));
1243
959
  if (o) {
1244
960
  var l = o.props, a = l.children, c = l.icon, s = l.label;
1245
961
  var f = j !== "optionLabel" && a ? a : s;
1246
962
  e.push(f);
1247
- I.push(s);
963
+ A.push(s);
1248
964
  // if not in multiple mode, add the icon
1249
965
  if (!y && i.length === 1) {
1250
- A = c;
966
+ T = c;
1251
967
  }
1252
968
  } else if (y) {
1253
969
  // only add values that don't match an option in "multiple" mode to preserve old behaviour
1254
970
  e.push(t);
1255
- I.push(t.toString());
971
+ A.push(t.toString());
1256
972
  }
1257
973
  if (n < r.length - 1) {
1258
974
  e.push((0, u._)(", "));
1259
- I.push((0, u._)(", "));
975
+ A.push((0, u._)(", "));
1260
976
  }
1261
977
  return e;
1262
978
  }), []);
1263
- T = M;
979
+ R = L;
1264
980
  // only apply prefix / suffix if the label is not empty
1265
- if (T.length > 0) {
981
+ if (R.length > 0) {
1266
982
  // If there's more than one item selected, read out the selected total
1267
983
  // rather than reading out each selected item
1268
- I = ht({
1269
- prefixLabel: w,
1270
- label: T.length > 1 ? [ "".concat(i.length, " items selected") ] : I,
984
+ A = ct({
985
+ prefixLabel: S,
986
+ label: R.length > 1 ? [ "".concat(i.length, " items selected") ] : A,
1271
987
  suffixLabel: k
1272
988
  });
1273
- T = ht({
1274
- prefixLabel: w,
1275
- label: T,
989
+ R = ct({
990
+ prefixLabel: S,
991
+ label: R,
1276
992
  suffixLabel: k
1277
993
  });
1278
994
  }
1279
995
  // single <Select> behaviour is to show the placeholder if all parts of the label
1280
996
  // are empty strings so we replicate this behaviour here
1281
- if (T.length === 0 || !y && T.every((function(e) {
997
+ if (R.length === 0 || !y && R.every((function(e) {
1282
998
  return e === "";
1283
999
  }))) {
1284
- T = it(g);
1285
- I = T;
1000
+ R = Ze(g);
1001
+ A = R;
1286
1002
  }
1287
- var R = nt({
1003
+ var M = Je({
1288
1004
  "aria-describedby": c,
1289
- "aria-label": "".concat(b ? "".concat(b, ", ") : "").concat(I.join("")),
1005
+ "aria-label": "".concat(b ? "".concat(b, ", ") : "").concat(A.join("")),
1290
1006
  "aria-labelledby": m,
1291
1007
  // aria-labelledby takes precedence over aria-label if exists
1292
1008
  "aria-required": C,
1293
1009
  "data-select-appearance": r,
1294
1010
  append: o,
1295
- prepend: S,
1011
+ prepend: w,
1296
1012
  onClick: h,
1297
1013
  role: "combobox",
1298
1014
  disabled: s,
1299
1015
  elementRef: f,
1300
1016
  error: d
1301
- }, E);
1017
+ }, P);
1302
1018
  if (y) {
1303
- R["data-test-values"] = JSON.stringify(i);
1019
+ M["data-test-values"] = JSON.stringify(i);
1304
1020
  } else {
1305
- var L = We(i, 1), V = L[0];
1306
- R["data-test-value"] = V;
1021
+ var I = De(i, 1), q = I[0];
1022
+ M["data-test-value"] = q;
1307
1023
  }
1308
1024
  if (x) {
1309
1025
 
1310
- return (0, e.cloneElement)(x, R);
1026
+ return (0, e.cloneElement)(x, M);
1311
1027
  }
1312
1028
  if (r === "link") {
1313
1029
 
1314
- return t().createElement(P(), $e({}, R, {
1030
+ return t().createElement(E(), Be({}, M, {
1315
1031
  "data-select-appearance": "link"
1316
- }), !!A && t().createElement(Ee, null, A), T || g, t().createElement(Pe, null, t().createElement($, null)));
1032
+ }), !!T && t().createElement(he, null, T), R || g, t().createElement(ge, null, t().createElement($, null)));
1317
1033
  }
1318
1034
 
1319
- return t().createElement(je, $e({}, R, {
1035
+ return t().createElement(ye, Be({}, M, {
1320
1036
  $multiple: y,
1321
1037
  appearance: r,
1322
- label: T,
1038
+ label: R,
1323
1039
  error: d,
1324
- icon: A,
1040
+ icon: T,
1325
1041
  inline: v,
1326
1042
  isMenu: true,
1327
1043
  onClick: h
1328
- }, O()(E, pt)), !!i.length && y && t().createElement(Ie, {
1044
+ }, O()(P, ot)), !!i.length && y && t().createElement(we, {
1329
1045
  "data-role": "count"
1330
1046
  }, "(", i.length, ")"));
1331
1047
  }
1332
- gt[x.legacyRefMode] = true;
1333
- function Ot(n) {
1334
- var r;
1335
- var o = n.allowKeyMatching, l = o === void 0 ? true : o, a = n.animateLoading, i = n.appearance, u = i === void 0 ? "toggle" : i, c = n.append, s = n.allowNewValues, f = n.children, d = n.defaultPlacement, v = d === void 0 ? "vertical" : d, b = n.defaultValues, y = n.describedBy, h = n.disabled, g = n.elementRef, O = n.error, w = n.filter, C = n.footerMessage, x = n.inline, E = n.inputId, P = n.inputRef, A = n.isLoadingOptions, _ = n.labelledBy, M = n.labelText, R = n.loadingMessage, V = n.menuStyle, D = V === void 0 ? {} : V, N = n.multiple, K = n.name, F = n.noOptionsMessage, H = F === void 0 ? dt : F, z = n.onChange, $ = n.onScroll, W = n.onScrollBottom, U = n.onFilterChange, J = n.onClick, X = n.onClose, G = n.onOpen, Q = n.required, Y = n.placeholder, Z = Y === void 0 ? vt : Y, ee = n.prefixLabel, te = n.prepend, ne = n.repositionMode, re = ne === void 0 ? "flip" : ne, oe = n.selectAllAppearance, le = oe === void 0 ? "buttongroup" : oe, ae = n.showSelectedValuesFirst, ie = n.suffixLabel, ue = n.tabConfirmsNewValue, ce = n.values, se = n.virtualization, fe = n.toggle, pe = n.toggleContent, de = pe === void 0 ? "optionChildren" : pe, ve = Ye(n, [ "allowKeyMatching", "animateLoading", "appearance", "append", "allowNewValues", "children", "defaultPlacement", "defaultValues", "describedBy", "disabled", "elementRef", "error", "filter", "footerMessage", "inline", "inputId", "inputRef", "isLoadingOptions", "labelledBy", "labelText", "loadingMessage", "menuStyle", "multiple", "name", "noOptionsMessage", "onChange", "onScroll", "onScrollBottom", "onFilterChange", "onClick", "onClose", "onOpen", "required", "placeholder", "prefixLabel", "prepend", "repositionMode", "selectAllAppearance", "showSelectedValuesFirst", "suffixLabel", "tabConfirmsNewValue", "values", "virtualization", "toggle", "toggleContent" ]);
1048
+ st[x.legacyRefMode] = true;
1049
+ function ft(n) {
1050
+ var r = n.allowKeyMatching, o = r === void 0 ? true : r, l = n.animateLoading, a = n.appearance, i = a === void 0 ? "toggle" : a, c = n.append, s = n.allowNewValues, f = n.children, d = n.defaultPlacement, b = d === void 0 ? "vertical" : d, y = n.defaultValues, h = n.describedBy, g = n.disabled, O = n.elementRef, S = n.error, C = n.filter, x = n.footerMessage, P = n.inline, E = n.inputId, _ = n.inputRef, L = n.isLoadingOptions, M = n.labelledBy, V = n.labelText, N = n.loadingMessage, K = n.menuStyle, F = K === void 0 ? {} : K, H = n.multiple, z = n.name, $ = n.noOptionsMessage, W = $ === void 0 ? lt : $, U = n.onChange, J = n.onScroll, X = n.onScrollBottom, G = n.onFilterChange, Q = n.onClick, Y = n.onClose, Z = n.onOpen, ee = n.required, te = n.placeholder, ne = te === void 0 ? at : te, re = n.prefixLabel, oe = n.prepend, le = n.repositionMode, ae = le === void 0 ? "flip" : le, ie = n.selectAllAppearance, ue = ie === void 0 ? "buttongroup" : ie, se = n.showSelectedValuesFirst, fe = n.suffixLabel, de = n.tabConfirmsNewValue, ve = n.values, be = n.virtualization, me = n.toggle, ye = n.toggleContent, he = ye === void 0 ? "optionChildren" : ye, ge = ze(n, [ "allowKeyMatching", "animateLoading", "appearance", "append", "allowNewValues", "children", "defaultPlacement", "defaultValues", "describedBy", "disabled", "elementRef", "error", "filter", "footerMessage", "inline", "inputId", "inputRef", "isLoadingOptions", "labelledBy", "labelText", "loadingMessage", "menuStyle", "multiple", "name", "noOptionsMessage", "onChange", "onScroll", "onScrollBottom", "onFilterChange", "onClick", "onClose", "onOpen", "required", "placeholder", "prefixLabel", "prepend", "repositionMode", "selectAllAppearance", "showSelectedValuesFirst", "suffixLabel", "tabConfirmsNewValue", "values", "virtualization", "toggle", "toggleContent" ]);
1336
1051
  // @docs-props-type SelectBasePropsBase
1337
- var be = (0, Re["default"])({
1338
- value: ce,
1339
- defaultValue: b,
1052
+ var Oe = (0, xe["default"])({
1053
+ value: ve,
1054
+ defaultValue: y,
1340
1055
  componentName: "SelectBase"
1341
1056
  });
1342
1057
  // states
1343
- var me = (0, e.useState)((function() {
1058
+ var Se = (0, e.useState)((function() {
1344
1059
  return {
1345
- activeItemId: (0, q.createDOMID)("active-item"),
1346
- menuListboxId: (0, q.createDOMID)("menu-listbox")
1060
+ activeItemId: (0, B.createDOMID)("active-item"),
1061
+ menuListboxId: (0, B.createDOMID)("menu-listbox")
1347
1062
  };
1348
- })), ye = We(me, 1), he = ye[0], ge = he.activeItemId, Oe = he.menuListboxId;
1349
- var we = (0, e.useState)(0), Se = We(we, 2), Ce = Se[0], ke = Se[1];
1350
- var xe = (0, e.useState)(""), je = We(xe, 2), Ee = je[0], Pe = je[1];
1351
- var Ae = (0, e.useState)(false), Te = We(Ae, 2), Ie = Te[0], _e = Te[1];
1352
- var Me = (0, e.useState)(false), Le = We(Me, 2), qe = Le[0], Be = Le[1];
1353
- var De = (0, e.useState)([]), Fe = We(De, 2), He = Fe[0], ze = Fe[1];
1354
- var Ue = (0, e.useState)(b || []), Je = We(Ue, 2), Xe = Je[0], Ge = Je[1];
1063
+ })), we = De(Se, 1), Ce = we[0], ke = Ce.activeItemId, je = Ce.menuListboxId;
1064
+ var Te = (0, e.useState)(0), Re = De(Te, 2), Ae = Re[0], Me = Re[1];
1065
+ var Ie = (0, e.useState)(""), qe = De(Ie, 2), Ve = qe[0], Ne = qe[1];
1066
+ var Ke = (0, e.useState)(false), Fe = De(Ke, 2), He = Fe[0], $e = Fe[1];
1067
+ var We = (0, e.useState)(false), Ue = De(We, 2), Je = Ue[0], Xe = Ue[1];
1068
+ var Ge = (0, e.useState)([]), Qe = De(Ge, 2), Ye = Qe[0], Ze = Qe[1];
1069
+ var ot = (0, e.useState)(y || []), ct = De(ot, 2), ft = ct[0], pt = ct[1];
1355
1070
  // previous state
1356
- var Qe = L()(Ce);
1071
+ var dt = I()(Ae);
1357
1072
  // refs
1358
- var Ze = (0, e.useRef)(null);
1359
- var et = (0, e.useRef)(null);
1360
- var tt = (0, e.useRef)(null);
1361
- var nt = (0, e.useRef)([]);
1362
- var rt = (0, e.useRef)([]);
1363
- var ot = (0, e.useRef)(Qe);
1364
- var lt = (0, e.useRef)();
1365
- var at = (0, e.useRef)({});
1366
- var it = (0, e.useRef)(0);
1367
- var pt = (0, e.useRef)([]);
1368
- var ht = (0, e.useRef)(null);
1073
+ var vt = (0, e.useRef)(null);
1074
+ var bt = (0, e.useRef)(null);
1075
+ var mt = (0, e.useRef)(null);
1076
+ var yt = (0, e.useRef)([]);
1077
+ var ht = (0, e.useRef)([]);
1078
+ var gt = (0, e.useRef)(dt);
1369
1079
  var Ot = (0, e.useRef)();
1080
+ var St = (0, e.useRef)({});
1370
1081
  var wt = (0, e.useRef)(0);
1371
- var St = (0, e.useRef)("none");
1372
- // setters for refs used in subcomponents
1373
- var Ct = function e(t) {
1374
- it.current = t;
1375
- };
1376
- var kt = function e(t) {
1377
- Ot.current = t;
1378
- };
1379
- var xt = function e(t) {
1380
- wt.current = t;
1381
- };
1382
- var jt = function e(t) {
1383
- lt.current = t;
1384
- };
1385
- var Et = function e(t) {
1386
- rt.current = t;
1387
- };
1388
- var Pt = function e(t) {
1389
- St.current = t;
1390
- };
1391
- var At = function e(t) {
1392
- pt.current = t;
1393
- };
1082
+ var Ct = (0, e.useRef)([]);
1083
+ var kt = (0, e.useRef)(null);
1084
+ var xt = (0, e.useRef)();
1085
+ var jt = (0, e.useRef)(0);
1086
+ var Pt = (0, e.useRef)("none");
1394
1087
  (0, e.useEffect)((function() {
1395
1088
  if (false) {}
1396
- }), [ u, c, O, te ]);
1089
+ }), [ i, c, S, oe ]);
1090
+ var Et = (0, e.useCallback)((function() {
1091
+ var e = Oe ? ve : ft;
1092
+ return H || e == null ? e : e.slice(0, 1);
1093
+ }), [ Oe, H, ve, ft ]);
1397
1094
  var Tt = (0, e.useCallback)((function() {
1398
- var e = be ? ce : Xe;
1399
- return N || e == null ? e : e.slice(0, 1);
1400
- }), [ be, N, ce, Xe ]);
1401
- var It = (0, e.useCallback)((function() {
1402
1095
  var e;
1403
1096
  // in non-multiple mode, don't move values to the top of the list
1404
- return N && ae !== "never" ? (e = Tt()) !== null && e !== void 0 ? e : [] : [];
1405
- }), [ Tt, N, ae ]);
1406
- var _t = (0, e.useCallback)((function(e) {
1407
- var t = Ee;
1408
- _e(true);
1409
- ze(It());
1097
+ return H && se !== "never" ? (e = Et()) !== null && e !== void 0 ? e : [] : [];
1098
+ }), [ Et, H, se ]);
1099
+ var Rt = (0, e.useCallback)((function(e) {
1100
+ var t = Ve;
1101
+ $e(true);
1102
+ Ze(Tt());
1410
1103
  // SUI-3234: preserve existing behavior difference between <Select> and <Multiselect.Compact>
1411
- if (N) {
1412
- Pe("");
1104
+ if (H) {
1105
+ Ne("");
1413
1106
  }
1414
- if (t !== Ee) {
1415
- U === null || U === void 0 ? void 0 : U(e, {
1416
- keyword: Ee
1107
+ if (t !== Ve) {
1108
+ G === null || G === void 0 ? void 0 : G(e, {
1109
+ keyword: Ve
1417
1110
  });
1418
1111
  }
1419
- }), [ Ee, It, N, U ]);
1112
+ }), [ Ve, Tt, H, G ]);
1420
1113
  (0, e.useEffect)((function() {
1421
- if (Ie) {
1422
- G === null || G === void 0 ? void 0 : G();
1423
- if (ht.current && !w) {
1424
- ht.current.focus();
1114
+ if (He) {
1115
+ Z === null || Z === void 0 ? void 0 : Z();
1116
+ if (kt.current && !C) {
1117
+ kt.current.focus();
1425
1118
  } else {
1426
1119
  var e;
1427
- ke((e = Ot.current) !== null && e !== void 0 ? e : 0);
1120
+ Me((e = xt.current) !== null && e !== void 0 ? e : 0);
1428
1121
  }
1429
1122
  }
1430
- }), [ G, Ie, He, Ee, w ]);
1431
- var Mt = (0, e.useCallback)((function() {
1432
- _e(false);
1433
- ke(0);
1434
- ot.current = null;
1435
- X === null || X === void 0 ? void 0 : X();
1436
- }), [ X ]);
1437
- var Rt = (0, e.useCallback)((function(e, t) {
1123
+ }), [ Z, He, Ye, Ve, C ]);
1124
+ var At = (0, e.useCallback)((function() {
1125
+ $e(false);
1126
+ Me(0);
1127
+ gt.current = null;
1128
+ Y === null || Y === void 0 ? void 0 : Y();
1129
+ }), [ Y ]);
1130
+ var _t = (0, e.useCallback)((function(e, t) {
1438
1131
  var n;
1439
- var r = (n = Tt()) !== null && n !== void 0 ? n : [];
1132
+ var r = (n = Et()) !== null && n !== void 0 ? n : [];
1440
1133
  var o = r.indexOf(t);
1441
1134
  var l;
1442
- if (N) {
1135
+ if (H) {
1443
1136
  if (o >= 0) {
1444
- l = [].concat(Ke(r.slice(0, o)), Ke(r.slice(o + 1)));
1137
+ l = [].concat(Le(r.slice(0, o)), Le(r.slice(o + 1)));
1445
1138
  } else {
1446
1139
  l = r.concat([ t ]);
1447
1140
  }
@@ -1449,143 +1142,143 @@
1449
1142
  // non-multiple mode must always have a value
1450
1143
  l = [ t ];
1451
1144
  }
1452
- var a = !be;
1145
+ var a = !Oe;
1453
1146
  if (a) {
1454
- Ge(l);
1147
+ pt(l);
1455
1148
  }
1456
- if (N) {
1149
+ if (H) {
1457
1150
  // in uncontrolled multiple mode, keep the menu open
1458
1151
  if (a) {
1459
- _e(true);
1152
+ $e(true);
1460
1153
  }
1461
1154
  } else {
1462
1155
  var i;
1463
1156
  // non-multiple mode only supports a single selection
1464
1157
  // so close the menu once a selection is made
1465
- Mt({
1158
+ At({
1466
1159
  reason: "contentClick"
1467
1160
  });
1468
- (i = Ze.current) === null || i === void 0 ? void 0 : i.focus();
1161
+ (i = vt.current) === null || i === void 0 ? void 0 : i.focus();
1469
1162
  }
1470
- z === null || z === void 0 ? void 0 : z(e, {
1163
+ U === null || U === void 0 ? void 0 : U(e, {
1471
1164
  values: l,
1472
- name: K,
1165
+ name: z,
1473
1166
  reason: "valueToggle"
1474
1167
  });
1475
- }), [ Tt, Mt, be, N, K, z ]);
1168
+ }), [ Et, At, Oe, H, z, U ]);
1476
1169
  var Lt = function e() {
1477
- et.current = null;
1478
- nt.current = [];
1479
- if (tt.current) {
1480
- clearTimeout(tt.current);
1170
+ bt.current = null;
1171
+ yt.current = [];
1172
+ if (mt.current) {
1173
+ clearTimeout(mt.current);
1481
1174
  }
1482
1175
  };
1483
- var Vt = (0, e.useCallback)((function(e) {
1176
+ var Mt = (0, e.useCallback)((function(e) {
1484
1177
  var n;
1485
1178
  // this doesn't make sense if we can't select multiple values
1486
- if (!N) {
1179
+ if (!H) {
1487
1180
  return;
1488
1181
  }
1489
- var r = (n = Tt()) !== null && n !== void 0 ? n : [];
1490
- var o = S()(r.concat(pt.current));
1182
+ var r = (n = Et()) !== null && n !== void 0 ? n : [];
1183
+ var o = w()(r.concat(Ct.current));
1491
1184
  o = t().Children.toArray(f).filter((function(e) {
1492
- return st(e) && m()(o, e.props.value) && (!e.props.disabled || m()(r, e.props.value));
1185
+ return nt(e) && m()(o, e.props.value) && (!e.props.disabled || m()(r, e.props.value));
1493
1186
  })).map((function(e) {
1494
1187
  return e.props.value;
1495
1188
  }));
1496
- if (!be) {
1497
- Ge(o);
1189
+ if (!Oe) {
1190
+ pt(o);
1498
1191
  }
1499
- z === null || z === void 0 ? void 0 : z(e, {
1192
+ U === null || U === void 0 ? void 0 : U(e, {
1500
1193
  values: o,
1501
- name: K,
1194
+ name: z,
1502
1195
  reason: "selectAll"
1503
1196
  });
1504
- }), [ f, Tt, be, N, K, z ]);
1505
- var qt = (0, e.useCallback)((function(e) {
1197
+ }), [ f, Et, Oe, H, z, U ]);
1198
+ var It = (0, e.useCallback)((function(e) {
1506
1199
  var n;
1507
1200
  // this doesn't make sense if we can't select multiple values
1508
- if (!N) {
1201
+ if (!H) {
1509
1202
  return;
1510
1203
  }
1511
- var r = (n = Tt()) !== null && n !== void 0 ? n : [];
1512
- var o = k().apply(void 0, [ r ].concat(Ke(pt.current)));
1204
+ var r = (n = Et()) !== null && n !== void 0 ? n : [];
1205
+ var o = k().apply(void 0, [ r ].concat(Le(Ct.current)));
1513
1206
  // this will unselect all selected values unless those values are disabled or hidden by the filter
1514
1207
  var l = t().Children.toArray(f).filter((function(e) {
1515
- return st(e) && (m()(r, e.props.value) && e.props.disabled || m()(o, e.props.value));
1208
+ return nt(e) && (m()(r, e.props.value) && e.props.disabled || m()(o, e.props.value));
1516
1209
  })).map((function(e) {
1517
1210
  return e.props.value;
1518
1211
  }));
1519
- if (!be) {
1520
- Ge(l);
1212
+ if (!Oe) {
1213
+ pt(l);
1521
1214
  }
1522
- z === null || z === void 0 ? void 0 : z(e, {
1215
+ U === null || U === void 0 ? void 0 : U(e, {
1523
1216
  values: l,
1524
- name: K,
1217
+ name: z,
1525
1218
  reason: "clearAll"
1526
1219
  });
1527
- }), [ f, Tt, be, N, K, z ]);
1528
- var Bt = (0, e.useCallback)((function(e) {
1529
- if (Ie && !A) {
1530
- W === null || W === void 0 ? void 0 : W(e);
1220
+ }), [ f, Et, Oe, H, z, U ]);
1221
+ var qt = (0, e.useCallback)((function(e) {
1222
+ if (He && !L) {
1223
+ X === null || X === void 0 ? void 0 : X(e);
1531
1224
  }
1532
- }), [ Ie, A, W ]);
1533
- var Dt = (0, e.useCallback)((function(t) {
1534
- var n = (0, B.keycode)(t.nativeEvent);
1225
+ }), [ He, L, X ]);
1226
+ var Bt = (0, e.useCallback)((function(t) {
1227
+ var n = (0, D.keycode)(t.nativeEvent);
1535
1228
  if (n === "tab") {
1536
- if (ue && lt.current && it.current <= 1) {
1229
+ if (de && Ot.current && wt.current <= 1) {
1537
1230
  t.preventDefault();
1538
- Rt(t, lt.current);
1231
+ _t(t, Ot.current);
1539
1232
  }
1540
1233
  }
1541
1234
  if (t.shiftKey || t.metaKey || t.ctrlKey) {
1542
1235
  if (n === "a" && (t.ctrlKey || t.metaKey)) {
1543
1236
  // handle control + A
1544
- if (St.current === "all") {
1545
- qt(t);
1237
+ if (Pt.current === "all") {
1238
+ It(t);
1546
1239
  } else {
1547
- Vt(t);
1240
+ Mt(t);
1548
1241
  }
1549
1242
  }
1550
1243
  return;
1551
1244
  }
1552
1245
  if (n === "down") {
1553
1246
  t.preventDefault();
1554
- ke(Math.min(Ce + 1, le === "checkbox" ? it.current : it.current - 1));
1555
- if (f && W) {
1247
+ Me(Math.min(Ae + 1, ue === "checkbox" ? wt.current : wt.current - 1));
1248
+ if (f && X) {
1556
1249
  var r;
1557
- var o = e.Children.toArray(f).length - (2 + ((r = Tt()) !== null && r !== void 0 ? r : []).length);
1558
- if (Ce === o) {
1559
- Bt(t);
1250
+ var o = e.Children.toArray(f).length - (2 + ((r = Et()) !== null && r !== void 0 ? r : []).length);
1251
+ if (Ae === o) {
1252
+ qt(t);
1560
1253
  }
1561
1254
  }
1562
1255
  }
1563
1256
  if (n === "up") {
1564
1257
  t.preventDefault();
1565
- ke(Math.max(Ce - 1, 0));
1258
+ Me(Math.max(Ae - 1, 0));
1566
1259
  }
1567
- if (n === "enter" && lt.current && Ie) {
1568
- if (lt.current === "selectAll") {
1569
- if (St.current === "all") {
1570
- qt(t);
1260
+ if (n === "enter" && Ot.current && He) {
1261
+ if (Ot.current === "selectAll") {
1262
+ if (Pt.current === "all") {
1263
+ It(t);
1571
1264
  } else {
1572
- Vt(t);
1265
+ Mt(t);
1573
1266
  }
1574
1267
  } else {
1575
1268
  t.preventDefault();
1576
- Rt(t, lt.current);
1269
+ _t(t, Ot.current);
1577
1270
  }
1578
1271
  }
1579
- }), [ Ce, f, Tt, qt, Bt, Vt, W, Ie, le, ue, Rt ]);
1580
- var Nt = (0, e.useCallback)((function(e, t) {
1272
+ }), [ Ae, f, Et, It, qt, Mt, X, He, ue, de, _t ]);
1273
+ var Dt = (0, e.useCallback)((function(e, t) {
1581
1274
  var n = t.value;
1582
1275
  e.preventDefault();
1583
- if (!Ie) {
1276
+ if (!He) {
1584
1277
  return;
1585
1278
  }
1586
- Rt(e, n);
1587
- }), [ Ie, Rt ]);
1588
- var Kt = (0, e.useCallback)((function(e, t) {
1279
+ _t(e, n);
1280
+ }), [ He, _t ]);
1281
+ var Vt = (0, e.useCallback)((function(e, t) {
1589
1282
  var n = e.nativeEvent.key;
1590
1283
  // Checking for a single character to avoid complications from double-byte languages and emojis.
1591
1284
  if (n.length === 1) {
@@ -1594,227 +1287,433 @@
1594
1287
  index: 0,
1595
1288
  value: n
1596
1289
  };
1597
- if (!et.current) {
1290
+ if (!bt.current) {
1598
1291
  if (n === " ") {
1599
1292
  Lt();
1600
1293
  return;
1601
1294
  }
1602
- r = Ve(rt.current, o);
1603
- } else if (nt.current.length > 1) {
1604
- o.index = et.current.index + 1;
1605
- r = Ve(nt.current, o);
1295
+ r = Pe(ht.current, o);
1296
+ } else if (yt.current.length > 1) {
1297
+ o.index = bt.current.index + 1;
1298
+ r = Pe(yt.current, o);
1606
1299
  }
1607
1300
  if (r.length) {
1608
- var l = 0;
1301
+ var l;
1302
+ var a = 0;
1609
1303
  // If the active option is a first character match, cycle to the next matching option.
1610
1304
  if (o.index === 0 && r.length > 1) {
1611
- var a = r.indexOf(rt.current[t]);
1612
- if (a >= 0) {
1613
- l = a === r.length - 1 ? 0 : a + 1;
1305
+ var i = r.indexOf(ht.current[t]);
1306
+ if (i >= 0) {
1307
+ a = i === r.length - 1 ? 0 : i + 1;
1614
1308
  }
1615
1309
  }
1616
- var i = r[l];
1617
- var u = i.value, c = i.label;
1618
- var s = at.current[ft(u, c)];
1619
- if (s != null) {
1620
- var f;
1621
- (f = s.focus) === null || f === void 0 ? void 0 : f.call(s);
1622
- }
1310
+ var u = r[a];
1311
+ var c = u.value, s = u.label;
1312
+ var f = St.current[rt(c, s)];
1313
+ f === null || f === void 0 ? void 0 : (l = f.focus) === null || l === void 0 ? void 0 : l.call(f);
1623
1314
  }
1624
- nt.current = r;
1625
- et.current = o;
1626
- if (tt.current) {
1627
- clearTimeout(tt.current);
1315
+ yt.current = r;
1316
+ bt.current = o;
1317
+ if (mt.current) {
1318
+ clearTimeout(mt.current);
1628
1319
  }
1629
- tt.current = setTimeout(Lt, 500);
1320
+ mt.current = setTimeout(Lt, 500);
1630
1321
  e.preventDefault();
1631
1322
  e.stopPropagation();
1632
1323
  }
1633
1324
  }), []);
1634
- var Ft = (0, e.useCallback)((function(e, t) {
1325
+ var Nt = (0, e.useCallback)((function(e, t) {
1635
1326
  var n = t.value;
1636
- Pe(n);
1637
- _e(true);
1638
- ke(0);
1639
- U === null || U === void 0 ? void 0 : U(e, {
1327
+ Ne(n);
1328
+ $e(true);
1329
+ Me(0);
1330
+ G === null || G === void 0 ? void 0 : G(e, {
1640
1331
  keyword: n
1641
1332
  });
1642
- }), [ U ]);
1643
- var Ht = (0, e.useCallback)((function() {
1644
- Be(true);
1333
+ }), [ G ]);
1334
+ var Kt = (0, e.useCallback)((function() {
1335
+ Xe(true);
1645
1336
  }), []);
1646
- var zt = (0, e.useCallback)((function() {
1647
- Be(false);
1337
+ var Ft = (0, e.useCallback)((function() {
1338
+ Xe(false);
1648
1339
  }), []);
1649
- var $t = (0, e.useCallback)((function(e) {
1650
- if (ot.current !== Ce) {
1651
- e === null || e === void 0 ? void 0 : e.scrollIntoViewIfNeeded();
1340
+ var Ht = (0, e.useCallback)((function(e) {
1341
+ if (gt.current !== Ae) {
1342
+ Ee(e);
1652
1343
  }
1653
- }), [ Ce ]);
1654
- var Wt = (0, e.useCallback)((function(e, t, n) {
1344
+ }), [ Ae ]);
1345
+ var zt = (0, e.useCallback)((function(e, t, n) {
1655
1346
  if (n) {
1656
- ht.current = e;
1347
+ kt.current = e;
1657
1348
  }
1658
1349
  if (e == null) {
1659
- delete at.current[t];
1350
+ delete St.current[t];
1660
1351
  } else {
1661
- at.current[t] = e;
1352
+ St.current[t] = e;
1662
1353
  }
1663
- }), []);
1664
- var Ut = (0, e.useCallback)((function(e) {
1665
- Ze.current = e;
1666
- }), [ Ze ]);
1667
- var Jt = (r = Tt()) !== null && r !== void 0 ? r : [];
1668
- var Xt = e.Children.toArray(f);
1669
- var Gt = Jt.some((function(e) {
1670
- var t = p()(Xt, (function(t) {
1671
- return st(t) && t.props.value === e;
1354
+ }), [ St ]);
1355
+ var $t = (0, e.useCallback)((function(e) {
1356
+ vt.current = e;
1357
+ }), [ vt ]);
1358
+ var Wt = (0, e.useMemo)((function() {
1359
+ var e;
1360
+ return (e = Et()) !== null && e !== void 0 ? e : [];
1361
+ }), [ Et ]);
1362
+ var Ut = e.Children.toArray(f);
1363
+ var Jt = Wt.some((function(e) {
1364
+ var t = p()(Ut, (function(t) {
1365
+ return nt(t) && t.props.value === e;
1672
1366
  }));
1673
1367
  return t && !t.props.disabled;
1674
1368
  }));
1675
- var Qt = ae === "immediately" ? It() : He;
1676
- var Yt = {
1677
- activeIndex: Ce,
1678
- activeItemId: ge,
1679
- allowKeyMatching: l,
1680
- allowNewValues: s,
1681
- availableMatchOptions: rt,
1682
- availableOptionCount: it,
1683
- children: f,
1684
- currentValues: Jt,
1685
- filter: w,
1686
- filterKeyword: Ee,
1687
- firstSelectedOptionIndex: Ot,
1688
- isLoadingOptions: A,
1689
- multiple: N,
1690
- newTopValues: Qt,
1691
- onActiveOptionMount: $t,
1692
- onClick: Nt,
1693
- onClearAll: qt,
1694
- onKeyDown: Kt,
1695
- onOptionMount: Wt,
1696
- onScrollBottom: W,
1697
- onSelectAll: Vt,
1698
- optionSelection: St,
1699
- selectAllAppearance: le,
1700
- selectedOptionCount: wt,
1701
- setActiveValue: jt,
1702
- setAvailableMatchOptions: Et,
1703
- setAvailableOptionCount: Ct,
1704
- setDisplayedValues: At,
1705
- setFirstSelectedOptionIndex: kt,
1706
- setOptionSelection: Pt,
1707
- setSelectedOptionCount: xt,
1708
- textHasFocus: qe,
1709
- toggle: fe
1710
- };
1711
- var Zt = function e(n) {
1712
- var r = n.anchorWidth, o = n.maxHeight, l = n.placement;
1713
- var i = ut({
1369
+ var Xt = se === "immediately" ? Tt() : Ye;
1370
+ var Gt = (0, e.useMemo)((function() {
1371
+ wt.current = 0;
1372
+ xt.current = undefined;
1373
+ jt.current = 0;
1374
+ Ot.current = undefined;
1375
+ ht.current = [];
1376
+ var n = function e(t, n) {
1377
+ return function(e) {
1378
+ return zt(e, t, n);
1379
+ };
1380
+ };
1381
+ var r;
1382
+ var l = 0;
1383
+ var a = false;
1384
+ // used to avoid overwriting the selected item ref in multiple mode
1385
+ var i;
1386
+ var c = e.Children.toArray(f).reduce((function(u, c, s) {
1387
+ // ignore Headings and Dividers
1388
+ if (!nt(c)) {
1389
+ u.push(c);
1390
+ return u;
1391
+ }
1392
+ var f = c.props, p = f.disabled, d = f.hidden, v = f.label, b = f.value;
1393
+ // Find out if the search string exactly matches a value
1394
+ if (b === Ve) {
1395
+ r = true;
1396
+ }
1397
+ var m = Wt && Wt.indexOf(b) >= 0;
1398
+ var y = !!m && !p && !i;
1399
+ var h = o && !H && !C && !L && !X;
1400
+ var g = rt(b, v);
1401
+ var O = -1;
1402
+ if (h && !p && !d) {
1403
+ ht.current.push({
1404
+ label: v,
1405
+ value: b
1406
+ });
1407
+ O = ht.current.length - 1;
1408
+ }
1409
+ // Format the Menu.Item
1410
+ var S = (0, e.cloneElement)(c, {
1411
+ elementRef: n(g, y),
1412
+ key: c.key || s,
1413
+ onClick: Dt,
1414
+ onKeyDown: h ? function(e) {
1415
+ return Vt(e, O);
1416
+ } : undefined,
1417
+ selected: m,
1418
+ multiple: H,
1419
+ role: "option"
1420
+ });
1421
+ if (y) {
1422
+ i = true;
1423
+ }
1424
+ if (Xt && Xt.indexOf(b) >= 0) {
1425
+ if (l === 0) {
1426
+ u.splice(l, 0, t().createElement(T.Divider, {
1427
+ key: "topDivider"
1428
+ }));
1429
+ a = true;
1430
+ }
1431
+ u.splice(l, 0, S);
1432
+ l += 1;
1433
+ } else {
1434
+ u.push(S);
1435
+ }
1436
+ return u;
1437
+ }), []);
1438
+ // In multiple mode, add missing items
1439
+ if (H) {
1440
+ v()(Wt, (function(e) {
1441
+ var o = p()(c, (function(t) {
1442
+ return nt(t) && t.props && t.props.value === e;
1443
+ }));
1444
+ if (!o) {
1445
+ if (e === Ve) {
1446
+ r = true;
1447
+ }
1448
+ var i = Xt && Xt.indexOf(e) >= 0;
1449
+ var u = Xt.length;
1450
+ if (l === 0) {
1451
+ c.splice(0, 0, t().createElement(T.Divider, {
1452
+ key: "topDivider"
1453
+ }));
1454
+ l += 1;
1455
+ a = true;
1456
+ }
1457
+ var s = String(e);
1458
+ var f = rt(e, s);
1459
+ c.splice(i ? 0 : u + 1, 0, t().createElement(ce, {
1460
+ elementRef: n(f),
1461
+ label: s,
1462
+ value: e,
1463
+ key: "missing-value-".concat(e),
1464
+ onClick: Dt,
1465
+ multiple: H,
1466
+ selected: true
1467
+ }));
1468
+ if (i) {
1469
+ l += 1;
1470
+ }
1471
+ }
1472
+ }));
1473
+ }
1474
+ var d = C === "controlled";
1475
+ // Filter the items
1476
+ var b = (0, q.stringToKeywords)(Ve);
1477
+ c = d ? c : c.filter((function(e) {
1478
+ if (nt(e)) {
1479
+ return (0, q.testPhrase)(e.props.label, b);
1480
+ }
1481
+ return true;
1482
+ // Keep all headers and non-interactive options
1483
+ })).map((function(t) {
1484
+ if (!nt(t)) {
1485
+ return t;
1486
+ }
1487
+ // highlight matched text
1488
+ var n = b && (0, q.keywordLocations)(t.props.label, b);
1489
+
1490
+ return (0, e.cloneElement)(t, {
1491
+ matchRanges: n || undefined
1492
+ });
1493
+ }));
1494
+ // Add the option to add the new value
1495
+ if (s && !r && Ve) {
1496
+ var m = a ? l + 1 : l;
1497
+ var y = "".concat(Ve, " (new value)");
1498
+ var h = rt(Ve, y);
1499
+ c.splice(m, 0, t().createElement(ce, {
1500
+ elementRef: n(h),
1501
+ label: y,
1502
+ value: Ve,
1503
+ key: "newValue",
1504
+ multiple: H,
1505
+ onClick: Dt
1506
+ }));
1507
+ }
1508
+ // When selectAll is a menu item, add an offset so that activeItem accounts for the extra selectAll option.
1509
+ var g = ue === "checkbox" && H && c.length > 1 ? 1 : 0;
1510
+ var O = true;
1511
+ // Highlight the selected Items and remove hidden
1512
+ c = c.reduce((function(t, n) {
1513
+ // ignore Dividers & Headings
1514
+ if (!nt(n)) {
1515
+ t.push(n);
1516
+ return t;
1517
+ }
1518
+ // Ignore any hidden items
1519
+ if (n.props && n.props.hidden) {
1520
+ return t;
1521
+ }
1522
+ if (n.props.selected && !n.props.disabled && xt.current == null) {
1523
+ xt.current = wt.current;
1524
+ }
1525
+ var r = g === Ae;
1526
+ g += 1;
1527
+ wt.current += 1;
1528
+ jt.current += n.props.selected ? 1 : 0;
1529
+ if (n.key !== "newValue" && !n.props.disabled && !n.props.selected) {
1530
+ O = false;
1531
+ }
1532
+ if (!r || !Je) {
1533
+ t.push(n);
1534
+ return t;
1535
+ }
1536
+ if (!n.props.disabled) {
1537
+ Ot.current = n.props.value;
1538
+ }
1539
+ var o = (0, e.cloneElement)(n, {
1540
+ active: r,
1541
+ elementRef: Ht,
1542
+ id: ke
1543
+ });
1544
+ t.push(o);
1545
+ return t;
1546
+ }), []);
1547
+ Pt.current = jt.current === 0 && "none" || O && "all" || "some";
1548
+ // add select all option
1549
+ if (ue === "checkbox" && H && wt.current > 0) {
1550
+ var S;
1551
+ if (Pt.current === "all") {
1552
+ if (Ve === "") {
1553
+ S = (0, u._)("Clear all");
1554
+ } else {
1555
+ S = (0, u._)("Clear all matches");
1556
+ }
1557
+ } else if (Ve === "") {
1558
+ S = (0, u._)("Select all");
1559
+ } else {
1560
+ S = (0, u._)("Select all matches");
1561
+ }
1562
+ if (Ae === 0 && Je) {
1563
+ Ot.current = "selectAll";
1564
+ }
1565
+ c.unshift( t().createElement(pe, {
1566
+ key: "select-all-option",
1567
+ active: Ae === 0,
1568
+ changedToggle: !!me,
1569
+ elementRef: Ht,
1570
+ id: Ae === 0 ? ke : undefined,
1571
+ onClick: Pt.current === "all" ? It : Mt,
1572
+ selectAllLabel: S,
1573
+ selected: Pt.current === "all" || Pt.current !== "none" && "some",
1574
+ totalCount: Wt.length,
1575
+ tabIndex: -1
1576
+ }), t().createElement(T.Divider, {
1577
+ key: "selectAllDivider"
1578
+ }));
1579
+ }
1580
+ Ct.current = c.reduce((function(e, t) {
1581
+ if (nt(t)) {
1582
+ e.push(t.props.value);
1583
+ }
1584
+ return e;
1585
+ }), []);
1586
+ ut = c.some((function(e) {
1587
+ return nt(e);
1588
+ }));
1589
+ return c;
1590
+ }), [ Ae, ke, o, s, f, Wt, C, Ve, Ht, It, Dt, Vt, zt, Mt, L, H, Xt, X, ue, Je, me ]);
1591
+ var Qt = function e(n) {
1592
+ var r = n.anchorWidth, o = n.maxHeight, a = n.placement;
1593
+ var i = et({
1714
1594
  anchorWidth: r,
1715
- isMultiple: N,
1595
+ isMultiple: H,
1716
1596
  maxHeight: o,
1717
- menuStyle: D
1597
+ menuStyle: F
1718
1598
  });
1719
- var u = Jt.length > 0 && !Gt && !w ? 0 : undefined;
1599
+ var u = Wt.length > 0 && !Jt && !C ? 0 : undefined;
1720
1600
  var c = {
1721
- "aria-multiselectable": N || undefined,
1722
- childrenStart: !!w && t().createElement(bt, {
1723
- activeItemId: ge,
1724
- filterKeyword: Ee,
1725
- hasChildren: mt,
1601
+ "aria-multiselectable": H || undefined,
1602
+ childrenStart: !!C && t().createElement(it, {
1603
+ activeItemId: ke,
1604
+ filterKeyword: Ve,
1605
+ hasChildren: ut,
1726
1606
  inputId: E,
1727
- inputRef: P,
1728
- menuListboxId: Oe,
1729
- multiple: N,
1730
- onClearAll: qt,
1731
- onSelectAll: Vt,
1732
- onTextBlur: zt,
1733
- onTextChange: Ft,
1734
- onTextFocus: Ht,
1735
- onTextKeyDown: Dt,
1736
- optionSelection: St,
1737
- placement: l,
1738
- selectAllAppearance: le,
1739
- textHasFocus: qe
1607
+ inputRef: _,
1608
+ menuListboxId: je,
1609
+ multiple: H,
1610
+ onClearAll: It,
1611
+ onSelectAll: Mt,
1612
+ onTextBlur: Ft,
1613
+ onTextChange: Nt,
1614
+ onTextFocus: Kt,
1615
+ onTextKeyDown: Bt,
1616
+ optionSelection: Pt,
1617
+ placement: a,
1618
+ selectAllAppearance: ue,
1619
+ textHasFocus: Je
1740
1620
  }),
1741
- focusMode: w ? "never" : undefined,
1742
- isLoading: A,
1743
- menuId: Oe,
1744
- onScrollBottom: W ? Bt : undefined,
1745
- placement: l !== null && l !== void 0 ? l : undefined,
1746
- noOptionsMessage: H,
1747
- footerMessage: C,
1748
- animateLoading: a,
1749
- loadingMessage: R,
1750
- onScroll: $,
1621
+ focusMode: C ? "never" : undefined,
1622
+ isLoading: L,
1623
+ menuId: je,
1624
+ onScrollBottom: X ? qt : undefined,
1625
+ placement: a !== null && a !== void 0 ? a : undefined,
1626
+ noOptionsMessage: W,
1627
+ footerMessage: x,
1628
+ animateLoading: l,
1629
+ loadingMessage: N,
1630
+ onScroll: J,
1751
1631
  style: i,
1752
1632
  tabIndex: u
1753
1633
  };
1754
- if (se) {
1634
+ if (be) {
1755
1635
 
1756
- return t().createElement(T.VirtualizedResultsMenu, $e({
1757
- virtualization: se
1758
- }, c), t().createElement(yt, Yt));
1636
+ return t().createElement(R.VirtualizedResultsMenu, Be({
1637
+ virtualization: be
1638
+ }, c), Gt);
1759
1639
  }
1760
1640
 
1761
- return t().createElement(I(), c, t().createElement(yt, Yt));
1641
+ return t().createElement(A(), c, Gt);
1762
1642
  };
1763
1643
 
1764
1644
  return t().createElement(j(), {
1765
- closeReasons: ct,
1645
+ closeReasons: tt,
1766
1646
  inputId: E,
1767
- toggle: t().createElement(gt, $e({
1768
- appearance: u,
1647
+ toggle: t().createElement(st, Be({
1648
+ appearance: i,
1769
1649
  append: c,
1770
- currentValues: Tt(),
1771
- "data-test": N ? "multiselect" : "select",
1772
- describedBy: y,
1773
- disabled: h,
1774
- elementRef: g,
1775
- error: O,
1776
- inline: x,
1777
- labelText: M,
1778
- labelledBy: _,
1779
- multiple: N,
1780
- onClick: J,
1781
- placeholder: Z,
1782
- prefixLabel: ee,
1783
- prepend: te,
1784
- required: Q,
1785
- suffixLabel: ie,
1786
- toggle: fe,
1787
- toggleContent: de
1788
- }, ve), f),
1789
- onRequestOpen: _t,
1790
- onRequestClose: Mt,
1791
- open: Ie,
1650
+ currentValues: Et(),
1651
+ "data-test": H ? "multiselect" : "select",
1652
+ describedBy: h,
1653
+ disabled: g,
1654
+ elementRef: O,
1655
+ error: S,
1656
+ inline: P,
1657
+ labelText: V,
1658
+ labelledBy: M,
1659
+ multiple: H,
1660
+ onClick: Q,
1661
+ placeholder: ne,
1662
+ prefixLabel: re,
1663
+ prepend: oe,
1664
+ required: ee,
1665
+ suffixLabel: fe,
1666
+ toggle: me,
1667
+ toggleContent: he
1668
+ }, ge), f),
1669
+ onRequestOpen: Rt,
1670
+ onRequestClose: At,
1671
+ open: He,
1792
1672
  openWithArrowKeys: true,
1793
- repositionMode: re,
1794
- defaultPlacement: w ? v : undefined,
1795
- canCoverAnchor: Ne().innerHeight < 500,
1796
- ref: Ut,
1673
+ repositionMode: ae,
1674
+ defaultPlacement: C ? b : undefined,
1675
+ canCoverAnchor: _e().innerHeight < 500,
1676
+ ref: $t,
1797
1677
  retainFocus: false,
1798
- takeFocus: Jt.length === 0 || Jt.length > 0 && !Gt || !!w
1799
- }, Zt);
1800
- }
1801
- Ot.propTypes = at;
1802
- Ot.componentType = "SelectBase";
1803
- Ot.Option = he;
1804
- Ot.Divider = A.Divider;
1805
- Ot.Heading = A.Heading;
1806
- /* harmony default export */ const wt = Ot;
1678
+ takeFocus: Wt.length === 0 || Wt.length > 0 && !Jt || !!C
1679
+ }, Qt);
1680
+ }
1681
+ ft.propTypes = Ye;
1682
+ ft.componentType = "SelectBase";
1683
+ ft.Option = ce;
1684
+ ft.Divider = T.Divider;
1685
+ ft.Heading = T.Heading;
1686
+ /* harmony default export */ const pt = ft;
1687
+ // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
1688
+ /**
1689
+ * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
1690
+ *
1691
+ * @param ref - The React callback or object ref. Can be `null` or `undefined`.
1692
+ * @param current - The new value of the ref.
1693
+ */
1694
+ function dt(e, t) {
1695
+ if (e) {
1696
+ if (typeof e === "function") {
1697
+ e(t);
1698
+ } else {
1699
+ // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
1700
+ // the intention here is to signal "we will take care of setting 'current', not you".
1701
+ e.current = t;
1702
+ // eslint-disable-line no-param-reassign
1703
+ }
1704
+ }
1705
+ }
1807
1706
  // CONCATENATED MODULE: ./src/Select/Option.tsx
1808
- function St(e) {
1707
+ function vt(e) {
1809
1708
  "@babel/helpers - typeof";
1810
- return St = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
1709
+ return vt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
1811
1710
  return typeof e;
1812
1711
  } : function(e) {
1813
1712
  return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
1814
- }, St(e);
1713
+ }, vt(e);
1815
1714
  }
1816
- function Ct() {
1817
- return Ct = Object.assign ? Object.assign.bind() : function(e) {
1715
+ function bt() {
1716
+ return bt = Object.assign ? Object.assign.bind() : function(e) {
1818
1717
  for (var t = 1; t < arguments.length; t++) {
1819
1718
  var n = arguments[t];
1820
1719
  for (var r in n) {
@@ -1822,24 +1721,24 @@
1822
1721
  }
1823
1722
  }
1824
1723
  return e;
1825
- }, Ct.apply(null, arguments);
1724
+ }, bt.apply(null, arguments);
1826
1725
  }
1827
- function kt(e, t) {
1726
+ function mt(e, t) {
1828
1727
  if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
1829
1728
  }
1830
- function xt(e, t) {
1729
+ function yt(e, t) {
1831
1730
  for (var n = 0; n < t.length; n++) {
1832
1731
  var r = t[n];
1833
1732
  r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
1834
- Object.defineProperty(e, Lt(r.key), r);
1733
+ Object.defineProperty(e, Pt(r.key), r);
1835
1734
  }
1836
1735
  }
1837
- function jt(e, t, n) {
1838
- return t && xt(e.prototype, t), n && xt(e, n), Object.defineProperty(e, "prototype", {
1736
+ function ht(e, t, n) {
1737
+ return t && yt(e.prototype, t), n && yt(e, n), Object.defineProperty(e, "prototype", {
1839
1738
  writable: !1
1840
1739
  }), e;
1841
1740
  }
1842
- function Et(e, t) {
1741
+ function gt(e, t) {
1843
1742
  if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
1844
1743
  e.prototype = Object.create(t && t.prototype, {
1845
1744
  constructor: {
@@ -1849,75 +1748,76 @@
1849
1748
  }
1850
1749
  }), Object.defineProperty(e, "prototype", {
1851
1750
  writable: !1
1852
- }), t && Pt(e, t);
1751
+ }), t && Ot(e, t);
1853
1752
  }
1854
- function Pt(e, t) {
1855
- return Pt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
1753
+ function Ot(e, t) {
1754
+ return Ot = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
1856
1755
  return e.__proto__ = t, e;
1857
- }, Pt(e, t);
1756
+ }, Ot(e, t);
1858
1757
  }
1859
- function At(e) {
1860
- var t = _t();
1758
+ function St(e) {
1759
+ var t = kt();
1861
1760
  return function() {
1862
- var n, r = Mt(e);
1761
+ var n, r = xt(e);
1863
1762
  if (t) {
1864
- var o = Mt(this).constructor;
1763
+ var o = xt(this).constructor;
1865
1764
  n = Reflect.construct(r, arguments, o);
1866
1765
  } else n = r.apply(this, arguments);
1867
- return Tt(this, n);
1766
+ return wt(this, n);
1868
1767
  };
1869
1768
  }
1870
- function Tt(e, t) {
1871
- if (t && ("object" == St(t) || "function" == typeof t)) return t;
1769
+ function wt(e, t) {
1770
+ if (t && ("object" == vt(t) || "function" == typeof t)) return t;
1872
1771
  if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
1873
- return It(e);
1772
+ return Ct(e);
1874
1773
  }
1875
- function It(e) {
1774
+ function Ct(e) {
1876
1775
  if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1877
1776
  return e;
1878
1777
  }
1879
- function _t() {
1778
+ function kt() {
1880
1779
  try {
1881
1780
  var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
1882
1781
  } catch (e) {}
1883
- return (_t = function t() {
1782
+ return (kt = function t() {
1884
1783
  return !!e;
1885
1784
  })();
1886
1785
  }
1887
- function Mt(e) {
1888
- return Mt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
1786
+ function xt(e) {
1787
+ return xt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
1889
1788
  return e.__proto__ || Object.getPrototypeOf(e);
1890
- }, Mt(e);
1789
+ }, xt(e);
1891
1790
  }
1892
- function Rt(e, t, n) {
1893
- return (t = Lt(t)) in e ? Object.defineProperty(e, t, {
1791
+ function jt(e, t, n) {
1792
+ return (t = Pt(t)) in e ? Object.defineProperty(e, t, {
1894
1793
  value: n,
1895
1794
  enumerable: !0,
1896
1795
  configurable: !0,
1897
1796
  writable: !0
1898
1797
  }) : e[t] = n, e;
1899
1798
  }
1900
- function Lt(e) {
1901
- var t = Vt(e, "string");
1902
- return "symbol" == St(t) ? t : t + "";
1799
+ function Pt(e) {
1800
+ var t = Et(e, "string");
1801
+ return "symbol" == vt(t) ? t : t + "";
1903
1802
  }
1904
- function Vt(e, t) {
1905
- if ("object" != St(e) || !e) return e;
1803
+ function Et(e, t) {
1804
+ if ("object" != vt(e) || !e) return e;
1906
1805
  var n = e[Symbol.toPrimitive];
1907
1806
  if (void 0 !== n) {
1908
1807
  var r = n.call(e, t || "default");
1909
- if ("object" != St(r)) return r;
1808
+ if ("object" != vt(r)) return r;
1910
1809
  throw new TypeError("@@toPrimitive must return a primitive value.");
1911
1810
  }
1912
1811
  return ("string" === t ? String : Number)(e);
1913
1812
  }
1914
- var qt = {
1813
+ var Tt = {
1915
1814
  /** @private */
1916
1815
  active: l().bool,
1917
1816
  children: l().node,
1918
1817
  description: l().string,
1919
1818
  descriptionPosition: l().oneOf([ "right", "bottom" ]),
1920
1819
  disabled: l().bool,
1820
+ elementRef: l().oneOfType([ l().func, l().object ]),
1921
1821
  hidden: l().bool,
1922
1822
  icon: l().node,
1923
1823
  label: l().string.isRequired,
@@ -1934,7 +1834,7 @@
1934
1834
  truncate: l().bool,
1935
1835
  value: l().oneOfType([ l().string, l().number, l().bool ]).isRequired
1936
1836
  };
1937
- var Bt = {
1837
+ var Rt = {
1938
1838
  active: false,
1939
1839
  descriptionPosition: "bottom",
1940
1840
  disabled: false,
@@ -1946,29 +1846,29 @@
1946
1846
  * An option within a `Select`. This inherits from
1947
1847
  * [PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent)
1948
1848
  * so any elements passed to it must also be pure.
1949
- */ var Dt = function(e) {
1950
- Et(r, e);
1951
- var n = At(r);
1849
+ */ var At = function(e) {
1850
+ gt(r, e);
1851
+ var n = St(r);
1952
1852
  function r() {
1953
1853
  var e;
1954
- kt(this, r);
1955
- for (var t = arguments.length, o = new Array(t), l = 0; l < t; l++) {
1956
- o[l] = arguments[l];
1957
- }
1958
- e = n.call.apply(n, [ this ].concat(o));
1959
- Rt(It(e), "c", null);
1960
- Rt(It(e), "handleMount", (function(t) {
1961
- e.c = t;
1854
+ mt(this, r);
1855
+ for (var o = arguments.length, l = new Array(o), a = 0; a < o; a++) {
1856
+ l[a] = arguments[a];
1857
+ }
1858
+ e = n.call.apply(n, [ this ].concat(l));
1859
+ jt(Ct(e), "optionBaseRef", t().createRef());
1860
+ jt(Ct(e), "handleMount", (function(t) {
1861
+ dt(e.props.elementRef, t);
1862
+ dt(e.optionBaseRef, t);
1962
1863
  }));
1963
1864
  return e;
1964
1865
  }
1965
1866
  // @docs-props-type OptionPropsBase
1966
- jt(r, [ {
1867
+ ht(r, [ {
1967
1868
  key: "scrollIntoViewIfNeeded",
1968
1869
  // eslint-disable-next-line react/no-unused-class-component-methods
1969
1870
  value: function e() {
1970
- var t;
1971
- (t = this.c) === null || t === void 0 ? void 0 : t.scrollIntoViewIfNeeded();
1871
+ Ee(this.optionBaseRef.current);
1972
1872
  }
1973
1873
  /**
1974
1874
  * Place focus on the button.
@@ -1977,35 +1877,35 @@
1977
1877
  }, {
1978
1878
  key: "focus",
1979
1879
  value: function e() {
1980
- var t;
1981
- (t = this.c) === null || t === void 0 ? void 0 : t.focus();
1880
+ var t, n;
1881
+ (t = this.optionBaseRef) === null || t === void 0 ? void 0 : (n = t.current) === null || n === void 0 ? void 0 : n.focus();
1982
1882
  }
1983
1883
  }, {
1984
1884
  key: "render",
1985
1885
  value: function e() {
1986
1886
 
1987
- return t().createElement(he, Ct({}, this.props, {
1988
- multiple: false,
1989
- ref: this.handleMount
1887
+ return t().createElement(ce, bt({}, this.props, {
1888
+ elementRef: this.handleMount,
1889
+ multiple: false
1990
1890
  }), this.props.children || this.props.label);
1991
1891
  }
1992
1892
  } ]);
1993
1893
  return r;
1994
1894
  }(e.PureComponent);
1995
- Rt(Dt, "propTypes", qt);
1996
- Rt(Dt, "defaultProps", Bt);
1997
- /* harmony default export */ const Nt = Dt;
1895
+ jt(At, "propTypes", Tt);
1896
+ jt(At, "defaultProps", Rt);
1897
+ /* harmony default export */ const _t = At;
1998
1898
  // CONCATENATED MODULE: ./src/Select/Select.tsx
1999
- function Kt(e) {
1899
+ function Lt(e) {
2000
1900
  "@babel/helpers - typeof";
2001
- return Kt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
1901
+ return Lt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
2002
1902
  return typeof e;
2003
1903
  } : function(e) {
2004
1904
  return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
2005
- }, Kt(e);
1905
+ }, Lt(e);
2006
1906
  }
2007
- function Ft() {
2008
- return Ft = Object.assign ? Object.assign.bind() : function(e) {
1907
+ function Mt() {
1908
+ return Mt = Object.assign ? Object.assign.bind() : function(e) {
2009
1909
  for (var t = 1; t < arguments.length; t++) {
2010
1910
  var n = arguments[t];
2011
1911
  for (var r in n) {
@@ -2013,11 +1913,11 @@
2013
1913
  }
2014
1914
  }
2015
1915
  return e;
2016
- }, Ft.apply(null, arguments);
1916
+ }, Mt.apply(null, arguments);
2017
1917
  }
2018
- function Ht(e, t) {
1918
+ function It(e, t) {
2019
1919
  if (null == e) return {};
2020
- var n, r, o = zt(e, t);
1920
+ var n, r, o = qt(e, t);
2021
1921
  if (Object.getOwnPropertySymbols) {
2022
1922
  var l = Object.getOwnPropertySymbols(e);
2023
1923
  for (r = 0; r < l.length; r++) {
@@ -2026,7 +1926,7 @@
2026
1926
  }
2027
1927
  return o;
2028
1928
  }
2029
- function zt(e, t) {
1929
+ function qt(e, t) {
2030
1930
  if (null == e) return {};
2031
1931
  var n = {};
2032
1932
  for (var r in e) {
@@ -2037,22 +1937,22 @@
2037
1937
  }
2038
1938
  return n;
2039
1939
  }
2040
- function $t(e, t) {
1940
+ function Bt(e, t) {
2041
1941
  if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
2042
1942
  }
2043
- function Wt(e, t) {
1943
+ function Dt(e, t) {
2044
1944
  for (var n = 0; n < t.length; n++) {
2045
1945
  var r = t[n];
2046
1946
  r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
2047
- Object.defineProperty(e, nn(r.key), r);
1947
+ Object.defineProperty(e, Jt(r.key), r);
2048
1948
  }
2049
1949
  }
2050
- function Ut(e, t, n) {
2051
- return t && Wt(e.prototype, t), n && Wt(e, n), Object.defineProperty(e, "prototype", {
1950
+ function Vt(e, t, n) {
1951
+ return t && Dt(e.prototype, t), n && Dt(e, n), Object.defineProperty(e, "prototype", {
2052
1952
  writable: !1
2053
1953
  }), e;
2054
1954
  }
2055
- function Jt(e, t) {
1955
+ function Nt(e, t) {
2056
1956
  if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
2057
1957
  e.prototype = Object.create(t && t.prototype, {
2058
1958
  constructor: {
@@ -2062,64 +1962,64 @@
2062
1962
  }
2063
1963
  }), Object.defineProperty(e, "prototype", {
2064
1964
  writable: !1
2065
- }), t && Xt(e, t);
1965
+ }), t && Kt(e, t);
2066
1966
  }
2067
- function Xt(e, t) {
2068
- return Xt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
1967
+ function Kt(e, t) {
1968
+ return Kt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
2069
1969
  return e.__proto__ = t, e;
2070
- }, Xt(e, t);
1970
+ }, Kt(e, t);
2071
1971
  }
2072
- function Gt(e) {
2073
- var t = Zt();
1972
+ function Ft(e) {
1973
+ var t = $t();
2074
1974
  return function() {
2075
- var n, r = en(e);
1975
+ var n, r = Wt(e);
2076
1976
  if (t) {
2077
- var o = en(this).constructor;
1977
+ var o = Wt(this).constructor;
2078
1978
  n = Reflect.construct(r, arguments, o);
2079
1979
  } else n = r.apply(this, arguments);
2080
- return Qt(this, n);
1980
+ return Ht(this, n);
2081
1981
  };
2082
1982
  }
2083
- function Qt(e, t) {
2084
- if (t && ("object" == Kt(t) || "function" == typeof t)) return t;
1983
+ function Ht(e, t) {
1984
+ if (t && ("object" == Lt(t) || "function" == typeof t)) return t;
2085
1985
  if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
2086
- return Yt(e);
1986
+ return zt(e);
2087
1987
  }
2088
- function Yt(e) {
1988
+ function zt(e) {
2089
1989
  if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2090
1990
  return e;
2091
1991
  }
2092
- function Zt() {
1992
+ function $t() {
2093
1993
  try {
2094
1994
  var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
2095
1995
  } catch (e) {}
2096
- return (Zt = function t() {
1996
+ return ($t = function t() {
2097
1997
  return !!e;
2098
1998
  })();
2099
1999
  }
2100
- function en(e) {
2101
- return en = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
2000
+ function Wt(e) {
2001
+ return Wt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
2102
2002
  return e.__proto__ || Object.getPrototypeOf(e);
2103
- }, en(e);
2003
+ }, Wt(e);
2104
2004
  }
2105
- function tn(e, t, n) {
2106
- return (t = nn(t)) in e ? Object.defineProperty(e, t, {
2005
+ function Ut(e, t, n) {
2006
+ return (t = Jt(t)) in e ? Object.defineProperty(e, t, {
2107
2007
  value: n,
2108
2008
  enumerable: !0,
2109
2009
  configurable: !0,
2110
2010
  writable: !0
2111
2011
  }) : e[t] = n, e;
2112
2012
  }
2113
- function nn(e) {
2114
- var t = rn(e, "string");
2115
- return "symbol" == Kt(t) ? t : t + "";
2013
+ function Jt(e) {
2014
+ var t = Xt(e, "string");
2015
+ return "symbol" == Lt(t) ? t : t + "";
2116
2016
  }
2117
- function rn(e, t) {
2118
- if ("object" != Kt(e) || !e) return e;
2017
+ function Xt(e, t) {
2018
+ if ("object" != Lt(e) || !e) return e;
2119
2019
  var n = e[Symbol.toPrimitive];
2120
2020
  if (void 0 !== n) {
2121
2021
  var r = n.call(e, t || "default");
2122
- if ("object" != Kt(r)) return r;
2022
+ if ("object" != Lt(r)) return r;
2123
2023
  throw new TypeError("@@toPrimitive must return a primitive value.");
2124
2024
  }
2125
2025
  return ("string" === t ? String : Number)(e);
@@ -2127,7 +2027,7 @@
2127
2027
  /* eslint-disable max-classes-per-file */
2128
2028
  /** @public */
2129
2029
  /** @public */
2130
- /** @public */ var on = {
2030
+ /** @public */ var Gt = {
2131
2031
  allowKeyMatching: l().bool,
2132
2032
  animateLoading: l().bool,
2133
2033
  appearance: l().oneOf([ "default", "link", "primary", "pill", "toggle", "flat", "subtle" ]),
@@ -2168,7 +2068,7 @@
2168
2068
  /** @private. */
2169
2069
  virtualization: l().number
2170
2070
  };
2171
- var ln = {
2071
+ var Qt = {
2172
2072
  allowKeyMatching: true,
2173
2073
  animateLoading: false,
2174
2074
  appearance: "toggle",
@@ -2186,13 +2086,13 @@
2186
2086
  prepend: false,
2187
2087
  toggleContent: "optionChildren"
2188
2088
  };
2189
- var an = function(e) {
2190
- Jt(r, e);
2191
- var n = Gt(r);
2089
+ var Yt = function(e) {
2090
+ Nt(r, e);
2091
+ var n = Ft(r);
2192
2092
  // @docs-props-type SelectPropsBase
2193
2093
  function r(e) {
2194
2094
  var t;
2195
- $t(this, r);
2095
+ Bt(this, r);
2196
2096
  t = n.call(this, e);
2197
2097
  var o = {};
2198
2098
  // wrap defaultValue in an array once to avoid failing <SelectBase>'s defaultValues comparison check
@@ -2210,7 +2110,7 @@
2210
2110
  if (false) {}
2211
2111
  return t;
2212
2112
  }
2213
- Ut(r, [ {
2113
+ Vt(r, [ {
2214
2114
  key: "componentDidUpdate",
2215
2115
  value: function e(t) {
2216
2116
  if (false) {}
@@ -2218,7 +2118,7 @@
2218
2118
  }, {
2219
2119
  key: "render",
2220
2120
  value: function e() {
2221
- var n = this.props, r = n.defaultValue, o = n.onChange, l = n.value, a = Ht(n, [ "defaultValue", "onChange", "value" ]);
2121
+ var n = this.props, r = n.defaultValue, o = n.onChange, l = n.value, a = It(n, [ "defaultValue", "onChange", "value" ]);
2222
2122
  var u = {
2223
2123
  onChange: function e(t, n) {
2224
2124
  var r = n.name, l = n.values;
@@ -2240,19 +2140,19 @@
2240
2140
  u.defaultValues = this.state.defaultValues;
2241
2141
  }
2242
2142
 
2243
- return t().createElement(wt, Ft({}, a, u, {
2143
+ return t().createElement(pt, Mt({}, a, u, {
2244
2144
  multiple: false
2245
2145
  }));
2246
2146
  }
2247
2147
  } ]);
2248
2148
  return r;
2249
2149
  }(e.Component);
2250
- tn(an, "propTypes", on);
2251
- tn(an, "defaultProps", ln);
2252
- tn(an, "Option", Nt);
2253
- tn(an, "Heading", A.Heading);
2254
- tn(an, "Divider", A.Divider);
2255
- /* harmony default export */ const un = an;
2150
+ Ut(Yt, "propTypes", Gt);
2151
+ Ut(Yt, "defaultProps", Qt);
2152
+ Ut(Yt, "Option", _t);
2153
+ Ut(Yt, "Heading", T.Heading);
2154
+ Ut(Yt, "Divider", T.Divider);
2155
+ /* harmony default export */ const Zt = Yt;
2256
2156
  }) // CONCATENATED MODULE: ./src/Select/index.ts
2257
2157
  ();
2258
2158
  module.exports = r;