@payfit/unity-components
Version:
33 lines (32 loc) • 1.12 kB
JavaScript
import { CheckboxGroup as e } from "./CheckboxGroup.js";
import { useFieldContext as t } from "../../hooks/tanstack-form-context.js";
import { useFieldA11yContext as n } from "../form-field/TanstackFormField.context.js";
import { forwardRef as r } from "react";
import { jsx as i } from "react/jsx-runtime";
//#region src/components/checkbox-group/TanstackCheckboxGroup.tsx
var a = r(({ onChange: r, onBlur: a, isReadOnly: o, isDisabled: s, children: c, label: l, ...u }, d) => {
let f = t(), p = n(), m = f.state.meta.isTouched && !f.state.meta.isValid, h = [p.helperTextId, p.feedbackTextId].filter(Boolean).join(" ");
return /* @__PURE__ */ i(e, {
...u,
ref: d,
id: p.inputId,
label: l,
value: f.state.value,
onChange: (e) => {
f.handleChange(e), r?.(e);
},
onBlur: (e) => {
f.handleBlur(), a?.(e);
},
isReadOnly: o,
isDisabled: s,
isInvalid: m,
"aria-labelledby": p.labelId,
"aria-describedby": h.length > 0 ? h : void 0,
"aria-details": p.contextualLinkId,
children: c
});
});
a.displayName = "TanstackCheckboxGroup";
//#endregion
export { a as TanstackCheckboxGroup };