@atlaskit/section-message 6.2.0 → 6.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,22 @@
1
1
  # @atlaskit/section-message
2
2
 
3
+ ## 6.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`7a9e73ec430`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7a9e73ec430) - [ux] Internal changes to how styles are represented in SectionMessage. Some minor visual changes to the color and spacing of SectionMessage. No changes to the SectionMessage API.
8
+
9
+ ### Patch Changes
10
+
11
+ - [`5f07e7b56a2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5f07e7b56a2) - Updates to the public types to better reflect the actual API.
12
+ - Updated dependencies
13
+
14
+ ## 6.2.1
15
+
16
+ ### Patch Changes
17
+
18
+ - [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
19
+
3
20
  ## 6.2.0
4
21
 
5
22
  ### Minor Changes
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
+ import { UNSAFE_Text as Text } from '@atlaskit/ds-explorations';
4
+
3
5
  import SectionMessage, { SectionMessageAction } from '../src';
4
6
 
5
7
  export default () => {
@@ -15,13 +17,13 @@ export default () => {
15
17
  </SectionMessageAction>,
16
18
  ]}
17
19
  >
18
- <p>
20
+ <Text>
19
21
  You will rejoice to hear that no disaster has accompanied the
20
22
  commencement of an enterprise which you have regarded with such evil
21
23
  forebodings. I arrived here yesterday, and my first task is to assure my
22
24
  dear sister of my welfare and increasing confidence in the success of my
23
25
  undertaking.
24
- </p>
26
+ </Text>
25
27
  </SectionMessage>
26
28
  );
27
29
  };
@@ -1,17 +1,19 @@
1
1
  import React from 'react';
2
2
 
3
+ import { UNSAFE_Text as Text } from '@atlaskit/ds-explorations';
4
+
3
5
  import SectionMessage from '../src';
4
6
 
5
7
  export default () => {
6
8
  return (
7
9
  <SectionMessage title="The Modern Prometheus">
8
- <p>
10
+ <Text>
9
11
  You will rejoice to hear that no disaster has accompanied the
10
12
  commencement of an enterprise which you have regarded with such evil
11
13
  forebodings. I arrived here yesterday, and my first task is to assure my
12
14
  dear sister of my welfare and increasing confidence in the success of my
13
15
  undertaking.
14
- </p>
16
+ </Text>
15
17
  </SectionMessage>
16
18
  );
17
19
  };
@@ -2,63 +2,47 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
8
10
  exports.default = void 0;
9
11
 
10
- var _react = require("react");
11
-
12
- var _react2 = require("@emotion/react");
12
+ var _react = _interopRequireWildcard(require("react"));
13
13
 
14
14
  var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
15
15
 
16
- var _colors = require("@atlaskit/theme/colors");
16
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
17
 
18
- var _constants = require("@atlaskit/theme/constants");
18
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
19
 
20
- /** @jsx jsx */
21
- var actionsSeparatorWidth = (0, _constants.gridSize)() * 2;
22
- var actionStyles = (0, _react2.css)({
23
- display: 'flex',
24
- margin: 0,
25
- alignItems: 'center',
26
- // eslint-disable-next-line @repo/internal/styles/no-nested-styles
27
- '&:not(:last-child)::after': {
28
- display: 'inline-block',
29
- width: "".concat(actionsSeparatorWidth, "px"),
30
- color: "".concat("var(--ds-text-subtle, ".concat(_colors.N500, ")")),
31
- content: '"·"',
32
- textAlign: 'center',
33
- verticalAlign: 'middle'
34
- }
35
- });
36
20
  /**
37
21
  * __Section message action__
38
22
  *
39
23
  * A section message action is designed to work with the `action` prop from
40
24
  * `SectionMessage`. It renders either a button or a link depending on whether
41
- * an `onClick` or `href` prop is supplied, with a dot seperator in between actions.
25
+ * an `onClick` or `href` prop is supplied, with a dot separator in between actions.
42
26
  *
43
27
  * - [Examples](https://atlassian.design/components/section-message/examples#actions)
44
28
  */
45
-
46
29
  var SectionMessageAction = /*#__PURE__*/(0, _react.memo)(function SectionMessageAction(_ref) {
47
30
  var children = _ref.children,
48
31
  onClick = _ref.onClick,
49
32
  href = _ref.href,
50
33
  testId = _ref.testId,
51
34
  linkComponent = _ref.linkComponent;
52
- return (0, _react2.jsx)("li", {
53
- css: actionStyles,
54
- "data-testid": testId
55
- }, onClick || href ? (0, _react2.jsx)(_standardButton.default, {
35
+ // FIXME: This path doesn't make sense
36
+ // If the intent of the design for this component is to use an action, not providing `href` or `onClick`
37
+ // makes the use case invalid. This should be addressed.
38
+ return onClick || href ? /*#__PURE__*/_react.default.createElement(_standardButton.default, {
39
+ testId: testId,
56
40
  appearance: "link",
57
41
  spacing: "none",
58
42
  onClick: onClick,
59
43
  href: href,
60
44
  component: href ? linkComponent : undefined
61
- }, children) : children);
45
+ }, children) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
62
46
  });
63
47
  SectionMessageAction.displayName = 'SectionMessageAction';
64
48
  var _default = SectionMessageAction;
@@ -9,19 +9,13 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports.default = void 0;
11
11
 
12
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
-
14
12
  var _react = _interopRequireWildcard(require("react"));
15
13
 
16
- var _react2 = require("@emotion/react");
17
-
18
- var _colors = require("@atlaskit/theme/colors");
19
-
20
- var _components = _interopRequireDefault(require("@atlaskit/theme/components"));
14
+ var _dsExplorations = require("@atlaskit/ds-explorations");
21
15
 
22
- var _constants = require("@atlaskit/theme/constants");
16
+ var _heading = _interopRequireDefault(require("@atlaskit/heading"));
23
17
 
24
- var _typography = require("@atlaskit/theme/typography");
18
+ var _colors = require("@atlaskit/theme/colors");
25
19
 
26
20
  var _appearanceIcon = require("./internal/appearance-icon");
27
21
 
@@ -29,98 +23,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
29
23
 
30
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
25
 
32
- /** @jsx jsx */
33
- var spacing = (0, _constants.gridSize)();
34
- var titleMarginBottom = spacing;
35
- var containerPadding = spacing * 2;
36
- var actionMarginTop = spacing;
37
- var iconWrapperWidth = spacing * 5;
38
- var titleColor = {
39
- light: "var(--ds-text, ".concat(_colors.N800, ")"),
40
- dark: "var(--ds-text, ".concat(_colors.DN600, ")")
41
- };
42
- var containerStyles = (0, _react2.css)({
43
- display: 'flex',
44
- padding: "".concat(containerPadding, "px"),
45
- borderRadius: "".concat((0, _constants.borderRadius)(), "px")
46
- });
47
- var contentContainerStyles = (0, _react2.css)({
48
- flexGrow: 1,
49
- wordBreak: 'break-word'
50
- });
51
- var titleStyles = (0, _react2.css)({
52
- margin: "0 0 ".concat(titleMarginBottom, "px"),
53
- fontSize: "".concat(_typography.headingSizes.h500.size / (0, _constants.fontSize)(), "em"),
54
- fontStyle: 'inherit',
55
- fontWeight: 600,
56
- letterSpacing: '-0.006em',
57
- lineHeight: "".concat(_typography.headingSizes.h500.lineHeight / _typography.headingSizes.h500.size)
58
- });
59
- var actionsStyles = (0, _react2.css)({
60
- display: 'flex',
61
- marginTop: "".concat(actionMarginTop, "px"),
62
- paddingLeft: 0,
63
- flexWrap: 'wrap',
64
- listStyle: 'none'
65
- }); // If the icon is not wrapped in a div with a width, and we instead use margin or
66
- // padding, the icon is shrunk by the padding.
67
- // Since the icons will have a consistent size, we can treat them as pre-calculated
68
- // space.
69
-
70
- var iconWrapperStyles = (0, _react2.css)({
71
- display: 'flex',
72
- margin: '-2px 0',
73
- flex: "0 0 ".concat(iconWrapperWidth, "px")
74
- });
75
- var SectionMessageWithMode = /*#__PURE__*/(0, _react.forwardRef)(function SectionMessage(_ref, ref) {
76
- var children = _ref.children,
77
- _ref$appearance = _ref.appearance,
78
- appearance = _ref$appearance === void 0 ? 'information' : _ref$appearance,
79
- actions = _ref.actions,
80
- title = _ref.title,
81
- icon = _ref.icon,
82
- testId = _ref.testId,
83
- mode = _ref.mode;
84
-
85
- var _getAppearanceIconSty = (0, _appearanceIcon.getAppearanceIconStyles)(appearance, icon),
86
- backgroundColor = _getAppearanceIconSty.backgroundColor,
87
- primaryIconColor = _getAppearanceIconSty.primaryIconColor,
88
- Icon = _getAppearanceIconSty.Icon;
26
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
89
27
 
90
- var containerStyleWithBackground = (0, _react.useMemo)(function () {
91
- return {
92
- backgroundColor: backgroundColor
93
- };
94
- }, [backgroundColor]);
95
- var memoizedTitleColor = (0, _react.useMemo)(function () {
96
- return {
97
- color: titleColor[mode]
98
- };
99
- }, [mode]);
100
-
101
- var actionsArray = _react.default.Children.toArray(actions);
102
-
103
- return (0, _react2.jsx)("section", {
104
- css: containerStyles,
105
- style: containerStyleWithBackground,
106
- "data-testid": testId,
107
- ref: ref
108
- }, (0, _react2.jsx)("div", {
109
- css: iconWrapperStyles
110
- }, (0, _react2.jsx)(Icon, {
111
- primaryColor: primaryIconColor,
112
- secondaryColor: backgroundColor
113
- })), (0, _react2.jsx)("div", {
114
- css: contentContainerStyles,
115
- "data-testid": testId && "".concat(testId, "--content")
116
- }, title ? (0, _react2.jsx)("h1", {
117
- css: titleStyles,
118
- style: memoizedTitleColor
119
- }, title) : null, (0, _react2.jsx)("div", null, children), actionsArray.length > 0 ? (0, _react2.jsx)("ul", {
120
- css: actionsStyles,
121
- "data-testid": testId && "".concat(testId, "--actions")
122
- }, actionsArray) : null));
123
- });
124
28
  /**
125
29
  * __Section message__
126
30
  *
@@ -130,16 +34,66 @@ var SectionMessageWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Sectio
130
34
  * - [Code](https://atlassian.design/components/section-message/code)
131
35
  * - [Usage](https://atlassian.design/components/section-message/usage)
132
36
  */
37
+ var SectionMessage = /*#__PURE__*/(0, _react.forwardRef)(function SectionMessage(_ref, ref) {
38
+ var children = _ref.children,
39
+ _ref$appearance = _ref.appearance,
40
+ appearance = _ref$appearance === void 0 ? 'information' : _ref$appearance,
41
+ actions = _ref.actions,
42
+ title = _ref.title,
43
+ icon = _ref.icon,
44
+ testId = _ref.testId;
133
45
 
134
- var SectionMessage = /*#__PURE__*/(0, _react.forwardRef)(function SectionMessage(props, ref) {
135
- return (0, _react2.jsx)(_components.default.Consumer, null, function (_ref2) {
136
- var mode = _ref2.mode;
137
- return (0, _react2.jsx)(SectionMessageWithMode, (0, _extends2.default)({}, props, {
138
- mode: mode,
139
- ref: ref
140
- }));
141
- });
46
+ var _getAppearanceIconSty = (0, _appearanceIcon.getAppearanceIconStyles)(appearance, icon),
47
+ primaryColor = _getAppearanceIconSty.primaryIconColor,
48
+ secondaryColor = _getAppearanceIconSty.backgroundColor,
49
+ Icon = _getAppearanceIconSty.Icon;
50
+
51
+ var actionElements = actions && actions.type === _react.default.Fragment ? actions.props.children : actions;
52
+
53
+ var actionsArray = _react.default.Children.toArray(actionElements);
54
+
55
+ return /*#__PURE__*/_react.default.createElement(_dsExplorations.UNSAFE_Box, {
56
+ as: "section",
57
+ backgroundColor: [appearanceMap[appearance], secondaryColor],
58
+ padding: "sp-200",
59
+ borderRadius: "normal",
60
+ testId: testId,
61
+ ref: ref,
62
+ UNSAFE_style: {
63
+ wordBreak: 'break-word'
64
+ }
65
+ }, /*#__PURE__*/_react.default.createElement(_dsExplorations.UNSAFE_Inline, {
66
+ gap: "sp-200"
67
+ }, /*#__PURE__*/_react.default.createElement(_dsExplorations.UNSAFE_Box, {
68
+ UNSAFE_style: {
69
+ margin: '-2px 0'
70
+ }
71
+ }, /*#__PURE__*/_react.default.createElement(Icon, {
72
+ size: "medium",
73
+ primaryColor: primaryColor,
74
+ secondaryColor: secondaryColor
75
+ })), /*#__PURE__*/_react.default.createElement(_dsExplorations.UNSAFE_Stack, {
76
+ gap: "sp-100",
77
+ testId: testId && "".concat(testId, "--content")
78
+ }, !!title && /*#__PURE__*/_react.default.createElement(_heading.default, {
79
+ as: "h2",
80
+ level: "h500"
81
+ }, title), /*#__PURE__*/_react.default.createElement(_dsExplorations.UNSAFE_Text, null, children), actionsArray.length > 0 && /*#__PURE__*/_react.default.createElement(_dsExplorations.UNSAFE_Inline, {
82
+ flexWrap: "wrap",
83
+ testId: testId && "".concat(testId, "--actions"),
84
+ divider: /*#__PURE__*/_react.default.createElement(_dsExplorations.UNSAFE_Text, {
85
+ color: ['subtle', _colors.N500]
86
+ }, "\xB7"),
87
+ gap: "sp-75"
88
+ }, actionsArray))));
142
89
  });
90
+ var appearanceMap = {
91
+ information: 'information',
92
+ warning: 'warning',
93
+ error: 'danger',
94
+ success: 'success',
95
+ discovery: 'discovery'
96
+ };
143
97
  SectionMessage.displayName = 'SectionMessage';
144
98
  var _default = SectionMessage;
145
99
  exports.default = _default;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/section-message",
3
- "version": "6.2.0",
3
+ "version": "6.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,34 +1,15 @@
1
- /** @jsx jsx */
2
- import { memo } from 'react';
3
- import { css, jsx } from '@emotion/react';
1
+ import React, { memo } from 'react';
4
2
  import Button from '@atlaskit/button/standard-button';
5
- import { N500 } from '@atlaskit/theme/colors';
6
- import { gridSize } from '@atlaskit/theme/constants';
7
- const actionsSeparatorWidth = gridSize() * 2;
8
- const actionStyles = css({
9
- display: 'flex',
10
- margin: 0,
11
- alignItems: 'center',
12
- // eslint-disable-next-line @repo/internal/styles/no-nested-styles
13
- '&:not(:last-child)::after': {
14
- display: 'inline-block',
15
- width: `${actionsSeparatorWidth}px`,
16
- color: `${`var(--ds-text-subtle, ${N500})`}`,
17
- content: '"·"',
18
- textAlign: 'center',
19
- verticalAlign: 'middle'
20
- }
21
- });
3
+
22
4
  /**
23
5
  * __Section message action__
24
6
  *
25
7
  * A section message action is designed to work with the `action` prop from
26
8
  * `SectionMessage`. It renders either a button or a link depending on whether
27
- * an `onClick` or `href` prop is supplied, with a dot seperator in between actions.
9
+ * an `onClick` or `href` prop is supplied, with a dot separator in between actions.
28
10
  *
29
11
  * - [Examples](https://atlassian.design/components/section-message/examples#actions)
30
12
  */
31
-
32
13
  const SectionMessageAction = /*#__PURE__*/memo(function SectionMessageAction({
33
14
  children,
34
15
  onClick,
@@ -36,16 +17,17 @@ const SectionMessageAction = /*#__PURE__*/memo(function SectionMessageAction({
36
17
  testId,
37
18
  linkComponent
38
19
  }) {
39
- return jsx("li", {
40
- css: actionStyles,
41
- "data-testid": testId
42
- }, onClick || href ? jsx(Button, {
20
+ // FIXME: This path doesn't make sense
21
+ // If the intent of the design for this component is to use an action, not providing `href` or `onClick`
22
+ // makes the use case invalid. This should be addressed.
23
+ return onClick || href ? /*#__PURE__*/React.createElement(Button, {
24
+ testId: testId,
43
25
  appearance: "link",
44
26
  spacing: "none",
45
27
  onClick: onClick,
46
28
  href: href,
47
29
  component: href ? linkComponent : undefined
48
- }, children) : children);
30
+ }, children) : /*#__PURE__*/React.createElement(React.Fragment, null, children);
49
31
  });
50
32
  SectionMessageAction.displayName = 'SectionMessageAction';
51
33
  export default SectionMessageAction;
@@ -1,97 +1,10 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
-
3
- /** @jsx jsx */
4
- import React, { forwardRef, useMemo } from 'react';
5
- import { css, jsx } from '@emotion/react';
6
- import { DN600, N800 } from '@atlaskit/theme/colors';
7
- import GlobalTheme from '@atlaskit/theme/components';
8
- import { borderRadius, fontSize, gridSize } from '@atlaskit/theme/constants';
9
- import { headingSizes } from '@atlaskit/theme/typography';
1
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
2
+ import React, { forwardRef } from 'react';
3
+ import { UNSAFE_Box as Box, UNSAFE_Inline as Inline, UNSAFE_Stack as Stack, UNSAFE_Text as Text } from '@atlaskit/ds-explorations';
4
+ import Heading from '@atlaskit/heading';
5
+ import { N500 } from '@atlaskit/theme/colors';
10
6
  import { getAppearanceIconStyles } from './internal/appearance-icon';
11
- const spacing = gridSize();
12
- const titleMarginBottom = spacing;
13
- const containerPadding = spacing * 2;
14
- const actionMarginTop = spacing;
15
- const iconWrapperWidth = spacing * 5;
16
- const titleColor = {
17
- light: `var(--ds-text, ${N800})`,
18
- dark: `var(--ds-text, ${DN600})`
19
- };
20
- const containerStyles = css({
21
- display: 'flex',
22
- padding: `${containerPadding}px`,
23
- borderRadius: `${borderRadius()}px`
24
- });
25
- const contentContainerStyles = css({
26
- flexGrow: 1,
27
- wordBreak: 'break-word'
28
- });
29
- const titleStyles = css({
30
- margin: `0 0 ${titleMarginBottom}px`,
31
- fontSize: `${headingSizes.h500.size / fontSize()}em`,
32
- fontStyle: 'inherit',
33
- fontWeight: 600,
34
- letterSpacing: '-0.006em',
35
- lineHeight: `${headingSizes.h500.lineHeight / headingSizes.h500.size}`
36
- });
37
- const actionsStyles = css({
38
- display: 'flex',
39
- marginTop: `${actionMarginTop}px`,
40
- paddingLeft: 0,
41
- flexWrap: 'wrap',
42
- listStyle: 'none'
43
- }); // If the icon is not wrapped in a div with a width, and we instead use margin or
44
- // padding, the icon is shrunk by the padding.
45
- // Since the icons will have a consistent size, we can treat them as pre-calculated
46
- // space.
47
7
 
48
- const iconWrapperStyles = css({
49
- display: 'flex',
50
- margin: '-2px 0',
51
- flex: `0 0 ${iconWrapperWidth}px`
52
- });
53
- const SectionMessageWithMode = /*#__PURE__*/forwardRef(function SectionMessage({
54
- children,
55
- appearance = 'information',
56
- actions,
57
- title,
58
- icon,
59
- testId,
60
- mode
61
- }, ref) {
62
- const {
63
- backgroundColor,
64
- primaryIconColor,
65
- Icon
66
- } = getAppearanceIconStyles(appearance, icon);
67
- const containerStyleWithBackground = useMemo(() => ({
68
- backgroundColor: backgroundColor
69
- }), [backgroundColor]);
70
- const memoizedTitleColor = useMemo(() => ({
71
- color: titleColor[mode]
72
- }), [mode]);
73
- const actionsArray = React.Children.toArray(actions);
74
- return jsx("section", {
75
- css: containerStyles,
76
- style: containerStyleWithBackground,
77
- "data-testid": testId,
78
- ref: ref
79
- }, jsx("div", {
80
- css: iconWrapperStyles
81
- }, jsx(Icon, {
82
- primaryColor: primaryIconColor,
83
- secondaryColor: backgroundColor
84
- })), jsx("div", {
85
- css: contentContainerStyles,
86
- "data-testid": testId && `${testId}--content`
87
- }, title ? jsx("h1", {
88
- css: titleStyles,
89
- style: memoizedTitleColor
90
- }, title) : null, jsx("div", null, children), actionsArray.length > 0 ? jsx("ul", {
91
- css: actionsStyles,
92
- "data-testid": testId && `${testId}--actions`
93
- }, actionsArray) : null));
94
- });
95
8
  /**
96
9
  * __Section message__
97
10
  *
@@ -101,14 +14,62 @@ const SectionMessageWithMode = /*#__PURE__*/forwardRef(function SectionMessage({
101
14
  * - [Code](https://atlassian.design/components/section-message/code)
102
15
  * - [Usage](https://atlassian.design/components/section-message/usage)
103
16
  */
104
-
105
- const SectionMessage = /*#__PURE__*/forwardRef(function SectionMessage(props, ref) {
106
- return jsx(GlobalTheme.Consumer, null, ({
107
- mode
108
- }) => jsx(SectionMessageWithMode, _extends({}, props, {
109
- mode: mode,
110
- ref: ref
111
- })));
17
+ const SectionMessage = /*#__PURE__*/forwardRef(function SectionMessage({
18
+ children,
19
+ appearance = 'information',
20
+ actions,
21
+ title,
22
+ icon,
23
+ testId
24
+ }, ref) {
25
+ const {
26
+ primaryIconColor: primaryColor,
27
+ backgroundColor: secondaryColor,
28
+ Icon
29
+ } = getAppearanceIconStyles(appearance, icon);
30
+ const actionElements = actions && actions.type === React.Fragment ? actions.props.children : actions;
31
+ const actionsArray = React.Children.toArray(actionElements);
32
+ return /*#__PURE__*/React.createElement(Box, {
33
+ as: "section",
34
+ backgroundColor: [appearanceMap[appearance], secondaryColor],
35
+ padding: "sp-200",
36
+ borderRadius: "normal",
37
+ testId: testId,
38
+ ref: ref,
39
+ UNSAFE_style: {
40
+ wordBreak: 'break-word'
41
+ }
42
+ }, /*#__PURE__*/React.createElement(Inline, {
43
+ gap: "sp-200"
44
+ }, /*#__PURE__*/React.createElement(Box, {
45
+ UNSAFE_style: {
46
+ margin: '-2px 0'
47
+ }
48
+ }, /*#__PURE__*/React.createElement(Icon, {
49
+ size: "medium",
50
+ primaryColor: primaryColor,
51
+ secondaryColor: secondaryColor
52
+ })), /*#__PURE__*/React.createElement(Stack, {
53
+ gap: "sp-100",
54
+ testId: testId && `${testId}--content`
55
+ }, !!title && /*#__PURE__*/React.createElement(Heading, {
56
+ as: "h2",
57
+ level: "h500"
58
+ }, title), /*#__PURE__*/React.createElement(Text, null, children), actionsArray.length > 0 && /*#__PURE__*/React.createElement(Inline, {
59
+ flexWrap: "wrap",
60
+ testId: testId && `${testId}--actions`,
61
+ divider: /*#__PURE__*/React.createElement(Text, {
62
+ color: ['subtle', N500]
63
+ }, "\xB7"),
64
+ gap: "sp-75"
65
+ }, actionsArray))));
112
66
  });
67
+ const appearanceMap = {
68
+ information: 'information',
69
+ warning: 'warning',
70
+ error: 'danger',
71
+ success: 'success',
72
+ discovery: 'discovery'
73
+ };
113
74
  SectionMessage.displayName = 'SectionMessage';
114
75
  export default SectionMessage;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/section-message",
3
- "version": "6.2.0",
3
+ "version": "6.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,50 +1,32 @@
1
- /** @jsx jsx */
2
- import { memo } from 'react';
3
- import { css, jsx } from '@emotion/react';
1
+ import React, { memo } from 'react';
4
2
  import Button from '@atlaskit/button/standard-button';
5
- import { N500 } from '@atlaskit/theme/colors';
6
- import { gridSize } from '@atlaskit/theme/constants';
7
- var actionsSeparatorWidth = gridSize() * 2;
8
- var actionStyles = css({
9
- display: 'flex',
10
- margin: 0,
11
- alignItems: 'center',
12
- // eslint-disable-next-line @repo/internal/styles/no-nested-styles
13
- '&:not(:last-child)::after': {
14
- display: 'inline-block',
15
- width: "".concat(actionsSeparatorWidth, "px"),
16
- color: "".concat("var(--ds-text-subtle, ".concat(N500, ")")),
17
- content: '"·"',
18
- textAlign: 'center',
19
- verticalAlign: 'middle'
20
- }
21
- });
3
+
22
4
  /**
23
5
  * __Section message action__
24
6
  *
25
7
  * A section message action is designed to work with the `action` prop from
26
8
  * `SectionMessage`. It renders either a button or a link depending on whether
27
- * an `onClick` or `href` prop is supplied, with a dot seperator in between actions.
9
+ * an `onClick` or `href` prop is supplied, with a dot separator in between actions.
28
10
  *
29
11
  * - [Examples](https://atlassian.design/components/section-message/examples#actions)
30
12
  */
31
-
32
13
  var SectionMessageAction = /*#__PURE__*/memo(function SectionMessageAction(_ref) {
33
14
  var children = _ref.children,
34
15
  onClick = _ref.onClick,
35
16
  href = _ref.href,
36
17
  testId = _ref.testId,
37
18
  linkComponent = _ref.linkComponent;
38
- return jsx("li", {
39
- css: actionStyles,
40
- "data-testid": testId
41
- }, onClick || href ? jsx(Button, {
19
+ // FIXME: This path doesn't make sense
20
+ // If the intent of the design for this component is to use an action, not providing `href` or `onClick`
21
+ // makes the use case invalid. This should be addressed.
22
+ return onClick || href ? /*#__PURE__*/React.createElement(Button, {
23
+ testId: testId,
42
24
  appearance: "link",
43
25
  spacing: "none",
44
26
  onClick: onClick,
45
27
  href: href,
46
28
  component: href ? linkComponent : undefined
47
- }, children) : children);
29
+ }, children) : /*#__PURE__*/React.createElement(React.Fragment, null, children);
48
30
  });
49
31
  SectionMessageAction.displayName = 'SectionMessageAction';
50
32
  export default SectionMessageAction;
@@ -1,102 +1,10 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
-
3
- /** @jsx jsx */
4
- import React, { forwardRef, useMemo } from 'react';
5
- import { css, jsx } from '@emotion/react';
6
- import { DN600, N800 } from '@atlaskit/theme/colors';
7
- import GlobalTheme from '@atlaskit/theme/components';
8
- import { borderRadius, fontSize, gridSize } from '@atlaskit/theme/constants';
9
- import { headingSizes } from '@atlaskit/theme/typography';
1
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
2
+ import React, { forwardRef } from 'react';
3
+ import { UNSAFE_Box as Box, UNSAFE_Inline as Inline, UNSAFE_Stack as Stack, UNSAFE_Text as Text } from '@atlaskit/ds-explorations';
4
+ import Heading from '@atlaskit/heading';
5
+ import { N500 } from '@atlaskit/theme/colors';
10
6
  import { getAppearanceIconStyles } from './internal/appearance-icon';
11
- var spacing = gridSize();
12
- var titleMarginBottom = spacing;
13
- var containerPadding = spacing * 2;
14
- var actionMarginTop = spacing;
15
- var iconWrapperWidth = spacing * 5;
16
- var titleColor = {
17
- light: "var(--ds-text, ".concat(N800, ")"),
18
- dark: "var(--ds-text, ".concat(DN600, ")")
19
- };
20
- var containerStyles = css({
21
- display: 'flex',
22
- padding: "".concat(containerPadding, "px"),
23
- borderRadius: "".concat(borderRadius(), "px")
24
- });
25
- var contentContainerStyles = css({
26
- flexGrow: 1,
27
- wordBreak: 'break-word'
28
- });
29
- var titleStyles = css({
30
- margin: "0 0 ".concat(titleMarginBottom, "px"),
31
- fontSize: "".concat(headingSizes.h500.size / fontSize(), "em"),
32
- fontStyle: 'inherit',
33
- fontWeight: 600,
34
- letterSpacing: '-0.006em',
35
- lineHeight: "".concat(headingSizes.h500.lineHeight / headingSizes.h500.size)
36
- });
37
- var actionsStyles = css({
38
- display: 'flex',
39
- marginTop: "".concat(actionMarginTop, "px"),
40
- paddingLeft: 0,
41
- flexWrap: 'wrap',
42
- listStyle: 'none'
43
- }); // If the icon is not wrapped in a div with a width, and we instead use margin or
44
- // padding, the icon is shrunk by the padding.
45
- // Since the icons will have a consistent size, we can treat them as pre-calculated
46
- // space.
47
-
48
- var iconWrapperStyles = css({
49
- display: 'flex',
50
- margin: '-2px 0',
51
- flex: "0 0 ".concat(iconWrapperWidth, "px")
52
- });
53
- var SectionMessageWithMode = /*#__PURE__*/forwardRef(function SectionMessage(_ref, ref) {
54
- var children = _ref.children,
55
- _ref$appearance = _ref.appearance,
56
- appearance = _ref$appearance === void 0 ? 'information' : _ref$appearance,
57
- actions = _ref.actions,
58
- title = _ref.title,
59
- icon = _ref.icon,
60
- testId = _ref.testId,
61
- mode = _ref.mode;
62
7
 
63
- var _getAppearanceIconSty = getAppearanceIconStyles(appearance, icon),
64
- backgroundColor = _getAppearanceIconSty.backgroundColor,
65
- primaryIconColor = _getAppearanceIconSty.primaryIconColor,
66
- Icon = _getAppearanceIconSty.Icon;
67
-
68
- var containerStyleWithBackground = useMemo(function () {
69
- return {
70
- backgroundColor: backgroundColor
71
- };
72
- }, [backgroundColor]);
73
- var memoizedTitleColor = useMemo(function () {
74
- return {
75
- color: titleColor[mode]
76
- };
77
- }, [mode]);
78
- var actionsArray = React.Children.toArray(actions);
79
- return jsx("section", {
80
- css: containerStyles,
81
- style: containerStyleWithBackground,
82
- "data-testid": testId,
83
- ref: ref
84
- }, jsx("div", {
85
- css: iconWrapperStyles
86
- }, jsx(Icon, {
87
- primaryColor: primaryIconColor,
88
- secondaryColor: backgroundColor
89
- })), jsx("div", {
90
- css: contentContainerStyles,
91
- "data-testid": testId && "".concat(testId, "--content")
92
- }, title ? jsx("h1", {
93
- css: titleStyles,
94
- style: memoizedTitleColor
95
- }, title) : null, jsx("div", null, children), actionsArray.length > 0 ? jsx("ul", {
96
- css: actionsStyles,
97
- "data-testid": testId && "".concat(testId, "--actions")
98
- }, actionsArray) : null));
99
- });
100
8
  /**
101
9
  * __Section message__
102
10
  *
@@ -106,15 +14,63 @@ var SectionMessageWithMode = /*#__PURE__*/forwardRef(function SectionMessage(_re
106
14
  * - [Code](https://atlassian.design/components/section-message/code)
107
15
  * - [Usage](https://atlassian.design/components/section-message/usage)
108
16
  */
17
+ var SectionMessage = /*#__PURE__*/forwardRef(function SectionMessage(_ref, ref) {
18
+ var children = _ref.children,
19
+ _ref$appearance = _ref.appearance,
20
+ appearance = _ref$appearance === void 0 ? 'information' : _ref$appearance,
21
+ actions = _ref.actions,
22
+ title = _ref.title,
23
+ icon = _ref.icon,
24
+ testId = _ref.testId;
25
+
26
+ var _getAppearanceIconSty = getAppearanceIconStyles(appearance, icon),
27
+ primaryColor = _getAppearanceIconSty.primaryIconColor,
28
+ secondaryColor = _getAppearanceIconSty.backgroundColor,
29
+ Icon = _getAppearanceIconSty.Icon;
109
30
 
110
- var SectionMessage = /*#__PURE__*/forwardRef(function SectionMessage(props, ref) {
111
- return jsx(GlobalTheme.Consumer, null, function (_ref2) {
112
- var mode = _ref2.mode;
113
- return jsx(SectionMessageWithMode, _extends({}, props, {
114
- mode: mode,
115
- ref: ref
116
- }));
117
- });
31
+ var actionElements = actions && actions.type === React.Fragment ? actions.props.children : actions;
32
+ var actionsArray = React.Children.toArray(actionElements);
33
+ return /*#__PURE__*/React.createElement(Box, {
34
+ as: "section",
35
+ backgroundColor: [appearanceMap[appearance], secondaryColor],
36
+ padding: "sp-200",
37
+ borderRadius: "normal",
38
+ testId: testId,
39
+ ref: ref,
40
+ UNSAFE_style: {
41
+ wordBreak: 'break-word'
42
+ }
43
+ }, /*#__PURE__*/React.createElement(Inline, {
44
+ gap: "sp-200"
45
+ }, /*#__PURE__*/React.createElement(Box, {
46
+ UNSAFE_style: {
47
+ margin: '-2px 0'
48
+ }
49
+ }, /*#__PURE__*/React.createElement(Icon, {
50
+ size: "medium",
51
+ primaryColor: primaryColor,
52
+ secondaryColor: secondaryColor
53
+ })), /*#__PURE__*/React.createElement(Stack, {
54
+ gap: "sp-100",
55
+ testId: testId && "".concat(testId, "--content")
56
+ }, !!title && /*#__PURE__*/React.createElement(Heading, {
57
+ as: "h2",
58
+ level: "h500"
59
+ }, title), /*#__PURE__*/React.createElement(Text, null, children), actionsArray.length > 0 && /*#__PURE__*/React.createElement(Inline, {
60
+ flexWrap: "wrap",
61
+ testId: testId && "".concat(testId, "--actions"),
62
+ divider: /*#__PURE__*/React.createElement(Text, {
63
+ color: ['subtle', N500]
64
+ }, "\xB7"),
65
+ gap: "sp-75"
66
+ }, actionsArray))));
118
67
  });
68
+ var appearanceMap = {
69
+ information: 'information',
70
+ warning: 'warning',
71
+ error: 'danger',
72
+ success: 'success',
73
+ discovery: 'discovery'
74
+ };
119
75
  SectionMessage.displayName = 'SectionMessage';
120
76
  export default SectionMessage;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/section-message",
3
- "version": "6.2.0",
3
+ "version": "6.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,13 +1,13 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import type { SectionMessageActionProps } from './types';
3
3
  /**
4
4
  * __Section message action__
5
5
  *
6
6
  * A section message action is designed to work with the `action` prop from
7
7
  * `SectionMessage`. It renders either a button or a link depending on whether
8
- * an `onClick` or `href` prop is supplied, with a dot seperator in between actions.
8
+ * an `onClick` or `href` prop is supplied, with a dot separator in between actions.
9
9
  *
10
10
  * - [Examples](https://atlassian.design/components/section-message/examples#actions)
11
11
  */
12
- declare const SectionMessageAction: import("react").NamedExoticComponent<SectionMessageActionProps>;
12
+ declare const SectionMessageAction: React.NamedExoticComponent<SectionMessageActionProps>;
13
13
  export default SectionMessageAction;
@@ -1,4 +1,3 @@
1
- /** @jsx jsx */
2
1
  import React from 'react';
3
2
  import type { SectionMessageProps } from './types';
4
3
  /**
@@ -0,0 +1,2 @@
1
+ export { default } from '../section-message-action';
2
+ export type { SectionMessageActionProps } from '../types';
@@ -0,0 +1,2 @@
1
+ export { default } from '../section-message';
2
+ export type { SectionMessageProps } from '../types';
@@ -0,0 +1 @@
1
+ export type { Appearance, SectionMessageProps, SectionMessageActionProps, } from '../types';
@@ -0,0 +1,3 @@
1
+ export { default } from './section-message';
2
+ export { default as SectionMessageAction } from './section-message-action';
3
+ export type { Appearance, SectionMessageProps, SectionMessageActionProps, } from './types';
@@ -0,0 +1,16 @@
1
+ import { ComponentType } from 'react';
2
+ import type { Appearance, SectionMessageProps } from '../types';
3
+ interface AppearanceIconSchema {
4
+ backgroundColor: string;
5
+ primaryIconColor: string;
6
+ Icon: ComponentType<any>;
7
+ }
8
+ export declare const appearanceIconSchema: {
9
+ [key in Appearance]: AppearanceIconSchema;
10
+ };
11
+ export declare function getAppearanceIconStyles(appearance: Appearance, icon: SectionMessageProps['icon']): {
12
+ Icon: "symbol" | "object" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "keygen" | "label" | "legend" | "li" | "link" | "main" | "map" | "mark" | "menu" | "menuitem" | "meta" | "meter" | "nav" | "noindex" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "table" | "tbody" | "td" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr" | "webview" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any>;
13
+ backgroundColor: string;
14
+ primaryIconColor: string;
15
+ };
16
+ export {};
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { SectionMessageActionProps } from './types';
3
+ /**
4
+ * __Section message action__
5
+ *
6
+ * A section message action is designed to work with the `action` prop from
7
+ * `SectionMessage`. It renders either a button or a link depending on whether
8
+ * an `onClick` or `href` prop is supplied, with a dot separator in between actions.
9
+ *
10
+ * - [Examples](https://atlassian.design/components/section-message/examples#actions)
11
+ */
12
+ declare const SectionMessageAction: React.NamedExoticComponent<SectionMessageActionProps>;
13
+ export default SectionMessageAction;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { SectionMessageProps } from './types';
3
+ /**
4
+ * __Section message__
5
+ *
6
+ * A section message is used to alert users to a particular section of the screen.
7
+ *
8
+ * - [Examples](https://atlassian.design/components/section-message/examples)
9
+ * - [Code](https://atlassian.design/components/section-message/code)
10
+ * - [Usage](https://atlassian.design/components/section-message/usage)
11
+ */
12
+ declare const SectionMessage: React.ForwardRefExoticComponent<SectionMessageProps & React.RefAttributes<HTMLElement>>;
13
+ export default SectionMessage;
@@ -0,0 +1,70 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
+ /**
4
+ * Appearance determines the icon and background color pairing indicating the message type
5
+ */
6
+ export declare type Appearance = 'information' | 'warning' | 'error' | 'success' | 'discovery';
7
+ export interface SectionMessageProps {
8
+ /**
9
+ * The appearance styling to use for the section message.
10
+ */
11
+ appearance?: Appearance;
12
+ /**
13
+ * The main content of the section message. This accepts a react node, although
14
+ * we recommend that this should be a paragraph.
15
+ */
16
+ children: React.ReactNode;
17
+ /**
18
+ * The heading of the section message.
19
+ */
20
+ title?: string;
21
+ /**
22
+ * Actions for the user to take after reading the section message. Accepts a ReactElement
23
+ * or an array of one or more SectionMessageAction React elements, which are applied as link buttons.
24
+ * Middle dots are automatically added between multiple link buttons, so no elements
25
+ * should be present between multiple actions.
26
+ *
27
+ * In general, avoid using more than two actions.
28
+ */
29
+ actions?: ReactElement | ReactElement<SectionMessageActionProps>[];
30
+ /**
31
+ * An Icon component to be rendered instead of the default icon for the component.
32
+ * This should only be an `@atlaskit/icon` icon. You can check out [this example](/packages/design-system/section-message/example/custom-icon)
33
+ * to see how to provide this icon.
34
+ */
35
+ icon?: React.ElementType;
36
+ /**
37
+ * A `testId` prop is a unique string that appears as a data attribute `data-testid`
38
+ * in the rendered code, serving as a hook for automated tests.
39
+ */
40
+ testId?: string;
41
+ }
42
+ export interface SectionMessageActionProps {
43
+ /**
44
+ * The text that needs to be displayed for section message action.
45
+ */
46
+ children: React.ReactNode;
47
+ /**
48
+ * A custom link component. This prop is designed to allow a custom link
49
+ * component to be passed to the rendered link button. The
50
+ * intended use-case is for when a custom router component such as react router
51
+ * is being used within the application.
52
+ *
53
+ * This component will only be used if a href prop is passed.
54
+ */
55
+ linkComponent?: React.ComponentType<any>;
56
+ /**
57
+ * Click handler which will be attached to the rendered link button. The second argument can be used to
58
+ * track analytics data. See the tutorial in the analytics-next package for details.
59
+ */
60
+ onClick?: (e: React.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent) => void;
61
+ /**
62
+ * The URL that the rendered link button will point to.
63
+ */
64
+ href?: string;
65
+ /**
66
+ * A `testId` prop is a unique string that appears as a data attribute `data-testid`
67
+ * in the rendered code, serving as a hook for automated tests.
68
+ */
69
+ testId?: string;
70
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/section-message",
3
- "version": "6.2.0",
3
+ "version": "6.3.0",
4
4
  "description": "A section message is used to alert users to a particular section of the screen.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -12,6 +12,13 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
+ "typesVersions": {
16
+ ">=4.0 <4.5": {
17
+ "*": [
18
+ "dist/types-ts4.0/*"
19
+ ]
20
+ }
21
+ },
15
22
  "sideEffects": false,
16
23
  "atlaskit:src": "src/index.tsx",
17
24
  "atlassian": {
@@ -31,33 +38,34 @@
31
38
  "dependencies": {
32
39
  "@atlaskit/button": "^16.3.0",
33
40
  "@atlaskit/codemod-utils": "^4.1.0",
34
- "@atlaskit/icon": "^21.10.0",
41
+ "@atlaskit/ds-explorations": "^0.1.0",
42
+ "@atlaskit/heading": "^0.1.13",
43
+ "@atlaskit/icon": "^21.11.0",
35
44
  "@atlaskit/theme": "^12.2.0",
36
45
  "@atlaskit/tokens": "^0.10.0",
37
- "@babel/runtime": "^7.0.0",
38
- "@emotion/react": "^11.7.1"
46
+ "@babel/runtime": "^7.0.0"
39
47
  },
40
48
  "peerDependencies": {
41
49
  "react": "^16.8.0"
42
50
  },
43
51
  "devDependencies": {
44
52
  "@atlaskit/analytics-next": "^8.1.2",
45
- "@atlaskit/code": "^14.3.0",
53
+ "@atlaskit/code": "^14.4.0",
46
54
  "@atlaskit/docs": "*",
47
55
  "@atlaskit/ds-lib": "^2.1.0",
48
- "@atlaskit/range": "^6.0.0",
56
+ "@atlaskit/range": "^6.1.0",
49
57
  "@atlaskit/ssr": "*",
50
58
  "@atlaskit/visual-regression": "*",
51
59
  "@atlaskit/webdriver-runner": "*",
52
60
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
53
- "@testing-library/react": "^8.0.1",
61
+ "@testing-library/react": "^12.1.5",
54
62
  "exenv": "^1.2.2",
55
63
  "jest-in-case": "^1.0.2",
56
64
  "jscodeshift": "^0.13.0",
57
65
  "react-dom": "^16.8.0",
58
66
  "react-test-renderer": "^16.8.0",
59
67
  "storybook-addon-performance": "^0.16.0",
60
- "typescript": "4.3.5"
68
+ "typescript": "4.5.5"
61
69
  },
62
70
  "techstack": {
63
71
  "@atlassian/frontend": {
@@ -66,11 +74,13 @@
66
74
  "@repo/internal": {
67
75
  "design-system": "v1",
68
76
  "dom-events": "use-bind-event-listener",
69
- "ui-components": "lite-mode",
77
+ "ui-components": [
78
+ "primitives",
79
+ "lite-mode"
80
+ ],
70
81
  "analytics": "analytics-next",
71
82
  "styling": [
72
- "static",
73
- "emotion"
83
+ "static"
74
84
  ],
75
85
  "theming": "tokens",
76
86
  "deprecation": "no-deprecated-imports"
package/report.api.md CHANGED
@@ -1,16 +1,17 @@
1
- ## API Report File for "@atlaskit/section-message"
1
+ ## API Report File for "@atlaskit/section-message".
2
2
 
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
3
+ > Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
4
4
 
5
- ```ts
6
- /// <reference types="react" />
5
+ [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
7
6
 
8
- import { NamedExoticComponent } from 'react';
7
+ ```ts
9
8
  import { default as React_2 } from 'react';
10
9
  import type { ReactElement } from 'react';
11
10
  import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
12
11
 
13
- /** Appearance determines the icon and background color pairing indicating the message type */
12
+ /**
13
+ * Appearance determines the icon and background color pairing indicating the message type
14
+ */
14
15
  export declare type Appearance =
15
16
  | 'information'
16
17
  | 'warning'
@@ -18,15 +19,44 @@ export declare type Appearance =
18
19
  | 'success'
19
20
  | 'discovery';
20
21
 
22
+ /**
23
+ * __Section message__
24
+ *
25
+ * A section message is used to alert users to a particular section of the screen.
26
+ *
27
+ * - [Examples](https://atlassian.design/components/section-message/examples)
28
+ * - [Code](https://atlassian.design/components/section-message/code)
29
+ * - [Usage](https://atlassian.design/components/section-message/usage)
30
+ */
21
31
  declare const SectionMessage: React_2.ForwardRefExoticComponent<
22
32
  SectionMessageProps & React_2.RefAttributes<HTMLElement>
23
33
  >;
24
34
  export default SectionMessage;
25
35
 
26
- export declare const SectionMessageAction: NamedExoticComponent<SectionMessageActionProps>;
36
+ /**
37
+ * __Section message action__
38
+ *
39
+ * A section message action is designed to work with the `action` prop from
40
+ * `SectionMessage`. It renders either a button or a link depending on whether
41
+ * an `onClick` or `href` prop is supplied, with a dot separator in between actions.
42
+ *
43
+ * - [Examples](https://atlassian.design/components/section-message/examples#actions)
44
+ */
45
+ export declare const SectionMessageAction: React_2.NamedExoticComponent<SectionMessageActionProps>;
27
46
 
28
47
  export declare interface SectionMessageActionProps {
48
+ /**
49
+ * The text that needs to be displayed for section message action.
50
+ */
29
51
  children: React.ReactNode;
52
+ /**
53
+ * A custom link component. This prop is designed to allow a custom link
54
+ * component to be passed to the rendered link button. The
55
+ * intended use-case is for when a custom router component such as react router
56
+ * is being used within the application.
57
+ *
58
+ * This component will only be used if a href prop is passed.
59
+ */
30
60
  linkComponent?: React.ComponentType<any>;
31
61
  /**
32
62
  * Click handler which will be attached to the rendered link button. The second argument can be used to
@@ -40,16 +70,46 @@ export declare interface SectionMessageActionProps {
40
70
  * The URL that the rendered link button will point to.
41
71
  */
42
72
  href?: string;
73
+ /**
74
+ * A `testId` prop is a unique string that appears as a data attribute `data-testid`
75
+ * in the rendered code, serving as a hook for automated tests.
76
+ */
43
77
  testId?: string;
44
78
  }
45
79
 
46
80
  export declare interface SectionMessageProps {
47
- /** The appearance styling to use for the section message. */
81
+ /**
82
+ * The appearance styling to use for the section message.
83
+ */
48
84
  appearance?: Appearance;
85
+ /**
86
+ * The main content of the section message. This accepts a react node, although
87
+ * we recommend that this should be a paragraph.
88
+ */
49
89
  children: React.ReactNode;
90
+ /**
91
+ * The heading of the section message.
92
+ */
50
93
  title?: string;
94
+ /**
95
+ * Actions for the user to take after reading the section message. Accepts a ReactElement
96
+ * or an array of one or more SectionMessageAction React elements, which are applied as link buttons.
97
+ * Middle dots are automatically added between multiple link buttons, so no elements
98
+ * should be present between multiple actions.
99
+ *
100
+ * In general, avoid using more than two actions.
101
+ */
51
102
  actions?: ReactElement | ReactElement<SectionMessageActionProps>[];
103
+ /**
104
+ * An Icon component to be rendered instead of the default icon for the component.
105
+ * This should only be an `@atlaskit/icon` icon. You can check out [this example](/packages/design-system/section-message/example/custom-icon)
106
+ * to see how to provide this icon.
107
+ */
52
108
  icon?: React.ElementType;
109
+ /**
110
+ * A `testId` prop is a unique string that appears as a data attribute `data-testid`
111
+ * in the rendered code, serving as a hook for automated tests.
112
+ */
53
113
  testId?: string;
54
114
  }
55
115
 
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/entry-points/section-message.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/section-message.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/section-message.d.ts"
7
+ "types": "../dist/types/entry-points/section-message.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/entry-points/section-message.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/entry-points/section-message-action.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/section-message-action.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/section-message-action.d.ts"
7
+ "types": "../dist/types/entry-points/section-message-action.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/entry-points/section-message-action.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/entry-points/types.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/types.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/types.d.ts"
7
+ "types": "../dist/types/entry-points/types.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/entry-points/types.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }