@targetprocess/tabs 12.19.0 → 12.19.2-alpha.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/ShowMore.jsx +17 -23
- package/TabInner.jsx +5 -0
- package/Tabs.jsx +10 -3
- package/dist/tabs.es.js +363 -264
- package/dist/tabs.js +363 -264
- package/package.json +4 -4
- package/style/index.css +5 -0
package/dist/tabs.es.js
CHANGED
|
@@ -6,29 +6,66 @@ import { ChevronIcon } from '@targetprocess/icons';
|
|
|
6
6
|
import { Button } from '@targetprocess/button';
|
|
7
7
|
import Popover from '@targetprocess/popover';
|
|
8
8
|
|
|
9
|
+
function _iterableToArrayLimit(r, l) {
|
|
10
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
11
|
+
if (null != t) {
|
|
12
|
+
var e,
|
|
13
|
+
n,
|
|
14
|
+
i,
|
|
15
|
+
u,
|
|
16
|
+
a = [],
|
|
17
|
+
f = !0,
|
|
18
|
+
o = !1;
|
|
19
|
+
try {
|
|
20
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
21
|
+
if (Object(t) !== t) return;
|
|
22
|
+
f = !1;
|
|
23
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
24
|
+
} catch (r) {
|
|
25
|
+
o = !0, n = r;
|
|
26
|
+
} finally {
|
|
27
|
+
try {
|
|
28
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
29
|
+
} finally {
|
|
30
|
+
if (o) throw n;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return a;
|
|
34
|
+
}
|
|
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
|
+
}
|
|
9
45
|
function _classCallCheck(instance, Constructor) {
|
|
10
46
|
if (!(instance instanceof Constructor)) {
|
|
11
47
|
throw new TypeError("Cannot call a class as a function");
|
|
12
48
|
}
|
|
13
49
|
}
|
|
14
|
-
|
|
15
50
|
function _defineProperties(target, props) {
|
|
16
51
|
for (var i = 0; i < props.length; i++) {
|
|
17
52
|
var descriptor = props[i];
|
|
18
53
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
19
54
|
descriptor.configurable = true;
|
|
20
55
|
if ("value" in descriptor) descriptor.writable = true;
|
|
21
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
56
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
22
57
|
}
|
|
23
58
|
}
|
|
24
|
-
|
|
25
59
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
26
60
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
27
61
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
62
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
63
|
+
writable: false
|
|
64
|
+
});
|
|
28
65
|
return Constructor;
|
|
29
66
|
}
|
|
30
|
-
|
|
31
67
|
function _defineProperty(obj, key, value) {
|
|
68
|
+
key = _toPropertyKey(key);
|
|
32
69
|
if (key in obj) {
|
|
33
70
|
Object.defineProperty(obj, key, {
|
|
34
71
|
value: value,
|
|
@@ -39,33 +76,26 @@ function _defineProperty(obj, key, value) {
|
|
|
39
76
|
} else {
|
|
40
77
|
obj[key] = value;
|
|
41
78
|
}
|
|
42
|
-
|
|
43
79
|
return obj;
|
|
44
80
|
}
|
|
45
|
-
|
|
46
81
|
function _extends() {
|
|
47
|
-
_extends = Object.assign
|
|
82
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
48
83
|
for (var i = 1; i < arguments.length; i++) {
|
|
49
84
|
var source = arguments[i];
|
|
50
|
-
|
|
51
85
|
for (var key in source) {
|
|
52
86
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
53
87
|
target[key] = source[key];
|
|
54
88
|
}
|
|
55
89
|
}
|
|
56
90
|
}
|
|
57
|
-
|
|
58
91
|
return target;
|
|
59
92
|
};
|
|
60
|
-
|
|
61
93
|
return _extends.apply(this, arguments);
|
|
62
94
|
}
|
|
63
|
-
|
|
64
95
|
function _inherits(subClass, superClass) {
|
|
65
96
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
66
97
|
throw new TypeError("Super expression must either be null or a function");
|
|
67
98
|
}
|
|
68
|
-
|
|
69
99
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
70
100
|
constructor: {
|
|
71
101
|
value: subClass,
|
|
@@ -73,77 +103,73 @@ function _inherits(subClass, superClass) {
|
|
|
73
103
|
configurable: true
|
|
74
104
|
}
|
|
75
105
|
});
|
|
106
|
+
Object.defineProperty(subClass, "prototype", {
|
|
107
|
+
writable: false
|
|
108
|
+
});
|
|
76
109
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
77
110
|
}
|
|
78
|
-
|
|
79
111
|
function _getPrototypeOf(o) {
|
|
80
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
112
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
81
113
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
82
114
|
};
|
|
83
115
|
return _getPrototypeOf(o);
|
|
84
116
|
}
|
|
85
|
-
|
|
86
117
|
function _setPrototypeOf(o, p) {
|
|
87
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
118
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
88
119
|
o.__proto__ = p;
|
|
89
120
|
return o;
|
|
90
121
|
};
|
|
91
|
-
|
|
92
122
|
return _setPrototypeOf(o, p);
|
|
93
123
|
}
|
|
94
|
-
|
|
95
124
|
function _assertThisInitialized(self) {
|
|
96
125
|
if (self === void 0) {
|
|
97
126
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
98
127
|
}
|
|
99
|
-
|
|
100
128
|
return self;
|
|
101
129
|
}
|
|
102
|
-
|
|
103
130
|
function _possibleConstructorReturn(self, call) {
|
|
104
131
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
105
132
|
return call;
|
|
133
|
+
} else if (call !== void 0) {
|
|
134
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
106
135
|
}
|
|
107
|
-
|
|
108
136
|
return _assertThisInitialized(self);
|
|
109
137
|
}
|
|
110
|
-
|
|
111
138
|
function _slicedToArray(arr, i) {
|
|
112
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
|
139
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
113
140
|
}
|
|
114
|
-
|
|
115
141
|
function _arrayWithHoles(arr) {
|
|
116
142
|
if (Array.isArray(arr)) return arr;
|
|
117
143
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
var
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
} catch (err) {
|
|
132
|
-
_d = true;
|
|
133
|
-
_e = err;
|
|
134
|
-
} finally {
|
|
135
|
-
try {
|
|
136
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
137
|
-
} finally {
|
|
138
|
-
if (_d) throw _e;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return _arr;
|
|
144
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
145
|
+
if (!o) return;
|
|
146
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
147
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
148
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
149
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
150
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
151
|
+
}
|
|
152
|
+
function _arrayLikeToArray(arr, len) {
|
|
153
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
154
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
155
|
+
return arr2;
|
|
143
156
|
}
|
|
144
|
-
|
|
145
157
|
function _nonIterableRest() {
|
|
146
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
158
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
159
|
+
}
|
|
160
|
+
function _toPrimitive(input, hint) {
|
|
161
|
+
if (typeof input !== "object" || input === null) return input;
|
|
162
|
+
var prim = input[Symbol.toPrimitive];
|
|
163
|
+
if (prim !== undefined) {
|
|
164
|
+
var res = prim.call(input, hint || "default");
|
|
165
|
+
if (typeof res !== "object") return res;
|
|
166
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
167
|
+
}
|
|
168
|
+
return (hint === "string" ? String : Number)(input);
|
|
169
|
+
}
|
|
170
|
+
function _toPropertyKey(arg) {
|
|
171
|
+
var key = _toPrimitive(arg, "string");
|
|
172
|
+
return typeof key === "symbol" ? key : String(key);
|
|
147
173
|
}
|
|
148
174
|
|
|
149
175
|
function styleInject(css, ref) {
|
|
@@ -173,12 +199,11 @@ function styleInject(css, ref) {
|
|
|
173
199
|
}
|
|
174
200
|
}
|
|
175
201
|
|
|
176
|
-
var css = ".tabs__header__tabs__12-19-
|
|
177
|
-
var styles = {"tabs__header":"tabs__header__tabs__12-19-
|
|
202
|
+
var css = ".tabs__header__tabs__12-19-2-alpha-1 {\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-1 {\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-1 {\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-1 {\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-1 {\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-1 {\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-1:first-child {\r\n padding-left: 0;\r\n }\r\n\r\n .tabs__header__tab-item__tabs__12-19-2-alpha-1: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-1: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-1:hover,\r\n .tabs__header__tab-item--active__tabs__12-19-2-alpha-1 {\r\n color: var(--DrBlack, #000000);\r\n }\r\n\r\n .tabs__header__tab-item__tabs__12-19-2-alpha-1: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-1 {\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-1 {\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-1 {\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-1 {\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-1: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-1 svg * {\r\n fill: var(--DrBlack, #000000);\r\n }\r\n\r\n .tabs__header__tabs__showmore-menu__tabs__12-19-2-alpha-1 {\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-1 {\r\n display: block;\r\n }\r\n\r\n .tabs__header__tabs__showmore-menu__tabs__12-19-2-alpha-1 .tabs__header__tab-item__tabs__12-19-2-alpha-1 {\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-1 .tabs__header__tab-item__tabs__12-19-2-alpha-1:hover:not(.tabs__header__tab-item--active__tabs__12-19-2-alpha-1) {\r\n background: var(--Active100, #FCF5DB);\r\n }\r\n\r\n .tabs__header__tabs__showmore-menu__tabs__12-19-2-alpha-1 .tabs__header__tab-item--active__tabs__12-19-2-alpha-1 {\r\n background: var(--Active300, #F7E292);\r\n }\r\n";
|
|
203
|
+
var styles = {"tabs__header":"tabs__header__tabs__12-19-2-alpha-1","tabs__header__title":"tabs__header__title__tabs__12-19-2-alpha-1","tabs__header__container":"tabs__header__container__tabs__12-19-2-alpha-1","tabs__header__line":"tabs__header__line__tabs__12-19-2-alpha-1","tabs__header__line__slider":"tabs__header__line__slider__tabs__12-19-2-alpha-1","tabs__header__tab-item":"tabs__header__tab-item__tabs__12-19-2-alpha-1","tabs__header__tab-item--active":"tabs__header__tab-item--active__tabs__12-19-2-alpha-1","tabs__header__tab-item--disabled":"tabs__header__tab-item--disabled__tabs__12-19-2-alpha-1","tabs__header__tabs__showmore__wrapper":"tabs__header__tabs__showmore__wrapper__tabs__12-19-2-alpha-1","tabs__header__tabs__showmore":"tabs__header__tabs__showmore__tabs__12-19-2-alpha-1","tabs__header__tabs__showmore__label":"tabs__header__tabs__showmore__label__tabs__12-19-2-alpha-1","tabs__header__tabs__showmore__label--selected":"tabs__header__tabs__showmore__label--selected__tabs__12-19-2-alpha-1","tabs__header__tabs__showmore-menu":"tabs__header__tabs__showmore-menu__tabs__12-19-2-alpha-1","tabs__header__tabs__showmore-menu--opened":"tabs__header__tabs__showmore-menu--opened__tabs__12-19-2-alpha-1"};
|
|
178
204
|
styleInject(css);
|
|
179
205
|
|
|
180
206
|
/* should be the same for Popover, all props are cut after build, so we needed to copy them */
|
|
181
|
-
|
|
182
207
|
var showMorePopoverProps = PropTypes.shape({
|
|
183
208
|
trackScroll: PropTypes.bool,
|
|
184
209
|
getContainerElement: PropTypes.func
|
|
@@ -186,42 +211,32 @@ var showMorePopoverProps = PropTypes.shape({
|
|
|
186
211
|
|
|
187
212
|
var ShowMore = /*#__PURE__*/function (_React$Component) {
|
|
188
213
|
_inherits(ShowMore, _React$Component);
|
|
189
|
-
|
|
190
214
|
function ShowMore() {
|
|
191
215
|
var _getPrototypeOf2;
|
|
192
|
-
|
|
193
216
|
var _this;
|
|
194
|
-
|
|
195
217
|
_classCallCheck(this, ShowMore);
|
|
196
|
-
|
|
197
218
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
198
219
|
args[_key] = arguments[_key];
|
|
199
220
|
}
|
|
200
|
-
|
|
201
221
|
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(ShowMore)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
|
202
|
-
|
|
203
222
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {
|
|
204
223
|
isFocused: false,
|
|
205
224
|
isHidden: true
|
|
206
225
|
});
|
|
207
|
-
|
|
208
226
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onFocus", function () {
|
|
209
227
|
return _this.setState({
|
|
210
228
|
isFocused: true
|
|
211
229
|
});
|
|
212
230
|
});
|
|
213
|
-
|
|
214
231
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onBlur", function () {
|
|
215
232
|
return _this.setState({
|
|
216
233
|
isFocused: false
|
|
217
234
|
});
|
|
218
235
|
});
|
|
219
|
-
|
|
220
236
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onKeyDown", function (event) {
|
|
221
237
|
var _this$state = _this.state,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
238
|
+
isFocused = _this$state.isFocused,
|
|
239
|
+
isHidden = _this$state.isHidden;
|
|
225
240
|
if (event.key === 'Enter') {
|
|
226
241
|
if (isFocused) {
|
|
227
242
|
_this.setState({
|
|
@@ -234,20 +249,16 @@ var ShowMore = /*#__PURE__*/function (_React$Component) {
|
|
|
234
249
|
}
|
|
235
250
|
}
|
|
236
251
|
});
|
|
237
|
-
|
|
238
252
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "close", function () {
|
|
239
253
|
var isHidden = _this.state.isHidden;
|
|
240
|
-
|
|
241
254
|
if (!isHidden) {
|
|
242
255
|
_this.setState({
|
|
243
256
|
isHidden: true
|
|
244
257
|
});
|
|
245
258
|
}
|
|
246
259
|
});
|
|
247
|
-
|
|
248
260
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "toggleVisibility", function (event) {
|
|
249
261
|
event.stopPropagation();
|
|
250
|
-
|
|
251
262
|
_this.setState(function (_ref) {
|
|
252
263
|
var isHidden = _ref.isHidden;
|
|
253
264
|
return {
|
|
@@ -255,20 +266,15 @@ var ShowMore = /*#__PURE__*/function (_React$Component) {
|
|
|
255
266
|
};
|
|
256
267
|
});
|
|
257
268
|
});
|
|
258
|
-
|
|
259
269
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getShowMorePopoverProps", function () {
|
|
260
270
|
var popoverProps = _extends({}, _this.props.showMorePopoverProps);
|
|
261
|
-
|
|
262
271
|
if (_this.props.showMorePopoverProps && _this.props.showMorePopoverProps.getContainerElement) {
|
|
263
272
|
showMorePopoverProps.trackScroll = false;
|
|
264
273
|
}
|
|
265
|
-
|
|
266
274
|
return popoverProps;
|
|
267
275
|
});
|
|
268
|
-
|
|
269
276
|
return _this;
|
|
270
277
|
}
|
|
271
|
-
|
|
272
278
|
_createClass(ShowMore, [{
|
|
273
279
|
key: "componentWillMount",
|
|
274
280
|
value: function componentWillMount() {
|
|
@@ -281,8 +287,8 @@ var ShowMore = /*#__PURE__*/function (_React$Component) {
|
|
|
281
287
|
key: "shouldComponentUpdate",
|
|
282
288
|
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
283
289
|
var _this$props = this.props,
|
|
284
|
-
|
|
285
|
-
|
|
290
|
+
children = _this$props.children,
|
|
291
|
+
hasChildSelected = _this$props.hasChildSelected;
|
|
286
292
|
return children.length !== nextProps.children.length || hasChildSelected !== nextProps.hasChildSelected || this.state !== nextState;
|
|
287
293
|
}
|
|
288
294
|
}, {
|
|
@@ -297,17 +303,14 @@ var ShowMore = /*#__PURE__*/function (_React$Component) {
|
|
|
297
303
|
key: "render",
|
|
298
304
|
value: function render() {
|
|
299
305
|
var _this$props2 = this.props,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
306
|
+
children = _this$props2.children,
|
|
307
|
+
onShowMoreChanged = _this$props2.onShowMoreChanged,
|
|
308
|
+
hasChildSelected = _this$props2.hasChildSelected;
|
|
303
309
|
var isHidden = this.state.isHidden;
|
|
304
|
-
|
|
305
310
|
if (!children || !children.length) {
|
|
306
311
|
return null;
|
|
307
312
|
}
|
|
308
|
-
|
|
309
313
|
var isListHidden = isHidden;
|
|
310
|
-
var showMoreStyles = classNames(styles['tabs__header__tabs__showmore'], hasChildSelected && styles['tabs__header__tabs__showmore--selected']);
|
|
311
314
|
var listStyles = classNames(styles['tabs__header__tabs__showmore-menu'], !isListHidden && styles['tabs__header__tabs__showmore-menu--opened'], this.props.showMorePopoverClassName);
|
|
312
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']);
|
|
313
316
|
return React.createElement(Popover, _extends({}, this.getShowMorePopoverProps(), {
|
|
@@ -319,19 +322,18 @@ var ShowMore = /*#__PURE__*/function (_React$Component) {
|
|
|
319
322
|
body: React.createElement("div", {
|
|
320
323
|
className: listStyles,
|
|
321
324
|
"aria-hidden": isListHidden,
|
|
322
|
-
role: "
|
|
325
|
+
role: "tablist"
|
|
323
326
|
}, children)
|
|
324
327
|
}), React.createElement("div", {
|
|
325
|
-
className: styles.tabs__header__tabs__showmore__wrapper
|
|
326
|
-
|
|
328
|
+
className: styles.tabs__header__tabs__showmore__wrapper,
|
|
329
|
+
role: "tab",
|
|
330
|
+
"aria-label": "More tabs"
|
|
331
|
+
}, React.createElement(Button, {
|
|
327
332
|
ref: onShowMoreChanged,
|
|
328
|
-
className: showMoreStyles,
|
|
329
|
-
role: "navigation",
|
|
330
|
-
tabIndex: "0",
|
|
331
333
|
onFocus: this.onFocus,
|
|
334
|
+
role: "navigation",
|
|
332
335
|
onBlur: this.onBlur,
|
|
333
|
-
onClick: this.toggleVisibility
|
|
334
|
-
}, React.createElement(Button, {
|
|
336
|
+
onClick: this.toggleVisibility,
|
|
335
337
|
checked: !isListHidden,
|
|
336
338
|
className: showMoreLabelStyles,
|
|
337
339
|
icon: React.createElement(ChevronIcon, null),
|
|
@@ -340,13 +342,11 @@ var ShowMore = /*#__PURE__*/function (_React$Component) {
|
|
|
340
342
|
"data-title": "More tabs",
|
|
341
343
|
noBackground: true,
|
|
342
344
|
isWide: true
|
|
343
|
-
})))
|
|
345
|
+
})));
|
|
344
346
|
}
|
|
345
347
|
}]);
|
|
346
|
-
|
|
347
348
|
return ShowMore;
|
|
348
349
|
}(React.Component);
|
|
349
|
-
|
|
350
350
|
_defineProperty(ShowMore, "defaultProps", {
|
|
351
351
|
children: null,
|
|
352
352
|
hasChildSelected: false,
|
|
@@ -357,10 +357,10 @@ _defineProperty(ShowMore, "defaultProps", {
|
|
|
357
357
|
|
|
358
358
|
var TabPanel = function TabPanel(props) {
|
|
359
359
|
var id = props.id,
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
360
|
+
tabId = props.tabId,
|
|
361
|
+
children = props.children,
|
|
362
|
+
_props$hidden = props.hidden,
|
|
363
|
+
hidden = _props$hidden === void 0 ? false : _props$hidden;
|
|
364
364
|
return React.createElement("div", {
|
|
365
365
|
role: "tabpanel",
|
|
366
366
|
id: id,
|
|
@@ -377,23 +377,16 @@ function onTabClick(selected, onClick, originalKey) {
|
|
|
377
377
|
return !selected && onClick(originalKey);
|
|
378
378
|
};
|
|
379
379
|
}
|
|
380
|
-
|
|
381
380
|
var TabInner = /*#__PURE__*/function (_React$Component) {
|
|
382
381
|
_inherits(TabInner, _React$Component);
|
|
383
|
-
|
|
384
382
|
function TabInner() {
|
|
385
383
|
var _getPrototypeOf2;
|
|
386
|
-
|
|
387
384
|
var _this;
|
|
388
|
-
|
|
389
385
|
_classCallCheck(this, TabInner);
|
|
390
|
-
|
|
391
386
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
392
387
|
args[_key] = arguments[_key];
|
|
393
388
|
}
|
|
394
|
-
|
|
395
389
|
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(TabInner)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
|
396
|
-
|
|
397
390
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "blurHandler", function () {
|
|
398
391
|
window.requestAnimationFrame(function () {
|
|
399
392
|
if (_this.tab) {
|
|
@@ -401,35 +394,38 @@ var TabInner = /*#__PURE__*/function (_React$Component) {
|
|
|
401
394
|
}
|
|
402
395
|
});
|
|
403
396
|
});
|
|
404
|
-
|
|
405
397
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "renderTab", function () {
|
|
406
398
|
var children = _this.props.children;
|
|
407
399
|
return children;
|
|
408
400
|
});
|
|
409
|
-
|
|
410
401
|
return _this;
|
|
411
402
|
}
|
|
412
|
-
|
|
413
403
|
_createClass(TabInner, [{
|
|
414
404
|
key: "shouldComponentUpdate",
|
|
415
405
|
value: function shouldComponentUpdate(nextProps) {
|
|
416
406
|
return this.props.children !== nextProps.children || this.props.selected !== nextProps.selected || this.props.classNames !== nextProps.classNames;
|
|
417
407
|
}
|
|
408
|
+
}, {
|
|
409
|
+
key: "componentDidMount",
|
|
410
|
+
value: function componentDidMount() {
|
|
411
|
+
if (this.props.firstElement) {
|
|
412
|
+
this.tab.focus();
|
|
413
|
+
}
|
|
414
|
+
}
|
|
418
415
|
}, {
|
|
419
416
|
key: "render",
|
|
420
417
|
value: function render() {
|
|
421
418
|
var _this2 = this;
|
|
422
|
-
|
|
423
419
|
var _this$props = this.props,
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
420
|
+
id = _this$props.id,
|
|
421
|
+
selected = _this$props.selected,
|
|
422
|
+
disabled = _this$props.disabled,
|
|
423
|
+
panelId = _this$props.panelId,
|
|
424
|
+
onClick = _this$props.onClick,
|
|
425
|
+
getOnFocusCallback = _this$props.getOnFocusCallback,
|
|
426
|
+
onBlur = _this$props.onBlur,
|
|
427
|
+
originalKey = _this$props.originalKey,
|
|
428
|
+
classNames$$1 = _this$props.classNames;
|
|
433
429
|
return React.createElement("div", {
|
|
434
430
|
ref: function ref(tab) {
|
|
435
431
|
return _this2.tab = tab;
|
|
@@ -450,10 +446,8 @@ var TabInner = /*#__PURE__*/function (_React$Component) {
|
|
|
450
446
|
}, React.createElement("div", null, this.renderTab()));
|
|
451
447
|
}
|
|
452
448
|
}]);
|
|
453
|
-
|
|
454
449
|
return TabInner;
|
|
455
450
|
}(React.Component);
|
|
456
|
-
|
|
457
451
|
_defineProperty(TabInner, "defaultProps", {
|
|
458
452
|
children: null,
|
|
459
453
|
disabled: false
|
|
@@ -465,7 +459,6 @@ var debounce = function debounce(callback, time) {
|
|
|
465
459
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
466
460
|
args[_key] = arguments[_key];
|
|
467
461
|
}
|
|
468
|
-
|
|
469
462
|
clearTimeout(interval);
|
|
470
463
|
interval = setTimeout(function () {
|
|
471
464
|
interval = null;
|
|
@@ -476,28 +469,24 @@ var debounce = function debounce(callback, time) {
|
|
|
476
469
|
|
|
477
470
|
var tabPrefix = 'tab-';
|
|
478
471
|
var panelPrefix = 'panel-';
|
|
479
|
-
|
|
480
472
|
var getTabs = function getTabs(allTabs) {
|
|
481
473
|
return allTabs.reduce(function (result, item) {
|
|
482
474
|
var _item$props = item.props,
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
475
|
+
id = _item$props.id,
|
|
476
|
+
header = _item$props.header,
|
|
477
|
+
children = _item$props.children,
|
|
478
|
+
disabled = _item$props.disabled;
|
|
487
479
|
var payload = {
|
|
488
480
|
tabIndex: result.tabIndex,
|
|
489
481
|
disabled: disabled,
|
|
490
482
|
id: id
|
|
491
483
|
};
|
|
492
|
-
|
|
493
484
|
var tabPayload = _extends({}, payload, {
|
|
494
485
|
header: header
|
|
495
486
|
});
|
|
496
|
-
|
|
497
487
|
var panelPayload = _extends({}, payload, {
|
|
498
488
|
children: children
|
|
499
489
|
});
|
|
500
|
-
|
|
501
490
|
result.headers.push(tabPayload);
|
|
502
491
|
result.panels.set(id, panelPayload);
|
|
503
492
|
result.tabIndex += 1;
|
|
@@ -508,25 +497,21 @@ var getTabs = function getTabs(allTabs) {
|
|
|
508
497
|
tabIndex: 0
|
|
509
498
|
});
|
|
510
499
|
};
|
|
511
|
-
|
|
512
500
|
var renderTabHeader = function renderTabHeader(headerProp) {
|
|
513
501
|
var isRenderProp = typeof headerProp === 'function';
|
|
514
|
-
|
|
515
502
|
if (!isRenderProp) {
|
|
516
503
|
return headerProp;
|
|
517
504
|
}
|
|
518
|
-
|
|
519
505
|
return headerProp({
|
|
520
506
|
onResize: function onResize() {}
|
|
521
507
|
});
|
|
522
508
|
};
|
|
523
|
-
|
|
524
509
|
var getTabProps = function getTabProps(_ref) {
|
|
525
510
|
var header = _ref.header,
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
511
|
+
id = _ref.id,
|
|
512
|
+
selected = _ref.selected,
|
|
513
|
+
tabIndex = _ref.tabIndex,
|
|
514
|
+
disabled = _ref.disabled;
|
|
530
515
|
return {
|
|
531
516
|
selected: selected,
|
|
532
517
|
tabIndex: tabIndex,
|
|
@@ -541,10 +526,9 @@ var getTabProps = function getTabProps(_ref) {
|
|
|
541
526
|
classNames: classNames(styles['tabs__header__tab-item'], selected && styles['tabs__header__tab-item--active'], disabled && styles['tabs__header__tab-item--disabled'])
|
|
542
527
|
};
|
|
543
528
|
};
|
|
544
|
-
|
|
545
529
|
var getPanelProps = function getPanelProps(_ref2) {
|
|
546
530
|
var id = _ref2.id,
|
|
547
|
-
|
|
531
|
+
children = _ref2.children;
|
|
548
532
|
return {
|
|
549
533
|
children: children,
|
|
550
534
|
key: panelPrefix + id,
|
|
@@ -552,16 +536,13 @@ var getPanelProps = function getPanelProps(_ref2) {
|
|
|
552
536
|
tabId: tabPrefix + id
|
|
553
537
|
};
|
|
554
538
|
};
|
|
555
|
-
|
|
556
539
|
var TabsPrint = function TabsPrint(props) {
|
|
557
540
|
var allTabs = React.Children.toArray(props.children).filter(function (child) {
|
|
558
541
|
return child.type === Tab;
|
|
559
542
|
});
|
|
560
|
-
|
|
561
543
|
var _getTabs = getTabs(allTabs),
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
544
|
+
headers = _getTabs.headers,
|
|
545
|
+
panels = _getTabs.panels;
|
|
565
546
|
return React.createElement("div", {
|
|
566
547
|
className: classNames(styles['tabs'], props.className)
|
|
567
548
|
}, Array.from(panels.values()).map(function (tab) {
|
|
@@ -580,10 +561,191 @@ var TabsPrint = function TabsPrint(props) {
|
|
|
580
561
|
}));
|
|
581
562
|
};
|
|
582
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
|
+
|
|
583
743
|
var tabPrefix$1 = 'tab-';
|
|
584
|
-
var panelPrefix$1 = 'panel-';
|
|
585
|
-
|
|
744
|
+
var panelPrefix$1 = 'panel-';
|
|
745
|
+
var tablistPrefix = 'tablist-';
|
|
586
746
|
|
|
747
|
+
// By itself, Tab is just a dummy component that is used for a cleaner Tabs API
|
|
748
|
+
// and as marker for actual tabs to prevent storing them as huge array
|
|
587
749
|
var Tab = function Tab() {
|
|
588
750
|
return null;
|
|
589
751
|
};
|
|
@@ -593,6 +755,7 @@ Tab.propTypes = {
|
|
|
593
755
|
children: PropTypes.node,
|
|
594
756
|
disabled: PropTypes.bool
|
|
595
757
|
};
|
|
758
|
+
|
|
596
759
|
/**
|
|
597
760
|
* Tabs component is an aggregate root for several content panes
|
|
598
761
|
* (via Tabs.Tab component), each with its own children, and a header
|
|
@@ -603,7 +766,7 @@ Tab.propTypes = {
|
|
|
603
766
|
*
|
|
604
767
|
* Top-level `<Tabs />` can work in either controlled or uncontrolled mode.
|
|
605
768
|
* In controlled mode, it uses `initialActiveTabId` to determine which
|
|
606
|
-
* tab is open by default, and then
|
|
769
|
+
* tab is open by default, and then manually manageschanging tabs
|
|
607
770
|
* on appropriate header clicks.
|
|
608
771
|
* In uncontrolled mode, it uses `activeTabId` prop to determine which tab
|
|
609
772
|
* is open and exposes `onActiveTabChanged` callback that is invoked each time
|
|
@@ -617,26 +780,18 @@ Tab.propTypes = {
|
|
|
617
780
|
|
|
618
781
|
var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
619
782
|
_inherits(Tabs, _React$Component);
|
|
620
|
-
|
|
621
783
|
function Tabs() {
|
|
622
784
|
var _getPrototypeOf2;
|
|
623
|
-
|
|
624
785
|
var _this;
|
|
625
|
-
|
|
626
786
|
_classCallCheck(this, Tabs);
|
|
627
|
-
|
|
628
787
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
629
788
|
args[_key] = arguments[_key];
|
|
630
789
|
}
|
|
631
|
-
|
|
632
790
|
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Tabs)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
|
633
|
-
|
|
791
|
+
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "tablistId", uniqueId_1(tablistPrefix));
|
|
634
792
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "tabRefs", new Map());
|
|
635
|
-
|
|
636
793
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "activeTabElement", null);
|
|
637
|
-
|
|
638
794
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "titleWrapper", null);
|
|
639
|
-
|
|
640
795
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {
|
|
641
796
|
activeTabId: _this.props.initialActiveTabId,
|
|
642
797
|
cachedTabs: new Set(),
|
|
@@ -648,14 +803,11 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
648
803
|
showMoreWidth: 40,
|
|
649
804
|
focusedTabKey: null
|
|
650
805
|
});
|
|
651
|
-
|
|
652
806
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "isControlledMode", function () {
|
|
653
807
|
return typeof _this.props.activeTabId !== 'undefined';
|
|
654
808
|
});
|
|
655
|
-
|
|
656
809
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "changeTab", function (tabId) {
|
|
657
810
|
var currentActiveTabId = _this.getActiveTabId(_this.getAllTabs());
|
|
658
|
-
|
|
659
811
|
if (_this.props.cacheOpenedTabs) {
|
|
660
812
|
_this.setState(function (state) {
|
|
661
813
|
var cachedTabs = new Set(state.cachedTabs);
|
|
@@ -670,30 +822,27 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
670
822
|
activeTabId: tabId
|
|
671
823
|
});
|
|
672
824
|
}
|
|
673
|
-
|
|
674
825
|
if (typeof _this.props.onActiveTabChanged === 'function') {
|
|
675
826
|
_this.props.onActiveTabChanged(tabId);
|
|
676
827
|
}
|
|
677
828
|
});
|
|
678
|
-
|
|
679
829
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "setTabsDimensions", function () {
|
|
680
830
|
window.requestAnimationFrame(function () {
|
|
681
831
|
if (!_this.tabsWrapper) {
|
|
682
832
|
// it shouldn't happens evern. Just paranoic check
|
|
683
833
|
return;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
var blockWidth = _this.tabsWrapper.offsetWidth - _this.props.showMoreWidthBuffer - _this.getTitleWidth(); // calculate width and offset for each tab
|
|
834
|
+
}
|
|
688
835
|
|
|
836
|
+
// initial wrapper width calculation
|
|
837
|
+
var blockWidth = _this.tabsWrapper.offsetWidth - _this.props.showMoreWidthBuffer - _this.getTitleWidth();
|
|
689
838
|
|
|
839
|
+
// calculate width and offset for each tab
|
|
690
840
|
var tabsTotalWidth = 0;
|
|
691
841
|
var tabDimensions = new Map();
|
|
692
842
|
Array.from(_this.tabRefs.entries()).forEach(function (_ref) {
|
|
693
843
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
844
|
+
key = _ref2[0],
|
|
845
|
+
value = _ref2[1];
|
|
697
846
|
if (value) {
|
|
698
847
|
var width = value.tab.offsetWidth;
|
|
699
848
|
tabDimensions.set(key.replace(tabPrefix$1, ''), {
|
|
@@ -703,7 +852,6 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
703
852
|
tabsTotalWidth += width;
|
|
704
853
|
}
|
|
705
854
|
});
|
|
706
|
-
|
|
707
855
|
_this.setState({
|
|
708
856
|
tabDimensions: tabDimensions,
|
|
709
857
|
tabsTotalWidth: tabsTotalWidth,
|
|
@@ -711,7 +859,6 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
711
859
|
});
|
|
712
860
|
});
|
|
713
861
|
});
|
|
714
|
-
|
|
715
862
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "adjustSlider", function () {
|
|
716
863
|
window.requestAnimationFrame(function () {
|
|
717
864
|
if (_this.activeTabElement && _this.activeTabElement.tab) {
|
|
@@ -727,53 +874,42 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
727
874
|
}
|
|
728
875
|
});
|
|
729
876
|
});
|
|
730
|
-
|
|
731
877
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getTitleWidth", function () {
|
|
732
878
|
return _this.titleWrapper ? _this.titleWrapper.offsetWidth : 0;
|
|
733
879
|
});
|
|
734
|
-
|
|
735
880
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onResizeThrottled", function (width) {
|
|
736
881
|
_this.setState({
|
|
737
882
|
blockWidth: width - _this.props.showMoreWidthBuffer - _this.getTitleWidth()
|
|
738
883
|
});
|
|
739
|
-
|
|
740
884
|
_this.adjustSlider();
|
|
741
885
|
});
|
|
742
|
-
|
|
743
886
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "handleHeaderResize", debounce(function () {
|
|
744
887
|
_this.setTabsDimensions();
|
|
745
|
-
|
|
746
888
|
_this.adjustSlider();
|
|
747
889
|
}, 50));
|
|
748
|
-
|
|
749
890
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "renderTabHeader", function (headerProp) {
|
|
750
891
|
var isRenderProp = typeof headerProp === 'function';
|
|
751
|
-
|
|
752
892
|
if (!isRenderProp) {
|
|
753
893
|
return headerProp;
|
|
754
894
|
}
|
|
755
|
-
|
|
756
895
|
return headerProp({
|
|
757
896
|
onResize: _this.handleHeaderResize
|
|
758
897
|
});
|
|
759
898
|
});
|
|
760
|
-
|
|
761
899
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getTabs", function (allTabs, shrinkToParent) {
|
|
762
900
|
var _this$state = _this.state,
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
901
|
+
blockWidth = _this$state.blockWidth,
|
|
902
|
+
tabsTotalWidth = _this$state.tabsTotalWidth,
|
|
903
|
+
tabDimensions = _this$state.tabDimensions,
|
|
904
|
+
showMoreWidth = _this$state.showMoreWidth;
|
|
768
905
|
var activeTabId = _this.getActiveTabId(allTabs);
|
|
769
|
-
|
|
770
906
|
var availableWidth = blockWidth - (tabsTotalWidth > blockWidth ? showMoreWidth : 0);
|
|
771
907
|
return allTabs.reduce(function (result, item) {
|
|
772
908
|
var _item$props = item.props,
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
909
|
+
id = _item$props.id,
|
|
910
|
+
header = _item$props.header,
|
|
911
|
+
children = _item$props.children,
|
|
912
|
+
disabled = _item$props.disabled;
|
|
777
913
|
var selected = activeTabId === id;
|
|
778
914
|
var payload = {
|
|
779
915
|
tabIndex: result.tabIndex,
|
|
@@ -781,33 +917,31 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
781
917
|
disabled: disabled,
|
|
782
918
|
id: id
|
|
783
919
|
};
|
|
784
|
-
|
|
785
920
|
var tabPayload = _extends({}, payload, {
|
|
786
921
|
header: header
|
|
787
922
|
});
|
|
788
|
-
|
|
789
923
|
var panelPayload = _extends({}, payload, {
|
|
790
924
|
children: children
|
|
791
925
|
});
|
|
792
|
-
|
|
793
926
|
var tabWidth = tabDimensions.has(id) ? tabDimensions.get(id).width : 0;
|
|
794
|
-
/* eslint-disable no-param-reassign */
|
|
795
927
|
|
|
796
|
-
|
|
797
|
-
!
|
|
798
|
-
|
|
928
|
+
/* eslint-disable no-param-reassign */
|
|
929
|
+
if (!shrinkToParent ||
|
|
930
|
+
// initial call
|
|
931
|
+
!blockWidth ||
|
|
932
|
+
// all tabs are fit into the block
|
|
933
|
+
blockWidth > tabsTotalWidth ||
|
|
934
|
+
// current tab fit into the block
|
|
799
935
|
result.availableWidth - tabWidth - showMoreWidth > 0) {
|
|
800
936
|
result.tabsVisible.push(tabPayload);
|
|
801
937
|
} else {
|
|
802
938
|
result.tabsHidden.push(tabPayload);
|
|
803
|
-
|
|
804
939
|
if (selected) {
|
|
805
940
|
result.isSelectedTabHidden = true;
|
|
806
941
|
}
|
|
807
942
|
}
|
|
808
943
|
/* eslint-enable no-param-reassign */
|
|
809
944
|
|
|
810
|
-
|
|
811
945
|
result.panels.set(id, panelPayload);
|
|
812
946
|
result.availableWidth -= tabWidth;
|
|
813
947
|
result.tabIndex += 1;
|
|
@@ -821,36 +955,27 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
821
955
|
availableWidth: availableWidth
|
|
822
956
|
});
|
|
823
957
|
});
|
|
824
|
-
|
|
825
958
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getActiveTabId", function (tabs) {
|
|
826
959
|
var _tabs = _slicedToArray(tabs, 1),
|
|
827
|
-
|
|
828
|
-
|
|
960
|
+
firstTab = _tabs[0];
|
|
829
961
|
if (_this.isControlledMode()) {
|
|
830
962
|
var tabId = _this.props.activeTabId;
|
|
831
|
-
|
|
832
963
|
if (tabId && tabs.some(function (tab) {
|
|
833
964
|
return tab.props.id === tabId;
|
|
834
965
|
})) {
|
|
835
966
|
return tabId;
|
|
836
967
|
}
|
|
837
|
-
|
|
838
968
|
return firstTab.props.id;
|
|
839
969
|
}
|
|
840
|
-
|
|
841
970
|
var activeTabId = _this.state.activeTabId;
|
|
842
|
-
|
|
843
971
|
if (typeof activeTabId === 'undefined') {
|
|
844
972
|
if (!(firstTab && firstTab.props)) {
|
|
845
973
|
return null;
|
|
846
974
|
}
|
|
847
|
-
|
|
848
975
|
return firstTab.props.id || null;
|
|
849
976
|
}
|
|
850
|
-
|
|
851
977
|
return activeTabId;
|
|
852
978
|
});
|
|
853
|
-
|
|
854
979
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onFocusTab", function (focusedTabKey) {
|
|
855
980
|
return function () {
|
|
856
981
|
return _this.setState({
|
|
@@ -858,29 +983,25 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
858
983
|
});
|
|
859
984
|
};
|
|
860
985
|
});
|
|
861
|
-
|
|
862
986
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onBlurTab", function () {
|
|
863
987
|
return _this.setState({
|
|
864
988
|
focusedTabKey: null
|
|
865
989
|
});
|
|
866
990
|
});
|
|
867
|
-
|
|
868
991
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onKeyDown", function (event) {
|
|
869
992
|
if (event.key === 'Enter' && _this.state.focusedTabKey !== null) {
|
|
870
993
|
_this.changeTab(_this.state.focusedTabKey);
|
|
871
994
|
}
|
|
872
995
|
});
|
|
873
|
-
|
|
874
996
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onClick", function (tab) {
|
|
875
997
|
return !tab.disabled && _this.changeTab(tab.id);
|
|
876
998
|
});
|
|
877
|
-
|
|
878
999
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getTabProps", function (_ref3) {
|
|
879
1000
|
var header = _ref3.header,
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
1001
|
+
id = _ref3.id,
|
|
1002
|
+
selected = _ref3.selected,
|
|
1003
|
+
tabIndex = _ref3.tabIndex,
|
|
1004
|
+
disabled = _ref3.disabled;
|
|
884
1005
|
return {
|
|
885
1006
|
selected: selected,
|
|
886
1007
|
tabIndex: tabIndex,
|
|
@@ -891,7 +1012,6 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
891
1012
|
if (selected) {
|
|
892
1013
|
_this.activeTabElement = tab;
|
|
893
1014
|
}
|
|
894
|
-
|
|
895
1015
|
_this.tabRefs.set(tabPrefix$1 + id, tab);
|
|
896
1016
|
},
|
|
897
1017
|
originalKey: id,
|
|
@@ -907,10 +1027,9 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
907
1027
|
classNames: classNames(styles['tabs__header__tab-item'], selected && styles['tabs__header__tab-item--active'], disabled && styles['tabs__header__tab-item--disabled'])
|
|
908
1028
|
};
|
|
909
1029
|
});
|
|
910
|
-
|
|
911
1030
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getPanelProps", function (_ref4) {
|
|
912
1031
|
var id = _ref4.id,
|
|
913
|
-
|
|
1032
|
+
children = _ref4.children;
|
|
914
1033
|
return {
|
|
915
1034
|
children: children,
|
|
916
1035
|
key: panelPrefix$1 + id,
|
|
@@ -918,54 +1037,43 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
918
1037
|
tabId: tabPrefix$1 + id
|
|
919
1038
|
};
|
|
920
1039
|
});
|
|
921
|
-
|
|
922
1040
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "showMoreChanged", function (element) {
|
|
923
1041
|
if (!element) {
|
|
924
1042
|
return;
|
|
925
1043
|
}
|
|
926
|
-
|
|
927
1044
|
var showMoreWidth = element.offsetWidth;
|
|
928
|
-
|
|
929
1045
|
if (_this.state.showMoreWidth === showMoreWidth) {
|
|
930
1046
|
return;
|
|
931
1047
|
}
|
|
932
|
-
|
|
933
1048
|
_this.setState({
|
|
934
1049
|
showMoreWidth: showMoreWidth
|
|
935
1050
|
});
|
|
936
1051
|
});
|
|
937
|
-
|
|
938
1052
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getShowMoreProps", function (isSelectedTabHidden) {
|
|
939
1053
|
return {
|
|
940
1054
|
onShowMoreChanged: _this.showMoreChanged,
|
|
941
1055
|
hasChildSelected: isSelectedTabHidden
|
|
942
1056
|
};
|
|
943
1057
|
});
|
|
944
|
-
|
|
945
1058
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getSliderStyle", function (isSelectedTabHidden) {
|
|
946
1059
|
return {
|
|
947
1060
|
left: isSelectedTabHidden ? '100%' : _this.state.sliderLeft,
|
|
948
1061
|
width: isSelectedTabHidden ? '0' : _this.state.sliderWidth
|
|
949
1062
|
};
|
|
950
1063
|
});
|
|
951
|
-
|
|
952
1064
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getAllTabs", function () {
|
|
953
1065
|
return React.Children.toArray(_this.props.children).filter(function (child) {
|
|
954
1066
|
return child.type === Tab;
|
|
955
1067
|
});
|
|
956
1068
|
});
|
|
957
|
-
|
|
958
1069
|
return _this;
|
|
959
1070
|
}
|
|
960
|
-
|
|
961
1071
|
_createClass(Tabs, [{
|
|
962
1072
|
key: "componentDidMount",
|
|
963
1073
|
value: function componentDidMount() {
|
|
964
1074
|
var _this2 = this;
|
|
965
|
-
|
|
966
1075
|
setTimeout(function () {
|
|
967
1076
|
_this2.setTabsDimensions();
|
|
968
|
-
|
|
969
1077
|
_this2.adjustSlider();
|
|
970
1078
|
}, this.props.tabSizeTimeout);
|
|
971
1079
|
}
|
|
@@ -974,11 +1082,9 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
974
1082
|
value: function componentDidUpdate(previousProps, previousState) {
|
|
975
1083
|
var activeTabChanged = this.isControlledMode() ? this.props.activeTabId !== previousProps.activeTabId : this.state.activeTabId !== previousState.activeTabId;
|
|
976
1084
|
var blockWidth = this.state.blockWidth;
|
|
977
|
-
|
|
978
1085
|
if (activeTabChanged) {
|
|
979
1086
|
this.adjustSlider();
|
|
980
1087
|
}
|
|
981
|
-
|
|
982
1088
|
if (!blockWidth) {
|
|
983
1089
|
this.setTabsDimensions();
|
|
984
1090
|
}
|
|
@@ -987,42 +1093,38 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
987
1093
|
key: "shouldComponentUpdate",
|
|
988
1094
|
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
989
1095
|
var _this$state2 = this.state,
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1096
|
+
activeTabId = _this$state2.activeTabId,
|
|
1097
|
+
blockWidth = _this$state2.blockWidth,
|
|
1098
|
+
showMoreWidth = _this$state2.showMoreWidth,
|
|
1099
|
+
sliderLeft = _this$state2.sliderLeft,
|
|
1100
|
+
sliderWidth = _this$state2.sliderWidth,
|
|
1101
|
+
tabsTotalWidth = _this$state2.tabsTotalWidth,
|
|
1102
|
+
focusedTabKey = _this$state2.focusedTabKey;
|
|
997
1103
|
var _this$props = this.props,
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1104
|
+
initialActiveTabId = _this$props.initialActiveTabId,
|
|
1105
|
+
onActiveTabChanged = _this$props.onActiveTabChanged,
|
|
1106
|
+
resizeThrottle = _this$props.resizeThrottle,
|
|
1107
|
+
tabSizeTimeout = _this$props.tabSizeTimeout,
|
|
1108
|
+
children = _this$props.children;
|
|
1003
1109
|
return nextState.blockWidth !== blockWidth || nextState.showMoreWidth !== showMoreWidth || nextState.sliderLeft !== sliderLeft || nextState.sliderWidth !== sliderWidth || nextState.tabsTotalWidth !== tabsTotalWidth || nextState.focusedTabKey !== focusedTabKey || nextState.activeTabId !== activeTabId || nextProps.initialActiveTabId !== initialActiveTabId || nextProps.onActiveTabChanged !== onActiveTabChanged || nextProps.resizeThrottle !== resizeThrottle || nextProps.tabSizeTimeout !== tabSizeTimeout || nextProps.children !== children;
|
|
1004
1110
|
}
|
|
1005
1111
|
}, {
|
|
1006
1112
|
key: "render",
|
|
1007
1113
|
value: function render() {
|
|
1008
1114
|
var _this3 = this;
|
|
1009
|
-
|
|
1010
1115
|
if (this.props.printMode) {
|
|
1011
1116
|
return React.createElement(TabsPrint, {
|
|
1012
1117
|
className: this.props.className,
|
|
1013
1118
|
children: this.props.children
|
|
1014
1119
|
});
|
|
1015
1120
|
}
|
|
1016
|
-
|
|
1017
1121
|
var allTabs = this.getAllTabs();
|
|
1018
1122
|
var activeTabId = this.getActiveTabId(allTabs);
|
|
1019
|
-
|
|
1020
1123
|
var _this$getTabs = this.getTabs(allTabs, this.props.shrinkToParent),
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1124
|
+
tabsVisible = _this$getTabs.tabsVisible,
|
|
1125
|
+
tabsHidden = _this$getTabs.tabsHidden,
|
|
1126
|
+
panels = _this$getTabs.panels,
|
|
1127
|
+
isSelectedTabHidden = _this$getTabs.isSelectedTabHidden;
|
|
1026
1128
|
var activeTab = panels.get(activeTabId) || allTabs[0];
|
|
1027
1129
|
return React.createElement("div", {
|
|
1028
1130
|
className: classNames(styles['tabs'], this.props.className)
|
|
@@ -1033,19 +1135,24 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
1033
1135
|
return _this3.tabsWrapper = tabs;
|
|
1034
1136
|
},
|
|
1035
1137
|
onKeyDown: this.onKeyDown,
|
|
1036
|
-
className: styles.tabs__header__container
|
|
1138
|
+
className: styles.tabs__header__container,
|
|
1139
|
+
role: "tablist",
|
|
1140
|
+
"aria-labelledby": this.tablistId
|
|
1037
1141
|
}, this.props.title ? React.createElement("div", {
|
|
1038
1142
|
className: styles.tabs__header__title,
|
|
1039
1143
|
ref: function ref(titleWrapper) {
|
|
1040
1144
|
return _this3.titleWrapper = titleWrapper;
|
|
1041
|
-
}
|
|
1145
|
+
},
|
|
1146
|
+
id: this.tablistId
|
|
1042
1147
|
}, this.props.title) : null, tabsVisible.map(function (tab) {
|
|
1043
1148
|
return React.createElement(TabInner, _this3.getTabProps(tab));
|
|
1044
1149
|
}), React.createElement(ShowMore, _extends({}, this.getShowMoreProps(isSelectedTabHidden), {
|
|
1045
1150
|
showMorePopoverClassName: this.props.showMorePopoverClassName,
|
|
1046
1151
|
showMorePopoverProps: this.props.showMorePopoverProps
|
|
1047
|
-
}), tabsHidden.map(function (tab) {
|
|
1048
|
-
return React.createElement(TabInner,
|
|
1152
|
+
}), tabsHidden.map(function (tab, index) {
|
|
1153
|
+
return React.createElement(TabInner, _extends({
|
|
1154
|
+
firstElement: index === 0
|
|
1155
|
+
}, _this3.getTabProps(tab)));
|
|
1049
1156
|
}))), React.createElement("div", {
|
|
1050
1157
|
className: styles.tabs__header__line
|
|
1051
1158
|
}, React.createElement("div", {
|
|
@@ -1055,17 +1162,13 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
1055
1162
|
className: styles.tabs__body
|
|
1056
1163
|
}, this.props.cacheOpenedTabs ? allTabs.map(function (_ref5) {
|
|
1057
1164
|
var id = _ref5.props.id;
|
|
1058
|
-
|
|
1059
1165
|
var shouldBeRendered = panels.has(id) && (id === activeTabId || _this3.state.cachedTabs.has(id));
|
|
1060
|
-
|
|
1061
1166
|
var isHidden = id !== activeTabId;
|
|
1062
|
-
|
|
1063
1167
|
if (shouldBeRendered) {
|
|
1064
1168
|
return React.createElement(TabPanel, _extends({}, _this3.getPanelProps(panels.get(id)), {
|
|
1065
1169
|
hidden: isHidden
|
|
1066
1170
|
}));
|
|
1067
1171
|
}
|
|
1068
|
-
|
|
1069
1172
|
return null;
|
|
1070
1173
|
}) : activeTab && React.createElement(TabPanel, this.getPanelProps(activeTab))), React.createElement(ResizeDetector, {
|
|
1071
1174
|
handleWidth: true,
|
|
@@ -1090,14 +1193,11 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
|
1090
1193
|
cachedTabs: cachedTabs
|
|
1091
1194
|
});
|
|
1092
1195
|
}
|
|
1093
|
-
|
|
1094
1196
|
return null;
|
|
1095
1197
|
}
|
|
1096
1198
|
}]);
|
|
1097
|
-
|
|
1098
1199
|
return Tabs;
|
|
1099
1200
|
}(React.Component);
|
|
1100
|
-
|
|
1101
1201
|
_defineProperty(Tabs, "defaultProps", {
|
|
1102
1202
|
resizeThrottle: 100,
|
|
1103
1203
|
tabSizeTimeout: 200,
|
|
@@ -1106,7 +1206,6 @@ _defineProperty(Tabs, "defaultProps", {
|
|
|
1106
1206
|
printMode: false,
|
|
1107
1207
|
cacheOpenedTabs: false
|
|
1108
1208
|
});
|
|
1109
|
-
|
|
1110
1209
|
Tabs.Tab = Tab;
|
|
1111
1210
|
|
|
1112
1211
|
export { Tabs };
|