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