@payfit/unity-components
Version:
21 lines (20 loc) • 715 B
JavaScript
import { ToggleSwitchGroup as e } from "./ToggleSwitchGroup.js";
import { useFieldContext as t } from "../../hooks/tanstack-form-context.js";
import { forwardRef as n } from "react";
import { jsx as r } from "react/jsx-runtime";
//#region src/components/toggle-switch-group/TanstackToggleSwitchGroup.tsx
var i = n(function({ onChange: n, ...i }, a) {
let o = t(), s = Array.isArray(o.state.value) ? o.state.value : [], c = o.state.meta.isTouched && !o.state.meta.isValid;
return /* @__PURE__ */ r(e, {
...i,
ref: a,
value: s,
isInvalid: c,
onChange: (e) => {
o.handleChange(e), n?.(e);
}
});
});
i.displayName = "TanstackToggleSwitchGroup";
//#endregion
export { i as TanstackToggleSwitchGroup };