@dhis2-ui/notice-box 8.10.1 → 8.11.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.
@@ -7,5 +7,5 @@ var _steps = require("cypress-cucumber-preprocessor/steps");
7
7
  cy.get('[data-test="dhis2-uicore-noticebox"]').should('be.visible');
8
8
  });
9
9
  (0, _steps.Then)('the message is visible', () => {
10
- cy.get('[data-test="dhis2-uicore-noticebox-message"]').contains('The noticebox content').should('be.visible');
10
+ cy.get('[data-test="dhis2-uicore-noticebox-content-message"]').contains('The noticebox content').should('be.visible');
11
11
  });
@@ -7,5 +7,5 @@ var _steps = require("cypress-cucumber-preprocessor/steps");
7
7
  cy.get('[data-test="dhis2-uicore-noticebox"]').should('be.visible');
8
8
  });
9
9
  (0, _steps.Then)('the title is visible', () => {
10
- cy.get('[data-test="dhis2-uicore-noticebox-title"]').contains('The noticebox title').should('be.visible');
10
+ cy.get('[data-test="dhis2-uicore-noticebox-content-title"]').contains('The noticebox title').should('be.visible');
11
11
  });
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NoticeBoxContent = void 0;
7
+
8
+ var _style = _interopRequireDefault(require("styled-jsx/style"));
9
+
10
+ var _uiConstants = require("@dhis2/ui-constants");
11
+
12
+ var _propTypes = _interopRequireDefault(require("prop-types"));
13
+
14
+ var _react = _interopRequireDefault(require("react"));
15
+
16
+ var _noticeBoxMessage = require("./notice-box-message.js");
17
+
18
+ var _noticeBoxTitle = require("./notice-box-title.js");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ const NoticeBoxContent = _ref => {
23
+ let {
24
+ children,
25
+ dataTest,
26
+ title
27
+ } = _ref;
28
+ return /*#__PURE__*/_react.default.createElement("div", {
29
+ "data-test": dataTest,
30
+ className: _style.default.dynamic([["3020667210", [_uiConstants.spacers.dp8]]])
31
+ }, /*#__PURE__*/_react.default.createElement(_noticeBoxTitle.NoticeBoxTitle, {
32
+ title: title,
33
+ dataTest: "".concat(dataTest, "-title")
34
+ }), /*#__PURE__*/_react.default.createElement(_noticeBoxMessage.NoticeBoxMessage, {
35
+ dataTest: "".concat(dataTest, "-message")
36
+ }, children), /*#__PURE__*/_react.default.createElement(_style.default, {
37
+ id: "3020667210",
38
+ dynamic: [_uiConstants.spacers.dp8]
39
+ }, ["div.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:".concat(_uiConstants.spacers.dp8, ";padding-top:3px;}")]));
40
+ };
41
+
42
+ exports.NoticeBoxContent = NoticeBoxContent;
43
+ NoticeBoxContent.defaultProps = {
44
+ dataTest: 'dhis2-uicore-noticebox-content'
45
+ };
46
+ NoticeBoxContent.propTypes = {
47
+ children: _propTypes.default.node,
48
+ dataTest: _propTypes.default.string,
49
+ title: _propTypes.default.string
50
+ };
@@ -21,6 +21,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
21
21
 
22
22
  const NoticeBoxIcon = _ref => {
23
23
  let {
24
+ valid,
24
25
  warning,
25
26
  error,
26
27
  dataTest
@@ -29,6 +30,11 @@ const NoticeBoxIcon = _ref => {
29
30
  let color = _uiConstants.colors.blue900;
30
31
  let Icon = _uiIcons.IconInfoFilled24;
31
32
 
33
+ if (valid) {
34
+ color = _uiConstants.colors.green700;
35
+ Icon = _uiIcons.IconCheckmarkCircle24;
36
+ }
37
+
32
38
  if (warning) {
33
39
  color = _uiConstants.colors.yellow700;
34
40
  Icon = _uiIcons.IconWarningFilled24;
@@ -41,19 +47,20 @@ const NoticeBoxIcon = _ref => {
41
47
 
42
48
  return /*#__PURE__*/_react.default.createElement("div", {
43
49
  "data-test": dataTest,
44
- className: _style.default.dynamic([["190287437", [_uiConstants.spacers.dp12]]])
50
+ className: _style.default.dynamic([["362741486", [_uiConstants.spacers.dp12, _uiConstants.spacers.dp24]]])
45
51
  }, /*#__PURE__*/_react.default.createElement(Icon, {
46
52
  color: color,
47
- className: _style.default.dynamic([["190287437", [_uiConstants.spacers.dp12]]])
53
+ className: _style.default.dynamic([["362741486", [_uiConstants.spacers.dp12, _uiConstants.spacers.dp24]]])
48
54
  }), /*#__PURE__*/_react.default.createElement(_style.default, {
49
- id: "190287437",
50
- dynamic: [_uiConstants.spacers.dp12]
51
- }, [".__jsx-style-dynamic-selector{margin-right:".concat(_uiConstants.spacers.dp12, ";}")]));
55
+ id: "362741486",
56
+ dynamic: [_uiConstants.spacers.dp12, _uiConstants.spacers.dp24]
57
+ }, [".__jsx-style-dynamic-selector{margin-right:".concat(_uiConstants.spacers.dp12, ";height:").concat(_uiConstants.spacers.dp24, ";}")]));
52
58
  };
53
59
 
54
60
  exports.NoticeBoxIcon = NoticeBoxIcon;
55
61
  NoticeBoxIcon.propTypes = {
56
62
  dataTest: _propTypes2.default.string.isRequired,
57
- error: (0, _propTypes.mutuallyExclusive)(['error', 'warning'], _propTypes2.default.bool),
58
- warning: (0, _propTypes.mutuallyExclusive)(['error', 'warning'], _propTypes2.default.bool)
63
+ error: (0, _propTypes.mutuallyExclusive)(['error', 'valid', 'warning'], _propTypes2.default.bool),
64
+ valid: (0, _propTypes.mutuallyExclusive)(['error', 'valid', 'warning'], _propTypes2.default.bool),
65
+ warning: (0, _propTypes.mutuallyExclusive)(['error', 'valid', 'warning'], _propTypes2.default.bool)
59
66
  };
@@ -27,11 +27,11 @@ const NoticeBoxMessage = _ref => {
27
27
 
28
28
  return /*#__PURE__*/_react.default.createElement("div", {
29
29
  "data-test": dataTest,
30
- className: _style.default.dynamic([["3452101222", [_uiConstants.colors.grey900]]])
30
+ className: _style.default.dynamic([["3568970766", [_uiConstants.colors.grey900]]])
31
31
  }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
32
- id: "3452101222",
32
+ id: "3568970766",
33
33
  dynamic: [_uiConstants.colors.grey900]
34
- }, ["div.__jsx-style-dynamic-selector{color:".concat(_uiConstants.colors.grey900, ";font-size:14px;line-height:20px;}")]));
34
+ }, ["div.__jsx-style-dynamic-selector{color:".concat(_uiConstants.colors.grey900, ";font-size:14px;line-height:19px;}")]));
35
35
  };
36
36
 
37
37
  exports.NoticeBoxMessage = NoticeBoxMessage;
@@ -27,11 +27,11 @@ const NoticeBoxTitle = _ref => {
27
27
 
28
28
  return /*#__PURE__*/_react.default.createElement("h6", {
29
29
  "data-test": dataTest,
30
- className: _style.default.dynamic([["3611901971", [_uiConstants.colors.grey900, _uiConstants.spacers.dp12]]])
30
+ className: _style.default.dynamic([["1334557505", [_uiConstants.colors.grey900]]])
31
31
  }, title, /*#__PURE__*/_react.default.createElement(_style.default, {
32
- id: "3611901971",
33
- dynamic: [_uiConstants.colors.grey900, _uiConstants.spacers.dp12]
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;}")]));
32
+ id: "1334557505",
33
+ dynamic: [_uiConstants.colors.grey900]
34
+ }, ["h6.__jsx-style-dynamic-selector{color:".concat(_uiConstants.colors.grey900, ";font-size:14px;font-weight:500;line-height:19px;margin:0;}")]));
35
35
  };
36
36
 
37
37
  exports.NoticeBoxTitle = NoticeBoxTitle;
@@ -17,11 +17,9 @@ var _propTypes2 = _interopRequireDefault(require("prop-types"));
17
17
 
18
18
  var _react = _interopRequireDefault(require("react"));
19
19
 
20
- var _noticeBoxIcon = require("./notice-box-icon.js");
21
-
22
- var _noticeBoxMessage = require("./notice-box-message.js");
20
+ var _noticeBoxContent = require("./notice-box-content.js");
23
21
 
24
- var _noticeBoxTitle = require("./notice-box-title.js");
22
+ var _noticeBoxIcon = require("./notice-box-icon.js");
25
23
 
26
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
25
 
@@ -32,30 +30,31 @@ const NoticeBox = _ref => {
32
30
  dataTest,
33
31
  title,
34
32
  warning,
35
- error
33
+ error,
34
+ valid
36
35
  } = _ref;
37
36
  const classnames = (0, _classnames.default)(className, 'root', {
38
37
  warning,
39
- error
38
+ error,
39
+ valid
40
40
  });
41
41
  return /*#__PURE__*/_react.default.createElement("div", {
42
42
  "data-test": dataTest,
43
- 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]]]) + " " + (classnames || "")
43
+ className: _style.default.dynamic([["1468515753", [_uiConstants.colors.blue050, _uiConstants.colors.blue200, _uiConstants.spacers.dp12, _uiConstants.spacers.dp16, _uiConstants.colors.yellow050, _uiConstants.colors.yellow200, _uiConstants.colors.red050, _uiConstants.colors.red500, _uiConstants.colors.green050, _uiConstants.colors.green200]]]) + " " + (classnames || "")
44
44
  }, /*#__PURE__*/_react.default.createElement(_noticeBoxIcon.NoticeBoxIcon, {
45
45
  error: error,
46
46
  warning: warning,
47
+ valid: valid,
47
48
  dataTest: "".concat(dataTest, "-icon")
48
49
  }), /*#__PURE__*/_react.default.createElement("div", {
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]]])
50
- }, /*#__PURE__*/_react.default.createElement(_noticeBoxTitle.NoticeBoxTitle, {
50
+ className: _style.default.dynamic([["1468515753", [_uiConstants.colors.blue050, _uiConstants.colors.blue200, _uiConstants.spacers.dp12, _uiConstants.spacers.dp16, _uiConstants.colors.yellow050, _uiConstants.colors.yellow200, _uiConstants.colors.red050, _uiConstants.colors.red500, _uiConstants.colors.green050, _uiConstants.colors.green200]]])
51
+ }, /*#__PURE__*/_react.default.createElement(_noticeBoxContent.NoticeBoxContent, {
51
52
  title: title,
52
- dataTest: "".concat(dataTest, "-title")
53
- }), /*#__PURE__*/_react.default.createElement(_noticeBoxMessage.NoticeBoxMessage, {
54
- dataTest: "".concat(dataTest, "-message")
53
+ dataTest: "".concat(dataTest, "-content")
55
54
  }, children)), /*#__PURE__*/_react.default.createElement(_style.default, {
56
- id: "833500449",
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]
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, ";}")]));
55
+ id: "1468515753",
56
+ 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, _uiConstants.colors.green050, _uiConstants.colors.green200]
57
+ }, [".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, ";}"), ".root.valid.__jsx-style-dynamic-selector{background:".concat(_uiConstants.colors.green050, ";border:1px solid ").concat(_uiConstants.colors.green200, ";}")]));
59
58
  };
60
59
 
61
60
  exports.NoticeBox = NoticeBox;
@@ -67,10 +66,13 @@ NoticeBox.propTypes = {
67
66
  className: _propTypes2.default.string,
68
67
  dataTest: _propTypes2.default.string,
69
68
 
70
- /** Applies 'error' message styles. Mutually exclusive with the `warning` prop */
71
- error: (0, _propTypes.mutuallyExclusive)(['error', 'warning'], _propTypes2.default.bool),
69
+ /** Applies 'error' message styles. Mutually exclusive with the `valid` and `warning` props */
70
+ error: (0, _propTypes.mutuallyExclusive)(['error', 'valid', 'warning'], _propTypes2.default.bool),
72
71
  title: _propTypes2.default.string,
73
72
 
74
- /** Applies 'warning' message styles. Mutually exclusive with the `error` prop */
75
- warning: (0, _propTypes.mutuallyExclusive)(['error', 'warning'], _propTypes2.default.bool)
73
+ /** Applies 'valid' message styles. Mutually exclusive with the `error` and `warning` props */
74
+ valid: (0, _propTypes.mutuallyExclusive)(['error', 'valid', 'warning'], _propTypes2.default.bool),
75
+
76
+ /** Applies 'warning' message styles. Mutually exclusive with the `error` and `valid` props */
77
+ warning: (0, _propTypes.mutuallyExclusive)(['error', 'valid', 'warning'], _propTypes2.default.bool)
76
78
  };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.WithALongTitle = exports.Warning = exports.Error = exports.Default = void 0;
6
+ exports.default = exports.WithoutTitle = exports.WithALongTitle = exports.Warning = exports.Valid = exports.TitleOnly = exports.Error = exports.Default = void 0;
7
7
 
8
8
  var _uiConstants = require("@dhis2/ui-constants");
9
9
 
@@ -30,6 +30,8 @@ var _default = {
30
30
  error: { ..._uiConstants.sharedPropTypes.statusArgType
31
31
  },
32
32
  warning: { ..._uiConstants.sharedPropTypes.statusArgType
33
+ },
34
+ valid: { ..._uiConstants.sharedPropTypes.statusArgType
33
35
  }
34
36
  }
35
37
  };
@@ -42,6 +44,14 @@ Default.args = {
42
44
  title: 'Your database was updated in the last 24 hours'
43
45
  };
44
46
 
47
+ const Valid = args => /*#__PURE__*/_react.default.createElement(_noticeBox.NoticeBox, args, "Programs using these rules are updated automatically.");
48
+
49
+ exports.Valid = Valid;
50
+ Valid.args = {
51
+ valid: true,
52
+ title: 'Program rules exported successfully'
53
+ };
54
+
45
55
  const Warning = args => /*#__PURE__*/_react.default.createElement(_noticeBox.NoticeBox, args, "No one will be able to access this program. Add some Organisation Units to the access list.");
46
56
 
47
57
  exports.Warning = Warning;
@@ -68,4 +78,14 @@ exports.WithALongTitle = WithALongTitle;
68
78
  WithALongTitle.args = {
69
79
  error: true,
70
80
  title: text
71
- };
81
+ };
82
+
83
+ const WithoutTitle = () => /*#__PURE__*/_react.default.createElement(_noticeBox.NoticeBox, null, "This noticebox does not have a title.");
84
+
85
+ exports.WithoutTitle = WithoutTitle;
86
+
87
+ const TitleOnly = () => /*#__PURE__*/_react.default.createElement(_noticeBox.NoticeBox, {
88
+ title: "This noticebox has only a title"
89
+ });
90
+
91
+ exports.TitleOnly = TitleOnly;
@@ -4,5 +4,5 @@ Given('a NoticeBox receives a message as children', () => {
4
4
  cy.get('[data-test="dhis2-uicore-noticebox"]').should('be.visible');
5
5
  });
6
6
  Then('the message is visible', () => {
7
- cy.get('[data-test="dhis2-uicore-noticebox-message"]').contains('The noticebox content').should('be.visible');
7
+ cy.get('[data-test="dhis2-uicore-noticebox-content-message"]').contains('The noticebox content').should('be.visible');
8
8
  });
@@ -4,5 +4,5 @@ Given('a NoticeBox receives a title prop', () => {
4
4
  cy.get('[data-test="dhis2-uicore-noticebox"]').should('be.visible');
5
5
  });
6
6
  Then('the title is visible', () => {
7
- cy.get('[data-test="dhis2-uicore-noticebox-title"]').contains('The noticebox title').should('be.visible');
7
+ cy.get('[data-test="dhis2-uicore-noticebox-content-title"]').contains('The noticebox title').should('be.visible');
8
8
  });
@@ -0,0 +1,33 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ import { spacers } from '@dhis2/ui-constants';
3
+ import PropTypes from 'prop-types';
4
+ import React from 'react';
5
+ import { NoticeBoxMessage } from './notice-box-message.js';
6
+ import { NoticeBoxTitle } from './notice-box-title.js';
7
+ export const NoticeBoxContent = _ref => {
8
+ let {
9
+ children,
10
+ dataTest,
11
+ title
12
+ } = _ref;
13
+ return /*#__PURE__*/React.createElement("div", {
14
+ "data-test": dataTest,
15
+ className: _JSXStyle.dynamic([["3020667210", [spacers.dp8]]])
16
+ }, /*#__PURE__*/React.createElement(NoticeBoxTitle, {
17
+ title: title,
18
+ dataTest: "".concat(dataTest, "-title")
19
+ }), /*#__PURE__*/React.createElement(NoticeBoxMessage, {
20
+ dataTest: "".concat(dataTest, "-message")
21
+ }, children), /*#__PURE__*/React.createElement(_JSXStyle, {
22
+ id: "3020667210",
23
+ dynamic: [spacers.dp8]
24
+ }, ["div.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;gap:".concat(spacers.dp8, ";padding-top:3px;}")]));
25
+ };
26
+ NoticeBoxContent.defaultProps = {
27
+ dataTest: 'dhis2-uicore-noticebox-content'
28
+ };
29
+ NoticeBoxContent.propTypes = {
30
+ children: PropTypes.node,
31
+ dataTest: PropTypes.string,
32
+ title: PropTypes.string
33
+ };
@@ -1,11 +1,12 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
2
  import { mutuallyExclusive } from '@dhis2/prop-types';
3
3
  import { colors, spacers } from '@dhis2/ui-constants';
4
- import { IconErrorFilled24, IconWarningFilled24, IconInfoFilled24 } from '@dhis2/ui-icons';
4
+ import { IconErrorFilled24, IconWarningFilled24, IconInfoFilled24, IconCheckmarkCircle24 } from '@dhis2/ui-icons';
5
5
  import PropTypes from 'prop-types';
6
6
  import React from 'react';
7
7
  export const NoticeBoxIcon = _ref => {
8
8
  let {
9
+ valid,
9
10
  warning,
10
11
  error,
11
12
  dataTest
@@ -14,6 +15,11 @@ export const NoticeBoxIcon = _ref => {
14
15
  let color = colors.blue900;
15
16
  let Icon = IconInfoFilled24;
16
17
 
18
+ if (valid) {
19
+ color = colors.green700;
20
+ Icon = IconCheckmarkCircle24;
21
+ }
22
+
17
23
  if (warning) {
18
24
  color = colors.yellow700;
19
25
  Icon = IconWarningFilled24;
@@ -26,17 +32,18 @@ export const NoticeBoxIcon = _ref => {
26
32
 
27
33
  return /*#__PURE__*/React.createElement("div", {
28
34
  "data-test": dataTest,
29
- className: _JSXStyle.dynamic([["190287437", [spacers.dp12]]])
35
+ className: _JSXStyle.dynamic([["362741486", [spacers.dp12, spacers.dp24]]])
30
36
  }, /*#__PURE__*/React.createElement(Icon, {
31
37
  color: color,
32
- className: _JSXStyle.dynamic([["190287437", [spacers.dp12]]])
38
+ className: _JSXStyle.dynamic([["362741486", [spacers.dp12, spacers.dp24]]])
33
39
  }), /*#__PURE__*/React.createElement(_JSXStyle, {
34
- id: "190287437",
35
- dynamic: [spacers.dp12]
36
- }, [".__jsx-style-dynamic-selector{margin-right:".concat(spacers.dp12, ";}")]));
40
+ id: "362741486",
41
+ dynamic: [spacers.dp12, spacers.dp24]
42
+ }, [".__jsx-style-dynamic-selector{margin-right:".concat(spacers.dp12, ";height:").concat(spacers.dp24, ";}")]));
37
43
  };
38
44
  NoticeBoxIcon.propTypes = {
39
45
  dataTest: PropTypes.string.isRequired,
40
- error: mutuallyExclusive(['error', 'warning'], PropTypes.bool),
41
- warning: mutuallyExclusive(['error', 'warning'], PropTypes.bool)
46
+ error: mutuallyExclusive(['error', 'valid', 'warning'], PropTypes.bool),
47
+ valid: mutuallyExclusive(['error', 'valid', 'warning'], PropTypes.bool),
48
+ warning: mutuallyExclusive(['error', 'valid', 'warning'], PropTypes.bool)
42
49
  };
@@ -14,11 +14,11 @@ export const NoticeBoxMessage = _ref => {
14
14
 
15
15
  return /*#__PURE__*/React.createElement("div", {
16
16
  "data-test": dataTest,
17
- className: _JSXStyle.dynamic([["3452101222", [colors.grey900]]])
17
+ className: _JSXStyle.dynamic([["3568970766", [colors.grey900]]])
18
18
  }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
19
- id: "3452101222",
19
+ id: "3568970766",
20
20
  dynamic: [colors.grey900]
21
- }, ["div.__jsx-style-dynamic-selector{color:".concat(colors.grey900, ";font-size:14px;line-height:20px;}")]));
21
+ }, ["div.__jsx-style-dynamic-selector{color:".concat(colors.grey900, ";font-size:14px;line-height:19px;}")]));
22
22
  };
23
23
  NoticeBoxMessage.propTypes = {
24
24
  dataTest: PropTypes.string.isRequired,
@@ -1,5 +1,5 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
- import { colors, spacers } from '@dhis2/ui-constants';
2
+ import { colors } from '@dhis2/ui-constants';
3
3
  import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
5
  export const NoticeBoxTitle = _ref => {
@@ -14,11 +14,11 @@ export const NoticeBoxTitle = _ref => {
14
14
 
15
15
  return /*#__PURE__*/React.createElement("h6", {
16
16
  "data-test": dataTest,
17
- className: _JSXStyle.dynamic([["3611901971", [colors.grey900, spacers.dp12]]])
17
+ className: _JSXStyle.dynamic([["1334557505", [colors.grey900]]])
18
18
  }, title, /*#__PURE__*/React.createElement(_JSXStyle, {
19
- id: "3611901971",
20
- dynamic: [colors.grey900, spacers.dp12]
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;}")]));
19
+ id: "1334557505",
20
+ dynamic: [colors.grey900]
21
+ }, ["h6.__jsx-style-dynamic-selector{color:".concat(colors.grey900, ";font-size:14px;font-weight:500;line-height:19px;margin:0;}")]));
22
22
  };
23
23
  NoticeBoxTitle.propTypes = {
24
24
  dataTest: PropTypes.string.isRequired,
@@ -4,9 +4,8 @@ import { spacers, colors } from '@dhis2/ui-constants';
4
4
  import cx from 'classnames';
5
5
  import PropTypes from 'prop-types';
6
6
  import React from 'react';
7
+ import { NoticeBoxContent } from './notice-box-content.js';
7
8
  import { NoticeBoxIcon } from './notice-box-icon.js';
8
- import { NoticeBoxMessage } from './notice-box-message.js';
9
- import { NoticeBoxTitle } from './notice-box-title.js';
10
9
  export const NoticeBox = _ref => {
11
10
  let {
12
11
  className,
@@ -14,30 +13,31 @@ export const NoticeBox = _ref => {
14
13
  dataTest,
15
14
  title,
16
15
  warning,
17
- error
16
+ error,
17
+ valid
18
18
  } = _ref;
19
19
  const classnames = cx(className, 'root', {
20
20
  warning,
21
- error
21
+ error,
22
+ valid
22
23
  });
23
24
  return /*#__PURE__*/React.createElement("div", {
24
25
  "data-test": dataTest,
25
- className: _JSXStyle.dynamic([["833500449", [colors.blue050, colors.blue200, spacers.dp12, spacers.dp16, colors.yellow050, colors.yellow200, colors.red050, colors.red500]]]) + " " + (classnames || "")
26
+ className: _JSXStyle.dynamic([["1468515753", [colors.blue050, colors.blue200, spacers.dp12, spacers.dp16, colors.yellow050, colors.yellow200, colors.red050, colors.red500, colors.green050, colors.green200]]]) + " " + (classnames || "")
26
27
  }, /*#__PURE__*/React.createElement(NoticeBoxIcon, {
27
28
  error: error,
28
29
  warning: warning,
30
+ valid: valid,
29
31
  dataTest: "".concat(dataTest, "-icon")
30
32
  }), /*#__PURE__*/React.createElement("div", {
31
- className: _JSXStyle.dynamic([["833500449", [colors.blue050, colors.blue200, spacers.dp12, spacers.dp16, colors.yellow050, colors.yellow200, colors.red050, colors.red500]]])
32
- }, /*#__PURE__*/React.createElement(NoticeBoxTitle, {
33
+ className: _JSXStyle.dynamic([["1468515753", [colors.blue050, colors.blue200, spacers.dp12, spacers.dp16, colors.yellow050, colors.yellow200, colors.red050, colors.red500, colors.green050, colors.green200]]])
34
+ }, /*#__PURE__*/React.createElement(NoticeBoxContent, {
33
35
  title: title,
34
- dataTest: "".concat(dataTest, "-title")
35
- }), /*#__PURE__*/React.createElement(NoticeBoxMessage, {
36
- dataTest: "".concat(dataTest, "-message")
36
+ dataTest: "".concat(dataTest, "-content")
37
37
  }, children)), /*#__PURE__*/React.createElement(_JSXStyle, {
38
- id: "833500449",
39
- dynamic: [colors.blue050, colors.blue200, spacers.dp12, spacers.dp16, colors.yellow050, colors.yellow200, colors.red050, colors.red500]
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, ";}")]));
38
+ id: "1468515753",
39
+ dynamic: [colors.blue050, colors.blue200, spacers.dp12, spacers.dp16, colors.yellow050, colors.yellow200, colors.red050, colors.red500, colors.green050, colors.green200]
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, ";}"), ".root.valid.__jsx-style-dynamic-selector{background:".concat(colors.green050, ";border:1px solid ").concat(colors.green200, ";}")]));
41
41
  };
42
42
  NoticeBox.defaultProps = {
43
43
  dataTest: 'dhis2-uicore-noticebox'
@@ -47,10 +47,13 @@ NoticeBox.propTypes = {
47
47
  className: PropTypes.string,
48
48
  dataTest: PropTypes.string,
49
49
 
50
- /** Applies 'error' message styles. Mutually exclusive with the `warning` prop */
51
- error: mutuallyExclusive(['error', 'warning'], PropTypes.bool),
50
+ /** Applies 'error' message styles. Mutually exclusive with the `valid` and `warning` props */
51
+ error: mutuallyExclusive(['error', 'valid', 'warning'], PropTypes.bool),
52
52
  title: PropTypes.string,
53
53
 
54
- /** Applies 'warning' message styles. Mutually exclusive with the `error` prop */
55
- warning: mutuallyExclusive(['error', 'warning'], PropTypes.bool)
54
+ /** Applies 'valid' message styles. Mutually exclusive with the `error` and `warning` props */
55
+ valid: mutuallyExclusive(['error', 'valid', 'warning'], PropTypes.bool),
56
+
57
+ /** Applies 'warning' message styles. Mutually exclusive with the `error` and `valid` props */
58
+ warning: mutuallyExclusive(['error', 'valid', 'warning'], PropTypes.bool)
56
59
  };
@@ -18,6 +18,8 @@ export default {
18
18
  error: { ...sharedPropTypes.statusArgType
19
19
  },
20
20
  warning: { ...sharedPropTypes.statusArgType
21
+ },
22
+ valid: { ...sharedPropTypes.statusArgType
21
23
  }
22
24
  }
23
25
  };
@@ -25,6 +27,11 @@ export const Default = args => /*#__PURE__*/React.createElement(NoticeBox, args,
25
27
  Default.args = {
26
28
  title: 'Your database was updated in the last 24 hours'
27
29
  };
30
+ export const Valid = args => /*#__PURE__*/React.createElement(NoticeBox, args, "Programs using these rules are updated automatically.");
31
+ Valid.args = {
32
+ valid: true,
33
+ title: 'Program rules exported successfully'
34
+ };
28
35
  export const Warning = args => /*#__PURE__*/React.createElement(NoticeBox, args, "No one will be able to access this program. Add some Organisation Units to the access list.");
29
36
  Warning.args = {
30
37
  warning: true,
@@ -43,4 +50,8 @@ export const WithALongTitle = args => /*#__PURE__*/React.createElement(NoticeBox
43
50
  WithALongTitle.args = {
44
51
  error: true,
45
52
  title: text
46
- };
53
+ };
54
+ export const WithoutTitle = () => /*#__PURE__*/React.createElement(NoticeBox, null, "This noticebox does not have a title.");
55
+ export const TitleOnly = () => /*#__PURE__*/React.createElement(NoticeBox, {
56
+ title: "This noticebox has only a title"
57
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2-ui/notice-box",
3
- "version": "8.10.1",
3
+ "version": "8.11.0",
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.1.2",
35
- "@dhis2/ui-constants": "8.10.1",
36
- "@dhis2/ui-icons": "8.10.1",
35
+ "@dhis2/ui-constants": "8.11.0",
36
+ "@dhis2/ui-icons": "8.11.0",
37
37
  "classnames": "^2.3.1",
38
38
  "prop-types": "^15.7.2"
39
39
  },