/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-af8d194 | Cube Dev Team */
import { tasty } from "../../../../tasty/tasty.js";
import { useEvent } from "../../../../_internal/hooks/use-event.js";
import { Button } from "../../../actions/index.js";
import { useNotificationContext } from "./NotificationProvider.js";
import { jsx } from "react/jsx-runtime";

//#region src/components/overlays/NewNotifications/NotificationView/NotificationAction.tsx
const Action = tasty(Button, { styles: {
	display: "block",
	whiteSpace: "nowrap",
	textOverflow: "ellipsis",
	overflow: "hidden",
	color: {
		"": "#primary-text",
		primary: "#primary-text",
		secondary: "#dark-03"
	}
} });
/**
* @internal This component is unstable and must not be used outside of `NotificationView`.
*/
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 /* @__PURE__ */ jsx(Action, {
		...buttonProps,
		type: "link",
		mods: {
			primary: type === "primary",
			secondary: type === "secondary"
		},
		onPress: onPressEvent,
		children
	});
}

//#endregion
export { NotificationAction };
//# sourceMappingURL=NotificationAction.js.map