@mantine/notifications 4.1.1 → 4.1.4

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.
@@ -53,7 +53,8 @@ function NotificationContainer(_a) {
53
53
  "onHide",
54
54
  "innerRef"
55
55
  ]);
56
- const autoCloseTimeout = getAutoClose['default'](autoClose, notification);
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({}, notification), others), {
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, notification);\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 {...notification}\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,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY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AO,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,YAAY,CAAC,EAAE,MAAM,CAAC,EAAE;AACnI,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
+ {"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,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,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AAE,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, notification) {
6
- if (typeof notification.autoClose === "number") {
7
- return notification.autoClose;
5
+ function getAutoClose(autoClose, notificationAutoClose) {
6
+ if (typeof notificationAutoClose === "number") {
7
+ return notificationAutoClose;
8
8
  }
9
- if (notification.autoClose === false || autoClose === false) {
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":["import { NotificationProps } from '../../types';\n\nexport default function getAutoClose(autoClose: boolean | number, notification: NotificationProps) {\n if (typeof notification.autoClose === 'number') {\n return notification.autoClose;\n }\n\n if (notification.autoClose === false || autoClose === false) {\n return false;\n }\n\n return autoClose;\n}\n"],"names":[],"mappings":";;;;AAAe,SAAS,YAAY,CAAC,SAAS,EAAE,YAAY,EAAE;AAC9D,EAAE,IAAI,OAAO,YAAY,CAAC,SAAS,KAAK,QAAQ,EAAE;AAClD,IAAI,OAAO,YAAY,CAAC,SAAS,CAAC;AAClC,GAAG;AACH,EAAE,IAAI,YAAY,CAAC,SAAS,KAAK,KAAK,IAAI,SAAS,KAAK,KAAK,EAAE;AAC/D,IAAI,OAAO,KAAK,CAAC;AACjB,GAAG;AACH,EAAE,OAAO,SAAS,CAAC;AACnB;;;;"}
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 = `calc(50% - ${containerWidth / 2}px)`);
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 = `calc(50% - ${containerWidth / 2}px)`);\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,CAAC,WAAW,EAAE,cAAc,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACnF,EAAE,OAAO,MAAM,CAAC;AAChB;;;;"}
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;;;;"}
@@ -45,7 +45,8 @@ function NotificationContainer(_a) {
45
45
  "onHide",
46
46
  "innerRef"
47
47
  ]);
48
- const autoCloseTimeout = getAutoClose(autoClose, notification);
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({}, notification), others), {
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, notification);\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 {...notification}\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,C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AAC9C,MAAM,WAAW,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;AAC5E,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,SAAS,CAAC,MAAM;AAClB,IAAI,IAAI,OAAO,YAAY,CAAC,MAAM,KAAK,UAAU,EAAE;AACnD,MAAM,YAAY,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACxC,KAAK;AACL,GAAG,EAAE,EAAE,CAAC,CAAC;AACT,EAAE,SAAS,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,uBAAuB,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,EAAE;AACnI,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
+ {"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,cA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AC5E,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,SAAS,CAAC,MAAM;AAClB,IAAI,IAAI,OAAO,YAAY,CAAC,MAAM,KAAK,UAAU,EAAE;AACnD,MAAM,YAAY,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACxC,KAAK;AACL,GAAG,EAAE,EAAE,CAAC,CAAC;AACT,EAAE,SAAS,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,uBAAuB,KAAK,CAAC,aAAa,CAAC,YAAY,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;;;;"}
@@ -1,8 +1,8 @@
1
- function getAutoClose(autoClose, notification) {
2
- if (typeof notification.autoClose === "number") {
3
- return notification.autoClose;
1
+ function getAutoClose(autoClose, notificationAutoClose) {
2
+ if (typeof notificationAutoClose === "number") {
3
+ return notificationAutoClose;
4
4
  }
5
- if (notification.autoClose === false || autoClose === false) {
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":["import { NotificationProps } from '../../types';\n\nexport default function getAutoClose(autoClose: boolean | number, notification: NotificationProps) {\n if (typeof notification.autoClose === 'number') {\n return notification.autoClose;\n }\n\n if (notification.autoClose === false || autoClose === false) {\n return false;\n }\n\n return autoClose;\n}\n"],"names":[],"mappings":"AAAe,SAAS,YAAY,CAAC,SAAS,EAAE,YAAY,EAAE;AAC9D,EAAE,IAAI,OAAO,YAAY,CAAC,SAAS,KAAK,QAAQ,EAAE;AAClD,IAAI,OAAO,YAAY,CAAC,SAAS,CAAC;AAClC,GAAG;AACH,EAAE,IAAI,YAAY,CAAC,SAAS,KAAK,KAAK,IAAI,SAAS,KAAK,KAAK,EAAE;AAC/D,IAAI,OAAO,KAAK,CAAC;AACjB,GAAG;AACH,EAAE,OAAO,SAAS,CAAC;AACnB;;;;"}
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 = `calc(50% - ${containerWidth / 2}px)`);
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 = `calc(50% - ${containerWidth / 2}px)`);\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,CAAC,WAAW,EAAE,cAAc,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACnF,EAAE,OAAO,MAAM,CAAC;AAChB;;;;"}
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;;;;"}
@@ -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,eA0C5B;kBAhDuB,qBAAqB;;;eAArB,qBAAqB"}
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
- import { NotificationProps } from '../../types';
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,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,EAAE,YAAY,EAAE,iBAAiB,oBAUhG"}
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.1",
4
+ "version": "4.1.4",
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.1",
32
- "@mantine/hooks": "4.1.1",
31
+ "@mantine/core": "4.1.4",
32
+ "@mantine/hooks": "4.1.4",
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": {}