Project Init

This commit is contained in:
Muluhabt
2026-05-29 15:23:46 +03:00
commit 2fbc557aac
67387 changed files with 6063341 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
'use client';
import { jsx } from 'react/jsx-runtime';
import { forwardRef, useRef, useEffect } from 'react';
import { Notification } from '@mantine/core';
import { getAutoClose } from './get-auto-close/get-auto-close.mjs';
const NotificationContainer = forwardRef(
({ data, onHide, autoClose, ...others }, ref) => {
const { autoClose: _autoClose, message, ...notificationProps } = data;
const autoCloseDuration = getAutoClose(autoClose, data.autoClose);
const autoCloseTimeout = useRef(-1);
const cancelAutoClose = () => window.clearTimeout(autoCloseTimeout.current);
const handleHide = () => {
onHide(data.id);
cancelAutoClose();
};
const handleAutoClose = () => {
if (typeof autoCloseDuration === "number") {
autoCloseTimeout.current = window.setTimeout(handleHide, autoCloseDuration);
}
};
useEffect(() => {
data.onOpen?.(data);
}, []);
useEffect(() => {
handleAutoClose();
return cancelAutoClose;
}, [autoCloseDuration]);
return /* @__PURE__ */ jsx(
Notification,
{
...others,
...notificationProps,
onClose: handleHide,
ref,
onMouseEnter: cancelAutoClose,
onMouseLeave: handleAutoClose,
children: message
}
);
}
);
NotificationContainer.displayName = "@mantine/notifications/NotificationContainer";
export { NotificationContainer };
//# sourceMappingURL=NotificationContainer.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,160 @@
'use client';
import { jsx, jsxs } from 'react/jsx-runtime';
import { useRef, useEffect } from 'react';
import { Transition as Transition$1, TransitionGroup } from 'react-transition-group';
import { getDefaultZIndex, createVarsResolver, rem, factory, useProps, useMantineTheme, useStyles, OptionalPortal, Box, RemoveScroll } from '@mantine/core';
import { useForceUpdate, useReducedMotion, useDidUpdate } from '@mantine/hooks';
import { getGroupedNotifications, positions } from './get-grouped-notifications/get-grouped-notifications.mjs';
import { getNotificationStateStyles } from './get-notification-state-styles.mjs';
import { NotificationContainer } from './NotificationContainer.mjs';
import classes from './Notifications.module.css.mjs';
import { notificationsStore, useNotifications, hideNotification, notifications } from './notifications.store.mjs';
const Transition = Transition$1;
const defaultProps = {
position: "bottom-right",
autoClose: 4e3,
transitionDuration: 250,
containerWidth: 440,
notificationMaxHeight: 200,
limit: 5,
zIndex: getDefaultZIndex("overlay"),
store: notificationsStore,
withinPortal: true
};
const varsResolver = createVarsResolver((_, { zIndex, containerWidth }) => ({
root: {
"--notifications-z-index": zIndex?.toString(),
"--notifications-container-width": rem(containerWidth)
}
}));
const Notifications = factory((_props, ref) => {
const props = useProps("Notifications", defaultProps, _props);
const {
classNames,
className,
style,
styles,
unstyled,
vars,
position,
autoClose,
transitionDuration,
containerWidth,
notificationMaxHeight,
limit,
zIndex,
store,
portalProps,
withinPortal,
...others
} = props;
const theme = useMantineTheme();
const data = useNotifications(store);
const forceUpdate = useForceUpdate();
const shouldReduceMotion = useReducedMotion();
const refs = useRef({});
const previousLength = useRef(0);
const reduceMotion = theme.respectReducedMotion ? shouldReduceMotion : false;
const duration = reduceMotion ? 1 : transitionDuration;
const getStyles = useStyles({
name: "Notifications",
classes,
props,
className,
style,
classNames,
styles,
unstyled,
vars,
varsResolver
});
useEffect(() => {
store?.updateState((current) => ({
...current,
limit: limit || 5,
defaultPosition: position
}));
}, [limit, position]);
useDidUpdate(() => {
if (data.notifications.length > previousLength.current) {
setTimeout(() => forceUpdate(), 0);
}
previousLength.current = data.notifications.length;
}, [data.notifications]);
const grouped = getGroupedNotifications(data.notifications, position);
const groupedComponents = positions.reduce(
(acc, pos) => {
acc[pos] = grouped[pos].map(({ style: notificationStyle, ...notification }) => /* @__PURE__ */ jsx(
Transition,
{
timeout: duration,
onEnter: () => refs.current[notification.id].offsetHeight,
nodeRef: { current: refs.current[notification.id] },
children: (state) => /* @__PURE__ */ jsx(
NotificationContainer,
{
ref: (node) => {
if (node) {
refs.current[notification.id] = node;
}
},
data: notification,
onHide: (id) => hideNotification(id, store),
autoClose,
...getStyles("notification", {
style: {
...getNotificationStateStyles({
state,
position: pos,
transitionDuration: duration,
maxHeight: notificationMaxHeight
}),
...notificationStyle
}
})
}
)
},
notification.id
));
return acc;
},
{}
);
return /* @__PURE__ */ jsxs(OptionalPortal, { withinPortal, ...portalProps, children: [
/* @__PURE__ */ jsx(Box, { ...getStyles("root"), "data-position": "top-center", ref, ...others, children: /* @__PURE__ */ jsx(TransitionGroup, { children: groupedComponents["top-center"] }) }),
/* @__PURE__ */ jsx(Box, { ...getStyles("root"), "data-position": "top-left", ...others, children: /* @__PURE__ */ jsx(TransitionGroup, { children: groupedComponents["top-left"] }) }),
/* @__PURE__ */ jsx(
Box,
{
...getStyles("root", { className: RemoveScroll.classNames.fullWidth }),
"data-position": "top-right",
...others,
children: /* @__PURE__ */ jsx(TransitionGroup, { children: groupedComponents["top-right"] })
}
),
/* @__PURE__ */ jsx(
Box,
{
...getStyles("root", { className: RemoveScroll.classNames.fullWidth }),
"data-position": "bottom-right",
...others,
children: /* @__PURE__ */ jsx(TransitionGroup, { children: groupedComponents["bottom-right"] })
}
),
/* @__PURE__ */ jsx(Box, { ...getStyles("root"), "data-position": "bottom-left", ...others, children: /* @__PURE__ */ jsx(TransitionGroup, { children: groupedComponents["bottom-left"] }) }),
/* @__PURE__ */ jsx(Box, { ...getStyles("root"), "data-position": "bottom-center", ...others, children: /* @__PURE__ */ jsx(TransitionGroup, { children: groupedComponents["bottom-center"] }) })
] });
});
Notifications.classes = classes;
Notifications.displayName = "@mantine/notifications/Notifications";
Notifications.show = notifications.show;
Notifications.hide = notifications.hide;
Notifications.update = notifications.update;
Notifications.clean = notifications.clean;
Notifications.cleanQueue = notifications.cleanQueue;
Notifications.updateState = notifications.updateState;
export { Notifications };
//# sourceMappingURL=Notifications.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
'use client';
var classes = {"root":"m_b37d9ac7","notification":"m_5ed0edd0"};
export { classes as default };
//# sourceMappingURL=Notifications.module.css.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Notifications.module.css.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}

View File

@@ -0,0 +1,13 @@
'use client';
function getAutoClose(autoClose, notificationAutoClose) {
if (typeof notificationAutoClose === "number") {
return notificationAutoClose;
}
if (notificationAutoClose === false || autoClose === false) {
return false;
}
return autoClose;
}
export { getAutoClose };
//# sourceMappingURL=get-auto-close.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"get-auto-close.mjs","sources":["../../src/get-auto-close/get-auto-close.ts"],"sourcesContent":["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"],"names":[],"mappings":";AAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACd,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GACA,qBAAA,CAAA,CACA,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,MAA0B,QAAA,CAAA,CAAU,CAAA;AAC7C,CAAA,CAAA,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACT,CAAA;AAEA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,qBAAA,CAAA,CAAA,CAAA,CAAA,CAA0B,CAAA,CAAA,CAAA,CAAA,CAAA,IAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,KAAA,CAAA,CAAO,CAAA;AAC1D,CAAA,CAAA,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACT,CAAA;AAEA,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACT,CAAA;;"}

View File

@@ -0,0 +1,24 @@
'use client';
const positions = [
"bottom-center",
"bottom-left",
"bottom-right",
"top-center",
"top-left",
"top-right"
];
function getGroupedNotifications(notifications, defaultPosition) {
return notifications.reduce(
(acc, notification) => {
acc[notification.position || defaultPosition].push(notification);
return acc;
},
positions.reduce((acc, item) => {
acc[item] = [];
return acc;
}, {})
);
}
export { getGroupedNotifications, positions };
//# sourceMappingURL=get-grouped-notifications.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"get-grouped-notifications.mjs","sources":["../../src/get-grouped-notifications/get-grouped-notifications.ts"],"sourcesContent":["import { 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"],"names":[],"mappings":";AAIO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,SAAA,CAAA,CAAA,CAAoC,CAAA;AAAA,CAAA,CAC/C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA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AA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAA,CAAE,CAAA,CAAA,CAAA,EAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAA,CAAA;AAC/D,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACT,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6B,CAAC,CAAA,CAAA,CAAA,CAAA,CAAK,IAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA;AACpD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAI,IAAI,CAAA,CAAC,CAAA;AACb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACT,CAAA,EAAG,CAAA,CAA0B,CAAA;AAAA,CAAA,CAAA,CAC/B,CAAA;AACF,CAAA;;"}

View File

@@ -0,0 +1,49 @@
'use client';
const transforms = {
left: "translateX(-100%)",
right: "translateX(100%)",
"top-center": "translateY(-100%)",
"bottom-center": "translateY(100%)"
};
const noTransform = {
left: "translateX(0)",
right: "translateX(0)",
"top-center": "translateY(0)",
"bottom-center": "translateY(0)"
};
function getNotificationStateStyles({
state,
maxHeight,
position,
transitionDuration
}) {
const [vertical, horizontal] = position.split("-");
const property = horizontal === "center" ? `${vertical}-center` : horizontal;
const commonStyles = {
opacity: 0,
maxHeight,
transform: transforms[property],
transitionDuration: `${transitionDuration}ms, ${transitionDuration}ms, ${transitionDuration}ms`,
transitionTimingFunction: "cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear",
transitionProperty: "opacity, transform, max-height"
};
const inState = {
opacity: 1,
transform: noTransform[property]
};
const outState = {
opacity: 0,
maxHeight: 0,
transform: transforms[property]
};
const transitionStyles = {
entering: inState,
entered: inState,
exiting: outState,
exited: outState
};
return { ...commonStyles, ...transitionStyles[state] };
}
export { getNotificationStateStyles };
//# sourceMappingURL=get-notification-state-styles.mjs.map

File diff suppressed because one or more lines are too long

3
node_modules/@mantine/notifications/esm/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export { cleanNotifications, cleanNotificationsQueue, createNotificationsStore, hideNotification, notifications, notificationsStore, showNotification, updateNotification, updateNotificationsState, useNotifications } from './notifications.store.mjs';
export { Notifications } from './Notifications.mjs';
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}

View File

@@ -0,0 +1,94 @@
'use client';
import { randomId } from '@mantine/hooks';
import { createStore, useStore } from '@mantine/store';
function getDistributedNotifications(data, defaultPosition, limit) {
const queue = [];
const notifications2 = [];
const count = {};
for (const item of data) {
const position = item.position || defaultPosition;
count[position] = count[position] || 0;
count[position] += 1;
if (count[position] <= limit) {
notifications2.push(item);
} else {
queue.push(item);
}
}
return { notifications: notifications2, queue };
}
const createNotificationsStore = () => createStore({
notifications: [],
queue: [],
defaultPosition: "bottom-right",
limit: 5
});
const notificationsStore = createNotificationsStore();
const useNotifications = (store = notificationsStore) => useStore(store);
function updateNotificationsState(store, update) {
const state = store.getState();
const notifications2 = update([...state.notifications, ...state.queue]);
const updated = getDistributedNotifications(notifications2, state.defaultPosition, state.limit);
store.setState({
notifications: updated.notifications,
queue: updated.queue,
limit: state.limit,
defaultPosition: state.defaultPosition
});
}
function showNotification(notification, store = notificationsStore) {
const id = notification.id || randomId();
updateNotificationsState(store, (notifications2) => {
if (notification.id && notifications2.some((n) => n.id === notification.id)) {
return notifications2;
}
return [...notifications2, { ...notification, id }];
});
return id;
}
function hideNotification(id, store = notificationsStore) {
updateNotificationsState(
store,
(notifications2) => notifications2.filter((notification) => {
if (notification.id === id) {
notification.onClose?.(notification);
return false;
}
return true;
})
);
return id;
}
function updateNotification(notification, store = notificationsStore) {
updateNotificationsState(
store,
(notifications2) => notifications2.map((item) => {
if (item.id === notification.id) {
return { ...item, ...notification };
}
return item;
})
);
return notification.id;
}
function cleanNotifications(store = notificationsStore) {
updateNotificationsState(store, () => []);
}
function cleanNotificationsQueue(store = notificationsStore) {
updateNotificationsState(
store,
(notifications2) => notifications2.slice(0, store.getState().limit)
);
}
const notifications = {
show: showNotification,
hide: hideNotification,
update: updateNotification,
clean: cleanNotifications,
cleanQueue: cleanNotificationsQueue,
updateState: updateNotificationsState
};
export { cleanNotifications, cleanNotificationsQueue, createNotificationsStore, hideNotification, notifications, notificationsStore, showNotification, updateNotification, updateNotificationsState, useNotifications };
//# sourceMappingURL=notifications.store.mjs.map

File diff suppressed because one or more lines are too long