@mantine/notifications 5.10.2 → 6.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/cjs/{NotificationsProvider/NotificationsProvider.js → Notifications/Notifications.js} +10 -14
  2. package/cjs/Notifications/Notifications.js.map +1 -0
  3. package/cjs/{NotificationsProvider/NotificationsProvider.styles.js → Notifications/Notifications.styles.js} +2 -2
  4. package/cjs/Notifications/Notifications.styles.js.map +1 -0
  5. package/cjs/{NotificationsProvider → Notifications}/get-notification-state-styles/get-notification-state-styles.js +0 -0
  6. package/cjs/Notifications/get-notification-state-styles/get-notification-state-styles.js.map +1 -0
  7. package/cjs/{NotificationsProvider → Notifications}/get-position-styles/get-position-styles.js +0 -0
  8. package/cjs/Notifications/get-position-styles/get-position-styles.js.map +1 -0
  9. package/cjs/{NotificationsProvider → Notifications}/use-notifications-state/use-notifications-state.js +0 -0
  10. package/cjs/Notifications/use-notifications-state/use-notifications-state.js.map +1 -0
  11. package/cjs/events.js +8 -0
  12. package/cjs/events.js.map +1 -1
  13. package/cjs/index.js +3 -4
  14. package/cjs/index.js.map +1 -1
  15. package/esm/{NotificationsProvider/NotificationsProvider.js → Notifications/Notifications.js} +10 -14
  16. package/esm/Notifications/Notifications.js.map +1 -0
  17. package/esm/{NotificationsProvider/NotificationsProvider.styles.js → Notifications/Notifications.styles.js} +2 -2
  18. package/esm/Notifications/Notifications.styles.js.map +1 -0
  19. package/esm/{NotificationsProvider → Notifications}/get-notification-state-styles/get-notification-state-styles.js +0 -0
  20. package/esm/Notifications/get-notification-state-styles/get-notification-state-styles.js.map +1 -0
  21. package/esm/{NotificationsProvider → Notifications}/get-position-styles/get-position-styles.js +0 -0
  22. package/esm/Notifications/get-position-styles/get-position-styles.js.map +1 -0
  23. package/esm/{NotificationsProvider → Notifications}/use-notifications-state/use-notifications-state.js +0 -0
  24. package/esm/Notifications/use-notifications-state/use-notifications-state.js.map +1 -0
  25. package/esm/events.js +8 -1
  26. package/esm/events.js.map +1 -1
  27. package/esm/index.js +2 -3
  28. package/esm/index.js.map +1 -1
  29. package/lib/{NotificationsProvider/NotificationsProvider.d.ts → Notifications/Notifications.d.ts} +9 -11
  30. package/lib/Notifications/Notifications.d.ts.map +1 -0
  31. package/lib/{NotificationsProvider/NotificationsProvider.styles.d.ts → Notifications/Notifications.styles.d.ts} +3 -3
  32. package/lib/Notifications/Notifications.styles.d.ts.map +1 -0
  33. package/lib/{NotificationsProvider → Notifications}/get-notification-state-styles/get-notification-state-styles.d.ts +3 -3
  34. package/lib/Notifications/get-notification-state-styles/get-notification-state-styles.d.ts.map +1 -0
  35. package/lib/Notifications/get-position-styles/get-position-styles.d.ts +4 -0
  36. package/lib/Notifications/get-position-styles/get-position-styles.d.ts.map +1 -0
  37. package/lib/{NotificationsProvider → Notifications}/use-notifications-state/use-notifications-state.d.ts +0 -0
  38. package/lib/Notifications/use-notifications-state/use-notifications-state.d.ts.map +1 -0
  39. package/lib/events.d.ts +9 -0
  40. package/lib/events.d.ts.map +1 -1
  41. package/lib/index.d.ts +3 -4
  42. package/lib/index.d.ts.map +1 -1
  43. package/lib/types.d.ts +1 -1
  44. package/lib/types.d.ts.map +1 -1
  45. package/package.json +4 -4
  46. package/cjs/Notifications.context.js +0 -11
  47. package/cjs/Notifications.context.js.map +0 -1
  48. package/cjs/NotificationsProvider/NotificationsProvider.js.map +0 -1
  49. package/cjs/NotificationsProvider/NotificationsProvider.styles.js.map +0 -1
  50. package/cjs/NotificationsProvider/get-notification-state-styles/get-notification-state-styles.js.map +0 -1
  51. package/cjs/NotificationsProvider/get-position-styles/get-position-styles.js.map +0 -1
  52. package/cjs/NotificationsProvider/use-notifications-state/use-notifications-state.js.map +0 -1
  53. package/cjs/use-notifications/use-notifications.js +0 -17
  54. package/cjs/use-notifications/use-notifications.js.map +0 -1
  55. package/esm/Notifications.context.js +0 -7
  56. package/esm/Notifications.context.js.map +0 -1
  57. package/esm/NotificationsProvider/NotificationsProvider.js.map +0 -1
  58. package/esm/NotificationsProvider/NotificationsProvider.styles.js.map +0 -1
  59. package/esm/NotificationsProvider/get-notification-state-styles/get-notification-state-styles.js.map +0 -1
  60. package/esm/NotificationsProvider/get-position-styles/get-position-styles.js.map +0 -1
  61. package/esm/NotificationsProvider/use-notifications-state/use-notifications-state.js.map +0 -1
  62. package/esm/use-notifications/use-notifications.js +0 -13
  63. package/esm/use-notifications/use-notifications.js.map +0 -1
  64. package/lib/Notifications.context.d.ts +0 -4
  65. package/lib/Notifications.context.d.ts.map +0 -1
  66. package/lib/NotificationsProvider/NotificationsProvider.d.ts.map +0 -1
  67. package/lib/NotificationsProvider/NotificationsProvider.styles.d.ts.map +0 -1
  68. package/lib/NotificationsProvider/get-notification-state-styles/get-notification-state-styles.d.ts.map +0 -1
  69. package/lib/NotificationsProvider/get-position-styles/get-position-styles.d.ts +0 -4
  70. package/lib/NotificationsProvider/get-position-styles/get-position-styles.d.ts.map +0 -1
  71. package/lib/NotificationsProvider/use-notifications-state/use-notifications-state.d.ts.map +0 -1
  72. package/lib/use-notifications/use-notifications.d.ts +0 -2
  73. package/lib/use-notifications/use-notifications.d.ts.map +0 -1
@@ -6,12 +6,11 @@ var React = require('react');
6
6
  var reactTransitionGroup = require('react-transition-group');
7
7
  var core = require('@mantine/core');
8
8
  var hooks = require('@mantine/hooks');
9
- var Notifications_context = require('../Notifications.context.js');
10
9
  var events = require('../events.js');
11
10
  var getPositionStyles = require('./get-position-styles/get-position-styles.js');
12
11
  var getNotificationStateStyles = require('./get-notification-state-styles/get-notification-state-styles.js');
13
12
  var NotificationContainer = require('../NotificationContainer/NotificationContainer.js');
14
- var NotificationsProvider_styles = require('./NotificationsProvider.styles.js');
13
+ var Notifications_styles = require('./Notifications.styles.js');
15
14
  var useNotificationsState = require('./use-notifications-state/use-notifications-state.js');
16
15
 
17
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
@@ -54,14 +53,14 @@ const POSITIONS = [
54
53
  "bottom-right",
55
54
  "bottom-center"
56
55
  ];
57
- function NotificationsProvider(_a) {
56
+ function Notifications(_a) {
58
57
  var _b = _a, {
59
58
  className,
60
59
  position = "bottom-right",
61
60
  autoClose = 4e3,
62
61
  transitionDuration = 250,
63
- containerWidth = 440,
64
- notificationMaxHeight = 200,
62
+ containerWidth = core.rem(440),
63
+ notificationMaxHeight = core.rem(200),
65
64
  limit = 5,
66
65
  zIndex = core.getDefaultZIndex("overlay"),
67
66
  style,
@@ -85,14 +84,13 @@ function NotificationsProvider(_a) {
85
84
  const previousLength = React.useRef(0);
86
85
  const {
87
86
  notifications,
88
- queue,
89
87
  showNotification,
90
88
  updateNotification,
91
89
  hideNotification,
92
90
  clean,
93
91
  cleanQueue
94
92
  } = useNotificationsState['default']({ limit });
95
- const { classes, cx, theme } = NotificationsProvider_styles['default']({ zIndex });
93
+ const { classes, cx, theme } = Notifications_styles['default']({ zIndex });
96
94
  const shouldReduceMotion = hooks.useReducedMotion();
97
95
  const reduceMotion = theme.respectReducedMotion ? shouldReduceMotion : false;
98
96
  const duration = reduceMotion ? 1 : transitionDuration;
@@ -133,9 +131,7 @@ function NotificationsProvider(_a) {
133
131
  ...Array.isArray(notification.sx) ? notification.sx : [notification.sx]
134
132
  ]
135
133
  })));
136
- return /* @__PURE__ */ React__default.createElement(Notifications_context.NotificationsContext.Provider, {
137
- value: { notifications, queue }
138
- }, /* @__PURE__ */ React__default.createElement(core.Portal, {
134
+ return /* @__PURE__ */ React__default.createElement(core.Portal, {
139
135
  target
140
136
  }, /* @__PURE__ */ React__default.createElement(core.Box, __spreadValues({
141
137
  className: cx(classes.notifications, className),
@@ -143,9 +139,9 @@ function NotificationsProvider(_a) {
143
139
  sx: __spreadValues({
144
140
  maxWidth: containerWidth
145
141
  }, getPositionStyles['default'](positioning, theme.spacing.md))
146
- }, others), /* @__PURE__ */ React__default.createElement(reactTransitionGroup.TransitionGroup, null, items))), children);
142
+ }, others), /* @__PURE__ */ React__default.createElement(reactTransitionGroup.TransitionGroup, null, items)));
147
143
  }
148
- NotificationsProvider.displayName = "@mantine/notifications/NotificationsProvider";
144
+ Notifications.displayName = "@mantine/notifications/Notifications";
149
145
 
150
- exports.NotificationsProvider = NotificationsProvider;
151
- //# sourceMappingURL=NotificationsProvider.js.map
146
+ exports.Notifications = Notifications;
147
+ //# sourceMappingURL=Notifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Notifications.js","sources":["../../src/Notifications/Notifications.tsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport { Transition, TransitionGroup } from 'react-transition-group';\nimport {\n DefaultProps,\n Portal,\n MantineStyleSystemSize,\n getDefaultZIndex,\n Box,\n PortalProps,\n rem,\n} from '@mantine/core';\nimport { useReducedMotion, useForceUpdate, useDidUpdate } from '@mantine/hooks';\nimport { NotificationsPositioning } from '../types';\nimport { useNotificationsEvents } from '../events';\nimport getPositionStyles from './get-position-styles/get-position-styles';\nimport getNotificationStateStyles from './get-notification-state-styles/get-notification-state-styles';\nimport NotificationContainer from '../NotificationContainer/NotificationContainer';\nimport useStyles from './Notifications.styles';\nimport useNotificationsState from './use-notifications-state/use-notifications-state';\n\nconst POSITIONS = [\n 'top-left',\n 'top-right',\n 'top-center',\n 'bottom-left',\n 'bottom-right',\n 'bottom-center',\n] as const;\n\nexport interface NotificationsProps\n extends Omit<DefaultProps, MantineStyleSystemSize>,\n React.ComponentPropsWithoutRef<'div'> {\n /** Notifications position */\n position?:\n | 'top-left'\n | 'top-right'\n | 'top-center'\n | 'bottom-left'\n | 'bottom-right'\n | 'bottom-center';\n\n /** Auto close timeout for all notifications, false to disable auto close, can be overwritten for individual notifications by notifications.show function */\n autoClose?: number | false;\n\n /** Notification transitions duration, 0 to turn transitions off */\n transitionDuration?: number;\n\n /** Notification width, cannot exceed 100% */\n containerWidth?: number | string;\n\n /** Notification max-height, used for transitions */\n notificationMaxHeight?: number | string;\n\n /** Maximum amount of notifications displayed at a time, other new notifications will be added to queue */\n limit?: number;\n\n /** Notifications container z-index */\n zIndex?: React.CSSProperties['zIndex'];\n\n /** Target element of Portal component */\n target?: PortalProps['target'];\n}\n\nexport function Notifications({\n className,\n position = 'bottom-right',\n autoClose = 4000,\n transitionDuration = 250,\n containerWidth = rem(440),\n notificationMaxHeight = rem(200),\n limit = 5,\n zIndex = getDefaultZIndex('overlay'),\n style,\n children,\n target,\n ...others\n}: NotificationsProps) {\n const forceUpdate = useForceUpdate();\n const refs = useRef<Record<string, HTMLDivElement>>({});\n const previousLength = useRef<number>(0);\n const {\n notifications,\n showNotification,\n updateNotification,\n hideNotification,\n clean,\n cleanQueue,\n } = useNotificationsState({ limit });\n\n const { classes, cx, theme } = useStyles({ zIndex });\n const shouldReduceMotion = useReducedMotion();\n const reduceMotion = theme.respectReducedMotion ? shouldReduceMotion : false;\n const duration = reduceMotion ? 1 : transitionDuration;\n const positioning = (POSITIONS.includes(position) ? position : 'bottom-right').split(\n '-'\n ) as NotificationsPositioning;\n\n useDidUpdate(() => {\n if (notifications.length > previousLength.current) {\n setTimeout(() => forceUpdate(), 0);\n }\n previousLength.current = notifications.length;\n }, [notifications]);\n\n useNotificationsEvents({\n show: showNotification,\n hide: hideNotification,\n update: updateNotification,\n clean,\n cleanQueue,\n });\n\n const items = notifications.map((notification) => (\n <Transition\n key={notification.id}\n timeout={duration}\n onEnter={() => refs.current[notification.id].offsetHeight}\n nodeRef={{ current: refs.current[notification.id] }}\n >\n {(state) => (\n <NotificationContainer\n innerRef={(node) => {\n refs.current[notification.id] = node;\n }}\n notification={notification}\n onHide={hideNotification}\n className={classes.notification}\n autoClose={autoClose}\n sx={[\n {\n ...getNotificationStateStyles({\n state,\n positioning,\n transitionDuration: duration,\n maxHeight: notificationMaxHeight,\n }),\n },\n ...(Array.isArray(notification.sx) ? notification.sx : [notification.sx]),\n ]}\n />\n )}\n </Transition>\n ));\n\n return (\n <Portal target={target}>\n <Box\n className={cx(classes.notifications, className)}\n style={style}\n sx={{\n maxWidth: containerWidth,\n ...getPositionStyles(positioning, theme.spacing.md),\n }}\n {...others}\n >\n <TransitionGroup>{items}</TransitionGroup>\n </Box>\n </Portal>\n );\n}\n\nNotifications.displayName = '@mantine/notifications/Notifications';\n"],"names":["rem","getDefaultZIndex","useForceUpdate","useRef","useNotificationsState","useStyles","useReducedMotion","useDidUpdate","useNotificationsEvents","React","Transition","NotificationContainer","getNotificationStateStyles","Portal","Box","getPositionStyles","TransitionGroup"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,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,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,CAAC,YAAY;AACnC,IAAI,SAAS;AACb,IAAI,EAAE,EAAE;AACR,MAAM,cAAc,CAAC,EAAE,EAAEC,qCAA0B,CAAC;AACpD,QAAQ,KAAK;AACb,QAAQ,WAAW;AACnB,QAAQ,kBAAkB,EAAE,QAAQ;AACpC,QAAQ,SAAS,EAAE,qBAAqB;AACxC,OAAO,CAAC,CAAC;AACT,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;AAC7E,KAAK;AACL,GAAG,CAAC,CAAC,CAAC,CAAC;AACP,EAAE,uBAAuBH,cAAK,CAAC,aAAa,CAACI,WAAM,EAAE;AACrD,IAAI,MAAM;AACV,GAAG,kBAAkBJ,cAAK,CAAC,aAAa,CAACK,QAAG,EAAE,cAAc,CAAC;AAC7D,IAAI,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,SAAS,CAAC;AACnD,IAAI,KAAK;AACT,IAAI,EAAE,EAAE,cAAc,CAAC;AACvB,MAAM,QAAQ,EAAE,cAAc;AAC9B,KAAK,EAAEC,4BAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AACxD,GAAG,EAAE,MAAM,CAAC,kBAAkBN,cAAK,CAAC,aAAa,CAACO,oCAAe,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC;AACD,aAAa,CAAC,WAAW,GAAG,sCAAsC;;;;"}
@@ -6,7 +6,7 @@ var core = require('@mantine/core');
6
6
 
7
7
  var useStyles = core.createStyles((theme, { zIndex }) => ({
8
8
  notifications: {
9
- width: `calc(100% - ${theme.spacing.md * 2}px)`,
9
+ width: `calc(100% - ${theme.spacing.md} * 2)`,
10
10
  boxSizing: "border-box",
11
11
  position: "fixed",
12
12
  zIndex
@@ -19,4 +19,4 @@ var useStyles = core.createStyles((theme, { zIndex }) => ({
19
19
  }));
20
20
 
21
21
  exports.default = useStyles;
22
- //# sourceMappingURL=NotificationsProvider.styles.js.map
22
+ //# sourceMappingURL=Notifications.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Notifications.styles.js","sources":["../../src/Notifications/Notifications.styles.ts"],"sourcesContent":["import { createStyles } from '@mantine/core';\n\ninterface NotificationsStylesParams {\n zIndex: React.CSSProperties['zIndex'];\n}\n\nexport default createStyles((theme, { zIndex }: NotificationsStylesParams) => ({\n notifications: {\n width: `calc(100% - ${theme.spacing.md} * 2)`,\n boxSizing: 'border-box',\n position: 'fixed',\n zIndex,\n },\n\n notification: {\n '&:not(:first-of-type)': {\n marginTop: theme.spacing.sm,\n },\n },\n}));\n"],"names":["createStyles"],"mappings":";;;;;;AACA,gBAAeA,iBAAY,CAAC,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM;AACpD,EAAE,aAAa,EAAE;AACjB,IAAI,KAAK,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC;AACjD,IAAI,SAAS,EAAE,YAAY;AAC3B,IAAI,QAAQ,EAAE,OAAO;AACrB,IAAI,MAAM;AACV,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,uBAAuB,EAAE;AAC7B,MAAM,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE;AACjC,KAAK;AACL,GAAG;AACH,CAAC,CAAC,CAAC;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-notification-state-styles.js","sources":["../../../src/Notifications/get-notification-state-styles/get-notification-state-styles.ts"],"sourcesContent":["import { TransitionStatus } from 'react-transition-group';\nimport { CSSObject } from '@mantine/core';\nimport { NotificationsPositioning } from '../../types';\n\ninterface NotificationStateStylesProps {\n state: TransitionStatus;\n maxHeight: number | string;\n positioning: NotificationsPositioning;\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 default function getNotificationStateStyles({\n state,\n maxHeight,\n positioning,\n transitionDuration,\n}: NotificationStateStylesProps): CSSObject {\n const [vertical, horizontal] = positioning;\n const property = horizontal === 'center' ? `${vertical}-center` : horizontal;\n\n const commonStyles: CSSObject = {\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: CSSObject = {\n opacity: 1,\n transform: noTransform[property],\n };\n\n const outState: CSSObject = {\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] };\n}\n"],"names":[],"mappings":";;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,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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B,IAAI,OAAO,EAAE,CAAC;AACd,IAAI,SAAS;AACb,IAAI,SAAS,EAAE,UAAU,CAAC,QAAQ,CAAC;AACnC,IAAI,kBAAkB,EAAE,CAAC,EAAE,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,CAAC,EAAE,CAAC;AACnG,IAAI,wBAAwB,EAAE,kEAAkE;AAChG,IAAI,kBAAkB,EAAE,gCAAgC;AACxD,GAAG,CAAC;AACJ,EAAE,MAAM,OAAO,GAAG;AAClB,IAAI,OAAO,EAAE,CAAC;AACd,IAAI,SAAS,EAAE,WAAW,CAAC,QAAQ,CAAC;AACpC,GAAG,CAAC;AACJ,EAAE,MAAM,QAAQ,GAAG;AACnB,IAAI,OAAO,EAAE,CAAC;AACd,IAAI,SAAS,EAAE,CAAC;AAChB,IAAI,SAAS,EAAE,UAAU,CAAC,QAAQ,CAAC;AACnC,GAAG,CAAC;AACJ,EAAE,MAAM,gBAAgB,GAAG;AAC3B,IAAI,QAAQ,EAAE,OAAO;AACrB,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,OAAO,EAAE,QAAQ;AACrB,IAAI,MAAM,EAAE,QAAQ;AACpB,GAAG,CAAC;AACJ,EAAE,OAAO,cAAc,CAAC,cAAc,CAAC,EAAE,EAAE,YAAY,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;AACnF;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-position-styles.js","sources":["../../../src/Notifications/get-position-styles/get-position-styles.ts"],"sourcesContent":["import { CSSObject } from '@mantine/core';\nimport { NotificationsPositioning } from '../../types';\n\nexport default function getPositionStyles(\n [vertical, horizontal]: NotificationsPositioning,\n spacing: number | string\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,OAAO,EAAE;AAC3E,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;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-notifications-state.js","sources":["../../../src/Notifications/use-notifications-state/use-notifications-state.ts"],"sourcesContent":["import { useQueue, randomId } from '@mantine/hooks';\nimport { NotificationProps } from '../../types';\n\nexport default function useNotificationsState({ limit }: { limit: number }) {\n const { state, queue, update, cleanQueue } = useQueue<NotificationProps>({\n initialValues: [],\n limit,\n });\n\n const showNotification = (notification: NotificationProps) => {\n const id = notification.id || randomId();\n\n update((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\n const updateNotification = (notification: NotificationProps) =>\n update((notifications) => {\n const index = notifications.findIndex((n) => n.id === notification.id);\n\n if (index === -1) {\n return notifications;\n }\n\n const newNotifications = [...notifications];\n newNotifications[index] = notification;\n\n return newNotifications;\n });\n\n const hideNotification = (id: string) =>\n update((notifications) =>\n notifications.filter((notification) => {\n if (notification.id === id) {\n typeof notification.onClose === 'function' && notification.onClose(notification);\n return false;\n }\n\n return true;\n })\n );\n\n const clean = () => update(() => []);\n\n return {\n notifications: state,\n queue,\n showNotification,\n updateNotification,\n hideNotification,\n cleanQueue,\n clean,\n };\n}\n"],"names":["useQueue","randomId"],"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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AAK,YAAY,CAAC,EAAE,CAAC,CAAC;AAC3E,IAAI,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;AACtB,MAAM,OAAO,aAAa,CAAC;AAC3B,KAAK;AACL,IAAI,MAAM,gBAAgB,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC;AAChD,IAAI,gBAAgB,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC;AAC3C,IAAI,OAAO,gBAAgB,CAAC;AAC5B,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,gBAAgB,GAAG,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC,aAAa,KAAK,aAAa,CAAC,MAAM,CAAC,CAAC,YAAY,KAAK;AACpG,IAAI,IAAI,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE;AAChC,MAAM,OAAO,YAAY,CAAC,OAAO,KAAK,UAAU,IAAI,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AACvF,MAAM,OAAO,KAAK,CAAC;AACnB,KAAK;AACL,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG,CAAC,CAAC,CAAC;AACN,EAAE,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;AACvC,EAAE,OAAO;AACT,IAAI,aAAa,EAAE,KAAK;AACxB,IAAI,KAAK;AACT,IAAI,gBAAgB;AACpB,IAAI,kBAAkB;AACtB,IAAI,gBAAgB;AACpB,IAAI,UAAU;AACd,IAAI,KAAK;AACT,GAAG,CAAC;AACJ;;;;"}
package/cjs/events.js CHANGED
@@ -10,11 +10,19 @@ const hideNotification = createEvent("hide");
10
10
  const cleanNotifications = createEvent("clean");
11
11
  const cleanNotificationsQueue = createEvent("cleanQueue");
12
12
  const updateNotification = createEvent("update");
13
+ const notifications = {
14
+ show: showNotification,
15
+ hide: hideNotification,
16
+ clean: cleanNotifications,
17
+ cleanQueue: cleanNotificationsQueue,
18
+ update: updateNotification
19
+ };
13
20
 
14
21
  exports.cleanNotifications = cleanNotifications;
15
22
  exports.cleanNotificationsQueue = cleanNotificationsQueue;
16
23
  exports.createEvent = createEvent;
17
24
  exports.hideNotification = hideNotification;
25
+ exports.notifications = notifications;
18
26
  exports.showNotification = showNotification;
19
27
  exports.updateNotification = updateNotification;
20
28
  exports.useNotificationsEvents = useNotificationsEvents;
package/cjs/events.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sources":["../src/events.ts"],"sourcesContent":["import { createUseExternalEvents } from '@mantine/utils';\nimport type { NotificationProps } from './types';\n\nexport type NotificationsEvents = {\n show(notification: NotificationProps): void;\n hide(id: string): void;\n update(notification: NotificationProps & { id: string }): void;\n clean(): void;\n cleanQueue(): void;\n};\n\nexport const [useNotificationsEvents, createEvent] =\n createUseExternalEvents<NotificationsEvents>('mantine-notifications');\n\nexport const showNotification = createEvent('show');\nexport const hideNotification = createEvent('hide');\nexport const cleanNotifications = createEvent('clean');\nexport const cleanNotificationsQueue = createEvent('cleanQueue');\nexport const updateNotification = createEvent('update');\n"],"names":["createUseExternalEvents"],"mappings":";;;;;;AACY,MAAC,CAAC,sBAAsB,EAAE,WAAW,CAAC,GAAGA,6BAAuB,CAAC,uBAAuB,EAAE;AAC1F,MAAC,gBAAgB,GAAG,WAAW,CAAC,MAAM,EAAE;AACxC,MAAC,gBAAgB,GAAG,WAAW,CAAC,MAAM,EAAE;AACxC,MAAC,kBAAkB,GAAG,WAAW,CAAC,OAAO,EAAE;AAC3C,MAAC,uBAAuB,GAAG,WAAW,CAAC,YAAY,EAAE;AACrD,MAAC,kBAAkB,GAAG,WAAW,CAAC,QAAQ;;;;;;;;;;"}
1
+ {"version":3,"file":"events.js","sources":["../src/events.ts"],"sourcesContent":["import { createUseExternalEvents } from '@mantine/utils';\nimport type { NotificationProps } from './types';\n\nexport type NotificationsEvents = {\n show(notification: NotificationProps): void;\n hide(id: string): void;\n update(notification: NotificationProps & { id: string }): void;\n clean(): void;\n cleanQueue(): void;\n};\n\nexport const [useNotificationsEvents, createEvent] =\n createUseExternalEvents<NotificationsEvents>('mantine-notifications');\n\nexport const showNotification = createEvent('show');\nexport const hideNotification = createEvent('hide');\nexport const cleanNotifications = createEvent('clean');\nexport const cleanNotificationsQueue = createEvent('cleanQueue');\nexport const updateNotification = createEvent('update');\n\nexport const notifications = {\n show: showNotification,\n hide: hideNotification,\n clean: cleanNotifications,\n cleanQueue: cleanNotificationsQueue,\n update: updateNotification,\n};\n"],"names":["createUseExternalEvents"],"mappings":";;;;;;AACY,MAAC,CAAC,sBAAsB,EAAE,WAAW,CAAC,GAAGA,6BAAuB,CAAC,uBAAuB,EAAE;AAC1F,MAAC,gBAAgB,GAAG,WAAW,CAAC,MAAM,EAAE;AACxC,MAAC,gBAAgB,GAAG,WAAW,CAAC,MAAM,EAAE;AACxC,MAAC,kBAAkB,GAAG,WAAW,CAAC,OAAO,EAAE;AAC3C,MAAC,uBAAuB,GAAG,WAAW,CAAC,YAAY,EAAE;AACrD,MAAC,kBAAkB,GAAG,WAAW,CAAC,QAAQ,EAAE;AAC5C,MAAC,aAAa,GAAG;AAC7B,EAAE,IAAI,EAAE,gBAAgB;AACxB,EAAE,IAAI,EAAE,gBAAgB;AACxB,EAAE,KAAK,EAAE,kBAAkB;AAC3B,EAAE,UAAU,EAAE,uBAAuB;AACrC,EAAE,MAAM,EAAE,kBAAkB;AAC5B;;;;;;;;;;;"}
package/cjs/index.js CHANGED
@@ -2,17 +2,16 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var useNotifications = require('./use-notifications/use-notifications.js');
6
- var NotificationsProvider = require('./NotificationsProvider/NotificationsProvider.js');
5
+ var Notifications = require('./Notifications/Notifications.js');
7
6
  var events = require('./events.js');
8
7
 
9
8
 
10
9
 
11
- exports.useNotifications = useNotifications.useNotifications;
12
- exports.NotificationsProvider = NotificationsProvider.NotificationsProvider;
10
+ exports.Notifications = Notifications.Notifications;
13
11
  exports.cleanNotifications = events.cleanNotifications;
14
12
  exports.cleanNotificationsQueue = events.cleanNotificationsQueue;
15
13
  exports.hideNotification = events.hideNotification;
14
+ exports.notifications = events.notifications;
16
15
  exports.showNotification = events.showNotification;
17
16
  exports.updateNotification = events.updateNotification;
18
17
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
@@ -1,13 +1,12 @@
1
1
  import React, { useRef } from 'react';
2
2
  import { Transition, TransitionGroup } from 'react-transition-group';
3
- import { getDefaultZIndex, Portal, Box } from '@mantine/core';
3
+ import { rem, getDefaultZIndex, Portal, Box } from '@mantine/core';
4
4
  import { useForceUpdate, useReducedMotion, useDidUpdate } from '@mantine/hooks';
5
- import { NotificationsContext } from '../Notifications.context.js';
6
5
  import { useNotificationsEvents } from '../events.js';
7
6
  import getPositionStyles from './get-position-styles/get-position-styles.js';
8
7
  import getNotificationStateStyles from './get-notification-state-styles/get-notification-state-styles.js';
9
8
  import NotificationContainer from '../NotificationContainer/NotificationContainer.js';
10
- import useStyles from './NotificationsProvider.styles.js';
9
+ import useStyles from './Notifications.styles.js';
11
10
  import useNotificationsState from './use-notifications-state/use-notifications-state.js';
12
11
 
13
12
  var __defProp = Object.defineProperty;
@@ -46,14 +45,14 @@ const POSITIONS = [
46
45
  "bottom-right",
47
46
  "bottom-center"
48
47
  ];
49
- function NotificationsProvider(_a) {
48
+ function Notifications(_a) {
50
49
  var _b = _a, {
51
50
  className,
52
51
  position = "bottom-right",
53
52
  autoClose = 4e3,
54
53
  transitionDuration = 250,
55
- containerWidth = 440,
56
- notificationMaxHeight = 200,
54
+ containerWidth = rem(440),
55
+ notificationMaxHeight = rem(200),
57
56
  limit = 5,
58
57
  zIndex = getDefaultZIndex("overlay"),
59
58
  style,
@@ -77,7 +76,6 @@ function NotificationsProvider(_a) {
77
76
  const previousLength = useRef(0);
78
77
  const {
79
78
  notifications,
80
- queue,
81
79
  showNotification,
82
80
  updateNotification,
83
81
  hideNotification,
@@ -125,9 +123,7 @@ function NotificationsProvider(_a) {
125
123
  ...Array.isArray(notification.sx) ? notification.sx : [notification.sx]
126
124
  ]
127
125
  })));
128
- return /* @__PURE__ */ React.createElement(NotificationsContext.Provider, {
129
- value: { notifications, queue }
130
- }, /* @__PURE__ */ React.createElement(Portal, {
126
+ return /* @__PURE__ */ React.createElement(Portal, {
131
127
  target
132
128
  }, /* @__PURE__ */ React.createElement(Box, __spreadValues({
133
129
  className: cx(classes.notifications, className),
@@ -135,9 +131,9 @@ function NotificationsProvider(_a) {
135
131
  sx: __spreadValues({
136
132
  maxWidth: containerWidth
137
133
  }, getPositionStyles(positioning, theme.spacing.md))
138
- }, others), /* @__PURE__ */ React.createElement(TransitionGroup, null, items))), children);
134
+ }, others), /* @__PURE__ */ React.createElement(TransitionGroup, null, items)));
139
135
  }
140
- NotificationsProvider.displayName = "@mantine/notifications/NotificationsProvider";
136
+ Notifications.displayName = "@mantine/notifications/Notifications";
141
137
 
142
- export { NotificationsProvider };
143
- //# sourceMappingURL=NotificationsProvider.js.map
138
+ export { Notifications };
139
+ //# sourceMappingURL=Notifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Notifications.js","sources":["../../src/Notifications/Notifications.tsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport { Transition, TransitionGroup } from 'react-transition-group';\nimport {\n DefaultProps,\n Portal,\n MantineStyleSystemSize,\n getDefaultZIndex,\n Box,\n PortalProps,\n rem,\n} from '@mantine/core';\nimport { useReducedMotion, useForceUpdate, useDidUpdate } from '@mantine/hooks';\nimport { NotificationsPositioning } from '../types';\nimport { useNotificationsEvents } from '../events';\nimport getPositionStyles from './get-position-styles/get-position-styles';\nimport getNotificationStateStyles from './get-notification-state-styles/get-notification-state-styles';\nimport NotificationContainer from '../NotificationContainer/NotificationContainer';\nimport useStyles from './Notifications.styles';\nimport useNotificationsState from './use-notifications-state/use-notifications-state';\n\nconst POSITIONS = [\n 'top-left',\n 'top-right',\n 'top-center',\n 'bottom-left',\n 'bottom-right',\n 'bottom-center',\n] as const;\n\nexport interface NotificationsProps\n extends Omit<DefaultProps, MantineStyleSystemSize>,\n React.ComponentPropsWithoutRef<'div'> {\n /** Notifications position */\n position?:\n | 'top-left'\n | 'top-right'\n | 'top-center'\n | 'bottom-left'\n | 'bottom-right'\n | 'bottom-center';\n\n /** Auto close timeout for all notifications, false to disable auto close, can be overwritten for individual notifications by notifications.show function */\n autoClose?: number | false;\n\n /** Notification transitions duration, 0 to turn transitions off */\n transitionDuration?: number;\n\n /** Notification width, cannot exceed 100% */\n containerWidth?: number | string;\n\n /** Notification max-height, used for transitions */\n notificationMaxHeight?: number | string;\n\n /** Maximum amount of notifications displayed at a time, other new notifications will be added to queue */\n limit?: number;\n\n /** Notifications container z-index */\n zIndex?: React.CSSProperties['zIndex'];\n\n /** Target element of Portal component */\n target?: PortalProps['target'];\n}\n\nexport function Notifications({\n className,\n position = 'bottom-right',\n autoClose = 4000,\n transitionDuration = 250,\n containerWidth = rem(440),\n notificationMaxHeight = rem(200),\n limit = 5,\n zIndex = getDefaultZIndex('overlay'),\n style,\n children,\n target,\n ...others\n}: NotificationsProps) {\n const forceUpdate = useForceUpdate();\n const refs = useRef<Record<string, HTMLDivElement>>({});\n const previousLength = useRef<number>(0);\n const {\n notifications,\n showNotification,\n updateNotification,\n hideNotification,\n clean,\n cleanQueue,\n } = useNotificationsState({ limit });\n\n const { classes, cx, theme } = useStyles({ zIndex });\n const shouldReduceMotion = useReducedMotion();\n const reduceMotion = theme.respectReducedMotion ? shouldReduceMotion : false;\n const duration = reduceMotion ? 1 : transitionDuration;\n const positioning = (POSITIONS.includes(position) ? position : 'bottom-right').split(\n '-'\n ) as NotificationsPositioning;\n\n useDidUpdate(() => {\n if (notifications.length > previousLength.current) {\n setTimeout(() => forceUpdate(), 0);\n }\n previousLength.current = notifications.length;\n }, [notifications]);\n\n useNotificationsEvents({\n show: showNotification,\n hide: hideNotification,\n update: updateNotification,\n clean,\n cleanQueue,\n });\n\n const items = notifications.map((notification) => (\n <Transition\n key={notification.id}\n timeout={duration}\n onEnter={() => refs.current[notification.id].offsetHeight}\n nodeRef={{ current: refs.current[notification.id] }}\n >\n {(state) => (\n <NotificationContainer\n innerRef={(node) => {\n refs.current[notification.id] = node;\n }}\n notification={notification}\n onHide={hideNotification}\n className={classes.notification}\n autoClose={autoClose}\n sx={[\n {\n ...getNotificationStateStyles({\n state,\n positioning,\n transitionDuration: duration,\n maxHeight: notificationMaxHeight,\n }),\n },\n ...(Array.isArray(notification.sx) ? notification.sx : [notification.sx]),\n ]}\n />\n )}\n </Transition>\n ));\n\n return (\n <Portal target={target}>\n <Box\n className={cx(classes.notifications, className)}\n style={style}\n sx={{\n maxWidth: containerWidth,\n ...getPositionStyles(positioning, theme.spacing.md),\n }}\n {...others}\n >\n <TransitionGroup>{items}</TransitionGroup>\n </Box>\n </Portal>\n );\n}\n\nNotifications.displayName = '@mantine/notifications/Notifications';\n"],"names":[],"mappings":";;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,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,CA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AAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC;AACD,aAAa,CAAC,WAAW,GAAG,sCAAsC;;;;"}
@@ -2,7 +2,7 @@ import { createStyles } from '@mantine/core';
2
2
 
3
3
  var useStyles = createStyles((theme, { zIndex }) => ({
4
4
  notifications: {
5
- width: `calc(100% - ${theme.spacing.md * 2}px)`,
5
+ width: `calc(100% - ${theme.spacing.md} * 2)`,
6
6
  boxSizing: "border-box",
7
7
  position: "fixed",
8
8
  zIndex
@@ -15,4 +15,4 @@ var useStyles = createStyles((theme, { zIndex }) => ({
15
15
  }));
16
16
 
17
17
  export default useStyles;
18
- //# sourceMappingURL=NotificationsProvider.styles.js.map
18
+ //# sourceMappingURL=Notifications.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Notifications.styles.js","sources":["../../src/Notifications/Notifications.styles.ts"],"sourcesContent":["import { createStyles } from '@mantine/core';\n\ninterface NotificationsStylesParams {\n zIndex: React.CSSProperties['zIndex'];\n}\n\nexport default createStyles((theme, { zIndex }: NotificationsStylesParams) => ({\n notifications: {\n width: `calc(100% - ${theme.spacing.md} * 2)`,\n boxSizing: 'border-box',\n position: 'fixed',\n zIndex,\n },\n\n notification: {\n '&:not(:first-of-type)': {\n marginTop: theme.spacing.sm,\n },\n },\n}));\n"],"names":[],"mappings":";;AACA,gBAAe,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM;AACpD,EAAE,aAAa,EAAE;AACjB,IAAI,KAAK,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC;AACjD,IAAI,SAAS,EAAE,YAAY;AAC3B,IAAI,QAAQ,EAAE,OAAO;AACrB,IAAI,MAAM;AACV,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,uBAAuB,EAAE;AAC7B,MAAM,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE;AACjC,KAAK;AACL,GAAG;AACH,CAAC,CAAC,CAAC;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-notification-state-styles.js","sources":["../../../src/Notifications/get-notification-state-styles/get-notification-state-styles.ts"],"sourcesContent":["import { TransitionStatus } from 'react-transition-group';\nimport { CSSObject } from '@mantine/core';\nimport { NotificationsPositioning } from '../../types';\n\ninterface NotificationStateStylesProps {\n state: TransitionStatus;\n maxHeight: number | string;\n positioning: NotificationsPositioning;\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 default function getNotificationStateStyles({\n state,\n maxHeight,\n positioning,\n transitionDuration,\n}: NotificationStateStylesProps): CSSObject {\n const [vertical, horizontal] = positioning;\n const property = horizontal === 'center' ? `${vertical}-center` : horizontal;\n\n const commonStyles: CSSObject = {\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: CSSObject = {\n opacity: 1,\n transform: noTransform[property],\n };\n\n const outState: CSSObject = {\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] };\n}\n"],"names":[],"mappings":"AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI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1 @@
1
+ {"version":3,"file":"get-position-styles.js","sources":["../../../src/Notifications/get-position-styles/get-position-styles.ts"],"sourcesContent":["import { CSSObject } from '@mantine/core';\nimport { NotificationsPositioning } from '../../types';\n\nexport default function getPositionStyles(\n [vertical, horizontal]: NotificationsPositioning,\n spacing: number | string\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,OAAO,EAAE;AAC3E,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;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-notifications-state.js","sources":["../../../src/Notifications/use-notifications-state/use-notifications-state.ts"],"sourcesContent":["import { useQueue, randomId } from '@mantine/hooks';\nimport { NotificationProps } from '../../types';\n\nexport default function useNotificationsState({ limit }: { limit: number }) {\n const { state, queue, update, cleanQueue } = useQueue<NotificationProps>({\n initialValues: [],\n limit,\n });\n\n const showNotification = (notification: NotificationProps) => {\n const id = notification.id || randomId();\n\n update((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\n const updateNotification = (notification: NotificationProps) =>\n update((notifications) => {\n const index = notifications.findIndex((n) => n.id === notification.id);\n\n if (index === -1) {\n return notifications;\n }\n\n const newNotifications = [...notifications];\n newNotifications[index] = notification;\n\n return newNotifications;\n });\n\n const hideNotification = (id: string) =>\n update((notifications) =>\n notifications.filter((notification) => {\n if (notification.id === id) {\n typeof notification.onClose === 'function' && notification.onClose(notification);\n return false;\n }\n\n return true;\n })\n );\n\n const clean = () => update(() => []);\n\n return {\n notifications: state,\n queue,\n showNotification,\n updateNotification,\n hideNotification,\n cleanQueue,\n clean,\n };\n}\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,IA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GAAG,CAAC;AACJ;;;;"}
package/esm/events.js CHANGED
@@ -6,6 +6,13 @@ const hideNotification = createEvent("hide");
6
6
  const cleanNotifications = createEvent("clean");
7
7
  const cleanNotificationsQueue = createEvent("cleanQueue");
8
8
  const updateNotification = createEvent("update");
9
+ const notifications = {
10
+ show: showNotification,
11
+ hide: hideNotification,
12
+ clean: cleanNotifications,
13
+ cleanQueue: cleanNotificationsQueue,
14
+ update: updateNotification
15
+ };
9
16
 
10
- export { cleanNotifications, cleanNotificationsQueue, createEvent, hideNotification, showNotification, updateNotification, useNotificationsEvents };
17
+ export { cleanNotifications, cleanNotificationsQueue, createEvent, hideNotification, notifications, showNotification, updateNotification, useNotificationsEvents };
11
18
  //# sourceMappingURL=events.js.map
package/esm/events.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sources":["../src/events.ts"],"sourcesContent":["import { createUseExternalEvents } from '@mantine/utils';\nimport type { NotificationProps } from './types';\n\nexport type NotificationsEvents = {\n show(notification: NotificationProps): void;\n hide(id: string): void;\n update(notification: NotificationProps & { id: string }): void;\n clean(): void;\n cleanQueue(): void;\n};\n\nexport const [useNotificationsEvents, createEvent] =\n createUseExternalEvents<NotificationsEvents>('mantine-notifications');\n\nexport const showNotification = createEvent('show');\nexport const hideNotification = createEvent('hide');\nexport const cleanNotifications = createEvent('clean');\nexport const cleanNotificationsQueue = createEvent('cleanQueue');\nexport const updateNotification = createEvent('update');\n"],"names":[],"mappings":";;AACY,MAAC,CAAC,sBAAsB,EAAE,WAAW,CAAC,GAAG,uBAAuB,CAAC,uBAAuB,EAAE;AAC1F,MAAC,gBAAgB,GAAG,WAAW,CAAC,MAAM,EAAE;AACxC,MAAC,gBAAgB,GAAG,WAAW,CAAC,MAAM,EAAE;AACxC,MAAC,kBAAkB,GAAG,WAAW,CAAC,OAAO,EAAE;AAC3C,MAAC,uBAAuB,GAAG,WAAW,CAAC,YAAY,EAAE;AACrD,MAAC,kBAAkB,GAAG,WAAW,CAAC,QAAQ;;;;"}
1
+ {"version":3,"file":"events.js","sources":["../src/events.ts"],"sourcesContent":["import { createUseExternalEvents } from '@mantine/utils';\nimport type { NotificationProps } from './types';\n\nexport type NotificationsEvents = {\n show(notification: NotificationProps): void;\n hide(id: string): void;\n update(notification: NotificationProps & { id: string }): void;\n clean(): void;\n cleanQueue(): void;\n};\n\nexport const [useNotificationsEvents, createEvent] =\n createUseExternalEvents<NotificationsEvents>('mantine-notifications');\n\nexport const showNotification = createEvent('show');\nexport const hideNotification = createEvent('hide');\nexport const cleanNotifications = createEvent('clean');\nexport const cleanNotificationsQueue = createEvent('cleanQueue');\nexport const updateNotification = createEvent('update');\n\nexport const notifications = {\n show: showNotification,\n hide: hideNotification,\n clean: cleanNotifications,\n cleanQueue: cleanNotificationsQueue,\n update: updateNotification,\n};\n"],"names":[],"mappings":";;AACY,MAAC,CAAC,sBAAsB,EAAE,WAAW,CAAC,GAAG,uBAAuB,CAAC,uBAAuB,EAAE;AAC1F,MAAC,gBAAgB,GAAG,WAAW,CAAC,MAAM,EAAE;AACxC,MAAC,gBAAgB,GAAG,WAAW,CAAC,MAAM,EAAE;AACxC,MAAC,kBAAkB,GAAG,WAAW,CAAC,OAAO,EAAE;AAC3C,MAAC,uBAAuB,GAAG,WAAW,CAAC,YAAY,EAAE;AACrD,MAAC,kBAAkB,GAAG,WAAW,CAAC,QAAQ,EAAE;AAC5C,MAAC,aAAa,GAAG;AAC7B,EAAE,IAAI,EAAE,gBAAgB;AACxB,EAAE,IAAI,EAAE,gBAAgB;AACxB,EAAE,KAAK,EAAE,kBAAkB;AAC3B,EAAE,UAAU,EAAE,uBAAuB;AACrC,EAAE,MAAM,EAAE,kBAAkB;AAC5B;;;;"}
package/esm/index.js CHANGED
@@ -1,4 +1,3 @@
1
- export { useNotifications } from './use-notifications/use-notifications.js';
2
- export { NotificationsProvider } from './NotificationsProvider/NotificationsProvider.js';
3
- export { cleanNotifications, cleanNotificationsQueue, hideNotification, showNotification, updateNotification } from './events.js';
1
+ export { Notifications } from './Notifications/Notifications.js';
2
+ export { cleanNotifications, cleanNotificationsQueue, hideNotification, notifications, showNotification, updateNotification } from './events.js';
4
3
  //# sourceMappingURL=index.js.map
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,27 +1,25 @@
1
1
  import React from 'react';
2
2
  import { DefaultProps, MantineStyleSystemSize, PortalProps } from '@mantine/core';
3
- export interface NotificationProviderProps extends Omit<DefaultProps, MantineStyleSystemSize>, React.ComponentPropsWithoutRef<'div'> {
3
+ export interface NotificationsProps extends Omit<DefaultProps, MantineStyleSystemSize>, React.ComponentPropsWithoutRef<'div'> {
4
4
  /** Notifications position */
5
5
  position?: 'top-left' | 'top-right' | 'top-center' | 'bottom-left' | 'bottom-right' | 'bottom-center';
6
- /** Auto close timeout for all notifications, false to disable auto close, can be overwritten for individual notifications by showNotification function */
6
+ /** Auto close timeout for all notifications, false to disable auto close, can be overwritten for individual notifications by notifications.show function */
7
7
  autoClose?: number | false;
8
8
  /** Notification transitions duration, 0 to turn transitions off */
9
9
  transitionDuration?: number;
10
- /** Notification width in px, cannot exceed 100% */
11
- containerWidth?: number;
12
- /** Notification max-height in px, used for transitions */
13
- notificationMaxHeight?: number;
10
+ /** Notification width, cannot exceed 100% */
11
+ containerWidth?: number | string;
12
+ /** Notification max-height, used for transitions */
13
+ notificationMaxHeight?: number | string;
14
14
  /** Maximum amount of notifications displayed at a time, other new notifications will be added to queue */
15
15
  limit?: number;
16
16
  /** Notifications container z-index */
17
17
  zIndex?: React.CSSProperties['zIndex'];
18
- /** Your application */
19
- children?: React.ReactNode;
20
18
  /** Target element of Portal component */
21
19
  target?: PortalProps['target'];
22
20
  }
23
- export declare function NotificationsProvider({ className, position, autoClose, transitionDuration, containerWidth, notificationMaxHeight, limit, zIndex, style, children, target, ...others }: NotificationProviderProps): JSX.Element;
24
- export declare namespace NotificationsProvider {
21
+ export declare function Notifications({ className, position, autoClose, transitionDuration, containerWidth, notificationMaxHeight, limit, zIndex, style, children, target, ...others }: NotificationsProps): JSX.Element;
22
+ export declare namespace Notifications {
25
23
  var displayName: string;
26
24
  }
27
- //# sourceMappingURL=NotificationsProvider.d.ts.map
25
+ //# sourceMappingURL=Notifications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Notifications.d.ts","sourceRoot":"","sources":["../../src/Notifications/Notifications.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAEtC,OAAO,EACL,YAAY,EAEZ,sBAAsB,EAGtB,WAAW,EAEZ,MAAM,eAAe,CAAC;AAmBvB,MAAM,WAAW,kBACf,SAAQ,IAAI,CAAC,YAAY,EAAE,sBAAsB,CAAC,EAChD,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC;IACvC,6BAA6B;IAC7B,QAAQ,CAAC,EACL,UAAU,GACV,WAAW,GACX,YAAY,GACZ,aAAa,GACb,cAAc,GACd,eAAe,CAAC;IAEpB,4JAA4J;IAC5J,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAE3B,mEAAmE;IACnE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,6CAA6C;IAC7C,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEjC,oDAAoD;IACpD,qBAAqB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAExC,0GAA0G;IAC1G,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,sCAAsC;IACtC,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAEvC,yCAAyC;IACzC,MAAM,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;CAChC;AAED,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,QAAyB,EACzB,SAAgB,EAChB,kBAAwB,EACxB,cAAyB,EACzB,qBAAgC,EAChC,KAAS,EACT,MAAoC,EACpC,KAAK,EACL,QAAQ,EACR,MAAM,EACN,GAAG,MAAM,EACV,EAAE,kBAAkB,eAmFpB;yBAhGe,aAAa"}
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
- interface NotificationsProviderStylesParams {
2
+ interface NotificationsStylesParams {
3
3
  zIndex: React.CSSProperties['zIndex'];
4
4
  }
5
- declare const _default: (params: NotificationsProviderStylesParams, options?: import("@mantine/core").UseStylesOptions<string>) => {
5
+ declare const _default: (params: NotificationsStylesParams, options?: import("@mantine/core").UseStylesOptions<string>) => {
6
6
  classes: {
7
7
  notifications: string;
8
8
  notification: string;
@@ -11,4 +11,4 @@ declare const _default: (params: NotificationsProviderStylesParams, options?: im
11
11
  theme: import("@mantine/core").MantineTheme;
12
12
  };
13
13
  export default _default;
14
- //# sourceMappingURL=NotificationsProvider.styles.d.ts.map
14
+ //# sourceMappingURL=Notifications.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Notifications.styles.d.ts","sourceRoot":"","sources":["../../src/Notifications/Notifications.styles.ts"],"names":[],"mappings":";AAEA,UAAU,yBAAyB;IACjC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;CACvC;;;;;;;;;AAED,wBAaI"}
@@ -1,10 +1,10 @@
1
1
  import { TransitionStatus } from 'react-transition-group';
2
2
  import { CSSObject } from '@mantine/core';
3
- import { NotificationsProviderPositioning } from '../../types';
3
+ import { NotificationsPositioning } from '../../types';
4
4
  interface NotificationStateStylesProps {
5
5
  state: TransitionStatus;
6
- maxHeight: number;
7
- positioning: NotificationsProviderPositioning;
6
+ maxHeight: number | string;
7
+ positioning: NotificationsPositioning;
8
8
  transitionDuration: number;
9
9
  }
10
10
  export default function getNotificationStateStyles({ state, maxHeight, positioning, transitionDuration, }: NotificationStateStylesProps): CSSObject;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-notification-state-styles.d.ts","sourceRoot":"","sources":["../../../src/Notifications/get-notification-state-styles/get-notification-state-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,UAAU,4BAA4B;IACpC,KAAK,EAAE,gBAAgB,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,WAAW,EAAE,wBAAwB,CAAC;IACtC,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAgBD,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAC,EACjD,KAAK,EACL,SAAS,EACT,WAAW,EACX,kBAAkB,GACnB,EAAE,4BAA4B,GAAG,SAAS,CAgC1C"}
@@ -0,0 +1,4 @@
1
+ import { CSSObject } from '@mantine/core';
2
+ import { NotificationsPositioning } from '../../types';
3
+ export default function getPositionStyles([vertical, horizontal]: NotificationsPositioning, spacing: number | string): CSSObject;
4
+ //# sourceMappingURL=get-position-styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-position-styles.d.ts","sourceRoot":"","sources":["../../../src/Notifications/get-position-styles/get-position-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,wBAAwB,EAChD,OAAO,EAAE,MAAM,GAAG,MAAM,aAYzB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-notifications-state.d.ts","sourceRoot":"","sources":["../../../src/Notifications/use-notifications-state/use-notifications-state.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE;;;qCAMhC,iBAAiB;uCAcf,iBAAiB;2BAc7B,MAAM;;;EAuBrC"}
package/lib/events.d.ts CHANGED
@@ -16,4 +16,13 @@ export declare const cleanNotificationsQueue: (payload_0?: undefined) => void;
16
16
  export declare const updateNotification: (payload_0: NotificationProps & {
17
17
  id: string;
18
18
  }) => void;
19
+ export declare const notifications: {
20
+ show: (payload_0: NotificationProps) => void;
21
+ hide: (payload_0: string) => void;
22
+ clean: (payload_0?: undefined) => void;
23
+ cleanQueue: (payload_0?: undefined) => void;
24
+ update: (payload_0: NotificationProps & {
25
+ id: string;
26
+ }) => void;
27
+ };
19
28
  //# sourceMappingURL=events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,CAAC,YAAY,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC5C,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,CAAC,YAAY,EAAE,iBAAiB,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/D,KAAK,IAAI,IAAI,CAAC;IACd,UAAU,IAAI,IAAI,CAAC;CACpB,CAAC;AAEF,eAAO,MAAO,sBAAsB,yCAAE,WAAW,uNACsB,CAAC;AAExE,eAAO,MAAM,gBAAgB,wCAAsB,CAAC;AACpD,eAAO,MAAM,gBAAgB,6BAAsB,CAAC;AACpD,eAAO,MAAM,kBAAkB,iCAAuB,CAAC;AACvD,eAAO,MAAM,uBAAuB,iCAA4B,CAAC;AACjE,eAAO,MAAM,kBAAkB;QAZkB,MAAM;UAYA,CAAC"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,CAAC,YAAY,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC5C,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,CAAC,YAAY,EAAE,iBAAiB,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC/D,KAAK,IAAI,IAAI,CAAC;IACd,UAAU,IAAI,IAAI,CAAC;CACpB,CAAC;AAEF,eAAO,MAAO,sBAAsB,yCAAE,WAAW,uNACsB,CAAC;AAExE,eAAO,MAAM,gBAAgB,wCAAsB,CAAC;AACpD,eAAO,MAAM,gBAAgB,6BAAsB,CAAC;AACpD,eAAO,MAAM,kBAAkB,iCAAuB,CAAC;AACvD,eAAO,MAAM,uBAAuB,iCAA4B,CAAC;AACjE,eAAO,MAAM,kBAAkB;QAZkB,MAAM;UAYA,CAAC;AAExD,eAAO,MAAM,aAAa;;;;;;YAduB,MAAM;;CAoBtD,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- export { useNotifications } from './use-notifications/use-notifications';
2
- export { NotificationsProvider } from './NotificationsProvider/NotificationsProvider';
3
- export { showNotification, updateNotification, hideNotification, cleanNotifications, cleanNotificationsQueue, } from './events';
1
+ export { Notifications } from './Notifications/Notifications';
2
+ export { showNotification, updateNotification, hideNotification, cleanNotifications, cleanNotificationsQueue, notifications, } from './events';
4
3
  export type { NotificationProps } from './types';
5
- export type { NotificationProviderProps } from './NotificationsProvider/NotificationsProvider';
4
+ export type { NotificationsProps } from './Notifications/Notifications';
6
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,YAAY,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,GACd,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC"}
package/lib/types.d.ts CHANGED
@@ -11,5 +11,5 @@ export interface NotificationsContextProps {
11
11
  notifications: NotificationProps[];
12
12
  queue: NotificationProps[];
13
13
  }
14
- export type NotificationsProviderPositioning = ['top' | 'bottom', 'left' | 'right' | 'center'];
14
+ export type NotificationsPositioning = ['top' | 'bottom', 'left' | 'right' | 'center'];
15
15
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,iBAAiB,IAAI,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAErF,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,0BAA0B,EAAE,SAAS,CAAC;IACpF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,OAAO,CAAC,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACzC,MAAM,CAAC,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACzC;AAED,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,iBAAiB,EAAE,CAAC;IACnC,KAAK,EAAE,iBAAiB,EAAE,CAAC;CAC5B;AAED,MAAM,MAAM,gCAAgC,GAAG,CAAC,KAAK,GAAG,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,iBAAiB,IAAI,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAErF,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,0BAA0B,EAAE,SAAS,CAAC;IACpF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,OAAO,CAAC,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACzC,MAAM,CAAC,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACzC;AAED,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,iBAAiB,EAAE,CAAC;IACnC,KAAK,EAAE,iBAAiB,EAAE,CAAC;CAC5B;AAED,MAAM,MAAM,wBAAwB,GAAG,CAAC,KAAK,GAAG,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC,CAAC"}
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": "5.10.2",
4
+ "version": "6.0.0-alpha.1",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -28,14 +28,14 @@
28
28
  "notification-system"
29
29
  ],
30
30
  "peerDependencies": {
31
- "@mantine/core": "5.10.2",
32
- "@mantine/hooks": "5.10.2",
31
+ "@mantine/core": "6.0.0-alpha.1",
32
+ "@mantine/hooks": "6.0.0-alpha.1",
33
33
  "react": ">=16.8.0",
34
34
  "react-dom": ">=16.8.0"
35
35
  },
36
36
  "dependencies": {
37
37
  "react-transition-group": "4.4.2",
38
- "@mantine/utils": "5.10.2"
38
+ "@mantine/utils": "6.0.0-alpha.1"
39
39
  },
40
40
  "devDependencies": {}
41
41
  }
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
-
7
- const NotificationsContext = React.createContext(null);
8
- NotificationsContext.displayName = "@mantine/notifications/NotificationsContext";
9
-
10
- exports.NotificationsContext = NotificationsContext;
11
- //# sourceMappingURL=Notifications.context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Notifications.context.js","sources":["../src/Notifications.context.ts"],"sourcesContent":["import { createContext } from 'react';\nimport { NotificationsContextProps } from './types';\n\nexport const NotificationsContext = createContext<NotificationsContextProps>(null);\nNotificationsContext.displayName = '@mantine/notifications/NotificationsContext';\n"],"names":["createContext"],"mappings":";;;;;;AACY,MAAC,oBAAoB,GAAGA,mBAAa,CAAC,IAAI,EAAE;AACxD,oBAAoB,CAAC,WAAW,GAAG,6CAA6C;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationsProvider.js","sources":["../../src/NotificationsProvider/NotificationsProvider.tsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport { Transition, TransitionGroup } from 'react-transition-group';\nimport {\n DefaultProps,\n Portal,\n MantineStyleSystemSize,\n getDefaultZIndex,\n Box,\n PortalProps,\n} from '@mantine/core';\nimport { useReducedMotion, useForceUpdate, useDidUpdate } from '@mantine/hooks';\nimport { NotificationsContext } from '../Notifications.context';\nimport { NotificationsProviderPositioning } from '../types';\nimport { useNotificationsEvents } from '../events';\nimport getPositionStyles from './get-position-styles/get-position-styles';\nimport getNotificationStateStyles from './get-notification-state-styles/get-notification-state-styles';\nimport NotificationContainer from '../NotificationContainer/NotificationContainer';\nimport useStyles from './NotificationsProvider.styles';\nimport useNotificationsState from './use-notifications-state/use-notifications-state';\n\nconst POSITIONS = [\n 'top-left',\n 'top-right',\n 'top-center',\n 'bottom-left',\n 'bottom-right',\n 'bottom-center',\n] as const;\n\nexport interface NotificationProviderProps\n extends Omit<DefaultProps, MantineStyleSystemSize>,\n React.ComponentPropsWithoutRef<'div'> {\n /** Notifications position */\n position?:\n | 'top-left'\n | 'top-right'\n | 'top-center'\n | 'bottom-left'\n | 'bottom-right'\n | 'bottom-center';\n\n /** Auto close timeout for all notifications, false to disable auto close, can be overwritten for individual notifications by showNotification function */\n autoClose?: number | false;\n\n /** Notification transitions duration, 0 to turn transitions off */\n transitionDuration?: number;\n\n /** Notification width in px, cannot exceed 100% */\n containerWidth?: number;\n\n /** Notification max-height in px, used for transitions */\n notificationMaxHeight?: number;\n\n /** Maximum amount of notifications displayed at a time, other new notifications will be added to queue */\n limit?: number;\n\n /** Notifications container z-index */\n zIndex?: React.CSSProperties['zIndex'];\n\n /** Your application */\n children?: React.ReactNode;\n\n /** Target element of Portal component */\n target?: PortalProps['target'];\n}\n\nexport function NotificationsProvider({\n className,\n position = 'bottom-right',\n autoClose = 4000,\n transitionDuration = 250,\n containerWidth = 440,\n notificationMaxHeight = 200,\n limit = 5,\n zIndex = getDefaultZIndex('overlay'),\n style,\n children,\n target,\n ...others\n}: NotificationProviderProps) {\n const forceUpdate = useForceUpdate();\n const refs = useRef<Record<string, HTMLDivElement>>({});\n const previousLength = useRef<number>(0);\n const {\n notifications,\n queue,\n showNotification,\n updateNotification,\n hideNotification,\n clean,\n cleanQueue,\n } = useNotificationsState({ limit });\n\n const { classes, cx, theme } = useStyles({ zIndex });\n const shouldReduceMotion = useReducedMotion();\n const reduceMotion = theme.respectReducedMotion ? shouldReduceMotion : false;\n const duration = reduceMotion ? 1 : transitionDuration;\n const positioning = (POSITIONS.includes(position) ? position : 'bottom-right').split(\n '-'\n ) as NotificationsProviderPositioning;\n\n useDidUpdate(() => {\n if (notifications.length > previousLength.current) {\n setTimeout(() => forceUpdate(), 0);\n }\n previousLength.current = notifications.length;\n }, [notifications]);\n\n useNotificationsEvents({\n show: showNotification,\n hide: hideNotification,\n update: updateNotification,\n clean,\n cleanQueue,\n });\n\n const items = notifications.map((notification) => (\n <Transition\n key={notification.id}\n timeout={duration}\n onEnter={() => refs.current[notification.id].offsetHeight}\n nodeRef={{ current: refs.current[notification.id] }}\n >\n {(state) => (\n <NotificationContainer\n innerRef={(node) => {\n refs.current[notification.id] = node;\n }}\n notification={notification}\n onHide={hideNotification}\n className={classes.notification}\n autoClose={autoClose}\n sx={[\n {\n ...getNotificationStateStyles({\n state,\n positioning,\n transitionDuration: duration,\n maxHeight: notificationMaxHeight,\n }),\n },\n ...(Array.isArray(notification.sx) ? notification.sx : [notification.sx]),\n ]}\n />\n )}\n </Transition>\n ));\n\n return (\n <NotificationsContext.Provider value={{ notifications, queue }}>\n <Portal target={target}>\n <Box\n className={cx(classes.notifications, className)}\n style={style}\n sx={{\n maxWidth: containerWidth,\n ...getPositionStyles(positioning, theme.spacing.md),\n }}\n {...others}\n >\n <TransitionGroup>{items}</TransitionGroup>\n </Box>\n </Portal>\n\n {children}\n </NotificationsContext.Provider>\n );\n}\n\nNotificationsProvider.displayName = '@mantine/notifications/NotificationsProvider';\n"],"names":["getDefaultZIndex","useForceUpdate","useRef","useNotificationsState","useStyles","useReducedMotion","useDidUpdate","useNotificationsEvents","React","Transition","NotificationContainer","getNotificationStateStyles","NotificationsContext","Portal","Box","getPositionStyles","TransitionGroup"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,mBAAmB,GAAG,MAAM,CAAC,q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H,cAAK,CAAC,aAAa,CAACI,0CAAoB,CAAC,QAAQ,EAAE;AAC5E,IAAI,KAAK,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE;AACnC,GAAG,kBAAkBJ,cAAK,CAAC,aAAa,CAACK,WAAM,EAAE;AACjD,IAAI,MAAM;AACV,GAAG,kBAAkBL,cAAK,CAAC,aAAa,CAACM,QAAG,EAAE,cAAc,CAAC;AAC7D,IAAI,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,SAAS,CAAC;AACnD,IAAI,KAAK;AACT,IAAI,EAAE,EAAE,cAAc,CAAC;AACvB,MAAM,QAAQ,EAAE,cAAc;AAC9B,KAAK,EAAEC,4BAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AACxD,GAAG,EAAE,MAAM,CAAC,kBAAkBP,cAAK,CAAC,aAAa,CAACQ,oCAAe,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AAC7F,CAAC;AACD,qBAAqB,CAAC,WAAW,GAAG,8CAA8C;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationsProvider.styles.js","sources":["../../src/NotificationsProvider/NotificationsProvider.styles.ts"],"sourcesContent":["import { createStyles } from '@mantine/core';\n\ninterface NotificationsProviderStylesParams {\n zIndex: React.CSSProperties['zIndex'];\n}\n\nexport default createStyles((theme, { zIndex }: NotificationsProviderStylesParams) => ({\n notifications: {\n width: `calc(100% - ${theme.spacing.md * 2}px)`,\n boxSizing: 'border-box',\n position: 'fixed',\n zIndex,\n },\n\n notification: {\n '&:not(:first-of-type)': {\n marginTop: theme.spacing.sm,\n },\n },\n}));\n"],"names":["createStyles"],"mappings":";;;;;;AACA,gBAAeA,iBAAY,CAAC,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM;AACpD,EAAE,aAAa,EAAE;AACjB,IAAI,KAAK,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC;AACnD,IAAI,SAAS,EAAE,YAAY;AAC3B,IAAI,QAAQ,EAAE,OAAO;AACrB,IAAI,MAAM;AACV,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,uBAAuB,EAAE;AAC7B,MAAM,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE;AACjC,KAAK;AACL,GAAG;AACH,CAAC,CAAC,CAAC;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-notification-state-styles.js","sources":["../../../src/NotificationsProvider/get-notification-state-styles/get-notification-state-styles.ts"],"sourcesContent":["import { TransitionStatus } from 'react-transition-group';\nimport { CSSObject } from '@mantine/core';\nimport { NotificationsProviderPositioning } from '../../types';\n\ninterface NotificationStateStylesProps {\n state: TransitionStatus;\n maxHeight: number;\n positioning: NotificationsProviderPositioning;\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 default function getNotificationStateStyles({\n state,\n maxHeight,\n positioning,\n transitionDuration,\n}: NotificationStateStylesProps): CSSObject {\n const [vertical, horizontal] = positioning;\n const property = horizontal === 'center' ? `${vertical}-center` : horizontal;\n\n const commonStyles: CSSObject = {\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: CSSObject = {\n opacity: 1,\n transform: noTransform[property],\n };\n\n const outState: CSSObject = {\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] };\n}\n"],"names":[],"mappings":";;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,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,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAC1C,KAAK;AACL,EAAE,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AACF,MAAM,UAAU,GAAG;AACnB,EAAE,I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gB,GAAG;AAC3B,IAAI,QAAQ,EAAE,OAAO;AACrB,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,OAAO,EAAE,QAAQ;AACrB,IAAI,MAAM,EAAE,QAAQ;AACpB,GAAG,CAAC;AACJ,EAAE,OAAO,cAAc,CAAC,cAAc,CAAC,EAAE,EAAE,YAAY,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;AACnF;;;;"}
@@ -1 +0,0 @@
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 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,OAAO,EAAE;AAC3E,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 +0,0 @@
1
- {"version":3,"file":"use-notifications-state.js","sources":["../../../src/NotificationsProvider/use-notifications-state/use-notifications-state.ts"],"sourcesContent":["import { useQueue, randomId } from '@mantine/hooks';\nimport { NotificationProps } from '../../types';\n\nexport default function useNotificationsState({ limit }: { limit: number }) {\n const { state, queue, update, cleanQueue } = useQueue<NotificationProps>({\n initialValues: [],\n limit,\n });\n\n const showNotification = (notification: NotificationProps) => {\n const id = notification.id || randomId();\n\n update((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\n const updateNotification = (notification: NotificationProps) =>\n update((notifications) => {\n const index = notifications.findIndex((n) => n.id === notification.id);\n\n if (index === -1) {\n return notifications;\n }\n\n const newNotifications = [...notifications];\n newNotifications[index] = notification;\n\n return newNotifications;\n });\n\n const hideNotification = (id: string) =>\n update((notifications) =>\n notifications.filter((notification) => {\n if (notification.id === id) {\n typeof notification.onClose === 'function' && notification.onClose(notification);\n return false;\n }\n\n return true;\n })\n );\n\n const clean = () => update(() => []);\n\n return {\n notifications: state,\n queue,\n showNotification,\n updateNotification,\n hideNotification,\n cleanQueue,\n clean,\n };\n}\n"],"names":["useQueue","randomId"],"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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O,KAAK,CAAC;AACnB,KAAK;AACL,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG,CAAC,CAAC,CAAC;AACN,EAAE,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;AACvC,EAAE,OAAO;AACT,IAAI,aAAa,EAAE,KAAK;AACxB,IAAI,KAAK;AACT,IAAI,gBAAgB;AACpB,IAAI,kBAAkB;AACtB,IAAI,gBAAgB;AACpB,IAAI,UAAU;AACd,IAAI,KAAK;AACT,GAAG,CAAC;AACJ;;;;"}
@@ -1,17 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
- var Notifications_context = require('../Notifications.context.js');
7
-
8
- function useNotifications() {
9
- const context = React.useContext(Notifications_context.NotificationsContext);
10
- if (!context) {
11
- throw new Error("@mantine/notifications: use-notifications hook was called outside of NotificationsProvider context");
12
- }
13
- return context;
14
- }
15
-
16
- exports.useNotifications = useNotifications;
17
- //# sourceMappingURL=use-notifications.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-notifications.js","sources":["../../src/use-notifications/use-notifications.ts"],"sourcesContent":["import { useContext } from 'react';\nimport { NotificationsContext } from '../Notifications.context';\n\nexport function useNotifications() {\n const context = useContext(NotificationsContext);\n\n if (!context) {\n throw new Error(\n '@mantine/notifications: use-notifications hook was called outside of NotificationsProvider context'\n );\n }\n\n return context;\n}\n"],"names":["useContext","NotificationsContext"],"mappings":";;;;;;;AAEO,SAAS,gBAAgB,GAAG;AACnC,EAAE,MAAM,OAAO,GAAGA,gBAAU,CAACC,0CAAoB,CAAC,CAAC;AACnD,EAAE,IAAI,CAAC,OAAO,EAAE;AAChB,IAAI,MAAM,IAAI,KAAK,CAAC,oGAAoG,CAAC,CAAC;AAC1H,GAAG;AACH,EAAE,OAAO,OAAO,CAAC;AACjB;;;;"}
@@ -1,7 +0,0 @@
1
- import { createContext } from 'react';
2
-
3
- const NotificationsContext = createContext(null);
4
- NotificationsContext.displayName = "@mantine/notifications/NotificationsContext";
5
-
6
- export { NotificationsContext };
7
- //# sourceMappingURL=Notifications.context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Notifications.context.js","sources":["../src/Notifications.context.ts"],"sourcesContent":["import { createContext } from 'react';\nimport { NotificationsContextProps } from './types';\n\nexport const NotificationsContext = createContext<NotificationsContextProps>(null);\nNotificationsContext.displayName = '@mantine/notifications/NotificationsContext';\n"],"names":[],"mappings":";;AACY,MAAC,oBAAoB,GAAG,aAAa,CAAC,IAAI,EAAE;AACxD,oBAAoB,CAAC,WAAW,GAAG,6CAA6C;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationsProvider.js","sources":["../../src/NotificationsProvider/NotificationsProvider.tsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport { Transition, TransitionGroup } from 'react-transition-group';\nimport {\n DefaultProps,\n Portal,\n MantineStyleSystemSize,\n getDefaultZIndex,\n Box,\n PortalProps,\n} from '@mantine/core';\nimport { useReducedMotion, useForceUpdate, useDidUpdate } from '@mantine/hooks';\nimport { NotificationsContext } from '../Notifications.context';\nimport { NotificationsProviderPositioning } from '../types';\nimport { useNotificationsEvents } from '../events';\nimport getPositionStyles from './get-position-styles/get-position-styles';\nimport getNotificationStateStyles from './get-notification-state-styles/get-notification-state-styles';\nimport NotificationContainer from '../NotificationContainer/NotificationContainer';\nimport useStyles from './NotificationsProvider.styles';\nimport useNotificationsState from './use-notifications-state/use-notifications-state';\n\nconst POSITIONS = [\n 'top-left',\n 'top-right',\n 'top-center',\n 'bottom-left',\n 'bottom-right',\n 'bottom-center',\n] as const;\n\nexport interface NotificationProviderProps\n extends Omit<DefaultProps, MantineStyleSystemSize>,\n React.ComponentPropsWithoutRef<'div'> {\n /** Notifications position */\n position?:\n | 'top-left'\n | 'top-right'\n | 'top-center'\n | 'bottom-left'\n | 'bottom-right'\n | 'bottom-center';\n\n /** Auto close timeout for all notifications, false to disable auto close, can be overwritten for individual notifications by showNotification function */\n autoClose?: number | false;\n\n /** Notification transitions duration, 0 to turn transitions off */\n transitionDuration?: number;\n\n /** Notification width in px, cannot exceed 100% */\n containerWidth?: number;\n\n /** Notification max-height in px, used for transitions */\n notificationMaxHeight?: number;\n\n /** Maximum amount of notifications displayed at a time, other new notifications will be added to queue */\n limit?: number;\n\n /** Notifications container z-index */\n zIndex?: React.CSSProperties['zIndex'];\n\n /** Your application */\n children?: React.ReactNode;\n\n /** Target element of Portal component */\n target?: PortalProps['target'];\n}\n\nexport function NotificationsProvider({\n className,\n position = 'bottom-right',\n autoClose = 4000,\n transitionDuration = 250,\n containerWidth = 440,\n notificationMaxHeight = 200,\n limit = 5,\n zIndex = getDefaultZIndex('overlay'),\n style,\n children,\n target,\n ...others\n}: NotificationProviderProps) {\n const forceUpdate = useForceUpdate();\n const refs = useRef<Record<string, HTMLDivElement>>({});\n const previousLength = useRef<number>(0);\n const {\n notifications,\n queue,\n showNotification,\n updateNotification,\n hideNotification,\n clean,\n cleanQueue,\n } = useNotificationsState({ limit });\n\n const { classes, cx, theme } = useStyles({ zIndex });\n const shouldReduceMotion = useReducedMotion();\n const reduceMotion = theme.respectReducedMotion ? shouldReduceMotion : false;\n const duration = reduceMotion ? 1 : transitionDuration;\n const positioning = (POSITIONS.includes(position) ? position : 'bottom-right').split(\n '-'\n ) as NotificationsProviderPositioning;\n\n useDidUpdate(() => {\n if (notifications.length > previousLength.current) {\n setTimeout(() => forceUpdate(), 0);\n }\n previousLength.current = notifications.length;\n }, [notifications]);\n\n useNotificationsEvents({\n show: showNotification,\n hide: hideNotification,\n update: updateNotification,\n clean,\n cleanQueue,\n });\n\n const items = notifications.map((notification) => (\n <Transition\n key={notification.id}\n timeout={duration}\n onEnter={() => refs.current[notification.id].offsetHeight}\n nodeRef={{ current: refs.current[notification.id] }}\n >\n {(state) => (\n <NotificationContainer\n innerRef={(node) => {\n refs.current[notification.id] = node;\n }}\n notification={notification}\n onHide={hideNotification}\n className={classes.notification}\n autoClose={autoClose}\n sx={[\n {\n ...getNotificationStateStyles({\n state,\n positioning,\n transitionDuration: duration,\n maxHeight: notificationMaxHeight,\n }),\n },\n ...(Array.isArray(notification.sx) ? notification.sx : [notification.sx]),\n ]}\n />\n )}\n </Transition>\n ));\n\n return (\n <NotificationsContext.Provider value={{ notifications, queue }}>\n <Portal target={target}>\n <Box\n className={cx(classes.notifications, className)}\n style={style}\n sx={{\n maxWidth: containerWidth,\n ...getPositionStyles(positioning, theme.spacing.md),\n }}\n {...others}\n >\n <TransitionGroup>{items}</TransitionGroup>\n </Box>\n </Portal>\n\n {children}\n </NotificationsContext.Provider>\n );\n}\n\nNotificationsProvider.displayName = '@mantine/notifications/NotificationsProvider';\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,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,IAA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;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationsProvider.styles.js","sources":["../../src/NotificationsProvider/NotificationsProvider.styles.ts"],"sourcesContent":["import { createStyles } from '@mantine/core';\n\ninterface NotificationsProviderStylesParams {\n zIndex: React.CSSProperties['zIndex'];\n}\n\nexport default createStyles((theme, { zIndex }: NotificationsProviderStylesParams) => ({\n notifications: {\n width: `calc(100% - ${theme.spacing.md * 2}px)`,\n boxSizing: 'border-box',\n position: 'fixed',\n zIndex,\n },\n\n notification: {\n '&:not(:first-of-type)': {\n marginTop: theme.spacing.sm,\n },\n },\n}));\n"],"names":[],"mappings":";;AACA,gBAAe,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM;AACpD,EAAE,aAAa,EAAE;AACjB,IAAI,KAAK,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC;AACnD,IAAI,SAAS,EAAE,YAAY;AAC3B,IAAI,QAAQ,EAAE,OAAO;AACrB,IAAI,MAAM;AACV,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,uBAAuB,EAAE;AAC7B,MAAM,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE;AACjC,KAAK;AACL,GAAG;AACH,CAAC,CAAC,CAAC;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-notification-state-styles.js","sources":["../../../src/NotificationsProvider/get-notification-state-styles/get-notification-state-styles.ts"],"sourcesContent":["import { TransitionStatus } from 'react-transition-group';\nimport { CSSObject } from '@mantine/core';\nimport { NotificationsProviderPositioning } from '../../types';\n\ninterface NotificationStateStylesProps {\n state: TransitionStatus;\n maxHeight: number;\n positioning: NotificationsProviderPositioning;\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 default function getNotificationStateStyles({\n state,\n maxHeight,\n positioning,\n transitionDuration,\n}: NotificationStateStylesProps): CSSObject {\n const [vertical, horizontal] = positioning;\n const property = horizontal === 'center' ? `${vertical}-center` : horizontal;\n\n const commonStyles: CSSObject = {\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: CSSObject = {\n opacity: 1,\n transform: noTransform[property],\n };\n\n const outState: CSSObject = {\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] };\n}\n"],"names":[],"mappings":"AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,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,KA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,CAAC;AACnC,IAAI,kBAAkB,EAAE,CAAC,EAAE,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,CAAC,EAAE,CAAC;AACnG,IAAI,wBAAwB,EAAE,kEAAkE;AAChG,IAAI,kBAAkB,EAAE,gCAAgC;AACxD,GAAG,CAAC;AACJ,EAAE,MAAM,OAAO,GAAG;AAClB,IAAI,OAAO,EAAE,CAAC;AACd,IAAI,SAAS,EAAE,WAAW,CAAC,QAAQ,CAAC;AACpC,GAAG,CAAC;AACJ,EAAE,MAAM,QAAQ,GAAG;AACnB,IAAI,OAAO,EAAE,CAAC;AACd,IAAI,SAAS,EAAE,CAAC;AAChB,IAAI,SAAS,EAAE,UAAU,CAAC,QAAQ,CAAC;AACnC,GAAG,CAAC;AACJ,EAAE,MAAM,gBAAgB,GAAG;AAC3B,IAAI,QAAQ,EAAE,OAAO;AACrB,IAAI,OAAO,EAAE,OAAO;AACpB,IAAI,OAAO,EAAE,QAAQ;AACrB,IAAI,MAAM,EAAE,QAAQ;AACpB,GAAG,CAAC;AACJ,EAAE,OAAO,cAAc,CAAC,cAAc,CAAC,EAAE,EAAE,YAAY,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;AACnF;;;;"}
@@ -1 +0,0 @@
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 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,OAAO,EAAE;AAC3E,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 +0,0 @@
1
- {"version":3,"file":"use-notifications-state.js","sources":["../../../src/NotificationsProvider/use-notifications-state/use-notifications-state.ts"],"sourcesContent":["import { useQueue, randomId } from '@mantine/hooks';\nimport { NotificationProps } from '../../types';\n\nexport default function useNotificationsState({ limit }: { limit: number }) {\n const { state, queue, update, cleanQueue } = useQueue<NotificationProps>({\n initialValues: [],\n limit,\n });\n\n const showNotification = (notification: NotificationProps) => {\n const id = notification.id || randomId();\n\n update((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\n const updateNotification = (notification: NotificationProps) =>\n update((notifications) => {\n const index = notifications.findIndex((n) => n.id === notification.id);\n\n if (index === -1) {\n return notifications;\n }\n\n const newNotifications = [...notifications];\n newNotifications[index] = notification;\n\n return newNotifications;\n });\n\n const hideNotification = (id: string) =>\n update((notifications) =>\n notifications.filter((notification) => {\n if (notification.id === id) {\n typeof notification.onClose === 'function' && notification.onClose(notification);\n return false;\n }\n\n return true;\n })\n );\n\n const clean = () => update(() => []);\n\n return {\n notifications: state,\n queue,\n showNotification,\n updateNotification,\n hideNotification,\n cleanQueue,\n clean,\n };\n}\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,EAAE,IAAI,EAAE,CAAC,CAA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AM,OAAO,aAAa,CAAC;AAC3B,KAAK;AACL,IAAI,MAAM,gBAAgB,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC;AAChD,IAAI,gBAAgB,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC;AAC3C,IAAI,OAAO,gBAAgB,CAAC;AAC5B,GAAG,CAAC,CAAC;AACL,EAAE,MAAM,gBAAgB,GAAG,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC,aAAa,KAAK,aAAa,CAAC,MAAM,CAAC,CAAC,YAAY,KAAK;AACpG,IAAI,IAAI,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE;AAChC,MAAM,OAAO,YAAY,CAAC,OAAO,KAAK,UAAU,IAAI,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AACvF,MAAM,OAAO,KAAK,CAAC;AACnB,KAAK;AACL,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG,CAAC,CAAC,CAAC;AACN,EAAE,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;AACvC,EAAE,OAAO;AACT,IAAI,aAAa,EAAE,KAAK;AACxB,IAAI,KAAK;AACT,IAAI,gBAAgB;AACpB,IAAI,kBAAkB;AACtB,IAAI,gBAAgB;AACpB,IAAI,UAAU;AACd,IAAI,KAAK;AACT,GAAG,CAAC;AACJ;;;;"}
@@ -1,13 +0,0 @@
1
- import { useContext } from 'react';
2
- import { NotificationsContext } from '../Notifications.context.js';
3
-
4
- function useNotifications() {
5
- const context = useContext(NotificationsContext);
6
- if (!context) {
7
- throw new Error("@mantine/notifications: use-notifications hook was called outside of NotificationsProvider context");
8
- }
9
- return context;
10
- }
11
-
12
- export { useNotifications };
13
- //# sourceMappingURL=use-notifications.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-notifications.js","sources":["../../src/use-notifications/use-notifications.ts"],"sourcesContent":["import { useContext } from 'react';\nimport { NotificationsContext } from '../Notifications.context';\n\nexport function useNotifications() {\n const context = useContext(NotificationsContext);\n\n if (!context) {\n throw new Error(\n '@mantine/notifications: use-notifications hook was called outside of NotificationsProvider context'\n );\n }\n\n return context;\n}\n"],"names":[],"mappings":";;;AAEO,SAAS,gBAAgB,GAAG;AACnC,EAAE,MAAM,OAAO,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;AACnD,EAAE,IAAI,CAAC,OAAO,EAAE;AAChB,IAAI,MAAM,IAAI,KAAK,CAAC,oGAAoG,CAAC,CAAC;AAC1H,GAAG;AACH,EAAE,OAAO,OAAO,CAAC;AACjB;;;;"}
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import { NotificationsContextProps } from './types';
3
- export declare const NotificationsContext: import("react").Context<NotificationsContextProps>;
4
- //# sourceMappingURL=Notifications.context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Notifications.context.d.ts","sourceRoot":"","sources":["../src/Notifications.context.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEpD,eAAO,MAAM,oBAAoB,oDAAiD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationsProvider.d.ts","sourceRoot":"","sources":["../../src/NotificationsProvider/NotificationsProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAEtC,OAAO,EACL,YAAY,EAEZ,sBAAsB,EAGtB,WAAW,EACZ,MAAM,eAAe,CAAC;AAoBvB,MAAM,WAAW,yBACf,SAAQ,IAAI,CAAC,YAAY,EAAE,sBAAsB,CAAC,EAChD,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC;IACvC,6BAA6B;IAC7B,QAAQ,CAAC,EACL,UAAU,GACV,WAAW,GACX,YAAY,GACZ,aAAa,GACb,cAAc,GACd,eAAe,CAAC;IAEpB,0JAA0J;IAC1J,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAE3B,mEAAmE;IACnE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,mDAAmD;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,0DAA0D;IAC1D,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,0GAA0G;IAC1G,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,sCAAsC;IACtC,MAAM,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAEvC,uBAAuB;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE3B,yCAAyC;IACzC,MAAM,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;CAChC;AAED,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,QAAyB,EACzB,SAAgB,EAChB,kBAAwB,EACxB,cAAoB,EACpB,qBAA2B,EAC3B,KAAS,EACT,MAAoC,EACpC,KAAK,EACL,QAAQ,EACR,MAAM,EACN,GAAG,MAAM,EACV,EAAE,yBAAyB,eAwF3B;yBArGe,qBAAqB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationsProvider.styles.d.ts","sourceRoot":"","sources":["../../src/NotificationsProvider/NotificationsProvider.styles.ts"],"names":[],"mappings":";AAEA,UAAU,iCAAiC;IACzC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;CACvC;;;;;;;;;AAED,wBAaI"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-notification-state-styles.d.ts","sourceRoot":"","sources":["../../../src/NotificationsProvider/get-notification-state-styles/get-notification-state-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAC;AAE/D,UAAU,4BAA4B;IACpC,KAAK,EAAE,gBAAgB,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,gCAAgC,CAAC;IAC9C,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAgBD,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAC,EACjD,KAAK,EACL,SAAS,EACT,WAAW,EACX,kBAAkB,GACnB,EAAE,4BAA4B,GAAG,SAAS,CAgC1C"}
@@ -1,4 +0,0 @@
1
- import { CSSObject } from '@mantine/core';
2
- import { NotificationsProviderPositioning } from '../../types';
3
- export default function getPositionStyles([vertical, horizontal]: NotificationsProviderPositioning, spacing: number): CSSObject;
4
- //# sourceMappingURL=get-position-styles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-position-styles.d.ts","sourceRoot":"","sources":["../../../src/NotificationsProvider/get-position-styles/get-position-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAC;AAE/D,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,gCAAgC,EACxD,OAAO,EAAE,MAAM,aAYhB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-notifications-state.d.ts","sourceRoot":"","sources":["../../../src/NotificationsProvider/use-notifications-state/use-notifications-state.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE;;;qCAMhC,iBAAiB;uCAcf,iBAAiB;2BAc7B,MAAM;;;EAuBrC"}
@@ -1,2 +0,0 @@
1
- export declare function useNotifications(): import("../types").NotificationsContextProps;
2
- //# sourceMappingURL=use-notifications.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-notifications.d.ts","sourceRoot":"","sources":["../../src/use-notifications/use-notifications.ts"],"names":[],"mappings":"AAGA,wBAAgB,gBAAgB,iDAU/B"}