@mantine/notifications 6.0.0 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/Notifications/Notifications.js +7 -2
- package/cjs/Notifications/Notifications.js.map +1 -1
- package/cjs/events.js.map +1 -1
- package/esm/Notifications/Notifications.js +8 -3
- package/esm/Notifications/Notifications.js.map +1 -1
- package/esm/events.js.map +1 -1
- package/lib/Notifications/Notifications.d.ts +4 -4
- package/lib/Notifications/Notifications.d.ts.map +1 -1
- package/lib/events.d.ts +1 -9
- package/lib/events.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -53,7 +53,7 @@ const POSITIONS = [
|
|
|
53
53
|
"bottom-right",
|
|
54
54
|
"bottom-center"
|
|
55
55
|
];
|
|
56
|
-
|
|
56
|
+
const Notifications = (_a) => {
|
|
57
57
|
var _b = _a, {
|
|
58
58
|
className,
|
|
59
59
|
position = "bottom-right",
|
|
@@ -140,8 +140,13 @@ function Notifications(_a) {
|
|
|
140
140
|
maxWidth: containerWidth
|
|
141
141
|
}, getPositionStyles['default'](positioning, theme.spacing.md))
|
|
142
142
|
}, others), /* @__PURE__ */ React__default.createElement(reactTransitionGroup.TransitionGroup, null, items)));
|
|
143
|
-
}
|
|
143
|
+
};
|
|
144
144
|
Notifications.displayName = "@mantine/notifications/Notifications";
|
|
145
|
+
Notifications.show = events.notifications.show;
|
|
146
|
+
Notifications.hide = events.notifications.hide;
|
|
147
|
+
Notifications.update = events.notifications.update;
|
|
148
|
+
Notifications.clean = events.notifications.clean;
|
|
149
|
+
Notifications.cleanQueue = events.notifications.cleanQueue;
|
|
145
150
|
|
|
146
151
|
exports.Notifications = Notifications;
|
|
147
152
|
//# sourceMappingURL=Notifications.js.map
|
|
@@ -1 +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 { DefaultProps, Portal, getDefaultZIndex, Box, PortalProps, rem } 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, 'style'>,\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,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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;;;;"}
|
|
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 { DefaultProps, Portal, getDefaultZIndex, Box, PortalProps, rem } from '@mantine/core';\nimport { useReducedMotion, useForceUpdate, useDidUpdate } from '@mantine/hooks';\nimport { NotificationsPositioning } from '../types';\nimport {\n notifications as GlobalNotifications,\n NotificationsEvents,\n useNotificationsEvents,\n} 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\ntype NotificationsStaticMethods = NotificationsEvents;\n\nexport interface NotificationsProps\n extends Omit<DefaultProps, 'style'>,\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 const Notifications: React.FC<NotificationsProps> & NotificationsStaticMethods = ({\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}) => {\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';\nNotifications.show = GlobalNotifications.show;\nNotifications.hide = GlobalNotifications.hide;\nNotifications.update = GlobalNotifications.update;\nNotifications.clean = GlobalNotifications.clean;\nNotifications.cleanQueue = GlobalNotifications.cleanQueue;\n"],"names":["rem","getDefaultZIndex","useForceUpdate","useRef","useNotificationsState","useStyles","useReducedMotion","useDidUpdate","useNotificationsEvents","React","Transition","NotificationContainer","getNotificationStateStyles","Portal","Box","getPositionStyles","TransitionGroup","GlobalNotifications"],"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,KA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AW,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,EAAE;AACF,aAAa,CAAC,WAAW,GAAG,sCAAsC,CAAC;AACnE,aAAa,CAAC,IAAI,GAAGC,oBAAmB,CAAC,IAAI,CAAC;AAC9C,aAAa,CAAC,IAAI,GAAGA,oBAAmB,CAAC,IAAI,CAAC;AAC9C,aAAa,CAAC,MAAM,GAAGA,oBAAmB,CAAC,MAAM,CAAC;AAClD,aAAa,CAAC,KAAK,GAAGA,oBAAmB,CAAC,KAAK,CAAC;AAChD,aAAa,CAAC,UAAU,GAAGA,oBAAmB,CAAC,UAAU;;;;"}
|
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\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;;;;;;;;;;;"}
|
|
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: NotificationsEvents = {\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;;;;;;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import React, { useRef } from 'react';
|
|
|
2
2
|
import { Transition, TransitionGroup } from 'react-transition-group';
|
|
3
3
|
import { rem, getDefaultZIndex, Portal, Box } from '@mantine/core';
|
|
4
4
|
import { useForceUpdate, useReducedMotion, useDidUpdate } from '@mantine/hooks';
|
|
5
|
-
import { useNotificationsEvents } from '../events.js';
|
|
5
|
+
import { useNotificationsEvents, notifications } from '../events.js';
|
|
6
6
|
import getPositionStyles from './get-position-styles/get-position-styles.js';
|
|
7
7
|
import getNotificationStateStyles from './get-notification-state-styles/get-notification-state-styles.js';
|
|
8
8
|
import NotificationContainer from '../NotificationContainer/NotificationContainer.js';
|
|
@@ -45,7 +45,7 @@ const POSITIONS = [
|
|
|
45
45
|
"bottom-right",
|
|
46
46
|
"bottom-center"
|
|
47
47
|
];
|
|
48
|
-
|
|
48
|
+
const Notifications = (_a) => {
|
|
49
49
|
var _b = _a, {
|
|
50
50
|
className,
|
|
51
51
|
position = "bottom-right",
|
|
@@ -132,8 +132,13 @@ function Notifications(_a) {
|
|
|
132
132
|
maxWidth: containerWidth
|
|
133
133
|
}, getPositionStyles(positioning, theme.spacing.md))
|
|
134
134
|
}, others), /* @__PURE__ */ React.createElement(TransitionGroup, null, items)));
|
|
135
|
-
}
|
|
135
|
+
};
|
|
136
136
|
Notifications.displayName = "@mantine/notifications/Notifications";
|
|
137
|
+
Notifications.show = notifications.show;
|
|
138
|
+
Notifications.hide = notifications.hide;
|
|
139
|
+
Notifications.update = notifications.update;
|
|
140
|
+
Notifications.clean = notifications.clean;
|
|
141
|
+
Notifications.cleanQueue = notifications.cleanQueue;
|
|
137
142
|
|
|
138
143
|
export { Notifications };
|
|
139
144
|
//# sourceMappingURL=Notifications.js.map
|
|
@@ -1 +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 { DefaultProps, Portal, getDefaultZIndex, Box, PortalProps, rem } 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, 'style'>,\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":";;;;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,YAAY,CAAC,EAAE,CAAC;AAC7E,KAAK;AACL,GAAG,CAAC,CAAC,CAAC,CAAC;AACP,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE;AACrD,IAAI,MAAM;AACV,GAAG,kBAAkB,KAAK,CAAC,aAAa,CAAC,GAAG,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,EAAE,iBAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AACxD,GAAG,EAAE,MAAM,CAAC,kBAAkB,KAAK,CAAC,aAAa,CAAC,eAAe,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AAClF,CAAC;AACD,aAAa,CAAC,WAAW,GAAG,sCAAsC;;;;"}
|
|
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 { DefaultProps, Portal, getDefaultZIndex, Box, PortalProps, rem } from '@mantine/core';\nimport { useReducedMotion, useForceUpdate, useDidUpdate } from '@mantine/hooks';\nimport { NotificationsPositioning } from '../types';\nimport {\n notifications as GlobalNotifications,\n NotificationsEvents,\n useNotificationsEvents,\n} 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\ntype NotificationsStaticMethods = NotificationsEvents;\n\nexport interface NotificationsProps\n extends Omit<DefaultProps, 'style'>,\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 const Notifications: React.FC<NotificationsProps> & NotificationsStaticMethods = ({\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}) => {\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';\nNotifications.show = GlobalNotifications.show;\nNotifications.hide = GlobalNotifications.hide;\nNotifications.update = GlobalNotifications.update;\nNotifications.clean = GlobalNotifications.clean;\nNotifications.cleanQueue = GlobalNotifications.cleanQueue;\n"],"names":["GlobalNotifications"],"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,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AAkB,KAAK,CAAC,aAAa,CAAC,eAAe,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AAClF,EAAE;AACF,aAAa,CAAC,WAAW,GAAG,sCAAsC,CAAC;AACnE,aAAa,CAAC,IAAI,GAAGA,aAAmB,CAAC,IAAI,CAAC;AAC9C,aAAa,CAAC,IAAI,GAAGA,aAAmB,CAAC,IAAI,CAAC;AAC9C,aAAa,CAAC,MAAM,GAAGA,aAAmB,CAAC,MAAM,CAAC;AAClD,aAAa,CAAC,KAAK,GAAGA,aAAmB,CAAC,KAAK,CAAC;AAChD,aAAa,CAAC,UAAU,GAAGA,aAAmB,CAAC,UAAU;;;;"}
|
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\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;;;;"}
|
|
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: NotificationsEvents = {\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;;;;"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DefaultProps, PortalProps } from '@mantine/core';
|
|
3
|
+
import { NotificationsEvents } from '../events';
|
|
4
|
+
type NotificationsStaticMethods = NotificationsEvents;
|
|
3
5
|
export interface NotificationsProps extends Omit<DefaultProps, 'style'>, React.ComponentPropsWithoutRef<'div'> {
|
|
4
6
|
/** Notifications position */
|
|
5
7
|
position?: 'top-left' | 'top-right' | 'top-center' | 'bottom-left' | 'bottom-right' | 'bottom-center';
|
|
@@ -18,8 +20,6 @@ export interface NotificationsProps extends Omit<DefaultProps, 'style'>, React.C
|
|
|
18
20
|
/** Target element of Portal component */
|
|
19
21
|
target?: PortalProps['target'];
|
|
20
22
|
}
|
|
21
|
-
export declare
|
|
22
|
-
export
|
|
23
|
-
var displayName: string;
|
|
24
|
-
}
|
|
23
|
+
export declare const Notifications: React.FC<NotificationsProps> & NotificationsStaticMethods;
|
|
24
|
+
export {};
|
|
25
25
|
//# sourceMappingURL=Notifications.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notifications.d.ts","sourceRoot":"","sources":["../../src/Notifications/Notifications.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAiC,WAAW,EAAO,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"Notifications.d.ts","sourceRoot":"","sources":["../../src/Notifications/Notifications.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,YAAY,EAAiC,WAAW,EAAO,MAAM,eAAe,CAAC;AAG9F,OAAO,EAEL,mBAAmB,EAEpB,MAAM,WAAW,CAAC;AAgBnB,KAAK,0BAA0B,GAAG,mBAAmB,CAAC;AAEtD,MAAM,WAAW,kBACf,SAAQ,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,EACjC,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,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAAC,GAAG,0BAgG1D,CAAC"}
|
package/lib/events.d.ts
CHANGED
|
@@ -16,13 +16,5 @@ 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
|
+
export declare const notifications: NotificationsEvents;
|
|
28
20
|
//# sourceMappingURL=events.d.ts.map
|
package/lib/events.d.ts.map
CHANGED
|
@@ -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;AAExD,eAAO,MAAM,aAAa
|
|
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,EAAE,mBAM3B,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": "6.0.
|
|
4
|
+
"version": "6.0.2",
|
|
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": "6.0.
|
|
32
|
-
"@mantine/hooks": "6.0.
|
|
31
|
+
"@mantine/core": "6.0.2",
|
|
32
|
+
"@mantine/hooks": "6.0.2",
|
|
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": "6.0.
|
|
38
|
+
"@mantine/utils": "6.0.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {}
|
|
41
41
|
}
|