@atlaskit/tabs 16.1.1 → 16.2.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 +842 -830
- package/__perf__/default.tsx +16 -16
- package/codemods/13.0.0-lite-mode.tsx +16 -20
- package/codemods/__tests__/13.0.0-lite-mode.tsx +44 -44
- package/codemods/__tests__/add-id-prop.tsx +13 -13
- package/codemods/__tests__/map-tabs-prop.tsx +42 -42
- package/codemods/__tests__/on-select-to-on-change.tsx +49 -49
- package/codemods/__tests__/remove-components-prop.tsx +14 -14
- package/codemods/__tests__/remove-is-selected-test-prop.tsx +14 -14
- package/codemods/__tests__/remove-tab-item-tab-content.tsx +7 -7
- package/codemods/__tests__/remove-types.tsx +14 -14
- package/codemods/__tests__/rename-is-content-persisted-to-should-unmount-tab-panel-on-change.tsx +36 -38
- package/codemods/migrations/add-id-prop.tsx +40 -43
- package/codemods/migrations/map-tabs-prop.tsx +146 -162
- package/codemods/migrations/on-select-to-on-change.tsx +67 -73
- package/codemods/migrations/remove-components-prop.tsx +3 -3
- package/codemods/migrations/remove-is-selected-test-prop.tsx +3 -3
- package/codemods/migrations/remove-tab-item-tab-content.tsx +22 -20
- package/codemods/migrations/remove-types.tsx +35 -30
- package/codemods/migrations/rename-is-content-persisted-to-should-unmount-tab-panel-on-change.tsx +49 -57
- package/codemods/utils.tsx +27 -30
- package/dist/cjs/components/tab-list.js +5 -0
- package/dist/cjs/components/tab-panel.js +5 -0
- package/dist/cjs/components/tab.js +4 -0
- package/dist/cjs/components/tabs.js +4 -2
- package/dist/cjs/internal/styles.js +8 -5
- package/dist/es2019/components/tab-list.js +5 -0
- package/dist/es2019/components/tab-panel.js +5 -0
- package/dist/es2019/components/tab.js +4 -0
- package/dist/es2019/components/tabs.js +6 -1
- package/dist/es2019/internal/styles.js +9 -4
- package/dist/esm/components/tab-list.js +5 -0
- package/dist/esm/components/tab-panel.js +5 -0
- package/dist/esm/components/tab.js +4 -0
- package/dist/esm/components/tabs.js +6 -1
- package/dist/esm/internal/styles.js +8 -4
- package/dist/types/components/tab-list.d.ts +1 -1
- package/dist/types/components/tab-panel.d.ts +1 -1
- package/dist/types/components/tab.d.ts +4 -1
- package/dist/types/components/tabs.d.ts +1 -1
- package/dist/types/internal/context.d.ts +1 -1
- package/dist/types/internal/styles.d.ts +1 -1
- package/dist/types/types.d.ts +3 -3
- package/dist/types-ts4.5/components/tab-list.d.ts +1 -1
- package/dist/types-ts4.5/components/tab-panel.d.ts +1 -1
- package/dist/types-ts4.5/components/tab.d.ts +4 -1
- package/dist/types-ts4.5/components/tabs.d.ts +1 -1
- package/dist/types-ts4.5/internal/context.d.ts +1 -1
- package/dist/types-ts4.5/internal/styles.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +3 -3
- package/extract-react-types/tab-attributes.tsx +2 -2
- package/extract-react-types/tab-panel-attributes.tsx +2 -2
- package/package.json +93 -95
- package/report.api.md +40 -42
package/codemods/migrations/rename-is-content-persisted-to-should-unmount-tab-panel-on-change.tsx
CHANGED
|
@@ -1,70 +1,62 @@
|
|
|
1
|
-
import core, { ASTPath, JSXAttribute, JSXElement } from 'jscodeshift';
|
|
2
|
-
import { Collection } from 'jscodeshift/src/Collection';
|
|
3
|
-
|
|
4
1
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
type ASTPath,
|
|
3
|
+
type default as core,
|
|
4
|
+
type JSXAttribute,
|
|
5
|
+
type JSXElement,
|
|
6
|
+
} from 'jscodeshift';
|
|
7
|
+
import { type Collection } from 'jscodeshift/src/Collection';
|
|
8
|
+
|
|
9
|
+
import { getDefaultSpecifier, getJSXAttributesByName } from '@atlaskit/codemod-utils';
|
|
8
10
|
|
|
9
11
|
const component = '@atlaskit/tabs';
|
|
10
12
|
const fromProp = 'isContentPersisted';
|
|
11
13
|
const toProp = 'shouldUnmountTabPanelOnChange';
|
|
12
14
|
|
|
13
15
|
export const renameIsContentPersistedToShouldUnmountTabPanelOnChange = (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
j: core.JSCodeshift,
|
|
17
|
+
source: Collection<Node>,
|
|
16
18
|
) => {
|
|
17
|
-
|
|
19
|
+
const defaultSpecifier = getDefaultSpecifier(j, source, component);
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
if (!defaultSpecifier) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
(attribute: ASTPath<JSXAttribute>) => {
|
|
29
|
-
foundUsage = true;
|
|
30
|
-
const { value } = attribute.node;
|
|
25
|
+
source.findJSXElements(defaultSpecifier).forEach((element: ASTPath<JSXElement>) => {
|
|
26
|
+
let foundUsage = false;
|
|
27
|
+
getJSXAttributesByName(j, element, fromProp).forEach((attribute: ASTPath<JSXAttribute>) => {
|
|
28
|
+
foundUsage = true;
|
|
29
|
+
const { value } = attribute.node;
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
if (!value) {
|
|
32
|
+
// boolean attribute isContentPersisted -> removed
|
|
33
|
+
return j(attribute).remove();
|
|
34
|
+
}
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
// No prop -> shouldUnmountTabPanelOnChange
|
|
64
|
-
// @ts-ignore
|
|
65
|
-
element.value.openingElement.attributes.push(
|
|
66
|
-
j.jsxAttribute(j.jsxIdentifier(toProp), null),
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
36
|
+
if (value.type === 'JSXExpressionContainer') {
|
|
37
|
+
if (value.expression.type === 'BooleanLiteral') {
|
|
38
|
+
if (value.expression.value) {
|
|
39
|
+
// isContentPersisted={true} -> removed
|
|
40
|
+
j(attribute).remove();
|
|
41
|
+
} else {
|
|
42
|
+
// isContentPersisted={false} -> shouldUnmountTabPanelOnChange
|
|
43
|
+
j(attribute).replaceWith(j.jsxAttribute(j.jsxIdentifier(toProp), null));
|
|
44
|
+
}
|
|
45
|
+
} else if (value.expression.type === 'Identifier') {
|
|
46
|
+
// isContentPersisted={isContentPersisted} -> shouldUnmountTabPanelOnChange={!isContentPersisted}
|
|
47
|
+
j(attribute).replaceWith(
|
|
48
|
+
j.jsxAttribute(
|
|
49
|
+
j.jsxIdentifier(toProp),
|
|
50
|
+
j.jsxExpressionContainer(j.unaryExpression('!', value.expression)),
|
|
51
|
+
),
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
if (!foundUsage) {
|
|
57
|
+
// No prop -> shouldUnmountTabPanelOnChange
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
element.value.openingElement.attributes.push(j.jsxAttribute(j.jsxIdentifier(toProp), null));
|
|
60
|
+
}
|
|
61
|
+
});
|
|
70
62
|
};
|
package/codemods/utils.tsx
CHANGED
|
@@ -1,42 +1,39 @@
|
|
|
1
|
-
import core from 'jscodeshift';
|
|
2
|
-
import { Collection } from 'jscodeshift/src/Collection';
|
|
1
|
+
import type core from 'jscodeshift';
|
|
2
|
+
import { type Collection } from 'jscodeshift/src/Collection';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
addCommentToStartOfFile,
|
|
6
|
+
getDefaultSpecifier,
|
|
7
|
+
getJSXAttributesByName,
|
|
8
8
|
} from '@atlaskit/codemod-utils';
|
|
9
9
|
|
|
10
10
|
export const createRemoveFuncWithDefaultSpecifierFor =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
(component: string, prop: string, comment?: string) =>
|
|
12
|
+
(j: core.JSCodeshift, source: Collection<Node>) => {
|
|
13
|
+
const specifier = getDefaultSpecifier(j, source, component);
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
if (!specifier) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
source.findJSXElements(specifier).forEach((element) => {
|
|
20
|
+
getJSXAttributesByName(j, element, prop).forEach((attribute: any) => {
|
|
21
|
+
if (comment) {
|
|
22
|
+
addCommentToStartOfFile({ j, base: source, message: comment });
|
|
23
|
+
}
|
|
24
|
+
j(attribute).remove();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
28
|
|
|
29
29
|
export function doesIdentifierExist({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
j,
|
|
31
|
+
base,
|
|
32
|
+
name,
|
|
33
33
|
}: {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
j: core.JSCodeshift;
|
|
35
|
+
base: Collection<any>;
|
|
36
|
+
name: string;
|
|
37
37
|
}): boolean {
|
|
38
|
-
|
|
39
|
-
base.find(j.Identifier).filter((identifer) => identifer.value.name === name)
|
|
40
|
-
.length > 0
|
|
41
|
-
);
|
|
38
|
+
return base.find(j.Identifier).filter((identifer) => identifer.value.name === name).length > 0;
|
|
42
39
|
}
|
|
@@ -9,8 +9,13 @@ var _react2 = require("@emotion/react");
|
|
|
9
9
|
var _hooks = require("../hooks");
|
|
10
10
|
var _context = require("../internal/context");
|
|
11
11
|
var _styles = require("../internal/styles");
|
|
12
|
+
/**
|
|
13
|
+
* @jsxRuntime classic
|
|
14
|
+
*/
|
|
12
15
|
/** @jsx jsx */
|
|
13
16
|
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
18
|
+
|
|
14
19
|
var baseStyles = (0, _react2.css)({
|
|
15
20
|
display: 'flex',
|
|
16
21
|
padding: "var(--ds-space-0, 0px)",
|
|
@@ -9,8 +9,13 @@ var _react = require("react");
|
|
|
9
9
|
var _react2 = require("@emotion/react");
|
|
10
10
|
var _focusRing = _interopRequireDefault(require("@atlaskit/focus-ring"));
|
|
11
11
|
var _hooks = require("../hooks");
|
|
12
|
+
/**
|
|
13
|
+
* @jsxRuntime classic
|
|
14
|
+
*/
|
|
12
15
|
/** @jsx jsx */
|
|
13
16
|
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
18
|
+
|
|
14
19
|
// Note this is not being memoized as children is an unstable reference
|
|
15
20
|
/**
|
|
16
21
|
* __TabPanel__
|
|
@@ -9,7 +9,11 @@ var _react = require("@emotion/react");
|
|
|
9
9
|
var _focusRing = _interopRequireDefault(require("@atlaskit/focus-ring"));
|
|
10
10
|
var _primitives = require("@atlaskit/primitives");
|
|
11
11
|
var _hooks = require("../hooks");
|
|
12
|
+
/**
|
|
13
|
+
* @jsxRuntime classic
|
|
14
|
+
*/
|
|
12
15
|
/** @jsx jsx */
|
|
16
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
13
17
|
|
|
14
18
|
/**
|
|
15
19
|
* __Tab__
|
|
@@ -14,7 +14,9 @@ var _usePlatformLeafEventHandler = require("@atlaskit/analytics-next/usePlatform
|
|
|
14
14
|
var _context = require("../internal/context");
|
|
15
15
|
var _styles = require("../internal/styles");
|
|
16
16
|
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; }
|
|
17
|
-
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) { (0, _defineProperty2.default)(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; } /**
|
|
17
|
+
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) { (0, _defineProperty2.default)(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; } /**
|
|
18
|
+
* @jsxRuntime classic
|
|
19
|
+
*/ /** @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
18
20
|
var baseStyles = (0, _react2.css)({
|
|
19
21
|
display: 'flex',
|
|
20
22
|
maxWidth: '100%',
|
|
@@ -29,7 +31,7 @@ var tabsStyles = (0, _styles.getTabsStyles)();
|
|
|
29
31
|
var analyticsAttributes = {
|
|
30
32
|
componentName: 'tabs',
|
|
31
33
|
packageName: "@atlaskit/tabs",
|
|
32
|
-
packageVersion: "16.
|
|
34
|
+
packageVersion: "16.2.0"
|
|
33
35
|
};
|
|
34
36
|
var getTabPanelWithContext = function getTabPanelWithContext(_ref) {
|
|
35
37
|
var tabPanel = _ref.tabPanel,
|
|
@@ -9,7 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
var _colors = require("./colors");
|
|
11
11
|
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; }
|
|
12
|
-
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) { (0, _defineProperty2.default)(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; }
|
|
12
|
+
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) { (0, _defineProperty2.default)(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; } // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
13
13
|
var tabInlinePadding = "var(--ds-space-100, 8px)";
|
|
14
14
|
var tabBlockPadding = "var(--ds-space-075, 6px)";
|
|
15
15
|
var tabInlineMargin = "var(--ds-space-negative-100, -8px)";
|
|
@@ -19,9 +19,9 @@ var getTabPanelStyles = function getTabPanelStyles() {
|
|
|
19
19
|
return {
|
|
20
20
|
flexGrow: 1,
|
|
21
21
|
/*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
NOTE min-height set to 0% because of Firefox bug
|
|
23
|
+
FF http://stackoverflow.com/questions/28636832/firefox-overflow-y-not-working-with-nested-flexbox
|
|
24
|
+
*/
|
|
25
25
|
minHeight: '0%',
|
|
26
26
|
display: 'flex'
|
|
27
27
|
};
|
|
@@ -30,10 +30,11 @@ var getTabsStyles = exports.getTabsStyles = function getTabsStyles() {
|
|
|
30
30
|
return (
|
|
31
31
|
// eslint-disable-next-line @repo/internal/styles/no-exported-styles
|
|
32
32
|
(0, _react.css)({
|
|
33
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
33
34
|
'& [role="tabpanel"]': getTabPanelStyles(),
|
|
34
35
|
// The hidden attribute doesn't work on flex elements
|
|
35
36
|
// Change display to be none
|
|
36
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
37
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
37
38
|
'& > [hidden]': {
|
|
38
39
|
display: 'none'
|
|
39
40
|
}
|
|
@@ -54,12 +55,14 @@ var getTabListStyles = exports.getTabListStyles = function getTabListStyles() {
|
|
|
54
55
|
return (
|
|
55
56
|
// eslint-disable-next-line @repo/internal/styles/no-exported-styles
|
|
56
57
|
(0, _react.css)({
|
|
58
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
57
59
|
'& [role="tab"]': getTabStyles(),
|
|
58
60
|
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
59
61
|
marginInlineStart: tabInlineMargin,
|
|
60
62
|
'&::before': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
|
|
61
63
|
height: underlineHeight,
|
|
62
64
|
// This line is not a border so the selected line is visible in high contrast mode
|
|
65
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
63
66
|
backgroundColor: _colors.tabLineColors.lineColor
|
|
64
67
|
})
|
|
65
68
|
})
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
*/
|
|
1
4
|
/** @jsx jsx */
|
|
2
5
|
import { Children, createRef, useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
8
|
import { css, jsx } from '@emotion/react';
|
|
4
9
|
import { useTabList } from '../hooks';
|
|
5
10
|
import { TabContext } from '../internal/context';
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
*/
|
|
1
4
|
/** @jsx jsx */
|
|
2
5
|
import { Fragment } from 'react';
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
8
|
import { jsx } from '@emotion/react';
|
|
4
9
|
import FocusRing from '@atlaskit/focus-ring';
|
|
5
10
|
import { useTabPanel } from '../hooks';
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
*/
|
|
1
4
|
/** @jsx jsx */
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
6
|
import { jsx } from '@emotion/react';
|
|
3
7
|
import FocusRing from '@atlaskit/focus-ring';
|
|
4
8
|
import { Text } from '@atlaskit/primitives';
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
*/
|
|
1
4
|
/** @jsx jsx */
|
|
2
5
|
import { Children, Fragment, useCallback, useRef, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
8
|
import { css, jsx } from '@emotion/react';
|
|
4
9
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
5
10
|
import { TabListContext, TabPanelContext } from '../internal/context';
|
|
@@ -18,7 +23,7 @@ const tabsStyles = getTabsStyles();
|
|
|
18
23
|
const analyticsAttributes = {
|
|
19
24
|
componentName: 'tabs',
|
|
20
25
|
packageName: "@atlaskit/tabs",
|
|
21
|
-
packageVersion: "16.
|
|
26
|
+
packageVersion: "16.2.0"
|
|
22
27
|
};
|
|
23
28
|
const getTabPanelWithContext = ({
|
|
24
29
|
tabPanel,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
1
2
|
import { css } from '@emotion/react';
|
|
2
3
|
import { tabColors, tabLineColors } from './colors';
|
|
3
4
|
const tabInlinePadding = "var(--ds-space-100, 8px)";
|
|
@@ -8,19 +9,20 @@ const underlineHeight = "var(--ds-border-width-outline, 2px)";
|
|
|
8
9
|
const getTabPanelStyles = () => ({
|
|
9
10
|
flexGrow: 1,
|
|
10
11
|
/*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
NOTE min-height set to 0% because of Firefox bug
|
|
13
|
+
FF http://stackoverflow.com/questions/28636832/firefox-overflow-y-not-working-with-nested-flexbox
|
|
14
|
+
*/
|
|
14
15
|
minHeight: '0%',
|
|
15
16
|
display: 'flex'
|
|
16
17
|
});
|
|
17
18
|
export const getTabsStyles = () =>
|
|
18
19
|
// eslint-disable-next-line @repo/internal/styles/no-exported-styles
|
|
19
20
|
css({
|
|
21
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
20
22
|
'& [role="tabpanel"]': getTabPanelStyles(),
|
|
21
23
|
// The hidden attribute doesn't work on flex elements
|
|
22
24
|
// Change display to be none
|
|
23
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
25
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
24
26
|
'& > [hidden]': {
|
|
25
27
|
display: 'none'
|
|
26
28
|
}
|
|
@@ -38,13 +40,16 @@ const tabLineStyles = {
|
|
|
38
40
|
export const getTabListStyles = () =>
|
|
39
41
|
// eslint-disable-next-line @repo/internal/styles/no-exported-styles
|
|
40
42
|
css({
|
|
43
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
41
44
|
'& [role="tab"]': getTabStyles(),
|
|
42
45
|
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
43
46
|
marginInlineStart: tabInlineMargin,
|
|
44
47
|
'&::before': {
|
|
48
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
45
49
|
...tabLineStyles,
|
|
46
50
|
height: underlineHeight,
|
|
47
51
|
// This line is not a border so the selected line is visible in high contrast mode
|
|
52
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
48
53
|
backgroundColor: tabLineColors.lineColor
|
|
49
54
|
}
|
|
50
55
|
});
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
*/
|
|
1
4
|
/** @jsx jsx */
|
|
2
5
|
import { Children, createRef, useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
8
|
import { css, jsx } from '@emotion/react';
|
|
4
9
|
import { useTabList } from '../hooks';
|
|
5
10
|
import { TabContext } from '../internal/context';
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
*/
|
|
1
4
|
/** @jsx jsx */
|
|
2
5
|
import { Fragment } from 'react';
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
8
|
import { jsx } from '@emotion/react';
|
|
4
9
|
import FocusRing from '@atlaskit/focus-ring';
|
|
5
10
|
import { useTabPanel } from '../hooks';
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
*/
|
|
1
4
|
/** @jsx jsx */
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
2
6
|
import { jsx } from '@emotion/react';
|
|
3
7
|
import FocusRing from '@atlaskit/focus-ring';
|
|
4
8
|
import { Text } from '@atlaskit/primitives';
|
|
@@ -3,8 +3,13 @@ import _toArray from "@babel/runtime/helpers/toArray";
|
|
|
3
3
|
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
|
+
/**
|
|
7
|
+
* @jsxRuntime classic
|
|
8
|
+
*/
|
|
6
9
|
/** @jsx jsx */
|
|
7
10
|
import { Children, Fragment, useCallback, useRef, useState } from 'react';
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
13
|
import { css, jsx } from '@emotion/react';
|
|
9
14
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
10
15
|
import { TabListContext, TabPanelContext } from '../internal/context';
|
|
@@ -23,7 +28,7 @@ var tabsStyles = getTabsStyles();
|
|
|
23
28
|
var analyticsAttributes = {
|
|
24
29
|
componentName: 'tabs',
|
|
25
30
|
packageName: "@atlaskit/tabs",
|
|
26
|
-
packageVersion: "16.
|
|
31
|
+
packageVersion: "16.2.0"
|
|
27
32
|
};
|
|
28
33
|
var getTabPanelWithContext = function getTabPanelWithContext(_ref) {
|
|
29
34
|
var tabPanel = _ref.tabPanel,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
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
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
5
|
import { css } from '@emotion/react';
|
|
5
6
|
import { tabColors, tabLineColors } from './colors';
|
|
6
7
|
var tabInlinePadding = "var(--ds-space-100, 8px)";
|
|
@@ -12,9 +13,9 @@ var getTabPanelStyles = function getTabPanelStyles() {
|
|
|
12
13
|
return {
|
|
13
14
|
flexGrow: 1,
|
|
14
15
|
/*
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
NOTE min-height set to 0% because of Firefox bug
|
|
17
|
+
FF http://stackoverflow.com/questions/28636832/firefox-overflow-y-not-working-with-nested-flexbox
|
|
18
|
+
*/
|
|
18
19
|
minHeight: '0%',
|
|
19
20
|
display: 'flex'
|
|
20
21
|
};
|
|
@@ -23,10 +24,11 @@ export var getTabsStyles = function getTabsStyles() {
|
|
|
23
24
|
return (
|
|
24
25
|
// eslint-disable-next-line @repo/internal/styles/no-exported-styles
|
|
25
26
|
css({
|
|
27
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
26
28
|
'& [role="tabpanel"]': getTabPanelStyles(),
|
|
27
29
|
// The hidden attribute doesn't work on flex elements
|
|
28
30
|
// Change display to be none
|
|
29
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles
|
|
31
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
30
32
|
'& > [hidden]': {
|
|
31
33
|
display: 'none'
|
|
32
34
|
}
|
|
@@ -47,12 +49,14 @@ export var getTabListStyles = function getTabListStyles() {
|
|
|
47
49
|
return (
|
|
48
50
|
// eslint-disable-next-line @repo/internal/styles/no-exported-styles
|
|
49
51
|
css({
|
|
52
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
50
53
|
'& [role="tab"]': getTabStyles(),
|
|
51
54
|
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
52
55
|
marginInlineStart: tabInlineMargin,
|
|
53
56
|
'&::before': _objectSpread(_objectSpread({}, tabLineStyles), {}, {
|
|
54
57
|
height: underlineHeight,
|
|
55
58
|
// This line is not a border so the selected line is visible in high contrast mode
|
|
59
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
56
60
|
backgroundColor: tabLineColors.lineColor
|
|
57
61
|
})
|
|
58
62
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TabAttributesType, TabListAttributesType, TabPanelAttributesType } from '../types';
|
|
2
|
+
import { type TabAttributesType, type TabListAttributesType, type TabPanelAttributesType } from '../types';
|
|
3
3
|
export declare const TabContext: import("react").Context<TabAttributesType | null>;
|
|
4
4
|
export declare const TabListContext: import("react").Context<TabListAttributesType | null>;
|
|
5
5
|
export declare const TabPanelContext: import("react").Context<TabPanelAttributesType | null>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSObject, SerializedStyles } from '@emotion/react';
|
|
1
|
+
import { type CSSObject, type SerializedStyles } from '@emotion/react';
|
|
2
2
|
export declare const getTabsStyles: () => SerializedStyles;
|
|
3
3
|
export declare const getTabListStyles: () => SerializedStyles;
|
|
4
4
|
export declare const getTabStyles: () => CSSObject;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { KeyboardEvent, ReactNode } from 'react';
|
|
2
|
-
import UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
|
|
3
|
-
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
1
|
+
import { type KeyboardEvent, type ReactNode } from 'react';
|
|
2
|
+
import type UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
|
|
3
|
+
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
4
4
|
export interface TabProps {
|
|
5
5
|
/**
|
|
6
6
|
* The children to be rendered within a `Tab`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TabAttributesType, TabListAttributesType, TabPanelAttributesType } from '../types';
|
|
2
|
+
import { type TabAttributesType, type TabListAttributesType, type TabPanelAttributesType } from '../types';
|
|
3
3
|
export declare const TabContext: import("react").Context<TabAttributesType | null>;
|
|
4
4
|
export declare const TabListContext: import("react").Context<TabListAttributesType | null>;
|
|
5
5
|
export declare const TabPanelContext: import("react").Context<TabPanelAttributesType | null>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSObject, SerializedStyles } from '@emotion/react';
|
|
1
|
+
import { type CSSObject, type SerializedStyles } from '@emotion/react';
|
|
2
2
|
export declare const getTabsStyles: () => SerializedStyles;
|
|
3
3
|
export declare const getTabListStyles: () => SerializedStyles;
|
|
4
4
|
export declare const getTabStyles: () => CSSObject;
|