@payfit/unity-components
Version:
31 lines (30 loc) • 1.08 kB
JavaScript
import { PhoneNumberInput as e } from "./PhoneNumberInput.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/phone-number/TanstackPhoneNumberInput.tsx
var a = r(({ onChange: r, onBlur: a, onClearButtonPress: 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, {
ref: l,
...c,
value: u.state.value ?? "",
onChange: (e) => {
u.handleChange(e), r?.(e);
},
onBlur: (e) => {
u.handleBlur(), a?.(e);
},
onClearButtonPress: () => {
u.setValue(""), o?.();
},
isDisabled: s,
isInvalid: f,
"aria-labelledby": d.labelId,
"aria-describedby": p.length > 0 ? p : void 0,
"aria-details": d.contextualLinkId
});
});
//#endregion
export { a as TanstackPhoneNumberInput };