@atlaskit/tabs 13.4.1 → 13.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/components/tab-list.js +1 -1
- package/dist/cjs/components/tabs.js +2 -2
- package/dist/cjs/internal/styles.js +6 -5
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/tab-list.js +1 -1
- package/dist/es2019/components/tabs.js +2 -2
- package/dist/es2019/internal/styles.js +6 -5
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/tab-list.js +1 -1
- package/dist/esm/components/tabs.js +2 -2
- package/dist/esm/internal/styles.js +6 -5
- package/dist/esm/version.json +1 -1
- package/dist/types-ts4.5/components/tab-list.d.ts +13 -0
- package/dist/types-ts4.5/components/tab-panel.d.ts +13 -0
- package/dist/types-ts4.5/components/tab.d.ts +13 -0
- package/dist/types-ts4.5/components/tabs.d.ts +13 -0
- package/dist/types-ts4.5/hooks.d.ts +3 -0
- package/dist/types-ts4.5/index.d.ts +6 -0
- package/dist/types-ts4.5/internal/colors.d.ts +17 -0
- package/dist/types-ts4.5/internal/context.d.ts +5 -0
- package/dist/types-ts4.5/internal/styles.d.ts +5 -0
- package/dist/types-ts4.5/internal/utils.d.ts +2 -0
- package/dist/types-ts4.5/performance/examples.d.ts +24 -0
- package/dist/types-ts4.5/types.d.ts +196 -0
- package/package.json +5 -5
- package/tmp/api-report-tmp.d.ts +109 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/tabs
|
|
2
2
|
|
|
3
|
+
## 13.4.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`599bfe90ee3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/599bfe90ee3) - Internal change to use shape tokens. There is no expected visual change.
|
|
8
|
+
|
|
9
|
+
## 13.4.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
|
|
14
|
+
|
|
3
15
|
## 13.4.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -109,7 +109,7 @@ var TabList = function TabList(props) {
|
|
|
109
109
|
position: "relative",
|
|
110
110
|
padding: "space.0",
|
|
111
111
|
ref: ref
|
|
112
|
-
// eslint-disable-next-line @
|
|
112
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
113
113
|
,
|
|
114
114
|
css: tabListStyles
|
|
115
115
|
}, childrenArray.map(function (child, index) {
|
|
@@ -21,7 +21,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
21
21
|
var analyticsAttributes = {
|
|
22
22
|
componentName: 'tabs',
|
|
23
23
|
packageName: "@atlaskit/tabs",
|
|
24
|
-
packageVersion: "13.4.
|
|
24
|
+
packageVersion: "13.4.3"
|
|
25
25
|
};
|
|
26
26
|
var getTabPanelWithContext = function getTabPanelWithContext(_ref) {
|
|
27
27
|
var tabPanel = _ref.tabPanel,
|
|
@@ -130,7 +130,7 @@ var Tabs = function Tabs(props) {
|
|
|
130
130
|
flexBasis: '100%',
|
|
131
131
|
flexGrow: 1
|
|
132
132
|
}
|
|
133
|
-
// eslint-disable-next-line @
|
|
133
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
134
134
|
,
|
|
135
135
|
css: tabsStyles
|
|
136
136
|
}, (0, _react2.jsx)(_context.TabListContext.Provider, {
|
|
@@ -12,9 +12,10 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
12
12
|
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) { (0, _defineProperty2.default)(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; }
|
|
13
13
|
var tabLeftRightPadding = "var(--ds-space-100, 8px)";
|
|
14
14
|
var tabTopBottomPadding = "var(--ds-space-050, 4px)";
|
|
15
|
-
|
|
15
|
+
// TODO this should probably be `border.width.indicator`
|
|
16
|
+
var underlineHeight = "var(--ds-border-width-outline, 2px)";
|
|
16
17
|
var highContrastFocusStyles = {
|
|
17
|
-
outline:
|
|
18
|
+
outline: "var(--ds-border-width, 1px)".concat(" solid")
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
// Required so the focus ring is visible in high contrast mode
|
|
@@ -29,7 +30,7 @@ var highContrastFocusRing = {
|
|
|
29
30
|
var tabFocusStyles = function tabFocusStyles(mode) {
|
|
30
31
|
return {
|
|
31
32
|
boxShadow: "0 0 0 2px ".concat((0, _colors.getTabPanelFocusColor)(mode), " inset"),
|
|
32
|
-
borderRadius: "var(--ds-radius
|
|
33
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
33
34
|
outline: 'none'
|
|
34
35
|
};
|
|
35
36
|
};
|
|
@@ -66,7 +67,7 @@ var getTabsStyles = function getTabsStyles(mode) {
|
|
|
66
67
|
exports.getTabsStyles = getTabsStyles;
|
|
67
68
|
var tabLineStyles = {
|
|
68
69
|
content: '""',
|
|
69
|
-
borderRadius:
|
|
70
|
+
borderRadius: "var(--ds-border-radius-050, 2px)",
|
|
70
71
|
bottom: 0,
|
|
71
72
|
margin: 0,
|
|
72
73
|
position: 'absolute',
|
|
@@ -93,7 +94,7 @@ var tabPanelFocusStyles = function tabPanelFocusStyles(mode) {
|
|
|
93
94
|
var colors = (0, _colors.getTabColors)(mode);
|
|
94
95
|
return {
|
|
95
96
|
boxShadow: "0 0 0 2px ".concat(colors.focusBorderColor, " inset"),
|
|
96
|
-
borderRadius: "var(--ds-radius
|
|
97
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
97
98
|
outline: 'none',
|
|
98
99
|
// Hide TabLine on focus
|
|
99
100
|
'&::after': {
|
package/dist/cjs/version.json
CHANGED
|
@@ -101,7 +101,7 @@ const TabList = props => {
|
|
|
101
101
|
position: "relative",
|
|
102
102
|
padding: "space.0",
|
|
103
103
|
ref: ref
|
|
104
|
-
// eslint-disable-next-line @
|
|
104
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
105
105
|
,
|
|
106
106
|
css: tabListStyles
|
|
107
107
|
}, childrenArray.map((child, index) => getTabWithContext({
|
|
@@ -10,7 +10,7 @@ import { onMouseDownBlur } from '../internal/utils';
|
|
|
10
10
|
const analyticsAttributes = {
|
|
11
11
|
componentName: 'tabs',
|
|
12
12
|
packageName: "@atlaskit/tabs",
|
|
13
|
-
packageVersion: "13.4.
|
|
13
|
+
packageVersion: "13.4.3"
|
|
14
14
|
};
|
|
15
15
|
const getTabPanelWithContext = ({
|
|
16
16
|
tabPanel,
|
|
@@ -109,7 +109,7 @@ const Tabs = props => {
|
|
|
109
109
|
flexBasis: '100%',
|
|
110
110
|
flexGrow: 1
|
|
111
111
|
}
|
|
112
|
-
// eslint-disable-next-line @
|
|
112
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
113
113
|
,
|
|
114
114
|
css: tabsStyles
|
|
115
115
|
}, jsx(TabListContext.Provider, {
|
|
@@ -2,9 +2,10 @@ import { css } from '@emotion/react';
|
|
|
2
2
|
import { getTabColors, getTabLineColor, getTabPanelFocusColor } from './colors';
|
|
3
3
|
const tabLeftRightPadding = "var(--ds-space-100, 8px)";
|
|
4
4
|
const tabTopBottomPadding = "var(--ds-space-050, 4px)";
|
|
5
|
-
|
|
5
|
+
// TODO this should probably be `border.width.indicator`
|
|
6
|
+
const underlineHeight = "var(--ds-border-width-outline, 2px)";
|
|
6
7
|
const highContrastFocusStyles = {
|
|
7
|
-
outline:
|
|
8
|
+
outline: `${"var(--ds-border-width, 1px)"} solid`
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
// Required so the focus ring is visible in high contrast mode
|
|
@@ -18,7 +19,7 @@ const highContrastFocusRing = {
|
|
|
18
19
|
};
|
|
19
20
|
const tabFocusStyles = mode => ({
|
|
20
21
|
boxShadow: `0 0 0 2px ${getTabPanelFocusColor(mode)} inset`,
|
|
21
|
-
borderRadius: "var(--ds-radius
|
|
22
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
22
23
|
outline: 'none'
|
|
23
24
|
});
|
|
24
25
|
const getTabPanelStyles = mode => ({
|
|
@@ -49,7 +50,7 @@ css({
|
|
|
49
50
|
});
|
|
50
51
|
const tabLineStyles = {
|
|
51
52
|
content: '""',
|
|
52
|
-
borderRadius:
|
|
53
|
+
borderRadius: "var(--ds-border-radius-050, 2px)",
|
|
53
54
|
bottom: 0,
|
|
54
55
|
margin: 0,
|
|
55
56
|
position: 'absolute',
|
|
@@ -73,7 +74,7 @@ const tabPanelFocusStyles = mode => {
|
|
|
73
74
|
const colors = getTabColors(mode);
|
|
74
75
|
return {
|
|
75
76
|
boxShadow: `0 0 0 2px ${colors.focusBorderColor} inset`,
|
|
76
|
-
borderRadius: "var(--ds-radius
|
|
77
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
77
78
|
outline: 'none',
|
|
78
79
|
// Hide TabLine on focus
|
|
79
80
|
'&::after': {
|
package/dist/es2019/version.json
CHANGED
|
@@ -102,7 +102,7 @@ var TabList = function TabList(props) {
|
|
|
102
102
|
position: "relative",
|
|
103
103
|
padding: "space.0",
|
|
104
104
|
ref: ref
|
|
105
|
-
// eslint-disable-next-line @
|
|
105
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
106
106
|
,
|
|
107
107
|
css: tabListStyles
|
|
108
108
|
}, childrenArray.map(function (child, index) {
|
|
@@ -15,7 +15,7 @@ import { onMouseDownBlur } from '../internal/utils';
|
|
|
15
15
|
var analyticsAttributes = {
|
|
16
16
|
componentName: 'tabs',
|
|
17
17
|
packageName: "@atlaskit/tabs",
|
|
18
|
-
packageVersion: "13.4.
|
|
18
|
+
packageVersion: "13.4.3"
|
|
19
19
|
};
|
|
20
20
|
var getTabPanelWithContext = function getTabPanelWithContext(_ref) {
|
|
21
21
|
var tabPanel = _ref.tabPanel,
|
|
@@ -124,7 +124,7 @@ var Tabs = function Tabs(props) {
|
|
|
124
124
|
flexBasis: '100%',
|
|
125
125
|
flexGrow: 1
|
|
126
126
|
}
|
|
127
|
-
// eslint-disable-next-line @
|
|
127
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
128
128
|
,
|
|
129
129
|
css: tabsStyles
|
|
130
130
|
}, jsx(TabListContext.Provider, {
|
|
@@ -5,9 +5,10 @@ import { css } from '@emotion/react';
|
|
|
5
5
|
import { getTabColors, getTabLineColor, getTabPanelFocusColor } from './colors';
|
|
6
6
|
var tabLeftRightPadding = "var(--ds-space-100, 8px)";
|
|
7
7
|
var tabTopBottomPadding = "var(--ds-space-050, 4px)";
|
|
8
|
-
|
|
8
|
+
// TODO this should probably be `border.width.indicator`
|
|
9
|
+
var underlineHeight = "var(--ds-border-width-outline, 2px)";
|
|
9
10
|
var highContrastFocusStyles = {
|
|
10
|
-
outline:
|
|
11
|
+
outline: "var(--ds-border-width, 1px)".concat(" solid")
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
// Required so the focus ring is visible in high contrast mode
|
|
@@ -22,7 +23,7 @@ var highContrastFocusRing = {
|
|
|
22
23
|
var tabFocusStyles = function tabFocusStyles(mode) {
|
|
23
24
|
return {
|
|
24
25
|
boxShadow: "0 0 0 2px ".concat(getTabPanelFocusColor(mode), " inset"),
|
|
25
|
-
borderRadius: "var(--ds-radius
|
|
26
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
26
27
|
outline: 'none'
|
|
27
28
|
};
|
|
28
29
|
};
|
|
@@ -58,7 +59,7 @@ export var getTabsStyles = function getTabsStyles(mode) {
|
|
|
58
59
|
};
|
|
59
60
|
var tabLineStyles = {
|
|
60
61
|
content: '""',
|
|
61
|
-
borderRadius:
|
|
62
|
+
borderRadius: "var(--ds-border-radius-050, 2px)",
|
|
62
63
|
bottom: 0,
|
|
63
64
|
margin: 0,
|
|
64
65
|
position: 'absolute',
|
|
@@ -84,7 +85,7 @@ var tabPanelFocusStyles = function tabPanelFocusStyles(mode) {
|
|
|
84
85
|
var colors = getTabColors(mode);
|
|
85
86
|
return {
|
|
86
87
|
boxShadow: "0 0 0 2px ".concat(colors.focusBorderColor, " inset"),
|
|
87
|
-
borderRadius: "var(--ds-radius
|
|
88
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
88
89
|
outline: 'none',
|
|
89
90
|
// Hide TabLine on focus
|
|
90
91
|
'&::after': {
|
package/dist/esm/version.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import { TabListProps } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* __TabList__
|
|
5
|
+
*
|
|
6
|
+
* A TabList groups `Tab` components together.
|
|
7
|
+
*
|
|
8
|
+
* - [Examples](https://atlassian.design/components/tabs/examples)
|
|
9
|
+
* - [Code](https://atlassian.design/components/tabs/code)
|
|
10
|
+
* - [Usage](https://atlassian.design/components/tabs/usage)
|
|
11
|
+
*/
|
|
12
|
+
declare const TabList: (props: TabListProps) => jsx.JSX.Element;
|
|
13
|
+
export default TabList;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
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
|
+
*/
|
|
12
|
+
declare const TabPanel: ({ children, testId }: TabPanelProps) => jsx.JSX.Element;
|
|
13
|
+
export default TabPanel;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import { TabProps } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* __Tab__
|
|
6
|
+
*
|
|
7
|
+
* Tab represents an indivudal Tab displayed in a TabList.
|
|
8
|
+
*
|
|
9
|
+
* - [Examples](https://atlassian.design/components/tabs/examples)
|
|
10
|
+
* - [Code](https://atlassian.design/components/tabs/code)
|
|
11
|
+
* - [Usage](https://atlassian.design/components/tabs/usage)
|
|
12
|
+
*/
|
|
13
|
+
export default function Tab({ children, testId }: TabProps): jsx.JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import { TabsProps } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* __Tabs__
|
|
5
|
+
*
|
|
6
|
+
* Tabs acts as a container for all Tab components.
|
|
7
|
+
*
|
|
8
|
+
* - [Examples](https://atlassian.design/components/tabs/examples)
|
|
9
|
+
* - [Code](https://atlassian.design/components/tabs/code)
|
|
10
|
+
* - [Usage](https://atlassian.design/components/tabs/usage)
|
|
11
|
+
*/
|
|
12
|
+
declare const Tabs: (props: TabsProps) => jsx.JSX.Element;
|
|
13
|
+
export default Tabs;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default } from './components/tabs';
|
|
2
|
+
export { default as TabPanel } from './components/tab-panel';
|
|
3
|
+
export { default as Tab } from './components/tab';
|
|
4
|
+
export { default as TabList } from './components/tab-list';
|
|
5
|
+
export type { TabProps, TabPanelProps, TabsProps, TabListProps, TabAttributesType, TabListAttributesType, TabPanelAttributesType, TabData, } from './types';
|
|
6
|
+
export { useTab, useTabPanel } from './hooks';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ThemeModes } from '@atlaskit/theme/types';
|
|
2
|
+
export type TabColors = {
|
|
3
|
+
labelColor: string;
|
|
4
|
+
activeLabelColor: string;
|
|
5
|
+
hoverLabelColor: string;
|
|
6
|
+
selectedColor: string;
|
|
7
|
+
focusBorderColor: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const getTabColors: (mode: ThemeModes) => TabColors;
|
|
10
|
+
export type TabLineColors = {
|
|
11
|
+
lineColor: string;
|
|
12
|
+
hoveredColor: string;
|
|
13
|
+
activeColor: string;
|
|
14
|
+
selectedColor: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const getTabLineColor: (mode: ThemeModes) => TabLineColors;
|
|
17
|
+
export declare const getTabPanelFocusColor: (mode: ThemeModes) => string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TabAttributesType, TabListAttributesType, TabPanelAttributesType } from '../types';
|
|
3
|
+
export declare const TabContext: import("react").Context<TabAttributesType | null>;
|
|
4
|
+
export declare const TabListContext: import("react").Context<TabListAttributesType | null>;
|
|
5
|
+
export declare const TabPanelContext: import("react").Context<TabPanelAttributesType | null>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CSSObject, SerializedStyles } from '@emotion/react';
|
|
2
|
+
import { ThemeModes } from '@atlaskit/theme/types';
|
|
3
|
+
export declare const getTabsStyles: (mode: ThemeModes) => SerializedStyles;
|
|
4
|
+
export declare const getTabListStyles: (mode: ThemeModes) => SerializedStyles;
|
|
5
|
+
export declare const getTabStyles: (mode: ThemeModes) => CSSObject;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { PublicInteractionTask } from 'storybook-addon-performance';
|
|
3
|
+
export declare const performance: {
|
|
4
|
+
(): JSX.Element;
|
|
5
|
+
story: {
|
|
6
|
+
name: string;
|
|
7
|
+
parameters: {
|
|
8
|
+
performance: {
|
|
9
|
+
interactions: PublicInteractionTask[];
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const heavyPerformance: {
|
|
15
|
+
(): JSX.Element;
|
|
16
|
+
story: {
|
|
17
|
+
name: string;
|
|
18
|
+
parameters: {
|
|
19
|
+
performance: {
|
|
20
|
+
interactions: PublicInteractionTask[];
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { KeyboardEvent, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
|
|
3
|
+
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
4
|
+
export interface TabProps {
|
|
5
|
+
/**
|
|
6
|
+
* The children to be rendered within a `Tab`.
|
|
7
|
+
*/
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* A `testId` prop is is a unique string that appears as a data attribute `data-testid`
|
|
11
|
+
* on the `Tab` element, serving as a hook for automated tests.
|
|
12
|
+
*/
|
|
13
|
+
testId?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface TabPanelProps {
|
|
16
|
+
/**
|
|
17
|
+
* The children to be rendered within a `TabPanel`.
|
|
18
|
+
*/
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* A `testId` prop is is a unique string that appears as a data attribute `data-testid`
|
|
22
|
+
* on the `TabPanel` element, serving as a hook for automated tests.
|
|
23
|
+
*/
|
|
24
|
+
testId?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated
|
|
28
|
+
* Previously this was the type for the tabs prop that was used like
|
|
29
|
+
* <Tabs tabs={tabs} />
|
|
30
|
+
* The codemod changes this to be
|
|
31
|
+
* <Tabs>
|
|
32
|
+
* <TabList>
|
|
33
|
+
* {tabs.map(tab => <Tab testId={tab.testId}>{tab.label}</Tab>)}
|
|
34
|
+
* </TabList>
|
|
35
|
+
* {tabs.map(tab => <TabPanel>{tab.content}</TabPanel>)}
|
|
36
|
+
* </Tabs>
|
|
37
|
+
* The TabData type remains so the variable used in tabs can have a type.
|
|
38
|
+
*/
|
|
39
|
+
export interface TabData {
|
|
40
|
+
/**
|
|
41
|
+
* String to be put inside a tab
|
|
42
|
+
*/
|
|
43
|
+
label?: string;
|
|
44
|
+
/**
|
|
45
|
+
* String to be put inside a tab panel
|
|
46
|
+
*/
|
|
47
|
+
content?: ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* A `testId` prop is provided for specified elements, which is a unique
|
|
50
|
+
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
51
|
+
* serving as a hook for automated tests. This `testId` is put on the tab.
|
|
52
|
+
*/
|
|
53
|
+
testId?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Used by consumers to convey extra information about the tab.
|
|
56
|
+
*/
|
|
57
|
+
[key: string]: any;
|
|
58
|
+
}
|
|
59
|
+
export type SelectedType = number;
|
|
60
|
+
export type OnChangeCallback = (index: SelectedType, analyticsEvent: UIAnalyticsEvent) => void;
|
|
61
|
+
export interface TabsProps extends WithAnalyticsEventsProps {
|
|
62
|
+
/**
|
|
63
|
+
* The index of the tab that will be selected by default when the component mounts.
|
|
64
|
+
* If not set the first tab will be displayed by default.
|
|
65
|
+
*/
|
|
66
|
+
defaultSelected?: SelectedType;
|
|
67
|
+
/**
|
|
68
|
+
* A callback function which will be fired when a changed. It will be passed
|
|
69
|
+
* the index of the selected tab and a `UIAnalyticsEvent`.
|
|
70
|
+
*/
|
|
71
|
+
onChange?: OnChangeCallback;
|
|
72
|
+
/**
|
|
73
|
+
* The selected tab's index. If this prop is set the component behaves as a
|
|
74
|
+
* controlled component. It will be up to you to listen to `onChange`.
|
|
75
|
+
*/
|
|
76
|
+
selected?: SelectedType;
|
|
77
|
+
/**
|
|
78
|
+
* Tabs by default leaves `TabPanel`'s mounted on the page after they have been selected.
|
|
79
|
+
* If you would like to unmount a `TabPanel` when it is not selected, set this prop to
|
|
80
|
+
* be true.
|
|
81
|
+
*/
|
|
82
|
+
shouldUnmountTabPanelOnChange?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Additional information to be included in the `context` of analytics events that come from `Tabs`.
|
|
85
|
+
*/
|
|
86
|
+
analyticsContext?: Record<string, any>;
|
|
87
|
+
/**
|
|
88
|
+
* A `testId` prop is a unique string that appears as a data attribute `data-testid`
|
|
89
|
+
* on the `Tabs` element, serving as a hook for automated tests.
|
|
90
|
+
*/
|
|
91
|
+
testId?: string;
|
|
92
|
+
/**
|
|
93
|
+
* The children of Tabs. The first child should be a `TabList` filled with `Tab`'s.
|
|
94
|
+
* Subsequent children should be `TabPanel`'s. There should be a `Tab` for each `TabPanel`.
|
|
95
|
+
* If you want to customize `Tab` or `TabPanel`, refer to the examples in the documentation.
|
|
96
|
+
*/
|
|
97
|
+
children: ReactNode;
|
|
98
|
+
/**
|
|
99
|
+
* A unique ID that will be used to generate IDs for tabs and tab panels.
|
|
100
|
+
* This is required for accessibility purposes.
|
|
101
|
+
*/
|
|
102
|
+
id: string;
|
|
103
|
+
}
|
|
104
|
+
export interface TabListProps {
|
|
105
|
+
/**
|
|
106
|
+
* A collection of `Tab`'s. There should be a `Tab` for each `TabPanel`.
|
|
107
|
+
* If you want to customize `Tab` there is documentation in the tab section.
|
|
108
|
+
*/
|
|
109
|
+
children: ReactNode;
|
|
110
|
+
}
|
|
111
|
+
export type TabAttributesType = {
|
|
112
|
+
/**
|
|
113
|
+
* Changes the selected tab.
|
|
114
|
+
*/
|
|
115
|
+
onClick: () => void;
|
|
116
|
+
/**
|
|
117
|
+
* ID of the tab.
|
|
118
|
+
*/
|
|
119
|
+
id: string;
|
|
120
|
+
/**
|
|
121
|
+
* The id of the tab panel that this tab links.
|
|
122
|
+
*/
|
|
123
|
+
'aria-controls': string;
|
|
124
|
+
/**
|
|
125
|
+
* The position of this tab within the tab list.
|
|
126
|
+
*/
|
|
127
|
+
'aria-posinset': number;
|
|
128
|
+
/**
|
|
129
|
+
* Whether this tab is selected.
|
|
130
|
+
*/
|
|
131
|
+
'aria-selected': boolean;
|
|
132
|
+
/**
|
|
133
|
+
* The number of tabs in this tab list.
|
|
134
|
+
*/
|
|
135
|
+
'aria-setsize': number;
|
|
136
|
+
/**
|
|
137
|
+
* Prevents a focus ring being shown when clicked.
|
|
138
|
+
*/
|
|
139
|
+
onMouseDown: (e: MouseEvent<HTMLElement>) => void;
|
|
140
|
+
/**
|
|
141
|
+
* Allows navigation of tabs with automatic activation.
|
|
142
|
+
* Read here for more details: https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html
|
|
143
|
+
*/
|
|
144
|
+
onKeyDown: (e: KeyboardEvent<HTMLElement>) => void;
|
|
145
|
+
/**
|
|
146
|
+
* Role is "tab".
|
|
147
|
+
*/
|
|
148
|
+
role: 'tab';
|
|
149
|
+
/**
|
|
150
|
+
* If the tab is selected the tab index is 0 and is focusable.
|
|
151
|
+
* Otherwise it is -1 and is not focusable.
|
|
152
|
+
*/
|
|
153
|
+
tabIndex: number;
|
|
154
|
+
};
|
|
155
|
+
export type TabListAttributesType = {
|
|
156
|
+
/**
|
|
157
|
+
* The index of the selected tab.
|
|
158
|
+
*/
|
|
159
|
+
selected: SelectedType;
|
|
160
|
+
/**
|
|
161
|
+
* A unique ID that will be used to generate IDs for tabs and tab panels.
|
|
162
|
+
* This is required for accessibility reasons.
|
|
163
|
+
*/
|
|
164
|
+
tabsId: string;
|
|
165
|
+
/**
|
|
166
|
+
* A callback function which will be fired when a tab is changed.
|
|
167
|
+
*/
|
|
168
|
+
onChange: (index: SelectedType) => void;
|
|
169
|
+
};
|
|
170
|
+
export type TabPanelAttributesType = {
|
|
171
|
+
/**
|
|
172
|
+
* Role is "tabpanel".
|
|
173
|
+
*/
|
|
174
|
+
role: 'tabpanel';
|
|
175
|
+
/**
|
|
176
|
+
* ID of the the tab panel.
|
|
177
|
+
*/
|
|
178
|
+
id: string;
|
|
179
|
+
/**
|
|
180
|
+
* Hidden is true if it is not the selected tab.
|
|
181
|
+
*/
|
|
182
|
+
hidden?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* The id of the tab that links to this tab panel.
|
|
185
|
+
*/
|
|
186
|
+
'aria-labelledby': string;
|
|
187
|
+
/**
|
|
188
|
+
* Prevents a focus ring being shown when clicked.
|
|
189
|
+
*/
|
|
190
|
+
onMouseDown: (e: MouseEvent<HTMLElement>) => void;
|
|
191
|
+
/**
|
|
192
|
+
* If the tab panel is selected the tab index is 0 and is focusable.
|
|
193
|
+
* Otherwise it is -1 and is not focusable.
|
|
194
|
+
*/
|
|
195
|
+
tabIndex: number;
|
|
196
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/tabs",
|
|
3
|
-
"version": "13.4.
|
|
3
|
+
"version": "13.4.3",
|
|
4
4
|
"description": "Tabs are used to organize content by grouping similar information on the same page.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"atlaskit:src": "src/index.tsx",
|
|
25
25
|
"atlassian": {
|
|
26
26
|
"team": "Design System Team",
|
|
27
|
-
"releaseModel": "
|
|
27
|
+
"releaseModel": "continuous",
|
|
28
28
|
"website": {
|
|
29
29
|
"name": "Tabs",
|
|
30
30
|
"category": "Components"
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
35
35
|
"@atlaskit/codemod-utils": "^4.2.0",
|
|
36
|
-
"@atlaskit/ds-explorations": "^2.
|
|
36
|
+
"@atlaskit/ds-explorations": "^2.2.0",
|
|
37
37
|
"@atlaskit/theme": "^12.5.0",
|
|
38
|
-
"@atlaskit/tokens": "^1.
|
|
38
|
+
"@atlaskit/tokens": "^1.11.0",
|
|
39
39
|
"@babel/runtime": "^7.0.0",
|
|
40
40
|
"@emotion/react": "^11.7.1"
|
|
41
41
|
},
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"react": "^16.8.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@atlaskit/button": "^16.
|
|
46
|
+
"@atlaskit/button": "^16.8.0",
|
|
47
47
|
"@atlaskit/docs": "*",
|
|
48
48
|
"@atlaskit/ds-lib": "^2.2.0",
|
|
49
49
|
"@atlaskit/section-message": "^6.4.0",
|
|
@@ -0,0 +1,109 @@
|
|
|
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
|
+
|
|
7
|
+
import { jsx } from '@emotion/react';
|
|
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
|
+
// @public (undocumented)
|
|
15
|
+
type OnChangeCallback = (index: SelectedType, analyticsEvent: UIAnalyticsEvent) => void;
|
|
16
|
+
|
|
17
|
+
// @public (undocumented)
|
|
18
|
+
type SelectedType = number;
|
|
19
|
+
|
|
20
|
+
// @public
|
|
21
|
+
export function Tab({ children, testId }: TabProps): jsx.JSX.Element;
|
|
22
|
+
|
|
23
|
+
// @public (undocumented)
|
|
24
|
+
export type TabAttributesType = {
|
|
25
|
+
onClick: () => void;
|
|
26
|
+
id: string;
|
|
27
|
+
'aria-controls': string;
|
|
28
|
+
'aria-posinset': number;
|
|
29
|
+
'aria-selected': boolean;
|
|
30
|
+
'aria-setsize': number;
|
|
31
|
+
onMouseDown: (e: MouseEvent_2<HTMLElement>) => void;
|
|
32
|
+
onKeyDown: (e: KeyboardEvent_2<HTMLElement>) => void;
|
|
33
|
+
role: 'tab';
|
|
34
|
+
tabIndex: number;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// @public @deprecated (undocumented)
|
|
38
|
+
export interface TabData {
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
content?: ReactNode;
|
|
41
|
+
label?: string;
|
|
42
|
+
testId?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// @public
|
|
46
|
+
export const TabList: (props: TabListProps) => jsx.JSX.Element;
|
|
47
|
+
|
|
48
|
+
// @public (undocumented)
|
|
49
|
+
export type TabListAttributesType = {
|
|
50
|
+
selected: SelectedType;
|
|
51
|
+
tabsId: string;
|
|
52
|
+
onChange: (index: SelectedType) => void;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// @public (undocumented)
|
|
56
|
+
export interface TabListProps {
|
|
57
|
+
children: ReactNode;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// @public
|
|
61
|
+
export const TabPanel: ({ children, testId }: TabPanelProps) => jsx.JSX.Element;
|
|
62
|
+
|
|
63
|
+
// @public (undocumented)
|
|
64
|
+
export type TabPanelAttributesType = {
|
|
65
|
+
role: 'tabpanel';
|
|
66
|
+
id: string;
|
|
67
|
+
hidden?: boolean;
|
|
68
|
+
'aria-labelledby': string;
|
|
69
|
+
onMouseDown: (e: MouseEvent_2<HTMLElement>) => void;
|
|
70
|
+
tabIndex: number;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// @public (undocumented)
|
|
74
|
+
export interface TabPanelProps {
|
|
75
|
+
children: ReactNode;
|
|
76
|
+
testId?: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// @public (undocumented)
|
|
80
|
+
export interface TabProps {
|
|
81
|
+
children: ReactNode;
|
|
82
|
+
testId?: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// @public
|
|
86
|
+
const Tabs: (props: TabsProps) => jsx.JSX.Element;
|
|
87
|
+
export default Tabs;
|
|
88
|
+
|
|
89
|
+
// @public (undocumented)
|
|
90
|
+
export interface TabsProps extends WithAnalyticsEventsProps {
|
|
91
|
+
analyticsContext?: Record<string, any>;
|
|
92
|
+
children: ReactNode;
|
|
93
|
+
defaultSelected?: SelectedType;
|
|
94
|
+
id: string;
|
|
95
|
+
onChange?: OnChangeCallback;
|
|
96
|
+
selected?: SelectedType;
|
|
97
|
+
shouldUnmountTabPanelOnChange?: boolean;
|
|
98
|
+
testId?: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// @public (undocumented)
|
|
102
|
+
export const useTab: () => TabAttributesType;
|
|
103
|
+
|
|
104
|
+
// @public (undocumented)
|
|
105
|
+
export const useTabPanel: () => TabPanelAttributesType;
|
|
106
|
+
|
|
107
|
+
// (No @packageDocumentation comment for this package)
|
|
108
|
+
|
|
109
|
+
```
|