@payfit/unity-components
Version:
33 lines (32 loc) • 1.07 kB
JavaScript
import { Select as e } from "./Select.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/select/TanstackSelect.tsx
var a = ({ onBlur: r, isReadOnly: a, isDisabled: o, renderValue: 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,
value: u.state.value ?? "",
onChange: (e) => {
u.handleChange(e);
},
onBlur: (e) => {
u.handleBlur(), r?.(e);
},
isReadOnly: a,
isDisabled: o,
isInvalid: f,
"aria-labelledby": d.labelId,
"aria-describedby": p.length > 0 ? p : void 0,
"aria-details": d.contextualLinkId,
renderValue: s
});
}, o = r(function(e, t) {
return a(e, t);
});
o.displayName = "TanstackSelect";
//#endregion
export { o as TanstackSelect };