@atlaskit/heading 1.7.1 → 1.8.1
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/codemods/{1.6.0-level-to-variant.tsx → 1.6.0-level-to-size.tsx} +5 -7
- package/codemods/__tests__/{next-level-to-variant.tsx → 1.6.0-level-to-size.tsx} +7 -7
- package/dist/cjs/heading.js +4 -2
- package/dist/cjs/heading.partial.js +12 -9
- package/dist/es2019/heading.js +3 -1
- package/dist/es2019/heading.partial.js +12 -9
- package/dist/esm/heading.js +4 -2
- package/dist/esm/heading.partial.js +12 -9
- package/dist/types/heading.d.ts +1 -1
- package/dist/types/heading.partial.d.ts +5 -5
- package/dist/types/types.d.ts +11 -7
- package/dist/types-ts4.5/heading.d.ts +1 -1
- package/dist/types-ts4.5/heading.partial.d.ts +5 -5
- package/dist/types-ts4.5/types.d.ts +11 -7
- package/package.json +1 -1
- package/scripts/codegen.tsx +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/heading
|
|
2
2
|
|
|
3
|
+
## 1.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#81644](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/81644) [`8ab7a816dca7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8ab7a816dca7) - Revert input border change from the previous version
|
|
8
|
+
|
|
9
|
+
## 1.8.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#80528](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80528) [`8877e9b57d55`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8877e9b57d55) - Added `size` prop which will replace `variant` prop in the next major version.
|
|
14
|
+
|
|
3
15
|
## 1.7.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -17,12 +17,12 @@ export default function transformer(
|
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
replaceLevelWithSize(j, base, headingSpecifier);
|
|
21
21
|
|
|
22
22
|
return base.toSource();
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const levelToSizeMap = {
|
|
26
26
|
h900: 'xxlarge',
|
|
27
27
|
h800: 'xlarge',
|
|
28
28
|
h700: 'large',
|
|
@@ -35,7 +35,7 @@ const levelToVariantMap = {
|
|
|
35
35
|
// h100: 'xxsmall',
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
function
|
|
38
|
+
function replaceLevelWithSize(
|
|
39
39
|
j: core.JSCodeshift,
|
|
40
40
|
source: ReturnType<typeof j>,
|
|
41
41
|
specifier: string,
|
|
@@ -47,13 +47,11 @@ function replaceLevelWithVariant(
|
|
|
47
47
|
const attrValue = j(attr).nodes()[0].value;
|
|
48
48
|
if (attrValue.type === 'StringLiteral') {
|
|
49
49
|
const replacementValue =
|
|
50
|
-
|
|
51
|
-
attrValue.value as keyof typeof levelToVariantMap
|
|
52
|
-
];
|
|
50
|
+
levelToSizeMap[attrValue.value as keyof typeof levelToSizeMap];
|
|
53
51
|
if (replacementValue) {
|
|
54
52
|
j(attr).replaceWith(
|
|
55
53
|
j.jsxAttribute(
|
|
56
|
-
j.jsxIdentifier('
|
|
54
|
+
j.jsxIdentifier('size'),
|
|
57
55
|
j.stringLiteral(replacementValue),
|
|
58
56
|
),
|
|
59
57
|
);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
jest.autoMockOff();
|
|
2
2
|
|
|
3
|
-
import transformer from '../1.6.0-level-to-
|
|
3
|
+
import transformer from '../1.6.0-level-to-size';
|
|
4
4
|
|
|
5
5
|
import { check } from './_framework';
|
|
6
6
|
|
|
7
7
|
check({
|
|
8
8
|
transformer,
|
|
9
|
-
it: 'should replace level with
|
|
9
|
+
it: 'should replace level with size only on Heading component',
|
|
10
10
|
original: `
|
|
11
11
|
import Heading from '@atlaskit/heading';
|
|
12
12
|
|
|
@@ -22,7 +22,7 @@ check({
|
|
|
22
22
|
|
|
23
23
|
function App() {
|
|
24
24
|
return <>
|
|
25
|
-
<Heading
|
|
25
|
+
<Heading size="large" as="h3">hello</Heading>
|
|
26
26
|
<SomethingElse level="h700">still here</SomethingElse>
|
|
27
27
|
</>;
|
|
28
28
|
}
|
|
@@ -48,7 +48,7 @@ check({
|
|
|
48
48
|
|
|
49
49
|
function App() {
|
|
50
50
|
return <>
|
|
51
|
-
<Heading
|
|
51
|
+
<Heading size="xxsmall">hello</Heading>
|
|
52
52
|
<Heading level="h200">hello</Heading>
|
|
53
53
|
<Heading level="h100">hello</Heading>
|
|
54
54
|
</>;
|
|
@@ -58,13 +58,13 @@ check({
|
|
|
58
58
|
|
|
59
59
|
check({
|
|
60
60
|
transformer,
|
|
61
|
-
it: 'should do nothing if
|
|
61
|
+
it: 'should do nothing if size already exists',
|
|
62
62
|
original: `
|
|
63
63
|
import Heading from '@atlaskit/heading';
|
|
64
64
|
|
|
65
65
|
function App() {
|
|
66
66
|
return <>
|
|
67
|
-
<Heading
|
|
67
|
+
<Heading size="large">hello</Heading>
|
|
68
68
|
</>;
|
|
69
69
|
}
|
|
70
70
|
`,
|
|
@@ -73,7 +73,7 @@ check({
|
|
|
73
73
|
|
|
74
74
|
function App() {
|
|
75
75
|
return <>
|
|
76
|
-
<Heading
|
|
76
|
+
<Heading size="large">hello</Heading>
|
|
77
77
|
</>;
|
|
78
78
|
}
|
|
79
79
|
`,
|
package/dist/cjs/heading.js
CHANGED
|
@@ -11,7 +11,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
11
11
|
var _react = require("@emotion/react");
|
|
12
12
|
var _headingContext = require("./heading-context");
|
|
13
13
|
var _heading = _interopRequireDefault(require("./heading.partial"));
|
|
14
|
-
var _excluded = ["level", "variant"];
|
|
14
|
+
var _excluded = ["level", "size", "variant"];
|
|
15
15
|
/** @jsx jsx */
|
|
16
16
|
// https://atlassian.design/foundations/typography
|
|
17
17
|
var levelMap = {
|
|
@@ -135,6 +135,7 @@ var Heading = function Heading(_ref) {
|
|
|
135
135
|
};
|
|
136
136
|
var _default = exports.default = function _default(_ref2) {
|
|
137
137
|
var level = _ref2.level,
|
|
138
|
+
size = _ref2.size,
|
|
138
139
|
variant = _ref2.variant,
|
|
139
140
|
props = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
140
141
|
return level ?
|
|
@@ -144,6 +145,7 @@ var _default = exports.default = function _default(_ref2) {
|
|
|
144
145
|
}, props)) :
|
|
145
146
|
// eslint-disable-next-line jsx-a11y/heading-has-content
|
|
146
147
|
(0, _react.jsx)(_heading.default, (0, _extends2.default)({
|
|
147
|
-
variant: variant
|
|
148
|
+
variant: variant,
|
|
149
|
+
size: size
|
|
148
150
|
}, props));
|
|
149
151
|
};
|
|
@@ -10,8 +10,7 @@ var _react = require("@emotion/react");
|
|
|
10
10
|
var _headingContext = require("./heading-context");
|
|
11
11
|
/** @jsx jsx */
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
var variantTagMap = {
|
|
13
|
+
var sizeTagMap = {
|
|
15
14
|
xxlarge: 'h1',
|
|
16
15
|
xlarge: 'h1',
|
|
17
16
|
large: 'h2',
|
|
@@ -38,11 +37,12 @@ var inverseStyles = (0, _react.css)({
|
|
|
38
37
|
* @example
|
|
39
38
|
*
|
|
40
39
|
* ```jsx
|
|
41
|
-
* <Heading
|
|
40
|
+
* <Heading size="xxlarge">Page title</Heading>
|
|
42
41
|
* ```
|
|
43
42
|
*/
|
|
44
43
|
var Heading = function Heading(_ref) {
|
|
45
44
|
var children = _ref.children,
|
|
45
|
+
size = _ref.size,
|
|
46
46
|
variant = _ref.variant,
|
|
47
47
|
id = _ref.id,
|
|
48
48
|
testId = _ref.testId,
|
|
@@ -53,9 +53,12 @@ var Heading = function Heading(_ref) {
|
|
|
53
53
|
throw new Error('`as` prop should be a string.');
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
// TODO: Temporary to move variant over to size
|
|
57
|
+
var localSize = variant || size;
|
|
58
|
+
|
|
59
|
+
// Technically size can be undefined here due to how the types work.
|
|
60
|
+
// Once removing the level prop this assertion can be removed since size will be a required prop.
|
|
61
|
+
var _useHeading = (0, _headingContext.useHeading)(sizeTagMap[localSize]),
|
|
59
62
|
_useHeading2 = (0, _slicedToArray2.default)(_useHeading, 2),
|
|
60
63
|
hLevel = _useHeading2[0],
|
|
61
64
|
inferredElement = _useHeading2[1];
|
|
@@ -66,17 +69,17 @@ var Heading = function Heading(_ref) {
|
|
|
66
69
|
"data-testid": testId,
|
|
67
70
|
role: needsAriaRole ? 'heading' : undefined,
|
|
68
71
|
"aria-level": needsAriaRole ? hLevel : undefined,
|
|
69
|
-
css: [headingResetStyles,
|
|
72
|
+
css: [headingResetStyles, localSize && headingSizeStylesMap[localSize], color === 'inverse' && inverseStyles]
|
|
70
73
|
}, children);
|
|
71
74
|
};
|
|
72
75
|
|
|
73
76
|
/**
|
|
74
77
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
75
|
-
* @codegen <<SignedSource::
|
|
78
|
+
* @codegen <<SignedSource::057c0fe2015c2071afe3d694c5afcc0e>>
|
|
76
79
|
* @codegenId typography
|
|
77
80
|
* @codegenCommand yarn workspace @atlaskit/heading codegen
|
|
78
81
|
*/
|
|
79
|
-
var
|
|
82
|
+
var headingSizeStylesMap = {
|
|
80
83
|
xxlarge: (0, _react.css)({
|
|
81
84
|
font: "var(--ds-font-heading-xxlarge, normal 500 35px/40px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
82
85
|
}),
|
package/dist/es2019/heading.js
CHANGED
|
@@ -122,6 +122,7 @@ const Heading = ({
|
|
|
122
122
|
};
|
|
123
123
|
export default (({
|
|
124
124
|
level,
|
|
125
|
+
size,
|
|
125
126
|
variant,
|
|
126
127
|
...props
|
|
127
128
|
}) => {
|
|
@@ -132,6 +133,7 @@ export default (({
|
|
|
132
133
|
}, props)) :
|
|
133
134
|
// eslint-disable-next-line jsx-a11y/heading-has-content
|
|
134
135
|
jsx(NewHeading, _extends({
|
|
135
|
-
variant: variant
|
|
136
|
+
variant: variant,
|
|
137
|
+
size: size
|
|
136
138
|
}, props));
|
|
137
139
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { css, jsx } from '@emotion/react';
|
|
3
3
|
import { useHeading } from './heading-context';
|
|
4
|
-
|
|
5
|
-
const variantTagMap = {
|
|
4
|
+
const sizeTagMap = {
|
|
6
5
|
xxlarge: 'h1',
|
|
7
6
|
xlarge: 'h1',
|
|
8
7
|
large: 'h2',
|
|
@@ -29,11 +28,12 @@ const inverseStyles = css({
|
|
|
29
28
|
* @example
|
|
30
29
|
*
|
|
31
30
|
* ```jsx
|
|
32
|
-
* <Heading
|
|
31
|
+
* <Heading size="xxlarge">Page title</Heading>
|
|
33
32
|
* ```
|
|
34
33
|
*/
|
|
35
34
|
const Heading = ({
|
|
36
35
|
children,
|
|
36
|
+
size,
|
|
37
37
|
variant,
|
|
38
38
|
id,
|
|
39
39
|
testId,
|
|
@@ -44,9 +44,12 @@ const Heading = ({
|
|
|
44
44
|
throw new Error('`as` prop should be a string.');
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
//
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
// TODO: Temporary to move variant over to size
|
|
48
|
+
const localSize = variant || size;
|
|
49
|
+
|
|
50
|
+
// Technically size can be undefined here due to how the types work.
|
|
51
|
+
// Once removing the level prop this assertion can be removed since size will be a required prop.
|
|
52
|
+
const [hLevel, inferredElement] = useHeading(sizeTagMap[localSize]);
|
|
50
53
|
const Component = as || inferredElement;
|
|
51
54
|
const needsAriaRole = Component === 'div' && hLevel;
|
|
52
55
|
return jsx(Component, {
|
|
@@ -54,17 +57,17 @@ const Heading = ({
|
|
|
54
57
|
"data-testid": testId,
|
|
55
58
|
role: needsAriaRole ? 'heading' : undefined,
|
|
56
59
|
"aria-level": needsAriaRole ? hLevel : undefined,
|
|
57
|
-
css: [headingResetStyles,
|
|
60
|
+
css: [headingResetStyles, localSize && headingSizeStylesMap[localSize], color === 'inverse' && inverseStyles]
|
|
58
61
|
}, children);
|
|
59
62
|
};
|
|
60
63
|
|
|
61
64
|
/**
|
|
62
65
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
63
|
-
* @codegen <<SignedSource::
|
|
66
|
+
* @codegen <<SignedSource::057c0fe2015c2071afe3d694c5afcc0e>>
|
|
64
67
|
* @codegenId typography
|
|
65
68
|
* @codegenCommand yarn workspace @atlaskit/heading codegen
|
|
66
69
|
*/
|
|
67
|
-
const
|
|
70
|
+
const headingSizeStylesMap = {
|
|
68
71
|
xxlarge: css({
|
|
69
72
|
font: "var(--ds-font-heading-xxlarge, normal 500 35px/40px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
70
73
|
}),
|
package/dist/esm/heading.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
-
var _excluded = ["level", "variant"];
|
|
4
|
+
var _excluded = ["level", "size", "variant"];
|
|
5
5
|
/** @jsx jsx */
|
|
6
6
|
import { css, jsx } from '@emotion/react';
|
|
7
7
|
import { useHeading } from './heading-context';
|
|
@@ -128,6 +128,7 @@ var Heading = function Heading(_ref) {
|
|
|
128
128
|
};
|
|
129
129
|
export default (function (_ref2) {
|
|
130
130
|
var level = _ref2.level,
|
|
131
|
+
size = _ref2.size,
|
|
131
132
|
variant = _ref2.variant,
|
|
132
133
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
133
134
|
return level ?
|
|
@@ -137,6 +138,7 @@ export default (function (_ref2) {
|
|
|
137
138
|
}, props)) :
|
|
138
139
|
// eslint-disable-next-line jsx-a11y/heading-has-content
|
|
139
140
|
jsx(NewHeading, _extends({
|
|
140
|
-
variant: variant
|
|
141
|
+
variant: variant,
|
|
142
|
+
size: size
|
|
141
143
|
}, props));
|
|
142
144
|
});
|
|
@@ -2,8 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { useHeading } from './heading-context';
|
|
5
|
-
|
|
6
|
-
var variantTagMap = {
|
|
5
|
+
var sizeTagMap = {
|
|
7
6
|
xxlarge: 'h1',
|
|
8
7
|
xlarge: 'h1',
|
|
9
8
|
large: 'h2',
|
|
@@ -30,11 +29,12 @@ var inverseStyles = css({
|
|
|
30
29
|
* @example
|
|
31
30
|
*
|
|
32
31
|
* ```jsx
|
|
33
|
-
* <Heading
|
|
32
|
+
* <Heading size="xxlarge">Page title</Heading>
|
|
34
33
|
* ```
|
|
35
34
|
*/
|
|
36
35
|
var Heading = function Heading(_ref) {
|
|
37
36
|
var children = _ref.children,
|
|
37
|
+
size = _ref.size,
|
|
38
38
|
variant = _ref.variant,
|
|
39
39
|
id = _ref.id,
|
|
40
40
|
testId = _ref.testId,
|
|
@@ -45,9 +45,12 @@ var Heading = function Heading(_ref) {
|
|
|
45
45
|
throw new Error('`as` prop should be a string.');
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
// TODO: Temporary to move variant over to size
|
|
49
|
+
var localSize = variant || size;
|
|
50
|
+
|
|
51
|
+
// Technically size can be undefined here due to how the types work.
|
|
52
|
+
// Once removing the level prop this assertion can be removed since size will be a required prop.
|
|
53
|
+
var _useHeading = useHeading(sizeTagMap[localSize]),
|
|
51
54
|
_useHeading2 = _slicedToArray(_useHeading, 2),
|
|
52
55
|
hLevel = _useHeading2[0],
|
|
53
56
|
inferredElement = _useHeading2[1];
|
|
@@ -58,17 +61,17 @@ var Heading = function Heading(_ref) {
|
|
|
58
61
|
"data-testid": testId,
|
|
59
62
|
role: needsAriaRole ? 'heading' : undefined,
|
|
60
63
|
"aria-level": needsAriaRole ? hLevel : undefined,
|
|
61
|
-
css: [headingResetStyles,
|
|
64
|
+
css: [headingResetStyles, localSize && headingSizeStylesMap[localSize], color === 'inverse' && inverseStyles]
|
|
62
65
|
}, children);
|
|
63
66
|
};
|
|
64
67
|
|
|
65
68
|
/**
|
|
66
69
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
67
|
-
* @codegen <<SignedSource::
|
|
70
|
+
* @codegen <<SignedSource::057c0fe2015c2071afe3d694c5afcc0e>>
|
|
68
71
|
* @codegenId typography
|
|
69
72
|
* @codegenCommand yarn workspace @atlaskit/heading codegen
|
|
70
73
|
*/
|
|
71
|
-
var
|
|
74
|
+
var headingSizeStylesMap = {
|
|
72
75
|
xxlarge: css({
|
|
73
76
|
font: "var(--ds-font-heading-xxlarge, normal 500 35px/40px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)"
|
|
74
77
|
}),
|
package/dist/types/heading.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
3
|
import type { HeadingProps } from './types';
|
|
4
|
-
declare const _default: ({ level, variant, ...props }: HeadingProps) => jsx.JSX.Element;
|
|
4
|
+
declare const _default: ({ level, size, variant, ...props }: HeadingProps) => jsx.JSX.Element;
|
|
5
5
|
export default _default;
|
|
@@ -9,17 +9,17 @@ import type { HeadingProps } from './types';
|
|
|
9
9
|
* @example
|
|
10
10
|
*
|
|
11
11
|
* ```jsx
|
|
12
|
-
* <Heading
|
|
12
|
+
* <Heading size="xxlarge">Page title</Heading>
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
|
-
declare const Heading: ({ children, variant, id, testId, as, color, }: HeadingProps) => jsx.JSX.Element;
|
|
15
|
+
declare const Heading: ({ children, size, variant, id, testId, as, color, }: HeadingProps) => jsx.JSX.Element;
|
|
16
16
|
/**
|
|
17
17
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
18
|
-
* @codegen <<SignedSource::
|
|
18
|
+
* @codegen <<SignedSource::057c0fe2015c2071afe3d694c5afcc0e>>
|
|
19
19
|
* @codegenId typography
|
|
20
20
|
* @codegenCommand yarn workspace @atlaskit/heading codegen
|
|
21
21
|
*/
|
|
22
|
-
declare const
|
|
22
|
+
declare const headingSizeStylesMap: {
|
|
23
23
|
xxlarge: import("@emotion/react").SerializedStyles;
|
|
24
24
|
xlarge: import("@emotion/react").SerializedStyles;
|
|
25
25
|
large: import("@emotion/react").SerializedStyles;
|
|
@@ -28,7 +28,7 @@ declare const headingVariantStylesMap: {
|
|
|
28
28
|
xsmall: import("@emotion/react").SerializedStyles;
|
|
29
29
|
xxsmall: import("@emotion/react").SerializedStyles;
|
|
30
30
|
};
|
|
31
|
-
export type
|
|
31
|
+
export type HeadingSize = keyof typeof headingSizeStylesMap;
|
|
32
32
|
/**
|
|
33
33
|
* @codegenEnd
|
|
34
34
|
*/
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { HeadingSize } from './heading.partial';
|
|
3
3
|
export type HeadingProps = {
|
|
4
4
|
/**
|
|
5
5
|
* A `testId` prop is provided for specified elements, which is a unique
|
|
@@ -27,7 +27,7 @@ export type HeadingProps = {
|
|
|
27
27
|
} & ({
|
|
28
28
|
/**
|
|
29
29
|
* @private
|
|
30
|
-
* @deprecated Use `
|
|
30
|
+
* @deprecated Use `size` prop instead.
|
|
31
31
|
* The heading level as defined by the Atlassian Design [typography foundations](/foundations/typography/). The `level` prop affects the actual HTML element rendered in the DOM:
|
|
32
32
|
* @example
|
|
33
33
|
* ```js
|
|
@@ -49,17 +49,21 @@ export type HeadingProps = {
|
|
|
49
49
|
*/
|
|
50
50
|
level: 'h900' | 'h800' | 'h700' | 'h600' | 'h500' | 'h400' | 'h300' | 'h200' | 'h100';
|
|
51
51
|
/**
|
|
52
|
-
* Heading
|
|
53
|
-
* Use instead of the deprecated `level` prop.
|
|
52
|
+
* Heading size. Use instead of the deprecated `level` prop.
|
|
54
53
|
*/
|
|
54
|
+
size?: never;
|
|
55
55
|
variant?: never;
|
|
56
56
|
} | {
|
|
57
57
|
level?: never;
|
|
58
58
|
/**
|
|
59
|
-
* Heading
|
|
59
|
+
* Heading size. This value is detached from the specific heading level applied to allow for more flexibility.
|
|
60
60
|
* Use instead of the deprecated `level` prop.
|
|
61
61
|
*
|
|
62
|
-
* This prop will only work if the typography theme is applied.
|
|
62
|
+
* This prop will only work if the typography tokens theme is applied on the page.
|
|
63
|
+
*/
|
|
64
|
+
size?: HeadingSize;
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated. Use `size` instead.
|
|
63
67
|
*/
|
|
64
|
-
variant
|
|
68
|
+
variant?: HeadingSize;
|
|
65
69
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
3
|
import type { HeadingProps } from './types';
|
|
4
|
-
declare const _default: ({ level, variant, ...props }: HeadingProps) => jsx.JSX.Element;
|
|
4
|
+
declare const _default: ({ level, size, variant, ...props }: HeadingProps) => jsx.JSX.Element;
|
|
5
5
|
export default _default;
|
|
@@ -9,17 +9,17 @@ import type { HeadingProps } from './types';
|
|
|
9
9
|
* @example
|
|
10
10
|
*
|
|
11
11
|
* ```jsx
|
|
12
|
-
* <Heading
|
|
12
|
+
* <Heading size="xxlarge">Page title</Heading>
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
|
-
declare const Heading: ({ children, variant, id, testId, as, color, }: HeadingProps) => jsx.JSX.Element;
|
|
15
|
+
declare const Heading: ({ children, size, variant, id, testId, as, color, }: HeadingProps) => jsx.JSX.Element;
|
|
16
16
|
/**
|
|
17
17
|
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
18
|
-
* @codegen <<SignedSource::
|
|
18
|
+
* @codegen <<SignedSource::057c0fe2015c2071afe3d694c5afcc0e>>
|
|
19
19
|
* @codegenId typography
|
|
20
20
|
* @codegenCommand yarn workspace @atlaskit/heading codegen
|
|
21
21
|
*/
|
|
22
|
-
declare const
|
|
22
|
+
declare const headingSizeStylesMap: {
|
|
23
23
|
xxlarge: import("@emotion/react").SerializedStyles;
|
|
24
24
|
xlarge: import("@emotion/react").SerializedStyles;
|
|
25
25
|
large: import("@emotion/react").SerializedStyles;
|
|
@@ -28,7 +28,7 @@ declare const headingVariantStylesMap: {
|
|
|
28
28
|
xsmall: import("@emotion/react").SerializedStyles;
|
|
29
29
|
xxsmall: import("@emotion/react").SerializedStyles;
|
|
30
30
|
};
|
|
31
|
-
export type
|
|
31
|
+
export type HeadingSize = keyof typeof headingSizeStylesMap;
|
|
32
32
|
/**
|
|
33
33
|
* @codegenEnd
|
|
34
34
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { HeadingSize } from './heading.partial';
|
|
3
3
|
export type HeadingProps = {
|
|
4
4
|
/**
|
|
5
5
|
* A `testId` prop is provided for specified elements, which is a unique
|
|
@@ -27,7 +27,7 @@ export type HeadingProps = {
|
|
|
27
27
|
} & ({
|
|
28
28
|
/**
|
|
29
29
|
* @private
|
|
30
|
-
* @deprecated Use `
|
|
30
|
+
* @deprecated Use `size` prop instead.
|
|
31
31
|
* The heading level as defined by the Atlassian Design [typography foundations](/foundations/typography/). The `level` prop affects the actual HTML element rendered in the DOM:
|
|
32
32
|
* @example
|
|
33
33
|
* ```js
|
|
@@ -49,17 +49,21 @@ export type HeadingProps = {
|
|
|
49
49
|
*/
|
|
50
50
|
level: 'h900' | 'h800' | 'h700' | 'h600' | 'h500' | 'h400' | 'h300' | 'h200' | 'h100';
|
|
51
51
|
/**
|
|
52
|
-
* Heading
|
|
53
|
-
* Use instead of the deprecated `level` prop.
|
|
52
|
+
* Heading size. Use instead of the deprecated `level` prop.
|
|
54
53
|
*/
|
|
54
|
+
size?: never;
|
|
55
55
|
variant?: never;
|
|
56
56
|
} | {
|
|
57
57
|
level?: never;
|
|
58
58
|
/**
|
|
59
|
-
* Heading
|
|
59
|
+
* Heading size. This value is detached from the specific heading level applied to allow for more flexibility.
|
|
60
60
|
* Use instead of the deprecated `level` prop.
|
|
61
61
|
*
|
|
62
|
-
* This prop will only work if the typography theme is applied.
|
|
62
|
+
* This prop will only work if the typography tokens theme is applied on the page.
|
|
63
|
+
*/
|
|
64
|
+
size?: HeadingSize;
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated. Use `size` instead.
|
|
63
67
|
*/
|
|
64
|
-
variant
|
|
68
|
+
variant?: HeadingSize;
|
|
65
69
|
});
|
package/package.json
CHANGED
package/scripts/codegen.tsx
CHANGED
|
@@ -26,7 +26,7 @@ export const createTypographyStylesFromTemplate = () => {
|
|
|
26
26
|
return (
|
|
27
27
|
prettier.format(
|
|
28
28
|
`
|
|
29
|
-
const
|
|
29
|
+
const headingSizeStylesMap = {
|
|
30
30
|
${headingTokens
|
|
31
31
|
.map(token => {
|
|
32
32
|
return `
|
|
@@ -46,7 +46,7 @@ const headingVariantStylesMap = {
|
|
|
46
46
|
parser: 'typescript',
|
|
47
47
|
plugins: [parserTypeScript],
|
|
48
48
|
},
|
|
49
|
-
) + `\nexport type
|
|
49
|
+
) + `\nexport type HeadingSize = keyof typeof headingSizeStylesMap;\n`
|
|
50
50
|
);
|
|
51
51
|
};
|
|
52
52
|
|