/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-29d58ba | Cube Dev Team */
import { tasty } from "../../../tasty/tasty.js";
import { useEvent } from "../../../_internal/hooks/use-event.js";
import { _Item } from "../../content/Item/Item.js";
import { Button } from "../Button/Button.js";
import { useMemo } from "react";
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
import { IconAlertTriangle, IconCircleCheck, IconExclamationCircle, IconInfoCircle, IconX } from "@tabler/icons-react";

//#region src/components/actions/Banner/Banner.tsx
const DEFAULT_ICONS = {
	danger: /* @__PURE__ */ jsx(IconExclamationCircle, {}),
	warning: /* @__PURE__ */ jsx(IconAlertTriangle, {}),
	note: /* @__PURE__ */ jsx(IconInfoCircle, {}),
	success: /* @__PURE__ */ jsx(IconCircleCheck, {})
};
const BannerElement = tasty(_Item, { styles: {
	width: "100%",
	Description: {
		textOverflow: "ellipsis / 2",
		whiteSpace: "normal"
	},
	Actions: { gap: "1x" }
} });
const BannerActionElement = tasty(_Item.Action, {
	type: "outline",
	styles: {
		preset: "t3m",
		border: "#clear"
	}
});
const BannerLinkElement = tasty(Button, {
	type: "link",
	size: "inline",
	styles: {
		color: "#white",
		textDecoration: "underline"
	}
});
/**
* Sub-component for action buttons within a Banner.
* Automatically styled to match the banner's theme.
*/
function BannerAction(props) {
	return /* @__PURE__ */ jsx(BannerActionElement, { ...props });
}
/**
* Sub-component for inline links within Banner content.
* Styled with white color and underline to stand out against the banner background.
*/
function BannerLink(props) {
	return /* @__PURE__ */ jsx(BannerLinkElement, { ...props });
}
/**
* Banner displays prominent messages and notifications to users.
* Supports different themes (danger, warning, note, success) with appropriate icons.
* Use Banner.Action for action buttons and Banner.Link for inline links.
*/
function Banner(props) {
	const { theme = "note", actions, isDismissible = false, onDismiss, children, icon, ...rest } = props;
	const onDismissEvent = useEvent(() => {
		onDismiss?.();
	});
	const defaultIcon = useMemo(() => DEFAULT_ICONS[theme], [theme]);
	const hasActions = !!(actions || isDismissible);
	return /* @__PURE__ */ jsx(BannerElement, {
		qa: "Banner",
		role: "status",
		type: "primary",
		theme,
		size: "large",
		icon: icon ?? defaultIcon,
		...rest,
		actions: hasActions ? /* @__PURE__ */ jsxs(Fragment$1, { children: [actions, isDismissible && /* @__PURE__ */ jsx(_Item.Action, {
			icon: /* @__PURE__ */ jsx(IconX, {}),
			tooltip: "Hide banner",
			onPress: onDismissEvent
		})] }) : void 0,
		children
	});
}
Banner.Action = BannerAction;
Banner.Link = BannerLink;

//#endregion
export { Banner, BannerAction, BannerLink };
//# sourceMappingURL=Banner.js.map