@atlaskit/tabs 13.1.4 → 13.2.3
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/CHANGELOG.md +32 -0
- package/dist/cjs/components/tab-list.js +13 -11
- package/dist/cjs/components/tabs.js +13 -11
- package/dist/cjs/internal/colors.js +22 -16
- package/dist/cjs/internal/styles.js +14 -4
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/tab-list.js +11 -9
- package/dist/es2019/components/tabs.js +13 -11
- package/dist/es2019/internal/colors.js +21 -16
- package/dist/es2019/internal/styles.js +14 -4
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/tab-list.js +13 -11
- package/dist/esm/components/tabs.js +13 -11
- package/dist/esm/internal/colors.js +21 -16
- package/dist/esm/internal/styles.js +14 -4
- package/dist/esm/version.json +1 -1
- package/dist/types/internal/colors.d.ts +3 -1
- package/package.json +13 -18
- package/dist/cjs/performance/examples.js +0 -196
- package/dist/es2019/performance/examples.js +0 -96
- package/dist/esm/performance/examples.js +0 -171
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @atlaskit/tabs
|
|
2
2
|
|
|
3
|
+
## 13.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 13.2.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 13.2.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
21
|
+
## 13.2.0
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- [`cc54bf994d6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cc54bf994d6) - Instrumented Tabs with the new theming package, `@atlaskit/tokens`.
|
|
26
|
+
|
|
27
|
+
New tokens will be visible only in applications configured to use the new Tokens API (currently in alpha).
|
|
28
|
+
These changes are intended to be interoperable with the legacy theme implementation. Legacy dark mode users should expect no visual or breaking changes.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- [`af4bca32ad4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/af4bca32ad4) - Internal changes to supress eslint rules.
|
|
33
|
+
- Updated dependencies
|
|
34
|
+
|
|
3
35
|
## 13.1.4
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
|
@@ -105,17 +105,19 @@ var TabListWithMode = function TabListWithMode(props) {
|
|
|
105
105
|
key: index
|
|
106
106
|
}, tab);
|
|
107
107
|
}, [length, onKeyDown, onChange, tabsId]);
|
|
108
|
-
return (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
108
|
+
return (// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
109
|
+
(0, _core.jsx)("div", {
|
|
110
|
+
role: "tablist",
|
|
111
|
+
css: styles,
|
|
112
|
+
ref: ref
|
|
113
|
+
}, childrenArray.map(function (child, index) {
|
|
114
|
+
return getTabWithContext({
|
|
115
|
+
tab: child,
|
|
116
|
+
index: index,
|
|
117
|
+
isSelected: index === selected
|
|
118
|
+
});
|
|
119
|
+
}))
|
|
120
|
+
);
|
|
119
121
|
};
|
|
120
122
|
|
|
121
123
|
var TabList = function TabList(props) {
|
|
@@ -36,7 +36,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
36
36
|
var analyticsAttributes = {
|
|
37
37
|
componentName: 'tabs',
|
|
38
38
|
packageName: "@atlaskit/tabs",
|
|
39
|
-
packageVersion: "13.
|
|
39
|
+
packageVersion: "13.2.3"
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
var getTabPanelWithContext = function getTabPanelWithContext(_ref) {
|
|
@@ -124,16 +124,18 @@ var TabsWithMode = function TabsWithMode(props) {
|
|
|
124
124
|
var tabsStyles = (0, _react.useMemo)(function () {
|
|
125
125
|
return (0, _styles.getTabsStyles)(mode);
|
|
126
126
|
}, [mode]);
|
|
127
|
-
return (
|
|
128
|
-
"
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
127
|
+
return (// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
128
|
+
(0, _core.jsx)("div", {
|
|
129
|
+
"data-testid": testId,
|
|
130
|
+
css: tabsStyles
|
|
131
|
+
}, (0, _core.jsx)(_context.TabListContext.Provider, {
|
|
132
|
+
value: {
|
|
133
|
+
selected: selected,
|
|
134
|
+
onChange: onChangeAnalytics,
|
|
135
|
+
tabsId: id
|
|
136
|
+
}
|
|
137
|
+
}, tabList), tabPanelsWithContext)
|
|
138
|
+
);
|
|
137
139
|
};
|
|
138
140
|
|
|
139
141
|
var Tabs = function Tabs(props) {
|
|
@@ -7,20 +7,22 @@ exports.getTabPanelFocusColor = exports.getTabLineColor = exports.getTabColors =
|
|
|
7
7
|
|
|
8
8
|
var _colors = require("@atlaskit/theme/colors");
|
|
9
9
|
|
|
10
|
+
var _tokens = require("@atlaskit/tokens");
|
|
11
|
+
|
|
10
12
|
var tabColorMap = {
|
|
11
13
|
light: {
|
|
12
|
-
labelColor: _colors.N500,
|
|
13
|
-
activeLabelColor: _colors.B500,
|
|
14
|
-
hoverLabelColor: _colors.B400,
|
|
15
|
-
selectedColor: _colors.B400,
|
|
16
|
-
|
|
14
|
+
labelColor: (0, _tokens.token)('color.text.mediumEmphasis', _colors.N500),
|
|
15
|
+
activeLabelColor: (0, _tokens.token)('color.text.highEmphasis', _colors.B500),
|
|
16
|
+
hoverLabelColor: (0, _tokens.token)('color.text.mediumEmphasis', _colors.B400),
|
|
17
|
+
selectedColor: (0, _tokens.token)('color.text.selected', _colors.B400),
|
|
18
|
+
focusBorderColor: (0, _tokens.token)('color.border.focus', _colors.B100)
|
|
17
19
|
},
|
|
18
20
|
dark: {
|
|
19
|
-
labelColor: _colors.DN400,
|
|
20
|
-
activeLabelColor: _colors.B200,
|
|
21
|
-
hoverLabelColor: _colors.B75,
|
|
22
|
-
selectedColor: _colors.B75,
|
|
23
|
-
|
|
21
|
+
labelColor: (0, _tokens.token)('color.text.mediumEmphasis', _colors.DN400),
|
|
22
|
+
activeLabelColor: (0, _tokens.token)('color.text.highEmphasis', _colors.B200),
|
|
23
|
+
hoverLabelColor: (0, _tokens.token)('color.text.mediumEmphasis', _colors.B75),
|
|
24
|
+
selectedColor: (0, _tokens.token)('color.text.selected', _colors.B75),
|
|
25
|
+
focusBorderColor: (0, _tokens.token)('color.border.focus', _colors.B75)
|
|
24
26
|
}
|
|
25
27
|
};
|
|
26
28
|
|
|
@@ -31,12 +33,16 @@ var getTabColors = function getTabColors(mode) {
|
|
|
31
33
|
exports.getTabColors = getTabColors;
|
|
32
34
|
var tabLineColorMap = {
|
|
33
35
|
light: {
|
|
34
|
-
lineColor: _colors.N30,
|
|
35
|
-
|
|
36
|
+
lineColor: (0, _tokens.token)('color.border.neutral', _colors.N30),
|
|
37
|
+
hoveredColor: (0, _tokens.token)('color.border.neutral', 'transparent'),
|
|
38
|
+
activeColor: (0, _tokens.token)('color.border.neutral', 'transparent'),
|
|
39
|
+
selectedColor: (0, _tokens.token)('color.text.selected', _colors.B400)
|
|
36
40
|
},
|
|
37
41
|
dark: {
|
|
38
|
-
lineColor: _colors.DN0,
|
|
39
|
-
|
|
42
|
+
lineColor: (0, _tokens.token)('color.border.neutral', _colors.DN0),
|
|
43
|
+
hoveredColor: (0, _tokens.token)('color.border.neutral', 'transparent'),
|
|
44
|
+
activeColor: (0, _tokens.token)('color.border.neutral', 'transparent'),
|
|
45
|
+
selectedColor: (0, _tokens.token)('color.text.selected', _colors.B75)
|
|
40
46
|
}
|
|
41
47
|
};
|
|
42
48
|
|
|
@@ -46,8 +52,8 @@ var getTabLineColor = function getTabLineColor(mode) {
|
|
|
46
52
|
|
|
47
53
|
exports.getTabLineColor = getTabLineColor;
|
|
48
54
|
var tabPanelFocusColorMap = {
|
|
49
|
-
light: _colors.B100,
|
|
50
|
-
dark: _colors.B75
|
|
55
|
+
light: (0, _tokens.token)('color.border.focus', _colors.B100),
|
|
56
|
+
dark: (0, _tokens.token)('color.border.focus', _colors.B75)
|
|
51
57
|
};
|
|
52
58
|
|
|
53
59
|
var getTabPanelFocusColor = function getTabPanelFocusColor(mode) {
|
|
@@ -112,13 +112,23 @@ var getTabStyles = function getTabStyles(mode) {
|
|
|
112
112
|
overflow: 'hidden',
|
|
113
113
|
textOverflow: 'ellipsis',
|
|
114
114
|
'&:hover': {
|
|
115
|
-
|
|
115
|
+
// TODO: interaction states will be reviewed in DSP-1438
|
|
116
|
+
color: colors.hoverLabelColor,
|
|
117
|
+
'&::after': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
|
|
118
|
+
borderBottom: "".concat(underlineHeight, " solid ").concat((0, _colors.getTabLineColor)(mode).hoveredColor),
|
|
119
|
+
height: 0
|
|
120
|
+
})
|
|
116
121
|
},
|
|
117
|
-
'&:active
|
|
118
|
-
|
|
122
|
+
'&:active': {
|
|
123
|
+
// TODO: interaction states will be reviewed in DSP-1438
|
|
124
|
+
color: colors.activeLabelColor,
|
|
125
|
+
'&::after': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
|
|
126
|
+
borderBottom: "".concat(underlineHeight, " solid ").concat((0, _colors.getTabLineColor)(mode).activeColor),
|
|
127
|
+
height: 0
|
|
128
|
+
})
|
|
119
129
|
},
|
|
120
130
|
'&:focus': {
|
|
121
|
-
boxShadow: "0 0 0 2px ".concat(colors.
|
|
131
|
+
boxShadow: "0 0 0 2px ".concat(colors.focusBorderColor, " inset"),
|
|
122
132
|
borderRadius: borderRadius,
|
|
123
133
|
outline: 'none',
|
|
124
134
|
// Hide TabLine on focus
|
package/dist/cjs/version.json
CHANGED
|
@@ -84,15 +84,17 @@ const TabListWithMode = props => {
|
|
|
84
84
|
},
|
|
85
85
|
key: index
|
|
86
86
|
}, tab), [length, onKeyDown, onChange, tabsId]);
|
|
87
|
-
return
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
87
|
+
return (// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
88
|
+
jsx("div", {
|
|
89
|
+
role: "tablist",
|
|
90
|
+
css: styles,
|
|
91
|
+
ref: ref
|
|
92
|
+
}, childrenArray.map((child, index) => getTabWithContext({
|
|
93
|
+
tab: child,
|
|
94
|
+
index,
|
|
95
|
+
isSelected: index === selected
|
|
96
|
+
})))
|
|
97
|
+
);
|
|
96
98
|
};
|
|
97
99
|
|
|
98
100
|
export const TabList = props => jsx(GlobalTheme.Consumer, null, ({
|
|
@@ -11,7 +11,7 @@ import { onMouseDownBlur } from '../internal/utils';
|
|
|
11
11
|
const analyticsAttributes = {
|
|
12
12
|
componentName: 'tabs',
|
|
13
13
|
packageName: "@atlaskit/tabs",
|
|
14
|
-
packageVersion: "13.
|
|
14
|
+
packageVersion: "13.2.3"
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const getTabPanelWithContext = ({
|
|
@@ -83,16 +83,18 @@ const TabsWithMode = props => {
|
|
|
83
83
|
tabsId: id
|
|
84
84
|
}));
|
|
85
85
|
const tabsStyles = useMemo(() => getTabsStyles(mode), [mode]);
|
|
86
|
-
return
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
return (// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
87
|
+
jsx("div", {
|
|
88
|
+
"data-testid": testId,
|
|
89
|
+
css: tabsStyles
|
|
90
|
+
}, jsx(TabListContext.Provider, {
|
|
91
|
+
value: {
|
|
92
|
+
selected,
|
|
93
|
+
onChange: onChangeAnalytics,
|
|
94
|
+
tabsId: id
|
|
95
|
+
}
|
|
96
|
+
}, tabList), tabPanelsWithContext)
|
|
97
|
+
);
|
|
96
98
|
};
|
|
97
99
|
|
|
98
100
|
export const Tabs = props => jsx(GlobalTheme.Consumer, null, ({
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { B100, B200, B400, B500, B75, DN0, DN400, N30, N500 } from '@atlaskit/theme/colors';
|
|
2
|
+
import { token } from '@atlaskit/tokens';
|
|
2
3
|
const tabColorMap = {
|
|
3
4
|
light: {
|
|
4
|
-
labelColor: N500,
|
|
5
|
-
activeLabelColor: B500,
|
|
6
|
-
hoverLabelColor: B400,
|
|
7
|
-
selectedColor: B400,
|
|
8
|
-
|
|
5
|
+
labelColor: token('color.text.mediumEmphasis', N500),
|
|
6
|
+
activeLabelColor: token('color.text.highEmphasis', B500),
|
|
7
|
+
hoverLabelColor: token('color.text.mediumEmphasis', B400),
|
|
8
|
+
selectedColor: token('color.text.selected', B400),
|
|
9
|
+
focusBorderColor: token('color.border.focus', B100)
|
|
9
10
|
},
|
|
10
11
|
dark: {
|
|
11
|
-
labelColor: DN400,
|
|
12
|
-
activeLabelColor: B200,
|
|
13
|
-
hoverLabelColor: B75,
|
|
14
|
-
selectedColor: B75,
|
|
15
|
-
|
|
12
|
+
labelColor: token('color.text.mediumEmphasis', DN400),
|
|
13
|
+
activeLabelColor: token('color.text.highEmphasis', B200),
|
|
14
|
+
hoverLabelColor: token('color.text.mediumEmphasis', B75),
|
|
15
|
+
selectedColor: token('color.text.selected', B75),
|
|
16
|
+
focusBorderColor: token('color.border.focus', B75)
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
19
|
export const getTabColors = mode => {
|
|
@@ -20,17 +21,21 @@ export const getTabColors = mode => {
|
|
|
20
21
|
};
|
|
21
22
|
const tabLineColorMap = {
|
|
22
23
|
light: {
|
|
23
|
-
lineColor: N30,
|
|
24
|
-
|
|
24
|
+
lineColor: token('color.border.neutral', N30),
|
|
25
|
+
hoveredColor: token('color.border.neutral', 'transparent'),
|
|
26
|
+
activeColor: token('color.border.neutral', 'transparent'),
|
|
27
|
+
selectedColor: token('color.text.selected', B400)
|
|
25
28
|
},
|
|
26
29
|
dark: {
|
|
27
|
-
lineColor: DN0,
|
|
28
|
-
|
|
30
|
+
lineColor: token('color.border.neutral', DN0),
|
|
31
|
+
hoveredColor: token('color.border.neutral', 'transparent'),
|
|
32
|
+
activeColor: token('color.border.neutral', 'transparent'),
|
|
33
|
+
selectedColor: token('color.text.selected', B75)
|
|
29
34
|
}
|
|
30
35
|
};
|
|
31
36
|
export const getTabLineColor = mode => tabLineColorMap[mode];
|
|
32
37
|
const tabPanelFocusColorMap = {
|
|
33
|
-
light: B100,
|
|
34
|
-
dark: B75
|
|
38
|
+
light: token('color.border.focus', B100),
|
|
39
|
+
dark: token('color.border.focus', B75)
|
|
35
40
|
};
|
|
36
41
|
export const getTabPanelFocusColor = mode => tabPanelFocusColorMap[mode];
|
|
@@ -84,13 +84,23 @@ export const getTabStyles = mode => {
|
|
|
84
84
|
overflow: 'hidden',
|
|
85
85
|
textOverflow: 'ellipsis',
|
|
86
86
|
'&:hover': {
|
|
87
|
-
|
|
87
|
+
// TODO: interaction states will be reviewed in DSP-1438
|
|
88
|
+
color: colors.hoverLabelColor,
|
|
89
|
+
'&::after': { ...tabLineStyles,
|
|
90
|
+
borderBottom: `${underlineHeight} solid ${getTabLineColor(mode).hoveredColor}`,
|
|
91
|
+
height: 0
|
|
92
|
+
}
|
|
88
93
|
},
|
|
89
|
-
'&:active
|
|
90
|
-
|
|
94
|
+
'&:active': {
|
|
95
|
+
// TODO: interaction states will be reviewed in DSP-1438
|
|
96
|
+
color: colors.activeLabelColor,
|
|
97
|
+
'&::after': { ...tabLineStyles,
|
|
98
|
+
borderBottom: `${underlineHeight} solid ${getTabLineColor(mode).activeColor}`,
|
|
99
|
+
height: 0
|
|
100
|
+
}
|
|
91
101
|
},
|
|
92
102
|
'&:focus': {
|
|
93
|
-
boxShadow: `0 0 0 2px ${colors.
|
|
103
|
+
boxShadow: `0 0 0 2px ${colors.focusBorderColor} inset`,
|
|
94
104
|
borderRadius: borderRadius,
|
|
95
105
|
outline: 'none',
|
|
96
106
|
// Hide TabLine on focus
|
package/dist/es2019/version.json
CHANGED
|
@@ -89,17 +89,19 @@ var TabListWithMode = function TabListWithMode(props) {
|
|
|
89
89
|
key: index
|
|
90
90
|
}, tab);
|
|
91
91
|
}, [length, onKeyDown, onChange, tabsId]);
|
|
92
|
-
return
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
return (// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
93
|
+
jsx("div", {
|
|
94
|
+
role: "tablist",
|
|
95
|
+
css: styles,
|
|
96
|
+
ref: ref
|
|
97
|
+
}, childrenArray.map(function (child, index) {
|
|
98
|
+
return getTabWithContext({
|
|
99
|
+
tab: child,
|
|
100
|
+
index: index,
|
|
101
|
+
isSelected: index === selected
|
|
102
|
+
});
|
|
103
|
+
}))
|
|
104
|
+
);
|
|
103
105
|
};
|
|
104
106
|
|
|
105
107
|
export var TabList = function TabList(props) {
|
|
@@ -18,7 +18,7 @@ import { onMouseDownBlur } from '../internal/utils';
|
|
|
18
18
|
var analyticsAttributes = {
|
|
19
19
|
componentName: 'tabs',
|
|
20
20
|
packageName: "@atlaskit/tabs",
|
|
21
|
-
packageVersion: "13.
|
|
21
|
+
packageVersion: "13.2.3"
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
var getTabPanelWithContext = function getTabPanelWithContext(_ref) {
|
|
@@ -104,16 +104,18 @@ var TabsWithMode = function TabsWithMode(props) {
|
|
|
104
104
|
var tabsStyles = useMemo(function () {
|
|
105
105
|
return getTabsStyles(mode);
|
|
106
106
|
}, [mode]);
|
|
107
|
-
return
|
|
108
|
-
"
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
107
|
+
return (// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
108
|
+
jsx("div", {
|
|
109
|
+
"data-testid": testId,
|
|
110
|
+
css: tabsStyles
|
|
111
|
+
}, jsx(TabListContext.Provider, {
|
|
112
|
+
value: {
|
|
113
|
+
selected: selected,
|
|
114
|
+
onChange: onChangeAnalytics,
|
|
115
|
+
tabsId: id
|
|
116
|
+
}
|
|
117
|
+
}, tabList), tabPanelsWithContext)
|
|
118
|
+
);
|
|
117
119
|
};
|
|
118
120
|
|
|
119
121
|
export var Tabs = function Tabs(props) {
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { B100, B200, B400, B500, B75, DN0, DN400, N30, N500 } from '@atlaskit/theme/colors';
|
|
2
|
+
import { token } from '@atlaskit/tokens';
|
|
2
3
|
var tabColorMap = {
|
|
3
4
|
light: {
|
|
4
|
-
labelColor: N500,
|
|
5
|
-
activeLabelColor: B500,
|
|
6
|
-
hoverLabelColor: B400,
|
|
7
|
-
selectedColor: B400,
|
|
8
|
-
|
|
5
|
+
labelColor: token('color.text.mediumEmphasis', N500),
|
|
6
|
+
activeLabelColor: token('color.text.highEmphasis', B500),
|
|
7
|
+
hoverLabelColor: token('color.text.mediumEmphasis', B400),
|
|
8
|
+
selectedColor: token('color.text.selected', B400),
|
|
9
|
+
focusBorderColor: token('color.border.focus', B100)
|
|
9
10
|
},
|
|
10
11
|
dark: {
|
|
11
|
-
labelColor: DN400,
|
|
12
|
-
activeLabelColor: B200,
|
|
13
|
-
hoverLabelColor: B75,
|
|
14
|
-
selectedColor: B75,
|
|
15
|
-
|
|
12
|
+
labelColor: token('color.text.mediumEmphasis', DN400),
|
|
13
|
+
activeLabelColor: token('color.text.highEmphasis', B200),
|
|
14
|
+
hoverLabelColor: token('color.text.mediumEmphasis', B75),
|
|
15
|
+
selectedColor: token('color.text.selected', B75),
|
|
16
|
+
focusBorderColor: token('color.border.focus', B75)
|
|
16
17
|
}
|
|
17
18
|
};
|
|
18
19
|
export var getTabColors = function getTabColors(mode) {
|
|
@@ -20,20 +21,24 @@ export var getTabColors = function getTabColors(mode) {
|
|
|
20
21
|
};
|
|
21
22
|
var tabLineColorMap = {
|
|
22
23
|
light: {
|
|
23
|
-
lineColor: N30,
|
|
24
|
-
|
|
24
|
+
lineColor: token('color.border.neutral', N30),
|
|
25
|
+
hoveredColor: token('color.border.neutral', 'transparent'),
|
|
26
|
+
activeColor: token('color.border.neutral', 'transparent'),
|
|
27
|
+
selectedColor: token('color.text.selected', B400)
|
|
25
28
|
},
|
|
26
29
|
dark: {
|
|
27
|
-
lineColor: DN0,
|
|
28
|
-
|
|
30
|
+
lineColor: token('color.border.neutral', DN0),
|
|
31
|
+
hoveredColor: token('color.border.neutral', 'transparent'),
|
|
32
|
+
activeColor: token('color.border.neutral', 'transparent'),
|
|
33
|
+
selectedColor: token('color.text.selected', B75)
|
|
29
34
|
}
|
|
30
35
|
};
|
|
31
36
|
export var getTabLineColor = function getTabLineColor(mode) {
|
|
32
37
|
return tabLineColorMap[mode];
|
|
33
38
|
};
|
|
34
39
|
var tabPanelFocusColorMap = {
|
|
35
|
-
light: B100,
|
|
36
|
-
dark: B75
|
|
40
|
+
light: token('color.border.focus', B100),
|
|
41
|
+
dark: token('color.border.focus', B75)
|
|
37
42
|
};
|
|
38
43
|
export var getTabPanelFocusColor = function getTabPanelFocusColor(mode) {
|
|
39
44
|
return tabPanelFocusColorMap[mode];
|
|
@@ -95,13 +95,23 @@ export var getTabStyles = function getTabStyles(mode) {
|
|
|
95
95
|
overflow: 'hidden',
|
|
96
96
|
textOverflow: 'ellipsis',
|
|
97
97
|
'&:hover': {
|
|
98
|
-
|
|
98
|
+
// TODO: interaction states will be reviewed in DSP-1438
|
|
99
|
+
color: colors.hoverLabelColor,
|
|
100
|
+
'&::after': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
|
|
101
|
+
borderBottom: "".concat(underlineHeight, " solid ").concat(getTabLineColor(mode).hoveredColor),
|
|
102
|
+
height: 0
|
|
103
|
+
})
|
|
99
104
|
},
|
|
100
|
-
'&:active
|
|
101
|
-
|
|
105
|
+
'&:active': {
|
|
106
|
+
// TODO: interaction states will be reviewed in DSP-1438
|
|
107
|
+
color: colors.activeLabelColor,
|
|
108
|
+
'&::after': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
|
|
109
|
+
borderBottom: "".concat(underlineHeight, " solid ").concat(getTabLineColor(mode).activeColor),
|
|
110
|
+
height: 0
|
|
111
|
+
})
|
|
102
112
|
},
|
|
103
113
|
'&:focus': {
|
|
104
|
-
boxShadow: "0 0 0 2px ".concat(colors.
|
|
114
|
+
boxShadow: "0 0 0 2px ".concat(colors.focusBorderColor, " inset"),
|
|
105
115
|
borderRadius: borderRadius,
|
|
106
116
|
outline: 'none',
|
|
107
117
|
// Hide TabLine on focus
|
package/dist/esm/version.json
CHANGED
|
@@ -4,11 +4,13 @@ export declare type TabColors = {
|
|
|
4
4
|
activeLabelColor: string;
|
|
5
5
|
hoverLabelColor: string;
|
|
6
6
|
selectedColor: string;
|
|
7
|
-
|
|
7
|
+
focusBorderColor: string;
|
|
8
8
|
};
|
|
9
9
|
export declare const getTabColors: (mode: ThemeModes) => TabColors;
|
|
10
10
|
export declare type TabLineColors = {
|
|
11
11
|
lineColor: string;
|
|
12
|
+
hoveredColor: string;
|
|
13
|
+
activeColor: string;
|
|
12
14
|
selectedColor: string;
|
|
13
15
|
};
|
|
14
16
|
export declare const getTabLineColor: (mode: ThemeModes) => TabLineColors;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/tabs",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.2.3",
|
|
4
4
|
"description": "Tabs are used to organize content by grouping similar information on the same page.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
27
|
-
"@atlaskit/codemod-utils": "^3.
|
|
28
|
-
"@atlaskit/theme": "^
|
|
27
|
+
"@atlaskit/codemod-utils": "^3.4.0",
|
|
28
|
+
"@atlaskit/theme": "^12.0.0",
|
|
29
|
+
"@atlaskit/tokens": "^0.3.0",
|
|
29
30
|
"@babel/runtime": "^7.0.0",
|
|
30
31
|
"@emotion/core": "^10.0.9"
|
|
31
32
|
},
|
|
@@ -34,11 +35,12 @@
|
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@atlaskit/build-utils": "*",
|
|
37
|
-
"@atlaskit/button": "^16.
|
|
38
|
+
"@atlaskit/button": "^16.1.0",
|
|
38
39
|
"@atlaskit/docs": "*",
|
|
39
|
-
"@atlaskit/
|
|
40
|
+
"@atlaskit/section-message": "^6.1.0",
|
|
41
|
+
"@atlaskit/spinner": "^15.1.0",
|
|
40
42
|
"@atlaskit/ssr": "*",
|
|
41
|
-
"@atlaskit/tooltip": "^17.
|
|
43
|
+
"@atlaskit/tooltip": "^17.5.0",
|
|
42
44
|
"@atlaskit/visual-regression": "*",
|
|
43
45
|
"@atlaskit/webdriver-runner": "*",
|
|
44
46
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
@@ -56,18 +58,11 @@
|
|
|
56
58
|
"import-structure": "atlassian-conventions"
|
|
57
59
|
},
|
|
58
60
|
"@repo/internal": {
|
|
59
|
-
"ui-components":
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
],
|
|
65
|
-
"theming": [
|
|
66
|
-
"new-theming-api"
|
|
67
|
-
],
|
|
68
|
-
"deprecation": [
|
|
69
|
-
"no-deprecated-imports"
|
|
70
|
-
]
|
|
61
|
+
"ui-components": "lite-mode",
|
|
62
|
+
"analytics": "analytics-next",
|
|
63
|
+
"theming": "tokens",
|
|
64
|
+
"styling": "emotion",
|
|
65
|
+
"deprecation": "no-deprecated-imports"
|
|
71
66
|
}
|
|
72
67
|
},
|
|
73
68
|
"af:exports": {
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports.heavyPerformance = exports.performance = void 0;
|
|
11
|
-
|
|
12
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
-
|
|
14
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
-
|
|
16
|
-
var _react = _interopRequireDefault(require("react"));
|
|
17
|
-
|
|
18
|
-
var _react2 = require("@testing-library/react");
|
|
19
|
-
|
|
20
|
-
var _index = _interopRequireWildcard(require("../index"));
|
|
21
|
-
|
|
22
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
-
|
|
24
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
26
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
27
|
-
var interactionTasks = [{
|
|
28
|
-
name: 'Change tabs',
|
|
29
|
-
description: 'Change tabs',
|
|
30
|
-
run: function () {
|
|
31
|
-
var _run = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref) {
|
|
32
|
-
var container, controls, tab2;
|
|
33
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
34
|
-
while (1) {
|
|
35
|
-
switch (_context2.prev = _context2.next) {
|
|
36
|
-
case 0:
|
|
37
|
-
container = _ref.container, controls = _ref.controls;
|
|
38
|
-
tab2 = container.querySelector('div[data-testid="tab2"]');
|
|
39
|
-
|
|
40
|
-
if (!(tab2 == null)) {
|
|
41
|
-
_context2.next = 4;
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
throw new Error('Could not find tab element');
|
|
46
|
-
|
|
47
|
-
case 4:
|
|
48
|
-
_context2.next = 6;
|
|
49
|
-
return controls.time( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
50
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
51
|
-
while (1) {
|
|
52
|
-
switch (_context.prev = _context.next) {
|
|
53
|
-
case 0:
|
|
54
|
-
_react2.fireEvent.click(tab2);
|
|
55
|
-
|
|
56
|
-
case 1:
|
|
57
|
-
case "end":
|
|
58
|
-
return _context.stop();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}, _callee);
|
|
62
|
-
})));
|
|
63
|
-
|
|
64
|
-
case 6:
|
|
65
|
-
case "end":
|
|
66
|
-
return _context2.stop();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}, _callee2);
|
|
70
|
-
}));
|
|
71
|
-
|
|
72
|
-
function run(_x) {
|
|
73
|
-
return _run.apply(this, arguments);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return run;
|
|
77
|
-
}()
|
|
78
|
-
}];
|
|
79
|
-
|
|
80
|
-
function PerformanceComponent() {
|
|
81
|
-
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
82
|
-
id: "test"
|
|
83
|
-
}, /*#__PURE__*/_react.default.createElement(_index.TabList, null, /*#__PURE__*/_react.default.createElement(_index.Tab, {
|
|
84
|
-
testId: "tab1"
|
|
85
|
-
}, "Tab 1"), /*#__PURE__*/_react.default.createElement(_index.Tab, {
|
|
86
|
-
testId: "tab2"
|
|
87
|
-
}, "Tab 2"), /*#__PURE__*/_react.default.createElement(_index.Tab, null, "Tab 3"), /*#__PURE__*/_react.default.createElement(_index.Tab, null, "Tab 4")), /*#__PURE__*/_react.default.createElement(_index.TabPanel, null, "One"), /*#__PURE__*/_react.default.createElement(_index.TabPanel, null, "Two"), /*#__PURE__*/_react.default.createElement(_index.TabPanel, null, "Three"), /*#__PURE__*/_react.default.createElement(_index.TabPanel, null, "Four"));
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
var performance = function performance() {
|
|
91
|
-
return /*#__PURE__*/_react.default.createElement(PerformanceComponent, null);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
exports.performance = performance;
|
|
95
|
-
performance.story = {
|
|
96
|
-
name: 'Performance',
|
|
97
|
-
parameters: {
|
|
98
|
-
performance: {
|
|
99
|
-
interactions: interactionTasks
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
var heavyInteractionTasks = [{
|
|
104
|
-
name: 'Change tabs twice',
|
|
105
|
-
description: 'Change tabs twice',
|
|
106
|
-
run: function () {
|
|
107
|
-
var _run2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(_ref3) {
|
|
108
|
-
var container, controls, tab1, tab2;
|
|
109
|
-
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
110
|
-
while (1) {
|
|
111
|
-
switch (_context4.prev = _context4.next) {
|
|
112
|
-
case 0:
|
|
113
|
-
container = _ref3.container, controls = _ref3.controls;
|
|
114
|
-
tab1 = container.querySelector('div[data-testid="tab1"]');
|
|
115
|
-
tab2 = container.querySelector('div[data-testid="tab2"]');
|
|
116
|
-
|
|
117
|
-
if (!(tab1 === null || tab2 === null)) {
|
|
118
|
-
_context4.next = 5;
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
throw new Error('Could not find tab element');
|
|
123
|
-
|
|
124
|
-
case 5:
|
|
125
|
-
_react2.fireEvent.click(tab2);
|
|
126
|
-
|
|
127
|
-
_context4.next = 8;
|
|
128
|
-
return controls.time( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
129
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
130
|
-
while (1) {
|
|
131
|
-
switch (_context3.prev = _context3.next) {
|
|
132
|
-
case 0:
|
|
133
|
-
_react2.fireEvent.click(tab1);
|
|
134
|
-
|
|
135
|
-
case 1:
|
|
136
|
-
case "end":
|
|
137
|
-
return _context3.stop();
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}, _callee3);
|
|
141
|
-
})));
|
|
142
|
-
|
|
143
|
-
case 8:
|
|
144
|
-
case "end":
|
|
145
|
-
return _context4.stop();
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}, _callee4);
|
|
149
|
-
}));
|
|
150
|
-
|
|
151
|
-
function run(_x2) {
|
|
152
|
-
return _run2.apply(this, arguments);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return run;
|
|
156
|
-
}()
|
|
157
|
-
}];
|
|
158
|
-
|
|
159
|
-
function HeavyContent(_ref5) {
|
|
160
|
-
var text = _ref5.text;
|
|
161
|
-
return /*#__PURE__*/_react.default.createElement("div", null, Array(100).fill(undefined).map(function () {
|
|
162
|
-
return /*#__PURE__*/_react.default.createElement("div", null, text);
|
|
163
|
-
}));
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function HeavyPanelPerformanceComponent() {
|
|
167
|
-
return /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
168
|
-
id: "heavy"
|
|
169
|
-
}, /*#__PURE__*/_react.default.createElement(_index.TabList, null, /*#__PURE__*/_react.default.createElement(_index.Tab, {
|
|
170
|
-
testId: "tab1"
|
|
171
|
-
}, "Tab 1"), /*#__PURE__*/_react.default.createElement(_index.Tab, {
|
|
172
|
-
testId: "tab2"
|
|
173
|
-
}, "Tab 2"), /*#__PURE__*/_react.default.createElement(_index.Tab, null, "Tab 3"), /*#__PURE__*/_react.default.createElement(_index.Tab, null, "Tab 4")), /*#__PURE__*/_react.default.createElement(_index.TabPanel, null, /*#__PURE__*/_react.default.createElement(HeavyContent, {
|
|
174
|
-
text: "One"
|
|
175
|
-
})), /*#__PURE__*/_react.default.createElement(_index.TabPanel, null, /*#__PURE__*/_react.default.createElement(HeavyContent, {
|
|
176
|
-
text: "Two"
|
|
177
|
-
})), /*#__PURE__*/_react.default.createElement(_index.TabPanel, null, /*#__PURE__*/_react.default.createElement(HeavyContent, {
|
|
178
|
-
text: "Three"
|
|
179
|
-
})), /*#__PURE__*/_react.default.createElement(_index.TabPanel, null, /*#__PURE__*/_react.default.createElement(HeavyContent, {
|
|
180
|
-
text: "Four"
|
|
181
|
-
})));
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
var heavyPerformance = function heavyPerformance() {
|
|
185
|
-
return /*#__PURE__*/_react.default.createElement(HeavyPanelPerformanceComponent, null);
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
exports.heavyPerformance = heavyPerformance;
|
|
189
|
-
heavyPerformance.story = {
|
|
190
|
-
name: 'Performance with heavy panels',
|
|
191
|
-
parameters: {
|
|
192
|
-
performance: {
|
|
193
|
-
interactions: heavyInteractionTasks
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
};
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import React from 'react'; // eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
-
|
|
3
|
-
import { fireEvent } from '@testing-library/react';
|
|
4
|
-
import Tabs, { Tab, TabList, TabPanel } from '../index';
|
|
5
|
-
const interactionTasks = [{
|
|
6
|
-
name: 'Change tabs',
|
|
7
|
-
description: 'Change tabs',
|
|
8
|
-
run: async ({
|
|
9
|
-
container,
|
|
10
|
-
controls
|
|
11
|
-
}) => {
|
|
12
|
-
const tab2 = container.querySelector('div[data-testid="tab2"]');
|
|
13
|
-
|
|
14
|
-
if (tab2 == null) {
|
|
15
|
-
throw new Error('Could not find tab element');
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
await controls.time(async () => {
|
|
19
|
-
fireEvent.click(tab2);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}];
|
|
23
|
-
|
|
24
|
-
function PerformanceComponent() {
|
|
25
|
-
return /*#__PURE__*/React.createElement(Tabs, {
|
|
26
|
-
id: "test"
|
|
27
|
-
}, /*#__PURE__*/React.createElement(TabList, null, /*#__PURE__*/React.createElement(Tab, {
|
|
28
|
-
testId: "tab1"
|
|
29
|
-
}, "Tab 1"), /*#__PURE__*/React.createElement(Tab, {
|
|
30
|
-
testId: "tab2"
|
|
31
|
-
}, "Tab 2"), /*#__PURE__*/React.createElement(Tab, null, "Tab 3"), /*#__PURE__*/React.createElement(Tab, null, "Tab 4")), /*#__PURE__*/React.createElement(TabPanel, null, "One"), /*#__PURE__*/React.createElement(TabPanel, null, "Two"), /*#__PURE__*/React.createElement(TabPanel, null, "Three"), /*#__PURE__*/React.createElement(TabPanel, null, "Four"));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const performance = () => /*#__PURE__*/React.createElement(PerformanceComponent, null);
|
|
35
|
-
performance.story = {
|
|
36
|
-
name: 'Performance',
|
|
37
|
-
parameters: {
|
|
38
|
-
performance: {
|
|
39
|
-
interactions: interactionTasks
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
const heavyInteractionTasks = [{
|
|
44
|
-
name: 'Change tabs twice',
|
|
45
|
-
description: 'Change tabs twice',
|
|
46
|
-
run: async ({
|
|
47
|
-
container,
|
|
48
|
-
controls
|
|
49
|
-
}) => {
|
|
50
|
-
const tab1 = container.querySelector('div[data-testid="tab1"]');
|
|
51
|
-
const tab2 = container.querySelector('div[data-testid="tab2"]');
|
|
52
|
-
|
|
53
|
-
if (tab1 === null || tab2 === null) {
|
|
54
|
-
throw new Error('Could not find tab element');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
fireEvent.click(tab2);
|
|
58
|
-
await controls.time(async () => {
|
|
59
|
-
fireEvent.click(tab1);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}];
|
|
63
|
-
|
|
64
|
-
function HeavyContent({
|
|
65
|
-
text
|
|
66
|
-
}) {
|
|
67
|
-
return /*#__PURE__*/React.createElement("div", null, Array(100).fill(undefined).map(() => /*#__PURE__*/React.createElement("div", null, text)));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function HeavyPanelPerformanceComponent() {
|
|
71
|
-
return /*#__PURE__*/React.createElement(Tabs, {
|
|
72
|
-
id: "heavy"
|
|
73
|
-
}, /*#__PURE__*/React.createElement(TabList, null, /*#__PURE__*/React.createElement(Tab, {
|
|
74
|
-
testId: "tab1"
|
|
75
|
-
}, "Tab 1"), /*#__PURE__*/React.createElement(Tab, {
|
|
76
|
-
testId: "tab2"
|
|
77
|
-
}, "Tab 2"), /*#__PURE__*/React.createElement(Tab, null, "Tab 3"), /*#__PURE__*/React.createElement(Tab, null, "Tab 4")), /*#__PURE__*/React.createElement(TabPanel, null, /*#__PURE__*/React.createElement(HeavyContent, {
|
|
78
|
-
text: "One"
|
|
79
|
-
})), /*#__PURE__*/React.createElement(TabPanel, null, /*#__PURE__*/React.createElement(HeavyContent, {
|
|
80
|
-
text: "Two"
|
|
81
|
-
})), /*#__PURE__*/React.createElement(TabPanel, null, /*#__PURE__*/React.createElement(HeavyContent, {
|
|
82
|
-
text: "Three"
|
|
83
|
-
})), /*#__PURE__*/React.createElement(TabPanel, null, /*#__PURE__*/React.createElement(HeavyContent, {
|
|
84
|
-
text: "Four"
|
|
85
|
-
})));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export const heavyPerformance = () => /*#__PURE__*/React.createElement(HeavyPanelPerformanceComponent, null);
|
|
89
|
-
heavyPerformance.story = {
|
|
90
|
-
name: 'Performance with heavy panels',
|
|
91
|
-
parameters: {
|
|
92
|
-
performance: {
|
|
93
|
-
interactions: heavyInteractionTasks
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
};
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
-
import React from 'react'; // eslint-disable-next-line import/no-extraneous-dependencies
|
|
4
|
-
|
|
5
|
-
import { fireEvent } from '@testing-library/react';
|
|
6
|
-
import Tabs, { Tab, TabList, TabPanel } from '../index';
|
|
7
|
-
var interactionTasks = [{
|
|
8
|
-
name: 'Change tabs',
|
|
9
|
-
description: 'Change tabs',
|
|
10
|
-
run: function () {
|
|
11
|
-
var _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref) {
|
|
12
|
-
var container, controls, tab2;
|
|
13
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
14
|
-
while (1) {
|
|
15
|
-
switch (_context2.prev = _context2.next) {
|
|
16
|
-
case 0:
|
|
17
|
-
container = _ref.container, controls = _ref.controls;
|
|
18
|
-
tab2 = container.querySelector('div[data-testid="tab2"]');
|
|
19
|
-
|
|
20
|
-
if (!(tab2 == null)) {
|
|
21
|
-
_context2.next = 4;
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
throw new Error('Could not find tab element');
|
|
26
|
-
|
|
27
|
-
case 4:
|
|
28
|
-
_context2.next = 6;
|
|
29
|
-
return controls.time( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
30
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
31
|
-
while (1) {
|
|
32
|
-
switch (_context.prev = _context.next) {
|
|
33
|
-
case 0:
|
|
34
|
-
fireEvent.click(tab2);
|
|
35
|
-
|
|
36
|
-
case 1:
|
|
37
|
-
case "end":
|
|
38
|
-
return _context.stop();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}, _callee);
|
|
42
|
-
})));
|
|
43
|
-
|
|
44
|
-
case 6:
|
|
45
|
-
case "end":
|
|
46
|
-
return _context2.stop();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}, _callee2);
|
|
50
|
-
}));
|
|
51
|
-
|
|
52
|
-
function run(_x) {
|
|
53
|
-
return _run.apply(this, arguments);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return run;
|
|
57
|
-
}()
|
|
58
|
-
}];
|
|
59
|
-
|
|
60
|
-
function PerformanceComponent() {
|
|
61
|
-
return /*#__PURE__*/React.createElement(Tabs, {
|
|
62
|
-
id: "test"
|
|
63
|
-
}, /*#__PURE__*/React.createElement(TabList, null, /*#__PURE__*/React.createElement(Tab, {
|
|
64
|
-
testId: "tab1"
|
|
65
|
-
}, "Tab 1"), /*#__PURE__*/React.createElement(Tab, {
|
|
66
|
-
testId: "tab2"
|
|
67
|
-
}, "Tab 2"), /*#__PURE__*/React.createElement(Tab, null, "Tab 3"), /*#__PURE__*/React.createElement(Tab, null, "Tab 4")), /*#__PURE__*/React.createElement(TabPanel, null, "One"), /*#__PURE__*/React.createElement(TabPanel, null, "Two"), /*#__PURE__*/React.createElement(TabPanel, null, "Three"), /*#__PURE__*/React.createElement(TabPanel, null, "Four"));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export var performance = function performance() {
|
|
71
|
-
return /*#__PURE__*/React.createElement(PerformanceComponent, null);
|
|
72
|
-
};
|
|
73
|
-
performance.story = {
|
|
74
|
-
name: 'Performance',
|
|
75
|
-
parameters: {
|
|
76
|
-
performance: {
|
|
77
|
-
interactions: interactionTasks
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
var heavyInteractionTasks = [{
|
|
82
|
-
name: 'Change tabs twice',
|
|
83
|
-
description: 'Change tabs twice',
|
|
84
|
-
run: function () {
|
|
85
|
-
var _run2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref3) {
|
|
86
|
-
var container, controls, tab1, tab2;
|
|
87
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
88
|
-
while (1) {
|
|
89
|
-
switch (_context4.prev = _context4.next) {
|
|
90
|
-
case 0:
|
|
91
|
-
container = _ref3.container, controls = _ref3.controls;
|
|
92
|
-
tab1 = container.querySelector('div[data-testid="tab1"]');
|
|
93
|
-
tab2 = container.querySelector('div[data-testid="tab2"]');
|
|
94
|
-
|
|
95
|
-
if (!(tab1 === null || tab2 === null)) {
|
|
96
|
-
_context4.next = 5;
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
throw new Error('Could not find tab element');
|
|
101
|
-
|
|
102
|
-
case 5:
|
|
103
|
-
fireEvent.click(tab2);
|
|
104
|
-
_context4.next = 8;
|
|
105
|
-
return controls.time( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
106
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
107
|
-
while (1) {
|
|
108
|
-
switch (_context3.prev = _context3.next) {
|
|
109
|
-
case 0:
|
|
110
|
-
fireEvent.click(tab1);
|
|
111
|
-
|
|
112
|
-
case 1:
|
|
113
|
-
case "end":
|
|
114
|
-
return _context3.stop();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}, _callee3);
|
|
118
|
-
})));
|
|
119
|
-
|
|
120
|
-
case 8:
|
|
121
|
-
case "end":
|
|
122
|
-
return _context4.stop();
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}, _callee4);
|
|
126
|
-
}));
|
|
127
|
-
|
|
128
|
-
function run(_x2) {
|
|
129
|
-
return _run2.apply(this, arguments);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return run;
|
|
133
|
-
}()
|
|
134
|
-
}];
|
|
135
|
-
|
|
136
|
-
function HeavyContent(_ref5) {
|
|
137
|
-
var text = _ref5.text;
|
|
138
|
-
return /*#__PURE__*/React.createElement("div", null, Array(100).fill(undefined).map(function () {
|
|
139
|
-
return /*#__PURE__*/React.createElement("div", null, text);
|
|
140
|
-
}));
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function HeavyPanelPerformanceComponent() {
|
|
144
|
-
return /*#__PURE__*/React.createElement(Tabs, {
|
|
145
|
-
id: "heavy"
|
|
146
|
-
}, /*#__PURE__*/React.createElement(TabList, null, /*#__PURE__*/React.createElement(Tab, {
|
|
147
|
-
testId: "tab1"
|
|
148
|
-
}, "Tab 1"), /*#__PURE__*/React.createElement(Tab, {
|
|
149
|
-
testId: "tab2"
|
|
150
|
-
}, "Tab 2"), /*#__PURE__*/React.createElement(Tab, null, "Tab 3"), /*#__PURE__*/React.createElement(Tab, null, "Tab 4")), /*#__PURE__*/React.createElement(TabPanel, null, /*#__PURE__*/React.createElement(HeavyContent, {
|
|
151
|
-
text: "One"
|
|
152
|
-
})), /*#__PURE__*/React.createElement(TabPanel, null, /*#__PURE__*/React.createElement(HeavyContent, {
|
|
153
|
-
text: "Two"
|
|
154
|
-
})), /*#__PURE__*/React.createElement(TabPanel, null, /*#__PURE__*/React.createElement(HeavyContent, {
|
|
155
|
-
text: "Three"
|
|
156
|
-
})), /*#__PURE__*/React.createElement(TabPanel, null, /*#__PURE__*/React.createElement(HeavyContent, {
|
|
157
|
-
text: "Four"
|
|
158
|
-
})));
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export var heavyPerformance = function heavyPerformance() {
|
|
162
|
-
return /*#__PURE__*/React.createElement(HeavyPanelPerformanceComponent, null);
|
|
163
|
-
};
|
|
164
|
-
heavyPerformance.story = {
|
|
165
|
-
name: 'Performance with heavy panels',
|
|
166
|
-
parameters: {
|
|
167
|
-
performance: {
|
|
168
|
-
interactions: heavyInteractionTasks
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
};
|