@dhis2-ui/notice-box 8.1.11 → 8.2.2
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/build/cjs/notice-box-icon.js +7 -6
- package/build/cjs/notice-box-message.js +7 -5
- package/build/cjs/notice-box-title.js +7 -5
- package/build/cjs/notice-box.js +13 -12
- package/build/cjs/notice-box.stories.js +4 -23
- package/build/es/notice-box-icon.js +7 -6
- package/build/es/notice-box-message.js +7 -5
- package/build/es/notice-box-title.js +7 -5
- package/build/es/notice-box.js +13 -12
- package/build/es/notice-box.stories.js +3 -22
- package/package.json +3 -3
|
@@ -19,11 +19,12 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
22
|
-
const NoticeBoxIcon =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
const NoticeBoxIcon = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
warning,
|
|
25
|
+
error,
|
|
26
|
+
dataTest
|
|
27
|
+
} = _ref;
|
|
27
28
|
// Info is the default icon
|
|
28
29
|
let color = _uiConstants.colors.blue900;
|
|
29
30
|
let Icon = _uiIcons.IconInfoFilled24;
|
|
@@ -47,7 +48,7 @@ const NoticeBoxIcon = ({
|
|
|
47
48
|
}), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
48
49
|
id: "190287437",
|
|
49
50
|
dynamic: [_uiConstants.spacers.dp12]
|
|
50
|
-
}, [
|
|
51
|
+
}, [".__jsx-style-dynamic-selector{margin-right:".concat(_uiConstants.spacers.dp12, ";}")]));
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
exports.NoticeBoxIcon = NoticeBoxIcon;
|
|
@@ -15,10 +15,12 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
const NoticeBoxMessage =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const NoticeBoxMessage = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
children,
|
|
21
|
+
dataTest
|
|
22
|
+
} = _ref;
|
|
23
|
+
|
|
22
24
|
if (!children) {
|
|
23
25
|
return null;
|
|
24
26
|
}
|
|
@@ -29,7 +31,7 @@ const NoticeBoxMessage = ({
|
|
|
29
31
|
}, children, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
30
32
|
id: "3452101222",
|
|
31
33
|
dynamic: [_uiConstants.colors.grey900]
|
|
32
|
-
}, [
|
|
34
|
+
}, ["div.__jsx-style-dynamic-selector{color:".concat(_uiConstants.colors.grey900, ";font-size:14px;line-height:20px;}")]));
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
exports.NoticeBoxMessage = NoticeBoxMessage;
|
|
@@ -15,10 +15,12 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
const NoticeBoxTitle =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const NoticeBoxTitle = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
title,
|
|
21
|
+
dataTest
|
|
22
|
+
} = _ref;
|
|
23
|
+
|
|
22
24
|
if (!title) {
|
|
23
25
|
return null;
|
|
24
26
|
}
|
|
@@ -29,7 +31,7 @@ const NoticeBoxTitle = ({
|
|
|
29
31
|
}, title, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
30
32
|
id: "3611901971",
|
|
31
33
|
dynamic: [_uiConstants.colors.grey900, _uiConstants.spacers.dp12]
|
|
32
|
-
}, [
|
|
34
|
+
}, ["h6.__jsx-style-dynamic-selector{color:".concat(_uiConstants.colors.grey900, ";font-size:14px;font-weight:500;line-height:20px;margin:0 0 ").concat(_uiConstants.spacers.dp12, " 0;}")]));
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
exports.NoticeBoxTitle = NoticeBoxTitle;
|
package/build/cjs/notice-box.js
CHANGED
|
@@ -25,14 +25,15 @@ var _noticeBoxTitle = require("./notice-box-title.js");
|
|
|
25
25
|
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
27
|
|
|
28
|
-
const NoticeBox =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
const NoticeBox = _ref => {
|
|
29
|
+
let {
|
|
30
|
+
className,
|
|
31
|
+
children,
|
|
32
|
+
dataTest,
|
|
33
|
+
title,
|
|
34
|
+
warning,
|
|
35
|
+
error
|
|
36
|
+
} = _ref;
|
|
36
37
|
const classnames = (0, _classnames.default)(className, 'root', {
|
|
37
38
|
warning,
|
|
38
39
|
error
|
|
@@ -43,18 +44,18 @@ const NoticeBox = ({
|
|
|
43
44
|
}, /*#__PURE__*/_react.default.createElement(_noticeBoxIcon.NoticeBoxIcon, {
|
|
44
45
|
error: error,
|
|
45
46
|
warning: warning,
|
|
46
|
-
dataTest:
|
|
47
|
+
dataTest: "".concat(dataTest, "-icon")
|
|
47
48
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
48
49
|
className: _style.default.dynamic([["833500449", [_uiConstants.colors.blue050, _uiConstants.colors.blue200, _uiConstants.spacers.dp12, _uiConstants.spacers.dp16, _uiConstants.colors.yellow050, _uiConstants.colors.yellow200, _uiConstants.colors.red050, _uiConstants.colors.red500]]])
|
|
49
50
|
}, /*#__PURE__*/_react.default.createElement(_noticeBoxTitle.NoticeBoxTitle, {
|
|
50
51
|
title: title,
|
|
51
|
-
dataTest:
|
|
52
|
+
dataTest: "".concat(dataTest, "-title")
|
|
52
53
|
}), /*#__PURE__*/_react.default.createElement(_noticeBoxMessage.NoticeBoxMessage, {
|
|
53
|
-
dataTest:
|
|
54
|
+
dataTest: "".concat(dataTest, "-message")
|
|
54
55
|
}, children)), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
55
56
|
id: "833500449",
|
|
56
57
|
dynamic: [_uiConstants.colors.blue050, _uiConstants.colors.blue200, _uiConstants.spacers.dp12, _uiConstants.spacers.dp16, _uiConstants.colors.yellow050, _uiConstants.colors.yellow200, _uiConstants.colors.red050, _uiConstants.colors.red500]
|
|
57
|
-
}, [
|
|
58
|
+
}, [".root.__jsx-style-dynamic-selector{background:".concat(_uiConstants.colors.blue050, ";border:1px solid ").concat(_uiConstants.colors.blue200, ";border-radius:3px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding:").concat(_uiConstants.spacers.dp12, " ").concat(_uiConstants.spacers.dp16, ";}"), ".root.warning.__jsx-style-dynamic-selector{background:".concat(_uiConstants.colors.yellow050, ";border:1px solid ").concat(_uiConstants.colors.yellow200, ";}"), ".root.error.__jsx-style-dynamic-selector{background:".concat(_uiConstants.colors.red050, ";border:2px solid ").concat(_uiConstants.colors.red500, ";}")]));
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
exports.NoticeBox = NoticeBox;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.default = exports.WithALongTitle = exports.Warning = exports.Error = exports.Default = void 0;
|
|
7
7
|
|
|
8
8
|
var _uiConstants = require("@dhis2/ui-constants");
|
|
9
9
|
|
|
@@ -13,29 +13,10 @@ var _noticeBox = require("./notice-box.js");
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
-
const subtitle =
|
|
17
|
-
const description =
|
|
18
|
-
Use a notice box wherever there is important, temporary information about a page or situation that the user needs to be aware of.
|
|
19
|
-
|
|
20
|
-
Notice boxes are different from alert bars in several ways. Notice boxes cannot be dismissed, so they will always display until the situation is resolved. Notice boxes are for highlighting static information or information that is ongoing. Alert bars are suited to alerting a user about something that has just happened.
|
|
21
|
-
|
|
22
|
-
Another way to decide which component to use:
|
|
23
|
-
|
|
24
|
-
- a notice box will usually be displayed when a page loads, before a user takes action
|
|
25
|
-
- an alert bar will usually display in response to an action/event
|
|
26
|
-
|
|
27
|
-
Notice boxes cannot be dismissed, so it is important to provide guidance on how to fix the problem/condition that is causing the notice box to display.
|
|
28
|
-
|
|
29
|
-
Do not use a notice box to display permanent information. If there is information that always will be displayed on a page it should be designed as part of the page itself. Notice boxes are for temporary information.
|
|
30
|
-
|
|
31
|
-
Learn more about Notice Boxes at [Design System: Notice Box](https://github.com/dhis2/design-system/blob/master/molecules/notice-box.md).
|
|
32
|
-
|
|
33
|
-
\`\`\`js
|
|
34
|
-
import { NoticeBox } from '@dhis2/ui'
|
|
35
|
-
\`\`\`
|
|
36
|
-
`;
|
|
16
|
+
const subtitle = "Highlights useful information that is directly relevant to the page the user is viewing";
|
|
17
|
+
const description = "\nUse a notice box wherever there is important, temporary information about a page or situation that the user needs to be aware of.\n\nNotice boxes are different from alert bars in several ways. Notice boxes cannot be dismissed, so they will always display until the situation is resolved. Notice boxes are for highlighting static information or information that is ongoing. Alert bars are suited to alerting a user about something that has just happened.\n\nAnother way to decide which component to use:\n\n- a notice box will usually be displayed when a page loads, before a user takes action\n- an alert bar will usually display in response to an action/event\n\nNotice boxes cannot be dismissed, so it is important to provide guidance on how to fix the problem/condition that is causing the notice box to display.\n\nDo not use a notice box to display permanent information. If there is information that always will be displayed on a page it should be designed as part of the page itself. Notice boxes are for temporary information.\n\nLearn more about Notice Boxes at [Design System: Notice Box](https://github.com/dhis2/design-system/blob/master/molecules/notice-box.md).\n\n```js\nimport { NoticeBox } from '@dhis2/ui'\n```\n";
|
|
37
18
|
var _default = {
|
|
38
|
-
title: '
|
|
19
|
+
title: 'Notice Box',
|
|
39
20
|
component: _noticeBox.NoticeBox,
|
|
40
21
|
parameters: {
|
|
41
22
|
componentSubtitle: subtitle,
|
|
@@ -4,11 +4,12 @@ import { colors, spacers } from '@dhis2/ui-constants';
|
|
|
4
4
|
import { IconErrorFilled24, IconWarningFilled24, IconInfoFilled24 } from '@dhis2/ui-icons';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import React from 'react';
|
|
7
|
-
export const NoticeBoxIcon =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
export const NoticeBoxIcon = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
warning,
|
|
10
|
+
error,
|
|
11
|
+
dataTest
|
|
12
|
+
} = _ref;
|
|
12
13
|
// Info is the default icon
|
|
13
14
|
let color = colors.blue900;
|
|
14
15
|
let Icon = IconInfoFilled24;
|
|
@@ -32,7 +33,7 @@ export const NoticeBoxIcon = ({
|
|
|
32
33
|
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
33
34
|
id: "190287437",
|
|
34
35
|
dynamic: [spacers.dp12]
|
|
35
|
-
}, [
|
|
36
|
+
}, [".__jsx-style-dynamic-selector{margin-right:".concat(spacers.dp12, ";}")]));
|
|
36
37
|
};
|
|
37
38
|
NoticeBoxIcon.propTypes = {
|
|
38
39
|
dataTest: PropTypes.string.isRequired,
|
|
@@ -2,10 +2,12 @@ import _JSXStyle from "styled-jsx/style";
|
|
|
2
2
|
import { colors } from '@dhis2/ui-constants';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
export const NoticeBoxMessage =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export const NoticeBoxMessage = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
dataTest
|
|
9
|
+
} = _ref;
|
|
10
|
+
|
|
9
11
|
if (!children) {
|
|
10
12
|
return null;
|
|
11
13
|
}
|
|
@@ -16,7 +18,7 @@ export const NoticeBoxMessage = ({
|
|
|
16
18
|
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
17
19
|
id: "3452101222",
|
|
18
20
|
dynamic: [colors.grey900]
|
|
19
|
-
}, [
|
|
21
|
+
}, ["div.__jsx-style-dynamic-selector{color:".concat(colors.grey900, ";font-size:14px;line-height:20px;}")]));
|
|
20
22
|
};
|
|
21
23
|
NoticeBoxMessage.propTypes = {
|
|
22
24
|
dataTest: PropTypes.string.isRequired,
|
|
@@ -2,10 +2,12 @@ import _JSXStyle from "styled-jsx/style";
|
|
|
2
2
|
import { colors, spacers } from '@dhis2/ui-constants';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
export const NoticeBoxTitle =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export const NoticeBoxTitle = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
title,
|
|
8
|
+
dataTest
|
|
9
|
+
} = _ref;
|
|
10
|
+
|
|
9
11
|
if (!title) {
|
|
10
12
|
return null;
|
|
11
13
|
}
|
|
@@ -16,7 +18,7 @@ export const NoticeBoxTitle = ({
|
|
|
16
18
|
}, title, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
17
19
|
id: "3611901971",
|
|
18
20
|
dynamic: [colors.grey900, spacers.dp12]
|
|
19
|
-
}, [
|
|
21
|
+
}, ["h6.__jsx-style-dynamic-selector{color:".concat(colors.grey900, ";font-size:14px;font-weight:500;line-height:20px;margin:0 0 ").concat(spacers.dp12, " 0;}")]));
|
|
20
22
|
};
|
|
21
23
|
NoticeBoxTitle.propTypes = {
|
|
22
24
|
dataTest: PropTypes.string.isRequired,
|
package/build/es/notice-box.js
CHANGED
|
@@ -7,14 +7,15 @@ import React from 'react';
|
|
|
7
7
|
import { NoticeBoxIcon } from './notice-box-icon.js';
|
|
8
8
|
import { NoticeBoxMessage } from './notice-box-message.js';
|
|
9
9
|
import { NoticeBoxTitle } from './notice-box-title.js';
|
|
10
|
-
export const NoticeBox =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
export const NoticeBox = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
className,
|
|
13
|
+
children,
|
|
14
|
+
dataTest,
|
|
15
|
+
title,
|
|
16
|
+
warning,
|
|
17
|
+
error
|
|
18
|
+
} = _ref;
|
|
18
19
|
const classnames = cx(className, 'root', {
|
|
19
20
|
warning,
|
|
20
21
|
error
|
|
@@ -25,18 +26,18 @@ export const NoticeBox = ({
|
|
|
25
26
|
}, /*#__PURE__*/React.createElement(NoticeBoxIcon, {
|
|
26
27
|
error: error,
|
|
27
28
|
warning: warning,
|
|
28
|
-
dataTest:
|
|
29
|
+
dataTest: "".concat(dataTest, "-icon")
|
|
29
30
|
}), /*#__PURE__*/React.createElement("div", {
|
|
30
31
|
className: _JSXStyle.dynamic([["833500449", [colors.blue050, colors.blue200, spacers.dp12, spacers.dp16, colors.yellow050, colors.yellow200, colors.red050, colors.red500]]])
|
|
31
32
|
}, /*#__PURE__*/React.createElement(NoticeBoxTitle, {
|
|
32
33
|
title: title,
|
|
33
|
-
dataTest:
|
|
34
|
+
dataTest: "".concat(dataTest, "-title")
|
|
34
35
|
}), /*#__PURE__*/React.createElement(NoticeBoxMessage, {
|
|
35
|
-
dataTest:
|
|
36
|
+
dataTest: "".concat(dataTest, "-message")
|
|
36
37
|
}, children)), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
37
38
|
id: "833500449",
|
|
38
39
|
dynamic: [colors.blue050, colors.blue200, spacers.dp12, spacers.dp16, colors.yellow050, colors.yellow200, colors.red050, colors.red500]
|
|
39
|
-
}, [
|
|
40
|
+
}, [".root.__jsx-style-dynamic-selector{background:".concat(colors.blue050, ";border:1px solid ").concat(colors.blue200, ";border-radius:3px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding:").concat(spacers.dp12, " ").concat(spacers.dp16, ";}"), ".root.warning.__jsx-style-dynamic-selector{background:".concat(colors.yellow050, ";border:1px solid ").concat(colors.yellow200, ";}"), ".root.error.__jsx-style-dynamic-selector{background:".concat(colors.red050, ";border:2px solid ").concat(colors.red500, ";}")]));
|
|
40
41
|
};
|
|
41
42
|
NoticeBox.defaultProps = {
|
|
42
43
|
dataTest: 'dhis2-uicore-noticebox'
|
|
@@ -1,29 +1,10 @@
|
|
|
1
1
|
import { sharedPropTypes } from '@dhis2/ui-constants';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { NoticeBox } from './notice-box.js';
|
|
4
|
-
const subtitle =
|
|
5
|
-
const description =
|
|
6
|
-
Use a notice box wherever there is important, temporary information about a page or situation that the user needs to be aware of.
|
|
7
|
-
|
|
8
|
-
Notice boxes are different from alert bars in several ways. Notice boxes cannot be dismissed, so they will always display until the situation is resolved. Notice boxes are for highlighting static information or information that is ongoing. Alert bars are suited to alerting a user about something that has just happened.
|
|
9
|
-
|
|
10
|
-
Another way to decide which component to use:
|
|
11
|
-
|
|
12
|
-
- a notice box will usually be displayed when a page loads, before a user takes action
|
|
13
|
-
- an alert bar will usually display in response to an action/event
|
|
14
|
-
|
|
15
|
-
Notice boxes cannot be dismissed, so it is important to provide guidance on how to fix the problem/condition that is causing the notice box to display.
|
|
16
|
-
|
|
17
|
-
Do not use a notice box to display permanent information. If there is information that always will be displayed on a page it should be designed as part of the page itself. Notice boxes are for temporary information.
|
|
18
|
-
|
|
19
|
-
Learn more about Notice Boxes at [Design System: Notice Box](https://github.com/dhis2/design-system/blob/master/molecules/notice-box.md).
|
|
20
|
-
|
|
21
|
-
\`\`\`js
|
|
22
|
-
import { NoticeBox } from '@dhis2/ui'
|
|
23
|
-
\`\`\`
|
|
24
|
-
`;
|
|
4
|
+
const subtitle = "Highlights useful information that is directly relevant to the page the user is viewing";
|
|
5
|
+
const description = "\nUse a notice box wherever there is important, temporary information about a page or situation that the user needs to be aware of.\n\nNotice boxes are different from alert bars in several ways. Notice boxes cannot be dismissed, so they will always display until the situation is resolved. Notice boxes are for highlighting static information or information that is ongoing. Alert bars are suited to alerting a user about something that has just happened.\n\nAnother way to decide which component to use:\n\n- a notice box will usually be displayed when a page loads, before a user takes action\n- an alert bar will usually display in response to an action/event\n\nNotice boxes cannot be dismissed, so it is important to provide guidance on how to fix the problem/condition that is causing the notice box to display.\n\nDo not use a notice box to display permanent information. If there is information that always will be displayed on a page it should be designed as part of the page itself. Notice boxes are for temporary information.\n\nLearn more about Notice Boxes at [Design System: Notice Box](https://github.com/dhis2/design-system/blob/master/molecules/notice-box.md).\n\n```js\nimport { NoticeBox } from '@dhis2/ui'\n```\n";
|
|
25
6
|
export default {
|
|
26
|
-
title: '
|
|
7
|
+
title: 'Notice Box',
|
|
27
8
|
component: NoticeBox,
|
|
28
9
|
parameters: {
|
|
29
10
|
componentSubtitle: subtitle,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2-ui/notice-box",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.2",
|
|
4
4
|
"description": "UI NoticeBox",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@dhis2/prop-types": "^3.0.0-beta.1",
|
|
35
|
-
"@dhis2/ui-constants": "8.
|
|
36
|
-
"@dhis2/ui-icons": "8.
|
|
35
|
+
"@dhis2/ui-constants": "8.2.2",
|
|
36
|
+
"@dhis2/ui-icons": "8.2.2",
|
|
37
37
|
"classnames": "^2.3.1",
|
|
38
38
|
"prop-types": "^15.7.2"
|
|
39
39
|
},
|