@atlaskit/heading 4.1.0 → 4.3.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,25 @@
1
1
  # @atlaskit/heading
2
2
 
3
+ ## 4.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#116138](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116138)
8
+ [`b50c5d5d65ae2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b50c5d5d65ae2) -
9
+ Bump to the latest version of @compiled/react
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 4.2.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [#116022](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116022)
20
+ [`49d35008263f7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/49d35008263f7) -
21
+ Added ref forwarding support.
22
+
3
23
  ## 4.1.0
4
24
 
5
25
  ### Minor Changes
@@ -1,4 +1,4 @@
1
- /* heading.partial.tsx generated by @compiled/babel-plugin v0.36.0 */
1
+ /* heading.partial.tsx generated by @compiled/babel-plugin v0.36.1 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -8,7 +8,8 @@ Object.defineProperty(exports, "__esModule", {
8
8
  });
9
9
  exports.default = void 0;
10
10
  require("./heading.partial.compiled.css");
11
- var React = _interopRequireWildcard(require("react"));
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var React = _react;
12
13
  var _runtime = require("@compiled/react/runtime");
13
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
14
15
  var _primitives = require("@atlaskit/primitives");
@@ -77,19 +78,16 @@ var useColor = function useColor(colorProp) {
77
78
  * <Heading size="xxlarge">Page title</Heading>
78
79
  * ```
79
80
  */
80
- var Heading = function Heading(_ref) {
81
- var children = _ref.children,
82
- size = _ref.size,
83
- id = _ref.id,
84
- testId = _ref.testId,
85
- as = _ref.as,
86
- colorProp = _ref.color;
81
+ var Heading = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
82
+ var children = props.children,
83
+ size = props.size,
84
+ id = props.id,
85
+ testId = props.testId,
86
+ as = props.as,
87
+ colorProp = props.color;
87
88
  if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && as && typeof as !== 'string') {
88
89
  throw new Error('`as` prop should be a string.');
89
90
  }
90
-
91
- // Technically size can be undefined here due to how the types work.
92
- // Once removing the level prop this assertion can be removed since size will be a required prop.
93
91
  var _useHeading = (0, _headingContext.useHeading)(sizeTagMap[size]),
94
92
  _useHeading2 = (0, _slicedToArray2.default)(_useHeading, 2),
95
93
  hLevel = _useHeading2[0],
@@ -99,10 +97,11 @@ var Heading = function Heading(_ref) {
99
97
  var color = useColor(colorProp);
100
98
  return /*#__PURE__*/React.createElement(Component, {
101
99
  id: id,
100
+ ref: ref,
102
101
  "data-testid": testId,
103
102
  role: needsAriaRole ? 'heading' : undefined,
104
103
  "aria-level": needsAriaRole ? hLevel : undefined,
105
104
  className: (0, _runtime.ax)([styles.reset, size && headingSizeStylesMap[size], headingColorStylesMap[color]])
106
105
  }, children);
107
- };
106
+ });
108
107
  var _default = exports.default = Heading;
@@ -1,7 +1,8 @@
1
- /* heading.partial.tsx generated by @compiled/babel-plugin v0.36.0 */
1
+ /* heading.partial.tsx generated by @compiled/babel-plugin v0.36.1 */
2
2
  import "./heading.partial.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
+ import { forwardRef } from 'react';
5
6
  import { UNSAFE_inverseColorMap } from '@atlaskit/primitives';
6
7
  import { UNSAFE_useSurface } from '@atlaskit/primitives/compiled';
7
8
  import { useHeading } from './heading-context';
@@ -66,30 +67,29 @@ const useColor = colorProp => {
66
67
  * <Heading size="xxlarge">Page title</Heading>
67
68
  * ```
68
69
  */
69
- const Heading = ({
70
- children,
71
- size,
72
- id,
73
- testId,
74
- as,
75
- color: colorProp
76
- }) => {
70
+ const Heading = /*#__PURE__*/forwardRef((props, ref) => {
71
+ const {
72
+ children,
73
+ size,
74
+ id,
75
+ testId,
76
+ as,
77
+ color: colorProp
78
+ } = props;
77
79
  if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && as && typeof as !== 'string') {
78
80
  throw new Error('`as` prop should be a string.');
79
81
  }
80
-
81
- // Technically size can be undefined here due to how the types work.
82
- // Once removing the level prop this assertion can be removed since size will be a required prop.
83
82
  const [hLevel, inferredElement] = useHeading(sizeTagMap[size]);
84
83
  const Component = as || inferredElement;
85
84
  const needsAriaRole = Component === 'div' && hLevel;
86
85
  const color = useColor(colorProp);
87
86
  return /*#__PURE__*/React.createElement(Component, {
88
87
  id: id,
88
+ ref: ref,
89
89
  "data-testid": testId,
90
90
  role: needsAriaRole ? 'heading' : undefined,
91
91
  "aria-level": needsAriaRole ? hLevel : undefined,
92
92
  className: ax([styles.reset, size && headingSizeStylesMap[size], headingColorStylesMap[color]])
93
93
  }, children);
94
- };
94
+ });
95
95
  export default Heading;
@@ -1,8 +1,9 @@
1
- /* heading.partial.tsx generated by @compiled/babel-plugin v0.36.0 */
1
+ /* heading.partial.tsx generated by @compiled/babel-plugin v0.36.1 */
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import "./heading.partial.compiled.css";
4
4
  import * as React from 'react';
5
5
  import { ax, ix } from "@compiled/react/runtime";
6
+ import { forwardRef } from 'react';
6
7
  import { UNSAFE_inverseColorMap } from '@atlaskit/primitives';
7
8
  import { UNSAFE_useSurface } from '@atlaskit/primitives/compiled';
8
9
  import { useHeading } from './heading-context';
@@ -67,19 +68,16 @@ var useColor = function useColor(colorProp) {
67
68
  * <Heading size="xxlarge">Page title</Heading>
68
69
  * ```
69
70
  */
70
- var Heading = function Heading(_ref) {
71
- var children = _ref.children,
72
- size = _ref.size,
73
- id = _ref.id,
74
- testId = _ref.testId,
75
- as = _ref.as,
76
- colorProp = _ref.color;
71
+ var Heading = /*#__PURE__*/forwardRef(function (props, ref) {
72
+ var children = props.children,
73
+ size = props.size,
74
+ id = props.id,
75
+ testId = props.testId,
76
+ as = props.as,
77
+ colorProp = props.color;
77
78
  if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && as && typeof as !== 'string') {
78
79
  throw new Error('`as` prop should be a string.');
79
80
  }
80
-
81
- // Technically size can be undefined here due to how the types work.
82
- // Once removing the level prop this assertion can be removed since size will be a required prop.
83
81
  var _useHeading = useHeading(sizeTagMap[size]),
84
82
  _useHeading2 = _slicedToArray(_useHeading, 2),
85
83
  hLevel = _useHeading2[0],
@@ -89,10 +87,11 @@ var Heading = function Heading(_ref) {
89
87
  var color = useColor(colorProp);
90
88
  return /*#__PURE__*/React.createElement(Component, {
91
89
  id: id,
90
+ ref: ref,
92
91
  "data-testid": testId,
93
92
  role: needsAriaRole ? 'heading' : undefined,
94
93
  "aria-level": needsAriaRole ? hLevel : undefined,
95
94
  className: ax([styles.reset, size && headingSizeStylesMap[size], headingColorStylesMap[color]])
96
95
  }, children);
97
- };
96
+ });
98
97
  export default Heading;
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from 'react';
1
+ import React, { type ReactNode } from 'react';
2
2
  type HeadingLevel = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
3
3
  type HeadingElement = `h${1 | 2 | 3 | 4 | 5 | 6}` | 'div';
4
4
  /**
@@ -31,5 +31,5 @@ interface HeadingLevelContextProps {
31
31
  * </HeadingContext>
32
32
  * ```
33
33
  */
34
- declare const HeadingLevelContextProvider: ({ children, value }: HeadingLevelContextProps) => JSX.Element;
34
+ declare const HeadingLevelContextProvider: ({ children, value }: HeadingLevelContextProps) => React.JSX.Element;
35
35
  export default HeadingLevelContextProvider;
@@ -77,5 +77,5 @@ type HeadingSize = keyof typeof headingSizeStylesMap;
77
77
  * <Heading size="xxlarge">Page title</Heading>
78
78
  * ```
79
79
  */
80
- declare const Heading: ({ children, size, id, testId, as, color: colorProp }: HeadingProps) => JSX.Element;
80
+ declare const Heading: import("react").ForwardRefExoticComponent<HeadingProps & import("react").RefAttributes<HTMLHeadingElement>>;
81
81
  export default Heading;
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from 'react';
1
+ import React, { type ReactNode } from 'react';
2
2
  type HeadingLevel = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
3
3
  type HeadingElement = `h${1 | 2 | 3 | 4 | 5 | 6}` | 'div';
4
4
  /**
@@ -34,5 +34,5 @@ interface HeadingLevelContextProps {
34
34
  * </HeadingContext>
35
35
  * ```
36
36
  */
37
- declare const HeadingLevelContextProvider: ({ children, value }: HeadingLevelContextProps) => JSX.Element;
37
+ declare const HeadingLevelContextProvider: ({ children, value }: HeadingLevelContextProps) => React.JSX.Element;
38
38
  export default HeadingLevelContextProvider;
@@ -77,5 +77,5 @@ type HeadingSize = keyof typeof headingSizeStylesMap;
77
77
  * <Heading size="xxlarge">Page title</Heading>
78
78
  * ```
79
79
  */
80
- declare const Heading: ({ children, size, id, testId, as, color: colorProp }: HeadingProps) => JSX.Element;
80
+ declare const Heading: import("react").ForwardRefExoticComponent<HeadingProps & import("react").RefAttributes<HTMLHeadingElement>>;
81
81
  export default Heading;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/heading",
3
- "version": "4.1.0",
3
+ "version": "4.3.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/"
@@ -31,11 +31,11 @@
31
31
  "codegen": "ts-node ./scripts/codegen.tsx"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/css": "^0.8.0",
35
- "@atlaskit/primitives": "^13.4.0",
34
+ "@atlaskit/css": "^0.9.0",
35
+ "@atlaskit/primitives": "^13.6.0",
36
36
  "@atlaskit/tokens": "^3.3.0",
37
37
  "@babel/runtime": "^7.0.0",
38
- "@compiled/react": "^0.18.1",
38
+ "@compiled/react": "^0.18.2",
39
39
  "@emotion/react": "^11.7.1"
40
40
  },
41
41
  "peerDependencies": {
@@ -46,7 +46,7 @@
46
46
  "@af/formatting": "*",
47
47
  "@af/integration-testing": "*",
48
48
  "@af/visual-regression": "*",
49
- "@atlaskit/button": "^20.4.0",
49
+ "@atlaskit/button": "^20.5.0",
50
50
  "@atlaskit/ds-lib": "^3.5.0",
51
51
  "@atlaskit/ssr": "*",
52
52
  "@atlassian/codegen": "^0.1.0",