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