import { t as e } from "./utils-CHlhTiFC.js";
import { t } from "./checkbox-DdJA0iKE.js";
import n from "react";
import { jsx as r } from "react/jsx-runtime";
//#region src/components/ui/checkbox-group.tsx
var i = n.createContext({
	selectedValues: [],
	onValueChange: () => {},
	color: void 0,
	variant: void 0
}), a = n.forwardRef(({ className: t, children: a, value: o, variant: s, color: c, onValueChange: l, defaultValue: u, ...d }, f) => {
	let [p, m] = n.useState(u || []), h = o === void 0 ? p : o, g = n.useCallback((e, t) => {
		let n = t ? [...h, e] : h.filter((t) => t !== e);
		o === void 0 && m(n), l?.(n);
	}, [
		h,
		o,
		l
	]), _ = n.useMemo(() => ({
		selectedValues: h,
		color: c,
		variant: s,
		onValueChange: g
	}), [
		h,
		g,
		c,
		s
	]);
	return /* @__PURE__ */ r(i.Provider, {
		value: _,
		children: /* @__PURE__ */ r("div", {
			...d,
			className: e("flex gap-x-4 gap-y-2 flex-row flex-wrap", t),
			ref: f,
			children: a
		})
	});
});
a.displayName = "CheckboxGroup";
var o = n.forwardRef(({ value: e, ...a }, o) => {
	let { selectedValues: s, onValueChange: c, color: l, variant: u } = n.useContext(i);
	return /* @__PURE__ */ r(t, {
		ref: o,
		...a,
		value: e,
		color: l,
		variant: u,
		checked: s.includes(e),
		onCheckedChange: (t) => c(e, t === !0)
	});
});
o.displayName = "CheckboxGroupItem";
//#endregion
export { a as CheckboxGroup, o as CheckboxGroupItem };

//# sourceMappingURL=CheckboxGroup.js.map