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