/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
"use client";
import { Icon } from "../../components/Icon.js";
import "../../components/client/Button/buttonConstants.js";
import { IconButtonBase, renderIconButtonAsChild } from "../../components/client/IconButton/IconButtonBase.js";
import { Progress } from "@yahoo/uds-icons";
import { forwardRef, isValidElement } from "react";
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
//#region src/css-animation/IconButton/IconButton.tsx
/**
* CSS-animation IconButton variant. This component intentionally never imports motion.
*
* @componentType Client component
*/
const IconButton = forwardRef(function IconButton(props, forwardedRef) {
	return /* @__PURE__ */ jsx(IconButtonBase, {
		...props,
		ref: forwardedRef,
		renderIconContent: ({ asChild, loading, name, iconVariant, children, iconClassName, loadingIconClassName, iconSlotClassName, iconSlotProps }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [loading && /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Icon, {
			size: "sm",
			name: Progress,
			variant: iconVariant,
			color: "current",
			className: loadingIconClassName
		}) }), name && !loading && (!asChild && children || /* @__PURE__ */ jsx(Icon, {
			size: "sm",
			name,
			variant: iconVariant,
			color: "current",
			className: [iconClassName, iconSlotClassName].filter(Boolean).join(" "),
			...iconSlotProps
		}))] }),
		renderRoot: ({ asChild, Slot, children, buttonRef, type, htmlName, rootClassName, rest, iconContent }) => {
			if (asChild && isValidElement(children)) return /* @__PURE__ */ jsx(Slot, {
				type,
				className: rootClassName,
				...rest,
				children: renderIconButtonAsChild(children, iconContent)
			});
			return /* @__PURE__ */ jsx("button", {
				ref: buttonRef,
				type,
				className: rootClassName,
				name: htmlName,
				...rest,
				children: iconContent
			});
		}
	});
});
IconButton.displayName = "IconButton";
//#endregion
export { IconButton };
