@atlaskit/tabs 13.3.0 → 13.3.2

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 +12 -0
  2. package/__perf__/default.tsx +1 -0
  3. package/dist/cjs/components/tab-list.js +32 -34
  4. package/dist/cjs/components/tab-panel.js +9 -4
  5. package/dist/cjs/components/tab.js +11 -3
  6. package/dist/cjs/components/tabs.js +37 -32
  7. package/dist/cjs/internal/styles.js +0 -10
  8. package/dist/cjs/version.json +1 -1
  9. package/dist/es2019/components/tab-list.js +29 -26
  10. package/dist/es2019/components/tab-panel.js +6 -3
  11. package/dist/es2019/components/tab.js +10 -3
  12. package/dist/es2019/components/tabs.js +36 -27
  13. package/dist/es2019/internal/styles.js +0 -10
  14. package/dist/es2019/version.json +1 -1
  15. package/dist/esm/components/tab-list.js +29 -29
  16. package/dist/esm/components/tab-panel.js +6 -3
  17. package/dist/esm/components/tab.js +10 -3
  18. package/dist/esm/components/tabs.js +36 -29
  19. package/dist/esm/internal/styles.js +0 -10
  20. package/dist/esm/version.json +1 -1
  21. package/dist/types/components/tab-list.d.ts +1 -1
  22. package/dist/types/components/tab-panel.d.ts +0 -1
  23. package/dist/types/components/tabs.d.ts +1 -1
  24. package/dist/types-ts4.0/components/tab-list.d.ts +13 -0
  25. package/dist/types-ts4.0/components/tab-panel.d.ts +13 -0
  26. package/dist/types-ts4.0/components/tab.d.ts +13 -0
  27. package/dist/types-ts4.0/components/tabs.d.ts +13 -0
  28. package/dist/types-ts4.0/hooks.d.ts +3 -0
  29. package/dist/types-ts4.0/index.d.ts +6 -0
  30. package/dist/types-ts4.0/internal/colors.d.ts +17 -0
  31. package/dist/types-ts4.0/internal/context.d.ts +5 -0
  32. package/dist/types-ts4.0/internal/styles.d.ts +5 -0
  33. package/dist/types-ts4.0/internal/utils.d.ts +2 -0
  34. package/dist/types-ts4.0/performance/examples.d.ts +24 -0
  35. package/dist/types-ts4.0/types.d.ts +196 -0
  36. package/hooks/package.json +8 -1
  37. package/package.json +17 -6
  38. package/report.api.md +58 -13
  39. package/types/package.json +8 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/tabs
2
2
 
3
+ ## 13.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`0d42cd1c926`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0d42cd1c926) - Internal changes to the way styles are applied. There should be no noticeable changes to consumers.
8
+
9
+ ## 13.3.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
14
+
3
15
  ## 13.3.0
4
16
 
5
17
  ### Minor Changes
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @repo/internal/react/use-primitives */
1
2
  import React from 'react';
2
3
 
3
4
  import Tabs, { Tab, TabList, TabPanel } from '../src';
@@ -1,19 +1,17 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
- exports.default = exports.TabList = void 0;
9
-
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
6
+ exports.default = void 0;
11
7
 
12
8
  var _react = require("react");
13
9
 
14
10
  var _react2 = require("@emotion/react");
15
11
 
16
- var _components = _interopRequireDefault(require("@atlaskit/theme/components"));
12
+ var _dsExplorations = require("@atlaskit/ds-explorations");
13
+
14
+ var _components = require("@atlaskit/theme/components");
17
15
 
18
16
  var _hooks = require("../hooks");
19
17
 
@@ -24,9 +22,21 @@ var _styles = require("../internal/styles");
24
22
  var _utils = require("../internal/utils");
25
23
 
26
24
  /** @jsx jsx */
27
- var TabListWithMode = function TabListWithMode(props) {
28
- var children = props.children,
29
- mode = props.mode;
25
+
26
+ /**
27
+ * __TabList__
28
+ *
29
+ * A TabList groups `Tab` components together.
30
+ *
31
+ * - [Examples](https://atlassian.design/components/tabs/examples)
32
+ * - [Code](https://atlassian.design/components/tabs/code)
33
+ * - [Usage](https://atlassian.design/components/tabs/usage)
34
+ */
35
+ var TabList = function TabList(props) {
36
+ var children = props.children;
37
+
38
+ var _useGlobalTheme = (0, _components.useGlobalTheme)(),
39
+ mode = _useGlobalTheme.mode;
30
40
 
31
41
  var _useTabList = (0, _hooks.useTabList)(),
32
42
  tabsId = _useTabList.tabsId,
@@ -38,7 +48,7 @@ var TabListWithMode = function TabListWithMode(props) {
38
48
  var childrenArray = _react.Children.toArray(children).filter(Boolean);
39
49
 
40
50
  var length = childrenArray.length;
41
- var styles = (0, _react.useMemo)(function () {
51
+ var tabListStyles = (0, _react.useMemo)(function () {
42
52
  return (0, _styles.getTabListStyles)(mode);
43
53
  }, [mode]);
44
54
  var selectTabByIndex = (0, _react.useCallback)(function (index) {
@@ -105,11 +115,19 @@ var TabListWithMode = function TabListWithMode(props) {
105
115
  key: index
106
116
  }, tab);
107
117
  }, [length, onKeyDown, onChange, tabsId]);
108
- return (// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
109
- (0, _react2.jsx)("div", {
118
+ return (// Only styles that affect the TabList itself have been applied via primitives.
119
+ // The other styles applied through the CSS prop are there for styling children
120
+ // through inheritance. This is important for custom cases that use the useTab(),
121
+ // which applies accessibility atributes that we use as a styling hook.
122
+ (0, _react2.jsx)(_dsExplorations.UNSAFE_Box, {
123
+ as: "div",
110
124
  role: "tablist",
111
- css: styles,
112
- ref: ref
125
+ display: "flex",
126
+ position: "relative",
127
+ padding: "sp-0",
128
+ ref: ref // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
129
+ ,
130
+ css: tabListStyles
113
131
  }, childrenArray.map(function (child, index) {
114
132
  return getTabWithContext({
115
133
  tab: child,
@@ -119,26 +137,6 @@ var TabListWithMode = function TabListWithMode(props) {
119
137
  }))
120
138
  );
121
139
  };
122
- /**
123
- * __TabList__
124
- *
125
- * A TabList groups `Tab` components together.
126
- *
127
- * - [Examples](https://atlassian.design/components/tabs/examples)
128
- * - [Code](https://atlassian.design/components/tabs/code)
129
- * - [Usage](https://atlassian.design/components/tabs/usage)
130
- */
131
-
132
-
133
- var TabList = function TabList(props) {
134
- return (0, _react2.jsx)(_components.default.Consumer, null, function (_ref2) {
135
- var mode = _ref2.mode;
136
- return (0, _react2.jsx)(TabListWithMode, (0, _extends2.default)({}, props, {
137
- mode: mode
138
- }));
139
- });
140
- };
141
140
 
142
- exports.TabList = TabList;
143
141
  var _default = TabList;
144
142
  exports.default = _default;
@@ -9,7 +9,11 @@ exports.default = void 0;
9
9
 
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
 
12
- var _react = require("@emotion/react");
12
+ var _react = require("react");
13
+
14
+ var _react2 = require("@emotion/react");
15
+
16
+ var _dsExplorations = require("@atlaskit/ds-explorations");
13
17
 
14
18
  var _hooks = require("../hooks");
15
19
 
@@ -29,9 +33,10 @@ var TabPanel = function TabPanel(_ref) {
29
33
  var children = _ref.children,
30
34
  testId = _ref.testId;
31
35
  var tabPanelAttributes = (0, _hooks.useTabPanel)();
32
- return (0, _react.jsx)("div", (0, _extends2.default)({
33
- "data-testid": testId
34
- }, tabPanelAttributes), children);
36
+ return (0, _react2.jsx)(_dsExplorations.UNSAFE_Box, (0, _extends2.default)({
37
+ testId: testId,
38
+ as: "div"
39
+ }, tabPanelAttributes), (0, _react2.jsx)(_react.Fragment, null, children));
35
40
  };
36
41
 
37
42
  var _default = TabPanel;
@@ -11,6 +11,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
 
12
12
  var _react = require("@emotion/react");
13
13
 
14
+ var _dsExplorations = require("@atlaskit/ds-explorations");
15
+
14
16
  var _hooks = require("../hooks");
15
17
 
16
18
  /** @jsx jsx */
@@ -28,7 +30,13 @@ function Tab(_ref) {
28
30
  var children = _ref.children,
29
31
  testId = _ref.testId;
30
32
  var tabAttributes = (0, _hooks.useTab)();
31
- return (0, _react.jsx)("div", (0, _extends2.default)({
32
- "data-testid": testId
33
- }, tabAttributes), children);
33
+ return (0, _react.jsx)(_dsExplorations.UNSAFE_Box, (0, _extends2.default)({
34
+ as: "div",
35
+ testId: testId
36
+ }, tabAttributes), (0, _react.jsx)(_dsExplorations.UNSAFE_Text, {
37
+ shouldTruncate: true,
38
+ UNSAFE_style: {
39
+ color: 'inherit'
40
+ }
41
+ }, children));
34
42
  }
@@ -5,9 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = exports.Tabs = void 0;
9
-
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
+ exports.default = void 0;
11
9
 
12
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
11
 
@@ -21,7 +19,9 @@ var _react2 = require("@emotion/react");
21
19
 
22
20
  var _usePlatformLeafEventHandler = require("@atlaskit/analytics-next/usePlatformLeafEventHandler");
23
21
 
24
- var _components = _interopRequireDefault(require("@atlaskit/theme/components"));
22
+ var _dsExplorations = require("@atlaskit/ds-explorations");
23
+
24
+ var _components = require("@atlaskit/theme/components");
25
25
 
26
26
  var _context = require("../internal/context");
27
27
 
@@ -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.3.0"
39
+ packageVersion: "13.3.2"
40
40
  };
41
41
 
42
42
  var getTabPanelWithContext = function getTabPanelWithContext(_ref) {
@@ -58,8 +58,18 @@ var getTabPanelWithContext = function getTabPanelWithContext(_ref) {
58
58
  }, tabPanel)
59
59
  );
60
60
  };
61
+ /**
62
+ * __Tabs__
63
+ *
64
+ * Tabs acts as a container for all Tab components.
65
+ *
66
+ * - [Examples](https://atlassian.design/components/tabs/examples)
67
+ * - [Code](https://atlassian.design/components/tabs/code)
68
+ * - [Usage](https://atlassian.design/components/tabs/usage)
69
+ */
61
70
 
62
- var TabsWithMode = function TabsWithMode(props) {
71
+
72
+ var Tabs = function Tabs(props) {
63
73
  var _props$shouldUnmountT = props.shouldUnmountTabPanelOnChange,
64
74
  shouldUnmountTabPanelOnChange = _props$shouldUnmountT === void 0 ? false : _props$shouldUnmountT,
65
75
  SelectedType = props.selected,
@@ -68,8 +78,10 @@ var TabsWithMode = function TabsWithMode(props) {
68
78
  id = props.id,
69
79
  analyticsContext = props.analyticsContext,
70
80
  children = props.children,
71
- testId = props.testId,
72
- mode = props.mode;
81
+ testId = props.testId;
82
+
83
+ var _useGlobalTheme = (0, _components.useGlobalTheme)(),
84
+ mode = _useGlobalTheme.mode;
73
85
 
74
86
  var _useState = (0, _react.useState)(SelectedType || defaultSelected || 0),
75
87
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -124,9 +136,22 @@ var TabsWithMode = function TabsWithMode(props) {
124
136
  var tabsStyles = (0, _react.useMemo)(function () {
125
137
  return (0, _styles.getTabsStyles)(mode);
126
138
  }, [mode]);
127
- return (// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
128
- (0, _react2.jsx)("div", {
129
- "data-testid": testId,
139
+ return (// Only styles that affect the Tabs container itself have been applied via primitives.
140
+ // The other styles applied through the CSS prop are there for styling children
141
+ // through inheritance. This is important for custom cases that use the useTabPanel(),
142
+ // which applies accessibility atributes that we use as a styling hook.
143
+ (0, _react2.jsx)(_dsExplorations.UNSAFE_Box, {
144
+ as: "div",
145
+ testId: testId,
146
+ display: "flex",
147
+ flexDirection: "column",
148
+ UNSAFE_style: {
149
+ maxWidth: '100%',
150
+ minHeight: '0%',
151
+ flexBasis: '100%',
152
+ flexGrow: 1
153
+ } // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
154
+ ,
130
155
  css: tabsStyles
131
156
  }, (0, _react2.jsx)(_context.TabListContext.Provider, {
132
157
  value: {
@@ -134,29 +159,9 @@ var TabsWithMode = function TabsWithMode(props) {
134
159
  onChange: onChangeAnalytics,
135
160
  tabsId: id
136
161
  }
137
- }, tabList), tabPanelsWithContext)
162
+ }, tabList), (0, _react2.jsx)(_react.Fragment, null, tabPanelsWithContext))
138
163
  );
139
164
  };
140
- /**
141
- * __Tabs__
142
- *
143
- * Tabs acts as a container for all Tab components.
144
- *
145
- * - [Examples](https://atlassian.design/components/tabs/examples)
146
- * - [Code](https://atlassian.design/components/tabs/code)
147
- * - [Usage](https://atlassian.design/components/tabs/usage)
148
- */
149
-
150
-
151
- var Tabs = function Tabs(props) {
152
- return (0, _react2.jsx)(_components.default.Consumer, null, function (_ref2) {
153
- var mode = _ref2.mode;
154
- return (0, _react2.jsx)(TabsWithMode, (0, _extends2.default)({}, props, {
155
- mode: mode
156
- }));
157
- });
158
- };
159
165
 
160
- exports.Tabs = Tabs;
161
166
  var _default = Tabs;
162
167
  exports.default = _default;
@@ -55,12 +55,6 @@ var getTabPanelStyles = function getTabPanelStyles(mode) {
55
55
  var getTabsStyles = function getTabsStyles(mode) {
56
56
  return (// eslint-disable-next-line @repo/internal/styles/no-exported-styles
57
57
  (0, _react.css)({
58
- display: 'flex',
59
- maxWidth: '100%',
60
- minHeight: '0%',
61
- flexBasis: '100%',
62
- flexDirection: 'column',
63
- flexGrow: 1,
64
58
  '& [role="tabpanel"]': getTabPanelStyles(mode),
65
59
  // The hidden attribute doesn't work on flex elements
66
60
  // Change display to be none
@@ -87,10 +81,6 @@ var tabLineStyles = {
87
81
  var getTabListStyles = function getTabListStyles(mode) {
88
82
  return (// eslint-disable-next-line @repo/internal/styles/no-exported-styles
89
83
  (0, _react.css)({
90
- display: 'flex',
91
- margin: 0,
92
- padding: 0,
93
- position: 'relative',
94
84
  '& [role="tab"]': getTabStyles(mode),
95
85
  fontWeight: 500,
96
86
  '&::before': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/tabs",
3
- "version": "13.3.0",
3
+ "version": "13.3.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,19 +1,29 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
-
3
1
  /** @jsx jsx */
4
2
  import { Children, createRef, useCallback, useMemo } from 'react';
5
3
  import { jsx } from '@emotion/react';
6
- import GlobalTheme from '@atlaskit/theme/components';
4
+ import { UNSAFE_Box as Box } from '@atlaskit/ds-explorations';
5
+ import { useGlobalTheme } from '@atlaskit/theme/components';
7
6
  import { useTabList } from '../hooks';
8
7
  import { TabContext } from '../internal/context';
9
8
  import { getTabListStyles } from '../internal/styles';
10
9
  import { onMouseDownBlur } from '../internal/utils';
11
10
 
12
- const TabListWithMode = props => {
11
+ /**
12
+ * __TabList__
13
+ *
14
+ * A TabList groups `Tab` components together.
15
+ *
16
+ * - [Examples](https://atlassian.design/components/tabs/examples)
17
+ * - [Code](https://atlassian.design/components/tabs/code)
18
+ * - [Usage](https://atlassian.design/components/tabs/usage)
19
+ */
20
+ const TabList = props => {
13
21
  const {
14
- children,
15
- mode
22
+ children
16
23
  } = props;
24
+ const {
25
+ mode
26
+ } = useGlobalTheme();
17
27
  const {
18
28
  tabsId,
19
29
  selected,
@@ -23,7 +33,7 @@ const TabListWithMode = props => {
23
33
 
24
34
  const childrenArray = Children.toArray(children).filter(Boolean);
25
35
  const length = childrenArray.length;
26
- const styles = useMemo(() => getTabListStyles(mode), [mode]);
36
+ const tabListStyles = useMemo(() => getTabListStyles(mode), [mode]);
27
37
  const selectTabByIndex = useCallback(index => {
28
38
  var _ref$current;
29
39
 
@@ -84,11 +94,19 @@ const TabListWithMode = props => {
84
94
  },
85
95
  key: index
86
96
  }, tab), [length, onKeyDown, onChange, tabsId]);
87
- return (// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
88
- jsx("div", {
97
+ return (// Only styles that affect the TabList itself have been applied via primitives.
98
+ // The other styles applied through the CSS prop are there for styling children
99
+ // through inheritance. This is important for custom cases that use the useTab(),
100
+ // which applies accessibility atributes that we use as a styling hook.
101
+ jsx(Box, {
102
+ as: "div",
89
103
  role: "tablist",
90
- css: styles,
91
- ref: ref
104
+ display: "flex",
105
+ position: "relative",
106
+ padding: "sp-0",
107
+ ref: ref // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
108
+ ,
109
+ css: tabListStyles
92
110
  }, childrenArray.map((child, index) => getTabWithContext({
93
111
  tab: child,
94
112
  index,
@@ -96,20 +114,5 @@ const TabListWithMode = props => {
96
114
  })))
97
115
  );
98
116
  };
99
- /**
100
- * __TabList__
101
- *
102
- * A TabList groups `Tab` components together.
103
- *
104
- * - [Examples](https://atlassian.design/components/tabs/examples)
105
- * - [Code](https://atlassian.design/components/tabs/code)
106
- * - [Usage](https://atlassian.design/components/tabs/usage)
107
- */
108
-
109
117
 
110
- export const TabList = props => jsx(GlobalTheme.Consumer, null, ({
111
- mode
112
- }) => jsx(TabListWithMode, _extends({}, props, {
113
- mode: mode
114
- })));
115
118
  export default TabList;
@@ -1,7 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
+ import { Fragment } from 'react';
4
5
  import { jsx } from '@emotion/react';
6
+ import { UNSAFE_Box as Box } from '@atlaskit/ds-explorations';
5
7
  import { useTabPanel } from '../hooks';
6
8
 
7
9
  // Note this is not being memoized as children is an unstable reference
@@ -20,9 +22,10 @@ const TabPanel = ({
20
22
  testId
21
23
  }) => {
22
24
  const tabPanelAttributes = useTabPanel();
23
- return jsx("div", _extends({
24
- "data-testid": testId
25
- }, tabPanelAttributes), children);
25
+ return jsx(Box, _extends({
26
+ testId: testId,
27
+ as: "div"
28
+ }, tabPanelAttributes), jsx(Fragment, null, children));
26
29
  };
27
30
 
28
31
  export default TabPanel;
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
4
  import { jsx } from '@emotion/react';
5
+ import { UNSAFE_Box as Box, UNSAFE_Text as Text } from '@atlaskit/ds-explorations';
5
6
  import { useTab } from '../hooks';
6
7
 
7
8
  /**
@@ -18,7 +19,13 @@ export default function Tab({
18
19
  testId
19
20
  }) {
20
21
  const tabAttributes = useTab();
21
- return jsx("div", _extends({
22
- "data-testid": testId
23
- }, tabAttributes), children);
22
+ return jsx(Box, _extends({
23
+ as: "div",
24
+ testId: testId
25
+ }, tabAttributes), jsx(Text, {
26
+ shouldTruncate: true,
27
+ UNSAFE_style: {
28
+ color: 'inherit'
29
+ }
30
+ }, children));
24
31
  }
@@ -1,17 +1,16 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
-
3
1
  /** @jsx jsx */
4
- import { Children, useCallback, useMemo, useRef, useState } from 'react';
2
+ import { Children, Fragment, useCallback, useMemo, useRef, useState } from 'react';
5
3
  import { jsx } from '@emotion/react';
6
4
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
7
- import GlobalTheme from '@atlaskit/theme/components';
5
+ import { UNSAFE_Box as Box } from '@atlaskit/ds-explorations';
6
+ import { useGlobalTheme } from '@atlaskit/theme/components';
8
7
  import { TabListContext, TabPanelContext } from '../internal/context';
9
8
  import { getTabsStyles } from '../internal/styles';
10
9
  import { onMouseDownBlur } from '../internal/utils';
11
10
  const analyticsAttributes = {
12
11
  componentName: 'tabs',
13
12
  packageName: "@atlaskit/tabs",
14
- packageVersion: "13.3.0"
13
+ packageVersion: "13.3.2"
15
14
  };
16
15
 
17
16
  const getTabPanelWithContext = ({
@@ -31,8 +30,18 @@ tabPanel && jsx(TabPanelContext.Provider, {
31
30
  },
32
31
  key: index
33
32
  }, tabPanel);
33
+ /**
34
+ * __Tabs__
35
+ *
36
+ * Tabs acts as a container for all Tab components.
37
+ *
38
+ * - [Examples](https://atlassian.design/components/tabs/examples)
39
+ * - [Code](https://atlassian.design/components/tabs/code)
40
+ * - [Usage](https://atlassian.design/components/tabs/usage)
41
+ */
42
+
34
43
 
35
- const TabsWithMode = props => {
44
+ const Tabs = props => {
36
45
  const {
37
46
  shouldUnmountTabPanelOnChange = false,
38
47
  selected: SelectedType,
@@ -41,9 +50,11 @@ const TabsWithMode = props => {
41
50
  id,
42
51
  analyticsContext,
43
52
  children,
44
- testId,
45
- mode
53
+ testId
46
54
  } = props;
55
+ const {
56
+ mode
57
+ } = useGlobalTheme();
47
58
  const [selectedState, setSelected] = useState(SelectedType || defaultSelected || 0);
48
59
  const selected = SelectedType === undefined ? selectedState : SelectedType;
49
60
  const childrenArray = Children.toArray(children) // Don't include any conditional children
@@ -83,9 +94,22 @@ const TabsWithMode = props => {
83
94
  tabsId: id
84
95
  }));
85
96
  const tabsStyles = useMemo(() => getTabsStyles(mode), [mode]);
86
- return (// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
87
- jsx("div", {
88
- "data-testid": testId,
97
+ return (// Only styles that affect the Tabs container itself have been applied via primitives.
98
+ // The other styles applied through the CSS prop are there for styling children
99
+ // through inheritance. This is important for custom cases that use the useTabPanel(),
100
+ // which applies accessibility atributes that we use as a styling hook.
101
+ jsx(Box, {
102
+ as: "div",
103
+ testId: testId,
104
+ display: "flex",
105
+ flexDirection: "column",
106
+ UNSAFE_style: {
107
+ maxWidth: '100%',
108
+ minHeight: '0%',
109
+ flexBasis: '100%',
110
+ flexGrow: 1
111
+ } // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
112
+ ,
89
113
  css: tabsStyles
90
114
  }, jsx(TabListContext.Provider, {
91
115
  value: {
@@ -93,23 +117,8 @@ const TabsWithMode = props => {
93
117
  onChange: onChangeAnalytics,
94
118
  tabsId: id
95
119
  }
96
- }, tabList), tabPanelsWithContext)
120
+ }, tabList), jsx(Fragment, null, tabPanelsWithContext))
97
121
  );
98
122
  };
99
- /**
100
- * __Tabs__
101
- *
102
- * Tabs acts as a container for all Tab components.
103
- *
104
- * - [Examples](https://atlassian.design/components/tabs/examples)
105
- * - [Code](https://atlassian.design/components/tabs/code)
106
- * - [Usage](https://atlassian.design/components/tabs/usage)
107
- */
108
-
109
123
 
110
- export const Tabs = props => jsx(GlobalTheme.Consumer, null, ({
111
- mode
112
- }) => jsx(TabsWithMode, _extends({}, props, {
113
- mode: mode
114
- })));
115
124
  export default Tabs;
@@ -35,12 +35,6 @@ const getTabPanelStyles = mode => ({
35
35
 
36
36
  export const getTabsStyles = mode => // eslint-disable-next-line @repo/internal/styles/no-exported-styles
37
37
  css({
38
- display: 'flex',
39
- maxWidth: '100%',
40
- minHeight: '0%',
41
- flexBasis: '100%',
42
- flexDirection: 'column',
43
- flexGrow: 1,
44
38
  '& [role="tabpanel"]': getTabPanelStyles(mode),
45
39
  // The hidden attribute doesn't work on flex elements
46
40
  // Change display to be none
@@ -61,10 +55,6 @@ const tabLineStyles = {
61
55
  };
62
56
  export const getTabListStyles = mode => // eslint-disable-next-line @repo/internal/styles/no-exported-styles
63
57
  css({
64
- display: 'flex',
65
- margin: 0,
66
- padding: 0,
67
- position: 'relative',
68
58
  '& [role="tab"]': getTabStyles(mode),
69
59
  fontWeight: 500,
70
60
  '&::before': { ...tabLineStyles,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/tabs",
3
- "version": "13.3.0",
3
+ "version": "13.3.2",
4
4
  "sideEffects": false
5
5
  }