/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
"use client";
import { cx, getStyles } from "../../styles/styler.js";
import { Box } from "../../components/Box.js";
import { RadioBase } from "../../components/client/Radio/RadioBase.js";
import { forwardRef } from "react";
import { jsx, jsxs } from "react/jsx-runtime";
//#region src/css-animation/Radio/Radio.tsx
/**
* CSS-animation Radio variant. This component intentionally never imports motion.
*
* @componentType Client component
*
* @example
* ```tsx
* 'use client';
* import { Radio } from '@yahoo/uds/css-animation';
*
* <Radio label="Name" />
* ```
*/
const Radio = forwardRef(function Radio(props, parentRef) {
	const cssAnimationDuration = "duration-120";
	return /* @__PURE__ */ jsx(RadioBase, {
		...props,
		ref: parentRef,
		cssAnimationDuration,
		renderRoot: ({ className, style, rootSlotProps, hasLabel, children }) => {
			return /* @__PURE__ */ jsx(hasLabel ? "label" : "div", {
				className: cx("group", className),
				"data-testid": "container",
				style,
				tabIndex: -1,
				...rootSlotProps,
				children
			});
		},
		renderIndicator: ({ size, variant, checked, disabled, cssAnimationDuration, radioSlotProps, radioIconSlotProps, children }) => {
			const classNames = {
				radio: getStyles({
					radioSizeRadio: size,
					radioVariantRadio: variant,
					radioVariantValueRadio: checked ? "checked" : "unchecked",
					className: cx([
						"border",
						"uds-ring",
						"uds-ring-within",
						!disabled && "group-hover:scale-110",
						!disabled && !checked && "group-active:scale-90",
						!disabled && !checked && "group-active:uds-inset-shadow-lg-invert",
						!disabled && checked && "group-hover:uds-inset-shadow-lg-invert",
						cssAnimationDuration,
						"transition-[background-color,border-color,transform]",
						"transition-shadow"
					])
				}),
				radioCircle: getStyles({
					radioVariantRadioCircle: variant,
					radioVariantValueRadioCircle: checked ? "checked" : "unchecked",
					className: cx([
						"pointer-events-none",
						"w-[8px]",
						"h-[8px]",
						checked ? "opacity-100" : "opacity-0",
						cssAnimationDuration,
						"transition-opacity"
					])
				})
			};
			return /* @__PURE__ */ jsxs(Box, {
				position: "relative",
				borderRadius: "full",
				alignItems: "center",
				justifyContent: "center",
				flex: "none",
				className: classNames.radio,
				...radioSlotProps,
				children: [children, /* @__PURE__ */ jsx(Box, {
					borderRadius: "full",
					className: classNames.radioCircle,
					...radioIconSlotProps
				})]
			});
		}
	});
});
Radio.displayName = "Radio";
//#endregion
export { Radio };
