@canonical/react-components 3.7.1 → 3.8.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/dist/components/LoginPageLayout/LoginPageLayout.stories.js +1 -1
- package/dist/components/Notifications/ToastNotification/ToastNotification.d.ts +2 -0
- package/dist/components/Notifications/ToastNotification/ToastNotification.js +9 -3
- package/dist/components/Notifications/ToastNotification/ToastNotificationProvider.js +15 -1
- package/dist/esm/components/LoginPageLayout/LoginPageLayout.stories.js +1 -1
- package/dist/esm/components/Notifications/ToastNotification/ToastNotification.d.ts +2 -0
- package/dist/esm/components/Notifications/ToastNotification/ToastNotification.js +9 -3
- package/dist/esm/components/Notifications/ToastNotification/ToastNotificationProvider.js +15 -1
- package/package.json +2 -2
|
@@ -50,7 +50,7 @@ const RegistrationPage = exports.RegistrationPage = {
|
|
|
50
50
|
placeholder: "Password"
|
|
51
51
|
}), /*#__PURE__*/_react.default.createElement("button", null, "Sign up"))),
|
|
52
52
|
logo: {
|
|
53
|
-
src: "https://anbox-cloud
|
|
53
|
+
src: "https://assets.ubuntu.com/v1/04242fd4-anbox-cloud-logo.svg",
|
|
54
54
|
title: "Anbox Cloud",
|
|
55
55
|
url: "/"
|
|
56
56
|
}
|
|
@@ -5,6 +5,8 @@ interface Props {
|
|
|
5
5
|
notification: ToastNotificationType;
|
|
6
6
|
onDismiss: (notification?: ToastNotificationType[]) => void;
|
|
7
7
|
show: boolean;
|
|
8
|
+
onHoverStart?: () => void;
|
|
9
|
+
onHoverEnd?: () => void;
|
|
8
10
|
}
|
|
9
11
|
declare const ToastNotification: FC<Props>;
|
|
10
12
|
export default ToastNotification;
|
|
@@ -17,7 +17,9 @@ const ToastNotification = _ref => {
|
|
|
17
17
|
let {
|
|
18
18
|
notification,
|
|
19
19
|
onDismiss,
|
|
20
|
-
show
|
|
20
|
+
show,
|
|
21
|
+
onHoverStart,
|
|
22
|
+
onHoverEnd
|
|
21
23
|
} = _ref;
|
|
22
24
|
if (!notification) {
|
|
23
25
|
return null;
|
|
@@ -42,7 +44,9 @@ const ToastNotification = _ref => {
|
|
|
42
44
|
},
|
|
43
45
|
className: "toast-animate"
|
|
44
46
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
-
className: "toast-notification"
|
|
47
|
+
className: "toast-notification",
|
|
48
|
+
onMouseEnter: onHoverStart,
|
|
49
|
+
onMouseLeave: onHoverEnd
|
|
46
50
|
}, /*#__PURE__*/_react.default.createElement(_.default, {
|
|
47
51
|
title: (_notification$title = notification.title) !== null && _notification$title !== void 0 ? _notification$title : _Notification.DefaultTitles[notification.type],
|
|
48
52
|
actions: notification.actions,
|
|
@@ -58,6 +62,8 @@ const ToastNotification = _ref => {
|
|
|
58
62
|
};
|
|
59
63
|
ToastNotification.propTypes = {
|
|
60
64
|
onDismiss: _propTypes.default.func.isRequired,
|
|
61
|
-
show: _propTypes.default.bool.isRequired
|
|
65
|
+
show: _propTypes.default.bool.isRequired,
|
|
66
|
+
onHoverStart: _propTypes.default.func,
|
|
67
|
+
onHoverEnd: _propTypes.default.func
|
|
62
68
|
};
|
|
63
69
|
var _default = exports.default = ToastNotification;
|
|
@@ -146,6 +146,18 @@ const ToastNotificationProvider = _ref => {
|
|
|
146
146
|
return null;
|
|
147
147
|
});
|
|
148
148
|
};
|
|
149
|
+
const pauseTimer = () => {
|
|
150
|
+
if (notificationTimer && typeof notificationTimer !== "boolean") {
|
|
151
|
+
clearTimeout(notificationTimer);
|
|
152
|
+
setNotificationTimer(true); // mark as paused
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
const resumeTimer = () => {
|
|
156
|
+
if (notificationTimer === true) {
|
|
157
|
+
// only resume if previously paused
|
|
158
|
+
showNotificationWithDelay();
|
|
159
|
+
}
|
|
160
|
+
};
|
|
149
161
|
const addNotification = notification => {
|
|
150
162
|
var _notification$id;
|
|
151
163
|
const notificationToAdd = {
|
|
@@ -227,7 +239,9 @@ const ToastNotificationProvider = _ref => {
|
|
|
227
239
|
}, children, /*#__PURE__*/_react.default.createElement(_ToastNotification.default, {
|
|
228
240
|
notification: latestNotification,
|
|
229
241
|
onDismiss: clear,
|
|
230
|
-
show: !!showNotification
|
|
242
|
+
show: !!showNotification,
|
|
243
|
+
onHoverStart: pauseTimer,
|
|
244
|
+
onHoverEnd: resumeTimer
|
|
231
245
|
}), /*#__PURE__*/_react.default.createElement(_ToastNotificationList.default, {
|
|
232
246
|
notifications: notifications,
|
|
233
247
|
groupedCount: countBySeverity,
|
|
@@ -43,7 +43,7 @@ export var RegistrationPage = {
|
|
|
43
43
|
placeholder: "Password"
|
|
44
44
|
}), /*#__PURE__*/React.createElement("button", null, "Sign up"))),
|
|
45
45
|
logo: {
|
|
46
|
-
src: "https://anbox-cloud
|
|
46
|
+
src: "https://assets.ubuntu.com/v1/04242fd4-anbox-cloud-logo.svg",
|
|
47
47
|
title: "Anbox Cloud",
|
|
48
48
|
url: "/"
|
|
49
49
|
}
|
|
@@ -5,6 +5,8 @@ interface Props {
|
|
|
5
5
|
notification: ToastNotificationType;
|
|
6
6
|
onDismiss: (notification?: ToastNotificationType[]) => void;
|
|
7
7
|
show: boolean;
|
|
8
|
+
onHoverStart?: () => void;
|
|
9
|
+
onHoverEnd?: () => void;
|
|
8
10
|
}
|
|
9
11
|
declare const ToastNotification: FC<Props>;
|
|
10
12
|
export default ToastNotification;
|
|
@@ -10,7 +10,9 @@ var ToastNotification = _ref => {
|
|
|
10
10
|
var {
|
|
11
11
|
notification,
|
|
12
12
|
onDismiss: _onDismiss,
|
|
13
|
-
show
|
|
13
|
+
show,
|
|
14
|
+
onHoverStart,
|
|
15
|
+
onHoverEnd
|
|
14
16
|
} = _ref;
|
|
15
17
|
if (!notification) {
|
|
16
18
|
return null;
|
|
@@ -35,7 +37,9 @@ var ToastNotification = _ref => {
|
|
|
35
37
|
},
|
|
36
38
|
className: "toast-animate"
|
|
37
39
|
}, /*#__PURE__*/React.createElement("div", {
|
|
38
|
-
className: "toast-notification"
|
|
40
|
+
className: "toast-notification",
|
|
41
|
+
onMouseEnter: onHoverStart,
|
|
42
|
+
onMouseLeave: onHoverEnd
|
|
39
43
|
}, /*#__PURE__*/React.createElement(Notification, {
|
|
40
44
|
title: (_notification$title = notification.title) !== null && _notification$title !== void 0 ? _notification$title : DefaultTitles[notification.type],
|
|
41
45
|
actions: notification.actions,
|
|
@@ -51,6 +55,8 @@ var ToastNotification = _ref => {
|
|
|
51
55
|
};
|
|
52
56
|
ToastNotification.propTypes = {
|
|
53
57
|
onDismiss: _pt.func.isRequired,
|
|
54
|
-
show: _pt.bool.isRequired
|
|
58
|
+
show: _pt.bool.isRequired,
|
|
59
|
+
onHoverStart: _pt.func,
|
|
60
|
+
onHoverEnd: _pt.func
|
|
55
61
|
};
|
|
56
62
|
export default ToastNotification;
|
|
@@ -143,6 +143,18 @@ var ToastNotificationProvider = _ref => {
|
|
|
143
143
|
return null;
|
|
144
144
|
});
|
|
145
145
|
};
|
|
146
|
+
var pauseTimer = () => {
|
|
147
|
+
if (notificationTimer && typeof notificationTimer !== "boolean") {
|
|
148
|
+
clearTimeout(notificationTimer);
|
|
149
|
+
setNotificationTimer(true); // mark as paused
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
var resumeTimer = () => {
|
|
153
|
+
if (notificationTimer === true) {
|
|
154
|
+
// only resume if previously paused
|
|
155
|
+
showNotificationWithDelay();
|
|
156
|
+
}
|
|
157
|
+
};
|
|
146
158
|
var addNotification = notification => {
|
|
147
159
|
var _notification$id;
|
|
148
160
|
var notificationToAdd = _objectSpread(_objectSpread({}, notification), {}, {
|
|
@@ -219,7 +231,9 @@ var ToastNotificationProvider = _ref => {
|
|
|
219
231
|
}, children, /*#__PURE__*/React.createElement(ToastNotification, {
|
|
220
232
|
notification: latestNotification,
|
|
221
233
|
onDismiss: clear,
|
|
222
|
-
show: !!showNotification
|
|
234
|
+
show: !!showNotification,
|
|
235
|
+
onHoverStart: pauseTimer,
|
|
236
|
+
onHoverEnd: resumeTimer
|
|
223
237
|
}), /*#__PURE__*/React.createElement(ToastNotificationList, {
|
|
224
238
|
notifications: notifications,
|
|
225
239
|
groupedCount: countBySeverity,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canonical/react-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"author": {
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"tsc-alias": "1.8.10",
|
|
94
94
|
"typescript": "5.7.3",
|
|
95
95
|
"typescript-eslint": "8.24.1",
|
|
96
|
-
"vanilla-framework": "4.
|
|
96
|
+
"vanilla-framework": "4.38.0",
|
|
97
97
|
"wait-on": "8.0.2",
|
|
98
98
|
"webpack": "5.98.0"
|
|
99
99
|
},
|