@splunk/react-ui 4.33.0 → 4.35.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 (80) hide show
  1. package/Breadcrumbs.js +20 -29
  2. package/Button.js +20 -23
  3. package/ButtonGroup.js +20 -23
  4. package/ButtonSimple.js +33 -34
  5. package/CHANGELOG.md +56 -1
  6. package/Card.js +129 -113
  7. package/Chip.js +75 -82
  8. package/CollapsiblePanel.js +281 -264
  9. package/Color.js +103 -93
  10. package/ComboBox.js +3 -2
  11. package/Concertina.js +139 -138
  12. package/ControlGroup.js +43 -39
  13. package/DualListbox.js +8 -11
  14. package/File.js +25 -30
  15. package/FormRows.js +53 -53
  16. package/Image.js +13 -13
  17. package/JSONTree.js +87 -85
  18. package/List.js +9 -13
  19. package/MIGRATION.mdx +100 -0
  20. package/Markdown.js +12 -12
  21. package/Menu.js +492 -699
  22. package/Message.js +192 -194
  23. package/MessageBar.js +104 -104
  24. package/Modal.js +2 -2
  25. package/Monogram.js +140 -94
  26. package/Multiselect.js +45 -49
  27. package/Paginator.js +8 -8
  28. package/Popover.js +53 -54
  29. package/Progress.js +45 -46
  30. package/RadioBar.js +117 -115
  31. package/RadioList.js +8 -5
  32. package/ResultsMenu.js +272 -279
  33. package/Search.js +197 -199
  34. package/Select.js +86 -84
  35. package/Slider.js +9 -9
  36. package/SplitButton.js +1 -4
  37. package/StaticContent.js +1 -1
  38. package/StepBar.js +92 -88
  39. package/Switch.js +217 -211
  40. package/TabBar.js +13 -5
  41. package/Table.js +714 -717
  42. package/Text.js +94 -83
  43. package/TextArea.js +162 -163
  44. package/Tooltip.js +1 -1
  45. package/package.json +8 -8
  46. package/stubs-splunkui.d.ts +11 -0
  47. package/types/src/Breadcrumbs/Breadcrumbs.d.ts +0 -1
  48. package/types/src/Breadcrumbs/Item.d.ts +0 -1
  49. package/types/src/Card/Card.d.ts +3 -1
  50. package/types/src/Card/Header.d.ts +22 -5
  51. package/types/src/Chip/Chip.d.ts +2 -4
  52. package/types/src/CollapsiblePanel/CollapsiblePanel.d.ts +5 -0
  53. package/types/src/CollapsiblePanel/icons/ExpandPanel.d.ts +1 -3
  54. package/types/src/Color/Color.d.ts +5 -5
  55. package/types/src/ComboBox/Option.d.ts +0 -1
  56. package/types/src/List/List.d.ts +2 -4
  57. package/types/src/Menu/Heading.d.ts +1 -1
  58. package/types/src/Menu/Item.d.ts +10 -5
  59. package/types/src/Menu/Menu.d.ts +18 -26
  60. package/types/src/Menu/MenuContext.d.ts +3 -2
  61. package/types/src/Menu/docs/examples/Dimmed.d.ts +2 -0
  62. package/types/src/Monogram/Monogram.d.ts +5 -6
  63. package/types/src/Multiselect/Option.d.ts +0 -1
  64. package/types/src/Progress/Progress.d.ts +4 -1
  65. package/types/src/RadioBar/Option.d.ts +4 -1
  66. package/types/src/RadioBar/RadioBar.d.ts +6 -4
  67. package/types/src/RadioBar/docs/examples/MenuBar.d.ts +2 -0
  68. package/types/src/ResultsMenu/ResultsMenu.d.ts +13 -28
  69. package/types/src/ResultsMenu/VirtualizedResultsMenu/VirtualizedResultsMenu.d.ts +3 -5
  70. package/types/src/Search/Option.d.ts +19 -6
  71. package/types/src/Search/docs/examples/OptionsLinks.d.ts +2 -0
  72. package/types/src/Select/Option.d.ts +0 -1
  73. package/types/src/Select/OptionBase.d.ts +2 -3
  74. package/types/src/Select/Select.d.ts +2 -2
  75. package/types/src/Select/SelectBase.d.ts +2 -2
  76. package/types/src/Table/Body.d.ts +0 -4
  77. package/types/src/Table/DragHandle.d.ts +1 -2
  78. package/types/src/Text/Text.d.ts +2 -0
  79. package/useRovingFocus.js +26 -40
  80. package/types/src/Select/docs/examples/prisma/Appearance.d.ts +0 -14
package/Menu.js CHANGED
@@ -8,27 +8,27 @@
8
8
  /******/ /* webpack/runtime/compat get default export */
9
9
  /******/ (() => {
10
10
  /******/ // getDefaultExport function for compatibility with non-harmony modules
11
- /******/ e.n = r => {
12
- /******/ var t = r && r.__esModule ?
13
- /******/ () => r["default"]
14
- /******/ : () => r
11
+ /******/ e.n = t => {
12
+ /******/ var r = t && t.__esModule ?
13
+ /******/ () => t["default"]
14
+ /******/ : () => t
15
15
  /******/;
16
- e.d(t, {
17
- a: t
16
+ e.d(r, {
17
+ a: r
18
18
  });
19
- /******/ return t;
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 = (r, t) => {
27
- /******/ for (var n in t) {
28
- /******/ if (e.o(t, n) && !e.o(r, n)) {
29
- /******/ Object.defineProperty(r, n, {
26
+ /******/ e.d = (t, r) => {
27
+ /******/ for (var n in r) {
28
+ /******/ if (e.o(r, n) && !e.o(t, n)) {
29
+ /******/ Object.defineProperty(t, n, {
30
30
  enumerable: true,
31
- get: t[n]
31
+ get: r[n]
32
32
  });
33
33
  /******/ }
34
34
  /******/ }
@@ -37,7 +37,7 @@
37
37
  /******/
38
38
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
39
39
  /******/ (() => {
40
- /******/ e.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
40
+ /******/ e.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
41
41
  /******/;
42
42
  })();
43
43
  /******/
@@ -56,20 +56,20 @@
56
56
  /******/ };
57
57
  /******/ })();
58
58
  /******/
59
- /************************************************************************/ var r = {};
59
+ /************************************************************************/ var t = {};
60
60
  // ESM COMPAT FLAG
61
- e.r(r);
61
+ e.r(t);
62
62
  // EXPORTS
63
- e.d(r, {
64
- Divider: () => /* reexport */ x,
65
- Heading: () => /* reexport */ N,
66
- Item: () => /* reexport */ ze,
63
+ e.d(t, {
64
+ Divider: () => /* reexport */ w,
65
+ Heading: () => /* reexport */ F,
66
+ Item: () => /* reexport */ Ke,
67
67
  MenuContext: () => /* reexport */ y,
68
- default: () => /* reexport */ cr
68
+ default: () => /* reexport */ nt
69
69
  });
70
70
  // CONCATENATED MODULE: external "react"
71
- const t = require("react");
72
- var n = e.n(t);
71
+ const r = require("react");
72
+ var n = e.n(r);
73
73
  // CONCATENATED MODULE: external "prop-types"
74
74
  const i = require("prop-types");
75
75
  var a = e.n(i);
@@ -78,203 +78,205 @@
78
78
  var l = e.n(o);
79
79
  // CONCATENATED MODULE: external "@splunk/react-ui/Popover"
80
80
  const s = require("@splunk/react-ui/Popover");
81
- // CONCATENATED MODULE: external "@splunk/ui-utils/focus"
82
- const c = require("@splunk/ui-utils/focus");
83
81
  // CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
84
- const u = require("@splunk/ui-utils/keyboard");
85
- // CONCATENATED MODULE: external "@splunk/react-ui/useForceUpdate"
86
- const p = require("@splunk/react-ui/useForceUpdate");
87
- var f = e.n(p);
82
+ const c = require("@splunk/ui-utils/keyboard");
83
+ // CONCATENATED MODULE: external "@splunk/ui-utils/focus"
84
+ const p = require("@splunk/ui-utils/focus");
88
85
  // CONCATENATED MODULE: external "styled-components"
89
- const d = require("styled-components");
86
+ const u = require("styled-components");
87
+ var f = e.n(u);
88
+ // CONCATENATED MODULE: external "@splunk/react-ui/Divider"
89
+ const d = require("@splunk/react-ui/Divider");
90
90
  var v = e.n(d);
91
91
  // CONCATENATED MODULE: external "@splunk/themes"
92
92
  const b = require("@splunk/themes");
93
93
  // CONCATENATED MODULE: ./src/Menu/DividerStyles.ts
94
- var m = v().div.withConfig({
94
+ var m = f()(v()).withConfig({
95
95
  displayName: "DividerStyles__Styled",
96
96
  componentId: "l3zfh3-0"
97
- })([ "border-top:1px solid ", ";", "" ], (0, b.pick)({
98
- enterprise: b.variables.borderColor,
99
- prisma: b.variables.neutral200
100
- }), (0, b.pick)({
97
+ })([ "", "" ], (0, b.pick)({
101
98
  prisma: {
102
- comfortable: (0, d.css)([ "margin:8px 0;" ]),
103
- compact: (0, d.css)([ "margin:6px 0;" ])
99
+ comfortable: (0, u.css)([ "margin:8px 0;" ]),
100
+ compact: (0, u.css)([ "margin:6px 0;" ])
104
101
  }
105
102
  }));
106
103
  // CONCATENATED MODULE: ./src/Menu/MenuContext.tsx
107
- var y = (0, t.createContext)({
108
- role: "menu"
104
+ var h = (0, r.createContext)({
105
+ role: "menu",
106
+ preventFocus: false
109
107
  });
108
+ /* harmony default export */ const y = h;
110
109
  // CONCATENATED MODULE: ./src/Menu/Divider.tsx
111
- function h() {
112
- h = Object.assign || function(e) {
113
- for (var r = 1; r < arguments.length; r++) {
114
- var t = arguments[r];
115
- for (var n in t) {
116
- if (Object.prototype.hasOwnProperty.call(t, n)) {
117
- e[n] = t[n];
110
+ function g() {
111
+ g = Object.assign || function(e) {
112
+ for (var t = 1; t < arguments.length; t++) {
113
+ var r = arguments[t];
114
+ for (var n in r) {
115
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
116
+ e[n] = r[n];
118
117
  }
119
118
  }
120
119
  }
121
120
  return e;
122
121
  };
123
- return h.apply(this, arguments);
122
+ return g.apply(this, arguments);
124
123
  }
125
- var g = {};
124
+ var k = {};
126
125
  /**
127
126
  * A non-interactive menu item used to visually separate groups of items in the menu.
128
- */ function k(e) {
129
- var r = h({}, e);
127
+ */ function x(e) {
128
+ var t = g({}, e);
130
129
  // @docs-props-type DividerPropsBase
131
- var i = (0, t.useContext)(y), a = i.role;
130
+ var i = (0, r.useContext)(y), a = i.role;
132
131
 
133
- return n().createElement(m, h({
132
+ return n().createElement(m, g({
134
133
  "aria-hidden": a === "listbox",
135
134
  "data-test": "divider",
136
135
  role: "separator"
137
- }, r));
136
+ }, t));
138
137
  }
139
- k.propTypes = g;
140
- /* Remove the item if it is the first item after filtering */ k.filterFirst = true;
141
- /* Remove consecutive items with filterConsecutive = true (Dividers and Headings) */ k.filterConsecutive = true;
142
- /* Remove the item if it is the last item after filtering. */ k.filterLast = true;
143
- /* Tag the item as Divider */ k.as = "Divider";
144
- /* harmony default export */ const x = k;
138
+ x.propTypes = k;
139
+ /* Remove the item if it is the first item after filtering */ x.filterFirst = true;
140
+ /* Remove consecutive items with filterConsecutive = true (Dividers and Headings) */ x.filterConsecutive = true;
141
+ /* Remove the item if it is the last item after filtering. */ x.filterLast = true;
142
+ /* Tag the item as Divider */ x.as = "Divider";
143
+ /* harmony default export */ const w = x;
145
144
  // CONCATENATED MODULE: external "@splunk/react-ui/Heading"
146
- const w = require("@splunk/react-ui/Heading");
147
- var S = e.n(w);
145
+ const S = require("@splunk/react-ui/Heading");
146
+ var O = e.n(S);
148
147
  // CONCATENATED MODULE: external "@splunk/themes/useSplunkTheme"
149
- const O = require("@splunk/themes/useSplunkTheme");
150
- var C = e.n(O);
148
+ const C = require("@splunk/themes/useSplunkTheme");
149
+ var I = e.n(C);
151
150
  // CONCATENATED MODULE: ./src/Menu/HeadingStyles.ts
152
- var P = v().div.withConfig({
151
+ var P = f().div.withConfig({
153
152
  displayName: "HeadingStyles__Styled",
154
153
  componentId: "mcd2ws-0"
155
- })([ "", " border-top:1px solid transparent;padding:", ";&:not(:first-child){", ";}" ], b.mixins.reset("block"), (0,
154
+ })([ "", " border-top:1px solid transparent;", ";&:not(:first-child){", ";}" ], b.mixins.reset("block"), (0,
156
155
  b.pick)({
157
- enterprise: (0, d.css)([ "", " ", " 6px" ], b.variables.spacingQuarter, b.variables.spacingHalf),
156
+ enterprise: (0, u.css)([ "padding:", " ", " 6px;" ], b.variables.spacingXSmall, b.variables.spacingSmall),
158
157
  prisma: {
159
- comfortable: "13px 16px 10px 16px",
160
- compact: "9px 16px 6px 16px"
158
+ comfortable: "padding: 13px 16px 10px 16px",
159
+ compact: "padding: 9px 16px 6px 16px"
161
160
  }
162
161
  }), (0, b.pick)({
163
- enterprise: (0, d.css)([ "border-top:", ";" ], b.variables.border),
162
+ enterprise: (0, u.css)([ "border-top:", ";" ], b.variables.border),
164
163
  prisma: {
165
- comfortable: (0, d.css)([ "border-top:1px solid ", ";margin-top:6px;padding-top:19px;" ], b.variables.neutral200),
166
- compact: (0, d.css)([ "border-top:1px solid ", ";margin-top:6px;padding-top:15px;" ], b.variables.neutral200)
164
+ comfortable: (0, u.css)([ "border-top:1px solid ", ";margin-top:6px;padding-top:19px;" ], b.variables.neutral200),
165
+ compact: (0, u.css)([ "border-top:1px solid ", ";margin-top:6px;padding-top:15px;" ], b.variables.neutral200)
167
166
  }
168
167
  }));
169
- var I = v().h5.withConfig({
168
+ var _ = f().h5.withConfig({
170
169
  displayName: "HeadingStyles__PrismaSectionTitle",
171
170
  componentId: "mcd2ws-1"
172
171
  })([ "", " font-size:", ";line-height:", ";font-weight:", ";letter-spacing:0.02em;" ], b.mixins.reset("block"), b.variables.fontSizeSmall, b.variables.lineHeight, b.variables.fontWeightBold);
173
172
  // CONCATENATED MODULE: ./src/Menu/Heading.tsx
174
- function j(e, r) {
175
- var t = Object.keys(e);
173
+ function j() {
174
+ j = Object.assign || function(e) {
175
+ for (var t = 1; t < arguments.length; t++) {
176
+ var r = arguments[t];
177
+ for (var n in r) {
178
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
179
+ e[n] = r[n];
180
+ }
181
+ }
182
+ }
183
+ return e;
184
+ };
185
+ return j.apply(this, arguments);
186
+ }
187
+ function E(e, t) {
188
+ var r = Object.keys(e);
176
189
  if (Object.getOwnPropertySymbols) {
177
190
  var n = Object.getOwnPropertySymbols(e);
178
- if (r) n = n.filter((function(r) {
179
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
191
+ if (t) n = n.filter((function(t) {
192
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
180
193
  }));
181
- t.push.apply(t, n);
194
+ r.push.apply(r, n);
182
195
  }
183
- return t;
196
+ return r;
184
197
  }
185
- function E(e) {
186
- for (var r = 1; r < arguments.length; r++) {
187
- var t = arguments[r] != null ? arguments[r] : {};
188
- if (r % 2) {
189
- j(Object(t), true).forEach((function(r) {
190
- _(e, r, t[r]);
198
+ function T(e) {
199
+ for (var t = 1; t < arguments.length; t++) {
200
+ var r = arguments[t] != null ? arguments[t] : {};
201
+ if (t % 2) {
202
+ E(Object(r), true).forEach((function(t) {
203
+ D(e, t, r[t]);
191
204
  }));
192
205
  } else if (Object.getOwnPropertyDescriptors) {
193
- Object.defineProperties(e, Object.getOwnPropertyDescriptors(t));
206
+ Object.defineProperties(e, Object.getOwnPropertyDescriptors(r));
194
207
  } else {
195
- j(Object(t)).forEach((function(r) {
196
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
208
+ E(Object(r)).forEach((function(t) {
209
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
197
210
  }));
198
211
  }
199
212
  }
200
213
  return e;
201
214
  }
202
- function _(e, r, t) {
203
- if (r in e) {
204
- Object.defineProperty(e, r, {
205
- value: t,
215
+ function D(e, t, r) {
216
+ if (t in e) {
217
+ Object.defineProperty(e, t, {
218
+ value: r,
206
219
  enumerable: true,
207
220
  configurable: true,
208
221
  writable: true
209
222
  });
210
223
  } else {
211
- e[r] = t;
224
+ e[t] = r;
212
225
  }
213
226
  return e;
214
227
  }
215
- function T() {
216
- T = Object.assign || function(e) {
217
- for (var r = 1; r < arguments.length; r++) {
218
- var t = arguments[r];
219
- for (var n in t) {
220
- if (Object.prototype.hasOwnProperty.call(t, n)) {
221
- e[n] = t[n];
222
- }
223
- }
224
- }
225
- return e;
226
- };
227
- return T.apply(this, arguments);
228
- }
229
- function R(e, r) {
228
+ function q(e, t) {
230
229
  if (e == null) return {};
231
- var t = D(e, r);
230
+ var r = R(e, t);
232
231
  var n, i;
233
232
  if (Object.getOwnPropertySymbols) {
234
233
  var a = Object.getOwnPropertySymbols(e);
235
234
  for (i = 0; i < a.length; i++) {
236
235
  n = a[i];
237
- if (r.indexOf(n) >= 0) continue;
236
+ if (t.indexOf(n) >= 0) continue;
238
237
  if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
239
- t[n] = e[n];
238
+ r[n] = e[n];
240
239
  }
241
240
  }
242
- return t;
241
+ return r;
243
242
  }
244
- function D(e, r) {
243
+ function R(e, t) {
245
244
  if (e == null) return {};
246
- var t = {};
245
+ var r = {};
247
246
  var n = Object.keys(e);
248
247
  var i, a;
249
248
  for (a = 0; a < n.length; a++) {
250
249
  i = n[a];
251
- if (r.indexOf(i) >= 0) continue;
252
- t[i] = e[i];
250
+ if (t.indexOf(i) >= 0) continue;
251
+ r[i] = e[i];
253
252
  }
254
- return t;
253
+ return r;
255
254
  }
256
- var q = {
255
+ var N = {
257
256
  children: a().node,
258
257
  title: a().bool,
259
258
  outerStyle: a().object
260
259
  };
261
260
  /**
262
261
  * A non-interactive `Menu` item used to separate and label groups of `Menu` items.
263
- */ function K(e) {
264
- var r = e.children, i = e.title, a = e.outerStyle, o = R(e, [ "children", "title", "outerStyle" ]);
265
- var l = (0, t.useContext)(y), s = l.role;
266
- var c = C()(), u = c.family;
267
- var p = u === "prisma" ? n().createElement(I, T({
268
- as: i ? "h4" : "h5",
269
- style: a,
270
- "data-test": "heading"
271
- }, o), r) : n().createElement(S(), T({
272
- style: E(E({}, a), {}, {
262
+ */ function H(e) {
263
+ var t = e.children, i = e.outerStyle, a = e.title, o = q(e, [ "children", "outerStyle", "title" ]);
264
+ var l = (0, r.useContext)(y), s = l.role;
265
+ var c = I()(), p = c.family;
266
+ var u = (0, r.useMemo)((function() {
267
+ return T(T({}, i), {}, {
273
268
  margin: 0
274
- }),
275
- level: i ? 4 : "ss",
276
- "data-test": "heading"
277
- }, o), r);
269
+ });
270
+ }), [ i ]);
271
+ var f = p === "prisma" ? n().createElement(_, j({
272
+ as: a ? "h4" : "h5",
273
+ "data-test": "heading",
274
+ style: i
275
+ }, o), t) : n().createElement(O(), j({
276
+ "data-test": "heading",
277
+ level: a ? 4 : "ss",
278
+ style: u
279
+ }, o), t);
278
280
  // headings are not supported in role="listbox"
279
281
  // this causes Firefox to incorrectly read the total number
280
282
  // of items in the list if it contains a heading or divider
@@ -282,61 +284,64 @@
282
284
 
283
285
  return n().createElement(P, {
284
286
  "aria-hidden": s === "listbox"
285
- }, p);
287
+ }, f);
286
288
  }
287
- K.propTypes = q;
288
- /* Remove consecutive items with filterConsecutive = true (Dividers and Headings) */ K.filterConsecutive = true;
289
- /* Remove the item if it is the last item after filtering. */ K.filterLast = true;
290
- /* Tag the item as a Heading */ K.as = "Heading";
291
- /* harmony default export */ const N = K;
289
+ H.propTypes = N;
290
+ /* Remove consecutive items with filterConsecutive = true (Dividers and Headings) */ H.filterConsecutive = true;
291
+ /* Remove the item if it is the last item after filtering. */ H.filterLast = true;
292
+ /* Tag the item as a Heading */ H.as = "Heading";
293
+ /* harmony default export */ const F = H;
292
294
  // CONCATENATED MODULE: external "lodash/isString"
293
- const H = require("lodash/isString");
294
- var A = e.n(H);
295
+ const $ = require("lodash/isString");
296
+ var A = e.n($);
295
297
  // CONCATENATED MODULE: external "@splunk/react-icons/ChevronRight"
296
- const F = require("@splunk/react-icons/ChevronRight");
297
- var $ = e.n(F);
298
+ const M = require("@splunk/react-icons/ChevronRight");
299
+ var L = e.n(M);
298
300
  // CONCATENATED MODULE: external "@splunk/react-icons/Checkmark"
299
- const M = require("@splunk/react-icons/Checkmark");
300
- var z = e.n(M);
301
+ const z = require("@splunk/react-icons/Checkmark");
302
+ var K = e.n(z);
301
303
  // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Check"
302
- const L = require("@splunk/react-icons/enterprise/Check");
303
- var U = e.n(L);
304
- // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/ChevronRight"
305
- const W = require("@splunk/react-icons/enterprise/ChevronRight");
304
+ const W = require("@splunk/react-icons/enterprise/Check");
306
305
  var B = e.n(W);
307
- // CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
308
- const G = require("@splunk/react-ui/Clickable");
306
+ // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/ChevronRight"
307
+ const G = require("@splunk/react-icons/enterprise/ChevronRight");
309
308
  var V = e.n(G);
309
+ // CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
310
+ const U = require("@splunk/react-ui/Clickable");
311
+ var X = e.n(U);
310
312
  // CONCATENATED MODULE: external "@splunk/react-ui/Switch"
311
- const Q = require("@splunk/react-ui/Switch");
312
- var Y = e.n(Q);
313
+ const Y = require("@splunk/react-ui/Switch");
314
+ var J = e.n(Y);
313
315
  // CONCATENATED MODULE: ./src/Menu/ItemStyles.ts
314
- var J = (0, d.css)([ "color:", ";font-size:", ";line-height:", ";overflow:inherit;white-space:inherit;text-overflow:inherit;" ], (0,
316
+ var Q = (0, u.css)([ "color:", ";font-size:", ";line-height:", ";overflow:inherit;white-space:inherit;text-overflow:inherit;" ], (0,
315
317
  b.pick)({
316
318
  prisma: b.variables.contentColorDefault,
317
319
  enterprise: b.variables.textGray
318
320
  }), b.variables.fontSizeSmall, (0, b.pick)({
319
321
  prisma: "16px"
320
322
  }));
321
- var X = v().span.withConfig({
323
+ var Z = f().span.withConfig({
322
324
  displayName: "ItemStyles__StyledItemDescriptionBottom",
323
325
  componentId: "sc-4kc053-0"
324
- })([ "", ";display:block;" ], J);
325
- var Z = v().span.withConfig({
326
+ })([ "", ";display:block;" ], Q);
327
+ var ee = f().span.withConfig({
326
328
  displayName: "ItemStyles__StyledItemDescriptionRight",
327
329
  componentId: "sc-4kc053-1"
328
- })([ "", ";float:right;padding-left:", ";max-width:50%;text-align:right;box-sizing:border-box;" ], J, b.variables.spacing);
329
- var ee = v().div.withConfig({
330
+ })([ "", ";float:right;", " max-width:50%;text-align:right;box-sizing:border-box;" ], Q, (0,
331
+ b.pick)({
332
+ enterprise: (0, u.css)([ "padding-left:", ";" ], b.variables.spacingLarge)
333
+ }));
334
+ var te = f().div.withConfig({
330
335
  displayName: "ItemStyles__StyledItemSelectedIcon",
331
336
  componentId: "sc-4kc053-2"
332
337
  })([ "position:absolute;", " color:", ";" ], (0, b.pick)({
333
- prisma: (0, d.css)([ "right:16px;" ]),
334
- enterprise: (0, d.css)([ "right:3px;left:8px;" ])
338
+ prisma: (0, u.css)([ "right:16px;" ]),
339
+ enterprise: (0, u.css)([ "right:3px;left:8px;" ])
335
340
  }), (0, b.pick)({
336
341
  prisma: b.variables.contentColorActive,
337
342
  enterprise: b.variables.accentColorL10
338
343
  }));
339
- var re = v().span.withConfig({
344
+ var re = f().span.withConfig({
340
345
  displayName: "ItemStyles__StyledItemIcon",
341
346
  componentId: "sc-4kc053-3"
342
347
  })([ "flex:0 0 auto;padding-right:", ";min-width:10px;display:inline-block;text-align:center;vertical-align:", ";", "" ], (0,
@@ -347,13 +352,13 @@
347
352
  prisma: "initial",
348
353
  enterprise: "middle"
349
354
  }), (0, b.pick)({
350
- prisma: (0, d.css)([ "color:", ";display:inline-flex;align-items:center;min-width:20px;min-height:20px;& > svg{width:20px;height:20px;}" ], b.variables.contentColorMuted),
351
- enterprise: (0, d.css)([ "transform:translateY(-1px);" ])
355
+ prisma: (0, u.css)([ "color:", ";display:inline-flex;align-items:center;min-width:20px;min-height:20px;& > svg{width:20px;height:20px;}" ], b.variables.contentColorMuted),
356
+ enterprise: (0, u.css)([ "transform:translateY(-1px);" ])
352
357
  }));
353
- var te = v()(V()).withConfig({
358
+ var ne = f()(X()).withConfig({
354
359
  displayName: "ItemStyles__StyledClickable",
355
360
  componentId: "sc-4kc053-4"
356
- })([ "display:block;position:relative;cursor:pointer;color:", ";word-wrap:break-word;max-width:100%;width:100%;padding:", ";", " ", " ", " &:not([disabled]){&:hover{background:", ";", "}&:focus{outline:0;box-shadow:", ";", "}", " ", "}&[disabled]{color:", ";cursor:not-allowed;", ",", "{color:inherit;}", "{cursor:not-allowed;color:", ";}", "}", "" ], (0,
361
+ })([ "display:block;position:relative;cursor:pointer;color:", ";word-wrap:break-word;max-width:100%;width:100%;padding:", ";", " ", " ", " &:not([disabled],[aria-disabled='true']){&:hover{background:", ";", "}", " ", "}&:focus{outline:0;box-shadow:", ";", "}&[disabled],&[aria-disabled='true']{color:", ";cursor:not-allowed;", ",", "{color:inherit;}", "{cursor:not-allowed;color:", ";}", "}", "" ], (0,
357
362
  b.pick)({
358
363
  prisma: b.variables.contentColorActive,
359
364
  enterprise: {
@@ -367,21 +372,21 @@
367
372
  },
368
373
  enterprise: "6px 10px"
369
374
  }), (function(e) {
370
- var r = e.$isSelectable, t = e.$selectableAppearance;
371
- return r && (0, b.pick)({
372
- prisma: (0, d.css)([ "padding-right:44px;", "" ], (function() {
373
- return t === "checkbox" && "padding-left: 42px;";
375
+ var t = e.$isSelectable, r = e.$selectableAppearance;
376
+ return t && (0, b.pick)({
377
+ prisma: (0, u.css)([ "padding-right:44px;", "" ], (function() {
378
+ return r === "checkbox" && "padding-left: 42px;";
374
379
  })),
375
- enterprise: (0, d.css)([ "padding-right:10px;padding-left:", ";" ], (function() {
376
- return t === "checkbox" ? "32px" : "28px";
380
+ enterprise: (0, u.css)([ "padding-right:10px;padding-left:", ";" ], (function() {
381
+ return r === "checkbox" ? "32px" : "28px";
377
382
  }))
378
383
  });
379
384
  }), (function(e) {
380
- var r = e.$active, t = e.$preventFocus;
381
- return r && !t && (0, d.css)([ "box-shadow:", ";" ], b.variables.focusShadowInset);
385
+ var t = e.$active, r = e.$preventFocus;
386
+ return t && !r && (0, u.css)([ "box-shadow:", ";" ], b.variables.focusShadowInset);
382
387
  }), (function(e) {
383
- var r = e.$active;
384
- return r && (0, d.css)([ "background:", ";font-weight:", ";" ], (0, b.pick)({
388
+ var t = e.$active;
389
+ return t && (0, u.css)([ "background:", ";font-weight:", ";" ], (0, b.pick)({
385
390
  enterprise: {
386
391
  light: b.variables.gray92,
387
392
  dark: b.variables.gray22
@@ -392,19 +397,19 @@
392
397
  prisma: b.variables.interactiveColorOverlayHover,
393
398
  enterprise: b.variables.backgroundColorHover
394
399
  }), (function(e) {
395
- var r = e.$selected;
396
- return r && (0, b.pick)({
397
- prisma: (0, d.css)([ "background:", ";" ], b.mixins.overlayColors(b.variables.interactiveColorOverlaySelected, b.variables.interactiveColorOverlayHover))
400
+ var t = e.$selected;
401
+ return t && (0, b.pick)({
402
+ prisma: (0, u.css)([ "background:", ";" ], b.mixins.overlayColors(b.variables.interactiveColorOverlaySelected, b.variables.interactiveColorOverlayHover))
398
403
  });
399
- }), b.variables.focusShadowInset, (0, b.pick)({
400
- prisma: (0, d.css)([ "background:", ";" ], b.variables.interactiveColorOverlayHover)
401
404
  }), (0, b.pick)({
402
- prisma: (0, d.css)([ "&:active{background:", ";}" ], b.variables.interactiveColorOverlayActive)
405
+ prisma: (0, u.css)([ "&:active{background:", ";}" ], b.variables.interactiveColorOverlayActive)
403
406
  }), (function(e) {
404
- var r = e.$selected;
405
- return r && (0, b.pick)({
406
- prisma: (0, d.css)([ "background:", ";&:active{background:", ";}" ], b.variables.interactiveColorOverlaySelected, b.mixins.overlayColors(b.variables.interactiveColorOverlaySelected, b.variables.interactiveColorOverlayActive))
407
+ var t = e.$selected;
408
+ return t && (0, b.pick)({
409
+ prisma: (0, u.css)([ "background:", ";&:active{background:", ";}" ], b.variables.interactiveColorOverlaySelected, b.mixins.overlayColors(b.variables.interactiveColorOverlaySelected, b.variables.interactiveColorOverlayActive))
407
410
  });
411
+ }), b.variables.focusShadowInset, (0, b.pick)({
412
+ prisma: (0, u.css)([ "background:", ";" ], b.variables.interactiveColorOverlayHover)
408
413
  }), (0, b.pick)({
409
414
  enterprise: {
410
415
  light: b.variables.gray45,
@@ -413,26 +418,26 @@
413
418
  prisma: b.variables.contentColorDisabled
414
419
  }),
415
420
  /* sc-sel */
416
- X,
417
- /* sc-sel */
418
421
  Z,
419
422
  /* sc-sel */
420
- ee, (0, b.pick)({
423
+ ee,
424
+ /* sc-sel */
425
+ te, (0, b.pick)({
421
426
  prisma: b.variables.contentColorDisabled,
422
427
  enterprise: b.variables.gray80
423
428
  }), (0, b.pick)({
424
- prisma: (0, d.css)([ "& > * > ", "{color:", ";}" ],
429
+ prisma: (0, u.css)([ "& > * > ", "{color:", ";}" ],
425
430
  /* sc-sel */
426
431
  re, b.variables.contentColorDisabled)
427
432
  }), (function(e) {
428
- var r = e.$selected;
429
- return r && (0, b.pick)({
430
- prisma: (0, d.css)([ "", "{color:", ";}" ],
433
+ var t = e.$selected;
434
+ return t && (0, b.pick)({
435
+ prisma: (0, u.css)([ "", "{color:", ";}" ],
431
436
  /* sc-sel */
432
437
  re, b.variables.contentColorActive)
433
438
  });
434
439
  }));
435
- var ne = v()(Y()).withConfig({
440
+ var ie = f()(J()).withConfig({
436
441
  displayName: "ItemStyles__StyledSwitch",
437
442
  componentId: "sc-4kc053-5"
438
443
  })([ "position:absolute;left:", ";top:", ";" ], (0, b.pick)({
@@ -445,25 +450,25 @@
445
450
  compact: "2px"
446
451
  }
447
452
  }));
448
- var ie = v().span.withConfig({
453
+ var ae = f().span.withConfig({
449
454
  displayName: "ItemStyles__StyledInnerWrapper",
450
455
  componentId: "sc-4kc053-6"
451
456
  })([ "display:flex;align-items:flex-start;" ]);
452
- var ae = v().span.withConfig({
457
+ var oe = f().span.withConfig({
453
458
  displayName: "ItemStyles__StyledTitleAndDescriptionWrapper",
454
459
  componentId: "sc-4kc053-7"
455
460
  })([ "display:flex;flex-wrap:wrap;flex-direction:column;max-width:100%;width:100%;align-self:center;word-break:break-word;white-space:normal;", "" ], (function(e) {
456
- var r = e.$truncate;
457
- return r && (0, d.css)([ "white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ]);
461
+ var t = e.$truncate;
462
+ return t && (0, u.css)([ "white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ]);
458
463
  }));
459
- var oe = v().div.withConfig({
464
+ var le = f().div.withConfig({
460
465
  displayName: "ItemStyles__StyledLabel",
461
466
  componentId: "sc-4kc053-8"
462
467
  })([ "overflow:inherit;white-space:inherit;text-overflow:inherit;max-width:100%;min-height:20px;", "" ], (function(e) {
463
- var r = e.$truncate;
464
- return r && (0, d.css)([ "display:block;clear:both;" ]);
468
+ var t = e.$truncate;
469
+ return t && (0, u.css)([ "display:block;clear:both;" ]);
465
470
  }));
466
- var le = v().span.withConfig({
471
+ var se = f().span.withConfig({
467
472
  displayName: "ItemStyles__StyledMatch",
468
473
  componentId: "sc-4kc053-9"
469
474
  })([ "border-bottom:1px solid ", ";" ], (0, b.pick)({
@@ -473,7 +478,7 @@
473
478
  light: b.variables.gray45
474
479
  }
475
480
  }));
476
- var se = v().span.withConfig({
481
+ var ce = f().span.withConfig({
477
482
  displayName: "ItemStyles__StyledSubmenu",
478
483
  componentId: "sc-4kc053-10"
479
484
  })([ "float:right;padding-left:", ";color:", ";", "" ], b.variables.spacingSmall, (0,
@@ -481,39 +486,39 @@
481
486
  prisma: "inherit",
482
487
  enterprise: b.variables.textGray
483
488
  }), (0, b.pick)({
484
- prisma: (0, d.css)([ "& > svg{width:20px;height:20px;}" ])
489
+ prisma: (0, u.css)([ "& > svg{width:20px;height:20px;}" ])
485
490
  }));
486
491
  // CONCATENATED MODULE: external "@splunk/react-icons/ArrowSquareTopRight"
487
- const ce = require("@splunk/react-icons/ArrowSquareTopRight");
488
- var ue = e.n(ce);
492
+ const pe = require("@splunk/react-icons/ArrowSquareTopRight");
493
+ var ue = e.n(pe);
489
494
  // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/External"
490
- const pe = require("@splunk/react-icons/enterprise/External");
491
- var fe = e.n(pe);
495
+ const fe = require("@splunk/react-icons/enterprise/External");
496
+ var de = e.n(fe);
492
497
  // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
493
- const de = require("@splunk/ui-utils/i18n");
498
+ const ve = require("@splunk/ui-utils/i18n");
494
499
  // CONCATENATED MODULE: ./src/Menu/icons/External.tsx
495
- var ve = (0, de._)("Open externally");
496
- var be = (0, d.css)([ "width:0.8em;height:0.8em;vertical-align:baseline;" ]);
497
- var me = v()(fe()).withConfig({
500
+ var be = (0, ve._)("Open externally");
501
+ var me = (0, u.css)([ "width:0.8em;height:0.8em;vertical-align:baseline;" ]);
502
+ var he = f()(de()).withConfig({
498
503
  displayName: "External__StyledEnterprise",
499
504
  componentId: "sc-1turs2s-0"
500
- })([ "", " margin:0 0 0 3px;" ], be);
501
- var ye = v()(ue()).withConfig({
505
+ })([ "", " margin:0 0 0 3px;" ], me);
506
+ var ye = f()(ue()).withConfig({
502
507
  displayName: "External__StyledPrisma",
503
508
  componentId: "sc-1turs2s-1"
504
- })([ "", " margin:0 0 0 4px;" ], be);
505
- function he() {
506
- var e = (0, b.useSplunkTheme)(), r = e.isEnterprise, t = e.isCompact;
507
- var i = t ? "20px" : "24px";
508
- return r ? n().createElement(me, {
509
- screenReaderText: ve
509
+ })([ "", " margin:0 0 0 4px;" ], me);
510
+ function ge() {
511
+ var e = (0, b.useSplunkTheme)(), t = e.isEnterprise, r = e.isCompact;
512
+ var i = r ? "20px" : "24px";
513
+ return t ? n().createElement(he, {
514
+ screenReaderText: be
510
515
  }) : n().createElement(ye, {
511
- "aria-label": ve,
516
+ "aria-label": be,
512
517
  height: i,
513
518
  width: i
514
- }, n().createElement("title", null, ve));
519
+ }, n().createElement("title", null, be));
515
520
  }
516
- /* harmony default export */ const ge = he;
521
+ /* harmony default export */ const ke = ge;
517
522
  // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
518
523
  /**
519
524
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
@@ -521,156 +526,156 @@
521
526
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
522
527
  * @param current - The new value of the ref.
523
528
  */
524
- function ke(e, r) {
529
+ function xe(e, t) {
525
530
  if (e) {
526
531
  if (typeof e === "function") {
527
- e(r);
532
+ e(t);
528
533
  } else {
529
534
  // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
530
535
  // the intention here is to signal "we will take care of setting 'current', not you".
531
- e.current = r;
536
+ e.current = t;
532
537
  // eslint-disable-line no-param-reassign
533
538
  }
534
539
  }
535
540
  }
536
541
  // CONCATENATED MODULE: ./src/utils/scrollIntoViewIfNeeded.ts
537
542
  // A utility that attempts to move an element into view by scrolling it's derived parent.
538
- var xe = function e(r) {
539
- if (!r) {
543
+ var we = function e(t) {
544
+ if (!t) {
540
545
  return;
541
546
  }
542
- var t = r.offsetParent;
543
- if (!t) {
547
+ var r = t.offsetParent;
548
+ if (!r) {
544
549
  return;
545
550
  }
546
551
  // Below the bottom of the container.
547
- if (t.scrollTop + t.clientHeight < r.offsetTop + r.clientHeight) {
548
- t.scrollTop = r.offsetTop + r.clientHeight - t.clientHeight;
552
+ if (r.scrollTop + r.clientHeight < t.offsetTop + t.clientHeight) {
553
+ r.scrollTop = t.offsetTop + t.clientHeight - r.clientHeight;
549
554
  // Above the top of the container.
550
- } else if (t.scrollTop > r.offsetTop) {
551
- t.scrollTop = r.offsetTop;
555
+ } else if (r.scrollTop > t.offsetTop) {
556
+ r.scrollTop = t.offsetTop;
552
557
  }
553
558
  };
554
559
  // CONCATENATED MODULE: ./src/Menu/Item.tsx
555
- function we(e) {
560
+ function Se(e) {
556
561
  "@babel/helpers - typeof";
557
562
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
558
- we = function e(r) {
559
- return typeof r;
563
+ Se = function e(t) {
564
+ return typeof t;
560
565
  };
561
566
  } else {
562
- we = function e(r) {
563
- return r && typeof Symbol === "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
567
+ Se = function e(t) {
568
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
564
569
  };
565
570
  }
566
- return we(e);
571
+ return Se(e);
567
572
  }
568
- function Se() {
569
- Se = Object.assign || function(e) {
570
- for (var r = 1; r < arguments.length; r++) {
571
- var t = arguments[r];
572
- for (var n in t) {
573
- if (Object.prototype.hasOwnProperty.call(t, n)) {
574
- e[n] = t[n];
573
+ function Oe() {
574
+ Oe = Object.assign || function(e) {
575
+ for (var t = 1; t < arguments.length; t++) {
576
+ var r = arguments[t];
577
+ for (var n in r) {
578
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
579
+ e[n] = r[n];
575
580
  }
576
581
  }
577
582
  }
578
583
  return e;
579
584
  };
580
- return Se.apply(this, arguments);
585
+ return Oe.apply(this, arguments);
581
586
  }
582
- function Oe(e, r) {
587
+ function Ce(e, t) {
583
588
  if (e == null) return {};
584
- var t = Ce(e, r);
589
+ var r = Ie(e, t);
585
590
  var n, i;
586
591
  if (Object.getOwnPropertySymbols) {
587
592
  var a = Object.getOwnPropertySymbols(e);
588
593
  for (i = 0; i < a.length; i++) {
589
594
  n = a[i];
590
- if (r.indexOf(n) >= 0) continue;
595
+ if (t.indexOf(n) >= 0) continue;
591
596
  if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
592
- t[n] = e[n];
597
+ r[n] = e[n];
593
598
  }
594
599
  }
595
- return t;
600
+ return r;
596
601
  }
597
- function Ce(e, r) {
602
+ function Ie(e, t) {
598
603
  if (e == null) return {};
599
- var t = {};
604
+ var r = {};
600
605
  var n = Object.keys(e);
601
606
  var i, a;
602
607
  for (a = 0; a < n.length; a++) {
603
608
  i = n[a];
604
- if (r.indexOf(i) >= 0) continue;
605
- t[i] = e[i];
609
+ if (t.indexOf(i) >= 0) continue;
610
+ r[i] = e[i];
606
611
  }
607
- return t;
612
+ return r;
608
613
  }
609
- function Pe(e, r) {
610
- if (!(e instanceof r)) {
614
+ function Pe(e, t) {
615
+ if (!(e instanceof t)) {
611
616
  throw new TypeError("Cannot call a class as a function");
612
617
  }
613
618
  }
614
- function Ie(e, r) {
615
- for (var t = 0; t < r.length; t++) {
616
- var n = r[t];
619
+ function _e(e, t) {
620
+ for (var r = 0; r < t.length; r++) {
621
+ var n = t[r];
617
622
  n.enumerable = n.enumerable || false;
618
623
  n.configurable = true;
619
624
  if ("value" in n) n.writable = true;
620
625
  Object.defineProperty(e, n.key, n);
621
626
  }
622
627
  }
623
- function je(e, r, t) {
624
- if (r) Ie(e.prototype, r);
625
- if (t) Ie(e, t);
628
+ function je(e, t, r) {
629
+ if (t) _e(e.prototype, t);
630
+ if (r) _e(e, r);
626
631
  return e;
627
632
  }
628
- function Ee(e, r) {
629
- if (typeof r !== "function" && r !== null) {
633
+ function Ee(e, t) {
634
+ if (typeof t !== "function" && t !== null) {
630
635
  throw new TypeError("Super expression must either be null or a function");
631
636
  }
632
- e.prototype = Object.create(r && r.prototype, {
637
+ e.prototype = Object.create(t && t.prototype, {
633
638
  constructor: {
634
639
  value: e,
635
640
  writable: true,
636
641
  configurable: true
637
642
  }
638
643
  });
639
- if (r) _e(e, r);
644
+ if (t) Te(e, t);
640
645
  }
641
- function _e(e, r) {
642
- _e = Object.setPrototypeOf || function e(r, t) {
643
- r.__proto__ = t;
644
- return r;
646
+ function Te(e, t) {
647
+ Te = Object.setPrototypeOf || function e(t, r) {
648
+ t.__proto__ = r;
649
+ return t;
645
650
  };
646
- return _e(e, r);
651
+ return Te(e, t);
647
652
  }
648
- function Te(e) {
649
- var r = qe();
650
- return function t() {
651
- var n = Ke(e), i;
652
- if (r) {
653
- var a = Ke(this).constructor;
653
+ function De(e) {
654
+ var t = Ne();
655
+ return function r() {
656
+ var n = He(e), i;
657
+ if (t) {
658
+ var a = He(this).constructor;
654
659
  i = Reflect.construct(n, arguments, a);
655
660
  } else {
656
661
  i = n.apply(this, arguments);
657
662
  }
658
- return Re(this, i);
663
+ return qe(this, i);
659
664
  };
660
665
  }
661
- function Re(e, r) {
662
- if (r && (we(r) === "object" || typeof r === "function")) {
663
- return r;
666
+ function qe(e, t) {
667
+ if (t && (Se(t) === "object" || typeof t === "function")) {
668
+ return t;
664
669
  }
665
- return De(e);
670
+ return Re(e);
666
671
  }
667
- function De(e) {
672
+ function Re(e) {
668
673
  if (e === void 0) {
669
674
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
670
675
  }
671
676
  return e;
672
677
  }
673
- function qe() {
678
+ function Ne() {
674
679
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
675
680
  if (Reflect.construct.sham) return false;
676
681
  if (typeof Proxy === "function") return true;
@@ -681,31 +686,31 @@
681
686
  return false;
682
687
  }
683
688
  }
684
- function Ke(e) {
685
- Ke = Object.setPrototypeOf ? Object.getPrototypeOf : function e(r) {
686
- return r.__proto__ || Object.getPrototypeOf(r);
689
+ function He(e) {
690
+ He = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
691
+ return t.__proto__ || Object.getPrototypeOf(t);
687
692
  };
688
- return Ke(e);
693
+ return He(e);
689
694
  }
690
- function Ne(e, r, t) {
691
- if (r in e) {
692
- Object.defineProperty(e, r, {
693
- value: t,
695
+ function Fe(e, t, r) {
696
+ if (t in e) {
697
+ Object.defineProperty(e, t, {
698
+ value: r,
694
699
  enumerable: true,
695
700
  configurable: true,
696
701
  writable: true
697
702
  });
698
703
  } else {
699
- e[r] = t;
704
+ e[t] = r;
700
705
  }
701
706
  return e;
702
707
  }
703
- var He = {
708
+ var $e = {
704
709
  active: a().bool,
705
710
  children: a().node,
706
711
  description: a().string,
707
712
  descriptionPosition: a().oneOf([ "right", "bottom" ]),
708
- disabled: a().bool,
713
+ disabled: a().oneOfType([ a().bool, a().oneOf([ "dimmed" ]) ]),
709
714
  elementRef: a().oneOfType([ a().func, a().object ]),
710
715
  hasSubmenu: a().bool,
711
716
  icon: a().node,
@@ -733,7 +738,6 @@
733
738
  var Ae = {
734
739
  active: false,
735
740
  descriptionPosition: "bottom",
736
- disabled: false,
737
741
  hasSubmenu: false,
738
742
  openInNewContext: false,
739
743
  preventFocus: false,
@@ -742,72 +746,72 @@
742
746
  selected: false,
743
747
  truncate: false
744
748
  };
745
- var Fe = function(e) {
746
- Ee(t, e);
747
- var r = Te(t);
748
- je(t, null, [ {
749
+ var Me = function(e) {
750
+ Ee(r, e);
751
+ var t = De(r);
752
+ je(r, null, [ {
749
753
  key: "validateProps",
750
754
  // @docs-props-type ItemPropsBase
751
- value: function e(r) {
755
+ value: function e(t) {
752
756
  if (false) {}
753
757
  }
754
758
  } ]);
755
- function t(e) {
759
+ function r(e) {
756
760
  var n;
757
- Pe(this, t);
758
- n = r.call(this, e);
759
- Ne(De(n), "el", null);
760
- Ne(De(n), "handleFocus", (function(e) {
761
- var r = n.props, t = r.onFocus, i = r.itemKey;
762
- t === null || t === void 0 ? void 0 : t(e, {
761
+ Pe(this, r);
762
+ n = t.call(this, e);
763
+ Fe(Re(n), "el", null);
764
+ Fe(Re(n), "handleFocus", (function(e) {
765
+ var t = n.props, r = t.onFocus, i = t.itemKey;
766
+ r === null || r === void 0 ? void 0 : r(e, {
763
767
  itemKey: i
764
768
  });
765
769
  }));
766
- Ne(De(n), "handleMount", (function(e) {
770
+ Fe(Re(n), "handleMount", (function(e) {
767
771
  n.el = e;
768
- ke(n.props.elementRef, e);
772
+ xe(n.props.elementRef, e);
769
773
  }));
770
- t.validateProps(e);
774
+ r.validateProps(e);
771
775
  return n;
772
776
  }
773
- je(t, [ {
777
+ je(r, [ {
774
778
  key: "componentDidUpdate",
775
779
  value: function e() {
776
- t.validateProps(this.props);
780
+ r.validateProps(this.props);
777
781
  }
778
782
  }, {
779
783
  key: "focus",
780
784
  value: function e() {
781
- var r;
782
- (r = this.el) === null || r === void 0 ? void 0 : r.focus();
785
+ var t;
786
+ (t = this.el) === null || t === void 0 ? void 0 : t.focus();
783
787
  }
784
788
  }, {
785
789
  key: "scrollIntoViewIfNeeded",
786
790
  value: function e() {
787
- xe(this.el);
791
+ we(this.el);
788
792
  }
789
793
  }, {
790
794
  key: "renderLabel",
791
795
  value: function e() {
792
- var r = this.props, t = r.children, i = r.matchRanges;
793
- if (!i || !A()(t)) {
794
- return t;
796
+ var t = this.props, r = t.children, i = t.matchRanges;
797
+ if (!i || !A()(r)) {
798
+ return r;
795
799
  }
796
800
  var a = [];
797
801
  // before first match. May be empty string.
798
- a.push(t.substring(0, i[0].start));
799
- i.forEach((function(e, r) {
802
+ a.push(r.substring(0, i[0].start));
803
+ i.forEach((function(e, t) {
800
804
  a.push(
801
805
 
802
806
  // eslint-disable-next-line react/no-array-index-key
803
- n().createElement(le, {
804
- key: r,
807
+ n().createElement(se, {
808
+ key: t,
805
809
  "data-test": "match"
806
- }, t.substring(e.start, e.end)));
807
- if (r < i.length - 1) {
808
- a.push(t.substring(e.end, i[r + 1].start));
810
+ }, r.substring(e.start, e.end)));
811
+ if (t < i.length - 1) {
812
+ a.push(r.substring(e.end, i[t + 1].start));
809
813
  } else {
810
- a.push(t.substring(e.end, t.length));
814
+ a.push(r.substring(e.end, r.length));
811
815
  }
812
816
  }));
813
817
  return a;
@@ -815,8 +819,9 @@
815
819
  }, {
816
820
  key: "render",
817
821
  value: function e() {
818
- var r = this.props, t = r.active, i = r.children, a = r.hasSubmenu, o = r.selectable, s = r.selectableAppearance, c = r.selected, u = r.icon, p = r.description, f = r.disabled, d = r.onClick, v = r.preventFocus, b = r.role, m = r.splunkTheme, y = r.to, h = r.truncate, g = r.descriptionPosition, k = r.openInNewContext, x = Oe(r, [ "active", "children", "hasSubmenu", "selectable", "selectableAppearance", "selected", "icon", "description", "disabled", "onClick", "preventFocus", "role", "splunkTheme", "to", "truncate", "descriptionPosition", "openInNewContext" ]);
819
- var w = m.isEnterprise, S = m.isPrisma;
822
+ var t = this.props, r = t.active, i = t.children, a = t.hasSubmenu, o = t.selectable, s = t.selectableAppearance, c = t.selected, p = t.icon, u = t.description, f = t.disabled, d = t.onClick, v = t.role, b = t.splunkTheme, m = t.to, h = t.truncate, y = t.descriptionPosition, g = t.openInNewContext, k = Ce(t, [ "active", "children", "hasSubmenu", "selectable", "selectableAppearance", "selected", "icon", "description", "disabled", "onClick", "role", "splunkTheme", "to", "truncate", "descriptionPosition", "openInNewContext" ]);
823
+ var x = b.isEnterprise, w = b.isPrisma;
824
+ var S = this.context.preventFocus;
820
825
  var O = o || c;
821
826
  var C = {
822
827
  nonselectable: "menuitem",
@@ -824,478 +829,266 @@
824
829
  checkbox: "menuitemcheckbox"
825
830
  }[O ? s : "nonselectable"];
826
831
  // aria-checked updates only with checkmark appearance for now SUI-2578
827
- var P = {
832
+ var I = {
828
833
  "aria-haspopup": a ? true : undefined,
829
834
  "aria-checked": s === "checkmark" && c ? true : undefined
830
835
  };
831
- var I = S ? "right" : "left";
832
- var j = p && g === "right";
833
- var E = p && !j;
834
- var _ = c && s === "checkmark" && n().createElement(ee, null, S ? n().createElement(z(), {
836
+ var P = w ? "right" : "left";
837
+ var _ = u && y === "right";
838
+ var j = u && !_;
839
+ var E = c && s === "checkmark" && n().createElement(te, null, w ? n().createElement(K(), {
835
840
  inline: true,
836
841
  height: "16",
837
842
  width: "16"
838
- }) : n().createElement(U(), {
843
+ }) : n().createElement(B(), {
839
844
  hideDefaultTooltip: true,
840
845
  inline: true,
841
846
  screenReaderText: null,
842
847
  size: .85
843
848
  }));
844
849
 
845
- return n().createElement(te, Se({
850
+ return n().createElement(ne, Oe({
846
851
  $isSelectable: O,
847
852
  $selectableAppearance: s,
848
853
  $selected: c,
849
- $active: t,
850
- $preventFocus: v,
854
+ $active: r,
855
+ $preventFocus: S || false,
851
856
  "data-test-selected": O ? c : null,
852
857
  "data-test": "item",
853
- "data-has-icon": !!u,
858
+ "data-has-icon": !!p,
854
859
  disabled: f,
855
860
  onClick: d,
856
861
  onFocus: this.handleFocus,
857
- onMouseDown: function e(r) {
858
- if (v) {
859
- r.preventDefault();
862
+ onMouseDown: function e(t) {
863
+ if (S) {
864
+ t.preventDefault();
860
865
  }
861
866
  },
862
- role: b || C,
863
- to: y,
867
+ role: v || C,
868
+ tabIndex: S ? -1 : undefined,
869
+ to: m,
864
870
  title: h && A()(i) ? i : undefined,
865
- openInNewContext: k
866
- }, P, l()(x, "onFocus"), {
871
+ openInNewContext: g
872
+ }, I, l()(k, "onFocus"), {
867
873
  elementRef: this.handleMount
868
- }), o && s === "checkbox" && n().createElement(ne, {
874
+ }), o && s === "checkbox" && n().createElement(ie, {
869
875
  interactive: false,
870
876
  selected: c,
871
877
  selectedLabel: "Selected",
872
878
  value: "menu-item"
873
- }), a && n().createElement(se, null, w ? n().createElement(B(), {
879
+ }), a && n().createElement(ce, null, x ? n().createElement(V(), {
874
880
  hideDefaultTooltip: true,
875
881
  screenReaderText: null
876
- }) : n().createElement($(), null)), j && n().createElement(Z, {
882
+ }) : n().createElement(L(), null)), _ && n().createElement(ee, {
877
883
  "data-test": "description"
878
- }, p), n().createElement(ie, null, u && n().createElement(re, null, u), n().createElement(ae, {
884
+ }, u), n().createElement(ae, null, p && n().createElement(re, null, p), n().createElement(oe, {
879
885
  $truncate: h
880
- }, I === "left" && _, n().createElement(oe, {
886
+ }, P === "left" && E, n().createElement(le, {
881
887
  $truncate: h,
882
888
  "data-test": "label"
883
- }, this.renderLabel(), k && n().createElement(ge, null)), E && n().createElement(X, {
889
+ }, this.renderLabel(), g && n().createElement(ke, null)), j && n().createElement(Z, {
884
890
  "data-test": "description"
885
- }, p), I === "right" && _)));
891
+ }, u), P === "right" && E)));
886
892
  }
887
893
  } ]);
888
- return t;
889
- }(t.Component);
890
- Ne(Fe, "propTypes", He);
891
- Ne(Fe, "defaultProps", Ae);
892
- Ne(Fe, "as", void 0);
893
- var $e = (0, b.withSplunkTheme)(Fe);
894
- var Me = $e;
895
- Me.propTypes = Fe.propTypes;
896
- Me.as = "Item";
897
- /* harmony default export */ const ze = Me;
894
+ return r;
895
+ }(r.Component);
896
+ Fe(Me, "propTypes", $e);
897
+ Fe(Me, "defaultProps", Ae);
898
+ Fe(Me, "as", void 0);
899
+ Fe(Me, "contextType", y);
900
+ var Le = (0, b.withSplunkTheme)(Me);
901
+ var ze = Le;
902
+ ze.propTypes = Me.propTypes;
903
+ ze.as = "Item";
904
+ /* harmony default export */ const Ke = ze;
898
905
  // CONCATENATED MODULE: external "@splunk/react-ui/Scroll"
899
- const Le = require("@splunk/react-ui/Scroll");
900
- var Ue = e.n(Le);
906
+ const We = require("@splunk/react-ui/Scroll");
907
+ var Be = e.n(We);
901
908
  // CONCATENATED MODULE: ./src/Menu/MenuStyles.ts
902
- var We = (0, d.css)([ "border-top:1px solid ", ";" ], (0, b.pick)({
909
+ var Ge = (0, u.css)([ "border-top:1px solid ", ";" ], (0, b.pick)({
903
910
  enterprise: b.variables.gray60,
904
911
  prisma: b.variables.neutral200
905
912
  }));
906
- var Be = v().div.withConfig({
907
- displayName: "MenuStyles__Styled",
908
- componentId: "sc-1olffp9-0"
909
- })([ "", ";background-color:", ";border-radius:", ";min-width:60px;overflow:auto;position:relative;", " &:focus{outline:0;box-shadow:", ";", "}& + &{", "}" ], b.mixins.reset("block"), (0,
913
+ var Ve = (0, u.css)([ "", ";background-color:", ";border-radius:", ";min-width:60px;overflow:auto;position:relative;", " &:focus{outline:0;box-shadow:", ";", "}& + &{", "}" ], b.mixins.reset("block"), (0,
910
914
  b.pick)({
911
915
  enterprise: b.variables.backgroundColor,
912
916
  prisma: b.variables.backgroundColorPopup
913
917
  }), b.variables.borderRadius, (0, b.pick)({
914
- prisma: (0, d.css)([ "padding:8px 0;" ])
918
+ prisma: (0, u.css)([ "padding:8px 0;" ])
915
919
  }), b.variables.focusShadowInset, (0, b.pick)({
916
- prisma: (0, d.css)([ "background:", ";" ], b.variables.interactiveColorOverlayHover)
917
- }), We);
918
- var Ge = v()(Be.withComponent(Ue())).withConfig({
920
+ prisma: (0, u.css)([ "background:", ";" ], b.variables.interactiveColorOverlayHover)
921
+ }), Ge);
922
+ var Ue = f().div.withConfig({
923
+ displayName: "MenuStyles__Styled",
924
+ componentId: "sc-1olffp9-0"
925
+ })([ "", "" ], Ve);
926
+ var Xe = f()(Be()).withConfig({
919
927
  displayName: "MenuStyles__StyledScroll",
920
928
  componentId: "sc-1olffp9-1"
921
- })([ "", " + &,& + ", "{", "}" ],
929
+ })([ "", " ", " + &,& + ", "{", "}" ], Ve,
922
930
  /* sc-sel */
923
- Be,
931
+ Ue,
924
932
  /* sc-sel */
925
- Be, We);
926
- // CONCATENATED MODULE: ./src/utils/navigateList.ts
927
- // A utility for keyboard navigation of lists
928
- function Ve(e, r, t) {
929
- for (var n = 0; n < e.length; n += 1) {
930
- var i;
931
- var a = (n + t) % e.length;
932
- if (((i = e[a].current) === null || i === void 0 ? void 0 : i.props.disabled) !== true) {
933
- return e[a];
934
- }
935
- }
936
- return e[r];
937
- }
938
- function Qe(e, r, t) {
939
- for (var n = e.length; n > 0; n -= 1) {
940
- var i;
941
- var a = (n + t) % e.length;
942
- if (((i = e[a].current) === null || i === void 0 ? void 0 : i.props.disabled) !== true) {
943
- return e[a];
944
- }
945
- }
946
- return e[r];
947
- }
948
- // CONCATENATED MODULE: ./src/utils/getMenuChildNode.tsx
949
- // TODO(SUI-5919): fix the ref handling in the other components so this isn't needed
950
- /**
951
- * @private Get the HTML <anchor> or <button> node for a received derivative of Menu.Item
952
- */
953
- var Ye = function e(r) {
954
- var t, n, i, a;
955
- if (r.el) {
956
- return r.el;
957
- // Menu.Item
958
- }
959
- if ((t = r.c) === null || t === void 0 ? void 0 : t.el) {
960
- return r.c.el;
961
- // Multiselect.Option
962
- }
963
- if ((n = r.c) === null || n === void 0 ? void 0 : (i = n.c) === null || i === void 0 ? void 0 : i.el) {
964
- return r.c.c.el;
965
- // Select.Option
966
- }
967
- if ((a = r.item) === null || a === void 0 ? void 0 : a.el) {
968
- return r.item.el;
969
- // ComboBox.Option
970
- }
971
- return null;
972
- };
933
+ Ue, Ge);
973
934
  // CONCATENATED MODULE: ./src/Menu/Menu.tsx
974
- function Je() {
975
- Je = Object.assign || function(e) {
976
- for (var r = 1; r < arguments.length; r++) {
977
- var t = arguments[r];
978
- for (var n in t) {
979
- if (Object.prototype.hasOwnProperty.call(t, n)) {
980
- e[n] = t[n];
935
+ function Ye() {
936
+ Ye = Object.assign || function(e) {
937
+ for (var t = 1; t < arguments.length; t++) {
938
+ var r = arguments[t];
939
+ for (var n in r) {
940
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
941
+ e[n] = r[n];
981
942
  }
982
943
  }
983
944
  }
984
945
  return e;
985
946
  };
986
- return Je.apply(this, arguments);
987
- }
988
- function Xe(e, r) {
989
- return nr(e) || tr(e, r) || er(e, r) || Ze();
990
- }
991
- function Ze() {
992
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
993
- }
994
- function er(e, r) {
995
- if (!e) return;
996
- if (typeof e === "string") return rr(e, r);
997
- var t = Object.prototype.toString.call(e).slice(8, -1);
998
- if (t === "Object" && e.constructor) t = e.constructor.name;
999
- if (t === "Map" || t === "Set") return Array.from(e);
1000
- if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return rr(e, r);
947
+ return Ye.apply(this, arguments);
1001
948
  }
1002
- function rr(e, r) {
1003
- if (r == null || r > e.length) r = e.length;
1004
- for (var t = 0, n = new Array(r); t < r; t++) {
1005
- n[t] = e[t];
1006
- }
1007
- return n;
1008
- }
1009
- function tr(e, r) {
1010
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(e))) return;
1011
- var t = [];
1012
- var n = true;
1013
- var i = false;
1014
- var a = undefined;
1015
- try {
1016
- for (var o = e[Symbol.iterator](), l; !(n = (l = o.next()).done); n = true) {
1017
- t.push(l.value);
1018
- if (r && t.length === r) break;
1019
- }
1020
- } catch (e) {
1021
- i = true;
1022
- a = e;
1023
- } finally {
1024
- try {
1025
- if (!n && o["return"] != null) o["return"]();
1026
- } finally {
1027
- if (i) throw a;
1028
- }
1029
- }
1030
- return t;
1031
- }
1032
- function nr(e) {
1033
- if (Array.isArray(e)) return e;
1034
- }
1035
- function ir(e, r) {
949
+ function Je(e, t) {
1036
950
  if (e == null) return {};
1037
- var t = ar(e, r);
951
+ var r = Qe(e, t);
1038
952
  var n, i;
1039
953
  if (Object.getOwnPropertySymbols) {
1040
954
  var a = Object.getOwnPropertySymbols(e);
1041
955
  for (i = 0; i < a.length; i++) {
1042
956
  n = a[i];
1043
- if (r.indexOf(n) >= 0) continue;
957
+ if (t.indexOf(n) >= 0) continue;
1044
958
  if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
1045
- t[n] = e[n];
959
+ r[n] = e[n];
1046
960
  }
1047
961
  }
1048
- return t;
962
+ return r;
1049
963
  }
1050
- function ar(e, r) {
964
+ function Qe(e, t) {
1051
965
  if (e == null) return {};
1052
- var t = {};
966
+ var r = {};
1053
967
  var n = Object.keys(e);
1054
968
  var i, a;
1055
969
  for (a = 0; a < n.length; a++) {
1056
970
  i = n[a];
1057
- if (r.indexOf(i) >= 0) continue;
1058
- t[i] = e[i];
971
+ if (t.indexOf(i) >= 0) continue;
972
+ r[i] = e[i];
1059
973
  }
1060
- return t;
974
+ return r;
1061
975
  }
1062
- var or = {
976
+ var Ze = {
1063
977
  children: a().node,
1064
- /** @private */
1065
- controlledExternally: a().bool,
1066
978
  elementRef: a().oneOfType([ a().func, a().object ]),
1067
- /** @private */
1068
- onDownKeyPress: a().func,
1069
- /** @private */
1070
- onEndKeyPress: a().func,
1071
- /** @private */
1072
- onHomeKeyPress: a().func,
1073
- /** @private */
1074
- onUpKeyPress: a().func,
979
+ focusMode: a().oneOf([ "roving", "normal", "never" ]),
1075
980
  retainFocus: a().bool,
1076
981
  stopScrollPropagation: a().bool
1077
982
  };
1078
- var lr = {
1079
- stopScrollPropagation: false
983
+ // the default focus control for Menu: loop, verticalArrows(up/down keys), home/end keys
984
+ var et = function e(t) {
985
+ return {
986
+ enableLoop: true,
987
+ orientation: "vertical",
988
+ enableTab: t,
989
+ enableHomeEnd: true
990
+ };
991
+ };
992
+ var tt = function e(t) {
993
+ var r = (0, c.keycode)(t.nativeEvent);
994
+ // Handle special case for tab navigation
995
+ if (r === "tab" && (0, p.isTabKey)(t)) {
996
+ return t.shiftKey ? "tabShift" : "tab";
997
+ }
998
+ return r;
1080
999
  };
1081
- function sr(e) {
1082
- var r = e.children, i = e.controlledExternally, a = e.elementRef, o = e.onDownKeyPress, p = e.onEndKeyPress, d = e.onHomeKeyPress, v = e.onUpKeyPress, b = e.retainFocus, m = e.stopScrollPropagation, h = ir(e, [ "children", "controlledExternally", "elementRef", "onDownKeyPress", "onEndKeyPress", "onHomeKeyPress", "onUpKeyPress", "retainFocus", "stopScrollPropagation" ]);
1000
+ function rt(e) {
1001
+ var t = e.children, i = e.elementRef, a = e.focusMode, o = e.retainFocus, c = e.stopScrollPropagation, u = Je(e, [ "children", "elementRef", "focusMode", "retainFocus", "stopScrollPropagation" ]);
1083
1002
  // @docs-props-type MenuPropsBase
1084
- var g = (0, t.useContext)(y), k = g.role, x = k === void 0 ? "menu" : k;
1085
- var w = (0, t.useContext)(s.PopoverContext), S = w.retainFocus;
1086
- var O = f()();
1087
- var C = true;
1088
- if (b != null) {
1089
- C = b;
1090
- } else if (S != null) {
1091
- C = S;
1003
+ if (false) {}
1004
+ var f = (0, r.useContext)(y), d = f.role, v = d === void 0 ? "menu" : d;
1005
+ var b = (0, r.useContext)(s.PopoverContext), m = b.retainFocus;
1006
+ var h = (0, r.useRef)(null);
1007
+ var g = true;
1008
+ if (o != null) {
1009
+ g = o;
1010
+ } else if (a === "roving") {
1011
+ g = false;
1012
+ } else if (m != null) {
1013
+ g = m;
1092
1014
  }
1093
- var P = n().useRef(0);
1094
- var I = [];
1095
- // `VirtualizedResultsMenu` needs some special consideration regarding the focused element index so that on
1096
- // keypress it won't ignore the requested focus index or element, even when it doesn't exist. `VirtualizedResultsMenu`
1097
- // knows what it _will_ mount as a child of `Menu`, and upon mount that targeted child should receive focus.
1098
- var j = n().useRef(null);
1099
- var E = n().useRef(false);
1100
- // TODO(SUI-5918): stabilize itemRefs so itemOnFocus does not churn and can access itemRefs
1101
- var _ = (0, t.useRef)(I);
1102
- _.current = I;
1103
- var T = 0;
1104
- var R;
1105
- var D = false;
1106
- var q = false;
1107
- var K = false;
1108
- var N = (0, t.useCallback)((function(e) {
1109
- var r = e.e, t = e.data, n = e.userCallback, i = e.defaultCallback;
1110
- var a;
1111
- if (n) {
1112
- var o = n(r, t);
1113
- if (typeof o[0] === "number") {
1114
- // userCallback returned index of the to-render element which should capture focus on mount
1115
- a = {
1116
- current: null
1117
- };
1118
- var l = Xe(o, 2);
1119
- P.current = l[0];
1120
- E.current = l[1];
1121
- } else {
1122
- // userCallback returned ref of the rendered element which should take focus
1123
- var s = o;
1124
- var c = Xe(s, 2);
1125
- a = c[0];
1126
- E.current = c[1];
1127
- P.current = Math.max(0, t.itemRefs.indexOf(a));
1128
- }
1129
- } else {
1130
- a = i();
1131
- }
1132
- return a;
1133
- }), []);
1134
- var H = function e(r) {
1135
- // SUI-2734: keeping this active even if controlledExternally is set
1136
- // because Firefox + Voiceover (and possibly other a11y tools)
1137
- // can still set focus on the Menu items and this avoids the
1138
- // whole page scrolling when that happens
1139
- var t = (0, u.keycode)(r.nativeEvent);
1140
- var n = P.current;
1141
- var i;
1142
- // the "retainFocus" checks here mimic the prior tab key functionality
1143
- if (t === "down" || C && (0, c.isTabKey)(r)) {
1144
- i = N({
1145
- e: r,
1146
- data: {
1147
- itemRefs: I,
1148
- focusedItemKey: n
1149
- },
1150
- userCallback: o,
1151
- defaultCallback: function e() {
1152
- return Ve(I, n, n + 1);
1153
- }
1154
- });
1155
- } else if (t === "up" || C && (0, c.isTabKey)(r) && r.shiftKey) {
1156
- i = N({
1157
- e: r,
1158
- data: {
1159
- itemRefs: I,
1160
- focusedItemKey: n
1161
- },
1162
- userCallback: v,
1163
- defaultCallback: function e() {
1164
- return Qe(I, n, n - 1);
1165
- }
1166
- });
1167
- } else if (t === "home") {
1168
- i = N({
1169
- e: r,
1170
- data: {
1171
- itemRefs: I,
1172
- focusedItemKey: n
1173
- },
1174
- userCallback: d,
1175
- defaultCallback: function e() {
1176
- return Ve(I, n, 0);
1177
- }
1178
- });
1179
- } else if (t === "end") {
1180
- i = N({
1181
- e: r,
1182
- data: {
1183
- itemRefs: I,
1184
- focusedItemKey: n
1185
- },
1186
- userCallback: p,
1187
- defaultCallback: function e() {
1188
- return Qe(I, n, I.length - 1);
1189
- }
1190
- });
1191
- }
1192
- if (i != null) {
1193
- var a, l;
1194
- (a = i.current) === null || a === void 0 ? void 0 : (l = a.focus) === null || l === void 0 ? void 0 : l.call(a);
1195
- r.preventDefault();
1196
- j.current = E.current ? null : i.current;
1197
- }
1198
- };
1199
- var A = (0, t.useCallback)((function(e, r) {
1200
- var t = r.itemKey;
1201
- if (t != null) {
1202
- var n;
1203
- P.current = t;
1204
- j.current = E.current ? null : (n = _.current[P.current]) === null || n === void 0 ? void 0 : n.current;
1205
- }
1206
- }), []);
1207
- var F = t.Children.toArray(r).filter(t.isValidElement).reduce((function(e, r, t, a) {
1015
+ var k = r.Children.toArray(t).filter(r.isValidElement).reduce((function(e, t, r, n) {
1208
1016
  /* Filter out initial Dividers
1209
1017
  * Requires reduce() over filter() because a Heading may have been
1210
1018
  * before the Divider.
1211
1019
  */
1212
- if (r.type.as === "Divider" && e.length === 0) {
1020
+ if (t.type.as === "Divider" && e.length === 0) {
1213
1021
  return e;
1214
1022
  }
1215
1023
  // Filter out consecutive Dividers and Headings
1216
1024
  // If Divider is next to Heading then it will remove both Heading and Divider unless Heading has title prop set to it
1217
- if ((r.type.as === "Heading" || r.type.as === "Divider") && !r.props.title && r.type.filterConsecutive && a.length > t + 1) {
1218
- var o = a[t + 1];
1219
- if (o.type.as === "Heading" || o.type.as === "Divider") {
1025
+ if ((t.type.as === "Heading" || t.type.as === "Divider") && !t.props.title && t.type.filterConsecutive && n.length > r + 1) {
1026
+ var i = n[r + 1];
1027
+ if (i.type.as === "Heading" || i.type.as === "Divider") {
1220
1028
  return e;
1221
1029
  }
1222
1030
  }
1223
1031
  // Filter out last Dividers and Headings
1224
- if ((r.type.as === "Divider" || r.type.as === "Heading") && t === a.length - 1) {
1032
+ if ((t.type.as === "Divider" || t.type.as === "Heading") && r === n.length - 1) {
1225
1033
  return e;
1226
1034
  }
1227
- // the filterConsecutive check filters out Headings and Dividers whether styled or not
1228
- // the typeof check prevents props from being applied to HTML elements
1229
- // such as the zero-height scroll bottom div in <ResultsMenu>
1230
- if (!(r.type.as === "Divider" || r.type.as === "Heading") && typeof r.type !== "string") {
1231
- var l = n().createRef();
1232
- var s = I.length;
1233
- I.push(l);
1234
- if (R == null && (!("disabled" in r.props) || !r.props.disabled)) {
1235
- R = T;
1236
- }
1237
- if (P.current === T && "disabled" in r.props && r.props.disabled) {
1238
- D = true;
1239
- }
1240
- if ("selected" in r.props && r.props.selected) {
1241
- q = true;
1242
- if ("disabled" in r.props && !r.props.disabled) {
1243
- K = true;
1244
- }
1245
- }
1246
- var c = !i && P.current === T ? undefined : -1;
1247
- e.push( n().cloneElement(r, {
1248
- itemKey: T,
1249
- onFocus: A,
1250
- preventFocus: i,
1251
- ref: function e(t) {
1252
- ke(r.ref, t);
1253
- ke(l, t);
1254
- if (!t) {
1255
- return;
1256
- }
1257
- if (t === j.current) {
1258
- // When using `VirtualizedResultsMenu` the ref content changes but the
1259
- // count doesn't. The keyboard scrolling will break if the focus index
1260
- // isn't corrected during scroll
1261
- P.current = s;
1262
- } else if (E.current && s === P.current) {
1263
- var n;
1264
- (n = Ye(t)) === null || n === void 0 ? void 0 : n.focus();
1265
- E.current = false;
1266
- }
1267
- },
1268
- tabIndex: c
1269
- }));
1270
- T += 1;
1271
- return e;
1272
- }
1273
- e.push(r);
1035
+ e.push(t);
1274
1036
  return e;
1275
1037
  }), []);
1276
- if (R !== P.current && (!q || K) && D && R != null) {
1277
- P.current = R;
1278
- O();
1279
- }
1280
- var $ = {
1038
+ var x = (0, r.useCallback)((function(e) {
1039
+ h.current = e;
1040
+ xe(i, e);
1041
+ }), [ i ]);
1042
+ var w = et(g);
1043
+ var S = (0, r.useCallback)((function(e) {
1044
+ var t = tt(e);
1045
+ var r = t === "tab" || t === "tabShift";
1046
+ var n = t === "enter";
1047
+ // Allow default behavior for the enter key.
1048
+ // If tab navigation is enabled, prevent default behavior for all other keys.
1049
+ // If tab navigation is disabled, allow default behavior for tab and tab+shift key
1050
+ if (!n && (w.enableTab || !r)) {
1051
+ e.preventDefault();
1052
+ }
1053
+ var i = h.current;
1054
+ var a = [];
1055
+ if (i) {
1056
+ a = (0, p.getSortedTabbableElements)(i, {
1057
+ ignoreTabIndex: true
1058
+ });
1059
+ }
1060
+ var o = (e === null || e === void 0 ? void 0 : e.target) instanceof Element ? e.target : null;
1061
+ var l = i === null || i === void 0 ? void 0 : i.querySelector(":focus");
1062
+ var s = o || l;
1063
+ var c = s ? a.indexOf(s) : -1;
1064
+ (0, p.handleFocus)(t, a, c, w);
1065
+ }), [ w ]);
1066
+ var O = function e() {
1067
+ return {
1068
+ role: "menu",
1069
+ preventFocus: a === "never"
1070
+ };
1071
+ };
1072
+ var C = a === "normal" || a === "never" ? undefined : S;
1073
+ var I = {
1281
1074
  "data-test": "menu",
1282
- onKeyDown: H,
1283
- role: x,
1284
- tabIndex: R == null && !i ? 0 : undefined
1075
+ onKeyDown: C,
1076
+ role: v
1285
1077
  };
1286
- return m ? n().createElement(Ge, Je({}, $, {
1287
- elementRef: a,
1078
+ return c ? n().createElement(Xe, Ye({}, I, {
1079
+ elementRef: x,
1288
1080
  stopScrollPropagation: true
1289
- }, l()(h, "tagName")), F) : n().createElement(Be, Je({}, $, {
1290
- ref: a
1291
- }, h), F);
1081
+ }, l()(u, "tagName")), k) : n().createElement(Ue, Ye({}, I, {
1082
+ ref: x
1083
+ }, u), n().createElement(y.Provider, {
1084
+ value: O()
1085
+ }, k));
1292
1086
  }
1293
- sr.propTypes = or;
1294
- sr.defaultProps = lr;
1295
- sr.Item = ze;
1296
- sr.Divider = x;
1297
- sr.Heading = N;
1298
- /* harmony default export */ const cr = sr;
1087
+ rt.propTypes = Ze;
1088
+ rt.Item = Ke;
1089
+ rt.Divider = w;
1090
+ rt.Heading = F;
1091
+ /* harmony default export */ const nt = rt;
1299
1092
  // CONCATENATED MODULE: ./src/Menu/index.ts
1300
- module.exports = r;
1093
+ module.exports = t;
1301
1094
  /******/})();