/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
"use client";
import { Icon } from "../../components/Icon.js";
import { IconSlot } from "../../components/IconSlot.js";
import { ButtonBase, renderButtonChildren } from "../../components/client/Button/ButtonBase.js";
import "../../components/client/Button/buttonConstants.js";
import { Progress } from "@yahoo/uds-icons";
import { forwardRef, isValidElement } from "react";
import { jsx, jsxs } from "react/jsx-runtime";
//#region src/css-animation/Button/Button.tsx
/**
* CSS-animation Button variant. This component intentionally never imports motion.
*
* @componentType Client component
*/
const Button = forwardRef(function Button(props, forwardedRef) {
	return /* @__PURE__ */ jsx(ButtonBase, {
		...props,
		ref: forwardedRef,
		renderStartContent: ({ iconVariant, loading, startIcon, iconContainerClassName, loadingIconClassName, iconClassName, startIconClassName, startIconSlotProps }) => /* @__PURE__ */ jsxs("span", {
			className: iconContainerClassName,
			children: [loading && /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Icon, {
				className: loadingIconClassName,
				size: "sm",
				name: Progress,
				variant: iconVariant,
				color: "current"
			}) }), startIcon && !loading && /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(IconSlot, {
				className: [iconClassName, startIconClassName].filter(Boolean).join(" "),
				icon: startIcon,
				iconProps: {
					size: "sm",
					variant: iconVariant,
					color: "current"
				},
				...startIconSlotProps
			}) })]
		}),
		renderEndContent: ({ endIcon, iconVariant, iconContainerClassName, iconClassName, endIconClassName, endIconSlotProps }) => /* @__PURE__ */ jsx("span", {
			className: iconContainerClassName,
			children: endIcon && /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(IconSlot, {
				className: [iconClassName, endIconClassName].filter(Boolean).join(" "),
				icon: endIcon,
				iconProps: {
					size: "sm",
					variant: iconVariant,
					color: "current"
				},
				...endIconSlotProps
			}) })
		}),
		renderRoot: ({ asChild, Slot, children, buttonRef, type, rootClassName, rest, contentClassName, contentSlotProps, startContent, endContent }) => {
			if (asChild && isValidElement(children)) {
				const childProps = children.props;
				return /* @__PURE__ */ jsx(Slot, {
					type,
					className: rootClassName,
					...rest,
					children: renderButtonChildren(children, childProps, startContent, contentClassName, contentSlotProps, endContent)
				});
			}
			return /* @__PURE__ */ jsxs("button", {
				ref: buttonRef,
				type,
				className: rootClassName,
				...rest,
				children: [
					startContent,
					/* @__PURE__ */ jsx("span", {
						className: contentClassName,
						...contentSlotProps,
						children
					}),
					endContent
				]
			});
		}
	});
});
Button.displayName = "Button";
//#endregion
export { Button };
