@splunk/react-ui 4.39.0 → 4.41.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/CHANGELOG.md +42 -0
- package/Calendar.js +548 -744
- package/Card.js +3 -1
- package/Chip.js +133 -125
- package/ControlGroup.js +27 -30
- package/Date.js +158 -161
- package/FormRows.js +93 -97
- package/Link.js +21 -19
- package/MIGRATION.mdx +54 -2
- package/Menu.js +1 -1
- package/Message.js +136 -123
- package/MessageBar.js +59 -57
- package/Multiselect.js +2985 -3085
- package/Number.js +23 -18
- package/Popover.js +2 -1
- package/RadioBar.js +19 -15
- package/ResultsMenu.js +1208 -1028
- package/Select.js +1906 -1998
- package/Slider.js +346 -300
- package/SlidingPanels.js +166 -148
- package/SplitButton.d.ts +2 -0
- package/TabBar.js +193 -175
- package/TabLayout.js +16 -10
- package/Table.js +236 -227
- package/TransitionOpen.js +44 -65
- package/WaitSpinner.js +1 -1
- package/package.json +2 -2
- 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/Card/Card.d.ts +1 -0
- package/types/src/Card/Footer.d.ts +1 -0
- package/types/src/Chip/Chip.d.ts +3 -6
- package/types/src/Color/Color.d.ts +2 -2
- package/types/src/ComboBox/ComboBox.d.ts +1 -1
- package/types/src/Date/Date.d.ts +18 -19
- 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/Link/Link.d.ts +7 -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/Compact.d.ts +1 -1
- package/types/src/Multiselect/Multiselect.d.ts +1 -1
- package/types/src/Multiselect/Normal.d.ts +1 -1
- package/types/src/Multiselect/Option.d.ts +1 -1
- package/types/src/Number/Number.d.ts +2 -2
- package/types/src/RadioBar/RadioBar.d.ts +2 -2
- package/types/src/ResultsMenu/VirtualizedResultsMenu/VirtualizedResultsMenu.d.ts +1 -1
- package/types/src/ResultsMenu/VirtualizedResultsMenu/injectVirtualizedItem.d.ts +2 -0
- 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/Select.d.ts +3 -1
- package/types/src/Select/SelectAllOption.d.ts +8 -4
- package/types/src/Select/SelectBase.d.ts +76 -66
- package/types/src/Select/docs/examples/Appearance.d.ts +0 -2
- 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/Cell.d.ts +0 -2
- package/types/src/Table/HeadInner.d.ts +5 -1
- package/types/src/Table/Row.d.ts +0 -2
- 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/Typography/Typography.d.ts +4 -2
- package/types/src/WaitSpinner/WaitSpinner.d.ts +0 -1
- package/types/src/useControlled/index.d.ts +2 -0
- package/types/src/useControlled/useControlled.d.ts +21 -0
- package/types/src/useResizeObserver/index.d.ts +2 -0
- package/types/src/useResizeObserver/useResizeObserver.d.ts +12 -0
- package/useControlled.js +112 -0
- package/useKeyPress.d.ts +2 -0
- package/useResizeObserver.d.ts +2 -0
- package/useResizeObserver.js +137 -0
- package/types/src/Chip/docs/examples/Basic.d.ts +0 -2
- package/types/src/Chip/docs/examples/prisma/Appearance.d.ts +0 -2
- package/types/src/Color/docs/examples/prisma/Controlled.d.ts +0 -2
- package/types/src/Color/docs/examples/prisma/ThemeVariables.d.ts +0 -1
- package/types/src/Color/docs/examples/prisma/Uncontrolled.d.ts +0 -2
- package/types/src/Dropdown/docs/examples/prisma/Basic.d.ts +0 -2
- package/types/src/Dropdown/docs/examples/prisma/BasicMenu.d.ts +0 -2
- package/types/src/Dropdown/docs/examples/prisma/ControlledDropdown.d.ts +0 -2
- package/types/src/Dropdown/docs/examples/prisma/Dialog.d.ts +0 -2
- package/types/src/Dropdown/docs/examples/prisma/OtherToggles.d.ts +0 -2
- package/types/src/Dropdown/docs/examples/prisma/ScrollingMenu.d.ts +0 -2
- package/types/src/File/docs/examples/prisma/Disabled.d.ts +0 -12
- package/types/src/Message/docs/examples/Title.d.ts +0 -2
- 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/WaitSpinner/docs/examples/prisma/Basic.d.ts +0 -2
- /package/types/src/Color/docs/examples/{prisma/CustomizedPalette.d.ts → CustomizedPalette.d.ts} +0 -0
- /package/types/src/Color/docs/examples/{prisma/HideInput.d.ts → HideInput.d.ts} +0 -0
- /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,69 +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
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
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 = "";
|
|
567
|
+
// SUI-6877: if the label isn't a string, don't attempt to do this since it'll just be wrong
|
|
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()) : "";
|
|
571
|
+
// titleValue is used for CSS styling in TabStyles. labelValue and countValue needs to be included in the title.
|
|
572
|
+
if (ee) {
|
|
573
|
+
// countValue needs unicode space for width to not change after it's clicked.
|
|
574
|
+
var ie = ne ? "(".concat(ne, ") ") : "";
|
|
575
|
+
te = "".concat(re, " ").concat(ie);
|
|
576
|
+
} else {
|
|
577
|
+
te = "".concat(re, " ").concat(ne);
|
|
578
|
+
}
|
|
575
579
|
}
|
|
576
|
-
var
|
|
577
|
-
var
|
|
580
|
+
var oe = J === x && G && !!m;
|
|
581
|
+
var ae = n().createElement(E, {
|
|
578
582
|
$active: r,
|
|
579
583
|
"data-test": "menu-toggle",
|
|
580
584
|
tabIndex: -1,
|
|
581
585
|
onFocus: this.handleFocusMenuToggle
|
|
582
|
-
},
|
|
586
|
+
}, ee ? n().createElement(g(), {
|
|
583
587
|
size: 1.1
|
|
584
588
|
}) : n().createElement(b(), null));
|
|
585
|
-
var
|
|
589
|
+
var le = function e(t) {
|
|
586
590
|
// if there is no menu, or if we are not in horizontal, do not render menu container
|
|
587
|
-
if (!m ||
|
|
591
|
+
if (!m || W !== "horizontal") {
|
|
588
592
|
return t;
|
|
589
593
|
}
|
|
590
594
|
|
|
591
|
-
return n().createElement(
|
|
592
|
-
toggle:
|
|
595
|
+
return n().createElement(_, null, t, n().createElement(y(), {
|
|
596
|
+
toggle: ae,
|
|
593
597
|
align: "center",
|
|
594
|
-
onRequestOpen:
|
|
595
|
-
onRequestClose:
|
|
596
|
-
open:
|
|
598
|
+
onRequestOpen: H,
|
|
599
|
+
onRequestClose: Y,
|
|
600
|
+
open: oe
|
|
597
601
|
}, m));
|
|
598
602
|
};
|
|
599
603
|
|
|
600
604
|
// TODO: Fix the ts error: https://splunk.atlassian.net/browse/SUI-5569
|
|
601
605
|
// eslint-disable-next-line
|
|
602
606
|
// @ts-ignore-next-line
|
|
603
|
-
return n().createElement(
|
|
607
|
+
return n().createElement(P, F({
|
|
604
608
|
"aria-controls": i,
|
|
605
609
|
"aria-selected": r,
|
|
606
610
|
"aria-labelledby": this.ariaId,
|
|
607
611
|
"aria-describedby": m ? this.menuDescription : undefined,
|
|
608
|
-
"aria-haspopup":
|
|
612
|
+
"aria-haspopup": oe,
|
|
609
613
|
"data-test": "tab",
|
|
610
|
-
"data-test-tab-id":
|
|
614
|
+
"data-test-tab-id": c,
|
|
611
615
|
"data-test-popover-id": h ? this.popoverId : undefined,
|
|
612
|
-
$layout:
|
|
613
|
-
$icon: l &&
|
|
614
|
-
disabled:
|
|
615
|
-
style:
|
|
616
|
-
elementRef: this.handleMount
|
|
616
|
+
$layout: W,
|
|
617
|
+
$icon: l && B !== "inline" ? true : undefined,
|
|
618
|
+
disabled: X,
|
|
619
|
+
style: Z,
|
|
620
|
+
elementRef: this.handleMount,
|
|
621
|
+
"data-title": te
|
|
617
622
|
}, d()(w, "elementRef"), {
|
|
618
623
|
onClick: this.handleClick,
|
|
619
624
|
onFocus: this.handleFocus,
|
|
@@ -622,22 +627,22 @@
|
|
|
622
627
|
onMouseLeave: this.handleTooltipClose,
|
|
623
628
|
role: "tab",
|
|
624
629
|
tabIndex: r ? undefined : -1,
|
|
625
|
-
"data-title": re,
|
|
626
630
|
to: v,
|
|
627
631
|
$hasMenu: !!m
|
|
628
|
-
}),
|
|
632
|
+
}), le( n().createElement($, {
|
|
629
633
|
"data-test": "label",
|
|
630
634
|
$withUnderline: j === "navigation"
|
|
631
|
-
}, l && n().createElement(
|
|
632
|
-
$
|
|
633
|
-
|
|
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, {
|
|
634
639
|
"data-test": "count",
|
|
635
|
-
disabled:
|
|
640
|
+
disabled: X
|
|
636
641
|
}, u ? K(o, u) : o)), !!m && n().createElement(S(), {
|
|
637
642
|
"aria-hidden": true,
|
|
638
643
|
id: this.menuDescription
|
|
639
|
-
}, (0, f._)("Press Shift + F10 to open the tab’s menu")))), n().createElement(
|
|
640
|
-
$layout:
|
|
644
|
+
}, (0, f._)("Press Shift + F10 to open the tab’s menu")))), n().createElement(z, {
|
|
645
|
+
$layout: W,
|
|
641
646
|
$withUnderline: j === "navigation"
|
|
642
647
|
}), !a && h && n().createElement(k(), {
|
|
643
648
|
role: "tooltip",
|
|
@@ -647,7 +652,7 @@
|
|
|
647
652
|
},
|
|
648
653
|
appearance: "inverted",
|
|
649
654
|
closeReasons: [ "offScreen", "escapeKey" ],
|
|
650
|
-
defaultPlacement:
|
|
655
|
+
defaultPlacement: W === "vertical" ? "right" : "above",
|
|
651
656
|
id: this.popoverId,
|
|
652
657
|
open: !!O && T,
|
|
653
658
|
align: "center"
|
|
@@ -661,10 +666,10 @@
|
|
|
661
666
|
}(r.Component);
|
|
662
667
|
re(le, "propTypes", oe);
|
|
663
668
|
re(le, "defaultProps", ae);
|
|
664
|
-
re(le, "contextType",
|
|
665
|
-
var
|
|
666
|
-
|
|
667
|
-
/* 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;
|
|
668
673
|
// CONCATENATED MODULE: ./src/utils/navigateList.ts
|
|
669
674
|
// A utility for keyboard navigation of lists
|
|
670
675
|
function ue(e, t, r) {
|
|
@@ -722,20 +727,20 @@
|
|
|
722
727
|
function ye(e, t) {
|
|
723
728
|
var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
724
729
|
if (null != r) {
|
|
725
|
-
var n, i, o, a, l = [],
|
|
730
|
+
var n, i, o, a, l = [], s = !0, c = !1;
|
|
726
731
|
try {
|
|
727
732
|
if (o = (r = r.call(e)).next, 0 === t) {
|
|
728
733
|
if (Object(r) !== r) return;
|
|
729
|
-
|
|
730
|
-
} else for (;!(
|
|
734
|
+
s = !1;
|
|
735
|
+
} else for (;!(s = (n = o.call(r)).done) && (l.push(n.value), l.length !== t); s = !0) {
|
|
731
736
|
}
|
|
732
737
|
} catch (e) {
|
|
733
|
-
|
|
738
|
+
c = !0, i = e;
|
|
734
739
|
} finally {
|
|
735
740
|
try {
|
|
736
|
-
if (!
|
|
741
|
+
if (!s && null != r["return"] && (a = r["return"](), Object(a) !== a)) return;
|
|
737
742
|
} finally {
|
|
738
|
-
if (
|
|
743
|
+
if (c) throw i;
|
|
739
744
|
}
|
|
740
745
|
}
|
|
741
746
|
return l;
|
|
@@ -776,30 +781,42 @@
|
|
|
776
781
|
/** @private */
|
|
777
782
|
disabled: o().bool,
|
|
778
783
|
elementRef: o().oneOfType([ o().func, o().object ]),
|
|
784
|
+
iconPosition: o().oneOf([ "above", "left" ]),
|
|
779
785
|
iconSize: o().oneOf([ "inline", "small", "large" ]),
|
|
780
786
|
layout: o().oneOf([ "horizontal", "vertical" ]),
|
|
781
787
|
onChange: o().func,
|
|
782
788
|
tabWidth: o().number
|
|
783
789
|
};
|
|
784
790
|
function Se(e) {
|
|
785
|
-
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" ]);
|
|
786
792
|
// @docs-props-type TabBarPropsBase
|
|
787
793
|
var x = (0, r.useState)(false), k = fe(x, 2), w = k[0], S = k[1];
|
|
788
794
|
var C = (0, r.useState)(0), O = fe(C, 2), T = O[0], I = O[1];
|
|
789
795
|
var j = (0, r.useRef)(T);
|
|
790
796
|
j.current = T;
|
|
791
|
-
var
|
|
792
|
-
var
|
|
793
|
-
var
|
|
794
|
-
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";
|
|
801
|
+
if (false) {}
|
|
802
|
+
var _ = f;
|
|
803
|
+
var $;
|
|
795
804
|
if (false) {}
|
|
796
|
-
|
|
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) {
|
|
797
814
|
var r = t.tabKey, n = t.tabId;
|
|
798
815
|
if (r != null) {
|
|
799
816
|
I(r);
|
|
800
817
|
}
|
|
801
818
|
if (n != null) {
|
|
802
|
-
|
|
819
|
+
P.current = n;
|
|
803
820
|
}
|
|
804
821
|
if (i) {
|
|
805
822
|
y === null || y === void 0 ? void 0 : y(e, {
|
|
@@ -807,22 +824,22 @@
|
|
|
807
824
|
});
|
|
808
825
|
}
|
|
809
826
|
}), [ i, y ]);
|
|
810
|
-
var
|
|
827
|
+
var R = (0, r.useCallback)((function(e, t) {
|
|
811
828
|
y === null || y === void 0 ? void 0 : y(e, {
|
|
812
829
|
selectedTabId: t.tabId
|
|
813
830
|
});
|
|
814
831
|
}), [ y ]);
|
|
815
|
-
var
|
|
832
|
+
var q = (0, r.useMemo)((function() {
|
|
816
833
|
var e = 0;
|
|
817
834
|
// reset tabRefs since children are changed
|
|
818
|
-
|
|
819
|
-
return r.Children.toArray(
|
|
835
|
+
z.current = [];
|
|
836
|
+
return r.Children.toArray(s).filter(r.isValidElement).map((function(i) {
|
|
820
837
|
// <TabBar> allows non-<Tab> children, pass them through without any modification
|
|
821
|
-
if (typeof i.type === "string" || i.type.name !==
|
|
838
|
+
if (typeof i.type === "string" || i.type.name !== ce.name) {
|
|
822
839
|
return i;
|
|
823
840
|
}
|
|
824
841
|
var o = n().createRef();
|
|
825
|
-
|
|
842
|
+
z.current.push(o);
|
|
826
843
|
var a = {
|
|
827
844
|
active: t === i.props.tabId,
|
|
828
845
|
tabKey: e,
|
|
@@ -832,34 +849,34 @@
|
|
|
832
849
|
|
|
833
850
|
return (0, r.cloneElement)(i, a);
|
|
834
851
|
}));
|
|
835
|
-
}), [ t,
|
|
852
|
+
}), [ t, s ]);
|
|
836
853
|
(0, r.useEffect)((function() {
|
|
837
|
-
|
|
854
|
+
q.forEach((function(e, t) {
|
|
838
855
|
// if the focused tab has changed order in the tab bar,
|
|
839
856
|
// then we want to update the focusedTabKey to the new position of the focused tab
|
|
840
|
-
if (
|
|
857
|
+
if (P.current != null && P.current === e.props.tabId && j.current !== t) {
|
|
841
858
|
I(t);
|
|
842
859
|
}
|
|
843
860
|
}));
|
|
844
|
-
}), [
|
|
845
|
-
var
|
|
846
|
-
var
|
|
861
|
+
}), [ q ]);
|
|
862
|
+
var V = m && m > ke ? m : null;
|
|
863
|
+
var K = (0, r.useCallback)((function(e) {
|
|
847
864
|
var t = (0, a.keycode)(e.nativeEvent);
|
|
848
865
|
var r;
|
|
849
|
-
if (t ===
|
|
850
|
-
r = ue(
|
|
851
|
-
} else if (t ===
|
|
852
|
-
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);
|
|
853
870
|
} else if (t === "home") {
|
|
854
|
-
r = ue(
|
|
871
|
+
r = ue(z.current, T, 0);
|
|
855
872
|
} else if (t === "end") {
|
|
856
|
-
r = pe(
|
|
873
|
+
r = pe(z.current, T, z.current.length - 1);
|
|
857
874
|
} else if (h === "horizontal" && e.shiftKey && t === "f10") {
|
|
858
875
|
S((function(e) {
|
|
859
876
|
if (e) {
|
|
860
877
|
var t;
|
|
861
878
|
// if we're closing, we want to shift focus to the tab
|
|
862
|
-
var r =
|
|
879
|
+
var r = z.current[T];
|
|
863
880
|
r === null || r === void 0 ? void 0 : (t = r.current) === null || t === void 0 ? void 0 : t.focus();
|
|
864
881
|
}
|
|
865
882
|
return !e;
|
|
@@ -872,33 +889,34 @@
|
|
|
872
889
|
(n = r.current) === null || n === void 0 ? void 0 : n.focus();
|
|
873
890
|
e.preventDefault();
|
|
874
891
|
}
|
|
875
|
-
}), [ T, h,
|
|
876
|
-
var
|
|
892
|
+
}), [ T, h, E, M ]);
|
|
893
|
+
var B = (0, r.useCallback)((function(e) {
|
|
877
894
|
// prevent clicking on the menu icon from changing the active tab
|
|
878
895
|
e.stopPropagation();
|
|
879
896
|
S(true);
|
|
880
897
|
}), []);
|
|
881
|
-
var
|
|
898
|
+
var N = (0, r.useCallback)((function(e) {
|
|
882
899
|
var t = e.event;
|
|
883
900
|
// prevent content clicks/enter key from changing the active tab
|
|
884
901
|
t === null || t === void 0 ? void 0 : t.stopPropagation();
|
|
885
902
|
S(false);
|
|
886
903
|
}), []);
|
|
887
|
-
var
|
|
904
|
+
var F = (0, r.useMemo)((function() {
|
|
888
905
|
return {
|
|
889
906
|
appearance: l,
|
|
890
907
|
disabled: p,
|
|
891
|
-
|
|
908
|
+
iconPosition: _,
|
|
909
|
+
iconSize: $,
|
|
892
910
|
layout: h,
|
|
893
|
-
onClick:
|
|
894
|
-
onFocus:
|
|
895
|
-
width:
|
|
896
|
-
onMenuOpen:
|
|
897
|
-
onMenuClose:
|
|
911
|
+
onClick: R,
|
|
912
|
+
onFocus: D,
|
|
913
|
+
width: V,
|
|
914
|
+
onMenuOpen: B,
|
|
915
|
+
onMenuClose: N,
|
|
898
916
|
isMenuOpen: w,
|
|
899
917
|
focusedTabKey: T
|
|
900
918
|
};
|
|
901
|
-
}), [ l, p, T,
|
|
919
|
+
}), [ l, p, T, _, $, w, h, N, B, R, D, V ]);
|
|
902
920
|
|
|
903
921
|
return n().createElement(u, de({
|
|
904
922
|
"data-tab-layout": h,
|
|
@@ -908,13 +926,13 @@
|
|
|
908
926
|
ref: d,
|
|
909
927
|
$layout: h,
|
|
910
928
|
$withUnderline: l === "navigation",
|
|
911
|
-
onKeyDown:
|
|
912
|
-
}, g), n().createElement(
|
|
913
|
-
value:
|
|
914
|
-
},
|
|
929
|
+
onKeyDown: K
|
|
930
|
+
}, g), n().createElement(A.Provider, {
|
|
931
|
+
value: F
|
|
932
|
+
}, q));
|
|
915
933
|
}
|
|
916
934
|
Se.propTypes = we;
|
|
917
|
-
Se.Tab =
|
|
935
|
+
Se.Tab = ce;
|
|
918
936
|
/* harmony default export */ const Ce = Se;
|
|
919
937
|
// CONCATENATED MODULE: ./src/TabBar/index.ts
|
|
920
938
|
module.exports = t;
|