/**
 * @license MIT
 * author: Cube Dev Team
 * @cube-dev/ui-kit v0.0.0-canary-6b06f3c
 * Released under the MIT license.
 */

import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useMemo } from 'react';
import { Portal } from '../../../portal/index.js';
import { NotificationsBar } from '../Bar/index.js';
import { NotificationsContext } from './NotificationsContext.js';
import { useNotifications } from './use-notifications.js';
export function NotificationsProvider(props) {
    const { children, rootRef } = props;
    const { notifications, api, addOnDismissListener, onDismissNotification } = useNotifications(rootRef);
    const providerValue = useMemo(() => ({ api, addOnDismissListener }), []);
    return (_jsxs(NotificationsContext.Provider, { value: providerValue, children: [_jsx(Portal, { children: _jsx(NotificationsBar, { items: notifications, onRemoveNotification: api.remove, onDismissNotification: onDismissNotification, children: (notification) => (_jsx(NotificationsBar.Item, { ...notification }, notification.id)) }) }), children] }));
}

        