@splunk/react-ui 4.27.0 → 4.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/Box.js +45 -44
  2. package/Button.js +1 -2
  3. package/ButtonSimple.js +145 -147
  4. package/CHANGELOG.md +36 -2
  5. package/CollapsiblePanel.js +60 -73
  6. package/JSONTree.js +1311 -629
  7. package/Markdown.js +521 -222
  8. package/Modal.js +11 -4
  9. package/Multiselect.js +844 -804
  10. package/Paginator.js +593 -271
  11. package/TabBar.js +487 -312
  12. package/Table.js +5 -3
  13. package/TextArea.js +368 -344
  14. package/Tree.js +607 -519
  15. package/package.json +2 -2
  16. package/types/src/Box/Box.d.ts +3 -2
  17. package/types/src/CollapsiblePanel/CollapsiblePanel.d.ts +5 -4
  18. package/types/src/CollapsiblePanel/SingleOpenPanelGroup.d.ts +4 -4
  19. package/types/src/File/docs/examples/FullScreen.d.ts +1 -14
  20. package/types/src/JSONTree/JSONTreeItem.d.ts +45 -0
  21. package/types/src/JSONTree/renderTreeItems.d.ts +17 -0
  22. package/types/src/Markdown/renderers/MarkdownAnchorHeading.d.ts +1 -1
  23. package/types/src/Markdown/renderers/MarkdownBlockquote.d.ts +1 -1
  24. package/types/src/Markdown/renderers/MarkdownCode.d.ts +1 -1
  25. package/types/src/Markdown/renderers/MarkdownCodeBlock.d.ts +1 -1
  26. package/types/src/Markdown/renderers/MarkdownHeading.d.ts +1 -1
  27. package/types/src/Markdown/renderers/MarkdownImage.d.ts +1 -1
  28. package/types/src/Markdown/renderers/MarkdownItem.d.ts +1 -1
  29. package/types/src/Markdown/renderers/MarkdownList.d.ts +1 -1
  30. package/types/src/Markdown/renderers/MarkdownParagraph.d.ts +1 -1
  31. package/types/src/Modal/Modal.d.ts +4 -5
  32. package/types/src/Multiselect/Normal.d.ts +1 -0
  33. package/types/src/Paginator/Button.d.ts +8 -3
  34. package/types/src/Paginator/Compact.d.ts +50 -0
  35. package/types/src/Paginator/PageControl.d.ts +37 -0
  36. package/types/src/Paginator/PageSelect.d.ts +32 -0
  37. package/types/src/Paginator/Paginator.d.ts +9 -4
  38. package/types/src/Paginator/docs/examples/Compact.d.ts +2 -0
  39. package/types/src/Paginator/docs/examples/CompactCustomLabel.d.ts +2 -0
  40. package/types/src/Paginator/docs/examples/CompactWithLabel.d.ts +2 -0
  41. package/types/src/Paginator/docs/examples/Labelled.d.ts +2 -0
  42. package/types/src/Paginator/docs/examples/PageControl.d.ts +2 -0
  43. package/types/src/Paginator/icons/ChevronLeft.d.ts +5 -0
  44. package/types/src/Paginator/icons/ChevronRight.d.ts +5 -0
  45. package/types/src/SlidingPanels/docs/examples/Modal.d.ts +1 -13
  46. package/types/src/TabBar/Tab.d.ts +12 -2
  47. package/types/src/TabBar/TabBar.d.ts +4 -3
  48. package/types/src/TabBar/TabBarContext.d.ts +6 -1
  49. package/types/src/TextArea/TextArea.d.ts +3 -2
  50. package/types/src/TextArea/icons/ClearButton.d.ts +3 -0
  51. package/types/src/TextArea/icons/SearchIcon.d.ts +1 -0
  52. package/types/src/Tree/TreeContext.d.ts +2 -1
  53. package/types/src/Tree/TreeItem.d.ts +18 -5
  54. package/types/src/JSONTree/JSONTreeContext.d.ts +0 -7
  55. package/types/src/JSONTree/TreeNode.d.ts +0 -44
package/TabBar.js CHANGED
@@ -61,33 +61,33 @@
61
61
  e.r(t);
62
62
  // EXPORTS
63
63
  e.d(t, {
64
- Tab: () => /* reexport */ Y,
65
- default: () => /* reexport */ re
64
+ Tab: () => /* reexport */ le,
65
+ default: () => /* reexport */ we
66
66
  });
67
67
  // CONCATENATED MODULE: external "react"
68
68
  const r = require("react");
69
69
  var n = e.n(r);
70
70
  // CONCATENATED MODULE: external "prop-types"
71
71
  const i = require("prop-types");
72
- var o = e.n(i);
72
+ var a = e.n(i);
73
73
  // CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
74
- const a = require("@splunk/ui-utils/keyboard");
74
+ const o = require("@splunk/ui-utils/keyboard");
75
75
  // CONCATENATED MODULE: external "styled-components"
76
76
  const l = require("styled-components");
77
- var c = e.n(l);
77
+ var s = e.n(l);
78
78
  // CONCATENATED MODULE: external "@splunk/themes"
79
- const s = require("@splunk/themes");
79
+ const c = require("@splunk/themes");
80
80
  // CONCATENATED MODULE: ./src/TabBar/TabBarStyles.ts
81
- var p = c().div.withConfig({
81
+ var u = s().div.withConfig({
82
82
  displayName: "TabBarStyles__Styled",
83
83
  componentId: "sc-1t85fen-0"
84
- })([ "", " position:relative;&::before{content:'';display:block;position:absolute;left:0;top:0;right:0;bottom:0;border:0 solid ", ";}", ";" ], s.mixins.reset("flex"), (0,
85
- s.pick)({
86
- enterprise: s.variables.borderLightColor,
87
- prisma: s.variables.neutral200
88
- }), (0, s.pickVariant)("$layout", {
84
+ })([ "", " position:relative;&::before{content:'';display:block;position:absolute;left:0;top:0;right:0;bottom:0;border:0 solid ", ";}", ";" ], c.mixins.reset("flex"), (0,
85
+ c.pick)({
86
+ enterprise: c.variables.borderLightColor,
87
+ prisma: c.variables.neutral200
88
+ }), (0, c.pickVariant)("$layout", {
89
89
  horizontal: {
90
- prisma: (0, s.pickVariant)("$withUnderline", {
90
+ prisma: (0, c.pickVariant)("$withUnderline", {
91
91
  /* context appearance is only supported for Prisma */
92
92
  true: (0, l.css)([ "&::before{border-bottom-width:1px;}" ])
93
93
  }),
@@ -95,31 +95,65 @@
95
95
  },
96
96
  vertical: (0, l.css)([ "display:inline-block;&::before{border-right-width:1px;}" ])
97
97
  }));
98
+ // CONCATENATED MODULE: external "lodash/omit"
99
+ const p = require("lodash/omit");
100
+ var d = e.n(p);
101
+ // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
102
+ const f = require("@splunk/ui-utils/i18n");
103
+ // CONCATENATED MODULE: external "@splunk/react-icons/DotsThreeVertical"
104
+ const v = require("@splunk/react-icons/DotsThreeVertical");
105
+ var b = e.n(v);
106
+ // CONCATENATED MODULE: external "@splunk/react-ui/Dropdown"
107
+ const h = require("@splunk/react-ui/Dropdown");
108
+ var y = e.n(h);
109
+ // CONCATENATED MODULE: external "@splunk/react-icons/enterprise/MoreVertical"
110
+ const m = require("@splunk/react-icons/enterprise/MoreVertical");
111
+ var g = e.n(m);
98
112
  // CONCATENATED MODULE: external "@splunk/react-ui/Popover"
99
- const u = require("@splunk/react-ui/Popover");
100
- var d = e.n(u);
113
+ const x = require("@splunk/react-ui/Popover");
114
+ var k = e.n(x);
101
115
  // CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
102
- const f = require("@splunk/react-ui/ScreenReaderContent");
103
- var v = e.n(f);
116
+ const w = require("@splunk/react-ui/ScreenReaderContent");
117
+ var C = e.n(w);
104
118
  // CONCATENATED MODULE: external "@splunk/ui-utils/id"
105
- const b = require("@splunk/ui-utils/id");
119
+ const S = require("@splunk/ui-utils/id");
106
120
  // CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
107
- const h = require("@splunk/react-ui/Clickable");
108
- var y = e.n(h);
121
+ const O = require("@splunk/react-ui/Clickable");
122
+ var T = e.n(O);
109
123
  // CONCATENATED MODULE: ./src/TabBar/TabStyles.ts
110
- var m = c()(y()).withConfig({
124
+ var I = (0, c.pick)({
125
+ prisma: (0, l.css)([ "color:", ";" ], c.variables.contentColorActive)
126
+ });
127
+ var j = (0, c.pickVariant)("$layout", {
128
+ horizontal: {
129
+ enterprise: (0, l.css)([ "height:3px;" ])
130
+ },
131
+ vertical: {
132
+ enterprise: (0, l.css)([ "width:3px;" ])
133
+ }
134
+ });
135
+ var z = s()(T()).withConfig({
111
136
  displayName: "TabStyles__StyledClickable",
112
137
  componentId: "sc-1ry8mzj-0"
113
- })([ "flex:0 1 auto;display:block;position:relative;line-height:", ";text-align:center;white-space:nowrap;color:", ";&::after{display:block;content:attr(data-title);font-weight:", ";height:0;color:transparent;overflow:hidden;visibility:hidden;}", ";&[aria-selected='true']{cursor:default;", "}&[aria-selected='false']{box-shadow:none;font-weight:", ";&:hover:not([disabled]){", "}}&:focus{box-shadow:", ";", "}" ], (0,
114
- s.pick)({
138
+ })([ "flex:0 1 auto;display:block;position:relative;line-height:", ";text-align:center;white-space:nowrap;color:", ";&::after{display:block;content:attr(data-title);font-weight:", ";height:0;color:transparent;overflow:hidden;visibility:hidden;}", ";&[aria-selected='true']{cursor:default;", "}&[aria-selected='false']{box-shadow:none;font-weight:", ";&:hover:not([disabled]){", "}&[aria-haspopup='true']{", "}}&:focus{box-shadow:", ";", "}" ], (0,
139
+ c.pick)({
115
140
  enterprise: "24px",
116
141
  prisma: "20px"
117
- }), s.variables.contentColorDefault, s.variables.fontWeightBold, (0, s.pickVariant)("$layout", {
118
- horizontal: (0, l.css)([ "padding:", ";margin-bottom:1px;" ], (0, s.pick)({
119
- enterprise: "3px 20px",
142
+ }), c.variables.contentColorDefault, c.variables.fontWeightBold, (0, c.pickVariant)("$layout", {
143
+ horizontal: (0, l.css)([ "padding:", ";margin-bottom:1px;" ], (0, c.pick)({
144
+ enterprise: (0, c.pickVariant)("$hasMenu", {
145
+ true: "3px 4px 3px 16px",
146
+ false: "3px 20px"
147
+ }),
120
148
  prisma: {
121
- comfortable: "0 20px",
122
- compact: "0 16px"
149
+ comfortable: (0, c.pickVariant)("$hasMenu", {
150
+ true: "0px 8px 0px 16px",
151
+ false: "0px 20px"
152
+ }),
153
+ compact: (0, c.pickVariant)("$hasMenu", {
154
+ true: "0px 8px 0px 12px",
155
+ false: "0 16px"
156
+ })
123
157
  }
124
158
  })),
125
159
  vertical: {
@@ -127,50 +161,48 @@
127
161
  var t = e.$icon;
128
162
  return t && (0, l.css)([ "text-align:center;" ]);
129
163
  })),
130
- prisma: (0, l.css)([ "width:100%;right:1px;padding:", ";" ], (0, s.pick)({
164
+ prisma: (0, l.css)([ "width:100%;right:1px;padding:", ";" ], (0, c.pick)({
131
165
  comfortable: "0 20px",
132
166
  compact: "0 16px"
133
167
  }))
134
168
  }
135
- }), (0, s.pick)({
136
- enterprise: (0, l.css)([ "font-weight:", ";" ], s.variables.fontWeightBold),
137
- prisma: (0, l.css)([ "color:", ";font-weight:", ";" ], s.variables.contentColorActive, s.variables.fontWeightBold)
138
- }), (0, s.pick)({
169
+ }), (0, c.pick)({
170
+ enterprise: (0, l.css)([ "font-weight:", ";" ], c.variables.fontWeightBold),
171
+ prisma: (0, l.css)([ "color:", ";font-weight:", ";" ], c.variables.contentColorActive, c.variables.fontWeightBold)
172
+ }), (0, c.pick)({
139
173
  enterprise: "normal",
140
- prisma: s.variables.fontWeightSemiBold
141
- }), (0, s.pick)({
142
- prisma: (0, l.css)([ "color:", ";" ], s.variables.contentColorActive)
143
- }), s.variables.focusShadowInset, (0, s.pick)({
144
- prisma: (0, l.css)([ "color:", ";" ], s.variables.contentColorActive)
174
+ prisma: c.variables.fontWeightSemiBold
175
+ }), I, I, c.variables.focusShadowInset, (0, c.pick)({
176
+ prisma: (0, l.css)([ "color:", ";" ], c.variables.contentColorActive)
145
177
  }));
146
- var g = c().div.withConfig({
178
+ var M = s().div.withConfig({
147
179
  displayName: "TabStyles__StyledUnderline",
148
180
  componentId: "sc-1ry8mzj-1"
149
- })([ "position:absolute;", " ", ";[aria-selected='true'] > &&{background-color:", ";", ";}", ":hover:not([disabled]) > &&{", ";}" ], (0,
150
- s.pick)({
151
- enterprise: (0, l.css)([ "background:", ";" ], s.variables.borderLightColor)
152
- }), (0, s.pickVariant)("$layout", {
181
+ })([ "position:absolute;", " ", ";[aria-selected='true'] > &&{background-color:", ";", ";}", ":hover:not([disabled]) > &&{", ";}[aria-selected='false'][aria-haspopup='true'] > &&{", "}" ], (0,
182
+ c.pick)({
183
+ enterprise: (0, l.css)([ "background:", ";" ], c.variables.borderLightColor)
184
+ }), (0, c.pickVariant)("$layout", {
153
185
  horizontal: (0, l.css)([ "height:0;box-sizing:border-box;width:", ";", " transition:height 0.2s;" ], (0,
154
- s.pick)({
186
+ c.pick)({
155
187
  enterprise: (0, l.css)([ "calc(100% - 20px * 2)" ]),
156
188
  prisma: {
157
189
  comfortable: (0, l.css)([ "calc(100% - 20px * 2)" ]),
158
190
  compact: (0, l.css)([ "calc(100% - 16px * 2)" ])
159
191
  }
160
- }), (0, s.pick)({
192
+ }), (0, c.pick)({
161
193
  enterprise: (0, l.css)([ "bottom:-1px;" ])
162
194
  })),
163
195
  vertical: {
164
196
  enterprise: (0, l.css)([ "width:0;height:calc(100% - 10px * 2);top:10px;right:-1px;transition:width 0.2s;" ]),
165
197
  prisma: (0, l.css)([ "width:1px;height:calc(100% - 10px * 2);top:10px;right:-1px;transition:width 0.2s;box-sizing:border-box;" ])
166
198
  }
167
- }), (0, s.pick)({
168
- enterprise: s.variables.accentColor,
169
- prisma: s.variables.contentColorActive
170
- }), (0, s.pickVariant)("$layout", {
199
+ }), (0, c.pick)({
200
+ enterprise: c.variables.accentColor,
201
+ prisma: c.variables.contentColorActive
202
+ }), (0, c.pickVariant)("$layout", {
171
203
  horizontal: {
172
204
  enterprise: (0, l.css)([ "height:3px;" ]),
173
- prisma: (0, s.pickVariant)("$withUnderline", {
205
+ prisma: (0, c.pickVariant)("$withUnderline", {
174
206
  // context appearance is only supported for Prisma
175
207
  true: (0, l.css)([ "height:1px;" ])
176
208
  })
@@ -179,67 +211,88 @@
179
211
  enterprise: (0, l.css)([ "width:3px;" ]),
180
212
  prisma: (0, l.css)([ "width:1px;" ])
181
213
  }
182
- }), m, (0, s.pickVariant)("$layout", {
183
- horizontal: {
184
- enterprise: (0, l.css)([ "height:3px;" ])
185
- },
186
- vertical: {
187
- enterprise: (0, l.css)([ "width:3px;" ])
188
- }
189
- }));
190
- var x = c().span.withConfig({
191
- displayName: "TabStyles__StyledIcon",
214
+ }), z, j, j);
215
+ var _ = s().span.withConfig({
216
+ displayName: "TabStyles__StyledMenu",
192
217
  componentId: "sc-1ry8mzj-2"
193
- })([ "", ";" ], (0, s.pickVariant)("$iconSize", {
218
+ })([ "display:inline-block;> svg{transform:translateY(-1px);}border-radius:", ";cursor:pointer;", " &:hover{", "}", "[aria-haspopup='true'] &,", ":hover &,", ":focus &{visibility:visible;}" ], c.variables.borderRadius, (0,
219
+ c.pickVariant)("$active", {
220
+ false: (0, l.css)([ "visibility:hidden;" ])
221
+ }), (0, c.pick)({
222
+ enterprise: (0, l.css)([ "color:", ";background-color:", ";border-color:", ";" ], (0,
223
+ c.pick)({
224
+ light: c.variables.linkColor,
225
+ dark: c.variables.white
226
+ }), c.variables.backgroundColorHover, (0, c.pick)({
227
+ light: c.variables.gray60,
228
+ dark: c.variables.borderColor
229
+ })),
230
+ prisma: (0, l.css)([ "background-color:", ";border-color:", ";box-shadow:", ";" ], c.variables.interactiveColorOverlayHover, c.variables.interactiveColorBorderHover, c.variables.hoverShadow)
231
+ }), z, z, z);
232
+ var E = s().span.withConfig({
233
+ displayName: "TabStyles__StyledIcon",
234
+ componentId: "sc-1ry8mzj-3"
235
+ })([ "", ";" ], (0, c.pickVariant)("$iconSize", {
194
236
  inline: (0, l.css)([ "", " text-align:left;padding-right:", ";> svg{transform:translateY(-1px);}" ], (0,
195
- s.pick)({
237
+ c.pick)({
196
238
  prisma: (0, l.css)([ "display:inline-block;width:16px;height:16px;" ])
197
- }), (0, s.pick)({
239
+ }), (0, c.pick)({
198
240
  enterprise: "0.4em",
199
241
  prisma: "8px"
200
242
  })),
201
243
  small: (0, l.css)([ "font-size:24px;height:24px;text-align:center;display:block;padding:4px 0;" ]),
202
244
  large: (0, l.css)([ "font-size:48px;height:48px;text-align:center;display:block;padding:8px 0 0;" ])
203
245
  }));
204
- var k = c().div.withConfig({
246
+ var P = s().div.withConfig({
247
+ displayName: "TabStyles__StyledLabelAndMenuContainer",
248
+ componentId: "sc-1ry8mzj-4"
249
+ })([ "display:flex;align-items:center;justify-content:center;gap:8px;" ]);
250
+ var $ = s().div.withConfig({
205
251
  displayName: "TabStyles__StyledLabel",
206
- componentId: "sc-1ry8mzj-3"
252
+ componentId: "sc-1ry8mzj-5"
207
253
  })([ "overflow:hidden;text-overflow:ellipsis;min-width:10px;margin:", ";" ], (0,
208
- s.pick)({
254
+ c.pick)({
209
255
  enterprise: "0",
210
256
  prisma: {
211
257
  comfortable: "16px 0",
212
258
  compact: "10px 0"
213
259
  }
214
260
  }));
215
- var w = c().span.withConfig({
261
+ var D = s().span.withConfig({
216
262
  displayName: "TabStyles__StyledCount",
217
- componentId: "sc-1ry8mzj-4"
218
- })([ "display:inline-block;border-radius:18px;color:", ";font-size:", ";line-height:10px;padding:", ";margin-inline-start:", ";", " &[disabled]{background:", ";color:", ";}" ], s.variables.contentColorDefault, (0,
219
- s.pick)({
263
+ componentId: "sc-1ry8mzj-6"
264
+ })([ "display:inline-block;border-radius:18px;color:", ";font-size:", ";line-height:10px;padding:", ";margin-inline-start:", ";", " &[disabled]{background:", ";color:", ";}" ], c.variables.contentColorDefault, (0,
265
+ c.pick)({
220
266
  enterprise: "inherit",
221
267
  prisma: "10px"
222
- }), (0, s.pick)({
268
+ }), (0, c.pick)({
223
269
  enterprise: "0.4em 0.3em",
224
270
  prisma: "0.4em 0.6em"
225
- }), (0, s.pick)({
271
+ }), (0, c.pick)({
226
272
  enterprise: "0",
227
273
  prisma: "0.3em"
228
- }), (0, s.pick)({
274
+ }), (0, c.pick)({
229
275
  enterprise: (0, l.css)([ "&::before{content:'(';}&::after{content:')';}" ]),
230
- prisma: (0, l.css)([ "background:", ";" ], s.variables.neutral100)
231
- }), s.variables.interactiveColorBackgroundDisabled, s.variables.contentColorDisabled);
232
- var O = c().div.withConfig({
276
+ prisma: (0, l.css)([ "background:", ";" ], c.variables.neutral100)
277
+ }), c.variables.interactiveColorBackgroundDisabled, c.variables.contentColorDisabled);
278
+ var R = s().div.withConfig({
233
279
  displayName: "TabStyles__StyledTooltipContent",
234
- componentId: "sc-1ry8mzj-5"
235
- })([ "padding:8px;font-size:", ";" ], s.variables.fontSizeSmall);
280
+ componentId: "sc-1ry8mzj-7"
281
+ })([ "padding:8px;font-size:", ";" ], c.variables.fontSizeSmall);
236
282
  // CONCATENATED MODULE: ./src/TabBar/TabBarContext.tsx
237
- var S = (0, r.createContext)({});
238
- S.displayName = "TabBar";
239
- /* harmony default export */ const C = S;
283
+ var q = function e() {
284
+ return undefined;
285
+ };
286
+ var A = (0, r.createContext)({
287
+ onMenuOpen: q,
288
+ onMenuClose: q,
289
+ isMenuOpen: false
290
+ });
291
+ A.displayName = "TabBar";
292
+ /* harmony default export */ const V = A;
240
293
  // CONCATENATED MODULE: ./src/utils/getCountValue.ts
241
294
  // A utility for max count
242
- var T = function e(t, r) {
295
+ var K = function e(t, r) {
243
296
  if (t > r) {
244
297
  return "".concat(r, "+");
245
298
  }
@@ -252,7 +305,7 @@
252
305
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
253
306
  * @param current - The new value of the ref.
254
307
  */
255
- function I(e, t) {
308
+ function B(e, t) {
256
309
  if (e) {
257
310
  if (typeof e === "function") {
258
311
  e(t);
@@ -265,21 +318,21 @@
265
318
  }
266
319
  }
267
320
  // CONCATENATED MODULE: ./src/TabBar/Tab.tsx
268
- function j(e) {
321
+ function F(e) {
269
322
  "@babel/helpers - typeof";
270
323
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
271
- j = function e(t) {
324
+ F = function e(t) {
272
325
  return typeof t;
273
326
  };
274
327
  } else {
275
- j = function e(t) {
328
+ F = function e(t) {
276
329
  return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
277
330
  };
278
331
  }
279
- return j(e);
332
+ return F(e);
280
333
  }
281
- function z() {
282
- z = Object.assign || function(e) {
334
+ function N() {
335
+ N = Object.assign || function(e) {
283
336
  for (var t = 1; t < arguments.length; t++) {
284
337
  var r = arguments[t];
285
338
  for (var n in r) {
@@ -290,16 +343,16 @@
290
343
  }
291
344
  return e;
292
345
  };
293
- return z.apply(this, arguments);
346
+ return N.apply(this, arguments);
294
347
  }
295
- function _(e, t) {
348
+ function U(e, t) {
296
349
  if (e == null) return {};
297
- var r = E(e, t);
350
+ var r = W(e, t);
298
351
  var n, i;
299
352
  if (Object.getOwnPropertySymbols) {
300
- var o = Object.getOwnPropertySymbols(e);
301
- for (i = 0; i < o.length; i++) {
302
- n = o[i];
353
+ var a = Object.getOwnPropertySymbols(e);
354
+ for (i = 0; i < a.length; i++) {
355
+ n = a[i];
303
356
  if (t.indexOf(n) >= 0) continue;
304
357
  if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
305
358
  r[n] = e[n];
@@ -307,24 +360,24 @@
307
360
  }
308
361
  return r;
309
362
  }
310
- function E(e, t) {
363
+ function W(e, t) {
311
364
  if (e == null) return {};
312
365
  var r = {};
313
366
  var n = Object.keys(e);
314
- var i, o;
315
- for (o = 0; o < n.length; o++) {
316
- i = n[o];
367
+ var i, a;
368
+ for (a = 0; a < n.length; a++) {
369
+ i = n[a];
317
370
  if (t.indexOf(i) >= 0) continue;
318
371
  r[i] = e[i];
319
372
  }
320
373
  return r;
321
374
  }
322
- function P(e, t) {
375
+ function L(e, t) {
323
376
  if (!(e instanceof t)) {
324
377
  throw new TypeError("Cannot call a class as a function");
325
378
  }
326
379
  }
327
- function $(e, t) {
380
+ function H(e, t) {
328
381
  for (var r = 0; r < t.length; r++) {
329
382
  var n = t[r];
330
383
  n.enumerable = n.enumerable || false;
@@ -333,12 +386,12 @@
333
386
  Object.defineProperty(e, n.key, n);
334
387
  }
335
388
  }
336
- function R(e, t, r) {
337
- if (t) $(e.prototype, t);
338
- if (r) $(e, r);
389
+ function Y(e, t, r) {
390
+ if (t) H(e.prototype, t);
391
+ if (r) H(e, r);
339
392
  return e;
340
393
  }
341
- function D(e, t) {
394
+ function G(e, t) {
342
395
  if (typeof t !== "function" && t !== null) {
343
396
  throw new TypeError("Super expression must either be null or a function");
344
397
  }
@@ -349,41 +402,41 @@
349
402
  configurable: true
350
403
  }
351
404
  });
352
- if (t) M(e, t);
405
+ if (t) J(e, t);
353
406
  }
354
- function M(e, t) {
355
- M = Object.setPrototypeOf || function e(t, r) {
407
+ function J(e, t) {
408
+ J = Object.setPrototypeOf || function e(t, r) {
356
409
  t.__proto__ = r;
357
410
  return t;
358
411
  };
359
- return M(e, t);
412
+ return J(e, t);
360
413
  }
361
- function q(e) {
362
- var t = A();
414
+ function Q(e) {
415
+ var t = ee();
363
416
  return function r() {
364
- var n = B(e), i;
417
+ var n = te(e), i;
365
418
  if (t) {
366
- var o = B(this).constructor;
367
- i = Reflect.construct(n, arguments, o);
419
+ var a = te(this).constructor;
420
+ i = Reflect.construct(n, arguments, a);
368
421
  } else {
369
422
  i = n.apply(this, arguments);
370
423
  }
371
- return K(this, i);
424
+ return X(this, i);
372
425
  };
373
426
  }
374
- function K(e, t) {
375
- if (t && (j(t) === "object" || typeof t === "function")) {
427
+ function X(e, t) {
428
+ if (t && (F(t) === "object" || typeof t === "function")) {
376
429
  return t;
377
430
  }
378
- return V(e);
431
+ return Z(e);
379
432
  }
380
- function V(e) {
433
+ function Z(e) {
381
434
  if (e === void 0) {
382
435
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
383
436
  }
384
437
  return e;
385
438
  }
386
- function A() {
439
+ function ee() {
387
440
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
388
441
  if (Reflect.construct.sham) return false;
389
442
  if (typeof Proxy === "function") return true;
@@ -394,13 +447,13 @@
394
447
  return false;
395
448
  }
396
449
  }
397
- function B(e) {
398
- B = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
450
+ function te(e) {
451
+ te = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
399
452
  return t.__proto__ || Object.getPrototypeOf(t);
400
453
  };
401
- return B(e);
454
+ return te(e);
402
455
  }
403
- function N(e, t, r) {
456
+ function re(e, t, r) {
404
457
  if (t in e) {
405
458
  Object.defineProperty(e, t, {
406
459
  value: r,
@@ -413,88 +466,103 @@
413
466
  }
414
467
  return e;
415
468
  }
416
- var W = {
469
+ var ne = {
417
470
  /** @private. Is the tab active. */
418
- active: o().bool,
419
- ariaControls: o().string,
420
- count: o().number,
421
- disabled: o().bool,
422
- elementRef: o().oneOfType([ o().func, o().object ]),
423
- icon: o().node,
424
- id: o().string,
425
- label: o().oneOfType([ o().string, o().element ]),
471
+ active: a().bool,
472
+ ariaControls: a().string,
473
+ count: a().number,
474
+ disabled: a().bool,
475
+ elementRef: a().oneOfType([ a().func, a().object ]),
476
+ icon: a().node,
477
+ id: a().string,
478
+ label: a().oneOfType([ a().string, a().element ]),
426
479
  /** @private Maximum count number in tab label */
427
- maxCount: o().number,
480
+ maxCount: a().number,
428
481
  /** @private */
429
- splunkTheme: o().object,
430
- tabId: o().string,
482
+ splunkTheme: a().object,
483
+ tabId: a().string,
431
484
  /** @private. The internal key of the tab */
432
- tabKey: o().number,
433
- to: o().string,
434
- tooltip: o().node
485
+ tabKey: a().number,
486
+ to: a().string,
487
+ tooltip: a().node,
488
+ /**
489
+ * @private
490
+ * Accepts a Menu component that is rendered for that Tab.
491
+ * Is not compatible with `count`.
492
+ * The `menu` prop is only supported in horizontal layout due to both design constraints as well as keyboard support.
493
+ */
494
+ menu: a().node
435
495
  };
436
- var F = {
496
+ var ie = {
437
497
  active: false
438
498
  };
439
- var U = function(e) {
440
- D(r, e);
441
- var t = q(r);
499
+ var ae = function(e) {
500
+ G(r, e);
501
+ var t = Q(r);
442
502
  // @docs-props-type TabPropsBase
443
503
  function r(e) {
444
504
  var n;
445
- P(this, r);
505
+ L(this, r);
446
506
  n = t.call(this, e);
447
- N(V(n), "popoverId", void 0);
448
- N(V(n), "ariaId", void 0);
449
- N(V(n), "handleMount", (function(e) {
507
+ re(Z(n), "popoverId", void 0);
508
+ re(Z(n), "ariaId", void 0);
509
+ re(Z(n), "menuDescription", void 0);
510
+ re(Z(n), "handleMount", (function(e) {
450
511
  n.setState({
451
512
  anchor: e
452
513
  });
453
- I(n.props.elementRef, e);
514
+ B(n.props.elementRef, e);
454
515
  }));
455
- N(V(n), "handleTooltipOpen", (function() {
516
+ re(Z(n), "handleTooltipOpen", (function() {
456
517
  n.setState({
457
518
  open: true
458
519
  });
459
520
  }));
460
- N(V(n), "handleTooltipClose", (function() {
521
+ re(Z(n), "handleTooltipClose", (function() {
461
522
  n.setState({
462
523
  open: false
463
524
  });
464
525
  }));
465
- N(V(n), "handleClick", (function(e) {
466
- var t = n.props, r = t.active, i = t.tabId, o = t.tabKey, a = t.to;
526
+ re(Z(n), "handleClick", (function(e) {
527
+ var t = n.props, r = t.active, i = t.tabId, a = t.tabKey, o = t.to;
467
528
  var l = n.context.onClick;
468
529
  // preserve the previous behaviour from 2ad8e7eaf47 to avoid firing unnecessary onChange events
469
530
  // while preventing the "to" prop from incorrectly triggering <Clickable>'s providedOnClick on the active tab
470
531
  if (!r) {
471
532
  l === null || l === void 0 ? void 0 : l(e, {
472
533
  tabId: i,
473
- tabKey: o
534
+ tabKey: a
474
535
  });
475
536
  }
476
- if (a == null || a != null && r) {
537
+ if (o == null || o != null && r) {
477
538
  e.preventDefault();
478
539
  }
479
540
  }));
480
- N(V(n), "handleFocus", (function(e) {
541
+ re(Z(n), "handleFocus", (function(e) {
481
542
  n.handleTooltipOpen();
482
543
  var t = n.props, r = t.tabId, i = t.tabKey;
483
- var o = n.context.onFocus;
484
- o === null || o === void 0 ? void 0 : o(e, {
544
+ var a = n.context.onFocus;
545
+ a === null || a === void 0 ? void 0 : a(e, {
485
546
  tabId: r,
486
547
  tabKey: i
487
548
  });
488
549
  }));
489
- n.popoverId = (0, b.createDOMID)("popover");
490
- n.ariaId = (0, b.createDOMID)("aria-id");
550
+ re(Z(n), "handleFocusMenuToggle", (function() {
551
+ n.focus();
552
+ }));
553
+ re(Z(n), "handleBlur", (function() {
554
+ n.handleTooltipClose();
555
+ }));
556
+ n.popoverId = (0, S.createDOMID)("popover");
557
+ n.ariaId = (0, S.createDOMID)("aria-id");
558
+ n.menuDescription = (0, S.createDOMID)("menu-description");
491
559
  n.state = {
492
560
  open: false,
493
561
  anchor: null
494
562
  };
495
563
  return n;
496
564
  }
497
- R(r, [ {
565
+ Y(r, [ {
498
566
  key: "focus",
499
567
  value: function e() {
500
568
  var t;
@@ -503,116 +571,145 @@
503
571
  }, {
504
572
  key: "render",
505
573
  value: function e() {
506
- var t = this.props, r = t.active, i = t.ariaControls, o = t.count, a = t.disabled, l = t.icon, c = t.label, s = t.tabId, p = t.maxCount, u = t.splunkTheme, f = t.to, b = t.tooltip, h = _(t, [ "active", "ariaControls", "count", "disabled", "icon", "label", "tabId", "maxCount", "splunkTheme", "to", "tooltip" ]);
507
- var y = this.state, S = y.anchor, C = y.open;
508
- var I = this.context, j = I.appearance, E = I.disabled, P = I.iconSize, $ = I.layout, R = I.width;
509
- var D = h.style;
510
- var M = E || a || false;
511
- var q = P || "inline";
512
- var K = $ || "horizontal";
513
- var V = R ? {
514
- width: R
515
- } : D;
516
- var A = u.isEnterprise;
517
- var B = c ? c.toString() : "";
518
- var N = o === 0 || o ? "".concat(o === null || o === void 0 ? void 0 : o.toString()) : "";
574
+ var t = this.props, r = t.active, i = t.ariaControls, a = t.count, o = t.disabled, l = t.icon, s = t.label, c = t.tabId, u = t.maxCount, p = t.splunkTheme, v = t.to, h = t.tooltip, m = t.menu, x = t.tabKey, w = U(t, [ "active", "ariaControls", "count", "disabled", "icon", "label", "tabId", "maxCount", "splunkTheme", "to", "tooltip", "menu", "tabKey" ]);
575
+ var S = this.state, O = S.anchor, T = S.open;
576
+ var I = this.context, j = I.appearance, q = I.disabled, A = I.iconSize, V = I.layout, B = I.width, F = I.onMenuOpen, W = I.onMenuClose, L = I.isMenuOpen, H = I.focusedTabKey;
577
+ var Y = w.style;
578
+ var G = q || o || false;
579
+ var J = A || "inline";
580
+ var Q = V || "horizontal";
581
+ var X = B ? {
582
+ width: B
583
+ } : Y;
584
+ var Z = p.isEnterprise;
585
+ var ee = s ? s.toString() : "";
586
+ var te = a === 0 || a ? "".concat(a === null || a === void 0 ? void 0 : a.toString()) : "";
519
587
  // title is used for CSS styling in TabStyles. labelValue and countValue needs to be included in the title.
520
- var W;
521
- if (A) {
588
+ var re;
589
+ if (Z) {
522
590
  // countValue needs unicode space for width to not change after it's clicked.
523
- var F = N ? "(".concat(N, ")  ") : "";
524
- W = "".concat(B, " ").concat(F);
591
+ var ne = te ? "(".concat(te, ")  ") : "";
592
+ re = "".concat(ee, " ").concat(ne);
525
593
  } else {
526
- W = "".concat(B, "    ").concat(N);
594
+ re = "".concat(ee, "    ").concat(te);
527
595
  }
596
+ var ie = H === x && L && !!m;
597
+ var ae = n().createElement(_, {
598
+ $active: r,
599
+ "data-test": "menu-toggle",
600
+ tabIndex: -1,
601
+ onFocus: this.handleFocusMenuToggle
602
+ }, Z ? n().createElement(g(), {
603
+ size: 1.1
604
+ }) : n().createElement(b(), null));
605
+ var oe = function e(t) {
606
+ // if there is no menu, or if we are not in horizontal, do not render menu container
607
+ if (!m || Q !== "horizontal") {
608
+ return t;
609
+ }
610
+
611
+ return n().createElement(P, null, t, n().createElement(y(), {
612
+ toggle: ae,
613
+ align: "center",
614
+ onRequestOpen: F,
615
+ onRequestClose: W,
616
+ open: ie
617
+ }, m));
618
+ };
528
619
 
529
620
  // TODO: Fix the ts error: https://splunk.atlassian.net/browse/SUI-5569
530
621
  // eslint-disable-next-line
531
622
  // @ts-ignore-next-line
532
- return n().createElement(m, z({
623
+ return n().createElement(z, N({
533
624
  "aria-controls": i,
534
625
  "aria-selected": r,
535
626
  "aria-labelledby": this.ariaId,
627
+ "aria-describedby": m ? this.menuDescription : undefined,
628
+ "aria-haspopup": ie,
536
629
  "data-test": "tab",
537
- "data-test-tab-id": s,
538
- "data-test-popover-id": b ? this.popoverId : undefined,
539
- $layout: K,
540
- $icon: l && q !== "inline" ? true : undefined,
541
- disabled: M,
542
- elementRef: this.handleMount,
543
- style: V
544
- }, h, {
630
+ "data-test-tab-id": c,
631
+ "data-test-popover-id": h ? this.popoverId : undefined,
632
+ $layout: Q,
633
+ $icon: l && J !== "inline" ? true : undefined,
634
+ disabled: G,
635
+ style: X,
636
+ elementRef: this.handleMount
637
+ }, d()(w, "elementRef"), {
545
638
  onClick: this.handleClick,
546
639
  onFocus: this.handleFocus,
547
640
  onMouseEnter: this.handleTooltipOpen,
548
- onBlur: this.handleTooltipClose,
641
+ onBlur: this.handleBlur,
549
642
  onMouseLeave: this.handleTooltipClose,
550
643
  role: "tab",
551
644
  tabIndex: r ? undefined : -1,
552
- "data-title": W,
553
- to: f
554
- }), n().createElement(k, {
645
+ "data-title": re,
646
+ to: v,
647
+ $hasMenu: !!m
648
+ }), oe( n().createElement($, {
555
649
  "data-test": "label",
556
650
  $withUnderline: j === "navigation"
557
- }, l && n().createElement(x, {
558
- $iconSize: q
559
- }, l), c, (o === 0 || o) && n().createElement(n().Fragment, null, n().createElement(v(), null, " "), n().createElement(w, {
651
+ }, l && n().createElement(E, {
652
+ $iconSize: J
653
+ }, l), s, !m && (a === 0 || a) && n().createElement(n().Fragment, null, n().createElement(C(), null, " "), n().createElement(D, {
560
654
  "data-test": "count",
561
- disabled: M
562
- }, p ? T(o, p) : o))), n().createElement(g, {
563
- $layout: K,
655
+ disabled: G
656
+ }, u ? K(a, u) : a)), !!m && n().createElement(C(), {
657
+ "aria-hidden": true,
658
+ id: this.menuDescription
659
+ }, (0, f._)("Press Shift + F10 to open the tab’s menu")))), n().createElement(M, {
660
+ $layout: Q,
564
661
  $withUnderline: j === "navigation"
565
- }), !a && b && n().createElement(d(), {
662
+ }), !o && h && n().createElement(k(), {
566
663
  role: "tooltip",
567
- anchor: S,
664
+ anchor: O,
568
665
  animationConfig: {
569
666
  tension: 400
570
667
  },
571
668
  appearance: "inverted",
572
669
  closeReasons: [ "offScreen", "escapeKey" ],
573
- defaultPlacement: K === "vertical" ? "right" : "above",
670
+ defaultPlacement: Q === "vertical" ? "right" : "above",
574
671
  id: this.popoverId,
575
- open: !!S && C,
672
+ open: !!O && T,
576
673
  align: "center"
577
- }, n().createElement(O, null, b)), b && n().createElement(v(), {
674
+ }, n().createElement(R, null, h)), h && n().createElement(C(), {
578
675
  "aria-hidden": "true",
579
676
  id: this.ariaId
580
- }, b));
677
+ }, h));
581
678
  }
582
679
  } ]);
583
680
  return r;
584
681
  }(r.Component);
585
- N(U, "propTypes", W);
586
- N(U, "defaultProps", F);
587
- N(U, "contextType", C);
588
- var L = (0, s.withSplunkTheme)(U);
589
- L.propTypes = U.propTypes;
590
- /* harmony default export */ const Y = L;
682
+ re(ae, "propTypes", ne);
683
+ re(ae, "defaultProps", ie);
684
+ re(ae, "contextType", V);
685
+ var oe = (0, c.withSplunkTheme)(ae);
686
+ oe.propTypes = ae.propTypes;
687
+ /* harmony default export */ const le = oe;
591
688
  // CONCATENATED MODULE: ./src/utils/navigateList.ts
592
689
  // A utility for keyboard navigation of lists
593
- function G(e, t, r) {
690
+ function se(e, t, r) {
594
691
  for (var n = 0; n < e.length; n += 1) {
595
692
  var i;
596
- var o = (n + r) % e.length;
597
- if (((i = e[o].current) === null || i === void 0 ? void 0 : i.props.disabled) !== true) {
598
- return e[o];
693
+ var a = (n + r) % e.length;
694
+ if (((i = e[a].current) === null || i === void 0 ? void 0 : i.props.disabled) !== true) {
695
+ return e[a];
599
696
  }
600
697
  }
601
698
  return e[t];
602
699
  }
603
- function H(e, t, r) {
700
+ function ce(e, t, r) {
604
701
  for (var n = e.length; n > 0; n -= 1) {
605
702
  var i;
606
- var o = (n + r) % e.length;
607
- if (((i = e[o].current) === null || i === void 0 ? void 0 : i.props.disabled) !== true) {
608
- return e[o];
703
+ var a = (n + r) % e.length;
704
+ if (((i = e[a].current) === null || i === void 0 ? void 0 : i.props.disabled) !== true) {
705
+ return e[a];
609
706
  }
610
707
  }
611
708
  return e[t];
612
709
  }
613
710
  // CONCATENATED MODULE: ./src/TabBar/TabBar.tsx
614
- function J() {
615
- J = Object.assign || function(e) {
711
+ function ue() {
712
+ ue = Object.assign || function(e) {
616
713
  for (var t = 1; t < arguments.length; t++) {
617
714
  var r = arguments[t];
618
715
  for (var n in r) {
@@ -623,16 +720,63 @@
623
720
  }
624
721
  return e;
625
722
  };
626
- return J.apply(this, arguments);
723
+ return ue.apply(this, arguments);
724
+ }
725
+ function pe(e, t) {
726
+ return he(e) || be(e, t) || fe(e, t) || de();
727
+ }
728
+ function de() {
729
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
627
730
  }
628
- function Q(e, t) {
731
+ function fe(e, t) {
732
+ if (!e) return;
733
+ if (typeof e === "string") return ve(e, t);
734
+ var r = Object.prototype.toString.call(e).slice(8, -1);
735
+ if (r === "Object" && e.constructor) r = e.constructor.name;
736
+ if (r === "Map" || r === "Set") return Array.from(e);
737
+ if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return ve(e, t);
738
+ }
739
+ function ve(e, t) {
740
+ if (t == null || t > e.length) t = e.length;
741
+ for (var r = 0, n = new Array(t); r < t; r++) {
742
+ n[r] = e[r];
743
+ }
744
+ return n;
745
+ }
746
+ function be(e, t) {
747
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(e))) return;
748
+ var r = [];
749
+ var n = true;
750
+ var i = false;
751
+ var a = undefined;
752
+ try {
753
+ for (var o = e[Symbol.iterator](), l; !(n = (l = o.next()).done); n = true) {
754
+ r.push(l.value);
755
+ if (t && r.length === t) break;
756
+ }
757
+ } catch (e) {
758
+ i = true;
759
+ a = e;
760
+ } finally {
761
+ try {
762
+ if (!n && o["return"] != null) o["return"]();
763
+ } finally {
764
+ if (i) throw a;
765
+ }
766
+ }
767
+ return r;
768
+ }
769
+ function he(e) {
770
+ if (Array.isArray(e)) return e;
771
+ }
772
+ function ye(e, t) {
629
773
  if (e == null) return {};
630
- var r = X(e, t);
774
+ var r = me(e, t);
631
775
  var n, i;
632
776
  if (Object.getOwnPropertySymbols) {
633
- var o = Object.getOwnPropertySymbols(e);
634
- for (i = 0; i < o.length; i++) {
635
- n = o[i];
777
+ var a = Object.getOwnPropertySymbols(e);
778
+ for (i = 0; i < a.length; i++) {
779
+ n = a[i];
636
780
  if (t.indexOf(n) >= 0) continue;
637
781
  if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
638
782
  r[n] = e[n];
@@ -640,97 +784,136 @@
640
784
  }
641
785
  return r;
642
786
  }
643
- function X(e, t) {
787
+ function me(e, t) {
644
788
  if (e == null) return {};
645
789
  var r = {};
646
790
  var n = Object.keys(e);
647
- var i, o;
648
- for (o = 0; o < n.length; o++) {
649
- i = n[o];
791
+ var i, a;
792
+ for (a = 0; a < n.length; a++) {
793
+ i = n[a];
650
794
  if (t.indexOf(i) >= 0) continue;
651
795
  r[i] = e[i];
652
796
  }
653
797
  return r;
654
798
  }
655
- var Z = 50;
656
- /** @public */ var ee = {
657
- autoActivate: o().bool,
658
- activeTabId: o().string,
659
- appearance: o().oneOf([ "navigation", "context" ]),
660
- children: o().node,
799
+ var ge = 50;
800
+ /** @public */ var xe = {
801
+ autoActivate: a().bool,
802
+ activeTabId: a().string,
803
+ appearance: a().oneOf([ "navigation", "context" ]),
804
+ children: a().node,
661
805
  /** @private */
662
- disabled: o().bool,
663
- elementRef: o().oneOfType([ o().func, o().object ]),
664
- iconSize: o().oneOf([ "inline", "small", "large" ]),
665
- layout: o().oneOf([ "horizontal", "vertical" ]),
666
- onChange: o().func,
667
- tabWidth: o().number
806
+ disabled: a().bool,
807
+ elementRef: a().oneOfType([ a().func, a().object ]),
808
+ iconSize: a().oneOf([ "inline", "small", "large" ]),
809
+ layout: a().oneOf([ "horizontal", "vertical" ]),
810
+ onChange: a().func,
811
+ tabWidth: a().number
668
812
  };
669
- function te(e) {
670
- var t = e.activeTabId, i = e.autoActivate, o = e.appearance, l = o === void 0 ? "navigation" : o, c = e.children, s = e.disabled, u = s === void 0 ? false : s, d = e.elementRef, f = e.iconSize, v = f === void 0 ? "inline" : f, b = e.layout, h = b === void 0 ? "horizontal" : b, y = e.onChange, m = e.tabWidth, g = Q(e, [ "activeTabId", "autoActivate", "appearance", "children", "disabled", "elementRef", "iconSize", "layout", "onChange", "tabWidth" ]);
813
+ function ke(e) {
814
+ var t = e.activeTabId, i = e.autoActivate, a = e.appearance, l = a === void 0 ? "navigation" : a, s = e.children, c = e.disabled, p = c === void 0 ? false : c, d = e.elementRef, f = e.iconSize, v = f === void 0 ? "inline" : f, b = e.layout, h = b === void 0 ? "horizontal" : b, y = e.onChange, m = e.tabWidth, g = ye(e, [ "activeTabId", "autoActivate", "appearance", "children", "disabled", "elementRef", "iconSize", "layout", "onChange", "tabWidth" ]);
671
815
  // @docs-props-type TabBarPropsBase
672
- var x = (0, r.useRef)(0);
673
- var k = [];
674
- var w = (0, r.useMemo)((function() {
675
- return h === "vertical" ? "down" : "right";
676
- }), [ h ]);
677
- var O = (0, r.useMemo)((function() {
678
- return h === "vertical" ? "up" : "left";
679
- }), [ h ]);
680
- var S = function e(t, r) {
681
- var n = r.tabKey;
682
- if (n != null) {
683
- x.current = n;
816
+ var x = (0, r.useState)(false), k = pe(x, 2), w = k[0], C = k[1];
817
+ var S = (0, r.useState)(0), O = pe(S, 2), T = O[0], I = O[1];
818
+ var j = (0, r.useRef)([]);
819
+ var z = h === "vertical" ? "down" : "right";
820
+ var M = h === "vertical" ? "up" : "left";
821
+ var _ = (0, r.useCallback)((function(e, t) {
822
+ var r = t.tabKey, n = t.tabId;
823
+ if (r != null) {
824
+ I(r);
684
825
  }
685
826
  if (i) {
686
- y === null || y === void 0 ? void 0 : y(t, {
687
- selectedTabId: r.tabId
827
+ y === null || y === void 0 ? void 0 : y(e, {
828
+ selectedTabId: n
688
829
  });
689
830
  }
690
- };
691
- var T = function e(t, r) {
692
- y === null || y === void 0 ? void 0 : y(t, {
693
- selectedTabId: r.tabId
831
+ }), [ i, y ]);
832
+ var E = (0, r.useCallback)((function(e, t) {
833
+ y === null || y === void 0 ? void 0 : y(e, {
834
+ selectedTabId: t.tabId
694
835
  });
695
- };
696
- var I = 0;
697
- var j = r.Children.toArray(c).filter(r.isValidElement).map((function(e) {
698
- // <TabBar> allows non-<Tab> children, pass them through without any modification
699
- if (typeof e.type === "string" || e.type.name !== Y.name) {
700
- return e;
701
- }
702
- var i = n().createRef();
703
- k.push(i);
704
- var o = {
705
- active: t === e.props.tabId,
706
- tabKey: I,
707
- ref: i
708
- };
709
- I += 1;
710
-
711
- return (0, r.cloneElement)(e, o);
712
- }));
713
- var z = m && m > Z ? m : null;
714
- var _ = function e(t) {
715
- var r = (0, a.keycode)(t.nativeEvent);
716
- var n;
717
- if (r === w) {
718
- n = G(k, x.current, x.current + 1);
719
- } else if (r === O) {
720
- n = H(k, x.current, x.current - 1);
721
- } else if (r === "home") {
722
- n = G(k, x.current, 0);
723
- } else if (r === "end") {
724
- n = H(k, x.current, k.length - 1);
836
+ }), [ y ]);
837
+ var P = (0, r.useMemo)((function() {
838
+ var e = 0;
839
+ // reset tabRefs since children are changed
840
+ j.current = [];
841
+ return r.Children.toArray(s).filter(r.isValidElement).map((function(i) {
842
+ // <TabBar> allows non-<Tab> children, pass them through without any modification
843
+ if (typeof i.type === "string" || i.type.name !== le.name) {
844
+ return i;
845
+ }
846
+ var a = n().createRef();
847
+ j.current.push(a);
848
+ var o = {
849
+ active: t === i.props.tabId,
850
+ tabKey: e,
851
+ ref: a
852
+ };
853
+ e += 1;
854
+
855
+ return (0, r.cloneElement)(i, o);
856
+ }));
857
+ }), [ t, s ]);
858
+ var $ = m && m > ge ? m : null;
859
+ var D = (0, r.useCallback)((function(e) {
860
+ var t = (0, o.keycode)(e.nativeEvent);
861
+ var r;
862
+ if (t === z) {
863
+ r = se(j.current, T, T + 1);
864
+ } else if (t === M) {
865
+ r = ce(j.current, T, T - 1);
866
+ } else if (t === "home") {
867
+ r = se(j.current, T, 0);
868
+ } else if (t === "end") {
869
+ r = ce(j.current, T, j.current.length - 1);
870
+ } else if (h === "horizontal" && e.shiftKey && t === "f10") {
871
+ C((function(e) {
872
+ if (e) {
873
+ var t;
874
+ // if we're closing, we want to shift focus to the tab
875
+ var r = j.current[T];
876
+ r === null || r === void 0 ? void 0 : (t = r.current) === null || t === void 0 ? void 0 : t.focus();
877
+ }
878
+ return !e;
879
+ }));
880
+ } else if (h === "horizontal" && t === "down") {
881
+ C(true);
725
882
  }
726
- if (n != null) {
727
- var i;
728
- (i = n.current) === null || i === void 0 ? void 0 : i.focus();
729
- t.preventDefault();
883
+ if (r != null) {
884
+ var n;
885
+ (n = r.current) === null || n === void 0 ? void 0 : n.focus();
886
+ e.preventDefault();
730
887
  }
731
- };
888
+ }), [ T, h, z, M ]);
889
+ var R = (0, r.useCallback)((function(e) {
890
+ // prevent clicking on the menu icon from changing the active tab
891
+ e.stopPropagation();
892
+ C(true);
893
+ }), []);
894
+ var q = (0, r.useCallback)((function(e) {
895
+ var t = e.event;
896
+ // prevent content clicks/enter key from changing the active tab
897
+ t === null || t === void 0 ? void 0 : t.stopPropagation();
898
+ C(false);
899
+ }), []);
900
+ var A = (0, r.useMemo)((function() {
901
+ return {
902
+ appearance: l,
903
+ disabled: p,
904
+ iconSize: v,
905
+ layout: h,
906
+ onClick: E,
907
+ onFocus: _,
908
+ width: $,
909
+ onMenuOpen: R,
910
+ onMenuClose: q,
911
+ isMenuOpen: w,
912
+ focusedTabKey: T
913
+ };
914
+ }), [ l, p, T, v, w, h, q, R, E, _, $ ]);
732
915
 
733
- return n().createElement(p, J({
916
+ return n().createElement(u, ue({
734
917
  "data-tab-layout": h,
735
918
  "data-test-active-tab-id": t,
736
919
  "data-test": "tab-bar",
@@ -738,22 +921,14 @@
738
921
  ref: d,
739
922
  $layout: h,
740
923
  $withUnderline: l === "navigation",
741
- onKeyDown: _
742
- }, g), n().createElement(C.Provider, {
743
- value: {
744
- appearance: l,
745
- disabled: u,
746
- iconSize: v,
747
- layout: h,
748
- onClick: T,
749
- onFocus: S,
750
- width: z
751
- }
752
- }, j));
924
+ onKeyDown: D
925
+ }, g), n().createElement(V.Provider, {
926
+ value: A
927
+ }, P));
753
928
  }
754
- te.propTypes = ee;
755
- te.Tab = Y;
756
- /* harmony default export */ const re = te;
929
+ ke.propTypes = xe;
930
+ ke.Tab = le;
931
+ /* harmony default export */ const we = ke;
757
932
  // CONCATENATED MODULE: ./src/TabBar/index.ts
758
933
  module.exports = t;
759
934
  /******/})();