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