@targetprocess/tabs 12.19.1-alpha.0 → 12.19.2-alpha.2
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/ShowMore.jsx +17 -23
- package/TabInner.jsx +5 -0
- package/Tabs.jsx +10 -3
- package/dist/tabs.es.js +217 -17
- package/dist/tabs.js +217 -17
- package/package.json +5 -4
- package/style/index.css +5 -0
package/ShowMore.jsx
CHANGED
|
@@ -99,11 +99,6 @@ export default class ShowMore extends React.Component {
|
|
|
99
99
|
|
|
100
100
|
const isListHidden = isHidden
|
|
101
101
|
|
|
102
|
-
const showMoreStyles = classNames(
|
|
103
|
-
styles['tabs__header__tabs__showmore'],
|
|
104
|
-
hasChildSelected && styles['tabs__header__tabs__showmore--selected']
|
|
105
|
-
)
|
|
106
|
-
|
|
107
102
|
const listStyles = classNames(
|
|
108
103
|
styles['tabs__header__tabs__showmore-menu'],
|
|
109
104
|
!isListHidden && styles['tabs__header__tabs__showmore-menu--opened'],
|
|
@@ -125,32 +120,31 @@ export default class ShowMore extends React.Component {
|
|
|
125
120
|
isOpen={!isListHidden}
|
|
126
121
|
onOuterAction={this.close}
|
|
127
122
|
body={
|
|
128
|
-
<div className={listStyles} aria-hidden={isListHidden} role="
|
|
123
|
+
<div className={listStyles} aria-hidden={isListHidden} role="tablist">
|
|
129
124
|
{children}
|
|
130
125
|
</div>
|
|
131
126
|
}
|
|
132
127
|
>
|
|
133
|
-
<div
|
|
134
|
-
|
|
128
|
+
<div
|
|
129
|
+
className={styles.tabs__header__tabs__showmore__wrapper}
|
|
130
|
+
role="tab"
|
|
131
|
+
aria-label="More tabs"
|
|
132
|
+
>
|
|
133
|
+
<Button
|
|
135
134
|
ref={onShowMoreChanged}
|
|
136
|
-
className={showMoreStyles}
|
|
137
|
-
role="navigation"
|
|
138
|
-
tabIndex="0"
|
|
139
135
|
onFocus={this.onFocus}
|
|
136
|
+
role="navigation"
|
|
140
137
|
onBlur={this.onBlur}
|
|
141
138
|
onClick={this.toggleVisibility}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
isWide
|
|
152
|
-
/>
|
|
153
|
-
</div>
|
|
139
|
+
checked={!isListHidden}
|
|
140
|
+
className={showMoreLabelStyles}
|
|
141
|
+
icon={<ChevronIcon />}
|
|
142
|
+
kind="default"
|
|
143
|
+
size="L"
|
|
144
|
+
data-title="More tabs"
|
|
145
|
+
noBackground
|
|
146
|
+
isWide
|
|
147
|
+
/>
|
|
154
148
|
</div>
|
|
155
149
|
</Popover>
|
|
156
150
|
)
|
package/TabInner.jsx
CHANGED
|
@@ -33,6 +33,11 @@ export default class TabInner extends React.Component {
|
|
|
33
33
|
this.props.classNames !== nextProps.classNames
|
|
34
34
|
)
|
|
35
35
|
}
|
|
36
|
+
componentDidMount() {
|
|
37
|
+
if (this.props.firstElement) {
|
|
38
|
+
this.tab.focus()
|
|
39
|
+
}
|
|
40
|
+
}
|
|
36
41
|
|
|
37
42
|
blurHandler = () => {
|
|
38
43
|
window.requestAnimationFrame(() => {
|
package/Tabs.jsx
CHANGED
|
@@ -9,9 +9,11 @@ import styles from './style/index.css'
|
|
|
9
9
|
import {debounce} from '../../base/utils/debounce'
|
|
10
10
|
import {TabsPrint} from './TabsPrint'
|
|
11
11
|
import {showMorePopoverProps} from './shared-proptype'
|
|
12
|
+
import _uniqueId from 'lodash/uniqueId'
|
|
12
13
|
|
|
13
14
|
const tabPrefix = 'tab-'
|
|
14
15
|
const panelPrefix = 'panel-'
|
|
16
|
+
const tablistPrefix = 'tablist-'
|
|
15
17
|
|
|
16
18
|
// By itself, Tab is just a dummy component that is used for a cleaner Tabs API
|
|
17
19
|
// and as marker for actual tabs to prevent storing them as huge array
|
|
@@ -34,7 +36,7 @@ Tab.propTypes = {
|
|
|
34
36
|
*
|
|
35
37
|
* Top-level `<Tabs />` can work in either controlled or uncontrolled mode.
|
|
36
38
|
* In controlled mode, it uses `initialActiveTabId` to determine which
|
|
37
|
-
* tab is open by default, and then
|
|
39
|
+
* tab is open by default, and then manually manageschanging tabs
|
|
38
40
|
* on appropriate header clicks.
|
|
39
41
|
* In uncontrolled mode, it uses `activeTabId` prop to determine which tab
|
|
40
42
|
* is open and exposes `onActiveTabChanged` callback that is invoked each time
|
|
@@ -74,6 +76,8 @@ export class Tabs extends React.Component {
|
|
|
74
76
|
cacheOpenedTabs: false
|
|
75
77
|
}
|
|
76
78
|
|
|
79
|
+
tablistId = _uniqueId(tablistPrefix)
|
|
80
|
+
|
|
77
81
|
tabRefs = new Map()
|
|
78
82
|
|
|
79
83
|
activeTabElement = null
|
|
@@ -432,11 +436,14 @@ export class Tabs extends React.Component {
|
|
|
432
436
|
ref={tabs => (this.tabsWrapper = tabs)}
|
|
433
437
|
onKeyDown={this.onKeyDown}
|
|
434
438
|
className={styles.tabs__header__container}
|
|
439
|
+
role="tablist"
|
|
440
|
+
aria-labelledby={this.tablistId}
|
|
435
441
|
>
|
|
436
442
|
{this.props.title ? (
|
|
437
443
|
<div
|
|
438
444
|
className={styles.tabs__header__title}
|
|
439
445
|
ref={titleWrapper => (this.titleWrapper = titleWrapper)}
|
|
446
|
+
id={this.tablistId}
|
|
440
447
|
>
|
|
441
448
|
{this.props.title}
|
|
442
449
|
</div>
|
|
@@ -449,8 +456,8 @@ export class Tabs extends React.Component {
|
|
|
449
456
|
showMorePopoverClassName={this.props.showMorePopoverClassName}
|
|
450
457
|
showMorePopoverProps={this.props.showMorePopoverProps}
|
|
451
458
|
>
|
|
452
|
-
{tabsHidden.map(tab => (
|
|
453
|
-
<TabInner {...this.getTabProps(tab)} />
|
|
459
|
+
{tabsHidden.map((tab, index) => (
|
|
460
|
+
<TabInner firstElement={index === 0} {...this.getTabProps(tab)} />
|
|
454
461
|
))}
|
|
455
462
|
</ShowMore>
|
|
456
463
|
</div>
|
package/dist/tabs.es.js
CHANGED
|
@@ -33,6 +33,15 @@ function _iterableToArrayLimit(r, l) {
|
|
|
33
33
|
return a;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
function _typeof(o) {
|
|
37
|
+
"@babel/helpers - typeof";
|
|
38
|
+
|
|
39
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
40
|
+
return typeof o;
|
|
41
|
+
} : function (o) {
|
|
42
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
43
|
+
}, _typeof(o);
|
|
44
|
+
}
|
|
36
45
|
function _classCallCheck(instance, Constructor) {
|
|
37
46
|
if (!(instance instanceof Constructor)) {
|
|
38
47
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -190,8 +199,8 @@ function styleInject(css, ref) {
|
|
|
190
199
|
}
|
|
191
200
|
}
|
|
192
201
|
|
|
193
|
-
var css = ".tabs__header__tabs__12-19-
|
|
194
|
-
var styles = {"tabs__header":"tabs__header__tabs__12-19-
|
|
202
|
+
var css = ".tabs__header__tabs__12-19-2-alpha-2 {\r\n font-size: var(--FontSizeDefault, 13px);\r\n line-height: 1.23;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-orient: vertical;\r\n -webkit-box-direction: normal;\r\n -ms-flex-direction: column;\r\n flex-direction: column;\r\n }\r\n\r\n .tabs__header__title__tabs__12-19-2-alpha-2 {\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n padding-right: var(--SpaceSM, 12px);\r\n }\r\n\r\n .tabs__header__container__tabs__12-19-2-alpha-2 {\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n position: relative;\r\n }\r\n\r\n .tabs__header__line__tabs__12-19-2-alpha-2 {\r\n height: 1px;\r\n position: relative;\r\n background-color: var(--ControlBorderColorDefault, rgba(64, 66, 73, 0.2));\r\n }\r\n\r\n .tabs__header__line__slider__tabs__12-19-2-alpha-2 {\r\n height: 1px;\r\n position: absolute;\r\n background-color: var(--DrBlack, #000000);\r\n -webkit-transition: left 0.3s, width 0.3s, right 0.3s, width 0.3s;\r\n transition: left 0.3s, width 0.3s, right 0.3s, width 0.3s;\r\n }\r\n\r\n .tabs__header__tab-item__tabs__12-19-2-alpha-2 {\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n font-weight: var(--FontWeightSemibold, 600);\r\n color: var(--FontColorLightGray, rgba(0, 0, 0, 0.4));\r\n cursor: pointer;\r\n outline: none;\r\n white-space: nowrap;\r\n padding: var(--SpaceS, 8px);\r\n }\r\n\r\n .tabs__header__tab-item__tabs__12-19-2-alpha-2:first-child {\r\n padding-left: 0;\r\n }\r\n\r\n .tabs__header__tab-item__tabs__12-19-2-alpha-2:not(:first-child) {\r\n padding-left: var(--SpaceSM, 12px);\r\n }\r\n\r\n .tabs__header__tab-item__tabs__12-19-2-alpha-2:not(:last-child) {\r\n padding-right: var(--SpaceSM, 12px);\r\n }\r\n\r\n .tabs__header__tab-item__tabs__12-19-2-alpha-2:hover,\r\n .tabs__header__tab-item--active__tabs__12-19-2-alpha-2 {\r\n color: var(--DrBlack, #000000);\r\n }\r\n\r\n .tabs__header__tab-item__tabs__12-19-2-alpha-2:focus {\r\n outline: 0;\r\n border-radius: 1px;\r\n -webkit-box-shadow: var(--ControlBoxShadowFocusDefault, 0 0 0 3px rgba(0, 126, 255, 0.2));\r\n box-shadow: var(--ControlBoxShadowFocusDefault, 0 0 0 3px rgba(0, 126, 255, 0.2));\r\n }\r\n\r\n .tabs__header__tab-item--disabled__tabs__12-19-2-alpha-2 {\r\n color: var(--FontColorLightGray, rgba(0, 0, 0, 0.4));\r\n cursor: default;\r\n }\r\n\r\n .tabs__header__tabs__showmore__wrapper__tabs__12-19-2-alpha-2 {\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n width: 100%;\r\n height: 100%;\r\n }\r\n\r\n .tabs__header__tabs__showmore__tabs__12-19-2-alpha-2 {\r\n padding: 0;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n outline: none;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n cursor: pointer;\r\n white-space: nowrap;\r\n position: relative;\r\n width: var(--ControlHeightLarge, 28px);\r\n }\r\n\r\n .tabs__header__tabs__showmore__label__tabs__12-19-2-alpha-2 {\r\n border-radius: var(--BorderRadiusDefault, 3px);\r\n width: var(--ControlHeightLarge, 28px);\r\n height: var(--ControlHeightLarge, 28px);\r\n z-index: 1;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-flex: 1;\r\n -ms-flex: 1 0 auto;\r\n flex: 1 0 auto;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-pack: center;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n }\r\n\r\n .tabs__header__tabs__showmore__label__tabs__12-19-2-alpha-2:hover {\r\n background-color: var(--ButtonBackgroundHover, #ECECED);\r\n }\r\n\r\n .tabs__header__tabs__showmore__label--selected__tabs__12-19-2-alpha-2 svg * {\r\n fill: var(--DrBlack, #000000);\r\n }\r\n\r\n .tabs__header__tabs__showmore-menu__tabs__12-19-2-alpha-2 {\r\n outline: none;\r\n -webkit-box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n border-radius: var(--BorderRadiusL, 4px);\r\n position: absolute;\r\n right: 0;\r\n padding: var(--SpaceXS, 4px) 0;\r\n left: auto;\r\n top: calc(100% + var(--SpaceXS, 4px)/2);\r\n bottom: auto;\r\n z-index: 11;\r\n background: var(--MrWhite, #FFFFFF);\r\n display: none;\r\n }\r\n\r\n .tabs__header__tabs__showmore-menu--opened__tabs__12-19-2-alpha-2 {\r\n display: block;\r\n }\r\n\r\n .tabs__header__tabs__showmore-menu__tabs__12-19-2-alpha-2 .tabs__header__tab-item__tabs__12-19-2-alpha-2 {\r\n padding: var(--SpaceS, 8px) var(--SpaceSM, 12px);\r\n }\r\n\r\n .tabs__header__tabs__showmore-menu__tabs__12-19-2-alpha-2 .tabs__header__tab-item__tabs__12-19-2-alpha-2:hover:not(.tabs__header__tab-item--active__tabs__12-19-2-alpha-2) {\r\n background: var(--Active100, #FCF5DB);\r\n }\r\n\r\n .tabs__header__tabs__showmore-menu__tabs__12-19-2-alpha-2 .tabs__header__tab-item--active__tabs__12-19-2-alpha-2 {\r\n background: var(--Active300, #F7E292);\r\n }\r\n";
|
|
203
|
+
var styles = {"tabs__header":"tabs__header__tabs__12-19-2-alpha-2","tabs__header__title":"tabs__header__title__tabs__12-19-2-alpha-2","tabs__header__container":"tabs__header__container__tabs__12-19-2-alpha-2","tabs__header__line":"tabs__header__line__tabs__12-19-2-alpha-2","tabs__header__line__slider":"tabs__header__line__slider__tabs__12-19-2-alpha-2","tabs__header__tab-item":"tabs__header__tab-item__tabs__12-19-2-alpha-2","tabs__header__tab-item--active":"tabs__header__tab-item--active__tabs__12-19-2-alpha-2","tabs__header__tab-item--disabled":"tabs__header__tab-item--disabled__tabs__12-19-2-alpha-2","tabs__header__tabs__showmore__wrapper":"tabs__header__tabs__showmore__wrapper__tabs__12-19-2-alpha-2","tabs__header__tabs__showmore":"tabs__header__tabs__showmore__tabs__12-19-2-alpha-2","tabs__header__tabs__showmore__label":"tabs__header__tabs__showmore__label__tabs__12-19-2-alpha-2","tabs__header__tabs__showmore__label--selected":"tabs__header__tabs__showmore__label--selected__tabs__12-19-2-alpha-2","tabs__header__tabs__showmore-menu":"tabs__header__tabs__showmore-menu__tabs__12-19-2-alpha-2","tabs__header__tabs__showmore-menu--opened":"tabs__header__tabs__showmore-menu--opened__tabs__12-19-2-alpha-2"};
|
|
195
204
|
styleInject(css);
|
|
196
205
|
|
|
197
206
|
/* should be the same for Popover, all props are cut after build, so we needed to copy them */
|
|
@@ -302,7 +311,6 @@ var ShowMore = /*#__PURE__*/function (_React$Component) {
|
|
|
302
311
|
return null;
|
|
303
312
|
}
|
|
304
313
|
var isListHidden = isHidden;
|
|
305
|
-
var showMoreStyles = classNames(styles['tabs__header__tabs__showmore'], hasChildSelected && styles['tabs__header__tabs__showmore--selected']);
|
|
306
314
|
var listStyles = classNames(styles['tabs__header__tabs__showmore-menu'], !isListHidden && styles['tabs__header__tabs__showmore-menu--opened'], this.props.showMorePopoverClassName);
|
|
307
315
|
var showMoreLabelStyles = classNames(styles['tabs__header__tabs__showmore__label'], hasChildSelected && styles['tabs__header__tabs__showmore__label--selected'], !isListHidden && styles['tabs__header__tabs__showmore__label--selected']);
|
|
308
316
|
return React.createElement(Popover, _extends({}, this.getShowMorePopoverProps(), {
|
|
@@ -314,19 +322,18 @@ var ShowMore = /*#__PURE__*/function (_React$Component) {
|
|
|
314
322
|
body: React.createElement("div", {
|
|
315
323
|
className: listStyles,
|
|
316
324
|
"aria-hidden": isListHidden,
|
|
317
|
-
role: "
|
|
325
|
+
role: "tablist"
|
|
318
326
|
}, children)
|
|
319
327
|
}), React.createElement("div", {
|
|
320
|
-
className: styles.tabs__header__tabs__showmore__wrapper
|
|
321
|
-
|
|
328
|
+
className: styles.tabs__header__tabs__showmore__wrapper,
|
|
329
|
+
role: "tab",
|
|
330
|
+
"aria-label": "More tabs"
|
|
331
|
+
}, React.createElement(Button, {
|
|
322
332
|
ref: onShowMoreChanged,
|
|
323
|
-
className: showMoreStyles,
|
|
324
|
-
role: "navigation",
|
|
325
|
-
tabIndex: "0",
|
|
326
333
|
onFocus: this.onFocus,
|
|
334
|
+
role: "navigation",
|
|
327
335
|
onBlur: this.onBlur,
|
|
328
|
-
onClick: this.toggleVisibility
|
|
329
|
-
}, React.createElement(Button, {
|
|
336
|
+
onClick: this.toggleVisibility,
|
|
330
337
|
checked: !isListHidden,
|
|
331
338
|
className: showMoreLabelStyles,
|
|
332
339
|
icon: React.createElement(ChevronIcon, null),
|
|
@@ -335,7 +342,7 @@ var ShowMore = /*#__PURE__*/function (_React$Component) {
|
|
|
335
342
|
"data-title": "More tabs",
|
|
336
343
|
noBackground: true,
|
|
337
344
|
isWide: true
|
|
338
|
-
})))
|
|
345
|
+
})));
|
|
339
346
|
}
|
|
340
347
|
}]);
|
|
341
348
|
return ShowMore;
|
|
@@ -398,6 +405,13 @@ var TabInner = /*#__PURE__*/function (_React$Component) {
|
|
|
398
405
|
value: function shouldComponentUpdate(nextProps) {
|
|
399
406
|
return this.props.children !== nextProps.children || this.props.selected !== nextProps.selected || this.props.classNames !== nextProps.classNames;
|
|
400
407
|
}
|
|
408
|
+
}, {
|
|
409
|
+
key: "componentDidMount",
|
|
410
|
+
value: function componentDidMount() {
|
|
411
|
+
if (this.props.firstElement) {
|
|
412
|
+
this.tab.focus();
|
|
413
|
+
}
|
|
414
|
+
}
|
|
401
415
|
}, {
|
|
402
416
|
key: "render",
|
|
403
417
|
value: function render() {
|
|
@@ -547,8 +561,188 @@ var TabsPrint = function TabsPrint(props) {
|
|
|
547
561
|
}));
|
|
548
562
|
};
|
|
549
563
|
|
|
564
|
+
var freeGlobal = require('./_freeGlobal');
|
|
565
|
+
|
|
566
|
+
/** Detect free variable `self`. */
|
|
567
|
+
var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof(self)) == 'object' && self && self.Object === Object && self;
|
|
568
|
+
|
|
569
|
+
/** Used as a reference to the global object. */
|
|
570
|
+
var root = freeGlobal || freeSelf || Function('return this')();
|
|
571
|
+
module.exports = root;
|
|
572
|
+
|
|
573
|
+
var _root = /*#__PURE__*/Object.freeze({
|
|
574
|
+
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
/** Built-in value references. */
|
|
578
|
+
var _Symbol = _root.Symbol;
|
|
579
|
+
var _Symbol_1 = _Symbol;
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* A specialized version of `_.map` for arrays without support for iteratee
|
|
583
|
+
* shorthands.
|
|
584
|
+
*
|
|
585
|
+
* @private
|
|
586
|
+
* @param {Array} [array] The array to iterate over.
|
|
587
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
588
|
+
* @returns {Array} Returns the new mapped array.
|
|
589
|
+
*/
|
|
590
|
+
function arrayMap(array, iteratee) {
|
|
591
|
+
var index = -1,
|
|
592
|
+
length = array == null ? 0 : array.length,
|
|
593
|
+
result = Array(length);
|
|
594
|
+
while (++index < length) {
|
|
595
|
+
result[index] = iteratee(array[index], index, array);
|
|
596
|
+
}
|
|
597
|
+
return result;
|
|
598
|
+
}
|
|
599
|
+
var _arrayMap = arrayMap;
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Checks if `value` is classified as an `Array` object.
|
|
603
|
+
*
|
|
604
|
+
* @static
|
|
605
|
+
* @memberOf _
|
|
606
|
+
* @since 0.1.0
|
|
607
|
+
* @category Lang
|
|
608
|
+
* @param {*} value The value to check.
|
|
609
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
610
|
+
* @example
|
|
611
|
+
*
|
|
612
|
+
* _.isArray([1, 2, 3]);
|
|
613
|
+
* // => true
|
|
614
|
+
*
|
|
615
|
+
* _.isArray(document.body.children);
|
|
616
|
+
* // => false
|
|
617
|
+
*
|
|
618
|
+
* _.isArray('abc');
|
|
619
|
+
* // => false
|
|
620
|
+
*
|
|
621
|
+
* _.isArray(_.noop);
|
|
622
|
+
* // => false
|
|
623
|
+
*/
|
|
624
|
+
var isArray = Array.isArray;
|
|
625
|
+
var isArray_1 = isArray;
|
|
626
|
+
|
|
627
|
+
var baseGetTag = require('./_baseGetTag'),
|
|
628
|
+
isObjectLike = require('./isObjectLike');
|
|
629
|
+
|
|
630
|
+
/** `Object#toString` result references. */
|
|
631
|
+
var symbolTag = '[object Symbol]';
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
635
|
+
*
|
|
636
|
+
* @static
|
|
637
|
+
* @memberOf _
|
|
638
|
+
* @since 4.0.0
|
|
639
|
+
* @category Lang
|
|
640
|
+
* @param {*} value The value to check.
|
|
641
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
642
|
+
* @example
|
|
643
|
+
*
|
|
644
|
+
* _.isSymbol(Symbol.iterator);
|
|
645
|
+
* // => true
|
|
646
|
+
*
|
|
647
|
+
* _.isSymbol('abc');
|
|
648
|
+
* // => false
|
|
649
|
+
*/
|
|
650
|
+
function isSymbol(value) {
|
|
651
|
+
return _typeof(value) == 'symbol' || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
652
|
+
}
|
|
653
|
+
module.exports = isSymbol;
|
|
654
|
+
|
|
655
|
+
var isSymbol$1 = /*#__PURE__*/Object.freeze({
|
|
656
|
+
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
/** Used as references for various `Number` constants. */
|
|
660
|
+
var INFINITY = 1 / 0;
|
|
661
|
+
|
|
662
|
+
/** Used to convert symbols to primitives and strings. */
|
|
663
|
+
var symbolProto = _Symbol_1 ? _Symbol_1.prototype : undefined,
|
|
664
|
+
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* The base implementation of `_.toString` which doesn't convert nullish
|
|
668
|
+
* values to empty strings.
|
|
669
|
+
*
|
|
670
|
+
* @private
|
|
671
|
+
* @param {*} value The value to process.
|
|
672
|
+
* @returns {string} Returns the string.
|
|
673
|
+
*/
|
|
674
|
+
function baseToString(value) {
|
|
675
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
|
676
|
+
if (typeof value == 'string') {
|
|
677
|
+
return value;
|
|
678
|
+
}
|
|
679
|
+
if (isArray_1(value)) {
|
|
680
|
+
// Recursively convert values (susceptible to call stack limits).
|
|
681
|
+
return _arrayMap(value, baseToString) + '';
|
|
682
|
+
}
|
|
683
|
+
if (isSymbol$1(value)) {
|
|
684
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
685
|
+
}
|
|
686
|
+
var result = value + '';
|
|
687
|
+
return result == '0' && 1 / value == -INFINITY ? '-0' : result;
|
|
688
|
+
}
|
|
689
|
+
var _baseToString = baseToString;
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
|
693
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
|
694
|
+
*
|
|
695
|
+
* @static
|
|
696
|
+
* @memberOf _
|
|
697
|
+
* @since 4.0.0
|
|
698
|
+
* @category Lang
|
|
699
|
+
* @param {*} value The value to convert.
|
|
700
|
+
* @returns {string} Returns the converted string.
|
|
701
|
+
* @example
|
|
702
|
+
*
|
|
703
|
+
* _.toString(null);
|
|
704
|
+
* // => ''
|
|
705
|
+
*
|
|
706
|
+
* _.toString(-0);
|
|
707
|
+
* // => '-0'
|
|
708
|
+
*
|
|
709
|
+
* _.toString([1, 2, 3]);
|
|
710
|
+
* // => '1,2,3'
|
|
711
|
+
*/
|
|
712
|
+
function toString(value) {
|
|
713
|
+
return value == null ? '' : _baseToString(value);
|
|
714
|
+
}
|
|
715
|
+
var toString_1 = toString;
|
|
716
|
+
|
|
717
|
+
/** Used to generate unique IDs. */
|
|
718
|
+
var idCounter = 0;
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Generates a unique ID. If `prefix` is given, the ID is appended to it.
|
|
722
|
+
*
|
|
723
|
+
* @static
|
|
724
|
+
* @since 0.1.0
|
|
725
|
+
* @memberOf _
|
|
726
|
+
* @category Util
|
|
727
|
+
* @param {string} [prefix=''] The value to prefix the ID with.
|
|
728
|
+
* @returns {string} Returns the unique ID.
|
|
729
|
+
* @example
|
|
730
|
+
*
|
|
731
|
+
* _.uniqueId('contact_');
|
|
732
|
+
* // => 'contact_104'
|
|
733
|
+
*
|
|
734
|
+
* _.uniqueId();
|
|
735
|
+
* // => '105'
|
|
736
|
+
*/
|
|
737
|
+
function uniqueId(prefix) {
|
|
738
|
+
var id = ++idCounter;
|
|
739
|
+
return toString_1(prefix) + id;
|
|
740
|
+
}
|
|
741
|
+
var uniqueId_1 = uniqueId;
|
|
742
|
+
|
|
550
743
|
var tabPrefix$1 = 'tab-';
|
|
551
744
|
var panelPrefix$1 = 'panel-';
|
|
745
|
+
var tablistPrefix = 'tablist-';
|
|
552
746
|
|
|
553
747
|
// By itself, Tab is just a dummy component that is used for a cleaner Tabs API
|
|
554
748
|
// and as marker for actual tabs to prevent storing them as huge array
|
|
@@ -572,7 +766,7 @@ Tab.propTypes = {
|
|
|
572
766
|
*
|
|
573
767
|
* Top-level `<Tabs />` can work in either controlled or uncontrolled mode.
|
|
574
768
|
* In controlled mode, it uses `initialActiveTabId` to determine which
|
|
575
|
-
* tab is open by default, and then
|
|
769
|
+
* tab is open by default, and then manually manageschanging tabs
|
|
576
770
|
* on appropriate header clicks.
|
|
577
771
|
* In uncontrolled mode, it uses `activeTabId` prop to determine which tab
|
|
578
772
|
* is open and exposes `onActiveTabChanged` callback that is invoked each time
|
|
@@ -594,6 +788,7 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
594
788
|
args[_key] = arguments[_key];
|
|
595
789
|
}
|
|
596
790
|
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Tabs)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
|
791
|
+
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "tablistId", uniqueId_1(tablistPrefix));
|
|
597
792
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "tabRefs", new Map());
|
|
598
793
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "activeTabElement", null);
|
|
599
794
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "titleWrapper", null);
|
|
@@ -940,19 +1135,24 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
940
1135
|
return _this3.tabsWrapper = tabs;
|
|
941
1136
|
},
|
|
942
1137
|
onKeyDown: this.onKeyDown,
|
|
943
|
-
className: styles.tabs__header__container
|
|
1138
|
+
className: styles.tabs__header__container,
|
|
1139
|
+
role: "tablist",
|
|
1140
|
+
"aria-labelledby": this.tablistId
|
|
944
1141
|
}, this.props.title ? React.createElement("div", {
|
|
945
1142
|
className: styles.tabs__header__title,
|
|
946
1143
|
ref: function ref(titleWrapper) {
|
|
947
1144
|
return _this3.titleWrapper = titleWrapper;
|
|
948
|
-
}
|
|
1145
|
+
},
|
|
1146
|
+
id: this.tablistId
|
|
949
1147
|
}, this.props.title) : null, tabsVisible.map(function (tab) {
|
|
950
1148
|
return React.createElement(TabInner, _this3.getTabProps(tab));
|
|
951
1149
|
}), React.createElement(ShowMore, _extends({}, this.getShowMoreProps(isSelectedTabHidden), {
|
|
952
1150
|
showMorePopoverClassName: this.props.showMorePopoverClassName,
|
|
953
1151
|
showMorePopoverProps: this.props.showMorePopoverProps
|
|
954
|
-
}), tabsHidden.map(function (tab) {
|
|
955
|
-
return React.createElement(TabInner,
|
|
1152
|
+
}), tabsHidden.map(function (tab, index) {
|
|
1153
|
+
return React.createElement(TabInner, _extends({
|
|
1154
|
+
firstElement: index === 0
|
|
1155
|
+
}, _this3.getTabProps(tab)));
|
|
956
1156
|
}))), React.createElement("div", {
|
|
957
1157
|
className: styles.tabs__header__line
|
|
958
1158
|
}, React.createElement("div", {
|
package/dist/tabs.js
CHANGED
|
@@ -39,6 +39,15 @@ function _iterableToArrayLimit(r, l) {
|
|
|
39
39
|
return a;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
function _typeof(o) {
|
|
43
|
+
"@babel/helpers - typeof";
|
|
44
|
+
|
|
45
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
46
|
+
return typeof o;
|
|
47
|
+
} : function (o) {
|
|
48
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
49
|
+
}, _typeof(o);
|
|
50
|
+
}
|
|
42
51
|
function _classCallCheck(instance, Constructor) {
|
|
43
52
|
if (!(instance instanceof Constructor)) {
|
|
44
53
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -196,8 +205,8 @@ function styleInject(css, ref) {
|
|
|
196
205
|
}
|
|
197
206
|
}
|
|
198
207
|
|
|
199
|
-
var css = ".tabs__header__tabs__12-19-
|
|
200
|
-
var styles = {"tabs__header":"tabs__header__tabs__12-19-
|
|
208
|
+
var css = ".tabs__header__tabs__12-19-2-alpha-2 {\r\n font-size: var(--FontSizeDefault, 13px);\r\n line-height: 1.23;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-orient: vertical;\r\n -webkit-box-direction: normal;\r\n -ms-flex-direction: column;\r\n flex-direction: column;\r\n }\r\n\r\n .tabs__header__title__tabs__12-19-2-alpha-2 {\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n padding-right: var(--SpaceSM, 12px);\r\n }\r\n\r\n .tabs__header__container__tabs__12-19-2-alpha-2 {\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n position: relative;\r\n }\r\n\r\n .tabs__header__line__tabs__12-19-2-alpha-2 {\r\n height: 1px;\r\n position: relative;\r\n background-color: var(--ControlBorderColorDefault, rgba(64, 66, 73, 0.2));\r\n }\r\n\r\n .tabs__header__line__slider__tabs__12-19-2-alpha-2 {\r\n height: 1px;\r\n position: absolute;\r\n background-color: var(--DrBlack, #000000);\r\n -webkit-transition: left 0.3s, width 0.3s, right 0.3s, width 0.3s;\r\n transition: left 0.3s, width 0.3s, right 0.3s, width 0.3s;\r\n }\r\n\r\n .tabs__header__tab-item__tabs__12-19-2-alpha-2 {\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n font-weight: var(--FontWeightSemibold, 600);\r\n color: var(--FontColorLightGray, rgba(0, 0, 0, 0.4));\r\n cursor: pointer;\r\n outline: none;\r\n white-space: nowrap;\r\n padding: var(--SpaceS, 8px);\r\n }\r\n\r\n .tabs__header__tab-item__tabs__12-19-2-alpha-2:first-child {\r\n padding-left: 0;\r\n }\r\n\r\n .tabs__header__tab-item__tabs__12-19-2-alpha-2:not(:first-child) {\r\n padding-left: var(--SpaceSM, 12px);\r\n }\r\n\r\n .tabs__header__tab-item__tabs__12-19-2-alpha-2:not(:last-child) {\r\n padding-right: var(--SpaceSM, 12px);\r\n }\r\n\r\n .tabs__header__tab-item__tabs__12-19-2-alpha-2:hover,\r\n .tabs__header__tab-item--active__tabs__12-19-2-alpha-2 {\r\n color: var(--DrBlack, #000000);\r\n }\r\n\r\n .tabs__header__tab-item__tabs__12-19-2-alpha-2:focus {\r\n outline: 0;\r\n border-radius: 1px;\r\n -webkit-box-shadow: var(--ControlBoxShadowFocusDefault, 0 0 0 3px rgba(0, 126, 255, 0.2));\r\n box-shadow: var(--ControlBoxShadowFocusDefault, 0 0 0 3px rgba(0, 126, 255, 0.2));\r\n }\r\n\r\n .tabs__header__tab-item--disabled__tabs__12-19-2-alpha-2 {\r\n color: var(--FontColorLightGray, rgba(0, 0, 0, 0.4));\r\n cursor: default;\r\n }\r\n\r\n .tabs__header__tabs__showmore__wrapper__tabs__12-19-2-alpha-2 {\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n width: 100%;\r\n height: 100%;\r\n }\r\n\r\n .tabs__header__tabs__showmore__tabs__12-19-2-alpha-2 {\r\n padding: 0;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n outline: none;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n cursor: pointer;\r\n white-space: nowrap;\r\n position: relative;\r\n width: var(--ControlHeightLarge, 28px);\r\n }\r\n\r\n .tabs__header__tabs__showmore__label__tabs__12-19-2-alpha-2 {\r\n border-radius: var(--BorderRadiusDefault, 3px);\r\n width: var(--ControlHeightLarge, 28px);\r\n height: var(--ControlHeightLarge, 28px);\r\n z-index: 1;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-flex: 1;\r\n -ms-flex: 1 0 auto;\r\n flex: 1 0 auto;\r\n -webkit-box-align: center;\r\n -ms-flex-align: center;\r\n align-items: center;\r\n -webkit-box-pack: center;\r\n -ms-flex-pack: center;\r\n justify-content: center;\r\n }\r\n\r\n .tabs__header__tabs__showmore__label__tabs__12-19-2-alpha-2:hover {\r\n background-color: var(--ButtonBackgroundHover, #ECECED);\r\n }\r\n\r\n .tabs__header__tabs__showmore__label--selected__tabs__12-19-2-alpha-2 svg * {\r\n fill: var(--DrBlack, #000000);\r\n }\r\n\r\n .tabs__header__tabs__showmore-menu__tabs__12-19-2-alpha-2 {\r\n outline: none;\r\n -webkit-box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n box-shadow: var(--BoxShadowL, 0 4px 16px 0 rgba(0, 0, 0, 0.12));\r\n border-radius: var(--BorderRadiusL, 4px);\r\n position: absolute;\r\n right: 0;\r\n padding: var(--SpaceXS, 4px) 0;\r\n left: auto;\r\n top: calc(100% + var(--SpaceXS, 4px)/2);\r\n bottom: auto;\r\n z-index: 11;\r\n background: var(--MrWhite, #FFFFFF);\r\n display: none;\r\n }\r\n\r\n .tabs__header__tabs__showmore-menu--opened__tabs__12-19-2-alpha-2 {\r\n display: block;\r\n }\r\n\r\n .tabs__header__tabs__showmore-menu__tabs__12-19-2-alpha-2 .tabs__header__tab-item__tabs__12-19-2-alpha-2 {\r\n padding: var(--SpaceS, 8px) var(--SpaceSM, 12px);\r\n }\r\n\r\n .tabs__header__tabs__showmore-menu__tabs__12-19-2-alpha-2 .tabs__header__tab-item__tabs__12-19-2-alpha-2:hover:not(.tabs__header__tab-item--active__tabs__12-19-2-alpha-2) {\r\n background: var(--Active100, #FCF5DB);\r\n }\r\n\r\n .tabs__header__tabs__showmore-menu__tabs__12-19-2-alpha-2 .tabs__header__tab-item--active__tabs__12-19-2-alpha-2 {\r\n background: var(--Active300, #F7E292);\r\n }\r\n";
|
|
209
|
+
var styles = {"tabs__header":"tabs__header__tabs__12-19-2-alpha-2","tabs__header__title":"tabs__header__title__tabs__12-19-2-alpha-2","tabs__header__container":"tabs__header__container__tabs__12-19-2-alpha-2","tabs__header__line":"tabs__header__line__tabs__12-19-2-alpha-2","tabs__header__line__slider":"tabs__header__line__slider__tabs__12-19-2-alpha-2","tabs__header__tab-item":"tabs__header__tab-item__tabs__12-19-2-alpha-2","tabs__header__tab-item--active":"tabs__header__tab-item--active__tabs__12-19-2-alpha-2","tabs__header__tab-item--disabled":"tabs__header__tab-item--disabled__tabs__12-19-2-alpha-2","tabs__header__tabs__showmore__wrapper":"tabs__header__tabs__showmore__wrapper__tabs__12-19-2-alpha-2","tabs__header__tabs__showmore":"tabs__header__tabs__showmore__tabs__12-19-2-alpha-2","tabs__header__tabs__showmore__label":"tabs__header__tabs__showmore__label__tabs__12-19-2-alpha-2","tabs__header__tabs__showmore__label--selected":"tabs__header__tabs__showmore__label--selected__tabs__12-19-2-alpha-2","tabs__header__tabs__showmore-menu":"tabs__header__tabs__showmore-menu__tabs__12-19-2-alpha-2","tabs__header__tabs__showmore-menu--opened":"tabs__header__tabs__showmore-menu--opened__tabs__12-19-2-alpha-2"};
|
|
201
210
|
styleInject(css);
|
|
202
211
|
|
|
203
212
|
/* should be the same for Popover, all props are cut after build, so we needed to copy them */
|
|
@@ -308,7 +317,6 @@ var ShowMore = /*#__PURE__*/function (_React$Component) {
|
|
|
308
317
|
return null;
|
|
309
318
|
}
|
|
310
319
|
var isListHidden = isHidden;
|
|
311
|
-
var showMoreStyles = classNames(styles['tabs__header__tabs__showmore'], hasChildSelected && styles['tabs__header__tabs__showmore--selected']);
|
|
312
320
|
var listStyles = classNames(styles['tabs__header__tabs__showmore-menu'], !isListHidden && styles['tabs__header__tabs__showmore-menu--opened'], this.props.showMorePopoverClassName);
|
|
313
321
|
var showMoreLabelStyles = classNames(styles['tabs__header__tabs__showmore__label'], hasChildSelected && styles['tabs__header__tabs__showmore__label--selected'], !isListHidden && styles['tabs__header__tabs__showmore__label--selected']);
|
|
314
322
|
return React.createElement(Popover, _extends({}, this.getShowMorePopoverProps(), {
|
|
@@ -320,19 +328,18 @@ var ShowMore = /*#__PURE__*/function (_React$Component) {
|
|
|
320
328
|
body: React.createElement("div", {
|
|
321
329
|
className: listStyles,
|
|
322
330
|
"aria-hidden": isListHidden,
|
|
323
|
-
role: "
|
|
331
|
+
role: "tablist"
|
|
324
332
|
}, children)
|
|
325
333
|
}), React.createElement("div", {
|
|
326
|
-
className: styles.tabs__header__tabs__showmore__wrapper
|
|
327
|
-
|
|
334
|
+
className: styles.tabs__header__tabs__showmore__wrapper,
|
|
335
|
+
role: "tab",
|
|
336
|
+
"aria-label": "More tabs"
|
|
337
|
+
}, React.createElement(button.Button, {
|
|
328
338
|
ref: onShowMoreChanged,
|
|
329
|
-
className: showMoreStyles,
|
|
330
|
-
role: "navigation",
|
|
331
|
-
tabIndex: "0",
|
|
332
339
|
onFocus: this.onFocus,
|
|
340
|
+
role: "navigation",
|
|
333
341
|
onBlur: this.onBlur,
|
|
334
|
-
onClick: this.toggleVisibility
|
|
335
|
-
}, React.createElement(button.Button, {
|
|
342
|
+
onClick: this.toggleVisibility,
|
|
336
343
|
checked: !isListHidden,
|
|
337
344
|
className: showMoreLabelStyles,
|
|
338
345
|
icon: React.createElement(icons.ChevronIcon, null),
|
|
@@ -341,7 +348,7 @@ var ShowMore = /*#__PURE__*/function (_React$Component) {
|
|
|
341
348
|
"data-title": "More tabs",
|
|
342
349
|
noBackground: true,
|
|
343
350
|
isWide: true
|
|
344
|
-
})))
|
|
351
|
+
})));
|
|
345
352
|
}
|
|
346
353
|
}]);
|
|
347
354
|
return ShowMore;
|
|
@@ -404,6 +411,13 @@ var TabInner = /*#__PURE__*/function (_React$Component) {
|
|
|
404
411
|
value: function shouldComponentUpdate(nextProps) {
|
|
405
412
|
return this.props.children !== nextProps.children || this.props.selected !== nextProps.selected || this.props.classNames !== nextProps.classNames;
|
|
406
413
|
}
|
|
414
|
+
}, {
|
|
415
|
+
key: "componentDidMount",
|
|
416
|
+
value: function componentDidMount() {
|
|
417
|
+
if (this.props.firstElement) {
|
|
418
|
+
this.tab.focus();
|
|
419
|
+
}
|
|
420
|
+
}
|
|
407
421
|
}, {
|
|
408
422
|
key: "render",
|
|
409
423
|
value: function render() {
|
|
@@ -553,8 +567,188 @@ var TabsPrint = function TabsPrint(props) {
|
|
|
553
567
|
}));
|
|
554
568
|
};
|
|
555
569
|
|
|
570
|
+
var freeGlobal = require('./_freeGlobal');
|
|
571
|
+
|
|
572
|
+
/** Detect free variable `self`. */
|
|
573
|
+
var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof(self)) == 'object' && self && self.Object === Object && self;
|
|
574
|
+
|
|
575
|
+
/** Used as a reference to the global object. */
|
|
576
|
+
var root = freeGlobal || freeSelf || Function('return this')();
|
|
577
|
+
module.exports = root;
|
|
578
|
+
|
|
579
|
+
var _root = /*#__PURE__*/Object.freeze({
|
|
580
|
+
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
/** Built-in value references. */
|
|
584
|
+
var _Symbol = _root.Symbol;
|
|
585
|
+
var _Symbol_1 = _Symbol;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* A specialized version of `_.map` for arrays without support for iteratee
|
|
589
|
+
* shorthands.
|
|
590
|
+
*
|
|
591
|
+
* @private
|
|
592
|
+
* @param {Array} [array] The array to iterate over.
|
|
593
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
594
|
+
* @returns {Array} Returns the new mapped array.
|
|
595
|
+
*/
|
|
596
|
+
function arrayMap(array, iteratee) {
|
|
597
|
+
var index = -1,
|
|
598
|
+
length = array == null ? 0 : array.length,
|
|
599
|
+
result = Array(length);
|
|
600
|
+
while (++index < length) {
|
|
601
|
+
result[index] = iteratee(array[index], index, array);
|
|
602
|
+
}
|
|
603
|
+
return result;
|
|
604
|
+
}
|
|
605
|
+
var _arrayMap = arrayMap;
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Checks if `value` is classified as an `Array` object.
|
|
609
|
+
*
|
|
610
|
+
* @static
|
|
611
|
+
* @memberOf _
|
|
612
|
+
* @since 0.1.0
|
|
613
|
+
* @category Lang
|
|
614
|
+
* @param {*} value The value to check.
|
|
615
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
616
|
+
* @example
|
|
617
|
+
*
|
|
618
|
+
* _.isArray([1, 2, 3]);
|
|
619
|
+
* // => true
|
|
620
|
+
*
|
|
621
|
+
* _.isArray(document.body.children);
|
|
622
|
+
* // => false
|
|
623
|
+
*
|
|
624
|
+
* _.isArray('abc');
|
|
625
|
+
* // => false
|
|
626
|
+
*
|
|
627
|
+
* _.isArray(_.noop);
|
|
628
|
+
* // => false
|
|
629
|
+
*/
|
|
630
|
+
var isArray = Array.isArray;
|
|
631
|
+
var isArray_1 = isArray;
|
|
632
|
+
|
|
633
|
+
var baseGetTag = require('./_baseGetTag'),
|
|
634
|
+
isObjectLike = require('./isObjectLike');
|
|
635
|
+
|
|
636
|
+
/** `Object#toString` result references. */
|
|
637
|
+
var symbolTag = '[object Symbol]';
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
641
|
+
*
|
|
642
|
+
* @static
|
|
643
|
+
* @memberOf _
|
|
644
|
+
* @since 4.0.0
|
|
645
|
+
* @category Lang
|
|
646
|
+
* @param {*} value The value to check.
|
|
647
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
648
|
+
* @example
|
|
649
|
+
*
|
|
650
|
+
* _.isSymbol(Symbol.iterator);
|
|
651
|
+
* // => true
|
|
652
|
+
*
|
|
653
|
+
* _.isSymbol('abc');
|
|
654
|
+
* // => false
|
|
655
|
+
*/
|
|
656
|
+
function isSymbol(value) {
|
|
657
|
+
return _typeof(value) == 'symbol' || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
658
|
+
}
|
|
659
|
+
module.exports = isSymbol;
|
|
660
|
+
|
|
661
|
+
var isSymbol$1 = /*#__PURE__*/Object.freeze({
|
|
662
|
+
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
/** Used as references for various `Number` constants. */
|
|
666
|
+
var INFINITY = 1 / 0;
|
|
667
|
+
|
|
668
|
+
/** Used to convert symbols to primitives and strings. */
|
|
669
|
+
var symbolProto = _Symbol_1 ? _Symbol_1.prototype : undefined,
|
|
670
|
+
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* The base implementation of `_.toString` which doesn't convert nullish
|
|
674
|
+
* values to empty strings.
|
|
675
|
+
*
|
|
676
|
+
* @private
|
|
677
|
+
* @param {*} value The value to process.
|
|
678
|
+
* @returns {string} Returns the string.
|
|
679
|
+
*/
|
|
680
|
+
function baseToString(value) {
|
|
681
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
|
682
|
+
if (typeof value == 'string') {
|
|
683
|
+
return value;
|
|
684
|
+
}
|
|
685
|
+
if (isArray_1(value)) {
|
|
686
|
+
// Recursively convert values (susceptible to call stack limits).
|
|
687
|
+
return _arrayMap(value, baseToString) + '';
|
|
688
|
+
}
|
|
689
|
+
if (isSymbol$1(value)) {
|
|
690
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
691
|
+
}
|
|
692
|
+
var result = value + '';
|
|
693
|
+
return result == '0' && 1 / value == -INFINITY ? '-0' : result;
|
|
694
|
+
}
|
|
695
|
+
var _baseToString = baseToString;
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
|
699
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
|
700
|
+
*
|
|
701
|
+
* @static
|
|
702
|
+
* @memberOf _
|
|
703
|
+
* @since 4.0.0
|
|
704
|
+
* @category Lang
|
|
705
|
+
* @param {*} value The value to convert.
|
|
706
|
+
* @returns {string} Returns the converted string.
|
|
707
|
+
* @example
|
|
708
|
+
*
|
|
709
|
+
* _.toString(null);
|
|
710
|
+
* // => ''
|
|
711
|
+
*
|
|
712
|
+
* _.toString(-0);
|
|
713
|
+
* // => '-0'
|
|
714
|
+
*
|
|
715
|
+
* _.toString([1, 2, 3]);
|
|
716
|
+
* // => '1,2,3'
|
|
717
|
+
*/
|
|
718
|
+
function toString(value) {
|
|
719
|
+
return value == null ? '' : _baseToString(value);
|
|
720
|
+
}
|
|
721
|
+
var toString_1 = toString;
|
|
722
|
+
|
|
723
|
+
/** Used to generate unique IDs. */
|
|
724
|
+
var idCounter = 0;
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* Generates a unique ID. If `prefix` is given, the ID is appended to it.
|
|
728
|
+
*
|
|
729
|
+
* @static
|
|
730
|
+
* @since 0.1.0
|
|
731
|
+
* @memberOf _
|
|
732
|
+
* @category Util
|
|
733
|
+
* @param {string} [prefix=''] The value to prefix the ID with.
|
|
734
|
+
* @returns {string} Returns the unique ID.
|
|
735
|
+
* @example
|
|
736
|
+
*
|
|
737
|
+
* _.uniqueId('contact_');
|
|
738
|
+
* // => 'contact_104'
|
|
739
|
+
*
|
|
740
|
+
* _.uniqueId();
|
|
741
|
+
* // => '105'
|
|
742
|
+
*/
|
|
743
|
+
function uniqueId(prefix) {
|
|
744
|
+
var id = ++idCounter;
|
|
745
|
+
return toString_1(prefix) + id;
|
|
746
|
+
}
|
|
747
|
+
var uniqueId_1 = uniqueId;
|
|
748
|
+
|
|
556
749
|
var tabPrefix$1 = 'tab-';
|
|
557
750
|
var panelPrefix$1 = 'panel-';
|
|
751
|
+
var tablistPrefix = 'tablist-';
|
|
558
752
|
|
|
559
753
|
// By itself, Tab is just a dummy component that is used for a cleaner Tabs API
|
|
560
754
|
// and as marker for actual tabs to prevent storing them as huge array
|
|
@@ -578,7 +772,7 @@ Tab.propTypes = {
|
|
|
578
772
|
*
|
|
579
773
|
* Top-level `<Tabs />` can work in either controlled or uncontrolled mode.
|
|
580
774
|
* In controlled mode, it uses `initialActiveTabId` to determine which
|
|
581
|
-
* tab is open by default, and then
|
|
775
|
+
* tab is open by default, and then manually manageschanging tabs
|
|
582
776
|
* on appropriate header clicks.
|
|
583
777
|
* In uncontrolled mode, it uses `activeTabId` prop to determine which tab
|
|
584
778
|
* is open and exposes `onActiveTabChanged` callback that is invoked each time
|
|
@@ -600,6 +794,7 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
600
794
|
args[_key] = arguments[_key];
|
|
601
795
|
}
|
|
602
796
|
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Tabs)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
|
797
|
+
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "tablistId", uniqueId_1(tablistPrefix));
|
|
603
798
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "tabRefs", new Map());
|
|
604
799
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "activeTabElement", null);
|
|
605
800
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "titleWrapper", null);
|
|
@@ -946,19 +1141,24 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
946
1141
|
return _this3.tabsWrapper = tabs;
|
|
947
1142
|
},
|
|
948
1143
|
onKeyDown: this.onKeyDown,
|
|
949
|
-
className: styles.tabs__header__container
|
|
1144
|
+
className: styles.tabs__header__container,
|
|
1145
|
+
role: "tablist",
|
|
1146
|
+
"aria-labelledby": this.tablistId
|
|
950
1147
|
}, this.props.title ? React.createElement("div", {
|
|
951
1148
|
className: styles.tabs__header__title,
|
|
952
1149
|
ref: function ref(titleWrapper) {
|
|
953
1150
|
return _this3.titleWrapper = titleWrapper;
|
|
954
|
-
}
|
|
1151
|
+
},
|
|
1152
|
+
id: this.tablistId
|
|
955
1153
|
}, this.props.title) : null, tabsVisible.map(function (tab) {
|
|
956
1154
|
return React.createElement(TabInner, _this3.getTabProps(tab));
|
|
957
1155
|
}), React.createElement(ShowMore, _extends({}, this.getShowMoreProps(isSelectedTabHidden), {
|
|
958
1156
|
showMorePopoverClassName: this.props.showMorePopoverClassName,
|
|
959
1157
|
showMorePopoverProps: this.props.showMorePopoverProps
|
|
960
|
-
}), tabsHidden.map(function (tab) {
|
|
961
|
-
return React.createElement(TabInner,
|
|
1158
|
+
}), tabsHidden.map(function (tab, index) {
|
|
1159
|
+
return React.createElement(TabInner, _extends({
|
|
1160
|
+
firstElement: index === 0
|
|
1161
|
+
}, _this3.getTabProps(tab)));
|
|
962
1162
|
}))), React.createElement("div", {
|
|
963
1163
|
className: styles.tabs__header__line
|
|
964
1164
|
}, React.createElement("div", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@targetprocess/tabs",
|
|
3
|
-
"version": "12.19.
|
|
3
|
+
"version": "12.19.2-alpha.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/tabs.js",
|
|
6
6
|
"module": "dist/tabs.es.js",
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@targetprocess/button": "^12.7.3",
|
|
14
|
-
"@targetprocess/icons": "^12.19.
|
|
15
|
-
"@targetprocess/popover": "^12.19.
|
|
14
|
+
"@targetprocess/icons": "^12.19.0",
|
|
15
|
+
"@targetprocess/popover": "^12.19.2-alpha.2",
|
|
16
16
|
"classnames": "^2.2.5",
|
|
17
|
+
"lodash": "^4.17.21",
|
|
17
18
|
"prop-types": "^15.6.0",
|
|
18
19
|
"react": "^16.8.0",
|
|
19
20
|
"react-dom": "^16.7.0",
|
|
@@ -23,5 +24,5 @@
|
|
|
23
24
|
"access": "public"
|
|
24
25
|
},
|
|
25
26
|
"sideEffects": false,
|
|
26
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "fda5a3cbb69aa225110e871cb7763d3fc644d798"
|
|
27
28
|
}
|