@dhis2-ui/alert 8.2.0 → 8.2.1
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/alert-bar/action.js +3 -3
- package/build/cjs/alert-bar/actions.js +9 -7
- package/build/cjs/alert-bar/alert-bar.js +18 -17
- package/build/cjs/alert-bar/alert-bar.stories.js +4 -23
- package/build/cjs/alert-bar/alert-bar.styles.js +1 -1
- package/build/cjs/alert-bar/dismiss.js +14 -11
- package/build/cjs/alert-bar/icon.js +20 -16
- package/build/cjs/alert-bar/message.js +10 -7
- package/build/cjs/alert-stack/alert-stack.js +14 -11
- package/build/cjs/alert-stack/alert-stack.stories.js +3 -11
- package/build/es/alert-bar/action.js +3 -3
- package/build/es/alert-bar/actions.js +9 -7
- package/build/es/alert-bar/alert-bar.js +18 -17
- package/build/es/alert-bar/alert-bar.stories.js +3 -22
- package/build/es/alert-bar/alert-bar.styles.js +1 -1
- package/build/es/alert-bar/dismiss.js +14 -11
- package/build/es/alert-bar/icon.js +20 -16
- package/build/es/alert-bar/message.js +10 -7
- package/build/es/alert-stack/alert-stack.js +14 -11
- package/build/es/alert-stack/alert-stack.stories.js +2 -10
- package/package.json +4 -4
@@ -22,8 +22,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
22
22
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
23
23
|
|
24
24
|
class Action extends _react.Component {
|
25
|
-
constructor(
|
26
|
-
super(...
|
25
|
+
constructor() {
|
26
|
+
super(...arguments);
|
27
27
|
|
28
28
|
_defineProperty(this, "onClick", event => {
|
29
29
|
this.props.onClick(event);
|
@@ -39,7 +39,7 @@ class Action extends _react.Component {
|
|
39
39
|
}, this.props.label, /*#__PURE__*/_react.default.createElement(_style.default, {
|
40
40
|
id: "663141299",
|
41
41
|
dynamic: [_uiConstants.spacers.dp12]
|
42
|
-
}, [
|
42
|
+
}, ["span.__jsx-style-dynamic-selector{margin-right:".concat(_uiConstants.spacers.dp12, ";-webkit-text-decoration:underline;text-decoration:underline;}"), "span.__jsx-style-dynamic-selector:hover{cursor:pointer;}"]));
|
43
43
|
}
|
44
44
|
|
45
45
|
}
|
@@ -21,11 +21,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
21
21
|
|
22
22
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
23
23
|
|
24
|
-
const Actions =
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
const Actions = _ref => {
|
25
|
+
let {
|
26
|
+
actions,
|
27
|
+
hide,
|
28
|
+
dataTest
|
29
|
+
} = _ref;
|
30
|
+
|
29
31
|
if (!actions) {
|
30
32
|
return null;
|
31
33
|
}
|
@@ -36,11 +38,11 @@ const Actions = ({
|
|
36
38
|
key: action.label
|
37
39
|
}, action, {
|
38
40
|
hide: hide,
|
39
|
-
dataTest:
|
41
|
+
dataTest: "".concat(dataTest, "-action")
|
40
42
|
}))), /*#__PURE__*/_react.default.createElement(_style.default, {
|
41
43
|
id: "961263490",
|
42
44
|
dynamic: [_uiConstants.spacers.dp48, _uiConstants.spacers.dp12]
|
43
|
-
}, [
|
45
|
+
}, ["div.__jsx-style-dynamic-selector{margin-left:".concat(_uiConstants.spacers.dp48, ";margin-right:-").concat(_uiConstants.spacers.dp12, ";}")]));
|
44
46
|
};
|
45
47
|
|
46
48
|
exports.Actions = Actions;
|
@@ -31,20 +31,21 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
31
31
|
|
32
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
33
33
|
|
34
|
-
const AlertBar =
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
34
|
+
const AlertBar = _ref => {
|
35
|
+
let {
|
36
|
+
actions,
|
37
|
+
children,
|
38
|
+
className,
|
39
|
+
critical,
|
40
|
+
dataTest,
|
41
|
+
duration,
|
42
|
+
hidden,
|
43
|
+
icon,
|
44
|
+
permanent,
|
45
|
+
success,
|
46
|
+
warning,
|
47
|
+
onHidden
|
48
|
+
} = _ref;
|
48
49
|
const [inViewport, setInViewport] = (0, _react.useState)(!hidden);
|
49
50
|
const [inDOM, setInDOM] = (0, _react.useState)(!hidden);
|
50
51
|
const showTimeout = (0, _react.useRef)(null);
|
@@ -130,7 +131,7 @@ const AlertBar = ({
|
|
130
131
|
"data-test": dataTest,
|
131
132
|
onMouseEnter: pauseDisplayTimeout,
|
132
133
|
onMouseLeave: resumeDisplayTimeout,
|
133
|
-
className:
|
134
|
+
className: "jsx-".concat(_alertBarStyles.default.__hash) + " " + ((0, _classnames.default)(className, {
|
134
135
|
info,
|
135
136
|
success,
|
136
137
|
warning,
|
@@ -138,7 +139,7 @@ const AlertBar = ({
|
|
138
139
|
inViewport
|
139
140
|
}) || "")
|
140
141
|
}, /*#__PURE__*/_react.default.createElement(_icon.Icon, {
|
141
|
-
dataTest:
|
142
|
+
dataTest: "".concat(dataTest, "-icon"),
|
142
143
|
icon: icon,
|
143
144
|
critical: critical,
|
144
145
|
success: success,
|
@@ -150,7 +151,7 @@ const AlertBar = ({
|
|
150
151
|
dataTest: dataTest
|
151
152
|
}), /*#__PURE__*/_react.default.createElement(_dismiss.Dismiss, {
|
152
153
|
onClick: runHideAnimation,
|
153
|
-
dataTest:
|
154
|
+
dataTest: "".concat(dataTest, "-dismiss")
|
154
155
|
}), /*#__PURE__*/_react.default.createElement(_style.default, {
|
155
156
|
id: _alertBarStyles.default.__hash
|
156
157
|
}, _alertBarStyles.default));
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.default = exports.WithActions = exports.TextOverflow = exports.States = exports.Icons = exports.HiddenProp = exports.Default = exports.AutoHiding = void 0;
|
7
7
|
|
8
8
|
var _uiIcons = require("@dhis2/ui-icons");
|
9
9
|
|
@@ -15,27 +15,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
15
15
|
|
16
16
|
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; }
|
17
17
|
|
18
|
-
const subtitle =
|
19
|
-
|
20
|
-
in the context of the current screen.
|
21
|
-
`;
|
22
|
-
const description = `
|
23
|
-
Alert bars notify a user of some information. There are different types of
|
24
|
-
alert bar for displaying different types of content. Use the alert bar type
|
25
|
-
that matches your content type and importance. Note that alert bar can be
|
26
|
-
ignored by the user, so they shouldn't be used for content that needs to
|
27
|
-
block an app flow, use a modal instead.
|
28
|
-
|
29
|
-
Alert bars are always displayed at centered and fixed at the bottom of the
|
30
|
-
screen. Some types of alert bar dismiss after a set time, others must be
|
31
|
-
dismissed by the user.
|
32
|
-
|
33
|
-
See specification: [Design System](https://github.com/dhis2/design-system/blob/master/molecules/alertbar.md)
|
34
|
-
|
35
|
-
\`\`\`js
|
36
|
-
import { AlertBar } from '@dhis2/ui'
|
37
|
-
\`\`\`
|
38
|
-
`;
|
18
|
+
const subtitle = "\nA floating alert that informs the user about temporary information\nin the context of the current screen.\n";
|
19
|
+
const description = "\nAlert bars notify a user of some information. There are different types of\nalert bar for displaying different types of content. Use the alert bar type\nthat matches your content type and importance. Note that alert bar can be\nignored by the user, so they shouldn't be used for content that needs to\nblock an app flow, use a modal instead.\n\nAlert bars are always displayed at centered and fixed at the bottom of the\nscreen. Some types of alert bar dismiss after a set time, others must be\ndismissed by the user.\n\nSee specification: [Design System](https://github.com/dhis2/design-system/blob/master/molecules/alertbar.md)\n\n```js\nimport { AlertBar } from '@dhis2/ui'\n```\n";
|
39
20
|
|
40
21
|
const Wrapper = fn => /*#__PURE__*/_react.default.createElement("div", {
|
41
22
|
style: {
|
@@ -78,7 +59,7 @@ const actionsArgType = {
|
|
78
59
|
}
|
79
60
|
};
|
80
61
|
var _default = {
|
81
|
-
title: '
|
62
|
+
title: 'Alert Bar',
|
82
63
|
component: _index.AlertBar,
|
83
64
|
decorators: [Wrapper],
|
84
65
|
parameters: {
|
@@ -9,7 +9,7 @@ var _uiConstants = require("@dhis2/ui-constants");
|
|
9
9
|
|
10
10
|
const ANIMATION_TIME = 350;
|
11
11
|
exports.ANIMATION_TIME = ANIMATION_TIME;
|
12
|
-
const _defaultExport = [
|
12
|
+
const _defaultExport = ["div.jsx-2593868549{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border-radius:4px;box-shadow:".concat(_uiConstants.elevations.e300, ";padding-top:").concat(_uiConstants.spacers.dp8, ";padding-right:").concat(_uiConstants.spacers.dp8, ";padding-bottom:").concat(_uiConstants.spacers.dp8, ";padding-left:").concat(_uiConstants.spacers.dp24, ";margin-bottom:").concat(_uiConstants.spacers.dp16, ";max-width:600px;min-width:300px;font-size:14px;pointer-events:all;}"), "div.info.jsx-2593868549{background-color:".concat(_uiConstants.colors.grey900, ";color:").concat(_uiConstants.colors.white, ";}"), "div.success.jsx-2593868549{background-color:".concat(_uiConstants.colors.green800, ";color:").concat(_uiConstants.colors.white, ";}"), "div.warning.jsx-2593868549{background-color:".concat(_uiConstants.colors.yellow300, ";color:").concat(_uiConstants.colors.yellow900, ";}"), "div.critical.jsx-2593868549{background-color:".concat(_uiConstants.colors.red800, ";color:").concat(_uiConstants.colors.white, ";}"), "@-webkit-keyframes slidein-jsx-2593868549{from{-webkit-transform:translateY(1000px);-ms-transform:translateY(1000px);transform:translateY(1000px);}to{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}}", "@keyframes slidein-jsx-2593868549{from{-webkit-transform:translateY(1000px);-ms-transform:translateY(1000px);transform:translateY(1000px);}to{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}}", "@-webkit-keyframes slideout-jsx-2593868549{from{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}to{-webkit-transform:translateY(1000px);-ms-transform:translateY(1000px);transform:translateY(1000px);}}", "@keyframes slideout-jsx-2593868549{from{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}to{-webkit-transform:translateY(1000px);-ms-transform:translateY(1000px);transform:translateY(1000px);}}", "div.inViewport.jsx-2593868549{-webkit-animation-duration:".concat(ANIMATION_TIME, "ms;animation-duration:").concat(ANIMATION_TIME, "ms;-webkit-animation-name:slidein-jsx-2593868549;animation-name:slidein-jsx-2593868549;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-timing-function:cubic-bezier(0.4,0,0.6,1);animation-timing-function:cubic-bezier(0.4,0,0.6,1);}"), "div.jsx-2593868549{-webkit-animation-duration:".concat(ANIMATION_TIME, "ms;animation-duration:").concat(ANIMATION_TIME, "ms;-webkit-animation-name:slideout-jsx-2593868549;animation-name:slideout-jsx-2593868549;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-timing-function:cubic-bezier(0.4,0,0.6,1);animation-timing-function:cubic-bezier(0.4,0,0.6,1);}")];
|
13
13
|
_defaultExport.__hash = "2593868549";
|
14
14
|
var _default = _defaultExport;
|
15
15
|
exports.default = _default;
|
@@ -17,17 +17,20 @@ var _react = _interopRequireDefault(require("react"));
|
|
17
17
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
19
|
|
20
|
-
const Dismiss =
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
"
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
20
|
+
const Dismiss = _ref => {
|
21
|
+
let {
|
22
|
+
onClick,
|
23
|
+
dataTest
|
24
|
+
} = _ref;
|
25
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
26
|
+
onClick: onClick,
|
27
|
+
"data-test": dataTest,
|
28
|
+
className: _style.default.dynamic([["489362409", [_uiConstants.spacers.dp16]]])
|
29
|
+
}, /*#__PURE__*/_react.default.createElement(_uiIcons.IconCross24, null), /*#__PURE__*/_react.default.createElement(_style.default, {
|
30
|
+
id: "489362409",
|
31
|
+
dynamic: [_uiConstants.spacers.dp16]
|
32
|
+
}, ["div.__jsx-style-dynamic-selector{margin-left:".concat(_uiConstants.spacers.dp16, ";min-height:32px;min-width:32px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;border-radius:5px;}"), "div.__jsx-style-dynamic-selector:hover{cursor:pointer;background:rgba(0,0,0,0.15);}", "div.__jsx-style-dynamic-selector:active{background:rgba(0,0,0,0.25);}", "div.__jsx-style-dynamic-selector svg{width:18px;height:18px;}"]));
|
33
|
+
};
|
31
34
|
|
32
35
|
exports.Dismiss = Dismiss;
|
33
36
|
Dismiss.propTypes = {
|
@@ -19,13 +19,15 @@ var _react = _interopRequireDefault(require("react"));
|
|
19
19
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
21
|
|
22
|
-
const StatusIcon =
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
const StatusIcon = _ref => {
|
23
|
+
let {
|
24
|
+
error,
|
25
|
+
warning,
|
26
|
+
valid,
|
27
|
+
info,
|
28
|
+
defaultTo
|
29
|
+
} = _ref;
|
30
|
+
|
29
31
|
if (error) {
|
30
32
|
return /*#__PURE__*/_react.default.createElement(_uiIcons.IconErrorFilled24, {
|
31
33
|
color: _uiConstants.colors.white
|
@@ -64,14 +66,16 @@ StatusIcon.propTypes = {
|
|
64
66
|
warning: _propTypes2.default.bool
|
65
67
|
};
|
66
68
|
|
67
|
-
const Icon =
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
69
|
+
const Icon = _ref2 => {
|
70
|
+
let {
|
71
|
+
icon,
|
72
|
+
success,
|
73
|
+
warning,
|
74
|
+
critical,
|
75
|
+
info,
|
76
|
+
dataTest
|
77
|
+
} = _ref2;
|
78
|
+
|
75
79
|
if (icon === false) {
|
76
80
|
return null;
|
77
81
|
}
|
@@ -87,7 +91,7 @@ const Icon = ({
|
|
87
91
|
}), /*#__PURE__*/_react.default.createElement(_style.default, {
|
88
92
|
id: "2057519855",
|
89
93
|
dynamic: [_uiConstants.spacers.dp16]
|
90
|
-
}, [
|
94
|
+
}, ["div.__jsx-style-dynamic-selector{margin-right:".concat(_uiConstants.spacers.dp16, ";}")]));
|
91
95
|
};
|
92
96
|
|
93
97
|
exports.Icon = Icon;
|
@@ -13,13 +13,16 @@ var _react = _interopRequireDefault(require("react"));
|
|
13
13
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
15
|
|
16
|
-
const Message =
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
},
|
16
|
+
const Message = _ref => {
|
17
|
+
let {
|
18
|
+
children
|
19
|
+
} = _ref;
|
20
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
21
|
+
className: "jsx-2181391309"
|
22
|
+
}, children, /*#__PURE__*/_react.default.createElement(_style.default, {
|
23
|
+
id: "2181391309"
|
24
|
+
}, ["div.jsx-2181391309{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}"]));
|
25
|
+
};
|
23
26
|
|
24
27
|
exports.Message = Message;
|
25
28
|
Message.propTypes = {
|
@@ -19,17 +19,20 @@ var _react = _interopRequireDefault(require("react"));
|
|
19
19
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
21
21
|
|
22
|
-
const AlertStack =
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
22
|
+
const AlertStack = _ref => {
|
23
|
+
let {
|
24
|
+
className,
|
25
|
+
children,
|
26
|
+
dataTest
|
27
|
+
} = _ref;
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_portal.Portal, null, /*#__PURE__*/_react.default.createElement("div", {
|
29
|
+
"data-test": dataTest,
|
30
|
+
className: _style.default.dynamic([["132471376", [_uiConstants.layers.alert]]]) + " " + ((0, _classnames.default)(className) || "")
|
31
|
+
}, children, /*#__PURE__*/_react.default.createElement(_style.default, {
|
32
|
+
id: "132471376",
|
33
|
+
dynamic: [_uiConstants.layers.alert]
|
34
|
+
}, ["div.__jsx-style-dynamic-selector{position:fixed;top:auto;right:auto;bottom:0;left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);z-index:".concat(_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;}")])));
|
35
|
+
};
|
33
36
|
|
34
37
|
exports.AlertStack = AlertStack;
|
35
38
|
AlertStack.defaultProps = {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.default = exports.Default = void 0;
|
7
7
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
9
9
|
|
@@ -13,17 +13,9 @@ var _alertStack = require("./alert-stack.js");
|
|
13
13
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
15
|
|
16
|
-
const description =
|
17
|
-
A container for Alert Bars.
|
18
|
-
|
19
|
-
_**Note:** The demos on this page may be slow._
|
20
|
-
|
21
|
-
\`\`\`js
|
22
|
-
import { AlertStack } from '@dhis2/ui'
|
23
|
-
\`\`\`
|
24
|
-
`;
|
16
|
+
const description = "\nA container for Alert Bars.\n\n_**Note:** The demos on this page may be slow._\n\n```js\nimport { AlertStack } from '@dhis2/ui'\n```\n";
|
25
17
|
var _default = {
|
26
|
-
title: '
|
18
|
+
title: 'Alert Stack',
|
27
19
|
component: _alertStack.AlertStack,
|
28
20
|
// Use an iframe in docs to contain 'portal'
|
29
21
|
parameters: {
|
@@ -7,8 +7,8 @@ import PropTypes from 'prop-types';
|
|
7
7
|
import React, { Component } from 'react';
|
8
8
|
|
9
9
|
class Action extends Component {
|
10
|
-
constructor(
|
11
|
-
super(...
|
10
|
+
constructor() {
|
11
|
+
super(...arguments);
|
12
12
|
|
13
13
|
_defineProperty(this, "onClick", event => {
|
14
14
|
this.props.onClick(event);
|
@@ -24,7 +24,7 @@ class Action extends Component {
|
|
24
24
|
}, this.props.label, /*#__PURE__*/React.createElement(_JSXStyle, {
|
25
25
|
id: "663141299",
|
26
26
|
dynamic: [spacers.dp12]
|
27
|
-
}, [
|
27
|
+
}, ["span.__jsx-style-dynamic-selector{margin-right:".concat(spacers.dp12, ";-webkit-text-decoration:underline;text-decoration:underline;}"), "span.__jsx-style-dynamic-selector:hover{cursor:pointer;}"]));
|
28
28
|
}
|
29
29
|
|
30
30
|
}
|
@@ -8,11 +8,13 @@ import PropTypes from 'prop-types';
|
|
8
8
|
import React from 'react';
|
9
9
|
import { Action } from './action.js';
|
10
10
|
|
11
|
-
const Actions =
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
const Actions = _ref => {
|
12
|
+
let {
|
13
|
+
actions,
|
14
|
+
hide,
|
15
|
+
dataTest
|
16
|
+
} = _ref;
|
17
|
+
|
16
18
|
if (!actions) {
|
17
19
|
return null;
|
18
20
|
}
|
@@ -23,11 +25,11 @@ const Actions = ({
|
|
23
25
|
key: action.label
|
24
26
|
}, action, {
|
25
27
|
hide: hide,
|
26
|
-
dataTest:
|
28
|
+
dataTest: "".concat(dataTest, "-action")
|
27
29
|
}))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
28
30
|
id: "961263490",
|
29
31
|
dynamic: [spacers.dp48, spacers.dp12]
|
30
|
-
}, [
|
32
|
+
}, ["div.__jsx-style-dynamic-selector{margin-left:".concat(spacers.dp48, ";margin-right:-").concat(spacers.dp12, ";}")]));
|
31
33
|
};
|
32
34
|
|
33
35
|
const actionsPropType = arrayWithLength(0, 2, PropTypes.shape({
|
@@ -9,20 +9,21 @@ import { Dismiss } from './dismiss.js';
|
|
9
9
|
import { Icon, iconPropType } from './icon.js';
|
10
10
|
import { Message } from './message.js';
|
11
11
|
|
12
|
-
const AlertBar =
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
12
|
+
const AlertBar = _ref => {
|
13
|
+
let {
|
14
|
+
actions,
|
15
|
+
children,
|
16
|
+
className,
|
17
|
+
critical,
|
18
|
+
dataTest,
|
19
|
+
duration,
|
20
|
+
hidden,
|
21
|
+
icon,
|
22
|
+
permanent,
|
23
|
+
success,
|
24
|
+
warning,
|
25
|
+
onHidden
|
26
|
+
} = _ref;
|
26
27
|
const [inViewport, setInViewport] = useState(!hidden);
|
27
28
|
const [inDOM, setInDOM] = useState(!hidden);
|
28
29
|
const showTimeout = useRef(null);
|
@@ -108,7 +109,7 @@ const AlertBar = ({
|
|
108
109
|
"data-test": dataTest,
|
109
110
|
onMouseEnter: pauseDisplayTimeout,
|
110
111
|
onMouseLeave: resumeDisplayTimeout,
|
111
|
-
className:
|
112
|
+
className: "jsx-".concat(styles.__hash) + " " + (cx(className, {
|
112
113
|
info,
|
113
114
|
success,
|
114
115
|
warning,
|
@@ -116,7 +117,7 @@ const AlertBar = ({
|
|
116
117
|
inViewport
|
117
118
|
}) || "")
|
118
119
|
}, /*#__PURE__*/React.createElement(Icon, {
|
119
|
-
dataTest:
|
120
|
+
dataTest: "".concat(dataTest, "-icon"),
|
120
121
|
icon: icon,
|
121
122
|
critical: critical,
|
122
123
|
success: success,
|
@@ -128,7 +129,7 @@ const AlertBar = ({
|
|
128
129
|
dataTest: dataTest
|
129
130
|
}), /*#__PURE__*/React.createElement(Dismiss, {
|
130
131
|
onClick: runHideAnimation,
|
131
|
-
dataTest:
|
132
|
+
dataTest: "".concat(dataTest, "-dismiss")
|
132
133
|
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
133
134
|
id: styles.__hash
|
134
135
|
}, styles));
|
@@ -1,27 +1,8 @@
|
|
1
1
|
import { IconFile16 } from '@dhis2/ui-icons';
|
2
2
|
import React, { useState } from 'react';
|
3
3
|
import { AlertBar } from './index.js';
|
4
|
-
const subtitle =
|
5
|
-
|
6
|
-
in the context of the current screen.
|
7
|
-
`;
|
8
|
-
const description = `
|
9
|
-
Alert bars notify a user of some information. There are different types of
|
10
|
-
alert bar for displaying different types of content. Use the alert bar type
|
11
|
-
that matches your content type and importance. Note that alert bar can be
|
12
|
-
ignored by the user, so they shouldn't be used for content that needs to
|
13
|
-
block an app flow, use a modal instead.
|
14
|
-
|
15
|
-
Alert bars are always displayed at centered and fixed at the bottom of the
|
16
|
-
screen. Some types of alert bar dismiss after a set time, others must be
|
17
|
-
dismissed by the user.
|
18
|
-
|
19
|
-
See specification: [Design System](https://github.com/dhis2/design-system/blob/master/molecules/alertbar.md)
|
20
|
-
|
21
|
-
\`\`\`js
|
22
|
-
import { AlertBar } from '@dhis2/ui'
|
23
|
-
\`\`\`
|
24
|
-
`;
|
4
|
+
const subtitle = "\nA floating alert that informs the user about temporary information\nin the context of the current screen.\n";
|
5
|
+
const description = "\nAlert bars notify a user of some information. There are different types of\nalert bar for displaying different types of content. Use the alert bar type\nthat matches your content type and importance. Note that alert bar can be\nignored by the user, so they shouldn't be used for content that needs to\nblock an app flow, use a modal instead.\n\nAlert bars are always displayed at centered and fixed at the bottom of the\nscreen. Some types of alert bar dismiss after a set time, others must be\ndismissed by the user.\n\nSee specification: [Design System](https://github.com/dhis2/design-system/blob/master/molecules/alertbar.md)\n\n```js\nimport { AlertBar } from '@dhis2/ui'\n```\n";
|
25
6
|
|
26
7
|
const Wrapper = fn => /*#__PURE__*/React.createElement("div", {
|
27
8
|
style: {
|
@@ -64,7 +45,7 @@ const actionsArgType = {
|
|
64
45
|
}
|
65
46
|
};
|
66
47
|
export default {
|
67
|
-
title: '
|
48
|
+
title: 'Alert Bar',
|
68
49
|
component: AlertBar,
|
69
50
|
decorators: [Wrapper],
|
70
51
|
parameters: {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { colors, spacers, elevations } from '@dhis2/ui-constants';
|
2
2
|
export const ANIMATION_TIME = 350;
|
3
|
-
const _defaultExport = [
|
3
|
+
const _defaultExport = ["div.jsx-2593868549{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border-radius:4px;box-shadow:".concat(elevations.e300, ";padding-top:").concat(spacers.dp8, ";padding-right:").concat(spacers.dp8, ";padding-bottom:").concat(spacers.dp8, ";padding-left:").concat(spacers.dp24, ";margin-bottom:").concat(spacers.dp16, ";max-width:600px;min-width:300px;font-size:14px;pointer-events:all;}"), "div.info.jsx-2593868549{background-color:".concat(colors.grey900, ";color:").concat(colors.white, ";}"), "div.success.jsx-2593868549{background-color:".concat(colors.green800, ";color:").concat(colors.white, ";}"), "div.warning.jsx-2593868549{background-color:".concat(colors.yellow300, ";color:").concat(colors.yellow900, ";}"), "div.critical.jsx-2593868549{background-color:".concat(colors.red800, ";color:").concat(colors.white, ";}"), "@-webkit-keyframes slidein-jsx-2593868549{from{-webkit-transform:translateY(1000px);-ms-transform:translateY(1000px);transform:translateY(1000px);}to{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}}", "@keyframes slidein-jsx-2593868549{from{-webkit-transform:translateY(1000px);-ms-transform:translateY(1000px);transform:translateY(1000px);}to{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}}", "@-webkit-keyframes slideout-jsx-2593868549{from{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}to{-webkit-transform:translateY(1000px);-ms-transform:translateY(1000px);transform:translateY(1000px);}}", "@keyframes slideout-jsx-2593868549{from{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}to{-webkit-transform:translateY(1000px);-ms-transform:translateY(1000px);transform:translateY(1000px);}}", "div.inViewport.jsx-2593868549{-webkit-animation-duration:".concat(ANIMATION_TIME, "ms;animation-duration:").concat(ANIMATION_TIME, "ms;-webkit-animation-name:slidein-jsx-2593868549;animation-name:slidein-jsx-2593868549;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-timing-function:cubic-bezier(0.4,0,0.6,1);animation-timing-function:cubic-bezier(0.4,0,0.6,1);}"), "div.jsx-2593868549{-webkit-animation-duration:".concat(ANIMATION_TIME, "ms;animation-duration:").concat(ANIMATION_TIME, "ms;-webkit-animation-name:slideout-jsx-2593868549;animation-name:slideout-jsx-2593868549;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-timing-function:cubic-bezier(0.4,0,0.6,1);animation-timing-function:cubic-bezier(0.4,0,0.6,1);}")];
|
4
4
|
_defaultExport.__hash = "2593868549";
|
5
5
|
export default _defaultExport;
|
@@ -4,17 +4,20 @@ import { IconCross24 } from '@dhis2/ui-icons';
|
|
4
4
|
import PropTypes from 'prop-types';
|
5
5
|
import React from 'react';
|
6
6
|
|
7
|
-
const Dismiss =
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
"
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
7
|
+
const Dismiss = _ref => {
|
8
|
+
let {
|
9
|
+
onClick,
|
10
|
+
dataTest
|
11
|
+
} = _ref;
|
12
|
+
return /*#__PURE__*/React.createElement("div", {
|
13
|
+
onClick: onClick,
|
14
|
+
"data-test": dataTest,
|
15
|
+
className: _JSXStyle.dynamic([["489362409", [spacers.dp16]]])
|
16
|
+
}, /*#__PURE__*/React.createElement(IconCross24, null), /*#__PURE__*/React.createElement(_JSXStyle, {
|
17
|
+
id: "489362409",
|
18
|
+
dynamic: [spacers.dp16]
|
19
|
+
}, ["div.__jsx-style-dynamic-selector{margin-left:".concat(spacers.dp16, ";min-height:32px;min-width:32px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;border-radius:5px;}"), "div.__jsx-style-dynamic-selector:hover{cursor:pointer;background:rgba(0,0,0,0.15);}", "div.__jsx-style-dynamic-selector:active{background:rgba(0,0,0,0.25);}", "div.__jsx-style-dynamic-selector svg{width:18px;height:18px;}"]));
|
20
|
+
};
|
18
21
|
|
19
22
|
Dismiss.propTypes = {
|
20
23
|
dataTest: PropTypes.string.isRequired,
|
@@ -5,13 +5,15 @@ import { IconErrorFilled24, IconInfoFilled24, IconWarningFilled24, IconCheckmark
|
|
5
5
|
import PropTypes from 'prop-types';
|
6
6
|
import React from 'react';
|
7
7
|
|
8
|
-
const StatusIcon =
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
const StatusIcon = _ref => {
|
9
|
+
let {
|
10
|
+
error,
|
11
|
+
warning,
|
12
|
+
valid,
|
13
|
+
info,
|
14
|
+
defaultTo
|
15
|
+
} = _ref;
|
16
|
+
|
15
17
|
if (error) {
|
16
18
|
return /*#__PURE__*/React.createElement(IconErrorFilled24, {
|
17
19
|
color: colors.white
|
@@ -50,14 +52,16 @@ StatusIcon.propTypes = {
|
|
50
52
|
warning: PropTypes.bool
|
51
53
|
};
|
52
54
|
|
53
|
-
const Icon =
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
55
|
+
const Icon = _ref2 => {
|
56
|
+
let {
|
57
|
+
icon,
|
58
|
+
success,
|
59
|
+
warning,
|
60
|
+
critical,
|
61
|
+
info,
|
62
|
+
dataTest
|
63
|
+
} = _ref2;
|
64
|
+
|
61
65
|
if (icon === false) {
|
62
66
|
return null;
|
63
67
|
}
|
@@ -73,7 +77,7 @@ const Icon = ({
|
|
73
77
|
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
74
78
|
id: "2057519855",
|
75
79
|
dynamic: [spacers.dp16]
|
76
|
-
}, [
|
80
|
+
}, ["div.__jsx-style-dynamic-selector{margin-right:".concat(spacers.dp16, ";}")]));
|
77
81
|
};
|
78
82
|
|
79
83
|
const iconPropType = PropTypes.oneOfType([PropTypes.bool, PropTypes.element]);
|
@@ -2,13 +2,16 @@ import _JSXStyle from "styled-jsx/style";
|
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import React from 'react';
|
4
4
|
|
5
|
-
const Message =
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
},
|
5
|
+
const Message = _ref => {
|
6
|
+
let {
|
7
|
+
children
|
8
|
+
} = _ref;
|
9
|
+
return /*#__PURE__*/React.createElement("div", {
|
10
|
+
className: "jsx-2181391309"
|
11
|
+
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
12
|
+
id: "2181391309"
|
13
|
+
}, ["div.jsx-2181391309{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}"]));
|
14
|
+
};
|
12
15
|
|
13
16
|
Message.propTypes = {
|
14
17
|
children: PropTypes.string.isRequired
|
@@ -4,17 +4,20 @@ import { layers } from '@dhis2/ui-constants';
|
|
4
4
|
import cx from 'classnames';
|
5
5
|
import PropTypes from 'prop-types';
|
6
6
|
import React from 'react';
|
7
|
-
export const AlertStack =
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
7
|
+
export const AlertStack = _ref => {
|
8
|
+
let {
|
9
|
+
className,
|
10
|
+
children,
|
11
|
+
dataTest
|
12
|
+
} = _ref;
|
13
|
+
return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement("div", {
|
14
|
+
"data-test": dataTest,
|
15
|
+
className: _JSXStyle.dynamic([["132471376", [layers.alert]]]) + " " + (cx(className) || "")
|
16
|
+
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
17
|
+
id: "132471376",
|
18
|
+
dynamic: [layers.alert]
|
19
|
+
}, ["div.__jsx-style-dynamic-selector{position:fixed;top:auto;right:auto;bottom:0;left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);z-index:".concat(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;}")])));
|
20
|
+
};
|
18
21
|
AlertStack.defaultProps = {
|
19
22
|
dataTest: 'dhis2-uicore-alertstack'
|
20
23
|
};
|
@@ -1,17 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { AlertBar } from '../alert-bar/index.js';
|
3
3
|
import { AlertStack } from './alert-stack.js';
|
4
|
-
const description =
|
5
|
-
A container for Alert Bars.
|
6
|
-
|
7
|
-
_**Note:** The demos on this page may be slow._
|
8
|
-
|
9
|
-
\`\`\`js
|
10
|
-
import { AlertStack } from '@dhis2/ui'
|
11
|
-
\`\`\`
|
12
|
-
`;
|
4
|
+
const description = "\nA container for Alert Bars.\n\n_**Note:** The demos on this page may be slow._\n\n```js\nimport { AlertStack } from '@dhis2/ui'\n```\n";
|
13
5
|
export default {
|
14
|
-
title: '
|
6
|
+
title: 'Alert Stack',
|
15
7
|
component: AlertStack,
|
16
8
|
// Use an iframe in docs to contain 'portal'
|
17
9
|
parameters: {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dhis2-ui/alert",
|
3
|
-
"version": "8.2.
|
3
|
+
"version": "8.2.1",
|
4
4
|
"description": "UI Alert",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -32,9 +32,9 @@
|
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
34
|
"@dhis2/prop-types": "^3.0.0-beta.1",
|
35
|
-
"@dhis2-ui/portal": "8.2.
|
36
|
-
"@dhis2/ui-constants": "8.2.
|
37
|
-
"@dhis2/ui-icons": "8.2.
|
35
|
+
"@dhis2-ui/portal": "8.2.1",
|
36
|
+
"@dhis2/ui-constants": "8.2.1",
|
37
|
+
"@dhis2/ui-icons": "8.2.1",
|
38
38
|
"classnames": "^2.3.1",
|
39
39
|
"prop-types": "^15.7.2"
|
40
40
|
},
|