@atlaskit/tabs 13.2.9 → 13.2.12

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 (47) hide show
  1. package/CHANGELOG.md +18 -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 +10 -0
  22. package/dist/cjs/components/tab-panel.js +10 -0
  23. package/dist/cjs/components/tab.js +10 -0
  24. package/dist/cjs/components/tabs.js +11 -1
  25. package/dist/cjs/internal/context.js +1 -0
  26. package/dist/cjs/version.json +1 -1
  27. package/dist/es2019/components/tab-list.js +10 -0
  28. package/dist/es2019/components/tab-panel.js +10 -0
  29. package/dist/es2019/components/tab.js +10 -0
  30. package/dist/es2019/components/tabs.js +11 -1
  31. package/dist/es2019/internal/context.js +1 -0
  32. package/dist/es2019/version.json +1 -1
  33. package/dist/esm/components/tab-list.js +10 -0
  34. package/dist/esm/components/tab-panel.js +10 -0
  35. package/dist/esm/components/tab.js +10 -0
  36. package/dist/esm/components/tabs.js +11 -1
  37. package/dist/esm/internal/context.js +1 -0
  38. package/dist/esm/version.json +1 -1
  39. package/dist/types/components/tab-list.d.ts +9 -0
  40. package/dist/types/components/tab-panel.d.ts +9 -0
  41. package/dist/types/components/tab.d.ts +9 -0
  42. package/dist/types/components/tabs.d.ts +9 -0
  43. package/dist/types/types.d.ts +13 -5
  44. package/hooks/package.json +1 -0
  45. package/package.json +15 -11
  46. package/report.api.md +229 -0
  47. package/types/package.json +1 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/tabs
2
2
 
3
+ ## 13.2.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f0056770cce`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f0056770cce) - Internal code change turning on new linting rules.
8
+
9
+ ## 13.2.11
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 13.2.10
16
+
17
+ ### Patch Changes
18
+
19
+ - [`cb2392f6d33`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb2392f6d33) - Upgrade to TypeScript 4.2.4
20
+
3
21
  ## 13.2.9
4
22
 
5
23
  ### 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
@@ -119,6 +119,16 @@ 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
134
  return (0, _core.jsx)(_components.default.Consumer, null, function (_ref2) {
@@ -15,6 +15,16 @@ 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;
@@ -14,6 +14,16 @@ var _core = require("@emotion/core");
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;
@@ -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.9"
39
+ packageVersion: "13.2.12"
40
40
  };
41
41
 
42
42
  var getTabPanelWithContext = function getTabPanelWithContext(_ref) {
@@ -137,6 +137,16 @@ 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
152
  return (0, _core.jsx)(_components.default.Consumer, null, function (_ref2) {
@@ -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);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/tabs",
3
- "version": "13.2.9",
3
+ "version": "13.2.12",
4
4
  "sideEffects": false
5
5
  }
@@ -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
@@ -5,6 +5,16 @@ import { jsx } from '@emotion/core';
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
@@ -3,6 +3,16 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  /** @jsx jsx */
4
4
  import { jsx } from '@emotion/core';
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
@@ -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.9"
14
+ packageVersion: "13.2.12"
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,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/tabs",
3
- "version": "13.2.9",
3
+ "version": "13.2.12",
4
4
  "sideEffects": false
5
5
  }
@@ -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) {
@@ -5,6 +5,16 @@ import { jsx } from '@emotion/core';
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;
@@ -3,6 +3,16 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  /** @jsx jsx */
4
4
  import { jsx } from '@emotion/core';
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;
@@ -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.9"
21
+ packageVersion: "13.2.12"
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);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/tabs",
3
- "version": "13.2.9",
3
+ "version": "13.2.12",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,13 @@
1
1
  /// <reference types="react" />
2
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
+ */
3
12
  export declare const TabList: (props: TabListProps) => JSX.Element;
4
13
  export default TabList;
@@ -1,4 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { TabPanelProps } from '../types';
3
+ /**
4
+ * __TabPanel__
5
+ *
6
+ * A TabPanel houses the contents of a Tab.
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
+ */
3
12
  declare const TabPanel: ({ children, testId }: TabPanelProps) => JSX.Element;
4
13
  export default TabPanel;
@@ -1,3 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { TabProps } from '../types';
3
+ /**
4
+ * __Tab__
5
+ *
6
+ * Tab represents an indivudal Tab displayed in a TabList.
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
+ */
3
12
  export default function Tab({ children, testId }: TabProps): JSX.Element;
@@ -1,4 +1,13 @@
1
1
  /// <reference types="react" />
2
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
+ */
3
12
  export declare const Tabs: (props: TabsProps) => JSX.Element;
4
13
  export default Tabs;
@@ -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;
@@ -3,5 +3,6 @@
3
3
  "main": "../dist/cjs/hooks.js",
4
4
  "module": "../dist/esm/hooks.js",
5
5
  "module:es2019": "../dist/es2019/hooks.js",
6
+ "sideEffects": false,
6
7
  "types": "../dist/types/hooks.d.ts"
7
8
  }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@atlaskit/tabs",
3
- "version": "13.2.9",
3
+ "version": "13.2.12",
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,19 +13,20 @@
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/codemod-utils": "^4.1.0",
27
28
  "@atlaskit/theme": "^12.1.0",
28
- "@atlaskit/tokens": "^0.9.0",
29
+ "@atlaskit/tokens": "^0.10.0",
29
30
  "@babel/runtime": "^7.0.0",
30
31
  "@emotion/core": "^10.0.9"
31
32
  },
@@ -33,8 +34,9 @@
33
34
  "react": "^16.8.0"
34
35
  },
35
36
  "devDependencies": {
36
- "@atlaskit/button": "^16.2.0",
37
+ "@atlaskit/button": "^16.3.0",
37
38
  "@atlaskit/docs": "*",
39
+ "@atlaskit/ds-lib": "^2.1.0",
38
40
  "@atlaskit/section-message": "^6.1.0",
39
41
  "@atlaskit/spinner": "^15.1.0",
40
42
  "@atlaskit/ssr": "*",
@@ -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": "3.9.10",
53
+ "typescript": "4.2.4",
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
+ ```
@@ -3,5 +3,6 @@
3
3
  "main": "../dist/cjs/types.js",
4
4
  "module": "../dist/esm/types.js",
5
5
  "module:es2019": "../dist/es2019/types.js",
6
+ "sideEffects": false,
6
7
  "types": "../dist/types/types.d.ts"
7
8
  }