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

import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useMemo } from 'react';
import { Portal } from '../../../portal';
import { NotificationsBar } from '../Bar';
import { NotificationsContext } from './NotificationsContext';
import { useNotifications } from './use-notifications';
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] }));
}

        