@atlaskit/heading 3.0.0 → 3.1.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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/heading
2
2
 
3
+ ## 3.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#166220](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/166220)
8
+ [`c02bd4e1ce076`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c02bd4e1ce076) -
9
+ Removed unused types related to the old Heading API. Exported types for the Heading component are
10
+ now `HeadingProps` and `HeadingColor`. Removed circular type references.
11
+
3
12
  ## 3.0.0
4
13
 
5
14
  ### Major Changes
@@ -3,6 +3,7 @@
3
3
  * @jsx jsx
4
4
  */
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
+
6
7
  import { css, jsx } from '@emotion/react';
7
8
  import { UNSAFE_inverseColorMap, UNSAFE_useSurface } from '@atlaskit/primitives';
8
9
  import { useHeading } from './heading-context';
@@ -4,6 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  * @jsx jsx
5
5
  */
6
6
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
7
+
7
8
  import { css, jsx } from '@emotion/react';
8
9
  import { UNSAFE_inverseColorMap, UNSAFE_useSurface } from '@atlaskit/primitives';
9
10
  import { useHeading } from './heading-context';
@@ -2,8 +2,41 @@
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
4
  */
5
+ import { type ReactNode } from 'react';
5
6
  import { jsx, type SerializedStyles } from '@emotion/react';
6
- import type { NewHeadingProps } from './types';
7
+ export type HeadingColor = 'color.text' | 'color.text.inverse' | 'color.text.warning.inverse';
8
+ export type HeadingProps = {
9
+ /**
10
+ * Heading size. This value is detached from the specific heading level applied to allow for more flexibility.
11
+ * Use instead of the deprecated `level` prop.
12
+ *
13
+ */
14
+ size: HeadingSize;
15
+ /**
16
+ * Allows the component to be rendered as the specified DOM element, overriding a default element set by `level` prop.
17
+ */
18
+ as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div' | 'span';
19
+ /**
20
+ * Token representing text color with a built-in fallback value.
21
+ * Will apply inverse text color automatically if placed within a Box with bold background color.
22
+ * Defaults to `color.text`.
23
+ */
24
+ color?: HeadingColor;
25
+ /**
26
+ * The text of the heading.
27
+ */
28
+ children: ReactNode;
29
+ /**
30
+ * Unique identifier for the heading DOM element.
31
+ */
32
+ id?: string;
33
+ /**
34
+ * A `testId` prop is provided for specified elements, which is a unique
35
+ * string that appears as a data attribute `data-testid` in the rendered code,
36
+ * serving as a hook for automated tests.
37
+ */
38
+ testId?: string;
39
+ };
7
40
  /**
8
41
  * __Heading__
9
42
  *
@@ -15,7 +48,7 @@ import type { NewHeadingProps } from './types';
15
48
  * <Heading size="xxlarge">Page title</Heading>
16
49
  * ```
17
50
  */
18
- declare const Heading: ({ children, size, id, testId, as, color: colorProp }: NewHeadingProps) => jsx.JSX.Element;
51
+ declare const Heading: ({ children, size, id, testId, as, color: colorProp }: HeadingProps) => jsx.JSX.Element;
19
52
  /**
20
53
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
21
54
  * @codegen <<SignedSource::df829c6c0aa19bb57c0c77dc08d12d60>>
@@ -1,3 +1,2 @@
1
- export { default } from './heading.partial';
1
+ export { default, type HeadingProps } from './heading.partial';
2
2
  export { default as HeadingContextProvider } from './heading-context';
3
- export type { HeadingProps } from './types';
@@ -2,8 +2,41 @@
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
4
  */
5
+ import { type ReactNode } from 'react';
5
6
  import { jsx, type SerializedStyles } from '@emotion/react';
6
- import type { NewHeadingProps } from './types';
7
+ export type HeadingColor = 'color.text' | 'color.text.inverse' | 'color.text.warning.inverse';
8
+ export type HeadingProps = {
9
+ /**
10
+ * Heading size. This value is detached from the specific heading level applied to allow for more flexibility.
11
+ * Use instead of the deprecated `level` prop.
12
+ *
13
+ */
14
+ size: HeadingSize;
15
+ /**
16
+ * Allows the component to be rendered as the specified DOM element, overriding a default element set by `level` prop.
17
+ */
18
+ as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div' | 'span';
19
+ /**
20
+ * Token representing text color with a built-in fallback value.
21
+ * Will apply inverse text color automatically if placed within a Box with bold background color.
22
+ * Defaults to `color.text`.
23
+ */
24
+ color?: HeadingColor;
25
+ /**
26
+ * The text of the heading.
27
+ */
28
+ children: ReactNode;
29
+ /**
30
+ * Unique identifier for the heading DOM element.
31
+ */
32
+ id?: string;
33
+ /**
34
+ * A `testId` prop is provided for specified elements, which is a unique
35
+ * string that appears as a data attribute `data-testid` in the rendered code,
36
+ * serving as a hook for automated tests.
37
+ */
38
+ testId?: string;
39
+ };
7
40
  /**
8
41
  * __Heading__
9
42
  *
@@ -15,7 +48,7 @@ import type { NewHeadingProps } from './types';
15
48
  * <Heading size="xxlarge">Page title</Heading>
16
49
  * ```
17
50
  */
18
- declare const Heading: ({ children, size, id, testId, as, color: colorProp }: NewHeadingProps) => jsx.JSX.Element;
51
+ declare const Heading: ({ children, size, id, testId, as, color: colorProp }: HeadingProps) => jsx.JSX.Element;
19
52
  /**
20
53
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
21
54
  * @codegen <<SignedSource::df829c6c0aa19bb57c0c77dc08d12d60>>
@@ -1,3 +1,2 @@
1
- export { default } from './heading.partial';
1
+ export { default, type HeadingProps } from './heading.partial';
2
2
  export { default as HeadingContextProvider } from './heading-context';
3
- export type { HeadingProps } from './types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/heading",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "A heading is a typography component used to display text in different sizes and formats.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
package/dist/cjs/types.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
@@ -1 +0,0 @@
1
- export {};
package/dist/esm/types.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,74 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import { type HeadingSize } from './heading.partial';
3
- type HeadingPropsBase = {
4
- /**
5
- * A `testId` prop is provided for specified elements, which is a unique
6
- * string that appears as a data attribute `data-testid` in the rendered code,
7
- * serving as a hook for automated tests.
8
- */
9
- testId?: string;
10
- /**
11
- * The text of the heading.
12
- */
13
- children: ReactNode;
14
- /**
15
- * Unique identifier for the heading DOM element.
16
- */
17
- id?: string;
18
- /**
19
- * Allows the component to be rendered as the specified DOM element, overriding a default element set by `level` prop.
20
- */
21
- as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div' | 'span';
22
- };
23
- export type OldHeadingProps = HeadingPropsBase & {
24
- /**
25
- * Text color of the heading. Use `"inverse"` option for a light text color over a dark background.
26
- * Defaults to `"default"`.
27
- */
28
- color?: 'inverse' | 'default';
29
- /**
30
- * @private
31
- * @deprecated Use `size` prop instead.
32
- * The heading level as defined by the Atlassian Design [typography foundations](/foundations/typography/). The `level` prop affects the actual HTML element rendered in the DOM:
33
- * @example
34
- * ```js
35
- * const levelMap = {
36
- * h900: 'h1',
37
- * h800: 'h1',
38
- * h700: 'h2',
39
- * h600: 'h3',
40
- * h500: 'h4',
41
- * h400: 'h5',
42
- * h300: 'h6',
43
- * h200: 'div',
44
- * h100: 'div',
45
- * };
46
- * ```
47
- *
48
- * It's important to note that the final DOM may be impacted by the parent heading level context because of inferred accessibility level correction.
49
- * Therefore, it is recommended to check the final DOM to confirm the actual rendered HTML element.
50
- */
51
- level: 'h900' | 'h800' | 'h700' | 'h600' | 'h500' | 'h400' | 'h300' | 'h200' | 'h100';
52
- /**
53
- * Heading size. Use instead of the deprecated `level` prop.
54
- */
55
- size?: never;
56
- };
57
- export type HeadingColor = 'color.text' | 'color.text.inverse' | 'color.text.warning.inverse';
58
- export type NewHeadingProps = HeadingPropsBase & {
59
- /**
60
- * Token representing text color with a built-in fallback value.
61
- * Will apply inverse text color automatically if placed within a Box with bold background color.
62
- * Defaults to `color.text`.
63
- */
64
- color?: HeadingColor;
65
- /**
66
- * Heading size. This value is detached from the specific heading level applied to allow for more flexibility.
67
- * Use instead of the deprecated `level` prop.
68
- *
69
- */
70
- size: HeadingSize;
71
- level?: never;
72
- };
73
- export type HeadingProps = OldHeadingProps | NewHeadingProps;
74
- export {};
@@ -1,74 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import { type HeadingSize } from './heading.partial';
3
- type HeadingPropsBase = {
4
- /**
5
- * A `testId` prop is provided for specified elements, which is a unique
6
- * string that appears as a data attribute `data-testid` in the rendered code,
7
- * serving as a hook for automated tests.
8
- */
9
- testId?: string;
10
- /**
11
- * The text of the heading.
12
- */
13
- children: ReactNode;
14
- /**
15
- * Unique identifier for the heading DOM element.
16
- */
17
- id?: string;
18
- /**
19
- * Allows the component to be rendered as the specified DOM element, overriding a default element set by `level` prop.
20
- */
21
- as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div' | 'span';
22
- };
23
- export type OldHeadingProps = HeadingPropsBase & {
24
- /**
25
- * Text color of the heading. Use `"inverse"` option for a light text color over a dark background.
26
- * Defaults to `"default"`.
27
- */
28
- color?: 'inverse' | 'default';
29
- /**
30
- * @private
31
- * @deprecated Use `size` prop instead.
32
- * The heading level as defined by the Atlassian Design [typography foundations](/foundations/typography/). The `level` prop affects the actual HTML element rendered in the DOM:
33
- * @example
34
- * ```js
35
- * const levelMap = {
36
- * h900: 'h1',
37
- * h800: 'h1',
38
- * h700: 'h2',
39
- * h600: 'h3',
40
- * h500: 'h4',
41
- * h400: 'h5',
42
- * h300: 'h6',
43
- * h200: 'div',
44
- * h100: 'div',
45
- * };
46
- * ```
47
- *
48
- * It's important to note that the final DOM may be impacted by the parent heading level context because of inferred accessibility level correction.
49
- * Therefore, it is recommended to check the final DOM to confirm the actual rendered HTML element.
50
- */
51
- level: 'h900' | 'h800' | 'h700' | 'h600' | 'h500' | 'h400' | 'h300' | 'h200' | 'h100';
52
- /**
53
- * Heading size. Use instead of the deprecated `level` prop.
54
- */
55
- size?: never;
56
- };
57
- export type HeadingColor = 'color.text' | 'color.text.inverse' | 'color.text.warning.inverse';
58
- export type NewHeadingProps = HeadingPropsBase & {
59
- /**
60
- * Token representing text color with a built-in fallback value.
61
- * Will apply inverse text color automatically if placed within a Box with bold background color.
62
- * Defaults to `color.text`.
63
- */
64
- color?: HeadingColor;
65
- /**
66
- * Heading size. This value is detached from the specific heading level applied to allow for more flexibility.
67
- * Use instead of the deprecated `level` prop.
68
- *
69
- */
70
- size: HeadingSize;
71
- level?: never;
72
- };
73
- export type HeadingProps = OldHeadingProps | NewHeadingProps;
74
- export {};