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

import { jsx as _jsx } from "react/jsx-runtime";
import { useEvent } from '../../../../_internal/index.js';
import { tasty } from '../../../../tasty/index.js';
import { Button } from '../../../actions/index.js';
import { useNotificationContext } from './NotificationProvider.js';
const Action = tasty(Button, {
    styles: {
        display: 'block',
        whiteSpace: 'nowrap',
        textOverflow: 'ellipsis',
        overflow: 'hidden',
        color: {
            '': '#purple-text',
            primary: '#purple-text',
            secondary: '#dark-03',
        },
    },
});
/**
 * @internal This component is unstable and must not be used outside of `NotificationView`.
 */
export function NotificationAction(props) {
    const { children, onPress, type = 'primary', disableCloseOnAction = type !== 'primary', ...buttonProps } = props;
    const { onClose } = useNotificationContext();
    const onPressEvent = useEvent((e) => {
        onPress?.(e);
        if (!disableCloseOnAction) {
            onClose?.();
        }
    });
    return (_jsx(Action, { ...buttonProps, type: "link", mods: { primary: type === 'primary', secondary: type === 'secondary' }, onPress: onPressEvent, children: children }));
}

        