@atlaskit/tabs 13.2.0 → 13.2.4

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 CHANGED
@@ -1,5 +1,30 @@
1
1
  # @atlaskit/tabs
2
2
 
3
+ ## 13.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f460cc7c411`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f460cc7c411) - Builds for this package now pass through a tokens babel plugin, removing runtime invocations of the tokens() function and improving bundle size.
8
+ - Updated dependencies
9
+
10
+ ## 13.2.3
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 13.2.2
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
22
+ ## 13.2.1
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies
27
+
3
28
  ## 13.2.0
4
29
 
5
30
  ### Minor Changes
@@ -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.2.0"
39
+ packageVersion: "13.2.4"
40
40
  };
41
41
 
42
42
  var getTabPanelWithContext = function getTabPanelWithContext(_ref) {
@@ -7,22 +7,20 @@ 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
-
12
10
  var tabColorMap = {
13
11
  light: {
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)
12
+ labelColor: "var(--ds-text-mediumEmphasis, ".concat(_colors.N500, ")"),
13
+ activeLabelColor: "var(--ds-text-highEmphasis, ".concat(_colors.B500, ")"),
14
+ hoverLabelColor: "var(--ds-text-mediumEmphasis, ".concat(_colors.B400, ")"),
15
+ selectedColor: "var(--ds-text-selected, ".concat(_colors.B400, ")"),
16
+ focusBorderColor: "var(--ds-border-focus, ".concat(_colors.B100, ")")
19
17
  },
20
18
  dark: {
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)
19
+ labelColor: "var(--ds-text-mediumEmphasis, ".concat(_colors.DN400, ")"),
20
+ activeLabelColor: "var(--ds-text-highEmphasis, ".concat(_colors.B200, ")"),
21
+ hoverLabelColor: "var(--ds-text-mediumEmphasis, ".concat(_colors.B75, ")"),
22
+ selectedColor: "var(--ds-text-selected, ".concat(_colors.B75, ")"),
23
+ focusBorderColor: "var(--ds-border-focus, ".concat(_colors.B75, ")")
26
24
  }
27
25
  };
28
26
 
@@ -33,16 +31,16 @@ var getTabColors = function getTabColors(mode) {
33
31
  exports.getTabColors = getTabColors;
34
32
  var tabLineColorMap = {
35
33
  light: {
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)
34
+ lineColor: "var(--ds-border-neutral, ".concat(_colors.N30, ")"),
35
+ hoveredColor: "var(--ds-border-neutral, transparent)",
36
+ activeColor: "var(--ds-border-neutral, transparent)",
37
+ selectedColor: "var(--ds-text-selected, ".concat(_colors.B400, ")")
40
38
  },
41
39
  dark: {
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
+ lineColor: "var(--ds-border-neutral, ".concat(_colors.DN0, ")"),
41
+ hoveredColor: "var(--ds-border-neutral, transparent)",
42
+ activeColor: "var(--ds-border-neutral, transparent)",
43
+ selectedColor: "var(--ds-text-selected, ".concat(_colors.B75, ")")
46
44
  }
47
45
  };
48
46
 
@@ -52,8 +50,8 @@ var getTabLineColor = function getTabLineColor(mode) {
52
50
 
53
51
  exports.getTabLineColor = getTabLineColor;
54
52
  var tabPanelFocusColorMap = {
55
- light: (0, _tokens.token)('color.border.focus', _colors.B100),
56
- dark: (0, _tokens.token)('color.border.focus', _colors.B75)
53
+ light: "var(--ds-border-focus, ".concat(_colors.B100, ")"),
54
+ dark: "var(--ds-border-focus, ".concat(_colors.B75, ")")
57
55
  };
58
56
 
59
57
  var getTabPanelFocusColor = function getTabPanelFocusColor(mode) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/tabs",
3
- "version": "13.2.0",
3
+ "version": "13.2.4",
4
4
  "sideEffects": false
5
5
  }
@@ -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.2.0"
14
+ packageVersion: "13.2.4"
15
15
  };
16
16
 
17
17
  const getTabPanelWithContext = ({
@@ -1,19 +1,18 @@
1
1
  import { B100, B200, B400, B500, B75, DN0, DN400, N30, N500 } from '@atlaskit/theme/colors';
2
- import { token } from '@atlaskit/tokens';
3
2
  const tabColorMap = {
4
3
  light: {
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)
4
+ labelColor: `var(--ds-text-mediumEmphasis, ${N500})`,
5
+ activeLabelColor: `var(--ds-text-highEmphasis, ${B500})`,
6
+ hoverLabelColor: `var(--ds-text-mediumEmphasis, ${B400})`,
7
+ selectedColor: `var(--ds-text-selected, ${B400})`,
8
+ focusBorderColor: `var(--ds-border-focus, ${B100})`
10
9
  },
11
10
  dark: {
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)
11
+ labelColor: `var(--ds-text-mediumEmphasis, ${DN400})`,
12
+ activeLabelColor: `var(--ds-text-highEmphasis, ${B200})`,
13
+ hoverLabelColor: `var(--ds-text-mediumEmphasis, ${B75})`,
14
+ selectedColor: `var(--ds-text-selected, ${B75})`,
15
+ focusBorderColor: `var(--ds-border-focus, ${B75})`
17
16
  }
18
17
  };
19
18
  export const getTabColors = mode => {
@@ -21,21 +20,21 @@ export const getTabColors = mode => {
21
20
  };
22
21
  const tabLineColorMap = {
23
22
  light: {
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)
23
+ lineColor: `var(--ds-border-neutral, ${N30})`,
24
+ hoveredColor: "var(--ds-border-neutral, transparent)",
25
+ activeColor: "var(--ds-border-neutral, transparent)",
26
+ selectedColor: `var(--ds-text-selected, ${B400})`
28
27
  },
29
28
  dark: {
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
+ lineColor: `var(--ds-border-neutral, ${DN0})`,
30
+ hoveredColor: "var(--ds-border-neutral, transparent)",
31
+ activeColor: "var(--ds-border-neutral, transparent)",
32
+ selectedColor: `var(--ds-text-selected, ${B75})`
34
33
  }
35
34
  };
36
35
  export const getTabLineColor = mode => tabLineColorMap[mode];
37
36
  const tabPanelFocusColorMap = {
38
- light: token('color.border.focus', B100),
39
- dark: token('color.border.focus', B75)
37
+ light: `var(--ds-border-focus, ${B100})`,
38
+ dark: `var(--ds-border-focus, ${B75})`
40
39
  };
41
40
  export const getTabPanelFocusColor = mode => tabPanelFocusColorMap[mode];
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/tabs",
3
- "version": "13.2.0",
3
+ "version": "13.2.4",
4
4
  "sideEffects": false
5
5
  }
@@ -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.2.0"
21
+ packageVersion: "13.2.4"
22
22
  };
23
23
 
24
24
  var getTabPanelWithContext = function getTabPanelWithContext(_ref) {
@@ -1,19 +1,18 @@
1
1
  import { B100, B200, B400, B500, B75, DN0, DN400, N30, N500 } from '@atlaskit/theme/colors';
2
- import { token } from '@atlaskit/tokens';
3
2
  var tabColorMap = {
4
3
  light: {
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)
4
+ labelColor: "var(--ds-text-mediumEmphasis, ".concat(N500, ")"),
5
+ activeLabelColor: "var(--ds-text-highEmphasis, ".concat(B500, ")"),
6
+ hoverLabelColor: "var(--ds-text-mediumEmphasis, ".concat(B400, ")"),
7
+ selectedColor: "var(--ds-text-selected, ".concat(B400, ")"),
8
+ focusBorderColor: "var(--ds-border-focus, ".concat(B100, ")")
10
9
  },
11
10
  dark: {
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)
11
+ labelColor: "var(--ds-text-mediumEmphasis, ".concat(DN400, ")"),
12
+ activeLabelColor: "var(--ds-text-highEmphasis, ".concat(B200, ")"),
13
+ hoverLabelColor: "var(--ds-text-mediumEmphasis, ".concat(B75, ")"),
14
+ selectedColor: "var(--ds-text-selected, ".concat(B75, ")"),
15
+ focusBorderColor: "var(--ds-border-focus, ".concat(B75, ")")
17
16
  }
18
17
  };
19
18
  export var getTabColors = function getTabColors(mode) {
@@ -21,24 +20,24 @@ export var getTabColors = function getTabColors(mode) {
21
20
  };
22
21
  var tabLineColorMap = {
23
22
  light: {
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)
23
+ lineColor: "var(--ds-border-neutral, ".concat(N30, ")"),
24
+ hoveredColor: "var(--ds-border-neutral, transparent)",
25
+ activeColor: "var(--ds-border-neutral, transparent)",
26
+ selectedColor: "var(--ds-text-selected, ".concat(B400, ")")
28
27
  },
29
28
  dark: {
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
+ lineColor: "var(--ds-border-neutral, ".concat(DN0, ")"),
30
+ hoveredColor: "var(--ds-border-neutral, transparent)",
31
+ activeColor: "var(--ds-border-neutral, transparent)",
32
+ selectedColor: "var(--ds-text-selected, ".concat(B75, ")")
34
33
  }
35
34
  };
36
35
  export var getTabLineColor = function getTabLineColor(mode) {
37
36
  return tabLineColorMap[mode];
38
37
  };
39
38
  var tabPanelFocusColorMap = {
40
- light: token('color.border.focus', B100),
41
- dark: token('color.border.focus', B75)
39
+ light: "var(--ds-border-focus, ".concat(B100, ")"),
40
+ dark: "var(--ds-border-focus, ".concat(B75, ")")
42
41
  };
43
42
  export var getTabPanelFocusColor = function getTabPanelFocusColor(mode) {
44
43
  return tabPanelFocusColorMap[mode];
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/tabs",
3
- "version": "13.2.0",
3
+ "version": "13.2.4",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/tabs",
3
- "version": "13.2.0",
3
+ "version": "13.2.4",
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,9 +24,9 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@atlaskit/analytics-next": "^8.2.0",
27
- "@atlaskit/codemod-utils": "^3.2.0",
28
- "@atlaskit/theme": "^11.4.0",
29
- "@atlaskit/tokens": "^0.1.0",
27
+ "@atlaskit/codemod-utils": "^3.4.0",
28
+ "@atlaskit/theme": "^12.0.0",
29
+ "@atlaskit/tokens": "^0.4.0",
30
30
  "@babel/runtime": "^7.0.0",
31
31
  "@emotion/core": "^10.0.9"
32
32
  },
@@ -40,7 +40,7 @@
40
40
  "@atlaskit/section-message": "^6.1.0",
41
41
  "@atlaskit/spinner": "^15.1.0",
42
42
  "@atlaskit/ssr": "*",
43
- "@atlaskit/tooltip": "^17.4.0",
43
+ "@atlaskit/tooltip": "^17.5.0",
44
44
  "@atlaskit/visual-regression": "*",
45
45
  "@atlaskit/webdriver-runner": "*",
46
46
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
@@ -61,7 +61,10 @@
61
61
  "ui-components": "lite-mode",
62
62
  "analytics": "analytics-next",
63
63
  "theming": "tokens",
64
- "styling": "emotion",
64
+ "styling": [
65
+ "static",
66
+ "emotion"
67
+ ],
65
68
  "deprecation": "no-deprecated-imports"
66
69
  }
67
70
  },
@@ -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
- };