@atlaskit/heading 1.0.4 → 1.1.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/constellation/index/examples.mdx +13 -0
- package/dist/cjs/heading-context.js +1 -10
- package/dist/cjs/heading.js +41 -45
- package/dist/cjs/index.js +0 -3
- package/dist/cjs/utils.js +0 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/heading-context.js +0 -2
- package/dist/es2019/heading.js +35 -35
- package/dist/es2019/version.json +1 -1
- package/dist/esm/heading-context.js +1 -3
- package/dist/esm/heading.js +41 -42
- package/dist/esm/version.json +1 -1
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/heading
|
|
2
2
|
|
|
3
|
+
## 1.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`18aeca8c199`](https://bitbucket.org/atlassian/atlassian-frontend/commits/18aeca8c199) - Internal change to update token references. There is no expected behaviour or visual change.
|
|
8
|
+
|
|
9
|
+
## 1.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`fce52a022f5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fce52a022f5) - Adds typography tokens to @atlaskit/heading.
|
|
14
|
+
|
|
3
15
|
## 1.0.4
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 0
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
import HeadingDefault from '../../examples/constellation/heading-default';
|
|
6
|
+
|
|
7
|
+
## Basic
|
|
8
|
+
|
|
9
|
+
Implements the Atlassian typography set as a component. The typography `level` can be configured to be one of the below types.
|
|
10
|
+
|
|
11
|
+
<Example Component={HeadingDefault} packageName="@atlaskit/heading" />
|
|
12
|
+
|
|
13
|
+
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.useHeadingElement = exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
|
|
14
10
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
|
|
16
11
|
var HeadingContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
17
|
-
|
|
18
12
|
var useHeadingElement = function useHeadingElement() {
|
|
19
13
|
return Math.min((0, _react.useContext)(HeadingContext) || 0, 6);
|
|
20
14
|
};
|
|
21
|
-
|
|
22
15
|
exports.useHeadingElement = useHeadingElement;
|
|
23
|
-
|
|
24
16
|
/**
|
|
25
17
|
* __Heading context__
|
|
26
18
|
*
|
|
@@ -39,13 +31,12 @@ exports.useHeadingElement = useHeadingElement;
|
|
|
39
31
|
*/
|
|
40
32
|
var HeadingContextProvider = function HeadingContextProvider(_ref) {
|
|
41
33
|
var children = _ref.children,
|
|
42
|
-
|
|
34
|
+
value = _ref.value;
|
|
43
35
|
var parentHeadingLevel = useHeadingElement();
|
|
44
36
|
var headingLevel = parentHeadingLevel + 1;
|
|
45
37
|
return /*#__PURE__*/_react.default.createElement(HeadingContext.Provider, {
|
|
46
38
|
value: value || headingLevel
|
|
47
39
|
}, children);
|
|
48
40
|
};
|
|
49
|
-
|
|
50
41
|
var _default = HeadingContextProvider;
|
|
51
42
|
exports.default = _default;
|
package/dist/cjs/heading.js
CHANGED
|
@@ -4,12 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = require("@emotion/react");
|
|
9
|
-
|
|
10
8
|
var _headingContext = require("./heading-context");
|
|
11
|
-
|
|
12
9
|
/** @jsx jsx */
|
|
10
|
+
|
|
13
11
|
// https://atlassian.design/foundations/typography
|
|
14
12
|
var levelMap = {
|
|
15
13
|
h900: 'h1',
|
|
@@ -24,64 +22,64 @@ var levelMap = {
|
|
|
24
22
|
h100: 'div'
|
|
25
23
|
};
|
|
26
24
|
var headingResetStyles = (0, _react.css)({
|
|
27
|
-
marginTop: "var(--ds-
|
|
28
|
-
marginBottom: "var(--ds-
|
|
25
|
+
marginTop: "var(--ds-space-0, 0px)",
|
|
26
|
+
marginBottom: "var(--ds-space-0, 0px)",
|
|
29
27
|
color: "var(--ds-text, #172B4D)"
|
|
30
28
|
});
|
|
31
29
|
var h900Styles = (0, _react.css)({
|
|
32
|
-
fontSize:
|
|
33
|
-
fontWeight: 500,
|
|
30
|
+
fontSize: "var(--ds-font-size-600, 35px)",
|
|
31
|
+
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
34
32
|
letterSpacing: '-0.01em',
|
|
35
|
-
lineHeight:
|
|
33
|
+
lineHeight: "var(--ds-font-lineHeight-600, 40px)"
|
|
36
34
|
});
|
|
37
35
|
var h800Styles = (0, _react.css)({
|
|
38
|
-
fontSize:
|
|
39
|
-
fontWeight: 600,
|
|
36
|
+
fontSize: "var(--ds-font-size-500, 29px)",
|
|
37
|
+
fontWeight: "var(--ds-font-weight-semibold, 600)",
|
|
40
38
|
letterSpacing: '-0.01em',
|
|
41
|
-
lineHeight:
|
|
39
|
+
lineHeight: "var(--ds-font-lineHeight-500, 32px)"
|
|
42
40
|
});
|
|
43
41
|
var h700Styles = (0, _react.css)({
|
|
44
|
-
fontSize:
|
|
45
|
-
fontWeight: 500,
|
|
42
|
+
fontSize: "var(--ds-font-size-400, 24px)",
|
|
43
|
+
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
46
44
|
letterSpacing: '-0.01em',
|
|
47
|
-
lineHeight:
|
|
45
|
+
lineHeight: "var(--ds-font-lineHeight-400, 28px)"
|
|
48
46
|
});
|
|
49
47
|
var h600Styles = (0, _react.css)({
|
|
50
|
-
fontSize:
|
|
51
|
-
fontWeight: 500,
|
|
48
|
+
fontSize: "var(--ds-font-size-300, 20px)",
|
|
49
|
+
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
52
50
|
letterSpacing: '-0.008em',
|
|
53
|
-
lineHeight:
|
|
51
|
+
lineHeight: "var(--ds-font-lineHeight-300, 24px)"
|
|
54
52
|
});
|
|
55
53
|
var h500Styles = (0, _react.css)({
|
|
56
|
-
fontSize:
|
|
57
|
-
fontWeight: 600,
|
|
54
|
+
fontSize: "var(--ds-font-size-200, 16px)",
|
|
55
|
+
fontWeight: "var(--ds-font-weight-semibold, 600)",
|
|
58
56
|
letterSpacing: '-0.006em',
|
|
59
|
-
lineHeight:
|
|
57
|
+
lineHeight: "var(--ds-font-lineHeight-200, 20px)"
|
|
60
58
|
});
|
|
61
59
|
var h400Styles = (0, _react.css)({
|
|
62
|
-
fontSize:
|
|
63
|
-
fontWeight: 600,
|
|
60
|
+
fontSize: "var(--ds-font-size-100, 14px)",
|
|
61
|
+
fontWeight: "var(--ds-font-weight-semibold, 600)",
|
|
64
62
|
letterSpacing: '-0.003em',
|
|
65
|
-
lineHeight:
|
|
63
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)"
|
|
66
64
|
});
|
|
67
65
|
var h300Styles = (0, _react.css)({
|
|
68
|
-
fontSize:
|
|
69
|
-
fontWeight: 600,
|
|
66
|
+
fontSize: "var(--ds-font-size-075, 12px)",
|
|
67
|
+
fontWeight: "var(--ds-font-weight-semibold, 600)",
|
|
70
68
|
letterSpacing: 0,
|
|
71
|
-
lineHeight:
|
|
69
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)",
|
|
72
70
|
textTransform: 'uppercase'
|
|
73
71
|
});
|
|
74
72
|
var h200Styles = (0, _react.css)({
|
|
75
|
-
fontSize:
|
|
76
|
-
fontWeight: 600,
|
|
73
|
+
fontSize: "var(--ds-font-size-075, 12px)",
|
|
74
|
+
fontWeight: "var(--ds-font-weight-semibold, 600)",
|
|
77
75
|
letterSpacing: 0,
|
|
78
|
-
lineHeight:
|
|
76
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)"
|
|
79
77
|
});
|
|
80
78
|
var h100Styles = (0, _react.css)({
|
|
81
|
-
fontSize:
|
|
82
|
-
fontWeight: 700,
|
|
79
|
+
fontSize: "var(--ds-font-size-050, 11px)",
|
|
80
|
+
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
83
81
|
letterSpacing: 0,
|
|
84
|
-
lineHeight:
|
|
82
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)"
|
|
85
83
|
});
|
|
86
84
|
var inverseStyles = (0, _react.css)({
|
|
87
85
|
color: "var(--ds-text-inverse, #FFF)"
|
|
@@ -89,6 +87,7 @@ var inverseStyles = (0, _react.css)({
|
|
|
89
87
|
var subtlestStyles = (0, _react.css)({
|
|
90
88
|
color: "var(--ds-text-subtlest, #6B778C)"
|
|
91
89
|
});
|
|
90
|
+
|
|
92
91
|
/**
|
|
93
92
|
* __Heading__
|
|
94
93
|
*
|
|
@@ -104,20 +103,17 @@ var subtlestStyles = (0, _react.css)({
|
|
|
104
103
|
* );
|
|
105
104
|
* ```
|
|
106
105
|
*/
|
|
107
|
-
|
|
108
106
|
var Heading = function Heading(_ref) {
|
|
109
107
|
var children = _ref.children,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
108
|
+
level = _ref.level,
|
|
109
|
+
id = _ref.id,
|
|
110
|
+
testId = _ref.testId,
|
|
111
|
+
as = _ref.as,
|
|
112
|
+
_ref$color = _ref.color,
|
|
113
|
+
color = _ref$color === void 0 ? 'default' : _ref$color;
|
|
117
114
|
if (process.env.NODE_ENV !== 'production' && as && typeof as !== 'string') {
|
|
118
115
|
throw new Error('`as` prop should be a string.');
|
|
119
116
|
}
|
|
120
|
-
|
|
121
117
|
var hLevel = (0, _headingContext.useHeadingElement)();
|
|
122
118
|
/**
|
|
123
119
|
* Order here is important, we for now apply
|
|
@@ -125,18 +121,18 @@ var Heading = function Heading(_ref) {
|
|
|
125
121
|
* 2. inferred a11y level
|
|
126
122
|
* 3. default final fallback
|
|
127
123
|
*/
|
|
128
|
-
|
|
129
124
|
var Markup = as || hLevel && "h".concat(hLevel) || levelMap[level];
|
|
130
125
|
var isSubtleHeading = level === 'h200' || level === 'h100';
|
|
131
126
|
return (0, _react.jsx)(Markup, {
|
|
132
127
|
id: id,
|
|
133
|
-
"data-testid": testId
|
|
128
|
+
"data-testid": testId
|
|
129
|
+
// @ts-ignore
|
|
134
130
|
// Resolved by https://github.com/atlassian-labs/compiled/pull/1321
|
|
135
131
|
,
|
|
136
|
-
css: [headingResetStyles,
|
|
132
|
+
css: [headingResetStyles,
|
|
133
|
+
// This can be refactored when @compiled supports style maps
|
|
137
134
|
level === 'h100' && h100Styles, level === 'h200' && h200Styles, level === 'h300' && h300Styles, level === 'h400' && h400Styles, level === 'h500' && h500Styles, level === 'h600' && h600Styles, level === 'h700' && h700Styles, level === 'h800' && h800Styles, level === 'h900' && h900Styles, color === 'inverse' && inverseStyles, color === 'default' && isSubtleHeading && subtlestStyles]
|
|
138
135
|
}, children);
|
|
139
136
|
};
|
|
140
|
-
|
|
141
137
|
var _default = Heading;
|
|
142
138
|
exports.default = _default;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -17,7 +16,5 @@ Object.defineProperty(exports, "default", {
|
|
|
17
16
|
return _heading.default;
|
|
18
17
|
}
|
|
19
18
|
});
|
|
20
|
-
|
|
21
19
|
var _heading = _interopRequireDefault(require("./heading"));
|
|
22
|
-
|
|
23
20
|
var _headingContext = _interopRequireDefault(require("./heading-context"));
|
package/dist/cjs/utils.js
CHANGED
package/dist/cjs/version.json
CHANGED
|
@@ -3,7 +3,6 @@ const HeadingContext = /*#__PURE__*/createContext(undefined);
|
|
|
3
3
|
export const useHeadingElement = () => {
|
|
4
4
|
return Math.min(useContext(HeadingContext) || 0, 6);
|
|
5
5
|
};
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* __Heading context__
|
|
9
8
|
*
|
|
@@ -30,5 +29,4 @@ const HeadingContextProvider = ({
|
|
|
30
29
|
value: value || headingLevel
|
|
31
30
|
}, children);
|
|
32
31
|
};
|
|
33
|
-
|
|
34
32
|
export default HeadingContextProvider;
|
package/dist/es2019/heading.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
|
|
2
3
|
import { css, jsx } from '@emotion/react';
|
|
3
4
|
import { useHeadingElement } from './heading-context';
|
|
4
5
|
// https://atlassian.design/foundations/typography
|
|
@@ -15,64 +16,64 @@ const levelMap = {
|
|
|
15
16
|
h100: 'div'
|
|
16
17
|
};
|
|
17
18
|
const headingResetStyles = css({
|
|
18
|
-
marginTop: "var(--ds-
|
|
19
|
-
marginBottom: "var(--ds-
|
|
19
|
+
marginTop: "var(--ds-space-0, 0px)",
|
|
20
|
+
marginBottom: "var(--ds-space-0, 0px)",
|
|
20
21
|
color: "var(--ds-text, #172B4D)"
|
|
21
22
|
});
|
|
22
23
|
const h900Styles = css({
|
|
23
|
-
fontSize:
|
|
24
|
-
fontWeight: 500,
|
|
24
|
+
fontSize: "var(--ds-font-size-600, 35px)",
|
|
25
|
+
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
25
26
|
letterSpacing: '-0.01em',
|
|
26
|
-
lineHeight:
|
|
27
|
+
lineHeight: "var(--ds-font-lineHeight-600, 40px)"
|
|
27
28
|
});
|
|
28
29
|
const h800Styles = css({
|
|
29
|
-
fontSize:
|
|
30
|
-
fontWeight: 600,
|
|
30
|
+
fontSize: "var(--ds-font-size-500, 29px)",
|
|
31
|
+
fontWeight: "var(--ds-font-weight-semibold, 600)",
|
|
31
32
|
letterSpacing: '-0.01em',
|
|
32
|
-
lineHeight:
|
|
33
|
+
lineHeight: "var(--ds-font-lineHeight-500, 32px)"
|
|
33
34
|
});
|
|
34
35
|
const h700Styles = css({
|
|
35
|
-
fontSize:
|
|
36
|
-
fontWeight: 500,
|
|
36
|
+
fontSize: "var(--ds-font-size-400, 24px)",
|
|
37
|
+
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
37
38
|
letterSpacing: '-0.01em',
|
|
38
|
-
lineHeight:
|
|
39
|
+
lineHeight: "var(--ds-font-lineHeight-400, 28px)"
|
|
39
40
|
});
|
|
40
41
|
const h600Styles = css({
|
|
41
|
-
fontSize:
|
|
42
|
-
fontWeight: 500,
|
|
42
|
+
fontSize: "var(--ds-font-size-300, 20px)",
|
|
43
|
+
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
43
44
|
letterSpacing: '-0.008em',
|
|
44
|
-
lineHeight:
|
|
45
|
+
lineHeight: "var(--ds-font-lineHeight-300, 24px)"
|
|
45
46
|
});
|
|
46
47
|
const h500Styles = css({
|
|
47
|
-
fontSize:
|
|
48
|
-
fontWeight: 600,
|
|
48
|
+
fontSize: "var(--ds-font-size-200, 16px)",
|
|
49
|
+
fontWeight: "var(--ds-font-weight-semibold, 600)",
|
|
49
50
|
letterSpacing: '-0.006em',
|
|
50
|
-
lineHeight:
|
|
51
|
+
lineHeight: "var(--ds-font-lineHeight-200, 20px)"
|
|
51
52
|
});
|
|
52
53
|
const h400Styles = css({
|
|
53
|
-
fontSize:
|
|
54
|
-
fontWeight: 600,
|
|
54
|
+
fontSize: "var(--ds-font-size-100, 14px)",
|
|
55
|
+
fontWeight: "var(--ds-font-weight-semibold, 600)",
|
|
55
56
|
letterSpacing: '-0.003em',
|
|
56
|
-
lineHeight:
|
|
57
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)"
|
|
57
58
|
});
|
|
58
59
|
const h300Styles = css({
|
|
59
|
-
fontSize:
|
|
60
|
-
fontWeight: 600,
|
|
60
|
+
fontSize: "var(--ds-font-size-075, 12px)",
|
|
61
|
+
fontWeight: "var(--ds-font-weight-semibold, 600)",
|
|
61
62
|
letterSpacing: 0,
|
|
62
|
-
lineHeight:
|
|
63
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)",
|
|
63
64
|
textTransform: 'uppercase'
|
|
64
65
|
});
|
|
65
66
|
const h200Styles = css({
|
|
66
|
-
fontSize:
|
|
67
|
-
fontWeight: 600,
|
|
67
|
+
fontSize: "var(--ds-font-size-075, 12px)",
|
|
68
|
+
fontWeight: "var(--ds-font-weight-semibold, 600)",
|
|
68
69
|
letterSpacing: 0,
|
|
69
|
-
lineHeight:
|
|
70
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)"
|
|
70
71
|
});
|
|
71
72
|
const h100Styles = css({
|
|
72
|
-
fontSize:
|
|
73
|
-
fontWeight: 700,
|
|
73
|
+
fontSize: "var(--ds-font-size-050, 11px)",
|
|
74
|
+
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
74
75
|
letterSpacing: 0,
|
|
75
|
-
lineHeight:
|
|
76
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)"
|
|
76
77
|
});
|
|
77
78
|
const inverseStyles = css({
|
|
78
79
|
color: "var(--ds-text-inverse, #FFF)"
|
|
@@ -80,6 +81,7 @@ const inverseStyles = css({
|
|
|
80
81
|
const subtlestStyles = css({
|
|
81
82
|
color: "var(--ds-text-subtlest, #6B778C)"
|
|
82
83
|
});
|
|
84
|
+
|
|
83
85
|
/**
|
|
84
86
|
* __Heading__
|
|
85
87
|
*
|
|
@@ -95,7 +97,6 @@ const subtlestStyles = css({
|
|
|
95
97
|
* );
|
|
96
98
|
* ```
|
|
97
99
|
*/
|
|
98
|
-
|
|
99
100
|
const Heading = ({
|
|
100
101
|
children,
|
|
101
102
|
level,
|
|
@@ -107,7 +108,6 @@ const Heading = ({
|
|
|
107
108
|
if (process.env.NODE_ENV !== 'production' && as && typeof as !== 'string') {
|
|
108
109
|
throw new Error('`as` prop should be a string.');
|
|
109
110
|
}
|
|
110
|
-
|
|
111
111
|
const hLevel = useHeadingElement();
|
|
112
112
|
/**
|
|
113
113
|
* Order here is important, we for now apply
|
|
@@ -115,17 +115,17 @@ const Heading = ({
|
|
|
115
115
|
* 2. inferred a11y level
|
|
116
116
|
* 3. default final fallback
|
|
117
117
|
*/
|
|
118
|
-
|
|
119
118
|
const Markup = as || hLevel && `h${hLevel}` || levelMap[level];
|
|
120
119
|
const isSubtleHeading = level === 'h200' || level === 'h100';
|
|
121
120
|
return jsx(Markup, {
|
|
122
121
|
id: id,
|
|
123
|
-
"data-testid": testId
|
|
122
|
+
"data-testid": testId
|
|
123
|
+
// @ts-ignore
|
|
124
124
|
// Resolved by https://github.com/atlassian-labs/compiled/pull/1321
|
|
125
125
|
,
|
|
126
|
-
css: [headingResetStyles,
|
|
126
|
+
css: [headingResetStyles,
|
|
127
|
+
// This can be refactored when @compiled supports style maps
|
|
127
128
|
level === 'h100' && h100Styles, level === 'h200' && h200Styles, level === 'h300' && h300Styles, level === 'h400' && h400Styles, level === 'h500' && h500Styles, level === 'h600' && h600Styles, level === 'h700' && h700Styles, level === 'h800' && h800Styles, level === 'h900' && h900Styles, color === 'inverse' && inverseStyles, color === 'default' && isSubtleHeading && subtlestStyles]
|
|
128
129
|
}, children);
|
|
129
130
|
};
|
|
130
|
-
|
|
131
131
|
export default Heading;
|
package/dist/es2019/version.json
CHANGED
|
@@ -3,7 +3,6 @@ var HeadingContext = /*#__PURE__*/createContext(undefined);
|
|
|
3
3
|
export var useHeadingElement = function useHeadingElement() {
|
|
4
4
|
return Math.min(useContext(HeadingContext) || 0, 6);
|
|
5
5
|
};
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* __Heading context__
|
|
9
8
|
*
|
|
@@ -22,12 +21,11 @@ export var useHeadingElement = function useHeadingElement() {
|
|
|
22
21
|
*/
|
|
23
22
|
var HeadingContextProvider = function HeadingContextProvider(_ref) {
|
|
24
23
|
var children = _ref.children,
|
|
25
|
-
|
|
24
|
+
value = _ref.value;
|
|
26
25
|
var parentHeadingLevel = useHeadingElement();
|
|
27
26
|
var headingLevel = parentHeadingLevel + 1;
|
|
28
27
|
return /*#__PURE__*/React.createElement(HeadingContext.Provider, {
|
|
29
28
|
value: value || headingLevel
|
|
30
29
|
}, children);
|
|
31
30
|
};
|
|
32
|
-
|
|
33
31
|
export default HeadingContextProvider;
|
package/dist/esm/heading.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
|
|
2
3
|
import { css, jsx } from '@emotion/react';
|
|
3
4
|
import { useHeadingElement } from './heading-context';
|
|
4
5
|
// https://atlassian.design/foundations/typography
|
|
@@ -15,64 +16,64 @@ var levelMap = {
|
|
|
15
16
|
h100: 'div'
|
|
16
17
|
};
|
|
17
18
|
var headingResetStyles = css({
|
|
18
|
-
marginTop: "var(--ds-
|
|
19
|
-
marginBottom: "var(--ds-
|
|
19
|
+
marginTop: "var(--ds-space-0, 0px)",
|
|
20
|
+
marginBottom: "var(--ds-space-0, 0px)",
|
|
20
21
|
color: "var(--ds-text, #172B4D)"
|
|
21
22
|
});
|
|
22
23
|
var h900Styles = css({
|
|
23
|
-
fontSize:
|
|
24
|
-
fontWeight: 500,
|
|
24
|
+
fontSize: "var(--ds-font-size-600, 35px)",
|
|
25
|
+
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
25
26
|
letterSpacing: '-0.01em',
|
|
26
|
-
lineHeight:
|
|
27
|
+
lineHeight: "var(--ds-font-lineHeight-600, 40px)"
|
|
27
28
|
});
|
|
28
29
|
var h800Styles = css({
|
|
29
|
-
fontSize:
|
|
30
|
-
fontWeight: 600,
|
|
30
|
+
fontSize: "var(--ds-font-size-500, 29px)",
|
|
31
|
+
fontWeight: "var(--ds-font-weight-semibold, 600)",
|
|
31
32
|
letterSpacing: '-0.01em',
|
|
32
|
-
lineHeight:
|
|
33
|
+
lineHeight: "var(--ds-font-lineHeight-500, 32px)"
|
|
33
34
|
});
|
|
34
35
|
var h700Styles = css({
|
|
35
|
-
fontSize:
|
|
36
|
-
fontWeight: 500,
|
|
36
|
+
fontSize: "var(--ds-font-size-400, 24px)",
|
|
37
|
+
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
37
38
|
letterSpacing: '-0.01em',
|
|
38
|
-
lineHeight:
|
|
39
|
+
lineHeight: "var(--ds-font-lineHeight-400, 28px)"
|
|
39
40
|
});
|
|
40
41
|
var h600Styles = css({
|
|
41
|
-
fontSize:
|
|
42
|
-
fontWeight: 500,
|
|
42
|
+
fontSize: "var(--ds-font-size-300, 20px)",
|
|
43
|
+
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
43
44
|
letterSpacing: '-0.008em',
|
|
44
|
-
lineHeight:
|
|
45
|
+
lineHeight: "var(--ds-font-lineHeight-300, 24px)"
|
|
45
46
|
});
|
|
46
47
|
var h500Styles = css({
|
|
47
|
-
fontSize:
|
|
48
|
-
fontWeight: 600,
|
|
48
|
+
fontSize: "var(--ds-font-size-200, 16px)",
|
|
49
|
+
fontWeight: "var(--ds-font-weight-semibold, 600)",
|
|
49
50
|
letterSpacing: '-0.006em',
|
|
50
|
-
lineHeight:
|
|
51
|
+
lineHeight: "var(--ds-font-lineHeight-200, 20px)"
|
|
51
52
|
});
|
|
52
53
|
var h400Styles = css({
|
|
53
|
-
fontSize:
|
|
54
|
-
fontWeight: 600,
|
|
54
|
+
fontSize: "var(--ds-font-size-100, 14px)",
|
|
55
|
+
fontWeight: "var(--ds-font-weight-semibold, 600)",
|
|
55
56
|
letterSpacing: '-0.003em',
|
|
56
|
-
lineHeight:
|
|
57
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)"
|
|
57
58
|
});
|
|
58
59
|
var h300Styles = css({
|
|
59
|
-
fontSize:
|
|
60
|
-
fontWeight: 600,
|
|
60
|
+
fontSize: "var(--ds-font-size-075, 12px)",
|
|
61
|
+
fontWeight: "var(--ds-font-weight-semibold, 600)",
|
|
61
62
|
letterSpacing: 0,
|
|
62
|
-
lineHeight:
|
|
63
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)",
|
|
63
64
|
textTransform: 'uppercase'
|
|
64
65
|
});
|
|
65
66
|
var h200Styles = css({
|
|
66
|
-
fontSize:
|
|
67
|
-
fontWeight: 600,
|
|
67
|
+
fontSize: "var(--ds-font-size-075, 12px)",
|
|
68
|
+
fontWeight: "var(--ds-font-weight-semibold, 600)",
|
|
68
69
|
letterSpacing: 0,
|
|
69
|
-
lineHeight:
|
|
70
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)"
|
|
70
71
|
});
|
|
71
72
|
var h100Styles = css({
|
|
72
|
-
fontSize:
|
|
73
|
-
fontWeight: 700,
|
|
73
|
+
fontSize: "var(--ds-font-size-050, 11px)",
|
|
74
|
+
fontWeight: "var(--ds-font-weight-bold, 700)",
|
|
74
75
|
letterSpacing: 0,
|
|
75
|
-
lineHeight:
|
|
76
|
+
lineHeight: "var(--ds-font-lineHeight-100, 16px)"
|
|
76
77
|
});
|
|
77
78
|
var inverseStyles = css({
|
|
78
79
|
color: "var(--ds-text-inverse, #FFF)"
|
|
@@ -80,6 +81,7 @@ var inverseStyles = css({
|
|
|
80
81
|
var subtlestStyles = css({
|
|
81
82
|
color: "var(--ds-text-subtlest, #6B778C)"
|
|
82
83
|
});
|
|
84
|
+
|
|
83
85
|
/**
|
|
84
86
|
* __Heading__
|
|
85
87
|
*
|
|
@@ -95,20 +97,17 @@ var subtlestStyles = css({
|
|
|
95
97
|
* );
|
|
96
98
|
* ```
|
|
97
99
|
*/
|
|
98
|
-
|
|
99
100
|
var Heading = function Heading(_ref) {
|
|
100
101
|
var children = _ref.children,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
level = _ref.level,
|
|
103
|
+
id = _ref.id,
|
|
104
|
+
testId = _ref.testId,
|
|
105
|
+
as = _ref.as,
|
|
106
|
+
_ref$color = _ref.color,
|
|
107
|
+
color = _ref$color === void 0 ? 'default' : _ref$color;
|
|
108
108
|
if (process.env.NODE_ENV !== 'production' && as && typeof as !== 'string') {
|
|
109
109
|
throw new Error('`as` prop should be a string.');
|
|
110
110
|
}
|
|
111
|
-
|
|
112
111
|
var hLevel = useHeadingElement();
|
|
113
112
|
/**
|
|
114
113
|
* Order here is important, we for now apply
|
|
@@ -116,17 +115,17 @@ var Heading = function Heading(_ref) {
|
|
|
116
115
|
* 2. inferred a11y level
|
|
117
116
|
* 3. default final fallback
|
|
118
117
|
*/
|
|
119
|
-
|
|
120
118
|
var Markup = as || hLevel && "h".concat(hLevel) || levelMap[level];
|
|
121
119
|
var isSubtleHeading = level === 'h200' || level === 'h100';
|
|
122
120
|
return jsx(Markup, {
|
|
123
121
|
id: id,
|
|
124
|
-
"data-testid": testId
|
|
122
|
+
"data-testid": testId
|
|
123
|
+
// @ts-ignore
|
|
125
124
|
// Resolved by https://github.com/atlassian-labs/compiled/pull/1321
|
|
126
125
|
,
|
|
127
|
-
css: [headingResetStyles,
|
|
126
|
+
css: [headingResetStyles,
|
|
127
|
+
// This can be refactored when @compiled supports style maps
|
|
128
128
|
level === 'h100' && h100Styles, level === 'h200' && h200Styles, level === 'h300' && h300Styles, level === 'h400' && h400Styles, level === 'h500' && h500Styles, level === 'h600' && h600Styles, level === 'h700' && h700Styles, level === 'h800' && h800Styles, level === 'h900' && h900Styles, color === 'inverse' && inverseStyles, color === 'default' && isSubtleHeading && subtlestStyles]
|
|
129
129
|
}, children);
|
|
130
130
|
};
|
|
131
|
-
|
|
132
131
|
export default Heading;
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/heading",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "A heading is a typography component used to display text in different sizes and formats.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
"releaseModel": "continuous",
|
|
14
14
|
"website": {
|
|
15
15
|
"name": "Heading",
|
|
16
|
-
"category": "Components"
|
|
16
|
+
"category": "Components",
|
|
17
|
+
"status": {
|
|
18
|
+
"type": "alpha"
|
|
19
|
+
}
|
|
17
20
|
}
|
|
18
21
|
},
|
|
19
22
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
@@ -66,6 +69,6 @@
|
|
|
66
69
|
"deprecation": "no-deprecated-imports"
|
|
67
70
|
}
|
|
68
71
|
},
|
|
69
|
-
"homepage": "https://
|
|
72
|
+
"homepage": "https://atlassian.design/components/heading/",
|
|
70
73
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
71
74
|
}
|