UNPKG

@payfit/unity-components

Version:

23 lines (22 loc) 792 B
import { ToggleSwitch as e } from "./ToggleSwitch.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/toggle-switch/TanstackToggleSwitch.tsx var a = r(({ onChange: r, isDisabled: a, ...o }, s) => { let c = t(), l = [n().feedbackTextId].filter(Boolean).join(" "); return /* @__PURE__ */ i(e, { ...o, ref: s, isDisabled: a, isSelected: c.state.value, onChange: (e) => { c.handleChange(e), r?.(e); }, "aria-describedby": l.length > 0 ? l : void 0 }); }); a.displayName = "TanstackToggleSwitch"; //#endregion export { a as TanstackToggleSwitch };