@splunk/react-ui 4.4.0 → 4.5.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/Accordion.js +37 -21
- package/Anchor.js +2 -2
- package/AnimationToggle.js +2 -2
- package/Box.js +2 -2
- package/Button.js +36 -12
- package/ButtonGroup.js +27 -6
- package/ButtonSimple.js +6 -6
- package/CHANGELOG.md +54 -1
- package/Calendar.js +14 -14
- package/Card.js +49 -23
- package/CardLayout.js +31 -10
- package/Chip.js +77 -53
- package/Clickable.js +2 -2
- package/CloseButton.js +6 -6
- package/Code.js +4 -4
- package/CollapsiblePanel.js +6 -6
- package/Color.js +103 -56
- package/ColumnLayout.js +4 -4
- package/ComboBox.js +22 -17
- package/Concertina.js +73 -68
- package/ControlGroup.js +72 -24
- package/Date.js +9 -9
- package/DefinitionList.js +6 -6
- package/Dropdown.js +12 -12
- package/EventListener.js +168 -0
- package/FetchOptions.js +8 -8
- package/File.js +93 -82
- package/FormRows.js +66 -58
- package/Image.js +14 -14
- package/JSONTree.js +5 -5
- package/Layer.js +32 -20
- package/Link.js +6 -6
- package/List.js +2 -2
- package/Markdown.js +250 -88
- package/Menu.js +70 -64
- package/Message.js +18 -18
- package/Modal.js +68 -14
- package/ModalLayer.js +4 -4
- package/Monogram.js +12 -11
- package/Multiselect.js +122 -78
- package/Number.js +19 -16
- package/Paginator.js +10 -10
- package/Paragraph.js +2 -2
- package/Popover.js +52 -38
- package/Progress.js +6 -6
- package/RadioBar.js +56 -69
- package/RadioList.js +2 -2
- package/Resize.js +19 -15
- package/ResultsMenu.js +8 -8
- package/ScreenReaderContent.js +2 -2
- package/Scroll.js +16 -14
- package/ScrollContainerContext.js +5 -5
- package/Search.d.ts +2 -0
- package/Search.js +797 -0
- package/Select.js +83 -43
- package/SidePanel.js +6 -6
- package/Slider.js +29 -25
- package/SlidingPanels.js +4 -4
- package/StaticContent.js +2 -2
- package/StepBar.js +56 -52
- package/Switch.js +8 -8
- package/TabBar.js +126 -85
- package/TabLayout.js +4 -5
- package/Table.js +188 -138
- package/Text.js +69 -63
- package/Tooltip.js +11 -11
- package/TransitionOpen.js +9 -9
- package/WaitSpinner.js +3 -4
- package/package.json +4 -5
- package/types/src/Accordion/AccordionContext.d.ts +10 -0
- package/types/src/Accordion/Panel.d.ts +0 -9
- package/types/src/Button/Button.d.ts +4 -2
- package/types/src/ButtonGroup/ButtonGroupContext.d.ts +7 -0
- package/types/src/ButtonSimple/ButtonSimple.d.ts +5 -5
- package/types/src/Card/Card.d.ts +2 -0
- package/types/src/CardLayout/CardLayoutContext.d.ts +8 -0
- package/types/src/Color/Color.d.ts +2 -2
- package/types/src/ComboBox/ComboBox.d.ts +4 -3
- package/types/src/Concertina/ConcertinaContext.d.ts +8 -0
- package/types/src/Concertina/Panel.d.ts +2 -4
- package/types/src/ControlGroup/ControlGroup.d.ts +6 -1
- package/types/src/Date/Date.d.ts +3 -3
- package/types/src/EventListener/EventListener.d.ts +18 -0
- package/types/src/EventListener/index.d.ts +2 -0
- package/types/src/File/File.d.ts +6 -4
- package/types/src/File/FileContext.d.ts +3 -0
- package/types/src/File/Item.d.ts +5 -8
- package/types/src/FormRows/FormRows.d.ts +2 -2
- package/types/src/FormRows/FormRowsContext.d.ts +10 -0
- package/types/src/FormRows/Row.d.ts +5 -16
- package/types/src/Markdown/Markdown.d.ts +2 -0
- package/types/src/Markdown/renderers/MarkdownBlockquote.d.ts +14 -0
- package/types/src/Markdown/renderers/MarkdownCode.d.ts +15 -0
- package/types/src/Markdown/renderers/MarkdownCodeBlock.d.ts +16 -0
- package/types/src/Markdown/renderers/MarkdownHeading.d.ts +15 -0
- package/types/src/Markdown/renderers/MarkdownImage.d.ts +18 -0
- package/types/src/Markdown/renderers/MarkdownItem.d.ts +14 -0
- package/types/src/Markdown/renderers/MarkdownLink.d.ts +18 -0
- package/types/src/Markdown/renderers/MarkdownList.d.ts +26 -0
- package/types/src/Markdown/renderers/MarkdownParagraph.d.ts +14 -0
- package/types/src/Markdown/renderers/index.d.ts +10 -0
- package/types/src/Modal/Modal.d.ts +15 -3
- package/types/src/Monogram/Monogram.d.ts +5 -1
- package/types/src/Multiselect/Compact.d.ts +12 -4
- package/types/src/Multiselect/Multiselect.d.ts +14 -4
- package/types/src/Multiselect/Normal.d.ts +7 -2
- package/types/src/Number/Number.d.ts +11 -7
- package/types/src/Popover/Popover.d.ts +2 -2
- package/types/src/RadioBar/Option.d.ts +4 -14
- package/types/src/RadioBar/RadioBar.d.ts +2 -2
- package/types/src/RadioBar/RadioBarContext.d.ts +9 -0
- package/types/src/Scroll/Inner.d.ts +1 -1
- package/types/src/ScrollContainerContext/ScrollContainerContext.d.ts +4 -4
- package/types/src/Search/Option.d.ts +60 -0
- package/types/src/Search/Search.d.ts +97 -0
- package/types/src/Search/index.d.ts +2 -0
- package/types/src/Select/Select.d.ts +6 -2
- package/types/src/Select/SelectBase.d.ts +12 -5
- package/types/src/Slider/Slider.d.ts +2 -2
- package/types/src/StepBar/Step.d.ts +1 -13
- package/types/src/StepBar/StepBarContext.d.ts +8 -0
- package/types/src/TabBar/Tab.d.ts +5 -13
- package/types/src/TabBar/TabBarContext.d.ts +14 -0
- package/types/src/Table/Body.d.ts +1 -1
- package/types/src/Table/Head.d.ts +1 -1
- package/types/src/Table/Row.d.ts +10 -3
- package/types/src/Table/Table.d.ts +3 -2
- package/types/src/Text/Text.d.ts +11 -7
- package/types/src/icons/Sort.d.ts +3 -0
- package/types/src/usePrevious/index.d.ts +2 -0
- package/types/src/usePrevious/usePrevious.d.ts +12 -0
- package/usePrevious.js +137 -0
package/TabBar.js
CHANGED
|
@@ -82,7 +82,7 @@ module.exports =
|
|
|
82
82
|
/******/
|
|
83
83
|
/******/
|
|
84
84
|
/******/ // Load entry module and return exports
|
|
85
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 125);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
@@ -109,13 +109,6 @@ module.exports = require("@splunk/ui-utils/id");
|
|
|
109
109
|
/***/ }),
|
|
110
110
|
|
|
111
111
|
/***/ 11:
|
|
112
|
-
/***/ (function(module, exports) {
|
|
113
|
-
|
|
114
|
-
module.exports = require("@splunk/react-ui/Clickable");
|
|
115
|
-
|
|
116
|
-
/***/ }),
|
|
117
|
-
|
|
118
|
-
/***/ 12:
|
|
119
112
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
120
113
|
|
|
121
114
|
"use strict";
|
|
@@ -142,7 +135,14 @@ function updateReactRef(ref, current) {
|
|
|
142
135
|
|
|
143
136
|
/***/ }),
|
|
144
137
|
|
|
145
|
-
/***/
|
|
138
|
+
/***/ 12:
|
|
139
|
+
/***/ (function(module, exports) {
|
|
140
|
+
|
|
141
|
+
module.exports = require("@splunk/react-ui/Clickable");
|
|
142
|
+
|
|
143
|
+
/***/ }),
|
|
144
|
+
|
|
145
|
+
/***/ 125:
|
|
146
146
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
147
147
|
|
|
148
148
|
"use strict";
|
|
@@ -198,15 +198,15 @@ var Styled = external_styled_components_default.a.div.withConfig({
|
|
|
198
198
|
var id_ = __webpack_require__(10);
|
|
199
199
|
|
|
200
200
|
// EXTERNAL MODULE: external "@splunk/react-ui/Popover"
|
|
201
|
-
var Popover_ = __webpack_require__(
|
|
201
|
+
var Popover_ = __webpack_require__(16);
|
|
202
202
|
var Popover_default = /*#__PURE__*/__webpack_require__.n(Popover_);
|
|
203
203
|
|
|
204
204
|
// EXTERNAL MODULE: external "@splunk/react-ui/ScreenReaderContent"
|
|
205
|
-
var ScreenReaderContent_ = __webpack_require__(
|
|
205
|
+
var ScreenReaderContent_ = __webpack_require__(15);
|
|
206
206
|
var ScreenReaderContent_default = /*#__PURE__*/__webpack_require__.n(ScreenReaderContent_);
|
|
207
207
|
|
|
208
208
|
// EXTERNAL MODULE: external "@splunk/react-ui/Clickable"
|
|
209
|
-
var Clickable_ = __webpack_require__(
|
|
209
|
+
var Clickable_ = __webpack_require__(12);
|
|
210
210
|
var Clickable_default = /*#__PURE__*/__webpack_require__.n(Clickable_);
|
|
211
211
|
|
|
212
212
|
// CONCATENATED MODULE: ./src/TabBar/TabStyles.ts
|
|
@@ -248,7 +248,7 @@ var StyledClickable = external_styled_components_default()(Clickable_default.a).
|
|
|
248
248
|
enterprise: 'normal',
|
|
249
249
|
prisma: themes_["variables"].fontWeightSemiBold
|
|
250
250
|
}), Object(themes_["pick"])({
|
|
251
|
-
prisma: Object(external_styled_components_["css"])(["&::after{display:block;content:attr(title);font-weight:", ";height:0;color:transparent;overflow:hidden;visibility:hidden;}"], themes_["variables"].
|
|
251
|
+
prisma: Object(external_styled_components_["css"])(["&::after{display:block;content:attr(title);font-weight:", ";height:0;color:transparent;overflow:hidden;visibility:hidden;}"], themes_["variables"].fontWeightBold)
|
|
252
252
|
}), Object(themes_["pick"])({
|
|
253
253
|
prisma: Object(external_styled_components_["css"])(["color:", ";"], themes_["variables"].contentColorActive)
|
|
254
254
|
}), themes_["variables"].focusShadowInset, Object(themes_["pick"])({
|
|
@@ -342,13 +342,22 @@ var StyledTooltipContent = external_styled_components_default.a.div.withConfig({
|
|
|
342
342
|
})(["padding:8px;font-size:", ";"], themes_["variables"].fontSizeSmall);
|
|
343
343
|
|
|
344
344
|
// EXTERNAL MODULE: ./src/utils/updateReactRef.ts
|
|
345
|
-
var updateReactRef = __webpack_require__(
|
|
345
|
+
var updateReactRef = __webpack_require__(11);
|
|
346
346
|
|
|
347
|
+
// CONCATENATED MODULE: ./src/TabBar/TabBarContext.tsx
|
|
348
|
+
|
|
349
|
+
var TabBarContext = /*#__PURE__*/Object(external_react_["createContext"])({});
|
|
350
|
+
TabBarContext.displayName = 'TabBar';
|
|
351
|
+
/* harmony default export */ var TabBar_TabBarContext = (TabBarContext);
|
|
347
352
|
// CONCATENATED MODULE: ./src/TabBar/Tab.tsx
|
|
348
353
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
349
354
|
|
|
350
355
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
351
356
|
|
|
357
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
358
|
+
|
|
359
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
360
|
+
|
|
352
361
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
353
362
|
|
|
354
363
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -382,31 +391,17 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
382
391
|
|
|
383
392
|
|
|
384
393
|
|
|
394
|
+
|
|
385
395
|
var propTypes = {
|
|
386
396
|
/** @private. Is the tab active. */
|
|
387
397
|
active: external_prop_types_default.a.bool,
|
|
388
|
-
|
|
389
|
-
/** @private. Setting this prop to 'context' creates an appearance without an underline. */
|
|
390
|
-
appearance: external_prop_types_default.a.oneOf(['navigation', 'context']),
|
|
391
398
|
ariaControls: external_prop_types_default.a.string,
|
|
392
399
|
count: external_prop_types_default.a.number,
|
|
393
400
|
disabled: external_prop_types_default.a.bool,
|
|
394
401
|
elementRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
|
|
395
402
|
icon: external_prop_types_default.a.node,
|
|
396
|
-
|
|
397
|
-
/** @private. Size of icon. */
|
|
398
|
-
iconSize: external_prop_types_default.a.oneOf(['inline', 'small', 'large']),
|
|
399
403
|
id: external_prop_types_default.a.string,
|
|
400
404
|
label: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.element]),
|
|
401
|
-
|
|
402
|
-
/** @private. The layout of tabs */
|
|
403
|
-
layout: external_prop_types_default.a.oneOf(['horizontal', 'vertical']),
|
|
404
|
-
|
|
405
|
-
/** @private. Callback function when activated */
|
|
406
|
-
onClick: external_prop_types_default.a.func,
|
|
407
|
-
|
|
408
|
-
/** @private. Callback function when focused */
|
|
409
|
-
onFocus: external_prop_types_default.a.func,
|
|
410
405
|
tabId: external_prop_types_default.a.string,
|
|
411
406
|
|
|
412
407
|
/** @private. The internal key of the tab */
|
|
@@ -415,10 +410,7 @@ var propTypes = {
|
|
|
415
410
|
tooltip: external_prop_types_default.a.node
|
|
416
411
|
};
|
|
417
412
|
var defaultProps = {
|
|
418
|
-
active: false
|
|
419
|
-
layout: 'horizontal',
|
|
420
|
-
iconSize: 'inline',
|
|
421
|
-
disabled: false
|
|
413
|
+
active: false
|
|
422
414
|
};
|
|
423
415
|
|
|
424
416
|
var Tab_Tab = /*#__PURE__*/function (_Component) {
|
|
@@ -459,10 +451,10 @@ var Tab_Tab = /*#__PURE__*/function (_Component) {
|
|
|
459
451
|
_defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
|
|
460
452
|
var _this$props = _this.props,
|
|
461
453
|
active = _this$props.active,
|
|
462
|
-
onClick = _this$props.onClick,
|
|
463
454
|
tabId = _this$props.tabId,
|
|
464
455
|
tabKey = _this$props.tabKey,
|
|
465
|
-
to = _this$props.to;
|
|
456
|
+
to = _this$props.to;
|
|
457
|
+
var onClick = _this.context.onClick; // preserve the previous behaviour from 2ad8e7eaf47 to avoid firing unnecessary onChange events
|
|
466
458
|
// while preventing the "to" prop from incorrectly triggering <Clickable>'s providedOnClick on the active tab
|
|
467
459
|
|
|
468
460
|
if (!active) {
|
|
@@ -481,9 +473,9 @@ var Tab_Tab = /*#__PURE__*/function (_Component) {
|
|
|
481
473
|
_this.handleTooltipOpen();
|
|
482
474
|
|
|
483
475
|
var _this$props2 = _this.props,
|
|
484
|
-
onFocus = _this$props2.onFocus,
|
|
485
476
|
tabId = _this$props2.tabId,
|
|
486
477
|
tabKey = _this$props2.tabKey;
|
|
478
|
+
var onFocus = _this.context.onFocus;
|
|
487
479
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e, {
|
|
488
480
|
tabId: tabId,
|
|
489
481
|
tabKey: tabKey
|
|
@@ -510,32 +502,45 @@ var Tab_Tab = /*#__PURE__*/function (_Component) {
|
|
|
510
502
|
value: function render() {
|
|
511
503
|
var _this$props3 = this.props,
|
|
512
504
|
active = _this$props3.active,
|
|
513
|
-
appearance = _this$props3.appearance,
|
|
514
505
|
ariaControls = _this$props3.ariaControls,
|
|
515
506
|
count = _this$props3.count,
|
|
516
507
|
disabled = _this$props3.disabled,
|
|
517
508
|
icon = _this$props3.icon,
|
|
518
|
-
iconSize = _this$props3.iconSize,
|
|
519
509
|
label = _this$props3.label,
|
|
520
|
-
layout = _this$props3.layout,
|
|
521
510
|
tabId = _this$props3.tabId,
|
|
522
511
|
to = _this$props3.to,
|
|
523
512
|
tooltip = _this$props3.tooltip,
|
|
524
|
-
otherProps = _objectWithoutProperties(_this$props3, ["active", "
|
|
513
|
+
otherProps = _objectWithoutProperties(_this$props3, ["active", "ariaControls", "count", "disabled", "icon", "label", "tabId", "to", "tooltip"]);
|
|
525
514
|
|
|
526
515
|
var _this$state = this.state,
|
|
527
516
|
anchor = _this$state.anchor,
|
|
528
517
|
open = _this$state.open;
|
|
518
|
+
var _this$context = this.context,
|
|
519
|
+
appearance = _this$context.appearance,
|
|
520
|
+
disabledContext = _this$context.disabled,
|
|
521
|
+
iconSize = _this$context.iconSize,
|
|
522
|
+
layout = _this$context.layout,
|
|
523
|
+
widthContext = _this$context.width;
|
|
524
|
+
|
|
525
|
+
var style = _objectSpread({}, otherProps);
|
|
526
|
+
|
|
527
|
+
var disabledValue = disabledContext || disabled;
|
|
528
|
+
var iconSizeValue = iconSize || 'inline';
|
|
529
|
+
var layoutValue = layout || 'horizontal';
|
|
530
|
+
var styleValue = widthContext ? {
|
|
531
|
+
width: widthContext
|
|
532
|
+
} : style;
|
|
529
533
|
return /*#__PURE__*/external_react_default.a.createElement(StyledClickable, _extends({
|
|
530
534
|
"aria-controls": ariaControls,
|
|
531
535
|
"aria-selected": active,
|
|
532
536
|
"data-test": "tab",
|
|
533
537
|
"data-test-tab-id": tabId,
|
|
534
538
|
"data-test-popover-id": tooltip ? this.popoverId : undefined,
|
|
535
|
-
$layout:
|
|
536
|
-
$icon: icon &&
|
|
537
|
-
disabled:
|
|
538
|
-
elementRef: this.handleMount
|
|
539
|
+
$layout: layoutValue,
|
|
540
|
+
$icon: icon && iconSizeValue !== 'inline' ? true : undefined,
|
|
541
|
+
disabled: disabledValue,
|
|
542
|
+
elementRef: this.handleMount,
|
|
543
|
+
style: styleValue
|
|
539
544
|
}, otherProps, {
|
|
540
545
|
onClick: this.handleClick,
|
|
541
546
|
onFocus: this.handleFocus,
|
|
@@ -553,18 +558,18 @@ var Tab_Tab = /*#__PURE__*/function (_Component) {
|
|
|
553
558
|
"data-test": "label",
|
|
554
559
|
$withUnderline: appearance === 'navigation'
|
|
555
560
|
}, icon && /*#__PURE__*/external_react_default.a.createElement(StyledIcon, {
|
|
556
|
-
$iconSize:
|
|
561
|
+
$iconSize: iconSizeValue
|
|
557
562
|
}, icon), label, (count === 0 || count) && /*#__PURE__*/external_react_default.a.createElement(StyledCount, {
|
|
558
563
|
"data-test": "count",
|
|
559
|
-
disabled:
|
|
564
|
+
disabled: disabledValue
|
|
560
565
|
}, count)), /*#__PURE__*/external_react_default.a.createElement(StyledUnderline, {
|
|
561
|
-
$layout:
|
|
566
|
+
$layout: layoutValue,
|
|
562
567
|
$withUnderline: appearance === 'navigation'
|
|
563
568
|
}), !disabled && tooltip && /*#__PURE__*/external_react_default.a.createElement(Popover_default.a, {
|
|
564
569
|
anchor: anchor,
|
|
565
570
|
appearance: "inverted",
|
|
566
571
|
closeReasons: [],
|
|
567
|
-
defaultPlacement:
|
|
572
|
+
defaultPlacement: layoutValue === 'vertical' ? 'right' : 'above',
|
|
568
573
|
id: this.popoverId,
|
|
569
574
|
open: !!anchor && open
|
|
570
575
|
}, /*#__PURE__*/external_react_default.a.createElement(StyledTooltipContent, null, tooltip)), tooltip && /*#__PURE__*/external_react_default.a.createElement(ScreenReaderContent_default.a, null, tooltip));
|
|
@@ -578,6 +583,8 @@ _defineProperty(Tab_Tab, "propTypes", propTypes);
|
|
|
578
583
|
|
|
579
584
|
_defineProperty(Tab_Tab, "defaultProps", defaultProps);
|
|
580
585
|
|
|
586
|
+
_defineProperty(Tab_Tab, "contextType", TabBar_TabBarContext);
|
|
587
|
+
|
|
581
588
|
/* harmony default export */ var TabBar_Tab = (Tab_Tab);
|
|
582
589
|
// CONCATENATED MODULE: ./src/TabBar/TabBar.tsx
|
|
583
590
|
function TabBar_extends() { TabBar_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return TabBar_extends.apply(this, arguments); }
|
|
@@ -591,6 +598,7 @@ function TabBar_objectWithoutPropertiesLoose(source, excluded) { if (source == n
|
|
|
591
598
|
|
|
592
599
|
|
|
593
600
|
|
|
601
|
+
|
|
594
602
|
var minTabWidth = 50;
|
|
595
603
|
/** @public */
|
|
596
604
|
|
|
@@ -627,7 +635,7 @@ function TabBar(_ref) {
|
|
|
627
635
|
otherProps = TabBar_objectWithoutProperties(_ref, ["activeTabId", "autoActivate", "appearance", "children", "disabled", "elementRef", "iconSize", "layout", "onChange", "tabWidth"]);
|
|
628
636
|
|
|
629
637
|
// @docs-props-type TabBarPropsBase
|
|
630
|
-
var
|
|
638
|
+
var focusedTabIndex = Object(external_react_["useRef"])(0);
|
|
631
639
|
var tabRefs = [];
|
|
632
640
|
var nextTabKey = Object(external_react_["useMemo"])(function () {
|
|
633
641
|
return layout === 'vertical' ? 'down' : 'right';
|
|
@@ -640,7 +648,7 @@ function TabBar(_ref) {
|
|
|
640
648
|
var tabKey = data.tabKey;
|
|
641
649
|
|
|
642
650
|
if (tabKey != null) {
|
|
643
|
-
|
|
651
|
+
focusedTabIndex.current = tabKey;
|
|
644
652
|
}
|
|
645
653
|
|
|
646
654
|
if (autoActivate) {
|
|
@@ -667,21 +675,65 @@ function TabBar(_ref) {
|
|
|
667
675
|
tabRefs.push(ref);
|
|
668
676
|
var childProps = {
|
|
669
677
|
active: activeTabId === child.props.tabId,
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
iconSize: iconSize,
|
|
673
|
-
layout: layout,
|
|
674
|
-
onClick: tabOnClick,
|
|
675
|
-
onFocus: tabOnFocus,
|
|
676
|
-
ref: ref,
|
|
677
|
-
style: tabWidth && tabWidth > minTabWidth ? {
|
|
678
|
-
width: tabWidth
|
|
679
|
-
} : child.props.style,
|
|
680
|
-
tabKey: tabKeyCounter
|
|
678
|
+
tabKey: tabKeyCounter,
|
|
679
|
+
ref: ref
|
|
681
680
|
};
|
|
682
681
|
tabKeyCounter += 1;
|
|
683
682
|
return /*#__PURE__*/Object(external_react_["cloneElement"])(child, childProps);
|
|
684
683
|
});
|
|
684
|
+
var widthContext = tabWidth && tabWidth > minTabWidth ? tabWidth : null;
|
|
685
|
+
|
|
686
|
+
var handleOnKeyDown = function handleOnKeyDown(e) {
|
|
687
|
+
var key = Object(keyboard_["keycode"])(e.nativeEvent);
|
|
688
|
+
var tabToFocusRef;
|
|
689
|
+
|
|
690
|
+
function checkNextTab(nextTabIndex) {
|
|
691
|
+
for (var i = 0; i < tabRefs.length; i += 1) {
|
|
692
|
+
var _tabRefs$pointer$curr;
|
|
693
|
+
|
|
694
|
+
var pointer = (i + nextTabIndex) % tabRefs.length;
|
|
695
|
+
|
|
696
|
+
if (((_tabRefs$pointer$curr = tabRefs[pointer].current) === null || _tabRefs$pointer$curr === void 0 ? void 0 : _tabRefs$pointer$curr.props.disabled) !== true) {
|
|
697
|
+
return tabRefs[pointer];
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
return tabRefs[focusedTabIndex.current];
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
function checkPrevTab(prevTabIndex) {
|
|
705
|
+
for (var i = tabRefs.length; i > 0; i -= 1) {
|
|
706
|
+
var _tabRefs$pointer$curr2;
|
|
707
|
+
|
|
708
|
+
var pointer = (i + prevTabIndex) % tabRefs.length;
|
|
709
|
+
|
|
710
|
+
if (((_tabRefs$pointer$curr2 = tabRefs[pointer].current) === null || _tabRefs$pointer$curr2 === void 0 ? void 0 : _tabRefs$pointer$curr2.props.disabled) !== true) {
|
|
711
|
+
return tabRefs[pointer];
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
return tabRefs[focusedTabIndex.current];
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
if (key === nextTabKey) {
|
|
719
|
+
tabToFocusRef = checkNextTab(focusedTabIndex.current + 1);
|
|
720
|
+
} else if (key === previousTabKey) {
|
|
721
|
+
tabToFocusRef = checkPrevTab(focusedTabIndex.current - 1);
|
|
722
|
+
} else if (key === 'home') {
|
|
723
|
+
// eslint-disable-next-line prefer-destructuring
|
|
724
|
+
tabToFocusRef = checkNextTab(0);
|
|
725
|
+
} else if (key === 'end') {
|
|
726
|
+
tabToFocusRef = checkNextTab(tabRefs.length - 1);
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
if (tabToFocusRef != null) {
|
|
730
|
+
var _tabToFocusRef$curren;
|
|
731
|
+
|
|
732
|
+
(_tabToFocusRef$curren = tabToFocusRef.current) === null || _tabToFocusRef$curren === void 0 ? void 0 : _tabToFocusRef$curren.focus();
|
|
733
|
+
e.preventDefault();
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
|
|
685
737
|
return /*#__PURE__*/external_react_default.a.createElement(Styled, TabBar_extends({
|
|
686
738
|
"data-tab-layout": layout,
|
|
687
739
|
"data-test-active-tab-id": activeTabId,
|
|
@@ -690,29 +742,18 @@ function TabBar(_ref) {
|
|
|
690
742
|
ref: elementRef,
|
|
691
743
|
$layout: layout,
|
|
692
744
|
$withUnderline: appearance === 'navigation',
|
|
693
|
-
onKeyDown:
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
tabToFocusRef = tabRefs[0];
|
|
704
|
-
} else if (key === 'end') {
|
|
705
|
-
tabToFocusRef = tabRefs[tabRefs.length - 1];
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
if (tabToFocusRef != null) {
|
|
709
|
-
var _tabToFocusRef$curren;
|
|
710
|
-
|
|
711
|
-
(_tabToFocusRef$curren = tabToFocusRef.current) === null || _tabToFocusRef$curren === void 0 ? void 0 : _tabToFocusRef$curren.focus();
|
|
712
|
-
e.preventDefault();
|
|
713
|
-
}
|
|
745
|
+
onKeyDown: handleOnKeyDown
|
|
746
|
+
}, otherProps), /*#__PURE__*/external_react_default.a.createElement(TabBar_TabBarContext.Provider, {
|
|
747
|
+
value: {
|
|
748
|
+
appearance: appearance,
|
|
749
|
+
disabled: disabled,
|
|
750
|
+
iconSize: iconSize,
|
|
751
|
+
layout: layout,
|
|
752
|
+
onClick: tabOnClick,
|
|
753
|
+
onFocus: tabOnFocus,
|
|
754
|
+
width: widthContext
|
|
714
755
|
}
|
|
715
|
-
},
|
|
756
|
+
}, clonedChildren));
|
|
716
757
|
}
|
|
717
758
|
|
|
718
759
|
TabBar.propTypes = TabBar_propTypes;
|
|
@@ -725,14 +766,14 @@ TabBar.Tab = TabBar_Tab;
|
|
|
725
766
|
|
|
726
767
|
/***/ }),
|
|
727
768
|
|
|
728
|
-
/***/
|
|
769
|
+
/***/ 15:
|
|
729
770
|
/***/ (function(module, exports) {
|
|
730
771
|
|
|
731
772
|
module.exports = require("@splunk/react-ui/ScreenReaderContent");
|
|
732
773
|
|
|
733
774
|
/***/ }),
|
|
734
775
|
|
|
735
|
-
/***/
|
|
776
|
+
/***/ 16:
|
|
736
777
|
/***/ (function(module, exports) {
|
|
737
778
|
|
|
738
779
|
module.exports = require("@splunk/react-ui/Popover");
|
package/TabLayout.js
CHANGED
|
@@ -82,7 +82,7 @@ module.exports =
|
|
|
82
82
|
/******/
|
|
83
83
|
/******/
|
|
84
84
|
/******/ // Load entry module and return exports
|
|
85
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 141);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
@@ -108,7 +108,7 @@ module.exports = require("@splunk/ui-utils/id");
|
|
|
108
108
|
|
|
109
109
|
/***/ }),
|
|
110
110
|
|
|
111
|
-
/***/
|
|
111
|
+
/***/ 141:
|
|
112
112
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
113
113
|
|
|
114
114
|
"use strict";
|
|
@@ -134,7 +134,7 @@ var external_lodash_ = __webpack_require__(4);
|
|
|
134
134
|
var id_ = __webpack_require__(10);
|
|
135
135
|
|
|
136
136
|
// EXTERNAL MODULE: external "@splunk/react-ui/TabBar"
|
|
137
|
-
var TabBar_ = __webpack_require__(
|
|
137
|
+
var TabBar_ = __webpack_require__(73);
|
|
138
138
|
var TabBar_default = /*#__PURE__*/__webpack_require__.n(TabBar_);
|
|
139
139
|
|
|
140
140
|
// EXTERNAL MODULE: external "styled-components"
|
|
@@ -337,7 +337,6 @@ var TabLayout_TabLayout = /*#__PURE__*/function (_Component) {
|
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
return /*#__PURE__*/external_react_default.a.createElement(TabBar_default.a.Tab, {
|
|
340
|
-
appearance: _this2.props.appearance,
|
|
341
340
|
icon: props.icon,
|
|
342
341
|
key: props.panelId,
|
|
343
342
|
label: props.label,
|
|
@@ -406,7 +405,7 @@ module.exports = require("lodash");
|
|
|
406
405
|
|
|
407
406
|
/***/ }),
|
|
408
407
|
|
|
409
|
-
/***/
|
|
408
|
+
/***/ 73:
|
|
410
409
|
/***/ (function(module, exports) {
|
|
411
410
|
|
|
412
411
|
module.exports = require("@splunk/react-ui/TabBar");
|