import { t as e } from "./utils-CHlhTiFC.js";
import { t } from "./dist-C2Jrcfwk.js";
import { useEffect as n, useEffectEvent as r, useState as i } from "react";
import { jsx as a } from "react/jsx-runtime";
//#region src/components/ui/segmentedControl.tsx
var o = t("inline-flex bg-primary-gray-300 dark:bg-primary-gray-600 rounded-none", {
	variants: {
		variant: {
			normal: "border border-primary-gray-300 dark:border-primary-gray-600",
			light: "border-0 border-primary-black dark:border-primary-gray-300"
		},
		size: {
			sm: "p-[3px]",
			base: "p-[5px]"
		}
	},
	defaultVariants: {
		size: "base",
		variant: "normal"
	}
}), s = t("bg-primary-white dark:bg-primary-gray-550 shadow-xs disabled:opacity-50 disabled:cursor-not-allowed", {
	variants: { color: {
		blue: "text-primary-blue-600 dark:text-primary-white",
		red: "text-accent-dark-red dark:text-primary-white",
		black: "text-primary-gray-700 dark:text-primary-white",
		custom: "text-custom-color-600 dark:text-primary-white"
	} },
	defaultVariants: { color: "red" }
}), c = t("text-primary-black dark:text-primary-gray-200 hover:bg-primary-gray-400 dark:hover:bg-primary-gray-650 disabled:hover:bg-transparent disabled:hover:text-inherit disabled:cursor-not-allowed disabled:opacity-25", {
	variants: { color: {
		blue: "hover:text-primary-blue-600 dark:hover:text-primary-white disabled:hover:text-inherit",
		red: "hover:text-accent-dark-red dark:hover:text-primary-white disabled:hover:text-inherit",
		black: "hover:text-primary-gray-600 dark:hover:text-primary-white disabled:hover:text-inherit",
		custom: "hover:text-custom-color-600 dark:hover:text-primary-white disabled:hover:text-inherit"
	} },
	defaultVariants: { color: "red" }
});
function l(t) {
	let { options: l, defaultValue: u, onValueChange: d, className: f, size: p, variant: m, color: h, value: g, disabled: _, buttonStyle: v, classNames: y } = t, [b, x] = i(g || u || l[0].value), S = (e) => {
		x(e), d?.(e);
	}, C = r((e) => {
		x(e || u || l[0].value);
	});
	return n(() => {
		C(g);
	}, [g]), /* @__PURE__ */ a("div", {
		className: e(o({
			size: p,
			variant: m
		}), f, y?.control),
		children: l.map((t) => /* @__PURE__ */ a("button", {
			disabled: _ || t.disabled,
			type: "button",
			onClick: () => S(t.value),
			className: e("px-4 py-2 text-sm rounded-sm transition-all duration-200", b === t.value ? s({ color: h }) : c({ color: h }), y?.items, b === t.value && y?.active),
			style: v?.items || b === t.value && v?.active ? {
				...v?.items || {},
				...b === t.value ? v?.active : {}
			} : void 0,
			children: t.label
		}, t.value))
	});
}
//#endregion
export { l as SegmentedControl };

//# sourceMappingURL=SegmentedControl.js.map