@mantine/notifications 9.0.0-alpha.5 → 9.0.0-alpha.7
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/cjs/NotificationContainer.cjs +51 -47
- package/cjs/NotificationContainer.cjs.map +1 -1
- package/cjs/Notifications.cjs +145 -159
- package/cjs/Notifications.cjs.map +1 -1
- package/cjs/Notifications.module.cjs +10 -0
- package/cjs/Notifications.module.cjs.map +1 -0
- package/cjs/get-auto-close/get-auto-close.cjs +8 -12
- package/cjs/get-auto-close/get-auto-close.cjs.map +1 -1
- package/cjs/get-grouped-notifications/get-grouped-notifications.cjs +18 -21
- package/cjs/get-grouped-notifications/get-grouped-notifications.cjs.map +1 -1
- package/cjs/get-notification-state-styles.cjs +43 -45
- package/cjs/get-notification-state-styles.cjs.map +1 -1
- package/cjs/index.cjs +14 -19
- package/cjs/notifications.store.cjs +68 -77
- package/cjs/notifications.store.cjs.map +1 -1
- package/esm/NotificationContainer.mjs +51 -45
- package/esm/NotificationContainer.mjs.map +1 -1
- package/esm/Notifications.mjs +138 -150
- package/esm/Notifications.mjs.map +1 -1
- package/esm/Notifications.module.mjs +10 -0
- package/esm/Notifications.module.mjs.map +1 -0
- package/esm/get-auto-close/get-auto-close.mjs +8 -10
- package/esm/get-auto-close/get-auto-close.mjs.map +1 -1
- package/esm/get-grouped-notifications/get-grouped-notifications.mjs +18 -19
- package/esm/get-grouped-notifications/get-grouped-notifications.mjs.map +1 -1
- package/esm/get-notification-state-styles.mjs +43 -43
- package/esm/get-notification-state-styles.mjs.map +1 -1
- package/esm/index.mjs +3 -3
- package/esm/notifications.store.mjs +66 -73
- package/esm/notifications.store.mjs.map +1 -1
- package/lib/NotificationContainer.d.ts +4 -1
- package/lib/Notifications.d.ts +2 -0
- package/package.json +4 -4
- package/cjs/Notifications.module.css.cjs +0 -7
- package/cjs/Notifications.module.css.cjs.map +0 -1
- package/cjs/index.cjs.map +0 -1
- package/esm/Notifications.module.css.mjs +0 -5
- package/esm/Notifications.module.css.mjs.map +0 -1
- package/esm/index.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-auto-close.cjs","sources":["../../src/get-auto-close/get-auto-close.ts"],"sourcesContent":["export function getAutoClose(\n autoClose: boolean | number | undefined,\n notificationAutoClose: boolean | number | undefined\n) {\n if (typeof notificationAutoClose === 'number') {\n return notificationAutoClose;\n }\n\n if (notificationAutoClose === false || autoClose === false) {\n return false;\n }\n\n return autoClose;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"get-auto-close.cjs","names":[],"sources":["../../src/get-auto-close/get-auto-close.ts"],"sourcesContent":["export function getAutoClose(\n autoClose: boolean | number | undefined,\n notificationAutoClose: boolean | number | undefined\n) {\n if (typeof notificationAutoClose === 'number') {\n return notificationAutoClose;\n }\n\n if (notificationAutoClose === false || autoClose === false) {\n return false;\n }\n\n return autoClose;\n}\n"],"mappings":";;AAAA,SAAgB,aACd,WACA,uBACA;AACA,KAAI,OAAO,0BAA0B,SACnC,QAAO;AAGT,KAAI,0BAA0B,SAAS,cAAc,MACnD,QAAO;AAGT,QAAO"}
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
//#region packages/@mantine/notifications/src/get-grouped-notifications/get-grouped-notifications.ts
|
|
4
3
|
const positions = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
"bottom-center",
|
|
5
|
+
"bottom-left",
|
|
6
|
+
"bottom-right",
|
|
7
|
+
"top-center",
|
|
8
|
+
"top-left",
|
|
9
|
+
"top-right"
|
|
11
10
|
];
|
|
12
11
|
function getGroupedNotifications(notifications, defaultPosition) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return acc;
|
|
21
|
-
}, {})
|
|
22
|
-
);
|
|
12
|
+
return notifications.reduce((acc, notification) => {
|
|
13
|
+
acc[notification.position || defaultPosition].push(notification);
|
|
14
|
+
return acc;
|
|
15
|
+
}, positions.reduce((acc, item) => {
|
|
16
|
+
acc[item] = [];
|
|
17
|
+
return acc;
|
|
18
|
+
}, {}));
|
|
23
19
|
}
|
|
24
|
-
|
|
20
|
+
//#endregion
|
|
25
21
|
exports.getGroupedNotifications = getGroupedNotifications;
|
|
26
22
|
exports.positions = positions;
|
|
27
|
-
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=get-grouped-notifications.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-grouped-notifications.cjs","sources":["../../src/get-grouped-notifications/get-grouped-notifications.ts"],"sourcesContent":["import { NotificationData, NotificationPosition } from '../notifications.store';\n\nexport type GroupedNotifications = Record<NotificationPosition, NotificationData[]>;\n\nexport const positions: NotificationPosition[] = [\n 'bottom-center',\n 'bottom-left',\n 'bottom-right',\n 'top-center',\n 'top-left',\n 'top-right',\n];\n\nexport function getGroupedNotifications(\n notifications: NotificationData[],\n defaultPosition: NotificationPosition\n) {\n return notifications.reduce<GroupedNotifications>(\n (acc, notification) => {\n acc[notification.position || defaultPosition].push(notification);\n return acc;\n },\n positions.reduce<GroupedNotifications>((acc, item) => {\n acc[item] = [];\n return acc;\n }, {} as GroupedNotifications)\n );\n}\n"],"
|
|
1
|
+
{"version":3,"file":"get-grouped-notifications.cjs","names":[],"sources":["../../src/get-grouped-notifications/get-grouped-notifications.ts"],"sourcesContent":["import { NotificationData, NotificationPosition } from '../notifications.store';\n\nexport type GroupedNotifications = Record<NotificationPosition, NotificationData[]>;\n\nexport const positions: NotificationPosition[] = [\n 'bottom-center',\n 'bottom-left',\n 'bottom-right',\n 'top-center',\n 'top-left',\n 'top-right',\n];\n\nexport function getGroupedNotifications(\n notifications: NotificationData[],\n defaultPosition: NotificationPosition\n) {\n return notifications.reduce<GroupedNotifications>(\n (acc, notification) => {\n acc[notification.position || defaultPosition].push(notification);\n return acc;\n },\n positions.reduce<GroupedNotifications>((acc, item) => {\n acc[item] = [];\n return acc;\n }, {} as GroupedNotifications)\n );\n}\n"],"mappings":";;AAIA,MAAa,YAAoC;CAC/C;CACA;CACA;CACA;CACA;CACA;CACD;AAED,SAAgB,wBACd,eACA,iBACA;AACA,QAAO,cAAc,QAClB,KAAK,iBAAiB;AACrB,MAAI,aAAa,YAAY,iBAAiB,KAAK,aAAa;AAChE,SAAO;IAET,UAAU,QAA8B,KAAK,SAAS;AACpD,MAAI,QAAQ,EAAE;AACd,SAAO;IACN,EAAE,CAAyB,CAC/B"}
|
|
@@ -1,51 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
//#region packages/@mantine/notifications/src/get-notification-state-styles.ts
|
|
4
3
|
const transforms = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
left: "translateX(-100%)",
|
|
5
|
+
right: "translateX(100%)",
|
|
6
|
+
"top-center": "translateY(-100%)",
|
|
7
|
+
"bottom-center": "translateY(100%)"
|
|
9
8
|
};
|
|
10
9
|
const noTransform = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
left: "translateX(0)",
|
|
11
|
+
right: "translateX(0)",
|
|
12
|
+
"top-center": "translateY(0)",
|
|
13
|
+
"bottom-center": "translateY(0)"
|
|
15
14
|
};
|
|
16
|
-
function getNotificationStateStyles({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
47
|
-
return { ...commonStyles, ...transitionStyles[state] };
|
|
15
|
+
function getNotificationStateStyles({ state, maxHeight, position, transitionDuration }) {
|
|
16
|
+
const [vertical, horizontal] = position.split("-");
|
|
17
|
+
const property = horizontal === "center" ? `${vertical}-center` : horizontal;
|
|
18
|
+
const commonStyles = {
|
|
19
|
+
opacity: 0,
|
|
20
|
+
maxHeight,
|
|
21
|
+
transform: transforms[property],
|
|
22
|
+
transitionDuration: `${transitionDuration}ms, ${transitionDuration}ms, ${transitionDuration}ms`,
|
|
23
|
+
transitionTimingFunction: "cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear",
|
|
24
|
+
transitionProperty: "opacity, transform, max-height"
|
|
25
|
+
};
|
|
26
|
+
const inState = {
|
|
27
|
+
opacity: 1,
|
|
28
|
+
transform: noTransform[property]
|
|
29
|
+
};
|
|
30
|
+
const outState = {
|
|
31
|
+
opacity: 0,
|
|
32
|
+
maxHeight: 0,
|
|
33
|
+
transform: transforms[property]
|
|
34
|
+
};
|
|
35
|
+
const transitionStyles = {
|
|
36
|
+
entering: inState,
|
|
37
|
+
entered: inState,
|
|
38
|
+
exiting: outState,
|
|
39
|
+
exited: outState
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
...commonStyles,
|
|
43
|
+
...transitionStyles[state]
|
|
44
|
+
};
|
|
48
45
|
}
|
|
49
|
-
|
|
46
|
+
//#endregion
|
|
50
47
|
exports.getNotificationStateStyles = getNotificationStateStyles;
|
|
51
|
-
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=get-notification-state-styles.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-notification-state-styles.cjs","sources":["../src/get-notification-state-styles.ts"],"sourcesContent":["import { TransitionStatus } from 'react-transition-group';\nimport type { NotificationsProps } from './Notifications';\n\ninterface NotificationStateStylesProps {\n state: TransitionStatus;\n maxHeight: number | string;\n position: NotificationsProps['position'];\n transitionDuration: number;\n}\n\nconst transforms = {\n left: 'translateX(-100%)',\n right: 'translateX(100%)',\n 'top-center': 'translateY(-100%)',\n 'bottom-center': 'translateY(100%)',\n};\n\nconst noTransform = {\n left: 'translateX(0)',\n right: 'translateX(0)',\n 'top-center': 'translateY(0)',\n 'bottom-center': 'translateY(0)',\n};\n\nexport function getNotificationStateStyles({\n state,\n maxHeight,\n position,\n transitionDuration,\n}: NotificationStateStylesProps): React.CSSProperties {\n const [vertical, horizontal] = position!.split('-');\n const property = (\n horizontal === 'center' ? `${vertical}-center` : horizontal\n ) as keyof typeof transforms;\n\n const commonStyles: React.CSSProperties = {\n opacity: 0,\n maxHeight,\n transform: transforms[property],\n transitionDuration: `${transitionDuration}ms, ${transitionDuration}ms, ${transitionDuration}ms`,\n transitionTimingFunction: 'cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear',\n transitionProperty: 'opacity, transform, max-height',\n };\n\n const inState: React.CSSProperties = {\n opacity: 1,\n transform: noTransform[property],\n };\n\n const outState: React.CSSProperties = {\n opacity: 0,\n maxHeight: 0,\n transform: transforms[property],\n };\n\n const transitionStyles = {\n entering: inState,\n entered: inState,\n exiting: outState,\n exited: outState,\n };\n\n return { ...commonStyles, ...transitionStyles[state as keyof typeof transitionStyles] };\n}\n"],"
|
|
1
|
+
{"version":3,"file":"get-notification-state-styles.cjs","names":[],"sources":["../src/get-notification-state-styles.ts"],"sourcesContent":["import { TransitionStatus } from 'react-transition-group';\nimport type { NotificationsProps } from './Notifications';\n\ninterface NotificationStateStylesProps {\n state: TransitionStatus;\n maxHeight: number | string;\n position: NotificationsProps['position'];\n transitionDuration: number;\n}\n\nconst transforms = {\n left: 'translateX(-100%)',\n right: 'translateX(100%)',\n 'top-center': 'translateY(-100%)',\n 'bottom-center': 'translateY(100%)',\n};\n\nconst noTransform = {\n left: 'translateX(0)',\n right: 'translateX(0)',\n 'top-center': 'translateY(0)',\n 'bottom-center': 'translateY(0)',\n};\n\nexport function getNotificationStateStyles({\n state,\n maxHeight,\n position,\n transitionDuration,\n}: NotificationStateStylesProps): React.CSSProperties {\n const [vertical, horizontal] = position!.split('-');\n const property = (\n horizontal === 'center' ? `${vertical}-center` : horizontal\n ) as keyof typeof transforms;\n\n const commonStyles: React.CSSProperties = {\n opacity: 0,\n maxHeight,\n transform: transforms[property],\n transitionDuration: `${transitionDuration}ms, ${transitionDuration}ms, ${transitionDuration}ms`,\n transitionTimingFunction: 'cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear',\n transitionProperty: 'opacity, transform, max-height',\n };\n\n const inState: React.CSSProperties = {\n opacity: 1,\n transform: noTransform[property],\n };\n\n const outState: React.CSSProperties = {\n opacity: 0,\n maxHeight: 0,\n transform: transforms[property],\n };\n\n const transitionStyles = {\n entering: inState,\n entered: inState,\n exiting: outState,\n exited: outState,\n };\n\n return { ...commonStyles, ...transitionStyles[state as keyof typeof transitionStyles] };\n}\n"],"mappings":";;AAUA,MAAM,aAAa;CACjB,MAAM;CACN,OAAO;CACP,cAAc;CACd,iBAAiB;CAClB;AAED,MAAM,cAAc;CAClB,MAAM;CACN,OAAO;CACP,cAAc;CACd,iBAAiB;CAClB;AAED,SAAgB,2BAA2B,EACzC,OACA,WACA,UACA,sBACoD;CACpD,MAAM,CAAC,UAAU,cAAc,SAAU,MAAM,IAAI;CACnD,MAAM,WACJ,eAAe,WAAW,GAAG,SAAS,WAAW;CAGnD,MAAM,eAAoC;EACxC,SAAS;EACT;EACA,WAAW,WAAW;EACtB,oBAAoB,GAAG,mBAAmB,MAAM,mBAAmB,MAAM,mBAAmB;EAC5F,0BAA0B;EAC1B,oBAAoB;EACrB;CAED,MAAM,UAA+B;EACnC,SAAS;EACT,WAAW,YAAY;EACxB;CAED,MAAM,WAAgC;EACpC,SAAS;EACT,WAAW;EACX,WAAW,WAAW;EACvB;CAED,MAAM,mBAAmB;EACvB,UAAU;EACV,SAAS;EACT,SAAS;EACT,QAAQ;EACT;AAED,QAAO;EAAE,GAAG;EAAc,GAAG,iBAAiB;EAAyC"}
|
package/cjs/index.cjs
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.updateNotification = notifications_store.updateNotification;
|
|
16
|
-
exports.updateNotificationsState = notifications_store.updateNotificationsState;
|
|
17
|
-
exports.useNotifications = notifications_store.useNotifications;
|
|
18
|
-
exports.Notifications = Notifications.Notifications;
|
|
19
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_notifications_store = require("./notifications.store.cjs");
|
|
3
|
+
const require_Notifications = require("./Notifications.cjs");
|
|
4
|
+
exports.Notifications = require_Notifications.Notifications;
|
|
5
|
+
exports.cleanNotifications = require_notifications_store.cleanNotifications;
|
|
6
|
+
exports.cleanNotificationsQueue = require_notifications_store.cleanNotificationsQueue;
|
|
7
|
+
exports.createNotificationsStore = require_notifications_store.createNotificationsStore;
|
|
8
|
+
exports.hideNotification = require_notifications_store.hideNotification;
|
|
9
|
+
exports.notifications = require_notifications_store.notifications;
|
|
10
|
+
exports.notificationsStore = require_notifications_store.notificationsStore;
|
|
11
|
+
exports.showNotification = require_notifications_store.showNotification;
|
|
12
|
+
exports.updateNotification = require_notifications_store.updateNotification;
|
|
13
|
+
exports.updateNotificationsState = require_notifications_store.updateNotificationsState;
|
|
14
|
+
exports.useNotifications = require_notifications_store.useNotifications;
|
|
@@ -1,97 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var store = require('@mantine/store');
|
|
6
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
let _mantine_hooks = require("@mantine/hooks");
|
|
3
|
+
let _mantine_store = require("@mantine/store");
|
|
4
|
+
//#region packages/@mantine/notifications/src/notifications.store.ts
|
|
7
5
|
function getDistributedNotifications(data, defaultPosition, limit) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
const queue = [];
|
|
7
|
+
const notifications = [];
|
|
8
|
+
const count = {};
|
|
9
|
+
for (const item of data) {
|
|
10
|
+
const position = item.position || defaultPosition;
|
|
11
|
+
count[position] = count[position] || 0;
|
|
12
|
+
count[position] += 1;
|
|
13
|
+
if (count[position] <= limit) notifications.push(item);
|
|
14
|
+
else queue.push(item);
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
notifications,
|
|
18
|
+
queue
|
|
19
|
+
};
|
|
22
20
|
}
|
|
23
|
-
const createNotificationsStore = () =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
const createNotificationsStore = () => (0, _mantine_store.createStore)({
|
|
22
|
+
notifications: [],
|
|
23
|
+
queue: [],
|
|
24
|
+
defaultPosition: "bottom-right",
|
|
25
|
+
limit: 5
|
|
28
26
|
});
|
|
29
27
|
const notificationsStore = createNotificationsStore();
|
|
30
|
-
const useNotifications = (store
|
|
28
|
+
const useNotifications = (store = notificationsStore) => (0, _mantine_store.useStore)(store);
|
|
31
29
|
function updateNotificationsState(store, update) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
30
|
+
const state = store.getState();
|
|
31
|
+
const updated = getDistributedNotifications(update([...state.notifications, ...state.queue]), state.defaultPosition, state.limit);
|
|
32
|
+
store.setState({
|
|
33
|
+
notifications: updated.notifications,
|
|
34
|
+
queue: updated.queue,
|
|
35
|
+
limit: state.limit,
|
|
36
|
+
defaultPosition: state.defaultPosition
|
|
37
|
+
});
|
|
41
38
|
}
|
|
42
39
|
function showNotification(notification, store = notificationsStore) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
40
|
+
const id = notification.id || (0, _mantine_hooks.randomId)();
|
|
41
|
+
updateNotificationsState(store, (notifications) => {
|
|
42
|
+
if (notification.id && notifications.some((n) => n.id === notification.id)) return notifications;
|
|
43
|
+
return [...notifications, {
|
|
44
|
+
...notification,
|
|
45
|
+
id
|
|
46
|
+
}];
|
|
47
|
+
});
|
|
48
|
+
return id;
|
|
51
49
|
}
|
|
52
50
|
function hideNotification(id, store = notificationsStore) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
})
|
|
62
|
-
);
|
|
63
|
-
return id;
|
|
51
|
+
updateNotificationsState(store, (notifications) => notifications.filter((notification) => {
|
|
52
|
+
if (notification.id === id) {
|
|
53
|
+
notification.onClose?.(notification);
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
}));
|
|
58
|
+
return id;
|
|
64
59
|
}
|
|
65
60
|
function updateNotification(notification, store = notificationsStore) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
);
|
|
75
|
-
return notification.id;
|
|
61
|
+
updateNotificationsState(store, (notifications) => notifications.map((item) => {
|
|
62
|
+
if (item.id === notification.id) return {
|
|
63
|
+
...item,
|
|
64
|
+
...notification
|
|
65
|
+
};
|
|
66
|
+
return item;
|
|
67
|
+
}));
|
|
68
|
+
return notification.id;
|
|
76
69
|
}
|
|
77
70
|
function cleanNotifications(store = notificationsStore) {
|
|
78
|
-
|
|
71
|
+
updateNotificationsState(store, () => []);
|
|
79
72
|
}
|
|
80
73
|
function cleanNotificationsQueue(store = notificationsStore) {
|
|
81
|
-
|
|
82
|
-
store,
|
|
83
|
-
(notifications2) => notifications2.slice(0, store.getState().limit)
|
|
84
|
-
);
|
|
74
|
+
updateNotificationsState(store, (notifications) => notifications.slice(0, store.getState().limit));
|
|
85
75
|
}
|
|
86
76
|
const notifications = {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
77
|
+
show: showNotification,
|
|
78
|
+
hide: hideNotification,
|
|
79
|
+
update: updateNotification,
|
|
80
|
+
clean: cleanNotifications,
|
|
81
|
+
cleanQueue: cleanNotificationsQueue,
|
|
82
|
+
updateState: updateNotificationsState
|
|
93
83
|
};
|
|
94
|
-
|
|
84
|
+
//#endregion
|
|
95
85
|
exports.cleanNotifications = cleanNotifications;
|
|
96
86
|
exports.cleanNotificationsQueue = cleanNotificationsQueue;
|
|
97
87
|
exports.createNotificationsStore = createNotificationsStore;
|
|
@@ -102,4 +92,5 @@ exports.showNotification = showNotification;
|
|
|
102
92
|
exports.updateNotification = updateNotification;
|
|
103
93
|
exports.updateNotificationsState = updateNotificationsState;
|
|
104
94
|
exports.useNotifications = useNotifications;
|
|
105
|
-
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=notifications.store.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.store.cjs","sources":["../src/notifications.store.ts"],"sourcesContent":["import { NotificationProps } from '@mantine/core';\nimport { randomId } from '@mantine/hooks';\nimport { createStore, MantineStore, useStore } from '@mantine/store';\n\nexport type NotificationPosition =\n | 'top-left'\n | 'top-right'\n | 'top-center'\n | 'bottom-left'\n | 'bottom-right'\n | 'bottom-center';\n\nexport interface NotificationData\n extends Omit<NotificationProps, 'onClose'>, Record<`data-${string}`, any> {\n /** Notification id, can be used to close or update notification */\n id?: string;\n\n /** Position of the notification, if not set, the position is determined based on `position` prop on Notifications component */\n position?: NotificationPosition;\n\n /** Notification message, required for all notifications */\n message: React.ReactNode;\n\n /** Determines whether notification should be closed automatically,\n * number is auto close timeout in ms, overrides `autoClose` from `Notifications`\n * */\n autoClose?: boolean | number;\n\n /** Called when notification closes */\n onClose?: (props: NotificationData) => void;\n\n /** Called when notification opens */\n onOpen?: (props: NotificationData) => void;\n}\n\nexport interface NotificationsState {\n notifications: NotificationData[];\n queue: NotificationData[];\n defaultPosition: NotificationPosition;\n limit: number;\n}\n\nexport type NotificationsStore = MantineStore<NotificationsState>;\n\nfunction getDistributedNotifications(\n data: NotificationData[],\n defaultPosition: NotificationPosition,\n limit: number\n) {\n const queue: NotificationData[] = [];\n const notifications: NotificationData[] = [];\n const count: Record<string, number> = {};\n\n for (const item of data) {\n const position = item.position || defaultPosition;\n count[position] = count[position] || 0;\n count[position] += 1;\n\n if (count[position] <= limit) {\n notifications.push(item);\n } else {\n queue.push(item);\n }\n }\n\n return { notifications, queue };\n}\n\nexport const createNotificationsStore = () =>\n createStore<NotificationsState>({\n notifications: [],\n queue: [],\n defaultPosition: 'bottom-right',\n limit: 5,\n });\n\nexport const notificationsStore = createNotificationsStore();\nexport const useNotifications = (store: NotificationsStore = notificationsStore) => useStore(store);\n\nexport function updateNotificationsState(\n store: NotificationsStore,\n update: (notifications: NotificationData[]) => NotificationData[]\n) {\n const state = store.getState();\n const notifications = update([...state.notifications, ...state.queue]);\n const updated = getDistributedNotifications(notifications, state.defaultPosition, state.limit);\n\n store.setState({\n notifications: updated.notifications,\n queue: updated.queue,\n limit: state.limit,\n defaultPosition: state.defaultPosition,\n });\n}\n\nexport function showNotification(\n notification: NotificationData,\n store: NotificationsStore = notificationsStore\n) {\n const id = notification.id || randomId();\n\n updateNotificationsState(store, (notifications) => {\n if (notification.id && notifications.some((n) => n.id === notification.id)) {\n return notifications;\n }\n\n return [...notifications, { ...notification, id }];\n });\n\n return id;\n}\n\nexport function hideNotification(id: string, store: NotificationsStore = notificationsStore) {\n updateNotificationsState(store, (notifications) =>\n notifications.filter((notification) => {\n if (notification.id === id) {\n notification.onClose?.(notification);\n return false;\n }\n\n return true;\n })\n );\n\n return id;\n}\n\nexport function updateNotification(\n notification: NotificationData,\n store: NotificationsStore = notificationsStore\n) {\n updateNotificationsState(store, (notifications) =>\n notifications.map((item) => {\n if (item.id === notification.id) {\n return { ...item, ...notification };\n }\n\n return item;\n })\n );\n\n return notification.id;\n}\n\nexport function cleanNotifications(store: NotificationsStore = notificationsStore) {\n updateNotificationsState(store, () => []);\n}\n\nexport function cleanNotificationsQueue(store: NotificationsStore = notificationsStore) {\n updateNotificationsState(store, (notifications) =>\n notifications.slice(0, store.getState().limit)\n );\n}\n\nexport const notifications = {\n show: showNotification,\n hide: hideNotification,\n update: updateNotification,\n clean: cleanNotifications,\n cleanQueue: cleanNotificationsQueue,\n updateState: updateNotificationsState,\n} as const;\n"],"names":["notifications","createStore","store","useStore","randomId"],"mappings":";;;;;;AA4CA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,2BAAA,CACP,CAAA,CAAA,CAAA,CAAA,EACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACA,KAAA,CAAA,CACA,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,IAA4B,CAAA,CAAC,CAAA;AACnC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAMA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,IAAoC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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACZ,WAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACf,CAAA,CAAA;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"notifications.store.cjs","names":[],"sources":["../src/notifications.store.ts"],"sourcesContent":["import { NotificationProps } from '@mantine/core';\nimport { randomId } from '@mantine/hooks';\nimport { createStore, MantineStore, useStore } from '@mantine/store';\n\nexport type NotificationPosition =\n | 'top-left'\n | 'top-right'\n | 'top-center'\n | 'bottom-left'\n | 'bottom-right'\n | 'bottom-center';\n\nexport interface NotificationData\n extends Omit<NotificationProps, 'onClose'>, Record<`data-${string}`, any> {\n /** Notification id, can be used to close or update notification */\n id?: string;\n\n /** Position of the notification, if not set, the position is determined based on `position` prop on Notifications component */\n position?: NotificationPosition;\n\n /** Notification message, required for all notifications */\n message: React.ReactNode;\n\n /** Determines whether notification should be closed automatically,\n * number is auto close timeout in ms, overrides `autoClose` from `Notifications`\n * */\n autoClose?: boolean | number;\n\n /** Called when notification closes */\n onClose?: (props: NotificationData) => void;\n\n /** Called when notification opens */\n onOpen?: (props: NotificationData) => void;\n}\n\nexport interface NotificationsState {\n notifications: NotificationData[];\n queue: NotificationData[];\n defaultPosition: NotificationPosition;\n limit: number;\n}\n\nexport type NotificationsStore = MantineStore<NotificationsState>;\n\nfunction getDistributedNotifications(\n data: NotificationData[],\n defaultPosition: NotificationPosition,\n limit: number\n) {\n const queue: NotificationData[] = [];\n const notifications: NotificationData[] = [];\n const count: Record<string, number> = {};\n\n for (const item of data) {\n const position = item.position || defaultPosition;\n count[position] = count[position] || 0;\n count[position] += 1;\n\n if (count[position] <= limit) {\n notifications.push(item);\n } else {\n queue.push(item);\n }\n }\n\n return { notifications, queue };\n}\n\nexport const createNotificationsStore = () =>\n createStore<NotificationsState>({\n notifications: [],\n queue: [],\n defaultPosition: 'bottom-right',\n limit: 5,\n });\n\nexport const notificationsStore = createNotificationsStore();\nexport const useNotifications = (store: NotificationsStore = notificationsStore) => useStore(store);\n\nexport function updateNotificationsState(\n store: NotificationsStore,\n update: (notifications: NotificationData[]) => NotificationData[]\n) {\n const state = store.getState();\n const notifications = update([...state.notifications, ...state.queue]);\n const updated = getDistributedNotifications(notifications, state.defaultPosition, state.limit);\n\n store.setState({\n notifications: updated.notifications,\n queue: updated.queue,\n limit: state.limit,\n defaultPosition: state.defaultPosition,\n });\n}\n\nexport function showNotification(\n notification: NotificationData,\n store: NotificationsStore = notificationsStore\n) {\n const id = notification.id || randomId();\n\n updateNotificationsState(store, (notifications) => {\n if (notification.id && notifications.some((n) => n.id === notification.id)) {\n return notifications;\n }\n\n return [...notifications, { ...notification, id }];\n });\n\n return id;\n}\n\nexport function hideNotification(id: string, store: NotificationsStore = notificationsStore) {\n updateNotificationsState(store, (notifications) =>\n notifications.filter((notification) => {\n if (notification.id === id) {\n notification.onClose?.(notification);\n return false;\n }\n\n return true;\n })\n );\n\n return id;\n}\n\nexport function updateNotification(\n notification: NotificationData,\n store: NotificationsStore = notificationsStore\n) {\n updateNotificationsState(store, (notifications) =>\n notifications.map((item) => {\n if (item.id === notification.id) {\n return { ...item, ...notification };\n }\n\n return item;\n })\n );\n\n return notification.id;\n}\n\nexport function cleanNotifications(store: NotificationsStore = notificationsStore) {\n updateNotificationsState(store, () => []);\n}\n\nexport function cleanNotificationsQueue(store: NotificationsStore = notificationsStore) {\n updateNotificationsState(store, (notifications) =>\n notifications.slice(0, store.getState().limit)\n );\n}\n\nexport const notifications = {\n show: showNotification,\n hide: hideNotification,\n update: updateNotification,\n clean: cleanNotifications,\n cleanQueue: cleanNotificationsQueue,\n updateState: updateNotificationsState,\n}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AC1B,gBAAa,UAAU,aAAa;AACpC,UAAO;;AAGT,SAAO;GACP,CACH;AAED,QAAO;;AAGT,SAAgB,mBACd,cACA,QAA4B,oBAC5B;AACA,0BAAyB,QAAQ,kBAC/B,cAAc,KAAK,SAAS;AAC1B,MAAI,KAAK,OAAO,aAAa,GAC3B,QAAO;GAAE,GAAG;GAAM,GAAG;GAAc;AAGrC,SAAO;GACP,CACH;AAED,QAAO,aAAa;;AAGtB,SAAgB,mBAAmB,QAA4B,oBAAoB;AACjF,0BAAyB,aAAa,EAAE,CAAC;;AAG3C,SAAgB,wBAAwB,QAA4B,oBAAoB;AACtF,0BAAyB,QAAQ,kBAC/B,cAAc,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,CAC/C;;AAGH,MAAa,gBAAgB;CAC3B,MAAM;CACN,MAAM;CACN,QAAQ;CACR,OAAO;CACP,YAAY;CACZ,aAAa;CACd"}
|
|
@@ -1,48 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { useRef,
|
|
4
|
-
import { Notification } from
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
function NotificationContainer({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { getAutoClose } from "./get-auto-close/get-auto-close.mjs";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { Notification } from "@mantine/core";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region packages/@mantine/notifications/src/NotificationContainer.tsx
|
|
7
|
+
function NotificationContainer({ data, onHide, autoClose, paused, onHoverStart, onHoverEnd, ...others }) {
|
|
8
|
+
const { autoClose: _autoClose, message, ...notificationProps } = data;
|
|
9
|
+
const autoCloseDuration = getAutoClose(autoClose, data.autoClose);
|
|
10
|
+
const autoCloseTimeout = useRef(-1);
|
|
11
|
+
const [hovered, setHovered] = useState(false);
|
|
12
|
+
const cancelAutoClose = () => window.clearTimeout(autoCloseTimeout.current);
|
|
13
|
+
const handleHide = () => {
|
|
14
|
+
onHide(data.id);
|
|
15
|
+
cancelAutoClose();
|
|
16
|
+
};
|
|
17
|
+
const handleAutoClose = () => {
|
|
18
|
+
cancelAutoClose();
|
|
19
|
+
if (typeof autoCloseDuration === "number") autoCloseTimeout.current = window.setTimeout(handleHide, autoCloseDuration);
|
|
20
|
+
};
|
|
21
|
+
const handleMouseEnter = () => {
|
|
22
|
+
setHovered(true);
|
|
23
|
+
onHoverStart?.();
|
|
24
|
+
};
|
|
25
|
+
const handleMouseLeave = () => {
|
|
26
|
+
setHovered(false);
|
|
27
|
+
onHoverEnd?.();
|
|
28
|
+
};
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
data.onOpen?.(data);
|
|
31
|
+
}, []);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
handleAutoClose();
|
|
34
|
+
return cancelAutoClose;
|
|
35
|
+
}, [autoCloseDuration]);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (paused || hovered) cancelAutoClose();
|
|
38
|
+
else handleAutoClose();
|
|
39
|
+
return cancelAutoClose;
|
|
40
|
+
}, [paused, hovered]);
|
|
41
|
+
return /* @__PURE__ */ jsx(Notification, {
|
|
42
|
+
...others,
|
|
43
|
+
...notificationProps,
|
|
44
|
+
onClose: handleHide,
|
|
45
|
+
onMouseEnter: handleMouseEnter,
|
|
46
|
+
onMouseLeave: handleMouseLeave,
|
|
47
|
+
children: message
|
|
48
|
+
});
|
|
44
49
|
}
|
|
45
50
|
NotificationContainer.displayName = "@mantine/notifications/NotificationContainer";
|
|
46
|
-
|
|
51
|
+
//#endregion
|
|
47
52
|
export { NotificationContainer };
|
|
48
|
-
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=NotificationContainer.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationContainer.mjs","sources":["../src/NotificationContainer.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { Notification, NotificationProps } from '@mantine/core';\nimport { getAutoClose } from './get-auto-close/get-auto-close';\nimport { NotificationData } from './notifications.store';\n\ninterface NotificationContainerProps extends NotificationProps {\n data: NotificationData;\n onHide: (id: string) => void;\n autoClose: number | false;\n}\n\nexport function NotificationContainer({\n data,\n onHide,\n autoClose,\n ...others\n}: NotificationContainerProps) {\n const { autoClose: _autoClose, message, ...notificationProps } = data;\n const autoCloseDuration = getAutoClose(autoClose, data.autoClose);\n const autoCloseTimeout = useRef<number>(-1);\n\n const cancelAutoClose = () => window.clearTimeout(autoCloseTimeout.current);\n\n const handleHide = () => {\n onHide(data.id!);\n cancelAutoClose();\n };\n\n const handleAutoClose = () => {\n if (typeof autoCloseDuration === 'number') {\n autoCloseTimeout.current = window.setTimeout(handleHide, autoCloseDuration);\n }\n };\n\n useEffect(() => {\n data.onOpen?.(data);\n }, []);\n\n useEffect(() => {\n handleAutoClose();\n return cancelAutoClose;\n }, [autoCloseDuration]);\n\n return (\n <Notification\n {...others}\n {...notificationProps}\n onClose={handleHide}\n onMouseEnter={
|
|
1
|
+
{"version":3,"file":"NotificationContainer.mjs","names":[],"sources":["../src/NotificationContainer.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { Notification, NotificationProps } from '@mantine/core';\nimport { getAutoClose } from './get-auto-close/get-auto-close';\nimport { NotificationData } from './notifications.store';\n\ninterface NotificationContainerProps extends NotificationProps {\n data: NotificationData;\n onHide: (id: string) => void;\n autoClose: number | false;\n paused: boolean;\n onHoverStart?: () => void;\n onHoverEnd?: () => void;\n}\n\nexport function NotificationContainer({\n data,\n onHide,\n autoClose,\n paused,\n onHoverStart,\n onHoverEnd,\n ...others\n}: NotificationContainerProps) {\n const { autoClose: _autoClose, message, ...notificationProps } = data;\n const autoCloseDuration = getAutoClose(autoClose, data.autoClose);\n const autoCloseTimeout = useRef<number>(-1);\n const [hovered, setHovered] = useState(false);\n\n const cancelAutoClose = () => window.clearTimeout(autoCloseTimeout.current);\n\n const handleHide = () => {\n onHide(data.id!);\n cancelAutoClose();\n };\n\n const handleAutoClose = () => {\n cancelAutoClose();\n if (typeof autoCloseDuration === 'number') {\n autoCloseTimeout.current = window.setTimeout(handleHide, autoCloseDuration);\n }\n };\n\n const handleMouseEnter = () => {\n setHovered(true);\n onHoverStart?.();\n };\n\n const handleMouseLeave = () => {\n setHovered(false);\n onHoverEnd?.();\n };\n\n useEffect(() => {\n data.onOpen?.(data);\n }, []);\n\n useEffect(() => {\n handleAutoClose();\n return cancelAutoClose;\n }, [autoCloseDuration]);\n\n useEffect(() => {\n if (paused || hovered) {\n cancelAutoClose();\n } else {\n handleAutoClose();\n }\n\n return cancelAutoClose;\n }, [paused, hovered]);\n\n return (\n <Notification\n {...others}\n {...notificationProps}\n onClose={handleHide}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {message}\n </Notification>\n );\n}\n\nNotificationContainer.displayName = '@mantine/notifications/NotificationContainer';\n"],"mappings":";;;;;;AAcA,SAAgB,sBAAsB,EACpC,MACA,QACA,WACA,QACA,cACA,YACA,GAAG,UAC0B;CAC7B,MAAM,EAAE,WAAW,YAAY,SAAS,GAAG,sBAAsB;CACjE,MAAM,oBAAoB,aAAa,WAAW,KAAK,UAAU;CACjE,MAAM,mBAAmB,OAAe,GAAG;CAC3C,MAAM,CAAC,SAAS,cAAc,SAAS,MAAM;CAE7C,MAAM,wBAAwB,OAAO,aAAa,iBAAiB,QAAQ;CAE3E,MAAM,mBAAmB;AACvB,SAAO,KAAK,GAAI;AAChB,mBAAiB;;CAGnB,MAAM,wBAAwB;AAC5B,mBAAiB;AACjB,MAAI,OAAO,sBAAsB,SAC/B,kBAAiB,UAAU,OAAO,WAAW,YAAY,kBAAkB;;CAI/E,MAAM,yBAAyB;AAC7B,aAAW,KAAK;AAChB,kBAAgB;;CAGlB,MAAM,yBAAyB;AAC7B,aAAW,MAAM;AACjB,gBAAc;;AAGhB,iBAAgB;AACd,OAAK,SAAS,KAAK;IAClB,EAAE,CAAC;AAEN,iBAAgB;AACd,mBAAiB;AACjB,SAAO;IACN,CAAC,kBAAkB,CAAC;AAEvB,iBAAgB;AACd,MAAI,UAAU,QACZ,kBAAiB;MAEjB,kBAAiB;AAGnB,SAAO;IACN,CAAC,QAAQ,QAAQ,CAAC;AAErB,QACE,oBAAC,cAAD;EACE,GAAI;EACJ,GAAI;EACJ,SAAS;EACT,cAAc;EACd,cAAc;YAEb;EACY,CAAA;;AAInB,sBAAsB,cAAc"}
|