/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
"use client";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
const require_styles_styler = require("../../../styles/styler.cjs");
const require_components_Icon = require("../../Icon.cjs");
const require_components_Box = require("../../Box.cjs");
const require_hooks_usePrefersReducedMotion = require("../../../hooks/usePrefersReducedMotion.cjs");
const require_components_client_SpringMotionConfig = require("../SpringMotionConfig.cjs");
const require_components_client_Checkbox_checkboxConstants = require("./checkboxConstants.cjs");
const require_components_client_Checkbox_CheckboxBase = require("./CheckboxBase.cjs");
let react = require("react");
react = require_runtime.__toESM(react);
let react_jsx_runtime = require("react/jsx-runtime");
let motion_react = require("motion/react");
//#region src/components/client/Checkbox/Checkbox.tsx
const MotionBox = motion_react.m.create(require_components_Box.Box);
MotionBox.displayName = "CheckboxMotionBox";
const hoverTransition = {
	layoutVariant: "smooth",
	layoutSpeed: "3"
};
const pressTransition = {
	layoutVariant: "veryBouncy",
	layoutSpeed: "4"
};
/**
* **⚙️️ An checkbox.
*
* @componentType Client component
*
* @description
* A checkbox component allows users to select one or multiple options from a set. It represents a binary state, typically as checked or unchecked, and optionally includes a third "indeterminate" state to indicate partial selection.
*
* @see
* Check out the {@link https://uds.build/docs/components/checkbox Checkbox Docs} for more info
*
* @usage
* - Forms: checkbox
*
* @example
* ```tsx
* 'use client';
* import { Checkbox } from "@yahoo/uds";
*
* <Checkbox label="Name" required />
*```
*
* @related [Radio](https://uds.build/docs/components/radio), [Switch](https://uds.build/docs/components/switch), [Input](https://uds.build/docs/components/input).
**/
const Checkbox = (0, react.forwardRef)(function Checkbox({ reduceMotion: forceReduceMotion, ...props }, parentRef) {
	const prefersReducedMotion = require_hooks_usePrefersReducedMotion.usePrefersReducedMotion();
	const reduceMotion = forceReduceMotion ? "always" : "user";
	const cssAnimationDuration = prefersReducedMotion || forceReduceMotion ? "duration-0" : "duration-120";
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Checkbox_CheckboxBase.CheckboxBase, {
		...props,
		ref: parentRef,
		cssAnimationDuration,
		enableInteractionTracking: true,
		renderRoot: ({ className, style, rootSlotProps, hasLabel, isPressed, onHoverStart, onHoverEnd, onTapStart, onTapEnd, children }) => {
			const RootElement = hasLabel ? motion_react.m.label : motion_react.m.div;
			return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_SpringMotionConfig.SpringMotionConfig, {
				reducedMotion: reduceMotion,
				...isPressed ? pressTransition : hoverTransition,
				children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RootElement, {
					className,
					"data-testid": "container",
					style,
					onHoverStart,
					onHoverEnd,
					onTapStart,
					onTap: onTapEnd,
					onTapCancel: onTapEnd,
					tabIndex: -1,
					...rootSlotProps,
					children
				})
			});
		},
		renderIndicator: ({ size, variant, valueState, checked, showHoverEffect, showPressedEffect, cssAnimationDuration, checkIcon, checkboxSlotProps, iconSlotProps, children }) => {
			const scale = showPressedEffect ? .9 : showHoverEffect ? 1.1 : 1;
			const checkOpacity = !checked ? require_styles_styler.cx("opacity-0") : showPressedEffect ? require_styles_styler.cx("opacity-55") : require_styles_styler.cx("opacity-100");
			const classNames = {
				checkbox: require_styles_styler.getStyles({
					checkboxSizeCheckbox: size,
					checkboxVariantCheckbox: variant,
					checkboxVariantValueCheckbox: valueState,
					className: require_styles_styler.cx("uds-ring", "uds-ring-within", cssAnimationDuration, "transition-[background-color,border-color,box-shadow]")
				}),
				check: require_styles_styler.getStyles({
					checkboxVariantCheckboxIcon: variant,
					checkboxVariantValueCheckboxIcon: valueState,
					className: require_styles_styler.cx("pointer-events-none", checkOpacity, cssAnimationDuration, "transition-opacity")
				})
			};
			return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(MotionBox, {
				position: "relative",
				className: classNames.checkbox,
				alignItems: "center",
				justifyContent: "center",
				flex: "none",
				animate: { scale },
				...checkboxSlotProps,
				children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Icon.Icon, {
					name: checkIcon,
					size: "sm",
					className: classNames.check,
					...iconSlotProps
				})]
			});
		}
	});
});
Checkbox.displayName = "Checkbox";
//#endregion
exports.Checkbox = Checkbox;
exports.SIZES = require_components_client_Checkbox_checkboxConstants.SIZES;
exports.VARIANTS = require_components_client_Checkbox_checkboxConstants.VARIANTS;
