@mantine/notifications 4.1.0 → 4.1.3
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/NotificationContainer.js +3 -2
- package/cjs/NotificationContainer/NotificationContainer.js.map +1 -1
- package/cjs/NotificationContainer/get-auto-close/get-auto-close.js +4 -4
- package/cjs/NotificationContainer/get-auto-close/get-auto-close.js.map +1 -1
- package/cjs/NotificationsProvider/get-position-styles/get-position-styles.js +1 -1
- package/cjs/NotificationsProvider/get-position-styles/get-position-styles.js.map +1 -1
- package/cjs/events.js +1 -1
- package/cjs/events.js.map +1 -1
- package/esm/NotificationContainer/NotificationContainer.js +3 -2
- package/esm/NotificationContainer/NotificationContainer.js.map +1 -1
- package/esm/NotificationContainer/get-auto-close/get-auto-close.js +4 -4
- package/esm/NotificationContainer/get-auto-close/get-auto-close.js.map +1 -1
- package/esm/NotificationsProvider/get-position-styles/get-position-styles.js +1 -1
- package/esm/NotificationsProvider/get-position-styles/get-position-styles.js.map +1 -1
- package/esm/events.js +1 -1
- package/esm/events.js.map +1 -1
- package/lib/NotificationContainer/NotificationContainer.d.ts.map +1 -1
- package/lib/NotificationContainer/get-auto-close/get-auto-close.d.ts +1 -2
- package/lib/NotificationContainer/get-auto-close/get-auto-close.d.ts.map +1 -1
- package/package.json +3 -4
|
@@ -53,7 +53,8 @@ function NotificationContainer(_a) {
|
|
|
53
53
|
"onHide",
|
|
54
54
|
"innerRef"
|
|
55
55
|
]);
|
|
56
|
-
const
|
|
56
|
+
const _a2 = notification, { autoClose: notificationAutoClose } = _a2, notificationProps = __objRest(_a2, ["autoClose"]);
|
|
57
|
+
const autoCloseTimeout = getAutoClose['default'](autoClose, notificationAutoClose);
|
|
57
58
|
const hideTimeout = React.useRef();
|
|
58
59
|
const handleHide = () => {
|
|
59
60
|
onHide(notification.id);
|
|
@@ -76,7 +77,7 @@ function NotificationContainer(_a) {
|
|
|
76
77
|
handleDelayedHide();
|
|
77
78
|
return cancelDelayedHide;
|
|
78
79
|
}, [autoClose, notification.autoClose]);
|
|
79
|
-
return /* @__PURE__ */ React__default.createElement(core.Notification, __spreadProps(__spreadValues(__spreadValues({},
|
|
80
|
+
return /* @__PURE__ */ React__default.createElement(core.Notification, __spreadProps(__spreadValues(__spreadValues({}, notificationProps), others), {
|
|
80
81
|
onClose: handleHide,
|
|
81
82
|
onMouseEnter: cancelDelayedHide,
|
|
82
83
|
onMouseLeave: handleDelayedHide,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationContainer.js","sources":["../../src/NotificationContainer/NotificationContainer.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport { Notification, DefaultProps } from '@mantine/core';\nimport getAutoClose from './get-auto-close/get-auto-close';\nimport { NotificationProps } from '../types';\n\nexport interface NotificationContainerProps extends DefaultProps {\n notification: NotificationProps;\n onHide(id: string): void;\n autoClose: false | number;\n innerRef: React.ForwardedRef<HTMLDivElement>;\n}\n\nexport default function NotificationContainer({\n notification,\n autoClose,\n onHide,\n innerRef,\n ...others\n}: NotificationContainerProps) {\n const autoCloseTimeout = getAutoClose(autoClose,
|
|
1
|
+
{"version":3,"file":"NotificationContainer.js","sources":["../../src/NotificationContainer/NotificationContainer.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport { Notification, DefaultProps } from '@mantine/core';\nimport getAutoClose from './get-auto-close/get-auto-close';\nimport { NotificationProps } from '../types';\n\nexport interface NotificationContainerProps extends DefaultProps {\n notification: NotificationProps;\n onHide(id: string): void;\n autoClose: false | number;\n innerRef: React.ForwardedRef<HTMLDivElement>;\n}\n\nexport default function NotificationContainer({\n notification,\n autoClose,\n onHide,\n innerRef,\n ...others\n}: NotificationContainerProps) {\n const { autoClose: notificationAutoClose, ...notificationProps } = notification;\n const autoCloseTimeout = getAutoClose(autoClose, notificationAutoClose);\n const hideTimeout = useRef<number>();\n\n const handleHide = () => {\n onHide(notification.id);\n window.clearTimeout(hideTimeout.current);\n };\n\n const cancelDelayedHide = () => {\n clearTimeout(hideTimeout.current);\n };\n\n const handleDelayedHide = () => {\n if (typeof autoCloseTimeout === 'number') {\n hideTimeout.current = window.setTimeout(handleHide, autoCloseTimeout);\n }\n };\n\n useEffect(() => {\n if (typeof notification.onOpen === 'function') {\n notification.onOpen(notification);\n }\n }, []);\n\n useEffect(() => {\n handleDelayedHide();\n return cancelDelayedHide;\n }, [autoClose, notification.autoClose]);\n\n return (\n <Notification\n {...notificationProps}\n {...others}\n onClose={handleHide}\n onMouseEnter={cancelDelayedHide}\n onMouseLeave={handleDelayedHide}\n ref={innerRef}\n >\n {notification.message}\n </Notification>\n );\n}\n\nNotificationContainer.displayName = '@mantine/notifications/NotificationContainer';\n"],"names":["getAutoClose","useRef","useEffect","React","Notification"],"mappings":";;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,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AAC,MAAM,KAAK,UAAU,EAAE;AACnD,MAAM,YAAY,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACxC,KAAK;AACL,GAAG,EAAE,EAAE,CAAC,CAAC;AACT,EAAEA,eAAS,CAAC,MAAM;AAClB,IAAI,iBAAiB,EAAE,CAAC;AACxB,IAAI,OAAO,iBAAiB,CAAC;AAC7B,GAAG,EAAE,CAAC,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;AAC1C,EAAE,uBAAuBC,cAAK,CAAC,aAAa,CAACC,iBAAY,EAAE,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,EAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC,EAAE;AACxI,IAAI,OAAO,EAAE,UAAU;AACvB,IAAI,YAAY,EAAE,iBAAiB;AACnC,IAAI,YAAY,EAAE,iBAAiB;AACnC,IAAI,GAAG,EAAE,QAAQ;AACjB,GAAG,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;AAC5B,CAAC;AACD,qBAAqB,CAAC,WAAW,GAAG,8CAA8C;;;;"}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
function getAutoClose(autoClose,
|
|
6
|
-
if (typeof
|
|
7
|
-
return
|
|
5
|
+
function getAutoClose(autoClose, notificationAutoClose) {
|
|
6
|
+
if (typeof notificationAutoClose === "number") {
|
|
7
|
+
return notificationAutoClose;
|
|
8
8
|
}
|
|
9
|
-
if (
|
|
9
|
+
if (notificationAutoClose === false || autoClose === false) {
|
|
10
10
|
return false;
|
|
11
11
|
}
|
|
12
12
|
return autoClose;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-auto-close.js","sources":["../../../src/NotificationContainer/get-auto-close/get-auto-close.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"get-auto-close.js","sources":["../../../src/NotificationContainer/get-auto-close/get-auto-close.ts"],"sourcesContent":["export default function getAutoClose(\n autoClose: boolean | number,\n notificationAutoClose: boolean | number\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"],"names":[],"mappings":";;;;AAAe,SAAS,YAAY,CAAC,SAAS,EAAE,qBAAqB,EAAE;AACvE,EAAE,IAAI,OAAO,qBAAqB,KAAK,QAAQ,EAAE;AACjD,IAAI,OAAO,qBAAqB,CAAC;AACjC,GAAG;AACH,EAAE,IAAI,qBAAqB,KAAK,KAAK,IAAI,SAAS,KAAK,KAAK,EAAE;AAC9D,IAAI,OAAO,KAAK,CAAC;AACjB,GAAG;AACH,EAAE,OAAO,SAAS,CAAC;AACnB;;;;"}
|
|
@@ -8,7 +8,7 @@ function getPositionStyles([vertical, horizontal], containerWidth, spacing) {
|
|
|
8
8
|
vertical === "bottom" && (styles.bottom = spacing);
|
|
9
9
|
horizontal === "left" && (styles.left = spacing);
|
|
10
10
|
horizontal === "right" && (styles.right = spacing);
|
|
11
|
-
horizontal === "center" && (styles.left =
|
|
11
|
+
horizontal === "center" && (styles.left = "50%", styles.transform = "translateX(-50%)");
|
|
12
12
|
return styles;
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-position-styles.js","sources":["../../../src/NotificationsProvider/get-position-styles/get-position-styles.ts"],"sourcesContent":["import { CSSObject } from '@mantine/core';\nimport { NotificationsProviderPositioning } from '../../types';\n\nexport default function getPositionStyles(\n [vertical, horizontal]: NotificationsProviderPositioning,\n containerWidth: number,\n spacing: number\n) {\n const styles: CSSObject = {};\n\n vertical === 'top' && (styles.top = spacing);\n vertical === 'bottom' && (styles.bottom = spacing);\n\n horizontal === 'left' && (styles.left = spacing);\n horizontal === 'right' && (styles.right = spacing);\n horizontal === 'center' && (styles.left =
|
|
1
|
+
{"version":3,"file":"get-position-styles.js","sources":["../../../src/NotificationsProvider/get-position-styles/get-position-styles.ts"],"sourcesContent":["import { CSSObject } from '@mantine/core';\nimport { NotificationsProviderPositioning } from '../../types';\n\nexport default function getPositionStyles(\n [vertical, horizontal]: NotificationsProviderPositioning,\n containerWidth: number,\n spacing: number\n) {\n const styles: CSSObject = {};\n\n vertical === 'top' && (styles.top = spacing);\n vertical === 'bottom' && (styles.bottom = spacing);\n\n horizontal === 'left' && (styles.left = spacing);\n horizontal === 'right' && (styles.right = spacing);\n horizontal === 'center' && ((styles.left = '50%'), (styles.transform = 'translateX(-50%)'));\n\n return styles;\n}\n"],"names":[],"mappings":";;;;AAAe,SAAS,iBAAiB,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,cAAc,EAAE,OAAO,EAAE;AAC3F,EAAE,MAAM,MAAM,GAAG,EAAE,CAAC;AACpB,EAAE,QAAQ,KAAK,KAAK,KAAK,MAAM,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC;AAC/C,EAAE,QAAQ,KAAK,QAAQ,KAAK,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC;AACrD,EAAE,UAAU,KAAK,MAAM,KAAK,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;AACnD,EAAE,UAAU,KAAK,OAAO,KAAK,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC;AACrD,EAAE,UAAU,KAAK,QAAQ,KAAK,MAAM,CAAC,IAAI,GAAG,KAAK,EAAE,MAAM,CAAC,SAAS,GAAG,kBAAkB,CAAC,CAAC;AAC1F,EAAE,OAAO,MAAM,CAAC;AAChB;;;;"}
|
package/cjs/events.js
CHANGED
|
@@ -35,7 +35,7 @@ function useNotificationsEvents(ctx) {
|
|
|
35
35
|
hide: (event) => ctx.hideNotification(event.detail),
|
|
36
36
|
update: (event) => ctx.updateNotification(event.detail.id, event.detail),
|
|
37
37
|
clean: ctx.clean,
|
|
38
|
-
|
|
38
|
+
cleanQueue: ctx.cleanQueue
|
|
39
39
|
};
|
|
40
40
|
React.useEffect(() => {
|
|
41
41
|
Object.keys(events).forEach((event) => {
|
package/cjs/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sources":["../src/events.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport type { NotificationProps, NotificationsContextProps } from './types';\n\ntype ValueOf<T> = T[keyof T];\n\nexport const NOTIFICATIONS_EVENTS = {\n show: 'mantine:show-notification',\n hide: 'mantine:hide-notification',\n update: 'mantine:update-notification',\n clean: 'mantine:clean-notifications',\n cleanQueue: 'mantine:clean-notifications-queue',\n} as const;\n\nexport function createEvent(type: ValueOf<typeof NOTIFICATIONS_EVENTS>, detail?: any) {\n return new CustomEvent(type, { detail });\n}\n\nexport function showNotification(notification: NotificationProps) {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.show, notification));\n}\n\nexport function updateNotification(notification: NotificationProps & { id: string }) {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.update, notification));\n}\n\nexport function hideNotification(id: string) {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.hide, id));\n}\n\nexport function cleanNotifications() {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.clean));\n}\n\nexport function cleanNotificationsQueue() {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.cleanQueue));\n}\n\nexport function useNotificationsEvents(ctx: NotificationsContextProps) {\n const events = {\n show: (event: any) => ctx.showNotification(event.detail),\n hide: (event: any) => ctx.hideNotification(event.detail),\n update: (event: any) => ctx.updateNotification(event.detail.id, event.detail),\n clean: ctx.clean,\n
|
|
1
|
+
{"version":3,"file":"events.js","sources":["../src/events.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport type { NotificationProps, NotificationsContextProps } from './types';\n\ntype ValueOf<T> = T[keyof T];\n\nexport const NOTIFICATIONS_EVENTS = {\n show: 'mantine:show-notification',\n hide: 'mantine:hide-notification',\n update: 'mantine:update-notification',\n clean: 'mantine:clean-notifications',\n cleanQueue: 'mantine:clean-notifications-queue',\n} as const;\n\nexport function createEvent(type: ValueOf<typeof NOTIFICATIONS_EVENTS>, detail?: any) {\n return new CustomEvent(type, { detail });\n}\n\nexport function showNotification(notification: NotificationProps) {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.show, notification));\n}\n\nexport function updateNotification(notification: NotificationProps & { id: string }) {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.update, notification));\n}\n\nexport function hideNotification(id: string) {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.hide, id));\n}\n\nexport function cleanNotifications() {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.clean));\n}\n\nexport function cleanNotificationsQueue() {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.cleanQueue));\n}\n\nexport function useNotificationsEvents(ctx: NotificationsContextProps) {\n const events = {\n show: (event: any) => ctx.showNotification(event.detail),\n hide: (event: any) => ctx.hideNotification(event.detail),\n update: (event: any) => ctx.updateNotification(event.detail.id, event.detail),\n clean: ctx.clean,\n cleanQueue: ctx.cleanQueue,\n };\n\n useEffect(() => {\n Object.keys(events).forEach((event) => {\n window.addEventListener(NOTIFICATIONS_EVENTS[event], events[event]);\n });\n\n return () => {\n Object.keys(events).forEach((event) => {\n window.removeEventListener(NOTIFICATIONS_EVENTS[event], events[event]);\n });\n };\n }, []);\n}\n"],"names":["useEffect"],"mappings":";;;;;;AACY,MAAC,oBAAoB,GAAG;AACpC,EAAE,IAAI,EAAE,2BAA2B;AACnC,EAAE,IAAI,EAAE,2BAA2B;AACnC,EAAE,MAAM,EAAE,6BAA6B;AACvC,EAAE,KAAK,EAAE,6BAA6B;AACtC,EAAE,UAAU,EAAE,mCAAmC;AACjD,EAAE;AACK,SAAS,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE;AAC1C,EAAE,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;A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,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,KAAK;AAC3C,MAAM,MAAM,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1E,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,MAAM;AACjB,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,KAAK;AAC7C,QAAQ,MAAM,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/E,OAAO,CAAC,CAAC;AACT,KAAK,CAAC;AACN,GAAG,EAAE,EAAE,CAAC,CAAC;AACT;;;;;;;;;;;"}
|
|
@@ -45,7 +45,8 @@ function NotificationContainer(_a) {
|
|
|
45
45
|
"onHide",
|
|
46
46
|
"innerRef"
|
|
47
47
|
]);
|
|
48
|
-
const
|
|
48
|
+
const _a2 = notification, { autoClose: notificationAutoClose } = _a2, notificationProps = __objRest(_a2, ["autoClose"]);
|
|
49
|
+
const autoCloseTimeout = getAutoClose(autoClose, notificationAutoClose);
|
|
49
50
|
const hideTimeout = useRef();
|
|
50
51
|
const handleHide = () => {
|
|
51
52
|
onHide(notification.id);
|
|
@@ -68,7 +69,7 @@ function NotificationContainer(_a) {
|
|
|
68
69
|
handleDelayedHide();
|
|
69
70
|
return cancelDelayedHide;
|
|
70
71
|
}, [autoClose, notification.autoClose]);
|
|
71
|
-
return /* @__PURE__ */ React.createElement(Notification, __spreadProps(__spreadValues(__spreadValues({},
|
|
72
|
+
return /* @__PURE__ */ React.createElement(Notification, __spreadProps(__spreadValues(__spreadValues({}, notificationProps), others), {
|
|
72
73
|
onClose: handleHide,
|
|
73
74
|
onMouseEnter: cancelDelayedHide,
|
|
74
75
|
onMouseLeave: handleDelayedHide,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationContainer.js","sources":["../../src/NotificationContainer/NotificationContainer.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport { Notification, DefaultProps } from '@mantine/core';\nimport getAutoClose from './get-auto-close/get-auto-close';\nimport { NotificationProps } from '../types';\n\nexport interface NotificationContainerProps extends DefaultProps {\n notification: NotificationProps;\n onHide(id: string): void;\n autoClose: false | number;\n innerRef: React.ForwardedRef<HTMLDivElement>;\n}\n\nexport default function NotificationContainer({\n notification,\n autoClose,\n onHide,\n innerRef,\n ...others\n}: NotificationContainerProps) {\n const autoCloseTimeout = getAutoClose(autoClose,
|
|
1
|
+
{"version":3,"file":"NotificationContainer.js","sources":["../../src/NotificationContainer/NotificationContainer.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport { Notification, DefaultProps } from '@mantine/core';\nimport getAutoClose from './get-auto-close/get-auto-close';\nimport { NotificationProps } from '../types';\n\nexport interface NotificationContainerProps extends DefaultProps {\n notification: NotificationProps;\n onHide(id: string): void;\n autoClose: false | number;\n innerRef: React.ForwardedRef<HTMLDivElement>;\n}\n\nexport default function NotificationContainer({\n notification,\n autoClose,\n onHide,\n innerRef,\n ...others\n}: NotificationContainerProps) {\n const { autoClose: notificationAutoClose, ...notificationProps } = notification;\n const autoCloseTimeout = getAutoClose(autoClose, notificationAutoClose);\n const hideTimeout = useRef<number>();\n\n const handleHide = () => {\n onHide(notification.id);\n window.clearTimeout(hideTimeout.current);\n };\n\n const cancelDelayedHide = () => {\n clearTimeout(hideTimeout.current);\n };\n\n const handleDelayedHide = () => {\n if (typeof autoCloseTimeout === 'number') {\n hideTimeout.current = window.setTimeout(handleHide, autoCloseTimeout);\n }\n };\n\n useEffect(() => {\n if (typeof notification.onOpen === 'function') {\n notification.onOpen(notification);\n }\n }, []);\n\n useEffect(() => {\n handleDelayedHide();\n return cancelDelayedHide;\n }, [autoClose, notification.autoClose]);\n\n return (\n <Notification\n {...notificationProps}\n {...others}\n onClose={handleHide}\n onMouseEnter={cancelDelayedHide}\n onMouseLeave={handleDelayedHide}\n ref={innerRef}\n >\n {notification.message}\n </Notification>\n );\n}\n\nNotificationContainer.displayName = '@mantine/notifications/NotificationContainer';\n"],"names":[],"mappings":";;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mBAAmB;AACzB,IAAI,KAAK,IAAI,IAAI,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;AAC7C,MAAM,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AACpC,QAAQ,eAAe,CAAC,CAAC,EA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Ac,CAAC,cAAc,CAAC,EAAE,EAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC,EAAE;AACxI,IAAI,OAAO,EAAE,UAAU;AACvB,IAAI,YAAY,EAAE,iBAAiB;AACnC,IAAI,YAAY,EAAE,iBAAiB;AACnC,IAAI,GAAG,EAAE,QAAQ;AACjB,GAAG,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;AAC5B,CAAC;AACD,qBAAqB,CAAC,WAAW,GAAG,8CAA8C;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
function getAutoClose(autoClose,
|
|
2
|
-
if (typeof
|
|
3
|
-
return
|
|
1
|
+
function getAutoClose(autoClose, notificationAutoClose) {
|
|
2
|
+
if (typeof notificationAutoClose === "number") {
|
|
3
|
+
return notificationAutoClose;
|
|
4
4
|
}
|
|
5
|
-
if (
|
|
5
|
+
if (notificationAutoClose === false || autoClose === false) {
|
|
6
6
|
return false;
|
|
7
7
|
}
|
|
8
8
|
return autoClose;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-auto-close.js","sources":["../../../src/NotificationContainer/get-auto-close/get-auto-close.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"get-auto-close.js","sources":["../../../src/NotificationContainer/get-auto-close/get-auto-close.ts"],"sourcesContent":["export default function getAutoClose(\n autoClose: boolean | number,\n notificationAutoClose: boolean | number\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"],"names":[],"mappings":"AAAe,SAAS,YAAY,CAAC,SAAS,EAAE,qBAAqB,EAAE;AACvE,EAAE,IAAI,OAAO,qBAAqB,KAAK,QAAQ,EAAE;AACjD,IAAI,OAAO,qBAAqB,CAAC;AACjC,GAAG;AACH,EAAE,IAAI,qBAAqB,KAAK,KAAK,IAAI,SAAS,KAAK,KAAK,EAAE;AAC9D,IAAI,OAAO,KAAK,CAAC;AACjB,GAAG;AACH,EAAE,OAAO,SAAS,CAAC;AACnB;;;;"}
|
|
@@ -4,7 +4,7 @@ function getPositionStyles([vertical, horizontal], containerWidth, spacing) {
|
|
|
4
4
|
vertical === "bottom" && (styles.bottom = spacing);
|
|
5
5
|
horizontal === "left" && (styles.left = spacing);
|
|
6
6
|
horizontal === "right" && (styles.right = spacing);
|
|
7
|
-
horizontal === "center" && (styles.left =
|
|
7
|
+
horizontal === "center" && (styles.left = "50%", styles.transform = "translateX(-50%)");
|
|
8
8
|
return styles;
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-position-styles.js","sources":["../../../src/NotificationsProvider/get-position-styles/get-position-styles.ts"],"sourcesContent":["import { CSSObject } from '@mantine/core';\nimport { NotificationsProviderPositioning } from '../../types';\n\nexport default function getPositionStyles(\n [vertical, horizontal]: NotificationsProviderPositioning,\n containerWidth: number,\n spacing: number\n) {\n const styles: CSSObject = {};\n\n vertical === 'top' && (styles.top = spacing);\n vertical === 'bottom' && (styles.bottom = spacing);\n\n horizontal === 'left' && (styles.left = spacing);\n horizontal === 'right' && (styles.right = spacing);\n horizontal === 'center' && (styles.left =
|
|
1
|
+
{"version":3,"file":"get-position-styles.js","sources":["../../../src/NotificationsProvider/get-position-styles/get-position-styles.ts"],"sourcesContent":["import { CSSObject } from '@mantine/core';\nimport { NotificationsProviderPositioning } from '../../types';\n\nexport default function getPositionStyles(\n [vertical, horizontal]: NotificationsProviderPositioning,\n containerWidth: number,\n spacing: number\n) {\n const styles: CSSObject = {};\n\n vertical === 'top' && (styles.top = spacing);\n vertical === 'bottom' && (styles.bottom = spacing);\n\n horizontal === 'left' && (styles.left = spacing);\n horizontal === 'right' && (styles.right = spacing);\n horizontal === 'center' && ((styles.left = '50%'), (styles.transform = 'translateX(-50%)'));\n\n return styles;\n}\n"],"names":[],"mappings":"AAAe,SAAS,iBAAiB,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,cAAc,EAAE,OAAO,EAAE;AAC3F,EAAE,MAAM,MAAM,GAAG,EAAE,CAAC;AACpB,EAAE,QAAQ,KAAK,KAAK,KAAK,MAAM,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC;AAC/C,EAAE,QAAQ,KAAK,QAAQ,KAAK,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC;AACrD,EAAE,UAAU,KAAK,MAAM,KAAK,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;AACnD,EAAE,UAAU,KAAK,OAAO,KAAK,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC;AACrD,EAAE,UAAU,KAAK,QAAQ,KAAK,MAAM,CAAC,IAAI,GAAG,KAAK,EAAE,MAAM,CAAC,SAAS,GAAG,kBAAkB,CAAC,CAAC;AAC1F,EAAE,OAAO,MAAM,CAAC;AAChB;;;;"}
|
package/esm/events.js
CHANGED
|
@@ -31,7 +31,7 @@ function useNotificationsEvents(ctx) {
|
|
|
31
31
|
hide: (event) => ctx.hideNotification(event.detail),
|
|
32
32
|
update: (event) => ctx.updateNotification(event.detail.id, event.detail),
|
|
33
33
|
clean: ctx.clean,
|
|
34
|
-
|
|
34
|
+
cleanQueue: ctx.cleanQueue
|
|
35
35
|
};
|
|
36
36
|
useEffect(() => {
|
|
37
37
|
Object.keys(events).forEach((event) => {
|
package/esm/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sources":["../src/events.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport type { NotificationProps, NotificationsContextProps } from './types';\n\ntype ValueOf<T> = T[keyof T];\n\nexport const NOTIFICATIONS_EVENTS = {\n show: 'mantine:show-notification',\n hide: 'mantine:hide-notification',\n update: 'mantine:update-notification',\n clean: 'mantine:clean-notifications',\n cleanQueue: 'mantine:clean-notifications-queue',\n} as const;\n\nexport function createEvent(type: ValueOf<typeof NOTIFICATIONS_EVENTS>, detail?: any) {\n return new CustomEvent(type, { detail });\n}\n\nexport function showNotification(notification: NotificationProps) {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.show, notification));\n}\n\nexport function updateNotification(notification: NotificationProps & { id: string }) {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.update, notification));\n}\n\nexport function hideNotification(id: string) {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.hide, id));\n}\n\nexport function cleanNotifications() {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.clean));\n}\n\nexport function cleanNotificationsQueue() {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.cleanQueue));\n}\n\nexport function useNotificationsEvents(ctx: NotificationsContextProps) {\n const events = {\n show: (event: any) => ctx.showNotification(event.detail),\n hide: (event: any) => ctx.hideNotification(event.detail),\n update: (event: any) => ctx.updateNotification(event.detail.id, event.detail),\n clean: ctx.clean,\n
|
|
1
|
+
{"version":3,"file":"events.js","sources":["../src/events.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport type { NotificationProps, NotificationsContextProps } from './types';\n\ntype ValueOf<T> = T[keyof T];\n\nexport const NOTIFICATIONS_EVENTS = {\n show: 'mantine:show-notification',\n hide: 'mantine:hide-notification',\n update: 'mantine:update-notification',\n clean: 'mantine:clean-notifications',\n cleanQueue: 'mantine:clean-notifications-queue',\n} as const;\n\nexport function createEvent(type: ValueOf<typeof NOTIFICATIONS_EVENTS>, detail?: any) {\n return new CustomEvent(type, { detail });\n}\n\nexport function showNotification(notification: NotificationProps) {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.show, notification));\n}\n\nexport function updateNotification(notification: NotificationProps & { id: string }) {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.update, notification));\n}\n\nexport function hideNotification(id: string) {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.hide, id));\n}\n\nexport function cleanNotifications() {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.clean));\n}\n\nexport function cleanNotificationsQueue() {\n window.dispatchEvent(createEvent(NOTIFICATIONS_EVENTS.cleanQueue));\n}\n\nexport function useNotificationsEvents(ctx: NotificationsContextProps) {\n const events = {\n show: (event: any) => ctx.showNotification(event.detail),\n hide: (event: any) => ctx.hideNotification(event.detail),\n update: (event: any) => ctx.updateNotification(event.detail.id, event.detail),\n clean: ctx.clean,\n cleanQueue: ctx.cleanQueue,\n };\n\n useEffect(() => {\n Object.keys(events).forEach((event) => {\n window.addEventListener(NOTIFICATIONS_EVENTS[event], events[event]);\n });\n\n return () => {\n Object.keys(events).forEach((event) => {\n window.removeEventListener(NOTIFICATIONS_EVENTS[event], events[event]);\n });\n };\n }, []);\n}\n"],"names":[],"mappings":";;AACY,MAAC,oBAAoB,GAAG;AACpC,EAAE,IAAI,EAAE,2BAA2B;AACnC,EAAE,IAAI,EAAE,2BAA2B;AACnC,EAAE,MAAM,EAAE,6BAA6B;AACvC,EAAE,KAAK,EAAE,6BAA6B;AACtC,EAAE,UAAU,EAAE,mCAAmC;AACjD,EAAE;AACK,SAAS,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE;AAC1C,EAAE,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAC3C,CAAC;AACM,SAAS,gBAAgB,CAAC,YAAY,EAAE;AAC/C,EAAE,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;AAC7E,CAAC;AACM,SAAS,kBAAkB,CAAC,YAAY,EAAE;AACjD,EAAE,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,oBAAoB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;AAC/E,CAAC;AACM,SAAS,gBAAgB,CAAC,EAAE,EAAE;AACrC,EAAE,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,oBAAoB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;AACnE,CAAC;A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AK,CAAC;AACN,GAAG,EAAE,EAAE,CAAC,CAAC;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationContainer.d.ts","sourceRoot":"","sources":["../../src/NotificationContainer/NotificationContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAgB,YAAY,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,WAAW,0BAA2B,SAAQ,YAAY;IAC9D,YAAY,EAAE,iBAAiB,CAAC;IAChC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;CAC9C;AAED,iBAAwB,qBAAqB,CAAC,EAC5C,YAAY,EACZ,SAAS,EACT,MAAM,EACN,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"NotificationContainer.d.ts","sourceRoot":"","sources":["../../src/NotificationContainer/NotificationContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAgB,YAAY,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,WAAW,0BAA2B,SAAQ,YAAY;IAC9D,YAAY,EAAE,iBAAiB,CAAC;IAChC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;CAC9C;AAED,iBAAwB,qBAAqB,CAAC,EAC5C,YAAY,EACZ,SAAS,EACT,MAAM,EACN,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,0BAA0B,eA2C5B;kBAjDuB,qBAAqB;;;eAArB,qBAAqB"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getAutoClose(autoClose: boolean | number, notification: NotificationProps): number | boolean;
|
|
1
|
+
export default function getAutoClose(autoClose: boolean | number, notificationAutoClose: boolean | number): number | boolean;
|
|
3
2
|
//# sourceMappingURL=get-auto-close.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-auto-close.d.ts","sourceRoot":"","sources":["../../../src/NotificationContainer/get-auto-close/get-auto-close.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"get-auto-close.d.ts","sourceRoot":"","sources":["../../../src/NotificationContainer/get-auto-close/get-auto-close.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,SAAS,EAAE,OAAO,GAAG,MAAM,EAC3B,qBAAqB,EAAE,OAAO,GAAG,MAAM,oBAWxC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantine/notifications",
|
|
3
3
|
"description": "Notification system based on Mantine components",
|
|
4
|
-
"version": "4.1.
|
|
4
|
+
"version": "4.1.3",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -28,13 +28,12 @@
|
|
|
28
28
|
"notification-system"
|
|
29
29
|
],
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@mantine/core": "4.1.
|
|
32
|
-
"@mantine/hooks": "4.1.
|
|
31
|
+
"@mantine/core": "4.1.3",
|
|
32
|
+
"@mantine/hooks": "4.1.3",
|
|
33
33
|
"react": ">=16.8.0",
|
|
34
34
|
"react-dom": ">=16.8.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"clsx": "^1.1.1",
|
|
38
37
|
"react-transition-group": "^4.4.2"
|
|
39
38
|
},
|
|
40
39
|
"devDependencies": {}
|