@atlaskit/tabs 13.4.8 → 14.0.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.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/components/tab-list.js +3 -6
- package/dist/cjs/components/tabs.js +4 -7
- package/dist/cjs/internal/colors.js +13 -42
- package/dist/cjs/internal/styles.js +20 -26
- package/dist/es2019/components/tab-list.js +4 -6
- package/dist/es2019/components/tabs.js +5 -7
- package/dist/es2019/internal/colors.js +15 -40
- package/dist/es2019/internal/styles.js +21 -27
- package/dist/esm/components/tab-list.js +4 -7
- package/dist/esm/components/tabs.js +5 -8
- package/dist/esm/internal/colors.js +15 -44
- package/dist/esm/internal/styles.js +21 -27
- package/dist/types/internal/colors.d.ts +12 -15
- package/dist/types/internal/styles.d.ts +3 -4
- package/dist/types-ts4.5/internal/colors.d.ts +12 -15
- package/dist/types-ts4.5/internal/styles.d.ts +3 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/tabs
|
|
2
2
|
|
|
3
|
+
## 14.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#41866](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41866) [`ed8b6957789`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ed8b6957789) - Removes any usage of deprecated legacy theming APIs. These have been superseeded by design tokens.
|
|
8
|
+
|
|
9
|
+
## 13.4.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#40650](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40650) [`07aa588c8a4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/07aa588c8a4) - Reverts the fix to text descender cut-off, due to incompatibilities with Firefox and Safari.
|
|
14
|
+
|
|
3
15
|
## 13.4.8
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _react2 = require("@emotion/react");
|
|
9
|
-
var _components = require("@atlaskit/theme/components");
|
|
10
9
|
var _hooks = require("../hooks");
|
|
11
10
|
var _context = require("../internal/context");
|
|
12
11
|
var _styles = require("../internal/styles");
|
|
@@ -19,6 +18,9 @@ var baseStyles = (0, _react2.css)({
|
|
|
19
18
|
position: 'relative'
|
|
20
19
|
});
|
|
21
20
|
|
|
21
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
22
|
+
var tabListStyles = (0, _styles.getTabListStyles)();
|
|
23
|
+
|
|
22
24
|
/**
|
|
23
25
|
* __TabList__
|
|
24
26
|
*
|
|
@@ -30,8 +32,6 @@ var baseStyles = (0, _react2.css)({
|
|
|
30
32
|
*/
|
|
31
33
|
var TabList = function TabList(_ref) {
|
|
32
34
|
var children = _ref.children;
|
|
33
|
-
var _useGlobalTheme = (0, _components.useGlobalTheme)(),
|
|
34
|
-
mode = _useGlobalTheme.mode;
|
|
35
35
|
var _useTabList = (0, _hooks.useTabList)(),
|
|
36
36
|
tabsId = _useTabList.tabsId,
|
|
37
37
|
selected = _useTabList.selected,
|
|
@@ -41,9 +41,6 @@ var TabList = function TabList(_ref) {
|
|
|
41
41
|
// Don't include any conditional children
|
|
42
42
|
var childrenArray = _react.Children.toArray(children).filter(Boolean);
|
|
43
43
|
var length = childrenArray.length;
|
|
44
|
-
var tabListStyles = (0, _react.useMemo)(function () {
|
|
45
|
-
return (0, _styles.getTabListStyles)(mode);
|
|
46
|
-
}, [mode]);
|
|
47
44
|
var selectTabByIndex = (0, _react.useCallback)(function (index) {
|
|
48
45
|
var _ref$current;
|
|
49
46
|
var newSelectedNode = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector("[id='".concat(tabsId, "-").concat(index, "']"));
|
|
@@ -11,7 +11,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
11
11
|
var _react = require("react");
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
13
|
var _usePlatformLeafEventHandler = require("@atlaskit/analytics-next/usePlatformLeafEventHandler");
|
|
14
|
-
var _components = require("@atlaskit/theme/components");
|
|
15
14
|
var _context = require("../internal/context");
|
|
16
15
|
var _styles = require("../internal/styles");
|
|
17
16
|
var _utils = require("../internal/utils");
|
|
@@ -25,10 +24,13 @@ var baseStyles = (0, _react2.css)({
|
|
|
25
24
|
flexDirection: 'column',
|
|
26
25
|
flexGrow: 1
|
|
27
26
|
});
|
|
27
|
+
|
|
28
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
29
|
+
var tabsStyles = (0, _styles.getTabsStyles)();
|
|
28
30
|
var analyticsAttributes = {
|
|
29
31
|
componentName: 'tabs',
|
|
30
32
|
packageName: "@atlaskit/tabs",
|
|
31
|
-
packageVersion: "
|
|
33
|
+
packageVersion: "14.0.0"
|
|
32
34
|
};
|
|
33
35
|
var getTabPanelWithContext = function getTabPanelWithContext(_ref) {
|
|
34
36
|
var tabPanel = _ref.tabPanel,
|
|
@@ -70,8 +72,6 @@ var Tabs = function Tabs(props) {
|
|
|
70
72
|
analyticsContext = props.analyticsContext,
|
|
71
73
|
children = props.children,
|
|
72
74
|
testId = props.testId;
|
|
73
|
-
var _useGlobalTheme = (0, _components.useGlobalTheme)(),
|
|
74
|
-
mode = _useGlobalTheme.mode;
|
|
75
75
|
var _useState = (0, _react.useState)(SelectedType || defaultSelected || 0),
|
|
76
76
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
77
77
|
selectedState = _useState2[0],
|
|
@@ -118,9 +118,6 @@ var Tabs = function Tabs(props) {
|
|
|
118
118
|
tabsId: id
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
|
-
var tabsStyles = (0, _react.useMemo)(function () {
|
|
122
|
-
return (0, _styles.getTabsStyles)(mode);
|
|
123
|
-
}, [mode]);
|
|
124
121
|
return (
|
|
125
122
|
// Only styles that affect the Tabs container itself have been applied via primitives.
|
|
126
123
|
// The other styles applied through the CSS prop are there for styling children
|
|
@@ -3,48 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.tabPanelFocusColor = exports.tabLineColors = exports.tabColors = void 0;
|
|
7
7
|
var _colors = require("@atlaskit/theme/colors");
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
focusBorderColor: "var(--ds-border-focused, ".concat(_colors.B100, ")")
|
|
15
|
-
},
|
|
16
|
-
dark: {
|
|
17
|
-
labelColor: "var(--ds-text-subtle, ".concat(_colors.DN400, ")"),
|
|
18
|
-
activeLabelColor: "var(--ds-text, ".concat(_colors.B200, ")"),
|
|
19
|
-
hoverLabelColor: "var(--ds-text-subtle, ".concat(_colors.B75, ")"),
|
|
20
|
-
selectedColor: "var(--ds-text-selected, ".concat(_colors.B75, ")"),
|
|
21
|
-
focusBorderColor: "var(--ds-border-focused, ".concat(_colors.B75, ")")
|
|
22
|
-
}
|
|
8
|
+
var tabColors = exports.tabColors = {
|
|
9
|
+
labelColor: "var(--ds-text-subtle, ".concat(_colors.N500, ")"),
|
|
10
|
+
activeLabelColor: "var(--ds-text, ".concat(_colors.B500, ")"),
|
|
11
|
+
hoverLabelColor: "var(--ds-text-subtle, ".concat(_colors.B400, ")"),
|
|
12
|
+
selectedColor: "var(--ds-text-selected, ".concat(_colors.B400, ")"),
|
|
13
|
+
focusBorderColor: "var(--ds-border-focused, ".concat(_colors.B100, ")")
|
|
23
14
|
};
|
|
24
|
-
var
|
|
25
|
-
|
|
15
|
+
var tabLineColors = exports.tabLineColors = {
|
|
16
|
+
lineColor: "var(--ds-border, ".concat(_colors.N30, ")"),
|
|
17
|
+
hoveredColor: "var(--ds-border, transparent)",
|
|
18
|
+
activeColor: "var(--ds-border, transparent)",
|
|
19
|
+
selectedColor: "var(--ds-border-selected, ".concat(_colors.B400, ")")
|
|
26
20
|
};
|
|
27
|
-
var
|
|
28
|
-
light: {
|
|
29
|
-
lineColor: "var(--ds-border, ".concat(_colors.N30, ")"),
|
|
30
|
-
hoveredColor: "var(--ds-border, transparent)",
|
|
31
|
-
activeColor: "var(--ds-border, transparent)",
|
|
32
|
-
selectedColor: "var(--ds-border-selected, ".concat(_colors.B400, ")")
|
|
33
|
-
},
|
|
34
|
-
dark: {
|
|
35
|
-
lineColor: "var(--ds-border, ".concat(_colors.DN0, ")"),
|
|
36
|
-
hoveredColor: "var(--ds-border, transparent)",
|
|
37
|
-
activeColor: "var(--ds-border, transparent)",
|
|
38
|
-
selectedColor: "var(--ds-border-selected, ".concat(_colors.B75, ")")
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
var getTabLineColor = exports.getTabLineColor = function getTabLineColor(mode) {
|
|
42
|
-
return tabLineColorMap[mode];
|
|
43
|
-
};
|
|
44
|
-
var tabPanelFocusColorMap = {
|
|
45
|
-
light: "var(--ds-border-focused, ".concat(_colors.B100, ")"),
|
|
46
|
-
dark: "var(--ds-border-focused, ".concat(_colors.B75, ")")
|
|
47
|
-
};
|
|
48
|
-
var getTabPanelFocusColor = exports.getTabPanelFocusColor = function getTabPanelFocusColor(mode) {
|
|
49
|
-
return tabPanelFocusColorMap[mode];
|
|
50
|
-
};
|
|
21
|
+
var tabPanelFocusColor = exports.tabPanelFocusColor = "var(--ds-border-focused, ".concat(_colors.B100, ")");
|
|
@@ -27,14 +27,14 @@ var highContrastFocusRing = {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
var tabFocusStyles = function tabFocusStyles(
|
|
30
|
+
var tabFocusStyles = function tabFocusStyles() {
|
|
31
31
|
return {
|
|
32
|
-
boxShadow: "0 0 0 2px ".concat(
|
|
32
|
+
boxShadow: "0 0 0 2px ".concat(_colors.tabPanelFocusColor, " inset"),
|
|
33
33
|
borderRadius: "var(--ds-border-radius, 3px)",
|
|
34
34
|
outline: 'none'
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
-
var getTabPanelStyles = function getTabPanelStyles(
|
|
37
|
+
var getTabPanelStyles = function getTabPanelStyles() {
|
|
38
38
|
return _objectSpread({
|
|
39
39
|
flexGrow: 1,
|
|
40
40
|
/*
|
|
@@ -44,17 +44,17 @@ var getTabPanelStyles = function getTabPanelStyles(mode) {
|
|
|
44
44
|
minHeight: '0%',
|
|
45
45
|
display: 'flex',
|
|
46
46
|
padding: "0 ".concat(tabLeftRightPadding),
|
|
47
|
-
'&:focus-visible': tabFocusStyles(
|
|
47
|
+
'&:focus-visible': tabFocusStyles(),
|
|
48
48
|
'@supports not selector(*:focus-visible)': {
|
|
49
|
-
'&:focus': tabFocusStyles(
|
|
49
|
+
'&:focus': tabFocusStyles()
|
|
50
50
|
}
|
|
51
51
|
}, highContrastFocusRing);
|
|
52
52
|
};
|
|
53
|
-
var getTabsStyles = exports.getTabsStyles = function getTabsStyles(
|
|
53
|
+
var getTabsStyles = exports.getTabsStyles = function getTabsStyles() {
|
|
54
54
|
return (
|
|
55
55
|
// eslint-disable-next-line @repo/internal/styles/no-exported-styles
|
|
56
56
|
(0, _react.css)({
|
|
57
|
-
'& [role="tabpanel"]': getTabPanelStyles(
|
|
57
|
+
'& [role="tabpanel"]': getTabPanelStyles(),
|
|
58
58
|
// The hidden attribute doesn't work on flex elements
|
|
59
59
|
// Change display to be none
|
|
60
60
|
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
@@ -74,22 +74,22 @@ var tabLineStyles = {
|
|
|
74
74
|
left: tabLeftRightPadding,
|
|
75
75
|
right: tabLeftRightPadding
|
|
76
76
|
};
|
|
77
|
-
var getTabListStyles = exports.getTabListStyles = function getTabListStyles(
|
|
77
|
+
var getTabListStyles = exports.getTabListStyles = function getTabListStyles() {
|
|
78
78
|
return (
|
|
79
79
|
// eslint-disable-next-line @repo/internal/styles/no-exported-styles
|
|
80
80
|
(0, _react.css)({
|
|
81
|
-
'& [role="tab"]': getTabStyles(
|
|
81
|
+
'& [role="tab"]': getTabStyles(),
|
|
82
82
|
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
83
83
|
'&::before': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
|
|
84
84
|
height: underlineHeight,
|
|
85
85
|
// This line is not a border so the selected line is visible in high contrast mode
|
|
86
|
-
backgroundColor:
|
|
86
|
+
backgroundColor: _colors.tabLineColors.lineColor
|
|
87
87
|
})
|
|
88
88
|
})
|
|
89
89
|
);
|
|
90
90
|
};
|
|
91
|
-
var tabPanelFocusStyles = function tabPanelFocusStyles(
|
|
92
|
-
var colors =
|
|
91
|
+
var tabPanelFocusStyles = function tabPanelFocusStyles() {
|
|
92
|
+
var colors = _colors.tabColors;
|
|
93
93
|
return {
|
|
94
94
|
boxShadow: "0 0 0 2px ".concat(colors.focusBorderColor, " inset"),
|
|
95
95
|
borderRadius: "var(--ds-border-radius, 3px)",
|
|
@@ -100,8 +100,8 @@ var tabPanelFocusStyles = function tabPanelFocusStyles(mode) {
|
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
102
|
};
|
|
103
|
-
var getTabStyles = exports.getTabStyles = function getTabStyles(
|
|
104
|
-
var colors =
|
|
103
|
+
var getTabStyles = exports.getTabStyles = function getTabStyles() {
|
|
104
|
+
var colors = _colors.tabColors;
|
|
105
105
|
return _objectSpread(_objectSpread({
|
|
106
106
|
color: colors.labelColor,
|
|
107
107
|
cursor: 'pointer',
|
|
@@ -110,19 +110,13 @@ var getTabStyles = exports.getTabStyles = function getTabStyles(mode) {
|
|
|
110
110
|
padding: "".concat(tabTopBottomPadding, " ").concat(tabLeftRightPadding),
|
|
111
111
|
position: 'relative',
|
|
112
112
|
whiteSpace: 'nowrap',
|
|
113
|
+
overflow: 'hidden',
|
|
113
114
|
textOverflow: 'ellipsis',
|
|
114
|
-
// Use "clip" overflow to allow ellipses on x-axis without clipping descenders
|
|
115
|
-
'@supports not (overflow-x: clip)': {
|
|
116
|
-
overflow: 'hidden'
|
|
117
|
-
},
|
|
118
|
-
'@supports (overflow-x: clip)': {
|
|
119
|
-
overflowX: 'clip'
|
|
120
|
-
},
|
|
121
115
|
'&:hover': {
|
|
122
116
|
// TODO: interaction states will be reviewed in DSP-1438
|
|
123
117
|
color: colors.hoverLabelColor,
|
|
124
118
|
'&::after': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
|
|
125
|
-
borderBottom: "".concat(underlineHeight, " solid ").concat(
|
|
119
|
+
borderBottom: "".concat(underlineHeight, " solid ").concat(_colors.tabLineColors.hoveredColor),
|
|
126
120
|
height: 0
|
|
127
121
|
})
|
|
128
122
|
},
|
|
@@ -130,20 +124,20 @@ var getTabStyles = exports.getTabStyles = function getTabStyles(mode) {
|
|
|
130
124
|
// TODO: interaction states will be reviewed in DSP-1438
|
|
131
125
|
color: colors.activeLabelColor,
|
|
132
126
|
'&::after': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
|
|
133
|
-
borderBottom: "".concat(underlineHeight, " solid ").concat(
|
|
127
|
+
borderBottom: "".concat(underlineHeight, " solid ").concat(_colors.tabLineColors.activeColor),
|
|
134
128
|
height: 0
|
|
135
129
|
})
|
|
136
130
|
},
|
|
137
|
-
'&:focus-visible': tabPanelFocusStyles(
|
|
131
|
+
'&:focus-visible': tabPanelFocusStyles(),
|
|
138
132
|
'@supports not selector(*:focus-visible)': {
|
|
139
|
-
'&:focus': tabPanelFocusStyles(
|
|
133
|
+
'&:focus': tabPanelFocusStyles()
|
|
140
134
|
}
|
|
141
135
|
}, highContrastFocusRing), {}, {
|
|
142
136
|
'&[aria-selected="true"]': {
|
|
143
137
|
color: colors.selectedColor,
|
|
144
138
|
'&::after': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
|
|
145
139
|
// This line is a border so it is visible in high contrast mode
|
|
146
|
-
borderBottom: "".concat(underlineHeight, " solid ").concat(
|
|
140
|
+
borderBottom: "".concat(underlineHeight, " solid ").concat(_colors.tabLineColors.selectedColor),
|
|
147
141
|
height: 0
|
|
148
142
|
})
|
|
149
143
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { Children, createRef, useCallback
|
|
2
|
+
import { Children, createRef, useCallback } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
-
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
5
4
|
import { useTabList } from '../hooks';
|
|
6
5
|
import { TabContext } from '../internal/context';
|
|
7
6
|
import { getTabListStyles } from '../internal/styles';
|
|
@@ -12,6 +11,9 @@ const baseStyles = css({
|
|
|
12
11
|
position: 'relative'
|
|
13
12
|
});
|
|
14
13
|
|
|
14
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
15
|
+
const tabListStyles = getTabListStyles();
|
|
16
|
+
|
|
15
17
|
/**
|
|
16
18
|
* __TabList__
|
|
17
19
|
*
|
|
@@ -24,9 +26,6 @@ const baseStyles = css({
|
|
|
24
26
|
const TabList = ({
|
|
25
27
|
children
|
|
26
28
|
}) => {
|
|
27
|
-
const {
|
|
28
|
-
mode
|
|
29
|
-
} = useGlobalTheme();
|
|
30
29
|
const {
|
|
31
30
|
tabsId,
|
|
32
31
|
selected,
|
|
@@ -37,7 +36,6 @@ const TabList = ({
|
|
|
37
36
|
// Don't include any conditional children
|
|
38
37
|
const childrenArray = Children.toArray(children).filter(Boolean);
|
|
39
38
|
const length = childrenArray.length;
|
|
40
|
-
const tabListStyles = useMemo(() => getTabListStyles(mode), [mode]);
|
|
41
39
|
const selectTabByIndex = useCallback(index => {
|
|
42
40
|
var _ref$current;
|
|
43
41
|
const newSelectedNode = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector(`[id='${tabsId}-${index}']`);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { Children, Fragment, useCallback,
|
|
2
|
+
import { Children, Fragment, useCallback, useRef, useState } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
5
|
-
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
6
5
|
import { TabListContext, TabPanelContext } from '../internal/context';
|
|
7
6
|
import { getTabsStyles } from '../internal/styles';
|
|
8
7
|
import { onMouseDownBlur } from '../internal/utils';
|
|
@@ -14,10 +13,13 @@ const baseStyles = css({
|
|
|
14
13
|
flexDirection: 'column',
|
|
15
14
|
flexGrow: 1
|
|
16
15
|
});
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
18
|
+
const tabsStyles = getTabsStyles();
|
|
17
19
|
const analyticsAttributes = {
|
|
18
20
|
componentName: 'tabs',
|
|
19
21
|
packageName: "@atlaskit/tabs",
|
|
20
|
-
packageVersion: "
|
|
22
|
+
packageVersion: "14.0.0"
|
|
21
23
|
};
|
|
22
24
|
const getTabPanelWithContext = ({
|
|
23
25
|
tabPanel,
|
|
@@ -58,9 +60,6 @@ const Tabs = props => {
|
|
|
58
60
|
children,
|
|
59
61
|
testId
|
|
60
62
|
} = props;
|
|
61
|
-
const {
|
|
62
|
-
mode
|
|
63
|
-
} = useGlobalTheme();
|
|
64
63
|
const [selectedState, setSelected] = useState(SelectedType || defaultSelected || 0);
|
|
65
64
|
const selected = SelectedType === undefined ? selectedState : SelectedType;
|
|
66
65
|
const childrenArray = Children.toArray(children)
|
|
@@ -99,7 +98,6 @@ const Tabs = props => {
|
|
|
99
98
|
isSelected: tabIndex === selected,
|
|
100
99
|
tabsId: id
|
|
101
100
|
}));
|
|
102
|
-
const tabsStyles = useMemo(() => getTabsStyles(mode), [mode]);
|
|
103
101
|
return (
|
|
104
102
|
// Only styles that affect the Tabs container itself have been applied via primitives.
|
|
105
103
|
// The other styles applied through the CSS prop are there for styling children
|
|
@@ -1,40 +1,15 @@
|
|
|
1
|
-
import { B100,
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
export const getTabColors = mode => {
|
|
19
|
-
return tabColorMap[mode];
|
|
20
|
-
};
|
|
21
|
-
const tabLineColorMap = {
|
|
22
|
-
light: {
|
|
23
|
-
lineColor: `var(--ds-border, ${N30})`,
|
|
24
|
-
hoveredColor: "var(--ds-border, transparent)",
|
|
25
|
-
activeColor: "var(--ds-border, transparent)",
|
|
26
|
-
selectedColor: `var(--ds-border-selected, ${B400})`
|
|
27
|
-
},
|
|
28
|
-
dark: {
|
|
29
|
-
lineColor: `var(--ds-border, ${DN0})`,
|
|
30
|
-
hoveredColor: "var(--ds-border, transparent)",
|
|
31
|
-
activeColor: "var(--ds-border, transparent)",
|
|
32
|
-
selectedColor: `var(--ds-border-selected, ${B75})`
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
export const getTabLineColor = mode => tabLineColorMap[mode];
|
|
36
|
-
const tabPanelFocusColorMap = {
|
|
37
|
-
light: `var(--ds-border-focused, ${B100})`,
|
|
38
|
-
dark: `var(--ds-border-focused, ${B75})`
|
|
39
|
-
};
|
|
40
|
-
export const getTabPanelFocusColor = mode => tabPanelFocusColorMap[mode];
|
|
1
|
+
import { B100, B400, B500, N30, N500 } from '@atlaskit/theme/colors';
|
|
2
|
+
export const tabColors = {
|
|
3
|
+
labelColor: `var(--ds-text-subtle, ${N500})`,
|
|
4
|
+
activeLabelColor: `var(--ds-text, ${B500})`,
|
|
5
|
+
hoverLabelColor: `var(--ds-text-subtle, ${B400})`,
|
|
6
|
+
selectedColor: `var(--ds-text-selected, ${B400})`,
|
|
7
|
+
focusBorderColor: `var(--ds-border-focused, ${B100})`
|
|
8
|
+
};
|
|
9
|
+
export const tabLineColors = {
|
|
10
|
+
lineColor: `var(--ds-border, ${N30})`,
|
|
11
|
+
hoveredColor: "var(--ds-border, transparent)",
|
|
12
|
+
activeColor: "var(--ds-border, transparent)",
|
|
13
|
+
selectedColor: `var(--ds-border-selected, ${B400})`
|
|
14
|
+
};
|
|
15
|
+
export const tabPanelFocusColor = `var(--ds-border-focused, ${B100})`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
|
-
import {
|
|
2
|
+
import { tabColors, tabLineColors, tabPanelFocusColor } 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`
|
|
@@ -17,12 +17,12 @@ const highContrastFocusRing = {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
const tabFocusStyles =
|
|
21
|
-
boxShadow: `0 0 0 2px ${
|
|
20
|
+
const tabFocusStyles = () => ({
|
|
21
|
+
boxShadow: `0 0 0 2px ${tabPanelFocusColor} inset`,
|
|
22
22
|
borderRadius: "var(--ds-border-radius, 3px)",
|
|
23
23
|
outline: 'none'
|
|
24
24
|
});
|
|
25
|
-
const getTabPanelStyles =
|
|
25
|
+
const getTabPanelStyles = () => ({
|
|
26
26
|
flexGrow: 1,
|
|
27
27
|
/*
|
|
28
28
|
NOTE min-height set to 0% because of Firefox bug
|
|
@@ -31,16 +31,16 @@ const getTabPanelStyles = mode => ({
|
|
|
31
31
|
minHeight: '0%',
|
|
32
32
|
display: 'flex',
|
|
33
33
|
padding: `0 ${tabLeftRightPadding}`,
|
|
34
|
-
'&:focus-visible': tabFocusStyles(
|
|
34
|
+
'&:focus-visible': tabFocusStyles(),
|
|
35
35
|
'@supports not selector(*:focus-visible)': {
|
|
36
|
-
'&:focus': tabFocusStyles(
|
|
36
|
+
'&:focus': tabFocusStyles()
|
|
37
37
|
},
|
|
38
38
|
...highContrastFocusRing
|
|
39
39
|
});
|
|
40
|
-
export const getTabsStyles =
|
|
40
|
+
export const getTabsStyles = () =>
|
|
41
41
|
// eslint-disable-next-line @repo/internal/styles/no-exported-styles
|
|
42
42
|
css({
|
|
43
|
-
'& [role="tabpanel"]': getTabPanelStyles(
|
|
43
|
+
'& [role="tabpanel"]': getTabPanelStyles(),
|
|
44
44
|
// The hidden attribute doesn't work on flex elements
|
|
45
45
|
// Change display to be none
|
|
46
46
|
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
@@ -58,20 +58,20 @@ const tabLineStyles = {
|
|
|
58
58
|
left: tabLeftRightPadding,
|
|
59
59
|
right: tabLeftRightPadding
|
|
60
60
|
};
|
|
61
|
-
export const getTabListStyles =
|
|
61
|
+
export const getTabListStyles = () =>
|
|
62
62
|
// eslint-disable-next-line @repo/internal/styles/no-exported-styles
|
|
63
63
|
css({
|
|
64
|
-
'& [role="tab"]': getTabStyles(
|
|
64
|
+
'& [role="tab"]': getTabStyles(),
|
|
65
65
|
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
66
66
|
'&::before': {
|
|
67
67
|
...tabLineStyles,
|
|
68
68
|
height: underlineHeight,
|
|
69
69
|
// This line is not a border so the selected line is visible in high contrast mode
|
|
70
|
-
backgroundColor:
|
|
70
|
+
backgroundColor: tabLineColors.lineColor
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
|
-
const tabPanelFocusStyles =
|
|
74
|
-
const colors =
|
|
73
|
+
const tabPanelFocusStyles = () => {
|
|
74
|
+
const colors = tabColors;
|
|
75
75
|
return {
|
|
76
76
|
boxShadow: `0 0 0 2px ${colors.focusBorderColor} inset`,
|
|
77
77
|
borderRadius: "var(--ds-border-radius, 3px)",
|
|
@@ -82,8 +82,8 @@ const tabPanelFocusStyles = mode => {
|
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
|
-
export const getTabStyles =
|
|
86
|
-
const colors =
|
|
85
|
+
export const getTabStyles = () => {
|
|
86
|
+
const colors = tabColors;
|
|
87
87
|
return {
|
|
88
88
|
color: colors.labelColor,
|
|
89
89
|
cursor: 'pointer',
|
|
@@ -92,20 +92,14 @@ export const getTabStyles = mode => {
|
|
|
92
92
|
padding: `${tabTopBottomPadding} ${tabLeftRightPadding}`,
|
|
93
93
|
position: 'relative',
|
|
94
94
|
whiteSpace: 'nowrap',
|
|
95
|
+
overflow: 'hidden',
|
|
95
96
|
textOverflow: 'ellipsis',
|
|
96
|
-
// Use "clip" overflow to allow ellipses on x-axis without clipping descenders
|
|
97
|
-
'@supports not (overflow-x: clip)': {
|
|
98
|
-
overflow: 'hidden'
|
|
99
|
-
},
|
|
100
|
-
'@supports (overflow-x: clip)': {
|
|
101
|
-
overflowX: 'clip'
|
|
102
|
-
},
|
|
103
97
|
'&:hover': {
|
|
104
98
|
// TODO: interaction states will be reviewed in DSP-1438
|
|
105
99
|
color: colors.hoverLabelColor,
|
|
106
100
|
'&::after': {
|
|
107
101
|
...tabLineStyles,
|
|
108
|
-
borderBottom: `${underlineHeight} solid ${
|
|
102
|
+
borderBottom: `${underlineHeight} solid ${tabLineColors.hoveredColor}`,
|
|
109
103
|
height: 0
|
|
110
104
|
}
|
|
111
105
|
},
|
|
@@ -114,13 +108,13 @@ export const getTabStyles = mode => {
|
|
|
114
108
|
color: colors.activeLabelColor,
|
|
115
109
|
'&::after': {
|
|
116
110
|
...tabLineStyles,
|
|
117
|
-
borderBottom: `${underlineHeight} solid ${
|
|
111
|
+
borderBottom: `${underlineHeight} solid ${tabLineColors.activeColor}`,
|
|
118
112
|
height: 0
|
|
119
113
|
}
|
|
120
114
|
},
|
|
121
|
-
'&:focus-visible': tabPanelFocusStyles(
|
|
115
|
+
'&:focus-visible': tabPanelFocusStyles(),
|
|
122
116
|
'@supports not selector(*:focus-visible)': {
|
|
123
|
-
'&:focus': tabPanelFocusStyles(
|
|
117
|
+
'&:focus': tabPanelFocusStyles()
|
|
124
118
|
},
|
|
125
119
|
...highContrastFocusRing,
|
|
126
120
|
'&[aria-selected="true"]': {
|
|
@@ -128,7 +122,7 @@ export const getTabStyles = mode => {
|
|
|
128
122
|
'&::after': {
|
|
129
123
|
...tabLineStyles,
|
|
130
124
|
// This line is a border so it is visible in high contrast mode
|
|
131
|
-
borderBottom: `${underlineHeight} solid ${
|
|
125
|
+
borderBottom: `${underlineHeight} solid ${tabLineColors.selectedColor}`,
|
|
132
126
|
height: 0
|
|
133
127
|
}
|
|
134
128
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { Children, createRef, useCallback
|
|
2
|
+
import { Children, createRef, useCallback } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
-
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
5
4
|
import { useTabList } from '../hooks';
|
|
6
5
|
import { TabContext } from '../internal/context';
|
|
7
6
|
import { getTabListStyles } from '../internal/styles';
|
|
@@ -12,6 +11,9 @@ var baseStyles = css({
|
|
|
12
11
|
position: 'relative'
|
|
13
12
|
});
|
|
14
13
|
|
|
14
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
15
|
+
var tabListStyles = getTabListStyles();
|
|
16
|
+
|
|
15
17
|
/**
|
|
16
18
|
* __TabList__
|
|
17
19
|
*
|
|
@@ -23,8 +25,6 @@ var baseStyles = css({
|
|
|
23
25
|
*/
|
|
24
26
|
var TabList = function TabList(_ref) {
|
|
25
27
|
var children = _ref.children;
|
|
26
|
-
var _useGlobalTheme = useGlobalTheme(),
|
|
27
|
-
mode = _useGlobalTheme.mode;
|
|
28
28
|
var _useTabList = useTabList(),
|
|
29
29
|
tabsId = _useTabList.tabsId,
|
|
30
30
|
selected = _useTabList.selected,
|
|
@@ -34,9 +34,6 @@ var TabList = function TabList(_ref) {
|
|
|
34
34
|
// Don't include any conditional children
|
|
35
35
|
var childrenArray = Children.toArray(children).filter(Boolean);
|
|
36
36
|
var length = childrenArray.length;
|
|
37
|
-
var tabListStyles = useMemo(function () {
|
|
38
|
-
return getTabListStyles(mode);
|
|
39
|
-
}, [mode]);
|
|
40
37
|
var selectTabByIndex = useCallback(function (index) {
|
|
41
38
|
var _ref$current;
|
|
42
39
|
var newSelectedNode = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector("[id='".concat(tabsId, "-").concat(index, "']"));
|
|
@@ -4,10 +4,9 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
/** @jsx jsx */
|
|
7
|
-
import { Children, Fragment, useCallback,
|
|
7
|
+
import { Children, Fragment, useCallback, useRef, useState } from 'react';
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
10
|
-
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
11
10
|
import { TabListContext, TabPanelContext } from '../internal/context';
|
|
12
11
|
import { getTabsStyles } from '../internal/styles';
|
|
13
12
|
import { onMouseDownBlur } from '../internal/utils';
|
|
@@ -19,10 +18,13 @@ var baseStyles = css({
|
|
|
19
18
|
flexDirection: 'column',
|
|
20
19
|
flexGrow: 1
|
|
21
20
|
});
|
|
21
|
+
|
|
22
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
23
|
+
var tabsStyles = getTabsStyles();
|
|
22
24
|
var analyticsAttributes = {
|
|
23
25
|
componentName: 'tabs',
|
|
24
26
|
packageName: "@atlaskit/tabs",
|
|
25
|
-
packageVersion: "
|
|
27
|
+
packageVersion: "14.0.0"
|
|
26
28
|
};
|
|
27
29
|
var getTabPanelWithContext = function getTabPanelWithContext(_ref) {
|
|
28
30
|
var tabPanel = _ref.tabPanel,
|
|
@@ -64,8 +66,6 @@ var Tabs = function Tabs(props) {
|
|
|
64
66
|
analyticsContext = props.analyticsContext,
|
|
65
67
|
children = props.children,
|
|
66
68
|
testId = props.testId;
|
|
67
|
-
var _useGlobalTheme = useGlobalTheme(),
|
|
68
|
-
mode = _useGlobalTheme.mode;
|
|
69
69
|
var _useState = useState(SelectedType || defaultSelected || 0),
|
|
70
70
|
_useState2 = _slicedToArray(_useState, 2),
|
|
71
71
|
selectedState = _useState2[0],
|
|
@@ -112,9 +112,6 @@ var Tabs = function Tabs(props) {
|
|
|
112
112
|
tabsId: id
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
|
-
var tabsStyles = useMemo(function () {
|
|
116
|
-
return getTabsStyles(mode);
|
|
117
|
-
}, [mode]);
|
|
118
115
|
return (
|
|
119
116
|
// Only styles that affect the Tabs container itself have been applied via primitives.
|
|
120
117
|
// The other styles applied through the CSS prop are there for styling children
|
|
@@ -1,44 +1,15 @@
|
|
|
1
|
-
import { B100,
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
export var getTabColors = function getTabColors(mode) {
|
|
19
|
-
return tabColorMap[mode];
|
|
20
|
-
};
|
|
21
|
-
var tabLineColorMap = {
|
|
22
|
-
light: {
|
|
23
|
-
lineColor: "var(--ds-border, ".concat(N30, ")"),
|
|
24
|
-
hoveredColor: "var(--ds-border, transparent)",
|
|
25
|
-
activeColor: "var(--ds-border, transparent)",
|
|
26
|
-
selectedColor: "var(--ds-border-selected, ".concat(B400, ")")
|
|
27
|
-
},
|
|
28
|
-
dark: {
|
|
29
|
-
lineColor: "var(--ds-border, ".concat(DN0, ")"),
|
|
30
|
-
hoveredColor: "var(--ds-border, transparent)",
|
|
31
|
-
activeColor: "var(--ds-border, transparent)",
|
|
32
|
-
selectedColor: "var(--ds-border-selected, ".concat(B75, ")")
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
export var getTabLineColor = function getTabLineColor(mode) {
|
|
36
|
-
return tabLineColorMap[mode];
|
|
37
|
-
};
|
|
38
|
-
var tabPanelFocusColorMap = {
|
|
39
|
-
light: "var(--ds-border-focused, ".concat(B100, ")"),
|
|
40
|
-
dark: "var(--ds-border-focused, ".concat(B75, ")")
|
|
41
|
-
};
|
|
42
|
-
export var getTabPanelFocusColor = function getTabPanelFocusColor(mode) {
|
|
43
|
-
return tabPanelFocusColorMap[mode];
|
|
44
|
-
};
|
|
1
|
+
import { B100, B400, B500, N30, N500 } from '@atlaskit/theme/colors';
|
|
2
|
+
export var tabColors = {
|
|
3
|
+
labelColor: "var(--ds-text-subtle, ".concat(N500, ")"),
|
|
4
|
+
activeLabelColor: "var(--ds-text, ".concat(B500, ")"),
|
|
5
|
+
hoverLabelColor: "var(--ds-text-subtle, ".concat(B400, ")"),
|
|
6
|
+
selectedColor: "var(--ds-text-selected, ".concat(B400, ")"),
|
|
7
|
+
focusBorderColor: "var(--ds-border-focused, ".concat(B100, ")")
|
|
8
|
+
};
|
|
9
|
+
export var tabLineColors = {
|
|
10
|
+
lineColor: "var(--ds-border, ".concat(N30, ")"),
|
|
11
|
+
hoveredColor: "var(--ds-border, transparent)",
|
|
12
|
+
activeColor: "var(--ds-border, transparent)",
|
|
13
|
+
selectedColor: "var(--ds-border-selected, ".concat(B400, ")")
|
|
14
|
+
};
|
|
15
|
+
export var tabPanelFocusColor = "var(--ds-border-focused, ".concat(B100, ")");
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
|
-
import {
|
|
5
|
+
import { tabColors, tabLineColors, tabPanelFocusColor } 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`
|
|
@@ -20,14 +20,14 @@ var highContrastFocusRing = {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
var tabFocusStyles = function tabFocusStyles(
|
|
23
|
+
var tabFocusStyles = function tabFocusStyles() {
|
|
24
24
|
return {
|
|
25
|
-
boxShadow: "0 0 0 2px ".concat(
|
|
25
|
+
boxShadow: "0 0 0 2px ".concat(tabPanelFocusColor, " inset"),
|
|
26
26
|
borderRadius: "var(--ds-border-radius, 3px)",
|
|
27
27
|
outline: 'none'
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
-
var getTabPanelStyles = function getTabPanelStyles(
|
|
30
|
+
var getTabPanelStyles = function getTabPanelStyles() {
|
|
31
31
|
return _objectSpread({
|
|
32
32
|
flexGrow: 1,
|
|
33
33
|
/*
|
|
@@ -37,17 +37,17 @@ var getTabPanelStyles = function getTabPanelStyles(mode) {
|
|
|
37
37
|
minHeight: '0%',
|
|
38
38
|
display: 'flex',
|
|
39
39
|
padding: "0 ".concat(tabLeftRightPadding),
|
|
40
|
-
'&:focus-visible': tabFocusStyles(
|
|
40
|
+
'&:focus-visible': tabFocusStyles(),
|
|
41
41
|
'@supports not selector(*:focus-visible)': {
|
|
42
|
-
'&:focus': tabFocusStyles(
|
|
42
|
+
'&:focus': tabFocusStyles()
|
|
43
43
|
}
|
|
44
44
|
}, highContrastFocusRing);
|
|
45
45
|
};
|
|
46
|
-
export var getTabsStyles = function getTabsStyles(
|
|
46
|
+
export var getTabsStyles = function getTabsStyles() {
|
|
47
47
|
return (
|
|
48
48
|
// eslint-disable-next-line @repo/internal/styles/no-exported-styles
|
|
49
49
|
css({
|
|
50
|
-
'& [role="tabpanel"]': getTabPanelStyles(
|
|
50
|
+
'& [role="tabpanel"]': getTabPanelStyles(),
|
|
51
51
|
// The hidden attribute doesn't work on flex elements
|
|
52
52
|
// Change display to be none
|
|
53
53
|
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
@@ -67,22 +67,22 @@ var tabLineStyles = {
|
|
|
67
67
|
left: tabLeftRightPadding,
|
|
68
68
|
right: tabLeftRightPadding
|
|
69
69
|
};
|
|
70
|
-
export var getTabListStyles = function getTabListStyles(
|
|
70
|
+
export var getTabListStyles = function getTabListStyles() {
|
|
71
71
|
return (
|
|
72
72
|
// eslint-disable-next-line @repo/internal/styles/no-exported-styles
|
|
73
73
|
css({
|
|
74
|
-
'& [role="tab"]': getTabStyles(
|
|
74
|
+
'& [role="tab"]': getTabStyles(),
|
|
75
75
|
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
76
76
|
'&::before': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
|
|
77
77
|
height: underlineHeight,
|
|
78
78
|
// This line is not a border so the selected line is visible in high contrast mode
|
|
79
|
-
backgroundColor:
|
|
79
|
+
backgroundColor: tabLineColors.lineColor
|
|
80
80
|
})
|
|
81
81
|
})
|
|
82
82
|
);
|
|
83
83
|
};
|
|
84
|
-
var tabPanelFocusStyles = function tabPanelFocusStyles(
|
|
85
|
-
var colors =
|
|
84
|
+
var tabPanelFocusStyles = function tabPanelFocusStyles() {
|
|
85
|
+
var colors = tabColors;
|
|
86
86
|
return {
|
|
87
87
|
boxShadow: "0 0 0 2px ".concat(colors.focusBorderColor, " inset"),
|
|
88
88
|
borderRadius: "var(--ds-border-radius, 3px)",
|
|
@@ -93,8 +93,8 @@ var tabPanelFocusStyles = function tabPanelFocusStyles(mode) {
|
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
|
-
export var getTabStyles = function getTabStyles(
|
|
97
|
-
var colors =
|
|
96
|
+
export var getTabStyles = function getTabStyles() {
|
|
97
|
+
var colors = tabColors;
|
|
98
98
|
return _objectSpread(_objectSpread({
|
|
99
99
|
color: colors.labelColor,
|
|
100
100
|
cursor: 'pointer',
|
|
@@ -103,19 +103,13 @@ export var getTabStyles = function getTabStyles(mode) {
|
|
|
103
103
|
padding: "".concat(tabTopBottomPadding, " ").concat(tabLeftRightPadding),
|
|
104
104
|
position: 'relative',
|
|
105
105
|
whiteSpace: 'nowrap',
|
|
106
|
+
overflow: 'hidden',
|
|
106
107
|
textOverflow: 'ellipsis',
|
|
107
|
-
// Use "clip" overflow to allow ellipses on x-axis without clipping descenders
|
|
108
|
-
'@supports not (overflow-x: clip)': {
|
|
109
|
-
overflow: 'hidden'
|
|
110
|
-
},
|
|
111
|
-
'@supports (overflow-x: clip)': {
|
|
112
|
-
overflowX: 'clip'
|
|
113
|
-
},
|
|
114
108
|
'&:hover': {
|
|
115
109
|
// TODO: interaction states will be reviewed in DSP-1438
|
|
116
110
|
color: colors.hoverLabelColor,
|
|
117
111
|
'&::after': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
|
|
118
|
-
borderBottom: "".concat(underlineHeight, " solid ").concat(
|
|
112
|
+
borderBottom: "".concat(underlineHeight, " solid ").concat(tabLineColors.hoveredColor),
|
|
119
113
|
height: 0
|
|
120
114
|
})
|
|
121
115
|
},
|
|
@@ -123,20 +117,20 @@ export var getTabStyles = function getTabStyles(mode) {
|
|
|
123
117
|
// TODO: interaction states will be reviewed in DSP-1438
|
|
124
118
|
color: colors.activeLabelColor,
|
|
125
119
|
'&::after': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
|
|
126
|
-
borderBottom: "".concat(underlineHeight, " solid ").concat(
|
|
120
|
+
borderBottom: "".concat(underlineHeight, " solid ").concat(tabLineColors.activeColor),
|
|
127
121
|
height: 0
|
|
128
122
|
})
|
|
129
123
|
},
|
|
130
|
-
'&:focus-visible': tabPanelFocusStyles(
|
|
124
|
+
'&:focus-visible': tabPanelFocusStyles(),
|
|
131
125
|
'@supports not selector(*:focus-visible)': {
|
|
132
|
-
'&:focus': tabPanelFocusStyles(
|
|
126
|
+
'&:focus': tabPanelFocusStyles()
|
|
133
127
|
}
|
|
134
128
|
}, highContrastFocusRing), {}, {
|
|
135
129
|
'&[aria-selected="true"]': {
|
|
136
130
|
color: colors.selectedColor,
|
|
137
131
|
'&::after': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
|
|
138
132
|
// This line is a border so it is visible in high contrast mode
|
|
139
|
-
borderBottom: "".concat(underlineHeight, " solid ").concat(
|
|
133
|
+
borderBottom: "".concat(underlineHeight, " solid ").concat(tabLineColors.selectedColor),
|
|
140
134
|
height: 0
|
|
141
135
|
})
|
|
142
136
|
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
focusBorderColor: string;
|
|
1
|
+
export declare const tabColors: {
|
|
2
|
+
labelColor: "var(--ds-text-subtle)";
|
|
3
|
+
activeLabelColor: "var(--ds-text)";
|
|
4
|
+
hoverLabelColor: "var(--ds-text-subtle)";
|
|
5
|
+
selectedColor: "var(--ds-text-selected)";
|
|
6
|
+
focusBorderColor: "var(--ds-border-focused)";
|
|
8
7
|
};
|
|
9
|
-
export declare const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
selectedColor: string;
|
|
8
|
+
export declare const tabLineColors: {
|
|
9
|
+
lineColor: "var(--ds-border)";
|
|
10
|
+
hoveredColor: "var(--ds-border)";
|
|
11
|
+
activeColor: "var(--ds-border)";
|
|
12
|
+
selectedColor: "var(--ds-border-selected)";
|
|
15
13
|
};
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const getTabPanelFocusColor: (mode: ThemeModes) => string;
|
|
14
|
+
export declare const tabPanelFocusColor: "var(--ds-border-focused)";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CSSObject, SerializedStyles } from '@emotion/react';
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const getTabStyles: (mode: ThemeModes) => CSSObject;
|
|
2
|
+
export declare const getTabsStyles: () => SerializedStyles;
|
|
3
|
+
export declare const getTabListStyles: () => SerializedStyles;
|
|
4
|
+
export declare const getTabStyles: () => CSSObject;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
focusBorderColor: string;
|
|
1
|
+
export declare const tabColors: {
|
|
2
|
+
labelColor: "var(--ds-text-subtle)";
|
|
3
|
+
activeLabelColor: "var(--ds-text)";
|
|
4
|
+
hoverLabelColor: "var(--ds-text-subtle)";
|
|
5
|
+
selectedColor: "var(--ds-text-selected)";
|
|
6
|
+
focusBorderColor: "var(--ds-border-focused)";
|
|
8
7
|
};
|
|
9
|
-
export declare const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
selectedColor: string;
|
|
8
|
+
export declare const tabLineColors: {
|
|
9
|
+
lineColor: "var(--ds-border)";
|
|
10
|
+
hoveredColor: "var(--ds-border)";
|
|
11
|
+
activeColor: "var(--ds-border)";
|
|
12
|
+
selectedColor: "var(--ds-border-selected)";
|
|
15
13
|
};
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const getTabPanelFocusColor: (mode: ThemeModes) => string;
|
|
14
|
+
export declare const tabPanelFocusColor: "var(--ds-border-focused)";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CSSObject, SerializedStyles } from '@emotion/react';
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const getTabStyles: (mode: ThemeModes) => CSSObject;
|
|
2
|
+
export declare const getTabsStyles: () => SerializedStyles;
|
|
3
|
+
export declare const getTabListStyles: () => SerializedStyles;
|
|
4
|
+
export declare const getTabStyles: () => CSSObject;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/tabs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.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/"
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
38
38
|
"@atlaskit/codemod-utils": "^4.2.0",
|
|
39
39
|
"@atlaskit/ds-explorations": "^3.0.0",
|
|
40
|
-
"@atlaskit/primitives": "^1.
|
|
40
|
+
"@atlaskit/primitives": "^1.10.0",
|
|
41
41
|
"@atlaskit/theme": "^12.6.0",
|
|
42
|
-
"@atlaskit/tokens": "^1.
|
|
42
|
+
"@atlaskit/tokens": "^1.28.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"@emotion/react": "^11.7.1"
|
|
45
45
|
},
|