@atlaskit/heading 1.3.8 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -28
- package/dist/cjs/heading-context.js +14 -7
- package/dist/cjs/heading.js +25 -13
- package/dist/cjs/heading.temp.js +105 -0
- package/dist/es2019/heading-context.js +15 -7
- package/dist/es2019/heading.js +23 -13
- package/dist/es2019/heading.temp.js +98 -0
- package/dist/esm/heading-context.js +15 -7
- package/dist/esm/heading.js +24 -13
- package/dist/esm/heading.temp.js +98 -0
- package/dist/types/heading-context.d.ts +14 -7
- package/dist/types/heading.d.ts +3 -18
- package/dist/types/heading.temp.d.ts +38 -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.temp.d.ts +38 -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,64 @@
|
|
|
1
1
|
# @atlaskit/heading
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#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.
|
|
8
|
+
|
|
3
9
|
## 1.3.8
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
6
12
|
|
|
7
|
-
- [`ff79902b24c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ff79902b24c) - This package is now onboarded onto the product push model.
|
|
13
|
+
- [#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
14
|
|
|
9
15
|
## 1.3.7
|
|
10
16
|
|
|
11
17
|
### Patch Changes
|
|
12
18
|
|
|
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.
|
|
19
|
+
- [#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
20
|
|
|
15
21
|
## 1.3.6
|
|
16
22
|
|
|
17
23
|
### Patch Changes
|
|
18
24
|
|
|
19
|
-
- [`529814693a1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/529814693a1) - Pin version of @atlaskit/primitives so it resolves to correct version
|
|
25
|
+
- [#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
26
|
|
|
21
27
|
## 1.3.5
|
|
22
28
|
|
|
23
29
|
### Patch Changes
|
|
24
30
|
|
|
25
|
-
- [`b8b41649492`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b8b41649492) - Update how certain background colors are referenced by name. Internal changes only.
|
|
31
|
+
- [#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
32
|
|
|
27
33
|
## 1.3.4
|
|
28
34
|
|
|
29
35
|
### Patch Changes
|
|
30
36
|
|
|
31
|
-
- [`779727e307a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/779727e307a) - Internal change only. Replace all instances of Box with stable @atlaskit/primitives version.
|
|
37
|
+
- [#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
38
|
|
|
33
39
|
## 1.3.3
|
|
34
40
|
|
|
35
41
|
### Patch Changes
|
|
36
42
|
|
|
37
|
-
- [`61cb5313358`](https://bitbucket.org/atlassian/atlassian-frontend/commits/61cb5313358) - Removing unused dependencies and dev dependencies
|
|
43
|
+
- [#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
44
|
|
|
39
45
|
## 1.3.2
|
|
40
46
|
|
|
41
47
|
### Patch Changes
|
|
42
48
|
|
|
43
|
-
- [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
|
|
49
|
+
- [#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
50
|
|
|
45
51
|
## 1.3.1
|
|
46
52
|
|
|
47
53
|
### Patch Changes
|
|
48
54
|
|
|
49
|
-
- [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
|
|
55
|
+
- [#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
56
|
|
|
51
57
|
## 1.3.0
|
|
52
58
|
|
|
53
59
|
### Minor Changes
|
|
54
60
|
|
|
55
|
-
- [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
|
|
61
|
+
- [#33258](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/33258) [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
|
|
56
62
|
|
|
57
63
|
### Patch Changes
|
|
58
64
|
|
|
@@ -62,25 +68,25 @@
|
|
|
62
68
|
|
|
63
69
|
### Patch Changes
|
|
64
70
|
|
|
65
|
-
- [`e0460d5d989`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e0460d5d989) - Usages of `process` are now guarded by a `typeof` check.
|
|
71
|
+
- [#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
72
|
|
|
67
73
|
## 1.2.0
|
|
68
74
|
|
|
69
75
|
### Minor Changes
|
|
70
76
|
|
|
71
|
-
- [`261420360ec`](https://bitbucket.org/atlassian/atlassian-frontend/commits/261420360ec) - Upgrades component types to support React 18.
|
|
77
|
+
- [#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
78
|
|
|
73
79
|
## 1.1.4
|
|
74
80
|
|
|
75
81
|
### Patch Changes
|
|
76
82
|
|
|
77
|
-
- [`cfe48bb7ece`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cfe48bb7ece) - Internal change only. Replace usages of Inline/Stack with stable version from `@atlaskit/primitives`.
|
|
83
|
+
- [#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
84
|
|
|
79
85
|
## 1.1.3
|
|
80
86
|
|
|
81
87
|
### Patch Changes
|
|
82
88
|
|
|
83
|
-
- [`b6c5779d358`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b6c5779d358) - Internal changes only to restrict usage of `Box` from the primitives package.
|
|
89
|
+
- [#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
90
|
|
|
85
91
|
## 1.1.2
|
|
86
92
|
|
|
@@ -92,13 +98,13 @@
|
|
|
92
98
|
|
|
93
99
|
### Patch Changes
|
|
94
100
|
|
|
95
|
-
- [`18aeca8c199`](https://bitbucket.org/atlassian/atlassian-frontend/commits/18aeca8c199) - Internal change to update token references. There is no expected behaviour or visual change.
|
|
101
|
+
- [#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
102
|
|
|
97
103
|
## 1.1.0
|
|
98
104
|
|
|
99
105
|
### Minor Changes
|
|
100
106
|
|
|
101
|
-
- [`fce52a022f5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fce52a022f5) - Adds typography tokens to @atlaskit/heading.
|
|
107
|
+
- [#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
108
|
|
|
103
109
|
## 1.0.4
|
|
104
110
|
|
|
@@ -116,7 +122,7 @@
|
|
|
116
122
|
|
|
117
123
|
### Patch Changes
|
|
118
124
|
|
|
119
|
-
- [`95fdae34c94`](https://bitbucket.org/atlassian/atlassian-frontend/commits/95fdae34c94) - Revert experimental change to `@compiled/react` from `@emotion/react`.
|
|
125
|
+
- [#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
126
|
|
|
121
127
|
## 1.0.1
|
|
122
128
|
|
|
@@ -128,7 +134,7 @@
|
|
|
128
134
|
|
|
129
135
|
### Major Changes
|
|
130
136
|
|
|
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.
|
|
137
|
+
- [#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
138
|
|
|
133
139
|
Other changes:
|
|
134
140
|
|
|
@@ -139,38 +145,38 @@
|
|
|
139
145
|
|
|
140
146
|
### Patch Changes
|
|
141
147
|
|
|
142
|
-
- [`bc989043572`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bc989043572) - Internal changes to apply spacing tokens. This should be a no-op change.
|
|
148
|
+
- [#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
149
|
|
|
144
150
|
## 0.1.17
|
|
145
151
|
|
|
146
152
|
### Patch Changes
|
|
147
153
|
|
|
148
|
-
- [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
|
|
154
|
+
- [#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
155
|
|
|
150
156
|
## 0.1.16
|
|
151
157
|
|
|
152
158
|
### Patch Changes
|
|
153
159
|
|
|
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.
|
|
160
|
+
- [#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
161
|
- Updated dependencies
|
|
156
162
|
|
|
157
163
|
## 0.1.15
|
|
158
164
|
|
|
159
165
|
### Patch Changes
|
|
160
166
|
|
|
161
|
-
- [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
|
|
167
|
+
- [#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
168
|
|
|
163
169
|
## 0.1.14
|
|
164
170
|
|
|
165
171
|
### Patch Changes
|
|
166
172
|
|
|
167
|
-
- [`47b01007f27`](https://bitbucket.org/atlassian/atlassian-frontend/commits/47b01007f27) - Introduces color prop with values default and inverse.
|
|
173
|
+
- [#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
174
|
|
|
169
175
|
## 0.1.13
|
|
170
176
|
|
|
171
177
|
### Patch Changes
|
|
172
178
|
|
|
173
|
-
- [`354050b68da`](https://bitbucket.org/atlassian/atlassian-frontend/commits/354050b68da) - Revert font size calculations to raw pixels.
|
|
179
|
+
- [#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
180
|
|
|
175
181
|
## 0.1.12
|
|
176
182
|
|
|
@@ -182,7 +188,7 @@
|
|
|
182
188
|
|
|
183
189
|
### Patch Changes
|
|
184
190
|
|
|
185
|
-
- [`cb2392f6d33`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb2392f6d33) - Upgrade to TypeScript 4.2.4
|
|
191
|
+
- [#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
192
|
|
|
187
193
|
## 0.1.10
|
|
188
194
|
|
|
@@ -206,7 +212,7 @@
|
|
|
206
212
|
|
|
207
213
|
### Patch Changes
|
|
208
214
|
|
|
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
|
|
215
|
+
- [#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
216
|
- Updated dependencies
|
|
211
217
|
|
|
212
218
|
## 0.1.6
|
|
@@ -219,7 +225,7 @@
|
|
|
219
225
|
|
|
220
226
|
### Patch Changes
|
|
221
227
|
|
|
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.
|
|
228
|
+
- [#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
229
|
- Updated dependencies
|
|
224
230
|
|
|
225
231
|
## 0.1.4
|
|
@@ -244,7 +250,7 @@
|
|
|
244
250
|
|
|
245
251
|
### Patch Changes
|
|
246
252
|
|
|
247
|
-
- [`d7a9a4ff7ec`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d7a9a4ff7ec) - Instrumented heading with the new theming package, `@atlaskit/tokens`.
|
|
253
|
+
- [#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
254
|
New tokens will be visible only in applications configured to use the new Tokens API (currently in alpha).
|
|
249
255
|
These changes are intended to be interoperable with the legacy theme implementation.
|
|
250
256
|
Legacy dark mode users should expect no visual or breaking changes.
|
|
@@ -254,7 +260,7 @@
|
|
|
254
260
|
|
|
255
261
|
### Minor Changes
|
|
256
262
|
|
|
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.
|
|
263
|
+
- [#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
264
|
|
|
259
265
|
### Patch Changes
|
|
260
266
|
|
|
@@ -8,15 +8,22 @@ 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
|
-
|
|
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
|
+
*/
|
|
12
19
|
var useHeadingElement = function useHeadingElement() {
|
|
13
|
-
return
|
|
20
|
+
return (0, _react.useContext)(HeadingLevelContext);
|
|
14
21
|
};
|
|
15
22
|
exports.useHeadingElement = useHeadingElement;
|
|
16
23
|
/**
|
|
17
|
-
* __Heading
|
|
24
|
+
* __Heading level provider__
|
|
18
25
|
*
|
|
19
|
-
* The
|
|
26
|
+
* The Heading level provider injectes the heading level to all `Heading` components below it in the component tree.
|
|
20
27
|
*
|
|
21
28
|
* @example
|
|
22
29
|
* ```tsx
|
|
@@ -29,14 +36,14 @@ exports.useHeadingElement = useHeadingElement;
|
|
|
29
36
|
* </HeadingContext>
|
|
30
37
|
* ```
|
|
31
38
|
*/
|
|
32
|
-
var
|
|
39
|
+
var HeadingLevelContextProvider = function HeadingLevelContextProvider(_ref) {
|
|
33
40
|
var children = _ref.children,
|
|
34
41
|
value = _ref.value;
|
|
35
42
|
var parentHeadingLevel = useHeadingElement();
|
|
36
43
|
var headingLevel = parentHeadingLevel + 1;
|
|
37
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement(HeadingLevelContext.Provider, {
|
|
38
45
|
value: value || headingLevel
|
|
39
46
|
}, children);
|
|
40
47
|
};
|
|
41
|
-
var _default =
|
|
48
|
+
var _default = HeadingLevelContextProvider;
|
|
42
49
|
exports.default = _default;
|
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.temp"));
|
|
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
|
+
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
134
|
}, children);
|
|
136
135
|
};
|
|
137
|
-
var _default =
|
|
136
|
+
var _default = function _default(_ref2) {
|
|
137
|
+
var level = _ref2.level,
|
|
138
|
+
variant = _ref2.variant,
|
|
139
|
+
props = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
140
|
+
return level ?
|
|
141
|
+
// eslint-disable-next-line jsx-a11y/heading-has-content
|
|
142
|
+
(0, _react.jsx)(Heading, (0, _extends2.default)({
|
|
143
|
+
level: level
|
|
144
|
+
}, props)) :
|
|
145
|
+
// eslint-disable-next-line jsx-a11y/heading-has-content
|
|
146
|
+
(0, _react.jsx)(_heading.default, (0, _extends2.default)({
|
|
147
|
+
variant: variant
|
|
148
|
+
}, props));
|
|
149
|
+
};
|
|
138
150
|
exports.default = _default;
|
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
css: [headingResetStyles, variant && headingVariantStylesMap[variant], color === 'inverse' && inverseStyles]
|
|
70
|
+
}, children);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @codegenStart
|
|
75
|
+
* @codegenId typography
|
|
76
|
+
* @codegenCommand yarn workspace @atlaskit/heading codegen
|
|
77
|
+
*/
|
|
78
|
+
var headingVariantStylesMap = {
|
|
79
|
+
large: (0, _react.css)({
|
|
80
|
+
font: "var(--ds-font-heading-lg, normal 500 24px/28px var(--ds-font-family-heading))"
|
|
81
|
+
}),
|
|
82
|
+
medium: (0, _react.css)({
|
|
83
|
+
font: "var(--ds-font-heading-md, normal 500 20px/24px var(--ds-font-family-heading))"
|
|
84
|
+
}),
|
|
85
|
+
small: (0, _react.css)({
|
|
86
|
+
font: "var(--ds-font-heading-sm, normal 600 16px/20px var(--ds-font-family-heading))"
|
|
87
|
+
}),
|
|
88
|
+
xlarge: (0, _react.css)({
|
|
89
|
+
font: "var(--ds-font-heading-xl, normal 600 29px/32px var(--ds-font-family-heading))"
|
|
90
|
+
}),
|
|
91
|
+
xsmall: (0, _react.css)({
|
|
92
|
+
font: "var(--ds-font-heading-xs, normal 600 14px/16px var(--ds-font-family-heading))"
|
|
93
|
+
}),
|
|
94
|
+
xxlarge: (0, _react.css)({
|
|
95
|
+
font: "var(--ds-font-heading-xxl, normal 500 35px/40px var(--ds-font-family-heading))"
|
|
96
|
+
}),
|
|
97
|
+
xxsmall: (0, _react.css)({
|
|
98
|
+
font: "var(--ds-font-heading-xxs, normal 600 12px/16px var(--ds-font-family-heading))"
|
|
99
|
+
})
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* @codegenEnd
|
|
103
|
+
*/
|
|
104
|
+
var _default = Heading;
|
|
105
|
+
exports.default = _default;
|
|
@@ -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.temp';
|
|
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,27 @@ 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
|
+
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
125
|
}, children);
|
|
130
126
|
};
|
|
131
|
-
export default
|
|
127
|
+
export default (({
|
|
128
|
+
level,
|
|
129
|
+
variant,
|
|
130
|
+
...props
|
|
131
|
+
}) => {
|
|
132
|
+
return level ?
|
|
133
|
+
// eslint-disable-next-line jsx-a11y/heading-has-content
|
|
134
|
+
jsx(Heading, _extends({
|
|
135
|
+
level: level
|
|
136
|
+
}, props)) :
|
|
137
|
+
// eslint-disable-next-line jsx-a11y/heading-has-content
|
|
138
|
+
jsx(NewHeading, _extends({
|
|
139
|
+
variant: variant
|
|
140
|
+
}, props));
|
|
141
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
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
|
+
css: [headingResetStyles, variant && headingVariantStylesMap[variant], color === 'inverse' && inverseStyles]
|
|
63
|
+
}, children);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @codegenStart
|
|
68
|
+
* @codegenId typography
|
|
69
|
+
* @codegenCommand yarn workspace @atlaskit/heading codegen
|
|
70
|
+
*/
|
|
71
|
+
const headingVariantStylesMap = {
|
|
72
|
+
large: css({
|
|
73
|
+
font: "var(--ds-font-heading-lg, normal 500 24px/28px var(--ds-font-family-heading))"
|
|
74
|
+
}),
|
|
75
|
+
medium: css({
|
|
76
|
+
font: "var(--ds-font-heading-md, normal 500 20px/24px var(--ds-font-family-heading))"
|
|
77
|
+
}),
|
|
78
|
+
small: css({
|
|
79
|
+
font: "var(--ds-font-heading-sm, normal 600 16px/20px var(--ds-font-family-heading))"
|
|
80
|
+
}),
|
|
81
|
+
xlarge: css({
|
|
82
|
+
font: "var(--ds-font-heading-xl, normal 600 29px/32px var(--ds-font-family-heading))"
|
|
83
|
+
}),
|
|
84
|
+
xsmall: css({
|
|
85
|
+
font: "var(--ds-font-heading-xs, normal 600 14px/16px var(--ds-font-family-heading))"
|
|
86
|
+
}),
|
|
87
|
+
xxlarge: css({
|
|
88
|
+
font: "var(--ds-font-heading-xxl, normal 500 35px/40px var(--ds-font-family-heading))"
|
|
89
|
+
}),
|
|
90
|
+
xxsmall: css({
|
|
91
|
+
font: "var(--ds-font-heading-xxs, normal 600 12px/16px var(--ds-font-family-heading))"
|
|
92
|
+
})
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* @codegenEnd
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
export default Heading;
|