@mantine-vue/notifications 1.1.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/index.cjs +637 -0
- package/cjs/index.cjs.map +1 -0
- package/esm/index.mjs +626 -0
- package/esm/index.mjs.map +1 -0
- package/lib/NotificationContainer.d.ts +82 -0
- package/lib/Notifications.d.ts +314 -0
- package/lib/get-auto-close/get-auto-close.d.ts +1 -0
- package/lib/get-grouped-notifications/get-grouped-notifications.d.ts +4 -0
- package/lib/get-notification-state-styles.d.ts +11 -0
- package/lib/index.d.mts +4 -0
- package/lib/index.d.ts +4 -0
- package/lib/notifications.store.d.ts +39 -0
- package/package.json +46 -0
- package/styles.css +43 -0
- package/styles.layer.css +45 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/notifications.store.ts","../src/get-grouped-notifications/get-grouped-notifications.ts","../src/get-notification-state-styles.ts","../src/get-auto-close/get-auto-close.ts","../src/NotificationContainer.ts","../src/Notifications.module.css","../src/Notifications.ts"],"sourcesContent":["import { type Ref } from 'vue'\nimport { createStore, type MantineStore } from '@mantine-vue/store'\n\nexport type NotificationPosition =\n | 'top-left'\n | 'top-right'\n | 'top-center'\n | 'bottom-left'\n | 'bottom-right'\n | 'bottom-center'\n\nexport interface NotificationData extends Record<`data-${string}`, any> {\n id?: string\n position?: NotificationPosition\n message: any\n autoClose?: boolean | number\n allowClose?: boolean\n onClose?: (props: NotificationData) => void\n onOpen?: (props: NotificationData) => void\n style?: any\n withCloseButton?: boolean\n [key: string]: any\n}\n\nexport interface NotificationsState {\n notifications: NotificationData[]\n queue: NotificationData[]\n defaultPosition: NotificationPosition\n limit: number\n}\n\nexport type NotificationsStore = MantineStore<NotificationsState>\n\nfunction randomId() {\n return `mantine-${Math.random().toString(36).slice(2, 11)}`\n}\n\nfunction getDistributedNotifications(\n data: NotificationData[],\n defaultPosition: NotificationPosition,\n limit: number,\n) {\n const queue: NotificationData[] = []\n const notifications: NotificationData[] = []\n const count: Record<string, number> = {}\n\n for (const item of data) {\n const position = item.position || defaultPosition\n count[position] = count[position] || 0\n count[position] += 1\n\n if (count[position] <= limit) {\n notifications.push(item)\n } else {\n queue.push(item)\n }\n }\n\n return { notifications, queue }\n}\n\nexport const createNotificationsStore = () =>\n createStore<NotificationsState>({\n notifications: [],\n queue: [],\n defaultPosition: 'bottom-right',\n limit: 5,\n })\n\nexport const notificationsStore = createNotificationsStore()\nexport const useNotifications = (\n store: NotificationsStore = notificationsStore,\n): Readonly<Ref<NotificationsState>> => store.value\n\nexport function updateNotificationsState(\n store: NotificationsStore,\n update: (notifications: NotificationData[]) => NotificationData[],\n) {\n const state = store.getState()\n const notifications = update([...state.notifications, ...state.queue])\n const updated = getDistributedNotifications(notifications, state.defaultPosition, state.limit)\n\n store.setState({\n notifications: updated.notifications,\n queue: updated.queue,\n limit: state.limit,\n defaultPosition: state.defaultPosition,\n })\n}\n\nexport function showNotification(\n notification: NotificationData,\n store: NotificationsStore = notificationsStore,\n) {\n const id = notification.id || randomId()\n\n updateNotificationsState(store, (notifications) => {\n if (notification.id && notifications.some((n) => n.id === notification.id)) {\n return notifications\n }\n\n return [...notifications, { ...notification, id }]\n })\n\n return id\n}\n\nexport function hideNotification(id: string, store: NotificationsStore = notificationsStore) {\n updateNotificationsState(store, (notifications) =>\n notifications.filter((notification) => {\n if (notification.id === id) {\n notification.onClose?.(notification)\n return false\n }\n\n return true\n }),\n )\n\n return id\n}\n\nexport function updateNotification(\n notification: NotificationData,\n store: NotificationsStore = notificationsStore,\n) {\n updateNotificationsState(store, (notifications) =>\n notifications.map((item) =>\n item.id === notification.id ? { ...item, ...notification } : item,\n ),\n )\n\n return notification.id\n}\n\nexport function cleanNotifications(store: NotificationsStore = notificationsStore) {\n updateNotificationsState(store, () => [])\n}\n\nexport function cleanNotificationsQueue(store: NotificationsStore = notificationsStore) {\n updateNotificationsState(store, (notifications) => notifications.slice(0, store.getState().limit))\n}\n\nexport const notifications = {\n show: showNotification,\n hide: hideNotification,\n update: updateNotification,\n clean: cleanNotifications,\n cleanQueue: cleanNotificationsQueue,\n updateState: updateNotificationsState,\n} as const\n","import type { NotificationData, NotificationPosition } from '../notifications.store'\n\nexport type GroupedNotifications = Record<NotificationPosition, NotificationData[]>\n\nexport const positions: NotificationPosition[] = [\n 'bottom-center',\n 'bottom-left',\n 'bottom-right',\n 'top-center',\n 'top-left',\n 'top-right',\n]\n\nexport function getGroupedNotifications(\n notifications: NotificationData[],\n defaultPosition: NotificationPosition,\n) {\n return notifications.reduce<GroupedNotifications>(\n (acc, notification) => {\n acc[notification.position || defaultPosition].push(notification)\n return acc\n },\n positions.reduce<GroupedNotifications>((acc, item) => {\n acc[item] = []\n return acc\n }, {} as GroupedNotifications),\n )\n}\n","import type { CSSProperties } from 'vue'\nimport type { NotificationPosition } from './notifications.store'\n\nexport type NotificationTransitionStatus = 'entering' | 'entered' | 'exiting' | 'exited'\n\ninterface NotificationStateStylesProps {\n state: NotificationTransitionStatus\n maxHeight: number | string\n position: NotificationPosition\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\nfunction toCssLength(value: number | string): string {\n return typeof value === 'number' ? `${value}px` : value\n}\n\nexport function getNotificationStateStyles({\n state,\n maxHeight,\n position,\n transitionDuration,\n}: NotificationStateStylesProps): CSSProperties {\n const [vertical, horizontal] = position.split('-')\n const property = (\n horizontal === 'center' ? `${vertical}-center` : horizontal\n ) as keyof typeof transforms\n\n const commonStyles: CSSProperties = {\n opacity: 0,\n maxHeight: toCssLength(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: CSSProperties = {\n opacity: 1,\n transform: noTransform[property],\n }\n\n const outState: CSSProperties = {\n opacity: 0,\n maxHeight: toCssLength(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","export function getAutoClose(\n autoClose: boolean | number | undefined,\n notificationAutoClose: boolean | number | undefined,\n) {\n if (typeof notificationAutoClose === 'number') {\n return notificationAutoClose\n }\n\n if (notificationAutoClose === false || autoClose === false) {\n return false\n }\n\n return autoClose\n}\n","import {\n computed,\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n ref,\n watch,\n type CSSProperties,\n type PropType,\n} from 'vue'\nimport { Notification } from '@mantine-vue/core'\nimport { getAutoClose } from './get-auto-close/get-auto-close'\nimport type { NotificationData } from './notifications.store'\n\nconst SCROLL_DISMISS_RESET_TIMEOUT = 120\n\nfunction normalizeStyle(style: any): Record<string, any> {\n if (!style) return {}\n if (Array.isArray(style)) {\n return style.reduce<Record<string, any>>(\n (acc, item) => Object.assign(acc, normalizeStyle(item)),\n {},\n )\n }\n return typeof style === 'object' ? style : {}\n}\n\nfunction renderContent(value: any) {\n return typeof value === 'function' ? value() : value\n}\n\nfunction getNotificationProps(data: NotificationData) {\n const omittedKeys = new Set([\n 'autoClose',\n 'message',\n 'allowClose',\n 'position',\n 'style',\n 'withCloseButton',\n 'onOpen',\n 'onClose',\n 'id',\n ])\n\n return Object.entries(data).reduce<Record<string, any>>((acc, [key, value]) => {\n if (!omittedKeys.has(key)) {\n acc[key] = value\n }\n\n return acc\n }, {})\n}\n\nexport const NotificationContainer = defineComponent({\n name: 'NotificationContainer',\n inheritAttrs: false,\n props: {\n data: { type: Object as PropType<NotificationData>, required: true },\n autoClose: { type: [Boolean, Number] as PropType<number | false>, required: true },\n transitionDuration: { type: Number, required: true },\n allowDragDismiss: { type: Boolean, required: true },\n allowScrollDismiss: { type: Boolean, required: true },\n paused: { type: Boolean, required: true },\n onHide: { type: Function as PropType<(id: string) => void>, required: true },\n onHoverStart: { type: Function as PropType<() => void>, default: undefined },\n onHoverEnd: { type: Function as PropType<() => void>, default: undefined },\n },\n setup(props, { attrs }) {\n const notificationRef = ref<HTMLElement | null>(null)\n const offset = ref(0)\n const dismissed = ref(false)\n const dismissDirection = ref<-1 | 1>(1)\n const active = ref(false)\n const scrollDismissActive = ref(false)\n const hovered = ref(false)\n const startX = ref(0)\n const startTime = ref(0)\n let autoCloseTimeout = -1\n let hideTimeout = -1\n let scrollDismissTimeout = -1\n\n const autoCloseDuration = computed(() => getAutoClose(props.autoClose, props.data.autoClose))\n const isCloseDisabled = computed(() => props.data.allowClose === false)\n\n const cancelAutoClose = () => window.clearTimeout(autoCloseTimeout)\n const cancelHide = () => window.clearTimeout(hideTimeout)\n const cancelScrollDismissReset = () => window.clearTimeout(scrollDismissTimeout)\n\n const setSwipeOffset = (value: number) => {\n offset.value = value\n }\n\n const handleHide = () => {\n props.onHide(props.data.id!)\n cancelAutoClose()\n cancelHide()\n cancelScrollDismissReset()\n }\n\n const handleAutoClose = () => {\n if (\n typeof window === 'undefined' ||\n dismissed.value ||\n active.value ||\n props.paused ||\n hovered.value ||\n typeof autoCloseDuration.value !== 'number'\n ) {\n return\n }\n\n cancelAutoClose()\n autoCloseTimeout = window.setTimeout(handleHide, autoCloseDuration.value)\n }\n\n const getExitOffset = (direction: -1 | 1) => {\n const width = notificationRef.value?.offsetWidth ?? 440\n return direction * (width + 40)\n }\n\n const shouldDismiss = (movement: number, velocity: number) => {\n const width = notificationRef.value?.offsetWidth ?? 440\n return Math.abs(movement) > width * 0.35 || velocity > 0.5\n }\n\n const resetSwipe = () => {\n cancelScrollDismissReset()\n scrollDismissActive.value = false\n setSwipeOffset(0)\n }\n\n const dismissNotification = (direction: -1 | 1) => {\n dismissDirection.value = direction\n dismissed.value = true\n scrollDismissActive.value = false\n setSwipeOffset(getExitOffset(direction))\n cancelAutoClose()\n cancelHide()\n cancelScrollDismissReset()\n hideTimeout = window.setTimeout(handleHide, props.transitionDuration)\n }\n\n const scheduleScrollDismissReset = () => {\n cancelScrollDismissReset()\n scrollDismissTimeout = window.setTimeout(() => {\n scrollDismissActive.value = false\n setSwipeOffset(0)\n handleAutoClose()\n }, SCROLL_DISMISS_RESET_TIMEOUT)\n }\n\n const handlePointerMove = (event: PointerEvent) => {\n if (!active.value || dismissed.value) {\n return\n }\n\n setSwipeOffset(event.clientX - startX.value)\n }\n\n const finishPointerDrag = (event: PointerEvent) => {\n if (!active.value) {\n return\n }\n\n active.value = false\n window.removeEventListener('pointermove', handlePointerMove)\n window.removeEventListener('pointerup', finishPointerDrag)\n window.removeEventListener('pointercancel', cancelPointerDragEvent)\n\n const movement = event.clientX - startX.value\n const elapsed = Math.max(Date.now() - startTime.value, 1)\n const velocity = Math.abs(movement) / elapsed\n const direction = movement === 0 ? 1 : movement > 0 ? 1 : -1\n\n if (shouldDismiss(movement, velocity)) {\n dismissNotification(direction)\n } else {\n setSwipeOffset(0)\n handleAutoClose()\n }\n }\n\n function cancelPointerDrag(shouldRestartAutoClose = true) {\n active.value = false\n window.removeEventListener('pointermove', handlePointerMove)\n window.removeEventListener('pointerup', finishPointerDrag)\n window.removeEventListener('pointercancel', cancelPointerDragEvent)\n setSwipeOffset(0)\n if (shouldRestartAutoClose) {\n handleAutoClose()\n }\n }\n\n const cancelPointerDragEvent = () => cancelPointerDrag()\n\n const handlePointerDown = (event: PointerEvent) => {\n if (\n !props.allowDragDismiss ||\n isCloseDisabled.value ||\n dismissed.value ||\n event.button !== 0\n ) {\n return\n }\n\n cancelAutoClose()\n active.value = true\n startX.value = event.clientX\n startTime.value = Date.now()\n window.addEventListener('pointermove', handlePointerMove)\n window.addEventListener('pointerup', finishPointerDrag)\n window.addEventListener('pointercancel', cancelPointerDragEvent)\n }\n\n const handleWheel = (event: WheelEvent) => {\n if (dismissed.value || active.value) {\n return\n }\n\n const isDocumentEvent = event.currentTarget === document\n if (!isDocumentEvent && !hovered.value) {\n return\n }\n\n const { deltaX, deltaY } = event\n if (Math.abs(deltaX) <= Math.abs(deltaY) || deltaX === 0) {\n return\n }\n\n if (!props.allowScrollDismiss || isCloseDisabled.value) {\n return\n }\n\n if (!isDocumentEvent) {\n event.preventDefault()\n event.stopPropagation()\n }\n\n cancelAutoClose()\n scrollDismissActive.value = true\n\n const nextOffset = offset.value - deltaX\n const direction = nextOffset > 0 ? 1 : -1\n\n if (shouldDismiss(nextOffset, 0)) {\n dismissNotification(direction)\n return\n }\n\n setSwipeOffset(nextOffset)\n scheduleScrollDismissReset()\n }\n\n const handleMouseEnter = () => {\n hovered.value = true\n cancelAutoClose()\n props.onHoverStart?.()\n }\n\n const handleMouseLeave = () => {\n hovered.value = false\n\n if (!scrollDismissActive.value) {\n resetSwipe()\n handleAutoClose()\n }\n\n props.onHoverEnd?.()\n }\n\n const handleResize = () => {\n if (dismissed.value) {\n setSwipeOffset(getExitOffset(dismissDirection.value))\n }\n }\n\n watch(\n () => scrollDismissActive.value,\n (value, _, onCleanup) => {\n if (!value) {\n return\n }\n\n document.addEventListener('wheel', handleWheel, { passive: false })\n onCleanup(() => document.removeEventListener('wheel', handleWheel))\n },\n )\n\n watch(\n [autoCloseDuration, active, dismissed, () => props.paused],\n () => {\n if (props.paused) {\n cancelAutoClose()\n } else {\n handleAutoClose()\n }\n },\n { immediate: true },\n )\n\n onMounted(() => {\n props.data.onOpen?.(props.data)\n notificationRef.value?.addEventListener('wheel', handleWheel, { passive: false })\n window.addEventListener('resize', handleResize)\n })\n\n onBeforeUnmount(() => {\n cancelAutoClose()\n cancelHide()\n cancelScrollDismissReset()\n cancelPointerDrag(false)\n notificationRef.value?.removeEventListener('wheel', handleWheel)\n window.removeEventListener('resize', handleResize)\n })\n\n return () => {\n const resolvedAttrsStyle = normalizeStyle(attrs.style)\n const resolvedDataStyle = normalizeStyle(props.data.style)\n const baseStyle = { ...resolvedAttrsStyle, ...resolvedDataStyle }\n const baseOpacity = typeof baseStyle.opacity === 'number' ? baseStyle.opacity : 1\n const swipeOpacity = dismissed.value ? 0 : 1 - Math.min(Math.abs(offset.value) / 200, 1) * 0.6\n const resolvedTransitionDuration =\n baseStyle.transitionDuration ??\n `${props.transitionDuration}ms, ${props.transitionDuration}ms, ${props.transitionDuration}ms`\n const notificationStyle: CSSProperties = {\n ...baseStyle,\n '--notifications-state-transform':\n typeof baseStyle.transform === 'string' ? baseStyle.transform : 'translateX(0)',\n '--notifications-state-opacity': String(baseOpacity),\n '--notifications-swipe-offset': `${offset.value}px`,\n '--notifications-swipe-opacity': String(swipeOpacity),\n transform:\n 'var(--notifications-state-transform) translate3d(var(--notifications-swipe-offset), 0, 0)',\n opacity: 'calc(var(--notifications-state-opacity) * var(--notifications-swipe-opacity))',\n transitionDuration:\n active.value || scrollDismissActive.value ? '0ms, 0ms, 0ms' : resolvedTransitionDuration,\n cursor: 'default',\n touchAction: 'pan-y',\n } as CSSProperties\n\n return h(\n Notification,\n {\n ...attrs,\n ...getNotificationProps(props.data),\n ref: (node: any) => {\n notificationRef.value = node?.$el ?? node\n },\n style: notificationStyle,\n withCloseButton: isCloseDisabled.value ? false : props.data.withCloseButton,\n onClose: handleHide,\n onMouseenter: handleMouseEnter,\n onMouseleave: handleMouseLeave,\n onPointerdown: handlePointerDown,\n },\n () => renderContent(props.data.message),\n )\n }\n },\n})\n",".root {\n width: calc(100% - var(--mantine-spacing-md) * 2);\n position: fixed;\n z-index: var(--notifications-z-index);\n max-width: var(--notifications-container-width);\n\n &:where([data-position='top-center']) {\n top: var(--mantine-spacing-md);\n left: 50%;\n transform: translateX(-50%);\n }\n\n &:where([data-position='top-left']) {\n top: var(--mantine-spacing-md);\n left: var(--mantine-spacing-md);\n }\n\n &:where([data-position='top-right']) {\n top: var(--mantine-spacing-md);\n right: var(--mantine-spacing-md);\n }\n\n &:where([data-position='bottom-center']) {\n bottom: var(--mantine-spacing-md);\n left: 50%;\n transform: translateX(-50%);\n }\n\n &:where([data-position='bottom-left']) {\n bottom: var(--mantine-spacing-md);\n left: var(--mantine-spacing-md);\n }\n\n &:where([data-position='bottom-right']) {\n bottom: var(--mantine-spacing-md);\n right: var(--mantine-spacing-md);\n }\n}\n\n.notification {\n & + & {\n margin-top: var(--mantine-spacing-md);\n }\n}\n","import { TransitionGroup, computed, defineComponent, h, ref, watch, type PropType } from 'vue'\nimport {\n Box,\n OptionalPortal,\n createVarsResolver,\n getDefaultZIndex,\n rem,\n useMantineTheme,\n useProps,\n useStyles,\n} from '@mantine-vue/core'\nimport { useReducedMotion } from '@mantine-vue/hooks'\nimport {\n getGroupedNotifications,\n positions,\n} from './get-grouped-notifications/get-grouped-notifications'\nimport { getNotificationStateStyles } from './get-notification-state-styles'\nimport { NotificationContainer } from './NotificationContainer'\nimport {\n hideNotification,\n notifications,\n notificationsStore,\n useNotifications,\n type NotificationPosition,\n type NotificationsStore,\n} from './notifications.store'\nimport classes from './Notifications.module.css'\n\nexport type NotificationsStylesNames = 'root' | 'notification'\nexport type NotificationsCssVariables = {\n root: '--notifications-z-index' | '--notifications-container-width'\n}\n\nexport interface NotificationsProps {\n position?: NotificationPosition\n autoClose?: number | false\n transitionDuration?: number\n allowDragDismiss?: boolean\n allowScrollDismiss?: boolean\n containerWidth?: number | string\n notificationMaxHeight?: number | string\n limit?: number\n zIndex?: string | number\n portalProps?: Record<string, any>\n store?: NotificationsStore\n withinPortal?: boolean\n pauseResetOnHover?: 'all' | 'notification'\n classNames?: Record<string, any>\n styles?: Record<string, any>\n vars?: Record<string, any>\n unstyled?: boolean\n}\n\nconst defaultProps = {\n position: 'bottom-right',\n autoClose: 4000,\n transitionDuration: 250,\n allowDragDismiss: true,\n allowScrollDismiss: true,\n containerWidth: 440,\n notificationMaxHeight: 200,\n limit: 5,\n zIndex: getDefaultZIndex('overlay'),\n store: notificationsStore,\n withinPortal: true,\n pauseResetOnHover: 'all',\n} satisfies Partial<NotificationsProps>\n\nconst varsResolver = createVarsResolver<any>((_, { zIndex, containerWidth }) => ({\n root: {\n '--notifications-z-index': zIndex?.toString(),\n '--notifications-container-width': rem(containerWidth),\n },\n}))\n\nfunction applyTransitionStyles(\n element: Element,\n state: 'entered' | 'exited' | 'exiting',\n position: NotificationPosition,\n transitionDuration: number,\n maxHeight: number | string,\n) {\n Object.assign(\n (element as HTMLElement).style,\n getNotificationStateStyles({\n state,\n position,\n transitionDuration,\n maxHeight,\n }),\n )\n}\n\nconst NotificationsBase = defineComponent({\n name: 'Notifications',\n inheritAttrs: false,\n props: {\n position: { type: String as PropType<NotificationPosition>, default: undefined },\n autoClose: { type: [Number, Boolean] as PropType<number | false>, default: undefined },\n transitionDuration: { type: Number, default: undefined },\n allowDragDismiss: { type: Boolean, default: undefined },\n allowScrollDismiss: { type: Boolean, default: undefined },\n containerWidth: { type: [Number, String] as PropType<number | string>, default: undefined },\n notificationMaxHeight: {\n type: [Number, String] as PropType<number | string>,\n default: undefined,\n },\n limit: { type: Number, default: undefined },\n zIndex: { type: [Number, String] as PropType<number | string>, default: undefined },\n portalProps: { type: Object as PropType<Record<string, any>>, default: undefined },\n store: { type: Object as PropType<NotificationsStore>, default: undefined },\n withinPortal: { type: Boolean, default: undefined },\n pauseResetOnHover: { type: String as PropType<'all' | 'notification'>, default: undefined },\n classNames: { type: [Object, Function], default: undefined },\n styles: { type: [Object, Function], default: undefined },\n vars: { type: [Object, Function], default: undefined },\n unstyled: { type: Boolean, default: false },\n },\n setup(rawProps, { attrs }) {\n const props = useProps<NotificationsProps>('Notifications', defaultProps, rawProps as any)\n const theme = useMantineTheme()\n const shouldReduceMotion = useReducedMotion()\n const hoveredCount = ref(0)\n const data = useNotifications(props.store)\n const reduceMotion = computed(() =>\n theme.value.respectReducedMotion ? shouldReduceMotion.value : false,\n )\n const duration = computed(() => (reduceMotion.value ? 1 : props.transitionDuration!))\n\n const getStyles = useStyles({\n name: 'Notifications',\n classes,\n props,\n className: attrs.class,\n style: attrs.style as any,\n classNames: props.classNames as any,\n styles: props.styles as any,\n unstyled: props.unstyled,\n vars: props.vars as any,\n varsResolver,\n })\n\n watch(\n () => [props.limit, props.position, props.store] as const,\n () => {\n props.store?.setState((current) => ({\n ...current,\n limit: props.limit || 5,\n defaultPosition: props.position!,\n }))\n },\n { immediate: true },\n )\n\n const handleHoverStart = () => {\n hoveredCount.value += 1\n }\n\n const handleHoverEnd = () => {\n hoveredCount.value = Math.max(0, hoveredCount.value - 1)\n }\n\n return () => {\n const grouped = getGroupedNotifications(data.value.notifications, props.position!)\n const rootProps = (position: NotificationPosition) => ({\n ...attrs,\n ...getStyles('root'),\n 'data-position': position,\n })\n\n const renderGroup = (position: NotificationPosition) =>\n h(Box, rootProps(position), () =>\n h(\n TransitionGroup,\n {\n css: false,\n onBeforeEnter: (el: Element) =>\n applyTransitionStyles(\n el,\n 'exited',\n position,\n duration.value,\n props.notificationMaxHeight!,\n ),\n onEnter: (el: Element, done: () => void) => {\n void (el as HTMLElement).offsetHeight\n applyTransitionStyles(\n el,\n 'entered',\n position,\n duration.value,\n props.notificationMaxHeight!,\n )\n window.setTimeout(done, duration.value)\n },\n onLeave: (el: Element, done: () => void) => {\n applyTransitionStyles(\n el,\n 'exiting',\n position,\n duration.value,\n props.notificationMaxHeight!,\n )\n window.setTimeout(done, duration.value)\n },\n },\n () =>\n grouped[position].map(({ style: notificationStyle, ...notification }) =>\n h(NotificationContainer, {\n key: notification.id,\n data: notification,\n onHide: (id) => hideNotification(id, props.store),\n autoClose: props.autoClose!,\n transitionDuration: duration.value,\n allowDragDismiss: props.allowDragDismiss!,\n allowScrollDismiss: props.allowScrollDismiss!,\n paused: props.pauseResetOnHover === 'all' ? hoveredCount.value > 0 : false,\n onHoverStart: handleHoverStart,\n onHoverEnd: handleHoverEnd,\n ...getStyles('notification', { style: notificationStyle }),\n }),\n ),\n ),\n )\n\n return h(OptionalPortal, { withinPortal: props.withinPortal, ...props.portalProps }, () =>\n positions.map((position) => renderGroup(position)),\n )\n }\n },\n})\n\nexport const Notifications = Object.assign(NotificationsBase, {\n classes,\n varsResolver,\n show: notifications.show,\n hide: notifications.hide,\n update: notifications.update,\n clean: notifications.clean,\n cleanQueue: notifications.cleanQueue,\n updateState: notifications.updateState,\n})\n"],"mappings":";;;;;AAiCA,SAAS,WAAW;CAClB,OAAO,WAAW,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,GAAG,EAAE;AAC1D;AAEA,SAAS,4BACP,MACA,iBACA,OACA;CACA,MAAM,QAA4B,CAAC;CACnC,MAAM,gBAAoC,CAAC;CAC3C,MAAM,QAAgC,CAAC;CAEvC,KAAK,MAAM,QAAQ,MAAM;EACvB,MAAM,WAAW,KAAK,YAAY;EAClC,MAAM,YAAY,MAAM,aAAa;EACrC,MAAM,aAAa;EAEnB,IAAI,MAAM,aAAa,OACrB,cAAc,KAAK,IAAI;OAEvB,MAAM,KAAK,IAAI;CAEnB;CAEA,OAAO;EAAE;EAAe;CAAM;AAChC;AAEA,IAAa,iCACX,YAAgC;CAC9B,eAAe,CAAC;CAChB,OAAO,CAAC;CACR,iBAAiB;CACjB,OAAO;AACT,CAAC;AAEH,IAAa,qBAAqB,yBAAyB;AAC3D,IAAa,oBACX,QAA4B,uBACU,MAAM;AAE9C,SAAgB,yBACd,OACA,QACA;CACA,MAAM,QAAQ,MAAM,SAAS;CAE7B,MAAM,UAAU,4BADM,OAAO,CAAC,GAAG,MAAM,eAAe,GAAG,MAAM,KAAK,CACxB,GAAe,MAAM,iBAAiB,MAAM,KAAK;CAE7F,MAAM,SAAS;EACb,eAAe,QAAQ;EACvB,OAAO,QAAQ;EACf,OAAO,MAAM;EACb,iBAAiB,MAAM;CACzB,CAAC;AACH;AAEA,SAAgB,iBACd,cACA,QAA4B,oBAC5B;CACA,MAAM,KAAK,aAAa,MAAM,SAAS;CAEvC,yBAAyB,QAAQ,kBAAkB;EACjD,IAAI,aAAa,MA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OACT,MAAM,qBACR;KACA,OAAO,WAAW,MAAM,SAAS,KAAK;IACxC;IACA,UAAU,IAAa,SAAqB;KAC1C,sBACE,IACA,WACA,UACA,SAAS,OACT,MAAM,qBACR;KACA,OAAO,WAAW,MAAM,SAAS,KAAK;IACxC;GACF,SAEE,QAAQ,UAAU,KAAK,EAAE,OAAO,mBAAmB,GAAG,mBACpD,EAAE,uBAAuB;IACvB,KAAK,aAAa;IAClB,MAAM;IACN,SAAS,OAAO,iBAAiB,IAAI,MAAM,KAAK;IAChD,WAAW,MAAM;IACjB,oBAAoB,SAAS;IAC7B,kBAAkB,MAAM;IACxB,oBAAoB,MAAM;IAC1B,QAAQ,MAAM,sBAAsB,QAAQ,aAAa,QAAQ,IAAI;IACrE,cAAc;IACd,YAAY;IACZ,GAAG,UAAU,gBAAgB,EAAE,OAAO,kBAAkB,CAAC;GAC3D,CAAC,CACH,CACJ,CACF;GAEF,OAAO,EAAE,gBAAgB;IAAE,cAAc,MAAM;IAAc,GAAG,MAAM;GAAY,SAChF,UAAU,KAAK,aAAa,YAAY,QAAQ,CAAC,CACnD;EACF;CACF;AACF,CAAC;AAED,IAAa,gBAAgB,OAAO,OAAO,mBAAmB;CAC5D,SAAA;CACA;CACA,MAAM,cAAc;CACpB,MAAM,cAAc;CACpB,QAAQ,cAAc;CACtB,OAAO,cAAc;CACrB,YAAY,cAAc;CAC1B,aAAa,cAAc;AAC7B,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import type { NotificationData } from './notifications.store';
|
|
3
|
+
export declare const NotificationContainer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
data: {
|
|
5
|
+
type: PropType<NotificationData>;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
autoClose: {
|
|
9
|
+
type: PropType<number | false>;
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
transitionDuration: {
|
|
13
|
+
type: NumberConstructor;
|
|
14
|
+
required: true;
|
|
15
|
+
};
|
|
16
|
+
allowDragDismiss: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
allowScrollDismiss: {
|
|
21
|
+
type: BooleanConstructor;
|
|
22
|
+
required: true;
|
|
23
|
+
};
|
|
24
|
+
paused: {
|
|
25
|
+
type: BooleanConstructor;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
onHide: {
|
|
29
|
+
type: PropType<(id: string) => void>;
|
|
30
|
+
required: true;
|
|
31
|
+
};
|
|
32
|
+
onHoverStart: {
|
|
33
|
+
type: PropType<() => void>;
|
|
34
|
+
default: undefined;
|
|
35
|
+
};
|
|
36
|
+
onHoverEnd: {
|
|
37
|
+
type: PropType<() => void>;
|
|
38
|
+
default: undefined;
|
|
39
|
+
};
|
|
40
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
43
|
+
data: {
|
|
44
|
+
type: PropType<NotificationData>;
|
|
45
|
+
required: true;
|
|
46
|
+
};
|
|
47
|
+
autoClose: {
|
|
48
|
+
type: PropType<number | false>;
|
|
49
|
+
required: true;
|
|
50
|
+
};
|
|
51
|
+
transitionDuration: {
|
|
52
|
+
type: NumberConstructor;
|
|
53
|
+
required: true;
|
|
54
|
+
};
|
|
55
|
+
allowDragDismiss: {
|
|
56
|
+
type: BooleanConstructor;
|
|
57
|
+
required: true;
|
|
58
|
+
};
|
|
59
|
+
allowScrollDismiss: {
|
|
60
|
+
type: BooleanConstructor;
|
|
61
|
+
required: true;
|
|
62
|
+
};
|
|
63
|
+
paused: {
|
|
64
|
+
type: BooleanConstructor;
|
|
65
|
+
required: true;
|
|
66
|
+
};
|
|
67
|
+
onHide: {
|
|
68
|
+
type: PropType<(id: string) => void>;
|
|
69
|
+
required: true;
|
|
70
|
+
};
|
|
71
|
+
onHoverStart: {
|
|
72
|
+
type: PropType<() => void>;
|
|
73
|
+
default: undefined;
|
|
74
|
+
};
|
|
75
|
+
onHoverEnd: {
|
|
76
|
+
type: PropType<() => void>;
|
|
77
|
+
default: undefined;
|
|
78
|
+
};
|
|
79
|
+
}>> & Readonly<{}>, {
|
|
80
|
+
onHoverStart: () => void;
|
|
81
|
+
onHoverEnd: () => void;
|
|
82
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import { hideNotification, type NotificationPosition, type NotificationsStore } from './notifications.store';
|
|
3
|
+
export type NotificationsStylesNames = 'root' | 'notification';
|
|
4
|
+
export type NotificationsCssVariables = {
|
|
5
|
+
root: '--notifications-z-index' | '--notifications-container-width';
|
|
6
|
+
};
|
|
7
|
+
export interface NotificationsProps {
|
|
8
|
+
position?: NotificationPosition;
|
|
9
|
+
autoClose?: number | false;
|
|
10
|
+
transitionDuration?: number;
|
|
11
|
+
allowDragDismiss?: boolean;
|
|
12
|
+
allowScrollDismiss?: boolean;
|
|
13
|
+
containerWidth?: number | string;
|
|
14
|
+
notificationMaxHeight?: number | string;
|
|
15
|
+
limit?: number;
|
|
16
|
+
zIndex?: string | number;
|
|
17
|
+
portalProps?: Record<string, any>;
|
|
18
|
+
store?: NotificationsStore;
|
|
19
|
+
withinPortal?: boolean;
|
|
20
|
+
pauseResetOnHover?: 'all' | 'notification';
|
|
21
|
+
classNames?: Record<string, any>;
|
|
22
|
+
styles?: Record<string, any>;
|
|
23
|
+
vars?: Record<string, any>;
|
|
24
|
+
unstyled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare const Notifications: {
|
|
27
|
+
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
|
|
28
|
+
position: {
|
|
29
|
+
type: PropType<NotificationPosition>;
|
|
30
|
+
default: undefined;
|
|
31
|
+
};
|
|
32
|
+
autoClose: {
|
|
33
|
+
type: PropType<number | false>;
|
|
34
|
+
default: undefined;
|
|
35
|
+
};
|
|
36
|
+
transitionDuration: {
|
|
37
|
+
type: NumberConstructor;
|
|
38
|
+
default: undefined;
|
|
39
|
+
};
|
|
40
|
+
allowDragDismiss: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
44
|
+
allowScrollDismiss: {
|
|
45
|
+
type: BooleanConstructor;
|
|
46
|
+
default: undefined;
|
|
47
|
+
};
|
|
48
|
+
containerWidth: {
|
|
49
|
+
type: PropType<number | string>;
|
|
50
|
+
default: undefined;
|
|
51
|
+
};
|
|
52
|
+
notificationMaxHeight: {
|
|
53
|
+
type: PropType<number | string>;
|
|
54
|
+
default: undefined;
|
|
55
|
+
};
|
|
56
|
+
limit: {
|
|
57
|
+
type: NumberConstructor;
|
|
58
|
+
default: undefined;
|
|
59
|
+
};
|
|
60
|
+
zIndex: {
|
|
61
|
+
type: PropType<number | string>;
|
|
62
|
+
default: undefined;
|
|
63
|
+
};
|
|
64
|
+
portalProps: {
|
|
65
|
+
type: PropType<Record<string, any>>;
|
|
66
|
+
default: undefined;
|
|
67
|
+
};
|
|
68
|
+
store: {
|
|
69
|
+
type: PropType<NotificationsStore>;
|
|
70
|
+
default: undefined;
|
|
71
|
+
};
|
|
72
|
+
withinPortal: {
|
|
73
|
+
type: BooleanConstructor;
|
|
74
|
+
default: undefined;
|
|
75
|
+
};
|
|
76
|
+
pauseResetOnHover: {
|
|
77
|
+
type: PropType<"all" | "notification">;
|
|
78
|
+
default: undefined;
|
|
79
|
+
};
|
|
80
|
+
classNames: {
|
|
81
|
+
type: (ObjectConstructor | FunctionConstructor)[];
|
|
82
|
+
default: undefined;
|
|
83
|
+
};
|
|
84
|
+
styles: {
|
|
85
|
+
type: (ObjectConstructor | FunctionConstructor)[];
|
|
86
|
+
default: undefined;
|
|
87
|
+
};
|
|
88
|
+
vars: {
|
|
89
|
+
type: (ObjectConstructor | FunctionConstructor)[];
|
|
90
|
+
default: undefined;
|
|
91
|
+
};
|
|
92
|
+
unstyled: {
|
|
93
|
+
type: BooleanConstructor;
|
|
94
|
+
default: boolean;
|
|
95
|
+
};
|
|
96
|
+
}>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
97
|
+
[key: string]: any;
|
|
98
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
|
|
99
|
+
classNames: Function | Record<string, any>;
|
|
100
|
+
styles: Function | Record<string, any>;
|
|
101
|
+
limit: number;
|
|
102
|
+
position: NotificationPosition;
|
|
103
|
+
transitionDuration: number;
|
|
104
|
+
zIndex: string | number;
|
|
105
|
+
vars: Function | Record<string, any>;
|
|
106
|
+
unstyled: boolean;
|
|
107
|
+
withinPortal: boolean;
|
|
108
|
+
portalProps: Record<string, any>;
|
|
109
|
+
containerWidth: string | number;
|
|
110
|
+
store: NotificationsStore;
|
|
111
|
+
autoClose: number | false;
|
|
112
|
+
allowDragDismiss: boolean;
|
|
113
|
+
allowScrollDismiss: boolean;
|
|
114
|
+
notificationMaxHeight: string | number;
|
|
115
|
+
pauseResetOnHover: "all" | "notification";
|
|
116
|
+
}, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
117
|
+
P: {};
|
|
118
|
+
B: {};
|
|
119
|
+
D: {};
|
|
120
|
+
C: {};
|
|
121
|
+
M: {};
|
|
122
|
+
Defaults: {};
|
|
123
|
+
}, Readonly<import("vue").ExtractPropTypes<{
|
|
124
|
+
position: {
|
|
125
|
+
type: PropType<NotificationPosition>;
|
|
126
|
+
default: undefined;
|
|
127
|
+
};
|
|
128
|
+
autoClose: {
|
|
129
|
+
type: PropType<number | false>;
|
|
130
|
+
default: undefined;
|
|
131
|
+
};
|
|
132
|
+
transitionDuration: {
|
|
133
|
+
type: NumberConstructor;
|
|
134
|
+
default: undefined;
|
|
135
|
+
};
|
|
136
|
+
allowDragDismiss: {
|
|
137
|
+
type: BooleanConstructor;
|
|
138
|
+
default: undefined;
|
|
139
|
+
};
|
|
140
|
+
allowScrollDismiss: {
|
|
141
|
+
type: BooleanConstructor;
|
|
142
|
+
default: undefined;
|
|
143
|
+
};
|
|
144
|
+
containerWidth: {
|
|
145
|
+
type: PropType<number | string>;
|
|
146
|
+
default: undefined;
|
|
147
|
+
};
|
|
148
|
+
notificationMaxHeight: {
|
|
149
|
+
type: PropType<number | string>;
|
|
150
|
+
default: undefined;
|
|
151
|
+
};
|
|
152
|
+
limit: {
|
|
153
|
+
type: NumberConstructor;
|
|
154
|
+
default: undefined;
|
|
155
|
+
};
|
|
156
|
+
zIndex: {
|
|
157
|
+
type: PropType<number | string>;
|
|
158
|
+
default: undefined;
|
|
159
|
+
};
|
|
160
|
+
portalProps: {
|
|
161
|
+
type: PropType<Record<string, any>>;
|
|
162
|
+
default: undefined;
|
|
163
|
+
};
|
|
164
|
+
store: {
|
|
165
|
+
type: PropType<NotificationsStore>;
|
|
166
|
+
default: undefined;
|
|
167
|
+
};
|
|
168
|
+
withinPortal: {
|
|
169
|
+
type: BooleanConstructor;
|
|
170
|
+
default: undefined;
|
|
171
|
+
};
|
|
172
|
+
pauseResetOnHover: {
|
|
173
|
+
type: PropType<"all" | "notification">;
|
|
174
|
+
default: undefined;
|
|
175
|
+
};
|
|
176
|
+
classNames: {
|
|
177
|
+
type: (ObjectConstructor | FunctionConstructor)[];
|
|
178
|
+
default: undefined;
|
|
179
|
+
};
|
|
180
|
+
styles: {
|
|
181
|
+
type: (ObjectConstructor | FunctionConstructor)[];
|
|
182
|
+
default: undefined;
|
|
183
|
+
};
|
|
184
|
+
vars: {
|
|
185
|
+
type: (ObjectConstructor | FunctionConstructor)[];
|
|
186
|
+
default: undefined;
|
|
187
|
+
};
|
|
188
|
+
unstyled: {
|
|
189
|
+
type: BooleanConstructor;
|
|
190
|
+
default: boolean;
|
|
191
|
+
};
|
|
192
|
+
}>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
193
|
+
[key: string]: any;
|
|
194
|
+
}>, {}, {}, {}, {
|
|
195
|
+
classNames: Function | Record<string, any>;
|
|
196
|
+
styles: Function | Record<string, any>;
|
|
197
|
+
limit: number;
|
|
198
|
+
position: NotificationPosition;
|
|
199
|
+
transitionDuration: number;
|
|
200
|
+
zIndex: string | number;
|
|
201
|
+
vars: Function | Record<string, any>;
|
|
202
|
+
unstyled: boolean;
|
|
203
|
+
withinPortal: boolean;
|
|
204
|
+
portalProps: Record<string, any>;
|
|
205
|
+
containerWidth: string | number;
|
|
206
|
+
store: NotificationsStore;
|
|
207
|
+
autoClose: number | false;
|
|
208
|
+
allowDragDismiss: boolean;
|
|
209
|
+
allowScrollDismiss: boolean;
|
|
210
|
+
notificationMaxHeight: string | number;
|
|
211
|
+
pauseResetOnHover: "all" | "notification";
|
|
212
|
+
}>;
|
|
213
|
+
__isFragment?: never;
|
|
214
|
+
__isTeleport?: never;
|
|
215
|
+
__isSuspense?: never;
|
|
216
|
+
} & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
217
|
+
position: {
|
|
218
|
+
type: PropType<NotificationPosition>;
|
|
219
|
+
default: undefined;
|
|
220
|
+
};
|
|
221
|
+
autoClose: {
|
|
222
|
+
type: PropType<number | false>;
|
|
223
|
+
default: undefined;
|
|
224
|
+
};
|
|
225
|
+
transitionDuration: {
|
|
226
|
+
type: NumberConstructor;
|
|
227
|
+
default: undefined;
|
|
228
|
+
};
|
|
229
|
+
allowDragDismiss: {
|
|
230
|
+
type: BooleanConstructor;
|
|
231
|
+
default: undefined;
|
|
232
|
+
};
|
|
233
|
+
allowScrollDismiss: {
|
|
234
|
+
type: BooleanConstructor;
|
|
235
|
+
default: undefined;
|
|
236
|
+
};
|
|
237
|
+
containerWidth: {
|
|
238
|
+
type: PropType<number | string>;
|
|
239
|
+
default: undefined;
|
|
240
|
+
};
|
|
241
|
+
notificationMaxHeight: {
|
|
242
|
+
type: PropType<number | string>;
|
|
243
|
+
default: undefined;
|
|
244
|
+
};
|
|
245
|
+
limit: {
|
|
246
|
+
type: NumberConstructor;
|
|
247
|
+
default: undefined;
|
|
248
|
+
};
|
|
249
|
+
zIndex: {
|
|
250
|
+
type: PropType<number | string>;
|
|
251
|
+
default: undefined;
|
|
252
|
+
};
|
|
253
|
+
portalProps: {
|
|
254
|
+
type: PropType<Record<string, any>>;
|
|
255
|
+
default: undefined;
|
|
256
|
+
};
|
|
257
|
+
store: {
|
|
258
|
+
type: PropType<NotificationsStore>;
|
|
259
|
+
default: undefined;
|
|
260
|
+
};
|
|
261
|
+
withinPortal: {
|
|
262
|
+
type: BooleanConstructor;
|
|
263
|
+
default: undefined;
|
|
264
|
+
};
|
|
265
|
+
pauseResetOnHover: {
|
|
266
|
+
type: PropType<"all" | "notification">;
|
|
267
|
+
default: undefined;
|
|
268
|
+
};
|
|
269
|
+
classNames: {
|
|
270
|
+
type: (ObjectConstructor | FunctionConstructor)[];
|
|
271
|
+
default: undefined;
|
|
272
|
+
};
|
|
273
|
+
styles: {
|
|
274
|
+
type: (ObjectConstructor | FunctionConstructor)[];
|
|
275
|
+
default: undefined;
|
|
276
|
+
};
|
|
277
|
+
vars: {
|
|
278
|
+
type: (ObjectConstructor | FunctionConstructor)[];
|
|
279
|
+
default: undefined;
|
|
280
|
+
};
|
|
281
|
+
unstyled: {
|
|
282
|
+
type: BooleanConstructor;
|
|
283
|
+
default: boolean;
|
|
284
|
+
};
|
|
285
|
+
}>> & Readonly<{}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
286
|
+
[key: string]: any;
|
|
287
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
|
|
288
|
+
classNames: Function | Record<string, any>;
|
|
289
|
+
styles: Function | Record<string, any>;
|
|
290
|
+
limit: number;
|
|
291
|
+
position: NotificationPosition;
|
|
292
|
+
transitionDuration: number;
|
|
293
|
+
zIndex: string | number;
|
|
294
|
+
vars: Function | Record<string, any>;
|
|
295
|
+
unstyled: boolean;
|
|
296
|
+
withinPortal: boolean;
|
|
297
|
+
portalProps: Record<string, any>;
|
|
298
|
+
containerWidth: string | number;
|
|
299
|
+
store: NotificationsStore;
|
|
300
|
+
autoClose: number | false;
|
|
301
|
+
allowDragDismiss: boolean;
|
|
302
|
+
allowScrollDismiss: boolean;
|
|
303
|
+
notificationMaxHeight: string | number;
|
|
304
|
+
pauseResetOnHover: "all" | "notification";
|
|
305
|
+
}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
306
|
+
classes: Record<string, string>;
|
|
307
|
+
varsResolver: (theme: import("@mantine-vue/core").MantineTheme, props: any, ctx: Record<string, any>) => Record<string, Record<string, string | undefined>>;
|
|
308
|
+
show: typeof import("./notifications.store").showNotification;
|
|
309
|
+
hide: typeof hideNotification;
|
|
310
|
+
update: typeof import("./notifications.store").updateNotification;
|
|
311
|
+
clean: typeof import("./notifications.store").cleanNotifications;
|
|
312
|
+
cleanQueue: typeof import("./notifications.store").cleanNotificationsQueue;
|
|
313
|
+
updateState: typeof import("./notifications.store").updateNotificationsState;
|
|
314
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getAutoClose(autoClose: boolean | number | undefined, notificationAutoClose: boolean | number | undefined): number | boolean | undefined;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NotificationData, NotificationPosition } from '../notifications.store';
|
|
2
|
+
export type GroupedNotifications = Record<NotificationPosition, NotificationData[]>;
|
|
3
|
+
export declare const positions: NotificationPosition[];
|
|
4
|
+
export declare function getGroupedNotifications(notifications: NotificationData[], defaultPosition: NotificationPosition): GroupedNotifications;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CSSProperties } from 'vue';
|
|
2
|
+
import type { NotificationPosition } from './notifications.store';
|
|
3
|
+
export type NotificationTransitionStatus = 'entering' | 'entered' | 'exiting' | 'exited';
|
|
4
|
+
interface NotificationStateStylesProps {
|
|
5
|
+
state: NotificationTransitionStatus;
|
|
6
|
+
maxHeight: number | string;
|
|
7
|
+
position: NotificationPosition;
|
|
8
|
+
transitionDuration: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function getNotificationStateStyles({ state, maxHeight, position, transitionDuration, }: NotificationStateStylesProps): CSSProperties;
|
|
11
|
+
export {};
|
package/lib/index.d.mts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { notifications, showNotification, hideNotification, cleanNotifications, cleanNotificationsQueue, updateNotification, updateNotificationsState, createNotificationsStore, notificationsStore, useNotifications, } from './notifications.store';
|
|
2
|
+
export { Notifications } from './Notifications';
|
|
3
|
+
export type { NotificationData, NotificationPosition, NotificationsState, NotificationsStore, } from './notifications.store';
|
|
4
|
+
export type { NotificationsCssVariables, NotificationsProps, NotificationsStylesNames, } from './Notifications';
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { notifications, showNotification, hideNotification, cleanNotifications, cleanNotificationsQueue, updateNotification, updateNotificationsState, createNotificationsStore, notificationsStore, useNotifications, } from './notifications.store';
|
|
2
|
+
export { Notifications } from './Notifications';
|
|
3
|
+
export type { NotificationData, NotificationPosition, NotificationsState, NotificationsStore, } from './notifications.store';
|
|
4
|
+
export type { NotificationsCssVariables, NotificationsProps, NotificationsStylesNames, } from './Notifications';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
import { type MantineStore } from '@mantine-vue/store';
|
|
3
|
+
export type NotificationPosition = 'top-left' | 'top-right' | 'top-center' | 'bottom-left' | 'bottom-right' | 'bottom-center';
|
|
4
|
+
export interface NotificationData extends Record<`data-${string}`, any> {
|
|
5
|
+
id?: string;
|
|
6
|
+
position?: NotificationPosition;
|
|
7
|
+
message: any;
|
|
8
|
+
autoClose?: boolean | number;
|
|
9
|
+
allowClose?: boolean;
|
|
10
|
+
onClose?: (props: NotificationData) => void;
|
|
11
|
+
onOpen?: (props: NotificationData) => void;
|
|
12
|
+
style?: any;
|
|
13
|
+
withCloseButton?: boolean;
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
export interface NotificationsState {
|
|
17
|
+
notifications: NotificationData[];
|
|
18
|
+
queue: NotificationData[];
|
|
19
|
+
defaultPosition: NotificationPosition;
|
|
20
|
+
limit: number;
|
|
21
|
+
}
|
|
22
|
+
export type NotificationsStore = MantineStore<NotificationsState>;
|
|
23
|
+
export declare const createNotificationsStore: () => MantineStore<NotificationsState>;
|
|
24
|
+
export declare const notificationsStore: MantineStore<NotificationsState>;
|
|
25
|
+
export declare const useNotifications: (store?: NotificationsStore) => Readonly<Ref<NotificationsState>>;
|
|
26
|
+
export declare function updateNotificationsState(store: NotificationsStore, update: (notifications: NotificationData[]) => NotificationData[]): void;
|
|
27
|
+
export declare function showNotification(notification: NotificationData, store?: NotificationsStore): string;
|
|
28
|
+
export declare function hideNotification(id: string, store?: NotificationsStore): string;
|
|
29
|
+
export declare function updateNotification(notification: NotificationData, store?: NotificationsStore): string | undefined;
|
|
30
|
+
export declare function cleanNotifications(store?: NotificationsStore): void;
|
|
31
|
+
export declare function cleanNotificationsQueue(store?: NotificationsStore): void;
|
|
32
|
+
export declare const notifications: {
|
|
33
|
+
readonly show: typeof showNotification;
|
|
34
|
+
readonly hide: typeof hideNotification;
|
|
35
|
+
readonly update: typeof updateNotification;
|
|
36
|
+
readonly clean: typeof cleanNotifications;
|
|
37
|
+
readonly cleanQueue: typeof cleanNotificationsQueue;
|
|
38
|
+
readonly updateState: typeof updateNotificationsState;
|
|
39
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mantine-vue/notifications",
|
|
3
|
+
"version": "1.1.2",
|
|
4
|
+
"description": "Vue notifications system equivalent to @mantine/notifications",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"files": [
|
|
7
|
+
"cjs",
|
|
8
|
+
"esm",
|
|
9
|
+
"lib",
|
|
10
|
+
"styles.css",
|
|
11
|
+
"styles.layer.css",
|
|
12
|
+
"styles"
|
|
13
|
+
],
|
|
14
|
+
"sideEffects": [
|
|
15
|
+
"*.css"
|
|
16
|
+
],
|
|
17
|
+
"main": "./cjs/index.cjs",
|
|
18
|
+
"module": "./esm/index.mjs",
|
|
19
|
+
"types": "./lib/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"import": {
|
|
23
|
+
"types": "./lib/index.d.mts",
|
|
24
|
+
"default": "./esm/index.mjs"
|
|
25
|
+
},
|
|
26
|
+
"require": {
|
|
27
|
+
"types": "./lib/index.d.ts",
|
|
28
|
+
"default": "./cjs/index.cjs"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@mantine-vue/core": "workspace:*",
|
|
34
|
+
"@mantine-vue/hooks": "workspace:*",
|
|
35
|
+
"@mantine-vue/store": "workspace:*",
|
|
36
|
+
"@vue/compiler-dom": "^3.5.0",
|
|
37
|
+
"@vue/test-utils": "^2.4.6",
|
|
38
|
+
"vue": "^3.5.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@mantine-vue/core": "1.1.1",
|
|
42
|
+
"@mantine-vue/hooks": "1.1.2",
|
|
43
|
+
"@mantine-vue/store": "1.1.1",
|
|
44
|
+
"vue": "^3.5.0"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/styles.css
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
._root_1izcx_1 {
|
|
2
|
+
width: calc(100% - var(--mantine-spacing-md) * 2);
|
|
3
|
+
position: fixed;
|
|
4
|
+
z-index: var(--notifications-z-index);
|
|
5
|
+
max-width: var(--notifications-container-width);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
._root_1izcx_1:where([data-position='top-center']) {
|
|
9
|
+
top: var(--mantine-spacing-md);
|
|
10
|
+
left: 50%;
|
|
11
|
+
transform: translateX(-50%);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
._root_1izcx_1:where([data-position='top-left']) {
|
|
15
|
+
top: var(--mantine-spacing-md);
|
|
16
|
+
left: var(--mantine-spacing-md);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
._root_1izcx_1:where([data-position='top-right']) {
|
|
20
|
+
top: var(--mantine-spacing-md);
|
|
21
|
+
right: var(--mantine-spacing-md);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
._root_1izcx_1:where([data-position='bottom-center']) {
|
|
25
|
+
bottom: var(--mantine-spacing-md);
|
|
26
|
+
left: 50%;
|
|
27
|
+
transform: translateX(-50%);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
._root_1izcx_1:where([data-position='bottom-left']) {
|
|
31
|
+
bottom: var(--mantine-spacing-md);
|
|
32
|
+
left: var(--mantine-spacing-md);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
._root_1izcx_1:where([data-position='bottom-right']) {
|
|
36
|
+
bottom: var(--mantine-spacing-md);
|
|
37
|
+
right: var(--mantine-spacing-md);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
._notification_1izcx_40 + ._notification_1izcx_40 {
|
|
41
|
+
margin-top: var(--mantine-spacing-md);
|
|
42
|
+
}
|
|
43
|
+
/*$vite$:1*/
|