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