@atlaskit/heading 1.3.8 → 1.4.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 +41 -28
- package/dist/cjs/heading-context.js +15 -10
- package/dist/cjs/heading.js +26 -14
- package/dist/cjs/heading.partial.js +106 -0
- package/dist/es2019/heading-context.js +15 -7
- package/dist/es2019/heading.js +24 -13
- package/dist/es2019/heading.partial.js +100 -0
- package/dist/esm/heading-context.js +15 -7
- package/dist/esm/heading.js +25 -13
- package/dist/esm/heading.partial.js +100 -0
- package/dist/types/heading-context.d.ts +14 -7
- package/dist/types/heading.d.ts +3 -18
- package/dist/types/heading.partial.d.ts +39 -0
- package/dist/types/types.d.ts +40 -24
- package/dist/types-ts4.5/heading-context.d.ts +14 -7
- package/dist/types-ts4.5/heading.d.ts +3 -18
- package/dist/types-ts4.5/heading.partial.d.ts +39 -0
- package/dist/types-ts4.5/types.d.ts +40 -24
- package/package.json +12 -7
- package/report.api.md +46 -21
- package/scripts/codegen.tsx +66 -0
- package/tmp/api-report-tmp.d.ts +31 -12
- package/dist/cjs/utils.js +0 -10
- package/dist/es2019/utils.js +0 -1
- package/dist/esm/utils.js +0 -3
- package/dist/types/utils.d.ts +0 -1
- package/dist/types-ts4.5/utils.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,58 +1,71 @@
|
|
|
1
1
|
# @atlaskit/heading
|
|
2
2
|
|
|
3
|
+
## 1.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#41032](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41032) [`8d9dad6b977`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d9dad6b977) - Heading will apply an aria level if rendered as a div. This is an accessibility fix for an incomplete feature shipped in the previous minor version.
|
|
8
|
+
- [#40299](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40299) [`b1882fdd842`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b1882fdd842) - Change typography token naming to be more verbose.
|
|
9
|
+
|
|
10
|
+
## 1.4.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [#40254](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40254) [`9cc7e23c65b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9cc7e23c65b) - [ux] Adds additional heading types via the `variant` prop. This prop has been added to aid deprecation of the previous `level` prop. The `level` prop will be removed in a future release.
|
|
15
|
+
|
|
3
16
|
## 1.3.8
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
6
19
|
|
|
7
|
-
- [`ff79902b24c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ff79902b24c) - This package is now onboarded onto the product push model.
|
|
20
|
+
- [#40040](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40040) [`ff79902b24c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ff79902b24c) - This package is now onboarded onto the product push model.
|
|
8
21
|
|
|
9
22
|
## 1.3.7
|
|
10
23
|
|
|
11
24
|
### Patch Changes
|
|
12
25
|
|
|
13
|
-
- [`4ae083a7e66`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4ae083a7e66) - Use `@af/accessibility-testing` for default jest-axe config and jest-axe import in accessibility testing.
|
|
26
|
+
- [#36754](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/36754) [`4ae083a7e66`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4ae083a7e66) - Use `@af/accessibility-testing` for default jest-axe config and jest-axe import in accessibility testing.
|
|
14
27
|
|
|
15
28
|
## 1.3.6
|
|
16
29
|
|
|
17
30
|
### Patch Changes
|
|
18
31
|
|
|
19
|
-
- [`529814693a1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/529814693a1) - Pin version of @atlaskit/primitives so it resolves to correct version
|
|
32
|
+
- [#35337](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/35337) [`529814693a1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/529814693a1) - Pin version of @atlaskit/primitives so it resolves to correct version
|
|
20
33
|
|
|
21
34
|
## 1.3.5
|
|
22
35
|
|
|
23
36
|
### Patch Changes
|
|
24
37
|
|
|
25
|
-
- [`b8b41649492`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b8b41649492) - Update how certain background colors are referenced by name. Internal changes only.
|
|
38
|
+
- [#33833](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33833) [`b8b41649492`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b8b41649492) - Update how certain background colors are referenced by name. Internal changes only.
|
|
26
39
|
|
|
27
40
|
## 1.3.4
|
|
28
41
|
|
|
29
42
|
### Patch Changes
|
|
30
43
|
|
|
31
|
-
- [`779727e307a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/779727e307a) - Internal change only. Replace all instances of Box with stable @atlaskit/primitives version.
|
|
44
|
+
- [#34922](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/34922) [`779727e307a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/779727e307a) - Internal change only. Replace all instances of Box with stable @atlaskit/primitives version.
|
|
32
45
|
|
|
33
46
|
## 1.3.3
|
|
34
47
|
|
|
35
48
|
### Patch Changes
|
|
36
49
|
|
|
37
|
-
- [`61cb5313358`](https://bitbucket.org/atlassian/atlassian-frontend/commits/61cb5313358) - Removing unused dependencies and dev dependencies
|
|
50
|
+
- [#34443](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/34443) [`61cb5313358`](https://bitbucket.org/atlassian/atlassian-frontend/commits/61cb5313358) - Removing unused dependencies and dev dependencies
|
|
38
51
|
|
|
39
52
|
## 1.3.2
|
|
40
53
|
|
|
41
54
|
### Patch Changes
|
|
42
55
|
|
|
43
|
-
- [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
|
|
56
|
+
- [#33793](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33793) [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
|
|
44
57
|
|
|
45
58
|
## 1.3.1
|
|
46
59
|
|
|
47
60
|
### Patch Changes
|
|
48
61
|
|
|
49
|
-
- [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
|
|
62
|
+
- [#33649](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33649) [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
|
|
50
63
|
|
|
51
64
|
## 1.3.0
|
|
52
65
|
|
|
53
66
|
### Minor Changes
|
|
54
67
|
|
|
55
|
-
- [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
|
|
68
|
+
- [#33258](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33258) [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
|
|
56
69
|
|
|
57
70
|
### Patch Changes
|
|
58
71
|
|
|
@@ -62,25 +75,25 @@
|
|
|
62
75
|
|
|
63
76
|
### Patch Changes
|
|
64
77
|
|
|
65
|
-
- [`e0460d5d989`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e0460d5d989) - Usages of `process` are now guarded by a `typeof` check.
|
|
78
|
+
- [#32294](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/32294) [`e0460d5d989`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e0460d5d989) - Usages of `process` are now guarded by a `typeof` check.
|
|
66
79
|
|
|
67
80
|
## 1.2.0
|
|
68
81
|
|
|
69
82
|
### Minor Changes
|
|
70
83
|
|
|
71
|
-
- [`261420360ec`](https://bitbucket.org/atlassian/atlassian-frontend/commits/261420360ec) - Upgrades component types to support React 18.
|
|
84
|
+
- [#31206](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31206) [`261420360ec`](https://bitbucket.org/atlassian/atlassian-frontend/commits/261420360ec) - Upgrades component types to support React 18.
|
|
72
85
|
|
|
73
86
|
## 1.1.4
|
|
74
87
|
|
|
75
88
|
### Patch Changes
|
|
76
89
|
|
|
77
|
-
- [`cfe48bb7ece`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cfe48bb7ece) - Internal change only. Replace usages of Inline/Stack with stable version from `@atlaskit/primitives`.
|
|
90
|
+
- [#31242](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31242) [`cfe48bb7ece`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cfe48bb7ece) - Internal change only. Replace usages of Inline/Stack with stable version from `@atlaskit/primitives`.
|
|
78
91
|
|
|
79
92
|
## 1.1.3
|
|
80
93
|
|
|
81
94
|
### Patch Changes
|
|
82
95
|
|
|
83
|
-
- [`b6c5779d358`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b6c5779d358) - Internal changes only to restrict usage of `Box` from the primitives package.
|
|
96
|
+
- [#31185](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31185) [`b6c5779d358`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b6c5779d358) - Internal changes only to restrict usage of `Box` from the primitives package.
|
|
84
97
|
|
|
85
98
|
## 1.1.2
|
|
86
99
|
|
|
@@ -92,13 +105,13 @@
|
|
|
92
105
|
|
|
93
106
|
### Patch Changes
|
|
94
107
|
|
|
95
|
-
- [`18aeca8c199`](https://bitbucket.org/atlassian/atlassian-frontend/commits/18aeca8c199) - Internal change to update token references. There is no expected behaviour or visual change.
|
|
108
|
+
- [#29390](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/29390) [`18aeca8c199`](https://bitbucket.org/atlassian/atlassian-frontend/commits/18aeca8c199) - Internal change to update token references. There is no expected behaviour or visual change.
|
|
96
109
|
|
|
97
110
|
## 1.1.0
|
|
98
111
|
|
|
99
112
|
### Minor Changes
|
|
100
113
|
|
|
101
|
-
- [`fce52a022f5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fce52a022f5) - Adds typography tokens to @atlaskit/heading.
|
|
114
|
+
- [#28493](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/28493) [`fce52a022f5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fce52a022f5) - Adds typography tokens to @atlaskit/heading.
|
|
102
115
|
|
|
103
116
|
## 1.0.4
|
|
104
117
|
|
|
@@ -116,7 +129,7 @@
|
|
|
116
129
|
|
|
117
130
|
### Patch Changes
|
|
118
131
|
|
|
119
|
-
- [`95fdae34c94`](https://bitbucket.org/atlassian/atlassian-frontend/commits/95fdae34c94) - Revert experimental change to `@compiled/react` from `@emotion/react`.
|
|
132
|
+
- [#27341](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/27341) [`95fdae34c94`](https://bitbucket.org/atlassian/atlassian-frontend/commits/95fdae34c94) - Revert experimental change to `@compiled/react` from `@emotion/react`.
|
|
120
133
|
|
|
121
134
|
## 1.0.1
|
|
122
135
|
|
|
@@ -128,7 +141,7 @@
|
|
|
128
141
|
|
|
129
142
|
### Major Changes
|
|
130
143
|
|
|
131
|
-
- [`7d92ed50264`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7d92ed50264) - [ux] This package is still considered to be in an experimental state and is discouraged for use in production. The major is to simplify consumption and versioning in product.
|
|
144
|
+
- [#27238](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/27238) [`7d92ed50264`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7d92ed50264) - [ux] This package is still considered to be in an experimental state and is discouraged for use in production. The major is to simplify consumption and versioning in product.
|
|
132
145
|
|
|
133
146
|
Other changes:
|
|
134
147
|
|
|
@@ -139,38 +152,38 @@
|
|
|
139
152
|
|
|
140
153
|
### Patch Changes
|
|
141
154
|
|
|
142
|
-
- [`bc989043572`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bc989043572) - Internal changes to apply spacing tokens. This should be a no-op change.
|
|
155
|
+
- [#26488](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/26488) [`bc989043572`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bc989043572) - Internal changes to apply spacing tokens. This should be a no-op change.
|
|
143
156
|
|
|
144
157
|
## 0.1.17
|
|
145
158
|
|
|
146
159
|
### Patch Changes
|
|
147
160
|
|
|
148
|
-
- [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
|
|
161
|
+
- [#24874](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24874) [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
|
|
149
162
|
|
|
150
163
|
## 0.1.16
|
|
151
164
|
|
|
152
165
|
### Patch Changes
|
|
153
166
|
|
|
154
|
-
- [`30b11aab9fb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/30b11aab9fb) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behavior change.
|
|
167
|
+
- [#24004](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24004) [`30b11aab9fb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/30b11aab9fb) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behavior change.
|
|
155
168
|
- Updated dependencies
|
|
156
169
|
|
|
157
170
|
## 0.1.15
|
|
158
171
|
|
|
159
172
|
### Patch Changes
|
|
160
173
|
|
|
161
|
-
- [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
|
|
174
|
+
- [#24492](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/24492) [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
|
|
162
175
|
|
|
163
176
|
## 0.1.14
|
|
164
177
|
|
|
165
178
|
### Patch Changes
|
|
166
179
|
|
|
167
|
-
- [`47b01007f27`](https://bitbucket.org/atlassian/atlassian-frontend/commits/47b01007f27) - Introduces color prop with values default and inverse.
|
|
180
|
+
- [#23381](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/23381) [`47b01007f27`](https://bitbucket.org/atlassian/atlassian-frontend/commits/47b01007f27) - Introduces color prop with values default and inverse.
|
|
168
181
|
|
|
169
182
|
## 0.1.13
|
|
170
183
|
|
|
171
184
|
### Patch Changes
|
|
172
185
|
|
|
173
|
-
- [`354050b68da`](https://bitbucket.org/atlassian/atlassian-frontend/commits/354050b68da) - Revert font size calculations to raw pixels.
|
|
186
|
+
- [#22642](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/22642) [`354050b68da`](https://bitbucket.org/atlassian/atlassian-frontend/commits/354050b68da) - Revert font size calculations to raw pixels.
|
|
174
187
|
|
|
175
188
|
## 0.1.12
|
|
176
189
|
|
|
@@ -182,7 +195,7 @@
|
|
|
182
195
|
|
|
183
196
|
### Patch Changes
|
|
184
197
|
|
|
185
|
-
- [`cb2392f6d33`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb2392f6d33) - Upgrade to TypeScript 4.2.4
|
|
198
|
+
- [#20650](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/20650) [`cb2392f6d33`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb2392f6d33) - Upgrade to TypeScript 4.2.4
|
|
186
199
|
|
|
187
200
|
## 0.1.10
|
|
188
201
|
|
|
@@ -206,7 +219,7 @@
|
|
|
206
219
|
|
|
207
220
|
### Patch Changes
|
|
208
221
|
|
|
209
|
-
- [`19d72473dfb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/19d72473dfb) - Updates usage of deprecated token names so they're aligned with the latest naming conventions. No UI or visual changes
|
|
222
|
+
- [#16752](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/16752) [`19d72473dfb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/19d72473dfb) - Updates usage of deprecated token names so they're aligned with the latest naming conventions. No UI or visual changes
|
|
210
223
|
- Updated dependencies
|
|
211
224
|
|
|
212
225
|
## 0.1.6
|
|
@@ -219,7 +232,7 @@
|
|
|
219
232
|
|
|
220
233
|
### Patch Changes
|
|
221
234
|
|
|
222
|
-
- [`f460cc7c411`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f460cc7c411) - Builds for this package now pass through a tokens babel plugin, removing runtime invocations of the tokens() function and improving bundle size.
|
|
235
|
+
- [#15998](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/15998) [`f460cc7c411`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f460cc7c411) - Builds for this package now pass through a tokens babel plugin, removing runtime invocations of the tokens() function and improving bundle size.
|
|
223
236
|
- Updated dependencies
|
|
224
237
|
|
|
225
238
|
## 0.1.4
|
|
@@ -244,7 +257,7 @@
|
|
|
244
257
|
|
|
245
258
|
### Patch Changes
|
|
246
259
|
|
|
247
|
-
- [`d7a9a4ff7ec`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d7a9a4ff7ec) - Instrumented heading with the new theming package, `@atlaskit/tokens`.
|
|
260
|
+
- [#13864](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/13864) [`d7a9a4ff7ec`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d7a9a4ff7ec) - Instrumented heading with the new theming package, `@atlaskit/tokens`.
|
|
248
261
|
New tokens will be visible only in applications configured to use the new Tokens API (currently in alpha).
|
|
249
262
|
These changes are intended to be interoperable with the legacy theme implementation.
|
|
250
263
|
Legacy dark mode users should expect no visual or breaking changes.
|
|
@@ -254,7 +267,7 @@
|
|
|
254
267
|
|
|
255
268
|
### Minor Changes
|
|
256
269
|
|
|
257
|
-
- [`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.
|
|
270
|
+
- [#12837](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/12837) [`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.
|
|
258
271
|
|
|
259
272
|
### Patch Changes
|
|
260
273
|
|
|
@@ -8,15 +8,21 @@ exports.useHeadingElement = exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
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); }
|
|
10
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; }
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
// Allows support for heading levels 1-9 via aria-level
|
|
12
|
+
|
|
13
|
+
var HeadingLevelContext = /*#__PURE__*/(0, _react.createContext)(0);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
* @returns The current heading level context.
|
|
18
|
+
*/
|
|
19
|
+
var useHeadingElement = exports.useHeadingElement = function useHeadingElement() {
|
|
20
|
+
return (0, _react.useContext)(HeadingLevelContext);
|
|
14
21
|
};
|
|
15
|
-
exports.useHeadingElement = useHeadingElement;
|
|
16
22
|
/**
|
|
17
|
-
* __Heading
|
|
23
|
+
* __Heading level provider__
|
|
18
24
|
*
|
|
19
|
-
* The
|
|
25
|
+
* The Heading level provider injectes the heading level to all `Heading` components below it in the component tree.
|
|
20
26
|
*
|
|
21
27
|
* @example
|
|
22
28
|
* ```tsx
|
|
@@ -29,14 +35,13 @@ exports.useHeadingElement = useHeadingElement;
|
|
|
29
35
|
* </HeadingContext>
|
|
30
36
|
* ```
|
|
31
37
|
*/
|
|
32
|
-
var
|
|
38
|
+
var HeadingLevelContextProvider = function HeadingLevelContextProvider(_ref) {
|
|
33
39
|
var children = _ref.children,
|
|
34
40
|
value = _ref.value;
|
|
35
41
|
var parentHeadingLevel = useHeadingElement();
|
|
36
42
|
var headingLevel = parentHeadingLevel + 1;
|
|
37
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(HeadingLevelContext.Provider, {
|
|
38
44
|
value: value || headingLevel
|
|
39
45
|
}, children);
|
|
40
46
|
};
|
|
41
|
-
var _default =
|
|
42
|
-
exports.default = _default;
|
|
47
|
+
var _default = exports.default = HeadingLevelContextProvider;
|
package/dist/cjs/heading.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
7
10
|
var _react = require("@emotion/react");
|
|
8
11
|
var _headingContext = require("./heading-context");
|
|
12
|
+
var _heading = _interopRequireDefault(require("./heading.partial"));
|
|
13
|
+
var _excluded = ["level", "variant"];
|
|
9
14
|
/** @jsx jsx */
|
|
10
|
-
|
|
11
15
|
// https://atlassian.design/foundations/typography
|
|
12
16
|
var levelMap = {
|
|
13
17
|
h900: 'h1',
|
|
@@ -22,9 +26,8 @@ var levelMap = {
|
|
|
22
26
|
h100: 'div'
|
|
23
27
|
};
|
|
24
28
|
var headingResetStyles = (0, _react.css)({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
color: "var(--ds-text, #172B4D)"
|
|
29
|
+
color: "var(--ds-text, #172B4D)",
|
|
30
|
+
marginBlock: "var(--ds-space-0, 0px)"
|
|
28
31
|
});
|
|
29
32
|
var h900Styles = (0, _react.css)({
|
|
30
33
|
fontSize: "var(--ds-font-size-600, 35px)",
|
|
@@ -121,18 +124,27 @@ var Heading = function Heading(_ref) {
|
|
|
121
124
|
* 2. inferred a11y level
|
|
122
125
|
* 3. default final fallback
|
|
123
126
|
*/
|
|
124
|
-
var Markup = as || hLevel && "h".concat(hLevel) || levelMap[level];
|
|
127
|
+
var Markup = as || hLevel && (hLevel > 6 ? 'div' : "h".concat(hLevel)) || levelMap[level];
|
|
125
128
|
var isSubtleHeading = level === 'h200' || level === 'h100';
|
|
126
129
|
return (0, _react.jsx)(Markup, {
|
|
127
130
|
id: id,
|
|
128
|
-
"data-testid": testId
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
,
|
|
132
|
-
css: [headingResetStyles,
|
|
133
|
-
// This can be refactored when @compiled supports style maps
|
|
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]
|
|
131
|
+
"data-testid": testId,
|
|
132
|
+
role: Markup === 'div' ? 'heading' : undefined,
|
|
133
|
+
"aria-level": Markup === 'div' ? hLevel : undefined,
|
|
134
|
+
css: [headingResetStyles, 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]
|
|
135
135
|
}, children);
|
|
136
136
|
};
|
|
137
|
-
var _default =
|
|
138
|
-
|
|
137
|
+
var _default = exports.default = function _default(_ref2) {
|
|
138
|
+
var level = _ref2.level,
|
|
139
|
+
variant = _ref2.variant,
|
|
140
|
+
props = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
141
|
+
return level ?
|
|
142
|
+
// eslint-disable-next-line jsx-a11y/heading-has-content
|
|
143
|
+
(0, _react.jsx)(Heading, (0, _extends2.default)({
|
|
144
|
+
level: level
|
|
145
|
+
}, props)) :
|
|
146
|
+
// eslint-disable-next-line jsx-a11y/heading-has-content
|
|
147
|
+
(0, _react.jsx)(_heading.default, (0, _extends2.default)({
|
|
148
|
+
variant: variant
|
|
149
|
+
}, props));
|
|
150
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _headingContext = require("./heading-context");
|
|
9
|
+
/** @jsx jsx */
|
|
10
|
+
|
|
11
|
+
// https://atlassian.design/foundations/typography
|
|
12
|
+
var levelMap = {
|
|
13
|
+
xxlarge: 'h1',
|
|
14
|
+
xlarge: 'h2',
|
|
15
|
+
large: 'h3',
|
|
16
|
+
medium: 'h4',
|
|
17
|
+
small: 'h5',
|
|
18
|
+
xsmall: 'h6',
|
|
19
|
+
xxsmall: 'div'
|
|
20
|
+
};
|
|
21
|
+
var headingResetStyles = (0, _react.css)({
|
|
22
|
+
color: "var(--ds-text, #172B4D)",
|
|
23
|
+
letterSpacing: 'normal',
|
|
24
|
+
marginBlock: 0,
|
|
25
|
+
textTransform: 'none'
|
|
26
|
+
});
|
|
27
|
+
var inverseStyles = (0, _react.css)({
|
|
28
|
+
color: "var(--ds-text-inverse, #FFF)"
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* __Heading__
|
|
33
|
+
*
|
|
34
|
+
* A heading is a typography component used to display text in different sizes and formats.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
*
|
|
38
|
+
* ```jsx
|
|
39
|
+
* import Heading from '@atlaskit/heading';
|
|
40
|
+
*
|
|
41
|
+
* const HeadingXXL = () => (
|
|
42
|
+
* <Heading level="xxlarge">XXL</Heading>
|
|
43
|
+
* );
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
var Heading = function Heading(_ref) {
|
|
47
|
+
var children = _ref.children,
|
|
48
|
+
variant = _ref.variant,
|
|
49
|
+
id = _ref.id,
|
|
50
|
+
testId = _ref.testId,
|
|
51
|
+
as = _ref.as,
|
|
52
|
+
_ref$color = _ref.color,
|
|
53
|
+
color = _ref$color === void 0 ? 'default' : _ref$color;
|
|
54
|
+
if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && as && typeof as !== 'string') {
|
|
55
|
+
throw new Error('`as` prop should be a string.');
|
|
56
|
+
}
|
|
57
|
+
var hLevel = (0, _headingContext.useHeadingElement)();
|
|
58
|
+
/**
|
|
59
|
+
* Order here is important, we for now apply
|
|
60
|
+
* 1. user choice
|
|
61
|
+
* 2. inferred a11y level
|
|
62
|
+
* 3. default final fallback
|
|
63
|
+
*/
|
|
64
|
+
var Markup = as || hLevel && (hLevel > 6 ? 'div' : "h".concat(hLevel)) || levelMap[variant];
|
|
65
|
+
return (0, _react.jsx)(Markup, {
|
|
66
|
+
id: id,
|
|
67
|
+
"data-testid": testId,
|
|
68
|
+
role: Markup === 'div' ? 'heading' : undefined,
|
|
69
|
+
"aria-level": Markup === 'div' ? hLevel : undefined,
|
|
70
|
+
css: [headingResetStyles, variant && headingVariantStylesMap[variant], color === 'inverse' && inverseStyles]
|
|
71
|
+
}, children);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
76
|
+
* @codegen <<SignedSource::cabcd4e0313e10dd81733a6ffcdbc90f>>
|
|
77
|
+
* @codegenId typography
|
|
78
|
+
* @codegenCommand yarn workspace @atlaskit/heading codegen
|
|
79
|
+
*/
|
|
80
|
+
var headingVariantStylesMap = {
|
|
81
|
+
large: (0, _react.css)({
|
|
82
|
+
font: "var(--ds-font-heading-large, normal 500 24px/28px var(--ds-font-family-heading))"
|
|
83
|
+
}),
|
|
84
|
+
medium: (0, _react.css)({
|
|
85
|
+
font: "var(--ds-font-heading-medium, normal 500 20px/24px var(--ds-font-family-heading))"
|
|
86
|
+
}),
|
|
87
|
+
small: (0, _react.css)({
|
|
88
|
+
font: "var(--ds-font-heading-small, normal 600 16px/20px var(--ds-font-family-heading))"
|
|
89
|
+
}),
|
|
90
|
+
xlarge: (0, _react.css)({
|
|
91
|
+
font: "var(--ds-font-heading-xlarge, normal 600 29px/32px var(--ds-font-family-heading))"
|
|
92
|
+
}),
|
|
93
|
+
xsmall: (0, _react.css)({
|
|
94
|
+
font: "var(--ds-font-heading-xsmall, normal 600 14px/16px var(--ds-font-family-heading))"
|
|
95
|
+
}),
|
|
96
|
+
xxlarge: (0, _react.css)({
|
|
97
|
+
font: "var(--ds-font-heading-xxlarge, normal 500 35px/40px var(--ds-font-family-heading))"
|
|
98
|
+
}),
|
|
99
|
+
xxsmall: (0, _react.css)({
|
|
100
|
+
font: "var(--ds-font-heading-xxsmall, normal 600 12px/16px var(--ds-font-family-heading))"
|
|
101
|
+
})
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* @codegenEnd
|
|
105
|
+
*/
|
|
106
|
+
var _default = exports.default = Heading;
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import React, { createContext, useContext } from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
// Allows support for heading levels 1-9 via aria-level
|
|
4
|
+
|
|
5
|
+
const HeadingLevelContext = /*#__PURE__*/createContext(0);
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
* @returns The current heading level context.
|
|
10
|
+
*/
|
|
3
11
|
export const useHeadingElement = () => {
|
|
4
|
-
return
|
|
12
|
+
return useContext(HeadingLevelContext);
|
|
5
13
|
};
|
|
6
14
|
/**
|
|
7
|
-
* __Heading
|
|
15
|
+
* __Heading level provider__
|
|
8
16
|
*
|
|
9
|
-
* The
|
|
17
|
+
* The Heading level provider injectes the heading level to all `Heading` components below it in the component tree.
|
|
10
18
|
*
|
|
11
19
|
* @example
|
|
12
20
|
* ```tsx
|
|
@@ -19,14 +27,14 @@ export const useHeadingElement = () => {
|
|
|
19
27
|
* </HeadingContext>
|
|
20
28
|
* ```
|
|
21
29
|
*/
|
|
22
|
-
const
|
|
30
|
+
const HeadingLevelContextProvider = ({
|
|
23
31
|
children,
|
|
24
32
|
value
|
|
25
33
|
}) => {
|
|
26
34
|
const parentHeadingLevel = useHeadingElement();
|
|
27
35
|
const headingLevel = parentHeadingLevel + 1;
|
|
28
|
-
return /*#__PURE__*/React.createElement(
|
|
36
|
+
return /*#__PURE__*/React.createElement(HeadingLevelContext.Provider, {
|
|
29
37
|
value: value || headingLevel
|
|
30
38
|
}, children);
|
|
31
39
|
};
|
|
32
|
-
export default
|
|
40
|
+
export default HeadingLevelContextProvider;
|
package/dist/es2019/heading.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
/** @jsx jsx */
|
|
2
|
-
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { useHeadingElement } from './heading-context';
|
|
5
|
+
import NewHeading from './heading.partial';
|
|
5
6
|
// https://atlassian.design/foundations/typography
|
|
6
7
|
const levelMap = {
|
|
7
8
|
h900: 'h1',
|
|
@@ -16,9 +17,8 @@ const levelMap = {
|
|
|
16
17
|
h100: 'div'
|
|
17
18
|
};
|
|
18
19
|
const headingResetStyles = css({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
color: "var(--ds-text, #172B4D)"
|
|
20
|
+
color: "var(--ds-text, #172B4D)",
|
|
21
|
+
marginBlock: "var(--ds-space-0, 0px)"
|
|
22
22
|
});
|
|
23
23
|
const h900Styles = css({
|
|
24
24
|
fontSize: "var(--ds-font-size-600, 35px)",
|
|
@@ -115,17 +115,28 @@ const Heading = ({
|
|
|
115
115
|
* 2. inferred a11y level
|
|
116
116
|
* 3. default final fallback
|
|
117
117
|
*/
|
|
118
|
-
const Markup = as || hLevel && `h${hLevel}` || levelMap[level];
|
|
118
|
+
const Markup = as || hLevel && (hLevel > 6 ? 'div' : `h${hLevel}`) || levelMap[level];
|
|
119
119
|
const isSubtleHeading = level === 'h200' || level === 'h100';
|
|
120
120
|
return jsx(Markup, {
|
|
121
121
|
id: id,
|
|
122
|
-
"data-testid": testId
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
,
|
|
126
|
-
css: [headingResetStyles,
|
|
127
|
-
// This can be refactored when @compiled supports style maps
|
|
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]
|
|
122
|
+
"data-testid": testId,
|
|
123
|
+
role: Markup === 'div' ? 'heading' : undefined,
|
|
124
|
+
"aria-level": Markup === 'div' ? hLevel : undefined,
|
|
125
|
+
css: [headingResetStyles, 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
126
|
}, children);
|
|
130
127
|
};
|
|
131
|
-
export default
|
|
128
|
+
export default (({
|
|
129
|
+
level,
|
|
130
|
+
variant,
|
|
131
|
+
...props
|
|
132
|
+
}) => {
|
|
133
|
+
return level ?
|
|
134
|
+
// eslint-disable-next-line jsx-a11y/heading-has-content
|
|
135
|
+
jsx(Heading, _extends({
|
|
136
|
+
level: level
|
|
137
|
+
}, props)) :
|
|
138
|
+
// eslint-disable-next-line jsx-a11y/heading-has-content
|
|
139
|
+
jsx(NewHeading, _extends({
|
|
140
|
+
variant: variant
|
|
141
|
+
}, props));
|
|
142
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, jsx } from '@emotion/react';
|
|
3
|
+
import { useHeadingElement } from './heading-context';
|
|
4
|
+
// https://atlassian.design/foundations/typography
|
|
5
|
+
const levelMap = {
|
|
6
|
+
xxlarge: 'h1',
|
|
7
|
+
xlarge: 'h2',
|
|
8
|
+
large: 'h3',
|
|
9
|
+
medium: 'h4',
|
|
10
|
+
small: 'h5',
|
|
11
|
+
xsmall: 'h6',
|
|
12
|
+
xxsmall: 'div'
|
|
13
|
+
};
|
|
14
|
+
const headingResetStyles = css({
|
|
15
|
+
color: "var(--ds-text, #172B4D)",
|
|
16
|
+
letterSpacing: 'normal',
|
|
17
|
+
marginBlock: 0,
|
|
18
|
+
textTransform: 'none'
|
|
19
|
+
});
|
|
20
|
+
const inverseStyles = css({
|
|
21
|
+
color: "var(--ds-text-inverse, #FFF)"
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* __Heading__
|
|
26
|
+
*
|
|
27
|
+
* A heading is a typography component used to display text in different sizes and formats.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
*
|
|
31
|
+
* ```jsx
|
|
32
|
+
* import Heading from '@atlaskit/heading';
|
|
33
|
+
*
|
|
34
|
+
* const HeadingXXL = () => (
|
|
35
|
+
* <Heading level="xxlarge">XXL</Heading>
|
|
36
|
+
* );
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
const Heading = ({
|
|
40
|
+
children,
|
|
41
|
+
variant,
|
|
42
|
+
id,
|
|
43
|
+
testId,
|
|
44
|
+
as,
|
|
45
|
+
color = 'default'
|
|
46
|
+
}) => {
|
|
47
|
+
if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && as && typeof as !== 'string') {
|
|
48
|
+
throw new Error('`as` prop should be a string.');
|
|
49
|
+
}
|
|
50
|
+
const hLevel = useHeadingElement();
|
|
51
|
+
/**
|
|
52
|
+
* Order here is important, we for now apply
|
|
53
|
+
* 1. user choice
|
|
54
|
+
* 2. inferred a11y level
|
|
55
|
+
* 3. default final fallback
|
|
56
|
+
*/
|
|
57
|
+
const Markup = as || hLevel && (hLevel > 6 ? 'div' : `h${hLevel}`) || levelMap[variant];
|
|
58
|
+
return jsx(Markup, {
|
|
59
|
+
id: id,
|
|
60
|
+
"data-testid": testId,
|
|
61
|
+
role: Markup === 'div' ? 'heading' : undefined,
|
|
62
|
+
"aria-level": Markup === 'div' ? hLevel : undefined,
|
|
63
|
+
css: [headingResetStyles, variant && headingVariantStylesMap[variant], color === 'inverse' && inverseStyles]
|
|
64
|
+
}, children);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
69
|
+
* @codegen <<SignedSource::cabcd4e0313e10dd81733a6ffcdbc90f>>
|
|
70
|
+
* @codegenId typography
|
|
71
|
+
* @codegenCommand yarn workspace @atlaskit/heading codegen
|
|
72
|
+
*/
|
|
73
|
+
const headingVariantStylesMap = {
|
|
74
|
+
large: css({
|
|
75
|
+
font: "var(--ds-font-heading-large, normal 500 24px/28px var(--ds-font-family-heading))"
|
|
76
|
+
}),
|
|
77
|
+
medium: css({
|
|
78
|
+
font: "var(--ds-font-heading-medium, normal 500 20px/24px var(--ds-font-family-heading))"
|
|
79
|
+
}),
|
|
80
|
+
small: css({
|
|
81
|
+
font: "var(--ds-font-heading-small, normal 600 16px/20px var(--ds-font-family-heading))"
|
|
82
|
+
}),
|
|
83
|
+
xlarge: css({
|
|
84
|
+
font: "var(--ds-font-heading-xlarge, normal 600 29px/32px var(--ds-font-family-heading))"
|
|
85
|
+
}),
|
|
86
|
+
xsmall: css({
|
|
87
|
+
font: "var(--ds-font-heading-xsmall, normal 600 14px/16px var(--ds-font-family-heading))"
|
|
88
|
+
}),
|
|
89
|
+
xxlarge: css({
|
|
90
|
+
font: "var(--ds-font-heading-xxlarge, normal 500 35px/40px var(--ds-font-family-heading))"
|
|
91
|
+
}),
|
|
92
|
+
xxsmall: css({
|
|
93
|
+
font: "var(--ds-font-heading-xxsmall, normal 600 12px/16px var(--ds-font-family-heading))"
|
|
94
|
+
})
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* @codegenEnd
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
export default Heading;
|