@atlaskit/heading 1.3.1 → 1.3.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/heading
2
2
 
3
+ ## 1.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`61cb5313358`](https://bitbucket.org/atlassian/atlassian-frontend/commits/61cb5313358) - Removing unused dependencies and dev dependencies
8
+
9
+ ## 1.3.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
14
+
3
15
  ## 1.3.1
4
16
 
5
17
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/heading",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/heading",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/heading",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "sideEffects": false
5
5
  }
@@ -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,3 @@
1
+ export { default } from './heading';
2
+ export { default as HeadingContextProvider } from './heading-context';
3
+ export type { HeadingProps } from './types';
@@ -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.1",
3
+ "version": "1.3.3",
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",
@@ -37,7 +37,7 @@
37
37
  ".": "./src/index.tsx"
38
38
  },
39
39
  "dependencies": {
40
- "@atlaskit/tokens": "^1.4.0",
40
+ "@atlaskit/tokens": "^1.5.0",
41
41
  "@babel/runtime": "^7.0.0",
42
42
  "@emotion/react": "^11.7.1"
43
43
  },
@@ -45,8 +45,6 @@
45
45
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@atlaskit/button": "^16.7.0",
49
- "@atlaskit/docs": "*",
50
48
  "@atlaskit/ds-explorations": "*",
51
49
  "@atlaskit/ds-lib": "^2.2.0",
52
50
  "@atlaskit/form": "^8.11.0",
@@ -54,7 +52,6 @@
54
52
  "@atlaskit/ssr": "*",
55
53
  "@atlaskit/toggle": "^12.6.0",
56
54
  "@atlaskit/visual-regression": "*",
57
- "@atlaskit/webdriver-runner": "*",
58
55
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
59
56
  "@testing-library/react": "^12.1.5",
60
57
  "react-dom": "^16.8.0",