@atlaskit/section-message 6.2.1 → 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 +11 -0
- package/__perf__/with-actions.tsx +4 -2
- package/__perf__/without-actions.tsx +4 -2
- package/dist/cjs/section-message-action.js +12 -28
- package/dist/cjs/section-message.js +62 -108
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/section-message-action.js +9 -27
- package/dist/es2019/section-message.js +61 -100
- package/dist/es2019/version.json +1 -1
- package/dist/esm/section-message-action.js +9 -27
- package/dist/esm/section-message.js +61 -105
- package/dist/esm/version.json +1 -1
- package/dist/types/section-message-action.d.ts +3 -3
- package/dist/types/section-message.d.ts +0 -1
- package/dist/types-ts4.0/section-message-action.d.ts +3 -3
- package/dist/types-ts4.0/section-message.d.ts +0 -1
- package/package.json +12 -9
- package/report.api.md +68 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
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
|
+
|
|
3
14
|
## 6.2.1
|
|
4
15
|
|
|
5
16
|
### Patch 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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
|
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
|
|
16
|
+
var _heading = _interopRequireDefault(require("@atlaskit/heading"));
|
|
23
17
|
|
|
24
|
-
var
|
|
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
|
-
|
|
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
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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;
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,34 +1,15 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
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
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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;
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,50 +1,32 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
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
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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;
|
package/dist/esm/version.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
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
|
|
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:
|
|
12
|
+
declare const SectionMessageAction: React.NamedExoticComponent<SectionMessageActionProps>;
|
|
13
13
|
export default SectionMessageAction;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
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
|
|
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:
|
|
12
|
+
declare const SectionMessageAction: React.NamedExoticComponent<SectionMessageActionProps>;
|
|
13
13
|
export default SectionMessageAction;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/section-message",
|
|
3
|
-
"version": "6.
|
|
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/"
|
|
@@ -38,21 +38,22 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@atlaskit/button": "^16.3.0",
|
|
40
40
|
"@atlaskit/codemod-utils": "^4.1.0",
|
|
41
|
-
"@atlaskit/
|
|
41
|
+
"@atlaskit/ds-explorations": "^0.1.0",
|
|
42
|
+
"@atlaskit/heading": "^0.1.13",
|
|
43
|
+
"@atlaskit/icon": "^21.11.0",
|
|
42
44
|
"@atlaskit/theme": "^12.2.0",
|
|
43
45
|
"@atlaskit/tokens": "^0.10.0",
|
|
44
|
-
"@babel/runtime": "^7.0.0"
|
|
45
|
-
"@emotion/react": "^11.7.1"
|
|
46
|
+
"@babel/runtime": "^7.0.0"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
49
|
"react": "^16.8.0"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@atlaskit/analytics-next": "^8.1.2",
|
|
52
|
-
"@atlaskit/code": "^14.
|
|
53
|
+
"@atlaskit/code": "^14.4.0",
|
|
53
54
|
"@atlaskit/docs": "*",
|
|
54
55
|
"@atlaskit/ds-lib": "^2.1.0",
|
|
55
|
-
"@atlaskit/range": "^6.
|
|
56
|
+
"@atlaskit/range": "^6.1.0",
|
|
56
57
|
"@atlaskit/ssr": "*",
|
|
57
58
|
"@atlaskit/visual-regression": "*",
|
|
58
59
|
"@atlaskit/webdriver-runner": "*",
|
|
@@ -73,11 +74,13 @@
|
|
|
73
74
|
"@repo/internal": {
|
|
74
75
|
"design-system": "v1",
|
|
75
76
|
"dom-events": "use-bind-event-listener",
|
|
76
|
-
"ui-components":
|
|
77
|
+
"ui-components": [
|
|
78
|
+
"primitives",
|
|
79
|
+
"lite-mode"
|
|
80
|
+
],
|
|
77
81
|
"analytics": "analytics-next",
|
|
78
82
|
"styling": [
|
|
79
|
-
"static"
|
|
80
|
-
"emotion"
|
|
83
|
+
"static"
|
|
81
84
|
],
|
|
82
85
|
"theming": "tokens",
|
|
83
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.
|
|
3
|
+
> Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
|
|
4
4
|
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
/**
|
|
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
|
-
|
|
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
|
-
/**
|
|
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
|
|