@splunk/react-ui 5.4.0 → 5.5.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 (76) hide show
  1. package/Badge.js +154 -0
  2. package/CHANGELOG.md +27 -0
  3. package/Code.js +1097 -500
  4. package/Color.js +142 -141
  5. package/ComboBox.js +6 -5
  6. package/Link.js +74 -44
  7. package/MIGRATION.md +32 -1
  8. package/Menu.js +41 -43
  9. package/Multiselect.js +596 -2143
  10. package/Number.js +3 -3
  11. package/PhoneNumber.d.ts +2 -0
  12. package/PhoneNumber.js +769 -0
  13. package/Popover.js +73 -75
  14. package/RadioList.js +166 -151
  15. package/ResultsMenu.js +27 -29
  16. package/Select.js +179 -1768
  17. package/SelectBase.d.ts +2 -0
  18. package/SelectBase.js +1681 -0
  19. package/Slider.js +202 -199
  20. package/SlidingPanels.js +55 -62
  21. package/Switch.js +42 -27
  22. package/TabBar.js +295 -294
  23. package/TabLayout.js +14 -14
  24. package/Table.js +1087 -1040
  25. package/TransitionOpen.js +82 -74
  26. package/docker-compose.yml +99 -52
  27. package/package.json +9 -5
  28. package/stubs-splunkui.d.ts +0 -86
  29. package/test-runner-jest.config.js +1 -0
  30. package/types/src/Badge/Badge.d.ts +29 -0
  31. package/types/src/Badge/docs/examples/Basic.d.ts +5 -0
  32. package/types/src/Badge/docs/examples/Count.d.ts +6 -0
  33. package/types/src/Badge/docs/examples/CustomColors.d.ts +8 -0
  34. package/types/src/Badge/docs/examples/Icon.d.ts +6 -0
  35. package/types/src/Badge/index.d.ts +2 -0
  36. package/types/src/Code/Code.d.ts +4 -3
  37. package/types/src/Code/index.d.ts +1 -0
  38. package/types/src/Link/Link.d.ts +4 -0
  39. package/types/src/Link/LinkContext.d.ts +14 -0
  40. package/types/src/Link/docs/examples/Visited.d.ts +7 -0
  41. package/types/src/Link/index.d.ts +1 -0
  42. package/types/src/Multiselect/Compact.d.ts +1 -1
  43. package/types/src/Multiselect/Multiselect.d.ts +1 -1
  44. package/types/src/PhoneNumber/PhoneNumber.d.ts +139 -0
  45. package/types/src/PhoneNumber/docs/examples/Controlled.d.ts +7 -0
  46. package/types/src/PhoneNumber/docs/examples/DefaultCountry.d.ts +7 -0
  47. package/types/src/PhoneNumber/docs/examples/Disabled.d.ts +6 -0
  48. package/types/src/PhoneNumber/docs/examples/Error.d.ts +6 -0
  49. package/types/src/PhoneNumber/docs/examples/Inline.d.ts +7 -0
  50. package/types/src/PhoneNumber/docs/examples/Uncontrolled.d.ts +7 -0
  51. package/types/src/PhoneNumber/index.d.ts +2 -0
  52. package/types/src/PhoneNumber/utils.d.ts +47 -0
  53. package/types/src/RadioList/Option.d.ts +6 -1
  54. package/types/src/RadioList/docs/examples/Description.d.ts +6 -0
  55. package/types/src/Select/Option.d.ts +8 -3
  56. package/types/src/Select/Select.d.ts +1 -1
  57. package/types/src/{Select → SelectBase}/OptionBase.d.ts +8 -2
  58. package/types/src/{Select → SelectBase}/SelectBase.d.ts +3 -1
  59. package/types/src/SelectBase/index.d.ts +2 -0
  60. package/types/src/Switch/Switch.d.ts +3 -0
  61. package/types/src/Table/Body.d.ts +6 -1
  62. package/types/src/Table/Cell.d.ts +5 -1
  63. package/types/src/Table/Head.d.ts +6 -2
  64. package/types/src/Table/HeadCell.d.ts +5 -1
  65. package/types/src/Table/Row.d.ts +5 -1
  66. package/types/src/Table/Table.d.ts +20 -1
  67. package/types/src/Table/TableContext.d.ts +1 -0
  68. package/types/src/Table/docs/examples/HorizontalOverflowScroll.d.ts +8 -0
  69. package/types/src/Table/docs/examples/PinActionColumn.d.ts +7 -0
  70. package/types/src/TransitionOpen/TransitionOpen.d.ts +3 -1
  71. package/types/src/useResizeObserver/useResizeObserver.d.ts +2 -0
  72. package/types/src/useRovingFocus/useRovingFocus.d.ts +8 -1
  73. package/usePrevious.d.ts +2 -0
  74. package/useResizeObserver.js +59 -92
  75. package/useRovingFocus.js +96 -41
  76. /package/types/src/{Select → SelectBase}/SelectAllOption.d.ts +0 -0
package/TabBar.js CHANGED
@@ -61,8 +61,8 @@
61
61
  e.r(t);
62
62
  // EXPORTS
63
63
  e.d(t, {
64
- Tab: () => /* reexport */ ne,
65
- default: () => /* reexport */ je
64
+ Tab: () => /* reexport */ ae,
65
+ default: () => /* reexport */ Ee
66
66
  });
67
67
  // CONCATENATED MODULE: external "react"
68
68
  const n = require("react");
@@ -83,146 +83,143 @@
83
83
  const f = require("@splunk/react-ui/Dropdown");
84
84
  var v = e.n(f);
85
85
  // CONCATENATED MODULE: external "@splunk/react-ui/Popover"
86
- const b = require("@splunk/react-ui/Popover");
87
- var p = e.n(b);
86
+ const p = require("@splunk/react-ui/Popover");
87
+ var b = e.n(p);
88
88
  // CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
89
89
  const m = require("@splunk/react-ui/ScreenReaderContent");
90
90
  var g = e.n(m);
91
+ // CONCATENATED MODULE: external "@splunk/themes"
92
+ const y = require("@splunk/themes");
93
+ // CONCATENATED MODULE: external "@splunk/ui-utils/format"
94
+ const h = require("@splunk/ui-utils/format");
91
95
  // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
92
- const y = require("@splunk/ui-utils/i18n");
96
+ const S = require("@splunk/ui-utils/i18n");
93
97
  // CONCATENATED MODULE: external "@splunk/ui-utils/id"
94
- const h = require("@splunk/ui-utils/id");
98
+ const w = require("@splunk/ui-utils/id");
95
99
  // CONCATENATED MODULE: ./src/TabBar/TabBarContext.tsx
96
- var S = function e() {
100
+ var O = function e() {
97
101
  return undefined;
98
102
  };
99
- var w = (0, n.createContext)({
103
+ var C = (0, n.createContext)({
100
104
  isMenuOpen: false,
101
- onMenuOpen: S,
102
- onMenuClose: S,
103
- registerTab: S
105
+ onMenuOpen: O,
106
+ onMenuClose: O,
107
+ registerTab: O
104
108
  });
105
- w.displayName = "TabBar";
106
- /* harmony default export */ const C = w;
109
+ C.displayName = "TabBar";
110
+ /* harmony default export */ const x = C;
107
111
  // CONCATENATED MODULE: external "styled-components"
108
- const O = require("styled-components");
109
- var x = e.n(O);
110
- // CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
111
- const I = require("@splunk/react-ui/Clickable");
112
+ const I = require("styled-components");
112
113
  var k = e.n(I);
113
- // CONCATENATED MODULE: external "@splunk/themes"
114
- const T = require("@splunk/themes");
114
+ // CONCATENATED MODULE: external "@splunk/react-ui/Badge"
115
+ const T = require("@splunk/react-ui/Badge");
116
+ var j = e.n(T);
117
+ // CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
118
+ const P = require("@splunk/react-ui/Clickable");
119
+ var E = e.n(P);
115
120
  // CONCATENATED MODULE: ./src/TabBar/TabStyles.ts
116
- var j = (0, O.css)([ "color:", ";" ], T.variables.contentColorActive);
117
- var P = "2px";
118
- var E = (0, T.pickVariant)("$layout", {
119
- horizontal: (0, O.css)([ "background:", ";height:", ";" ], T.variables.contentColorAccentWeak, P),
120
- vertical: (0, O.css)([ "background:", ";width:", ";" ], T.variables.contentColorAccentWeak, P)
121
+ var M = (0, I.css)([ "color:", ";" ], y.variables.contentColorActive);
122
+ var $ = "2px";
123
+ var A = (0, y.pickVariant)("$layout", {
124
+ horizontal: (0, I.css)([ "background:", ";height:", ";" ], y.variables.contentColorAccentWeak, $),
125
+ vertical: (0, I.css)([ "background:", ";width:", ";" ], y.variables.contentColorAccentWeak, $)
121
126
  });
122
- var M = function e(t) {
127
+ var _ = function e(t) {
123
128
  var n = t.$hasIcon, r = t.$hasMenu, a = t.$iconPosition;
124
129
  if (a === "above" && n && r) {
125
- return (0, O.css)([ "grid-template-areas:'icon icon icon' 'menu-counter-neg-space content menu' 'gutter gutter gutter' 'underline underline underline';grid-template-columns:", " 1fr min-content;grid-template-rows:repeat(2,auto) ", " auto;" ], T.variables.spacingXSmall, T.variables.spacingXSmall);
130
+ return (0, I.css)([ "grid-template-areas:'icon icon icon' 'menu-counter-neg-space content menu' 'gutter gutter gutter' 'underline underline underline';grid-template-columns:", " 1fr min-content;grid-template-rows:repeat(2,auto) ", " auto;" ], y.variables.spacingXSmall, y.variables.spacingXSmall);
126
131
  }
127
132
  if (a === "above" && n) {
128
- return (0, O.css)([ "grid-template-areas:'icon' 'content' 'gutter' 'underline';grid-template-columns:1fr;grid-template-rows:repeat(2,auto) ", " auto;" ], T.variables.spacingXSmall);
133
+ return (0, I.css)([ "grid-template-areas:'icon' 'content' 'gutter' 'underline';grid-template-columns:1fr;grid-template-rows:repeat(2,auto) ", " auto;" ], y.variables.spacingXSmall);
129
134
  }
130
135
  if (a === "left" && n && r) {
131
- return (0, O.css)([ "grid-template-areas:'menu-counter-neg-space icon content menu' 'underline underline underline underline';grid-template-columns:", " min-content 1fr min-content;" ], T.variables.spacingXSmall);
136
+ return (0, I.css)([ "grid-template-areas:'menu-counter-neg-space icon content menu' 'underline underline underline underline';grid-template-columns:", " min-content 1fr min-content;" ], y.variables.spacingXSmall);
132
137
  }
133
138
  if (a === "left" && n) {
134
- return (0, O.css)([ "grid-template-areas:'icon content' 'underline underline';grid-template-columns:min-content 1fr;" ]);
139
+ return (0, I.css)([ "grid-template-areas:'icon content' 'underline underline';grid-template-columns:min-content 1fr;" ]);
135
140
  }
136
141
  if (r) {
137
- return (0, O.css)([ "grid-template-areas:'menu-counter-neg-space content menu' 'underline underline underline';grid-template-columns:", " minmax(auto,min-content) min-content;" ], T.variables.spacingXSmall);
142
+ return (0, I.css)([ "grid-template-areas:'menu-counter-neg-space content menu' 'underline underline underline';grid-template-columns:", " minmax(auto,min-content) min-content;" ], y.variables.spacingXSmall);
138
143
  }
139
- return (0, O.css)([ "grid-template-areas:'content' 'underline';grid-template-columns:minmax(auto,min-content);" ]);
144
+ return (0, I.css)([ "grid-template-areas:'content' 'underline';grid-template-columns:minmax(auto,min-content);" ]);
140
145
  };
141
- var $ = function e(t) {
146
+ var z = function e(t) {
142
147
  var n = t.$hasIcon, r = t.$iconPosition;
143
148
  if (r === "above" && n) {
144
- return (0, O.css)([ "grid-template-areas:'icon gutter underline' 'content gutter underline';grid-template-columns:1fr ", " ", ";" ], T.variables.spacingXSmall, P);
149
+ return (0, I.css)([ "grid-template-areas:'icon gutter underline' 'content gutter underline';grid-template-columns:1fr ", " ", ";" ], y.variables.spacingXSmall, $);
145
150
  }
146
151
  if (r === "left" && n) {
147
- return (0, O.css)([ "grid-template-areas:'icon content gutter underline';grid-template-columns:min-content 1fr ", " ", ";" ], T.variables.spacingXSmall, P);
152
+ return (0, I.css)([ "grid-template-areas:'icon content gutter underline';grid-template-columns:min-content 1fr ", " ", ";" ], y.variables.spacingXSmall, $);
148
153
  }
149
- return (0, O.css)([ "grid-template-areas:'content gutter underline';grid-template-columns:1fr ", " ", ";" ], T.variables.spacingXSmall, P);
154
+ return (0, I.css)([ "grid-template-areas:'content gutter underline';grid-template-columns:1fr ", " ", ";" ], y.variables.spacingXSmall, $);
150
155
  };
151
- var A = x()(k()).withConfig({
156
+ var D = k()(E()).withConfig({
152
157
  displayName: "TabStyles__StyledClickable",
153
158
  componentId: "sc-1ry8mzj-0"
154
- })([ "color:", ";column-gap:", ";display:grid;justify-content:center;align-items:baseline;min-height:", ";position:relative;", " ", " ", ";&[aria-selected='true']{cursor:default;color:", ";font-weight:", ";}&[aria-selected='false']{box-shadow:none;font-weight:", ";&:hover:not([disabled]){", "}&[aria-haspopup='true']{", "}}&:focus{box-shadow:", ";color:", ";}" ], T.variables.contentColorDefault, T.variables.spacingXSmall, T.variables.inputHeight, (function(e) {
159
+ })([ "color:", ";column-gap:", ";display:grid;justify-content:center;align-items:baseline;min-height:", ";position:relative;", " ", " ", ";&[aria-selected='true']{cursor:default;color:", ";font-weight:", ";}&[aria-selected='false']{box-shadow:none;font-weight:", ";&:hover:not([disabled]){", "}&[aria-haspopup='true']{", "}}&:focus{box-shadow:", ";color:", ";}" ], y.variables.contentColorDefault, y.variables.spacingXSmall, y.variables.inputHeight, (function(e) {
155
160
  var t = e.$maxTabWidth;
156
- return t && (0, O.css)([ "max-width:", "px;" ], t);
161
+ return t && (0, I.css)([ "max-width:", "px;" ], t);
157
162
  }), (function(e) {
158
163
  var t = e.$hasIcon, n = e.$hasMenu, r = e.$iconPosition, a = e.$layout;
159
164
  if (a === "vertical") {
160
- return $({
165
+ return z({
161
166
  $hasIcon: t,
162
167
  $iconPosition: r
163
168
  });
164
169
  }
165
- return M({
170
+ return _({
166
171
  $hasIcon: t,
167
172
  $hasMenu: n,
168
173
  $iconPosition: r
169
174
  });
170
- }), (0, T.pickVariant)("$layout", {
171
- horizontal: (0, O.css)([ "margin-bottom:1px;" ]),
172
- vertical: (0, O.css)([ "align-items:center;right:1px;" ])
173
- }), T.variables.contentColorActive, T.variables.fontWeightBold, T.variables.fontWeightSemiBold, j, j, T.variables.focusShadow, T.variables.contentColorActive);
174
- var z = x().div.withConfig({
175
+ }), (0, y.pickVariant)("$layout", {
176
+ horizontal: (0, I.css)([ "margin-bottom:1px;" ]),
177
+ vertical: (0, I.css)([ "align-items:center;right:1px;" ])
178
+ }), y.variables.contentColorActive, y.variables.fontWeightBold, y.variables.fontWeightSemiBold, M, M, y.variables.focusShadow, y.variables.contentColorActive);
179
+ var N = k().div.withConfig({
175
180
  displayName: "TabStyles__StyledUnderline",
176
181
  componentId: "sc-1ry8mzj-1"
177
182
  })([ "grid-area:underline;position:absolute;", ";[aria-selected='true'] > &&{background-color:", ";", ";}", ":hover:not([disabled]):not([aria-selected='true']) > &&{", ";}[aria-selected='false'][aria-haspopup='true'] > &&{", "}" ], (0,
178
- T.pickVariant)("$layout", {
179
- horizontal: (0, O.css)([ "bottom:-1px;height:0;width:100%;transition:height 0.2s;" ]),
180
- vertical: (0, O.css)([ "width:1px;height:100%;right:-1px;transition:width 0.2s;" ])
181
- }), T.variables.contentColorAccent, (0, T.pickVariant)("$layout", {
182
- horizontal: (0, O.css)([ "height:", ";" ], P),
183
- vertical: (0, O.css)([ "width:", ";" ], P)
184
- }), /* sc-sel */ A, E, E);
185
- var _ = x().span.withConfig({
183
+ y.pickVariant)("$layout", {
184
+ horizontal: (0, I.css)([ "bottom:-1px;height:0;width:100%;transition:height 0.2s;" ]),
185
+ vertical: (0, I.css)([ "width:1px;height:100%;right:-1px;transition:width 0.2s;" ])
186
+ }), y.variables.contentColorAccent, (0, y.pickVariant)("$layout", {
187
+ horizontal: (0, I.css)([ "height:", ";" ], $),
188
+ vertical: (0, I.css)([ "width:", ";" ], $)
189
+ }), /* sc-sel */ D, A, A);
190
+ var R = k().span.withConfig({
186
191
  displayName: "TabStyles__StyledMenu",
187
192
  componentId: "sc-1ry8mzj-2"
188
- })([ "display:inline-block;grid-area:menu;margin-left:4px;> svg{transform:translateY(-1px);}border-radius:", ";cursor:pointer;", " &:hover{background-color:", ";border-color:", ";}", "[aria-haspopup='true'] &,", ":hover &,", ":focus &{visibility:visible;}" ], T.variables.borderRadius, (0,
189
- T.pickVariant)("$active", {
190
- false: (0, O.css)([ "visibility:hidden;" ])
191
- }), T.variables.interactiveColorOverlayHover, T.variables.interactiveColorBorderHover, /* sc-sel */ A, /* sc-sel */ A, /* sc-sel */ A);
192
- var D = x().span.withConfig({
193
+ })([ "display:inline-block;grid-area:menu;margin-left:4px;> svg{transform:translateY(-1px);}border-radius:", ";cursor:pointer;", " &:hover{background-color:", ";border-color:", ";}", "[aria-haspopup='true'] &,", ":hover &,", ":focus &{visibility:visible;}" ], y.variables.borderRadius, (0,
194
+ y.pickVariant)("$active", {
195
+ false: (0, I.css)([ "visibility:hidden;" ])
196
+ }), y.variables.interactiveColorOverlayHover, y.variables.interactiveColorBorderHover, /* sc-sel */ D, /* sc-sel */ D, /* sc-sel */ D);
197
+ var q = k().span.withConfig({
193
198
  displayName: "TabStyles__StyledIcon",
194
199
  componentId: "sc-1ry8mzj-3"
195
- })([ "grid-area:icon;", "" ], (0, T.pickVariant)("$iconPosition", {
196
- above: (0, O.css)([ "display:flex;justify-content:center;" ]),
197
- left: (0, O.css)([ "> svg{transform:translateY(-1px);}" ])
200
+ })([ "grid-area:icon;", "" ], (0, y.pickVariant)("$iconPosition", {
201
+ above: (0, I.css)([ "display:flex;justify-content:center;" ]),
202
+ left: (0, I.css)([ "> svg{transform:translateY(-1px);}" ])
198
203
  }));
199
- var N = x().div.withConfig({
204
+ var V = k().div.withConfig({
200
205
  displayName: "TabStyles__StyledContent",
201
206
  componentId: "sc-1ry8mzj-4"
202
207
  })([ "display:inline-flex;align-items:baseline;grid-area:content;min-width:10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", "" ], (function(e) {
203
208
  var t = e.$iconPosition;
204
- return t === "above" && (0, O.css)([ "justify-content:center;text-align:center;" ]);
209
+ return t === "above" && (0, I.css)([ "justify-content:center;text-align:center;" ]);
205
210
  }));
206
- var R = x().div.withConfig({
211
+ var B = k().div.withConfig({
207
212
  displayName: "TabStyles__StyledLabel",
208
213
  componentId: "sc-1ry8mzj-5"
209
- })([ "&::after{display:block;content:attr(data-title);font-weight:", ";height:0;color:transparent;overflow:hidden;visibility:hidden;white-space:nowrap;}" ], T.variables.fontWeightBold);
210
- var q = x().span.withConfig({
211
- displayName: "TabStyles__StyledCount",
214
+ })([ "&::after{display:block;content:attr(data-title);font-weight:", ";height:0;color:transparent;overflow:hidden;visibility:hidden;white-space:nowrap;}" ], y.variables.fontWeightBold);
215
+ var W = k()(j()).withConfig({
216
+ displayName: "TabStyles__StyledBadge",
212
217
  componentId: "sc-1ry8mzj-6"
213
- })([ "background:", ";border-radius:18px;color:", ";display:inline-block;font-size:", ";line-height:10px;margin-inline-start:0.3em;padding:0.4em 0.6em;&[disabled]{color:", ";}" ], T.variables.neutral100, T.variables.contentColorDefault, T.variables.fontSizeSmall, T.variables.contentColorDisabled);
214
- var V = x().div.withConfig({
218
+ })([ "line-height:10px;margin-inline-start:0.3em;padding:0.4em 0.6em;" ]);
219
+ var X = k().div.withConfig({
215
220
  displayName: "TabStyles__StyledTooltipContent",
216
221
  componentId: "sc-1ry8mzj-7"
217
- })([ "padding:8px;font-size:", ";" ], T.variables.fontSizeSmall);
218
- // CONCATENATED MODULE: ./src/utils/getCountValue.ts
219
- // A utility for max count
220
- var W = function e(t, n) {
221
- if (t > n) {
222
- return "".concat(n, "+");
223
- }
224
- return t;
225
- };
222
+ })([ "padding:8px;font-size:", ";" ], y.variables.fontSizeSmall);
226
223
  // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
227
224
  /**
228
225
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
@@ -230,7 +227,7 @@
230
227
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
231
228
  * @param current - The new value of the ref.
232
229
  */
233
- function X(e, t) {
230
+ function L(e, t) {
234
231
  if (e) {
235
232
  if (typeof e === "function") {
236
233
  e(t);
@@ -243,8 +240,8 @@
243
240
  }
244
241
  }
245
242
  // CONCATENATED MODULE: ./src/TabBar/Tab.tsx
246
- function B() {
247
- return B = Object.assign ? Object.assign.bind() : function(e) {
243
+ function F() {
244
+ return F = Object.assign ? Object.assign.bind() : function(e) {
248
245
  for (var t = 1; t < arguments.length; t++) {
249
246
  var n = arguments[t];
250
247
  for (var r in n) {
@@ -252,29 +249,29 @@
252
249
  }
253
250
  }
254
251
  return e;
255
- }, B.apply(null, arguments);
252
+ }, F.apply(null, arguments);
256
253
  }
257
- function F(e, t) {
258
- return Y(e) || K(e, t) || H(e, t) || L();
254
+ function H(e, t) {
255
+ return J(e) || G(e, t) || K(e, t) || U();
259
256
  }
260
- function L() {
257
+ function U() {
261
258
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
262
259
  }
263
- function H(e, t) {
260
+ function K(e, t) {
264
261
  if (e) {
265
- if ("string" == typeof e) return U(e, t);
262
+ if ("string" == typeof e) return Y(e, t);
266
263
  var n = {}.toString.call(e).slice(8, -1);
267
- return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? U(e, t) : void 0;
264
+ return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Y(e, t) : void 0;
268
265
  }
269
266
  }
270
- function U(e, t) {
267
+ function Y(e, t) {
271
268
  (null == t || t > e.length) && (t = e.length);
272
269
  for (var n = 0, r = Array(t); n < t; n++) {
273
270
  r[n] = e[n];
274
271
  }
275
272
  return r;
276
273
  }
277
- function K(e, t) {
274
+ function G(e, t) {
278
275
  var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
279
276
  if (null != n) {
280
277
  var r, a, i, o, l = [], u = !0, c = !1;
@@ -296,12 +293,12 @@
296
293
  return l;
297
294
  }
298
295
  }
299
- function Y(e) {
296
+ function J(e) {
300
297
  if (Array.isArray(e)) return e;
301
298
  }
302
- function G(e, t) {
299
+ function Q(e, t) {
303
300
  if (null == e) return {};
304
- var n, r, a = J(e, t);
301
+ var n, r, a = Z(e, t);
305
302
  if (Object.getOwnPropertySymbols) {
306
303
  var i = Object.getOwnPropertySymbols(e);
307
304
  for (r = 0; r < i.length; r++) {
@@ -310,7 +307,7 @@
310
307
  }
311
308
  return a;
312
309
  }
313
- function J(e, t) {
310
+ function Z(e, t) {
314
311
  if (null == e) return {};
315
312
  var n = {};
316
313
  for (var r in e) {
@@ -321,7 +318,7 @@
321
318
  }
322
319
  return n;
323
320
  }
324
- var Q = {
321
+ var ee = {
325
322
  ariaControls: i().string,
326
323
  count: i().number,
327
324
  disabled: i().bool,
@@ -347,170 +344,174 @@
347
344
  */
348
345
  index: i().number
349
346
  };
350
- var Z = {
347
+ var te = {
351
348
  tension: 400
352
349
  };
353
- var ee = [ "offScreen", "escapeKey" ];
354
- var te = function e(t) {
355
- var a = t.ariaControls, i = t.count, o = t.disabled, l = t.elementRef, u = t.icon, s = t.label, f = t.maxCount, b = t.tabId, m = t.to, S = t.tooltip, w = t.menu, O = t.index, x = G(t, [ "ariaControls", "count", "disabled", "elementRef", "icon", "label", "maxCount", "tabId", "to", "tooltip", "menu", "index" ]);
350
+ var ne = [ "offScreen", "escapeKey" ];
351
+ var re = function e(t) {
352
+ var a = t.ariaControls, i = t.count, o = t.disabled, l = t.elementRef, u = t.icon, s = t.label, f = t.maxCount, p = t.tabId, m = t.to, O = t.tooltip, C = t.menu, I = t.index, k = Q(t, [ "ariaControls", "count", "disabled", "elementRef", "icon", "label", "maxCount", "tabId", "to", "tooltip", "menu", "index" ]);
356
353
  // @docs-props-type TabPropsBase
357
- var I = (0, n.useState)(false), k = F(I, 2), T = k[0], j = k[1];
358
- var P = (0, n.useState)(null), E = F(P, 2), M = E[0], $ = E[1];
359
- var L = (0, n.useContext)(C), H = L.activeTabId, U = L.disabled, K = L.focusedTabId, Y = L.iconPosition, J = Y === void 0 ? "above" : Y, Q = L.isMenuOpen, te = L.layout, ne = te === void 0 ? "horizontal" : te, re = L.maxTabWidth, ae = L.onClick, ie = L.onFocus, oe = L.onMenuOpen, le = L.onMenuClose, ue = L.registerTab;
360
- var ce = (0, n.useState)((0, h.createDOMID)("aria-id")), se = F(ce, 1), de = se[0];
361
- var fe = (0, n.useState)((0, h.createDOMID)("menu-description")), ve = F(fe, 1), be = ve[0];
362
- var pe = (0, n.useState)((0, h.createDOMID)("popover")), me = F(pe, 1), ge = me[0];
363
- var ye = (0, n.useMemo)((function() {
364
- return b || (0, h.createGUID)();
365
- }), [ b ]);
366
- var he = U || o ? "disabled" : false;
367
- var Se = s ? s.toString() : "";
368
- var we = H === ye;
354
+ var T = (0, n.useState)(false), j = H(T, 2), P = j[0], E = j[1];
355
+ var M = (0, n.useState)(null), $ = H(M, 2), A = $[0], _ = $[1];
356
+ var z = (0, n.useContext)(x), U = z.activeTabId, K = z.disabled, Y = z.focusedTabId, G = z.iconPosition, J = G === void 0 ? "above" : G, Z = z.isMenuOpen, ee = z.layout, re = ee === void 0 ? "horizontal" : ee, ae = z.maxTabWidth, ie = z.onClick, oe = z.onFocus, le = z.onMenuOpen, ue = z.onMenuClose, ce = z.registerTab;
357
+ var se = (0, n.useState)((0, w.createDOMID)("aria-id")), de = H(se, 1), fe = de[0];
358
+ var ve = (0, n.useState)((0, w.createDOMID)("menu-description")), pe = H(ve, 1), be = pe[0];
359
+ var me = (0, n.useState)((0, w.createDOMID)("popover")), ge = H(me, 1), ye = ge[0];
360
+ var he = (0, n.useMemo)((function() {
361
+ return p || (0, w.createGUID)();
362
+ }), [ p ]);
363
+ var Se = K || o ? "disabled" : false;
364
+ var we = s ? s.toString() : "";
365
+ var Oe = U === he;
369
366
  // title is used for CSS styling in TabStyles. labelValue and countValue needs to be included in the title.
370
367
  var Ce = (0, n.useMemo)((function() {
371
368
  // SUI-6877: if the label isn't a string, don't attempt to do this since it'll just be wrong
372
- return s && typeof s === "string" ? Se : "";
373
- }), [ s, Se ]);
374
- var Oe = (0, n.useCallback)((function() {
375
- M === null || M === void 0 ? void 0 : M.focus();
376
- }), [ M ]);
377
- var xe = (0, n.useCallback)((function(e) {
378
- $(e);
379
- X(l, e);
369
+ return s && typeof s === "string" ? we : "";
370
+ }), [ s, we ]);
371
+ var xe = (0, n.useCallback)((function() {
372
+ A === null || A === void 0 ? void 0 : A.focus();
373
+ }), [ A ]);
374
+ var Ie = (0, n.useCallback)((function(e) {
375
+ _(e);
376
+ L(l, e);
380
377
  // Register with index, assert index is defined as it's injected by TabBar
381
- ue({
382
- tabId: ye,
378
+ ce({
379
+ tabId: he,
383
380
  element: e,
384
- index: O
381
+ index: I
385
382
  });
386
- }), [ l, ue, ye, O ]);
387
- var Ie = (0, n.useCallback)((function() {
388
- j(true);
389
- }), []);
383
+ }), [ l, ce, he, I ]);
390
384
  var ke = (0, n.useCallback)((function() {
391
- j(false);
385
+ E(true);
386
+ }), []);
387
+ var Te = (0, n.useCallback)((function() {
388
+ E(false);
392
389
  }), []);
393
- var Te = (0, n.useCallback)((function(e) {
390
+ var je = (0, n.useCallback)((function(e) {
394
391
  // preserve the previous behaviour from 2ad8e7eaf47 to avoid firing unnecessary onChange events
395
392
  // while preventing the "to" prop from incorrectly triggering <Clickable>'s providedOnClick on the active tab
396
- if (!we) {
397
- ae === null || ae === void 0 ? void 0 : ae(e, {
398
- tabId: ye
393
+ if (!Oe) {
394
+ ie === null || ie === void 0 ? void 0 : ie(e, {
395
+ tabId: he
399
396
  });
400
397
  }
401
- if (m == null || m != null && we) {
398
+ if (m == null || m != null && Oe) {
402
399
  e.preventDefault();
403
400
  }
404
- }), [ we, ae, ye, m ]);
405
- var je = (0, n.useCallback)((function(e) {
406
- Ie();
407
- ie === null || ie === void 0 ? void 0 : ie(e, {
408
- tabId: ye
401
+ }), [ Oe, ie, he, m ]);
402
+ var Pe = (0, n.useCallback)((function(e) {
403
+ ke();
404
+ oe === null || oe === void 0 ? void 0 : oe(e, {
405
+ tabId: he
409
406
  });
410
- }), [ Ie, ie, ye ]);
411
- var Pe = (0, n.useCallback)((function() {
412
- Oe();
413
- }), [ Oe ]);
407
+ }), [ ke, oe, he ]);
414
408
  var Ee = (0, n.useCallback)((function() {
415
- ke();
416
- }), [ ke ]);
417
- var Me = (0, n.useCallback)((function(e) {
409
+ xe();
410
+ }), [ xe ]);
411
+ var Me = (0, n.useCallback)((function() {
412
+ Te();
413
+ }), [ Te ]);
414
+ var $e = (0, n.useCallback)((function(e) {
418
415
  // prevent clicking on the menu icon from changing the active tab
419
416
  e.stopPropagation();
420
- oe(ye);
421
- }), [ oe, ye ]);
422
- var $e = K === ye && Q && !!w;
423
- var Ae = r().createElement(_, {
424
- $active: we,
417
+ le(he);
418
+ }), [ le, he ]);
419
+ var Ae = Y === he && Z && !!C;
420
+ var _e = r().createElement(R, {
421
+ $active: Oe,
425
422
  "data-test": "menu-toggle",
426
423
  tabIndex: -1,
427
- onFocus: Pe
424
+ onFocus: Ee
428
425
  }, r().createElement(d(), null));
429
426
  var ze = function e(t) {
430
427
 
431
428
  return r().createElement(r().Fragment, null, t, r().createElement(v(), {
432
- toggle: Ae,
429
+ toggle: _e,
433
430
  align: "center",
434
- onRequestOpen: Me,
435
- onRequestClose: le,
436
- open: $e
437
- }, w));
431
+ onRequestOpen: $e,
432
+ onRequestClose: ue,
433
+ open: Ae
434
+ }, C));
438
435
  };
439
- var _e = x["data-title"];
440
- var De = r().createElement(N, {
436
+ var De = k["data-title"];
437
+ var Ne = r().createElement(V, {
441
438
  "data-test": "label",
442
439
  $iconPosition: J
443
- }, r().createElement(R, {
444
- "data-title": _e || Ce
445
- }, s), !w && (i === 0 || i) && r().createElement(r().Fragment, null, r().createElement(g(), null, " "), r().createElement(q, {
440
+ }, r().createElement(B, {
441
+ "data-title": De || Ce
442
+ }, s), !C && (i === 0 || i) && r().createElement(W, {
446
443
  "data-test": "count",
447
- disabled: !!he
448
- }, f ? W(i, f) : i)), !!w && r().createElement(g(), {
444
+ foregroundColor: Se ? y.variables.contentColorDisabled : undefined,
445
+ label: f ? (0, h.truncateNumber)({
446
+ number: i,
447
+ max: f
448
+ }) : "".concat(i)
449
+ }), !!C && r().createElement(g(), {
449
450
  "aria-hidden": true,
450
451
  id: be
451
- }, (0, y._)("Press Shift + F10 to open the tab’s menu")));
452
+ }, (0, S._)("Press Shift + F10 to open the tab’s menu")));
452
453
 
453
454
  // TODO: Fix the ts error: https://splunk.atlassian.net/browse/SUI-5569
454
455
  // eslint-disable-next-line
455
456
  // @ts-ignore-next-line
456
- return r().createElement(A, B({
457
+ return r().createElement(D, F({
457
458
  $hasIcon: !!u,
458
- $hasMenu: !!w,
459
+ $hasMenu: !!C,
459
460
  $iconPosition: J,
460
- $layout: ne,
461
- $maxTabWidth: re,
461
+ $layout: re,
462
+ $maxTabWidth: ae,
462
463
  "aria-controls": a,
463
- "aria-selected": we,
464
- "aria-labelledby": de,
465
- "aria-describedby": w ? be : undefined,
466
- "aria-haspopup": $e,
464
+ "aria-selected": Oe,
465
+ "aria-labelledby": fe,
466
+ "aria-describedby": C ? be : undefined,
467
+ "aria-haspopup": Ae,
467
468
  "data-test": "tab",
468
- "data-test-tab-id": ye,
469
- "data-test-popover-id": S ? ge : undefined,
470
- "data-test-disabled": he || undefined,
471
- disabled: he,
472
- elementRef: xe,
473
- onClick: Te,
474
- onFocus: je,
475
- onMouseEnter: Ie,
476
- onBlur: Ee,
477
- onMouseLeave: ke,
469
+ "data-test-tab-id": he,
470
+ "data-test-popover-id": O ? ye : undefined,
471
+ "data-test-disabled": Se || undefined,
472
+ disabled: Se,
473
+ elementRef: Ie,
474
+ onClick: je,
475
+ onFocus: Pe,
476
+ onMouseEnter: ke,
477
+ onBlur: Me,
478
+ onMouseLeave: Te,
478
479
  role: "tab",
479
- tabIndex: we ? undefined : -1,
480
+ tabIndex: Oe ? undefined : -1,
480
481
  to: m
481
- }, c()(x, "elementRef")), u && r().createElement(D, {
482
+ }, c()(k, "elementRef")), u && r().createElement(q, {
482
483
  $iconPosition: J
483
- }, u), w && ne === "horizontal" ? ze(De) : De, r().createElement(z, {
484
- $layout: ne
485
- }), !o && S && r().createElement(p(), {
484
+ }, u), C && re === "horizontal" ? ze(Ne) : Ne, r().createElement(N, {
485
+ $layout: re
486
+ }), !o && O && r().createElement(b(), {
486
487
  role: "tooltip",
487
- anchor: M,
488
- animationConfig: Z,
489
- closeReasons: ee,
490
- defaultPlacement: ne === "vertical" ? "right" : "above",
491
- id: ge,
492
- open: !!M && T,
488
+ anchor: A,
489
+ animationConfig: te,
490
+ closeReasons: ne,
491
+ defaultPlacement: re === "vertical" ? "right" : "above",
492
+ id: ye,
493
+ open: !!A && P,
493
494
  align: "center"
494
- }, r().createElement(V, null, S)), S && r().createElement(g(), {
495
+ }, r().createElement(X, null, O)), O && r().createElement(g(), {
495
496
  "aria-hidden": "true",
496
- id: de
497
- }, S));
497
+ id: fe
498
+ }, O));
498
499
  };
499
- te.propTypes = Q;
500
- te.as = "Tab";
501
- /* harmony default export */ const ne = te;
500
+ re.propTypes = ee;
501
+ re.as = "Tab";
502
+ /* harmony default export */ const ae = re;
502
503
  // CONCATENATED MODULE: ./src/TabBar/TabBarStyles.ts
503
- var re = x().div.withConfig({
504
+ var ie = k().div.withConfig({
504
505
  displayName: "TabBarStyles__Styled",
505
506
  componentId: "sc-1t85fen-0"
506
- })([ "", " position:relative;&::before{content:'';display:block;position:absolute;left:0;top:0;right:0;bottom:0;border:0 solid ", ";}", ";" ], T.mixins.reset("flex"), T.variables.neutral300, (0,
507
- T.pickVariant)("$layout", {
508
- horizontal: (0, O.css)([ "column-gap:", ";&::before{border-bottom-width:1px;}" ], T.variables.spacingXLarge),
509
- vertical: (0, O.css)([ "display:inline-flex;flex-direction:column;row-gap:", ";&::before{border-right-width:1px;}" ], T.variables.spacingXLarge)
507
+ })([ "", " position:relative;&::before{content:'';display:block;position:absolute;left:0;top:0;right:0;bottom:0;border:0 solid ", ";}", ";" ], y.mixins.reset("flex"), y.variables.neutral300, (0,
508
+ y.pickVariant)("$layout", {
509
+ horizontal: (0, I.css)([ "column-gap:", ";&::before{border-bottom-width:1px;}" ], y.variables.spacingXLarge),
510
+ vertical: (0, I.css)([ "display:inline-flex;flex-direction:column;row-gap:", ";&::before{border-right-width:1px;}" ], y.variables.spacingXLarge)
510
511
  }));
511
512
  // CONCATENATED MODULE: ./src/TabBar/tabBarUtils.tsx
512
513
  // A utility for keyboard navigation for TabBar
513
- function ae(e, t, n) {
514
+ function oe(e, t, n) {
514
515
  for (var r = 0; r < e.length; r += 1) {
515
516
  var a = (r + n) % e.length;
516
517
  var i = e[a].element;
@@ -520,7 +521,7 @@
520
521
  }
521
522
  return e[t];
522
523
  }
523
- function ie(e, t, n) {
524
+ function le(e, t, n) {
524
525
  for (var r = e.length; r > 0; r -= 1) {
525
526
  var a = (r + n) % e.length;
526
527
  var i = e[a].element;
@@ -531,36 +532,36 @@
531
532
  return e[t];
532
533
  }
533
534
  // CONCATENATED MODULE: ./src/utils/useDeprecate.tsx
534
- var oe = "is deprecated and will be removed in the next major version.";
535
- var le = function e(t) {
535
+ var ue = "is deprecated and will be removed in the next major version.";
536
+ var ce = function e(t) {
536
537
  var n = t.additionalMessage, r = n === void 0 ? "" : n, a = t.componentName;
537
538
  useEffect((function() {
538
539
  if (false) {}
539
540
  }), [ r, a ]);
540
541
  };
541
- var ue = function e(t) {
542
+ var se = function e(t) {
542
543
  var r = t.additionalMessage, a = r === void 0 ? "" : r, i = t.componentName, o = t.propName, l = t.propValue;
543
544
  (0, n.useEffect)((function() {
544
545
  if (false) {}
545
546
  }), [ a, i, o, l ]);
546
547
  };
547
- var ce = function e(t) {
548
+ var de = function e(t) {
548
549
  var n = t.additionalMessage, r = n === void 0 ? "" : n, a = t.componentName, i = t.deprecatedPropValue, o = t.propName, l = t.propValue;
549
550
  useEffect((function() {
550
551
  if (false) {}
551
552
  }), [ r, a, o, l, i ]);
552
553
  };
553
554
  // CONCATENATED MODULE: ./src/TabBar/TabBar.tsx
554
- function se(e) {
555
+ function fe(e) {
555
556
  "@babel/helpers - typeof";
556
- return se = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
557
+ return fe = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
557
558
  return typeof e;
558
559
  } : function(e) {
559
560
  return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
560
- }, se(e);
561
+ }, fe(e);
561
562
  }
562
- function de() {
563
- return de = Object.assign ? Object.assign.bind() : function(e) {
563
+ function ve() {
564
+ return ve = Object.assign ? Object.assign.bind() : function(e) {
564
565
  for (var t = 1; t < arguments.length; t++) {
565
566
  var n = arguments[t];
566
567
  for (var r in n) {
@@ -568,11 +569,11 @@
568
569
  }
569
570
  }
570
571
  return e;
571
- }, de.apply(null, arguments);
572
+ }, ve.apply(null, arguments);
572
573
  }
573
- function fe(e, t) {
574
+ function pe(e, t) {
574
575
  if (null == e) return {};
575
- var n, r, a = ve(e, t);
576
+ var n, r, a = be(e, t);
576
577
  if (Object.getOwnPropertySymbols) {
577
578
  var i = Object.getOwnPropertySymbols(e);
578
579
  for (r = 0; r < i.length; r++) {
@@ -581,7 +582,7 @@
581
582
  }
582
583
  return a;
583
584
  }
584
- function ve(e, t) {
585
+ function be(e, t) {
585
586
  if (null == e) return {};
586
587
  var n = {};
587
588
  for (var r in e) {
@@ -592,7 +593,7 @@
592
593
  }
593
594
  return n;
594
595
  }
595
- function be(e, t) {
596
+ function me(e, t) {
596
597
  var n = Object.keys(e);
597
598
  if (Object.getOwnPropertySymbols) {
598
599
  var r = Object.getOwnPropertySymbols(e);
@@ -602,60 +603,60 @@
602
603
  }
603
604
  return n;
604
605
  }
605
- function pe(e) {
606
+ function ge(e) {
606
607
  for (var t = 1; t < arguments.length; t++) {
607
608
  var n = null != arguments[t] ? arguments[t] : {};
608
- t % 2 ? be(Object(n), !0).forEach((function(t) {
609
- me(e, t, n[t]);
610
- })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : be(Object(n)).forEach((function(t) {
609
+ t % 2 ? me(Object(n), !0).forEach((function(t) {
610
+ ye(e, t, n[t]);
611
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : me(Object(n)).forEach((function(t) {
611
612
  Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
612
613
  }));
613
614
  }
614
615
  return e;
615
616
  }
616
- function me(e, t, n) {
617
- return (t = ge(t)) in e ? Object.defineProperty(e, t, {
617
+ function ye(e, t, n) {
618
+ return (t = he(t)) in e ? Object.defineProperty(e, t, {
618
619
  value: n,
619
620
  enumerable: !0,
620
621
  configurable: !0,
621
622
  writable: !0
622
623
  }) : e[t] = n, e;
623
624
  }
624
- function ge(e) {
625
- var t = ye(e, "string");
626
- return "symbol" == se(t) ? t : t + "";
625
+ function he(e) {
626
+ var t = Se(e, "string");
627
+ return "symbol" == fe(t) ? t : t + "";
627
628
  }
628
- function ye(e, t) {
629
- if ("object" != se(e) || !e) return e;
629
+ function Se(e, t) {
630
+ if ("object" != fe(e) || !e) return e;
630
631
  var n = e[Symbol.toPrimitive];
631
632
  if (void 0 !== n) {
632
633
  var r = n.call(e, t || "default");
633
- if ("object" != se(r)) return r;
634
+ if ("object" != fe(r)) return r;
634
635
  throw new TypeError("@@toPrimitive must return a primitive value.");
635
636
  }
636
637
  return ("string" === t ? String : Number)(e);
637
638
  }
638
- function he(e, t) {
639
- return xe(e) || Oe(e, t) || we(e, t) || Se();
639
+ function we(e, t) {
640
+ return ke(e) || Ie(e, t) || Ce(e, t) || Oe();
640
641
  }
641
- function Se() {
642
+ function Oe() {
642
643
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
643
644
  }
644
- function we(e, t) {
645
+ function Ce(e, t) {
645
646
  if (e) {
646
- if ("string" == typeof e) return Ce(e, t);
647
+ if ("string" == typeof e) return xe(e, t);
647
648
  var n = {}.toString.call(e).slice(8, -1);
648
- return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Ce(e, t) : void 0;
649
+ return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? xe(e, t) : void 0;
649
650
  }
650
651
  }
651
- function Ce(e, t) {
652
+ function xe(e, t) {
652
653
  (null == t || t > e.length) && (t = e.length);
653
654
  for (var n = 0, r = Array(t); n < t; n++) {
654
655
  r[n] = e[n];
655
656
  }
656
657
  return r;
657
658
  }
658
- function Oe(e, t) {
659
+ function Ie(e, t) {
659
660
  var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
660
661
  if (null != n) {
661
662
  var r, a, i, o, l = [], u = !0, c = !1;
@@ -677,11 +678,11 @@
677
678
  return l;
678
679
  }
679
680
  }
680
- function xe(e) {
681
+ function ke(e) {
681
682
  if (Array.isArray(e)) return e;
682
683
  }
683
684
  /** @public */
684
- /** @public */ var Ie = {
685
+ /** @public */ var Te = {
685
686
  autoActivate: i().bool,
686
687
  activeTabId: i().string,
687
688
  children: i().node,
@@ -693,31 +694,31 @@
693
694
  maxTabWidth: i().number,
694
695
  onChange: i().func
695
696
  };
696
- var ke = function e(t) {
697
+ var je = function e(t) {
697
698
  return Array.from(t.entries()).sort((function(e, t) {
698
- var n = he(e, 2), r = n[1].index;
699
- var a = he(t, 2), i = a[1].index;
699
+ var n = we(e, 2), r = n[1].index;
700
+ var a = we(t, 2), i = a[1].index;
700
701
  return r - i;
701
702
  })).map((function(e) {
702
- var t = he(e, 2), n = t[0], r = t[1];
703
- return pe({
703
+ var t = we(e, 2), n = t[0], r = t[1];
704
+ return ge({
704
705
  tabId: n
705
706
  }, r);
706
707
  }));
707
708
  };
708
- function Te(e) {
709
+ function Pe(e) {
709
710
  var t;
710
- var a = e.activeTabId, i = e.autoActivate, o = e.children, u = e.disabled, c = u === void 0 ? false : u, s = e.elementRef, d = e.iconPosition, f = d === void 0 ? "left" : d, v = e.layout, b = v === void 0 ? "horizontal" : v, p = e.maxTabWidth, m = e.onChange, g = fe(e, [ "activeTabId", "autoActivate", "children", "disabled", "elementRef", "iconPosition", "layout", "maxTabWidth", "onChange" ]);
711
+ var a = e.activeTabId, i = e.autoActivate, o = e.children, u = e.disabled, c = u === void 0 ? false : u, s = e.elementRef, d = e.iconPosition, f = d === void 0 ? "left" : d, v = e.layout, p = v === void 0 ? "horizontal" : v, b = e.maxTabWidth, m = e.onChange, g = pe(e, [ "activeTabId", "autoActivate", "children", "disabled", "elementRef", "iconPosition", "layout", "maxTabWidth", "onChange" ]);
711
712
  // @docs-props-type TabBarPropsBase
712
713
  // eslint-disable-next-line prefer-rest-params
713
714
  var y = (t = arguments[0]) === null || t === void 0 ? void 0 : t.iconPosition;
714
- ue({
715
+ se({
715
716
  componentName: "TabBar and TabLayout",
716
717
  propName: "iconPosition",
717
718
  propValue: y
718
719
  });
719
- var h = (0, n.useState)(false), S = he(h, 2), w = S[0], O = S[1];
720
- var x = (0, n.useState)(a), I = he(x, 2), k = I[0], T = I[1];
720
+ var h = (0, n.useState)(false), S = we(h, 2), w = S[0], O = S[1];
721
+ var C = (0, n.useState)(a), I = we(C, 2), k = I[0], T = I[1];
721
722
  // need to keep track of the focused tabId in a ref to avoid re-generating registerTab
722
723
  // because every time `registerTab` changes, it calls `ref` on all tabs
723
724
  var j = (0, n.useRef)(a);
@@ -730,17 +731,17 @@
730
731
  if (!M.current) {
731
732
  M.current = new Map;
732
733
  }
733
- var $ = b === "vertical" ? "ArrowDown" : "ArrowRight";
734
- var A = b === "vertical" ? "ArrowUp" : "ArrowLeft";
734
+ var $ = p === "vertical" ? "ArrowDown" : "ArrowRight";
735
+ var A = p === "vertical" ? "ArrowUp" : "ArrowLeft";
735
736
  // focus the tab belonging to the given tabId
736
- var z = (0, n.useCallback)((function(e) {
737
+ var _ = (0, n.useCallback)((function(e) {
737
738
  var t;
738
739
  if (!e) {
739
740
  return;
740
741
  }
741
742
  var n = (t = M.current) === null || t === void 0 ? void 0 : t.get(e);
742
743
  if (!n) {
743
- var r = ke(M.current);
744
+ var r = je(M.current);
744
745
  var a = r[0];
745
746
  if (a) {
746
747
  var i;
@@ -752,7 +753,7 @@
752
753
  T(e);
753
754
  n.element.focus();
754
755
  }), []);
755
- var _ = (0, n.useCallback)((function(e) {
756
+ var z = (0, n.useCallback)((function(e) {
756
757
  var t = e.tabId, n = e.element, r = e.index;
757
758
  if (n) {
758
759
  var a;
@@ -771,7 +772,7 @@
771
772
  }), []);
772
773
  var D = (0, n.useCallback)((function(e) {
773
774
  E.current = e;
774
- X(s, e);
775
+ L(s, e);
775
776
  }), [ s, E ]);
776
777
  // callback to handle focus event sent from a Tab
777
778
  var N = (0, n.useCallback)((function(e, t) {
@@ -780,26 +781,26 @@
780
781
  // tab already focused, no need to continue
781
782
  return;
782
783
  }
783
- z(n);
784
+ _(n);
784
785
  if (i && a !== n) {
785
786
  m === null || m === void 0 ? void 0 : m(e, {
786
787
  selectedTabId: n
787
788
  });
788
789
  }
789
- }), [ a, i, k, z, m ]);
790
+ }), [ a, i, k, _, m ]);
790
791
  var R = (0, n.useCallback)((function(e, t) {
791
792
  var n = t.tabId;
792
- z(n);
793
+ _(n);
793
794
  m === null || m === void 0 ? void 0 : m(e, {
794
795
  selectedTabId: n
795
796
  });
796
- }), [ z, m ]);
797
+ }), [ _, m ]);
797
798
  var q = (0, n.useCallback)((function(e) {
798
799
  // if command key on Mac was pressed ignore
799
800
  if (e.nativeEvent.metaKey) {
800
801
  return;
801
802
  }
802
- var t = ke(M.current);
803
+ var t = je(M.current);
803
804
  var n = k ? t.findIndex((function(e) {
804
805
  return e.tabId === k;
805
806
  })) : -1;
@@ -810,14 +811,14 @@
810
811
  var i = e.key;
811
812
  var o;
812
813
  if (i === $) {
813
- o = ae(t, a, a + 1);
814
+ o = oe(t, a, a + 1);
814
815
  } else if (i === A) {
815
- o = ie(t, a, a - 1);
816
+ o = le(t, a, a - 1);
816
817
  } else if (i === "Home") {
817
- o = ae(t, a, 0);
818
+ o = oe(t, a, 0);
818
819
  } else if (i === "End") {
819
- o = ie(t, a, r.length - 1);
820
- } else if (b === "horizontal" && e.shiftKey && i === "F10") {
820
+ o = le(t, a, r.length - 1);
821
+ } else if (p === "horizontal" && e.shiftKey && i === "F10") {
821
822
  O((function(e) {
822
823
  if (e) {
823
824
  var t = r[a];
@@ -825,42 +826,42 @@
825
826
  }
826
827
  return !e;
827
828
  }));
828
- } else if (b === "horizontal" && i === "ArrowDown") {
829
+ } else if (p === "horizontal" && i === "ArrowDown") {
829
830
  O(true);
830
831
  }
831
832
  if (o) {
832
- z(o.tabId);
833
+ _(o.tabId);
833
834
  e.preventDefault();
834
835
  }
835
- }), [ k, z, b, $, A ]);
836
+ }), [ k, _, p, $, A ]);
836
837
  var V = (0, n.useCallback)((function(e) {
837
- z(e);
838
+ _(e);
838
839
  // in case they clicked on a menu of tab they were not even focused on yet
839
840
  O(true);
840
- }), [ z ]);
841
- var W = (0, n.useCallback)((function(e) {
841
+ }), [ _ ]);
842
+ var B = (0, n.useCallback)((function(e) {
842
843
  var t = e.event;
843
844
  // prevent content clicks/enter key from changing the active tab
844
845
  t === null || t === void 0 ? void 0 : t.stopPropagation();
845
846
  O(false);
846
847
  }), []);
847
- var B = (0, n.useMemo)((function() {
848
+ var W = (0, n.useMemo)((function() {
848
849
  return {
849
850
  disabled: c,
850
851
  focusedTabId: k,
851
852
  iconPosition: f,
852
- layout: b,
853
- maxTabWidth: p,
853
+ layout: p,
854
+ maxTabWidth: b,
854
855
  onClick: R,
855
856
  onFocus: N,
856
857
  onMenuOpen: V,
857
- onMenuClose: W,
858
+ onMenuClose: B,
858
859
  isMenuOpen: w,
859
- registerTab: _,
860
+ registerTab: z,
860
861
  activeTabId: a
861
862
  };
862
- }), [ c, k, f, b, R, N, p, V, W, w, _, a ]);
863
- var F = (0, n.useMemo)((function() {
863
+ }), [ c, k, f, p, R, N, b, V, B, w, z, a ]);
864
+ var X = (0, n.useMemo)((function() {
864
865
  return n.Children.toArray(o).filter(n.isValidElement).map((function(e, t) {
865
866
  if (e.type.as === "Tab") {
866
867
 
@@ -871,12 +872,12 @@
871
872
  return e;
872
873
  }));
873
874
  }), [ o ]);
874
- var L = l()(F);
875
+ var F = l()(X);
875
876
  (0, n.useEffect)((function() {
876
877
  // if the focused tab is removed, focus the next tab
877
- if (L !== F) {
878
+ if (F !== X) {
878
879
  var e;
879
- var t = ke(M.current);
880
+ var t = je(M.current);
880
881
  if (t.find((function(e) {
881
882
  return e.tabId === j.current;
882
883
  }))) {
@@ -886,26 +887,26 @@
886
887
  var n = Math.min((e = P.current) !== null && e !== void 0 ? e : 0, t.length - 1);
887
888
  var r = t[n];
888
889
  if (r) {
889
- z(r.tabId);
890
+ _(r.tabId);
890
891
  }
891
892
  }
892
- }), [ F, z, L ]);
893
+ }), [ X, _, F ]);
893
894
 
894
- return r().createElement(re, de({
895
- "data-tab-layout": b,
895
+ return r().createElement(ie, ve({
896
+ "data-tab-layout": p,
896
897
  "data-test-active-tab-id": a,
897
898
  "data-test": "tab-bar",
898
899
  role: "tablist",
899
900
  ref: D,
900
- $layout: b,
901
+ $layout: p,
901
902
  onKeyDown: q
902
- }, g), r().createElement(C.Provider, {
903
- value: B
904
- }, F));
903
+ }, g), r().createElement(x.Provider, {
904
+ value: W
905
+ }, X));
905
906
  }
906
- Te.propTypes = Ie;
907
- Te.Tab = ne;
908
- /* harmony default export */ const je = Te;
907
+ Pe.propTypes = Te;
908
+ Pe.Tab = ae;
909
+ /* harmony default export */ const Ee = Pe;
909
910
  // CONCATENATED MODULE: ./src/TabBar/index.ts
910
911
  module.exports = t;
911
912
  /******/})();