@splunk/react-ui 4.20.0 → 4.21.1

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 (101) hide show
  1. package/Accordion.js +425 -441
  2. package/Anchor.js +147 -193
  3. package/Animation.js +142 -166
  4. package/AnimationToggle.js +197 -253
  5. package/Box.js +145 -194
  6. package/Breadcrumbs.js +288 -298
  7. package/Button.js +488 -613
  8. package/ButtonGroup.js +160 -212
  9. package/ButtonSimple.js +543 -562
  10. package/CHANGELOG.md +26 -0
  11. package/Calendar.js +1107 -1195
  12. package/Card.js +771 -746
  13. package/CardLayout.js +205 -223
  14. package/Chip.js +509 -612
  15. package/Clickable.js +416 -472
  16. package/CloseButton.js +165 -250
  17. package/Code.js +1808 -2172
  18. package/Code.js.LICENSE.txt +8 -0
  19. package/CollapsiblePanel.js +586 -675
  20. package/Color.js +1066 -1297
  21. package/ColumnLayout.js +402 -465
  22. package/ComboBox.js +892 -969
  23. package/Concertina.js +998 -963
  24. package/ControlGroup.js +687 -718
  25. package/Date.js +567 -697
  26. package/DefinitionList.js +308 -310
  27. package/Divider.js +149 -194
  28. package/Dropdown.js +459 -558
  29. package/DualListbox.js +1480 -1735
  30. package/EventListener.js +94 -165
  31. package/File.js +1051 -1173
  32. package/FormRows.js +885 -880
  33. package/Heading.js +216 -263
  34. package/Image.js +446 -558
  35. package/JSONTree.js +690 -699
  36. package/Layer.js +442 -582
  37. package/Link.js +336 -361
  38. package/List.js +213 -237
  39. package/Markdown.js +510 -612
  40. package/Menu.js +1109 -1331
  41. package/Message.js +474 -629
  42. package/MessageBar.js +387 -561
  43. package/Modal.js +810 -798
  44. package/ModalLayer.js +326 -343
  45. package/Monogram.js +308 -368
  46. package/Multiselect.js +3558 -3998
  47. package/Number.js +729 -843
  48. package/Paginator.js +510 -615
  49. package/Paragraph.js +145 -188
  50. package/Popover.js +1470 -1693
  51. package/Progress.js +301 -362
  52. package/RadioBar.js +610 -651
  53. package/RadioList.js +483 -544
  54. package/Resize.js +530 -623
  55. package/ResultsMenu.js +494 -597
  56. package/ScreenReaderContent.js +142 -187
  57. package/Scroll.js +595 -598
  58. package/ScrollContainerContext.js +197 -278
  59. package/Search.js +745 -817
  60. package/Select.js +2441 -2746
  61. package/SidePanel.js +390 -392
  62. package/Slider.js +668 -825
  63. package/SlidingPanels.js +639 -645
  64. package/SplitButton.js +464 -499
  65. package/StaticContent.js +161 -217
  66. package/StepBar.js +386 -466
  67. package/Switch.js +710 -764
  68. package/TabBar.js +724 -815
  69. package/TabLayout.js +406 -438
  70. package/Table.js +4842 -5121
  71. package/Text.js +1169 -1351
  72. package/TextArea.js +1097 -1307
  73. package/Tooltip.js +624 -721
  74. package/TransitionOpen.js +489 -546
  75. package/Typography.js +176 -229
  76. package/WaitSpinner.js +230 -298
  77. package/package.json +14 -15
  78. package/stubs-splunkui.d.ts +4 -1
  79. package/types/src/ComboBox/Option.d.ts +1 -1
  80. package/types/src/Concertina/Concertina.d.ts +4 -0
  81. package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
  82. package/types/src/JSONTree/TreeNode.d.ts +5 -0
  83. package/types/src/Link/Link.d.ts +7 -3
  84. package/types/src/Link/docs/examples/NewWindow.d.ts +2 -0
  85. package/types/src/Markdown/Markdown.d.ts +1 -1
  86. package/types/src/Markdown/renderers/MarkdownHeading.d.ts +1 -1
  87. package/types/src/Menu/Item.d.ts +1 -1
  88. package/types/src/Menu/Menu.d.ts +1 -0
  89. package/types/src/MessageBar/docs/examples/WithActions.d.ts +2 -0
  90. package/types/src/Multiselect/Option.d.ts +1 -1
  91. package/types/src/Search/Option.d.ts +1 -1
  92. package/types/src/Select/Option.d.ts +1 -1
  93. package/types/src/Select/OptionBase.d.ts +1 -1
  94. package/types/src/fixtures/FetchOptions.d.ts +2 -8
  95. package/useForceUpdate.js +112 -146
  96. package/useKeyPress.js +74 -128
  97. package/usePrevious.js +65 -129
  98. package/useRovingFocus.js +122 -218
  99. package/types/src/Link/docs/examples/NewTab.d.ts +0 -2
  100. /package/types/src/Table/docs/examples/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
  101. /package/types/src/Table/docs/examples/prisma/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
package/ComboBox.js CHANGED
@@ -1,990 +1,913 @@
1
- module.exports =
2
- /******/ (function(modules) { // webpackBootstrap
3
- /******/ // The module cache
4
- /******/ var installedModules = {};
5
- /******/
6
- /******/ // The require function
7
- /******/ function __webpack_require__(moduleId) {
8
- /******/
9
- /******/ // Check if module is in cache
10
- /******/ if(installedModules[moduleId]) {
11
- /******/ return installedModules[moduleId].exports;
12
- /******/ }
13
- /******/ // Create a new module (and put it into the cache)
14
- /******/ var module = installedModules[moduleId] = {
15
- /******/ i: moduleId,
16
- /******/ l: false,
17
- /******/ exports: {}
18
- /******/ };
19
- /******/
20
- /******/ // Execute the module function
21
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22
- /******/
23
- /******/ // Flag the module as loaded
24
- /******/ module.l = true;
25
- /******/
26
- /******/ // Return the exports of the module
27
- /******/ return module.exports;
28
- /******/ }
29
- /******/
30
- /******/
31
- /******/ // expose the modules object (__webpack_modules__)
32
- /******/ __webpack_require__.m = modules;
33
- /******/
34
- /******/ // expose the module cache
35
- /******/ __webpack_require__.c = installedModules;
36
- /******/
37
- /******/ // define getter function for harmony exports
38
- /******/ __webpack_require__.d = function(exports, name, getter) {
39
- /******/ if(!__webpack_require__.o(exports, name)) {
40
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41
- /******/ }
42
- /******/ };
43
- /******/
44
- /******/ // define __esModule on exports
45
- /******/ __webpack_require__.r = function(exports) {
46
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
- /******/ }
49
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
50
- /******/ };
51
- /******/
52
- /******/ // create a fake namespace object
53
- /******/ // mode & 1: value is a module id, require it
54
- /******/ // mode & 2: merge all properties of value into the ns
55
- /******/ // mode & 4: return value when already ns object
56
- /******/ // mode & 8|1: behave like require
57
- /******/ __webpack_require__.t = function(value, mode) {
58
- /******/ if(mode & 1) value = __webpack_require__(value);
59
- /******/ if(mode & 8) return value;
60
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61
- /******/ var ns = Object.create(null);
62
- /******/ __webpack_require__.r(ns);
63
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65
- /******/ return ns;
66
- /******/ };
67
- /******/
68
- /******/ // getDefaultExport function for compatibility with non-harmony modules
69
- /******/ __webpack_require__.n = function(module) {
70
- /******/ var getter = module && module.__esModule ?
71
- /******/ function getDefault() { return module['default']; } :
72
- /******/ function getModuleExports() { return module; };
73
- /******/ __webpack_require__.d(getter, 'a', getter);
74
- /******/ return getter;
75
- /******/ };
76
- /******/
77
- /******/ // Object.prototype.hasOwnProperty.call
78
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79
- /******/
80
- /******/ // __webpack_public_path__
81
- /******/ __webpack_require__.p = "";
82
- /******/
83
- /******/
84
- /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 220);
86
- /******/ })
87
- /************************************************************************/
88
- /******/ ({
89
-
90
- /***/ 1:
91
- /***/ (function(module, exports) {
92
-
93
- module.exports = require("prop-types");
94
-
95
- /***/ }),
96
-
97
- /***/ 10:
98
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
99
-
100
- "use strict";
101
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return updateReactRef; });
102
- /**
1
+ /******/ (() => {
2
+ // webpackBootstrap
3
+ /******/ "use strict";
4
+ /******/ // The require scope
5
+ /******/ var e = {};
6
+ /******/
7
+ /************************************************************************/
8
+ /******/ /* webpack/runtime/compat get default export */
9
+ /******/ (() => {
10
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
11
+ /******/ e.n = t => {
12
+ /******/ var n = t && t.__esModule ?
13
+ /******/ () => t["default"]
14
+ /******/ : () => t
15
+ /******/;
16
+ e.d(n, {
17
+ a: n
18
+ });
19
+ /******/ return n;
20
+ /******/ };
21
+ /******/ })();
22
+ /******/
23
+ /******/ /* webpack/runtime/define property getters */
24
+ /******/ (() => {
25
+ /******/ // define getter functions for harmony exports
26
+ /******/ e.d = (t, n) => {
27
+ /******/ for (var o in n) {
28
+ /******/ if (e.o(n, o) && !e.o(t, o)) {
29
+ /******/ Object.defineProperty(t, o, {
30
+ enumerable: true,
31
+ get: n[o]
32
+ });
33
+ /******/ }
34
+ /******/ }
35
+ /******/ };
36
+ /******/ })();
37
+ /******/
38
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
39
+ /******/ (() => {
40
+ /******/ e.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
41
+ /******/;
42
+ })();
43
+ /******/
44
+ /******/ /* webpack/runtime/make namespace object */
45
+ /******/ (() => {
46
+ /******/ // define __esModule on exports
47
+ /******/ e.r = e => {
48
+ /******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
49
+ /******/ Object.defineProperty(e, Symbol.toStringTag, {
50
+ value: "Module"
51
+ });
52
+ /******/ }
53
+ /******/ Object.defineProperty(e, "__esModule", {
54
+ value: true
55
+ });
56
+ /******/ };
57
+ /******/ })();
58
+ /******/
59
+ /************************************************************************/ var t = {};
60
+ // ESM COMPAT FLAG
61
+ e.r(t);
62
+ // EXPORTS
63
+ e.d(t, {
64
+ Divider: () => /* reexport */ O.Divider,
65
+ Heading: () => /* reexport */ O.Heading,
66
+ Option: () => /* reexport */ W,
67
+ default: () => /* reexport */ pe
68
+ });
69
+ // CONCATENATED MODULE: external "react"
70
+ const n = require("react");
71
+ var o = e.n(n);
72
+ // CONCATENATED MODULE: external "prop-types"
73
+ const r = require("prop-types");
74
+ var i = e.n(r);
75
+ // CONCATENATED MODULE: external "lodash/extend"
76
+ const a = require("lodash/extend");
77
+ var l = e.n(a);
78
+ // CONCATENATED MODULE: external "lodash/has"
79
+ const u = require("lodash/has");
80
+ var c = e.n(u);
81
+ // CONCATENATED MODULE: external "lodash/omit"
82
+ const s = require("lodash/omit");
83
+ var f = e.n(s);
84
+ // CONCATENATED MODULE: external "lodash/pick"
85
+ const p = require("lodash/pick");
86
+ var d = e.n(p);
87
+ // CONCATENATED MODULE: external "lodash/some"
88
+ const v = require("lodash/some");
89
+ var h = e.n(v);
90
+ // CONCATENATED MODULE: external "@splunk/ui-utils/filter"
91
+ const y = require("@splunk/ui-utils/filter");
92
+ // CONCATENATED MODULE: external "@splunk/ui-utils/id"
93
+ const b = require("@splunk/ui-utils/id");
94
+ // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
95
+ const m = require("@splunk/ui-utils/i18n");
96
+ // CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
97
+ const g = require("@splunk/ui-utils/keyboard");
98
+ // CONCATENATED MODULE: external "@splunk/react-ui/Menu"
99
+ const O = require("@splunk/react-ui/Menu");
100
+ // CONCATENATED MODULE: external "@splunk/react-ui/Popover"
101
+ const I = require("@splunk/react-ui/Popover");
102
+ var S = e.n(I);
103
+ // CONCATENATED MODULE: external "@splunk/react-ui/ResultsMenu"
104
+ const C = require("@splunk/react-ui/ResultsMenu");
105
+ var w = e.n(C);
106
+ // CONCATENATED MODULE: external "@splunk/react-ui/Text"
107
+ const k = require("@splunk/react-ui/Text");
108
+ var P = e.n(k);
109
+ // CONCATENATED MODULE: ./src/ComboBox/Option.tsx
110
+ function j(e) {
111
+ "@babel/helpers - typeof";
112
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
113
+ j = function e(t) {
114
+ return typeof t;
115
+ };
116
+ } else {
117
+ j = function e(t) {
118
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
119
+ };
120
+ }
121
+ return j(e);
122
+ }
123
+ function x() {
124
+ x = Object.assign || function(e) {
125
+ for (var t = 1; t < arguments.length; t++) {
126
+ var n = arguments[t];
127
+ for (var o in n) {
128
+ if (Object.prototype.hasOwnProperty.call(n, o)) {
129
+ e[o] = n[o];
130
+ }
131
+ }
132
+ }
133
+ return e;
134
+ };
135
+ return x.apply(this, arguments);
136
+ }
137
+ function R(e, t) {
138
+ if (e == null) return {};
139
+ var n = M(e, t);
140
+ var o, r;
141
+ if (Object.getOwnPropertySymbols) {
142
+ var i = Object.getOwnPropertySymbols(e);
143
+ for (r = 0; r < i.length; r++) {
144
+ o = i[r];
145
+ if (t.indexOf(o) >= 0) continue;
146
+ if (!Object.prototype.propertyIsEnumerable.call(e, o)) continue;
147
+ n[o] = e[o];
148
+ }
149
+ }
150
+ return n;
151
+ }
152
+ function M(e, t) {
153
+ if (e == null) return {};
154
+ var n = {};
155
+ var o = Object.keys(e);
156
+ var r, i;
157
+ for (i = 0; i < o.length; i++) {
158
+ r = o[i];
159
+ if (t.indexOf(r) >= 0) continue;
160
+ n[r] = e[r];
161
+ }
162
+ return n;
163
+ }
164
+ function V(e, t) {
165
+ if (!(e instanceof t)) {
166
+ throw new TypeError("Cannot call a class as a function");
167
+ }
168
+ }
169
+ function D(e, t) {
170
+ for (var n = 0; n < t.length; n++) {
171
+ var o = t[n];
172
+ o.enumerable = o.enumerable || false;
173
+ o.configurable = true;
174
+ if ("value" in o) o.writable = true;
175
+ Object.defineProperty(e, o.key, o);
176
+ }
177
+ }
178
+ function E(e, t, n) {
179
+ if (t) D(e.prototype, t);
180
+ if (n) D(e, n);
181
+ return e;
182
+ }
183
+ function _(e, t) {
184
+ if (typeof t !== "function" && t !== null) {
185
+ throw new TypeError("Super expression must either be null or a function");
186
+ }
187
+ e.prototype = Object.create(t && t.prototype, {
188
+ constructor: {
189
+ value: e,
190
+ writable: true,
191
+ configurable: true
192
+ }
193
+ });
194
+ if (t) q(e, t);
195
+ }
196
+ function q(e, t) {
197
+ q = Object.setPrototypeOf || function e(t, n) {
198
+ t.__proto__ = n;
199
+ return t;
200
+ };
201
+ return q(e, t);
202
+ }
203
+ function A(e) {
204
+ var t = L();
205
+ return function n() {
206
+ var o = F(e), r;
207
+ if (t) {
208
+ var i = F(this).constructor;
209
+ r = Reflect.construct(o, arguments, i);
210
+ } else {
211
+ r = o.apply(this, arguments);
212
+ }
213
+ return B(this, r);
214
+ };
215
+ }
216
+ function B(e, t) {
217
+ if (t && (j(t) === "object" || typeof t === "function")) {
218
+ return t;
219
+ }
220
+ return T(e);
221
+ }
222
+ function T(e) {
223
+ if (e === void 0) {
224
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
225
+ }
226
+ return e;
227
+ }
228
+ function L() {
229
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
230
+ if (Reflect.construct.sham) return false;
231
+ if (typeof Proxy === "function") return true;
232
+ try {
233
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
234
+ return true;
235
+ } catch (e) {
236
+ return false;
237
+ }
238
+ }
239
+ function F(e) {
240
+ F = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
241
+ return t.__proto__ || Object.getPrototypeOf(t);
242
+ };
243
+ return F(e);
244
+ }
245
+ function H(e, t, n) {
246
+ if (t in e) {
247
+ Object.defineProperty(e, t, {
248
+ value: n,
249
+ enumerable: true,
250
+ configurable: true,
251
+ writable: true
252
+ });
253
+ } else {
254
+ e[t] = n;
255
+ }
256
+ return e;
257
+ }
258
+ var K = {
259
+ /** @private */
260
+ active: i().bool,
261
+ description: i().string,
262
+ descriptionPosition: i().oneOf([ "right", "bottom" ]),
263
+ disabled: i().bool,
264
+ icon: i().node,
265
+ label: i().string,
266
+ matchRanges: i().arrayOf(i().shape({
267
+ start: i().number.isRequired,
268
+ end: i().number.isRequired
269
+ })),
270
+ /** @private */
271
+ onClick: i().func,
272
+ truncate: i().bool,
273
+ value: i().string.isRequired
274
+ };
275
+ var N = {
276
+ active: false,
277
+ descriptionPosition: "bottom",
278
+ disabled: false,
279
+ truncate: false
280
+ };
281
+ /**
282
+ * An option within a `ComboBox`. This inherits from
283
+ * [PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent)
284
+ * so any elements passed to it must also be pure.
285
+ */ var z = function(e) {
286
+ _(n, e);
287
+ var t = A(n);
288
+ function n() {
289
+ var e;
290
+ V(this, n);
291
+ for (var o = arguments.length, r = new Array(o), i = 0; i < o; i++) {
292
+ r[i] = arguments[i];
293
+ }
294
+ e = t.call.apply(t, [ this ].concat(r));
295
+ H(T(e), "item", null);
296
+ H(T(e), "handleClick", (function(t) {
297
+ var n = e.props, o = n.disabled, r = n.onClick, i = n.value;
298
+ if (!o) {
299
+ r === null || r === void 0 ? void 0 : r(t, {
300
+ value: i
301
+ });
302
+ }
303
+ }));
304
+ return e;
305
+ }
306
+ E(n, [ {
307
+ key: "scrollIntoViewIfNeeded",
308
+ value: function e() {
309
+ var t;
310
+ (t = this.item) === null || t === void 0 ? void 0 : t.scrollIntoViewIfNeeded();
311
+ }
312
+ }, {
313
+ key: "render",
314
+ value: function e() {
315
+ var t = this;
316
+ // eslint-disable-next-line no-unused-vars
317
+ var n = this.props, r = n.value, i = n.label, a = R(n, [ "value", "label" ]);
318
+ var l = i === undefined ? r : i;
319
+
320
+ return o().createElement(O.Item, x({
321
+ ref: function e(n) {
322
+ t.item = n;
323
+ },
324
+ "data-test": "option",
325
+ "data-test-value": r
326
+ }, a, {
327
+ onClick: this.handleClick,
328
+ role: "option",
329
+ "aria-selected": false
330
+ }), l);
331
+ }
332
+ } ]);
333
+ return n;
334
+ }(n.PureComponent);
335
+ H(z, "propTypes", K);
336
+ H(z, "defaultProps", N);
337
+ /* harmony default export */ const W = z;
338
+ // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
339
+ /**
103
340
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
104
341
  *
105
342
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
106
343
  * @param current - The new value of the ref.
107
344
  */
108
- function updateReactRef(ref, current) {
109
- if (ref) {
110
- if (typeof ref === 'function') {
111
- ref(current);
112
- } else {
113
- // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
114
- // the intention here is to signal "we will take care of setting 'current', not you".
115
- ref.current = current; // eslint-disable-line no-param-reassign
116
- }
117
- }
118
- }
119
-
120
-
121
-
122
- /***/ }),
123
-
124
- /***/ 11:
125
- /***/ (function(module, exports) {
126
-
127
- module.exports = require("lodash/has");
128
-
129
- /***/ }),
130
-
131
- /***/ 13:
132
- /***/ (function(module, exports) {
133
-
134
- module.exports = require("@splunk/react-ui/Menu");
135
-
136
- /***/ }),
137
-
138
- /***/ 130:
139
- /***/ (function(module, exports) {
140
-
141
- module.exports = require("lodash/some");
142
-
143
- /***/ }),
144
-
145
- /***/ 2:
146
- /***/ (function(module, exports) {
147
-
148
- module.exports = require("react");
149
-
150
- /***/ }),
151
-
152
- /***/ 21:
153
- /***/ (function(module, exports) {
154
-
155
- module.exports = require("@splunk/react-ui/Popover");
156
-
157
- /***/ }),
158
-
159
- /***/ 220:
160
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
161
-
162
- "use strict";
163
- // ESM COMPAT FLAG
164
- __webpack_require__.r(__webpack_exports__);
165
-
166
- // EXPORTS
167
- __webpack_require__.d(__webpack_exports__, "default", function() { return /* reexport */ src_ComboBox_ComboBox; });
168
- __webpack_require__.d(__webpack_exports__, "Option", function() { return /* reexport */ ComboBox_Option; });
169
- __webpack_require__.d(__webpack_exports__, "Divider", function() { return /* reexport */ Menu_["Divider"]; });
170
- __webpack_require__.d(__webpack_exports__, "Heading", function() { return /* reexport */ Menu_["Heading"]; });
171
-
172
- // EXTERNAL MODULE: external "react"
173
- var external_react_ = __webpack_require__(2);
174
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
175
-
176
- // EXTERNAL MODULE: external "prop-types"
177
- var external_prop_types_ = __webpack_require__(1);
178
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
179
-
180
- // EXTERNAL MODULE: external "lodash/extend"
181
- var extend_ = __webpack_require__(52);
182
- var extend_default = /*#__PURE__*/__webpack_require__.n(extend_);
183
-
184
- // EXTERNAL MODULE: external "lodash/has"
185
- var has_ = __webpack_require__(11);
186
- var has_default = /*#__PURE__*/__webpack_require__.n(has_);
187
-
188
- // EXTERNAL MODULE: external "lodash/omit"
189
- var omit_ = __webpack_require__(5);
190
- var omit_default = /*#__PURE__*/__webpack_require__.n(omit_);
191
-
192
- // EXTERNAL MODULE: external "lodash/pick"
193
- var pick_ = __webpack_require__(44);
194
- var pick_default = /*#__PURE__*/__webpack_require__.n(pick_);
195
-
196
- // EXTERNAL MODULE: external "lodash/some"
197
- var some_ = __webpack_require__(130);
198
- var some_default = /*#__PURE__*/__webpack_require__.n(some_);
199
-
200
- // EXTERNAL MODULE: external "@splunk/ui-utils/filter"
201
- var filter_ = __webpack_require__(35);
202
-
203
- // EXTERNAL MODULE: external "@splunk/ui-utils/id"
204
- var id_ = __webpack_require__(8);
205
-
206
- // EXTERNAL MODULE: external "@splunk/ui-utils/i18n"
207
- var i18n_ = __webpack_require__(4);
208
-
209
- // EXTERNAL MODULE: external "@splunk/ui-utils/keyboard"
210
- var keyboard_ = __webpack_require__(7);
211
-
212
- // EXTERNAL MODULE: external "@splunk/react-ui/Menu"
213
- var Menu_ = __webpack_require__(13);
214
-
215
- // EXTERNAL MODULE: external "@splunk/react-ui/Popover"
216
- var Popover_ = __webpack_require__(21);
217
- var Popover_default = /*#__PURE__*/__webpack_require__.n(Popover_);
218
-
219
- // EXTERNAL MODULE: external "@splunk/react-ui/ResultsMenu"
220
- var ResultsMenu_ = __webpack_require__(47);
221
- var ResultsMenu_default = /*#__PURE__*/__webpack_require__.n(ResultsMenu_);
222
-
223
- // EXTERNAL MODULE: external "@splunk/react-ui/Text"
224
- var Text_ = __webpack_require__(32);
225
- var Text_default = /*#__PURE__*/__webpack_require__.n(Text_);
226
-
227
- // CONCATENATED MODULE: ./src/ComboBox/Option.tsx
228
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
229
-
230
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
231
-
232
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
233
-
234
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
235
-
236
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
237
-
238
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
239
-
240
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
241
-
242
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
243
-
244
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
245
-
246
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
247
-
248
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
249
-
250
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
251
-
252
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
253
-
254
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
255
-
256
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
257
-
258
-
259
-
260
-
261
- var propTypes = {
262
- /** @private */
263
- active: external_prop_types_default.a.bool,
264
- description: external_prop_types_default.a.string,
265
- descriptionPosition: external_prop_types_default.a.oneOf(['right', 'bottom']),
266
- disabled: external_prop_types_default.a.bool,
267
- icon: external_prop_types_default.a.node,
268
- label: external_prop_types_default.a.string,
269
- matchRanges: external_prop_types_default.a.arrayOf(external_prop_types_default.a.shape({
270
- start: external_prop_types_default.a.number.isRequired,
271
- end: external_prop_types_default.a.number.isRequired
272
- })),
273
-
274
- /** @private */
275
- onClick: external_prop_types_default.a.func,
276
- truncate: external_prop_types_default.a.bool,
277
- value: external_prop_types_default.a.string.isRequired
278
- };
279
- var defaultProps = {
280
- active: false,
281
- descriptionPosition: 'bottom',
282
- disabled: false,
283
- truncate: false
284
- };
285
-
286
- /**
287
- * An option within a `ComboBox`. This inherits from
288
- * [PureComponent](https://reactjs.org/docs/react-api.html#reactpurecomponent)
289
- * so any elements passed to it must also be pure.
290
- */
291
- var Option_Option = /*#__PURE__*/function (_PureComponent) {
292
- _inherits(Option, _PureComponent);
293
-
294
- var _super = _createSuper(Option);
295
-
296
- function Option() {
297
- var _this;
298
-
299
- _classCallCheck(this, Option);
300
-
301
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
302
- args[_key] = arguments[_key];
345
+ function U(e, t) {
346
+ if (e) {
347
+ if (typeof e === "function") {
348
+ e(t);
349
+ } else {
350
+ // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
351
+ // the intention here is to signal "we will take care of setting 'current', not you".
352
+ e.current = t;
353
+ // eslint-disable-line no-param-reassign
354
+ }
355
+ }
303
356
  }
304
-
305
- _this = _super.call.apply(_super, [this].concat(args));
306
-
307
- _defineProperty(_assertThisInitialized(_this), "item", null);
308
-
309
- _defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
310
- var _this$props = _this.props,
311
- disabled = _this$props.disabled,
312
- onClick = _this$props.onClick,
313
- value = _this$props.value;
314
-
315
- if (!disabled) {
316
- onClick === null || onClick === void 0 ? void 0 : onClick(e, {
317
- value: value
318
- });
319
- }
320
- });
321
-
322
- return _this;
323
- }
324
-
325
- _createClass(Option, [{
326
- key: "scrollIntoViewIfNeeded",
327
- value: function scrollIntoViewIfNeeded() {
328
- var _this$item;
329
-
330
- (_this$item = this.item) === null || _this$item === void 0 ? void 0 : _this$item.scrollIntoViewIfNeeded();
357
+ // CONCATENATED MODULE: ./src/ComboBox/ComboBox.tsx
358
+ function X(e) {
359
+ "@babel/helpers - typeof";
360
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
361
+ X = function e(t) {
362
+ return typeof t;
363
+ };
364
+ } else {
365
+ X = function e(t) {
366
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
367
+ };
368
+ }
369
+ return X(e);
331
370
  }
332
- }, {
333
- key: "render",
334
- value: function render() {
335
- var _this2 = this;
336
-
337
- // eslint-disable-next-line no-unused-vars
338
- var _this$props2 = this.props,
339
- value = _this$props2.value,
340
- label = _this$props2.label,
341
- otherProps = _objectWithoutProperties(_this$props2, ["value", "label"]);
342
-
343
- var displayLabel = label === undefined ? value : label;
344
- return /*#__PURE__*/external_react_default.a.createElement(Menu_["Item"], _extends({
345
- ref: function ref(c) {
346
- _this2.item = c;
347
- },
348
- "data-test": "option",
349
- "data-test-value": value
350
- }, otherProps, {
351
- onClick: this.handleClick,
352
- role: "option",
353
- "aria-selected": false
354
- }), displayLabel);
355
- }
356
- }]);
357
-
358
- return Option;
359
- }(external_react_["PureComponent"]);
360
-
361
- _defineProperty(Option_Option, "propTypes", propTypes);
362
-
363
- _defineProperty(Option_Option, "defaultProps", defaultProps);
364
-
365
- /* harmony default export */ var ComboBox_Option = (Option_Option);
366
- // EXTERNAL MODULE: ./src/utils/updateReactRef.ts
367
- var updateReactRef = __webpack_require__(10);
368
-
369
- // CONCATENATED MODULE: ./src/ComboBox/ComboBox.tsx
370
- function ComboBox_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ComboBox_typeof = function _typeof(obj) { return typeof obj; }; } else { ComboBox_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ComboBox_typeof(obj); }
371
-
372
- function ComboBox_extends() { ComboBox_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return ComboBox_extends.apply(this, arguments); }
373
-
374
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
375
-
376
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { ComboBox_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
377
-
378
- function ComboBox_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
379
-
380
- function ComboBox_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
381
-
382
- function ComboBox_createClass(Constructor, protoProps, staticProps) { if (protoProps) ComboBox_defineProperties(Constructor.prototype, protoProps); if (staticProps) ComboBox_defineProperties(Constructor, staticProps); return Constructor; }
383
-
384
- function ComboBox_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ComboBox_setPrototypeOf(subClass, superClass); }
385
-
386
- function ComboBox_setPrototypeOf(o, p) { ComboBox_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ComboBox_setPrototypeOf(o, p); }
387
-
388
- function ComboBox_createSuper(Derived) { var hasNativeReflectConstruct = ComboBox_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = ComboBox_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = ComboBox_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return ComboBox_possibleConstructorReturn(this, result); }; }
389
-
390
- function ComboBox_possibleConstructorReturn(self, call) { if (call && (ComboBox_typeof(call) === "object" || typeof call === "function")) { return call; } return ComboBox_assertThisInitialized(self); }
391
-
392
- function ComboBox_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
393
-
394
- function ComboBox_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
395
-
396
- function ComboBox_getPrototypeOf(o) { ComboBox_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ComboBox_getPrototypeOf(o); }
397
-
398
- function ComboBox_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
399
-
400
-
401
-
402
-
403
-
404
-
405
-
406
-
407
-
408
-
409
-
410
-
411
-
412
-
413
-
414
-
415
-
416
-
417
- var ComboBox_propTypes = {
418
- animateLoading: external_prop_types_default.a.bool,
419
- append: external_prop_types_default.a.bool,
420
- children: external_prop_types_default.a.node,
421
- controlledFilter: external_prop_types_default.a.bool,
422
- defaultPlacement: external_prop_types_default.a.oneOf(['above', 'below', 'vertical']),
423
- defaultValue: external_prop_types_default.a.string,
424
- describedBy: external_prop_types_default.a.string,
425
- disabled: external_prop_types_default.a.bool,
426
- elementRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
427
- error: external_prop_types_default.a.bool,
428
- footerMessage: external_prop_types_default.a.node,
429
- inline: external_prop_types_default.a.bool,
430
- inputRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
431
- isLoadingOptions: external_prop_types_default.a.bool,
432
- labelledBy: external_prop_types_default.a.string,
433
- loadingMessage: external_prop_types_default.a.node,
434
- menuStyle: external_prop_types_default.a.object,
435
- name: external_prop_types_default.a.string,
436
- noOptionsMessage: external_prop_types_default.a.node,
437
- onChange: external_prop_types_default.a.func,
438
- onClose: external_prop_types_default.a.func,
439
- onFocus: external_prop_types_default.a.func,
440
- onKeyDown: external_prop_types_default.a.func,
441
- onOpen: external_prop_types_default.a.func,
442
- onScroll: external_prop_types_default.a.func,
443
- onScrollBottom: external_prop_types_default.a.func,
444
- placeholder: external_prop_types_default.a.string,
445
- prepend: external_prop_types_default.a.bool,
446
- size: external_prop_types_default.a.oneOf(['small', 'medium', 'large']),
447
- value: external_prop_types_default.a.string
448
- };
449
- var ComboBox_defaultProps = {
450
- animateLoading: false,
451
- controlledFilter: false,
452
- defaultPlacement: 'vertical',
453
- disabled: false,
454
- error: false,
455
- inline: false,
456
- isLoadingOptions: false,
457
- menuStyle: {},
458
- placeholder: Object(i18n_["_"])('Select...'),
459
- size: 'medium'
460
- };
461
-
462
- function containsEvent(el, _ref) {
463
- var clientX = _ref.clientX,
464
- clientY = _ref.clientY;
465
-
466
- var _el$getBoundingClient = el.getBoundingClientRect(),
467
- top = _el$getBoundingClient.top,
468
- left = _el$getBoundingClient.left,
469
- bottom = _el$getBoundingClient.bottom,
470
- right = _el$getBoundingClient.right;
471
-
472
- return clientX > left && clientX < right && clientY > top && clientY < bottom;
473
- }
474
-
475
- /**
476
- * `ComboBox` allows the user to select a predefined string or enter a new value. Unlike `Select`
477
- * and `Multiselect`, `Option` value must always be a string and `Option` does not have a label
478
- * property.
479
- */
480
- var ComboBox_ComboBox = /*#__PURE__*/function (_Component) {
481
- ComboBox_inherits(ComboBox, _Component);
482
-
483
- var _super = ComboBox_createSuper(ComboBox);
484
-
485
- // @docs-props-type ComboBoxPropsBase
486
- function ComboBox(props) {
487
- var _this;
488
-
489
- ComboBox_classCallCheck(this, ComboBox);
490
-
491
- _this = _super.call(this, props);
492
-
493
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "activeItemId", void 0);
494
-
495
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "activeValue", void 0);
496
-
497
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "availableOptionCount", 0);
498
-
499
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "controlledExternally", void 0);
500
-
501
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "focusCalledInternally", false);
502
-
503
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "options", void 0);
504
-
505
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "popoverId", void 0);
506
-
507
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "previousActiveIndex", null);
508
-
509
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "textInput", null);
510
-
511
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleInputMount", function (el) {
512
- _this.textInput = el;
513
- Object(updateReactRef["a" /* updateReactRef */])(_this.props.inputRef, el);
514
- });
515
-
516
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleAnchorMount", function (el) {
517
- _this.setState({
518
- anchor: el
519
- });
520
-
521
- Object(updateReactRef["a" /* updateReactRef */])(_this.props.elementRef, el);
522
- });
523
-
524
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleActiveOptionMount", function (c) {
525
- if (_this.previousActiveIndex !== _this.state.activeIndex) {
526
- c === null || c === void 0 ? void 0 : c.scrollIntoViewIfNeeded();
527
- }
528
- });
529
-
530
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleInputFocus", function (e) {
531
- var _this$props$onFocus, _this$props;
532
-
533
- /* SUI-930 On IE 11 this handler is essentially deferred after calling
534
- * this.textInput.focus(). this.focusCalledInternally enables the focus event to be ignored
535
- * when the menu closes. */
536
- if (_this.focusCalledInternally) {
537
- _this.focusCalledInternally = false;
538
- } else {
539
- _this.open();
540
- }
541
-
542
- (_this$props$onFocus = (_this$props = _this.props).onFocus) === null || _this$props$onFocus === void 0 ? void 0 : _this$props$onFocus.call(_this$props, e);
543
- });
544
-
545
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleChange", function (e, _ref2) {
546
- var _this$props$onChange, _this$props2;
547
-
548
- var value = _ref2.value,
549
- selectedOption = _ref2.selectedOption;
550
- var name = _this.props.name;
551
- var typedValue = selectedOption ? undefined : value;
552
-
553
- if (_this.isControlled()) {
554
- _this.setState({
555
- activeIndex: 0,
556
- typedValue: typedValue
557
- });
558
- } else {
559
- _this.setState({
560
- value: value,
561
- activeIndex: 0,
562
- typedValue: typedValue
563
- });
564
- }
565
-
566
- (_this$props$onChange = (_this$props2 = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props2, e, {
567
- value: value,
568
- name: name
569
- });
570
- });
571
-
572
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleSelectOption", function (e, data) {
573
- _this.handleChange(e, _objectSpread(_objectSpread({}, data), {}, {
574
- selectedOption: true
575
- }));
576
-
577
- _this.focusCalledInternally = true;
578
-
579
- _this.focus();
580
-
581
- _this.close();
582
- });
583
-
584
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleInputKeyDown", function (e) {
585
- var _this$props3 = _this.props,
586
- children = _this$props3.children,
587
- onKeyDown = _this$props3.onKeyDown,
588
- onScrollBottom = _this$props3.onScrollBottom;
589
- var numOptions = _this.availableOptionCount;
590
- var activeOption = _this.activeValue;
591
- var eventKeyCode = Object(keyboard_["keycode"])(e.nativeEvent);
592
-
593
- if (_this.state.open) {
594
- switch (eventKeyCode) {
595
- case 'enter':
596
- {
597
- if (activeOption) {
598
- _this.handleSelectOption(e, {
599
- value: activeOption
600
- });
601
- }
602
-
603
- break;
371
+ function Y() {
372
+ Y = Object.assign || function(e) {
373
+ for (var t = 1; t < arguments.length; t++) {
374
+ var n = arguments[t];
375
+ for (var o in n) {
376
+ if (Object.prototype.hasOwnProperty.call(n, o)) {
377
+ e[o] = n[o];
378
+ }
379
+ }
604
380
  }
605
-
606
- case 'tab':
607
- _this.close();
608
-
609
- break;
610
-
611
- case 'down':
612
- _this.setState(function (state) {
613
- return {
614
- activeIndex: Math.min(state.activeIndex + 1, numOptions - 1)
615
- };
616
- });
617
-
618
- if (children && onScrollBottom) {
619
- var beforeLastChild = external_react_["Children"].count(children) - 2;
620
-
621
- if (_this.state.activeIndex === beforeLastChild) {
622
- _this.handleScrollBottom(e);
623
- }
624
- }
625
-
626
- break;
627
-
628
- case 'up':
629
- _this.setState(function (state) {
630
- return {
631
- activeIndex: Math.max(state.activeIndex - 1, 0)
632
- };
633
- });
634
-
635
- break;
636
-
637
- default: // do nothing
638
-
381
+ return e;
382
+ };
383
+ return Y.apply(this, arguments);
384
+ }
385
+ function G(e, t) {
386
+ var n = Object.keys(e);
387
+ if (Object.getOwnPropertySymbols) {
388
+ var o = Object.getOwnPropertySymbols(e);
389
+ if (t) o = o.filter((function(t) {
390
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
391
+ }));
392
+ n.push.apply(n, o);
639
393
  }
640
- } else if (Object(keyboard_["addsCharacter"])(e.nativeEvent) !== false || // Safari 9.0 returns undefined
641
- eventKeyCode === 'enter' || eventKeyCode === 'backspace' || eventKeyCode === 'down' || eventKeyCode === 'up') {
642
- _this.open();
643
- }
644
-
645
- onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
646
- });
647
-
648
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleInputClick", function () {
649
- if (!_this.state.open && !_this.props.disabled) {
650
- _this.open();
651
- }
652
- });
653
-
654
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleRequestClose", function (_ref3) {
655
- var event = _ref3.event,
656
- reason = _ref3.reason;
657
- var shouldClose = reason === 'offScreen' || reason === 'escapeKey' || reason === 'clickAway' && _this.state.anchor && !containsEvent(_this.state.anchor, event);
658
-
659
- if (shouldClose) {
660
- _this.close();
661
- }
662
- });
663
-
664
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "handleScrollBottom", function (e) {
665
- if (_this.state.open && !_this.props.isLoadingOptions) {
666
- var _this$props$onScrollB, _this$props4;
667
-
668
- (_this$props$onScrollB = (_this$props4 = _this.props).onScrollBottom) === null || _this$props$onScrollB === void 0 ? void 0 : _this$props$onScrollB.call(_this$props4, e);
669
- }
670
- });
671
-
672
- ComboBox_defineProperty(ComboBox_assertThisInitialized(_this), "renderMenu", function (_ref4) {
673
- var anchorWidth = _ref4.anchorWidth,
674
- maxHeight = _ref4.maxHeight;
675
- var _this$props5 = _this.props,
676
- children = _this$props5.children,
677
- controlledFilter = _this$props5.controlledFilter,
678
- isLoadingOptions = _this$props5.isLoadingOptions,
679
- menuStyle = _this$props5.menuStyle,
680
- onScrollBottom = _this$props5.onScrollBottom;
681
- var _this$state = _this.state,
682
- activeIndex = _this$state.activeIndex,
683
- typedValue = _this$state.typedValue;
684
-
685
- var value = _this.getValue();
686
-
687
- var initialOptions = external_react_["Children"].toArray(children).filter(external_react_["isValidElement"]);
688
- var hasExactMatch = some_default()(initialOptions, function (option) {
689
- if (option.type === Menu_["Heading"]) {
690
- return false;
394
+ return n;
395
+ }
396
+ function J(e) {
397
+ for (var t = 1; t < arguments.length; t++) {
398
+ var n = arguments[t] != null ? arguments[t] : {};
399
+ if (t % 2) {
400
+ G(Object(n), true).forEach((function(t) {
401
+ le(e, t, n[t]);
402
+ }));
403
+ } else if (Object.getOwnPropertyDescriptors) {
404
+ Object.defineProperties(e, Object.getOwnPropertyDescriptors(n));
405
+ } else {
406
+ G(Object(n)).forEach((function(t) {
407
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
408
+ }));
409
+ }
691
410
  }
692
-
693
- if (option.props.label === undefined) {
694
- return option.props.value === value;
411
+ return e;
412
+ }
413
+ function Q(e, t) {
414
+ if (!(e instanceof t)) {
415
+ throw new TypeError("Cannot call a class as a function");
695
416
  }
696
-
697
- if (option.props.label !== undefined && typedValue !== undefined) {
698
- return option.props.label === value;
417
+ }
418
+ function Z(e, t) {
419
+ for (var n = 0; n < t.length; n++) {
420
+ var o = t[n];
421
+ o.enumerable = o.enumerable || false;
422
+ o.configurable = true;
423
+ if ("value" in o) o.writable = true;
424
+ Object.defineProperty(e, o.key, o);
699
425
  }
700
-
701
- return option.props.value === value;
702
- });
703
-
704
- if (!hasExactMatch && value) {
705
- initialOptions.unshift( /*#__PURE__*/external_react_default.a.createElement(ComboBox_Option, {
706
- description: Object(i18n_["_"])('(New value)'),
707
- descriptionPosition: "right",
708
- key: "currentValueOption",
709
- value: value,
710
- "data-test-current-value-option": value
711
- }));
712
- } // Highlight Active
713
-
714
-
715
- _this.availableOptionCount = 0;
716
- _this.activeValue = undefined;
717
- var keywords = Object(filter_["stringToKeywords"])(typedValue ? value : _this.getDisplayValue());
718
- _this.options = (controlledFilter ? initialOptions : initialOptions.filter(function (option) {
719
- if (option.props.label !== undefined) {
720
- return Object(filter_["testPhrase"])(option.props.label, keywords);
426
+ }
427
+ function $(e, t, n) {
428
+ if (t) Z(e.prototype, t);
429
+ if (n) Z(e, n);
430
+ return e;
431
+ }
432
+ function ee(e, t) {
433
+ if (typeof t !== "function" && t !== null) {
434
+ throw new TypeError("Super expression must either be null or a function");
721
435
  }
722
-
723
- if (option.props.value !== undefined) {
724
- return Object(filter_["testPhrase"])(option.props.value, keywords);
436
+ e.prototype = Object.create(t && t.prototype, {
437
+ constructor: {
438
+ value: e,
439
+ writable: true,
440
+ configurable: true
441
+ }
442
+ });
443
+ if (t) te(e, t);
444
+ }
445
+ function te(e, t) {
446
+ te = Object.setPrototypeOf || function e(t, n) {
447
+ t.__proto__ = n;
448
+ return t;
449
+ };
450
+ return te(e, t);
451
+ }
452
+ function ne(e) {
453
+ var t = ie();
454
+ return function n() {
455
+ var o = ae(e), r;
456
+ if (t) {
457
+ var i = ae(this).constructor;
458
+ r = Reflect.construct(o, arguments, i);
459
+ } else {
460
+ r = o.apply(this, arguments);
461
+ }
462
+ return oe(this, r);
463
+ };
464
+ }
465
+ function oe(e, t) {
466
+ if (t && (X(t) === "object" || typeof t === "function")) {
467
+ return t;
725
468
  }
726
-
727
- return true; // Keep all headers and non-interactive options
728
- })).map(function (option, index) {
729
- if (!has_default()(option.props, 'active')) {
730
- // ignore Headings and Dividers
731
- return option;
469
+ return re(e);
470
+ }
471
+ function re(e) {
472
+ if (e === void 0) {
473
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
732
474
  }
733
-
734
- var active = _this.availableOptionCount === activeIndex;
735
- _this.availableOptionCount += 1;
736
- var matchRangePhrase = option.props.label !== undefined ? option.props.label : option.props.value;
737
- var matchRangesProp = option.props.matchRanges;
738
- var matchRanges = !controlledFilter && value && (hasExactMatch || index > 0) ? Object(filter_["keywordLocations"])(matchRangePhrase, keywords) || undefined // keywordLocations can return false, matchRanges must be an array or undefined
739
- : undefined;
740
-
741
- if (active) {
742
- _this.activeValue = option.props.value;
743
- return /*#__PURE__*/Object(external_react_["cloneElement"])(option, {
744
- ref: _this.handleActiveOptionMount,
745
- id: _this.activeItemId,
746
- onClick: _this.handleSelectOption,
747
- matchRanges: matchRangesProp || matchRanges,
748
- active: true
749
- });
475
+ return e;
476
+ }
477
+ function ie() {
478
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
479
+ if (Reflect.construct.sham) return false;
480
+ if (typeof Proxy === "function") return true;
481
+ try {
482
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
483
+ return true;
484
+ } catch (e) {
485
+ return false;
750
486
  }
751
-
752
- return /*#__PURE__*/Object(external_react_["cloneElement"])(option, {
753
- onClick: _this.handleSelectOption,
754
- matchRanges: matchRangesProp || matchRanges
755
- });
756
- });
757
- return /*#__PURE__*/external_react_default.a.createElement(ResultsMenu_default.a, ComboBox_extends({
758
- style: extend_default()({
759
- overflow: 'auto',
760
- width: Math.max(anchorWidth !== null && anchorWidth !== void 0 ? anchorWidth : 0, 200)
761
- }, menuStyle),
762
- controlledExternally: true,
763
- maxHeight: maxHeight !== null && maxHeight !== void 0 ? maxHeight : undefined,
764
- onScrollBottom: onScrollBottom ? _this.handleScrollBottom : undefined,
765
- isLoading: isLoadingOptions
766
- }, pick_default()(_this.props, 'className', 'noOptionsMessage', 'footerMessage', 'animateLoading', 'loadingMessage', 'onScroll')), _this.options);
767
- });
768
-
769
- _this.state = {
770
- activeIndex: 0,
771
- anchor: null,
772
- typedValue: undefined,
773
- open: false,
774
- value: props.defaultValue || ''
775
- };
776
- _this.controlledExternally = has_default()(props, 'value');
777
- _this.popoverId = Object(id_["createDOMID"])('popover');
778
- _this.activeItemId = Object(id_["createDOMID"])('active-item');
779
-
780
- if (false) {}
781
-
782
- if (false) {}
783
-
784
- return _this;
785
- }
786
-
787
- ComboBox_createClass(ComboBox, [{
788
- key: "componentDidUpdate",
789
- value: function componentDidUpdate(prevProps, prevState) {
790
- if (false) {}
791
-
792
- this.previousActiveIndex = prevState.activeIndex;
793
- }
794
- }, {
795
- key: "getValue",
796
- value: function getValue() {
797
- return this.isControlled() ? this.props.value : this.state.value;
798
- }
799
- }, {
800
- key: "getDisplayValue",
801
- value: function getDisplayValue() {
802
- var value = this.getValue();
803
- var typedValue = this.state.typedValue;
804
- var initialOptions = external_react_["Children"].toArray(this.props.children).filter(external_react_["isValidElement"]);
805
- var optionForValue = !typedValue && initialOptions.find(function (option) {
806
- return option.props.label !== undefined && option.props.value === value;
807
- });
808
-
809
- if (optionForValue) {
810
- return optionForValue === null || optionForValue === void 0 ? void 0 : optionForValue.props.label;
811
- }
812
-
813
- return value;
814
487
  }
815
- }, {
816
- key: "open",
817
- value: function open() {
818
- var _this2 = this;
819
-
820
- this.setState({
821
- open: true,
822
- activeIndex: 0
823
- }, function () {
824
- var _this2$props$onOpen, _this2$props;
825
-
826
- (_this2$props$onOpen = (_this2$props = _this2.props).onOpen) === null || _this2$props$onOpen === void 0 ? void 0 : _this2$props$onOpen.call(_this2$props);
827
- });
488
+ function ae(e) {
489
+ ae = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
490
+ return t.__proto__ || Object.getPrototypeOf(t);
491
+ };
492
+ return ae(e);
828
493
  }
829
- }, {
830
- key: "close",
831
- value: function close() {
832
- var _this3 = this;
833
-
834
- this.setState({
835
- open: false
836
- }, function () {
837
- var _this3$props$onClose, _this3$props;
838
-
839
- _this3.previousActiveIndex = null;
840
- (_this3$props$onClose = (_this3$props = _this3.props).onClose) === null || _this3$props$onClose === void 0 ? void 0 : _this3$props$onClose.call(_this3$props);
841
- });
494
+ function le(e, t, n) {
495
+ if (t in e) {
496
+ Object.defineProperty(e, t, {
497
+ value: n,
498
+ enumerable: true,
499
+ configurable: true,
500
+ writable: true
501
+ });
502
+ } else {
503
+ e[t] = n;
504
+ }
505
+ return e;
506
+ }
507
+ var ue = {
508
+ animateLoading: i().bool,
509
+ append: i().bool,
510
+ children: i().node,
511
+ controlledFilter: i().bool,
512
+ defaultPlacement: i().oneOf([ "above", "below", "vertical" ]),
513
+ defaultValue: i().string,
514
+ describedBy: i().string,
515
+ disabled: i().bool,
516
+ elementRef: i().oneOfType([ i().func, i().object ]),
517
+ error: i().bool,
518
+ footerMessage: i().node,
519
+ inline: i().bool,
520
+ inputRef: i().oneOfType([ i().func, i().object ]),
521
+ isLoadingOptions: i().bool,
522
+ labelledBy: i().string,
523
+ loadingMessage: i().node,
524
+ menuStyle: i().object,
525
+ name: i().string,
526
+ noOptionsMessage: i().node,
527
+ onChange: i().func,
528
+ onClose: i().func,
529
+ onFocus: i().func,
530
+ onKeyDown: i().func,
531
+ onOpen: i().func,
532
+ onScroll: i().func,
533
+ onScrollBottom: i().func,
534
+ placeholder: i().string,
535
+ prepend: i().bool,
536
+ size: i().oneOf([ "small", "medium", "large" ]),
537
+ value: i().string
538
+ };
539
+ var ce = {
540
+ animateLoading: false,
541
+ controlledFilter: false,
542
+ defaultPlacement: "vertical",
543
+ disabled: false,
544
+ error: false,
545
+ inline: false,
546
+ isLoadingOptions: false,
547
+ menuStyle: {},
548
+ placeholder: (0, m._)("Select..."),
549
+ size: "medium"
550
+ };
551
+ function se(e, t) {
552
+ var n = t.clientX, o = t.clientY;
553
+ var r = e.getBoundingClientRect(), i = r.top, a = r.left, l = r.bottom, u = r.right;
554
+ return n > a && n < u && o > i && o < l;
842
555
  }
843
556
  /**
557
+ * `ComboBox` allows the user to select a predefined string or enter a new value. Unlike `Select`
558
+ * and `Multiselect`, `Option` value must always be a string and `Option` does not have a label
559
+ * property.
560
+ */ var fe = function(e) {
561
+ ee(r, e);
562
+ var t = ne(r);
563
+ // @docs-props-type ComboBoxPropsBase
564
+ function r(e) {
565
+ var i;
566
+ Q(this, r);
567
+ i = t.call(this, e);
568
+ le(re(i), "activeItemId", void 0);
569
+ le(re(i), "activeValue", void 0);
570
+ le(re(i), "availableOptionCount", 0);
571
+ le(re(i), "controlledExternally", void 0);
572
+ le(re(i), "focusCalledInternally", false);
573
+ le(re(i), "options", void 0);
574
+ le(re(i), "popoverId", void 0);
575
+ le(re(i), "previousActiveIndex", null);
576
+ le(re(i), "textInput", null);
577
+ le(re(i), "handleInputMount", (function(e) {
578
+ i.textInput = e;
579
+ U(i.props.inputRef, e);
580
+ }));
581
+ le(re(i), "handleAnchorMount", (function(e) {
582
+ i.setState({
583
+ anchor: e
584
+ });
585
+ U(i.props.elementRef, e);
586
+ }));
587
+ le(re(i), "handleActiveOptionMount", (function(e) {
588
+ if (i.previousActiveIndex !== i.state.activeIndex) {
589
+ e === null || e === void 0 ? void 0 : e.scrollIntoViewIfNeeded();
590
+ }
591
+ }));
592
+ le(re(i), "handleInputFocus", (function(e) {
593
+ var t, n;
594
+ /* SUI-930 On IE 11 this handler is essentially deferred after calling
595
+ * this.textInput.focus(). this.focusCalledInternally enables the focus event to be ignored
596
+ * when the menu closes. */ if (i.focusCalledInternally) {
597
+ i.focusCalledInternally = false;
598
+ } else {
599
+ i.open();
600
+ }
601
+ (t = (n = i.props).onFocus) === null || t === void 0 ? void 0 : t.call(n, e);
602
+ }));
603
+ le(re(i), "handleChange", (function(e, t) {
604
+ var n, o;
605
+ var r = t.value, a = t.selectedOption;
606
+ var l = i.props.name;
607
+ var u = a ? undefined : r;
608
+ if (i.isControlled()) {
609
+ i.setState({
610
+ activeIndex: 0,
611
+ typedValue: u
612
+ });
613
+ } else {
614
+ i.setState({
615
+ value: r,
616
+ activeIndex: 0,
617
+ typedValue: u
618
+ });
619
+ }
620
+ (n = (o = i.props).onChange) === null || n === void 0 ? void 0 : n.call(o, e, {
621
+ value: r,
622
+ name: l
623
+ });
624
+ }));
625
+ le(re(i), "handleSelectOption", (function(e, t) {
626
+ i.handleChange(e, J(J({}, t), {}, {
627
+ selectedOption: true
628
+ }));
629
+ i.focusCalledInternally = true;
630
+ i.focus();
631
+ i.close();
632
+ }));
633
+ le(re(i), "handleInputKeyDown", (function(e) {
634
+ var t = i.props, o = t.children, r = t.onKeyDown, a = t.onScrollBottom;
635
+ var l = i.availableOptionCount;
636
+ var u = i.activeValue;
637
+ var c = (0, g.keycode)(e.nativeEvent);
638
+ if (i.state.open) {
639
+ switch (c) {
640
+ case "enter":
641
+ {
642
+ if (u) {
643
+ i.handleSelectOption(e, {
644
+ value: u
645
+ });
646
+ }
647
+ break;
648
+ }
649
+
650
+ case "tab":
651
+ i.close();
652
+ break;
653
+
654
+ case "down":
655
+ i.setState((function(e) {
656
+ return {
657
+ activeIndex: Math.min(e.activeIndex + 1, l - 1)
658
+ };
659
+ }));
660
+ if (o && a) {
661
+ var s = n.Children.count(o) - 2;
662
+ if (i.state.activeIndex === s) {
663
+ i.handleScrollBottom(e);
664
+ }
665
+ }
666
+ break;
667
+
668
+ case "up":
669
+ i.setState((function(e) {
670
+ return {
671
+ activeIndex: Math.max(e.activeIndex - 1, 0)
672
+ };
673
+ }));
674
+ break;
675
+
676
+ default:
677
+ // do nothing
678
+ }
679
+ } else if ((0, g.addsCharacter)(e.nativeEvent) !== false || // Safari 9.0 returns undefined
680
+ c === "enter" || c === "backspace" || c === "down" || c === "up") {
681
+ i.open();
682
+ }
683
+ r === null || r === void 0 ? void 0 : r(e);
684
+ }));
685
+ le(re(i), "handleInputClick", (function() {
686
+ if (!i.state.open && !i.props.disabled) {
687
+ i.open();
688
+ }
689
+ }));
690
+ le(re(i), "handleRequestClose", (function(e) {
691
+ var t = e.event, n = e.reason;
692
+ var o = n === "offScreen" || n === "escapeKey" || n === "clickAway" && i.state.anchor && !se(i.state.anchor, t);
693
+ if (o) {
694
+ i.close();
695
+ }
696
+ }));
697
+ le(re(i), "handleScrollBottom", (function(e) {
698
+ if (i.state.open && !i.props.isLoadingOptions) {
699
+ var t, n;
700
+ (t = (n = i.props).onScrollBottom) === null || t === void 0 ? void 0 : t.call(n, e);
701
+ }
702
+ }));
703
+ le(re(i), "renderMenu", (function(e) {
704
+ var t = e.anchorWidth, r = e.maxHeight;
705
+ var a = i.props, u = a.children, s = a.controlledFilter, f = a.isLoadingOptions, p = a.menuStyle, v = a.onScrollBottom;
706
+ var b = i.state, g = b.activeIndex, I = b.typedValue;
707
+ var S = i.getValue();
708
+ var C = n.Children.toArray(u).filter(n.isValidElement);
709
+ var k = h()(C, (function(e) {
710
+ if (e.type === O.Heading) {
711
+ return false;
712
+ }
713
+ if (e.props.label === undefined) {
714
+ return e.props.value === S;
715
+ }
716
+ if (e.props.label !== undefined && I !== undefined) {
717
+ return e.props.label === S;
718
+ }
719
+ return e.props.value === S;
720
+ }));
721
+ if (!k && S) {
722
+ C.unshift( o().createElement(W, {
723
+ description: (0, m._)("(New value)"),
724
+ descriptionPosition: "right",
725
+ key: "currentValueOption",
726
+ value: S,
727
+ "data-test-current-value-option": S
728
+ }));
729
+ }
730
+ // Highlight Active
731
+ i.availableOptionCount = 0;
732
+ i.activeValue = undefined;
733
+ var P = (0, y.stringToKeywords)(I ? S : i.getDisplayValue());
734
+ i.options = (s ? C : C.filter((function(e) {
735
+ if (e.props.label !== undefined) {
736
+ return (0, y.testPhrase)(e.props.label, P);
737
+ }
738
+ if (e.props.value !== undefined) {
739
+ return (0, y.testPhrase)(e.props.value, P);
740
+ }
741
+ return true;
742
+ // Keep all headers and non-interactive options
743
+ }))).map((function(e, t) {
744
+ if (!c()(e.props, "active")) {
745
+ // ignore Headings and Dividers
746
+ return e;
747
+ }
748
+ var o = i.availableOptionCount === g;
749
+ i.availableOptionCount += 1;
750
+ var r = e.props.label !== undefined ? e.props.label : e.props.value;
751
+ var a = e.props.matchRanges;
752
+ var l = !s && S && (k || t > 0) ? (0, y.keywordLocations)(r, P) || undefined : undefined;
753
+ if (o) {
754
+ i.activeValue = e.props.value;
755
+
756
+ return (0, n.cloneElement)(e, {
757
+ ref: i.handleActiveOptionMount,
758
+ id: i.activeItemId,
759
+ onClick: i.handleSelectOption,
760
+ matchRanges: a || l,
761
+ active: true
762
+ });
763
+ }
764
+
765
+ return (0, n.cloneElement)(e, {
766
+ onClick: i.handleSelectOption,
767
+ matchRanges: a || l
768
+ });
769
+ }));
770
+
771
+ return o().createElement(w(), Y({
772
+ style: l()({
773
+ overflow: "auto",
774
+ width: Math.max(t !== null && t !== void 0 ? t : 0, 200)
775
+ }, p),
776
+ controlledExternally: true,
777
+ maxHeight: r !== null && r !== void 0 ? r : undefined,
778
+ onScrollBottom: v ? i.handleScrollBottom : undefined,
779
+ isLoading: f
780
+ }, d()(i.props, "className", "noOptionsMessage", "footerMessage", "animateLoading", "loadingMessage", "onScroll")), i.options);
781
+ }));
782
+ i.state = {
783
+ activeIndex: 0,
784
+ anchor: null,
785
+ typedValue: undefined,
786
+ open: false,
787
+ value: e.defaultValue || ""
788
+ };
789
+ i.controlledExternally = c()(e, "value");
790
+ i.popoverId = (0, b.createDOMID)("popover");
791
+ i.activeItemId = (0, b.createDOMID)("active-item");
792
+ if (false) {}
793
+ if (false) {}
794
+ return i;
795
+ }
796
+ $(r, [ {
797
+ key: "componentDidUpdate",
798
+ value: function e(t, n) {
799
+ if (false) {}
800
+ this.previousActiveIndex = n.activeIndex;
801
+ }
802
+ }, {
803
+ key: "getValue",
804
+ value: function e() {
805
+ return this.isControlled() ? this.props.value : this.state.value;
806
+ }
807
+ }, {
808
+ key: "getDisplayValue",
809
+ value: function e() {
810
+ var t = this.getValue();
811
+ var o = this.state.typedValue;
812
+ var r = n.Children.toArray(this.props.children).filter(n.isValidElement);
813
+ var i = !o && r.find((function(e) {
814
+ return e.props.label !== undefined && e.props.value === t;
815
+ }));
816
+ if (i) {
817
+ return i === null || i === void 0 ? void 0 : i.props.label;
818
+ }
819
+ return t;
820
+ }
821
+ }, {
822
+ key: "open",
823
+ value: function e() {
824
+ var t = this;
825
+ this.setState({
826
+ open: true,
827
+ activeIndex: 0
828
+ }, (function() {
829
+ var e, n;
830
+ (e = (n = t.props).onOpen) === null || e === void 0 ? void 0 : e.call(n);
831
+ }));
832
+ }
833
+ }, {
834
+ key: "close",
835
+ value: function e() {
836
+ var t = this;
837
+ this.setState({
838
+ open: false
839
+ }, (function() {
840
+ var e, n;
841
+ t.previousActiveIndex = null;
842
+ (e = (n = t.props).onClose) === null || e === void 0 ? void 0 : e.call(n);
843
+ }));
844
+ }
845
+ /**
844
846
  * Focus the `ComboBox`.
845
- */
846
-
847
- }, {
848
- key: "focus",
849
- value: function focus() {
850
- var _this$textInput;
851
-
852
- (_this$textInput = this.textInput) === null || _this$textInput === void 0 ? void 0 : _this$textInput.focus();
853
- }
854
- }, {
855
- key: "isControlled",
856
- value: function isControlled() {
857
- return this.controlledExternally;
858
- }
859
- }, {
860
- key: "render",
861
- value: function render() {
862
- var defaultPlacement = this.props.defaultPlacement;
863
- var _this$state2 = this.state,
864
- anchor = _this$state2.anchor,
865
- open = _this$state2.open;
866
- var currentValue = this.getValue();
867
- var currentDisplayValue = this.getDisplayValue();
868
- return /*#__PURE__*/external_react_default.a.createElement(Text_default.a, ComboBox_extends({
869
- autoCapitalize: "off",
870
- autoComplete: "off",
871
- autoCorrect: "off",
872
- spellCheck: false,
873
- canClear: true,
874
- "data-test": "combo-box"
875
- }, omit_default()(this.props, 'animateLoading', 'className', 'controlledFilter', 'defaultValue', 'footerMessage', 'isLoadingOptions', 'loadingMessage', 'menuStyle', 'noOptionsMessage', 'onClose', 'onOpen', 'onScroll', 'onScrollBottom', 'spellCheck'), {
876
- "data-test-popover-id": this.popoverId,
877
- "data-test-label": currentDisplayValue,
878
- "data-test-value": currentValue,
879
- "data-test-open": open && !!anchor,
880
- onFocus: this.handleInputFocus,
881
- onClick: this.handleInputClick,
882
- onChange: this.handleChange,
883
- onKeyDown: this.handleInputKeyDown,
884
- inputRef: this.handleInputMount,
885
- elementRef: this.handleAnchorMount,
886
- role: "combobox",
887
- value: currentDisplayValue,
888
- "aria-activedescendant": this.activeItemId,
889
- "aria-expanded": open,
890
- "aria-haspopup": true,
891
- "aria-label": Object(i18n_["_"])('Value input'),
892
- "aria-controls": open ? this.popoverId : undefined
893
- }), /*#__PURE__*/external_react_default.a.createElement(Popover_default.a, {
894
- anchor: anchor,
895
- autoCloseWhenOffScreen: true,
896
- canCoverAnchor: false,
897
- defaultPlacement: defaultPlacement,
898
- id: this.popoverId,
899
- onRequestClose: this.handleRequestClose,
900
- open: open && !!anchor,
901
- repositionMode: "flip"
902
- }, this.renderMenu));
903
- }
904
- }]);
905
-
906
- return ComboBox;
907
- }(external_react_["Component"]);
908
-
909
- ComboBox_defineProperty(ComboBox_ComboBox, "propTypes", ComboBox_propTypes);
910
-
911
- ComboBox_defineProperty(ComboBox_ComboBox, "defaultProps", ComboBox_defaultProps);
912
-
913
- ComboBox_defineProperty(ComboBox_ComboBox, "Option", ComboBox_Option);
914
-
915
- ComboBox_defineProperty(ComboBox_ComboBox, "Divider", Menu_["Divider"]);
916
-
917
- ComboBox_defineProperty(ComboBox_ComboBox, "Heading", Menu_["Heading"]);
918
-
919
- /* harmony default export */ var src_ComboBox_ComboBox = (ComboBox_ComboBox);
920
-
921
- // CONCATENATED MODULE: ./src/ComboBox/index.ts
922
-
923
-
924
-
925
- /***/ }),
926
-
927
- /***/ 32:
928
- /***/ (function(module, exports) {
929
-
930
- module.exports = require("@splunk/react-ui/Text");
931
-
932
- /***/ }),
933
-
934
- /***/ 35:
935
- /***/ (function(module, exports) {
936
-
937
- module.exports = require("@splunk/ui-utils/filter");
938
-
939
- /***/ }),
940
-
941
- /***/ 4:
942
- /***/ (function(module, exports) {
943
-
944
- module.exports = require("@splunk/ui-utils/i18n");
945
-
946
- /***/ }),
947
-
948
- /***/ 44:
949
- /***/ (function(module, exports) {
950
-
951
- module.exports = require("lodash/pick");
952
-
953
- /***/ }),
954
-
955
- /***/ 47:
956
- /***/ (function(module, exports) {
957
-
958
- module.exports = require("@splunk/react-ui/ResultsMenu");
959
-
960
- /***/ }),
961
-
962
- /***/ 5:
963
- /***/ (function(module, exports) {
964
-
965
- module.exports = require("lodash/omit");
966
-
967
- /***/ }),
968
-
969
- /***/ 52:
970
- /***/ (function(module, exports) {
971
-
972
- module.exports = require("lodash/extend");
973
-
974
- /***/ }),
975
-
976
- /***/ 7:
977
- /***/ (function(module, exports) {
978
-
979
- module.exports = require("@splunk/ui-utils/keyboard");
980
-
981
- /***/ }),
982
-
983
- /***/ 8:
984
- /***/ (function(module, exports) {
985
-
986
- module.exports = require("@splunk/ui-utils/id");
987
-
988
- /***/ })
989
-
990
- /******/ });
847
+ */ }, {
848
+ key: "focus",
849
+ value: function e() {
850
+ var t;
851
+ (t = this.textInput) === null || t === void 0 ? void 0 : t.focus();
852
+ }
853
+ }, {
854
+ key: "isControlled",
855
+ value: function e() {
856
+ return this.controlledExternally;
857
+ }
858
+ }, {
859
+ key: "render",
860
+ value: function e() {
861
+ var t = this.props.defaultPlacement;
862
+ var n = this.state, r = n.anchor, i = n.open;
863
+ var a = this.getValue();
864
+ var l = this.getDisplayValue();
865
+
866
+ return o().createElement(P(), Y({
867
+ autoCapitalize: "off",
868
+ autoComplete: "off",
869
+ autoCorrect: "off",
870
+ spellCheck: false,
871
+ canClear: true,
872
+ "data-test": "combo-box"
873
+ }, f()(this.props, "animateLoading", "className", "controlledFilter", "defaultValue", "footerMessage", "isLoadingOptions", "loadingMessage", "menuStyle", "noOptionsMessage", "onClose", "onOpen", "onScroll", "onScrollBottom", "spellCheck"), {
874
+ "data-test-popover-id": this.popoverId,
875
+ "data-test-label": l,
876
+ "data-test-value": a,
877
+ "data-test-open": i && !!r,
878
+ onFocus: this.handleInputFocus,
879
+ onClick: this.handleInputClick,
880
+ onChange: this.handleChange,
881
+ onKeyDown: this.handleInputKeyDown,
882
+ inputRef: this.handleInputMount,
883
+ elementRef: this.handleAnchorMount,
884
+ role: "combobox",
885
+ value: l,
886
+ "aria-activedescendant": this.activeItemId,
887
+ "aria-expanded": i,
888
+ "aria-haspopup": true,
889
+ "aria-label": (0, m._)("Value input"),
890
+ "aria-controls": i ? this.popoverId : undefined
891
+ }), o().createElement(S(), {
892
+ anchor: r,
893
+ autoCloseWhenOffScreen: true,
894
+ canCoverAnchor: false,
895
+ defaultPlacement: t,
896
+ id: this.popoverId,
897
+ onRequestClose: this.handleRequestClose,
898
+ open: i && !!r,
899
+ repositionMode: "flip"
900
+ }, this.renderMenu));
901
+ }
902
+ } ]);
903
+ return r;
904
+ }(n.Component);
905
+ le(fe, "propTypes", ue);
906
+ le(fe, "defaultProps", ce);
907
+ le(fe, "Option", W);
908
+ le(fe, "Divider", O.Divider);
909
+ le(fe, "Heading", O.Heading);
910
+ /* harmony default export */ const pe = fe;
911
+ // CONCATENATED MODULE: ./src/ComboBox/index.ts
912
+ module.exports = t;
913
+ /******/})();