@payfit/unity-components
Version:
30 lines (29 loc) • 1.18 kB
JavaScript
import { SelectableCardCheckboxGroup as e } from "./SelectableCardCheckboxGroup.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/selectable-card/selectable-card-checkbox-group/TanstackSelectableCardCheckboxGroup.tsx
var a = r(({ onBlur: r, onChange: a, children: o, ...s }, c) => {
let l = t(), u = n(), d = l.state.meta.isTouched && !l.state.meta.isValid, f = [u.helperTextId, u.feedbackTextId].filter(Boolean).join(" "), p = Array.isArray(l.state.value) ? l.state.value : [];
return /* @__PURE__ */ i(e, {
...s,
ref: c,
id: u.inputId,
value: p,
onChange: (e) => {
l.handleChange(e), a?.(e);
},
onBlur: (e) => {
l.handleBlur(), r?.(e);
},
isInvalid: d,
"aria-labelledby": u.labelId,
"aria-describedby": f.length > 0 ? f : void 0,
"aria-details": u.contextualLinkId,
children: o
});
});
a.displayName = "TanstackSelectableCardCheckboxGroup";
//#endregion
export { a as TanstackSelectableCardCheckboxGroup };