UNPKG

@uva-glass/component-library

Version:

React components UvA

52 lines (51 loc) 1.52 kB
import { jsxs as r, jsx as n } from "react/jsx-runtime"; import { c as i } from "../../clsx-OuTLNxxd.js"; import { useId as d, useState as m } from "react"; import '../../assets/CheckboxButton.css';const t = { "checkbox-button__container": "_checkbox-button__container_lqy3b_1", "checkbox-button": "_checkbox-button_lqy3b_1", "checkbox-button--not-valid": "_checkbox-button--not-valid_lqy3b_59", "checkbox-button--single": "_checkbox-button--single_lqy3b_69", "checkbox-button--start": "_checkbox-button--start_lqy3b_73", "checkbox-button--middle": "_checkbox-button--middle_lqy3b_77", "checkbox-button--end": "_checkbox-button--end_lqy3b_84" }, q = ({ label: c, value: b, isChecked: h = !1, variant: _ = "single", disabled: s, notValid: l, onSetValue: u }) => { const e = d(), [x, k] = m(h), a = (o) => { k(o.target.checked), u(o.target.checked ? o.target.value : null); }; return /* @__PURE__ */ r("span", { className: t["checkbox-button__container"], children: [ /* @__PURE__ */ n( "input", { type: "checkbox", id: `${e}${c}`, disabled: s, value: b, checked: x, onChange: a } ), /* @__PURE__ */ n( "label", { htmlFor: `${e}${c}`, className: i(t["checkbox-button"], t[`checkbox-button--${_}`], { [t["checkbox-button--not-valid"]]: l }), children: c } ) ] }); }; export { q as CheckboxButton }; //# sourceMappingURL=CheckboxButton.js.map