@splunk/react-ui 5.4.0 → 5.6.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 (89) hide show
  1. package/AnchorMenu.d.ts +2 -0
  2. package/AnchorMenu.js +286 -0
  3. package/Badge.d.ts +2 -0
  4. package/Badge.js +154 -0
  5. package/CHANGELOG.md +42 -0
  6. package/Code.js +1097 -500
  7. package/Color.js +142 -141
  8. package/ComboBox.js +6 -5
  9. package/Link.js +74 -44
  10. package/MIGRATION.md +32 -1
  11. package/Menu.js +41 -43
  12. package/Multiselect.js +615 -2156
  13. package/Number.js +3 -3
  14. package/PhoneNumber.d.ts +2 -0
  15. package/PhoneNumber.js +769 -0
  16. package/Popover.js +73 -75
  17. package/RadioList.js +166 -151
  18. package/ResultsMenu.js +27 -29
  19. package/Select.js +179 -1768
  20. package/SelectBase.d.ts +2 -0
  21. package/SelectBase.js +1714 -0
  22. package/Slider.js +358 -302
  23. package/SlidingPanels.js +55 -62
  24. package/Switch.js +42 -27
  25. package/TabBar.js +295 -294
  26. package/TabLayout.js +14 -14
  27. package/Table.js +1087 -1040
  28. package/TransitionOpen.js +65 -58
  29. package/cypress/support/commands.ts +40 -0
  30. package/cypress/support/component.ts +1 -1
  31. package/cypress/support/index.d.ts +22 -0
  32. package/docker-compose.yml +99 -52
  33. package/package.json +9 -5
  34. package/stubs-splunkui.d.ts +0 -86
  35. package/test-runner-jest.config.js +1 -0
  36. package/types/src/AnchorMenu/AnchorMenu.d.ts +36 -0
  37. package/types/src/AnchorMenu/AnchorMenuContext.d.ts +6 -0
  38. package/types/src/AnchorMenu/Item.d.ts +35 -0
  39. package/types/src/AnchorMenu/docs/examples/Basic.d.ts +6 -0
  40. package/types/src/AnchorMenu/index.d.ts +3 -0
  41. package/types/src/Badge/Badge.d.ts +29 -0
  42. package/types/src/Badge/docs/examples/Basic.d.ts +5 -0
  43. package/types/src/Badge/docs/examples/Count.d.ts +6 -0
  44. package/types/src/Badge/docs/examples/CustomColors.d.ts +8 -0
  45. package/types/src/Badge/docs/examples/Icon.d.ts +6 -0
  46. package/types/src/Badge/index.d.ts +2 -0
  47. package/types/src/Code/Code.d.ts +4 -3
  48. package/types/src/Code/index.d.ts +1 -0
  49. package/types/src/Link/Link.d.ts +4 -0
  50. package/types/src/Link/LinkContext.d.ts +14 -0
  51. package/types/src/Link/docs/examples/Visited.d.ts +7 -0
  52. package/types/src/Link/index.d.ts +1 -0
  53. package/types/src/Menu/Item.d.ts +1 -1
  54. package/types/src/Multiselect/Compact.d.ts +8 -1
  55. package/types/src/Multiselect/Multiselect.d.ts +8 -1
  56. package/types/src/PhoneNumber/PhoneNumber.d.ts +139 -0
  57. package/types/src/PhoneNumber/docs/examples/Controlled.d.ts +7 -0
  58. package/types/src/PhoneNumber/docs/examples/DefaultCountry.d.ts +7 -0
  59. package/types/src/PhoneNumber/docs/examples/Disabled.d.ts +6 -0
  60. package/types/src/PhoneNumber/docs/examples/Error.d.ts +6 -0
  61. package/types/src/PhoneNumber/docs/examples/Inline.d.ts +7 -0
  62. package/types/src/PhoneNumber/docs/examples/Uncontrolled.d.ts +7 -0
  63. package/types/src/PhoneNumber/index.d.ts +2 -0
  64. package/types/src/PhoneNumber/utils.d.ts +47 -0
  65. package/types/src/RadioList/Option.d.ts +6 -1
  66. package/types/src/RadioList/docs/examples/Description.d.ts +6 -0
  67. package/types/src/Select/Option.d.ts +8 -3
  68. package/types/src/Select/Select.d.ts +1 -1
  69. package/types/src/{Select → SelectBase}/OptionBase.d.ts +8 -2
  70. package/types/src/{Select → SelectBase}/SelectBase.d.ts +11 -2
  71. package/types/src/SelectBase/index.d.ts +2 -0
  72. package/types/src/Slider/Slider.d.ts +7 -1
  73. package/types/src/Switch/Switch.d.ts +4 -1
  74. package/types/src/Table/Body.d.ts +6 -1
  75. package/types/src/Table/Cell.d.ts +5 -1
  76. package/types/src/Table/Head.d.ts +6 -2
  77. package/types/src/Table/HeadCell.d.ts +5 -1
  78. package/types/src/Table/Row.d.ts +5 -1
  79. package/types/src/Table/Table.d.ts +20 -1
  80. package/types/src/Table/TableContext.d.ts +1 -0
  81. package/types/src/Table/docs/examples/HorizontalOverflowScroll.d.ts +8 -0
  82. package/types/src/Table/docs/examples/PinActionColumn.d.ts +7 -0
  83. package/types/src/TransitionOpen/TransitionOpen.d.ts +3 -1
  84. package/types/src/useResizeObserver/useResizeObserver.d.ts +2 -0
  85. package/types/src/useRovingFocus/useRovingFocus.d.ts +8 -1
  86. package/usePrevious.d.ts +2 -0
  87. package/useResizeObserver.js +59 -92
  88. package/useRovingFocus.js +96 -41
  89. /package/types/src/{Select → SelectBase}/SelectAllOption.d.ts +0 -0
package/SelectBase.js ADDED
@@ -0,0 +1,1714 @@
1
+ /******/ (() => {
2
+ // webpackBootstrap
3
+ /******/ "use strict";
4
+ /******/ // The require scope
5
+ /******/ var e = {};
6
+ /******/
7
+ /************************************************************************/
8
+ /******/ /* webpack/runtime/compat get default export */
9
+ /******/ (() => {
10
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
11
+ /******/ e.n = r => {
12
+ /******/ var t = r && r.__esModule ?
13
+ /******/ () => r["default"]
14
+ /******/ : () => r
15
+ /******/;
16
+ e.d(t, {
17
+ a: t
18
+ });
19
+ /******/ return t;
20
+ /******/ };
21
+ /******/ })();
22
+ /******/
23
+ /******/ /* webpack/runtime/define property getters */
24
+ /******/ (() => {
25
+ /******/ // define getter functions for harmony exports
26
+ /******/ e.d = (r, t) => {
27
+ /******/ for (var n in t) {
28
+ /******/ if (e.o(t, n) && !e.o(r, n)) {
29
+ /******/ Object.defineProperty(r, n, {
30
+ enumerable: true,
31
+ get: t[n]
32
+ });
33
+ /******/ }
34
+ /******/ }
35
+ /******/ };
36
+ /******/ })();
37
+ /******/
38
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
39
+ /******/ (() => {
40
+ /******/ e.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
41
+ /******/;
42
+ })();
43
+ /******/
44
+ /******/ /* webpack/runtime/make namespace object */
45
+ /******/ (() => {
46
+ /******/ // define __esModule on exports
47
+ /******/ e.r = e => {
48
+ /******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
49
+ /******/ Object.defineProperty(e, Symbol.toStringTag, {
50
+ value: "Module"
51
+ });
52
+ /******/ }
53
+ /******/ Object.defineProperty(e, "__esModule", {
54
+ value: true
55
+ });
56
+ /******/ };
57
+ /******/ })();
58
+ /******/
59
+ /************************************************************************/ var r = {};
60
+ // ESM COMPAT FLAG
61
+ e.r(r);
62
+ // EXPORTS
63
+ e.d(r, {
64
+ Controls: () => /* reexport */ sr,
65
+ Divider: () => /* reexport */ w.Divider,
66
+ Heading: () => /* reexport */ w.Heading,
67
+ Option: () => /* reexport */ U,
68
+ SelectAllOption: () => /* reexport */ oe,
69
+ default: () => /* reexport */ mr,
70
+ isOption: () => /* reexport */ tr
71
+ });
72
+ // CONCATENATED MODULE: external "react"
73
+ const t = require("react");
74
+ var n = e.n(t);
75
+ // CONCATENATED MODULE: external "lodash/castArray"
76
+ const l = require("lodash/castArray");
77
+ var a = e.n(l);
78
+ // CONCATENATED MODULE: external "lodash/has"
79
+ const o = require("lodash/has");
80
+ var i = e.n(o);
81
+ // CONCATENATED MODULE: external "lodash/memoize"
82
+ const u = require("lodash/memoize");
83
+ var c = e.n(u);
84
+ // CONCATENATED MODULE: external "lodash/pick"
85
+ const s = require("lodash/pick");
86
+ var f = e.n(s);
87
+ // CONCATENATED MODULE: external "prop-types"
88
+ const d = require("prop-types");
89
+ var p = e.n(d);
90
+ // CONCATENATED MODULE: external "@splunk/react-icons/CaretSmallDown"
91
+ const v = require("@splunk/react-icons/CaretSmallDown");
92
+ var b = e.n(v);
93
+ // CONCATENATED MODULE: external "@splunk/react-icons/Magnifier"
94
+ const m = require("@splunk/react-icons/Magnifier");
95
+ var y = e.n(m);
96
+ // CONCATENATED MODULE: external "@splunk/react-ui/Dropdown"
97
+ const g = require("@splunk/react-ui/Dropdown");
98
+ var h = e.n(g);
99
+ // CONCATENATED MODULE: external "@splunk/react-ui/Link"
100
+ const S = require("@splunk/react-ui/Link");
101
+ var O = e.n(S);
102
+ // CONCATENATED MODULE: external "@splunk/react-ui/Menu"
103
+ const w = require("@splunk/react-ui/Menu");
104
+ // CONCATENATED MODULE: external "@splunk/react-ui/ResultsMenu"
105
+ const C = require("@splunk/react-ui/ResultsMenu");
106
+ var k = e.n(C);
107
+ // CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
108
+ const x = require("@splunk/react-ui/ScreenReaderContent");
109
+ var j = e.n(x);
110
+ // CONCATENATED MODULE: external "@splunk/react-ui/Text"
111
+ const P = require("@splunk/react-ui/Text");
112
+ var E = e.n(P);
113
+ // CONCATENATED MODULE: external "@splunk/react-ui/useControlled"
114
+ const A = require("@splunk/react-ui/useControlled");
115
+ var L = e.n(A);
116
+ // CONCATENATED MODULE: external "@splunk/react-ui/usePrevious"
117
+ const I = require("@splunk/react-ui/usePrevious");
118
+ var R = e.n(I);
119
+ // CONCATENATED MODULE: external "@splunk/ui-utils/filter"
120
+ const M = require("@splunk/ui-utils/filter");
121
+ // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
122
+ const q = require("@splunk/ui-utils/i18n");
123
+ // CONCATENATED MODULE: external "@splunk/ui-utils/id"
124
+ const T = require("@splunk/ui-utils/id");
125
+ // CONCATENATED MODULE: external "@splunk/ui-utils/scroll"
126
+ const D = require("@splunk/ui-utils/scroll");
127
+ // CONCATENATED MODULE: ./src/SelectBase/OptionBase.tsx
128
+ function _(e) {
129
+ "@babel/helpers - typeof";
130
+ return _ = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
131
+ return typeof e;
132
+ } : function(e) {
133
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
134
+ }, _(e);
135
+ }
136
+ function B() {
137
+ return B = Object.assign ? Object.assign.bind() : function(e) {
138
+ for (var r = 1; r < arguments.length; r++) {
139
+ var t = arguments[r];
140
+ for (var n in t) {
141
+ ({}).hasOwnProperty.call(t, n) && (e[n] = t[n]);
142
+ }
143
+ }
144
+ return e;
145
+ }, B.apply(null, arguments);
146
+ }
147
+ function N(e, r) {
148
+ var t = Object.keys(e);
149
+ if (Object.getOwnPropertySymbols) {
150
+ var n = Object.getOwnPropertySymbols(e);
151
+ r && (n = n.filter((function(r) {
152
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
153
+ }))), t.push.apply(t, n);
154
+ }
155
+ return t;
156
+ }
157
+ function V(e) {
158
+ for (var r = 1; r < arguments.length; r++) {
159
+ var t = null != arguments[r] ? arguments[r] : {};
160
+ r % 2 ? N(Object(t), !0).forEach((function(r) {
161
+ F(e, r, t[r]);
162
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : N(Object(t)).forEach((function(r) {
163
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
164
+ }));
165
+ }
166
+ return e;
167
+ }
168
+ function F(e, r, t) {
169
+ return (r = K(r)) in e ? Object.defineProperty(e, r, {
170
+ value: t,
171
+ enumerable: !0,
172
+ configurable: !0,
173
+ writable: !0
174
+ }) : e[r] = t, e;
175
+ }
176
+ function K(e) {
177
+ var r = H(e, "string");
178
+ return "symbol" == _(r) ? r : r + "";
179
+ }
180
+ function H(e, r) {
181
+ if ("object" != _(e) || !e) return e;
182
+ var t = e[Symbol.toPrimitive];
183
+ if (void 0 !== t) {
184
+ var n = t.call(e, r || "default");
185
+ if ("object" != _(n)) return n;
186
+ throw new TypeError("@@toPrimitive must return a primitive value.");
187
+ }
188
+ return ("string" === r ? String : Number)(e);
189
+ }
190
+ function z(e, r) {
191
+ if (null == e) return {};
192
+ var t, n, l = W(e, r);
193
+ if (Object.getOwnPropertySymbols) {
194
+ var a = Object.getOwnPropertySymbols(e);
195
+ for (n = 0; n < a.length; n++) {
196
+ t = a[n], -1 === r.indexOf(t) && {}.propertyIsEnumerable.call(e, t) && (l[t] = e[t]);
197
+ }
198
+ }
199
+ return l;
200
+ }
201
+ function W(e, r) {
202
+ if (null == e) return {};
203
+ var t = {};
204
+ for (var n in e) {
205
+ if ({}.hasOwnProperty.call(e, n)) {
206
+ if (-1 !== r.indexOf(n)) continue;
207
+ t[n] = e[n];
208
+ }
209
+ }
210
+ return t;
211
+ }
212
+ var $ = {
213
+ /** @private */
214
+ active: p().bool,
215
+ children: p().node,
216
+ description: p().string,
217
+ descriptionPosition: p().oneOf([ "right", "bottom" ]),
218
+ disabled: p().bool,
219
+ elementRef: p().oneOfType([ p().func, p().object ]),
220
+ endAdornment: p().node,
221
+ hidden: p().bool,
222
+ icon: p().node,
223
+ label: p().string.isRequired,
224
+ /**
225
+ * @private Passed down from <BaseSelect>
226
+ */
227
+ multiple: p().bool,
228
+ matchRanges: p().arrayOf(p().shape({
229
+ start: p().number.isRequired,
230
+ end: p().number.isRequired
231
+ })),
232
+ /** @private */
233
+ onClick: p().func,
234
+ /** @private */
235
+ role: p().oneOf([ "menuitemcheckbox", "option" ]),
236
+ /** @private */
237
+ selected: p().oneOfType([ p().bool, p().oneOf([ "some" ]) ]),
238
+ truncate: p().bool,
239
+ value: p().oneOfType([ p().string, p().number, p().bool ]).isRequired
240
+ };
241
+ /**
242
+ * An option within a `Multiselect`.
243
+ */ function X(e) {
244
+ var r = e.children, l = e.descriptionPosition, a = l === void 0 ? "bottom" : l, o = e.disabled, i = e.elementRef, u = e.endAdornment, c = e.icon, s = e.label, f = e.multiple, d = e.onClick, p = e.role, v = p === void 0 ? "option" : p, b = e.value, m = z(e, [ "children", "descriptionPosition", "disabled", "elementRef", "endAdornment", "icon", "label", "multiple", "onClick", "role", "value" ]);
245
+ // @docs-props-type OptionPropsBase
246
+ var y = (0, t.useCallback)((function(e) {
247
+ if (!o) {
248
+ d === null || d === void 0 ? void 0 : d(e, {
249
+ value: b
250
+ });
251
+ }
252
+ }), [ o, d, b ]);
253
+ var g = b.toString();
254
+ var h = V({
255
+ descriptionPosition: a,
256
+ disabled: o ? "disabled" : undefined
257
+ }, m);
258
+
259
+ return n().createElement(w.Item, B({
260
+ "data-test-value": b,
261
+ "data-test": "option",
262
+ elementRef: i,
263
+ endAdornment: u
264
+ }, h, {
265
+ selectable: true,
266
+ selectableAppearance: f ? "checkbox" : "checkmark",
267
+ startAdornment: c,
268
+ onClick: y,
269
+ role: v,
270
+ value: g
271
+ }), r || s);
272
+ }
273
+ X.propTypes = $;
274
+ X.type = w.Item;
275
+ // For components to distinguish if their children are Options or Headings/Dividers
276
+ /* harmony default export */ const U = X;
277
+ // CONCATENATED MODULE: ./src/SelectBase/SelectAllOption.tsx
278
+ function J(e) {
279
+ "@babel/helpers - typeof";
280
+ return J = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
281
+ return typeof e;
282
+ } : function(e) {
283
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
284
+ }, J(e);
285
+ }
286
+ function G() {
287
+ return G = Object.assign ? Object.assign.bind() : function(e) {
288
+ for (var r = 1; r < arguments.length; r++) {
289
+ var t = arguments[r];
290
+ for (var n in t) {
291
+ ({}).hasOwnProperty.call(t, n) && (e[n] = t[n]);
292
+ }
293
+ }
294
+ return e;
295
+ }, G.apply(null, arguments);
296
+ }
297
+ function Q(e, r) {
298
+ if (null == e) return {};
299
+ var t, n, l = Y(e, r);
300
+ if (Object.getOwnPropertySymbols) {
301
+ var a = Object.getOwnPropertySymbols(e);
302
+ for (n = 0; n < a.length; n++) {
303
+ t = a[n], -1 === r.indexOf(t) && {}.propertyIsEnumerable.call(e, t) && (l[t] = e[t]);
304
+ }
305
+ }
306
+ return l;
307
+ }
308
+ function Y(e, r) {
309
+ if (null == e) return {};
310
+ var t = {};
311
+ for (var n in e) {
312
+ if ({}.hasOwnProperty.call(e, n)) {
313
+ if (-1 !== r.indexOf(n)) continue;
314
+ t[n] = e[n];
315
+ }
316
+ }
317
+ return t;
318
+ }
319
+ function Z(e, r) {
320
+ var t = Object.keys(e);
321
+ if (Object.getOwnPropertySymbols) {
322
+ var n = Object.getOwnPropertySymbols(e);
323
+ r && (n = n.filter((function(r) {
324
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
325
+ }))), t.push.apply(t, n);
326
+ }
327
+ return t;
328
+ }
329
+ function ee(e) {
330
+ for (var r = 1; r < arguments.length; r++) {
331
+ var t = null != arguments[r] ? arguments[r] : {};
332
+ r % 2 ? Z(Object(t), !0).forEach((function(r) {
333
+ re(e, r, t[r]);
334
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Z(Object(t)).forEach((function(r) {
335
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
336
+ }));
337
+ }
338
+ return e;
339
+ }
340
+ function re(e, r, t) {
341
+ return (r = te(r)) in e ? Object.defineProperty(e, r, {
342
+ value: t,
343
+ enumerable: !0,
344
+ configurable: !0,
345
+ writable: !0
346
+ }) : e[r] = t, e;
347
+ }
348
+ function te(e) {
349
+ var r = ne(e, "string");
350
+ return "symbol" == J(r) ? r : r + "";
351
+ }
352
+ function ne(e, r) {
353
+ if ("object" != J(e) || !e) return e;
354
+ var t = e[Symbol.toPrimitive];
355
+ if (void 0 !== t) {
356
+ var n = t.call(e, r || "default");
357
+ if ("object" != J(n)) return n;
358
+ throw new TypeError("@@toPrimitive must return a primitive value.");
359
+ }
360
+ return ("string" === r ? String : Number)(e);
361
+ }
362
+ var le = ee(ee({}, U.propTypes), {}, {
363
+ totalCount: p().number,
364
+ // unlike OptionBase, there's a default value for this prop
365
+ value: p().string
366
+ });
367
+ function ae(e) {
368
+ var r = e.active, t = e.elementRef, l = e.id, a = e.label, o = e.onClick, i = e.selected, u = e.totalCount, c = e.value, s = c === void 0 ? "selectAll" : c, f = Q(e, [ "active", "elementRef", "id", "label", "onClick", "selected", "totalCount", "value" ]);
369
+ // @docs-props-type SelectAllOptionPropsBase
370
+ // When toggle is changed the total count is not displayed anymore so the count is now shown in the Select all menu item
371
+ var d = u != null ? " (".concat(u === null || u === void 0 ? void 0 : u.toString(), ")") : "";
372
+
373
+ return n().createElement(U, G({
374
+ active: r,
375
+ elementRef: t,
376
+ "aria-keyshortcuts": "Control+A",
377
+ "data-test": "select-all",
378
+ description: "".concat(d, " Ctrl-a"),
379
+ descriptionPosition: "right",
380
+ id: l,
381
+ key: "selectAll",
382
+ multiple: true,
383
+ label: a,
384
+ onClick: o,
385
+ selected: i,
386
+ role: "menuitemcheckbox",
387
+ value: s
388
+ }, f));
389
+ }
390
+ ae.propTypes = le;
391
+ /* harmony default export */ const oe = ae;
392
+ // CONCATENATED MODULE: external "styled-components"
393
+ const ie = require("styled-components");
394
+ var ue = e.n(ie);
395
+ // CONCATENATED MODULE: external "@splunk/react-ui/Button"
396
+ const ce = require("@splunk/react-ui/Button");
397
+ var se = e.n(ce);
398
+ // CONCATENATED MODULE: external "@splunk/react-ui/Divider"
399
+ const fe = require("@splunk/react-ui/Divider");
400
+ var de = e.n(fe);
401
+ // CONCATENATED MODULE: external "@splunk/themes"
402
+ const pe = require("@splunk/themes");
403
+ // CONCATENATED MODULE: ./src/SelectBase/SelectBaseStyles.ts
404
+ var ve = ue()(se()).withConfig({
405
+ displayName: "SelectBaseStyles__StyledButton",
406
+ componentId: "sc-1lmonqb-0"
407
+ })([ "&[data-inline]{width:", ";}", "" ], (function(e) {
408
+ var r = e.$multiple;
409
+ return r ? "400px" : "auto";
410
+ }), (function(e) {
411
+ var r = e.$multiple;
412
+ return !r && "flex-grow: 0;";
413
+ }));
414
+ var be = ue().span.withConfig({
415
+ displayName: "SelectBaseStyles__StyledLinkIcon",
416
+ componentId: "sc-1lmonqb-1"
417
+ })([ "padding-right:", ";" ], pe.variables.spacingXSmall);
418
+ var me = ue().span.withConfig({
419
+ displayName: "SelectBaseStyles__StyledLinkCaret",
420
+ componentId: "sc-1lmonqb-2"
421
+ })([ "padding-left:", ";" ], pe.variables.spacingXSmall);
422
+ var ye = ue().div.withConfig({
423
+ displayName: "SelectBaseStyles__StyledFilter",
424
+ componentId: "sc-1lmonqb-3"
425
+ })([ "padding:", " ", " ", ";min-width:160px;" ], pe.variables.spacingLarge, pe.variables.spacingLarge, pe.variables.spacingSmall);
426
+ var ge = ue().span.withConfig({
427
+ displayName: "SelectBaseStyles__StyledCount",
428
+ componentId: "sc-1lmonqb-4"
429
+ })([ "padding-right:", ";" ], pe.variables.spacingXSmall);
430
+ var he = ue()(O()).withConfig({
431
+ displayName: "SelectBaseStyles__StyledControlsLink",
432
+ componentId: "sc-1lmonqb-5"
433
+ })([ "", ";" ], (function(e) {
434
+ var r = e.$disabled;
435
+ return r && (0, ie.css)([ "color:", ";" ], pe.variables.contentColorDisabled);
436
+ }));
437
+ var Se = ue().div.withConfig({
438
+ displayName: "SelectBaseStyles__StyledToggleAllControls",
439
+ componentId: "sc-1lmonqb-6"
440
+ })([ "", ";gap:", ";padding:", " ", " ", ";" ], pe.mixins.reset("flex"), pe.variables.spacingMedium, pe.variables.spacingXSmall, pe.variables.spacingLarge, pe.variables.spacingSmall);
441
+ var Oe = ue()(de()).withConfig({
442
+ displayName: "SelectBaseStyles__StyledControlsDivider",
443
+ componentId: "sc-1lmonqb-7"
444
+ })([ "border-color:", ";" ], pe.variables.borderColor);
445
+ // CONCATENATED MODULE: ./src/utils/fuzzyMatch.ts
446
+ // A utility for matching keyboard characters to list values
447
+ var we = function e(r, t) {
448
+ return r ? r.label.charAt(t).toLowerCase() : "";
449
+ };
450
+ var Ce = function e(r, t) {
451
+ if (!r.length) {
452
+ return r;
453
+ }
454
+ var n = null;
455
+ var l = false;
456
+ var a = r.filter((function(e) {
457
+ var r = we(e, t.index);
458
+ if (r === t.value) {
459
+ l = true;
460
+ return true;
461
+ }
462
+ // If we haven't found a match yet, keep track of the next closest match.
463
+ // Secondary matching looks for the closest character of a higher value, and failing that, closest of a lower value.
464
+ if (!l) {
465
+ var a = we(n, t.index);
466
+ if (!a) {
467
+ n = e;
468
+ } else if (r > t.value) {
469
+ if (a < t.value) {
470
+ n = e;
471
+ } else if (a > r) {
472
+ n = e;
473
+ }
474
+ } else if (r > a) {
475
+ n = e;
476
+ }
477
+ }
478
+ return false;
479
+ }));
480
+ return a.length === 0 && n ? [ n ] : a;
481
+ };
482
+ // CONCATENATED MODULE: ./src/utils/ssrDocument.ts
483
+ /* eslint-disable @typescript-eslint/no-empty-function */
484
+ var ke = {
485
+ body: {
486
+ appendChild: function e() {
487
+ return [];
488
+ }
489
+ },
490
+ addEventListener: function e() {},
491
+ removeEventListener: function e() {},
492
+ activeElement: {
493
+ blur: function e() {},
494
+ nodeName: ""
495
+ },
496
+ querySelector: function e() {
497
+ return null;
498
+ },
499
+ querySelectorAll: function e() {
500
+ return [];
501
+ },
502
+ getElementById: function e() {
503
+ return null;
504
+ },
505
+ createEvent: function e() {
506
+ return {
507
+ initEvent: function e() {}
508
+ };
509
+ },
510
+ createElement: function e() {
511
+ return {
512
+ children: [],
513
+ childNodes: [],
514
+ style: {},
515
+ setAttribute: function e() {},
516
+ getElementsByTagName: function e() {
517
+ return [];
518
+ }
519
+ };
520
+ },
521
+ createElementNS: function e() {
522
+ return {};
523
+ },
524
+ importNode: function e() {
525
+ return null;
526
+ },
527
+ location: {
528
+ hash: "",
529
+ host: "",
530
+ hostname: "",
531
+ href: "",
532
+ origin: "",
533
+ pathname: "",
534
+ protocol: "",
535
+ search: ""
536
+ }
537
+ };
538
+ function xe() {
539
+ var e = typeof document !== "undefined" ? document : ke;
540
+ return e;
541
+ }
542
+ var je = xe();
543
+ /* harmony default export */ const Pe = /* unused pure expression or super */ null && je;
544
+ // CONCATENATED MODULE: ./src/utils/ssrWindow.ts
545
+ /* eslint-disable @typescript-eslint/no-empty-function */
546
+ var Ee = {
547
+ document: ke,
548
+ navigator: {
549
+ userAgent: ""
550
+ },
551
+ location: {
552
+ hash: "",
553
+ host: "",
554
+ hostname: "",
555
+ href: "",
556
+ origin: "",
557
+ pathname: "",
558
+ protocol: "",
559
+ search: ""
560
+ },
561
+ history: {
562
+ replaceState: function e() {},
563
+ pushState: function e() {},
564
+ go: function e() {},
565
+ back: function e() {}
566
+ },
567
+ CustomEvent: function e() {
568
+ return this;
569
+ },
570
+ addEventListener: function e() {},
571
+ removeEventListener: function e() {},
572
+ getComputedStyle: function e() {
573
+ return {
574
+ getPropertyValue: function e() {
575
+ return "";
576
+ }
577
+ };
578
+ },
579
+ Image: function e() {},
580
+ Date: function e() {},
581
+ screen: {},
582
+ setTimeout: function e() {},
583
+ clearTimeout: function e() {},
584
+ matchMedia: function e() {
585
+ return {};
586
+ },
587
+ requestAnimationFrame: function e(r) {
588
+ if (typeof setTimeout === "undefined") {
589
+ r();
590
+ return null;
591
+ }
592
+ return setTimeout(r, 0);
593
+ },
594
+ cancelAnimationFrame: function e(r) {
595
+ if (typeof setTimeout === "undefined") {
596
+ return;
597
+ }
598
+ clearTimeout(r);
599
+ }
600
+ };
601
+ function Ae() {
602
+ var e = typeof window !== "undefined" ? window : Ee;
603
+ return e;
604
+ }
605
+ var Le = Ae();
606
+ /* harmony default export */ const Ie = /* unused pure expression or super */ null && Le;
607
+ // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
608
+ /**
609
+ * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
610
+ *
611
+ * @param ref - The React callback or object ref. Can be `null` or `undefined`.
612
+ * @param current - The new value of the ref.
613
+ */
614
+ function Re(e, r) {
615
+ if (e) {
616
+ if (typeof e === "function") {
617
+ e(r);
618
+ } else {
619
+ // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
620
+ // the intention here is to signal "we will take care of setting 'current', not you".
621
+ e.current = r;
622
+ // eslint-disable-line no-param-reassign
623
+ }
624
+ }
625
+ }
626
+ // CONCATENATED MODULE: ./src/SelectBase/SelectBase.tsx
627
+ function Me(e) {
628
+ return De(e) || Te(e) || Ve(e) || qe();
629
+ }
630
+ function qe() {
631
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
632
+ }
633
+ function Te(e) {
634
+ if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
635
+ }
636
+ function De(e) {
637
+ if (Array.isArray(e)) return Fe(e);
638
+ }
639
+ function _e() {
640
+ return _e = Object.assign ? Object.assign.bind() : function(e) {
641
+ for (var r = 1; r < arguments.length; r++) {
642
+ var t = arguments[r];
643
+ for (var n in t) {
644
+ ({}).hasOwnProperty.call(t, n) && (e[n] = t[n]);
645
+ }
646
+ }
647
+ return e;
648
+ }, _e.apply(null, arguments);
649
+ }
650
+ function Be(e, r) {
651
+ return He(e) || Ke(e, r) || Ve(e, r) || Ne();
652
+ }
653
+ function Ne() {
654
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
655
+ }
656
+ function Ve(e, r) {
657
+ if (e) {
658
+ if ("string" == typeof e) return Fe(e, r);
659
+ var t = {}.toString.call(e).slice(8, -1);
660
+ return "Object" === t && e.constructor && (t = e.constructor.name), "Map" === t || "Set" === t ? Array.from(e) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? Fe(e, r) : void 0;
661
+ }
662
+ }
663
+ function Fe(e, r) {
664
+ (null == r || r > e.length) && (r = e.length);
665
+ for (var t = 0, n = Array(r); t < r; t++) {
666
+ n[t] = e[t];
667
+ }
668
+ return n;
669
+ }
670
+ function Ke(e, r) {
671
+ var t = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
672
+ if (null != t) {
673
+ var n, l, a, o, i = [], u = !0, c = !1;
674
+ try {
675
+ if (a = (t = t.call(e)).next, 0 === r) {
676
+ if (Object(t) !== t) return;
677
+ u = !1;
678
+ } else for (;!(u = (n = a.call(t)).done) && (i.push(n.value), i.length !== r); u = !0) {
679
+ }
680
+ } catch (e) {
681
+ c = !0, l = e;
682
+ } finally {
683
+ try {
684
+ if (!u && null != t["return"] && (o = t["return"](), Object(o) !== o)) return;
685
+ } finally {
686
+ if (c) throw l;
687
+ }
688
+ }
689
+ return i;
690
+ }
691
+ }
692
+ function He(e) {
693
+ if (Array.isArray(e)) return e;
694
+ }
695
+ function ze(e, r) {
696
+ if (null == e) return {};
697
+ var t, n, l = We(e, r);
698
+ if (Object.getOwnPropertySymbols) {
699
+ var a = Object.getOwnPropertySymbols(e);
700
+ for (n = 0; n < a.length; n++) {
701
+ t = a[n], -1 === r.indexOf(t) && {}.propertyIsEnumerable.call(e, t) && (l[t] = e[t]);
702
+ }
703
+ }
704
+ return l;
705
+ }
706
+ function We(e, r) {
707
+ if (null == e) return {};
708
+ var t = {};
709
+ for (var n in e) {
710
+ if ({}.hasOwnProperty.call(e, n)) {
711
+ if (-1 !== r.indexOf(n)) continue;
712
+ t[n] = e[n];
713
+ }
714
+ }
715
+ return t;
716
+ }
717
+ function $e(e) {
718
+ "@babel/helpers - typeof";
719
+ return $e = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
720
+ return typeof e;
721
+ } : function(e) {
722
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
723
+ }, $e(e);
724
+ }
725
+ function Xe(e, r) {
726
+ var t = Object.keys(e);
727
+ if (Object.getOwnPropertySymbols) {
728
+ var n = Object.getOwnPropertySymbols(e);
729
+ r && (n = n.filter((function(r) {
730
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
731
+ }))), t.push.apply(t, n);
732
+ }
733
+ return t;
734
+ }
735
+ function Ue(e) {
736
+ for (var r = 1; r < arguments.length; r++) {
737
+ var t = null != arguments[r] ? arguments[r] : {};
738
+ r % 2 ? Xe(Object(t), !0).forEach((function(r) {
739
+ Je(e, r, t[r]);
740
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Xe(Object(t)).forEach((function(r) {
741
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
742
+ }));
743
+ }
744
+ return e;
745
+ }
746
+ function Je(e, r, t) {
747
+ return (r = Ge(r)) in e ? Object.defineProperty(e, r, {
748
+ value: t,
749
+ enumerable: !0,
750
+ configurable: !0,
751
+ writable: !0
752
+ }) : e[r] = t, e;
753
+ }
754
+ function Ge(e) {
755
+ var r = Qe(e, "string");
756
+ return "symbol" == $e(r) ? r : r + "";
757
+ }
758
+ function Qe(e, r) {
759
+ if ("object" != $e(e) || !e) return e;
760
+ var t = e[Symbol.toPrimitive];
761
+ if (void 0 !== t) {
762
+ var n = t.call(e, r || "default");
763
+ if ("object" != $e(n)) return n;
764
+ throw new TypeError("@@toPrimitive must return a primitive value.");
765
+ }
766
+ return ("string" === r ? String : Number)(e);
767
+ }
768
+ var Ye = {
769
+ allowKeyMatching: p().bool,
770
+ allowNewValues: p().bool,
771
+ animateLoading: p().bool,
772
+ appearance: p().oneOf([ "default", "link", "subtle" ]),
773
+ append: p().bool,
774
+ children: p().node,
775
+ defaultPlacement: p().oneOf([ "above", "below", "vertical" ]),
776
+ defaultValues: p().array,
777
+ describedBy: p().string,
778
+ disabled: p().bool,
779
+ elementRef: p().oneOfType([ p().func, p().object ]),
780
+ error: p().bool,
781
+ filter: p().oneOf([ false, true, "controlled" ]),
782
+ footerMessage: p().node,
783
+ inline: p().bool,
784
+ inputId: p().string,
785
+ inputRef: p().oneOfType([ p().func, p().object ]),
786
+ isLoadingOptions: p().bool,
787
+ labelledBy: p().string,
788
+ labelText: p().string,
789
+ loadingMessage: p().node,
790
+ /** @private. */
791
+ maxLabelItems: p().number,
792
+ menuStyle: p().object,
793
+ multiple: p().bool,
794
+ name: p().string,
795
+ noOptionsMessage: p().node,
796
+ onChange: p().func,
797
+ onClick: p().func,
798
+ onClose: p().func,
799
+ onFilterChange: p().func,
800
+ onOpen: p().func,
801
+ onScroll: p().func,
802
+ onScrollBottom: p().func,
803
+ /** @private. */
804
+ required: p().bool,
805
+ placeholder: p().string,
806
+ prefixLabel: p().string,
807
+ prepend: p().bool,
808
+ repositionMode: p().oneOf([ "none", "flip" ]),
809
+ selectAllAppearance: p().oneOf([ "buttongroup", "checkbox", "none" ]),
810
+ showSelectedValuesFirst: p().oneOf([ "nextOpen", "immediately", "never" ]),
811
+ suffixLabel: p().string,
812
+ tabConfirmsNewValue: p().bool,
813
+ toggle: p().node,
814
+ toggleContent: p().oneOf([ "optionChildren", "optionLabel" ]),
815
+ values: p().array,
816
+ /** @private. */
817
+ virtualization: p().number
818
+ };
819
+ var Ze = c()((function(e) {
820
+ return [ e ];
821
+ }));
822
+ // preserve separate widths for single vs. multi mode
823
+ var er = c()((function(e) {
824
+ var r = e.anchorWidth, t = e.isMultiple, n = e.maxHeight, l = e.menuStyle;
825
+ return t ? Ue({
826
+ width: Math.max(r !== null && r !== void 0 ? r : 0, 200),
827
+ maxHeight: n
828
+ }, l) : Ue({
829
+ minWidth: r !== null && r !== void 0 ? r : undefined,
830
+ maxWidth: Math.max(r !== null && r !== void 0 ? r : 0, 300),
831
+ maxHeight: n
832
+ }, l);
833
+ }));
834
+ var rr = [ "clickAway", "escapeKey", "offScreen", "tabKey", "toggleClick" ];
835
+ function tr(e) {
836
+ return e && i()(e.props, "value");
837
+ }
838
+ function nr(e, r) {
839
+ return "".concat($e(e), "-").concat(e, "-").concat(r);
840
+ }
841
+ var lr = [ "append", "error", "prepend" ];
842
+ var ar = (0, q._)("No matches");
843
+ var or = (0, q._)("Select...");
844
+ var ir = 30;
845
+ var ur = {};
846
+ var cr = n().createElement(y(), null);
847
+ var sr = function e(r) {
848
+ var t = r.activeItemId, l = r.filterA11yId, a = r.filterKeyword, o = r.hasChildren, i = r.inputId, u = r.inputRef, c = r.menuListboxId, s = r.multiple, f = r.onClearAll, d = r.onSelectAll, p = r.onTextBlur, v = r.onTextChange, b = r.onTextFocus, m = r.onTextKeyDown, y = r.optionSelection, g = r.placement, h = r.selectAllAppearance, S = r.textHasFocus;
849
+ var O = (0, q._)("Select all options".concat(y.current === "all" ? " disabled" : ""));
850
+ var w = (0, q._)("Clear all options".concat(y.current === "none" ? " disabled" : ""));
851
+ // only visually disable these as opposed to fully disabling to avoid losing keyboard focus - see SUI-2731
852
+ var C = n().createElement(Se, {
853
+ key: "selectAll"
854
+ }, n().createElement(he, {
855
+ disabled: y.current === "all",
856
+ appearance: "standalone",
857
+ "aria-label": O,
858
+ onClick: d,
859
+ "data-test": "select-all",
860
+ tag: "button"
861
+ }, a ? (0, q._)("Select all Matches") : (0, q._)("Select all")), n().createElement(he, {
862
+ disabled: y.current === "none",
863
+ appearance: "standalone",
864
+ "aria-label": w,
865
+ onClick: f,
866
+ "data-test": "clear-all",
867
+ tag: "button"
868
+ }, a ? (0, q._)("Clear all Matches") : (0, q._)("Clear all")));
869
+
870
+ return n().createElement("div", {
871
+ key: "controls"
872
+ }, l && n().createElement(j(), {
873
+ id: l
874
+ }, (0, q._)("Type to filter")), g === "above" && n().createElement(Oe, null), n().createElement(ye, {
875
+ key: "filter",
876
+ "data-test": "filter"
877
+ }, n().createElement(E(), {
878
+ value: a,
879
+ autoCapitalize: "off",
880
+ autoComplete: "off",
881
+ autoCorrect: "off",
882
+ spellCheck: false,
883
+ onChange: v,
884
+ onKeyDown: m,
885
+ onFocus: b,
886
+ onBlur: p,
887
+ placeholder: (0, q._)("Filter"),
888
+ role: "combobox",
889
+ "aria-expanded": "true",
890
+ "aria-controls": c,
891
+ "aria-owns": S && o ? t : undefined,
892
+ "aria-label": (0, q._)("Filter"),
893
+ "aria-autocomplete": "list",
894
+ "aria-activedescendant": S && o ? t : undefined,
895
+ inputRef: u,
896
+ inputId: i,
897
+ canClear: true,
898
+ startAdornment: cr
899
+ })), s && o && h === "buttongroup" && C, g === "below" && n().createElement(Oe, null));
900
+ };
901
+ var fr = function e(r) {
902
+ var t = r.prefixLabel, n = r.label, l = r.suffixLabel;
903
+ var o = n;
904
+ if (t) {
905
+ o = [ "".concat(t, ": ") ].concat(o);
906
+ }
907
+ if (l) {
908
+ o = a()(o).concat(" ".concat(l));
909
+ }
910
+ return o;
911
+ };
912
+ var dr = [];
913
+ var pr = n().forwardRef((function(e, r) {
914
+ var l = e.appearance, a = l === void 0 ? "default" : l, o = e.append, i = e.children, u = e.currentValues, c = u === void 0 ? dr : u, s = e.describedBy, d = e.disabled, p = e.elementRef, v = e.error, m = e.inline, y = e.labelText, g = e.labelledBy, h = e.multiple, S = e.onClick, w = e.placeholder, C = e.prefixLabel, k = e.prepend, x = e.required, j = e.suffixLabel, P = e.toggle, E = e.toggleContent, A = e.maxLabelItems, L = A === void 0 ? ir : A, I = ze(e, [ "appearance", "append", "children", "currentValues", "describedBy", "disabled", "elementRef", "error", "inline", "labelText", "labelledBy", "multiple", "onClick", "placeholder", "prefixLabel", "prepend", "required", "suffixLabel", "toggle", "toggleContent", "maxLabelItems" ]);
915
+ var R = (0, t.useMemo)((function() {
916
+ var e = t.Children.toArray(i);
917
+ var r = new Map;
918
+ for (var n = 0; n < e.length; n += 1) {
919
+ var l = e[n];
920
+ if (tr(l)) {
921
+ r.set(l.props.value, l);
922
+ }
923
+ }
924
+ return r;
925
+ }), [ i ]);
926
+ var M = (0, t.useMemo)((function() {
927
+ var e = {
928
+ icon: null,
929
+ label: [],
930
+ ariaLabel: []
931
+ };
932
+ var r = h && c.length > L ? Math.max(1, L) : c.length;
933
+ for (var t = 0; t < r; t += 1) {
934
+ var n = c[t];
935
+ var l = R.get(n);
936
+ if (l) {
937
+ var a = l.props, o = a.children, i = a.icon, u = a.label;
938
+ var s = E !== "optionLabel" && o ? o : u;
939
+ e.label.push(s);
940
+ e.ariaLabel.push(u);
941
+ // if not in multiple mode, add the icon
942
+ if (!h && c.length === 1) {
943
+ e.icon = i;
944
+ }
945
+ } else if (h) {
946
+ // only add values that don't match an option in "multiple" mode to preserve old behaviour
947
+ e.label.push(n);
948
+ e.ariaLabel.push(n.toString());
949
+ }
950
+ if (t < r - 1) {
951
+ e.label.push((0, q._)(", "));
952
+ e.ariaLabel.push((0, q._)(", "));
953
+ }
954
+ }
955
+ if (h && c.length > r && e.label.length) {
956
+ // add visual ellipsis to ensure truncation is shown
957
+ e.label.push((0, q._)("..."));
958
+ }
959
+ // only apply prefix / suffix if the label is not empty
960
+ if (e.label.length > 0) {
961
+ // If there's more than one item selected, read out the selected total
962
+ // rather than reading out each selected item
963
+ e.ariaLabel = fr({
964
+ prefixLabel: C,
965
+ label: e.label.length > 1 ? [ "".concat(c.length, " items selected") ] : e.ariaLabel,
966
+ suffixLabel: j
967
+ });
968
+ e.label = fr({
969
+ prefixLabel: C,
970
+ label: e.label,
971
+ suffixLabel: j
972
+ });
973
+ }
974
+ // single <Select> behaviour is to show the placeholder if all parts of the label
975
+ // are empty strings so we replicate this behaviour here
976
+ if (!e.label.length || !h && e.label.every((function(e) {
977
+ return e === "";
978
+ }))) {
979
+ e.label = Ze(w);
980
+ e.ariaLabel = e.label;
981
+ }
982
+ return e;
983
+ }), [ c, L, h, R, w, C, j, E ]), T = M.label, D = M.ariaLabel, _ = M.icon;
984
+ var B = "aria-labelledby" in I;
985
+ var N = Ue({
986
+ "aria-describedby": s,
987
+ "aria-label": g || B ? undefined : "".concat(y ? "".concat(y, ", ") : "").concat(D.join("")),
988
+ // aria-labelledby takes precedence over aria-label, so existence of both is redundant
989
+ "aria-labelledby": g,
990
+ "aria-required": x,
991
+ "data-select-appearance": a,
992
+ append: o,
993
+ prepend: k,
994
+ onClick: S,
995
+ role: "combobox",
996
+ disabled: d ? "disabled" : undefined,
997
+ elementRef: p,
998
+ error: v,
999
+ ref: r
1000
+ }, I);
1001
+ if (h) {
1002
+ N["data-test-values"] = JSON.stringify(c);
1003
+ } else {
1004
+ var V = Be(c, 1), F = V[0];
1005
+ N["data-test-value"] = F;
1006
+ }
1007
+ if (P) {
1008
+
1009
+ return (0, t.cloneElement)(P, N);
1010
+ }
1011
+ if (a === "link") {
1012
+
1013
+ return n().createElement(O(), _e({
1014
+ tag: "button",
1015
+ appearance: "standalone"
1016
+ }, N, {
1017
+ "data-select-appearance": "link"
1018
+ }), !!_ && n().createElement(be, null, _), T || w, n().createElement(me, null, n().createElement(b(), null)));
1019
+ }
1020
+ // Using Button's secondary appearance as Select's default appearance.
1021
+ var K = a === "default" ? "secondary" : a;
1022
+
1023
+ return n().createElement(ve, _e({}, N, {
1024
+ $multiple: h,
1025
+ appearance: K,
1026
+ label: T,
1027
+ error: v,
1028
+ icon: _,
1029
+ inline: m,
1030
+ isMenu: true,
1031
+ onClick: S
1032
+ }, f()(I, lr)), !!c.length && h && n().createElement(ge, {
1033
+ "data-role": "count"
1034
+ }, "(", c.length, ")"));
1035
+ }));
1036
+ function vr(e) {
1037
+ var r = e.currentValues, t = e.multiple;
1038
+ if (t || !(r === null || r === void 0 ? void 0 : r.length)) {
1039
+ return r !== null && r !== void 0 ? r : [];
1040
+ }
1041
+ return [ r[0] ];
1042
+ }
1043
+ function br(e) {
1044
+ var r = e.allowKeyMatching, l = r === void 0 ? true : r, a = e.animateLoading, o = e.appearance, i = o === void 0 ? "default" : o, u = e.append, c = e.allowNewValues, s = e.children, f = e.defaultPlacement, d = f === void 0 ? "vertical" : f, p = e.defaultValues, v = e.describedBy, b = e.disabled, m = e.elementRef, y = e.error, g = e.filter, S = e.footerMessage, O = e.inline, x = e.inputId, j = e.inputRef, P = e.isLoadingOptions, E = e.labelledBy, A = e.labelText, I = e.loadingMessage, _ = e.menuStyle, B = _ === void 0 ? ur : _, N = e.multiple, V = e.name, F = e.noOptionsMessage, K = F === void 0 ? ar : F, H = e.onChange, z = e.onScroll, W = e.onScrollBottom, $ = e.onFilterChange, X = e.onClick, J = e.onClose, G = e.onOpen, Q = e.required, Y = e.placeholder, Z = Y === void 0 ? or : Y, ee = e.prefixLabel, re = e.prepend, te = e.repositionMode, ne = te === void 0 ? "flip" : te, le = e.selectAllAppearance, ae = le === void 0 ? "buttongroup" : le, ie = e.showSelectedValuesFirst, ue = e.suffixLabel, ce = e.tabConfirmsNewValue, se = e.values, fe = e.virtualization, de = e.toggle, pe = e.toggleContent, ve = pe === void 0 ? "optionChildren" : pe, be = e.maxLabelItems, me = be === void 0 ? ir : be, ye = ze(e, [ "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", "maxLabelItems" ]);
1045
+ // @docs-props-type SelectBasePropsBase
1046
+ var ge = L()({
1047
+ componentName: "SelectBase",
1048
+ /* eslint-disable-next-line prefer-rest-params */
1049
+ componentProps: arguments[0],
1050
+ // see SUI-7028
1051
+ defaultValuePropName: "defaultValues",
1052
+ valuePropName: "values"
1053
+ });
1054
+ // states
1055
+ var he = (0, t.useState)((function() {
1056
+ return {
1057
+ activeItemId: (0, T.createDOMID)("active-item"),
1058
+ menuListboxId: (0, T.createDOMID)("menu-listbox")
1059
+ };
1060
+ })), Se = Be(he, 1), Oe = Se[0], we = Oe.activeItemId, ke = Oe.menuListboxId;
1061
+ var xe = (0, t.useState)(0), je = Be(xe, 2), Pe = je[0], Ee = je[1];
1062
+ var Le = (0, t.useState)(""), Ie = Be(Le, 2), qe = Ie[0], Te = Ie[1];
1063
+ var De = (0, t.useState)(false), Ne = Be(De, 2), Ve = Ne[0], Fe = Ne[1];
1064
+ var Ke = (0, t.useState)(false), He = Be(Ke, 2), We = He[0], $e = He[1];
1065
+ var Xe = (0, t.useState)([]), Ue = Be(Xe, 2), Je = Ue[0], Ge = Ue[1];
1066
+ var Qe = (0, t.useState)(p || []), Ye = Be(Qe, 2), Ze = Ye[0], lr = Ye[1];
1067
+ // previous state
1068
+ var cr = R()(Pe);
1069
+ // refs
1070
+ var fr = (0, t.useRef)(null);
1071
+ var dr = (0, t.useRef)(null);
1072
+ var br = (0, t.useRef)(null);
1073
+ var mr = (0, t.useRef)([]);
1074
+ var yr = (0, t.useRef)([]);
1075
+ var gr = (0, t.useRef)(cr);
1076
+ var hr = (0, t.useRef)();
1077
+ var Sr = (0, t.useRef)({});
1078
+ var Or = (0, t.useRef)(0);
1079
+ var wr = (0, t.useRef)([]);
1080
+ var Cr = (0, t.useRef)(null);
1081
+ var kr = (0, t.useRef)();
1082
+ var xr = (0, t.useRef)(0);
1083
+ var jr = (0, t.useRef)("none");
1084
+ var Pr = (0, t.useState)(g ? (0, T.createDOMID)("filter") : undefined), Er = Be(Pr, 1), Ar = Er[0];
1085
+ (0, t.useEffect)((function() {
1086
+ if (false) {}
1087
+ }), [ i, u, y, re ]);
1088
+ var Lr = (0, t.useMemo)((function() {
1089
+ var e = n().Children.toArray(s);
1090
+ var r = new Map;
1091
+ for (var t = 0; t < e.length; t += 1) {
1092
+ var l = e[t];
1093
+ if (tr(l)) {
1094
+ r.set(l.props.value, l);
1095
+ }
1096
+ }
1097
+ return [ e, r ];
1098
+ }), [ s ]), Ir = Be(Lr, 2), Rr = Ir[0], Mr = Ir[1];
1099
+ var qr = vr({
1100
+ currentValues: ge ? se : Ze,
1101
+ multiple: N
1102
+ });
1103
+ // mutable object reference to currentValues to permit idempotent callbacks
1104
+ var Tr = (0, t.useRef)(null);
1105
+ Tr.current = qr;
1106
+ var Dr = (0, t.useCallback)((function() {
1107
+ // in non-multiple mode, don't move values to the top of the list
1108
+ return N && ie !== "never" ? Tr.current : [];
1109
+ }), [ N, ie ]);
1110
+ var _r = (0, t.useCallback)((function(e) {
1111
+ var r = qe;
1112
+ Fe(true);
1113
+ Ge(Dr());
1114
+ // SUI-3234: preserve existing behavior difference between <Select> and <Multiselect.Compact>
1115
+ if (N) {
1116
+ Te("");
1117
+ }
1118
+ if (r !== qe) {
1119
+ $ === null || $ === void 0 ? void 0 : $(e, {
1120
+ keyword: qe
1121
+ });
1122
+ }
1123
+ }), [ qe, Dr, N, $ ]);
1124
+ (0, t.useEffect)((function() {
1125
+ if (Ve) {
1126
+ G === null || G === void 0 ? void 0 : G();
1127
+ if (Cr.current && !g) {
1128
+ Cr.current.focus();
1129
+ } else {
1130
+ var e;
1131
+ Ee((e = kr.current) !== null && e !== void 0 ? e : 0);
1132
+ }
1133
+ }
1134
+ }), [ G, Ve, Je, qe, g ]);
1135
+ var Br = (0, t.useCallback)((function() {
1136
+ Fe(false);
1137
+ Ee(0);
1138
+ gr.current = null;
1139
+ J === null || J === void 0 ? void 0 : J();
1140
+ }), [ J ]);
1141
+ var Nr = (0, t.useCallback)((function(e, r) {
1142
+ var t = new Set(Tr.current);
1143
+ var n;
1144
+ if (N) {
1145
+ if (t.has(r)) {
1146
+ t["delete"](r);
1147
+ } else {
1148
+ t.add(r);
1149
+ }
1150
+ n = Array.from(t);
1151
+ } else {
1152
+ // non-multiple mode must always have a value
1153
+ n = [ r ];
1154
+ }
1155
+ var l = !ge;
1156
+ if (l) {
1157
+ lr(n);
1158
+ }
1159
+ if (N) {
1160
+ // in uncontrolled multiple mode, keep the menu open
1161
+ if (l) {
1162
+ Fe(true);
1163
+ }
1164
+ } else {
1165
+ var a;
1166
+ // non-multiple mode only supports a single selection
1167
+ // so close the menu once a selection is made
1168
+ Br({
1169
+ reason: "contentClick"
1170
+ });
1171
+ (a = fr.current) === null || a === void 0 ? void 0 : a.focus();
1172
+ }
1173
+ H === null || H === void 0 ? void 0 : H(e, {
1174
+ values: n,
1175
+ name: V,
1176
+ reason: "valueToggle"
1177
+ });
1178
+ }), [ Br, ge, N, V, H ]);
1179
+ var Vr = function e() {
1180
+ dr.current = null;
1181
+ mr.current = [];
1182
+ if (br.current) {
1183
+ clearTimeout(br.current);
1184
+ }
1185
+ };
1186
+ var Fr = (0, t.useCallback)((function(e) {
1187
+ // this doesn't make sense if we can't select multiple values
1188
+ if (!N) {
1189
+ return;
1190
+ }
1191
+ var r = Tr.current;
1192
+ var t = new Set(r);
1193
+ var n = new Set([].concat(Me(r), Me(wr.current)));
1194
+ // to keep track of custom values we create a copy of selected values and remove
1195
+ // items as they are accounted for in children, leaving only custom values
1196
+ var l = new Set(n);
1197
+ var a = new Set;
1198
+ Rr.forEach((function(e) {
1199
+ if (tr(e)) {
1200
+ // this value is being represented in children so it is not custom
1201
+ l["delete"](e.props.value);
1202
+ }
1203
+ if (tr(e) && n.has(e.props.value) && (!e.props.disabled || t.has(e.props.value))) {
1204
+ a.add(e.props.value);
1205
+ }
1206
+ }));
1207
+ var o = [].concat(Me(Array.from(l)), Me(Array.from(a)));
1208
+ if (!ge) {
1209
+ lr(o);
1210
+ }
1211
+ H === null || H === void 0 ? void 0 : H(e, {
1212
+ values: o,
1213
+ name: V,
1214
+ reason: "selectAll"
1215
+ });
1216
+ }), [ Rr, ge, N, V, H ]);
1217
+ var Kr = (0, t.useCallback)((function(e) {
1218
+ // this doesn't make sense if we can't select multiple values
1219
+ if (!N) {
1220
+ return;
1221
+ }
1222
+ var r = new Set(Tr.current);
1223
+ var t = new Set(Tr.current);
1224
+ for (var n = 0; n < wr.current.length; n += 1) {
1225
+ t["delete"](wr.current[n]);
1226
+ }
1227
+ var l = new Set;
1228
+ for (var a = 0; a < Rr.length; a += 1) {
1229
+ var o = Rr[a];
1230
+ // this will unselect all selected values unless those values are disabled or hidden by the filter
1231
+ if (tr(o) && (r.has(o.props.value) && o.props.disabled || t.has(o.props.value))) {
1232
+ l.add(o.props.value);
1233
+ }
1234
+ }
1235
+ var i = Array.from(l);
1236
+ if (!ge) {
1237
+ lr(i);
1238
+ }
1239
+ H === null || H === void 0 ? void 0 : H(e, {
1240
+ values: i,
1241
+ name: V,
1242
+ reason: "clearAll"
1243
+ });
1244
+ }), [ Rr, ge, N, V, H ]);
1245
+ var Hr = (0, t.useCallback)((function(e) {
1246
+ if (Ve && !P) {
1247
+ W === null || W === void 0 ? void 0 : W(e);
1248
+ }
1249
+ }), [ Ve, P, W ]);
1250
+ var zr = (0, t.useCallback)((function(e) {
1251
+ var r = e.key;
1252
+ if (r === "Tab") {
1253
+ if (ce && hr.current && Or.current <= 1) {
1254
+ e.preventDefault();
1255
+ Nr(e, hr.current);
1256
+ }
1257
+ }
1258
+ if (e.shiftKey || e.metaKey || e.ctrlKey) {
1259
+ if (r === "a" && (e.ctrlKey || e.metaKey)) {
1260
+ // handle control + A
1261
+ if (jr.current === "all") {
1262
+ Kr(e);
1263
+ } else {
1264
+ Fr(e);
1265
+ }
1266
+ }
1267
+ return;
1268
+ }
1269
+ if (r === "ArrowDown") {
1270
+ e.preventDefault();
1271
+ Ee(Math.min(Pe + 1, ae === "checkbox" ? Or.current : Or.current - 1));
1272
+ if (s && W) {
1273
+ var n = t.Children.toArray(s).length - (2 + Tr.current.length);
1274
+ if (Pe === n) {
1275
+ Hr(e);
1276
+ }
1277
+ }
1278
+ }
1279
+ if (r === "ArrowUp") {
1280
+ e.preventDefault();
1281
+ Ee(Math.max(Pe - 1, 0));
1282
+ }
1283
+ if (r === "Enter" && hr.current && Ve) {
1284
+ if (hr.current === "selectAll") {
1285
+ if (jr.current === "all") {
1286
+ Kr(e);
1287
+ } else {
1288
+ Fr(e);
1289
+ }
1290
+ } else {
1291
+ e.preventDefault();
1292
+ Nr(e, hr.current);
1293
+ }
1294
+ }
1295
+ }), [ Pe, s, Kr, Hr, Fr, W, Ve, ae, ce, Nr ]);
1296
+ var Wr = (0, t.useCallback)((function(e, r) {
1297
+ var t = r.value;
1298
+ e.preventDefault();
1299
+ if (!Ve) {
1300
+ return;
1301
+ }
1302
+ Nr(e, t);
1303
+ }), [ Ve, Nr ]);
1304
+ var $r = (0, t.useCallback)((function(e, r) {
1305
+ var t = e.nativeEvent.key;
1306
+ // Checking for a single character to avoid complications from double-byte languages and emojis.
1307
+ if (t.length === 1) {
1308
+ var n = [];
1309
+ var l = {
1310
+ index: 0,
1311
+ value: t
1312
+ };
1313
+ if (!dr.current) {
1314
+ if (t === " ") {
1315
+ Vr();
1316
+ return;
1317
+ }
1318
+ n = Ce(yr.current, l);
1319
+ } else if (mr.current.length > 1) {
1320
+ l.index = dr.current.index + 1;
1321
+ n = Ce(mr.current, l);
1322
+ }
1323
+ if (n.length) {
1324
+ var a;
1325
+ var o = 0;
1326
+ // If the active option is a first character match, cycle to the next matching option.
1327
+ if (l.index === 0 && n.length > 1) {
1328
+ var i = n.indexOf(yr.current[r]);
1329
+ if (i >= 0) {
1330
+ o = i === n.length - 1 ? 0 : i + 1;
1331
+ }
1332
+ }
1333
+ var u = n[o];
1334
+ var c = u.value, s = u.label;
1335
+ var f = Sr.current[nr(c, s)];
1336
+ f === null || f === void 0 ? void 0 : (a = f.focus) === null || a === void 0 ? void 0 : a.call(f);
1337
+ }
1338
+ mr.current = n;
1339
+ dr.current = l;
1340
+ if (br.current) {
1341
+ clearTimeout(br.current);
1342
+ }
1343
+ br.current = setTimeout(Vr, 500);
1344
+ e.preventDefault();
1345
+ e.stopPropagation();
1346
+ }
1347
+ }), []);
1348
+ var Xr = (0, t.useCallback)((function(e, r) {
1349
+ var t = r.value;
1350
+ Te(t);
1351
+ Fe(true);
1352
+ Ee(0);
1353
+ $ === null || $ === void 0 ? void 0 : $(e, {
1354
+ keyword: t
1355
+ });
1356
+ }), [ $ ]);
1357
+ var Ur = (0, t.useCallback)((function() {
1358
+ $e(true);
1359
+ }), []);
1360
+ var Jr = (0, t.useCallback)((function() {
1361
+ $e(false);
1362
+ }), []);
1363
+ var Gr = (0, t.useCallback)((function(e) {
1364
+ if (gr.current !== Pe) {
1365
+ (0, D.scrollIntoViewIfNeeded)(e);
1366
+ }
1367
+ }), [ Pe ]);
1368
+ var Qr = (0, t.useCallback)((function(e, r, t) {
1369
+ if (t) {
1370
+ Cr.current = e;
1371
+ }
1372
+ if (e == null) {
1373
+ delete Sr.current[r];
1374
+ } else {
1375
+ Sr.current[r] = e;
1376
+ }
1377
+ }), [ Sr ]);
1378
+ var Yr = (0, t.useCallback)((function(e) {
1379
+ fr.current = e;
1380
+ Re(m, e);
1381
+ }), [ m, fr ]);
1382
+ var Zr = qr.some((function(e) {
1383
+ var r = Mr.get(e);
1384
+ return r && !r.props.disabled;
1385
+ }));
1386
+ var et = ie === "immediately" ? Dr() : Je;
1387
+ var rt = (0, t.useMemo)((function() {
1388
+ Or.current = 0;
1389
+ kr.current = undefined;
1390
+ xr.current = 0;
1391
+ hr.current = undefined;
1392
+ yr.current = [];
1393
+ var e = function e(r, t) {
1394
+ return function(e) {
1395
+ return Qr(e, r, t);
1396
+ };
1397
+ };
1398
+ var r;
1399
+ var a = 0;
1400
+ var o = false;
1401
+ // used to avoid overwriting the selected item ref in multiple mode
1402
+ var i;
1403
+ var u = new Set(qr);
1404
+ var s = new Set(et !== null && et !== void 0 ? et : []);
1405
+ var f = Rr.reduce((function(c, f, d) {
1406
+ // ignore Headings and Dividers
1407
+ if (!tr(f)) {
1408
+ c.push(f);
1409
+ return c;
1410
+ }
1411
+ var p = f.props, v = p.disabled, b = p.hidden, m = p.label, y = p.value;
1412
+ // Find out if the search string exactly matches a value
1413
+ if (y === qe) {
1414
+ r = true;
1415
+ }
1416
+ var h = u.has(y);
1417
+ var S = !!h && !v && !i;
1418
+ var O = l && !N && !g && !P && !W;
1419
+ var C = nr(y, m);
1420
+ var k = -1;
1421
+ if (O && !v && !b) {
1422
+ yr.current.push({
1423
+ label: m,
1424
+ value: y
1425
+ });
1426
+ k = yr.current.length - 1;
1427
+ }
1428
+ // Format the Menu.Item
1429
+ var x = (0, t.cloneElement)(f, {
1430
+ elementRef: e(C, S),
1431
+ key: f.key || d,
1432
+ onClick: Wr,
1433
+ onKeyDown: O ? function(e) {
1434
+ return $r(e, k);
1435
+ } : undefined,
1436
+ selected: h,
1437
+ multiple: N,
1438
+ role: "option"
1439
+ });
1440
+ if (S) {
1441
+ i = true;
1442
+ }
1443
+ if (s.has(y)) {
1444
+ if (a === 0) {
1445
+ c.splice(a, 0, n().createElement(w.Divider, {
1446
+ key: "topDivider"
1447
+ }));
1448
+ o = true;
1449
+ }
1450
+ c.splice(a, 0, x);
1451
+ a += 1;
1452
+ } else {
1453
+ c.push(x);
1454
+ }
1455
+ return c;
1456
+ }), []);
1457
+ // In multiple mode, add missing items
1458
+ if (N) {
1459
+ for (var d = qr.length - 1; d >= 0; d -= 1) {
1460
+ var p = qr[d];
1461
+ var v = Mr.get(p);
1462
+ if (!v) {
1463
+ if (p === qe) {
1464
+ r = true;
1465
+ }
1466
+ var b = s.has(p);
1467
+ var m = et.length;
1468
+ if (a === 0) {
1469
+ f.splice(0, 0, n().createElement(w.Divider, {
1470
+ key: "topDivider"
1471
+ }));
1472
+ a += 1;
1473
+ o = true;
1474
+ }
1475
+ var y = String(p);
1476
+ var h = nr(p, y);
1477
+ f.splice(b ? 0 : m + 1, 0, n().createElement(U, {
1478
+ elementRef: e(h),
1479
+ label: y,
1480
+ value: p,
1481
+ key: "missing-value-".concat(p),
1482
+ onClick: Wr,
1483
+ multiple: N,
1484
+ selected: true
1485
+ }));
1486
+ if (b) {
1487
+ a += 1;
1488
+ }
1489
+ }
1490
+ }
1491
+ }
1492
+ var S = g === "controlled";
1493
+ // Filter the items
1494
+ var O = (0, M.stringToKeywords)(qe);
1495
+ f = S ? f : f.filter((function(e) {
1496
+ if (tr(e)) {
1497
+ return (0, M.testPhrase)(e.props.label, O);
1498
+ }
1499
+ return true;
1500
+ // Keep all headers and non-interactive options
1501
+ })).map((function(e) {
1502
+ if (!tr(e)) {
1503
+ return e;
1504
+ }
1505
+ // highlight matched text
1506
+ var r = O && (0, M.keywordLocations)(e.props.label, O);
1507
+
1508
+ return (0, t.cloneElement)(e, {
1509
+ matchRanges: r || undefined
1510
+ });
1511
+ }));
1512
+ // Add the option to add the new value
1513
+ if (c && !r && qe) {
1514
+ var C = o ? a + 1 : a;
1515
+ var k = "".concat(qe, " (new value)");
1516
+ var x = nr(qe, k);
1517
+ f.splice(C, 0, n().createElement(U, {
1518
+ elementRef: e(x),
1519
+ label: k,
1520
+ value: qe,
1521
+ key: "newValue",
1522
+ multiple: N,
1523
+ onClick: Wr
1524
+ }));
1525
+ }
1526
+ // When selectAll is a menu item, add an offset so that activeItem accounts for the extra selectAll option.
1527
+ var j = ae === "checkbox" && N && f.length > 1 ? 1 : 0;
1528
+ var E = true;
1529
+ // Highlight the selected Items and remove hidden
1530
+ f = f.reduce((function(e, r) {
1531
+ // ignore Dividers & Headings
1532
+ if (!tr(r)) {
1533
+ e.push(r);
1534
+ return e;
1535
+ }
1536
+ // Ignore any hidden items
1537
+ if (r.props && r.props.hidden) {
1538
+ return e;
1539
+ }
1540
+ if (r.props.selected && !r.props.disabled && kr.current == null) {
1541
+ kr.current = Or.current;
1542
+ }
1543
+ var n = j === Pe;
1544
+ j += 1;
1545
+ Or.current += 1;
1546
+ xr.current += r.props.selected ? 1 : 0;
1547
+ if (r.key !== "newValue" && !r.props.disabled && !r.props.selected) {
1548
+ E = false;
1549
+ }
1550
+ if (!n || !We) {
1551
+ e.push(r);
1552
+ return e;
1553
+ }
1554
+ if (!r.props.disabled) {
1555
+ hr.current = r.props.value;
1556
+ }
1557
+ var l = (0, t.cloneElement)(r, {
1558
+ active: n,
1559
+ elementRef: Gr,
1560
+ id: we
1561
+ });
1562
+ e.push(l);
1563
+ return e;
1564
+ }), []);
1565
+ jr.current = xr.current === 0 && "none" || E && "all" || "some";
1566
+ // add select all option
1567
+ if (ae === "checkbox" && N && Or.current > 0) {
1568
+ var A = Pe === 0 && !!g;
1569
+ var L;
1570
+ if (jr.current === "all") {
1571
+ if (qe === "") {
1572
+ L = (0, q._)("Clear all");
1573
+ } else {
1574
+ L = (0, q._)("Clear all matches");
1575
+ }
1576
+ } else if (qe === "") {
1577
+ L = (0, q._)("Select all");
1578
+ } else {
1579
+ L = (0, q._)("Select all matches");
1580
+ }
1581
+ if (A) {
1582
+ hr.current = "selectAll";
1583
+ }
1584
+ f.unshift( n().createElement(oe, {
1585
+ key: "select-all-option",
1586
+ active: A,
1587
+ elementRef: Gr,
1588
+ id: A ? we : undefined,
1589
+ onClick: jr.current === "all" ? Kr : Fr,
1590
+ label: L,
1591
+ selected: jr.current === "all" || jr.current !== "none" && "some",
1592
+ totalCount: !!de && qr.length || undefined,
1593
+ tabIndex: g ? -1 : undefined
1594
+ }), n().createElement(w.Divider, {
1595
+ key: "selectAllDivider"
1596
+ }));
1597
+ }
1598
+ wr.current = f.reduce((function(e, r) {
1599
+ if (tr(r)) {
1600
+ e.push(r.props.value);
1601
+ }
1602
+ return e;
1603
+ }), []);
1604
+ return f;
1605
+ }), [ Pe, we, l, c, Rr, Mr, qr, g, qe, Gr, Kr, Wr, $r, Qr, Fr, P, N, et, W, ae, We, de ]);
1606
+ var tt = function e(r) {
1607
+ var t = r.anchorWidth, l = r.maxHeight, o = r.placement, i = r.toggleId;
1608
+ var u = er({
1609
+ anchorWidth: t,
1610
+ isMultiple: N,
1611
+ maxHeight: l,
1612
+ menuStyle: B
1613
+ });
1614
+ var c = qr.length > 0 && !Zr && !g ? 0 : undefined;
1615
+ var s = {
1616
+ "aria-multiselectable": N || undefined,
1617
+ childrenStart: !!g && n().createElement(sr, {
1618
+ activeItemId: we,
1619
+ filterA11yId: Ar,
1620
+ filterKeyword: qe,
1621
+ hasChildren: rt.some((function(e) {
1622
+ return tr(e);
1623
+ })),
1624
+ inputId: x,
1625
+ inputRef: j,
1626
+ menuListboxId: ke,
1627
+ multiple: N,
1628
+ onClearAll: Kr,
1629
+ onSelectAll: Fr,
1630
+ onTextBlur: Jr,
1631
+ onTextChange: Xr,
1632
+ onTextFocus: Ur,
1633
+ onTextKeyDown: zr,
1634
+ optionSelection: jr,
1635
+ placement: o,
1636
+ selectAllAppearance: ae,
1637
+ textHasFocus: We
1638
+ }),
1639
+ focusMode: g ? "never" : undefined,
1640
+ isLoading: P,
1641
+ labelledBy: "".concat(Ar !== null && Ar !== void 0 ? Ar : "", " ").concat(i !== null && i !== void 0 ? i : "").trim(),
1642
+ // NVDA ignores aria-labelledby attribute on popover, but reads it on menu
1643
+ menuId: ke,
1644
+ onScrollBottom: W ? Hr : undefined,
1645
+ placement: o !== null && o !== void 0 ? o : undefined,
1646
+ noOptionsMessage: K,
1647
+ footerMessage: S,
1648
+ animateLoading: a,
1649
+ loadingMessage: I,
1650
+ onScroll: z,
1651
+ style: u,
1652
+ tabIndex: c
1653
+ };
1654
+ if (fe) {
1655
+
1656
+ return n().createElement(C.VirtualizedResultsMenu, _e({
1657
+ virtualization: fe
1658
+ }, s), rt);
1659
+ }
1660
+
1661
+ return n().createElement(k(), s, rt);
1662
+ };
1663
+ var nt = (0, t.useMemo)((function() {
1664
+
1665
+ return n().createElement(pr, _e({
1666
+ appearance: i,
1667
+ append: u,
1668
+ currentValues: qr,
1669
+ "data-test": N ? "multiselect" : "select",
1670
+ describedBy: v,
1671
+ disabled: b,
1672
+ elementRef: Yr,
1673
+ error: y,
1674
+ inline: O,
1675
+ labelText: A,
1676
+ labelledBy: E,
1677
+ multiple: N,
1678
+ onClick: X,
1679
+ placeholder: Z,
1680
+ prefixLabel: ee,
1681
+ prepend: re,
1682
+ required: Q,
1683
+ suffixLabel: ue,
1684
+ toggle: de,
1685
+ toggleContent: ve,
1686
+ maxLabelItems: me
1687
+ }, ye), s);
1688
+ }), [ i, u, qr, N, v, b, Yr, y, O, A, E, X, Z, ee, re, Q, ue, de, ve, me, ye, s ]);
1689
+
1690
+ return n().createElement(h(), {
1691
+ closeReasons: rr,
1692
+ inputId: x,
1693
+ "aria-labelledby": Ar,
1694
+ toggle: nt,
1695
+ onRequestOpen: _r,
1696
+ onRequestClose: Br,
1697
+ open: Ve,
1698
+ openWithArrowKeys: true,
1699
+ repositionMode: ne,
1700
+ defaultPlacement: d,
1701
+ canCoverAnchor: Ae().innerHeight < 500,
1702
+ retainFocus: false,
1703
+ takeFocus: qr.length === 0 || qr.length > 0 && !Zr || !!g
1704
+ }, tt);
1705
+ }
1706
+ br.propTypes = Ye;
1707
+ br.componentType = "SelectBase";
1708
+ br.Option = U;
1709
+ br.Divider = w.Divider;
1710
+ br.Heading = w.Heading;
1711
+ /* harmony default export */ const mr = br;
1712
+ // CONCATENATED MODULE: ./src/SelectBase/index.ts
1713
+ module.exports = r;
1714
+ /******/})();