@splunk/react-ui 4.21.0 → 4.21.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 (83) hide show
  1. package/Accordion.js +425 -325
  2. package/Anchor.js +147 -117
  3. package/Animation.js +142 -94
  4. package/AnimationToggle.js +197 -193
  5. package/Box.js +145 -118
  6. package/Breadcrumbs.js +288 -206
  7. package/Button.js +488 -465
  8. package/ButtonGroup.js +160 -128
  9. package/ButtonSimple.js +543 -462
  10. package/CHANGELOG.md +7 -2
  11. package/Calendar.js +1111 -1001
  12. package/Card.js +771 -598
  13. package/CardLayout.js +205 -147
  14. package/Chip.js +509 -488
  15. package/Clickable.js +414 -352
  16. package/CloseButton.js +165 -142
  17. package/Code.js +1808 -2084
  18. package/Code.js.LICENSE.txt +8 -0
  19. package/CollapsiblePanel.js +586 -519
  20. package/Color.js +1066 -1069
  21. package/ColumnLayout.js +402 -363
  22. package/ComboBox.js +891 -794
  23. package/Concertina.js +997 -802
  24. package/ControlGroup.js +687 -594
  25. package/Date.js +567 -547
  26. package/DefinitionList.js +308 -234
  27. package/Divider.js +149 -118
  28. package/Dropdown.js +459 -416
  29. package/DualListbox.js +1479 -1541
  30. package/EventListener.js +94 -97
  31. package/File.js +1051 -969
  32. package/FormRows.js +883 -696
  33. package/Heading.js +216 -193
  34. package/Image.js +446 -402
  35. package/JSONTree.js +690 -551
  36. package/Layer.js +437 -410
  37. package/Link.js +336 -255
  38. package/List.js +213 -161
  39. package/Markdown.js +509 -487
  40. package/Menu.js +1105 -1056
  41. package/Message.js +475 -441
  42. package/MessageBar.js +387 -373
  43. package/Modal.js +810 -634
  44. package/ModalLayer.js +326 -243
  45. package/Monogram.js +308 -276
  46. package/Multiselect.js +3550 -3364
  47. package/Number.js +729 -687
  48. package/Paginator.js +510 -449
  49. package/Paragraph.js +145 -112
  50. package/Popover.js +1459 -1432
  51. package/Progress.js +301 -246
  52. package/RadioBar.js +610 -527
  53. package/RadioList.js +483 -444
  54. package/Resize.js +530 -489
  55. package/ResultsMenu.js +494 -455
  56. package/ScreenReaderContent.js +142 -111
  57. package/Scroll.js +595 -456
  58. package/ScrollContainerContext.js +197 -206
  59. package/Search.js +744 -650
  60. package/Select.js +2442 -2345
  61. package/SidePanel.js +390 -284
  62. package/Slider.js +669 -676
  63. package/SlidingPanels.js +639 -503
  64. package/SplitButton.js +464 -367
  65. package/StaticContent.js +161 -133
  66. package/StepBar.js +386 -358
  67. package/Switch.js +710 -640
  68. package/TabBar.js +726 -680
  69. package/TabLayout.js +406 -322
  70. package/Table.js +4842 -4616
  71. package/Text.js +1170 -1138
  72. package/TextArea.js +1102 -1090
  73. package/Tooltip.js +624 -581
  74. package/TransitionOpen.js +489 -422
  75. package/Typography.js +176 -153
  76. package/WaitSpinner.js +230 -206
  77. package/package.json +5 -5
  78. package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
  79. package/types/src/JSONTree/TreeNode.d.ts +5 -0
  80. package/useForceUpdate.js +112 -82
  81. package/useKeyPress.js +74 -71
  82. package/usePrevious.js +65 -65
  83. package/useRovingFocus.js +122 -138
package/TabBar.js CHANGED
@@ -1,698 +1,744 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
- /******/ // The require scope
4
- /******/ var __webpack_require__ = {};
5
- /******/
6
- /************************************************************************/
7
- /******/ /* webpack/runtime/compat get default export */
8
- /******/ (() => {
9
- /******/ // getDefaultExport function for compatibility with non-harmony modules
10
- /******/ __webpack_require__.n = (module) => {
11
- /******/ var getter = module && module.__esModule ?
12
- /******/ () => (module['default']) :
13
- /******/ () => (module);
14
- /******/ __webpack_require__.d(getter, { a: getter });
15
- /******/ return getter;
16
- /******/ };
17
- /******/ })();
18
- /******/
19
- /******/ /* webpack/runtime/define property getters */
20
- /******/ (() => {
21
- /******/ // define getter functions for harmony exports
22
- /******/ __webpack_require__.d = (exports, definition) => {
23
- /******/ for(var key in definition) {
24
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
25
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
26
- /******/ }
27
- /******/ }
28
- /******/ };
29
- /******/ })();
30
- /******/
31
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
32
- /******/ (() => {
33
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
34
- /******/ })();
35
- /******/
36
- /******/ /* webpack/runtime/make namespace object */
37
- /******/ (() => {
38
- /******/ // define __esModule on exports
39
- /******/ __webpack_require__.r = (exports) => {
40
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
41
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
42
- /******/ }
43
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
44
- /******/ };
45
- /******/ })();
46
- /******/
47
- /************************************************************************/
48
- var __webpack_exports__ = {};
49
- // ESM COMPAT FLAG
50
- __webpack_require__.r(__webpack_exports__);
51
-
52
- // EXPORTS
53
- __webpack_require__.d(__webpack_exports__, {
54
- Tab: () => (/* reexport */ TabBar_Tab),
55
- "default": () => (/* reexport */ TabBar_TabBar)
56
- });
57
-
58
- ;// CONCATENATED MODULE: external "react"
59
- const external_react_namespaceObject = require("react");
60
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
61
- ;// CONCATENATED MODULE: external "prop-types"
62
- const external_prop_types_namespaceObject = require("prop-types");
63
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_namespaceObject);
64
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
65
- const keyboard_namespaceObject = require("@splunk/ui-utils/keyboard");
66
- ;// CONCATENATED MODULE: external "styled-components"
67
- const external_styled_components_namespaceObject = require("styled-components");
68
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_namespaceObject);
69
- ;// CONCATENATED MODULE: external "@splunk/themes"
70
- const themes_namespaceObject = require("@splunk/themes");
71
- ;// CONCATENATED MODULE: ./src/TabBar/TabBarStyles.ts
72
-
73
-
74
- var Styled = external_styled_components_default().div.withConfig({
75
- displayName: "TabBarStyles__Styled",
76
- componentId: "sc-1t85fen-0"
77
- })(["", " position:relative;&::before{content:'';display:block;position:absolute;left:0;top:0;right:0;bottom:0;border:0 solid ", ";}", ";"], themes_namespaceObject.mixins.reset('flex'), (0,themes_namespaceObject.pick)({
78
- enterprise: themes_namespaceObject.variables.borderLightColor,
79
- prisma: themes_namespaceObject.variables.neutral200
80
- }), (0,themes_namespaceObject.pickVariant)('$layout', {
81
- horizontal: {
82
- prisma: (0,themes_namespaceObject.pickVariant)('$withUnderline', {
83
- /* context appearance is only supported for Prisma */
84
- "true": (0,external_styled_components_namespaceObject.css)(["&::before{border-bottom-width:1px;}"])
85
- }),
86
- enterprise: (0,external_styled_components_namespaceObject.css)(["&::before{border-bottom-width:1px;}"])
87
- },
88
- vertical: {
89
- enterprise: (0,external_styled_components_namespaceObject.css)(["display:inline-block;&::before{border-right-width:1px;}"]),
90
- prisma: (0,external_styled_components_namespaceObject.css)(["display:inline-block;&::before{border-right-width:1px;}"])
91
- }
92
- }));
93
-
94
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Popover"
95
- const Popover_namespaceObject = require("@splunk/react-ui/Popover");
96
- var Popover_default = /*#__PURE__*/__webpack_require__.n(Popover_namespaceObject);
97
- ;// CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
98
- const ScreenReaderContent_namespaceObject = require("@splunk/react-ui/ScreenReaderContent");
99
- var ScreenReaderContent_default = /*#__PURE__*/__webpack_require__.n(ScreenReaderContent_namespaceObject);
100
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/id"
101
- const id_namespaceObject = require("@splunk/ui-utils/id");
102
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
103
- const Clickable_namespaceObject = require("@splunk/react-ui/Clickable");
104
- var Clickable_default = /*#__PURE__*/__webpack_require__.n(Clickable_namespaceObject);
105
- ;// CONCATENATED MODULE: ./src/TabBar/TabStyles.ts
106
-
107
-
108
-
109
- var StyledClickable = external_styled_components_default()((Clickable_default())).withConfig({
110
- displayName: "TabStyles__StyledClickable",
111
- componentId: "sc-1ry8mzj-0"
112
- })(["flex:0 1 auto;display:block;position:relative;line-height:", ";text-align:center;white-space:nowrap;color:", ";", ";&[aria-selected='true']{cursor:default;", "}&[aria-selected='false']{box-shadow:none;font-weight:", ";", " &:hover:not([disabled]){", "}}&:focus{box-shadow:", ";", "}"], (0,themes_namespaceObject.pick)({
113
- enterprise: '24px',
114
- prisma: '20px'
115
- }), themes_namespaceObject.variables.contentColorDefault, (0,themes_namespaceObject.pickVariant)('$layout', {
116
- horizontal: (0,external_styled_components_namespaceObject.css)(["padding:", ";margin-bottom:1px;"], (0,themes_namespaceObject.pick)({
117
- enterprise: '3px 20px',
118
- prisma: {
119
- comfortable: '0 20px',
120
- compact: '0 16px'
121
- }
122
- })),
123
- vertical: {
124
- enterprise: (0,external_styled_components_namespaceObject.css)(["width:100%;text-align:left;right:1px;padding:10px 20px;", ""], function (_ref) {
125
- var $icon = _ref.$icon;
126
- return $icon && (0,external_styled_components_namespaceObject.css)(["text-align:center;"]);
127
- }),
128
- prisma: (0,external_styled_components_namespaceObject.css)(["width:100%;right:1px;padding:", ";"], (0,themes_namespaceObject.pick)({
129
- comfortable: '0 20px',
130
- compact: '0 16px'
131
- }))
132
- }
133
- }), (0,themes_namespaceObject.pick)({
134
- enterprise: (0,external_styled_components_namespaceObject.css)(["font-weight:", ";"], themes_namespaceObject.variables.fontWeightBold),
135
- prisma: (0,external_styled_components_namespaceObject.css)(["color:", ";font-weight:", ";"], themes_namespaceObject.variables.contentColorActive, themes_namespaceObject.variables.fontWeightBold)
136
- }), (0,themes_namespaceObject.pick)({
137
- enterprise: 'normal',
138
- prisma: themes_namespaceObject.variables.fontWeightSemiBold
139
- }), (0,themes_namespaceObject.pick)({
140
- prisma: (0,external_styled_components_namespaceObject.css)(["&::after{display:block;content:attr(title);font-weight:", ";height:0;color:transparent;overflow:hidden;visibility:hidden;}"], themes_namespaceObject.variables.fontWeightBold)
141
- }), (0,themes_namespaceObject.pick)({
142
- prisma: (0,external_styled_components_namespaceObject.css)(["color:", ";"], themes_namespaceObject.variables.contentColorActive)
143
- }), themes_namespaceObject.variables.focusShadowInset, (0,themes_namespaceObject.pick)({
144
- prisma: (0,external_styled_components_namespaceObject.css)(["color:", ";"], themes_namespaceObject.variables.contentColorActive)
145
- }));
146
- var StyledUnderline = external_styled_components_default().div.withConfig({
147
- displayName: "TabStyles__StyledUnderline",
148
- componentId: "sc-1ry8mzj-1"
149
- })(["position:absolute;", " ", ";[aria-selected='true'] > &&{background-color:", ";", ";}", ":hover:not([disabled]) > &&{", ";}"], (0,themes_namespaceObject.pick)({
150
- enterprise: (0,external_styled_components_namespaceObject.css)(["background:", ";"], themes_namespaceObject.variables.borderLightColor)
151
- }), (0,themes_namespaceObject.pickVariant)('$layout', {
152
- horizontal: (0,external_styled_components_namespaceObject.css)(["height:0;box-sizing:border-box;width:", ";", " transition:height 0.2s;"], (0,themes_namespaceObject.pick)({
153
- enterprise: (0,external_styled_components_namespaceObject.css)(["calc(100% - 20px * 2)"]),
154
- prisma: {
155
- comfortable: (0,external_styled_components_namespaceObject.css)(["calc(100% - 20px * 2)"]),
156
- compact: (0,external_styled_components_namespaceObject.css)(["calc(100% - 16px * 2)"])
157
- }
158
- }), (0,themes_namespaceObject.pick)({
159
- enterprise: (0,external_styled_components_namespaceObject.css)(["bottom:-1px;"])
160
- })),
161
- vertical: {
162
- enterprise: (0,external_styled_components_namespaceObject.css)(["width:0;height:calc(100% - 10px * 2);top:10px;right:-1px;transition:width 0.2s;"]),
163
- prisma: (0,external_styled_components_namespaceObject.css)(["width:1px;height:calc(100% - 10px * 2);top:10px;right:-1px;transition:width 0.2s;box-sizing:border-box;"])
164
- }
165
- }), (0,themes_namespaceObject.pick)({
166
- enterprise: themes_namespaceObject.variables.accentColor,
167
- prisma: themes_namespaceObject.variables.contentColorActive
168
- }), (0,themes_namespaceObject.pickVariant)('$layout', {
169
- horizontal: {
170
- enterprise: (0,external_styled_components_namespaceObject.css)(["height:3px;"]),
171
- prisma: (0,themes_namespaceObject.pickVariant)('$withUnderline', {
172
- // context appearance is only supported for Prisma
173
- "true": (0,external_styled_components_namespaceObject.css)(["height:1px;"])
174
- })
175
- },
176
- vertical: {
177
- enterprise: (0,external_styled_components_namespaceObject.css)(["width:3px;"]),
178
- prisma: (0,external_styled_components_namespaceObject.css)(["width:1px;"])
179
- }
180
- }), StyledClickable, (0,themes_namespaceObject.pickVariant)('$layout', {
181
- horizontal: {
182
- enterprise: (0,external_styled_components_namespaceObject.css)(["height:3px;"])
183
- },
184
- vertical: {
185
- enterprise: (0,external_styled_components_namespaceObject.css)(["width:3px;"])
186
- }
187
- }));
188
- var StyledIcon = external_styled_components_default().span.withConfig({
189
- displayName: "TabStyles__StyledIcon",
190
- componentId: "sc-1ry8mzj-2"
191
- })(["", ";"], (0,themes_namespaceObject.pickVariant)('$iconSize', {
192
- inline: (0,external_styled_components_namespaceObject.css)(["", " text-align:left;padding-right:", ";> svg{transform:translateY(-1px);}"], (0,themes_namespaceObject.pick)({
193
- prisma: (0,external_styled_components_namespaceObject.css)(["display:inline-block;width:16px;height:16px;"])
194
- }), (0,themes_namespaceObject.pick)({
195
- enterprise: '0.4em',
196
- prisma: '8px'
197
- })),
198
- small: (0,external_styled_components_namespaceObject.css)(["font-size:24px;height:24px;text-align:center;display:block;padding:4px 0;"]),
199
- large: (0,external_styled_components_namespaceObject.css)(["font-size:48px;height:48px;text-align:center;display:block;padding:8px 0 0;"])
200
- }));
201
- var StyledLabel = external_styled_components_default().div.withConfig({
202
- displayName: "TabStyles__StyledLabel",
203
- componentId: "sc-1ry8mzj-3"
204
- })(["overflow:hidden;text-overflow:ellipsis;min-width:10px;margin:", ";"], (0,themes_namespaceObject.pick)({
205
- enterprise: '0',
206
- prisma: {
207
- comfortable: '16px 0',
208
- compact: '10px 0'
209
- }
210
- }));
211
- var StyledCount = external_styled_components_default().div.withConfig({
212
- displayName: "TabStyles__StyledCount",
213
- componentId: "sc-1ry8mzj-4"
214
- })(["", " display:inline-block;border-radius:18px;color:", ";font-size:", ";line-height:10px;padding:4px 6px;margin-left:", ";", " &[disabled]{background:", ";color:", ";}"], themes_namespaceObject.mixins.reset('inlne-block'), themes_namespaceObject.variables.contentColorDefault, (0,themes_namespaceObject.pick)({
215
- enterprise: 'inherit',
216
- prisma: '10px'
217
- }), (0,themes_namespaceObject.pick)({
218
- enterprise: '0',
219
- prisma: '8px'
220
- }), (0,themes_namespaceObject.pick)({
221
- enterprise: (0,external_styled_components_namespaceObject.css)(["&::before{content:'(';}&::after{content:')';}"]),
222
- prisma: (0,external_styled_components_namespaceObject.css)(["background:", ";"], themes_namespaceObject.variables.neutral100)
223
- }), themes_namespaceObject.variables.interactiveColorBackgroundDisabled, themes_namespaceObject.variables.contentColorDisabled);
224
- var StyledTooltipContent = external_styled_components_default().div.withConfig({
225
- displayName: "TabStyles__StyledTooltipContent",
226
- componentId: "sc-1ry8mzj-5"
227
- })(["padding:8px;font-size:", ";"], themes_namespaceObject.variables.fontSizeSmall);
228
-
229
- ;// CONCATENATED MODULE: ./src/TabBar/TabBarContext.tsx
230
-
231
- var TabBarContext = /*#__PURE__*/(0,external_react_namespaceObject.createContext)({});
232
- TabBarContext.displayName = 'TabBar';
233
- /* harmony default export */ const TabBar_TabBarContext = (TabBarContext);
234
- ;// CONCATENATED MODULE: ./src/utils/getCountValue.ts
235
- // A utility for max count
236
- var maxCountValue = function maxCountValue(count, maxCount) {
237
- if (count > maxCount) {
238
- return "".concat(maxCount, "+");
239
- }
240
-
241
- return count;
242
- };
243
- ;// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
244
- /**
1
+ /******/ (() => {
2
+ // webpackBootstrap
3
+ /******/ "use strict";
4
+ /******/ // The require scope
5
+ /******/ var e = {};
6
+ /******/
7
+ /************************************************************************/
8
+ /******/ /* webpack/runtime/compat get default export */
9
+ /******/ (() => {
10
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
11
+ /******/ e.n = t => {
12
+ /******/ var r = t && t.__esModule ?
13
+ /******/ () => t["default"]
14
+ /******/ : () => t
15
+ /******/;
16
+ e.d(r, {
17
+ a: r
18
+ });
19
+ /******/ return r;
20
+ /******/ };
21
+ /******/ })();
22
+ /******/
23
+ /******/ /* webpack/runtime/define property getters */
24
+ /******/ (() => {
25
+ /******/ // define getter functions for harmony exports
26
+ /******/ e.d = (t, r) => {
27
+ /******/ for (var n in r) {
28
+ /******/ if (e.o(r, n) && !e.o(t, n)) {
29
+ /******/ Object.defineProperty(t, n, {
30
+ enumerable: true,
31
+ get: r[n]
32
+ });
33
+ /******/ }
34
+ /******/ }
35
+ /******/ };
36
+ /******/ })();
37
+ /******/
38
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
39
+ /******/ (() => {
40
+ /******/ e.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
41
+ /******/;
42
+ })();
43
+ /******/
44
+ /******/ /* webpack/runtime/make namespace object */
45
+ /******/ (() => {
46
+ /******/ // define __esModule on exports
47
+ /******/ e.r = e => {
48
+ /******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
49
+ /******/ Object.defineProperty(e, Symbol.toStringTag, {
50
+ value: "Module"
51
+ });
52
+ /******/ }
53
+ /******/ Object.defineProperty(e, "__esModule", {
54
+ value: true
55
+ });
56
+ /******/ };
57
+ /******/ })();
58
+ /******/
59
+ /************************************************************************/ var t = {};
60
+ // ESM COMPAT FLAG
61
+ e.r(t);
62
+ // EXPORTS
63
+ e.d(t, {
64
+ Tab: () => /* reexport */ L,
65
+ default: () => /* reexport */ te
66
+ });
67
+ // CONCATENATED MODULE: external "react"
68
+ const r = require("react");
69
+ var n = e.n(r);
70
+ // CONCATENATED MODULE: external "prop-types"
71
+ const i = require("prop-types");
72
+ var o = e.n(i);
73
+ // CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
74
+ const a = require("@splunk/ui-utils/keyboard");
75
+ // CONCATENATED MODULE: external "styled-components"
76
+ const l = require("styled-components");
77
+ var c = e.n(l);
78
+ // CONCATENATED MODULE: external "@splunk/themes"
79
+ const s = require("@splunk/themes");
80
+ // CONCATENATED MODULE: ./src/TabBar/TabBarStyles.ts
81
+ var p = c().div.withConfig({
82
+ displayName: "TabBarStyles__Styled",
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", {
89
+ horizontal: {
90
+ prisma: (0, s.pickVariant)("$withUnderline", {
91
+ /* context appearance is only supported for Prisma */
92
+ true: (0, l.css)([ "&::before{border-bottom-width:1px;}" ])
93
+ }),
94
+ enterprise: (0, l.css)([ "&::before{border-bottom-width:1px;}" ])
95
+ },
96
+ vertical: {
97
+ enterprise: (0, l.css)([ "display:inline-block;&::before{border-right-width:1px;}" ]),
98
+ prisma: (0, l.css)([ "display:inline-block;&::before{border-right-width:1px;}" ])
99
+ }
100
+ }));
101
+ // CONCATENATED MODULE: external "@splunk/react-ui/Popover"
102
+ const u = require("@splunk/react-ui/Popover");
103
+ var d = e.n(u);
104
+ // CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
105
+ const f = require("@splunk/react-ui/ScreenReaderContent");
106
+ var b = e.n(f);
107
+ // CONCATENATED MODULE: external "@splunk/ui-utils/id"
108
+ const v = require("@splunk/ui-utils/id");
109
+ // CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
110
+ const h = require("@splunk/react-ui/Clickable");
111
+ var y = e.n(h);
112
+ // CONCATENATED MODULE: ./src/TabBar/TabStyles.ts
113
+ var m = c()(y()).withConfig({
114
+ displayName: "TabStyles__StyledClickable",
115
+ componentId: "sc-1ry8mzj-0"
116
+ })([ "flex:0 1 auto;display:block;position:relative;line-height:", ";text-align:center;white-space:nowrap;color:", ";", ";&[aria-selected='true']{cursor:default;", "}&[aria-selected='false']{box-shadow:none;font-weight:", ";", " &:hover:not([disabled]){", "}}&:focus{box-shadow:", ";", "}" ], (0,
117
+ s.pick)({
118
+ enterprise: "24px",
119
+ prisma: "20px"
120
+ }), s.variables.contentColorDefault, (0, s.pickVariant)("$layout", {
121
+ horizontal: (0, l.css)([ "padding:", ";margin-bottom:1px;" ], (0, s.pick)({
122
+ enterprise: "3px 20px",
123
+ prisma: {
124
+ comfortable: "0 20px",
125
+ compact: "0 16px"
126
+ }
127
+ })),
128
+ vertical: {
129
+ enterprise: (0, l.css)([ "width:100%;text-align:left;right:1px;padding:10px 20px;", "" ], (function(e) {
130
+ var t = e.$icon;
131
+ return t && (0, l.css)([ "text-align:center;" ]);
132
+ })),
133
+ prisma: (0, l.css)([ "width:100%;right:1px;padding:", ";" ], (0, s.pick)({
134
+ comfortable: "0 20px",
135
+ compact: "0 16px"
136
+ }))
137
+ }
138
+ }), (0, s.pick)({
139
+ enterprise: (0, l.css)([ "font-weight:", ";" ], s.variables.fontWeightBold),
140
+ prisma: (0, l.css)([ "color:", ";font-weight:", ";" ], s.variables.contentColorActive, s.variables.fontWeightBold)
141
+ }), (0, s.pick)({
142
+ enterprise: "normal",
143
+ prisma: s.variables.fontWeightSemiBold
144
+ }), (0, s.pick)({
145
+ prisma: (0, l.css)([ "&::after{display:block;content:attr(title);font-weight:", ";height:0;color:transparent;overflow:hidden;visibility:hidden;}" ], s.variables.fontWeightBold)
146
+ }), (0, s.pick)({
147
+ prisma: (0, l.css)([ "color:", ";" ], s.variables.contentColorActive)
148
+ }), s.variables.focusShadowInset, (0, s.pick)({
149
+ prisma: (0, l.css)([ "color:", ";" ], s.variables.contentColorActive)
150
+ }));
151
+ var g = c().div.withConfig({
152
+ displayName: "TabStyles__StyledUnderline",
153
+ componentId: "sc-1ry8mzj-1"
154
+ })([ "position:absolute;", " ", ";[aria-selected='true'] > &&{background-color:", ";", ";}", ":hover:not([disabled]) > &&{", ";}" ], (0,
155
+ s.pick)({
156
+ enterprise: (0, l.css)([ "background:", ";" ], s.variables.borderLightColor)
157
+ }), (0, s.pickVariant)("$layout", {
158
+ horizontal: (0, l.css)([ "height:0;box-sizing:border-box;width:", ";", " transition:height 0.2s;" ], (0,
159
+ s.pick)({
160
+ enterprise: (0, l.css)([ "calc(100% - 20px * 2)" ]),
161
+ prisma: {
162
+ comfortable: (0, l.css)([ "calc(100% - 20px * 2)" ]),
163
+ compact: (0, l.css)([ "calc(100% - 16px * 2)" ])
164
+ }
165
+ }), (0, s.pick)({
166
+ enterprise: (0, l.css)([ "bottom:-1px;" ])
167
+ })),
168
+ vertical: {
169
+ enterprise: (0, l.css)([ "width:0;height:calc(100% - 10px * 2);top:10px;right:-1px;transition:width 0.2s;" ]),
170
+ prisma: (0, l.css)([ "width:1px;height:calc(100% - 10px * 2);top:10px;right:-1px;transition:width 0.2s;box-sizing:border-box;" ])
171
+ }
172
+ }), (0, s.pick)({
173
+ enterprise: s.variables.accentColor,
174
+ prisma: s.variables.contentColorActive
175
+ }), (0, s.pickVariant)("$layout", {
176
+ horizontal: {
177
+ enterprise: (0, l.css)([ "height:3px;" ]),
178
+ prisma: (0, s.pickVariant)("$withUnderline", {
179
+ // context appearance is only supported for Prisma
180
+ true: (0, l.css)([ "height:1px;" ])
181
+ })
182
+ },
183
+ vertical: {
184
+ enterprise: (0, l.css)([ "width:3px;" ]),
185
+ prisma: (0, l.css)([ "width:1px;" ])
186
+ }
187
+ }), m, (0, s.pickVariant)("$layout", {
188
+ horizontal: {
189
+ enterprise: (0, l.css)([ "height:3px;" ])
190
+ },
191
+ vertical: {
192
+ enterprise: (0, l.css)([ "width:3px;" ])
193
+ }
194
+ }));
195
+ var x = c().span.withConfig({
196
+ displayName: "TabStyles__StyledIcon",
197
+ componentId: "sc-1ry8mzj-2"
198
+ })([ "", ";" ], (0, s.pickVariant)("$iconSize", {
199
+ inline: (0, l.css)([ "", " text-align:left;padding-right:", ";> svg{transform:translateY(-1px);}" ], (0,
200
+ s.pick)({
201
+ prisma: (0, l.css)([ "display:inline-block;width:16px;height:16px;" ])
202
+ }), (0, s.pick)({
203
+ enterprise: "0.4em",
204
+ prisma: "8px"
205
+ })),
206
+ small: (0, l.css)([ "font-size:24px;height:24px;text-align:center;display:block;padding:4px 0;" ]),
207
+ large: (0, l.css)([ "font-size:48px;height:48px;text-align:center;display:block;padding:8px 0 0;" ])
208
+ }));
209
+ var k = c().div.withConfig({
210
+ displayName: "TabStyles__StyledLabel",
211
+ componentId: "sc-1ry8mzj-3"
212
+ })([ "overflow:hidden;text-overflow:ellipsis;min-width:10px;margin:", ";" ], (0,
213
+ s.pick)({
214
+ enterprise: "0",
215
+ prisma: {
216
+ comfortable: "16px 0",
217
+ compact: "10px 0"
218
+ }
219
+ }));
220
+ var w = c().div.withConfig({
221
+ displayName: "TabStyles__StyledCount",
222
+ componentId: "sc-1ry8mzj-4"
223
+ })([ "", " display:inline-block;border-radius:18px;color:", ";font-size:", ";line-height:10px;padding:4px 6px;margin-left:", ";", " &[disabled]{background:", ";color:", ";}" ], s.mixins.reset("inlne-block"), s.variables.contentColorDefault, (0,
224
+ s.pick)({
225
+ enterprise: "inherit",
226
+ prisma: "10px"
227
+ }), (0, s.pick)({
228
+ enterprise: "0",
229
+ prisma: "8px"
230
+ }), (0, s.pick)({
231
+ enterprise: (0, l.css)([ "&::before{content:'(';}&::after{content:')';}" ]),
232
+ prisma: (0, l.css)([ "background:", ";" ], s.variables.neutral100)
233
+ }), s.variables.interactiveColorBackgroundDisabled, s.variables.contentColorDisabled);
234
+ var O = c().div.withConfig({
235
+ displayName: "TabStyles__StyledTooltipContent",
236
+ componentId: "sc-1ry8mzj-5"
237
+ })([ "padding:8px;font-size:", ";" ], s.variables.fontSizeSmall);
238
+ // CONCATENATED MODULE: ./src/TabBar/TabBarContext.tsx
239
+ var S = (0, r.createContext)({});
240
+ S.displayName = "TabBar";
241
+ /* harmony default export */ const C = S;
242
+ // CONCATENATED MODULE: ./src/utils/getCountValue.ts
243
+ // A utility for max count
244
+ var I = function e(t, r) {
245
+ if (t > r) {
246
+ return "".concat(r, "+");
247
+ }
248
+ return t;
249
+ };
250
+ // CONCATENATED MODULE: ./src/utils/updateReactRef.ts
251
+ /**
245
252
  * Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
246
253
  *
247
254
  * @param ref - The React callback or object ref. Can be `null` or `undefined`.
248
255
  * @param current - The new value of the ref.
249
256
  */
250
- function updateReactRef(ref, current) {
251
- if (ref) {
252
- if (typeof ref === 'function') {
253
- ref(current);
254
- } else {
255
- // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
256
- // the intention here is to signal "we will take care of setting 'current', not you".
257
- ref.current = current; // eslint-disable-line no-param-reassign
257
+ function j(e, t) {
258
+ if (e) {
259
+ if (typeof e === "function") {
260
+ e(t);
261
+ } else {
262
+ // the public signature of this util uses React.Ref<T> to mirror the way React types refs.
263
+ // the intention here is to signal "we will take care of setting 'current', not you".
264
+ e.current = t;
265
+ // eslint-disable-line no-param-reassign
266
+ }
267
+ }
258
268
  }
259
- }
260
- }
261
-
262
-
263
- ;// CONCATENATED MODULE: ./src/TabBar/Tab.tsx
264
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
265
-
266
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
267
-
268
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
269
-
270
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
271
-
272
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
273
-
274
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
275
-
276
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
277
-
278
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
279
-
280
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
281
-
282
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
283
-
284
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
285
-
286
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
287
-
288
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
289
-
290
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
291
-
292
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
293
-
294
-
295
-
296
-
297
-
298
-
299
-
300
-
301
-
302
-
303
- var propTypes = {
304
- /** @private. Is the tab active. */
305
- active: (external_prop_types_default()).bool,
306
- ariaControls: (external_prop_types_default()).string,
307
- count: (external_prop_types_default()).number,
308
- disabled: (external_prop_types_default()).bool,
309
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
310
- icon: (external_prop_types_default()).node,
311
- id: (external_prop_types_default()).string,
312
- label: external_prop_types_default().oneOfType([(external_prop_types_default()).string, (external_prop_types_default()).element]),
313
-
314
- /** @private Maximum count number in tab label */
315
- maxCount: (external_prop_types_default()).number,
316
- tabId: (external_prop_types_default()).string,
317
-
318
- /** @private. The internal key of the tab */
319
- tabKey: (external_prop_types_default()).number,
320
- to: (external_prop_types_default()).string,
321
- tooltip: (external_prop_types_default()).node
322
- };
323
- var defaultProps = {
324
- active: false
325
- };
326
-
327
- var Tab = /*#__PURE__*/function (_Component) {
328
- _inherits(Tab, _Component);
329
-
330
- var _super = _createSuper(Tab);
331
-
332
- // @docs-props-type TabPropsBase
333
- function Tab(props) {
334
- var _this;
335
-
336
- _classCallCheck(this, Tab);
337
-
338
- _this = _super.call(this, props);
339
-
340
- _defineProperty(_assertThisInitialized(_this), "popoverId", void 0);
341
-
342
- _defineProperty(_assertThisInitialized(_this), "ariaId", void 0);
343
-
344
- _defineProperty(_assertThisInitialized(_this), "handleMount", function (el) {
345
- _this.setState({
346
- anchor: el
347
- });
348
-
349
- updateReactRef(_this.props.elementRef, el);
350
- });
351
-
352
- _defineProperty(_assertThisInitialized(_this), "handleTooltipOpen", function () {
353
- _this.setState({
354
- open: true
355
- });
356
- });
357
-
358
- _defineProperty(_assertThisInitialized(_this), "handleTooltipClose", function () {
359
- _this.setState({
360
- open: false
361
- });
362
- });
363
-
364
- _defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
365
- var _this$props = _this.props,
366
- active = _this$props.active,
367
- tabId = _this$props.tabId,
368
- tabKey = _this$props.tabKey,
369
- to = _this$props.to;
370
- var onClick = _this.context.onClick; // preserve the previous behaviour from 2ad8e7eaf47 to avoid firing unnecessary onChange events
371
- // while preventing the "to" prop from incorrectly triggering <Clickable>'s providedOnClick on the active tab
372
-
373
- if (!active) {
374
- onClick === null || onClick === void 0 ? void 0 : onClick(e, {
375
- tabId: tabId,
376
- tabKey: tabKey
269
+ // CONCATENATED MODULE: ./src/TabBar/Tab.tsx
270
+ function T(e) {
271
+ "@babel/helpers - typeof";
272
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
273
+ T = function e(t) {
274
+ return typeof t;
275
+ };
276
+ } else {
277
+ T = function e(t) {
278
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
279
+ };
280
+ }
281
+ return T(e);
282
+ }
283
+ function z() {
284
+ z = Object.assign || function(e) {
285
+ for (var t = 1; t < arguments.length; t++) {
286
+ var r = arguments[t];
287
+ for (var n in r) {
288
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
289
+ e[n] = r[n];
290
+ }
291
+ }
292
+ }
293
+ return e;
294
+ };
295
+ return z.apply(this, arguments);
296
+ }
297
+ function _(e, t) {
298
+ if (e == null) return {};
299
+ var r = E(e, t);
300
+ var n, i;
301
+ if (Object.getOwnPropertySymbols) {
302
+ var o = Object.getOwnPropertySymbols(e);
303
+ for (i = 0; i < o.length; i++) {
304
+ n = o[i];
305
+ if (t.indexOf(n) >= 0) continue;
306
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
307
+ r[n] = e[n];
308
+ }
309
+ }
310
+ return r;
311
+ }
312
+ function E(e, t) {
313
+ if (e == null) return {};
314
+ var r = {};
315
+ var n = Object.keys(e);
316
+ var i, o;
317
+ for (o = 0; o < n.length; o++) {
318
+ i = n[o];
319
+ if (t.indexOf(i) >= 0) continue;
320
+ r[i] = e[i];
321
+ }
322
+ return r;
323
+ }
324
+ function P(e, t) {
325
+ if (!(e instanceof t)) {
326
+ throw new TypeError("Cannot call a class as a function");
327
+ }
328
+ }
329
+ function $(e, t) {
330
+ for (var r = 0; r < t.length; r++) {
331
+ var n = t[r];
332
+ n.enumerable = n.enumerable || false;
333
+ n.configurable = true;
334
+ if ("value" in n) n.writable = true;
335
+ Object.defineProperty(e, n.key, n);
336
+ }
337
+ }
338
+ function R(e, t, r) {
339
+ if (t) $(e.prototype, t);
340
+ if (r) $(e, r);
341
+ return e;
342
+ }
343
+ function D(e, t) {
344
+ if (typeof t !== "function" && t !== null) {
345
+ throw new TypeError("Super expression must either be null or a function");
346
+ }
347
+ e.prototype = Object.create(t && t.prototype, {
348
+ constructor: {
349
+ value: e,
350
+ writable: true,
351
+ configurable: true
352
+ }
377
353
  });
378
- }
379
-
380
- if (to == null || to != null && active) {
381
- e.preventDefault();
382
- }
383
- });
384
-
385
- _defineProperty(_assertThisInitialized(_this), "handleFocus", function (e) {
386
- _this.handleTooltipOpen();
387
-
388
- var _this$props2 = _this.props,
389
- tabId = _this$props2.tabId,
390
- tabKey = _this$props2.tabKey;
391
- var onFocus = _this.context.onFocus;
392
- onFocus === null || onFocus === void 0 ? void 0 : onFocus(e, {
393
- tabId: tabId,
394
- tabKey: tabKey
395
- });
396
- });
397
-
398
- _this.popoverId = (0,id_namespaceObject.createDOMID)('popover');
399
- _this.ariaId = (0,id_namespaceObject.createDOMID)('aria-id');
400
- _this.state = {
401
- open: false,
402
- anchor: null
403
- };
404
- return _this;
405
- }
406
-
407
- _createClass(Tab, [{
408
- key: "focus",
409
- value: function focus() {
410
- var _this$state$anchor;
411
-
412
- (_this$state$anchor = this.state.anchor) === null || _this$state$anchor === void 0 ? void 0 : _this$state$anchor.focus();
354
+ if (t) M(e, t);
413
355
  }
414
- }, {
415
- key: "render",
416
- value: function render() {
417
- var _this$props3 = this.props,
418
- active = _this$props3.active,
419
- ariaControls = _this$props3.ariaControls,
420
- count = _this$props3.count,
421
- disabled = _this$props3.disabled,
422
- icon = _this$props3.icon,
423
- label = _this$props3.label,
424
- tabId = _this$props3.tabId,
425
- maxCount = _this$props3.maxCount,
426
- to = _this$props3.to,
427
- tooltip = _this$props3.tooltip,
428
- otherProps = _objectWithoutProperties(_this$props3, ["active", "ariaControls", "count", "disabled", "icon", "label", "tabId", "maxCount", "to", "tooltip"]);
429
-
430
- var _this$state = this.state,
431
- anchor = _this$state.anchor,
432
- open = _this$state.open;
433
- var _this$context = this.context,
434
- appearance = _this$context.appearance,
435
- disabledContext = _this$context.disabled,
436
- iconSize = _this$context.iconSize,
437
- layout = _this$context.layout,
438
- widthContext = _this$context.width;
439
- var style = otherProps.style;
440
- var disabledValue = disabledContext || disabled || false;
441
- var iconSizeValue = iconSize || 'inline';
442
- var layoutValue = layout || 'horizontal';
443
- var styleValue = widthContext ? {
444
- width: widthContext
445
- } : style;
446
- return (
447
- /*#__PURE__*/
448
- // TODO: Fix the ts error: https://splunk.atlassian.net/browse/SUI-5569
449
- // eslint-disable-next-line
450
- // @ts-ignore-next-line
451
- external_react_default().createElement(StyledClickable, _extends({
452
- "aria-controls": ariaControls,
453
- "aria-selected": active,
454
- "aria-labelledby": this.ariaId,
455
- "data-test": "tab",
456
- "data-test-tab-id": tabId,
457
- "data-test-popover-id": tooltip ? this.popoverId : undefined,
458
- $layout: layoutValue,
459
- $icon: icon && iconSizeValue !== 'inline' ? true : undefined,
460
- disabled: disabledValue,
461
- elementRef: this.handleMount,
462
- style: styleValue
463
- }, otherProps, {
464
- onClick: this.handleClick,
465
- onFocus: this.handleFocus,
466
- onMouseEnter: this.handleTooltipOpen,
467
- onBlur: this.handleTooltipClose,
468
- onMouseLeave: this.handleTooltipClose,
469
- role: "tab",
470
- tabIndex: active ? undefined : -1,
471
- to: to
472
- }), /*#__PURE__*/external_react_default().createElement(StyledLabel, {
473
- "data-test": "label",
474
- $withUnderline: appearance === 'navigation'
475
- }, icon && /*#__PURE__*/external_react_default().createElement(StyledIcon, {
476
- $iconSize: iconSizeValue
477
- }, icon), label, (count === 0 || count) && /*#__PURE__*/external_react_default().createElement((external_react_default()).Fragment, null, /*#__PURE__*/external_react_default().createElement((ScreenReaderContent_default()), null, "\xA0"), /*#__PURE__*/external_react_default().createElement(StyledCount, {
478
- "data-test": "count",
479
- disabled: disabledValue
480
- }, maxCount ? maxCountValue(count, maxCount) : count))), /*#__PURE__*/external_react_default().createElement(StyledUnderline, {
481
- $layout: layoutValue,
482
- $withUnderline: appearance === 'navigation'
483
- }), !disabled && tooltip && /*#__PURE__*/external_react_default().createElement((Popover_default()), {
484
- role: "tooltip",
485
- anchor: anchor // override Popover's default animation to make it faster
486
- // this keeps the overall amount of time the Tooltip is on-screen the same
487
- // even with the increased default closeDelay to address SUI-5116
488
- ,
489
- animationConfig: {
490
- tension: 400
491
- },
492
- appearance: "inverted",
493
- closeReasons: ['offScreen', 'escapeKey'],
494
- defaultPlacement: layoutValue === 'vertical' ? 'right' : 'above',
495
- id: this.popoverId,
496
- open: !!anchor && open,
497
- align: "center"
498
- }, /*#__PURE__*/external_react_default().createElement(StyledTooltipContent, null, tooltip)), tooltip && /*#__PURE__*/external_react_default().createElement((ScreenReaderContent_default()), {
499
- "aria-hidden": "true",
500
- id: this.ariaId
501
- }, tooltip))
502
- );
356
+ function M(e, t) {
357
+ M = Object.setPrototypeOf || function e(t, r) {
358
+ t.__proto__ = r;
359
+ return t;
360
+ };
361
+ return M(e, t);
503
362
  }
504
- }]);
505
-
506
- return Tab;
507
- }(external_react_namespaceObject.Component);
508
-
509
- _defineProperty(Tab, "propTypes", propTypes);
510
-
511
- _defineProperty(Tab, "defaultProps", defaultProps);
512
-
513
- _defineProperty(Tab, "contextType", TabBar_TabBarContext);
514
-
515
- /* harmony default export */ const TabBar_Tab = (Tab);
516
- ;// CONCATENATED MODULE: ./src/utils/navigateList.ts
517
- // A utility for keyboard navigation of lists
518
- function getNextListItem(refs, currentIndex, nextIndex) {
519
- for (var i = 0; i < refs.length; i += 1) {
520
- var _refs$pointer$current;
521
-
522
- var pointer = (i + nextIndex) % refs.length;
523
-
524
- if (((_refs$pointer$current = refs[pointer].current) === null || _refs$pointer$current === void 0 ? void 0 : _refs$pointer$current.props.disabled) !== true) {
525
- return refs[pointer];
363
+ function q(e) {
364
+ var t = A();
365
+ return function r() {
366
+ var n = B(e), i;
367
+ if (t) {
368
+ var o = B(this).constructor;
369
+ i = Reflect.construct(n, arguments, o);
370
+ } else {
371
+ i = n.apply(this, arguments);
372
+ }
373
+ return K(this, i);
374
+ };
526
375
  }
527
- }
528
-
529
- return refs[currentIndex];
530
- }
531
-
532
- function getPrevListItem(refs, currentIndex, prevIndex) {
533
- for (var i = refs.length; i > 0; i -= 1) {
534
- var _refs$pointer$current2;
535
-
536
- var pointer = (i + prevIndex) % refs.length;
537
-
538
- if (((_refs$pointer$current2 = refs[pointer].current) === null || _refs$pointer$current2 === void 0 ? void 0 : _refs$pointer$current2.props.disabled) !== true) {
539
- return refs[pointer];
376
+ function K(e, t) {
377
+ if (t && (T(t) === "object" || typeof t === "function")) {
378
+ return t;
379
+ }
380
+ return V(e);
540
381
  }
541
- }
542
-
543
- return refs[currentIndex];
544
- }
545
-
546
-
547
- ;// CONCATENATED MODULE: ./src/TabBar/TabBar.tsx
548
- function TabBar_extends() { TabBar_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return TabBar_extends.apply(this, arguments); }
549
-
550
- function TabBar_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = TabBar_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
551
-
552
- function TabBar_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
553
-
554
-
555
-
556
-
557
-
558
-
559
-
560
-
561
- var minTabWidth = 50;
562
- /** @public */
563
-
564
- var TabBar_propTypes = {
565
- autoActivate: (external_prop_types_default()).bool,
566
- activeTabId: (external_prop_types_default()).string,
567
- appearance: external_prop_types_default().oneOf(['navigation', 'context']),
568
- children: (external_prop_types_default()).node,
569
-
570
- /** @private */
571
- disabled: (external_prop_types_default()).bool,
572
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
573
- iconSize: external_prop_types_default().oneOf(['inline', 'small', 'large']),
574
- layout: external_prop_types_default().oneOf(['horizontal', 'vertical']),
575
- onChange: (external_prop_types_default()).func,
576
- tabWidth: (external_prop_types_default()).number
577
- };
578
-
579
- function TabBar(_ref) {
580
- var activeTabId = _ref.activeTabId,
581
- autoActivate = _ref.autoActivate,
582
- _ref$appearance = _ref.appearance,
583
- appearance = _ref$appearance === void 0 ? 'navigation' : _ref$appearance,
584
- children = _ref.children,
585
- _ref$disabled = _ref.disabled,
586
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
587
- elementRef = _ref.elementRef,
588
- _ref$iconSize = _ref.iconSize,
589
- iconSize = _ref$iconSize === void 0 ? 'inline' : _ref$iconSize,
590
- _ref$layout = _ref.layout,
591
- layout = _ref$layout === void 0 ? 'horizontal' : _ref$layout,
592
- onChange = _ref.onChange,
593
- tabWidth = _ref.tabWidth,
594
- otherProps = TabBar_objectWithoutProperties(_ref, ["activeTabId", "autoActivate", "appearance", "children", "disabled", "elementRef", "iconSize", "layout", "onChange", "tabWidth"]);
595
-
596
- // @docs-props-type TabBarPropsBase
597
- var focusedTabIndex = (0,external_react_namespaceObject.useRef)(0);
598
- var tabRefs = [];
599
- var nextTabKey = (0,external_react_namespaceObject.useMemo)(function () {
600
- return layout === 'vertical' ? 'down' : 'right';
601
- }, [layout]);
602
- var previousTabKey = (0,external_react_namespaceObject.useMemo)(function () {
603
- return layout === 'vertical' ? 'up' : 'left';
604
- }, [layout]);
605
-
606
- var tabOnFocus = function tabOnFocus(e, data) {
607
- var tabKey = data.tabKey;
608
-
609
- if (tabKey != null) {
610
- focusedTabIndex.current = tabKey;
382
+ function V(e) {
383
+ if (e === void 0) {
384
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
385
+ }
386
+ return e;
611
387
  }
612
-
613
- if (autoActivate) {
614
- onChange === null || onChange === void 0 ? void 0 : onChange(e, {
615
- selectedTabId: data.tabId
616
- });
388
+ function A() {
389
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
390
+ if (Reflect.construct.sham) return false;
391
+ if (typeof Proxy === "function") return true;
392
+ try {
393
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
394
+ return true;
395
+ } catch (e) {
396
+ return false;
397
+ }
617
398
  }
618
- };
619
-
620
- var tabOnClick = function tabOnClick(e, data) {
621
- onChange === null || onChange === void 0 ? void 0 : onChange(e, {
622
- selectedTabId: data.tabId
623
- });
624
- };
625
-
626
- var tabKeyCounter = 0;
627
- var clonedChildren = external_react_namespaceObject.Children.toArray(children).filter(external_react_namespaceObject.isValidElement).map(function (child) {
628
- // <TabBar> allows non-<Tab> children, pass them through without any modification
629
- if (typeof child.type === 'string' || child.type.name !== TabBar_Tab.name) {
630
- return child;
399
+ function B(e) {
400
+ B = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
401
+ return t.__proto__ || Object.getPrototypeOf(t);
402
+ };
403
+ return B(e);
631
404
  }
632
-
633
- var ref = /*#__PURE__*/external_react_default().createRef();
634
- tabRefs.push(ref);
635
- var childProps = {
636
- active: activeTabId === child.props.tabId,
637
- tabKey: tabKeyCounter,
638
- ref: ref
405
+ function N(e, t, r) {
406
+ if (t in e) {
407
+ Object.defineProperty(e, t, {
408
+ value: r,
409
+ enumerable: true,
410
+ configurable: true,
411
+ writable: true
412
+ });
413
+ } else {
414
+ e[t] = r;
415
+ }
416
+ return e;
417
+ }
418
+ var W = {
419
+ /** @private. Is the tab active. */
420
+ active: o().bool,
421
+ ariaControls: o().string,
422
+ count: o().number,
423
+ disabled: o().bool,
424
+ elementRef: o().oneOfType([ o().func, o().object ]),
425
+ icon: o().node,
426
+ id: o().string,
427
+ label: o().oneOfType([ o().string, o().element ]),
428
+ /** @private Maximum count number in tab label */
429
+ maxCount: o().number,
430
+ tabId: o().string,
431
+ /** @private. The internal key of the tab */
432
+ tabKey: o().number,
433
+ to: o().string,
434
+ tooltip: o().node
435
+ };
436
+ var F = {
437
+ active: false
639
438
  };
640
- tabKeyCounter += 1;
641
- return /*#__PURE__*/(0,external_react_namespaceObject.cloneElement)(child, childProps);
642
- });
643
- var widthContext = tabWidth && tabWidth > minTabWidth ? tabWidth : null;
644
-
645
- var handleOnKeyDown = function handleOnKeyDown(e) {
646
- var key = (0,keyboard_namespaceObject.keycode)(e.nativeEvent);
647
- var tabToFocusRef;
648
-
649
- if (key === nextTabKey) {
650
- tabToFocusRef = getNextListItem(tabRefs, focusedTabIndex.current, focusedTabIndex.current + 1);
651
- } else if (key === previousTabKey) {
652
- tabToFocusRef = getPrevListItem(tabRefs, focusedTabIndex.current, focusedTabIndex.current - 1);
653
- } else if (key === 'home') {
654
- tabToFocusRef = getNextListItem(tabRefs, focusedTabIndex.current, 0);
655
- } else if (key === 'end') {
656
- tabToFocusRef = getPrevListItem(tabRefs, focusedTabIndex.current, tabRefs.length - 1);
439
+ var U = function(e) {
440
+ D(r, e);
441
+ var t = q(r);
442
+ // @docs-props-type TabPropsBase
443
+ function r(e) {
444
+ var n;
445
+ P(this, r);
446
+ 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) {
450
+ n.setState({
451
+ anchor: e
452
+ });
453
+ j(n.props.elementRef, e);
454
+ }));
455
+ N(V(n), "handleTooltipOpen", (function() {
456
+ n.setState({
457
+ open: true
458
+ });
459
+ }));
460
+ N(V(n), "handleTooltipClose", (function() {
461
+ n.setState({
462
+ open: false
463
+ });
464
+ }));
465
+ N(V(n), "handleClick", (function(e) {
466
+ var t = n.props, r = t.active, i = t.tabId, o = t.tabKey, a = t.to;
467
+ var l = n.context.onClick;
468
+ // preserve the previous behaviour from 2ad8e7eaf47 to avoid firing unnecessary onChange events
469
+ // while preventing the "to" prop from incorrectly triggering <Clickable>'s providedOnClick on the active tab
470
+ if (!r) {
471
+ l === null || l === void 0 ? void 0 : l(e, {
472
+ tabId: i,
473
+ tabKey: o
474
+ });
475
+ }
476
+ if (a == null || a != null && r) {
477
+ e.preventDefault();
478
+ }
479
+ }));
480
+ N(V(n), "handleFocus", (function(e) {
481
+ n.handleTooltipOpen();
482
+ 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, {
485
+ tabId: r,
486
+ tabKey: i
487
+ });
488
+ }));
489
+ n.popoverId = (0, v.createDOMID)("popover");
490
+ n.ariaId = (0, v.createDOMID)("aria-id");
491
+ n.state = {
492
+ open: false,
493
+ anchor: null
494
+ };
495
+ return n;
496
+ }
497
+ R(r, [ {
498
+ key: "focus",
499
+ value: function e() {
500
+ var t;
501
+ (t = this.state.anchor) === null || t === void 0 ? void 0 : t.focus();
502
+ }
503
+ }, {
504
+ key: "render",
505
+ 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.to, f = t.tooltip, v = _(t, [ "active", "ariaControls", "count", "disabled", "icon", "label", "tabId", "maxCount", "to", "tooltip" ]);
507
+ var h = this.state, y = h.anchor, S = h.open;
508
+ var C = this.context, j = C.appearance, T = C.disabled, E = C.iconSize, P = C.layout, $ = C.width;
509
+ var R = v.style;
510
+ var D = T || a || false;
511
+ var M = E || "inline";
512
+ var q = P || "horizontal";
513
+ var K = $ ? {
514
+ width: $
515
+ } : R;
516
+
517
+ // TODO: Fix the ts error: https://splunk.atlassian.net/browse/SUI-5569
518
+ // eslint-disable-next-line
519
+ // @ts-ignore-next-line
520
+ return n().createElement(m, z({
521
+ "aria-controls": i,
522
+ "aria-selected": r,
523
+ "aria-labelledby": this.ariaId,
524
+ "data-test": "tab",
525
+ "data-test-tab-id": s,
526
+ "data-test-popover-id": f ? this.popoverId : undefined,
527
+ $layout: q,
528
+ $icon: l && M !== "inline" ? true : undefined,
529
+ disabled: D,
530
+ elementRef: this.handleMount,
531
+ style: K
532
+ }, v, {
533
+ onClick: this.handleClick,
534
+ onFocus: this.handleFocus,
535
+ onMouseEnter: this.handleTooltipOpen,
536
+ onBlur: this.handleTooltipClose,
537
+ onMouseLeave: this.handleTooltipClose,
538
+ role: "tab",
539
+ tabIndex: r ? undefined : -1,
540
+ to: u
541
+ }), n().createElement(k, {
542
+ "data-test": "label",
543
+ $withUnderline: j === "navigation"
544
+ }, l && n().createElement(x, {
545
+ $iconSize: M
546
+ }, l), c, (o === 0 || o) && n().createElement(n().Fragment, null, n().createElement(b(), null, " "), n().createElement(w, {
547
+ "data-test": "count",
548
+ disabled: D
549
+ }, p ? I(o, p) : o))), n().createElement(g, {
550
+ $layout: q,
551
+ $withUnderline: j === "navigation"
552
+ }), !a && f && n().createElement(d(), {
553
+ role: "tooltip",
554
+ anchor: y,
555
+ animationConfig: {
556
+ tension: 400
557
+ },
558
+ appearance: "inverted",
559
+ closeReasons: [ "offScreen", "escapeKey" ],
560
+ defaultPlacement: q === "vertical" ? "right" : "above",
561
+ id: this.popoverId,
562
+ open: !!y && S,
563
+ align: "center"
564
+ }, n().createElement(O, null, f)), f && n().createElement(b(), {
565
+ "aria-hidden": "true",
566
+ id: this.ariaId
567
+ }, f));
568
+ }
569
+ } ]);
570
+ return r;
571
+ }(r.Component);
572
+ N(U, "propTypes", W);
573
+ N(U, "defaultProps", F);
574
+ N(U, "contextType", C);
575
+ /* harmony default export */ const L = U;
576
+ // CONCATENATED MODULE: ./src/utils/navigateList.ts
577
+ // A utility for keyboard navigation of lists
578
+ function Y(e, t, r) {
579
+ for (var n = 0; n < e.length; n += 1) {
580
+ var i;
581
+ var o = (n + r) % e.length;
582
+ if (((i = e[o].current) === null || i === void 0 ? void 0 : i.props.disabled) !== true) {
583
+ return e[o];
584
+ }
585
+ }
586
+ return e[t];
587
+ }
588
+ function G(e, t, r) {
589
+ for (var n = e.length; n > 0; n -= 1) {
590
+ var i;
591
+ var o = (n + r) % e.length;
592
+ if (((i = e[o].current) === null || i === void 0 ? void 0 : i.props.disabled) !== true) {
593
+ return e[o];
594
+ }
595
+ }
596
+ return e[t];
657
597
  }
658
-
659
- if (tabToFocusRef != null) {
660
- var _tabToFocusRef$curren;
661
-
662
- (_tabToFocusRef$curren = tabToFocusRef.current) === null || _tabToFocusRef$curren === void 0 ? void 0 : _tabToFocusRef$curren.focus();
663
- e.preventDefault();
598
+ // CONCATENATED MODULE: ./src/TabBar/TabBar.tsx
599
+ function H() {
600
+ H = Object.assign || function(e) {
601
+ for (var t = 1; t < arguments.length; t++) {
602
+ var r = arguments[t];
603
+ for (var n in r) {
604
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
605
+ e[n] = r[n];
606
+ }
607
+ }
608
+ }
609
+ return e;
610
+ };
611
+ return H.apply(this, arguments);
664
612
  }
665
- };
666
-
667
- return /*#__PURE__*/external_react_default().createElement(Styled, TabBar_extends({
668
- "data-tab-layout": layout,
669
- "data-test-active-tab-id": activeTabId,
670
- "data-test": "tab-bar",
671
- role: "tablist",
672
- ref: elementRef,
673
- $layout: layout,
674
- $withUnderline: appearance === 'navigation',
675
- onKeyDown: handleOnKeyDown
676
- }, otherProps), /*#__PURE__*/external_react_default().createElement(TabBar_TabBarContext.Provider, {
677
- value: {
678
- appearance: appearance,
679
- disabled: disabled,
680
- iconSize: iconSize,
681
- layout: layout,
682
- onClick: tabOnClick,
683
- onFocus: tabOnFocus,
684
- width: widthContext
613
+ function J(e, t) {
614
+ if (e == null) return {};
615
+ var r = Q(e, t);
616
+ var n, i;
617
+ if (Object.getOwnPropertySymbols) {
618
+ var o = Object.getOwnPropertySymbols(e);
619
+ for (i = 0; i < o.length; i++) {
620
+ n = o[i];
621
+ if (t.indexOf(n) >= 0) continue;
622
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
623
+ r[n] = e[n];
624
+ }
625
+ }
626
+ return r;
627
+ }
628
+ function Q(e, t) {
629
+ if (e == null) return {};
630
+ var r = {};
631
+ var n = Object.keys(e);
632
+ var i, o;
633
+ for (o = 0; o < n.length; o++) {
634
+ i = n[o];
635
+ if (t.indexOf(i) >= 0) continue;
636
+ r[i] = e[i];
637
+ }
638
+ return r;
639
+ }
640
+ var X = 50;
641
+ /** @public */ var Z = {
642
+ autoActivate: o().bool,
643
+ activeTabId: o().string,
644
+ appearance: o().oneOf([ "navigation", "context" ]),
645
+ children: o().node,
646
+ /** @private */
647
+ disabled: o().bool,
648
+ elementRef: o().oneOfType([ o().func, o().object ]),
649
+ iconSize: o().oneOf([ "inline", "small", "large" ]),
650
+ layout: o().oneOf([ "horizontal", "vertical" ]),
651
+ onChange: o().func,
652
+ tabWidth: o().number
653
+ };
654
+ function ee(e) {
655
+ 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, b = f === void 0 ? "inline" : f, v = e.layout, h = v === void 0 ? "horizontal" : v, y = e.onChange, m = e.tabWidth, g = J(e, [ "activeTabId", "autoActivate", "appearance", "children", "disabled", "elementRef", "iconSize", "layout", "onChange", "tabWidth" ]);
656
+ // @docs-props-type TabBarPropsBase
657
+ var x = (0, r.useRef)(0);
658
+ var k = [];
659
+ var w = (0, r.useMemo)((function() {
660
+ return h === "vertical" ? "down" : "right";
661
+ }), [ h ]);
662
+ var O = (0, r.useMemo)((function() {
663
+ return h === "vertical" ? "up" : "left";
664
+ }), [ h ]);
665
+ var S = function e(t, r) {
666
+ var n = r.tabKey;
667
+ if (n != null) {
668
+ x.current = n;
669
+ }
670
+ if (i) {
671
+ y === null || y === void 0 ? void 0 : y(t, {
672
+ selectedTabId: r.tabId
673
+ });
674
+ }
675
+ };
676
+ var I = function e(t, r) {
677
+ y === null || y === void 0 ? void 0 : y(t, {
678
+ selectedTabId: r.tabId
679
+ });
680
+ };
681
+ var j = 0;
682
+ var T = r.Children.toArray(c).filter(r.isValidElement).map((function(e) {
683
+ // <TabBar> allows non-<Tab> children, pass them through without any modification
684
+ if (typeof e.type === "string" || e.type.name !== L.name) {
685
+ return e;
686
+ }
687
+ var i = n().createRef();
688
+ k.push(i);
689
+ var o = {
690
+ active: t === e.props.tabId,
691
+ tabKey: j,
692
+ ref: i
693
+ };
694
+ j += 1;
695
+
696
+ return (0, r.cloneElement)(e, o);
697
+ }));
698
+ var z = m && m > X ? m : null;
699
+ var _ = function e(t) {
700
+ var r = (0, a.keycode)(t.nativeEvent);
701
+ var n;
702
+ if (r === w) {
703
+ n = Y(k, x.current, x.current + 1);
704
+ } else if (r === O) {
705
+ n = G(k, x.current, x.current - 1);
706
+ } else if (r === "home") {
707
+ n = Y(k, x.current, 0);
708
+ } else if (r === "end") {
709
+ n = G(k, x.current, k.length - 1);
710
+ }
711
+ if (n != null) {
712
+ var i;
713
+ (i = n.current) === null || i === void 0 ? void 0 : i.focus();
714
+ t.preventDefault();
715
+ }
716
+ };
717
+
718
+ return n().createElement(p, H({
719
+ "data-tab-layout": h,
720
+ "data-test-active-tab-id": t,
721
+ "data-test": "tab-bar",
722
+ role: "tablist",
723
+ ref: d,
724
+ $layout: h,
725
+ $withUnderline: l === "navigation",
726
+ onKeyDown: _
727
+ }, g), n().createElement(C.Provider, {
728
+ value: {
729
+ appearance: l,
730
+ disabled: u,
731
+ iconSize: b,
732
+ layout: h,
733
+ onClick: I,
734
+ onFocus: S,
735
+ width: z
736
+ }
737
+ }, T));
685
738
  }
686
- }, clonedChildren));
687
- }
688
-
689
- TabBar.propTypes = TabBar_propTypes;
690
- TabBar.Tab = TabBar_Tab;
691
- /* harmony default export */ const TabBar_TabBar = (TabBar);
692
-
693
- ;// CONCATENATED MODULE: ./src/TabBar/index.ts
694
-
695
-
696
- module.exports = __webpack_exports__;
697
- /******/ })()
698
- ;
739
+ ee.propTypes = Z;
740
+ ee.Tab = L;
741
+ /* harmony default export */ const te = ee;
742
+ // CONCATENATED MODULE: ./src/TabBar/index.ts
743
+ module.exports = t;
744
+ /******/})();