@splunk/react-ui 4.40.0 → 4.42.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.
- package/ButtonGroup.js +1 -3
- package/CHANGELOG.md +43 -0
- package/Calendar.js +548 -744
- package/Date.js +158 -161
- package/Dropdown.js +33 -32
- package/FormRows.js +93 -97
- package/Layer.js +115 -97
- package/MIGRATION.mdx +24 -3
- package/Menu.js +10 -9
- package/MessageBar.js +5 -5
- package/Multiselect.js +1498 -1599
- package/Number.js +51 -48
- package/Popover.js +481 -479
- package/RadioBar.js +19 -15
- package/Resize.js +61 -61
- package/ResultsMenu.js +1208 -1028
- package/Scroll.js +482 -475
- package/Select.js +949 -1030
- package/Slider.js +346 -300
- package/SlidingPanels.js +166 -148
- package/TabBar.js +187 -172
- package/TabLayout.js +8 -8
- package/Table.js +1518 -1432
- package/Text.js +29 -17
- package/TextArea.js +37 -37
- package/Tooltip.js +300 -207
- package/TransitionOpen.js +44 -65
- package/package.json +4 -4
- package/types/src/ButtonGroup/ButtonGroup.d.ts +0 -4
- package/types/src/ButtonSimple/ButtonSimple.d.ts +1 -1
- package/types/src/Calendar/Calendar.d.ts +28 -30
- package/types/src/Calendar/MonthHeader.d.ts +12 -22
- package/types/src/Color/Color.d.ts +2 -2
- package/types/src/Date/Date.d.ts +18 -19
- package/types/src/Dropdown/Dropdown.d.ts +2 -1
- package/types/src/File/File.d.ts +1 -1
- package/types/src/FormRows/FormRows.d.ts +5 -60
- package/types/src/FormRows/Row.d.ts +1 -1
- package/types/src/Layer/Layer.d.ts +2 -1
- package/types/src/Link/Link.d.ts +5 -0
- package/types/src/Link/index.d.ts +1 -0
- package/types/src/Menu/Item.d.ts +1 -1
- package/types/src/Menu/Menu.d.ts +1 -1
- package/types/src/Multiselect/Option.d.ts +1 -1
- package/types/src/Number/Number.d.ts +10 -2
- package/types/src/Popover/Popover.d.ts +1 -4
- package/types/src/RadioBar/RadioBar.d.ts +2 -2
- package/types/src/Resize/Resize.d.ts +0 -11
- package/types/src/ResultsMenu/VirtualizedResultsMenu/VirtualizedResultsMenu.d.ts +1 -1
- package/types/src/ResultsMenu/VirtualizedResultsMenu/injectVirtualizedItem.d.ts +2 -0
- package/types/src/Scroll/Inner.d.ts +17 -19
- package/types/src/Search/Option.d.ts +1 -1
- package/types/src/Select/Option.d.ts +5 -1
- package/types/src/Select/OptionBase.d.ts +41 -23
- package/types/src/Select/SelectAllOption.d.ts +6 -2
- package/types/src/Select/SelectBase.d.ts +8 -34
- package/types/src/Slider/Slider.d.ts +7 -16
- package/types/src/SlidingPanels/SlidingPanels.d.ts +4 -3
- package/types/src/TabBar/TabBar.d.ts +10 -2
- package/types/src/TabBar/TabBarContext.d.ts +1 -0
- package/types/src/TabBar/docs/examples/IconsAbove.d.ts +2 -0
- package/types/src/TabBar/docs/examples/IconsLeft.d.ts +2 -0
- package/types/src/TabBar/docs/examples/VerticalIconsAbove.d.ts +2 -0
- package/types/src/TabBar/docs/examples/VerticalIconsLeft.d.ts +2 -0
- package/types/src/TabLayout/TabLayout.d.ts +4 -2
- package/types/src/Table/ExpandButton.d.ts +8 -0
- package/types/src/Table/HeadDropdownCell.d.ts +2 -0
- package/types/src/Table/HeadInner.d.ts +5 -1
- package/types/src/Table/Row.d.ts +8 -4
- package/types/src/Table/Table.d.ts +0 -2
- package/types/src/Table/docs/examples/Complex.d.ts +14 -3
- package/types/src/Text/Text.d.ts +2 -2
- package/types/src/TextArea/TextArea.d.ts +2 -2
- package/types/src/Tooltip/Tooltip.d.ts +38 -5
- package/types/src/Tooltip/docs/examples/CustomProps.d.ts +2 -0
- package/types/src/Tooltip/docs/examples/Toggletip.d.ts +2 -0
- package/types/src/Typography/Typography.d.ts +4 -2
- package/types/src/useControlled/useControlled.d.ts +5 -4
- package/useControlled.js +37 -15
- package/usePrevious.js +62 -30
- package/useRovingFocus.js +5 -4
- package/types/src/TabBar/docs/examples/IconsInline.d.ts +0 -2
- package/types/src/TabBar/docs/examples/IconsSmall.d.ts +0 -2
- package/types/src/TabBar/docs/examples/VerticalSmallIcons.d.ts +0 -2
- package/types/src/Table/docs/examples/prisma/Complex.d.ts +0 -48
- package/types/src/Table/icons/ExpansionRow.d.ts +0 -6
- package/types/src/Tooltip/docs/examples/CustomContent.d.ts +0 -2
- /package/types/src/Table/docs/examples/{prisma/RowActions.d.ts → RowActions.d.ts} +0 -0
package/TabBar.js
CHANGED
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
e.r(t);
|
|
62
62
|
// EXPORTS
|
|
63
63
|
e.d(t, {
|
|
64
|
-
Tab: () => /* reexport */
|
|
64
|
+
Tab: () => /* reexport */ ce,
|
|
65
65
|
default: () => /* reexport */ Ce
|
|
66
66
|
});
|
|
67
67
|
// CONCATENATED MODULE: external "react"
|
|
@@ -74,20 +74,20 @@
|
|
|
74
74
|
const a = require("@splunk/ui-utils/keyboard");
|
|
75
75
|
// CONCATENATED MODULE: external "styled-components"
|
|
76
76
|
const l = require("styled-components");
|
|
77
|
-
var
|
|
77
|
+
var s = e.n(l);
|
|
78
78
|
// CONCATENATED MODULE: external "@splunk/themes"
|
|
79
|
-
const
|
|
79
|
+
const c = require("@splunk/themes");
|
|
80
80
|
// CONCATENATED MODULE: ./src/TabBar/TabBarStyles.ts
|
|
81
|
-
var u =
|
|
81
|
+
var u = s().div.withConfig({
|
|
82
82
|
displayName: "TabBarStyles__Styled",
|
|
83
83
|
componentId: "sc-1t85fen-0"
|
|
84
|
-
})([ "", " position:relative;&::before{content:'';display:block;position:absolute;left:0;top:0;right:0;bottom:0;border:0 solid ", ";}", ";" ],
|
|
85
|
-
|
|
86
|
-
enterprise:
|
|
87
|
-
prisma:
|
|
88
|
-
}), (0,
|
|
84
|
+
})([ "", " position:relative;&::before{content:'';display:block;position:absolute;left:0;top:0;right:0;bottom:0;border:0 solid ", ";}", ";" ], c.mixins.reset("flex"), (0,
|
|
85
|
+
c.pick)({
|
|
86
|
+
enterprise: c.variables.borderLightColor,
|
|
87
|
+
prisma: c.variables.neutral200
|
|
88
|
+
}), (0, c.pickVariant)("$layout", {
|
|
89
89
|
horizontal: {
|
|
90
|
-
prisma: (0,
|
|
90
|
+
prisma: (0, c.pickVariant)("$withUnderline", {
|
|
91
91
|
/* context appearance is only supported for Prisma */
|
|
92
92
|
true: (0, l.css)([ "&::before{border-bottom-width:1px;}" ])
|
|
93
93
|
}),
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
const O = require("@splunk/react-ui/Clickable");
|
|
122
122
|
var T = e.n(O);
|
|
123
123
|
// CONCATENATED MODULE: ./src/TabBar/TabStyles.ts
|
|
124
|
-
var I = (0,
|
|
125
|
-
prisma: (0, l.css)([ "color:", ";" ],
|
|
124
|
+
var I = (0, c.pick)({
|
|
125
|
+
prisma: (0, l.css)([ "color:", ";" ], c.variables.contentColorActive)
|
|
126
126
|
});
|
|
127
|
-
var j = (0,
|
|
127
|
+
var j = (0, c.pickVariant)("$layout", {
|
|
128
128
|
horizontal: {
|
|
129
129
|
enterprise: (0, l.css)([ "height:3px;" ])
|
|
130
130
|
},
|
|
@@ -132,25 +132,25 @@
|
|
|
132
132
|
enterprise: (0, l.css)([ "width:3px;" ])
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
|
-
var
|
|
135
|
+
var P = s()(T()).withConfig({
|
|
136
136
|
displayName: "TabStyles__StyledClickable",
|
|
137
137
|
componentId: "sc-1ry8mzj-0"
|
|
138
138
|
})([ "flex:0 1 auto;display:flow-root;position:relative;line-height:", ";text-align:center;white-space:nowrap;color:", ";&::after{display:block;content:attr(data-title);font-weight:", ";height:0;color:transparent;overflow:hidden;visibility:hidden;}", ";&[aria-selected='true']{cursor:default;", "}&[aria-selected='false']{box-shadow:none;font-weight:", ";&:hover:not([disabled]){", "}&[aria-haspopup='true']{", "}}&:focus{box-shadow:", ";", "}" ], (0,
|
|
139
|
-
|
|
139
|
+
c.pick)({
|
|
140
140
|
enterprise: "24px",
|
|
141
141
|
prisma: "20px"
|
|
142
|
-
}),
|
|
143
|
-
horizontal: (0, l.css)([ "padding:", ";margin-bottom:1px;" ], (0,
|
|
144
|
-
enterprise: (0,
|
|
142
|
+
}), c.variables.contentColorDefault, c.variables.fontWeightBold, (0, c.pickVariant)("$layout", {
|
|
143
|
+
horizontal: (0, l.css)([ "padding:", ";margin-bottom:1px;" ], (0, c.pick)({
|
|
144
|
+
enterprise: (0, c.pickVariant)("$hasMenu", {
|
|
145
145
|
true: "3px 4px 3px 16px",
|
|
146
146
|
false: "3px 20px"
|
|
147
147
|
}),
|
|
148
148
|
prisma: {
|
|
149
|
-
comfortable: (0,
|
|
149
|
+
comfortable: (0, c.pickVariant)("$hasMenu", {
|
|
150
150
|
true: "0px 8px 0px 16px",
|
|
151
151
|
false: "0px 20px"
|
|
152
152
|
}),
|
|
153
|
-
compact: (0,
|
|
153
|
+
compact: (0, c.pickVariant)("$hasMenu", {
|
|
154
154
|
true: "0px 8px 0px 12px",
|
|
155
155
|
false: "0 16px"
|
|
156
156
|
})
|
|
@@ -161,48 +161,48 @@
|
|
|
161
161
|
var t = e.$icon;
|
|
162
162
|
return t && (0, l.css)([ "text-align:center;" ]);
|
|
163
163
|
})),
|
|
164
|
-
prisma: (0, l.css)([ "width:100%;right:1px;padding:", ";" ], (0,
|
|
164
|
+
prisma: (0, l.css)([ "width:100%;right:1px;padding:", ";" ], (0, c.pick)({
|
|
165
165
|
comfortable: "0 20px",
|
|
166
166
|
compact: "0 16px"
|
|
167
167
|
}))
|
|
168
168
|
}
|
|
169
|
-
}), (0,
|
|
170
|
-
enterprise: (0, l.css)([ "font-weight:", ";" ],
|
|
171
|
-
prisma: (0, l.css)([ "color:", ";font-weight:", ";" ],
|
|
172
|
-
}), (0,
|
|
169
|
+
}), (0, c.pick)({
|
|
170
|
+
enterprise: (0, l.css)([ "font-weight:", ";" ], c.variables.fontWeightBold),
|
|
171
|
+
prisma: (0, l.css)([ "color:", ";font-weight:", ";" ], c.variables.contentColorActive, c.variables.fontWeightBold)
|
|
172
|
+
}), (0, c.pick)({
|
|
173
173
|
enterprise: "normal",
|
|
174
|
-
prisma:
|
|
175
|
-
}), I, I,
|
|
176
|
-
prisma: (0, l.css)([ "color:", ";" ],
|
|
174
|
+
prisma: c.variables.fontWeightSemiBold
|
|
175
|
+
}), I, I, c.variables.focusShadowInset, (0, c.pick)({
|
|
176
|
+
prisma: (0, l.css)([ "color:", ";" ], c.variables.contentColorActive)
|
|
177
177
|
}));
|
|
178
|
-
var
|
|
178
|
+
var z = s().div.withConfig({
|
|
179
179
|
displayName: "TabStyles__StyledUnderline",
|
|
180
180
|
componentId: "sc-1ry8mzj-1"
|
|
181
181
|
})([ "position:absolute;", " ", ";[aria-selected='true'] > &&{background-color:", ";", ";}", ":hover:not([disabled]) > &&{", ";}[aria-selected='false'][aria-haspopup='true'] > &&{", "}" ], (0,
|
|
182
|
-
|
|
183
|
-
enterprise: (0, l.css)([ "background:", ";" ],
|
|
184
|
-
}), (0,
|
|
182
|
+
c.pick)({
|
|
183
|
+
enterprise: (0, l.css)([ "background:", ";" ], c.variables.borderLightColor)
|
|
184
|
+
}), (0, c.pickVariant)("$layout", {
|
|
185
185
|
horizontal: (0, l.css)([ "height:0;box-sizing:border-box;width:", ";", " transition:height 0.2s;" ], (0,
|
|
186
|
-
|
|
186
|
+
c.pick)({
|
|
187
187
|
enterprise: "calc(100% - 20px * 2)",
|
|
188
188
|
prisma: {
|
|
189
189
|
comfortable: "calc(100% - 20px * 2)",
|
|
190
190
|
compact: "calc(100% - 16px * 2)"
|
|
191
191
|
}
|
|
192
|
-
}), (0,
|
|
192
|
+
}), (0, c.pick)({
|
|
193
193
|
enterprise: (0, l.css)([ "bottom:-1px;" ])
|
|
194
194
|
})),
|
|
195
195
|
vertical: {
|
|
196
196
|
enterprise: (0, l.css)([ "width:0;height:calc(100% - 10px * 2);top:10px;right:-1px;transition:width 0.2s;" ]),
|
|
197
197
|
prisma: (0, l.css)([ "width:1px;height:calc(100% - 10px * 2);top:10px;right:-1px;transition:width 0.2s;box-sizing:border-box;" ])
|
|
198
198
|
}
|
|
199
|
-
}), (0,
|
|
200
|
-
enterprise:
|
|
201
|
-
prisma:
|
|
202
|
-
}), (0,
|
|
199
|
+
}), (0, c.pick)({
|
|
200
|
+
enterprise: c.variables.accentColor,
|
|
201
|
+
prisma: c.variables.contentColorActive
|
|
202
|
+
}), (0, c.pickVariant)("$layout", {
|
|
203
203
|
horizontal: {
|
|
204
204
|
enterprise: (0, l.css)([ "height:3px;" ]),
|
|
205
|
-
prisma: (0,
|
|
205
|
+
prisma: (0, c.pickVariant)("$withUnderline", {
|
|
206
206
|
// context appearance is only supported for Prisma
|
|
207
207
|
true: (0, l.css)([ "height:1px;" ])
|
|
208
208
|
})
|
|
@@ -211,85 +211,88 @@
|
|
|
211
211
|
enterprise: (0, l.css)([ "width:3px;" ]),
|
|
212
212
|
prisma: (0, l.css)([ "width:1px;" ])
|
|
213
213
|
}
|
|
214
|
-
}), /* sc-sel */
|
|
215
|
-
var
|
|
214
|
+
}), /* sc-sel */ P, j, j);
|
|
215
|
+
var E = s().span.withConfig({
|
|
216
216
|
displayName: "TabStyles__StyledMenu",
|
|
217
217
|
componentId: "sc-1ry8mzj-2"
|
|
218
|
-
})([ "display:inline-block;> svg{transform:translateY(-1px);}border-radius:", ";cursor:pointer;", " &:hover{", "}", "[aria-haspopup='true'] &,", ":hover &,", ":focus &{visibility:visible;}" ],
|
|
219
|
-
|
|
218
|
+
})([ "display:inline-block;> svg{transform:translateY(-1px);}border-radius:", ";cursor:pointer;", " &:hover{", "}", "[aria-haspopup='true'] &,", ":hover &,", ":focus &{visibility:visible;}" ], c.variables.borderRadius, (0,
|
|
219
|
+
c.pickVariant)("$active", {
|
|
220
220
|
false: (0, l.css)([ "visibility:hidden;" ])
|
|
221
|
-
}), (0,
|
|
221
|
+
}), (0, c.pick)({
|
|
222
222
|
enterprise: (0, l.css)([ "color:", ";background-color:", ";border-color:", ";" ], (0,
|
|
223
|
-
|
|
224
|
-
light:
|
|
225
|
-
dark:
|
|
226
|
-
}),
|
|
227
|
-
light:
|
|
228
|
-
dark:
|
|
223
|
+
c.pick)({
|
|
224
|
+
light: c.variables.linkColor,
|
|
225
|
+
dark: c.variables.white
|
|
226
|
+
}), c.variables.backgroundColorHover, (0, c.pick)({
|
|
227
|
+
light: c.variables.gray60,
|
|
228
|
+
dark: c.variables.borderColor
|
|
229
229
|
})),
|
|
230
|
-
prisma: (0, l.css)([ "background-color:", ";border-color:", ";box-shadow:", ";" ],
|
|
231
|
-
}), /* sc-sel */
|
|
232
|
-
var
|
|
230
|
+
prisma: (0, l.css)([ "background-color:", ";border-color:", ";box-shadow:", ";" ], c.variables.interactiveColorOverlayHover, c.variables.interactiveColorBorderHover, c.variables.hoverShadow)
|
|
231
|
+
}), /* sc-sel */ P, /* sc-sel */ P, /* sc-sel */ P);
|
|
232
|
+
var M = s().span.withConfig({
|
|
233
233
|
displayName: "TabStyles__StyledIcon",
|
|
234
234
|
componentId: "sc-1ry8mzj-3"
|
|
235
|
-
})([ "", ";" ], (0,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}), (0, s.pick)({
|
|
235
|
+
})([ "", " ", ";" ], (0, c.pickVariant)("$iconPosition", {
|
|
236
|
+
above: (0, l.css)([ "display:block;text-align:center;" ]),
|
|
237
|
+
left: (0, l.css)([ "text-align:left;padding-right:", ";> svg{transform:translateY(-1px);}" ], (0,
|
|
238
|
+
c.pick)({
|
|
240
239
|
enterprise: "0.4em",
|
|
241
240
|
prisma: "8px"
|
|
241
|
+
}))
|
|
242
|
+
}), (0, c.pickVariant)("$iconSize", {
|
|
243
|
+
inline: (0, l.css)([ "", "" ], (0, c.pick)({
|
|
244
|
+
prisma: (0, l.css)([ "display:inline-block;width:16px;height:16px;" ])
|
|
242
245
|
})),
|
|
243
|
-
small: (0, l.css)([ "font-size:24px;height:24px;
|
|
244
|
-
large: (0, l.css)([ "font-size:48px;height:48px;
|
|
246
|
+
small: (0, l.css)([ "font-size:24px;height:24px;padding:4px 0;" ]),
|
|
247
|
+
large: (0, l.css)([ "font-size:48px;height:48px;padding:8px 0 0;" ])
|
|
245
248
|
}));
|
|
246
|
-
var
|
|
249
|
+
var _ = s().div.withConfig({
|
|
247
250
|
displayName: "TabStyles__StyledLabelAndMenuContainer",
|
|
248
251
|
componentId: "sc-1ry8mzj-4"
|
|
249
252
|
})([ "display:flex;align-items:center;justify-content:center;gap:8px;" ]);
|
|
250
|
-
var $ =
|
|
253
|
+
var $ = s().div.withConfig({
|
|
251
254
|
displayName: "TabStyles__StyledLabel",
|
|
252
255
|
componentId: "sc-1ry8mzj-5"
|
|
253
256
|
})([ "overflow:hidden;text-overflow:ellipsis;min-width:10px;margin:", ";" ], (0,
|
|
254
|
-
|
|
257
|
+
c.pick)({
|
|
255
258
|
enterprise: "0",
|
|
256
259
|
prisma: {
|
|
257
260
|
comfortable: "16px 0",
|
|
258
261
|
compact: "10px 0"
|
|
259
262
|
}
|
|
260
263
|
}));
|
|
261
|
-
var D =
|
|
264
|
+
var D = s().span.withConfig({
|
|
262
265
|
displayName: "TabStyles__StyledCount",
|
|
263
266
|
componentId: "sc-1ry8mzj-6"
|
|
264
|
-
})([ "display:inline-block;border-radius:18px;color:", ";font-size:", ";line-height:10px;padding:", ";margin-inline-start:", ";", " &[disabled]{color:", ";}" ],
|
|
265
|
-
|
|
267
|
+
})([ "display:inline-block;border-radius:18px;color:", ";font-size:", ";line-height:10px;padding:", ";margin-inline-start:", ";", " &[disabled]{color:", ";}" ], c.variables.contentColorDefault, (0,
|
|
268
|
+
c.pick)({
|
|
266
269
|
enterprise: "inherit",
|
|
267
270
|
prisma: "10px"
|
|
268
|
-
}), (0,
|
|
271
|
+
}), (0, c.pick)({
|
|
269
272
|
enterprise: "0.4em 0.3em",
|
|
270
273
|
prisma: "0.4em 0.6em"
|
|
271
|
-
}), (0,
|
|
274
|
+
}), (0, c.pick)({
|
|
272
275
|
enterprise: "0",
|
|
273
276
|
prisma: "0.3em"
|
|
274
|
-
}), (0,
|
|
277
|
+
}), (0, c.pick)({
|
|
275
278
|
enterprise: (0, l.css)([ "&::before{content:'(';}&::after{content:')';}" ]),
|
|
276
|
-
prisma: (0, l.css)([ "background:", ";" ],
|
|
277
|
-
}),
|
|
278
|
-
var R =
|
|
279
|
+
prisma: (0, l.css)([ "background:", ";" ], c.variables.neutral100)
|
|
280
|
+
}), c.variables.contentColorDisabled);
|
|
281
|
+
var R = s().div.withConfig({
|
|
279
282
|
displayName: "TabStyles__StyledTooltipContent",
|
|
280
283
|
componentId: "sc-1ry8mzj-7"
|
|
281
|
-
})([ "padding:8px;font-size:", ";" ],
|
|
284
|
+
})([ "padding:8px;font-size:", ";" ], c.variables.fontSizeSmall);
|
|
282
285
|
// CONCATENATED MODULE: ./src/TabBar/TabBarContext.tsx
|
|
283
286
|
var q = function e() {
|
|
284
287
|
return undefined;
|
|
285
288
|
};
|
|
286
|
-
var
|
|
289
|
+
var V = (0, r.createContext)({
|
|
287
290
|
onMenuOpen: q,
|
|
288
291
|
onMenuClose: q,
|
|
289
292
|
isMenuOpen: false
|
|
290
293
|
});
|
|
291
|
-
|
|
292
|
-
/* harmony default export */ const
|
|
294
|
+
V.displayName = "TabBar";
|
|
295
|
+
/* harmony default export */ const A = V;
|
|
293
296
|
// CONCATENATED MODULE: ./src/utils/getCountValue.ts
|
|
294
297
|
// A utility for max count
|
|
295
298
|
var K = function e(t, r) {
|
|
@@ -551,73 +554,71 @@
|
|
|
551
554
|
}, {
|
|
552
555
|
key: "render",
|
|
553
556
|
value: function e() {
|
|
554
|
-
var t = this.props, r = t.active, i = t.ariaControls, o = t.count, a = t.disabled, l = t.icon,
|
|
557
|
+
var t = this.props, r = t.active, i = t.ariaControls, o = t.count, a = t.disabled, l = t.icon, s = t.label, c = t.tabId, u = t.maxCount, p = t.splunkTheme, v = t.to, h = t.tooltip, m = t.menu, x = t.tabKey, w = U(t, [ "active", "ariaControls", "count", "disabled", "icon", "label", "tabId", "maxCount", "splunkTheme", "to", "tooltip", "menu", "tabKey" ]);
|
|
555
558
|
var C = this.state, O = C.anchor, T = C.open;
|
|
556
|
-
var I = this.context, j = I.appearance, q = I.disabled, A = I.iconSize,
|
|
557
|
-
var
|
|
558
|
-
var
|
|
559
|
-
var
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
var Z = p.isEnterprise;
|
|
565
|
-
var ee = "";
|
|
559
|
+
var I = this.context, j = I.appearance, q = I.disabled, V = I.iconPosition, A = V === void 0 ? "above" : V, B = I.iconSize, N = I.layout, W = N === void 0 ? "horizontal" : N, L = I.width, H = I.onMenuOpen, Y = I.onMenuClose, G = I.isMenuOpen, J = I.focusedTabKey;
|
|
560
|
+
var Q = w.style;
|
|
561
|
+
var X = q || a || false;
|
|
562
|
+
var Z = L ? {
|
|
563
|
+
width: L
|
|
564
|
+
} : Q;
|
|
565
|
+
var ee = p.isEnterprise;
|
|
566
|
+
var te = "";
|
|
566
567
|
// SUI-6877: if the label isn't a string, don't attempt to do this since it'll just be wrong
|
|
567
|
-
if (
|
|
568
|
-
var
|
|
569
|
-
var
|
|
568
|
+
if (s && typeof s === "string") {
|
|
569
|
+
var re = s ? s.toString() : "";
|
|
570
|
+
var ne = o === 0 || o ? "".concat(o === null || o === void 0 ? void 0 : o.toString()) : "";
|
|
570
571
|
// titleValue is used for CSS styling in TabStyles. labelValue and countValue needs to be included in the title.
|
|
571
|
-
if (
|
|
572
|
+
if (ee) {
|
|
572
573
|
// countValue needs unicode space for width to not change after it's clicked.
|
|
573
|
-
var
|
|
574
|
-
|
|
574
|
+
var ie = ne ? "(".concat(ne, ") ") : "";
|
|
575
|
+
te = "".concat(re, " ").concat(ie);
|
|
575
576
|
} else {
|
|
576
|
-
|
|
577
|
+
te = "".concat(re, " ").concat(ne);
|
|
577
578
|
}
|
|
578
579
|
}
|
|
579
|
-
var
|
|
580
|
-
var
|
|
580
|
+
var oe = J === x && G && !!m;
|
|
581
|
+
var ae = n().createElement(E, {
|
|
581
582
|
$active: r,
|
|
582
583
|
"data-test": "menu-toggle",
|
|
583
584
|
tabIndex: -1,
|
|
584
585
|
onFocus: this.handleFocusMenuToggle
|
|
585
|
-
},
|
|
586
|
+
}, ee ? n().createElement(g(), {
|
|
586
587
|
size: 1.1
|
|
587
588
|
}) : n().createElement(b(), null));
|
|
588
|
-
var
|
|
589
|
+
var le = function e(t) {
|
|
589
590
|
// if there is no menu, or if we are not in horizontal, do not render menu container
|
|
590
|
-
if (!m ||
|
|
591
|
+
if (!m || W !== "horizontal") {
|
|
591
592
|
return t;
|
|
592
593
|
}
|
|
593
594
|
|
|
594
|
-
return n().createElement(
|
|
595
|
-
toggle:
|
|
595
|
+
return n().createElement(_, null, t, n().createElement(y(), {
|
|
596
|
+
toggle: ae,
|
|
596
597
|
align: "center",
|
|
597
|
-
onRequestOpen:
|
|
598
|
-
onRequestClose:
|
|
599
|
-
open:
|
|
598
|
+
onRequestOpen: H,
|
|
599
|
+
onRequestClose: Y,
|
|
600
|
+
open: oe
|
|
600
601
|
}, m));
|
|
601
602
|
};
|
|
602
603
|
|
|
603
604
|
// TODO: Fix the ts error: https://splunk.atlassian.net/browse/SUI-5569
|
|
604
605
|
// eslint-disable-next-line
|
|
605
606
|
// @ts-ignore-next-line
|
|
606
|
-
return n().createElement(
|
|
607
|
+
return n().createElement(P, F({
|
|
607
608
|
"aria-controls": i,
|
|
608
609
|
"aria-selected": r,
|
|
609
610
|
"aria-labelledby": this.ariaId,
|
|
610
611
|
"aria-describedby": m ? this.menuDescription : undefined,
|
|
611
|
-
"aria-haspopup":
|
|
612
|
+
"aria-haspopup": oe,
|
|
612
613
|
"data-test": "tab",
|
|
613
|
-
"data-test-tab-id":
|
|
614
|
+
"data-test-tab-id": c,
|
|
614
615
|
"data-test-popover-id": h ? this.popoverId : undefined,
|
|
615
|
-
$layout:
|
|
616
|
-
$icon: l &&
|
|
617
|
-
disabled:
|
|
618
|
-
style:
|
|
616
|
+
$layout: W,
|
|
617
|
+
$icon: l && B !== "inline" ? true : undefined,
|
|
618
|
+
disabled: X,
|
|
619
|
+
style: Z,
|
|
619
620
|
elementRef: this.handleMount,
|
|
620
|
-
"data-title":
|
|
621
|
+
"data-title": te
|
|
621
622
|
}, d()(w, "elementRef"), {
|
|
622
623
|
onClick: this.handleClick,
|
|
623
624
|
onFocus: this.handleFocus,
|
|
@@ -628,19 +629,20 @@
|
|
|
628
629
|
tabIndex: r ? undefined : -1,
|
|
629
630
|
to: v,
|
|
630
631
|
$hasMenu: !!m
|
|
631
|
-
}),
|
|
632
|
+
}), le( n().createElement($, {
|
|
632
633
|
"data-test": "label",
|
|
633
634
|
$withUnderline: j === "navigation"
|
|
634
|
-
}, l && n().createElement(
|
|
635
|
-
$
|
|
636
|
-
|
|
635
|
+
}, l && n().createElement(M, {
|
|
636
|
+
$iconPosition: A,
|
|
637
|
+
$iconSize: B
|
|
638
|
+
}, l), s, !m && (o === 0 || o) && n().createElement(n().Fragment, null, n().createElement(S(), null, " "), n().createElement(D, {
|
|
637
639
|
"data-test": "count",
|
|
638
|
-
disabled:
|
|
640
|
+
disabled: X
|
|
639
641
|
}, u ? K(o, u) : o)), !!m && n().createElement(S(), {
|
|
640
642
|
"aria-hidden": true,
|
|
641
643
|
id: this.menuDescription
|
|
642
|
-
}, (0, f._)("Press Shift + F10 to open the tab’s menu")))), n().createElement(
|
|
643
|
-
$layout:
|
|
644
|
+
}, (0, f._)("Press Shift + F10 to open the tab’s menu")))), n().createElement(z, {
|
|
645
|
+
$layout: W,
|
|
644
646
|
$withUnderline: j === "navigation"
|
|
645
647
|
}), !a && h && n().createElement(k(), {
|
|
646
648
|
role: "tooltip",
|
|
@@ -650,7 +652,7 @@
|
|
|
650
652
|
},
|
|
651
653
|
appearance: "inverted",
|
|
652
654
|
closeReasons: [ "offScreen", "escapeKey" ],
|
|
653
|
-
defaultPlacement:
|
|
655
|
+
defaultPlacement: W === "vertical" ? "right" : "above",
|
|
654
656
|
id: this.popoverId,
|
|
655
657
|
open: !!O && T,
|
|
656
658
|
align: "center"
|
|
@@ -664,10 +666,10 @@
|
|
|
664
666
|
}(r.Component);
|
|
665
667
|
re(le, "propTypes", oe);
|
|
666
668
|
re(le, "defaultProps", ae);
|
|
667
|
-
re(le, "contextType",
|
|
668
|
-
var
|
|
669
|
-
|
|
670
|
-
/* harmony default export */ const
|
|
669
|
+
re(le, "contextType", A);
|
|
670
|
+
var se = (0, c.withSplunkTheme)(le);
|
|
671
|
+
se.propTypes = le.propTypes;
|
|
672
|
+
/* harmony default export */ const ce = se;
|
|
671
673
|
// CONCATENATED MODULE: ./src/utils/navigateList.ts
|
|
672
674
|
// A utility for keyboard navigation of lists
|
|
673
675
|
function ue(e, t, r) {
|
|
@@ -725,20 +727,20 @@
|
|
|
725
727
|
function ye(e, t) {
|
|
726
728
|
var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
727
729
|
if (null != r) {
|
|
728
|
-
var n, i, o, a, l = [],
|
|
730
|
+
var n, i, o, a, l = [], s = !0, c = !1;
|
|
729
731
|
try {
|
|
730
732
|
if (o = (r = r.call(e)).next, 0 === t) {
|
|
731
733
|
if (Object(r) !== r) return;
|
|
732
|
-
|
|
733
|
-
} else for (;!(
|
|
734
|
+
s = !1;
|
|
735
|
+
} else for (;!(s = (n = o.call(r)).done) && (l.push(n.value), l.length !== t); s = !0) {
|
|
734
736
|
}
|
|
735
737
|
} catch (e) {
|
|
736
|
-
|
|
738
|
+
c = !0, i = e;
|
|
737
739
|
} finally {
|
|
738
740
|
try {
|
|
739
|
-
if (!
|
|
741
|
+
if (!s && null != r["return"] && (a = r["return"](), Object(a) !== a)) return;
|
|
740
742
|
} finally {
|
|
741
|
-
if (
|
|
743
|
+
if (c) throw i;
|
|
742
744
|
}
|
|
743
745
|
}
|
|
744
746
|
return l;
|
|
@@ -779,30 +781,42 @@
|
|
|
779
781
|
/** @private */
|
|
780
782
|
disabled: o().bool,
|
|
781
783
|
elementRef: o().oneOfType([ o().func, o().object ]),
|
|
784
|
+
iconPosition: o().oneOf([ "above", "left" ]),
|
|
782
785
|
iconSize: o().oneOf([ "inline", "small", "large" ]),
|
|
783
786
|
layout: o().oneOf([ "horizontal", "vertical" ]),
|
|
784
787
|
onChange: o().func,
|
|
785
788
|
tabWidth: o().number
|
|
786
789
|
};
|
|
787
790
|
function Se(e) {
|
|
788
|
-
var t = e.activeTabId, i = e.autoActivate, o = e.appearance, l = o === void 0 ? "navigation" : o,
|
|
791
|
+
var t = e.activeTabId, i = e.autoActivate, o = e.appearance, l = o === void 0 ? "navigation" : o, s = e.children, c = e.disabled, p = c === void 0 ? false : c, d = e.elementRef, f = e.iconPosition, v = e.iconSize, b = e.layout, h = b === void 0 ? "horizontal" : b, y = e.onChange, m = e.tabWidth, g = ge(e, [ "activeTabId", "autoActivate", "appearance", "children", "disabled", "elementRef", "iconPosition", "iconSize", "layout", "onChange", "tabWidth" ]);
|
|
789
792
|
// @docs-props-type TabBarPropsBase
|
|
790
793
|
var x = (0, r.useState)(false), k = fe(x, 2), w = k[0], S = k[1];
|
|
791
794
|
var C = (0, r.useState)(0), O = fe(C, 2), T = O[0], I = O[1];
|
|
792
795
|
var j = (0, r.useRef)(T);
|
|
793
796
|
j.current = T;
|
|
794
|
-
var
|
|
795
|
-
var
|
|
796
|
-
var
|
|
797
|
-
var
|
|
797
|
+
var P = (0, r.useRef)("");
|
|
798
|
+
var z = (0, r.useRef)([]);
|
|
799
|
+
var E = h === "vertical" ? "down" : "right";
|
|
800
|
+
var M = h === "vertical" ? "up" : "left";
|
|
798
801
|
if (false) {}
|
|
799
|
-
var
|
|
802
|
+
var _ = f;
|
|
803
|
+
var $;
|
|
804
|
+
if (false) {}
|
|
805
|
+
if (_ == null) {
|
|
806
|
+
$ = v;
|
|
807
|
+
if (v != null) {
|
|
808
|
+
_ = v === "inline" ? "left" : "above";
|
|
809
|
+
} else {
|
|
810
|
+
_ = "left";
|
|
811
|
+
}
|
|
812
|
+
} else if (false) {}
|
|
813
|
+
var D = (0, r.useCallback)((function(e, t) {
|
|
800
814
|
var r = t.tabKey, n = t.tabId;
|
|
801
815
|
if (r != null) {
|
|
802
816
|
I(r);
|
|
803
817
|
}
|
|
804
818
|
if (n != null) {
|
|
805
|
-
|
|
819
|
+
P.current = n;
|
|
806
820
|
}
|
|
807
821
|
if (i) {
|
|
808
822
|
y === null || y === void 0 ? void 0 : y(e, {
|
|
@@ -810,22 +824,22 @@
|
|
|
810
824
|
});
|
|
811
825
|
}
|
|
812
826
|
}), [ i, y ]);
|
|
813
|
-
var
|
|
827
|
+
var R = (0, r.useCallback)((function(e, t) {
|
|
814
828
|
y === null || y === void 0 ? void 0 : y(e, {
|
|
815
829
|
selectedTabId: t.tabId
|
|
816
830
|
});
|
|
817
831
|
}), [ y ]);
|
|
818
|
-
var
|
|
832
|
+
var q = (0, r.useMemo)((function() {
|
|
819
833
|
var e = 0;
|
|
820
834
|
// reset tabRefs since children are changed
|
|
821
|
-
|
|
822
|
-
return r.Children.toArray(
|
|
835
|
+
z.current = [];
|
|
836
|
+
return r.Children.toArray(s).filter(r.isValidElement).map((function(i) {
|
|
823
837
|
// <TabBar> allows non-<Tab> children, pass them through without any modification
|
|
824
|
-
if (typeof i.type === "string" || i.type.name !==
|
|
838
|
+
if (typeof i.type === "string" || i.type.name !== ce.name) {
|
|
825
839
|
return i;
|
|
826
840
|
}
|
|
827
841
|
var o = n().createRef();
|
|
828
|
-
|
|
842
|
+
z.current.push(o);
|
|
829
843
|
var a = {
|
|
830
844
|
active: t === i.props.tabId,
|
|
831
845
|
tabKey: e,
|
|
@@ -835,34 +849,34 @@
|
|
|
835
849
|
|
|
836
850
|
return (0, r.cloneElement)(i, a);
|
|
837
851
|
}));
|
|
838
|
-
}), [ t,
|
|
852
|
+
}), [ t, s ]);
|
|
839
853
|
(0, r.useEffect)((function() {
|
|
840
|
-
|
|
854
|
+
q.forEach((function(e, t) {
|
|
841
855
|
// if the focused tab has changed order in the tab bar,
|
|
842
856
|
// then we want to update the focusedTabKey to the new position of the focused tab
|
|
843
|
-
if (
|
|
857
|
+
if (P.current != null && P.current === e.props.tabId && j.current !== t) {
|
|
844
858
|
I(t);
|
|
845
859
|
}
|
|
846
860
|
}));
|
|
847
|
-
}), [
|
|
848
|
-
var
|
|
849
|
-
var
|
|
861
|
+
}), [ q ]);
|
|
862
|
+
var V = m && m > ke ? m : null;
|
|
863
|
+
var K = (0, r.useCallback)((function(e) {
|
|
850
864
|
var t = (0, a.keycode)(e.nativeEvent);
|
|
851
865
|
var r;
|
|
852
|
-
if (t ===
|
|
853
|
-
r = ue(
|
|
854
|
-
} else if (t ===
|
|
855
|
-
r = pe(
|
|
866
|
+
if (t === E) {
|
|
867
|
+
r = ue(z.current, T, T + 1);
|
|
868
|
+
} else if (t === M) {
|
|
869
|
+
r = pe(z.current, T, T - 1);
|
|
856
870
|
} else if (t === "home") {
|
|
857
|
-
r = ue(
|
|
871
|
+
r = ue(z.current, T, 0);
|
|
858
872
|
} else if (t === "end") {
|
|
859
|
-
r = pe(
|
|
873
|
+
r = pe(z.current, T, z.current.length - 1);
|
|
860
874
|
} else if (h === "horizontal" && e.shiftKey && t === "f10") {
|
|
861
875
|
S((function(e) {
|
|
862
876
|
if (e) {
|
|
863
877
|
var t;
|
|
864
878
|
// if we're closing, we want to shift focus to the tab
|
|
865
|
-
var r =
|
|
879
|
+
var r = z.current[T];
|
|
866
880
|
r === null || r === void 0 ? void 0 : (t = r.current) === null || t === void 0 ? void 0 : t.focus();
|
|
867
881
|
}
|
|
868
882
|
return !e;
|
|
@@ -875,33 +889,34 @@
|
|
|
875
889
|
(n = r.current) === null || n === void 0 ? void 0 : n.focus();
|
|
876
890
|
e.preventDefault();
|
|
877
891
|
}
|
|
878
|
-
}), [ T, h,
|
|
879
|
-
var
|
|
892
|
+
}), [ T, h, E, M ]);
|
|
893
|
+
var B = (0, r.useCallback)((function(e) {
|
|
880
894
|
// prevent clicking on the menu icon from changing the active tab
|
|
881
895
|
e.stopPropagation();
|
|
882
896
|
S(true);
|
|
883
897
|
}), []);
|
|
884
|
-
var
|
|
898
|
+
var N = (0, r.useCallback)((function(e) {
|
|
885
899
|
var t = e.event;
|
|
886
900
|
// prevent content clicks/enter key from changing the active tab
|
|
887
901
|
t === null || t === void 0 ? void 0 : t.stopPropagation();
|
|
888
902
|
S(false);
|
|
889
903
|
}), []);
|
|
890
|
-
var
|
|
904
|
+
var F = (0, r.useMemo)((function() {
|
|
891
905
|
return {
|
|
892
906
|
appearance: l,
|
|
893
907
|
disabled: p,
|
|
894
|
-
|
|
908
|
+
iconPosition: _,
|
|
909
|
+
iconSize: $,
|
|
895
910
|
layout: h,
|
|
896
|
-
onClick:
|
|
897
|
-
onFocus:
|
|
898
|
-
width:
|
|
899
|
-
onMenuOpen:
|
|
900
|
-
onMenuClose:
|
|
911
|
+
onClick: R,
|
|
912
|
+
onFocus: D,
|
|
913
|
+
width: V,
|
|
914
|
+
onMenuOpen: B,
|
|
915
|
+
onMenuClose: N,
|
|
901
916
|
isMenuOpen: w,
|
|
902
917
|
focusedTabKey: T
|
|
903
918
|
};
|
|
904
|
-
}), [ l, p, T,
|
|
919
|
+
}), [ l, p, T, _, $, w, h, N, B, R, D, V ]);
|
|
905
920
|
|
|
906
921
|
return n().createElement(u, de({
|
|
907
922
|
"data-tab-layout": h,
|
|
@@ -911,13 +926,13 @@
|
|
|
911
926
|
ref: d,
|
|
912
927
|
$layout: h,
|
|
913
928
|
$withUnderline: l === "navigation",
|
|
914
|
-
onKeyDown:
|
|
915
|
-
}, g), n().createElement(
|
|
916
|
-
value:
|
|
917
|
-
},
|
|
929
|
+
onKeyDown: K
|
|
930
|
+
}, g), n().createElement(A.Provider, {
|
|
931
|
+
value: F
|
|
932
|
+
}, q));
|
|
918
933
|
}
|
|
919
934
|
Se.propTypes = we;
|
|
920
|
-
Se.Tab =
|
|
935
|
+
Se.Tab = ce;
|
|
921
936
|
/* harmony default export */ const Ce = Se;
|
|
922
937
|
// CONCATENATED MODULE: ./src/TabBar/index.ts
|
|
923
938
|
module.exports = t;
|