@splunk/react-ui 4.32.0 → 4.34.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/Button.js +59 -65
  2. package/ButtonGroup.js +20 -23
  3. package/ButtonSimple.js +374 -339
  4. package/CHANGELOG.md +54 -0
  5. package/Card.js +56 -44
  6. package/Chip.js +2 -6
  7. package/Clickable.js +21 -19
  8. package/CollapsiblePanel.js +281 -264
  9. package/Color.js +88 -86
  10. package/Concertina.js +7 -7
  11. package/ControlGroup.js +18 -18
  12. package/DualListbox.js +8 -11
  13. package/File.js +25 -30
  14. package/FormRows.js +232 -210
  15. package/Image.js +13 -13
  16. package/JSONTree.js +22 -22
  17. package/MIGRATION.mdx +99 -0
  18. package/Markdown.js +12 -12
  19. package/Menu.js +505 -719
  20. package/Message.js +205 -204
  21. package/MessageBar.js +104 -104
  22. package/Modal.js +158 -133
  23. package/Multiselect.js +81 -70
  24. package/Paginator.js +8 -8
  25. package/Popover.js +53 -54
  26. package/Progress.js +45 -46
  27. package/RadioBar.js +117 -115
  28. package/RadioList.js +8 -5
  29. package/ResultsMenu.js +256 -261
  30. package/Search.js +21 -24
  31. package/Select.js +265 -246
  32. package/Slider.js +9 -9
  33. package/SplitButton.js +1 -4
  34. package/StaticContent.js +1 -1
  35. package/StepBar.js +1 -1
  36. package/Switch.js +169 -171
  37. package/TabBar.js +14 -6
  38. package/Table.js +65 -67
  39. package/Text.js +30 -37
  40. package/TextArea.js +162 -163
  41. package/Tooltip.js +1 -1
  42. package/package.json +9 -9
  43. package/stubs-splunkui.d.ts +11 -0
  44. package/types/src/Button/Button.d.ts +4 -4
  45. package/types/src/ButtonSimple/ButtonSimple.d.ts +8 -6
  46. package/types/src/ButtonSimple/mixin.d.ts +2 -2
  47. package/types/src/Card/Card.d.ts +3 -1
  48. package/types/src/Card/Header.d.ts +22 -3
  49. package/types/src/Clickable/Clickable.d.ts +3 -2
  50. package/types/src/CollapsiblePanel/CollapsiblePanel.d.ts +5 -0
  51. package/types/src/CollapsiblePanel/icons/ExpandPanel.d.ts +1 -3
  52. package/types/src/Date/Date.d.ts +2 -2
  53. package/types/src/Menu/Item.d.ts +3 -1
  54. package/types/src/Menu/Menu.d.ts +16 -21
  55. package/types/src/Menu/MenuContext.d.ts +3 -2
  56. package/types/src/Number/Number.d.ts +2 -2
  57. package/types/src/RadioBar/Option.d.ts +4 -1
  58. package/types/src/RadioBar/RadioBar.d.ts +6 -4
  59. package/types/src/RadioBar/docs/examples/MenuBar.d.ts +2 -0
  60. package/types/src/ResultsMenu/ResultsMenu.d.ts +5 -22
  61. package/types/src/Select/Select.d.ts +8 -4
  62. package/types/src/Select/SelectBase.d.ts +8 -4
  63. package/types/src/Slider/Slider.d.ts +2 -2
  64. package/types/src/Table/Body.d.ts +0 -4
  65. package/types/src/Text/docs/examples/Basic.d.ts +1 -9
  66. package/types/src/Text/docs/examples/Error.d.ts +2 -10
  67. package/types/src/Text/docs/examples/Inline.d.ts +1 -9
  68. package/types/src/Text/docs/examples/Multiline.d.ts +1 -9
  69. package/types/src/Text/docs/examples/Password.d.ts +1 -9
  70. package/types/src/Text/docs/examples/Search.d.ts +1 -9
  71. package/useRovingFocus.js +26 -40
  72. package/types/src/Button/docs/examples/prisma/Basic.d.ts +0 -2
  73. package/types/src/Button/docs/examples/prisma/Block.d.ts +0 -2
  74. package/types/src/Button/docs/examples/prisma/Disabled.d.ts +0 -2
  75. package/types/src/Button/docs/examples/prisma/Icons.d.ts +0 -2
  76. package/types/src/Button/docs/examples/prisma/Menus.d.ts +0 -2
  77. package/types/src/Button/docs/examples/prisma/To.d.ts +0 -2
  78. package/types/src/Button/docs/examples/prisma/Truncated.d.ts +0 -2
  79. package/types/src/Select/docs/examples/prisma/Appearance.d.ts +0 -14
  80. /package/types/src/{Button/docs/examples/prisma → Clickable/docs/examples}/Dimmed.d.ts +0 -0
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,
63
+ e.d(t, {
64
+ Divider: () => /* reexport */ k,
65
65
  Heading: () => /* reexport */ N,
66
- Item: () => /* reexport */ ze,
67
- MenuContext: () => /* reexport */ y,
68
- default: () => /* reexport */ cr
66
+ Item: () => /* reexport */ Le,
67
+ MenuContext: () => /* reexport */ m,
68
+ default: () => /* reexport */ Ze
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,43 +78,42 @@
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");
90
- var v = e.n(d);
86
+ const u = require("styled-components");
87
+ var d = e.n(u);
91
88
  // CONCATENATED MODULE: external "@splunk/themes"
92
- const b = require("@splunk/themes");
89
+ const f = require("@splunk/themes");
93
90
  // CONCATENATED MODULE: ./src/Menu/DividerStyles.ts
94
- var m = v().div.withConfig({
91
+ var v = d().div.withConfig({
95
92
  displayName: "DividerStyles__Styled",
96
93
  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)({
94
+ })([ "border-top:1px solid ", ";", "" ], (0, f.pick)({
95
+ enterprise: f.variables.borderColor,
96
+ prisma: f.variables.neutral200
97
+ }), (0, f.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 b = (0, r.createContext)({
105
+ role: "menu",
106
+ preventFocus: false
109
107
  });
108
+ /* harmony default export */ const m = b;
110
109
  // CONCATENATED MODULE: ./src/Menu/Divider.tsx
111
110
  function h() {
112
111
  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];
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
  }
@@ -122,185 +121,185 @@
122
121
  };
123
122
  return h.apply(this, arguments);
124
123
  }
125
- var g = {};
124
+ var y = {};
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 g(e) {
128
+ var t = h({}, e);
130
129
  // @docs-props-type DividerPropsBase
131
- var i = (0, t.useContext)(y), a = i.role;
130
+ var i = (0, r.useContext)(m), a = i.role;
132
131
 
133
- return n().createElement(m, h({
132
+ return n().createElement(v, h({
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
+ g.propTypes = y;
139
+ /* Remove the item if it is the first item after filtering */ g.filterFirst = true;
140
+ /* Remove consecutive items with filterConsecutive = true (Dividers and Headings) */ g.filterConsecutive = true;
141
+ /* Remove the item if it is the last item after filtering. */ g.filterLast = true;
142
+ /* Tag the item as Divider */ g.as = "Divider";
143
+ /* harmony default export */ const k = g;
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 x = require("@splunk/react-ui/Heading");
146
+ var w = e.n(x);
148
147
  // CONCATENATED MODULE: external "@splunk/themes/useSplunkTheme"
149
- const O = require("@splunk/themes/useSplunkTheme");
150
- var C = e.n(O);
148
+ const S = require("@splunk/themes/useSplunkTheme");
149
+ var O = e.n(S);
151
150
  // CONCATENATED MODULE: ./src/Menu/HeadingStyles.ts
152
- var P = v().div.withConfig({
151
+ var C = d().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,
156
- b.pick)({
157
- enterprise: (0, d.css)([ "", " ", " 6px" ], b.variables.spacingQuarter, b.variables.spacingHalf),
154
+ })([ "", " border-top:1px solid transparent;", ";&:not(:first-child){", ";}" ], f.mixins.reset("block"), (0,
155
+ f.pick)({
156
+ enterprise: (0, u.css)([ "padding:", " ", " 6px;" ], f.variables.spacingXSmall, f.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
- }), (0, b.pick)({
163
- enterprise: (0, d.css)([ "border-top:", ";" ], b.variables.border),
161
+ }), (0, f.pick)({
162
+ enterprise: (0, u.css)([ "border-top:", ";" ], f.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;" ], f.variables.neutral200),
165
+ compact: (0, u.css)([ "border-top:1px solid ", ";margin-top:6px;padding-top:15px;" ], f.variables.neutral200)
167
166
  }
168
167
  }));
169
- var I = v().h5.withConfig({
168
+ var I = d().h5.withConfig({
170
169
  displayName: "HeadingStyles__PrismaSectionTitle",
171
170
  componentId: "mcd2ws-1"
172
- })([ "", " font-size:", ";line-height:", ";font-weight:", ";letter-spacing:0.02em;" ], b.mixins.reset("block"), b.variables.fontSizeSmall, b.variables.lineHeight, b.variables.fontWeightBold);
171
+ })([ "", " font-size:", ";line-height:", ";font-weight:", ";letter-spacing:0.02em;" ], f.mixins.reset("block"), f.variables.fontSizeSmall, f.variables.lineHeight, f.variables.fontWeightBold);
173
172
  // CONCATENATED MODULE: ./src/Menu/Heading.tsx
174
- function j(e, r) {
175
- var t = Object.keys(e);
173
+ function P(e, t) {
174
+ var r = Object.keys(e);
176
175
  if (Object.getOwnPropertySymbols) {
177
176
  var n = Object.getOwnPropertySymbols(e);
178
- if (r) n = n.filter((function(r) {
179
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
177
+ if (t) n = n.filter((function(t) {
178
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
180
179
  }));
181
- t.push.apply(t, n);
180
+ r.push.apply(r, n);
182
181
  }
183
- return t;
182
+ return r;
184
183
  }
185
184
  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]);
185
+ for (var t = 1; t < arguments.length; t++) {
186
+ var r = arguments[t] != null ? arguments[t] : {};
187
+ if (t % 2) {
188
+ P(Object(r), true).forEach((function(t) {
189
+ _(e, t, r[t]);
191
190
  }));
192
191
  } else if (Object.getOwnPropertyDescriptors) {
193
- Object.defineProperties(e, Object.getOwnPropertyDescriptors(t));
192
+ Object.defineProperties(e, Object.getOwnPropertyDescriptors(r));
194
193
  } else {
195
- j(Object(t)).forEach((function(r) {
196
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
194
+ P(Object(r)).forEach((function(t) {
195
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
197
196
  }));
198
197
  }
199
198
  }
200
199
  return e;
201
200
  }
202
- function _(e, r, t) {
203
- if (r in e) {
204
- Object.defineProperty(e, r, {
205
- value: t,
201
+ function _(e, t, r) {
202
+ if (t in e) {
203
+ Object.defineProperty(e, t, {
204
+ value: r,
206
205
  enumerable: true,
207
206
  configurable: true,
208
207
  writable: true
209
208
  });
210
209
  } else {
211
- e[r] = t;
210
+ e[t] = r;
212
211
  }
213
212
  return e;
214
213
  }
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];
214
+ function j() {
215
+ j = Object.assign || function(e) {
216
+ for (var t = 1; t < arguments.length; t++) {
217
+ var r = arguments[t];
218
+ for (var n in r) {
219
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
220
+ e[n] = r[n];
222
221
  }
223
222
  }
224
223
  }
225
224
  return e;
226
225
  };
227
- return T.apply(this, arguments);
226
+ return j.apply(this, arguments);
228
227
  }
229
- function R(e, r) {
228
+ function T(e, t) {
230
229
  if (e == null) return {};
231
- var t = D(e, r);
230
+ var r = D(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 D(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 R = {
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({
262
+ */ function q(e) {
263
+ var t = e.children, i = e.title, a = e.outerStyle, o = T(e, [ "children", "title", "outerStyle" ]);
264
+ var l = (0, r.useContext)(m), s = l.role;
265
+ var c = O()(), p = c.family;
266
+ var u = p === "prisma" ? n().createElement(I, j({
268
267
  as: i ? "h4" : "h5",
269
268
  style: a,
270
269
  "data-test": "heading"
271
- }, o), r) : n().createElement(S(), T({
270
+ }, o), t) : n().createElement(w(), j({
272
271
  style: E(E({}, a), {}, {
273
272
  margin: 0
274
273
  }),
275
274
  level: i ? 4 : "ss",
276
275
  "data-test": "heading"
277
- }, o), r);
276
+ }, o), t);
278
277
  // headings are not supported in role="listbox"
279
278
  // this causes Firefox to incorrectly read the total number
280
279
  // of items in the list if it contains a heading or divider
281
280
  // so we set them to aria-hidden to prevent that
282
281
 
283
- return n().createElement(P, {
282
+ return n().createElement(C, {
284
283
  "aria-hidden": s === "listbox"
285
- }, p);
284
+ }, u);
286
285
  }
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;
286
+ q.propTypes = R;
287
+ /* Remove consecutive items with filterConsecutive = true (Dividers and Headings) */ q.filterConsecutive = true;
288
+ /* Remove the item if it is the last item after filtering. */ q.filterLast = true;
289
+ /* Tag the item as a Heading */ q.as = "Heading";
290
+ /* harmony default export */ const N = q;
292
291
  // CONCATENATED MODULE: external "lodash/isString"
293
- const H = require("lodash/isString");
294
- var A = e.n(H);
292
+ const F = require("lodash/isString");
293
+ var H = e.n(F);
295
294
  // CONCATENATED MODULE: external "@splunk/react-icons/ChevronRight"
296
- const F = require("@splunk/react-icons/ChevronRight");
297
- var $ = e.n(F);
295
+ const $ = require("@splunk/react-icons/ChevronRight");
296
+ var A = e.n($);
298
297
  // CONCATENATED MODULE: external "@splunk/react-icons/Checkmark"
299
298
  const M = require("@splunk/react-icons/Checkmark");
300
- var z = e.n(M);
299
+ var L = e.n(M);
301
300
  // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Check"
302
- const L = require("@splunk/react-icons/enterprise/Check");
303
- var U = e.n(L);
301
+ const z = require("@splunk/react-icons/enterprise/Check");
302
+ var K = e.n(z);
304
303
  // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/ChevronRight"
305
304
  const W = require("@splunk/react-icons/enterprise/ChevronRight");
306
305
  var B = e.n(W);
@@ -308,212 +307,215 @@
308
307
  const G = require("@splunk/react-ui/Clickable");
309
308
  var V = e.n(G);
310
309
  // CONCATENATED MODULE: external "@splunk/react-ui/Switch"
311
- const Q = require("@splunk/react-ui/Switch");
312
- var Y = e.n(Q);
310
+ const U = require("@splunk/react-ui/Switch");
311
+ var X = e.n(U);
313
312
  // 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,
315
- b.pick)({
316
- prisma: b.variables.contentColorDefault,
317
- enterprise: b.variables.textGray
318
- }), b.variables.fontSizeSmall, (0, b.pick)({
313
+ var Y = (0, u.css)([ "color:", ";font-size:", ";line-height:", ";overflow:inherit;white-space:inherit;text-overflow:inherit;" ], (0,
314
+ f.pick)({
315
+ prisma: f.variables.contentColorDefault,
316
+ enterprise: f.variables.textGray
317
+ }), f.variables.fontSizeSmall, (0, f.pick)({
319
318
  prisma: "16px"
320
319
  }));
321
- var X = v().span.withConfig({
320
+ var J = d().span.withConfig({
322
321
  displayName: "ItemStyles__StyledItemDescriptionBottom",
323
322
  componentId: "sc-4kc053-0"
324
- })([ "", ";display:block;" ], J);
325
- var Z = v().span.withConfig({
323
+ })([ "", ";display:block;" ], Y);
324
+ var Q = d().span.withConfig({
326
325
  displayName: "ItemStyles__StyledItemDescriptionRight",
327
326
  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({
327
+ })([ "", ";float:right;", " max-width:50%;text-align:right;box-sizing:border-box;" ], Y, (0,
328
+ f.pick)({
329
+ enterprise: (0, u.css)([ "padding-left:", ";" ], f.variables.spacingLarge)
330
+ }));
331
+ var Z = d().div.withConfig({
330
332
  displayName: "ItemStyles__StyledItemSelectedIcon",
331
333
  componentId: "sc-4kc053-2"
332
- })([ "position:absolute;", " color:", ";" ], (0, b.pick)({
333
- prisma: (0, d.css)([ "right:16px;" ]),
334
- enterprise: (0, d.css)([ "right:3px;left:8px;" ])
335
- }), (0, b.pick)({
336
- prisma: b.variables.contentColorActive,
337
- enterprise: b.variables.accentColorL10
334
+ })([ "position:absolute;", " color:", ";" ], (0, f.pick)({
335
+ prisma: (0, u.css)([ "right:16px;" ]),
336
+ enterprise: (0, u.css)([ "right:3px;left:8px;" ])
337
+ }), (0, f.pick)({
338
+ prisma: f.variables.contentColorActive,
339
+ enterprise: f.variables.accentColorL10
338
340
  }));
339
- var re = v().span.withConfig({
341
+ var ee = d().span.withConfig({
340
342
  displayName: "ItemStyles__StyledItemIcon",
341
343
  componentId: "sc-4kc053-3"
342
344
  })([ "flex:0 0 auto;padding-right:", ";min-width:10px;display:inline-block;text-align:center;vertical-align:", ";", "" ], (0,
343
- b.pick)({
345
+ f.pick)({
344
346
  prisma: "8px",
345
347
  enterprise: "3px"
346
- }), (0, b.pick)({
348
+ }), (0, f.pick)({
347
349
  prisma: "initial",
348
350
  enterprise: "middle"
349
- }), (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);" ])
351
+ }), (0, f.pick)({
352
+ prisma: (0, u.css)([ "color:", ";display:inline-flex;align-items:center;min-width:20px;min-height:20px;& > svg{width:20px;height:20px;}" ], f.variables.contentColorMuted),
353
+ enterprise: (0, u.css)([ "transform:translateY(-1px);" ])
352
354
  }));
353
- var te = v()(V()).withConfig({
355
+ var te = d()(V()).withConfig({
354
356
  displayName: "ItemStyles__StyledClickable",
355
357
  componentId: "sc-4kc053-4"
356
358
  })([ "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,
357
- b.pick)({
358
- prisma: b.variables.contentColorActive,
359
+ f.pick)({
360
+ prisma: f.variables.contentColorActive,
359
361
  enterprise: {
360
- dark: b.variables.gray96,
361
- light: b.variables.gray22
362
+ dark: f.variables.gray96,
363
+ light: f.variables.gray22
362
364
  }
363
- }), (0, b.pick)({
365
+ }), (0, f.pick)({
364
366
  prisma: {
365
367
  comfortable: "10px 16px",
366
368
  compact: "6px 16px"
367
369
  },
368
370
  enterprise: "6px 10px"
369
371
  }), (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;";
372
+ var t = e.$isSelectable, r = e.$selectableAppearance;
373
+ return t && (0, f.pick)({
374
+ prisma: (0, u.css)([ "padding-right:44px;", "" ], (function() {
375
+ return r === "checkbox" && "padding-left: 42px;";
374
376
  })),
375
- enterprise: (0, d.css)([ "padding-right:10px;padding-left:", ";" ], (function() {
376
- return t === "checkbox" ? "32px" : "28px";
377
+ enterprise: (0, u.css)([ "padding-right:10px;padding-left:", ";" ], (function() {
378
+ return r === "checkbox" ? "32px" : "28px";
377
379
  }))
378
380
  });
379
381
  }), (function(e) {
380
- var r = e.$active, t = e.$preventFocus;
381
- return r && !t && (0, d.css)([ "box-shadow:", ";" ], b.variables.focusShadowInset);
382
+ var t = e.$active, r = e.$preventFocus;
383
+ return t && !r && (0, u.css)([ "box-shadow:", ";" ], f.variables.focusShadowInset);
382
384
  }), (function(e) {
383
- var r = e.$active;
384
- return r && (0, d.css)([ "background:", ";font-weight:", ";" ], (0, b.pick)({
385
+ var t = e.$active;
386
+ return t && (0, u.css)([ "background:", ";font-weight:", ";" ], (0, f.pick)({
385
387
  enterprise: {
386
- light: b.variables.gray92,
387
- dark: b.variables.gray22
388
+ light: f.variables.gray92,
389
+ dark: f.variables.gray22
388
390
  },
389
- prisma: b.variables.neutral100
390
- }), b.variables.fontWeightBold);
391
- }), (0, b.pick)({
392
- prisma: b.variables.interactiveColorOverlayHover,
393
- enterprise: b.variables.backgroundColorHover
391
+ prisma: f.variables.neutral100
392
+ }), f.variables.fontWeightBold);
393
+ }), (0, f.pick)({
394
+ prisma: f.variables.interactiveColorOverlayHover,
395
+ enterprise: f.variables.backgroundColorHover
394
396
  }), (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))
397
+ var t = e.$selected;
398
+ return t && (0, f.pick)({
399
+ prisma: (0, u.css)([ "background:", ";" ], f.mixins.overlayColors(f.variables.interactiveColorOverlaySelected, f.variables.interactiveColorOverlayHover))
398
400
  });
399
- }), b.variables.focusShadowInset, (0, b.pick)({
400
- prisma: (0, d.css)([ "background:", ";" ], b.variables.interactiveColorOverlayHover)
401
- }), (0, b.pick)({
402
- prisma: (0, d.css)([ "&:active{background:", ";}" ], b.variables.interactiveColorOverlayActive)
401
+ }), f.variables.focusShadowInset, (0, f.pick)({
402
+ prisma: (0, u.css)([ "background:", ";" ], f.variables.interactiveColorOverlayHover)
403
+ }), (0, f.pick)({
404
+ prisma: (0, u.css)([ "&:active{background:", ";}" ], f.variables.interactiveColorOverlayActive)
403
405
  }), (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))
406
+ var t = e.$selected;
407
+ return t && (0, f.pick)({
408
+ prisma: (0, u.css)([ "background:", ";&:active{background:", ";}" ], f.variables.interactiveColorOverlaySelected, f.mixins.overlayColors(f.variables.interactiveColorOverlaySelected, f.variables.interactiveColorOverlayActive))
407
409
  });
408
- }), (0, b.pick)({
410
+ }), (0, f.pick)({
409
411
  enterprise: {
410
- light: b.variables.gray45,
411
- dark: b.variables.contentColorDisabled
412
+ light: f.variables.gray45,
413
+ dark: f.variables.contentColorDisabled
412
414
  },
413
- prisma: b.variables.contentColorDisabled
415
+ prisma: f.variables.contentColorDisabled
414
416
  }),
415
417
  /* sc-sel */
416
- X,
418
+ J,
417
419
  /* sc-sel */
418
- Z,
420
+ Q,
419
421
  /* sc-sel */
420
- ee, (0, b.pick)({
421
- prisma: b.variables.contentColorDisabled,
422
- enterprise: b.variables.gray80
423
- }), (0, b.pick)({
424
- prisma: (0, d.css)([ "& > * > ", "{color:", ";}" ],
422
+ Z, (0, f.pick)({
423
+ prisma: f.variables.contentColorDisabled,
424
+ enterprise: f.variables.gray80
425
+ }), (0, f.pick)({
426
+ prisma: (0, u.css)([ "& > * > ", "{color:", ";}" ],
425
427
  /* sc-sel */
426
- re, b.variables.contentColorDisabled)
428
+ ee, f.variables.contentColorDisabled)
427
429
  }), (function(e) {
428
- var r = e.$selected;
429
- return r && (0, b.pick)({
430
- prisma: (0, d.css)([ "", "{color:", ";}" ],
430
+ var t = e.$selected;
431
+ return t && (0, f.pick)({
432
+ prisma: (0, u.css)([ "", "{color:", ";}" ],
431
433
  /* sc-sel */
432
- re, b.variables.contentColorActive)
434
+ ee, f.variables.contentColorActive)
433
435
  });
434
436
  }));
435
- var ne = v()(Y()).withConfig({
437
+ var re = d()(X()).withConfig({
436
438
  displayName: "ItemStyles__StyledSwitch",
437
439
  componentId: "sc-4kc053-5"
438
- })([ "position:absolute;left:", ";top:", ";" ], (0, b.pick)({
440
+ })([ "position:absolute;left:", ";top:", ";" ], (0, f.pick)({
439
441
  prisma: "16px",
440
442
  enterprise: "8px"
441
- }), (0, b.pick)({
443
+ }), (0, f.pick)({
442
444
  prisma: "0px",
443
445
  enterprise: {
444
446
  comfortable: "-1px",
445
447
  compact: "2px"
446
448
  }
447
449
  }));
448
- var ie = v().span.withConfig({
450
+ var ne = d().span.withConfig({
449
451
  displayName: "ItemStyles__StyledInnerWrapper",
450
452
  componentId: "sc-4kc053-6"
451
453
  })([ "display:flex;align-items:flex-start;" ]);
452
- var ae = v().span.withConfig({
454
+ var ie = d().span.withConfig({
453
455
  displayName: "ItemStyles__StyledTitleAndDescriptionWrapper",
454
456
  componentId: "sc-4kc053-7"
455
457
  })([ "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;" ]);
458
+ var t = e.$truncate;
459
+ return t && (0, u.css)([ "white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ]);
458
460
  }));
459
- var oe = v().div.withConfig({
461
+ var ae = d().div.withConfig({
460
462
  displayName: "ItemStyles__StyledLabel",
461
463
  componentId: "sc-4kc053-8"
462
464
  })([ "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;" ]);
465
+ var t = e.$truncate;
466
+ return t && (0, u.css)([ "display:block;clear:both;" ]);
465
467
  }));
466
- var le = v().span.withConfig({
468
+ var oe = d().span.withConfig({
467
469
  displayName: "ItemStyles__StyledMatch",
468
470
  componentId: "sc-4kc053-9"
469
- })([ "border-bottom:1px solid ", ";" ], (0, b.pick)({
470
- prisma: b.variables.contentColorActive,
471
+ })([ "border-bottom:1px solid ", ";" ], (0, f.pick)({
472
+ prisma: f.variables.contentColorActive,
471
473
  enterprise: {
472
- dark: b.variables.gray96,
473
- light: b.variables.gray45
474
+ dark: f.variables.gray96,
475
+ light: f.variables.gray45
474
476
  }
475
477
  }));
476
- var se = v().span.withConfig({
478
+ var le = d().span.withConfig({
477
479
  displayName: "ItemStyles__StyledSubmenu",
478
480
  componentId: "sc-4kc053-10"
479
- })([ "float:right;padding-left:", ";color:", ";", "" ], b.variables.spacingSmall, (0,
480
- b.pick)({
481
+ })([ "float:right;padding-left:", ";color:", ";", "" ], f.variables.spacingSmall, (0,
482
+ f.pick)({
481
483
  prisma: "inherit",
482
- enterprise: b.variables.textGray
483
- }), (0, b.pick)({
484
- prisma: (0, d.css)([ "& > svg{width:20px;height:20px;}" ])
484
+ enterprise: f.variables.textGray
485
+ }), (0, f.pick)({
486
+ prisma: (0, u.css)([ "& > svg{width:20px;height:20px;}" ])
485
487
  }));
486
488
  // CONCATENATED MODULE: external "@splunk/react-icons/ArrowSquareTopRight"
487
- const ce = require("@splunk/react-icons/ArrowSquareTopRight");
488
- var ue = e.n(ce);
489
+ const se = require("@splunk/react-icons/ArrowSquareTopRight");
490
+ var ce = e.n(se);
489
491
  // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/External"
490
492
  const pe = require("@splunk/react-icons/enterprise/External");
491
- var fe = e.n(pe);
493
+ var ue = e.n(pe);
492
494
  // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
493
495
  const de = require("@splunk/ui-utils/i18n");
494
496
  // 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({
497
+ var fe = (0, de._)("Open externally");
498
+ var ve = (0, u.css)([ "width:0.8em;height:0.8em;vertical-align:baseline;" ]);
499
+ var be = d()(ue()).withConfig({
498
500
  displayName: "External__StyledEnterprise",
499
501
  componentId: "sc-1turs2s-0"
500
- })([ "", " margin:0 0 0 3px;" ], be);
501
- var ye = v()(ue()).withConfig({
502
+ })([ "", " margin:0 0 0 3px;" ], ve);
503
+ var me = d()(ce()).withConfig({
502
504
  displayName: "External__StyledPrisma",
503
505
  componentId: "sc-1turs2s-1"
504
- })([ "", " margin:0 0 0 4px;" ], be);
506
+ })([ "", " margin:0 0 0 4px;" ], ve);
505
507
  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
510
- }) : n().createElement(ye, {
511
- "aria-label": ve,
508
+ var e = (0, f.useSplunkTheme)(), t = e.isEnterprise, r = e.isCompact;
509
+ var i = r ? "20px" : "24px";
510
+ return t ? n().createElement(be, {
511
+ screenReaderText: fe
512
+ }) : n().createElement(me, {
513
+ "aria-label": fe,
512
514
  height: i,
513
515
  width: i
514
- }, n().createElement("title", null, ve));
516
+ }, n().createElement("title", null, fe));
515
517
  }
516
- /* harmony default export */ const ge = he;
518
+ /* harmony default export */ const ye = he;
517
519
  // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
518
520
  /**
519
521
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
@@ -521,146 +523,146 @@
521
523
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
522
524
  * @param current - The new value of the ref.
523
525
  */
524
- function ke(e, r) {
526
+ function ge(e, t) {
525
527
  if (e) {
526
528
  if (typeof e === "function") {
527
- e(r);
529
+ e(t);
528
530
  } else {
529
531
  // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
530
532
  // the intention here is to signal "we will take care of setting 'current', not you".
531
- e.current = r;
533
+ e.current = t;
532
534
  // eslint-disable-line no-param-reassign
533
535
  }
534
536
  }
535
537
  }
536
538
  // CONCATENATED MODULE: ./src/utils/scrollIntoViewIfNeeded.ts
537
539
  // 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) {
540
+ var ke = function e(t) {
541
+ if (!t) {
540
542
  return;
541
543
  }
542
- var t = r.offsetParent;
543
- if (!t) {
544
+ var r = t.offsetParent;
545
+ if (!r) {
544
546
  return;
545
547
  }
546
548
  // 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;
549
+ if (r.scrollTop + r.clientHeight < t.offsetTop + t.clientHeight) {
550
+ r.scrollTop = t.offsetTop + t.clientHeight - r.clientHeight;
549
551
  // Above the top of the container.
550
- } else if (t.scrollTop > r.offsetTop) {
551
- t.scrollTop = r.offsetTop;
552
+ } else if (r.scrollTop > t.offsetTop) {
553
+ r.scrollTop = t.offsetTop;
552
554
  }
553
555
  };
554
556
  // CONCATENATED MODULE: ./src/Menu/Item.tsx
555
- function we(e) {
557
+ function xe(e) {
556
558
  "@babel/helpers - typeof";
557
559
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
558
- we = function e(r) {
559
- return typeof r;
560
+ xe = function e(t) {
561
+ return typeof t;
560
562
  };
561
563
  } else {
562
- we = function e(r) {
563
- return r && typeof Symbol === "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
564
+ xe = function e(t) {
565
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
564
566
  };
565
567
  }
566
- return we(e);
568
+ return xe(e);
567
569
  }
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];
570
+ function we() {
571
+ we = Object.assign || function(e) {
572
+ for (var t = 1; t < arguments.length; t++) {
573
+ var r = arguments[t];
574
+ for (var n in r) {
575
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
576
+ e[n] = r[n];
575
577
  }
576
578
  }
577
579
  }
578
580
  return e;
579
581
  };
580
- return Se.apply(this, arguments);
582
+ return we.apply(this, arguments);
581
583
  }
582
- function Oe(e, r) {
584
+ function Se(e, t) {
583
585
  if (e == null) return {};
584
- var t = Ce(e, r);
586
+ var r = Oe(e, t);
585
587
  var n, i;
586
588
  if (Object.getOwnPropertySymbols) {
587
589
  var a = Object.getOwnPropertySymbols(e);
588
590
  for (i = 0; i < a.length; i++) {
589
591
  n = a[i];
590
- if (r.indexOf(n) >= 0) continue;
592
+ if (t.indexOf(n) >= 0) continue;
591
593
  if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
592
- t[n] = e[n];
594
+ r[n] = e[n];
593
595
  }
594
596
  }
595
- return t;
597
+ return r;
596
598
  }
597
- function Ce(e, r) {
599
+ function Oe(e, t) {
598
600
  if (e == null) return {};
599
- var t = {};
601
+ var r = {};
600
602
  var n = Object.keys(e);
601
603
  var i, a;
602
604
  for (a = 0; a < n.length; a++) {
603
605
  i = n[a];
604
- if (r.indexOf(i) >= 0) continue;
605
- t[i] = e[i];
606
+ if (t.indexOf(i) >= 0) continue;
607
+ r[i] = e[i];
606
608
  }
607
- return t;
609
+ return r;
608
610
  }
609
- function Pe(e, r) {
610
- if (!(e instanceof r)) {
611
+ function Ce(e, t) {
612
+ if (!(e instanceof t)) {
611
613
  throw new TypeError("Cannot call a class as a function");
612
614
  }
613
615
  }
614
- function Ie(e, r) {
615
- for (var t = 0; t < r.length; t++) {
616
- var n = r[t];
616
+ function Ie(e, t) {
617
+ for (var r = 0; r < t.length; r++) {
618
+ var n = t[r];
617
619
  n.enumerable = n.enumerable || false;
618
620
  n.configurable = true;
619
621
  if ("value" in n) n.writable = true;
620
622
  Object.defineProperty(e, n.key, n);
621
623
  }
622
624
  }
623
- function je(e, r, t) {
624
- if (r) Ie(e.prototype, r);
625
- if (t) Ie(e, t);
625
+ function Pe(e, t, r) {
626
+ if (t) Ie(e.prototype, t);
627
+ if (r) Ie(e, r);
626
628
  return e;
627
629
  }
628
- function Ee(e, r) {
629
- if (typeof r !== "function" && r !== null) {
630
+ function Ee(e, t) {
631
+ if (typeof t !== "function" && t !== null) {
630
632
  throw new TypeError("Super expression must either be null or a function");
631
633
  }
632
- e.prototype = Object.create(r && r.prototype, {
634
+ e.prototype = Object.create(t && t.prototype, {
633
635
  constructor: {
634
636
  value: e,
635
637
  writable: true,
636
638
  configurable: true
637
639
  }
638
640
  });
639
- if (r) _e(e, r);
641
+ if (t) _e(e, t);
640
642
  }
641
- function _e(e, r) {
642
- _e = Object.setPrototypeOf || function e(r, t) {
643
- r.__proto__ = t;
644
- return r;
643
+ function _e(e, t) {
644
+ _e = Object.setPrototypeOf || function e(t, r) {
645
+ t.__proto__ = r;
646
+ return t;
645
647
  };
646
- return _e(e, r);
648
+ return _e(e, t);
647
649
  }
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;
650
+ function je(e) {
651
+ var t = Re();
652
+ return function r() {
653
+ var n = qe(e), i;
654
+ if (t) {
655
+ var a = qe(this).constructor;
654
656
  i = Reflect.construct(n, arguments, a);
655
657
  } else {
656
658
  i = n.apply(this, arguments);
657
659
  }
658
- return Re(this, i);
660
+ return Te(this, i);
659
661
  };
660
662
  }
661
- function Re(e, r) {
662
- if (r && (we(r) === "object" || typeof r === "function")) {
663
- return r;
663
+ function Te(e, t) {
664
+ if (t && (xe(t) === "object" || typeof t === "function")) {
665
+ return t;
664
666
  }
665
667
  return De(e);
666
668
  }
@@ -670,7 +672,7 @@
670
672
  }
671
673
  return e;
672
674
  }
673
- function qe() {
675
+ function Re() {
674
676
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
675
677
  if (Reflect.construct.sham) return false;
676
678
  if (typeof Proxy === "function") return true;
@@ -681,26 +683,26 @@
681
683
  return false;
682
684
  }
683
685
  }
684
- function Ke(e) {
685
- Ke = Object.setPrototypeOf ? Object.getPrototypeOf : function e(r) {
686
- return r.__proto__ || Object.getPrototypeOf(r);
686
+ function qe(e) {
687
+ qe = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
688
+ return t.__proto__ || Object.getPrototypeOf(t);
687
689
  };
688
- return Ke(e);
690
+ return qe(e);
689
691
  }
690
- function Ne(e, r, t) {
691
- if (r in e) {
692
- Object.defineProperty(e, r, {
693
- value: t,
692
+ function Ne(e, t, r) {
693
+ if (t in e) {
694
+ Object.defineProperty(e, t, {
695
+ value: r,
694
696
  enumerable: true,
695
697
  configurable: true,
696
698
  writable: true
697
699
  });
698
700
  } else {
699
- e[r] = t;
701
+ e[t] = r;
700
702
  }
701
703
  return e;
702
704
  }
703
- var He = {
705
+ var Fe = {
704
706
  active: a().bool,
705
707
  children: a().node,
706
708
  description: a().string,
@@ -730,7 +732,7 @@
730
732
  to: a().string,
731
733
  truncate: a().bool
732
734
  };
733
- var Ae = {
735
+ var He = {
734
736
  active: false,
735
737
  descriptionPosition: "bottom",
736
738
  disabled: false,
@@ -742,72 +744,72 @@
742
744
  selected: false,
743
745
  truncate: false
744
746
  };
745
- var Fe = function(e) {
746
- Ee(t, e);
747
- var r = Te(t);
748
- je(t, null, [ {
747
+ var $e = function(e) {
748
+ Ee(r, e);
749
+ var t = je(r);
750
+ Pe(r, null, [ {
749
751
  key: "validateProps",
750
752
  // @docs-props-type ItemPropsBase
751
- value: function e(r) {
753
+ value: function e(t) {
752
754
  if (false) {}
753
755
  }
754
756
  } ]);
755
- function t(e) {
757
+ function r(e) {
756
758
  var n;
757
- Pe(this, t);
758
- n = r.call(this, e);
759
+ Ce(this, r);
760
+ n = t.call(this, e);
759
761
  Ne(De(n), "el", null);
760
762
  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, {
763
+ var t = n.props, r = t.onFocus, i = t.itemKey;
764
+ r === null || r === void 0 ? void 0 : r(e, {
763
765
  itemKey: i
764
766
  });
765
767
  }));
766
768
  Ne(De(n), "handleMount", (function(e) {
767
769
  n.el = e;
768
- ke(n.props.elementRef, e);
770
+ ge(n.props.elementRef, e);
769
771
  }));
770
- t.validateProps(e);
772
+ r.validateProps(e);
771
773
  return n;
772
774
  }
773
- je(t, [ {
775
+ Pe(r, [ {
774
776
  key: "componentDidUpdate",
775
777
  value: function e() {
776
- t.validateProps(this.props);
778
+ r.validateProps(this.props);
777
779
  }
778
780
  }, {
779
781
  key: "focus",
780
782
  value: function e() {
781
- var r;
782
- (r = this.el) === null || r === void 0 ? void 0 : r.focus();
783
+ var t;
784
+ (t = this.el) === null || t === void 0 ? void 0 : t.focus();
783
785
  }
784
786
  }, {
785
787
  key: "scrollIntoViewIfNeeded",
786
788
  value: function e() {
787
- xe(this.el);
789
+ ke(this.el);
788
790
  }
789
791
  }, {
790
792
  key: "renderLabel",
791
793
  value: function e() {
792
- var r = this.props, t = r.children, i = r.matchRanges;
793
- if (!i || !A()(t)) {
794
- return t;
794
+ var t = this.props, r = t.children, i = t.matchRanges;
795
+ if (!i || !H()(r)) {
796
+ return r;
795
797
  }
796
798
  var a = [];
797
799
  // before first match. May be empty string.
798
- a.push(t.substring(0, i[0].start));
799
- i.forEach((function(e, r) {
800
+ a.push(r.substring(0, i[0].start));
801
+ i.forEach((function(e, t) {
800
802
  a.push(
801
803
 
802
804
  // eslint-disable-next-line react/no-array-index-key
803
- n().createElement(le, {
804
- key: r,
805
+ n().createElement(oe, {
806
+ key: t,
805
807
  "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));
808
+ }, r.substring(e.start, e.end)));
809
+ if (t < i.length - 1) {
810
+ a.push(r.substring(e.end, i[t + 1].start));
809
811
  } else {
810
- a.push(t.substring(e.end, t.length));
812
+ a.push(r.substring(e.end, r.length));
811
813
  }
812
814
  }));
813
815
  return a;
@@ -815,8 +817,9 @@
815
817
  }, {
816
818
  key: "render",
817
819
  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;
820
+ 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, d = t.disabled, f = t.onClick, v = t.role, b = t.splunkTheme, m = t.to, h = t.truncate, y = t.descriptionPosition, g = t.openInNewContext, k = Se(t, [ "active", "children", "hasSubmenu", "selectable", "selectableAppearance", "selected", "icon", "description", "disabled", "onClick", "role", "splunkTheme", "to", "truncate", "descriptionPosition", "openInNewContext" ]);
821
+ var x = b.isEnterprise, w = b.isPrisma;
822
+ var S = this.context.preventFocus;
820
823
  var O = o || c;
821
824
  var C = {
822
825
  nonselectable: "menuitem",
@@ -824,98 +827,100 @@
824
827
  checkbox: "menuitemcheckbox"
825
828
  }[O ? s : "nonselectable"];
826
829
  // aria-checked updates only with checkmark appearance for now SUI-2578
827
- var P = {
830
+ var I = {
828
831
  "aria-haspopup": a ? true : undefined,
829
832
  "aria-checked": s === "checkmark" && c ? true : undefined
830
833
  };
831
- var I = S ? "right" : "left";
832
- var j = p && g === "right" && I !== "right";
833
- var E = p && !j;
834
- var _ = c && s === "checkmark" && n().createElement(ee, null, S ? n().createElement(z(), {
834
+ var P = w ? "right" : "left";
835
+ var E = u && y === "right";
836
+ var _ = u && !E;
837
+ var j = c && s === "checkmark" && n().createElement(Z, null, w ? n().createElement(L(), {
835
838
  inline: true,
836
839
  height: "16",
837
840
  width: "16"
838
- }) : n().createElement(U(), {
841
+ }) : n().createElement(K(), {
839
842
  hideDefaultTooltip: true,
840
843
  inline: true,
841
844
  screenReaderText: null,
842
845
  size: .85
843
846
  }));
844
847
 
845
- return n().createElement(te, Se({
848
+ return n().createElement(te, we({
846
849
  $isSelectable: O,
847
850
  $selectableAppearance: s,
848
851
  $selected: c,
849
- $active: t,
850
- $preventFocus: v,
852
+ $active: r,
853
+ $preventFocus: S || false,
851
854
  "data-test-selected": O ? c : null,
852
855
  "data-test": "item",
853
- "data-has-icon": !!u,
854
- disabled: f,
855
- onClick: d,
856
+ "data-has-icon": !!p,
857
+ disabled: d,
858
+ onClick: f,
856
859
  onFocus: this.handleFocus,
857
- onMouseDown: function e(r) {
858
- if (v) {
859
- r.preventDefault();
860
+ onMouseDown: function e(t) {
861
+ if (S) {
862
+ t.preventDefault();
860
863
  }
861
864
  },
862
- role: b || C,
863
- to: y,
864
- title: h && A()(i) ? i : undefined,
865
- openInNewContext: k
866
- }, P, l()(x, "onFocus"), {
865
+ role: v || C,
866
+ tabIndex: S ? -1 : undefined,
867
+ to: m,
868
+ title: h && H()(i) ? i : undefined,
869
+ openInNewContext: g
870
+ }, I, l()(k, "onFocus"), {
867
871
  elementRef: this.handleMount
868
- }), o && s === "checkbox" && n().createElement(ne, {
872
+ }), o && s === "checkbox" && n().createElement(re, {
869
873
  interactive: false,
870
874
  selected: c,
871
875
  selectedLabel: "Selected",
872
876
  value: "menu-item"
873
- }), a && n().createElement(se, null, w ? n().createElement(B(), {
877
+ }), a && n().createElement(le, null, x ? n().createElement(B(), {
874
878
  hideDefaultTooltip: true,
875
879
  screenReaderText: null
876
- }) : n().createElement($(), null)), j && n().createElement(Z, {
880
+ }) : n().createElement(A(), null)), E && n().createElement(Q, {
877
881
  "data-test": "description"
878
- }, p), n().createElement(ie, null, u && n().createElement(re, null, u), n().createElement(ae, {
882
+ }, u), n().createElement(ne, null, p && n().createElement(ee, null, p), n().createElement(ie, {
879
883
  $truncate: h
880
- }, I === "left" && _, n().createElement(oe, {
884
+ }, P === "left" && j, n().createElement(ae, {
881
885
  $truncate: h,
882
886
  "data-test": "label"
883
- }, this.renderLabel(), k && n().createElement(ge, null)), E && n().createElement(X, {
887
+ }, this.renderLabel(), g && n().createElement(ye, null)), _ && n().createElement(J, {
884
888
  "data-test": "description"
885
- }, p), I === "right" && _)));
889
+ }, u), P === "right" && j)));
886
890
  }
887
891
  } ]);
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;
892
+ return r;
893
+ }(r.Component);
894
+ Ne($e, "propTypes", Fe);
895
+ Ne($e, "defaultProps", He);
896
+ Ne($e, "as", void 0);
897
+ Ne($e, "contextType", m);
898
+ var Ae = (0, f.withSplunkTheme)($e);
899
+ var Me = Ae;
900
+ Me.propTypes = $e.propTypes;
896
901
  Me.as = "Item";
897
- /* harmony default export */ const ze = Me;
902
+ /* harmony default export */ const Le = Me;
898
903
  // CONCATENATED MODULE: external "@splunk/react-ui/Scroll"
899
- const Le = require("@splunk/react-ui/Scroll");
900
- var Ue = e.n(Le);
904
+ const ze = require("@splunk/react-ui/Scroll");
905
+ var Ke = e.n(ze);
901
906
  // CONCATENATED MODULE: ./src/Menu/MenuStyles.ts
902
- var We = (0, d.css)([ "border-top:1px solid ", ";" ], (0, b.pick)({
903
- enterprise: b.variables.gray60,
904
- prisma: b.variables.neutral200
907
+ var We = (0, u.css)([ "border-top:1px solid ", ";" ], (0, f.pick)({
908
+ enterprise: f.variables.gray60,
909
+ prisma: f.variables.neutral200
905
910
  }));
906
- var Be = v().div.withConfig({
911
+ var Be = d().div.withConfig({
907
912
  displayName: "MenuStyles__Styled",
908
913
  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,
910
- b.pick)({
911
- enterprise: b.variables.backgroundColor,
912
- prisma: b.variables.backgroundColorPopup
913
- }), b.variables.borderRadius, (0, b.pick)({
914
- prisma: (0, d.css)([ "padding:8px 0;" ])
915
- }), b.variables.focusShadowInset, (0, b.pick)({
916
- prisma: (0, d.css)([ "background:", ";" ], b.variables.interactiveColorOverlayHover)
914
+ })([ "", ";background-color:", ";border-radius:", ";min-width:60px;overflow:auto;position:relative;", " &:focus{outline:0;box-shadow:", ";", "}& + &{", "}" ], f.mixins.reset("block"), (0,
915
+ f.pick)({
916
+ enterprise: f.variables.backgroundColor,
917
+ prisma: f.variables.backgroundColorPopup
918
+ }), f.variables.borderRadius, (0, f.pick)({
919
+ prisma: (0, u.css)([ "padding:8px 0;" ])
920
+ }), f.variables.focusShadowInset, (0, f.pick)({
921
+ prisma: (0, u.css)([ "background:", ";" ], f.variables.interactiveColorOverlayHover)
917
922
  }), We);
918
- var Ge = v()(Be.withComponent(Ue())).withConfig({
923
+ var Ge = d()(Be.withComponent(Ke())).withConfig({
919
924
  displayName: "MenuStyles__StyledScroll",
920
925
  componentId: "sc-1olffp9-1"
921
926
  })([ "", " + &,& + ", "{", "}" ],
@@ -923,379 +928,160 @@
923
928
  Be,
924
929
  /* sc-sel */
925
930
  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
- };
973
931
  // 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];
932
+ function Ve() {
933
+ Ve = Object.assign || function(e) {
934
+ for (var t = 1; t < arguments.length; t++) {
935
+ var r = arguments[t];
936
+ for (var n in r) {
937
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
938
+ e[n] = r[n];
981
939
  }
982
940
  }
983
941
  }
984
942
  return e;
985
943
  };
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);
944
+ return Ve.apply(this, arguments);
1001
945
  }
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) {
946
+ function Ue(e, t) {
1036
947
  if (e == null) return {};
1037
- var t = ar(e, r);
948
+ var r = Xe(e, t);
1038
949
  var n, i;
1039
950
  if (Object.getOwnPropertySymbols) {
1040
951
  var a = Object.getOwnPropertySymbols(e);
1041
952
  for (i = 0; i < a.length; i++) {
1042
953
  n = a[i];
1043
- if (r.indexOf(n) >= 0) continue;
954
+ if (t.indexOf(n) >= 0) continue;
1044
955
  if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
1045
- t[n] = e[n];
956
+ r[n] = e[n];
1046
957
  }
1047
958
  }
1048
- return t;
959
+ return r;
1049
960
  }
1050
- function ar(e, r) {
961
+ function Xe(e, t) {
1051
962
  if (e == null) return {};
1052
- var t = {};
963
+ var r = {};
1053
964
  var n = Object.keys(e);
1054
965
  var i, a;
1055
966
  for (a = 0; a < n.length; a++) {
1056
967
  i = n[a];
1057
- if (r.indexOf(i) >= 0) continue;
1058
- t[i] = e[i];
968
+ if (t.indexOf(i) >= 0) continue;
969
+ r[i] = e[i];
1059
970
  }
1060
- return t;
971
+ return r;
1061
972
  }
1062
- var or = {
973
+ var Ye = {
1063
974
  children: a().node,
1064
975
  /** @private */
1065
976
  controlledExternally: a().bool,
1066
977
  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,
1075
978
  retainFocus: a().bool,
1076
- stopScrollPropagation: a().bool
979
+ stopScrollPropagation: a().bool,
980
+ disableFocusControl: a().bool
1077
981
  };
1078
- var lr = {
1079
- stopScrollPropagation: false
982
+ // the default focus control for Menu: loop, verticalArrows(up/down keys), home/end keys
983
+ var Je = function e(t) {
984
+ return {
985
+ enableLoop: true,
986
+ orientation: "vertical",
987
+ enableTab: t,
988
+ enableHomeEnd: true
989
+ };
1080
990
  };
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" ]);
991
+ function Qe(e) {
992
+ var t = e.children, i = e.controlledExternally, a = e.elementRef, o = e.retainFocus, u = e.stopScrollPropagation, d = e.disableFocusControl, f = Ue(e, [ "children", "controlledExternally", "elementRef", "retainFocus", "stopScrollPropagation", "disableFocusControl" ]);
1083
993
  // @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;
994
+ var v = (0, r.useContext)(m), b = v.role, h = b === void 0 ? "menu" : b;
995
+ var y = (0, r.useContext)(s.PopoverContext), g = y.retainFocus;
996
+ var k = (0, r.useRef)(null);
997
+ var x = true;
998
+ if (o != null) {
999
+ x = o;
1000
+ } else if (g != null) {
1001
+ x = g;
1092
1002
  }
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) {
1003
+ var w = r.Children.toArray(t).filter(r.isValidElement).reduce((function(e, t, r, n) {
1208
1004
  /* Filter out initial Dividers
1209
1005
  * Requires reduce() over filter() because a Heading may have been
1210
1006
  * before the Divider.
1211
1007
  */
1212
- if (r.type.as === "Divider" && e.length === 0) {
1008
+ if (t.type.as === "Divider" && e.length === 0) {
1213
1009
  return e;
1214
1010
  }
1215
1011
  // Filter out consecutive Dividers and Headings
1216
1012
  // 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") {
1013
+ if ((t.type.as === "Heading" || t.type.as === "Divider") && !t.props.title && t.type.filterConsecutive && n.length > r + 1) {
1014
+ var i = n[r + 1];
1015
+ if (i.type.as === "Heading" || i.type.as === "Divider") {
1220
1016
  return e;
1221
1017
  }
1222
1018
  }
1223
1019
  // Filter out last Dividers and Headings
1224
- if ((r.type.as === "Divider" || r.type.as === "Heading") && t === a.length - 1) {
1020
+ if ((t.type.as === "Divider" || t.type.as === "Heading") && r === n.length - 1) {
1225
1021
  return e;
1226
1022
  }
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);
1023
+ e.push(t);
1274
1024
  return e;
1275
1025
  }), []);
1276
- if (R !== P.current && (!q || K) && D && R != null) {
1277
- P.current = R;
1278
- O();
1279
- }
1280
- var $ = {
1026
+ var S = (0, r.useCallback)((function(e) {
1027
+ k.current = e;
1028
+ ge(a, e);
1029
+ }), [ a ]);
1030
+ var O = Je(x);
1031
+ var C = (0, r.useCallback)((function(e) {
1032
+ var t = (0, c.keycode)(e.nativeEvent);
1033
+ if (t === "tab" && (0, p.isTabKey)(e) && e.shiftKey) {
1034
+ t = "tabShift";
1035
+ } else if (t === "tab" && (0, p.isTabKey)(e)) {
1036
+ t = "tab";
1037
+ }
1038
+ var r = t === "tab" || t === "tabShift";
1039
+ var n = t === "enter";
1040
+ // Allow default behavior for the enter key.
1041
+ // If tab navigation is enabled, prevent default behavior for all other keys.
1042
+ // If tab navigation is disabled, allow default behavior for tab and tab+shift key
1043
+ if (!n && (O.enableTab || !r)) {
1044
+ e.preventDefault();
1045
+ }
1046
+ var i = k.current;
1047
+ var a = [];
1048
+ if (i) {
1049
+ a = (0, p.getSortedTabbableElements)(i, {
1050
+ ignoreTabIndex: true
1051
+ });
1052
+ }
1053
+ var o = (e === null || e === void 0 ? void 0 : e.target) instanceof Element ? e.target : null;
1054
+ var l = i === null || i === void 0 ? void 0 : i.querySelector(":focus");
1055
+ var s = o || l;
1056
+ var u = s ? a.indexOf(s) : -1;
1057
+ (0, p.handleFocus)(t, a, u, O);
1058
+ }), [ O ]);
1059
+ var I = function e() {
1060
+ return {
1061
+ role: "menu",
1062
+ preventFocus: i
1063
+ };
1064
+ };
1065
+ var P = !d && !i ? C : undefined;
1066
+ var E = {
1281
1067
  "data-test": "menu",
1282
- onKeyDown: H,
1283
- role: x,
1284
- tabIndex: R == null && !i ? 0 : undefined
1068
+ onKeyDown: P,
1069
+ role: h
1285
1070
  };
1286
- return m ? n().createElement(Ge, Je({}, $, {
1287
- elementRef: a,
1071
+ return u ? n().createElement(Ge, Ve({}, E, {
1072
+ elementRef: S,
1288
1073
  stopScrollPropagation: true
1289
- }, l()(h, "tagName")), F) : n().createElement(Be, Je({}, $, {
1290
- ref: a
1291
- }, h), F);
1074
+ }, l()(f, "tagName")), w) : n().createElement(Be, Ve({}, E, {
1075
+ ref: S
1076
+ }, f), n().createElement(m.Provider, {
1077
+ value: I()
1078
+ }, w));
1292
1079
  }
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;
1080
+ Qe.propTypes = Ye;
1081
+ Qe.Item = Le;
1082
+ Qe.Divider = k;
1083
+ Qe.Heading = N;
1084
+ /* harmony default export */ const Ze = Qe;
1299
1085
  // CONCATENATED MODULE: ./src/Menu/index.ts
1300
- module.exports = r;
1086
+ module.exports = t;
1301
1087
  /******/})();