@dhis2-ui/alert 9.11.3 → 9.11.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,10 +23,10 @@ const AlertBar = _ref => {
23
23
  children,
24
24
  className,
25
25
  critical,
26
- dataTest,
27
- duration,
26
+ dataTest = 'dhis2-uicore-alertbar',
27
+ duration = 8000,
28
28
  hidden,
29
- icon,
29
+ icon = true,
30
30
  permanent,
31
31
  success,
32
32
  warning,
@@ -132,11 +132,6 @@ const AlertBar = _ref => {
132
132
  };
133
133
  exports.AlertBar = AlertBar;
134
134
  const alertTypePropType = (0, _propTypes.mutuallyExclusive)(['success', 'warning', 'critical'], _propTypes2.default.bool);
135
- AlertBar.defaultProps = {
136
- duration: 8000,
137
- dataTest: 'dhis2-uicore-alertbar',
138
- icon: true
139
- };
140
135
  AlertBar.propTypes = {
141
136
  /** An array of 0-2 action objects
142
137
  `[{label: "Save", onClick: clickHandler}]`*/
@@ -49,6 +49,9 @@ const alertTypeArgType = {
49
49
  type: {
50
50
  summary: 'bool',
51
51
  detail: "'success', 'warning', and 'critical' are mutually exclusive props"
52
+ },
53
+ defaultValue: {
54
+ summary: false
52
55
  }
53
56
  },
54
57
  control: {
@@ -62,6 +65,26 @@ const iconArgType = {
62
65
  }
63
66
  }
64
67
  };
68
+ const permanentArgType = {
69
+ table: {
70
+ type: {
71
+ summary: 'bool'
72
+ },
73
+ defaultValue: {
74
+ summary: false
75
+ }
76
+ },
77
+ control: {
78
+ type: 'boolean'
79
+ }
80
+ };
81
+ const childrenArgType = {
82
+ table: {
83
+ type: {
84
+ summary: 'String to display in the alert bar'
85
+ }
86
+ }
87
+ };
65
88
  const actionsArgType = {
66
89
  table: {
67
90
  type: {
@@ -73,6 +96,9 @@ var _default = exports.default = {
73
96
  title: 'Alert Bar',
74
97
  component: _index.AlertBar,
75
98
  decorators: [Wrapper],
99
+ args: {
100
+ children: 'I will autohide'
101
+ },
76
102
  parameters: {
77
103
  componentSubtitle: subtitle,
78
104
  docs: {
@@ -94,12 +120,18 @@ var _default = exports.default = {
94
120
  warning: {
95
121
  ...alertTypeArgType
96
122
  },
123
+ permanent: {
124
+ ...permanentArgType
125
+ },
126
+ children: {
127
+ ...childrenArgType
128
+ },
97
129
  icon: {
98
130
  ...iconArgType
99
131
  }
100
132
  }
101
133
  };
102
- const Default = args => /*#__PURE__*/_react.default.createElement(_index.AlertBar, args, "Default - I will autohide");
134
+ const Default = args => /*#__PURE__*/_react.default.createElement(_index.AlertBar, args);
103
135
  exports.Default = Default;
104
136
  const States = () => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_index.AlertBar, {
105
137
  permanent: true
@@ -17,7 +17,7 @@ const StatusIcon = _ref => {
17
17
  warning,
18
18
  valid,
19
19
  info,
20
- defaultTo
20
+ defaultTo = null
21
21
  } = _ref;
22
22
  if (error) {
23
23
  return /*#__PURE__*/_react.default.createElement(_uiIcons.IconErrorFilled24, {
@@ -41,9 +41,6 @@ const StatusIcon = _ref => {
41
41
  }
42
42
  return defaultTo;
43
43
  };
44
- StatusIcon.defaultProps = {
45
- defaultTo: null
46
- };
47
44
  StatusIcon.propTypes = {
48
45
  defaultTo: _propTypes2.default.element,
49
46
  error: _propTypes2.default.bool,
@@ -15,7 +15,7 @@ const AlertStack = _ref => {
15
15
  let {
16
16
  className,
17
17
  children,
18
- dataTest
18
+ dataTest = 'dhis2-uicore-alertstack'
19
19
  } = _ref;
20
20
  return /*#__PURE__*/_react.default.createElement(_portal.Portal, null, /*#__PURE__*/_react.default.createElement("div", {
21
21
  "data-test": dataTest,
@@ -26,9 +26,6 @@ const AlertStack = _ref => {
26
26
  }, [`div.__jsx-style-dynamic-selector{position:fixed;top:auto;inset-inline-end:auto;bottom:0;inset-inline-start:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);z-index:${_uiConstants.layers.alert};display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column-reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;pointer-events:none;}`, "div.__jsx-style-dynamic-selector:dir(rtl){-webkit-transform:translateX(50%);-ms-transform:translateX(50%);transform:translateX(50%);}"])));
27
27
  };
28
28
  exports.AlertStack = AlertStack;
29
- AlertStack.defaultProps = {
30
- dataTest: 'dhis2-uicore-alertstack'
31
- };
32
29
  AlertStack.propTypes = {
33
30
  children: _propTypes.default.node,
34
31
  className: _propTypes.default.string,
@@ -14,10 +14,10 @@ const AlertBar = _ref => {
14
14
  children,
15
15
  className,
16
16
  critical,
17
- dataTest,
18
- duration,
17
+ dataTest = 'dhis2-uicore-alertbar',
18
+ duration = 8000,
19
19
  hidden,
20
- icon,
20
+ icon = true,
21
21
  permanent,
22
22
  success,
23
23
  warning,
@@ -122,11 +122,6 @@ const AlertBar = _ref => {
122
122
  }, styles));
123
123
  };
124
124
  const alertTypePropType = mutuallyExclusive(['success', 'warning', 'critical'], PropTypes.bool);
125
- AlertBar.defaultProps = {
126
- duration: 8000,
127
- dataTest: 'dhis2-uicore-alertbar',
128
- icon: true
129
- };
130
125
  AlertBar.propTypes = {
131
126
  /** An array of 0-2 action objects
132
127
  `[{label: "Save", onClick: clickHandler}]`*/
@@ -41,6 +41,9 @@ const alertTypeArgType = {
41
41
  type: {
42
42
  summary: 'bool',
43
43
  detail: "'success', 'warning', and 'critical' are mutually exclusive props"
44
+ },
45
+ defaultValue: {
46
+ summary: false
44
47
  }
45
48
  },
46
49
  control: {
@@ -54,6 +57,26 @@ const iconArgType = {
54
57
  }
55
58
  }
56
59
  };
60
+ const permanentArgType = {
61
+ table: {
62
+ type: {
63
+ summary: 'bool'
64
+ },
65
+ defaultValue: {
66
+ summary: false
67
+ }
68
+ },
69
+ control: {
70
+ type: 'boolean'
71
+ }
72
+ };
73
+ const childrenArgType = {
74
+ table: {
75
+ type: {
76
+ summary: 'String to display in the alert bar'
77
+ }
78
+ }
79
+ };
57
80
  const actionsArgType = {
58
81
  table: {
59
82
  type: {
@@ -65,6 +88,9 @@ export default {
65
88
  title: 'Alert Bar',
66
89
  component: AlertBar,
67
90
  decorators: [Wrapper],
91
+ args: {
92
+ children: 'I will autohide'
93
+ },
68
94
  parameters: {
69
95
  componentSubtitle: subtitle,
70
96
  docs: {
@@ -86,12 +112,18 @@ export default {
86
112
  warning: {
87
113
  ...alertTypeArgType
88
114
  },
115
+ permanent: {
116
+ ...permanentArgType
117
+ },
118
+ children: {
119
+ ...childrenArgType
120
+ },
89
121
  icon: {
90
122
  ...iconArgType
91
123
  }
92
124
  }
93
125
  };
94
- export const Default = args => /*#__PURE__*/React.createElement(AlertBar, args, "Default - I will autohide");
126
+ export const Default = args => /*#__PURE__*/React.createElement(AlertBar, args);
95
127
  export const States = () => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AlertBar, {
96
128
  permanent: true
97
129
  }, "Default (info)"), /*#__PURE__*/React.createElement(AlertBar, {
@@ -10,7 +10,7 @@ const StatusIcon = _ref => {
10
10
  warning,
11
11
  valid,
12
12
  info,
13
- defaultTo
13
+ defaultTo = null
14
14
  } = _ref;
15
15
  if (error) {
16
16
  return /*#__PURE__*/React.createElement(IconErrorFilled24, {
@@ -34,9 +34,6 @@ const StatusIcon = _ref => {
34
34
  }
35
35
  return defaultTo;
36
36
  };
37
- StatusIcon.defaultProps = {
38
- defaultTo: null
39
- };
40
37
  StatusIcon.propTypes = {
41
38
  defaultTo: PropTypes.element,
42
39
  error: PropTypes.bool,
@@ -8,7 +8,7 @@ export const AlertStack = _ref => {
8
8
  let {
9
9
  className,
10
10
  children,
11
- dataTest
11
+ dataTest = 'dhis2-uicore-alertstack'
12
12
  } = _ref;
13
13
  return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement("div", {
14
14
  "data-test": dataTest,
@@ -18,9 +18,6 @@ export const AlertStack = _ref => {
18
18
  dynamic: [layers.alert]
19
19
  }, [`div.__jsx-style-dynamic-selector{position:fixed;top:auto;inset-inline-end:auto;bottom:0;inset-inline-start:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);z-index:${layers.alert};display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column-reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;pointer-events:none;}`, "div.__jsx-style-dynamic-selector:dir(rtl){-webkit-transform:translateX(50%);-ms-transform:translateX(50%);transform:translateX(50%);}"])));
20
20
  };
21
- AlertStack.defaultProps = {
22
- dataTest: 'dhis2-uicore-alertstack'
23
- };
24
21
  AlertStack.propTypes = {
25
22
  children: PropTypes.node,
26
23
  className: PropTypes.string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2-ui/alert",
3
- "version": "9.11.3",
3
+ "version": "9.11.5",
4
4
  "description": "UI Alert",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,9 +33,9 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@dhis2/prop-types": "^3.1.2",
36
- "@dhis2-ui/portal": "9.11.3",
37
- "@dhis2/ui-constants": "9.11.3",
38
- "@dhis2/ui-icons": "9.11.3",
36
+ "@dhis2-ui/portal": "9.11.5",
37
+ "@dhis2/ui-constants": "9.11.5",
38
+ "@dhis2/ui-icons": "9.11.5",
39
39
  "classnames": "^2.3.1",
40
40
  "prop-types": "^15.7.2"
41
41
  },