/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
"use client";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../../_virtual/_rolldown/runtime.cjs");
const require_styles_styler = require("../../../styles/styler.cjs");
const require_components_client_Pressable = require("../Pressable.cjs");
const require_components_IconSlot = require("../../IconSlot.cjs");
const require_components_Text = require("../../Text.cjs");
const require_components_client_Button = require("../Button.cjs");
const require_components_client_Toast_UDSToastConfigProvider = require("./UDSToastConfigProvider.cjs");
const require_components_client_Toast_ToastContainer = require("./ToastContainer.cjs");
let _yahoo_uds_icons = require("@yahoo/uds-icons");
let react_jsx_runtime = require("react/jsx-runtime");
let motion_react = require("motion/react");
//#region src/components/client/Toast/Toast.tsx
const iconMap = {
	loading: _yahoo_uds_icons.Progress,
	success: _yahoo_uds_icons.CheckCircle,
	error: _yahoo_uds_icons.Error,
	info: _yahoo_uds_icons.Info,
	warning: _yahoo_uds_icons.Warning
};
/**
* **⚙️️ A single Toast notification.
*
* @componentType Client component
*
* @description
* Toasts are short, non-blocking notifications that appear temporarily to communicate system feedback (success, warning, error, info). They may include an optional action and a dismiss control.
*
* Toasts should never interrupt a user’s task flow. If the user must make a decision or cannot proceed until they acknowledge the message, use a Dialog instead.
*
* @see
* Check out the {@link https://uds.build/docs/components/toast Toast Docs} for more info
*
* @example
* ```tsx
* 'use client';
* import { Toast } from "@yahoo/uds";
*
* <Toast variant="info" message="This is a toast" />
*```
*
* @related [Tooltip](https://uds.build/docs/components/tooltip), [Popover](https://uds.build/docs/components/popover)
**/
const Toast = ({ message, onClickCloseButton, size: sizeProp, variant: variantProp, actionButton, onClickActionButton, startIcon, closeIcon = _yahoo_uds_icons.Cross, closeToast, slotProps, className, id, reduceMotion: forceReduceMotion }) => {
	const { iconVariant, iconSize, buttonVariant, buttonSize, size, variant, textVariant, textColor } = require_components_client_Toast_UDSToastConfigProvider.useToastConfig(sizeProp, variantProp);
	const { className: startIconClassName, ...startIconProps } = slotProps?.startIcon ?? {};
	const { className: closeIconContainerClassName, ...closeIconContainerProps } = slotProps?.closeIconContainer ?? {};
	const { className: closeIconClassName, ...closeIconProps } = slotProps?.closeIcon ?? {};
	const reducedMotion = (0, motion_react.useReducedMotion)() || forceReduceMotion;
	const handleClose = () => {
		closeToast?.();
		onClickCloseButton?.(id);
	};
	const classNames = {
		label: require_styles_styler.getStyles({
			toastSizeLabel: size,
			className: "w-full"
		}),
		icon: require_styles_styler.getStyles({
			toastVariantIcon: variant,
			toastSizeIcon: size,
			className: variant === "loading" ? "animate-spin" : void 0
		}),
		actionButton: require_styles_styler.getStyles({
			toastSizeActionButton: size,
			toastVariantActionButton: variant,
			className: "flex-none"
		}),
		closeIconContainer: require_styles_styler.getStyles({
			spacing: "2",
			borderRadius: "full",
			className: require_styles_styler.cx(reducedMotion ? "duration-0" : "duration-120", "transition-[background-color]", "bg-carbon-15/0", "hover:bg-carbon-15/10", "active:bg-carbon-15/15", "uds-ring")
		}),
		closeIcon: require_styles_styler.getStyles({
			toastVariantCloseIcon: variant,
			toastSizeCloseIcon: size
		})
	};
	const iconName = startIcon ?? iconMap[variant];
	return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_client_Toast_ToastContainer.ToastContainer, {
		size,
		variant,
		className,
		children: [
			iconName && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
				icon: iconName,
				iconProps: {
					color: "inherit",
					variant: iconVariant,
					size: iconSize,
					className: require_styles_styler.cx(classNames.icon, startIconClassName),
					...startIconProps
				}
			}),
			/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
				variant: textVariant,
				color: textColor,
				className: classNames.label,
				...slotProps?.label,
				children: message
			}),
			actionButton && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Button.Button, {
				size: buttonSize,
				variant: buttonVariant,
				onClick: onClickActionButton,
				className: classNames.actionButton,
				...slotProps?.actionButton,
				children: actionButton
			}),
			closeIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Pressable.Pressable, {
				onClick: handleClose,
				className: require_styles_styler.cx(classNames.closeIconContainer, closeIconContainerClassName),
				...closeIconContainerProps,
				children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
					icon: closeIcon,
					iconProps: {
						color: "inherit",
						className: require_styles_styler.cx(classNames.closeIcon, closeIconClassName),
						...closeIconProps
					}
				})
			})
		]
	});
};
Toast.displayName = "Toast";
//#endregion
exports.Toast = Toast;
