"use client";
import { jsx as _jsx } from "react/jsx-runtime";
import { cnb } from "cnbuilder";
import { forwardRef } from "react";
import { Button } from "../button/Button.js";
import { bem } from "../utils/bem.js";
import { useCurrentToastActions } from "./useCurrentToastActions.js";
const styles = bem("rmd-toast-action");
const noop = ()=>{
// do nothing
};
/**
 * **Client Component**
 *
 * This button will automatically close the toast when clicked unless
 * `event.stopPropagation()` is called from the `onClick` prop.
 *
 * @see {@link https://react-md.dev/components/snackbar | Snackbar Demos}
 * @since 6.0.0
 */ export const ToastActionButton = /*#__PURE__*/ forwardRef(function ToastActionButton(props, ref) {
    const { className, children, theme = "secondary", onClick = noop, reordered, ...remaining } = props;
    const { removeToast } = useCurrentToastActions();
    return /*#__PURE__*/ _jsx(Button, {
        ...remaining,
        ref: ref,
        onClick: (event)=>{
            onClick(event);
            if (event.isPropagationStopped()) {
                return;
            }
            removeToast(true);
        },
        theme: theme,
        className: cnb(styles({
            reordered
        }), className),
        children: children
    });
});

//# sourceMappingURL=ToastActionButton.js.map