@splunk/react-ui 4.23.0 → 4.24.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 (36) hide show
  1. package/Breadcrumbs.js +99 -124
  2. package/CHANGELOG.md +11 -0
  3. package/ComboBox.js +49 -37
  4. package/JSONTree.js +210 -177
  5. package/Menu.js +643 -472
  6. package/Modal.js +261 -222
  7. package/Multiselect.js +634 -620
  8. package/ResultsMenu.js +863 -148
  9. package/Search.js +3 -1
  10. package/Select.js +427 -416
  11. package/TabBar.js +2 -2
  12. package/Table.js +2 -2
  13. package/Tree.js +617 -0
  14. package/package.json +1 -1
  15. package/types/src/Breadcrumbs/Breadcrumbs.d.ts +7 -1
  16. package/types/src/Breadcrumbs/Item.d.ts +8 -2
  17. package/types/src/ComboBox/ComboBox.d.ts +6 -0
  18. package/types/src/JSONTree/JSONTree.d.ts +2 -1
  19. package/types/src/Menu/Menu.d.ts +14 -1
  20. package/types/src/Modal/Modal.d.ts +6 -0
  21. package/types/src/Multiselect/Compact.d.ts +6 -0
  22. package/types/src/Multiselect/Multiselect.d.ts +7 -0
  23. package/types/src/ResultsMenu/ResultsMenu.d.ts +53 -1
  24. package/types/src/ResultsMenu/VirtualizedResultsMenu/VirtualizedItem.d.ts +9 -0
  25. package/types/src/ResultsMenu/VirtualizedResultsMenu/VirtualizedResultsMenu.d.ts +33 -0
  26. package/types/src/ResultsMenu/VirtualizedResultsMenu/groupChildren.d.ts +16 -0
  27. package/types/src/ResultsMenu/VirtualizedResultsMenu/index.d.ts +3 -0
  28. package/types/src/ResultsMenu/VirtualizedResultsMenu/injectVirtualizedItem.d.ts +21 -0
  29. package/types/src/ResultsMenu/index.d.ts +2 -1
  30. package/types/src/Select/Select.d.ts +2 -0
  31. package/types/src/Select/SelectBase.d.ts +6 -0
  32. package/types/src/Tree/Tree.d.ts +24 -0
  33. package/types/src/Tree/TreeContext.d.ts +13 -0
  34. package/types/src/Tree/TreeItem.d.ts +31 -0
  35. package/types/src/Tree/index.d.ts +3 -0
  36. package/types/src/Tree/treeUtils.d.ts +29 -0
package/ResultsMenu.js CHANGED
@@ -9,26 +9,26 @@
9
9
  /******/ (() => {
10
10
  /******/ // getDefaultExport function for compatibility with non-harmony modules
11
11
  /******/ e.n = t => {
12
- /******/ var o = t && t.__esModule ?
12
+ /******/ var r = t && t.__esModule ?
13
13
  /******/ () => t["default"]
14
14
  /******/ : () => t
15
15
  /******/;
16
- e.d(o, {
17
- a: o
16
+ e.d(r, {
17
+ a: r
18
18
  });
19
- /******/ return o;
19
+ /******/ return r;
20
20
  /******/ };
21
21
  /******/ })();
22
22
  /******/
23
23
  /******/ /* webpack/runtime/define property getters */
24
24
  /******/ (() => {
25
25
  /******/ // define getter functions for harmony exports
26
- /******/ e.d = (t, o) => {
27
- /******/ for (var n in o) {
28
- /******/ if (e.o(o, n) && !e.o(t, n)) {
26
+ /******/ e.d = (t, r) => {
27
+ /******/ for (var n in r) {
28
+ /******/ if (e.o(r, n) && !e.o(t, n)) {
29
29
  /******/ Object.defineProperty(t, n, {
30
30
  enumerable: true,
31
- get: o[n]
31
+ get: r[n]
32
32
  });
33
33
  /******/ }
34
34
  /******/ }
@@ -61,47 +61,48 @@
61
61
  e.r(t);
62
62
  // EXPORTS
63
63
  e.d(t, {
64
- default: () => /* reexport */ U
64
+ VirtualizedResultsMenu: () => /* reexport */ Le,
65
+ default: () => /* reexport */ $
65
66
  });
66
67
  // CONCATENATED MODULE: external "react"
67
- const o = require("react");
68
- var n = e.n(o);
68
+ const r = require("react");
69
+ var n = e.n(r);
69
70
  // CONCATENATED MODULE: external "prop-types"
70
- const r = require("prop-types");
71
- var l = e.n(r);
71
+ const o = require("prop-types");
72
+ var i = e.n(o);
72
73
  // CONCATENATED MODULE: external "lodash/keys"
73
- const i = require("lodash/keys");
74
- var a = e.n(i);
74
+ const u = require("lodash/keys");
75
+ var a = e.n(u);
75
76
  // CONCATENATED MODULE: external "lodash/memoize"
76
- const s = require("lodash/memoize");
77
- var u = e.n(s);
77
+ const l = require("lodash/memoize");
78
+ var c = e.n(l);
78
79
  // CONCATENATED MODULE: external "lodash/omit"
79
- const c = require("lodash/omit");
80
- var p = e.n(c);
80
+ const s = require("lodash/omit");
81
+ var f = e.n(s);
81
82
  // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
82
83
  const d = require("@splunk/ui-utils/i18n");
83
84
  // CONCATENATED MODULE: external "@splunk/ui-utils/userAgent"
84
- const f = require("@splunk/ui-utils/userAgent");
85
+ const p = require("@splunk/ui-utils/userAgent");
85
86
  // CONCATENATED MODULE: external "@splunk/react-ui/Menu"
86
- const m = require("@splunk/react-ui/Menu");
87
- var h = e.n(m);
87
+ const v = require("@splunk/react-ui/Menu");
88
+ var m = e.n(v);
88
89
  // CONCATENATED MODULE: external "styled-components"
89
- const v = require("styled-components");
90
- var y = e.n(v);
90
+ const y = require("styled-components");
91
+ var h = e.n(y);
91
92
  // CONCATENATED MODULE: external "@splunk/react-ui/WaitSpinner"
92
93
  const b = require("@splunk/react-ui/WaitSpinner");
93
94
  var g = e.n(b);
94
95
  // CONCATENATED MODULE: external "@splunk/themes"
95
96
  const S = require("@splunk/themes");
96
97
  // CONCATENATED MODULE: ./src/ResultsMenu/ResultsMenuStyles.ts
97
- var M = y().div.withConfig({
98
+ var O = h().div.withConfig({
98
99
  displayName: "ResultsMenuStyles__Styled",
99
100
  componentId: "avbhl8-0"
100
101
  })([ "", ";flex-direction:column;max-height:calc(100vh - 20px);", "" ], S.mixins.reset("flex"), (0,
101
102
  S.pick)({
102
- prisma: (0, v.css)([ "border-radius:", ";background-color:", ";" ], S.variables.borderRadius, S.variables.backgroundColorPopup)
103
+ prisma: (0, y.css)([ "border-radius:", ";background-color:", ";" ], S.variables.borderRadius, S.variables.backgroundColorPopup)
103
104
  }));
104
- var x = y().div.withConfig({
105
+ var E = h().div.withConfig({
105
106
  displayName: "ResultsMenuStyles__StyledFooter",
106
107
  componentId: "avbhl8-1"
107
108
  })([ "padding:", ";color:", ";", "" ], (0, S.pick)({
@@ -116,14 +117,14 @@
116
117
  }), (function(e) {
117
118
  var t = e.$placement;
118
119
  return t === "above" ? (0, S.pick)({
119
- prisma: (0, v.css)([ "border-bottom:1px solid ", ";" ], S.variables.neutral200),
120
- enterprise: (0, v.css)([ "border-bottom:", ";" ], S.variables.border)
120
+ prisma: (0, y.css)([ "border-bottom:1px solid ", ";" ], S.variables.neutral200),
121
+ enterprise: (0, y.css)([ "border-bottom:", ";" ], S.variables.border)
121
122
  }) : (0, S.pick)({
122
- prisma: (0, v.css)([ "border-top:1px solid ", ";" ], S.variables.neutral200),
123
- enterprise: (0, v.css)([ "border-top:", ";" ], S.variables.border)
123
+ prisma: (0, y.css)([ "border-top:1px solid ", ";" ], S.variables.neutral200),
124
+ enterprise: (0, y.css)([ "border-top:", ";" ], S.variables.border)
124
125
  });
125
126
  }));
126
- var E = y().li.withConfig({
127
+ var M = h().li.withConfig({
127
128
  displayName: "ResultsMenuStyles__StyledLoading",
128
129
  componentId: "avbhl8-2"
129
130
  })([ "", ";padding:", ";gap:", ";" ], S.mixins.reset("flex"), (0, S.pick)({
@@ -133,15 +134,15 @@
133
134
  },
134
135
  enterprise: "6px 10px"
135
136
  }), S.variables.spacingXSmall);
136
- var O = y()(h()).withConfig({
137
+ var w = h()(m()).withConfig({
137
138
  displayName: "ResultsMenuStyles__StyledMenu",
138
139
  componentId: "avbhl8-3"
139
140
  })([ "overflow:auto;flex-direction:column;" ]);
140
- var k = y()(g()).withConfig({
141
+ var P = h()(g()).withConfig({
141
142
  displayName: "ResultsMenuStyles__StyledWait",
142
143
  componentId: "avbhl8-4"
143
144
  })([ "flex:0 0 auto;" ]);
144
- var w = y().div.withConfig({
145
+ var x = h().div.withConfig({
145
146
  displayName: "ResultsMenuStyles__StyledLoadingMessage",
146
147
  componentId: "avbhl8-5"
147
148
  })([ "flex:1 0 0;color:", ";" ], (0, S.pick)({
@@ -155,7 +156,7 @@
155
156
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
156
157
  * @param current - The new value of the ref.
157
158
  */
158
- function _(e, t) {
159
+ function j(e, t) {
159
160
  if (e) {
160
161
  if (typeof e === "function") {
161
162
  e(t);
@@ -168,53 +169,53 @@
168
169
  }
169
170
  }
170
171
  // CONCATENATED MODULE: ./src/ResultsMenu/ResultsMenu.tsx
171
- function T(e) {
172
+ function k(e) {
172
173
  "@babel/helpers - typeof";
173
174
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
174
- T = function e(t) {
175
+ k = function e(t) {
175
176
  return typeof t;
176
177
  };
177
178
  } else {
178
- T = function e(t) {
179
+ k = function e(t) {
179
180
  return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
180
181
  };
181
182
  }
182
- return T(e);
183
+ return k(e);
183
184
  }
184
- function B() {
185
- B = Object.assign || function(e) {
185
+ function I() {
186
+ I = Object.assign || function(e) {
186
187
  for (var t = 1; t < arguments.length; t++) {
187
- var o = arguments[t];
188
- for (var n in o) {
189
- if (Object.prototype.hasOwnProperty.call(o, n)) {
190
- e[n] = o[n];
188
+ var r = arguments[t];
189
+ for (var n in r) {
190
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
191
+ e[n] = r[n];
191
192
  }
192
193
  }
193
194
  }
194
195
  return e;
195
196
  };
196
- return B.apply(this, arguments);
197
+ return I.apply(this, arguments);
197
198
  }
198
- function C(e, t) {
199
+ function R(e, t) {
199
200
  if (!(e instanceof t)) {
200
201
  throw new TypeError("Cannot call a class as a function");
201
202
  }
202
203
  }
203
- function P(e, t) {
204
- for (var o = 0; o < t.length; o++) {
205
- var n = t[o];
204
+ function T(e, t) {
205
+ for (var r = 0; r < t.length; r++) {
206
+ var n = t[r];
206
207
  n.enumerable = n.enumerable || false;
207
208
  n.configurable = true;
208
209
  if ("value" in n) n.writable = true;
209
210
  Object.defineProperty(e, n.key, n);
210
211
  }
211
212
  }
212
- function L(e, t, o) {
213
- if (t) P(e.prototype, t);
214
- if (o) P(e, o);
213
+ function C(e, t, r) {
214
+ if (t) T(e.prototype, t);
215
+ if (r) T(e, r);
215
216
  return e;
216
217
  }
217
- function R(e, t) {
218
+ function A(e, t) {
218
219
  if (typeof t !== "function" && t !== null) {
219
220
  throw new TypeError("Super expression must either be null or a function");
220
221
  }
@@ -225,41 +226,41 @@
225
226
  configurable: true
226
227
  }
227
228
  });
228
- if (t) j(e, t);
229
+ if (t) _(e, t);
229
230
  }
230
- function j(e, t) {
231
- j = Object.setPrototypeOf || function e(t, o) {
232
- t.__proto__ = o;
231
+ function _(e, t) {
232
+ _ = Object.setPrototypeOf || function e(t, r) {
233
+ t.__proto__ = r;
233
234
  return t;
234
235
  };
235
- return j(e, t);
236
+ return _(e, t);
236
237
  }
237
- function I(e) {
238
- var t = F();
239
- return function o() {
240
- var n = N(e), r;
238
+ function K(e) {
239
+ var t = H();
240
+ return function r() {
241
+ var n = q(e), o;
241
242
  if (t) {
242
- var l = N(this).constructor;
243
- r = Reflect.construct(n, arguments, l);
243
+ var i = q(this).constructor;
244
+ o = Reflect.construct(n, arguments, i);
244
245
  } else {
245
- r = n.apply(this, arguments);
246
+ o = n.apply(this, arguments);
246
247
  }
247
- return q(this, r);
248
+ return L(this, o);
248
249
  };
249
250
  }
250
- function q(e, t) {
251
- if (t && (T(t) === "object" || typeof t === "function")) {
251
+ function L(e, t) {
252
+ if (t && (k(t) === "object" || typeof t === "function")) {
252
253
  return t;
253
254
  }
254
- return H(e);
255
+ return B(e);
255
256
  }
256
- function H(e) {
257
+ function B(e) {
257
258
  if (e === void 0) {
258
259
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
259
260
  }
260
261
  return e;
261
262
  }
262
- function F() {
263
+ function H() {
263
264
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
264
265
  if (Reflect.construct.sham) return false;
265
266
  if (typeof Proxy === "function") return true;
@@ -270,105 +271,113 @@
270
271
  return false;
271
272
  }
272
273
  }
273
- function N(e) {
274
- N = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
274
+ function q(e) {
275
+ q = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
275
276
  return t.__proto__ || Object.getPrototypeOf(t);
276
277
  };
277
- return N(e);
278
+ return q(e);
278
279
  }
279
- function D(e, t, o) {
280
+ function D(e, t, r) {
280
281
  if (t in e) {
281
282
  Object.defineProperty(e, t, {
282
- value: o,
283
+ value: r,
283
284
  enumerable: true,
284
285
  configurable: true,
285
286
  writable: true
286
287
  });
287
288
  } else {
288
- e[t] = o;
289
+ e[t] = r;
289
290
  }
290
291
  return e;
291
292
  }
292
- var W = {
293
- animateLoading: l().bool,
294
- children: l().node,
293
+ var F = {
294
+ animateLoading: i().bool,
295
+ children: i().node,
295
296
  /** @private */
296
- controlledExternally: l().bool,
297
- childrenStart: l().node,
298
- elementRef: l().oneOfType([ l().func, l().object ]),
299
- footerMessage: l().node,
300
- isLoading: l().bool,
301
- loadingMessage: l().node,
302
- noOptionsMessage: l().node,
303
- onScroll: l().func,
304
- onScrollBottom: l().func,
305
- placement: l().string
297
+ controlledExternally: i().bool,
298
+ childrenStart: i().node,
299
+ elementRef: i().oneOfType([ i().func, i().object ]),
300
+ footerMessage: i().node,
301
+ isLoading: i().bool,
302
+ loadingMessage: i().node,
303
+ noOptionsMessage: i().node,
304
+ /** @private */
305
+ onDownKeyPress: i().func,
306
+ /** @private */
307
+ onEndKeyPress: i().func,
308
+ /** @private */
309
+ onHomeKeyPress: i().func,
310
+ onScroll: i().func,
311
+ onScrollBottom: i().func,
312
+ /** @private */
313
+ onUpKeyPress: i().func,
314
+ placement: i().string
306
315
  };
307
- var A = {
316
+ var N = {
308
317
  animateLoading: false,
309
318
  isLoading: false,
310
319
  loadingMessage: (0, d._)("Loading..."),
311
320
  noOptionsMessage: (0, d._)("No matches")
312
321
  };
313
- var G = {
322
+ var U = {
314
323
  role: "listbox"
315
324
  };
316
- var $ = u()((function(e) {
325
+ var z = c()((function(e) {
317
326
  return {
318
327
  height: e
319
328
  };
320
329
  }));
321
330
  // @docs-props-type ResultsMenuPropsBase
322
- var z = function(e) {
323
- R(r, e);
324
- var t = I(r);
325
- function r(e) {
331
+ var W = function(e) {
332
+ A(o, e);
333
+ var t = K(o);
334
+ function o(e) {
326
335
  var n;
327
- C(this, r);
336
+ R(this, o);
328
337
  n = t.call(this, e);
329
- D(H(n), "scrollBottomOffset", void 0);
330
- D(H(n), "itemMinHeight", void 0);
331
- D(H(n), "handleMenuMount", (function(e) {
338
+ D(B(n), "scrollBottomOffset", void 0);
339
+ D(B(n), "itemMinHeight", void 0);
340
+ D(B(n), "handleMenuMount", (function(e) {
332
341
  n.setState({
333
342
  menuEl: e
334
343
  });
335
344
  }));
336
- D(H(n), "handleMount", (function(e) {
345
+ D(B(n), "handleMount", (function(e) {
337
346
  n.setState({
338
347
  containerEl: e
339
348
  });
340
- _(n.props.elementRef, e);
349
+ j(n.props.elementRef, e);
341
350
  }));
342
- D(H(n), "handleMouseEnter", (function() {
351
+ D(B(n), "handleMouseEnter", (function() {
343
352
  n.setState({
344
353
  windowTop: document.documentElement.scrollTop
345
354
  });
346
355
  }));
347
- D(H(n), "handleMouseLeave", (function() {
356
+ D(B(n), "handleMouseLeave", (function() {
348
357
  n.setState({
349
358
  windowTop: document.documentElement.scrollTop
350
359
  });
351
360
  }));
352
- D(H(n), "handleScroll", (function(e) {
353
- var t, o;
361
+ D(B(n), "handleScroll", (function(e) {
362
+ var t, r;
354
363
  if (n.props.onScrollBottom != null) {
355
364
  if (e.target && n.state.menuEl) {
356
- var r = n.state.menuEl.scrollHeight - n.state.menuEl.offsetHeight - n.scrollBottomOffset;
365
+ var o = n.state.menuEl.scrollHeight - n.state.menuEl.offsetHeight - n.scrollBottomOffset;
357
366
  // Adding 1 due to border of menu item.
358
- if (n.state.menuEl.scrollTop + 1 >= r) {
367
+ if (n.state.menuEl.scrollTop + 1 >= o) {
359
368
  n.handleScrollBottom(e);
360
369
  }
361
370
  }
362
371
  }
363
- (t = (o = n.props).onScroll) === null || t === void 0 ? void 0 : t.call(o, e);
372
+ (t = (r = n.props).onScroll) === null || t === void 0 ? void 0 : t.call(r, e);
364
373
  }));
365
- D(H(n), "handleWheelMenu", (function(e) {
374
+ D(B(n), "handleWheelMenu", (function(e) {
366
375
  // Safety net to ensure window doesn't scroll if menu is scrolled pass the numberOfItemsLoaded at high velocity.
367
376
  e.stopPropagation();
368
377
  document.documentElement.scrollTop = n.state.windowTop;
369
378
  }));
370
- D(H(n), "handleScrollBottomOnFullMenu", (function() {
371
- var e = o.Children.count(n.props.children);
379
+ D(B(n), "handleScrollBottomOnFullMenu", (function() {
380
+ var e = r.Children.count(n.props.children);
372
381
  var t = n.state.childrenCount;
373
382
  // If menu is full length, load more items.
374
383
  if (n.checkFullHeight()) {
@@ -401,16 +410,16 @@
401
410
  n.itemMinHeight = 28;
402
411
  return n;
403
412
  }
404
- L(r, [ {
413
+ C(o, [ {
405
414
  key: "componentDidUpdate",
406
415
  value: function e() {
407
- var t, o;
408
- var n = this.state, r = n.containerEl, l = n.menuEl;
409
- if (!f.isIE11 || !r || !l) {
416
+ var t, r;
417
+ var n = this.state, o = n.containerEl, i = n.menuEl;
418
+ if (!p.isIE11 || !o || !i) {
410
419
  return;
411
420
  }
412
421
  // If onScrollBottom is defined, determine if it should be triggered.
413
- if (((t = this.props) === null || t === void 0 ? void 0 : t.onScrollBottom) && ((o = this.props) === null || o === void 0 ? void 0 : o.children)) {
422
+ if (((t = this.props) === null || t === void 0 ? void 0 : t.onScrollBottom) && ((r = this.props) === null || r === void 0 ? void 0 : r.children)) {
414
423
  this.handleScrollBottomOnFullMenu();
415
424
  }
416
425
  }
@@ -419,11 +428,11 @@
419
428
  value: function e(t) {
420
429
  // Prevent multiple calls to onScrollBottom.
421
430
  if (!this.state.scrollBottomTriggered) {
422
- var o, n;
431
+ var r, n;
423
432
  this.setState({
424
433
  scrollBottomTriggered: true
425
434
  });
426
- (o = (n = this.props).onScrollBottom) === null || o === void 0 ? void 0 : o.call(n, t);
435
+ (r = (n = this.props).onScrollBottom) === null || r === void 0 ? void 0 : r.call(n, t);
427
436
  }
428
437
  }
429
438
  }, {
@@ -435,7 +444,7 @@
435
444
  }, {
436
445
  key: "renderFooterMessage",
437
446
  value: function e() {
438
- return this.props.footerMessage && !!o.Children.toArray(this.props.children).length && n().createElement(x, {
447
+ return this.props.footerMessage && !!r.Children.toArray(this.props.children).length && n().createElement(E, {
439
448
  $placement: this.props.placement,
440
449
  "data-test": "footer-message",
441
450
  key: "footer"
@@ -444,50 +453,756 @@
444
453
  }, {
445
454
  key: "render",
446
455
  value: function e() {
447
- var t = this.props, l = t.animateLoading, i = t.children, s = t.controlledExternally, u = t.childrenStart, c = t.isLoading, d = t.loadingMessage, f = t.noOptionsMessage, v = t.onScrollBottom, y = t.placement, b = t.style, g = t.tabIndex;
448
- var S = p()(this.props, a()(r.propTypes));
456
+ var t = this.props, i = t.animateLoading, u = t.children, l = t.controlledExternally, c = t.childrenStart, s = t.isLoading, d = t.loadingMessage, p = t.noOptionsMessage, y = t.onDownKeyPress, h = t.onEndKeyPress, b = t.onHomeKeyPress, g = t.onScrollBottom, S = t.onUpKeyPress, E = t.placement, j = t.style, k = t.tabIndex;
457
+ var R = f()(this.props, a()(o.propTypes));
449
458
  // Assumption: that you cannot be filtered if you are a result
450
- var x = o.Children.toArray(i).filter(o.isValidElement).some((function(e) {
459
+ var T = r.Children.toArray(u).filter(r.isValidElement).some((function(e) {
451
460
  var t = e.type;
452
- return !(t === m.Divider && t.filterFirst || (t === m.Divider || t === m.Heading) && (t.filterLast || t.filterConsecutive));
461
+ return !(t === v.Divider && t.filterFirst || (t === v.Divider || t === v.Heading) && (t.filterLast || t.filterConsecutive));
453
462
  }));
454
- var _ = this.checkFullHeight();
455
- var T = $(this.state.scrollBottomTriggered ? this.state.numberOfItemsLoaded * this.itemMinHeight || 0 : 0);
463
+ var C = this.checkFullHeight();
464
+ var A = z(this.state.scrollBottomTriggered ? this.state.numberOfItemsLoaded * this.itemMinHeight || 0 : 0);
456
465
  /* eslint-disable jsx-a11y/aria-role */
457
- return n().createElement(M, B({
466
+ return n().createElement(O, I({
458
467
  key: "wrapper",
459
468
  ref: this.handleMount,
460
- onWheel: v ? this.handleWheelMenu : undefined,
461
- onMouseEnter: v ? this.handleMouseEnter : undefined,
462
- onMouseLeave: v ? this.handleMouseLeave : undefined
463
- }, p()(S, "tabIndex"), {
464
- style: b
465
- }), y !== "above" && u, y === "above" && this.renderFooterMessage(), n().createElement(m.MenuContext.Provider, {
466
- value: G
467
- }, n().createElement(O, {
469
+ onWheel: g ? this.handleWheelMenu : undefined,
470
+ onMouseEnter: g ? this.handleMouseEnter : undefined,
471
+ onMouseLeave: g ? this.handleMouseLeave : undefined
472
+ }, f()(R, "tabIndex"), {
473
+ style: j
474
+ }), E !== "above" && c, E === "above" && this.renderFooterMessage(), n().createElement(v.MenuContext.Provider, {
475
+ value: U
476
+ }, n().createElement(w, {
468
477
  key: "menu",
469
- controlledExternally: s,
478
+ controlledExternally: l,
470
479
  elementRef: this.handleMenuMount,
480
+ onDownKeyPress: y,
481
+ onEndKeyPress: h,
482
+ onHomeKeyPress: b,
471
483
  onScroll: this.handleScroll,
484
+ onUpKeyPress: S,
472
485
  stopScrollPropagation: true,
473
- tabIndex: g
474
- }, !x && f && !c && n().createElement(h().Item, {
486
+ tabIndex: k
487
+ }, !T && p && !s && n().createElement(m().Item, {
475
488
  "data-test": "no-results-message",
476
489
  disabled: true
477
- }, f), i, v && !_ &&
490
+ }, p), u, g && !C &&
478
491
 
479
492
  // Bottom spacer fills in the space of new items being loaded by using the minimum possible height x menuItems.
480
493
  n().createElement("div", {
481
494
  "data-test": "results-menu-bottom-spacer",
482
- style: T
483
- }), c && n().createElement(E, null, l && n().createElement(k, null), n().createElement(w, null, d)))), y !== "above" && this.renderFooterMessage(), y === "above" && u);
495
+ style: A
496
+ }), s && n().createElement(M, null, i && n().createElement(P, null), n().createElement(x, null, d)))), E !== "above" && this.renderFooterMessage(), E === "above" && c);
484
497
  }
485
498
  } ]);
499
+ return o;
500
+ }(r.Component);
501
+ D(W, "propTypes", F);
502
+ D(W, "defaultProps", N);
503
+ /* harmony default export */ const $ = W;
504
+ // CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/groupChildren.ts
505
+ // Cheap(er than processing potentially thousands of array elements) memoization
506
+ var G = {
507
+ result: []
508
+ };
509
+ /**
510
+ * Given component children, restructure them into an array of arrays, each of length `groupSize`.
511
+ *
512
+ * The last array is not guaranteed to be full, it will have a length in the range `[1, groupSize]`
513
+ *
514
+ * @example
515
+ * ```js
516
+ * groupChildren([1, 2, 3, 4, 5, 6, 7], 2);
517
+ * // > [[1, 2], [3, 4], [5, 6], [7]]
518
+ * ```
519
+ * @param {Array} children One node, or an array of nodes, to be divided into groups
520
+ * @param {number} groupSize The size of each group to be created
521
+ * @returns A 2d array where each inner-array is a group of size `groupSize` of children
522
+ * and the order of the `children` received equals the order of the flattened result
523
+ */ var V = function e(t, n) {
524
+ if (G.children === t && G.groupSize === n) {
525
+ return G.result;
526
+ }
527
+ G.children = t;
528
+ G.groupSize = n;
529
+ if (n <= 1) {
530
+ if (false) {}
531
+ // don't break in non-__DEV__ and return one big group
532
+ G.result = [ r.Children.toArray(t) ];
533
+ } else {
534
+ G.result = r.Children.toArray(t).reduce((function(e, t, r) {
535
+ var o = Math.floor(r / n);
536
+ if (!Array.isArray(e[o])) {
537
+ // eslint-disable-next-line no-param-reassign
538
+ e[o] = [];
539
+ }
540
+ e[o].push(t);
541
+ return e;
542
+ }), []);
543
+ }
544
+ return G.result;
545
+ };
546
+ // CONCATENATED MODULE: external "@splunk/ui-utils/id"
547
+ const X = require("@splunk/ui-utils/id");
548
+ // CONCATENATED MODULE: ./src/utils/getMenuChildNode.tsx
549
+ // TODO(SUI-5919): fix the ref handling in the other components so this isn't needed
550
+ /**
551
+ * @private Get the HTML <anchor> or <button> node for a received derivative of Menu.Item
552
+ */
553
+ var J = function e(t) {
554
+ var r, n, o, i;
555
+ if (t.el) {
556
+ return t.el;
557
+ // Menu.Item
558
+ }
559
+ if ((r = t.c) === null || r === void 0 ? void 0 : r.el) {
560
+ return t.c.el;
561
+ // Multiselect.Option
562
+ }
563
+ if ((n = t.c) === null || n === void 0 ? void 0 : (o = n.c) === null || o === void 0 ? void 0 : o.el) {
564
+ return t.c.c.el;
565
+ // Select.Option
566
+ }
567
+ if ((i = t.item) === null || i === void 0 ? void 0 : i.el) {
568
+ return t.item.el;
569
+ // ComboBox.Option
570
+ }
571
+ return null;
572
+ };
573
+ // CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/VirtualizedItem.ts
574
+ function Q(e, t) {
575
+ return re(e) || te(e, t) || Z(e, t) || Y();
576
+ }
577
+ function Y() {
578
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
579
+ }
580
+ function Z(e, t) {
581
+ if (!e) return;
582
+ if (typeof e === "string") return ee(e, t);
583
+ var r = Object.prototype.toString.call(e).slice(8, -1);
584
+ if (r === "Object" && e.constructor) r = e.constructor.name;
585
+ if (r === "Map" || r === "Set") return Array.from(e);
586
+ if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return ee(e, t);
587
+ }
588
+ function ee(e, t) {
589
+ if (t == null || t > e.length) t = e.length;
590
+ for (var r = 0, n = new Array(t); r < t; r++) {
591
+ n[r] = e[r];
592
+ }
593
+ return n;
594
+ }
595
+ function te(e, t) {
596
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(e))) return;
597
+ var r = [];
598
+ var n = true;
599
+ var o = false;
600
+ var i = undefined;
601
+ try {
602
+ for (var u = e[Symbol.iterator](), a; !(n = (a = u.next()).done); n = true) {
603
+ r.push(a.value);
604
+ if (t && r.length === t) break;
605
+ }
606
+ } catch (e) {
607
+ o = true;
608
+ i = e;
609
+ } finally {
610
+ try {
611
+ if (!n && u["return"] != null) u["return"]();
612
+ } finally {
613
+ if (o) throw i;
614
+ }
615
+ }
486
616
  return r;
487
- }(o.Component);
488
- D(z, "propTypes", W);
489
- D(z, "defaultProps", A);
490
- /* harmony default export */ const U = z;
617
+ }
618
+ function re(e) {
619
+ if (Array.isArray(e)) return e;
620
+ }
621
+ var ne = {
622
+ children: i().node,
623
+ onMount: i().func.isRequired,
624
+ onUnmount: i().func.isRequired
625
+ };
626
+ /** @private Used by `VirtualizedResultsMenu` */ var oe = n().forwardRef((function(e, t) {
627
+ var n = e.children, o = e.onMount, i = e.onUnmount;
628
+ var u = (0, r.useState)(), a = Q(u, 2), l = a[0], c = a[1];
629
+ (0, r.useEffect)((function() {
630
+ if (l) {
631
+ o(l);
632
+ }
633
+ return function() {
634
+ if (l) {
635
+ i(l);
636
+ }
637
+ };
638
+ }), [ l, o, i ]);
639
+ var s = r.Children.only(n);
640
+ if (!s) {
641
+ if (false) {}
642
+ return null;
643
+ }
644
+
645
+ return (0, r.cloneElement)(s, {
646
+ ref: function e(r) {
647
+ var n = r;
648
+ if (!n) {
649
+ return;
650
+ }
651
+ j(t, r);
652
+ j(c, J(n));
653
+ }
654
+ });
655
+ }));
656
+ oe.propTypes = ne;
657
+ oe.as = "Item";
658
+ // CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/injectVirtualizedItem.tsx
659
+ /**
660
+ * Find the index of an array element which is nearest to targetIndex and is a Menu.Item component
661
+ * @param {Array} elements An array to search
662
+ * @param {Number} targetIndex The target index. This is the ideal value to return.
663
+ * @returns The index in the array of the nearest `Menu.Item` component to `targetIndex`, or -1 if no element is a `Menu.Item` component
664
+ */
665
+ var ie = function e(t, r) {
666
+ var n = -1;
667
+ var o = -1;
668
+ t.forEach((function(e, t) {
669
+ var i = Math.abs(r - t);
670
+ if (n >= 0 && n < i) {
671
+ return;
672
+ }
673
+ if (e.type !== v.Divider && e.type !== v.Heading) {
674
+ n = i;
675
+ o = t;
676
+ }
677
+ }));
678
+ return o;
679
+ };
680
+ /**
681
+ * @private Keep the injection of `VirtualizedItem` DRY. Will always replace the middle-most non-divider/heading
682
+ * with a VirtualizedItem instance.
683
+ * - If `trackFirstElement` the **FIRST** non-divider/heading item will also be replaced.
684
+ * - If `trackLastElement` the **LAST** non-divider/heading item will also be replaced.
685
+ */ var ue = function e(t, r, o) {
686
+ var i = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, u = i.trackFirstElement, a = i.trackLastElement;
687
+ if (!Array.isArray(t)) {
688
+ return [];
689
+ }
690
+ var l = ie(t, Math.floor(t.length / 2));
691
+ var c = u && ie(t, 0);
692
+ var s = a && ie(t, t.length - 1);
693
+ return t.map((function(e, t) {
694
+ if (t === l || t === c || t === s) {
695
+
696
+ return n().createElement(oe, {
697
+ key: (0, X.createGUID)(),
698
+ onMount: r,
699
+ onUnmount: o
700
+ }, e);
701
+ }
702
+ return e;
703
+ }));
704
+ };
705
+ // CONCATENATED MODULE: ./src/utils/navigateList.ts
706
+ // A utility for keyboard navigation of lists
707
+ function ae(e, t, r) {
708
+ for (var n = 0; n < e.length; n += 1) {
709
+ var o;
710
+ var i = (n + r) % e.length;
711
+ if (((o = e[i].current) === null || o === void 0 ? void 0 : o.props.disabled) !== true) {
712
+ return e[i];
713
+ }
714
+ }
715
+ return e[t];
716
+ }
717
+ function le(e, t, r) {
718
+ for (var n = e.length; n > 0; n -= 1) {
719
+ var o;
720
+ var i = (n + r) % e.length;
721
+ if (((o = e[i].current) === null || o === void 0 ? void 0 : o.props.disabled) !== true) {
722
+ return e[i];
723
+ }
724
+ }
725
+ return e[t];
726
+ }
727
+ // CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/VirtualizedResultsMenu.tsx
728
+ function ce() {
729
+ ce = Object.assign || function(e) {
730
+ for (var t = 1; t < arguments.length; t++) {
731
+ var r = arguments[t];
732
+ for (var n in r) {
733
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
734
+ e[n] = r[n];
735
+ }
736
+ }
737
+ }
738
+ return e;
739
+ };
740
+ return ce.apply(this, arguments);
741
+ }
742
+ function se(e) {
743
+ return pe(e) || de(e) || ye(e) || fe();
744
+ }
745
+ function fe() {
746
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
747
+ }
748
+ function de(e) {
749
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(e)) return Array.from(e);
750
+ }
751
+ function pe(e) {
752
+ if (Array.isArray(e)) return he(e);
753
+ }
754
+ function ve(e, t) {
755
+ return ge(e) || be(e, t) || ye(e, t) || me();
756
+ }
757
+ function me() {
758
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
759
+ }
760
+ function ye(e, t) {
761
+ if (!e) return;
762
+ if (typeof e === "string") return he(e, t);
763
+ var r = Object.prototype.toString.call(e).slice(8, -1);
764
+ if (r === "Object" && e.constructor) r = e.constructor.name;
765
+ if (r === "Map" || r === "Set") return Array.from(e);
766
+ if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return he(e, t);
767
+ }
768
+ function he(e, t) {
769
+ if (t == null || t > e.length) t = e.length;
770
+ for (var r = 0, n = new Array(t); r < t; r++) {
771
+ n[r] = e[r];
772
+ }
773
+ return n;
774
+ }
775
+ function be(e, t) {
776
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(e))) return;
777
+ var r = [];
778
+ var n = true;
779
+ var o = false;
780
+ var i = undefined;
781
+ try {
782
+ for (var u = e[Symbol.iterator](), a; !(n = (a = u.next()).done); n = true) {
783
+ r.push(a.value);
784
+ if (t && r.length === t) break;
785
+ }
786
+ } catch (e) {
787
+ o = true;
788
+ i = e;
789
+ } finally {
790
+ try {
791
+ if (!n && u["return"] != null) u["return"]();
792
+ } finally {
793
+ if (o) throw i;
794
+ }
795
+ }
796
+ return r;
797
+ }
798
+ function ge(e) {
799
+ if (Array.isArray(e)) return e;
800
+ }
801
+ function Se(e, t) {
802
+ if (e == null) return {};
803
+ var r = Oe(e, t);
804
+ var n, o;
805
+ if (Object.getOwnPropertySymbols) {
806
+ var i = Object.getOwnPropertySymbols(e);
807
+ for (o = 0; o < i.length; o++) {
808
+ n = i[o];
809
+ if (t.indexOf(n) >= 0) continue;
810
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
811
+ r[n] = e[n];
812
+ }
813
+ }
814
+ return r;
815
+ }
816
+ function Oe(e, t) {
817
+ if (e == null) return {};
818
+ var r = {};
819
+ var n = Object.keys(e);
820
+ var o, i;
821
+ for (i = 0; i < n.length; i++) {
822
+ o = n[i];
823
+ if (t.indexOf(o) >= 0) continue;
824
+ r[o] = e[o];
825
+ }
826
+ return r;
827
+ }
828
+ function Ee(e, t) {
829
+ var r = Object.keys(e);
830
+ if (Object.getOwnPropertySymbols) {
831
+ var n = Object.getOwnPropertySymbols(e);
832
+ if (t) n = n.filter((function(t) {
833
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
834
+ }));
835
+ r.push.apply(r, n);
836
+ }
837
+ return r;
838
+ }
839
+ function Me(e) {
840
+ for (var t = 1; t < arguments.length; t++) {
841
+ var r = arguments[t] != null ? arguments[t] : {};
842
+ if (t % 2) {
843
+ Ee(Object(r), true).forEach((function(t) {
844
+ we(e, t, r[t]);
845
+ }));
846
+ } else if (Object.getOwnPropertyDescriptors) {
847
+ Object.defineProperties(e, Object.getOwnPropertyDescriptors(r));
848
+ } else {
849
+ Ee(Object(r)).forEach((function(t) {
850
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
851
+ }));
852
+ }
853
+ }
854
+ return e;
855
+ }
856
+ function we(e, t, r) {
857
+ if (t in e) {
858
+ Object.defineProperty(e, t, {
859
+ value: r,
860
+ enumerable: true,
861
+ configurable: true,
862
+ writable: true
863
+ });
864
+ } else {
865
+ e[t] = r;
866
+ }
867
+ return e;
868
+ }
869
+ var Pe = Me(Me({}, f()(F, "onDownKeyPress", "onEndKeyPress", "onHomeKeyPress", "onUpKeyPress")), {}, {
870
+ virtualization: i().number.isRequired
871
+ });
872
+ var xe = {
873
+ virtualization: 0
874
+ };
875
+ var je = [];
876
+ var ke = function e(t, r) {
877
+ var n = r.itemRefs, o = r.focusedItemKey;
878
+ var i = ae(n, o, o + 1);
879
+ return [ n.indexOf(i) < o ? o : i, false ];
880
+ };
881
+ var Ie = function e(t, r) {
882
+ var n = r.itemRefs, o = r.focusedItemKey;
883
+ var i = le(n, o, o - 1);
884
+ return [ n.indexOf(i) > o ? o : i, false ];
885
+ };
886
+ /**
887
+ * A wrapper for `ResultsMenu` which virtualizes the `children`. The received `children` array will be split into **"panes"** each with `virtualization` entries
888
+ * and, at any given time, 3 or fewer of these panes will be rendered in the DOM.
889
+ *
890
+ * Given the children `[1, 2, 3, 4, 5, 6, 7, 8, 9]` and `virtualization=4`, then at first only elements `[1, 2, 3, 4, 5, 6, 7, 8]` will be added to the DOM.
891
+ * Once either child `6` or `8` intersect the `Menu` rendered by `ResultsMenu` the next pane of children will also be included and, if needed, the oldest pane
892
+ * will be removed.
893
+ *
894
+ * In effect this means the menu will show the "central" content at pane index _`n`_, a previous-content-buffer comprised of pane index _`n - 1`_,
895
+ * and an upcoming-content-buffer comprised of pane index _`n + 1`_.
896
+ *
897
+ * An `IntersectionObserver` will observe the first node in the _`n - 1`_ pane, the last node in the _`n + 1`_ pane, and the central node in both _`n ± 1`_ panes
898
+ * for intersections with the rendered `Menu` and trigger a *pane change* upon that intersection. As such, in SSR or other environments which don't support `IntersectionObserver`
899
+ * this component should not be used and will be replaced by the barrel file with a vanilla `ResultsMenu`.
900
+ *
901
+ * @throws in `__DEV__` when `virtualization` is too small as compared to the menu height (`virtualization` must be greater than the number of visible items in the rendered menu)
902
+ * @throws in `__DEV__` when `virtualization` is less than or equal to 1 (`virtualization` must be ≥ 2)
903
+ * @throws in `__DEV__` when `virtualization` is changed during the lifecycle of the `VirtualizedResultsMenu` component
904
+ */ function Re(e) {
905
+ var t = e.virtualization, o = e.elementRef, i = e.children, u = Se(e, [ "virtualization", "elementRef", "children" ]);
906
+ // @docs-props-type VirtualizedResultsMenuPropsBase
907
+ // If a user tries to set virtualization to a value smaller than the number of options
908
+ // visible at a given moment then the menu will flicker endlessly. This state is set in
909
+ // the IntersectionObserver to fix the issue, but in `__DEV__` an error is thrown.
910
+ var a = (0, r.useState)(t), l = ve(a, 2), c = l[0], s = l[1];
911
+ // `useRef` will recompute its initial value every render cycle.
912
+ // To avoid the array processing we can provide an initialization function to useState and init the ref with the result
913
+ var f = (0, r.useState)((function() {
914
+ return V(i, c);
915
+ })), d = ve(f, 1), p = d[0];
916
+ // NOSONAR
917
+ // `windowPanes` is an array of arrays, each of length `virtualization`. Each "pane" is just a subset of
918
+ // `children` which will be rendered in a chunk, and at most 3 of these panes will render at any given time.
919
+ var v = (0, r.useRef)(p);
920
+ var m = (0, r.useRef)(0);
921
+ // An IntersectionObserver is used to detect when pane changes are needed.
922
+ // When loadPrevPaneRef or loadNextPaneRef entries intersect the menu, the currentPaneId will be updated.
923
+ var y = (0, r.useRef)();
924
+ var h = (0, r.useRef)(je);
925
+ var b = (0, r.useRef)(je);
926
+ var g = (0, r.useCallback)((function() {
927
+ var e;
928
+ var t = v.current, r = t === void 0 ? [] : t;
929
+ var n = m.current;
930
+ /**
931
+ * create onMount for an child of the menu which will be used to trigger pane
932
+ * changes upon intersection with the menu's visible bounds
933
+ */ var o = function e(t) {
934
+ return function(e) {
935
+ var r;
936
+ if (!e) {
937
+ return;
938
+ }
939
+ t.current.push(e);
940
+ (r = y.current) === null || r === void 0 ? void 0 : r.observe(e);
941
+ };
942
+ };
943
+ /**
944
+ * onUnmount to cleanup the operations of `onVirtualizeMount`
945
+ */ var i = function e(t) {
946
+ var r;
947
+ if (!t) {
948
+ return;
949
+ }
950
+ var n = b.current.indexOf(t);
951
+ if (n >= 0) {
952
+ b.current.splice(n, 1);
953
+ }
954
+ var o = h.current.indexOf(t);
955
+ if (o) {
956
+ h.current.splice(o, 1);
957
+ }
958
+ (r = y.current) === null || r === void 0 ? void 0 : r.unobserve(t);
959
+ };
960
+ return [].concat(se(ue(r[n - 1], o(b), i, {
961
+ trackFirstElement: true
962
+ })), se((e = r[n]) !== null && e !== void 0 ? e : []), se(ue(r[n + 1], o(h), i, {
963
+ trackLastElement: true
964
+ })));
965
+ }), []);
966
+ var S = (0, r.useState)(g), O = ve(S, 2), E = O[0], M = O[1];
967
+ var w = (0, r.useCallback)((function(e) {
968
+ var t = m.current;
969
+ m.current = Math.max(0, Math.min(e, v.current.length - 1));
970
+ if (t === m.current) {
971
+ // no change in current pane
972
+ return;
973
+ }
974
+ M(g);
975
+ }), [ g ]);
976
+ // Link an IntersectionObserver instance with the menu children to be observed
977
+ var P = (0, r.useCallback)((function(e) {
978
+ var t;
979
+ j(o, e);
980
+ // This is overly defensive and could probably be removed
981
+ (t = y.current) === null || t === void 0 ? void 0 : t.disconnect();
982
+ if (!e) {
983
+ return;
984
+ }
985
+ b.current = [];
986
+ h.current = [];
987
+ // Run the observation flow
988
+ y.current = new IntersectionObserver((function(t) {
989
+ var r;
990
+ var n = m.current;
991
+ var o = e.firstElementChild;
992
+ if (!!o && o.scrollHeight < e.clientHeight) {
993
+ var i;
994
+ // If the first element doesn't require a scrollbar then it's likely a filter input
995
+ o = (i = o) === null || i === void 0 ? void 0 : i.nextElementSibling;
996
+ }
997
+ if (((r = o) === null || r === void 0 ? void 0 : r.scrollTop) === 0 && n === 0 && v.current.length > 1 && t.some((function(e) {
998
+ return e.isIntersecting;
999
+ }))) {
1000
+ // The menu hasn't scrolled, is on pane 0, and already has an intersection, the `virtualization` prop is too small
1001
+ s((function(e) {
1002
+ return e + 10;
1003
+ }));
1004
+ if (false) {}
1005
+ return;
1006
+ }
1007
+ var u = false;
1008
+ t.forEach((function(e) {
1009
+ if (u || !e.isIntersecting) {
1010
+ // don't process if the pane changed or the entry isn't intersecting
1011
+ return;
1012
+ }
1013
+ if (b.current.includes(e.target)) {
1014
+ u = true;
1015
+ w(n - 1);
1016
+ } else if (h.current.includes(e.target)) {
1017
+ u = true;
1018
+ w(n + 1);
1019
+ }
1020
+ }));
1021
+ }), {
1022
+ root: e
1023
+ });
1024
+ }), [ o, w ]);
1025
+ var x = (0, r.useCallback)((function(e, t) {
1026
+ var r, n;
1027
+ var o = t.itemRefs;
1028
+ var i = v.current.length - 1;
1029
+ if (m.current === i) {
1030
+ return [ le(o, o.length - 1, o.length - 1), true ];
1031
+ }
1032
+ w(i);
1033
+ // When we are rendering the last set of records a buffer will exist containing the next-to-last pane.
1034
+ // This means the desired index for focus will be the length of the buffer + the length of the last set
1035
+ // of records (less 1 because of array indexing)
1036
+ var u = (r = v.current[i - 1].length) !== null && r !== void 0 ? r : 0;
1037
+ var a = v.current[i].length;
1038
+ // If the last child is non-interactive (Heading or Divider) then `Menu` will focus on the "next" interactive
1039
+ // element, which would be at the _start_ of the list. The IntersectionObserver would then change to the
1040
+ // `lastPaneId - 1` pane and the focus would be incorrect. Call `findClosestMenuItem` to avoid that.
1041
+ var l = Math.max(u + a - 1, 0);
1042
+ var c = ie([].concat(se((n = v.current[i - 1]) !== null && n !== void 0 ? n : []), se(v.current[i])), l);
1043
+ return [ c, true ];
1044
+ }), [ w ]);
1045
+ var k = (0, r.useCallback)((function(e, t) {
1046
+ var r = t.itemRefs;
1047
+ if (m.current === 0) {
1048
+ return [ ae(r, 0, 0), true ];
1049
+ }
1050
+ w(0);
1051
+ return [ 0, true ];
1052
+ }), [ w ]);
1053
+ (0, r.useEffect)((function() {
1054
+ s((function(e) {
1055
+ if (false) {}
1056
+ return t;
1057
+ }));
1058
+ }), [ t ]);
1059
+ (0, r.useEffect)((function() {
1060
+ v.current = V(i, c);
1061
+ M(g);
1062
+ }), [ i, c, g ]);
1063
+ (0, r.useEffect)((function() {
1064
+ return function() {
1065
+ var e;
1066
+ return (e = y.current) === null || e === void 0 ? void 0 : e.disconnect();
1067
+ };
1068
+ }), []);
1069
+
1070
+ return n().createElement($, ce({
1071
+ elementRef: P
1072
+ }, u, {
1073
+ onEndKeyPress: x,
1074
+ onHomeKeyPress: k,
1075
+ onUpKeyPress: Ie,
1076
+ onDownKeyPress: ke
1077
+ }), E);
1078
+ }
1079
+ Re.propTypes = Pe;
1080
+ Re.defaultProps = xe;
1081
+ // CONCATENATED MODULE: ./src/utils/ssrDocument.ts
1082
+ /* eslint-disable @typescript-eslint/no-empty-function */
1083
+ var Te = {
1084
+ body: {
1085
+ appendChild: function e() {
1086
+ return [];
1087
+ }
1088
+ },
1089
+ addEventListener: function e() {},
1090
+ removeEventListener: function e() {},
1091
+ activeElement: {
1092
+ blur: function e() {},
1093
+ nodeName: ""
1094
+ },
1095
+ querySelector: function e() {
1096
+ return null;
1097
+ },
1098
+ querySelectorAll: function e() {
1099
+ return [];
1100
+ },
1101
+ getElementById: function e() {
1102
+ return null;
1103
+ },
1104
+ createEvent: function e() {
1105
+ return {
1106
+ initEvent: function e() {}
1107
+ };
1108
+ },
1109
+ createElement: function e() {
1110
+ return {
1111
+ children: [],
1112
+ childNodes: [],
1113
+ style: {},
1114
+ setAttribute: function e() {},
1115
+ getElementsByTagName: function e() {
1116
+ return [];
1117
+ }
1118
+ };
1119
+ },
1120
+ createElementNS: function e() {
1121
+ return {};
1122
+ },
1123
+ importNode: function e() {
1124
+ return null;
1125
+ },
1126
+ location: {
1127
+ hash: "",
1128
+ host: "",
1129
+ hostname: "",
1130
+ href: "",
1131
+ origin: "",
1132
+ pathname: "",
1133
+ protocol: "",
1134
+ search: ""
1135
+ }
1136
+ };
1137
+ function Ce() {
1138
+ var e = typeof document !== "undefined" ? document : Te;
1139
+ return e;
1140
+ }
1141
+ // CONCATENATED MODULE: ./src/utils/ssrWindow.ts
1142
+ /* eslint-disable @typescript-eslint/no-empty-function */
1143
+ var Ae = {
1144
+ document: Te,
1145
+ navigator: {
1146
+ userAgent: ""
1147
+ },
1148
+ location: {
1149
+ hash: "",
1150
+ host: "",
1151
+ hostname: "",
1152
+ href: "",
1153
+ origin: "",
1154
+ pathname: "",
1155
+ protocol: "",
1156
+ search: ""
1157
+ },
1158
+ history: {
1159
+ replaceState: function e() {},
1160
+ pushState: function e() {},
1161
+ go: function e() {},
1162
+ back: function e() {}
1163
+ },
1164
+ CustomEvent: function e() {
1165
+ return this;
1166
+ },
1167
+ addEventListener: function e() {},
1168
+ removeEventListener: function e() {},
1169
+ getComputedStyle: function e() {
1170
+ return {
1171
+ getPropertyValue: function e() {
1172
+ return "";
1173
+ }
1174
+ };
1175
+ },
1176
+ Image: function e() {},
1177
+ Date: function e() {},
1178
+ screen: {},
1179
+ setTimeout: function e() {},
1180
+ clearTimeout: function e() {},
1181
+ matchMedia: function e() {
1182
+ return {};
1183
+ },
1184
+ requestAnimationFrame: function e(t) {
1185
+ if (typeof setTimeout === "undefined") {
1186
+ t();
1187
+ return null;
1188
+ }
1189
+ return setTimeout(t, 0);
1190
+ },
1191
+ cancelAnimationFrame: function e(t) {
1192
+ if (typeof setTimeout === "undefined") {
1193
+ return;
1194
+ }
1195
+ clearTimeout(t);
1196
+ }
1197
+ };
1198
+ function _e() {
1199
+ var e = typeof window !== "undefined" ? window : Ae;
1200
+ return e;
1201
+ }
1202
+ // CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/index.ts
1203
+ // In environments without IntersectionObserver support this should just export ResultsMenu
1204
+ var Ke = "IntersectionObserver" in _e() ? Re : $;
1205
+ /* harmony default export */ const Le = Ke;
491
1206
  // CONCATENATED MODULE: ./src/ResultsMenu/index.ts
492
1207
  module.exports = t;
493
1208
  /******/})();