@atlaskit/tabs 13.2.11 → 13.3.0

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 (49) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/codemods/{13.0.0-lite-mode.ts → 13.0.0-lite-mode.tsx} +4 -4
  3. package/codemods/__tests__/{13.0.0-lite-mode.ts → 13.0.0-lite-mode.tsx} +0 -0
  4. package/codemods/__tests__/{add-id-prop.ts → add-id-prop.tsx} +0 -0
  5. package/codemods/__tests__/{map-tabs-prop.ts → map-tabs-prop.tsx} +0 -0
  6. package/codemods/__tests__/{onSelect-to-onChange.ts → on-select-to-on-change.tsx} +1 -1
  7. package/codemods/__tests__/{remove-components-prop.ts → remove-components-prop.tsx} +0 -0
  8. package/codemods/__tests__/{remove-isSelectedTest-prop.ts → remove-is-selected-test-prop.tsx} +1 -1
  9. package/codemods/__tests__/{remove-TabItem-TabContent.ts → remove-tab-item-tab-content.tsx} +1 -1
  10. package/codemods/__tests__/{remove-types.ts → remove-types.tsx} +0 -0
  11. package/codemods/__tests__/{rename-isContentPersisted-to-shouldUnmountTabPanelOnChange.ts → rename-is-content-persisted-to-should-unmount-tab-panel-on-change.tsx} +1 -1
  12. package/codemods/migrations/{add-id-prop.ts → add-id-prop.tsx} +0 -0
  13. package/codemods/migrations/{map-tabs-prop.ts → map-tabs-prop.tsx} +0 -0
  14. package/codemods/migrations/{onSelect-to-onChange.ts → on-select-to-on-change.tsx} +0 -0
  15. package/codemods/migrations/{remove-components-prop.ts → remove-components-prop.tsx} +0 -0
  16. package/codemods/migrations/{remove-isSelectedTest-prop.ts → remove-is-selected-test-prop.tsx} +0 -0
  17. package/codemods/migrations/{remove-TabItem-TabContent.ts → remove-tab-item-tab-content.tsx} +0 -0
  18. package/codemods/migrations/{remove-types.ts → remove-types.tsx} +0 -0
  19. package/codemods/migrations/{rename-isContentPersisted-to-shouldUnmountTabPanelOnChange.ts → rename-is-content-persisted-to-should-unmount-tab-panel-on-change.tsx} +0 -0
  20. package/codemods/{utils.ts → utils.tsx} +0 -0
  21. package/dist/cjs/components/tab-list.js +15 -5
  22. package/dist/cjs/components/tab-panel.js +12 -2
  23. package/dist/cjs/components/tab.js +12 -2
  24. package/dist/cjs/components/tabs.js +17 -7
  25. package/dist/cjs/internal/context.js +1 -0
  26. package/dist/cjs/internal/styles.js +34 -29
  27. package/dist/cjs/version.json +1 -1
  28. package/dist/es2019/components/tab-list.js +11 -1
  29. package/dist/es2019/components/tab-panel.js +11 -1
  30. package/dist/es2019/components/tab.js +11 -1
  31. package/dist/es2019/components/tabs.js +12 -2
  32. package/dist/es2019/internal/context.js +1 -0
  33. package/dist/es2019/internal/styles.js +15 -13
  34. package/dist/es2019/version.json +1 -1
  35. package/dist/esm/components/tab-list.js +11 -1
  36. package/dist/esm/components/tab-panel.js +11 -1
  37. package/dist/esm/components/tab.js +11 -1
  38. package/dist/esm/components/tabs.js +12 -2
  39. package/dist/esm/internal/context.js +1 -0
  40. package/dist/esm/internal/styles.js +33 -29
  41. package/dist/esm/version.json +1 -1
  42. package/dist/types/components/tab-list.d.ts +11 -2
  43. package/dist/types/components/tab-panel.d.ts +12 -2
  44. package/dist/types/components/tab.d.ts +12 -2
  45. package/dist/types/components/tabs.d.ts +11 -2
  46. package/dist/types/internal/styles.d.ts +3 -3
  47. package/dist/types/types.d.ts +13 -5
  48. package/package.json +16 -12
  49. package/report.api.md +229 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @atlaskit/tabs
2
2
 
3
+ ## 13.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`7ec1c1a023f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7ec1c1a023f) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behavior change.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 13.2.13
14
+
15
+ ### Patch Changes
16
+
17
+ - [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
18
+
19
+ ## 13.2.12
20
+
21
+ ### Patch Changes
22
+
23
+ - [`f0056770cce`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f0056770cce) - Internal code change turning on new linting rules.
24
+
3
25
  ## 13.2.11
4
26
 
5
27
  ### Patch Changes
@@ -8,12 +8,12 @@ import {
8
8
 
9
9
  import { addIdProp } from './migrations/add-id-prop';
10
10
  import { mapTabsProp, removeTabsProp } from './migrations/map-tabs-prop';
11
- import { migrateOnSelectType } from './migrations/onSelect-to-onChange';
11
+ import { migrateOnSelectType } from './migrations/on-select-to-on-change';
12
12
  import { removeComponentsProp } from './migrations/remove-components-prop';
13
- import { removeIsSelectedTestProp } from './migrations/remove-isSelectedTest-prop';
14
- import { removeTabItemTabContent } from './migrations/remove-TabItem-TabContent';
13
+ import { removeIsSelectedTestProp } from './migrations/remove-is-selected-test-prop';
14
+ import { removeTabItemTabContent } from './migrations/remove-tab-item-tab-content';
15
15
  import { removeTypes } from './migrations/remove-types';
16
- import { renameIsContentPersistedToShouldUnmountTabPanelOnChange } from './migrations/rename-isContentPersisted-to-shouldUnmountTabPanelOnChange';
16
+ import { renameIsContentPersistedToShouldUnmountTabPanelOnChange } from './migrations/rename-is-content-persisted-to-should-unmount-tab-panel-on-change';
17
17
 
18
18
  const transformer = createTransformer(
19
19
  [
@@ -1,6 +1,6 @@
1
1
  import { createTransformer } from '@atlaskit/codemod-utils';
2
2
 
3
- import { migrateOnSelectType } from '../migrations/onSelect-to-onChange';
3
+ import { migrateOnSelectType } from '../migrations/on-select-to-on-change';
4
4
 
5
5
  const transformer = createTransformer([migrateOnSelectType]);
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { createTransformer } from '@atlaskit/codemod-utils';
2
2
 
3
- import { removeIsSelectedTestProp } from '../migrations/remove-isSelectedTest-prop';
3
+ import { removeIsSelectedTestProp } from '../migrations/remove-is-selected-test-prop';
4
4
 
5
5
  const transformer = createTransformer([removeIsSelectedTestProp]);
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { createTransformer } from '@atlaskit/codemod-utils';
2
2
 
3
- import { removeTabItemTabContent } from '../migrations/remove-TabItem-TabContent';
3
+ import { removeTabItemTabContent } from '../migrations/remove-tab-item-tab-content';
4
4
 
5
5
  const transformer = createTransformer([removeTabItemTabContent]);
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { createTransformer } from '@atlaskit/codemod-utils';
2
2
 
3
- import { renameIsContentPersistedToShouldUnmountTabPanelOnChange } from '../migrations/rename-isContentPersisted-to-shouldUnmountTabPanelOnChange';
3
+ import { renameIsContentPersistedToShouldUnmountTabPanelOnChange } from '../migrations/rename-is-content-persisted-to-should-unmount-tab-panel-on-change';
4
4
 
5
5
  const transformer = createTransformer([
6
6
  renameIsContentPersistedToShouldUnmountTabPanelOnChange,
File without 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
@@ -119,11 +119,21 @@ var TabListWithMode = function TabListWithMode(props) {
119
119
  }))
120
120
  );
121
121
  };
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
+
122
132
 
123
133
  var TabList = function TabList(props) {
124
- return (0, _core.jsx)(_components.default.Consumer, null, function (_ref2) {
134
+ return (0, _react2.jsx)(_components.default.Consumer, null, function (_ref2) {
125
135
  var mode = _ref2.mode;
126
- return (0, _core.jsx)(TabListWithMode, (0, _extends2.default)({}, props, {
136
+ return (0, _react2.jsx)(TabListWithMode, (0, _extends2.default)({}, props, {
127
137
  mode: mode
128
138
  }));
129
139
  });
@@ -9,17 +9,27 @@ 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
 
16
16
  /** @jsx jsx */
17
17
  // Note this is not being memoized as children is an unstable reference
18
+
19
+ /**
20
+ * __TabPanel__
21
+ *
22
+ * A TabPanel houses the contents of a Tab.
23
+ *
24
+ * - [Examples](https://atlassian.design/components/tabs/examples)
25
+ * - [Code](https://atlassian.design/components/tabs/code)
26
+ * - [Usage](https://atlassian.design/components/tabs/usage)
27
+ */
18
28
  var TabPanel = function TabPanel(_ref) {
19
29
  var children = _ref.children,
20
30
  testId = _ref.testId;
21
31
  var tabPanelAttributes = (0, _hooks.useTabPanel)();
22
- return (0, _core.jsx)("div", (0, _extends2.default)({
32
+ return (0, _react.jsx)("div", (0, _extends2.default)({
23
33
  "data-testid": testId
24
34
  }, tabPanelAttributes), children);
25
35
  };
@@ -9,16 +9,26 @@ 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
 
16
16
  /** @jsx jsx */
17
+
18
+ /**
19
+ * __Tab__
20
+ *
21
+ * Tab represents an indivudal Tab displayed in a TabList.
22
+ *
23
+ * - [Examples](https://atlassian.design/components/tabs/examples)
24
+ * - [Code](https://atlassian.design/components/tabs/code)
25
+ * - [Usage](https://atlassian.design/components/tabs/usage)
26
+ */
17
27
  function Tab(_ref) {
18
28
  var children = _ref.children,
19
29
  testId = _ref.testId;
20
30
  var tabAttributes = (0, _hooks.useTab)();
21
- return (0, _core.jsx)("div", (0, _extends2.default)({
31
+ return (0, _react.jsx)("div", (0, _extends2.default)({
22
32
  "data-testid": testId
23
33
  }, tabAttributes), children);
24
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.11"
39
+ packageVersion: "13.3.0"
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,
@@ -137,11 +137,21 @@ var TabsWithMode = function TabsWithMode(props) {
137
137
  }, tabList), tabPanelsWithContext)
138
138
  );
139
139
  };
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
+
140
150
 
141
151
  var Tabs = function Tabs(props) {
142
- return (0, _core.jsx)(_components.default.Consumer, null, function (_ref2) {
152
+ return (0, _react2.jsx)(_components.default.Consumer, null, function (_ref2) {
143
153
  var mode = _ref2.mode;
144
- return (0, _core.jsx)(TabsWithMode, (0, _extends2.default)({}, props, {
154
+ return (0, _react2.jsx)(TabsWithMode, (0, _extends2.default)({}, props, {
145
155
  mode: mode
146
156
  }));
147
157
  });
@@ -7,6 +7,7 @@ exports.TabPanelContext = exports.TabListContext = exports.TabContext = void 0;
7
7
 
8
8
  var _react = require("react");
9
9
 
10
+ /* eslint-disable @repo/internal/react/require-jsdoc */
10
11
  var TabContext = /*#__PURE__*/(0, _react.createContext)(null);
11
12
  exports.TabContext = TabContext;
12
13
  var TabListContext = /*#__PURE__*/(0, _react.createContext)(null);
@@ -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.11",
3
+ "version": "13.3.0",
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';
@@ -96,6 +96,16 @@ const TabListWithMode = props => {
96
96
  })))
97
97
  );
98
98
  };
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
+
99
109
 
100
110
  export const TabList = props => jsx(GlobalTheme.Consumer, null, ({
101
111
  mode
@@ -1,10 +1,20 @@
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
8
+
9
+ /**
10
+ * __TabPanel__
11
+ *
12
+ * A TabPanel houses the contents of a Tab.
13
+ *
14
+ * - [Examples](https://atlassian.design/components/tabs/examples)
15
+ * - [Code](https://atlassian.design/components/tabs/code)
16
+ * - [Usage](https://atlassian.design/components/tabs/usage)
17
+ */
8
18
  const TabPanel = ({
9
19
  children,
10
20
  testId
@@ -1,8 +1,18 @@
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
+
7
+ /**
8
+ * __Tab__
9
+ *
10
+ * Tab represents an indivudal Tab displayed in a TabList.
11
+ *
12
+ * - [Examples](https://atlassian.design/components/tabs/examples)
13
+ * - [Code](https://atlassian.design/components/tabs/code)
14
+ * - [Usage](https://atlassian.design/components/tabs/usage)
15
+ */
6
16
  export default function Tab({
7
17
  children,
8
18
  testId
@@ -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.11"
14
+ packageVersion: "13.3.0"
15
15
  };
16
16
 
17
17
  const getTabPanelWithContext = ({
@@ -96,6 +96,16 @@ const TabsWithMode = props => {
96
96
  }, tabList), tabPanelsWithContext)
97
97
  );
98
98
  };
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
+
99
109
 
100
110
  export const Tabs = props => jsx(GlobalTheme.Consumer, null, ({
101
111
  mode
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @repo/internal/react/require-jsdoc */
1
2
  import { createContext } from 'react';
2
3
  export const TabContext = /*#__PURE__*/createContext(null);
3
4
  export const TabListContext = /*#__PURE__*/createContext(null);
@@ -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.11",
3
+ "version": "13.3.0",
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';
@@ -103,6 +103,16 @@ var TabListWithMode = function TabListWithMode(props) {
103
103
  }))
104
104
  );
105
105
  };
106
+ /**
107
+ * __TabList__
108
+ *
109
+ * A TabList groups `Tab` components together.
110
+ *
111
+ * - [Examples](https://atlassian.design/components/tabs/examples)
112
+ * - [Code](https://atlassian.design/components/tabs/code)
113
+ * - [Usage](https://atlassian.design/components/tabs/usage)
114
+ */
115
+
106
116
 
107
117
  export var TabList = function TabList(props) {
108
118
  return jsx(GlobalTheme.Consumer, null, function (_ref2) {
@@ -1,10 +1,20 @@
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
8
+
9
+ /**
10
+ * __TabPanel__
11
+ *
12
+ * A TabPanel houses the contents of a Tab.
13
+ *
14
+ * - [Examples](https://atlassian.design/components/tabs/examples)
15
+ * - [Code](https://atlassian.design/components/tabs/code)
16
+ * - [Usage](https://atlassian.design/components/tabs/usage)
17
+ */
8
18
  var TabPanel = function TabPanel(_ref) {
9
19
  var children = _ref.children,
10
20
  testId = _ref.testId;
@@ -1,8 +1,18 @@
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
+
7
+ /**
8
+ * __Tab__
9
+ *
10
+ * Tab represents an indivudal Tab displayed in a TabList.
11
+ *
12
+ * - [Examples](https://atlassian.design/components/tabs/examples)
13
+ * - [Code](https://atlassian.design/components/tabs/code)
14
+ * - [Usage](https://atlassian.design/components/tabs/usage)
15
+ */
6
16
  export default function Tab(_ref) {
7
17
  var children = _ref.children,
8
18
  testId = _ref.testId;
@@ -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.11"
21
+ packageVersion: "13.3.0"
22
22
  };
23
23
 
24
24
  var getTabPanelWithContext = function getTabPanelWithContext(_ref) {
@@ -117,6 +117,16 @@ var TabsWithMode = function TabsWithMode(props) {
117
117
  }, tabList), tabPanelsWithContext)
118
118
  );
119
119
  };
120
+ /**
121
+ * __Tabs__
122
+ *
123
+ * Tabs acts as a container for all Tab components.
124
+ *
125
+ * - [Examples](https://atlassian.design/components/tabs/examples)
126
+ * - [Code](https://atlassian.design/components/tabs/code)
127
+ * - [Usage](https://atlassian.design/components/tabs/usage)
128
+ */
129
+
120
130
 
121
131
  export var Tabs = function Tabs(props) {
122
132
  return jsx(GlobalTheme.Consumer, null, function (_ref2) {
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @repo/internal/react/require-jsdoc */
1
2
  import { createContext } from 'react';
2
3
  export var TabContext = /*#__PURE__*/createContext(null);
3
4
  export var TabListContext = /*#__PURE__*/createContext(null);
@@ -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.11",
3
+ "version": "13.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,13 @@
1
- /// <reference types="react" />
1
+ import { jsx } from '@emotion/react';
2
2
  import { TabListProps } from '../types';
3
- export declare const TabList: (props: TabListProps) => JSX.Element;
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;
4
13
  export default TabList;
@@ -1,4 +1,14 @@
1
- /// <reference types="react" />
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
2
3
  import { TabPanelProps } from '../types';
3
- declare const TabPanel: ({ children, testId }: TabPanelProps) => JSX.Element;
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;
4
14
  export default TabPanel;
@@ -1,3 +1,13 @@
1
- /// <reference types="react" />
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
2
3
  import { TabProps } from '../types';
3
- export default function Tab({ children, testId }: TabProps): JSX.Element;
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;
@@ -1,4 +1,13 @@
1
- /// <reference types="react" />
1
+ import { jsx } from '@emotion/react';
2
2
  import { TabsProps } from '../types';
3
- export declare const Tabs: (props: TabsProps) => JSX.Element;
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;
4
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;
@@ -37,15 +37,23 @@ export interface TabPanelProps {
37
37
  * The TabData type remains so the variable used in tabs can have a type.
38
38
  */
39
39
  export interface TabData {
40
- /** String to be put inside a tab */
40
+ /**
41
+ * String to be put inside a tab
42
+ */
41
43
  label?: string;
42
- /** String to be put inside a tab panel */
44
+ /**
45
+ * String to be put inside a tab panel
46
+ */
43
47
  content?: ReactNode;
44
- /** A `testId` prop is provided for specified elements, which is a unique
48
+ /**
49
+ * A `testId` prop is provided for specified elements, which is a unique
45
50
  * string that appears as a data attribute `data-testid` in the rendered code,
46
- * serving as a hook for automated tests. This `testId` is put on the tab. */
51
+ * serving as a hook for automated tests. This `testId` is put on the tab.
52
+ */
47
53
  testId?: string;
48
- /** Used by consumers to convey extra information about the tab. */
54
+ /**
55
+ * Used by consumers to convey extra information about the tab.
56
+ */
49
57
  [key: string]: any;
50
58
  }
51
59
  export declare type SelectedType = number;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@atlaskit/tabs",
3
- "version": "13.2.11",
3
+ "version": "13.3.0",
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/"
7
7
  },
8
- "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
8
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
9
9
  "author": "Atlassian Pty Ltd",
10
10
  "license": "Apache-2.0",
11
11
  "main": "dist/cjs/index.js",
@@ -13,21 +13,22 @@
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
15
  "sideEffects": false,
16
- "atlaskit:src": "src/index.ts",
16
+ "atlaskit:src": "src/index.tsx",
17
17
  "atlassian": {
18
18
  "team": "Design System Team",
19
19
  "releaseModel": "scheduled",
20
20
  "website": {
21
- "name": "Tabs"
21
+ "name": "Tabs",
22
+ "category": "Components"
22
23
  }
23
24
  },
24
25
  "dependencies": {
25
26
  "@atlaskit/analytics-next": "^8.2.0",
26
- "@atlaskit/codemod-utils": "^4.0.0",
27
- "@atlaskit/theme": "^12.1.0",
27
+ "@atlaskit/codemod-utils": "^4.1.0",
28
+ "@atlaskit/theme": "^12.2.0",
28
29
  "@atlaskit/tokens": "^0.10.0",
29
30
  "@babel/runtime": "^7.0.0",
30
- "@emotion/core": "^10.0.9"
31
+ "@emotion/react": "^11.7.1"
31
32
  },
32
33
  "peerDependencies": {
33
34
  "react": "^16.8.0"
@@ -35,7 +36,8 @@
35
36
  "devDependencies": {
36
37
  "@atlaskit/button": "^16.3.0",
37
38
  "@atlaskit/docs": "*",
38
- "@atlaskit/section-message": "^6.1.0",
39
+ "@atlaskit/ds-lib": "^2.1.0",
40
+ "@atlaskit/section-message": "^6.2.0",
39
41
  "@atlaskit/spinner": "^15.1.0",
40
42
  "@atlaskit/ssr": "*",
41
43
  "@atlaskit/tooltip": "^17.5.0",
@@ -48,7 +50,7 @@
48
50
  "react-dom": "^16.8.0",
49
51
  "react-lorem-component": "^0.13.0",
50
52
  "storybook-addon-performance": "^0.16.0",
51
- "typescript": "4.2.4",
53
+ "typescript": "4.3.5",
52
54
  "wait-for-expect": "^1.2.0"
53
55
  },
54
56
  "techstack": {
@@ -56,6 +58,8 @@
56
58
  "import-structure": "atlassian-conventions"
57
59
  },
58
60
  "@repo/internal": {
61
+ "dom-events": "use-bind-event-listener",
62
+ "design-system": "v1",
59
63
  "ui-components": "lite-mode",
60
64
  "analytics": "analytics-next",
61
65
  "theming": "tokens",
@@ -67,9 +71,9 @@
67
71
  }
68
72
  },
69
73
  "af:exports": {
70
- ".": "./src/index.ts",
71
- "./types": "./src/types.ts",
72
- "./hooks": "./src/hooks.ts"
74
+ ".": "./src/index.tsx",
75
+ "./types": "./src/types.tsx",
76
+ "./hooks": "./src/hooks.tsx"
73
77
  },
74
78
  "homepage": "https://atlassian.design/components/tabs/",
75
79
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
package/report.api.md ADDED
@@ -0,0 +1,229 @@
1
+ ## API Report File for "@atlaskit/tabs"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+ /// <reference types="react" />
7
+
8
+ import { KeyboardEvent as KeyboardEvent_2 } from 'react';
9
+ import { MouseEvent as MouseEvent_2 } from 'react';
10
+ import { ReactNode } from 'react';
11
+ import UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
12
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next/withAnalyticsEvents';
13
+
14
+ declare type OnChangeCallback = (
15
+ index: SelectedType,
16
+ analyticsEvent: UIAnalyticsEvent,
17
+ ) => void;
18
+
19
+ declare type SelectedType = number;
20
+
21
+ export declare function Tab({ children, testId }: TabProps): JSX.Element;
22
+
23
+ export declare type TabAttributesType = {
24
+ /**
25
+ * Changes the selected tab.
26
+ */
27
+ onClick: () => void;
28
+ /**
29
+ * ID of the tab.
30
+ */
31
+ id: string;
32
+ /**
33
+ * The id of the tab panel that this tab links.
34
+ */
35
+ 'aria-controls': string;
36
+ /**
37
+ * The position of this tab within the tab list.
38
+ */
39
+ 'aria-posinset': number;
40
+ /**
41
+ * Whether this tab is selected.
42
+ */
43
+ 'aria-selected': boolean;
44
+ /**
45
+ * The number of tabs in this tab list.
46
+ */
47
+ 'aria-setsize': number;
48
+ /**
49
+ * Prevents a focus ring being shown when clicked.
50
+ */
51
+ onMouseDown: (e: MouseEvent_2<HTMLElement>) => void;
52
+ /**
53
+ * Allows navigation of tabs with automatic activation.
54
+ * Read here for more details: https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html
55
+ */
56
+ onKeyDown: (e: KeyboardEvent_2<HTMLElement>) => void;
57
+ /**
58
+ * Role is "tab".
59
+ */
60
+ role: 'tab';
61
+ /**
62
+ * If the tab is selected the tab index is 0 and is focusable.
63
+ * Otherwise it is -1 and is not focusable.
64
+ */
65
+ tabIndex: number;
66
+ };
67
+
68
+ /**
69
+ * @deprecated
70
+ * Previously this was the type for the tabs prop that was used like
71
+ * <Tabs tabs={tabs} />
72
+ * The codemod changes this to be
73
+ * <Tabs>
74
+ * <TabList>
75
+ * {tabs.map(tab => <Tab testId={tab.testId}>{tab.label}</Tab>)}
76
+ * </TabList>
77
+ * {tabs.map(tab => <TabPanel>{tab.content}</TabPanel>)}
78
+ * </Tabs>
79
+ * The TabData type remains so the variable used in tabs can have a type.
80
+ */
81
+ export declare interface TabData {
82
+ /** String to be put inside a tab */
83
+ label?: string;
84
+ /** String to be put inside a tab panel */
85
+ content?: ReactNode;
86
+ /** A `testId` prop is provided for specified elements, which is a unique
87
+ * string that appears as a data attribute `data-testid` in the rendered code,
88
+ * serving as a hook for automated tests. This `testId` is put on the tab. */
89
+ testId?: string;
90
+ /** Used by consumers to convey extra information about the tab. */
91
+ [key: string]: any;
92
+ }
93
+
94
+ export declare const TabList: (props: TabListProps) => JSX.Element;
95
+
96
+ export declare type TabListAttributesType = {
97
+ /**
98
+ * The index of the selected tab.
99
+ */
100
+ selected: SelectedType;
101
+ /**
102
+ * A unique ID that will be used to generate IDs for tabs and tab panels.
103
+ * This is required for accessibility reasons.
104
+ */
105
+ tabsId: string;
106
+ /**
107
+ * A callback function which will be fired when a tab is changed.
108
+ */
109
+ onChange: (index: SelectedType) => void;
110
+ };
111
+
112
+ export declare interface TabListProps {
113
+ /**
114
+ * A collection of `Tab`'s. There should be a `Tab` for each `TabPanel`.
115
+ * If you want to customize `Tab` there is documentation in the tab section.
116
+ */
117
+ children: ReactNode;
118
+ }
119
+
120
+ export declare const TabPanel: ({
121
+ children,
122
+ testId,
123
+ }: TabPanelProps) => JSX.Element;
124
+
125
+ export declare type TabPanelAttributesType = {
126
+ /**
127
+ * Role is "tabpanel".
128
+ */
129
+ role: 'tabpanel';
130
+ /**
131
+ * ID of the the tab panel.
132
+ */
133
+ id: string;
134
+ /**
135
+ * Hidden is true if it is not the selected tab.
136
+ */
137
+ hidden?: boolean;
138
+ /**
139
+ * The id of the tab that links to this tab panel.
140
+ */
141
+ 'aria-labelledby': string;
142
+ /**
143
+ * Prevents a focus ring being shown when clicked.
144
+ */
145
+ onMouseDown: (e: MouseEvent_2<HTMLElement>) => void;
146
+ /**
147
+ * If the tab panel is selected the tab index is 0 and is focusable.
148
+ * Otherwise it is -1 and is not focusable.
149
+ */
150
+ tabIndex: number;
151
+ };
152
+
153
+ export declare interface TabPanelProps {
154
+ /**
155
+ * The children to be rendered within a `TabPanel`.
156
+ */
157
+ children: ReactNode;
158
+ /**
159
+ * A `testId` prop is is a unique string that appears as a data attribute `data-testid`
160
+ * on the `TabPanel` element, serving as a hook for automated tests.
161
+ */
162
+ testId?: string;
163
+ }
164
+
165
+ export declare interface TabProps {
166
+ /**
167
+ * The children to be rendered within a `Tab`.
168
+ */
169
+ children: ReactNode;
170
+ /**
171
+ * A `testId` prop is is a unique string that appears as a data attribute `data-testid`
172
+ * on the `Tab` element, serving as a hook for automated tests.
173
+ */
174
+ testId?: string;
175
+ }
176
+
177
+ declare const Tabs: (props: TabsProps) => JSX.Element;
178
+ export default Tabs;
179
+
180
+ export declare interface TabsProps extends WithAnalyticsEventsProps {
181
+ /**
182
+ * The index of the tab that will be selected by default when the component mounts.
183
+ * If not set the first tab will be displayed by default.
184
+ */
185
+ defaultSelected?: SelectedType;
186
+ /**
187
+ * A callback function which will be fired when a changed. It will be passed
188
+ * the index of the selected tab and a `UIAnalyticsEvent`.
189
+ */
190
+ onChange?: OnChangeCallback;
191
+ /**
192
+ * The selected tab's index. If this prop is set the component behaves as a
193
+ * controlled component. It will be up to you to listen to `onChange`.
194
+ */
195
+ selected?: SelectedType;
196
+ /**
197
+ * Tabs by default leaves `TabPanel`'s mounted on the page after they have been selected.
198
+ * If you would like to unmount a `TabPanel` when it is not selected, set this prop to
199
+ * be true.
200
+ */
201
+ shouldUnmountTabPanelOnChange?: boolean;
202
+ /**
203
+ * Additional information to be included in the `context` of analytics events that come from `Tabs`.
204
+ */
205
+ analyticsContext?: Record<string, any>;
206
+ /**
207
+ * A `testId` prop is a unique string that appears as a data attribute `data-testid`
208
+ * on the `Tabs` element, serving as a hook for automated tests.
209
+ */
210
+ testId?: string;
211
+ /**
212
+ * The children of Tabs. The first child should be a `TabList` filled with `Tab`'s.
213
+ * Subsequent children should be `TabPanel`'s. There should be a `Tab` for each `TabPanel`.
214
+ * If you want to customize `Tab` or `TabPanel`, refer to the examples in the documentation.
215
+ */
216
+ children: ReactNode;
217
+ /**
218
+ * A unique ID that will be used to generate IDs for tabs and tab panels.
219
+ * This is required for accessibility purposes.
220
+ */
221
+ id: string;
222
+ }
223
+
224
+ export declare const useTab: () => TabAttributesType;
225
+
226
+ export declare const useTabPanel: () => TabPanelAttributesType;
227
+
228
+ export {};
229
+ ```