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