carbon-react 114.15.0 → 114.16.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.
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { MarginProps } from "styled-system";
3
3
  import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
4
+ export declare type HeadingType = "h1" | "h2" | "h3" | "h4" | "h5";
4
5
  export interface HeadingProps extends MarginProps, TagProps {
5
6
  /** Child elements */
6
7
  children?: React.ReactNode;
@@ -12,6 +13,8 @@ export interface HeadingProps extends MarginProps, TagProps {
12
13
  subheader?: React.ReactNode;
13
14
  /** Defines the subtitle id for the heading. */
14
15
  subtitleId?: string;
16
+ /** Defines the HTML heading element of the title. */
17
+ headingType?: HeadingType;
15
18
  /** Defines the help text for the heading. */
16
19
  help?: string;
17
20
  /** Defines the help link for the heading. */
@@ -27,5 +30,5 @@ export interface HeadingProps extends MarginProps, TagProps {
27
30
  /** Aria label for rendered help component */
28
31
  helpAriaLabel?: string;
29
32
  }
30
- export declare const Heading: ({ children, backLink, divider, help, helpAriaLabel, helpLink, pills, separator, subheader, subtitleId, title, titleId, ...rest }: HeadingProps) => JSX.Element | null;
33
+ export declare const Heading: ({ children, backLink, divider, help, helpAriaLabel, helpLink, pills, separator, subheader, subtitleId, headingType, title, titleId, ...rest }: HeadingProps) => JSX.Element | null;
31
34
  export default Heading;
@@ -18,6 +18,7 @@ const Heading = ({
18
18
  separator = false,
19
19
  subheader,
20
20
  subtitleId,
21
+ headingType = "h1",
21
22
  title,
22
23
  titleId,
23
24
  ...rest
@@ -76,7 +77,7 @@ const Heading = ({
76
77
  hasBackLink: !!backLink
77
78
  }, backLink && getBackButton(), /*#__PURE__*/React.createElement(StyledHeaderContent, null, /*#__PURE__*/React.createElement(StyledHeadingTitle, {
78
79
  withMargin: !!pills || !!help,
79
- variant: "h1",
80
+ variant: headingType,
80
81
  "data-element": "title",
81
82
  id: titleId
82
83
  }, title), (help || helpLink) && getHelp(), pills && getPills()), separator && /*#__PURE__*/React.createElement(StyledSeparator, null), subheader && getSubheader()), divider && /*#__PURE__*/React.createElement(StyledDivider, {
@@ -91,6 +92,7 @@ Heading.propTypes = {
91
92
  "data-element": PropTypes.string,
92
93
  "data-role": PropTypes.string,
93
94
  "divider": PropTypes.bool,
95
+ "headingType": PropTypes.oneOf(["h1", "h2", "h3", "h4", "h5"]),
94
96
  "help": PropTypes.string,
95
97
  "helpAriaLabel": PropTypes.string,
96
98
  "helpLink": PropTypes.string,
@@ -1,2 +1,2 @@
1
1
  export { default } from "./heading.component";
2
- export type { HeadingProps } from "./heading.component";
2
+ export type { HeadingProps, HeadingType } from "./heading.component";
@@ -11,6 +11,7 @@ const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.spac
11
11
 
12
12
  const SettingsRow = ({
13
13
  title,
14
+ headingType = "h3",
14
15
  description,
15
16
  children,
16
17
  className,
@@ -20,6 +21,7 @@ const SettingsRow = ({
20
21
  const heading = () => {
21
22
  if (!title) return null;
22
23
  return /*#__PURE__*/React.createElement(Heading, {
24
+ headingType: headingType,
23
25
  title: title,
24
26
  subheader: description,
25
27
  separator: description !== undefined,
@@ -46,6 +48,9 @@ SettingsRow.propTypes = { ...marginPropTypes,
46
48
  /** A title for this group of settings. */
47
49
  title: PropTypes.string,
48
50
 
51
+ /** Defines the HTML heading element of the `title` within the component. */
52
+ headingType: PropTypes.oneOf(["h1", "h2", "h3", "h4", "h5"]),
53
+
49
54
  /** A string or JSX object that provides a short description about the group of settings. */
50
55
  description: PropTypes.node,
51
56
 
@@ -1,10 +1,13 @@
1
1
  import * as React from "react";
2
+ import { HeadingType } from "../heading";
2
3
 
3
4
  export interface SettingsRowProps {
4
5
  /** The CSS classes to apply to the component. */
5
6
  className?: string;
6
7
  /** A title for this group of settings. */
7
8
  title?: string;
9
+ /** Defines the HTML heading element of the `title` within the component. */
10
+ headingType?: HeadingType;
8
11
  /** A string or JSX object that provides a short description about the group of settings. */
9
12
  description?: React.ReactNode;
10
13
  /** Shows a divider below the component. */
@@ -1,7 +1,7 @@
1
1
  import styled, { css } from "styled-components";
2
2
  import { margin } from "styled-system";
3
3
  import baseTheme from "../../style/themes/base";
4
- import { StyledHeader, StyledHeadingTitle, StyledSeparator } from "../heading/heading.style";
4
+ import { StyledHeader, StyledSeparator } from "../heading/heading.style";
5
5
  export const StyledSettingsRow = styled.div`
6
6
  ${margin}
7
7
 
@@ -24,15 +24,6 @@ export const StyledSettingsRow = styled.div`
24
24
  margin-bottom: 0;
25
25
  }
26
26
 
27
- ${StyledHeadingTitle} {
28
- color: var(--colorsUtilityYin090);
29
- font-size: 15px;
30
- font-weight: bold;
31
- line-height: 18px;
32
- margin-bottom: 10px;
33
- text-transform: uppercase;
34
- }
35
-
36
27
  ${StyledSeparator} {
37
28
  margin-bottom: 17px;
38
29
  }
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { MarginProps } from "styled-system";
3
3
  import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
4
+ export declare type HeadingType = "h1" | "h2" | "h3" | "h4" | "h5";
4
5
  export interface HeadingProps extends MarginProps, TagProps {
5
6
  /** Child elements */
6
7
  children?: React.ReactNode;
@@ -12,6 +13,8 @@ export interface HeadingProps extends MarginProps, TagProps {
12
13
  subheader?: React.ReactNode;
13
14
  /** Defines the subtitle id for the heading. */
14
15
  subtitleId?: string;
16
+ /** Defines the HTML heading element of the title. */
17
+ headingType?: HeadingType;
15
18
  /** Defines the help text for the heading. */
16
19
  help?: string;
17
20
  /** Defines the help link for the heading. */
@@ -27,5 +30,5 @@ export interface HeadingProps extends MarginProps, TagProps {
27
30
  /** Aria label for rendered help component */
28
31
  helpAriaLabel?: string;
29
32
  }
30
- export declare const Heading: ({ children, backLink, divider, help, helpAriaLabel, helpLink, pills, separator, subheader, subtitleId, title, titleId, ...rest }: HeadingProps) => JSX.Element | null;
33
+ export declare const Heading: ({ children, backLink, divider, help, helpAriaLabel, helpLink, pills, separator, subheader, subtitleId, headingType, title, titleId, ...rest }: HeadingProps) => JSX.Element | null;
31
34
  export default Heading;
@@ -32,6 +32,7 @@ const Heading = ({
32
32
  separator = false,
33
33
  subheader,
34
34
  subtitleId,
35
+ headingType = "h1",
35
36
  title,
36
37
  titleId,
37
38
  ...rest
@@ -90,7 +91,7 @@ const Heading = ({
90
91
  hasBackLink: !!backLink
91
92
  }, backLink && getBackButton(), /*#__PURE__*/_react.default.createElement(_heading.StyledHeaderContent, null, /*#__PURE__*/_react.default.createElement(_heading.StyledHeadingTitle, {
92
93
  withMargin: !!pills || !!help,
93
- variant: "h1",
94
+ variant: headingType,
94
95
  "data-element": "title",
95
96
  id: titleId
96
97
  }, title), (help || helpLink) && getHelp(), pills && getPills()), separator && /*#__PURE__*/_react.default.createElement(_heading.StyledSeparator, null), subheader && getSubheader()), divider && /*#__PURE__*/_react.default.createElement(_heading.StyledDivider, {
@@ -106,6 +107,7 @@ Heading.propTypes = {
106
107
  "data-element": _propTypes.default.string,
107
108
  "data-role": _propTypes.default.string,
108
109
  "divider": _propTypes.default.bool,
110
+ "headingType": _propTypes.default.oneOf(["h1", "h2", "h3", "h4", "h5"]),
109
111
  "help": _propTypes.default.string,
110
112
  "helpAriaLabel": _propTypes.default.string,
111
113
  "helpLink": _propTypes.default.string,
@@ -1,2 +1,2 @@
1
1
  export { default } from "./heading.component";
2
- export type { HeadingProps } from "./heading.component";
2
+ export type { HeadingProps, HeadingType } from "./heading.component";
@@ -27,6 +27,7 @@ const marginPropTypes = (0, _utils.filterStyledSystemMarginProps)(_propTypes2.de
27
27
 
28
28
  const SettingsRow = ({
29
29
  title,
30
+ headingType = "h3",
30
31
  description,
31
32
  children,
32
33
  className,
@@ -36,6 +37,7 @@ const SettingsRow = ({
36
37
  const heading = () => {
37
38
  if (!title) return null;
38
39
  return /*#__PURE__*/_react.default.createElement(_heading.default, {
40
+ headingType: headingType,
39
41
  title: title,
40
42
  subheader: description,
41
43
  separator: description !== undefined,
@@ -62,6 +64,9 @@ SettingsRow.propTypes = { ...marginPropTypes,
62
64
  /** A title for this group of settings. */
63
65
  title: _propTypes.default.string,
64
66
 
67
+ /** Defines the HTML heading element of the `title` within the component. */
68
+ headingType: _propTypes.default.oneOf(["h1", "h2", "h3", "h4", "h5"]),
69
+
65
70
  /** A string or JSX object that provides a short description about the group of settings. */
66
71
  description: _propTypes.default.node,
67
72
 
@@ -1,10 +1,13 @@
1
1
  import * as React from "react";
2
+ import { HeadingType } from "../heading";
2
3
 
3
4
  export interface SettingsRowProps {
4
5
  /** The CSS classes to apply to the component. */
5
6
  className?: string;
6
7
  /** A title for this group of settings. */
7
8
  title?: string;
9
+ /** Defines the HTML heading element of the `title` within the component. */
10
+ headingType?: HeadingType;
8
11
  /** A string or JSX object that provides a short description about the group of settings. */
9
12
  description?: React.ReactNode;
10
13
  /** Shows a divider below the component. */
@@ -41,15 +41,6 @@ const StyledSettingsRow = _styledComponents.default.div`
41
41
  margin-bottom: 0;
42
42
  }
43
43
 
44
- ${_heading.StyledHeadingTitle} {
45
- color: var(--colorsUtilityYin090);
46
- font-size: 15px;
47
- font-weight: bold;
48
- line-height: 18px;
49
- margin-bottom: 10px;
50
- text-transform: uppercase;
51
- }
52
-
53
44
  ${_heading.StyledSeparator} {
54
45
  margin-bottom: 17px;
55
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "114.15.0",
3
+ "version": "114.16.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",