@atlaskit/section-message 8.12.15 → 8.13.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,13 @@
|
|
|
1
1
|
# @atlaskit/section-message
|
|
2
2
|
|
|
3
|
+
## 8.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`36317b7bc1752`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/36317b7bc1752) -
|
|
8
|
+
Add `headingLevel` prop to customize heading element and ensure makers can use proper and
|
|
9
|
+
accessible heading structures.
|
|
10
|
+
|
|
3
11
|
## 8.12.15
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -51,6 +51,8 @@ var SectionMessage = /*#__PURE__*/(0, _react.forwardRef)(function SectionMessage
|
|
|
51
51
|
appearance = _ref$appearance === void 0 ? 'information' : _ref$appearance,
|
|
52
52
|
actions = _ref.actions,
|
|
53
53
|
title = _ref.title,
|
|
54
|
+
_ref$headingLevel = _ref.headingLevel,
|
|
55
|
+
headingLevel = _ref$headingLevel === void 0 ? 'h2' : _ref$headingLevel,
|
|
54
56
|
icon = _ref.icon,
|
|
55
57
|
isDismissible = _ref.isDismissible,
|
|
56
58
|
onDismiss = _ref.onDismiss,
|
|
@@ -91,7 +93,7 @@ var SectionMessage = /*#__PURE__*/(0, _react.forwardRef)(function SectionMessage
|
|
|
91
93
|
testId: testId && "".concat(testId, "--content"),
|
|
92
94
|
xcss: sectionMessageStyles.contentContainer
|
|
93
95
|
}, !!title && /*#__PURE__*/React.createElement(_heading.default, {
|
|
94
|
-
as:
|
|
96
|
+
as: headingLevel,
|
|
95
97
|
size: "small"
|
|
96
98
|
}, title), /*#__PURE__*/React.createElement("div", {
|
|
97
99
|
className: (0, _runtime.ax)([sectionMessageStyles.content])
|
|
@@ -40,6 +40,7 @@ const SectionMessage = /*#__PURE__*/forwardRef(function SectionMessage({
|
|
|
40
40
|
appearance = 'information',
|
|
41
41
|
actions,
|
|
42
42
|
title,
|
|
43
|
+
headingLevel = 'h2',
|
|
43
44
|
icon,
|
|
44
45
|
isDismissible,
|
|
45
46
|
onDismiss,
|
|
@@ -79,7 +80,7 @@ const SectionMessage = /*#__PURE__*/forwardRef(function SectionMessage({
|
|
|
79
80
|
testId: testId && `${testId}--content`,
|
|
80
81
|
xcss: sectionMessageStyles.contentContainer
|
|
81
82
|
}, !!title && /*#__PURE__*/React.createElement(Heading, {
|
|
82
|
-
as:
|
|
83
|
+
as: headingLevel,
|
|
83
84
|
size: "small"
|
|
84
85
|
}, title), /*#__PURE__*/React.createElement("div", {
|
|
85
86
|
className: ax([sectionMessageStyles.content])
|
|
@@ -42,6 +42,8 @@ var SectionMessage = /*#__PURE__*/forwardRef(function SectionMessage(_ref, ref)
|
|
|
42
42
|
appearance = _ref$appearance === void 0 ? 'information' : _ref$appearance,
|
|
43
43
|
actions = _ref.actions,
|
|
44
44
|
title = _ref.title,
|
|
45
|
+
_ref$headingLevel = _ref.headingLevel,
|
|
46
|
+
headingLevel = _ref$headingLevel === void 0 ? 'h2' : _ref$headingLevel,
|
|
45
47
|
icon = _ref.icon,
|
|
46
48
|
isDismissible = _ref.isDismissible,
|
|
47
49
|
onDismiss = _ref.onDismiss,
|
|
@@ -82,7 +84,7 @@ var SectionMessage = /*#__PURE__*/forwardRef(function SectionMessage(_ref, ref)
|
|
|
82
84
|
testId: testId && "".concat(testId, "--content"),
|
|
83
85
|
xcss: sectionMessageStyles.contentContainer
|
|
84
86
|
}, !!title && /*#__PURE__*/React.createElement(Heading, {
|
|
85
|
-
as:
|
|
87
|
+
as: headingLevel,
|
|
86
88
|
size: "small"
|
|
87
89
|
}, title), /*#__PURE__*/React.createElement("div", {
|
|
88
90
|
className: ax([sectionMessageStyles.content])
|
package/dist/types/types.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
|
4
4
|
* Appearance determines the icon and background color pairing indicating the message type
|
|
5
5
|
*/
|
|
6
6
|
export type Appearance = 'information' | 'warning' | 'error' | 'success' | 'discovery';
|
|
7
|
-
|
|
7
|
+
type HeadingElements = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
8
|
+
interface BaseSectionMessageProps {
|
|
8
9
|
/**
|
|
9
10
|
* The appearance styling to use for the section message.
|
|
10
11
|
*/
|
|
@@ -14,6 +15,11 @@ export interface SectionMessageProps {
|
|
|
14
15
|
* we recommend that this should be a paragraph.
|
|
15
16
|
*/
|
|
16
17
|
children: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Allows the section message's `title` to be rendered as the specified HTML
|
|
20
|
+
* heading element. The default heading element is `h2`.
|
|
21
|
+
*/
|
|
22
|
+
headingLevel?: HeadingElements;
|
|
17
23
|
/**
|
|
18
24
|
* The heading of the section message.
|
|
19
25
|
*/
|
|
@@ -49,6 +55,14 @@ export interface SectionMessageProps {
|
|
|
49
55
|
*/
|
|
50
56
|
testId?: string;
|
|
51
57
|
}
|
|
58
|
+
type ConditionalSectionMessageProps = {
|
|
59
|
+
headingLevel?: HeadingElements;
|
|
60
|
+
title: string;
|
|
61
|
+
} | {
|
|
62
|
+
headingLevel?: never;
|
|
63
|
+
title?: never;
|
|
64
|
+
};
|
|
65
|
+
export type SectionMessageProps = BaseSectionMessageProps & ConditionalSectionMessageProps;
|
|
52
66
|
export interface SectionMessageActionProps {
|
|
53
67
|
/**
|
|
54
68
|
* The text that needs to be displayed for section message action.
|
|
@@ -82,3 +96,4 @@ export interface SectionMessageActionProps {
|
|
|
82
96
|
*/
|
|
83
97
|
testId?: string;
|
|
84
98
|
}
|
|
99
|
+
export {};
|
|
@@ -4,7 +4,8 @@ import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
|
4
4
|
* Appearance determines the icon and background color pairing indicating the message type
|
|
5
5
|
*/
|
|
6
6
|
export type Appearance = 'information' | 'warning' | 'error' | 'success' | 'discovery';
|
|
7
|
-
|
|
7
|
+
type HeadingElements = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
8
|
+
interface BaseSectionMessageProps {
|
|
8
9
|
/**
|
|
9
10
|
* The appearance styling to use for the section message.
|
|
10
11
|
*/
|
|
@@ -14,6 +15,11 @@ export interface SectionMessageProps {
|
|
|
14
15
|
* we recommend that this should be a paragraph.
|
|
15
16
|
*/
|
|
16
17
|
children: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Allows the section message's `title` to be rendered as the specified HTML
|
|
20
|
+
* heading element. The default heading element is `h2`.
|
|
21
|
+
*/
|
|
22
|
+
headingLevel?: HeadingElements;
|
|
17
23
|
/**
|
|
18
24
|
* The heading of the section message.
|
|
19
25
|
*/
|
|
@@ -49,6 +55,14 @@ export interface SectionMessageProps {
|
|
|
49
55
|
*/
|
|
50
56
|
testId?: string;
|
|
51
57
|
}
|
|
58
|
+
type ConditionalSectionMessageProps = {
|
|
59
|
+
headingLevel?: HeadingElements;
|
|
60
|
+
title: string;
|
|
61
|
+
} | {
|
|
62
|
+
headingLevel?: never;
|
|
63
|
+
title?: never;
|
|
64
|
+
};
|
|
65
|
+
export type SectionMessageProps = BaseSectionMessageProps & ConditionalSectionMessageProps;
|
|
52
66
|
export interface SectionMessageActionProps {
|
|
53
67
|
/**
|
|
54
68
|
* The text that needs to be displayed for section message action.
|
|
@@ -82,3 +96,4 @@ export interface SectionMessageActionProps {
|
|
|
82
96
|
*/
|
|
83
97
|
testId?: string;
|
|
84
98
|
}
|
|
99
|
+
export {};
|
package/package.json
CHANGED