import { t as e } from "../chunks/ui.module-BisoTevy.js";
import { useId as t } from "react";
import { cn as n } from "@ryuzaki13/react-foundation-lib/utils";
import { jsx as r, jsxs as i } from "react/jsx-runtime";
//#region src/toggle/stringToggleState.ts
var a = "true", o = "false";
function s(e, t) {
	return typeof e == "string" ? e : t;
}
var c = {
	row: "FFyoOs",
	wrapper: "zPYy7T",
	input: "j6ek6R",
	track: "HFTPXI",
	thumb: "_0RK4xF",
	unchecked: "kDPnKt",
	checked: "DQHqws",
	option: "nCQ9v4"
};
//#endregion
//#region src/toggle/Toggle.tsx
function l({ label: a, description: o, placeholder: s, disabled: l, size: u, className: d, onChange: f, value: p, id: m, checkedText: h = "ВКЛ", uncheckedText: g = "ВЫКЛ", labelPosition: _ = "before", ...v }) {
	let y = t(), b = m ?? y, x = o ? `${b}-description` : void 0, S = a ?? s, C = !!p, w = !S && !v["aria-label"] ? `${g} / ${h}` : void 0, T = S ? /* @__PURE__ */ r("label", {
		htmlFor: b,
		className: e.uiLabel,
		children: S
	}) : null;
	return /* @__PURE__ */ i("div", {
		className: n(e.uiElement, l && e.disabled, u && e.uiSizable, u && e[u], d),
		"aria-disabled": l || void 0,
		children: [/* @__PURE__ */ i("div", {
			className: c.row,
			children: [
				_ === "before" && T,
				/* @__PURE__ */ i("div", {
					className: c.wrapper,
					children: [/* @__PURE__ */ r("input", {
						...v,
						id: b,
						type: "checkbox",
						role: "switch",
						checked: C,
						disabled: l,
						"aria-checked": C,
						"aria-describedby": x,
						"aria-label": w,
						className: n(e.uiInputControl, c.input),
						onChange: (e) => f?.(e.currentTarget.checked)
					}), /* @__PURE__ */ i("div", {
						className: c.track,
						"data-disabled": l || void 0,
						"aria-hidden": "true",
						children: [
							/* @__PURE__ */ r("div", { className: c.thumb }),
							/* @__PURE__ */ r("div", {
								className: n(c.option, c.unchecked),
								children: g
							}),
							/* @__PURE__ */ r("div", {
								className: n(c.option, c.checked),
								children: h
							})
						]
					})]
				}),
				_ === "after" && T
			]
		}), o && /* @__PURE__ */ r("p", {
			id: x,
			className: e.uiDescription,
			children: o
		})]
	});
}
//#endregion
//#region src/toggle/StringToggle.tsx
function u({ value: e, onChange: t, checkedValue: n, uncheckedValue: i, defaultChecked: c, ...u }) {
	let d = s(n, a), f = s(i, o), p = e === d;
	return /* @__PURE__ */ r(l, {
		...u,
		value: p,
		onChange: (e) => t(e ? d : f)
	});
}
//#endregion
export { a as DEFAULT_STRING_TOGGLE_CHECKED_VALUE, o as DEFAULT_STRING_TOGGLE_UNCHECKED_VALUE, u as StringToggle, l as Toggle, s as resolveStringToggleStateValue };

//# sourceMappingURL=index.js.map