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