@atlaskit/heading 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/heading-context.d.ts +1 -1
- package/dist/types/types.d.ts +1 -1
- package/dist/types-ts4.5/heading-context.d.ts +28 -0
- package/dist/types-ts4.5/heading.d.ts +20 -0
- package/dist/types-ts4.5/index.d.ts +3 -0
- package/dist/types-ts4.5/types.d.ts +49 -0
- package/dist/types-ts4.5/utils.d.ts +1 -0
- package/package.json +11 -3
- package/tmp/api-report-tmp.d.ts +39 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/heading
|
|
2
2
|
|
|
3
|
+
## 1.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
|
|
8
|
+
|
|
9
|
+
## 1.3.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
|
|
14
|
+
|
|
3
15
|
## 1.3.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/version.json
CHANGED
package/dist/esm/version.json
CHANGED
package/dist/types/types.d.ts
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
type HeadingElement = 1 | 2 | 3 | 4 | 5 | 6;
|
|
3
|
+
export declare const useHeadingElement: () => HeadingElement;
|
|
4
|
+
export interface HeadingContextProps {
|
|
5
|
+
/**
|
|
6
|
+
* Optional - only apply this value if the intent is to reset the heading context outside the normal content flow, for example inside a `section`.
|
|
7
|
+
*/
|
|
8
|
+
value?: HeadingElement;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* __Heading context__
|
|
13
|
+
*
|
|
14
|
+
* The HeadingContext
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* // Will correctly infer the heading level
|
|
19
|
+
* <HeadingContext value={1}>
|
|
20
|
+
* <Heading>H1</Heading>
|
|
21
|
+
* <HeadingContext>
|
|
22
|
+
* <Heading>H2</Heading>
|
|
23
|
+
* </HeadingContext>
|
|
24
|
+
* </HeadingContext>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
declare const HeadingContextProvider: FC<HeadingContextProps>;
|
|
28
|
+
export default HeadingContextProvider;
|
|
@@ -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,49 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export 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 the Atlasian Design [typography foundations](/foundations/typography/).
|
|
15
|
+
|
|
16
|
+
The `level` prop affects the actual HTML element rendered in the DOM:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
const levelMap = {
|
|
20
|
+
h900: 'h1',
|
|
21
|
+
h800: 'h1',
|
|
22
|
+
h700: 'h2',
|
|
23
|
+
h600: 'h3',
|
|
24
|
+
h500: 'h4',
|
|
25
|
+
h400: 'h5',
|
|
26
|
+
h300: 'h6',
|
|
27
|
+
h200: 'div',
|
|
28
|
+
h100: 'div',
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
It's important to note that the final DOM may be impacted by the parent heading level context because of inferred accessibility level correction.
|
|
33
|
+
Therefore, it is recommended to check the final DOM to confirm the actual rendered HTML element.
|
|
34
|
+
*/
|
|
35
|
+
level: 'h900' | 'h800' | 'h700' | 'h600' | 'h500' | 'h400' | 'h300' | 'h200' | 'h100';
|
|
36
|
+
/**
|
|
37
|
+
* Unique identifier for the heading DOM element.
|
|
38
|
+
*/
|
|
39
|
+
id?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Allows the component to be rendered as the specified DOM element, overriding a default element set by `level` prop.
|
|
42
|
+
*/
|
|
43
|
+
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div' | 'span';
|
|
44
|
+
/**
|
|
45
|
+
* Text color of the heading. Use `"inverse"` option for a light text color over a dark background.
|
|
46
|
+
* Defaults to `"default"`.
|
|
47
|
+
*/
|
|
48
|
+
color?: 'inverse' | 'default';
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const lh: (sizePx: number, lineHeightPx: number) => number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/heading",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "A heading is a typography component used to display text in different sizes and formats.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,13 +23,21 @@
|
|
|
23
23
|
"module": "dist/esm/index.js",
|
|
24
24
|
"module:es2019": "dist/es2019/index.js",
|
|
25
25
|
"types": "dist/types/index.d.ts",
|
|
26
|
+
"typesVersions": {
|
|
27
|
+
">=4.5 <4.9": {
|
|
28
|
+
"*": [
|
|
29
|
+
"dist/types-ts4.5/*",
|
|
30
|
+
"dist/types-ts4.5/index.d.ts"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
26
34
|
"sideEffects": false,
|
|
27
35
|
"atlaskit:src": "src/index.tsx",
|
|
28
36
|
"af:exports": {
|
|
29
37
|
".": "./src/index.tsx"
|
|
30
38
|
},
|
|
31
39
|
"dependencies": {
|
|
32
|
-
"@atlaskit/tokens": "^1.
|
|
40
|
+
"@atlaskit/tokens": "^1.4.0",
|
|
33
41
|
"@babel/runtime": "^7.0.0",
|
|
34
42
|
"@emotion/react": "^11.7.1"
|
|
35
43
|
},
|
|
@@ -50,7 +58,7 @@
|
|
|
50
58
|
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
51
59
|
"@testing-library/react": "^12.1.5",
|
|
52
60
|
"react-dom": "^16.8.0",
|
|
53
|
-
"typescript": "4.
|
|
61
|
+
"typescript": "~4.9.5",
|
|
54
62
|
"wait-for-expect": "^1.2.0"
|
|
55
63
|
},
|
|
56
64
|
"techstack": {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/heading"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { FC } from 'react';
|
|
8
|
+
import { ReactNode } from 'react';
|
|
9
|
+
|
|
10
|
+
// @public
|
|
11
|
+
const Heading: FC<HeadingProps>;
|
|
12
|
+
export default Heading;
|
|
13
|
+
|
|
14
|
+
// @public (undocumented)
|
|
15
|
+
interface HeadingContextProps {
|
|
16
|
+
// (undocumented)
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
value?: HeadingElement;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// @public
|
|
22
|
+
export const HeadingContextProvider: FC<HeadingContextProps>;
|
|
23
|
+
|
|
24
|
+
// @public (undocumented)
|
|
25
|
+
type HeadingElement = 1 | 2 | 3 | 4 | 5 | 6;
|
|
26
|
+
|
|
27
|
+
// @public (undocumented)
|
|
28
|
+
export type HeadingProps = {
|
|
29
|
+
testId?: string;
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
level: 'h100' | 'h200' | 'h300' | 'h400' | 'h500' | 'h600' | 'h700' | 'h800' | 'h900';
|
|
32
|
+
id?: string;
|
|
33
|
+
as?: 'div' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span';
|
|
34
|
+
color?: 'default' | 'inverse';
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// (No @packageDocumentation comment for this package)
|
|
38
|
+
|
|
39
|
+
```
|