@splunk/react-ui 5.2.0 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/Accordion.js +31 -31
  2. package/Avatar.js +64 -59
  3. package/Box.js +2 -1
  4. package/Breadcrumbs.js +66 -63
  5. package/ButtonSimple.js +52 -52
  6. package/CHANGELOG.md +47 -0
  7. package/Calendar.js +8 -4
  8. package/CardLayout.js +39 -36
  9. package/Checkbox.d.ts +2 -0
  10. package/Checkbox.js +350 -0
  11. package/Clickable.js +5 -6
  12. package/Code.js +451 -536
  13. package/CollapsiblePanel.js +184 -210
  14. package/Color.js +903 -1023
  15. package/ControlGroup.js +2 -1
  16. package/Date.js +123 -119
  17. package/DefinitionList.js +100 -77
  18. package/Dropdown.js +2 -2
  19. package/DualListbox.js +409 -353
  20. package/File.js +102 -99
  21. package/FormRows.js +13 -11
  22. package/JSONTree.js +679 -1391
  23. package/Link.js +7 -7
  24. package/MIGRATION.md +27 -0
  25. package/Markdown.js +171 -156
  26. package/Menu.js +107 -100
  27. package/Modal.js +3 -3
  28. package/Multiselect.js +2698 -2767
  29. package/Paginator.js +2 -1
  30. package/Popover.js +201 -196
  31. package/Resize.js +11 -8
  32. package/ResultsMenu.js +913 -1029
  33. package/ScreenReaderContent.js +86 -130
  34. package/Scroll.js +366 -424
  35. package/Search.js +131 -127
  36. package/Select.js +1741 -1831
  37. package/Slider.js +1 -1
  38. package/SlidingPanels.js +129 -127
  39. package/StepBar.js +123 -97
  40. package/Switch.js +214 -242
  41. package/TabBar.js +10 -10
  42. package/Table.js +1255 -1248
  43. package/Text.js +180 -206
  44. package/TextArea.js +596 -675
  45. package/Tooltip.js +144 -139
  46. package/Tree.js +638 -682
  47. package/package.json +15 -16
  48. package/tsconfig.check-docs.json +8 -0
  49. package/types/src/Avatar/docs/examples/Basic.d.ts +1 -1
  50. package/types/src/Breadcrumbs/Breadcrumbs.d.ts +1 -5
  51. package/types/src/Breadcrumbs/BreadcrumbsContext.d.ts +7 -0
  52. package/types/src/Breadcrumbs/Item.d.ts +1 -1
  53. package/types/src/ButtonSimple/mixin.d.ts +1 -1
  54. package/types/src/Checkbox/Checkbox.d.ts +90 -0
  55. package/types/src/Checkbox/docs/examples/Basic.d.ts +7 -0
  56. package/types/src/Checkbox/docs/examples/Disabled.d.ts +6 -0
  57. package/types/src/Checkbox/docs/examples/Error.d.ts +6 -0
  58. package/types/src/Checkbox/docs/examples/Uncontrolled.d.ts +7 -0
  59. package/types/src/Checkbox/index.d.ts +2 -0
  60. package/types/src/Code/Code.d.ts +4 -1
  61. package/types/src/Code/LineHighlights.d.ts +1 -0
  62. package/types/src/Code/LineNumbers.d.ts +2 -1
  63. package/types/src/Code/docs/examples/CustomizeContainer.d.ts +7 -0
  64. package/types/src/ControlGroup/docs/examples/CustomizedLabelTarget.d.ts +3 -3
  65. package/types/src/Date/Date.d.ts +7 -1
  66. package/types/src/DefinitionList/DefinitionList.d.ts +7 -2
  67. package/types/src/DefinitionList/DefinitionListContext.d.ts +1 -1
  68. package/types/src/DefinitionList/docs/examples/StackedLayout.d.ts +6 -0
  69. package/types/src/DualListbox/DualListbox.d.ts +1 -1
  70. package/types/src/DualListbox/Label.d.ts +7 -7
  71. package/types/src/DualListbox/Listbox.d.ts +2 -2
  72. package/types/src/DualListbox/ListboxContext.d.ts +1 -1
  73. package/types/src/File/File.d.ts +7 -1
  74. package/types/src/JSONTree/JSONTreeItem.d.ts +5 -3
  75. package/types/src/JSONTree/renderTreeItems.d.ts +3 -2
  76. package/types/src/Markdown/renderers/MarkdownCodeBlock.d.ts +2 -1
  77. package/types/src/Menu/docs/examples/Dimmed.d.ts +1 -1
  78. package/types/src/Menu/docs/examples/Disabled.d.ts +1 -0
  79. package/types/src/Modal/ModalContext.d.ts +1 -1
  80. package/types/src/Multiselect/Compact.d.ts +9 -3
  81. package/types/src/Multiselect/Multiselect.d.ts +7 -1
  82. package/types/src/Multiselect/Normal.d.ts +9 -3
  83. package/types/src/Number/utils.d.ts +1 -1
  84. package/types/src/Popover/getPlacement.d.ts +1 -1
  85. package/types/src/RadioList/Option.d.ts +1 -1
  86. package/types/src/RadioList/RadioListContext.d.ts +1 -1
  87. package/types/src/Search/Search.d.ts +5 -1
  88. package/types/src/StepBar/StepBar.d.ts +4 -1
  89. package/types/src/StepBar/StepBarContext.d.ts +1 -0
  90. package/types/src/StepBar/docs/examples/Vertical.d.ts +6 -0
  91. package/types/src/Switch/Switch.d.ts +13 -1
  92. package/types/src/Switch/docs/examples/Basic.d.ts +2 -10
  93. package/types/src/Switch/docs/examples/Disabled.d.ts +2 -9
  94. package/types/src/TabBar/Tab.d.ts +3 -1
  95. package/types/src/TabBar/docs/examples/Icons.d.ts +4 -0
  96. package/types/src/TabBar/docs/examples/Tooltips.d.ts +3 -0
  97. package/types/src/TabLayout/Panel.d.ts +2 -0
  98. package/types/src/Table/ExpandButton.d.ts +1 -1
  99. package/types/src/Table/Head.d.ts +1 -1
  100. package/types/src/Table/Row.d.ts +1 -1
  101. package/types/src/Table/Table.d.ts +1 -0
  102. package/types/src/Tooltip/Tooltip.d.ts +14 -1
  103. package/types/src/Tree/TreeContext.d.ts +1 -1
  104. package/useControlled.js +61 -97
  105. package/usePrevious.js +30 -62
  106. package/useResizeObserver.js +95 -127
  107. package/NonInteractiveCheckbox.js +0 -101
  108. package/types/src/CollapsiblePanel/icons/ExpandPanel.d.ts +0 -12
  109. package/types/src/NonInteractiveCheckbox/NonInteractiveCheckbox.d.ts +0 -22
  110. package/types/src/NonInteractiveCheckbox/index.d.ts +0 -1
  111. package/types/src/Switch/docs/examples/Error.d.ts +0 -6
  112. package/types/src/Text/IconOutlinedHide.d.ts +0 -3
  113. package/types/src/Text/IconOutlinedView.d.ts +0 -3
  114. /package/cypress/{tsconfig.cypress.json → tsconfig.check-cypress.json} +0 -0
package/ResultsMenu.js CHANGED
@@ -1,151 +1,34 @@
1
1
  /******/ (() => {
2
2
  // webpackBootstrap
3
3
  /******/ "use strict";
4
- /******/ var e = {
5
- /***/ 6165:
6
- /***/ (e, r, n) => {
7
- // EXPORTS
8
- n.d(r, {
9
- default: () => /* reexport */ b
10
- });
11
- // EXTERNAL MODULE: external "react"
12
- var t = n(9497);
13
- var o = n.n(t);
14
- // EXTERNAL MODULE: external "prop-types"
15
- var a = n(23);
16
- var i = n.n(a);
17
- // EXTERNAL MODULE: external "styled-components"
18
- var l = n(232);
19
- var u = n.n(l);
20
- // EXTERNAL MODULE: external "@splunk/themes"
21
- var c = n(3563);
22
- // CONCATENATED MODULE: ./src/ScreenReaderContent/ScreenReaderContentStyles.ts
23
- var s = u().span.withConfig({
24
- displayName: "ScreenReaderContentStyles__Styled",
25
- componentId: "sc-1lnohwp-0"
26
- })([ "", ";" ], c.mixins.screenReaderContent());
27
- // CONCATENATED MODULE: ./src/ScreenReaderContent/ScreenReaderContent.tsx
28
- function f() {
29
- return f = Object.assign ? Object.assign.bind() : function(e) {
30
- for (var r = 1; r < arguments.length; r++) {
31
- var n = arguments[r];
32
- for (var t in n) {
33
- ({}).hasOwnProperty.call(n, t) && (e[t] = n[t]);
34
- }
35
- }
36
- return e;
37
- }, f.apply(null, arguments);
38
- }
39
- function v(e, r) {
40
- if (null == e) return {};
41
- var n, t, o = d(e, r);
42
- if (Object.getOwnPropertySymbols) {
43
- var a = Object.getOwnPropertySymbols(e);
44
- for (t = 0; t < a.length; t++) {
45
- n = a[t], -1 === r.indexOf(n) && {}.propertyIsEnumerable.call(e, n) && (o[n] = e[n]);
46
- }
47
- }
48
- return o;
49
- }
50
- function d(e, r) {
51
- if (null == e) return {};
52
- var n = {};
53
- for (var t in e) {
54
- if ({}.hasOwnProperty.call(e, t)) {
55
- if (-1 !== r.indexOf(t)) continue;
56
- n[t] = e[t];
57
- }
58
- }
59
- return n;
60
- }
61
- var m = {
62
- children: i().node.isRequired,
63
- elementRef: i().oneOfType([ i().func, i().object ])
64
- };
65
- /**
66
- * The screen reader text is used to wrap content that
67
- * is only accessible through screen readers.
68
- */ function p(e) {
69
- var r = e.children, n = e.elementRef, t = v(e, [ "children", "elementRef" ]);
70
- // @docs-props-type ScreenReaderContentPropsBase
71
-
72
- return o().createElement(s, f({
73
- "data-test": "screen-reader-content",
74
- ref: n
75
- }, t), r);
76
- }
77
- p.propTypes = m;
78
- /* harmony default export */ const b = p;
79
- } // CONCATENATED MODULE: ./src/ScreenReaderContent/index.ts
80
- /***/ ,
81
- /***/ 3563:
82
- /***/ e => {
83
- e.exports = require("@splunk/themes");
84
- /***/ },
85
- /***/ 23:
86
- /***/ e => {
87
- e.exports = require("prop-types");
88
- /***/ },
89
- /***/ 9497:
90
- /***/ e => {
91
- e.exports = require("react");
92
- /***/ },
93
- /***/ 232:
94
- /***/ e => {
95
- e.exports = require("styled-components");
96
- /***/
97
- /******/ }
98
- };
99
- /************************************************************************/
100
- /******/ // The module cache
101
- /******/ var r = {};
102
- /******/
103
- /******/ // The require function
104
- /******/ function n(t) {
105
- /******/ // Check if module is in cache
106
- /******/ var o = r[t];
107
- /******/ if (o !== undefined) {
108
- /******/ return o.exports;
109
- /******/ }
110
- /******/ // Create a new module (and put it into the cache)
111
- /******/ var a = r[t] = {
112
- /******/ // no module.id needed
113
- /******/ // no module.loaded needed
114
- /******/ exports: {}
115
- /******/ };
116
- /******/
117
- /******/ // Execute the module function
118
- /******/ e[t](a, a.exports, n);
119
- /******/
120
- /******/ // Return the exports of the module
121
- /******/ return a.exports;
122
- /******/ }
4
+ /******/ // The require scope
5
+ /******/ var e = {};
123
6
  /******/
124
7
  /************************************************************************/
125
8
  /******/ /* webpack/runtime/compat get default export */
126
9
  /******/ (() => {
127
10
  /******/ // getDefaultExport function for compatibility with non-harmony modules
128
- /******/ n.n = e => {
129
- /******/ var r = e && e.__esModule ?
130
- /******/ () => e["default"]
131
- /******/ : () => e
11
+ /******/ e.n = r => {
12
+ /******/ var n = r && r.__esModule ?
13
+ /******/ () => r["default"]
14
+ /******/ : () => r
132
15
  /******/;
133
- n.d(r, {
134
- a: r
16
+ e.d(n, {
17
+ a: n
135
18
  });
136
- /******/ return r;
19
+ /******/ return n;
137
20
  /******/ };
138
21
  /******/ })();
139
22
  /******/
140
23
  /******/ /* webpack/runtime/define property getters */
141
24
  /******/ (() => {
142
25
  /******/ // define getter functions for harmony exports
143
- /******/ n.d = (e, r) => {
144
- /******/ for (var t in r) {
145
- /******/ if (n.o(r, t) && !n.o(e, t)) {
146
- /******/ Object.defineProperty(e, t, {
26
+ /******/ e.d = (r, n) => {
27
+ /******/ for (var t in n) {
28
+ /******/ if (e.o(n, t) && !e.o(r, t)) {
29
+ /******/ Object.defineProperty(r, t, {
147
30
  enumerable: true,
148
- get: r[t]
31
+ get: n[t]
149
32
  });
150
33
  /******/ }
151
34
  /******/ }
@@ -154,14 +37,14 @@
154
37
  /******/
155
38
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
156
39
  /******/ (() => {
157
- /******/ n.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
40
+ /******/ e.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
158
41
  /******/;
159
42
  })();
160
43
  /******/
161
44
  /******/ /* webpack/runtime/make namespace object */
162
45
  /******/ (() => {
163
46
  /******/ // define __esModule on exports
164
- /******/ n.r = e => {
47
+ /******/ e.r = e => {
165
48
  /******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
166
49
  /******/ Object.defineProperty(e, Symbol.toStringTag, {
167
50
  value: "Module"
@@ -173,332 +56,331 @@
173
56
  /******/ };
174
57
  /******/ })();
175
58
  /******/
176
- /************************************************************************/ var t = {};
177
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
178
- (() => {
179
- // ESM COMPAT FLAG
180
- n.r(t);
181
- // EXPORTS
182
- n.d(t, {
183
- VirtualizedResultsMenu: () => /* reexport */ Re,
184
- default: () => /* reexport */ F
185
- });
186
- // EXTERNAL MODULE: external "react"
187
- var e = n(9497);
188
- var r = n.n(e);
189
- // EXTERNAL MODULE: external "prop-types"
190
- var o = n(23);
191
- var a = n.n(o);
192
- // CONCATENATED MODULE: external "@splunk/react-ui/Divider"
193
- const i = require("@splunk/react-ui/Divider");
194
- var l = n.n(i);
195
- // CONCATENATED MODULE: external "@splunk/react-ui/Menu"
196
- const u = require("@splunk/react-ui/Menu");
197
- var c = n.n(u);
198
- // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
199
- const s = require("@splunk/ui-utils/i18n");
200
- // EXTERNAL MODULE: external "styled-components"
201
- var f = n(232);
202
- var v = n.n(f);
203
- // CONCATENATED MODULE: external "@splunk/react-ui/WaitSpinner"
204
- const d = require("@splunk/react-ui/WaitSpinner");
205
- var m = n.n(d);
206
- // EXTERNAL MODULE: external "@splunk/themes"
207
- var p = n(3563);
208
- // CONCATENATED MODULE: ./src/ResultsMenu/ResultsMenuStyles.ts
209
- var b = v()(c()).withConfig({
210
- displayName: "ResultsMenuStyles__StyledMenu",
211
- componentId: "avbhl8-0"
212
- })([ "overflow:auto;flex-direction:column;" ]);
213
- var y = v().div.withConfig({
214
- displayName: "ResultsMenuStyles__Styled",
215
- componentId: "avbhl8-1"
216
- })([ "", ";flex-direction:column;max-height:calc(100vh - 20px);border-radius:", ";background-color:", ";& > ", ":not(:first-child){border-start-start-radius:0;border-start-end-radius:0;}& > ", ":not(:last-child){border-end-start-radius:0;border-end-end-radius:0;}" ], p.mixins.reset("flex"), p.variables.borderRadius, p.variables.backgroundColorPopup, b, b);
217
- var g = v().div.withConfig({
218
- displayName: "ResultsMenuStyles__StyledFooter",
219
- componentId: "avbhl8-2"
220
- })([ "padding:", " ", ";color:", ";" ], p.variables.spacingSmall, p.variables.spacingLarge, p.variables.contentColorDefault);
221
- var h = v().li.withConfig({
222
- displayName: "ResultsMenuStyles__StyledLoading",
223
- componentId: "avbhl8-3"
224
- })([ "", ";padding:", " ", ";gap:", ";" ], p.mixins.reset("flex"), p.variables.spacingSmall, p.variables.spacingLarge, p.variables.spacingXSmall);
225
- var S = v()(c().Item).withConfig({
226
- displayName: "ResultsMenuStyles__StyledNoOptions",
227
- componentId: "avbhl8-4"
228
- })([ "&[disabled],&[aria-disabled='true']{color:", ";}" ], p.variables.contentColorDefault);
229
- var E = v()(m()).withConfig({
230
- displayName: "ResultsMenuStyles__StyledWait",
231
- componentId: "avbhl8-5"
232
- })([ "flex:0 0 auto;" ]);
233
- var O = v().div.withConfig({
234
- displayName: "ResultsMenuStyles__StyledLoadingMessage",
235
- componentId: "avbhl8-6"
236
- })([ "flex:1 0 0;color:", ";" ], p.variables.contentColorDefault);
237
- // EXTERNAL MODULE: ./src/ScreenReaderContent/index.ts + 2 modules
238
- var w = n(6165);
239
- // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
240
- /**
59
+ /************************************************************************/ var r = {};
60
+ // ESM COMPAT FLAG
61
+ e.r(r);
62
+ // EXPORTS
63
+ e.d(r, {
64
+ VirtualizedResultsMenu: () => /* reexport */ Re,
65
+ default: () => /* reexport */ B
66
+ });
67
+ // CONCATENATED MODULE: external "react"
68
+ const n = require("react");
69
+ var t = e.n(n);
70
+ // CONCATENATED MODULE: external "prop-types"
71
+ const o = require("prop-types");
72
+ var a = e.n(o);
73
+ // CONCATENATED MODULE: external "@splunk/react-ui/Divider"
74
+ const i = require("@splunk/react-ui/Divider");
75
+ var u = e.n(i);
76
+ // CONCATENATED MODULE: external "@splunk/react-ui/Menu"
77
+ const l = require("@splunk/react-ui/Menu");
78
+ var c = e.n(l);
79
+ // CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
80
+ const s = require("@splunk/react-ui/ScreenReaderContent");
81
+ var f = e.n(s);
82
+ // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
83
+ const d = require("@splunk/ui-utils/i18n");
84
+ // CONCATENATED MODULE: external "styled-components"
85
+ const v = require("styled-components");
86
+ var m = e.n(v);
87
+ // CONCATENATED MODULE: external "@splunk/react-ui/WaitSpinner"
88
+ const b = require("@splunk/react-ui/WaitSpinner");
89
+ var p = e.n(b);
90
+ // CONCATENATED MODULE: external "@splunk/themes"
91
+ const y = require("@splunk/themes");
92
+ // CONCATENATED MODULE: ./src/ResultsMenu/ResultsMenuStyles.ts
93
+ var g = m()(c()).withConfig({
94
+ displayName: "ResultsMenuStyles__StyledMenu",
95
+ componentId: "avbhl8-0"
96
+ })([ "overflow:auto;flex-direction:column;" ]);
97
+ var h = m().div.withConfig({
98
+ displayName: "ResultsMenuStyles__Styled",
99
+ componentId: "avbhl8-1"
100
+ })([ "", ";flex-direction:column;max-height:calc(100vh - 20px);border-radius:", ";background-color:", ";& > ", ":not(:first-child){border-start-start-radius:0;border-start-end-radius:0;}& > ", ":not(:last-child){border-end-start-radius:0;border-end-end-radius:0;}" ], y.mixins.reset("flex"), y.variables.borderRadius, y.variables.backgroundColorPopup, g, g);
101
+ var S = m().div.withConfig({
102
+ displayName: "ResultsMenuStyles__StyledFooter",
103
+ componentId: "avbhl8-2"
104
+ })([ "padding:", " ", ";color:", ";" ], y.variables.spacingSmall, y.variables.spacingLarge, y.variables.contentColorDefault);
105
+ var E = m().li.withConfig({
106
+ displayName: "ResultsMenuStyles__StyledLoading",
107
+ componentId: "avbhl8-3"
108
+ })([ "", ";padding:", " ", ";gap:", ";" ], y.mixins.reset("flex"), y.variables.spacingSmall, y.variables.spacingLarge, y.variables.spacingXSmall);
109
+ var O = m()(c().Item).withConfig({
110
+ displayName: "ResultsMenuStyles__StyledNoOptions",
111
+ componentId: "avbhl8-4"
112
+ })([ "&[disabled],&[aria-disabled='true']{color:", ";}" ], y.variables.contentColorDefault);
113
+ var M = m()(p()).withConfig({
114
+ displayName: "ResultsMenuStyles__StyledWait",
115
+ componentId: "avbhl8-5"
116
+ })([ "flex:0 0 auto;" ]);
117
+ var w = m().div.withConfig({
118
+ displayName: "ResultsMenuStyles__StyledLoadingMessage",
119
+ componentId: "avbhl8-6"
120
+ })([ "flex:1 0 0;color:", ";" ], y.variables.contentColorDefault);
121
+ // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
122
+ /**
241
123
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
242
124
  *
243
125
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
244
126
  * @param current - The new value of the ref.
245
127
  */
246
- function M(e, r) {
247
- if (e) {
248
- if (typeof e === "function") {
249
- e(r);
250
- } else {
251
- // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
252
- // the intention here is to signal "we will take care of setting 'current', not you".
253
- e.current = r;
128
+ function C(e, r) {
129
+ if (e) {
130
+ if (typeof e === "function") {
131
+ e(r);
132
+ } else {
133
+ // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
134
+ // the intention here is to signal "we will take care of setting 'current', not you".
135
+ e.current = r;
254
136
  // eslint-disable-line no-param-reassign
255
- }
256
- }
137
+ }
257
138
  }
258
- // CONCATENATED MODULE: ./src/ResultsMenu/ResultsMenu.tsx
259
- function C() {
260
- return C = Object.assign ? Object.assign.bind() : function(e) {
261
- for (var r = 1; r < arguments.length; r++) {
262
- var n = arguments[r];
263
- for (var t in n) {
264
- ({}).hasOwnProperty.call(n, t) && (e[t] = n[t]);
265
- }
139
+ }
140
+ // CONCATENATED MODULE: ./src/ResultsMenu/ResultsMenu.tsx
141
+ function k() {
142
+ return k = Object.assign ? Object.assign.bind() : function(e) {
143
+ for (var r = 1; r < arguments.length; r++) {
144
+ var n = arguments[r];
145
+ for (var t in n) {
146
+ ({}).hasOwnProperty.call(n, t) && (e[t] = n[t]);
266
147
  }
267
- return e;
268
- }, C.apply(null, arguments);
269
- }
270
- function j(e, r) {
271
- return P(e) || I(e, r) || R(e, r) || x();
272
- }
273
- function x() {
274
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
275
- }
276
- function R(e, r) {
277
- if (e) {
278
- if ("string" == typeof e) return k(e, r);
279
- var n = {}.toString.call(e).slice(8, -1);
280
- return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? k(e, r) : void 0;
281
148
  }
149
+ return e;
150
+ }, k.apply(null, arguments);
151
+ }
152
+ function j(e, r) {
153
+ return A(e) || x(e, r) || R(e, r) || I();
154
+ }
155
+ function I() {
156
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
157
+ }
158
+ function R(e, r) {
159
+ if (e) {
160
+ if ("string" == typeof e) return P(e, r);
161
+ var n = {}.toString.call(e).slice(8, -1);
162
+ return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? P(e, r) : void 0;
282
163
  }
283
- function k(e, r) {
284
- (null == r || r > e.length) && (r = e.length);
285
- for (var n = 0, t = Array(r); n < r; n++) {
286
- t[n] = e[n];
287
- }
288
- return t;
164
+ }
165
+ function P(e, r) {
166
+ (null == r || r > e.length) && (r = e.length);
167
+ for (var n = 0, t = Array(r); n < r; n++) {
168
+ t[n] = e[n];
289
169
  }
290
- function I(e, r) {
291
- var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
292
- if (null != n) {
293
- var t, o, a, i, l = [], u = !0, c = !1;
170
+ return t;
171
+ }
172
+ function x(e, r) {
173
+ var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
174
+ if (null != n) {
175
+ var t, o, a, i, u = [], l = !0, c = !1;
176
+ try {
177
+ if (a = (n = n.call(e)).next, 0 === r) {
178
+ if (Object(n) !== n) return;
179
+ l = !1;
180
+ } else for (;!(l = (t = a.call(n)).done) && (u.push(t.value), u.length !== r); l = !0) {
181
+ }
182
+ } catch (e) {
183
+ c = !0, o = e;
184
+ } finally {
294
185
  try {
295
- if (a = (n = n.call(e)).next, 0 === r) {
296
- if (Object(n) !== n) return;
297
- u = !1;
298
- } else for (;!(u = (t = a.call(n)).done) && (l.push(t.value), l.length !== r); u = !0) {
299
- }
300
- } catch (e) {
301
- c = !0, o = e;
186
+ if (!l && null != n["return"] && (i = n["return"](), Object(i) !== i)) return;
302
187
  } finally {
303
- try {
304
- if (!u && null != n["return"] && (i = n["return"](), Object(i) !== i)) return;
305
- } finally {
306
- if (c) throw o;
307
- }
188
+ if (c) throw o;
308
189
  }
309
- return l;
310
190
  }
191
+ return u;
311
192
  }
312
- function P(e) {
313
- if (Array.isArray(e)) return e;
314
- }
315
- function T(e, r) {
316
- if (null == e) return {};
317
- var n, t, o = A(e, r);
318
- if (Object.getOwnPropertySymbols) {
319
- var a = Object.getOwnPropertySymbols(e);
320
- for (t = 0; t < a.length; t++) {
321
- n = a[t], -1 === r.indexOf(n) && {}.propertyIsEnumerable.call(e, n) && (o[n] = e[n]);
322
- }
193
+ }
194
+ function A(e) {
195
+ if (Array.isArray(e)) return e;
196
+ }
197
+ function T(e, r) {
198
+ if (null == e) return {};
199
+ var n, t, o = L(e, r);
200
+ if (Object.getOwnPropertySymbols) {
201
+ var a = Object.getOwnPropertySymbols(e);
202
+ for (t = 0; t < a.length; t++) {
203
+ n = a[t], -1 === r.indexOf(n) && {}.propertyIsEnumerable.call(e, n) && (o[n] = e[n]);
323
204
  }
324
- return o;
325
205
  }
326
- function A(e, r) {
327
- if (null == e) return {};
328
- var n = {};
329
- for (var t in e) {
330
- if ({}.hasOwnProperty.call(e, t)) {
331
- if (-1 !== r.indexOf(t)) continue;
332
- n[t] = e[t];
333
- }
206
+ return o;
207
+ }
208
+ function L(e, r) {
209
+ if (null == e) return {};
210
+ var n = {};
211
+ for (var t in e) {
212
+ if ({}.hasOwnProperty.call(e, t)) {
213
+ if (-1 !== r.indexOf(t)) continue;
214
+ n[t] = e[t];
334
215
  }
335
- return n;
336
216
  }
337
- var L = {
338
- animateLoading: a().bool,
339
- children: a().node,
340
- childrenStart: a().node,
341
- elementRef: a().oneOfType([ a().func, a().object ]),
342
- focusMode: a().oneOf([ "roving", "normal", "never" ]),
343
- footerMessage: a().node,
344
- isLoading: a().bool,
345
- loadingMessage: a().node,
346
- menuId: a().string,
347
- noOptionsMessage: a().node,
348
- onScroll: a().func,
349
- onScrollBottom: a().func,
350
- placement: a().string
351
- };
352
- var _ = (0, s._)("Loading...");
353
- var q = (0, s._)("No matches");
354
- // The remaining amount of pixels when scrolled from bottom of menu to trigger onScrollBottom().
355
- var N = 400;
356
- var D = 28;
357
- function H(n) {
358
- var t = n.animateLoading, o = n["aria-multiselectable"], a = n.children, i = n.childrenStart, c = n.elementRef, s = n.focusMode, f = n.footerMessage, v = n.isLoading, d = n.labelledBy, m = n.loadingMessage, p = m === void 0 ? _ : m, x = n.menuId, R = n.noOptionsMessage, k = R === void 0 ? q : R, I = n.onScroll, P = n.onScrollBottom, A = n.placement, L = n.style, H = n.tabIndex, F = T(n, [ "animateLoading", "aria-multiselectable", "children", "childrenStart", "elementRef", "focusMode", "footerMessage", "isLoading", "labelledBy", "loadingMessage", "menuId", "noOptionsMessage", "onScroll", "onScrollBottom", "placement", "style", "tabIndex" ]);
359
- // @docs-props-type ResultsMenuPropsBase
360
- var B = (0, e.useState)(undefined), U = j(B, 2), z = U[0], V = U[1];
361
- var K = (0, e.useState)(null), W = j(K, 2), $ = W[0], G = W[1];
362
- var X = (0, e.useState)(null), J = j(X, 2), Q = J[0], Y = J[1];
363
- var Z = (0, e.useState)(0), ee = j(Z, 2), re = ee[0], ne = ee[1];
364
- var te = (0, e.useState)(0), oe = j(te, 2), ae = oe[0], ie = oe[1];
365
- var le = (0, e.useState)(false), ue = j(le, 2), ce = ue[0], se = ue[1];
366
- var fe = (0, e.useCallback)((function(e) {
367
- Y(e);
368
- }), []);
369
- var ve = (0, e.useCallback)((function(e) {
370
- G(e);
371
- M(c, e);
372
- }), [ c ]);
373
- var de = (0, e.useCallback)((function() {
374
- ie(document.documentElement.scrollTop);
375
- }), []);
376
- var me = (0, e.useCallback)((function() {
377
- ie(document.documentElement.scrollTop);
378
- }), []);
379
- var pe = (0, e.useCallback)((function(e) {
380
- // Safety net to ensure window doesn't scroll if menu is scrolled pass the numberOfItemsLoaded at high velocity.
381
- e.stopPropagation();
382
- document.documentElement.scrollTop = ae;
383
- }), [ ae ]);
384
- var be = (0, e.useCallback)((function() {
385
- return !!Q && Q.scrollHeight === Q.offsetHeight;
386
- }), [ Q ]);
387
- var ye = (0, e.useCallback)((function(e) {
388
- if (!ce) {
389
- se(true);
390
- P === null || P === void 0 ? void 0 : P(e);
391
- }
392
- }), [ ce, P ]);
393
- var ge = (0, e.useCallback)((function(e) {
394
- if (P && e.target && Q) {
395
- var r = Q.scrollHeight - Q.offsetHeight - N;
396
- // Adding 1 due to border of menu item.
397
- if (Q.scrollTop + 1 >= r) {
398
- ye(e);
399
- }
400
- }
401
- I === null || I === void 0 ? void 0 : I(e);
402
- }), [ ye, Q, I, P ]);
403
- var he = (0, e.useCallback)((function() {
404
- var r = e.Children.count(a);
405
- // If menu is full length, load more items.
406
- if (be()) {
407
- ye(null);
408
- }
409
- // Avoid triggering this logic if this.state.childrenCount is null
410
- // because that's not a real change in the number of children
411
- // and thus we want to avoid resetting the value of scrollBottomTriggered
412
- if (z != null && r !== z) {
413
- ne(r - (z !== null && z !== void 0 ? z : 0));
414
- se(false);
415
- }
416
- if (r !== z) {
417
- V(r);
418
- }
419
- }), [ be, a, z, ye ]);
420
- (0, e.useEffect)((function() {
421
- if (!$ || !Q) {
422
- return;
423
- }
424
- // If onScrollBottom is defined, determine if it should be triggered.
425
- if (P && a) {
426
- he();
217
+ return n;
218
+ }
219
+ var _ = {
220
+ animateLoading: a().bool,
221
+ children: a().node,
222
+ childrenStart: a().node,
223
+ elementRef: a().oneOfType([ a().func, a().object ]),
224
+ focusMode: a().oneOf([ "roving", "normal", "never" ]),
225
+ footerMessage: a().node,
226
+ isLoading: a().bool,
227
+ loadingMessage: a().node,
228
+ menuId: a().string,
229
+ noOptionsMessage: a().node,
230
+ onScroll: a().func,
231
+ onScrollBottom: a().func,
232
+ placement: a().string
233
+ };
234
+ var q = (0, d._)("Loading...");
235
+ var D = (0, d._)("No matches");
236
+ // The remaining amount of pixels when scrolled from bottom of menu to trigger onScrollBottom().
237
+ var N = 400;
238
+ var H = 28;
239
+ function F(e) {
240
+ var r = e.animateLoading, o = e["aria-multiselectable"], a = e.children, i = e.childrenStart, c = e.elementRef, s = e.focusMode, d = e.footerMessage, v = e.isLoading, m = e.labelledBy, b = e.loadingMessage, p = b === void 0 ? q : b, y = e.menuId, I = e.noOptionsMessage, R = I === void 0 ? D : I, P = e.onScroll, x = e.onScrollBottom, A = e.placement, L = e.style, _ = e.tabIndex, F = T(e, [ "animateLoading", "aria-multiselectable", "children", "childrenStart", "elementRef", "focusMode", "footerMessage", "isLoading", "labelledBy", "loadingMessage", "menuId", "noOptionsMessage", "onScroll", "onScrollBottom", "placement", "style", "tabIndex" ]);
241
+ // @docs-props-type ResultsMenuPropsBase
242
+ var B = (0, n.useState)(undefined), U = j(B, 2), z = U[0], V = U[1];
243
+ var K = (0, n.useState)(null), W = j(K, 2), $ = W[0], G = W[1];
244
+ var X = (0, n.useState)(null), J = j(X, 2), Q = J[0], Y = J[1];
245
+ var Z = (0, n.useState)(0), ee = j(Z, 2), re = ee[0], ne = ee[1];
246
+ var te = (0, n.useState)(0), oe = j(te, 2), ae = oe[0], ie = oe[1];
247
+ var ue = (0, n.useState)(false), le = j(ue, 2), ce = le[0], se = le[1];
248
+ var fe = (0, n.useCallback)((function(e) {
249
+ Y(e);
250
+ }), []);
251
+ var de = (0, n.useCallback)((function(e) {
252
+ G(e);
253
+ C(c, e);
254
+ }), [ c ]);
255
+ var ve = (0, n.useCallback)((function() {
256
+ ie(document.documentElement.scrollTop);
257
+ }), []);
258
+ var me = (0, n.useCallback)((function() {
259
+ ie(document.documentElement.scrollTop);
260
+ }), []);
261
+ var be = (0, n.useCallback)((function(e) {
262
+ // Safety net to ensure window doesn't scroll if menu is scrolled pass the numberOfItemsLoaded at high velocity.
263
+ e.stopPropagation();
264
+ document.documentElement.scrollTop = ae;
265
+ }), [ ae ]);
266
+ var pe = (0, n.useCallback)((function() {
267
+ return !!Q && Q.scrollHeight === Q.offsetHeight;
268
+ }), [ Q ]);
269
+ var ye = (0, n.useCallback)((function(e) {
270
+ if (!ce) {
271
+ se(true);
272
+ x === null || x === void 0 ? void 0 : x(e);
273
+ }
274
+ }), [ ce, x ]);
275
+ var ge = (0, n.useCallback)((function(e) {
276
+ if (x && e.target && Q) {
277
+ var r = Q.scrollHeight - Q.offsetHeight - N;
278
+ // Adding 1 due to border of menu item.
279
+ if (Q.scrollTop + 1 >= r) {
280
+ ye(e);
427
281
  }
428
- }), [ $, Q, a, P, he ]);
429
- // Assumption: that you cannot be filtered if you are a result
430
- var Se = e.Children.toArray(a).filter(e.isValidElement).some((function(e) {
431
- var r = e.type;
432
- return !(r.as === "Divider" && r.filterFirst || (r.as === "Divider" || r.as === "Heading") && (r.filterLast || r.filterConsecutive));
433
- }));
434
- var Ee = be();
435
- var Oe = (0, e.useMemo)((function() {
436
- return {
437
- height: ce ? re * D : 0
438
- };
439
- }), [ ce, re ]);
440
- var we = !Se && !!k && !v;
441
- var Me = (0, e.useCallback)((function() {
442
- return {
443
- role: "listbox",
444
- preventFocus: s === "never"
445
- };
446
- }), [ s ]);
447
- var Ce = (0, e.useCallback)((function() {
448
- var n = !!e.Children.toArray(a).length;
449
- return f && n && r().createElement(r().Fragment, null, A !== "above" && r().createElement(l(), null), r().createElement(g, {
450
- "data-test": "footer-message",
451
- key: "footer"
452
- }, f), A === "above" && r().createElement(l(), null));
453
- }), [ f, a, A ]);
454
-
455
- return r().createElement(y, C({
456
- "data-test": "results-menu",
457
- key: "wrapper",
458
- ref: ve,
459
- onWheel: P ? pe : undefined,
460
- onMouseEnter: P ? de : undefined,
461
- onMouseLeave: P ? me : undefined
462
- }, F, {
463
- style: L
464
- }), A !== "above" && i, A === "above" && Ce(), r().createElement(u.MenuContext.Provider, {
465
- value: Me()
466
- }, r().createElement(b, {
467
- "aria-multiselectable": o,
468
- "aria-labelledby": d,
469
- elementRef: fe,
470
- focusMode: s,
471
- id: x,
472
- key: "menu",
473
- onScroll: ge,
474
- stopScrollPropagation: true,
475
- tabIndex: H
476
- }, we && r().createElement(S, {
477
- "data-test": "no-results-message",
478
- disabled: true
479
- }, k), a, P && !Ee &&
480
-
481
- // Bottom spacer fills in the space of new items being loaded by using the minimum possible height x menuItems.
482
- r().createElement("div", {
483
- "data-test": "results-menu-bottom-spacer",
484
- style: Oe
485
- }), v && r().createElement(h, null, t && r().createElement(E, null), r().createElement(O, null, p)))), r().createElement(w["default"], {
486
- "aria-live": "polite"
487
- }, we && k), A !== "above" && Ce(), A === "above" && i);
488
- }
489
- H.propTypes = L;
490
- /* harmony default export */ const F = H;
491
- // CONCATENATED MODULE: external "lodash/omit"
492
- const B = require("lodash/omit");
493
- var U = n.n(B);
494
- // CONCATENATED MODULE: external "@splunk/ui-utils/focus"
495
- const z = require("@splunk/ui-utils/focus");
496
- // CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/groupChildren.ts
497
- // Cheap(er than processing potentially thousands of array elements) memoization
498
- var V = {
499
- result: []
500
- };
501
- /**
282
+ }
283
+ P === null || P === void 0 ? void 0 : P(e);
284
+ }), [ ye, Q, P, x ]);
285
+ var he = (0, n.useCallback)((function() {
286
+ var e = n.Children.count(a);
287
+ // If menu is full length, load more items.
288
+ if (pe()) {
289
+ ye(null);
290
+ }
291
+ // Avoid triggering this logic if this.state.childrenCount is null
292
+ // because that's not a real change in the number of children
293
+ // and thus we want to avoid resetting the value of scrollBottomTriggered
294
+ if (z != null && e !== z) {
295
+ ne(e - (z !== null && z !== void 0 ? z : 0));
296
+ se(false);
297
+ }
298
+ if (e !== z) {
299
+ V(e);
300
+ }
301
+ }), [ pe, a, z, ye ]);
302
+ (0, n.useEffect)((function() {
303
+ if (!$ || !Q) {
304
+ return;
305
+ }
306
+ // If onScrollBottom is defined, determine if it should be triggered.
307
+ if (x && a) {
308
+ he();
309
+ }
310
+ }), [ $, Q, a, x, he ]);
311
+ // Assumption: that you cannot be filtered if you are a result
312
+ var Se = n.Children.toArray(a).filter(n.isValidElement).some((function(e) {
313
+ var r = e.type;
314
+ return !(r.as === "Divider" && r.filterFirst || (r.as === "Divider" || r.as === "Heading") && (r.filterLast || r.filterConsecutive));
315
+ }));
316
+ var Ee = pe();
317
+ var Oe = (0, n.useMemo)((function() {
318
+ return {
319
+ height: ce ? re * H : 0
320
+ };
321
+ }), [ ce, re ]);
322
+ var Me = !Se && !!R && !v;
323
+ var we = (0, n.useCallback)((function() {
324
+ return {
325
+ role: "listbox",
326
+ preventFocus: s === "never"
327
+ };
328
+ }), [ s ]);
329
+ var Ce = (0, n.useCallback)((function() {
330
+ var e = !!n.Children.toArray(a).length;
331
+ return d && e && t().createElement(t().Fragment, null, A !== "above" && t().createElement(u(), null), t().createElement(S, {
332
+ "data-test": "footer-message",
333
+ key: "footer"
334
+ }, d), A === "above" && t().createElement(u(), null));
335
+ }), [ d, a, A ]);
336
+
337
+ return t().createElement(h, k({
338
+ "data-test": "results-menu",
339
+ key: "wrapper",
340
+ ref: de,
341
+ onWheel: x ? be : undefined,
342
+ onMouseEnter: x ? ve : undefined,
343
+ onMouseLeave: x ? me : undefined
344
+ }, F, {
345
+ style: L
346
+ }), A !== "above" && i, A === "above" && Ce(), t().createElement(l.MenuContext.Provider, {
347
+ value: we()
348
+ }, t().createElement(g, {
349
+ "aria-multiselectable": o,
350
+ "aria-labelledby": m,
351
+ elementRef: fe,
352
+ focusMode: s,
353
+ id: y,
354
+ key: "menu",
355
+ onScroll: ge,
356
+ stopScrollPropagation: true,
357
+ tabIndex: _
358
+ }, Me && t().createElement(O, {
359
+ "data-test": "no-results-message",
360
+ disabled: true
361
+ }, R), a, x && !Ee &&
362
+
363
+ // Bottom spacer fills in the space of new items being loaded by using the minimum possible height x menuItems.
364
+ t().createElement("div", {
365
+ "data-test": "results-menu-bottom-spacer",
366
+ style: Oe
367
+ }), v && t().createElement(E, null, r && t().createElement(M, null), t().createElement(w, null, p)))), t().createElement(f(), {
368
+ "aria-live": "polite"
369
+ }, Me && R), A !== "above" && Ce(), A === "above" && i);
370
+ }
371
+ F.propTypes = _;
372
+ /* harmony default export */ const B = F;
373
+ // CONCATENATED MODULE: external "lodash/omit"
374
+ const U = require("lodash/omit");
375
+ var z = e.n(U);
376
+ // CONCATENATED MODULE: external "@splunk/ui-utils/focus"
377
+ const V = require("@splunk/ui-utils/focus");
378
+ // CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/groupChildren.ts
379
+ // Cheap(er than processing potentially thousands of array elements) memoization
380
+ var K = {
381
+ result: []
382
+ };
383
+ /**
502
384
  * Given component children, restructure them into an array of arrays, each of length `groupSize`.
503
385
  *
504
386
  * The last array is not guaranteed to be full, it will have a length in the range `[1, groupSize]`
@@ -512,262 +394,264 @@
512
394
  * @param {number} groupSize The size of each group to be created
513
395
  * @returns A 2d array where each inner-array is a group of size `groupSize` of children
514
396
  * and the order of the `children` received equals the order of the flattened result
515
- */ var K = function r(n, t) {
516
- if (V.children === n && V.groupSize === t) {
517
- return V.result;
518
- }
519
- V.children = n;
520
- V.groupSize = t;
521
- if (t <= 1) {
522
- if (false) {}
523
- // don't break in non-__DEV__ and return one big group
524
- V.result = [ e.Children.toArray(n) ];
525
- } else {
526
- V.result = e.Children.toArray(n).reduce((function(e, r, n) {
527
- var o = Math.floor(n / t);
528
- if (!Array.isArray(e[o])) {
529
- // eslint-disable-next-line no-param-reassign
530
- e[o] = [];
531
- }
532
- e[o].push(r);
533
- return e;
534
- }), []);
397
+ */ var W = function e(r, t) {
398
+ if (K.children === r && K.groupSize === t) {
399
+ return K.result;
400
+ }
401
+ K.children = r;
402
+ K.groupSize = t;
403
+ if (t <= 1) {
404
+ if (false) {}
405
+ // don't break in non-__DEV__ and return one big group
406
+ K.result = [ n.Children.toArray(r) ];
407
+ } else {
408
+ K.result = n.Children.toArray(r).reduce((function(e, r, n) {
409
+ var o = Math.floor(n / t);
410
+ if (!Array.isArray(e[o])) {
411
+ // eslint-disable-next-line no-param-reassign
412
+ e[o] = [];
413
+ }
414
+ e[o].push(r);
415
+ return e;
416
+ }), []);
417
+ }
418
+ return K.result;
419
+ };
420
+ // CONCATENATED MODULE: external "@splunk/ui-utils/id"
421
+ const $ = require("@splunk/ui-utils/id");
422
+ // CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/VirtualizedItem.ts
423
+ // This wrapper should only be used with Menu.Item/derivatives thereof, so omitting Heading/Divider is fine
424
+ var G = {
425
+ children: a().node,
426
+ onMount: a().func.isRequired,
427
+ onUnmount: a().func.isRequired
428
+ };
429
+ /** @private Used by `VirtualizedResultsMenu` */ var X = t().forwardRef((function(e, r) {
430
+ var t = e.children, o = e.onMount, a = e.onUnmount;
431
+ // @docs-props-type VirtualizedItemPropsBase
432
+ var i = (0, n.useRef)(null);
433
+ (0, n.useEffect)((function() {
434
+ var e = i.current;
435
+ if (e) {
436
+ o(e);
535
437
  }
536
- return V.result;
537
- };
538
- // CONCATENATED MODULE: external "@splunk/ui-utils/id"
539
- const W = require("@splunk/ui-utils/id");
540
- // CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/VirtualizedItem.ts
541
- // This wrapper should only be used with Menu.Item/derivatives thereof, so omitting Heading/Divider is fine
542
- var $ = {
543
- children: a().node,
544
- onMount: a().func.isRequired,
545
- onUnmount: a().func.isRequired
546
- };
547
- /** @private Used by `VirtualizedResultsMenu` */ var G = r().forwardRef((function(r, n) {
548
- var t = r.children, o = r.onMount, a = r.onUnmount;
549
- var i = (0, e.useRef)(null);
550
- (0, e.useEffect)((function() {
551
- var e = i.current;
438
+ return function() {
552
439
  if (e) {
553
- o(e);
440
+ a(e);
554
441
  }
555
- return function() {
556
- if (e) {
557
- a(e);
558
- }
559
- };
560
- }), [ o, a ]);
561
- var l = e.Children.only(t);
562
- if (!l) {
563
- if (false) {}
564
- return null;
442
+ };
443
+ }), [ o, a ]);
444
+ var u = n.Children.only(t);
445
+ if (!u) {
446
+ if (false) {}
447
+ return null;
448
+ }
449
+
450
+ return (0, n.cloneElement)(u, {
451
+ elementRef: function e(n) {
452
+ i.current = n;
453
+ C(r, n);
565
454
  }
566
-
567
- return (0, e.cloneElement)(l, {
568
- elementRef: function e(r) {
569
- i.current = r;
570
- M(n, r);
571
- }
572
- });
573
- }));
574
- G.propTypes = $;
575
- G.as = "Item";
576
- // CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/injectVirtualizedItem.tsx
577
- /**
455
+ });
456
+ }));
457
+ X.propTypes = G;
458
+ X.as = "Item";
459
+ // CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/injectVirtualizedItem.tsx
460
+ /**
578
461
  * Find the index of an array element which is nearest to targetIndex and is a Menu.Item component
579
462
  * @param {Array} elements An array to search
580
463
  * @param {Number} targetIndex The target index. This is the ideal value to return.
581
464
  * @returns The index in the array of the nearest `Menu.Item` component to `targetIndex`, or -1 if no element is a `Menu.Item` component
582
465
  */
583
- var X = function e(r, n) {
584
- var t = -1;
585
- var o = -1;
586
- r.forEach((function(e, r) {
587
- var a = Math.abs(n - r);
588
- if (t >= 0 && t < a) {
589
- return;
590
- }
591
- if (e.type !== u.Divider && e.type !== u.Heading) {
592
- t = a;
593
- o = r;
594
- }
595
- }));
596
- return o;
597
- };
598
- /**
466
+ var J = function e(r, n) {
467
+ var t = -1;
468
+ var o = -1;
469
+ r.forEach((function(e, r) {
470
+ var a = Math.abs(n - r);
471
+ if (t >= 0 && t < a) {
472
+ return;
473
+ }
474
+ if (e.type !== l.Divider && e.type !== l.Heading) {
475
+ t = a;
476
+ o = r;
477
+ }
478
+ }));
479
+ return o;
480
+ };
481
+ /**
599
482
  * @private Keep the injection of `VirtualizedItem` DRY. Will always replace the middle-most non-divider/heading
600
483
  * with a VirtualizedItem instance.
601
484
  * - If `trackFirstElement` the **FIRST** non-divider/heading item will also be replaced.
602
485
  * - If `trackLastElement` the **LAST** non-divider/heading item will also be replaced.
603
- */ var J = function e(n, t, o) {
604
- var a = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, i = a.trackFirstElement, l = a.trackLastElement;
605
- if (!Array.isArray(n)) {
606
- return [];
607
- }
608
- var u = X(n, Math.floor(n.length / 2));
609
- var c = i && X(n, 0);
610
- var s = l && X(n, n.length - 1);
611
- return n.map((function(e, n) {
612
- if (n === u || n === c || n === s) {
613
-
614
- return r().createElement(G, {
615
- key: (0, W.createGUID)(),
616
- onMount: t,
617
- onUnmount: o
618
- }, e);
619
- }
620
- return e;
621
- }));
622
- };
623
- // CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/VirtualizedResultsMenu.tsx
624
- function Q(e) {
625
- "@babel/helpers - typeof";
626
- return Q = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
627
- return typeof e;
628
- } : function(e) {
629
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
630
- }, Q(e);
631
- }
632
- function Y() {
633
- return Y = Object.assign ? Object.assign.bind() : function(e) {
634
- for (var r = 1; r < arguments.length; r++) {
635
- var n = arguments[r];
636
- for (var t in n) {
637
- ({}).hasOwnProperty.call(n, t) && (e[t] = n[t]);
638
- }
639
- }
640
- return e;
641
- }, Y.apply(null, arguments);
486
+ */ var Q = function e(r, n, o) {
487
+ var a = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, i = a.trackFirstElement, u = a.trackLastElement;
488
+ if (!Array.isArray(r)) {
489
+ return [];
642
490
  }
643
- function Z(e) {
644
- return ne(e) || re(e) || ae(e) || ee();
645
- }
646
- function ee() {
647
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
648
- }
649
- function re(e) {
650
- if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
651
- }
652
- function ne(e) {
653
- if (Array.isArray(e)) return ie(e);
654
- }
655
- function te(e, r) {
656
- return ue(e) || le(e, r) || ae(e, r) || oe();
657
- }
658
- function oe() {
659
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
660
- }
661
- function ae(e, r) {
662
- if (e) {
663
- if ("string" == typeof e) return ie(e, r);
664
- var n = {}.toString.call(e).slice(8, -1);
665
- return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? ie(e, r) : void 0;
491
+ var l = J(r, Math.floor(r.length / 2));
492
+ var c = i && J(r, 0);
493
+ var s = u && J(r, r.length - 1);
494
+ return r.map((function(e, r) {
495
+ if (r === l || r === c || r === s) {
496
+
497
+ return t().createElement(X, {
498
+ key: (0, $.createGUID)(),
499
+ onMount: n,
500
+ onUnmount: o
501
+ }, e);
666
502
  }
667
- }
668
- function ie(e, r) {
669
- (null == r || r > e.length) && (r = e.length);
670
- for (var n = 0, t = Array(r); n < r; n++) {
671
- t[n] = e[n];
672
- }
673
- return t;
674
- }
675
- function le(e, r) {
676
- var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
677
- if (null != n) {
678
- var t, o, a, i, l = [], u = !0, c = !1;
679
- try {
680
- if (a = (n = n.call(e)).next, 0 === r) {
681
- if (Object(n) !== n) return;
682
- u = !1;
683
- } else for (;!(u = (t = a.call(n)).done) && (l.push(t.value), l.length !== r); u = !0) {
684
- }
685
- } catch (e) {
686
- c = !0, o = e;
687
- } finally {
688
- try {
689
- if (!u && null != n["return"] && (i = n["return"](), Object(i) !== i)) return;
690
- } finally {
691
- if (c) throw o;
692
- }
503
+ return e;
504
+ }));
505
+ };
506
+ // CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/VirtualizedResultsMenu.tsx
507
+ function Y(e) {
508
+ "@babel/helpers - typeof";
509
+ return Y = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
510
+ return typeof e;
511
+ } : function(e) {
512
+ return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
513
+ }, Y(e);
514
+ }
515
+ function Z() {
516
+ return Z = Object.assign ? Object.assign.bind() : function(e) {
517
+ for (var r = 1; r < arguments.length; r++) {
518
+ var n = arguments[r];
519
+ for (var t in n) {
520
+ ({}).hasOwnProperty.call(n, t) && (e[t] = n[t]);
693
521
  }
694
- return l;
695
522
  }
523
+ return e;
524
+ }, Z.apply(null, arguments);
525
+ }
526
+ function ee(e) {
527
+ return te(e) || ne(e) || ie(e) || re();
528
+ }
529
+ function re() {
530
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
531
+ }
532
+ function ne(e) {
533
+ if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
534
+ }
535
+ function te(e) {
536
+ if (Array.isArray(e)) return ue(e);
537
+ }
538
+ function oe(e, r) {
539
+ return ce(e) || le(e, r) || ie(e, r) || ae();
540
+ }
541
+ function ae() {
542
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
543
+ }
544
+ function ie(e, r) {
545
+ if (e) {
546
+ if ("string" == typeof e) return ue(e, r);
547
+ var n = {}.toString.call(e).slice(8, -1);
548
+ return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? ue(e, r) : void 0;
696
549
  }
697
- function ue(e) {
698
- if (Array.isArray(e)) return e;
550
+ }
551
+ function ue(e, r) {
552
+ (null == r || r > e.length) && (r = e.length);
553
+ for (var n = 0, t = Array(r); n < r; n++) {
554
+ t[n] = e[n];
699
555
  }
700
- function ce(e, r) {
701
- if (null == e) return {};
702
- var n, t, o = se(e, r);
703
- if (Object.getOwnPropertySymbols) {
704
- var a = Object.getOwnPropertySymbols(e);
705
- for (t = 0; t < a.length; t++) {
706
- n = a[t], -1 === r.indexOf(n) && {}.propertyIsEnumerable.call(e, n) && (o[n] = e[n]);
556
+ return t;
557
+ }
558
+ function le(e, r) {
559
+ var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
560
+ if (null != n) {
561
+ var t, o, a, i, u = [], l = !0, c = !1;
562
+ try {
563
+ if (a = (n = n.call(e)).next, 0 === r) {
564
+ if (Object(n) !== n) return;
565
+ l = !1;
566
+ } else for (;!(l = (t = a.call(n)).done) && (u.push(t.value), u.length !== r); l = !0) {
707
567
  }
708
- }
709
- return o;
710
- }
711
- function se(e, r) {
712
- if (null == e) return {};
713
- var n = {};
714
- for (var t in e) {
715
- if ({}.hasOwnProperty.call(e, t)) {
716
- if (-1 !== r.indexOf(t)) continue;
717
- n[t] = e[t];
568
+ } catch (e) {
569
+ c = !0, o = e;
570
+ } finally {
571
+ try {
572
+ if (!l && null != n["return"] && (i = n["return"](), Object(i) !== i)) return;
573
+ } finally {
574
+ if (c) throw o;
718
575
  }
719
576
  }
720
- return n;
577
+ return u;
721
578
  }
722
- function fe(e, r) {
723
- var n = Object.keys(e);
724
- if (Object.getOwnPropertySymbols) {
725
- var t = Object.getOwnPropertySymbols(e);
726
- r && (t = t.filter((function(r) {
727
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
728
- }))), n.push.apply(n, t);
579
+ }
580
+ function ce(e) {
581
+ if (Array.isArray(e)) return e;
582
+ }
583
+ function se(e, r) {
584
+ if (null == e) return {};
585
+ var n, t, o = fe(e, r);
586
+ if (Object.getOwnPropertySymbols) {
587
+ var a = Object.getOwnPropertySymbols(e);
588
+ for (t = 0; t < a.length; t++) {
589
+ n = a[t], -1 === r.indexOf(n) && {}.propertyIsEnumerable.call(e, n) && (o[n] = e[n]);
729
590
  }
730
- return n;
731
591
  }
732
- function ve(e) {
733
- for (var r = 1; r < arguments.length; r++) {
734
- var n = null != arguments[r] ? arguments[r] : {};
735
- r % 2 ? fe(Object(n), !0).forEach((function(r) {
736
- de(e, r, n[r]);
737
- })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : fe(Object(n)).forEach((function(r) {
738
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(n, r));
739
- }));
592
+ return o;
593
+ }
594
+ function fe(e, r) {
595
+ if (null == e) return {};
596
+ var n = {};
597
+ for (var t in e) {
598
+ if ({}.hasOwnProperty.call(e, t)) {
599
+ if (-1 !== r.indexOf(t)) continue;
600
+ n[t] = e[t];
740
601
  }
741
- return e;
742
602
  }
743
- function de(e, r, n) {
744
- return (r = me(r)) in e ? Object.defineProperty(e, r, {
745
- value: n,
746
- enumerable: !0,
747
- configurable: !0,
748
- writable: !0
749
- }) : e[r] = n, e;
603
+ return n;
604
+ }
605
+ function de(e, r) {
606
+ var n = Object.keys(e);
607
+ if (Object.getOwnPropertySymbols) {
608
+ var t = Object.getOwnPropertySymbols(e);
609
+ r && (t = t.filter((function(r) {
610
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
611
+ }))), n.push.apply(n, t);
750
612
  }
751
- function me(e) {
752
- var r = pe(e, "string");
753
- return "symbol" == Q(r) ? r : r + "";
613
+ return n;
614
+ }
615
+ function ve(e) {
616
+ for (var r = 1; r < arguments.length; r++) {
617
+ var n = null != arguments[r] ? arguments[r] : {};
618
+ r % 2 ? de(Object(n), !0).forEach((function(r) {
619
+ me(e, r, n[r]);
620
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : de(Object(n)).forEach((function(r) {
621
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(n, r));
622
+ }));
754
623
  }
755
- function pe(e, r) {
756
- if ("object" != Q(e) || !e) return e;
757
- var n = e[Symbol.toPrimitive];
758
- if (void 0 !== n) {
759
- var t = n.call(e, r || "default");
760
- if ("object" != Q(t)) return t;
761
- throw new TypeError("@@toPrimitive must return a primitive value.");
762
- }
763
- return ("string" === r ? String : Number)(e);
624
+ return e;
625
+ }
626
+ function me(e, r, n) {
627
+ return (r = be(r)) in e ? Object.defineProperty(e, r, {
628
+ value: n,
629
+ enumerable: !0,
630
+ configurable: !0,
631
+ writable: !0
632
+ }) : e[r] = n, e;
633
+ }
634
+ function be(e) {
635
+ var r = pe(e, "string");
636
+ return "symbol" == Y(r) ? r : r + "";
637
+ }
638
+ function pe(e, r) {
639
+ if ("object" != Y(e) || !e) return e;
640
+ var n = e[Symbol.toPrimitive];
641
+ if (void 0 !== n) {
642
+ var t = n.call(e, r || "default");
643
+ if ("object" != Y(t)) return t;
644
+ throw new TypeError("@@toPrimitive must return a primitive value.");
764
645
  }
765
- // TODO(SUI-5920): add transitions to this component in React 18
766
- var be = ve(ve({}, U()(L, "onDownKeyPress", "onEndKeyPress", "onHomeKeyPress", "onUpKeyPress")), {}, {
767
- virtualization: a().number
768
- });
769
- var ye = [];
770
- /**
646
+ return ("string" === r ? String : Number)(e);
647
+ }
648
+ // eslint-disable-next-line no-relative-imports-of-published -- TODO(SUI-8190): VirtualizedResultsMenu wraps ResultsMenu, using external import creates circular dependency
649
+ // TODO(SUI-5920): add transitions to this component in React 18
650
+ var ye = ve(ve({}, z()(_, "onDownKeyPress", "onEndKeyPress", "onHomeKeyPress", "onUpKeyPress")), {}, {
651
+ virtualization: a().number
652
+ });
653
+ var ge = [];
654
+ /**
771
655
  * A wrapper for `ResultsMenu` which virtualizes the `children`. The received `children` array will be split into **"panes"** each with `virtualization` entries
772
656
  * and, at any given time, 3 or fewer of these panes will be rendered in the DOM.
773
657
  *
@@ -785,396 +669,396 @@
785
669
  * @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)
786
670
  * @throws in `__DEV__` when `virtualization` is less than or equal to 1 (`virtualization` must be ≥ 2)
787
671
  * @throws in `__DEV__` when `virtualization` is changed during the lifecycle of the `VirtualizedResultsMenu` component
788
- */ function ge(n) {
789
- var t = n.virtualization, o = t === void 0 ? 2 : t, a = n.elementRef, i = n.children, l = n.focusMode, u = l === void 0 ? "normal" : l, c = ce(n, [ "virtualization", "elementRef", "children", "focusMode" ]);
790
- // @docs-props-type VirtualizedResultsMenuPropsBase
791
- var s = (0, e.useRef)(o);
792
- // If a user tries to set virtualization to a value smaller than the number of options
793
- // visible at a given moment then the menu will flicker endlessly. This state is set in
794
- // the IntersectionObserver to fix the issue, but in `__DEV__` an error is thrown.
795
- var f = (0, e.useState)(o), v = te(f, 2), d = v[0], m = v[1];
672
+ */ function he(e) {
673
+ var r = e.virtualization, o = r === void 0 ? 2 : r, a = e.elementRef, i = e.children, u = e.focusMode, l = u === void 0 ? "normal" : u, c = se(e, [ "virtualization", "elementRef", "children", "focusMode" ]);
674
+ // @docs-props-type VirtualizedResultsMenuPropsBase
675
+ var s = (0, n.useRef)(o);
676
+ // If a user tries to set virtualization to a value smaller than the number of options
677
+ // visible at a given moment then the menu will flicker endlessly. This state is set in
678
+ // the IntersectionObserver to fix the issue, but in `__DEV__` an error is thrown.
679
+ var f = (0, n.useState)(o), d = oe(f, 2), v = d[0], m = d[1];
796
680
  // these refs keep track of whether we need to focus the first/last
797
- // element after the next render
798
- var p = (0, e.useRef)(false);
799
- var b = (0, e.useRef)(false);
800
- var y = (0, e.useRef)(i);
801
- // this code makes the "Home" and "End" keys work by injecting
802
- // an elementRef callback function into the first and last item
803
- // that will attempt to focus the first/last item if appropriate
804
- // we need to do this because if we call focus() right after changePane()
805
- // the new pane won't be in the DOM yet, so the wrong element will end up focused
806
- (0, e.useMemo)((function() {
807
- var r = e.Children.toArray(i);
808
- var n = X(r, 0);
809
- var t = X(r, r.length - 1);
810
- y.current = r.map((function(r, o) {
811
- var a = r;
812
- if (o === n) {
813
- a = (0, e.isValidElement)(r) ? (0, e.cloneElement)(r, {
814
- elementRef: function e(r) {
815
- if (p === null || p === void 0 ? void 0 : p.current) {
816
- p.current = false;
817
- r === null || r === void 0 ? void 0 : r.focus();
818
- }
681
+ // element after the next render
682
+ var b = (0, n.useRef)(false);
683
+ var p = (0, n.useRef)(false);
684
+ var y = (0, n.useRef)(i);
685
+ // this code makes the "Home" and "End" keys work by injecting
686
+ // an elementRef callback function into the first and last item
687
+ // that will attempt to focus the first/last item if appropriate
688
+ // we need to do this because if we call focus() right after changePane()
689
+ // the new pane won't be in the DOM yet, so the wrong element will end up focused
690
+ (0, n.useMemo)((function() {
691
+ var e = n.Children.toArray(i);
692
+ var r = J(e, 0);
693
+ var t = J(e, e.length - 1);
694
+ y.current = e.map((function(e, o) {
695
+ var a = e;
696
+ if (o === r) {
697
+ a = (0, n.isValidElement)(e) ? (0, n.cloneElement)(e, {
698
+ elementRef: function e(r) {
699
+ if (b === null || b === void 0 ? void 0 : b.current) {
700
+ b.current = false;
701
+ r === null || r === void 0 ? void 0 : r.focus();
819
702
  }
820
- }) : r;
821
- } else if (o === t) {
822
- a = (0, e.isValidElement)(r) ? (0, e.cloneElement)(r, {
823
- elementRef: function e(r) {
824
- if (b === null || b === void 0 ? void 0 : b.current) {
825
- b.current = false;
826
- r === null || r === void 0 ? void 0 : r.focus();
827
- }
703
+ }
704
+ }) : e;
705
+ } else if (o === t) {
706
+ a = (0, n.isValidElement)(e) ? (0, n.cloneElement)(e, {
707
+ elementRef: function e(r) {
708
+ if (p === null || p === void 0 ? void 0 : p.current) {
709
+ p.current = false;
710
+ r === null || r === void 0 ? void 0 : r.focus();
828
711
  }
829
- }) : r;
830
- }
831
- return a;
832
- }));
833
- }), [ i ]);
834
- var g = y.current;
835
- (0, e.useEffect)((function() {
836
- if (false) {}
837
- }), [ o ]);
838
- // `useRef` will recompute its initial value every render cycle.
839
- // To avoid the array processing we can provide an initialization function to useState and init the ref with the result
840
- var h = (0, e.useState)((function() {
841
- return K(g, d);
842
- })), S = te(h, 1), E = S[0];
712
+ }
713
+ }) : e;
714
+ }
715
+ return a;
716
+ }));
717
+ }), [ i ]);
718
+ var g = y.current;
719
+ (0, n.useEffect)((function() {
720
+ if (false) {}
721
+ }), [ o ]);
722
+ // `useRef` will recompute its initial value every render cycle.
723
+ // To avoid the array processing we can provide an initialization function to useState and init the ref with the result
724
+ var h = (0, n.useState)((function() {
725
+ return W(g, v);
726
+ })), S = oe(h, 1), E = S[0];
843
727
  // NOSONAR
844
- // `windowPanes` is an array of arrays, each of length `virtualization`. Each "pane" is just a subset of
845
- // `children` which will be rendered in a chunk, and at most 3 of these panes will render at any given time.
846
- var O = (0, e.useRef)(E);
847
- var w = (0, e.useRef)(0);
848
- var C = (0, e.useRef)(null);
849
- // An IntersectionObserver is used to detect when pane changes are needed.
850
- // When loadPrevPaneRef or loadNextPaneRef entries intersect the menu, the currentPaneId will be updated.
851
- var j = (0, e.useRef)();
852
- var x = (0, e.useRef)(ye);
853
- var R = (0, e.useRef)(ye);
854
- var k = (0, e.useCallback)((function() {
855
- var e;
856
- var r = O.current, n = r === void 0 ? [] : r;
857
- var t = w.current;
858
- /**
728
+ // `windowPanes` is an array of arrays, each of length `virtualization`. Each "pane" is just a subset of
729
+ // `children` which will be rendered in a chunk, and at most 3 of these panes will render at any given time.
730
+ var O = (0, n.useRef)(E);
731
+ var M = (0, n.useRef)(0);
732
+ var w = (0, n.useRef)(null);
733
+ // An IntersectionObserver is used to detect when pane changes are needed.
734
+ // When loadPrevPaneRef or loadNextPaneRef entries intersect the menu, the currentPaneId will be updated.
735
+ var k = (0, n.useRef)();
736
+ var j = (0, n.useRef)(ge);
737
+ var I = (0, n.useRef)(ge);
738
+ var R = (0, n.useCallback)((function() {
739
+ var e;
740
+ var r = O.current, n = r === void 0 ? [] : r;
741
+ var t = M.current;
742
+ /**
859
743
  * create onMount for an child of the menu which will be used to trigger pane
860
744
  * changes upon intersection with the menu's visible bounds
861
- */ var o = function e(r) {
862
- return function(e) {
863
- var n;
864
- if (!e) {
865
- return;
866
- }
867
- r.current.push(e);
868
- (n = j.current) === null || n === void 0 ? void 0 : n.observe(e);
869
- };
870
- };
871
- /**
872
- * onUnmount to cleanup the operations of `onVirtualizeMount`
873
- */ var a = function e(r) {
745
+ */ var o = function e(r) {
746
+ return function(e) {
874
747
  var n;
875
- if (!r) {
748
+ if (!e) {
876
749
  return;
877
750
  }
878
- var t = R.current.indexOf(r);
879
- if (t >= 0) {
880
- R.current.splice(t, 1);
881
- }
882
- var o = x.current.indexOf(r);
883
- if (o) {
884
- x.current.splice(o, 1);
885
- }
886
- (n = j.current) === null || n === void 0 ? void 0 : n.unobserve(r);
751
+ r.current.push(e);
752
+ (n = k.current) === null || n === void 0 ? void 0 : n.observe(e);
887
753
  };
888
- return [].concat(Z(J(n[t - 1], o(R), a, {
889
- trackFirstElement: true
890
- })), Z((e = n[t]) !== null && e !== void 0 ? e : []), Z(J(n[t + 1], o(x), a, {
891
- trackLastElement: true
892
- })));
893
- }), []);
894
- var I = (0, e.useState)(k), P = te(I, 2), T = P[0], A = P[1];
895
- var L = (0, e.useCallback)((function(e) {
896
- var r = w.current;
897
- w.current = Math.max(0, Math.min(e, O.current.length - 1));
898
- if (r === w.current) {
899
- // no change in current pane
754
+ };
755
+ /**
756
+ * onUnmount to cleanup the operations of `onVirtualizeMount`
757
+ */ var a = function e(r) {
758
+ var n;
759
+ if (!r) {
900
760
  return;
901
761
  }
902
- A(k);
903
- }), [ k ]);
904
- // Link an IntersectionObserver instance with the menu children to be observed
905
- var _ = (0, e.useCallback)((function(e) {
906
- var r;
907
- M(a, e);
908
- C.current = e;
909
- // This is overly defensive and could probably be removed
910
- (r = j.current) === null || r === void 0 ? void 0 : r.disconnect();
911
- if (!e) {
912
- return;
762
+ var t = I.current.indexOf(r);
763
+ if (t >= 0) {
764
+ I.current.splice(t, 1);
913
765
  }
914
- R.current = [];
915
- x.current = [];
916
- // Run the observation flow
917
- j.current = new IntersectionObserver((function(r) {
918
- var n;
919
- var t = w.current;
920
- var o = e.firstElementChild;
921
- if (!!o && o.scrollHeight < e.clientHeight) {
922
- var a;
923
- // If the first element doesn't require a scrollbar then it's likely a filter input
924
- o = (a = o) === null || a === void 0 ? void 0 : a.nextElementSibling;
925
- }
926
- if (((n = o) === null || n === void 0 ? void 0 : n.scrollTop) === 0 && t === 0 && O.current.length > 1 && r.some((function(e) {
927
- return e.isIntersecting;
928
- }))) {
929
- // The menu hasn't scrolled, is on pane 0, and already has an intersection, the `virtualization` prop is too small
930
- m((function(e) {
931
- return e + 10;
932
- }));
933
- if (false) {}
934
- return;
935
- }
936
- var i = false;
937
- r.forEach((function(e) {
938
- if (i || !e.isIntersecting) {
939
- // don't process if the pane changed or the entry isn't intersecting
940
- return;
941
- }
942
- if (R.current.includes(e.target)) {
943
- i = true;
944
- L(t - 1);
945
- } else if (x.current.includes(e.target)) {
946
- i = true;
947
- L(t + 1);
948
- }
766
+ var o = j.current.indexOf(r);
767
+ if (o) {
768
+ j.current.splice(o, 1);
769
+ }
770
+ (n = k.current) === null || n === void 0 ? void 0 : n.unobserve(r);
771
+ };
772
+ return [].concat(ee(Q(n[t - 1], o(I), a, {
773
+ trackFirstElement: true
774
+ })), ee((e = n[t]) !== null && e !== void 0 ? e : []), ee(Q(n[t + 1], o(j), a, {
775
+ trackLastElement: true
776
+ })));
777
+ }), []);
778
+ var P = (0, n.useState)(R), x = oe(P, 2), A = x[0], T = x[1];
779
+ var L = (0, n.useCallback)((function(e) {
780
+ var r = M.current;
781
+ M.current = Math.max(0, Math.min(e, O.current.length - 1));
782
+ if (r === M.current) {
783
+ // no change in current pane
784
+ return;
785
+ }
786
+ T(R);
787
+ }), [ R ]);
788
+ // Link an IntersectionObserver instance with the menu children to be observed
789
+ var _ = (0, n.useCallback)((function(e) {
790
+ var r;
791
+ C(a, e);
792
+ w.current = e;
793
+ // This is overly defensive and could probably be removed
794
+ (r = k.current) === null || r === void 0 ? void 0 : r.disconnect();
795
+ if (!e) {
796
+ return;
797
+ }
798
+ I.current = [];
799
+ j.current = [];
800
+ // Run the observation flow
801
+ k.current = new IntersectionObserver((function(r) {
802
+ var n;
803
+ var t = M.current;
804
+ var o = e.firstElementChild;
805
+ if (!!o && o.scrollHeight < e.clientHeight) {
806
+ var a;
807
+ // If the first element doesn't require a scrollbar then it's likely a filter input
808
+ o = (a = o) === null || a === void 0 ? void 0 : a.nextElementSibling;
809
+ }
810
+ if (((n = o) === null || n === void 0 ? void 0 : n.scrollTop) === 0 && t === 0 && O.current.length > 1 && r.some((function(e) {
811
+ return e.isIntersecting;
812
+ }))) {
813
+ // The menu hasn't scrolled, is on pane 0, and already has an intersection, the `virtualization` prop is too small
814
+ m((function(e) {
815
+ return e + 10;
949
816
  }));
950
- }), {
951
- root: e
952
- });
953
- }), [ a, L ]);
954
- var q = (0, e.useCallback)((function(e) {
955
- var r = C.current;
956
- if (!r) {
817
+ if (false) {}
957
818
  return;
958
819
  }
959
- e.preventDefault();
960
- var n = e.key;
961
- if (n === "Home") {
962
- var t = w.current === 0;
963
- if (t) {
964
- var o;
965
- // if the first pane is already rendered, find the first element and focus it
966
- var a = (0, z.getSortedTabbableElements)(r, {
967
- ignoreTabIndex: true
968
- });
969
- var i = a[0];
970
- i === null || i === void 0 ? void 0 : (o = i.focus) === null || o === void 0 ? void 0 : o.call(i);
971
- } else {
972
- // if it's not rendered, set up focusing it after the next render
973
- p.current = true;
974
- // then call changePane() to trigger the render
975
- L(0);
820
+ var i = false;
821
+ r.forEach((function(e) {
822
+ if (i || !e.isIntersecting) {
823
+ // don't process if the pane changed or the entry isn't intersecting
824
+ return;
976
825
  }
977
- return;
978
- }
979
- var l = O.current.length - 1;
980
- if (n === "End") {
981
- var u = w.current === l;
982
- if (u) {
983
- var c;
984
- // if the last pane is already rendered, find the first element and focus it
985
- var s = (0, z.getSortedTabbableElements)(r, {
986
- ignoreTabIndex: true
987
- });
988
- var f = s[s.length - 1];
989
- f === null || f === void 0 ? void 0 : (c = f.focus) === null || c === void 0 ? void 0 : c.call(f);
990
- } else {
991
- // if it's not rendered, set up focusing it after the next render
992
- b.current = true;
993
- // then call changePane() to trigger the render
994
- L(l);
826
+ if (I.current.includes(e.target)) {
827
+ i = true;
828
+ L(t - 1);
829
+ } else if (j.current.includes(e.target)) {
830
+ i = true;
831
+ L(t + 1);
995
832
  }
996
- return;
997
- }
998
- var v = (0, z.getSortedTabbableElements)(r, {
999
- ignoreTabIndex: true
1000
- });
1001
- var d = (e === null || e === void 0 ? void 0 : e.target) instanceof Element ? e.target : null;
1002
- var m = r === null || r === void 0 ? void 0 : r.querySelector(":focus");
1003
- var y = d || m;
1004
- var g = y ? v.indexOf(y) : -1;
1005
- (0, z.handleFocus)(n, v, g, {
1006
- enableLoop: false,
1007
- // VirtualizedResultsMenu does not support looping focus
1008
- orientation: "vertical",
1009
- enableTab: false,
1010
- enableHomeEnd: false
1011
- });
1012
- }), [ L ]);
1013
- (0, e.useEffect)((function() {
1014
- m((function(e) {
1015
- if (false) {}
1016
- return o;
1017
833
  }));
1018
- }), [ o ]);
1019
- (0, e.useEffect)((function() {
1020
- O.current = K(g, d);
1021
- A(k);
1022
- }), [ g, d, k ]);
1023
- (0, e.useEffect)((function() {
1024
- return function() {
1025
- var e;
1026
- return (e = j.current) === null || e === void 0 ? void 0 : e.disconnect();
1027
- };
1028
- }), []);
1029
- (0, e.useEffect)((function() {
1030
- if (u === "never") {
1031
- return undefined;
1032
- }
1033
- var e = C.current;
1034
- if (e) {
1035
- e.addEventListener("keydown", q);
834
+ }), {
835
+ root: e
836
+ });
837
+ }), [ a, L ]);
838
+ var q = (0, n.useCallback)((function(e) {
839
+ var r = w.current;
840
+ if (!r) {
841
+ return;
842
+ }
843
+ e.preventDefault();
844
+ var n = e.key;
845
+ if (n === "Home") {
846
+ var t = M.current === 0;
847
+ if (t) {
848
+ var o;
849
+ // if the first pane is already rendered, find the first element and focus it
850
+ var a = (0, V.getSortedTabbableElements)(r, {
851
+ ignoreTabIndex: true
852
+ });
853
+ var i = a[0];
854
+ i === null || i === void 0 ? void 0 : (o = i.focus) === null || o === void 0 ? void 0 : o.call(i);
855
+ } else {
856
+ // if it's not rendered, set up focusing it after the next render
857
+ b.current = true;
858
+ // then call changePane() to trigger the render
859
+ L(0);
1036
860
  }
1037
- return function() {
1038
- e === null || e === void 0 ? void 0 : e.removeEventListener("keydown", q);
1039
- };
1040
- }), [ q, u ]);
1041
-
1042
- return r().createElement(F, Y({
1043
- elementRef: _,
1044
- focusMode: u
1045
- }, c), T);
1046
- }
1047
- ge.propTypes = be;
1048
- // CONCATENATED MODULE: ./src/utils/ssrDocument.ts
1049
- /* eslint-disable @typescript-eslint/no-empty-function */
1050
- var he = {
1051
- body: {
1052
- appendChild: function e() {
1053
- return [];
861
+ return;
862
+ }
863
+ var u = O.current.length - 1;
864
+ if (n === "End") {
865
+ var l = M.current === u;
866
+ if (l) {
867
+ var c;
868
+ // if the last pane is already rendered, find the first element and focus it
869
+ var s = (0, V.getSortedTabbableElements)(r, {
870
+ ignoreTabIndex: true
871
+ });
872
+ var f = s[s.length - 1];
873
+ f === null || f === void 0 ? void 0 : (c = f.focus) === null || c === void 0 ? void 0 : c.call(f);
874
+ } else {
875
+ // if it's not rendered, set up focusing it after the next render
876
+ p.current = true;
877
+ // then call changePane() to trigger the render
878
+ L(u);
1054
879
  }
1055
- },
1056
- addEventListener: function e() {},
1057
- removeEventListener: function e() {},
1058
- activeElement: {
1059
- blur: function e() {},
1060
- nodeName: ""
1061
- },
1062
- querySelector: function e() {
1063
- return null;
1064
- },
1065
- querySelectorAll: function e() {
880
+ return;
881
+ }
882
+ var d = (0, V.getSortedTabbableElements)(r, {
883
+ ignoreTabIndex: true
884
+ });
885
+ var v = (e === null || e === void 0 ? void 0 : e.target) instanceof Element ? e.target : null;
886
+ var m = r === null || r === void 0 ? void 0 : r.querySelector(":focus");
887
+ var y = v || m;
888
+ var g = y ? d.indexOf(y) : -1;
889
+ (0, V.handleFocus)(n, d, g, {
890
+ enableLoop: false,
891
+ // VirtualizedResultsMenu does not support looping focus
892
+ orientation: "vertical",
893
+ enableTab: false,
894
+ enableHomeEnd: false
895
+ });
896
+ }), [ L ]);
897
+ (0, n.useEffect)((function() {
898
+ m((function(e) {
899
+ if (false) {}
900
+ return o;
901
+ }));
902
+ }), [ o ]);
903
+ (0, n.useEffect)((function() {
904
+ O.current = W(g, v);
905
+ T(R);
906
+ }), [ g, v, R ]);
907
+ (0, n.useEffect)((function() {
908
+ return function() {
909
+ var e;
910
+ return (e = k.current) === null || e === void 0 ? void 0 : e.disconnect();
911
+ };
912
+ }), []);
913
+ (0, n.useEffect)((function() {
914
+ if (l === "never") {
915
+ return undefined;
916
+ }
917
+ var e = w.current;
918
+ if (e) {
919
+ e.addEventListener("keydown", q);
920
+ }
921
+ return function() {
922
+ e === null || e === void 0 ? void 0 : e.removeEventListener("keydown", q);
923
+ };
924
+ }), [ q, l ]);
925
+
926
+ return t().createElement(B, Z({
927
+ elementRef: _,
928
+ focusMode: l
929
+ }, c), A);
930
+ }
931
+ he.propTypes = ye;
932
+ // CONCATENATED MODULE: ./src/utils/ssrDocument.ts
933
+ /* eslint-disable @typescript-eslint/no-empty-function */
934
+ var Se = {
935
+ body: {
936
+ appendChild: function e() {
1066
937
  return [];
1067
- },
1068
- getElementById: function e() {
1069
- return null;
1070
- },
1071
- createEvent: function e() {
1072
- return {
1073
- initEvent: function e() {}
1074
- };
1075
- },
1076
- createElement: function e() {
1077
- return {
1078
- children: [],
1079
- childNodes: [],
1080
- style: {},
1081
- setAttribute: function e() {},
1082
- getElementsByTagName: function e() {
1083
- return [];
1084
- }
1085
- };
1086
- },
1087
- createElementNS: function e() {
1088
- return {};
1089
- },
1090
- importNode: function e() {
1091
- return null;
1092
- },
1093
- location: {
1094
- hash: "",
1095
- host: "",
1096
- hostname: "",
1097
- href: "",
1098
- origin: "",
1099
- pathname: "",
1100
- protocol: "",
1101
- search: ""
1102
938
  }
1103
- };
1104
- function Se() {
1105
- var e = typeof document !== "undefined" ? document : he;
1106
- return e;
1107
- }
1108
- var Ee = Se();
1109
- /* harmony default export */ const Oe = /* unused pure expression or super */ null && Ee;
1110
- // CONCATENATED MODULE: ./src/utils/ssrWindow.ts
1111
- /* eslint-disable @typescript-eslint/no-empty-function */
1112
- var we = {
1113
- document: he,
1114
- navigator: {
1115
- userAgent: ""
1116
- },
1117
- location: {
1118
- hash: "",
1119
- host: "",
1120
- hostname: "",
1121
- href: "",
1122
- origin: "",
1123
- pathname: "",
1124
- protocol: "",
1125
- search: ""
1126
- },
1127
- history: {
1128
- replaceState: function e() {},
1129
- pushState: function e() {},
1130
- go: function e() {},
1131
- back: function e() {}
1132
- },
1133
- CustomEvent: function e() {
1134
- return this;
1135
- },
1136
- addEventListener: function e() {},
1137
- removeEventListener: function e() {},
1138
- getComputedStyle: function e() {
1139
- return {
1140
- getPropertyValue: function e() {
1141
- return "";
1142
- }
1143
- };
1144
- },
1145
- Image: function e() {},
1146
- Date: function e() {},
1147
- screen: {},
1148
- setTimeout: function e() {},
1149
- clearTimeout: function e() {},
1150
- matchMedia: function e() {
1151
- return {};
1152
- },
1153
- requestAnimationFrame: function e(r) {
1154
- if (typeof setTimeout === "undefined") {
1155
- r();
1156
- return null;
939
+ },
940
+ addEventListener: function e() {},
941
+ removeEventListener: function e() {},
942
+ activeElement: {
943
+ blur: function e() {},
944
+ nodeName: ""
945
+ },
946
+ querySelector: function e() {
947
+ return null;
948
+ },
949
+ querySelectorAll: function e() {
950
+ return [];
951
+ },
952
+ getElementById: function e() {
953
+ return null;
954
+ },
955
+ createEvent: function e() {
956
+ return {
957
+ initEvent: function e() {}
958
+ };
959
+ },
960
+ createElement: function e() {
961
+ return {
962
+ children: [],
963
+ childNodes: [],
964
+ style: {},
965
+ setAttribute: function e() {},
966
+ getElementsByTagName: function e() {
967
+ return [];
1157
968
  }
1158
- return setTimeout(r, 0);
1159
- },
1160
- cancelAnimationFrame: function e(r) {
1161
- if (typeof setTimeout === "undefined") {
1162
- return;
969
+ };
970
+ },
971
+ createElementNS: function e() {
972
+ return {};
973
+ },
974
+ importNode: function e() {
975
+ return null;
976
+ },
977
+ location: {
978
+ hash: "",
979
+ host: "",
980
+ hostname: "",
981
+ href: "",
982
+ origin: "",
983
+ pathname: "",
984
+ protocol: "",
985
+ search: ""
986
+ }
987
+ };
988
+ function Ee() {
989
+ var e = typeof document !== "undefined" ? document : Se;
990
+ return e;
991
+ }
992
+ var Oe = Ee();
993
+ /* harmony default export */ const Me = /* unused pure expression or super */ null && Oe;
994
+ // CONCATENATED MODULE: ./src/utils/ssrWindow.ts
995
+ /* eslint-disable @typescript-eslint/no-empty-function */
996
+ var we = {
997
+ document: Se,
998
+ navigator: {
999
+ userAgent: ""
1000
+ },
1001
+ location: {
1002
+ hash: "",
1003
+ host: "",
1004
+ hostname: "",
1005
+ href: "",
1006
+ origin: "",
1007
+ pathname: "",
1008
+ protocol: "",
1009
+ search: ""
1010
+ },
1011
+ history: {
1012
+ replaceState: function e() {},
1013
+ pushState: function e() {},
1014
+ go: function e() {},
1015
+ back: function e() {}
1016
+ },
1017
+ CustomEvent: function e() {
1018
+ return this;
1019
+ },
1020
+ addEventListener: function e() {},
1021
+ removeEventListener: function e() {},
1022
+ getComputedStyle: function e() {
1023
+ return {
1024
+ getPropertyValue: function e() {
1025
+ return "";
1163
1026
  }
1164
- clearTimeout(r);
1027
+ };
1028
+ },
1029
+ Image: function e() {},
1030
+ Date: function e() {},
1031
+ screen: {},
1032
+ setTimeout: function e() {},
1033
+ clearTimeout: function e() {},
1034
+ matchMedia: function e() {
1035
+ return {};
1036
+ },
1037
+ requestAnimationFrame: function e(r) {
1038
+ if (typeof setTimeout === "undefined") {
1039
+ r();
1040
+ return null;
1165
1041
  }
1166
- };
1167
- function Me() {
1168
- var e = typeof window !== "undefined" ? window : we;
1169
- return e;
1042
+ return setTimeout(r, 0);
1043
+ },
1044
+ cancelAnimationFrame: function e(r) {
1045
+ if (typeof setTimeout === "undefined") {
1046
+ return;
1047
+ }
1048
+ clearTimeout(r);
1170
1049
  }
1171
- var Ce = Me();
1172
- /* harmony default export */ const je = /* unused pure expression or super */ null && Ce;
1173
- // CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/index.ts
1174
- // In environments without IntersectionObserver support this should just export ResultsMenu
1175
- var xe = "IntersectionObserver" in Me() ? ge : F;
1176
- /* harmony default export */ const Re = xe;
1177
- }) // CONCATENATED MODULE: ./src/ResultsMenu/index.ts
1178
- ();
1179
- module.exports = t;
1050
+ };
1051
+ function Ce() {
1052
+ var e = typeof window !== "undefined" ? window : we;
1053
+ return e;
1054
+ }
1055
+ var ke = Ce();
1056
+ /* harmony default export */ const je = /* unused pure expression or super */ null && ke;
1057
+ // CONCATENATED MODULE: ./src/ResultsMenu/VirtualizedResultsMenu/index.ts
1058
+ // eslint-disable-next-line no-relative-imports-of-published -- TODO(SUI-8190): VirtualizedResultsMenu wraps ResultsMenu, using external import creates circular dependency
1059
+ // In environments without IntersectionObserver support this should just export ResultsMenu
1060
+ var Ie = "IntersectionObserver" in Ce() ? he : B;
1061
+ /* harmony default export */ const Re = Ie;
1062
+ // CONCATENATED MODULE: ./src/ResultsMenu/index.ts
1063
+ module.exports = r;
1180
1064
  /******/})();