import { mergeProps as i, filterDOMProps as v } from "../../utils/dist/module.es.js";
import { useFocusable as x } from "../../focus/dist/module.es.js";
import { usePress as D } from "../../interactions/dist/module.es.js";
function L(e, s, d) {
  let { isDisabled: a = !1, isRequired: o, isReadOnly: t, value: l, name: n, children: c, "aria-label": b, "aria-labelledby": f, validationState: u = "valid" } = e, p = (r) => {
    r.stopPropagation(), s.setSelected(r.target.checked);
  }, $ = c != null, m = b != null || f != null;
  !$ && !m && console.warn("If you do not provide children, you must specify an aria-label for accessibility");
  let { pressProps: h } = D({
    isDisabled: a
  }), { focusableProps: y } = x(e, d), P = i(h, y), g = v(e, {
    labelable: !0
  });
  return {
    inputProps: i(g, {
      "aria-invalid": u === "invalid" || void 0,
      "aria-errormessage": e["aria-errormessage"],
      "aria-controls": e["aria-controls"],
      "aria-readonly": t || void 0,
      "aria-required": o || void 0,
      onChange: p,
      disabled: a,
      ...l == null ? {} : {
        value: l
      },
      name: n,
      type: "checkbox",
      ...P
    })
  };
}
export {
  L as useToggle
};
//# sourceMappingURL=module.es.js.map
