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