@atlaskit/tabs 13.2.13 → 13.3.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/components/tab-list.js +5 -5
  3. package/dist/cjs/components/tab-panel.js +2 -2
  4. package/dist/cjs/components/tab.js +2 -2
  5. package/dist/cjs/components/tabs.js +7 -7
  6. package/dist/cjs/internal/styles.js +34 -29
  7. package/dist/cjs/version.json +1 -1
  8. package/dist/es2019/components/tab-list.js +1 -1
  9. package/dist/es2019/components/tab-panel.js +1 -1
  10. package/dist/es2019/components/tab.js +1 -1
  11. package/dist/es2019/components/tabs.js +2 -2
  12. package/dist/es2019/internal/styles.js +15 -13
  13. package/dist/es2019/version.json +1 -1
  14. package/dist/esm/components/tab-list.js +1 -1
  15. package/dist/esm/components/tab-panel.js +1 -1
  16. package/dist/esm/components/tab.js +1 -1
  17. package/dist/esm/components/tabs.js +2 -2
  18. package/dist/esm/internal/styles.js +33 -29
  19. package/dist/esm/version.json +1 -1
  20. package/dist/types/components/tab-list.d.ts +2 -2
  21. package/dist/types/components/tab-panel.d.ts +3 -2
  22. package/dist/types/components/tab.d.ts +3 -2
  23. package/dist/types/components/tabs.d.ts +2 -2
  24. package/dist/types/internal/styles.d.ts +3 -3
  25. package/dist/types-ts4.0/components/tab-list.d.ts +13 -0
  26. package/dist/types-ts4.0/components/tab-panel.d.ts +14 -0
  27. package/dist/types-ts4.0/components/tab.d.ts +13 -0
  28. package/dist/types-ts4.0/components/tabs.d.ts +13 -0
  29. package/dist/types-ts4.0/hooks.d.ts +3 -0
  30. package/dist/types-ts4.0/index.d.ts +6 -0
  31. package/dist/types-ts4.0/internal/colors.d.ts +17 -0
  32. package/dist/types-ts4.0/internal/context.d.ts +5 -0
  33. package/dist/types-ts4.0/internal/styles.d.ts +5 -0
  34. package/dist/types-ts4.0/internal/utils.d.ts +2 -0
  35. package/dist/types-ts4.0/performance/examples.d.ts +24 -0
  36. package/dist/types-ts4.0/types.d.ts +196 -0
  37. package/hooks/package.json +8 -1
  38. package/package.json +13 -6
  39. package/types/package.json +8 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/tabs
2
2
 
3
+ ## 13.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
8
+
9
+ ## 13.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`7ec1c1a023f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7ec1c1a023f) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behavior change.
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 13.2.13
4
20
 
5
21
  ### Patch Changes
@@ -11,7 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
 
12
12
  var _react = require("react");
13
13
 
14
- var _core = require("@emotion/core");
14
+ var _react2 = require("@emotion/react");
15
15
 
16
16
  var _components = _interopRequireDefault(require("@atlaskit/theme/components"));
17
17
 
@@ -87,7 +87,7 @@ var TabListWithMode = function TabListWithMode(props) {
87
87
  var tab = _ref.tab,
88
88
  isSelected = _ref.isSelected,
89
89
  index = _ref.index;
90
- return (0, _core.jsx)(_context.TabContext.Provider, {
90
+ return (0, _react2.jsx)(_context.TabContext.Provider, {
91
91
  value: {
92
92
  onClick: function onClick() {
93
93
  return onChange(index);
@@ -106,7 +106,7 @@ var TabListWithMode = function TabListWithMode(props) {
106
106
  }, tab);
107
107
  }, [length, onKeyDown, onChange, tabsId]);
108
108
  return (// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
109
- (0, _core.jsx)("div", {
109
+ (0, _react2.jsx)("div", {
110
110
  role: "tablist",
111
111
  css: styles,
112
112
  ref: ref
@@ -131,9 +131,9 @@ var TabListWithMode = function TabListWithMode(props) {
131
131
 
132
132
 
133
133
  var TabList = function TabList(props) {
134
- return (0, _core.jsx)(_components.default.Consumer, null, function (_ref2) {
134
+ return (0, _react2.jsx)(_components.default.Consumer, null, function (_ref2) {
135
135
  var mode = _ref2.mode;
136
- return (0, _core.jsx)(TabListWithMode, (0, _extends2.default)({}, props, {
136
+ return (0, _react2.jsx)(TabListWithMode, (0, _extends2.default)({}, props, {
137
137
  mode: mode
138
138
  }));
139
139
  });
@@ -9,7 +9,7 @@ exports.default = void 0;
9
9
 
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
 
12
- var _core = require("@emotion/core");
12
+ var _react = require("@emotion/react");
13
13
 
14
14
  var _hooks = require("../hooks");
15
15
 
@@ -29,7 +29,7 @@ var TabPanel = function TabPanel(_ref) {
29
29
  var children = _ref.children,
30
30
  testId = _ref.testId;
31
31
  var tabPanelAttributes = (0, _hooks.useTabPanel)();
32
- return (0, _core.jsx)("div", (0, _extends2.default)({
32
+ return (0, _react.jsx)("div", (0, _extends2.default)({
33
33
  "data-testid": testId
34
34
  }, tabPanelAttributes), children);
35
35
  };
@@ -9,7 +9,7 @@ exports.default = Tab;
9
9
 
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
 
12
- var _core = require("@emotion/core");
12
+ var _react = require("@emotion/react");
13
13
 
14
14
  var _hooks = require("../hooks");
15
15
 
@@ -28,7 +28,7 @@ function Tab(_ref) {
28
28
  var children = _ref.children,
29
29
  testId = _ref.testId;
30
30
  var tabAttributes = (0, _hooks.useTab)();
31
- return (0, _core.jsx)("div", (0, _extends2.default)({
31
+ return (0, _react.jsx)("div", (0, _extends2.default)({
32
32
  "data-testid": testId
33
33
  }, tabAttributes), children);
34
34
  }
@@ -17,7 +17,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
17
17
 
18
18
  var _react = require("react");
19
19
 
20
- var _core = require("@emotion/core");
20
+ var _react2 = require("@emotion/react");
21
21
 
22
22
  var _usePlatformLeafEventHandler = require("@atlaskit/analytics-next/usePlatformLeafEventHandler");
23
23
 
@@ -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.13"
39
+ packageVersion: "13.3.1"
40
40
  };
41
41
 
42
42
  var getTabPanelWithContext = function getTabPanelWithContext(_ref) {
@@ -45,7 +45,7 @@ var getTabPanelWithContext = function getTabPanelWithContext(_ref) {
45
45
  isSelected = _ref.isSelected,
46
46
  tabsId = _ref.tabsId;
47
47
  return (// Ensure tabPanel exists in case it has been removed
48
- tabPanel && (0, _core.jsx)(_context.TabPanelContext.Provider, {
48
+ tabPanel && (0, _react2.jsx)(_context.TabPanelContext.Provider, {
49
49
  value: {
50
50
  role: 'tabpanel',
51
51
  id: "".concat(tabsId, "-").concat(index, "-tab"),
@@ -125,10 +125,10 @@ var TabsWithMode = function TabsWithMode(props) {
125
125
  return (0, _styles.getTabsStyles)(mode);
126
126
  }, [mode]);
127
127
  return (// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
128
- (0, _core.jsx)("div", {
128
+ (0, _react2.jsx)("div", {
129
129
  "data-testid": testId,
130
130
  css: tabsStyles
131
- }, (0, _core.jsx)(_context.TabListContext.Provider, {
131
+ }, (0, _react2.jsx)(_context.TabListContext.Provider, {
132
132
  value: {
133
133
  selected: selected,
134
134
  onChange: onChangeAnalytics,
@@ -149,9 +149,9 @@ var TabsWithMode = function TabsWithMode(props) {
149
149
 
150
150
 
151
151
  var Tabs = function Tabs(props) {
152
- return (0, _core.jsx)(_components.default.Consumer, null, function (_ref2) {
152
+ return (0, _react2.jsx)(_components.default.Consumer, null, function (_ref2) {
153
153
  var mode = _ref2.mode;
154
- return (0, _core.jsx)(TabsWithMode, (0, _extends2.default)({}, props, {
154
+ return (0, _react2.jsx)(TabsWithMode, (0, _extends2.default)({}, props, {
155
155
  mode: mode
156
156
  }));
157
157
  });
@@ -9,6 +9,8 @@ exports.getTabsStyles = exports.getTabStyles = exports.getTabListStyles = void 0
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
+ var _react = require("@emotion/react");
13
+
12
14
  var _constants = require("@atlaskit/theme/constants");
13
15
 
14
16
  var _colors = require("./colors");
@@ -51,22 +53,23 @@ var getTabPanelStyles = function getTabPanelStyles(mode) {
51
53
  };
52
54
 
53
55
  var getTabsStyles = function getTabsStyles(mode) {
54
- return {
55
- display: 'flex',
56
- flexBasis: '100%',
57
- flexDirection: 'column',
58
- flexGrow: 1,
59
- maxWidth: '100%',
60
- minHeight: '0%'
61
- /* Same Firefox bug as above */
62
- ,
63
- '& [role="tabpanel"]': getTabPanelStyles(mode),
64
- // The hidden attribute doesn't work on flex elements
65
- // Change display to be none
66
- '& > [hidden]': {
67
- display: 'none'
68
- }
69
- };
56
+ return (// eslint-disable-next-line @repo/internal/styles/no-exported-styles
57
+ (0, _react.css)({
58
+ display: 'flex',
59
+ maxWidth: '100%',
60
+ minHeight: '0%',
61
+ flexBasis: '100%',
62
+ flexDirection: 'column',
63
+ flexGrow: 1,
64
+ '& [role="tabpanel"]': getTabPanelStyles(mode),
65
+ // The hidden attribute doesn't work on flex elements
66
+ // Change display to be none
67
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
68
+ '& > [hidden]': {
69
+ display: 'none'
70
+ }
71
+ })
72
+ );
70
73
  };
71
74
 
72
75
  exports.getTabsStyles = getTabsStyles;
@@ -82,19 +85,21 @@ var tabLineStyles = {
82
85
  };
83
86
 
84
87
  var getTabListStyles = function getTabListStyles(mode) {
85
- return {
86
- position: 'relative',
87
- display: 'flex',
88
- fontWeight: 500,
89
- padding: 0,
90
- margin: 0,
91
- '&::before': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
92
- // This line is not a border so the selected line is visible in high contrast mode
93
- backgroundColor: (0, _colors.getTabLineColor)(mode).lineColor,
94
- height: underlineHeight
95
- }),
96
- '& [role="tab"]': getTabStyles(mode)
97
- };
88
+ return (// eslint-disable-next-line @repo/internal/styles/no-exported-styles
89
+ (0, _react.css)({
90
+ display: 'flex',
91
+ margin: 0,
92
+ padding: 0,
93
+ position: 'relative',
94
+ '& [role="tab"]': getTabStyles(mode),
95
+ fontWeight: 500,
96
+ '&::before': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
97
+ height: underlineHeight,
98
+ // This line is not a border so the selected line is visible in high contrast mode
99
+ backgroundColor: (0, _colors.getTabLineColor)(mode).lineColor
100
+ })
101
+ })
102
+ );
98
103
  };
99
104
 
100
105
  exports.getTabListStyles = getTabListStyles;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/tabs",
3
- "version": "13.2.13",
3
+ "version": "13.3.1",
4
4
  "sideEffects": false
5
5
  }
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
4
  import { Children, createRef, useCallback, useMemo } from 'react';
5
- import { jsx } from '@emotion/core';
5
+ import { jsx } from '@emotion/react';
6
6
  import GlobalTheme from '@atlaskit/theme/components';
7
7
  import { useTabList } from '../hooks';
8
8
  import { TabContext } from '../internal/context';
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
- import { jsx } from '@emotion/core';
4
+ import { jsx } from '@emotion/react';
5
5
  import { useTabPanel } from '../hooks';
6
6
 
7
7
  // Note this is not being memoized as children is an unstable reference
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
- import { jsx } from '@emotion/core';
4
+ import { jsx } from '@emotion/react';
5
5
  import { useTab } from '../hooks';
6
6
 
7
7
  /**
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
4
  import { Children, useCallback, useMemo, useRef, useState } from 'react';
5
- import { jsx } from '@emotion/core';
5
+ import { jsx } from '@emotion/react';
6
6
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
7
7
  import GlobalTheme from '@atlaskit/theme/components';
8
8
  import { TabListContext, TabPanelContext } from '../internal/context';
@@ -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.13"
14
+ packageVersion: "13.3.1"
15
15
  };
16
16
 
17
17
  const getTabPanelWithContext = ({
@@ -1,3 +1,4 @@
1
+ import { css } from '@emotion/react';
1
2
  import { borderRadius as getBorderRadius, gridSize as getGridSize } from '@atlaskit/theme/constants';
2
3
  import { getTabColors, getTabLineColor, getTabPanelFocusColor } from './colors';
3
4
  const borderRadius = getBorderRadius();
@@ -32,18 +33,18 @@ const getTabPanelStyles = mode => ({
32
33
  ...highContrastFocusRing
33
34
  });
34
35
 
35
- export const getTabsStyles = mode => ({
36
+ export const getTabsStyles = mode => // eslint-disable-next-line @repo/internal/styles/no-exported-styles
37
+ css({
36
38
  display: 'flex',
39
+ maxWidth: '100%',
40
+ minHeight: '0%',
37
41
  flexBasis: '100%',
38
42
  flexDirection: 'column',
39
43
  flexGrow: 1,
40
- maxWidth: '100%',
41
- minHeight: '0%'
42
- /* Same Firefox bug as above */
43
- ,
44
44
  '& [role="tabpanel"]': getTabPanelStyles(mode),
45
45
  // The hidden attribute doesn't work on flex elements
46
46
  // Change display to be none
47
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
47
48
  '& > [hidden]': {
48
49
  display: 'none'
49
50
  }
@@ -58,18 +59,19 @@ const tabLineStyles = {
58
59
  left: tabLeftRightPadding,
59
60
  right: tabLeftRightPadding
60
61
  };
61
- export const getTabListStyles = mode => ({
62
- position: 'relative',
62
+ export const getTabListStyles = mode => // eslint-disable-next-line @repo/internal/styles/no-exported-styles
63
+ css({
63
64
  display: 'flex',
64
- fontWeight: 500,
65
- padding: 0,
66
65
  margin: 0,
66
+ padding: 0,
67
+ position: 'relative',
68
+ '& [role="tab"]': getTabStyles(mode),
69
+ fontWeight: 500,
67
70
  '&::before': { ...tabLineStyles,
71
+ height: underlineHeight,
68
72
  // This line is not a border so the selected line is visible in high contrast mode
69
- backgroundColor: getTabLineColor(mode).lineColor,
70
- height: underlineHeight
71
- },
72
- '& [role="tab"]': getTabStyles(mode)
73
+ backgroundColor: getTabLineColor(mode).lineColor
74
+ }
73
75
  });
74
76
  export const getTabStyles = mode => {
75
77
  const colors = getTabColors(mode);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/tabs",
3
- "version": "13.2.13",
3
+ "version": "13.3.1",
4
4
  "sideEffects": false
5
5
  }
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
4
  import { Children, createRef, useCallback, useMemo } from 'react';
5
- import { jsx } from '@emotion/core';
5
+ import { jsx } from '@emotion/react';
6
6
  import GlobalTheme from '@atlaskit/theme/components';
7
7
  import { useTabList } from '../hooks';
8
8
  import { TabContext } from '../internal/context';
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
- import { jsx } from '@emotion/core';
4
+ import { jsx } from '@emotion/react';
5
5
  import { useTabPanel } from '../hooks';
6
6
 
7
7
  // Note this is not being memoized as children is an unstable reference
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
- import { jsx } from '@emotion/core';
4
+ import { jsx } from '@emotion/react';
5
5
  import { useTab } from '../hooks';
6
6
 
7
7
  /**
@@ -9,7 +9,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
9
9
 
10
10
  /** @jsx jsx */
11
11
  import { Children, useCallback, useMemo, useRef, useState } from 'react';
12
- import { jsx } from '@emotion/core';
12
+ import { jsx } from '@emotion/react';
13
13
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
14
14
  import GlobalTheme from '@atlaskit/theme/components';
15
15
  import { TabListContext, TabPanelContext } from '../internal/context';
@@ -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.13"
21
+ packageVersion: "13.3.1"
22
22
  };
23
23
 
24
24
  var getTabPanelWithContext = function getTabPanelWithContext(_ref) {
@@ -4,6 +4,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
4
4
 
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
 
7
+ import { css } from '@emotion/react';
7
8
  import { borderRadius as getBorderRadius, gridSize as getGridSize } from '@atlaskit/theme/constants';
8
9
  import { getTabColors, getTabLineColor, getTabPanelFocusColor } from './colors';
9
10
  var borderRadius = getBorderRadius();
@@ -40,22 +41,23 @@ var getTabPanelStyles = function getTabPanelStyles(mode) {
40
41
  };
41
42
 
42
43
  export var getTabsStyles = function getTabsStyles(mode) {
43
- return {
44
- display: 'flex',
45
- flexBasis: '100%',
46
- flexDirection: 'column',
47
- flexGrow: 1,
48
- maxWidth: '100%',
49
- minHeight: '0%'
50
- /* Same Firefox bug as above */
51
- ,
52
- '& [role="tabpanel"]': getTabPanelStyles(mode),
53
- // The hidden attribute doesn't work on flex elements
54
- // Change display to be none
55
- '& > [hidden]': {
56
- display: 'none'
57
- }
58
- };
44
+ return (// eslint-disable-next-line @repo/internal/styles/no-exported-styles
45
+ css({
46
+ display: 'flex',
47
+ maxWidth: '100%',
48
+ minHeight: '0%',
49
+ flexBasis: '100%',
50
+ flexDirection: 'column',
51
+ flexGrow: 1,
52
+ '& [role="tabpanel"]': getTabPanelStyles(mode),
53
+ // The hidden attribute doesn't work on flex elements
54
+ // Change display to be none
55
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
56
+ '& > [hidden]': {
57
+ display: 'none'
58
+ }
59
+ })
60
+ );
59
61
  };
60
62
  var tabLineStyles = {
61
63
  content: '""',
@@ -68,19 +70,21 @@ var tabLineStyles = {
68
70
  right: tabLeftRightPadding
69
71
  };
70
72
  export var getTabListStyles = function getTabListStyles(mode) {
71
- return {
72
- position: 'relative',
73
- display: 'flex',
74
- fontWeight: 500,
75
- padding: 0,
76
- margin: 0,
77
- '&::before': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
78
- // This line is not a border so the selected line is visible in high contrast mode
79
- backgroundColor: getTabLineColor(mode).lineColor,
80
- height: underlineHeight
81
- }),
82
- '& [role="tab"]': getTabStyles(mode)
83
- };
73
+ return (// eslint-disable-next-line @repo/internal/styles/no-exported-styles
74
+ css({
75
+ display: 'flex',
76
+ margin: 0,
77
+ padding: 0,
78
+ position: 'relative',
79
+ '& [role="tab"]': getTabStyles(mode),
80
+ fontWeight: 500,
81
+ '&::before': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
82
+ height: underlineHeight,
83
+ // This line is not a border so the selected line is visible in high contrast mode
84
+ backgroundColor: getTabLineColor(mode).lineColor
85
+ })
86
+ })
87
+ );
84
88
  };
85
89
  export var getTabStyles = function getTabStyles(mode) {
86
90
  var colors = getTabColors(mode);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/tabs",
3
- "version": "13.2.13",
3
+ "version": "13.3.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import { jsx } from '@emotion/react';
2
2
  import { TabListProps } from '../types';
3
3
  /**
4
4
  * __TabList__
@@ -9,5 +9,5 @@ import { TabListProps } from '../types';
9
9
  * - [Code](https://atlassian.design/components/tabs/code)
10
10
  * - [Usage](https://atlassian.design/components/tabs/usage)
11
11
  */
12
- export declare const TabList: (props: TabListProps) => JSX.Element;
12
+ export declare const TabList: (props: TabListProps) => jsx.JSX.Element;
13
13
  export default TabList;
@@ -1,4 +1,5 @@
1
- /// <reference types="react" />
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
2
3
  import { TabPanelProps } from '../types';
3
4
  /**
4
5
  * __TabPanel__
@@ -9,5 +10,5 @@ import { TabPanelProps } from '../types';
9
10
  * - [Code](https://atlassian.design/components/tabs/code)
10
11
  * - [Usage](https://atlassian.design/components/tabs/usage)
11
12
  */
12
- declare const TabPanel: ({ children, testId }: TabPanelProps) => JSX.Element;
13
+ declare const TabPanel: ({ children, testId }: TabPanelProps) => jsx.JSX.Element;
13
14
  export default TabPanel;
@@ -1,4 +1,5 @@
1
- /// <reference types="react" />
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
2
3
  import { TabProps } from '../types';
3
4
  /**
4
5
  * __Tab__
@@ -9,4 +10,4 @@ import { TabProps } from '../types';
9
10
  * - [Code](https://atlassian.design/components/tabs/code)
10
11
  * - [Usage](https://atlassian.design/components/tabs/usage)
11
12
  */
12
- export default function Tab({ children, testId }: TabProps): JSX.Element;
13
+ export default function Tab({ children, testId }: TabProps): jsx.JSX.Element;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import { jsx } from '@emotion/react';
2
2
  import { TabsProps } from '../types';
3
3
  /**
4
4
  * __Tabs__
@@ -9,5 +9,5 @@ import { TabsProps } from '../types';
9
9
  * - [Code](https://atlassian.design/components/tabs/code)
10
10
  * - [Usage](https://atlassian.design/components/tabs/usage)
11
11
  */
12
- export declare const Tabs: (props: TabsProps) => JSX.Element;
12
+ export declare const Tabs: (props: TabsProps) => jsx.JSX.Element;
13
13
  export default Tabs;
@@ -1,5 +1,5 @@
1
- import { CSSObject } from '@emotion/core';
1
+ import { CSSObject, SerializedStyles } from '@emotion/react';
2
2
  import { ThemeModes } from '@atlaskit/theme/types';
3
- export declare const getTabsStyles: (mode: ThemeModes) => CSSObject;
4
- export declare const getTabListStyles: (mode: ThemeModes) => CSSObject;
3
+ export declare const getTabsStyles: (mode: ThemeModes) => SerializedStyles;
4
+ export declare const getTabListStyles: (mode: ThemeModes) => SerializedStyles;
5
5
  export declare const getTabStyles: (mode: ThemeModes) => CSSObject;
@@ -0,0 +1,13 @@
1
+ import { jsx } from '@emotion/react';
2
+ import { TabListProps } from '../types';
3
+ /**
4
+ * __TabList__
5
+ *
6
+ * A TabList groups `Tab` components together.
7
+ *
8
+ * - [Examples](https://atlassian.design/components/tabs/examples)
9
+ * - [Code](https://atlassian.design/components/tabs/code)
10
+ * - [Usage](https://atlassian.design/components/tabs/usage)
11
+ */
12
+ export declare const TabList: (props: TabListProps) => jsx.JSX.Element;
13
+ export default TabList;
@@ -0,0 +1,14 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { TabPanelProps } from '../types';
4
+ /**
5
+ * __TabPanel__
6
+ *
7
+ * A TabPanel houses the contents of a Tab.
8
+ *
9
+ * - [Examples](https://atlassian.design/components/tabs/examples)
10
+ * - [Code](https://atlassian.design/components/tabs/code)
11
+ * - [Usage](https://atlassian.design/components/tabs/usage)
12
+ */
13
+ declare const TabPanel: ({ children, testId }: TabPanelProps) => jsx.JSX.Element;
14
+ export default TabPanel;
@@ -0,0 +1,13 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { TabProps } from '../types';
4
+ /**
5
+ * __Tab__
6
+ *
7
+ * Tab represents an indivudal Tab displayed in a TabList.
8
+ *
9
+ * - [Examples](https://atlassian.design/components/tabs/examples)
10
+ * - [Code](https://atlassian.design/components/tabs/code)
11
+ * - [Usage](https://atlassian.design/components/tabs/usage)
12
+ */
13
+ export default function Tab({ children, testId }: TabProps): jsx.JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { jsx } from '@emotion/react';
2
+ import { TabsProps } from '../types';
3
+ /**
4
+ * __Tabs__
5
+ *
6
+ * Tabs acts as a container for all Tab components.
7
+ *
8
+ * - [Examples](https://atlassian.design/components/tabs/examples)
9
+ * - [Code](https://atlassian.design/components/tabs/code)
10
+ * - [Usage](https://atlassian.design/components/tabs/usage)
11
+ */
12
+ export declare const Tabs: (props: TabsProps) => jsx.JSX.Element;
13
+ export default Tabs;
@@ -0,0 +1,3 @@
1
+ export declare const useTab: () => import("./types").TabAttributesType;
2
+ export declare const useTabList: () => import("./types").TabListAttributesType;
3
+ export declare const useTabPanel: () => import("./types").TabPanelAttributesType;
@@ -0,0 +1,6 @@
1
+ export { default } from './components/tabs';
2
+ export { default as TabPanel } from './components/tab-panel';
3
+ export { default as Tab } from './components/tab';
4
+ export { default as TabList } from './components/tab-list';
5
+ export type { TabProps, TabPanelProps, TabsProps, TabListProps, TabAttributesType, TabListAttributesType, TabPanelAttributesType, TabData, } from './types';
6
+ export { useTab, useTabPanel } from './hooks';
@@ -0,0 +1,17 @@
1
+ import { ThemeModes } from '@atlaskit/theme/types';
2
+ export declare type TabColors = {
3
+ labelColor: string;
4
+ activeLabelColor: string;
5
+ hoverLabelColor: string;
6
+ selectedColor: string;
7
+ focusBorderColor: string;
8
+ };
9
+ export declare const getTabColors: (mode: ThemeModes) => TabColors;
10
+ export declare type TabLineColors = {
11
+ lineColor: string;
12
+ hoveredColor: string;
13
+ activeColor: string;
14
+ selectedColor: string;
15
+ };
16
+ export declare const getTabLineColor: (mode: ThemeModes) => TabLineColors;
17
+ export declare const getTabPanelFocusColor: (mode: ThemeModes) => string;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { TabAttributesType, TabListAttributesType, TabPanelAttributesType } from '../types';
3
+ export declare const TabContext: import("react").Context<TabAttributesType | null>;
4
+ export declare const TabListContext: import("react").Context<TabListAttributesType | null>;
5
+ export declare const TabPanelContext: import("react").Context<TabPanelAttributesType | null>;
@@ -0,0 +1,5 @@
1
+ import { CSSObject, SerializedStyles } from '@emotion/react';
2
+ import { ThemeModes } from '@atlaskit/theme/types';
3
+ export declare const getTabsStyles: (mode: ThemeModes) => SerializedStyles;
4
+ export declare const getTabListStyles: (mode: ThemeModes) => SerializedStyles;
5
+ export declare const getTabStyles: (mode: ThemeModes) => CSSObject;
@@ -0,0 +1,2 @@
1
+ import type { MouseEvent } from 'react';
2
+ export declare const onMouseDownBlur: (e: MouseEvent<HTMLElement>) => void;
@@ -0,0 +1,24 @@
1
+ /// <reference types="react" />
2
+ import type { PublicInteractionTask } from 'storybook-addon-performance';
3
+ export declare const performance: {
4
+ (): JSX.Element;
5
+ story: {
6
+ name: string;
7
+ parameters: {
8
+ performance: {
9
+ interactions: PublicInteractionTask[];
10
+ };
11
+ };
12
+ };
13
+ };
14
+ export declare const heavyPerformance: {
15
+ (): JSX.Element;
16
+ story: {
17
+ name: string;
18
+ parameters: {
19
+ performance: {
20
+ interactions: PublicInteractionTask[];
21
+ };
22
+ };
23
+ };
24
+ };
@@ -0,0 +1,196 @@
1
+ import { KeyboardEvent, MouseEvent, ReactNode } from 'react';
2
+ import UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
3
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next/withAnalyticsEvents';
4
+ export interface TabProps {
5
+ /**
6
+ * The children to be rendered within a `Tab`.
7
+ */
8
+ children: ReactNode;
9
+ /**
10
+ * A `testId` prop is is a unique string that appears as a data attribute `data-testid`
11
+ * on the `Tab` element, serving as a hook for automated tests.
12
+ */
13
+ testId?: string;
14
+ }
15
+ export interface TabPanelProps {
16
+ /**
17
+ * The children to be rendered within a `TabPanel`.
18
+ */
19
+ children: ReactNode;
20
+ /**
21
+ * A `testId` prop is is a unique string that appears as a data attribute `data-testid`
22
+ * on the `TabPanel` element, serving as a hook for automated tests.
23
+ */
24
+ testId?: string;
25
+ }
26
+ /**
27
+ * @deprecated
28
+ * Previously this was the type for the tabs prop that was used like
29
+ * <Tabs tabs={tabs} />
30
+ * The codemod changes this to be
31
+ * <Tabs>
32
+ * <TabList>
33
+ * {tabs.map(tab => <Tab testId={tab.testId}>{tab.label}</Tab>)}
34
+ * </TabList>
35
+ * {tabs.map(tab => <TabPanel>{tab.content}</TabPanel>)}
36
+ * </Tabs>
37
+ * The TabData type remains so the variable used in tabs can have a type.
38
+ */
39
+ export interface TabData {
40
+ /**
41
+ * String to be put inside a tab
42
+ */
43
+ label?: string;
44
+ /**
45
+ * String to be put inside a tab panel
46
+ */
47
+ content?: ReactNode;
48
+ /**
49
+ * A `testId` prop is provided for specified elements, which is a unique
50
+ * string that appears as a data attribute `data-testid` in the rendered code,
51
+ * serving as a hook for automated tests. This `testId` is put on the tab.
52
+ */
53
+ testId?: string;
54
+ /**
55
+ * Used by consumers to convey extra information about the tab.
56
+ */
57
+ [key: string]: any;
58
+ }
59
+ export declare type SelectedType = number;
60
+ export declare type OnChangeCallback = (index: SelectedType, analyticsEvent: UIAnalyticsEvent) => void;
61
+ export interface TabsProps extends WithAnalyticsEventsProps {
62
+ /**
63
+ * The index of the tab that will be selected by default when the component mounts.
64
+ * If not set the first tab will be displayed by default.
65
+ */
66
+ defaultSelected?: SelectedType;
67
+ /**
68
+ * A callback function which will be fired when a changed. It will be passed
69
+ * the index of the selected tab and a `UIAnalyticsEvent`.
70
+ */
71
+ onChange?: OnChangeCallback;
72
+ /**
73
+ * The selected tab's index. If this prop is set the component behaves as a
74
+ * controlled component. It will be up to you to listen to `onChange`.
75
+ */
76
+ selected?: SelectedType;
77
+ /**
78
+ * Tabs by default leaves `TabPanel`'s mounted on the page after they have been selected.
79
+ * If you would like to unmount a `TabPanel` when it is not selected, set this prop to
80
+ * be true.
81
+ */
82
+ shouldUnmountTabPanelOnChange?: boolean;
83
+ /**
84
+ * Additional information to be included in the `context` of analytics events that come from `Tabs`.
85
+ */
86
+ analyticsContext?: Record<string, any>;
87
+ /**
88
+ * A `testId` prop is a unique string that appears as a data attribute `data-testid`
89
+ * on the `Tabs` element, serving as a hook for automated tests.
90
+ */
91
+ testId?: string;
92
+ /**
93
+ * The children of Tabs. The first child should be a `TabList` filled with `Tab`'s.
94
+ * Subsequent children should be `TabPanel`'s. There should be a `Tab` for each `TabPanel`.
95
+ * If you want to customize `Tab` or `TabPanel`, refer to the examples in the documentation.
96
+ */
97
+ children: ReactNode;
98
+ /**
99
+ * A unique ID that will be used to generate IDs for tabs and tab panels.
100
+ * This is required for accessibility purposes.
101
+ */
102
+ id: string;
103
+ }
104
+ export interface TabListProps {
105
+ /**
106
+ * A collection of `Tab`'s. There should be a `Tab` for each `TabPanel`.
107
+ * If you want to customize `Tab` there is documentation in the tab section.
108
+ */
109
+ children: ReactNode;
110
+ }
111
+ export declare type TabAttributesType = {
112
+ /**
113
+ * Changes the selected tab.
114
+ */
115
+ onClick: () => void;
116
+ /**
117
+ * ID of the tab.
118
+ */
119
+ id: string;
120
+ /**
121
+ * The id of the tab panel that this tab links.
122
+ */
123
+ 'aria-controls': string;
124
+ /**
125
+ * The position of this tab within the tab list.
126
+ */
127
+ 'aria-posinset': number;
128
+ /**
129
+ * Whether this tab is selected.
130
+ */
131
+ 'aria-selected': boolean;
132
+ /**
133
+ * The number of tabs in this tab list.
134
+ */
135
+ 'aria-setsize': number;
136
+ /**
137
+ * Prevents a focus ring being shown when clicked.
138
+ */
139
+ onMouseDown: (e: MouseEvent<HTMLElement>) => void;
140
+ /**
141
+ * Allows navigation of tabs with automatic activation.
142
+ * Read here for more details: https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html
143
+ */
144
+ onKeyDown: (e: KeyboardEvent<HTMLElement>) => void;
145
+ /**
146
+ * Role is "tab".
147
+ */
148
+ role: 'tab';
149
+ /**
150
+ * If the tab is selected the tab index is 0 and is focusable.
151
+ * Otherwise it is -1 and is not focusable.
152
+ */
153
+ tabIndex: number;
154
+ };
155
+ export declare type TabListAttributesType = {
156
+ /**
157
+ * The index of the selected tab.
158
+ */
159
+ selected: SelectedType;
160
+ /**
161
+ * A unique ID that will be used to generate IDs for tabs and tab panels.
162
+ * This is required for accessibility reasons.
163
+ */
164
+ tabsId: string;
165
+ /**
166
+ * A callback function which will be fired when a tab is changed.
167
+ */
168
+ onChange: (index: SelectedType) => void;
169
+ };
170
+ export declare type TabPanelAttributesType = {
171
+ /**
172
+ * Role is "tabpanel".
173
+ */
174
+ role: 'tabpanel';
175
+ /**
176
+ * ID of the the tab panel.
177
+ */
178
+ id: string;
179
+ /**
180
+ * Hidden is true if it is not the selected tab.
181
+ */
182
+ hidden?: boolean;
183
+ /**
184
+ * The id of the tab that links to this tab panel.
185
+ */
186
+ 'aria-labelledby': string;
187
+ /**
188
+ * Prevents a focus ring being shown when clicked.
189
+ */
190
+ onMouseDown: (e: MouseEvent<HTMLElement>) => void;
191
+ /**
192
+ * If the tab panel is selected the tab index is 0 and is focusable.
193
+ * Otherwise it is -1 and is not focusable.
194
+ */
195
+ tabIndex: number;
196
+ };
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/hooks.js",
5
5
  "module:es2019": "../dist/es2019/hooks.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/hooks.d.ts"
7
+ "types": "../dist/types/hooks.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/hooks.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/tabs",
3
- "version": "13.2.13",
3
+ "version": "13.3.1",
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/"
@@ -12,6 +12,13 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
+ "typesVersions": {
16
+ ">=4.0 <4.5": {
17
+ "*": [
18
+ "dist/types-ts4.0/*"
19
+ ]
20
+ }
21
+ },
15
22
  "sideEffects": false,
16
23
  "atlaskit:src": "src/index.tsx",
17
24
  "atlassian": {
@@ -25,10 +32,10 @@
25
32
  "dependencies": {
26
33
  "@atlaskit/analytics-next": "^8.2.0",
27
34
  "@atlaskit/codemod-utils": "^4.1.0",
28
- "@atlaskit/theme": "^12.1.0",
35
+ "@atlaskit/theme": "^12.2.0",
29
36
  "@atlaskit/tokens": "^0.10.0",
30
37
  "@babel/runtime": "^7.0.0",
31
- "@emotion/core": "^10.0.9"
38
+ "@emotion/react": "^11.7.1"
32
39
  },
33
40
  "peerDependencies": {
34
41
  "react": "^16.8.0"
@@ -37,20 +44,20 @@
37
44
  "@atlaskit/button": "^16.3.0",
38
45
  "@atlaskit/docs": "*",
39
46
  "@atlaskit/ds-lib": "^2.1.0",
40
- "@atlaskit/section-message": "^6.1.0",
47
+ "@atlaskit/section-message": "^6.2.0",
41
48
  "@atlaskit/spinner": "^15.1.0",
42
49
  "@atlaskit/ssr": "*",
43
50
  "@atlaskit/tooltip": "^17.5.0",
44
51
  "@atlaskit/visual-regression": "*",
45
52
  "@atlaskit/webdriver-runner": "*",
46
53
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
47
- "@testing-library/react": "^8.0.1",
54
+ "@testing-library/react": "^12.1.5",
48
55
  "enzyme": "^3.10.0",
49
56
  "jscodeshift": "^0.13.0",
50
57
  "react-dom": "^16.8.0",
51
58
  "react-lorem-component": "^0.13.0",
52
59
  "storybook-addon-performance": "^0.16.0",
53
- "typescript": "4.3.5",
60
+ "typescript": "4.5.5",
54
61
  "wait-for-expect": "^1.2.0"
55
62
  },
56
63
  "techstack": {
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/types.js",
5
5
  "module:es2019": "../dist/es2019/types.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/types.d.ts"
7
+ "types": "../dist/types/types.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/types.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }