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

import { jsx as _jsx } from "react/jsx-runtime";
import { useEvent } from '../../../../_internal';
import { tasty } from '../../../../tasty';
import { Button } from '../../../actions';
import { useNotificationContext } from './NotificationProvider';
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 }));
}

        