@atlaskit/heading 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/LICENSE.md +13 -0
- package/README.md +6 -0
- package/dist/cjs/heading.js +144 -0
- package/dist/cjs/index.js +15 -0
- package/dist/cjs/types.js +5 -0
- package/dist/cjs/utils.js +12 -0
- package/dist/cjs/version.json +5 -0
- package/dist/es2019/heading.js +132 -0
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/types.js +1 -0
- package/dist/es2019/utils.js +1 -0
- package/dist/es2019/version.json +5 -0
- package/dist/esm/heading.js +132 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/utils.js +3 -0
- package/dist/esm/version.json +5 -0
- package/dist/types/heading.d.ts +20 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/types.d.ts +22 -0
- package/dist/types/utils.d.ts +1 -0
- package/package.json +65 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# @atlaskit/heading
|
|
2
|
+
|
|
3
|
+
## 0.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 0.1.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 0.1.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`d7a9a4ff7ec`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d7a9a4ff7ec) - Instrumented heading with the new theming package, `@atlaskit/tokens`.
|
|
20
|
+
New tokens will be visible only in applications configured to use the new Tokens API (currently in alpha).
|
|
21
|
+
These changes are intended to be interoperable with the legacy theme implementation.
|
|
22
|
+
Legacy dark mode users should expect no visual or breaking changes.
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
25
|
+
## 0.1.0
|
|
26
|
+
|
|
27
|
+
### Minor Changes
|
|
28
|
+
|
|
29
|
+
- [`ee15e59ba60`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ee15e59ba60) - This is the initial release of the Heading package. Typography styles have been duplicated from the `@atlaskit/theme` package as standalone components.
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- [`46816ee8526`](https://bitbucket.org/atlassian/atlassian-frontend/commits/46816ee8526) - Changes heading element mappings to match '@atlaskit/css-reset'.
|
|
34
|
+
- [`f9cd2065648`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f9cd2065648) - Removed redundant styles for text-transform, moved font-size to `rem` insteda of `em`.
|
|
35
|
+
- Updated dependencies
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2020 Atlassian Pty Ltd
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _core = require("@emotion/core");
|
|
9
|
+
|
|
10
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
11
|
+
|
|
12
|
+
var _tokens = require("@atlaskit/tokens");
|
|
13
|
+
|
|
14
|
+
var _utils = require("./utils");
|
|
15
|
+
|
|
16
|
+
/** @jsx jsx */
|
|
17
|
+
// https://atlassian.design/foundations/typography
|
|
18
|
+
var levelMap = {
|
|
19
|
+
h900: 'h1',
|
|
20
|
+
h800: 'h1',
|
|
21
|
+
h700: 'h2',
|
|
22
|
+
h600: 'h3',
|
|
23
|
+
h500: 'h4',
|
|
24
|
+
h400: 'h5',
|
|
25
|
+
h300: 'h6',
|
|
26
|
+
// NB: These two levels are not covered at all by the existing @atlaskit/css-reset
|
|
27
|
+
h200: 'div',
|
|
28
|
+
h100: 'div'
|
|
29
|
+
};
|
|
30
|
+
var headingResetStyles = (0, _core.css)({
|
|
31
|
+
margin: 0
|
|
32
|
+
});
|
|
33
|
+
var h900Styles = (0, _core.css)({
|
|
34
|
+
color: (0, _tokens.token)('color.text.highEmphasis', _colors.N800),
|
|
35
|
+
fontSize: "".concat(35 / 14, "rem"),
|
|
36
|
+
fontWeight: 500,
|
|
37
|
+
letterSpacing: '-0.01em',
|
|
38
|
+
lineHeight: (0, _utils.lh)(35, 40)
|
|
39
|
+
});
|
|
40
|
+
var h800Styles = (0, _core.css)({
|
|
41
|
+
color: (0, _tokens.token)('color.text.highEmphasis', _colors.N800),
|
|
42
|
+
fontSize: "".concat(29 / 14, "rem"),
|
|
43
|
+
fontWeight: 600,
|
|
44
|
+
letterSpacing: '-0.01em',
|
|
45
|
+
lineHeight: (0, _utils.lh)(29, 32)
|
|
46
|
+
});
|
|
47
|
+
var h700Styles = (0, _core.css)({
|
|
48
|
+
color: (0, _tokens.token)('color.text.highEmphasis', _colors.N800),
|
|
49
|
+
fontSize: "".concat(24 / 14, "rem"),
|
|
50
|
+
fontWeight: 500,
|
|
51
|
+
letterSpacing: '-0.01em',
|
|
52
|
+
lineHeight: (0, _utils.lh)(24, 28)
|
|
53
|
+
});
|
|
54
|
+
var h600Styles = (0, _core.css)({
|
|
55
|
+
color: (0, _tokens.token)('color.text.highEmphasis', _colors.N800),
|
|
56
|
+
fontSize: "".concat(20 / 14, "rem"),
|
|
57
|
+
fontWeight: 500,
|
|
58
|
+
letterSpacing: '-0.008em',
|
|
59
|
+
lineHeight: (0, _utils.lh)(20, 24)
|
|
60
|
+
});
|
|
61
|
+
var h500Styles = (0, _core.css)({
|
|
62
|
+
color: (0, _tokens.token)('color.text.highEmphasis', _colors.N800),
|
|
63
|
+
fontSize: "".concat(16 / 14, "rem"),
|
|
64
|
+
fontWeight: 600,
|
|
65
|
+
letterSpacing: '-0.006em',
|
|
66
|
+
lineHeight: (0, _utils.lh)(16, 20)
|
|
67
|
+
});
|
|
68
|
+
var h400Styles = (0, _core.css)({
|
|
69
|
+
color: (0, _tokens.token)('color.text.highEmphasis', _colors.N800),
|
|
70
|
+
fontSize: '1rem',
|
|
71
|
+
fontWeight: 600,
|
|
72
|
+
letterSpacing: '-0.003em',
|
|
73
|
+
lineHeight: (0, _utils.lh)(14, 16)
|
|
74
|
+
});
|
|
75
|
+
var h300Styles = (0, _core.css)({
|
|
76
|
+
color: (0, _tokens.token)('color.text.highEmphasis', _colors.N800),
|
|
77
|
+
fontSize: "".concat(12 / 14, "rem"),
|
|
78
|
+
fontWeight: 600,
|
|
79
|
+
letterSpacing: 0,
|
|
80
|
+
lineHeight: (0, _utils.lh)(12, 16),
|
|
81
|
+
textTransform: 'uppercase'
|
|
82
|
+
});
|
|
83
|
+
var h200Styles = (0, _core.css)({
|
|
84
|
+
color: (0, _tokens.token)('color.text.lowEmphasis', _colors.N200),
|
|
85
|
+
fontSize: "".concat(12 / 14, "rem"),
|
|
86
|
+
fontWeight: 600,
|
|
87
|
+
letterSpacing: 0,
|
|
88
|
+
lineHeight: (0, _utils.lh)(12, 16)
|
|
89
|
+
});
|
|
90
|
+
var h100Styles = (0, _core.css)({
|
|
91
|
+
color: (0, _tokens.token)('color.text.lowEmphasis', _colors.N200),
|
|
92
|
+
fontSize: "".concat(11 / 14, "rem"),
|
|
93
|
+
fontWeight: 700,
|
|
94
|
+
letterSpacing: 0,
|
|
95
|
+
lineHeight: (0, _utils.lh)(11, 16)
|
|
96
|
+
});
|
|
97
|
+
var styleMap = {
|
|
98
|
+
h900: h900Styles,
|
|
99
|
+
h800: h800Styles,
|
|
100
|
+
h700: h700Styles,
|
|
101
|
+
h600: h600Styles,
|
|
102
|
+
h500: h500Styles,
|
|
103
|
+
h400: h400Styles,
|
|
104
|
+
h300: h300Styles,
|
|
105
|
+
h200: h200Styles,
|
|
106
|
+
h100: h100Styles
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* __Heading__
|
|
110
|
+
*
|
|
111
|
+
* A heading is a typography component used to display text in different sizes and formats.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
*
|
|
115
|
+
* ```jsx
|
|
116
|
+
* import Heading from '@atlaskit/heading';
|
|
117
|
+
*
|
|
118
|
+
* const H100 = () => (
|
|
119
|
+
* <Heading level="h100">h100</Heading>
|
|
120
|
+
* );
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
var Heading = function Heading(_ref) {
|
|
125
|
+
var children = _ref.children,
|
|
126
|
+
level = _ref.level,
|
|
127
|
+
id = _ref.id,
|
|
128
|
+
testId = _ref.testId,
|
|
129
|
+
as = _ref.as;
|
|
130
|
+
|
|
131
|
+
if (process.env.NODE_ENV !== 'production' && as && typeof as !== 'string') {
|
|
132
|
+
throw new Error('`as` prop should be a string.');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
var Markup = as || levelMap[level];
|
|
136
|
+
return (0, _core.jsx)(Markup, {
|
|
137
|
+
id: id,
|
|
138
|
+
"data-testid": testId,
|
|
139
|
+
css: [headingResetStyles, styleMap[level]]
|
|
140
|
+
}, children);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
var _default = Heading;
|
|
144
|
+
exports.default = _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "default", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _heading.default;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
var _heading = _interopRequireDefault(require("./heading"));
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, jsx } from '@emotion/core';
|
|
3
|
+
import { N200, N800 } from '@atlaskit/theme/colors';
|
|
4
|
+
import { token } from '@atlaskit/tokens';
|
|
5
|
+
import { lh } from './utils'; // https://atlassian.design/foundations/typography
|
|
6
|
+
|
|
7
|
+
const levelMap = {
|
|
8
|
+
h900: 'h1',
|
|
9
|
+
h800: 'h1',
|
|
10
|
+
h700: 'h2',
|
|
11
|
+
h600: 'h3',
|
|
12
|
+
h500: 'h4',
|
|
13
|
+
h400: 'h5',
|
|
14
|
+
h300: 'h6',
|
|
15
|
+
// NB: These two levels are not covered at all by the existing @atlaskit/css-reset
|
|
16
|
+
h200: 'div',
|
|
17
|
+
h100: 'div'
|
|
18
|
+
};
|
|
19
|
+
const headingResetStyles = css({
|
|
20
|
+
margin: 0
|
|
21
|
+
});
|
|
22
|
+
const h900Styles = css({
|
|
23
|
+
color: token('color.text.highEmphasis', N800),
|
|
24
|
+
fontSize: `${35 / 14}rem`,
|
|
25
|
+
fontWeight: 500,
|
|
26
|
+
letterSpacing: '-0.01em',
|
|
27
|
+
lineHeight: lh(35, 40)
|
|
28
|
+
});
|
|
29
|
+
const h800Styles = css({
|
|
30
|
+
color: token('color.text.highEmphasis', N800),
|
|
31
|
+
fontSize: `${29 / 14}rem`,
|
|
32
|
+
fontWeight: 600,
|
|
33
|
+
letterSpacing: '-0.01em',
|
|
34
|
+
lineHeight: lh(29, 32)
|
|
35
|
+
});
|
|
36
|
+
const h700Styles = css({
|
|
37
|
+
color: token('color.text.highEmphasis', N800),
|
|
38
|
+
fontSize: `${24 / 14}rem`,
|
|
39
|
+
fontWeight: 500,
|
|
40
|
+
letterSpacing: '-0.01em',
|
|
41
|
+
lineHeight: lh(24, 28)
|
|
42
|
+
});
|
|
43
|
+
const h600Styles = css({
|
|
44
|
+
color: token('color.text.highEmphasis', N800),
|
|
45
|
+
fontSize: `${20 / 14}rem`,
|
|
46
|
+
fontWeight: 500,
|
|
47
|
+
letterSpacing: '-0.008em',
|
|
48
|
+
lineHeight: lh(20, 24)
|
|
49
|
+
});
|
|
50
|
+
const h500Styles = css({
|
|
51
|
+
color: token('color.text.highEmphasis', N800),
|
|
52
|
+
fontSize: `${16 / 14}rem`,
|
|
53
|
+
fontWeight: 600,
|
|
54
|
+
letterSpacing: '-0.006em',
|
|
55
|
+
lineHeight: lh(16, 20)
|
|
56
|
+
});
|
|
57
|
+
const h400Styles = css({
|
|
58
|
+
color: token('color.text.highEmphasis', N800),
|
|
59
|
+
fontSize: '1rem',
|
|
60
|
+
fontWeight: 600,
|
|
61
|
+
letterSpacing: '-0.003em',
|
|
62
|
+
lineHeight: lh(14, 16)
|
|
63
|
+
});
|
|
64
|
+
const h300Styles = css({
|
|
65
|
+
color: token('color.text.highEmphasis', N800),
|
|
66
|
+
fontSize: `${12 / 14}rem`,
|
|
67
|
+
fontWeight: 600,
|
|
68
|
+
letterSpacing: 0,
|
|
69
|
+
lineHeight: lh(12, 16),
|
|
70
|
+
textTransform: 'uppercase'
|
|
71
|
+
});
|
|
72
|
+
const h200Styles = css({
|
|
73
|
+
color: token('color.text.lowEmphasis', N200),
|
|
74
|
+
fontSize: `${12 / 14}rem`,
|
|
75
|
+
fontWeight: 600,
|
|
76
|
+
letterSpacing: 0,
|
|
77
|
+
lineHeight: lh(12, 16)
|
|
78
|
+
});
|
|
79
|
+
const h100Styles = css({
|
|
80
|
+
color: token('color.text.lowEmphasis', N200),
|
|
81
|
+
fontSize: `${11 / 14}rem`,
|
|
82
|
+
fontWeight: 700,
|
|
83
|
+
letterSpacing: 0,
|
|
84
|
+
lineHeight: lh(11, 16)
|
|
85
|
+
});
|
|
86
|
+
const styleMap = {
|
|
87
|
+
h900: h900Styles,
|
|
88
|
+
h800: h800Styles,
|
|
89
|
+
h700: h700Styles,
|
|
90
|
+
h600: h600Styles,
|
|
91
|
+
h500: h500Styles,
|
|
92
|
+
h400: h400Styles,
|
|
93
|
+
h300: h300Styles,
|
|
94
|
+
h200: h200Styles,
|
|
95
|
+
h100: h100Styles
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* __Heading__
|
|
99
|
+
*
|
|
100
|
+
* A heading is a typography component used to display text in different sizes and formats.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
*
|
|
104
|
+
* ```jsx
|
|
105
|
+
* import Heading from '@atlaskit/heading';
|
|
106
|
+
*
|
|
107
|
+
* const H100 = () => (
|
|
108
|
+
* <Heading level="h100">h100</Heading>
|
|
109
|
+
* );
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
const Heading = ({
|
|
114
|
+
children,
|
|
115
|
+
level,
|
|
116
|
+
id,
|
|
117
|
+
testId,
|
|
118
|
+
as
|
|
119
|
+
}) => {
|
|
120
|
+
if (process.env.NODE_ENV !== 'production' && as && typeof as !== 'string') {
|
|
121
|
+
throw new Error('`as` prop should be a string.');
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const Markup = as || levelMap[level];
|
|
125
|
+
return jsx(Markup, {
|
|
126
|
+
id: id,
|
|
127
|
+
"data-testid": testId,
|
|
128
|
+
css: [headingResetStyles, styleMap[level]]
|
|
129
|
+
}, children);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export default Heading;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './heading';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const lh = (sizePx, lineHeightPx) => lineHeightPx / sizePx;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, jsx } from '@emotion/core';
|
|
3
|
+
import { N200, N800 } from '@atlaskit/theme/colors';
|
|
4
|
+
import { token } from '@atlaskit/tokens';
|
|
5
|
+
import { lh } from './utils'; // https://atlassian.design/foundations/typography
|
|
6
|
+
|
|
7
|
+
var levelMap = {
|
|
8
|
+
h900: 'h1',
|
|
9
|
+
h800: 'h1',
|
|
10
|
+
h700: 'h2',
|
|
11
|
+
h600: 'h3',
|
|
12
|
+
h500: 'h4',
|
|
13
|
+
h400: 'h5',
|
|
14
|
+
h300: 'h6',
|
|
15
|
+
// NB: These two levels are not covered at all by the existing @atlaskit/css-reset
|
|
16
|
+
h200: 'div',
|
|
17
|
+
h100: 'div'
|
|
18
|
+
};
|
|
19
|
+
var headingResetStyles = css({
|
|
20
|
+
margin: 0
|
|
21
|
+
});
|
|
22
|
+
var h900Styles = css({
|
|
23
|
+
color: token('color.text.highEmphasis', N800),
|
|
24
|
+
fontSize: "".concat(35 / 14, "rem"),
|
|
25
|
+
fontWeight: 500,
|
|
26
|
+
letterSpacing: '-0.01em',
|
|
27
|
+
lineHeight: lh(35, 40)
|
|
28
|
+
});
|
|
29
|
+
var h800Styles = css({
|
|
30
|
+
color: token('color.text.highEmphasis', N800),
|
|
31
|
+
fontSize: "".concat(29 / 14, "rem"),
|
|
32
|
+
fontWeight: 600,
|
|
33
|
+
letterSpacing: '-0.01em',
|
|
34
|
+
lineHeight: lh(29, 32)
|
|
35
|
+
});
|
|
36
|
+
var h700Styles = css({
|
|
37
|
+
color: token('color.text.highEmphasis', N800),
|
|
38
|
+
fontSize: "".concat(24 / 14, "rem"),
|
|
39
|
+
fontWeight: 500,
|
|
40
|
+
letterSpacing: '-0.01em',
|
|
41
|
+
lineHeight: lh(24, 28)
|
|
42
|
+
});
|
|
43
|
+
var h600Styles = css({
|
|
44
|
+
color: token('color.text.highEmphasis', N800),
|
|
45
|
+
fontSize: "".concat(20 / 14, "rem"),
|
|
46
|
+
fontWeight: 500,
|
|
47
|
+
letterSpacing: '-0.008em',
|
|
48
|
+
lineHeight: lh(20, 24)
|
|
49
|
+
});
|
|
50
|
+
var h500Styles = css({
|
|
51
|
+
color: token('color.text.highEmphasis', N800),
|
|
52
|
+
fontSize: "".concat(16 / 14, "rem"),
|
|
53
|
+
fontWeight: 600,
|
|
54
|
+
letterSpacing: '-0.006em',
|
|
55
|
+
lineHeight: lh(16, 20)
|
|
56
|
+
});
|
|
57
|
+
var h400Styles = css({
|
|
58
|
+
color: token('color.text.highEmphasis', N800),
|
|
59
|
+
fontSize: '1rem',
|
|
60
|
+
fontWeight: 600,
|
|
61
|
+
letterSpacing: '-0.003em',
|
|
62
|
+
lineHeight: lh(14, 16)
|
|
63
|
+
});
|
|
64
|
+
var h300Styles = css({
|
|
65
|
+
color: token('color.text.highEmphasis', N800),
|
|
66
|
+
fontSize: "".concat(12 / 14, "rem"),
|
|
67
|
+
fontWeight: 600,
|
|
68
|
+
letterSpacing: 0,
|
|
69
|
+
lineHeight: lh(12, 16),
|
|
70
|
+
textTransform: 'uppercase'
|
|
71
|
+
});
|
|
72
|
+
var h200Styles = css({
|
|
73
|
+
color: token('color.text.lowEmphasis', N200),
|
|
74
|
+
fontSize: "".concat(12 / 14, "rem"),
|
|
75
|
+
fontWeight: 600,
|
|
76
|
+
letterSpacing: 0,
|
|
77
|
+
lineHeight: lh(12, 16)
|
|
78
|
+
});
|
|
79
|
+
var h100Styles = css({
|
|
80
|
+
color: token('color.text.lowEmphasis', N200),
|
|
81
|
+
fontSize: "".concat(11 / 14, "rem"),
|
|
82
|
+
fontWeight: 700,
|
|
83
|
+
letterSpacing: 0,
|
|
84
|
+
lineHeight: lh(11, 16)
|
|
85
|
+
});
|
|
86
|
+
var styleMap = {
|
|
87
|
+
h900: h900Styles,
|
|
88
|
+
h800: h800Styles,
|
|
89
|
+
h700: h700Styles,
|
|
90
|
+
h600: h600Styles,
|
|
91
|
+
h500: h500Styles,
|
|
92
|
+
h400: h400Styles,
|
|
93
|
+
h300: h300Styles,
|
|
94
|
+
h200: h200Styles,
|
|
95
|
+
h100: h100Styles
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* __Heading__
|
|
99
|
+
*
|
|
100
|
+
* A heading is a typography component used to display text in different sizes and formats.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
*
|
|
104
|
+
* ```jsx
|
|
105
|
+
* import Heading from '@atlaskit/heading';
|
|
106
|
+
*
|
|
107
|
+
* const H100 = () => (
|
|
108
|
+
* <Heading level="h100">h100</Heading>
|
|
109
|
+
* );
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
var Heading = function Heading(_ref) {
|
|
114
|
+
var children = _ref.children,
|
|
115
|
+
level = _ref.level,
|
|
116
|
+
id = _ref.id,
|
|
117
|
+
testId = _ref.testId,
|
|
118
|
+
as = _ref.as;
|
|
119
|
+
|
|
120
|
+
if (process.env.NODE_ENV !== 'production' && as && typeof as !== 'string') {
|
|
121
|
+
throw new Error('`as` prop should be a string.');
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
var Markup = as || levelMap[level];
|
|
125
|
+
return jsx(Markup, {
|
|
126
|
+
id: id,
|
|
127
|
+
"data-testid": testId,
|
|
128
|
+
css: [headingResetStyles, styleMap[level]]
|
|
129
|
+
}, children);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export default Heading;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './heading';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
import type { HeadingProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* __Heading__
|
|
6
|
+
*
|
|
7
|
+
* A heading is a typography component used to display text in different sizes and formats.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* ```jsx
|
|
12
|
+
* import Heading from '@atlaskit/heading';
|
|
13
|
+
*
|
|
14
|
+
* const H100 = () => (
|
|
15
|
+
* <Heading level="h100">h100</Heading>
|
|
16
|
+
* );
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare const Heading: FC<HeadingProps>;
|
|
20
|
+
export default Heading;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export declare type HeadingProps = {
|
|
3
|
+
/**
|
|
4
|
+
* A `testId` prop is provided for specified elements, which is a unique
|
|
5
|
+
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
6
|
+
* serving as a hook for automated tests
|
|
7
|
+
*/
|
|
8
|
+
testId?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The text of the heading
|
|
11
|
+
*/
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* The headling level as defined by by the ADG
|
|
15
|
+
*/
|
|
16
|
+
level: 'h900' | 'h800' | 'h700' | 'h600' | 'h500' | 'h400' | 'h300' | 'h200' | 'h100';
|
|
17
|
+
id?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Allows the component to be rendered as the specified DOM Element
|
|
20
|
+
*/
|
|
21
|
+
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div' | 'span';
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const lh: (sizePx: number, lineHeightPx: number) => number;
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/heading",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "A heading is a typography component used to display text in different sizes and formats.",
|
|
5
|
+
"author": "Atlassian Pty Ltd",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"registry": "https://registry.npmjs.org/"
|
|
9
|
+
},
|
|
10
|
+
"atlassian": {
|
|
11
|
+
"team": "Design System Team",
|
|
12
|
+
"inPublicMirror": false,
|
|
13
|
+
"releaseModel": "continuous",
|
|
14
|
+
"website": {
|
|
15
|
+
"name": "Heading"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
19
|
+
"main": "dist/cjs/index.js",
|
|
20
|
+
"module": "dist/esm/index.js",
|
|
21
|
+
"module:es2019": "dist/es2019/index.js",
|
|
22
|
+
"types": "dist/types/index.d.ts",
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"atlaskit:src": "src/index.ts",
|
|
25
|
+
"af:exports": {
|
|
26
|
+
".": "./src/index.ts"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@atlaskit/theme": "^12.0.0",
|
|
30
|
+
"@atlaskit/tokens": "^0.2.0",
|
|
31
|
+
"@babel/runtime": "^7.0.0",
|
|
32
|
+
"@emotion/core": "^10.0.9"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"react": "^16.8.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@atlaskit/build-utils": "*",
|
|
39
|
+
"@atlaskit/button": "^16.0.0",
|
|
40
|
+
"@atlaskit/docs": "*",
|
|
41
|
+
"@atlaskit/ssr": "*",
|
|
42
|
+
"@atlaskit/visual-regression": "*",
|
|
43
|
+
"@atlaskit/webdriver-runner": "*",
|
|
44
|
+
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
45
|
+
"@testing-library/react": "^8.0.1",
|
|
46
|
+
"react-dom": "^16.8.0",
|
|
47
|
+
"typescript": "3.9.6",
|
|
48
|
+
"wait-for-expect": "^1.2.0"
|
|
49
|
+
},
|
|
50
|
+
"techstack": {
|
|
51
|
+
"@atlassian/frontend": {
|
|
52
|
+
"import-structure": "atlassian-conventions",
|
|
53
|
+
"circular-dependencies": "file-and-folder-level"
|
|
54
|
+
},
|
|
55
|
+
"@repo/internal": {
|
|
56
|
+
"design-system": "v1",
|
|
57
|
+
"styling": "emotion",
|
|
58
|
+
"ui-components": "lite-mode",
|
|
59
|
+
"analytics": "analytics-next",
|
|
60
|
+
"theming": "tokens",
|
|
61
|
+
"deprecation": "no-deprecated-imports"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
65
|
+
}
|