@splunk/react-ui 5.3.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 (60) hide show
  1. package/Accordion.js +31 -31
  2. package/Avatar.js +13 -13
  3. package/Breadcrumbs.js +66 -63
  4. package/ButtonSimple.js +52 -52
  5. package/CHANGELOG.md +16 -0
  6. package/CardLayout.js +39 -36
  7. package/Clickable.js +5 -6
  8. package/Code.js +424 -528
  9. package/CollapsiblePanel.js +1 -1
  10. package/Color.js +903 -1025
  11. package/DefinitionList.js +1 -1
  12. package/FormRows.js +13 -11
  13. package/JSONTree.js +682 -1408
  14. package/Link.js +5 -5
  15. package/Markdown.js +9 -5
  16. package/Menu.js +72 -67
  17. package/Multiselect.js +2692 -2780
  18. package/Popover.js +201 -196
  19. package/Resize.js +11 -8
  20. package/ResultsMenu.js +913 -1030
  21. package/ScreenReaderContent.js +86 -130
  22. package/Scroll.js +366 -425
  23. package/Select.js +1741 -1832
  24. package/Slider.js +1 -1
  25. package/SlidingPanels.js +129 -127
  26. package/StepBar.js +123 -97
  27. package/Switch.js +115 -111
  28. package/TabBar.js +10 -10
  29. package/Table.js +1239 -1240
  30. package/TextArea.js +596 -684
  31. package/Tree.js +638 -682
  32. package/package.json +11 -11
  33. package/types/src/Breadcrumbs/Breadcrumbs.d.ts +1 -5
  34. package/types/src/Breadcrumbs/BreadcrumbsContext.d.ts +7 -0
  35. package/types/src/Breadcrumbs/Item.d.ts +1 -1
  36. package/types/src/ButtonSimple/mixin.d.ts +1 -1
  37. package/types/src/JSONTree/JSONTreeItem.d.ts +1 -1
  38. package/types/src/JSONTree/renderTreeItems.d.ts +1 -1
  39. package/types/src/Modal/ModalContext.d.ts +1 -1
  40. package/types/src/Multiselect/Compact.d.ts +2 -2
  41. package/types/src/Multiselect/Normal.d.ts +2 -2
  42. package/types/src/Number/utils.d.ts +1 -1
  43. package/types/src/Popover/getPlacement.d.ts +1 -1
  44. package/types/src/RadioList/Option.d.ts +1 -1
  45. package/types/src/RadioList/RadioListContext.d.ts +1 -1
  46. package/types/src/StepBar/StepBar.d.ts +4 -1
  47. package/types/src/StepBar/StepBarContext.d.ts +1 -0
  48. package/types/src/StepBar/docs/examples/Vertical.d.ts +6 -0
  49. package/types/src/Switch/Switch.d.ts +7 -1
  50. package/types/src/TabBar/Tab.d.ts +3 -1
  51. package/types/src/TabBar/docs/examples/Icons.d.ts +4 -0
  52. package/types/src/TabBar/docs/examples/Tooltips.d.ts +3 -0
  53. package/types/src/TabLayout/Panel.d.ts +2 -0
  54. package/types/src/Table/Head.d.ts +1 -1
  55. package/types/src/Table/Row.d.ts +1 -1
  56. package/types/src/Table/Table.d.ts +1 -0
  57. package/types/src/Tree/TreeContext.d.ts +1 -1
  58. package/useControlled.js +61 -97
  59. package/usePrevious.js +30 -62
  60. package/useResizeObserver.js +95 -127
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,1861 +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
- // @docs-props-type SelectAllOptionPropsBase
544
- // When toggle is changed the total count is not displayed anymore so the count is now shown in the Select all menu item
545
- var d = u != null ? " (".concat(u === null || u === void 0 ? void 0 : u.toString(), ")") : "";
546
-
547
- return n().createElement(S, pe({
548
- active: r,
549
- elementRef: t,
550
- "aria-keyshortcuts": "Control+A",
551
- "data-test": "select-all",
552
- description: "".concat(d, " Ctrl-a"),
553
- descriptionPosition: "right",
554
- id: l,
555
- key: "selectAll",
556
- multiple: true,
557
- label: o,
558
- onClick: a,
559
- selected: i,
560
- role: "menuitemcheckbox",
561
- value: s
562
- }, 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;
563
539
  }
564
- Ce.propTypes = Se;
565
- /* harmony default export */ const we = Ce;
566
- // CONCATENATED MODULE: external "styled-components"
567
- const ke = require("styled-components");
568
- var xe = r.n(ke);
569
- // CONCATENATED MODULE: external "@splunk/react-ui/Button"
570
- const je = require("@splunk/react-ui/Button");
571
- var Pe = r.n(je);
572
- // CONCATENATED MODULE: external "@splunk/react-ui/Divider"
573
- const Ee = require("@splunk/react-ui/Divider");
574
- var Re = r.n(Ee);
575
- // CONCATENATED MODULE: external "@splunk/themes"
576
- const Me = require("@splunk/themes");
577
- // CONCATENATED MODULE: ./src/Select/SelectBaseStyles.ts
578
- var Ae = xe()(Pe()).withConfig({
579
- displayName: "SelectBaseStyles__StyledButton",
580
- componentId: "sc-16cj7sk-0"
581
- })([ "&[data-inline]{width:", ";}", "" ], (function(e) {
582
- var n = e.$multiple;
583
- return n ? "400px" : "auto";
584
- }), (function(e) {
585
- var n = e.$multiple;
586
- return !n && "flex-grow: 0;";
587
- }));
588
- var Te = xe().span.withConfig({
589
- displayName: "SelectBaseStyles__StyledLinkIcon",
590
- componentId: "sc-16cj7sk-1"
591
- })([ "padding-right:", ";" ], Me.variables.spacingXSmall);
592
- var Ie = xe().span.withConfig({
593
- displayName: "SelectBaseStyles__StyledLinkCaret",
594
- componentId: "sc-16cj7sk-2"
595
- })([ "padding-left:", ";" ], Me.variables.spacingXSmall);
596
- var qe = xe().div.withConfig({
597
- displayName: "SelectBaseStyles__StyledFilter",
598
- componentId: "sc-16cj7sk-3"
599
- })([ "padding:", " ", " ", ";min-width:160px;" ], Me.variables.spacingLarge, Me.variables.spacingLarge, Me.variables.spacingSmall);
600
- var Le = xe().span.withConfig({
601
- displayName: "SelectBaseStyles__StyledCount",
602
- componentId: "sc-16cj7sk-4"
603
- })([ "padding-right:", ";" ], Me.variables.spacingXSmall);
604
- var De = xe()(ee()).withConfig({
605
- displayName: "SelectBaseStyles__StyledControlsLink",
606
- componentId: "sc-16cj7sk-5"
607
- })([ "", ";" ], (function(e) {
608
- var n = e.$disabled;
609
- return n && (0, ke.css)([ "color:", ";" ], Me.variables.contentColorDisabled);
610
- }));
611
- var Ne = xe().div.withConfig({
612
- displayName: "SelectBaseStyles__StyledToggleAllControls",
613
- componentId: "sc-16cj7sk-6"
614
- })([ "", ";gap:", ";padding:", " ", " ", ";" ], Me.mixins.reset("flex"), Me.variables.spacingMedium, Me.variables.spacingXSmall, Me.variables.spacingLarge, Me.variables.spacingSmall);
615
- var _e = xe()(Re()).withConfig({
616
- displayName: "SelectBaseStyles__StyledControlsDivider",
617
- componentId: "sc-16cj7sk-7"
618
- })([ "border-color:", ";" ], Me.variables.borderColor);
619
- // EXTERNAL MODULE: ./src/useControlled/index.ts + 2 modules
620
- var Be = r(3639);
621
- // CONCATENATED MODULE: ./src/utils/fuzzyMatch.ts
622
- // A utility for matching keyboard characters to list values
623
- var Ve = function e(n, r) {
624
- return n ? n.label.charAt(r).toLowerCase() : "";
625
- };
626
- var Ke = function e(n, r) {
627
- if (!n.length) {
628
- 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;
629
547
  }
630
- var t = null;
631
- var l = false;
632
- var o = n.filter((function(e) {
633
- var n = Ve(e, r.index);
634
- if (n === r.value) {
635
- l = true;
636
- return true;
637
- }
638
- // If we haven't found a match yet, keep track of the next closest match.
639
- // Secondary matching looks for the closest character of a higher value, and failing that, closest of a lower value.
640
- if (!l) {
641
- var o = Ve(t, r.index);
642
- if (!o) {
643
- t = e;
644
- } else if (n > r.value) {
645
- if (o < r.value) {
646
- t = e;
647
- } else if (o > n) {
648
- t = e;
649
- }
650
- } else if (n > o) {
651
- 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;
652
559
  }
560
+ } else if (n > o) {
561
+ r = e;
653
562
  }
654
- return false;
655
- }));
656
- return o.length === 0 && t ? [ t ] : o;
657
- };
658
- // CONCATENATED MODULE: ./src/utils/ssrDocument.ts
659
- /* eslint-disable @typescript-eslint/no-empty-function */
660
- var Fe = {
661
- body: {
662
- appendChild: function e() {
663
- return [];
664
- }
665
- },
666
- addEventListener: function e() {},
667
- removeEventListener: function e() {},
668
- activeElement: {
669
- blur: function e() {},
670
- nodeName: ""
671
- },
672
- querySelector: function e() {
673
- return null;
674
- },
675
- 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() {
676
573
  return [];
677
- },
678
- getElementById: function e() {
679
- return null;
680
- },
681
- createEvent: function e() {
682
- return {
683
- initEvent: function e() {}
684
- };
685
- },
686
- createElement: function e() {
687
- return {
688
- children: [],
689
- childNodes: [],
690
- style: {},
691
- setAttribute: function e() {},
692
- getElementsByTagName: function e() {
693
- return [];
694
- }
695
- };
696
- },
697
- createElementNS: function e() {
698
- return {};
699
- },
700
- importNode: function e() {
701
- return null;
702
- },
703
- location: {
704
- hash: "",
705
- host: "",
706
- hostname: "",
707
- href: "",
708
- origin: "",
709
- pathname: "",
710
- protocol: "",
711
- search: ""
712
574
  }
713
- };
714
- function He() {
715
- var e = typeof document !== "undefined" ? document : Fe;
716
- return e;
717
- }
718
- var ze = He();
719
- /* harmony default export */ const We = /* unused pure expression or super */ null && ze;
720
- // CONCATENATED MODULE: ./src/utils/ssrWindow.ts
721
- /* eslint-disable @typescript-eslint/no-empty-function */
722
- var $e = {
723
- document: Fe,
724
- navigator: {
725
- userAgent: ""
726
- },
727
- location: {
728
- hash: "",
729
- host: "",
730
- hostname: "",
731
- href: "",
732
- origin: "",
733
- pathname: "",
734
- protocol: "",
735
- search: ""
736
- },
737
- history: {
738
- replaceState: function e() {},
739
- pushState: function e() {},
740
- go: function e() {},
741
- back: function e() {}
742
- },
743
- CustomEvent: function e() {
744
- return this;
745
- },
746
- addEventListener: function e() {},
747
- removeEventListener: function e() {},
748
- getComputedStyle: function e() {
749
- return {
750
- getPropertyValue: function e() {
751
- return "";
752
- }
753
- };
754
- },
755
- Image: function e() {},
756
- Date: function e() {},
757
- screen: {},
758
- setTimeout: function e() {},
759
- clearTimeout: function e() {},
760
- matchMedia: function e() {
761
- return {};
762
- },
763
- requestAnimationFrame: function e(n) {
764
- if (typeof setTimeout === "undefined") {
765
- n();
766
- 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 [];
767
604
  }
768
- return setTimeout(n, 0);
769
- },
770
- cancelAnimationFrame: function e(n) {
771
- if (typeof setTimeout === "undefined") {
772
- 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 "";
773
662
  }
774
- 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;
775
677
  }
776
- };
777
- function Xe() {
778
- var e = typeof window !== "undefined" ? window : $e;
779
- return e;
678
+ return setTimeout(n, 0);
679
+ },
680
+ cancelAnimationFrame: function e(n) {
681
+ if (typeof setTimeout === "undefined") {
682
+ return;
683
+ }
684
+ clearTimeout(n);
780
685
  }
781
- var Ue = Xe();
782
- /* harmony default export */ const Je = /* unused pure expression or super */ null && Ue;
783
- // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
784
- /**
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
+ /**
785
695
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
786
696
  *
787
697
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
788
698
  * @param current - The new value of the ref.
789
699
  */
790
- function Ge(e, n) {
791
- if (e) {
792
- if (typeof e === "function") {
793
- e(n);
794
- } else {
795
- // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
796
- // the intention here is to signal "we will take care of setting 'current', not you".
797
- 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;
798
708
  // eslint-disable-line no-param-reassign
799
- }
800
- }
801
- }
802
- // CONCATENATED MODULE: ./src/Select/SelectBase.tsx
803
- function Qe(e) {
804
- return en(e) || Ze(e) || ln(e) || Ye();
805
- }
806
- function Ye() {
807
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
808
- }
809
- function Ze(e) {
810
- if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
811
- }
812
- function en(e) {
813
- if (Array.isArray(e)) return on(e);
709
+ }
814
710
  }
815
- function nn() {
816
- return nn = Object.assign ? Object.assign.bind() : function(e) {
817
- for (var n = 1; n < arguments.length; n++) {
818
- var r = arguments[n];
819
- for (var t in r) {
820
- ({}).hasOwnProperty.call(r, t) && (e[t] = r[t]);
821
- }
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]);
822
731
  }
823
- return e;
824
- }, nn.apply(null, arguments);
825
- }
826
- function rn(e, n) {
827
- return un(e) || an(e, n) || ln(e, n) || tn();
828
- }
829
- function tn() {
830
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
831
- }
832
- function ln(e, n) {
833
- if (e) {
834
- if ("string" == typeof e) return on(e, n);
835
- var r = {}.toString.call(e).slice(8, -1);
836
- 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;
837
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;
838
747
  }
839
- function on(e, n) {
840
- (null == n || n > e.length) && (n = e.length);
841
- for (var r = 0, t = Array(n); r < n; r++) {
842
- t[r] = e[r];
843
- }
844
- 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];
845
753
  }
846
- function an(e, n) {
847
- var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
848
- if (null != r) {
849
- 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 {
850
769
  try {
851
- if (o = (r = r.call(e)).next, 0 === n) {
852
- if (Object(r) !== r) return;
853
- u = !1;
854
- } else for (;!(u = (t = o.call(r)).done) && (i.push(t.value), i.length !== n); u = !0) {
855
- }
856
- } catch (e) {
857
- c = !0, l = e;
770
+ if (!u && null != t["return"] && (a = t["return"](), Object(a) !== a)) return;
858
771
  } finally {
859
- try {
860
- if (!u && null != r["return"] && (a = r["return"](), Object(a) !== a)) return;
861
- } finally {
862
- if (c) throw l;
863
- }
772
+ if (c) throw l;
864
773
  }
865
- return i;
866
774
  }
775
+ return i;
867
776
  }
868
- function un(e) {
869
- if (Array.isArray(e)) return e;
870
- }
871
- function cn(e, n) {
872
- if (null == e) return {};
873
- var r, t, l = sn(e, n);
874
- if (Object.getOwnPropertySymbols) {
875
- var o = Object.getOwnPropertySymbols(e);
876
- for (t = 0; t < o.length; t++) {
877
- r = o[t], -1 === n.indexOf(r) && {}.propertyIsEnumerable.call(e, r) && (l[r] = e[r]);
878
- }
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]);
879
788
  }
880
- return l;
881
789
  }
882
- function sn(e, n) {
883
- if (null == e) return {};
884
- var r = {};
885
- for (var t in e) {
886
- if ({}.hasOwnProperty.call(e, t)) {
887
- if (-1 !== n.indexOf(t)) continue;
888
- r[t] = e[t];
889
- }
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];
890
799
  }
891
- return r;
892
800
  }
893
- function fn(e) {
894
- "@babel/helpers - typeof";
895
- return fn = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
896
- return typeof e;
897
- } : function(e) {
898
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
899
- }, 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);
900
818
  }
901
- function dn(e, n) {
902
- var r = Object.keys(e);
903
- if (Object.getOwnPropertySymbols) {
904
- var t = Object.getOwnPropertySymbols(e);
905
- n && (t = t.filter((function(n) {
906
- return Object.getOwnPropertyDescriptor(e, n).enumerable;
907
- }))), r.push.apply(r, t);
908
- }
909
- 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
+ }));
910
829
  }
911
- function pn(e) {
912
- for (var n = 1; n < arguments.length; n++) {
913
- var r = null != arguments[n] ? arguments[n] : {};
914
- n % 2 ? dn(Object(r), !0).forEach((function(n) {
915
- vn(e, n, r[n]);
916
- })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : dn(Object(r)).forEach((function(n) {
917
- Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
918
- }));
919
- }
920
- 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.");
921
851
  }
922
- function vn(e, n, r) {
923
- return (n = bn(n)) in e ? Object.defineProperty(e, n, {
924
- value: r,
925
- enumerable: !0,
926
- configurable: !0,
927
- writable: !0
928
- }) : 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);
929
988
  }
930
- function bn(e) {
931
- var n = mn(e, "string");
932
- return "symbol" == fn(n) ? n : n + "";
989
+ if (l) {
990
+ o = M()(o).concat(" ".concat(l));
933
991
  }
934
- function mn(e, n) {
935
- if ("object" != fn(e) || !e) return e;
936
- var r = e[Symbol.toPrimitive];
937
- if (void 0 !== r) {
938
- var t = r.call(e, n || "default");
939
- if ("object" != fn(t)) return t;
940
- 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._)(", "));
941
1022
  }
942
- 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
+ });
943
1040
  }
944
- var yn = {
945
- allowKeyMatching: o().bool,
946
- allowNewValues: o().bool,
947
- animateLoading: o().bool,
948
- appearance: o().oneOf([ "default", "link", "subtle" ]),
949
- append: o().bool,
950
- children: o().node,
951
- defaultPlacement: o().oneOf([ "above", "below", "vertical" ]),
952
- defaultValues: o().array,
953
- describedBy: o().string,
954
- disabled: o().bool,
955
- elementRef: o().oneOfType([ o().func, o().object ]),
956
- error: o().bool,
957
- filter: o().oneOf([ false, true, "controlled" ]),
958
- footerMessage: o().node,
959
- inline: o().bool,
960
- inputId: o().string,
961
- inputRef: o().oneOfType([ o().func, o().object ]),
962
- isLoadingOptions: o().bool,
963
- labelledBy: o().string,
964
- labelText: o().string,
965
- loadingMessage: o().node,
966
- menuStyle: o().object,
967
- multiple: o().bool,
968
- name: o().string,
969
- noOptionsMessage: o().node,
970
- onChange: o().func,
971
- onClick: o().func,
972
- onClose: o().func,
973
- onFilterChange: o().func,
974
- onOpen: o().func,
975
- onScroll: o().func,
976
- onScrollBottom: o().func,
977
- /** @private. */
978
- required: o().bool,
979
- placeholder: o().string,
980
- prefixLabel: o().string,
981
- prepend: o().bool,
982
- repositionMode: o().oneOf([ "none", "flip" ]),
983
- selectAllAppearance: o().oneOf([ "buttongroup", "checkbox", "none" ]),
984
- showSelectedValuesFirst: o().oneOf([ "nextOpen", "immediately", "never" ]),
985
- suffixLabel: o().string,
986
- tabConfirmsNewValue: o().bool,
987
- toggle: o().node,
988
- toggleContent: o().oneOf([ "optionChildren", "optionLabel" ]),
989
- values: o().array,
990
- /** @private. */
991
- virtualization: o().number
992
- };
993
- var gn = V()((function(e) {
994
- return [ e ];
995
- }));
996
- // preserve separate widths for single vs. multi mode
997
- var hn = V()((function(e) {
998
- var n = e.anchorWidth, r = e.isMultiple, t = e.maxHeight, l = e.menuStyle;
999
- return r ? pn({
1000
- width: Math.max(n !== null && n !== void 0 ? n : 0, 200),
1001
- maxHeight: t
1002
- }, l) : pn({
1003
- minWidth: n !== null && n !== void 0 ? n : undefined,
1004
- maxWidth: Math.max(n !== null && n !== void 0 ? n : 0, 300),
1005
- maxHeight: t
1006
- }, l);
1007
- }));
1008
- var On = [ "clickAway", "escapeKey", "offScreen", "tabKey", "toggleClick" ];
1009
- function Sn(e) {
1010
- 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;
1011
1048
  }
1012
- function Cn(e, n) {
1013
- 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"] = _;
1014
1071
  }
1015
- var wn = [ "append", "error", "prepend" ];
1016
- var kn = (0, u._)("No matches");
1017
- var xn = (0, u._)("Select...");
1018
- var jn = n().createElement(G(), null);
1019
- var Pn = function e(r) {
1020
- 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;
1021
- var C = (0, u._)("Select all options".concat(g.current === "all" ? " disabled" : ""));
1022
- var w = (0, u._)("Clear all options".concat(g.current === "none" ? " disabled" : ""));
1023
- // only visually disable these as opposed to fully disabling to avoid losing keyboard focus - see SUI-2731
1024
- var k = n().createElement(Ne, {
1025
- key: "selectAll"
1026
- }, n().createElement(De, {
1027
- disabled: g.current === "all",
1028
- appearance: "standalone",
1029
- "aria-label": C,
1030
- onClick: p,
1031
- "data-test": "select-all",
1032
- tag: "button"
1033
- }, o ? (0, u._)("Select all Matches") : (0, u._)("Select all")), n().createElement(De, {
1034
- disabled: g.current === "none",
1035
- appearance: "standalone",
1036
- "aria-label": w,
1037
- onClick: d,
1038
- "data-test": "clear-all",
1039
- tag: "button"
1040
- }, o ? (0, u._)("Clear all Matches") : (0, u._)("Clear all")));
1072
+ if (x) {
1041
1073
 
1042
- return n().createElement("div", {
1043
- key: "controls"
1044
- }, l && n().createElement(le(), {
1045
- id: l
1046
- }, (0, u._)("Type to filter")), h === "above" && n().createElement(_e, null), n().createElement(qe, {
1047
- key: "filter",
1048
- "data-test": "filter"
1049
- }, n().createElement(ae(), {
1050
- value: o,
1051
- autoCapitalize: "off",
1052
- autoComplete: "off",
1053
- autoCorrect: "off",
1054
- spellCheck: false,
1055
- onChange: b,
1056
- onKeyDown: y,
1057
- onFocus: m,
1058
- onBlur: v,
1059
- placeholder: (0, u._)("filter"),
1060
- role: "combobox",
1061
- "aria-expanded": "true",
1062
- "aria-controls": s,
1063
- "aria-owns": S && a ? t : undefined,
1064
- "aria-label": (0, u._)("Filter"),
1065
- "aria-autocomplete": "list",
1066
- "aria-activedescendant": S && a ? t : undefined,
1067
- inputRef: c,
1068
- inputId: i,
1069
- canClear: true,
1070
- startAdornment: jn
1071
- })), f && a && O === "buttongroup" && k, h === "below" && n().createElement(_e, null));
1072
- };
1073
- var En = function e(n) {
1074
- var r = n.prefixLabel, t = n.label, l = n.suffixLabel;
1075
- var o = t;
1076
- if (r) {
1077
- 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("");
1078
1162
  }
1079
- if (l) {
1080
- o = M()(o).concat(" ".concat(l));
1163
+ if (n !== Ie) {
1164
+ H === null || H === void 0 ? void 0 : H(e, {
1165
+ keyword: Ie
1166
+ });
1081
1167
  }
1082
- return o;
1083
- };
1084
- var Rn = n().forwardRef((function(r, t) {
1085
- 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" ]);
1086
- var E;
1087
- var R;
1088
- var M = [];
1089
- // Generate buttonLabels
1090
- var A = e.Children.toArray(i);
1091
- var I = s.reduce((function(e, n, r, t) {
1092
- var l = T()(A, (function(e) {
1093
- return Sn(e) && e.props.value === n;
1094
- }));
1095
- if (l) {
1096
- var o = l.props, a = o.children, i = o.icon, c = o.label;
1097
- var f = j !== "optionLabel" && a ? a : c;
1098
- e.push(f);
1099
- M.push(c);
1100
- // if not in multiple mode, add the icon
1101
- if (!g && s.length === 1) {
1102
- E = i;
1103
- }
1104
- } else if (g) {
1105
- // only add values that don't match an option in "multiple" mode to preserve old behaviour
1106
- e.push(n);
1107
- 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);
1108
1177
  }
1109
- if (r < t.length - 1) {
1110
- e.push((0, u._)(", "));
1111
- 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 ]);
1112
1196
  }
1113
- return e;
1114
- }), []);
1115
- R = I;
1116
- // only apply prefix / suffix if the label is not empty
1117
- if (R.length > 0) {
1118
- // If there's more than one item selected, read out the selected total
1119
- // rather than reading out each selected item
1120
- M = En({
1121
- prefixLabel: S,
1122
- label: R.length > 1 ? [ "".concat(s.length, " items selected") ] : M,
1123
- suffixLabel: k
1124
- });
1125
- R = En({
1126
- prefixLabel: S,
1127
- label: R,
1128
- suffixLabel: k
1129
- });
1197
+ } else {
1198
+ // non-multiple mode must always have a value
1199
+ o = [ n ];
1130
1200
  }
1131
- // single <Select> behaviour is to show the placeholder if all parts of the label
1132
- // are empty strings so we replicate this behaviour here
1133
- if (R.length === 0 || !g && R.every((function(e) {
1134
- return e === "";
1135
- }))) {
1136
- R = gn(O);
1137
- M = R;
1201
+ var a = !Oe;
1202
+ if (a) {
1203
+ tn(o);
1138
1204
  }
1139
- var q = Object.keys(P).includes("aria-labelledby");
1140
- var L = pn({
1141
- "aria-describedby": f,
1142
- "aria-label": y || q ? undefined : "".concat(m ? "".concat(m, ", ") : "").concat(M.join("")),
1143
- // aria-labelledby takes precedence over aria-label, so existence of both is redundant
1144
- "aria-labelledby": y,
1145
- "aria-required": w,
1146
- "data-select-appearance": o,
1147
- append: a,
1148
- prepend: C,
1149
- onClick: h,
1150
- role: "combobox",
1151
- disabled: d ? "disabled" : undefined,
1152
- elementRef: p,
1153
- error: v,
1154
- ref: t
1155
- }, P);
1156
- if (g) {
1157
- 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
+ }
1158
1210
  } else {
1159
- var D = rn(s, 1), N = D[0];
1160
- 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();
1161
1218
  }
1162
- if (x) {
1163
-
1164
- 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);
1165
1230
  }
1166
- if (o === "link") {
1167
-
1168
- return n().createElement(ee(), nn({
1169
- tag: "button",
1170
- appearance: "standalone"
1171
- }, L, {
1172
- "data-select-appearance": "link"
1173
- }), !!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;
1174
1237
  }
1175
- // Using Button's secondary appearance as Select's default appearance.
1176
- var _ = o === "default" ? "secondary" : o;
1177
-
1178
- return n().createElement(Ae, nn({}, L, {
1179
- $multiple: g,
1180
- appearance: _,
1181
- label: R,
1182
- error: v,
1183
- icon: E,
1184
- inline: b,
1185
- isMenu: true,
1186
- onClick: h
1187
- }, F()(P, wn)), !!s.length && g && n().createElement(Le, {
1188
- "data-role": "count"
1189
- }, "(", s.length, ")"));
1190
- }));
1191
- function Mn(r) {
1192
- 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" ]);
1193
- // @docs-props-type SelectBasePropsBase
1194
- var he = (0, Be["default"])({
1195
- componentName: "SelectBase",
1196
- /* eslint-disable-next-line prefer-rest-params */
1197
- componentProps: arguments[0],
1198
- // see SUI-7028
1199
- defaultValuePropName: "defaultValues",
1200
- 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"
1201
1252
  });
1202
- // states
1203
- var Oe = (0, e.useState)((function() {
1204
- return {
1205
- activeItemId: (0, se.createDOMID)("active-item"),
1206
- menuListboxId: (0, se.createDOMID)("menu-listbox")
1207
- };
1208
- })), Se = rn(Oe, 1), Ce = Se[0], ke = Ce.activeItemId, xe = Ce.menuListboxId;
1209
- var je = (0, e.useState)(0), Pe = rn(je, 2), Ee = Pe[0], Re = Pe[1];
1210
- var Me = (0, e.useState)(""), Ae = rn(Me, 2), Te = Ae[0], Ie = Ae[1];
1211
- var qe = (0, e.useState)(false), Le = rn(qe, 2), De = Le[0], Ne = Le[1];
1212
- var _e = (0, e.useState)(false), Ve = rn(_e, 2), Fe = Ve[0], He = Ve[1];
1213
- var ze = (0, e.useState)([]), We = rn(ze, 2), $e = We[0], Ue = We[1];
1214
- var Je = (0, e.useState)(b || []), Ye = rn(Je, 2), Ze = Ye[0], en = Ye[1];
1215
- // previous state
1216
- var tn = ue()(Ee);
1217
- // refs
1218
- var ln = (0, e.useRef)(null);
1219
- var on = (0, e.useRef)(null);
1220
- var an = (0, e.useRef)(null);
1221
- var un = (0, e.useRef)([]);
1222
- var sn = (0, e.useRef)([]);
1223
- var fn = (0, e.useRef)(tn);
1224
- var dn = (0, e.useRef)();
1225
- var pn = (0, e.useRef)({});
1226
- var vn = (0, e.useRef)(0);
1227
- var bn = (0, e.useRef)([]);
1228
- var mn = (0, e.useRef)(null);
1229
- var yn = (0, e.useRef)();
1230
- var gn = (0, e.useRef)(0);
1231
- var wn = (0, e.useRef)("none");
1232
- var jn = (0, e.useState)(O ? (0, se.createDOMID)("filter") : undefined), En = rn(jn, 1), Mn = En[0];
1233
- (0, e.useEffect)((function() {
1234
- if (false) {}
1235
- }), [ i, s, h, Z ]);
1236
- var An = (0, e.useCallback)((function() {
1237
- var e = he ? pe : Ze;
1238
- return I || e == null ? e : e.slice(0, 1);
1239
- }), [ he, I, pe, Ze ]);
1240
- var Tn = (0, e.useCallback)((function() {
1241
- var e;
1242
- // in non-multiple mode, don't move values to the top of the list
1243
- return I && ae !== "never" ? (e = An()) !== null && e !== void 0 ? e : [] : [];
1244
- }), [ An, I, ae ]);
1245
- var In = (0, e.useCallback)((function(e) {
1246
- var n = Te;
1247
- Ne(true);
1248
- Ue(Tn());
1249
- // SUI-3234: preserve existing behavior difference between <Select> and <Multiselect.Compact>
1250
- if (I) {
1251
- Ie("");
1252
- }
1253
- if (n !== Te) {
1254
- F === null || F === void 0 ? void 0 : F(e, {
1255
- keyword: Te
1256
- });
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);
1257
1288
  }
1258
- }), [ Te, Tn, I, F ]);
1259
- (0, e.useEffect)((function() {
1260
- if (De) {
1261
- X === null || X === void 0 ? void 0 : X();
1262
- if (mn.current && !O) {
1263
- 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);
1264
1295
  } else {
1265
- var e;
1266
- Re((e = yn.current) !== null && e !== void 0 ? e : 0);
1296
+ _n(e);
1267
1297
  }
1268
1298
  }
1269
- }), [ X, De, $e, Te, O ]);
1270
- var qn = (0, e.useCallback)((function() {
1271
- Ne(false);
1272
- Re(0);
1273
- fn.current = null;
1274
- W === null || W === void 0 ? void 0 : W();
1275
- }), [ W ]);
1276
- var Ln = (0, e.useCallback)((function(e, n) {
1277
- var r;
1278
- var t = (r = An()) !== null && r !== void 0 ? r : [];
1279
- var l = t.indexOf(n);
1280
- var o;
1281
- if (I) {
1282
- if (l >= 0) {
1283
- 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);
1284
1320
  } else {
1285
- o = t.concat([ n ]);
1321
+ _n(e);
1286
1322
  }
1287
1323
  } else {
1288
- // non-multiple mode must always have a value
1289
- o = [ n ];
1324
+ e.preventDefault();
1325
+ Ln(e, dn.current);
1290
1326
  }
1291
- var a = !he;
1292
- if (a) {
1293
- 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);
1294
1355
  }
1295
- if (I) {
1296
- // in uncontrolled multiple mode, keep the menu open
1297
- if (a) {
1298
- 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
+ }
1299
1365
  }
1300
- } else {
1301
- var i;
1302
- // non-multiple mode only supports a single selection
1303
- // so close the menu once a selection is made
1304
- qn({
1305
- reason: "contentClick"
1306
- });
1307
- (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);
1308
1370
  }
1309
- B === null || B === void 0 ? void 0 : B(e, {
1310
- values: o,
1311
- name: L,
1312
- reason: "valueToggle"
1313
- });
1314
- }), [ An, qn, he, I, L, B ]);
1315
- var Dn = function e() {
1316
- on.current = null;
1317
- un.current = [];
1371
+ cn.current = r;
1372
+ on.current = l;
1318
1373
  if (an.current) {
1319
1374
  clearTimeout(an.current);
1320
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
+ };
1321
1437
  };
1322
- var Nn = (0, e.useCallback)((function(e) {
1323
- var r;
1324
- // this doesn't make sense if we can't select multiple values
1325
- if (!I) {
1326
- return;
1327
- }
1328
- var t = (r = An()) !== null && r !== void 0 ? r : [];
1329
- var l = z()(t.concat(bn.current));
1330
- l = n().Children.toArray(d).filter((function(e) {
1331
- return Sn(e) && _()(l, e.props.value) && (!e.props.disabled || _()(t, e.props.value));
1332
- })).map((function(e) {
1333
- return e.props.value;
1334
- }));
1335
- if (!he) {
1336
- 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;
1337
1448
  }
1338
- B === null || B === void 0 ? void 0 : B(e, {
1339
- values: l,
1340
- name: L,
1341
- reason: "selectAll"
1342
- });
1343
- }), [ d, An, he, I, L, B ]);
1344
- var _n = (0, e.useCallback)((function(e) {
1345
- var r;
1346
- // this doesn't make sense if we can't select multiple values
1347
- if (!I) {
1348
- 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;
1349
1453
  }
1350
- var t = (r = An()) !== null && r !== void 0 ? r : [];
1351
- var l = $().apply(void 0, [ t ].concat(Qe(bn.current)));
1352
- // this will unselect all selected values unless those values are disabled or hidden by the filter
1353
- var o = n().Children.toArray(d).filter((function(e) {
1354
- return Sn(e) && (_()(t, e.props.value) && e.props.disabled || _()(l, e.props.value));
1355
- })).map((function(e) {
1356
- return e.props.value;
1357
- }));
1358
- if (!he) {
1359
- 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;
1360
1465
  }
1361
- B === null || B === void 0 ? void 0 : B(e, {
1362
- values: o,
1363
- name: L,
1364
- 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"
1365
1477
  });
1366
- }), [ d, An, he, I, L, B ]);
1367
- var Bn = (0, e.useCallback)((function(e) {
1368
- if (De && !j) {
1369
- K === null || K === void 0 ? void 0 : K(e);
1370
- }
1371
- }), [ De, j, K ]);
1372
- var Vn = (0, e.useCallback)((function(n) {
1373
- var r = n.key;
1374
- if (r === "Tab") {
1375
- if (de && dn.current && vn.current <= 1) {
1376
- n.preventDefault();
1377
- Ln(n, dn.current);
1378
- }
1379
- }
1380
- if (n.shiftKey || n.metaKey || n.ctrlKey) {
1381
- if (r === "a" && (n.ctrlKey || n.metaKey)) {
1382
- // handle control + A
1383
- if (wn.current === "all") {
1384
- _n(n);
1385
- } else {
1386
- Nn(n);
1387
- }
1388
- }
1389
- return;
1390
- }
1391
- if (r === "ArrowDown") {
1392
- n.preventDefault();
1393
- Re(Math.min(Ee + 1, oe === "checkbox" ? vn.current : vn.current - 1));
1394
- if (d && K) {
1395
- var t;
1396
- var l = e.Children.toArray(d).length - (2 + ((t = An()) !== null && t !== void 0 ? t : []).length);
1397
- if (Ee === l) {
1398
- Bn(n);
1399
- }
1400
- }
1478
+ if (g) {
1479
+ i = true;
1401
1480
  }
1402
- if (r === "ArrowUp") {
1403
- n.preventDefault();
1404
- Re(Math.max(Ee - 1, 0));
1405
- }
1406
- if (r === "Enter" && dn.current && De) {
1407
- if (dn.current === "selectAll") {
1408
- if (wn.current === "all") {
1409
- _n(n);
1410
- } else {
1411
- Nn(n);
1412
- }
1413
- } else {
1414
- n.preventDefault();
1415
- Ln(n, dn.current);
1416
- }
1417
- }
1418
- }), [ Ee, d, An, _n, Bn, Nn, K, De, oe, de, Ln ]);
1419
- var Kn = (0, e.useCallback)((function(e, n) {
1420
- var r = n.value;
1421
- e.preventDefault();
1422
- if (!De) {
1423
- return;
1424
- }
1425
- Ln(e, r);
1426
- }), [ De, Ln ]);
1427
- var Fn = (0, e.useCallback)((function(e, n) {
1428
- var r = e.nativeEvent.key;
1429
- // Checking for a single character to avoid complications from double-byte languages and emojis.
1430
- if (r.length === 1) {
1431
- var t = [];
1432
- var l = {
1433
- index: 0,
1434
- value: r
1435
- };
1436
- if (!on.current) {
1437
- if (r === " ") {
1438
- Dn();
1439
- return;
1440
- }
1441
- t = Ke(sn.current, l);
1442
- } else if (un.current.length > 1) {
1443
- l.index = on.current.index + 1;
1444
- t = Ke(un.current, l);
1445
- }
1446
- if (t.length) {
1447
- var o;
1448
- var a = 0;
1449
- // If the active option is a first character match, cycle to the next matching option.
1450
- if (l.index === 0 && t.length > 1) {
1451
- var i = t.indexOf(sn.current[n]);
1452
- if (i >= 0) {
1453
- a = i === t.length - 1 ? 0 : i + 1;
1454
- }
1455
- }
1456
- var u = t[a];
1457
- var c = u.value, s = u.label;
1458
- var f = pn.current[Cn(c, s)];
1459
- f === null || f === void 0 ? void 0 : (o = f.focus) === null || o === void 0 ? void 0 : o.call(f);
1460
- }
1461
- un.current = t;
1462
- on.current = l;
1463
- if (an.current) {
1464
- 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;
1465
1487
  }
1466
- an.current = setTimeout(Dn, 500);
1467
- e.preventDefault();
1468
- e.stopPropagation();
1469
- }
1470
- }), []);
1471
- var Hn = (0, e.useCallback)((function(e, n) {
1472
- var r = n.value;
1473
- Ie(r);
1474
- Ne(true);
1475
- Re(0);
1476
- F === null || F === void 0 ? void 0 : F(e, {
1477
- keyword: r
1478
- });
1479
- }), [ F ]);
1480
- var zn = (0, e.useCallback)((function() {
1481
- He(true);
1482
- }), []);
1483
- var Wn = (0, e.useCallback)((function() {
1484
- He(false);
1485
- }), []);
1486
- var $n = (0, e.useCallback)((function(e) {
1487
- if (fn.current !== Ee) {
1488
- (0, fe.scrollIntoViewIfNeeded)(e);
1489
- }
1490
- }), [ Ee ]);
1491
- var Xn = (0, e.useCallback)((function(e, n, r) {
1492
- if (r) {
1493
- mn.current = e;
1494
- }
1495
- if (e == null) {
1496
- delete pn.current[n];
1488
+ u.splice(o, 0, w);
1489
+ o += 1;
1497
1490
  } else {
1498
- pn.current[n] = e;
1491
+ u.push(w);
1499
1492
  }
1500
- }), [ pn ]);
1501
- var Un = (0, e.useCallback)((function(e) {
1502
- ln.current = e;
1503
- Ge(g, e);
1504
- }), [ g, ln ]);
1505
- var Jn = (0, e.useMemo)((function() {
1506
- var e;
1507
- return (e = An()) !== null && e !== void 0 ? e : [];
1508
- }), [ An ]);
1509
- var Gn = e.Children.toArray(d);
1510
- var Qn = Jn.some((function(e) {
1511
- var n = T()(Gn, (function(n) {
1512
- return Sn(n) && n.props.value === e;
1513
- }));
1514
- return n && !n.props.disabled;
1515
- }));
1516
- var Yn = ae === "immediately" ? Tn() : $e;
1517
- var Zn = (0, e.useMemo)((function() {
1518
- vn.current = 0;
1519
- yn.current = undefined;
1520
- gn.current = 0;
1521
- dn.current = undefined;
1522
- sn.current = [];
1523
- var r = function e(n, r) {
1524
- return function(e) {
1525
- return Xn(e, n, r);
1526
- };
1527
- };
1528
- var t;
1529
- var o = 0;
1530
- var a = false;
1531
- // used to avoid overwriting the selected item ref in multiple mode
1532
- var i;
1533
- var s = e.Children.toArray(d).reduce((function(u, s, f) {
1534
- // ignore Headings and Dividers
1535
- if (!Sn(s)) {
1536
- u.push(s);
1537
- return u;
1538
- }
1539
- var d = s.props, p = d.disabled, v = d.hidden, b = d.label, m = d.value;
1540
- // Find out if the search string exactly matches a value
1541
- if (m === Te) {
1542
- t = true;
1543
- }
1544
- var y = Jn && Jn.indexOf(m) >= 0;
1545
- var g = !!y && !p && !i;
1546
- var h = l && !I && !O && !j && !K;
1547
- var S = Cn(m, b);
1548
- var C = -1;
1549
- if (h && !p && !v) {
1550
- sn.current.push({
1551
- label: b,
1552
- value: m
1553
- });
1554
- C = sn.current.length - 1;
1555
- }
1556
- // Format the Menu.Item
1557
- var w = (0, e.cloneElement)(s, {
1558
- elementRef: r(S, g),
1559
- key: s.key || f,
1560
- onClick: Kn,
1561
- onKeyDown: h ? function(e) {
1562
- return Fn(e, C);
1563
- } : undefined,
1564
- selected: y,
1565
- multiple: I,
1566
- role: "option"
1567
- });
1568
- if (g) {
1569
- i = true;
1570
- }
1571
- 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;
1572
1507
  if (o === 0) {
1573
- u.splice(o, 0, n().createElement(c.Divider, {
1508
+ s.splice(0, 0, r().createElement(c.Divider, {
1574
1509
  key: "topDivider"
1575
1510
  }));
1511
+ o += 1;
1576
1512
  a = true;
1577
1513
  }
1578
- u.splice(o, 0, w);
1579
- o += 1;
1580
- } else {
1581
- u.push(w);
1582
- }
1583
- return u;
1584
- }), []);
1585
- // In multiple mode, add missing items
1586
- if (I) {
1587
- q()(Jn, (function(e) {
1588
- var l = T()(s, (function(n) {
1589
- 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
1590
1524
  }));
1591
- if (!l) {
1592
- if (e === Te) {
1593
- t = true;
1594
- }
1595
- var i = Yn && Yn.indexOf(e) >= 0;
1596
- var u = Yn.length;
1597
- if (o === 0) {
1598
- s.splice(0, 0, n().createElement(c.Divider, {
1599
- key: "topDivider"
1600
- }));
1601
- o += 1;
1602
- a = true;
1603
- }
1604
- var f = String(e);
1605
- var d = Cn(e, f);
1606
- s.splice(i ? 0 : u + 1, 0, n().createElement(S, {
1607
- elementRef: r(d),
1608
- label: f,
1609
- value: e,
1610
- key: "missing-value-".concat(e),
1611
- onClick: Kn,
1612
- multiple: I,
1613
- selected: true
1614
- }));
1615
- if (i) {
1616
- o += 1;
1617
- }
1525
+ if (i) {
1526
+ o += 1;
1618
1527
  }
1619
- }));
1620
- }
1621
- var p = O === "controlled";
1622
- // Filter the items
1623
- var v = (0, ce.stringToKeywords)(Te);
1624
- s = p ? s : s.filter((function(e) {
1625
- if (Sn(e)) {
1626
- return (0, ce.testPhrase)(e.props.label, v);
1627
1528
  }
1628
- 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;
1629
1539
  // Keep all headers and non-interactive options
1630
- })).map((function(n) {
1631
- if (!Sn(n)) {
1632
- return n;
1633
- }
1634
- // highlight matched text
1635
- var r = v && (0, ce.keywordLocations)(n.props.label, v);
1636
-
1637
- return (0, e.cloneElement)(n, {
1638
- matchRanges: r || undefined
1639
- });
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
1640
1563
  }));
1641
- // Add the option to add the new value
1642
- if (f && !t && Te) {
1643
- var b = a ? o + 1 : o;
1644
- var m = "".concat(Te, " (new value)");
1645
- var y = Cn(Te, m);
1646
- s.splice(b, 0, n().createElement(S, {
1647
- elementRef: r(y),
1648
- label: m,
1649
- value: Te,
1650
- key: "newValue",
1651
- multiple: I,
1652
- onClick: Kn
1653
- }));
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;
1654
1574
  }
1655
- // When selectAll is a menu item, add an offset so that activeItem accounts for the extra selectAll option.
1656
- var g = oe === "checkbox" && I && s.length > 1 ? 1 : 0;
1657
- var h = true;
1658
- // Highlight the selected Items and remove hidden
1659
- s = s.reduce((function(n, r) {
1660
- // ignore Dividers & Headings
1661
- if (!Sn(r)) {
1662
- n.push(r);
1663
- return n;
1664
- }
1665
- // Ignore any hidden items
1666
- if (r.props && r.props.hidden) {
1667
- return n;
1668
- }
1669
- if (r.props.selected && !r.props.disabled && yn.current == null) {
1670
- yn.current = vn.current;
1671
- }
1672
- var t = g === Ee;
1673
- g += 1;
1674
- vn.current += 1;
1675
- gn.current += r.props.selected ? 1 : 0;
1676
- if (r.key !== "newValue" && !r.props.disabled && !r.props.selected) {
1677
- h = false;
1678
- }
1679
- if (!t || !Fe) {
1680
- n.push(r);
1681
- return n;
1682
- }
1683
- if (!r.props.disabled) {
1684
- dn.current = r.props.value;
1685
- }
1686
- var l = (0, e.cloneElement)(r, {
1687
- active: t,
1688
- elementRef: $n,
1689
- id: ke
1690
- });
1691
- n.push(l);
1692
- return n;
1693
- }), []);
1694
- wn.current = gn.current === 0 && "none" || h && "all" || "some";
1695
- // add select all option
1696
- if (oe === "checkbox" && I && vn.current > 0) {
1697
- var C = Ee === 0 && !!O;
1698
- var w;
1699
- if (wn.current === "all") {
1700
- if (Te === "") {
1701
- w = (0, u._)("Clear all");
1702
- } else {
1703
- w = (0, u._)("Clear all matches");
1704
- }
1705
- } else if (Te === "") {
1706
- w = (0, u._)("Select all");
1707
- } else {
1708
- w = (0, u._)("Select all matches");
1709
- }
1710
- if (C) {
1711
- dn.current = "selectAll";
1712
- }
1713
- s.unshift( n().createElement(we, {
1714
- key: "select-all-option",
1715
- active: C,
1716
- elementRef: $n,
1717
- id: C ? ke : undefined,
1718
- onClick: wn.current === "all" ? _n : Nn,
1719
- label: w,
1720
- selected: wn.current === "all" || wn.current !== "none" && "some",
1721
- totalCount: !!be && Jn.length || undefined,
1722
- tabIndex: O ? -1 : undefined
1723
- }), n().createElement(c.Divider, {
1724
- key: "selectAllDivider"
1725
- }));
1575
+ // Ignore any hidden items
1576
+ if (n.props && n.props.hidden) {
1577
+ return e;
1726
1578
  }
1727
- bn.current = s.reduce((function(e, n) {
1728
- if (Sn(n)) {
1729
- e.push(n.props.value);
1730
- }
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);
1731
1591
  return e;
1732
- }), []);
1733
- return s;
1734
- }), [ Ee, ke, l, f, d, Jn, O, Te, $n, _n, Kn, Fn, Xn, Nn, j, I, Yn, K, oe, Fe, be ]);
1735
- var er = function e(r) {
1736
- var t = r.anchorWidth, l = r.maxHeight, a = r.placement, i = r.toggleId;
1737
- var u = hn({
1738
- anchorWidth: t,
1739
- isMultiple: I,
1740
- maxHeight: l,
1741
- 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
1742
1600
  });
1743
- var c = Jn.length > 0 && !Qn && !O ? 0 : undefined;
1744
- var s = {
1745
- "aria-multiselectable": I || undefined,
1746
- childrenStart: !!O && n().createElement(Pn, {
1747
- activeItemId: ke,
1748
- filterA11yId: Mn,
1749
- filterKeyword: Te,
1750
- hasChildren: Zn.some((function(e) {
1751
- return Sn(e);
1752
- })),
1753
- inputId: k,
1754
- inputRef: x,
1755
- menuListboxId: xe,
1756
- multiple: I,
1757
- onClearAll: _n,
1758
- onSelectAll: Nn,
1759
- onTextBlur: Wn,
1760
- onTextChange: Hn,
1761
- onTextFocus: zn,
1762
- onTextKeyDown: Vn,
1763
- optionSelection: wn,
1764
- placement: a,
1765
- selectAllAppearance: oe,
1766
- textHasFocus: Fe
1767
- }),
1768
- focusMode: O ? "never" : undefined,
1769
- isLoading: j,
1770
- labelledBy: "".concat(Mn !== null && Mn !== void 0 ? Mn : "", " ").concat(i !== null && i !== void 0 ? i : "").trim(),
1771
- // NVDA ignores aria-labelledby attribute on popover, but reads it on menu
1772
- menuId: xe,
1773
- onScrollBottom: K ? Bn : undefined,
1774
- placement: a !== null && a !== void 0 ? a : undefined,
1775
- noOptionsMessage: N,
1776
- footerMessage: C,
1777
- animateLoading: o,
1778
- loadingMessage: R,
1779
- onScroll: V,
1780
- style: u,
1781
- tabIndex: c
1782
- };
1783
- if (ve) {
1784
-
1785
- return n().createElement(ne.VirtualizedResultsMenu, nn({
1786
- virtualization: ve
1787
- }, 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");
1788
1619
  }
1789
-
1790
- 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
1791
1692
  };
1792
- var nr = (0, e.useMemo)((function() {
1693
+ if (be) {
1793
1694
 
1794
- return n().createElement(Rn, nn({
1795
- appearance: i,
1796
- append: s,
1797
- currentValues: An(),
1798
- "data-test": I ? "multiselect" : "select",
1799
- describedBy: m,
1800
- disabled: y,
1801
- elementRef: Un,
1802
- error: h,
1803
- inline: w,
1804
- labelText: E,
1805
- labelledBy: P,
1806
- multiple: I,
1807
- onClick: H,
1808
- placeholder: G,
1809
- prefixLabel: Q,
1810
- prepend: Z,
1811
- required: U,
1812
- suffixLabel: ie,
1813
- toggle: be,
1814
- toggleContent: ye
1815
- }, ge), d);
1816
- }), [ 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
+ }
1817
1699
 
1818
- return n().createElement(Y(), {
1819
- closeReasons: On,
1820
- inputId: k,
1821
- "aria-labelledby": Mn,
1822
- toggle: nr,
1823
- onRequestOpen: In,
1824
- onRequestClose: qn,
1825
- open: De,
1826
- openWithArrowKeys: true,
1827
- repositionMode: te,
1828
- defaultPlacement: v,
1829
- canCoverAnchor: Xe().innerHeight < 500,
1830
- retainFocus: false,
1831
- takeFocus: Jn.length === 0 || Jn.length > 0 && !Qn || !!O
1832
- }, er);
1833
- }
1834
- Mn.propTypes = yn;
1835
- Mn.componentType = "SelectBase";
1836
- Mn.Option = S;
1837
- Mn.Divider = c.Divider;
1838
- Mn.Heading = c.Heading;
1839
- /* harmony default export */ const An = Mn;
1840
- // CONCATENATED MODULE: ./src/utils/useDeprecate.tsx
1841
- var Tn = "is deprecated and will be removed in the next major version.";
1842
- var In = function e(n) {
1843
- var r = n.additionalMessage, t = r === void 0 ? "" : r, l = n.componentName;
1844
- useEffect((function() {
1845
- if (false) {}
1846
- }), [ t, l ]);
1847
- };
1848
- var qn = function e(n) {
1849
- var r = n.additionalMessage, t = r === void 0 ? "" : r, l = n.componentName, o = n.propName, a = n.propValue;
1850
- useEffect((function() {
1851
- if (false) {}
1852
- }), [ t, l, o, a ]);
1700
+ return r().createElement(te(), s, Zn);
1853
1701
  };
1854
- var Ln = function n(r) {
1855
- var t = r.additionalMessage, l = t === void 0 ? "" : t, o = r.componentName, a = r.deprecatedPropValue, i = r.propName, u = r.propValue;
1856
- (0, e.useEffect)((function() {
1857
- if (false) {}
1858
- }), [ l, o, i, u, a ]);
1859
- };
1860
- // CONCATENATED MODULE: ./src/Select/Select.tsx
1861
- function Dn() {
1862
- return Dn = Object.assign ? Object.assign.bind() : function(e) {
1863
- for (var n = 1; n < arguments.length; n++) {
1864
- var r = arguments[n];
1865
- for (var t in r) {
1866
- ({}).hasOwnProperty.call(r, t) && (e[t] = r[t]);
1867
- }
1868
- }
1869
- return e;
1870
- }, Dn.apply(null, arguments);
1871
- }
1872
- function Nn(e, n) {
1873
- if (null == e) return {};
1874
- var r, t, l = _n(e, n);
1875
- if (Object.getOwnPropertySymbols) {
1876
- var o = Object.getOwnPropertySymbols(e);
1877
- for (t = 0; t < o.length; t++) {
1878
- 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]);
1879
1777
  }
1880
1778
  }
1881
- return l;
1882
- }
1883
- function _n(e, n) {
1884
- if (null == e) return {};
1885
- var r = {};
1886
- for (var t in e) {
1887
- if ({}.hasOwnProperty.call(e, t)) {
1888
- if (-1 !== n.indexOf(t)) continue;
1889
- r[t] = e[t];
1890
- }
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]);
1891
1789
  }
1892
- return r;
1893
1790
  }
1894
- /** @public */
1895
- /** @public */
1896
- /** @public */ var Bn = {
1897
- allowKeyMatching: o().bool,
1898
- animateLoading: o().bool,
1899
- appearance: o().oneOf([ "default", "link", "subtle" ]),
1900
- append: o().bool,
1901
- children: o().node,
1902
- defaultPlacement: o().oneOf([ "above", "below", "vertical" ]),
1903
- defaultValue: o().oneOfType([ o().string, o().number, o().bool ]),
1904
- describedBy: o().string,
1905
- disabled: o().bool,
1906
- elementRef: o().oneOfType([ o().func, o().object ]),
1907
- error: o().bool,
1908
- filter: o().oneOf([ false, true, "controlled" ]),
1909
- footerMessage: o().node,
1910
- inline: o().bool,
1911
- inputId: o().string,
1912
- inputRef: o().oneOfType([ o().func, o().object ]),
1913
- isLoadingOptions: o().bool,
1914
- labelledBy: o().string,
1915
- labelText: o().string,
1916
- loadingMessage: o().node,
1917
- menuStyle: o().object,
1918
- name: o().string,
1919
- noOptionsMessage: o().node,
1920
- onChange: o().func,
1921
- onClose: o().func,
1922
- onFilterChange: o().func,
1923
- onOpen: o().func,
1924
- onScroll: o().func,
1925
- onScrollBottom: o().func,
1926
- placeholder: o().string,
1927
- prefixLabel: o().string,
1928
- prepend: o().bool,
1929
- repositionMode: o().oneOf([ "none", "flip" ]),
1930
- suffixLabel: o().string,
1931
- toggleContent: o().oneOf([ "optionChildren", "optionLabel" ]),
1932
- /** @private. */
1933
- toggle: o().node,
1934
- value: o().oneOfType([ o().string, o().number, o().bool ]),
1935
- /** @private. */
1936
- virtualization: o().number
1937
- };
1938
- var Vn = (0, u._)("No matches");
1939
- var Kn = (0, u._)("Select...");
1940
- function Fn(r) {
1941
- 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" ]);
1942
- // @docs-props-type SelectPropsBase
1943
- Ln({
1944
- componentName: "Select",
1945
- deprecatedPropValue: "link",
1946
- propName: "appearance",
1947
- propValue: a
1948
- });
1949
- var C = i()({
1950
- componentName: "Select",
1951
- /* eslint-disable-next-line prefer-rest-params */
1952
- componentProps: arguments[0]
1953
- });
1954
- var w = (0, e.useMemo)((function() {
1955
- // wrap defaultValue in an array once to avoid failing <SelectBase>'s defaultValues comparison check
1956
- if (s != null) {
1957
- return [ s ];
1958
- }
1959
- return [];
1960
- }), [ s ]);
1961
- // Converts the provided props into a structure suitable for SelectBase.
1962
- var k = (0, e.useMemo)((function() {
1963
- var e = C ? undefined : w;
1964
- var n = function e(n, r) {
1965
- var t = r.name, l = r.values;
1966
- b === null || b === void 0 ? void 0 : b(n, {
1967
- name: t,
1968
- value: l[0]
1969
- });
1970
- };
1971
- var r = {
1972
- onChange: n
1973
- };
1974
- if (C) {
1975
- r.values = O != null ? [ O ] : [];
1976
- } else if (e != null) {
1977
- r.defaultValues = e;
1978
- }
1979
- return r;
1980
- }), [ w, b, C, O ]);
1981
-
1982
- return n().createElement(An, Dn({
1983
- allowKeyMatching: l,
1984
- appearance: a,
1985
- defaultPlacement: c,
1986
- inline: d,
1987
- noOptionsMessage: v,
1988
- placeholder: y,
1989
- toggleContent: h
1990
- }, S, k, {
1991
- multiple: false
1992
- }));
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
+ }
1993
1801
  }
1994
- Fn.propTypes = Bn;
1995
- Fn.Option = E;
1996
- Fn.Heading = c.Heading;
1997
- Fn.Divider = c.Divider;
1998
- /* harmony default export */ const Hn = Fn;
1999
- }) // CONCATENATED MODULE: ./src/Select/index.ts
2000
- ();
2001
- 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;
2002
1911
  /******/})();