@payfit/unity-components
Version:
32 lines (31 loc) • 964 B
JavaScript
import { MultiSelect as e } from "./MultiSelect.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";
var a = r((r, a) => {
let o = t(), s = n(), c = o.state.meta.isTouched && !o.state.meta.isValid, { onClearButtonPress: l, onFocus: u, isReadOnly: d, isDisabled: f, ...p } = r, m = (e) => {
o.handleChange(e);
}, h = () => {
o.handleBlur();
}, g = () => {
o.setValue(/* @__PURE__ */ new Set()), l && l();
};
return /* @__PURE__ */ i(e, {
...p,
ref: a,
id: s.inputId || p.id,
value: o.state.value,
onChange: m,
onBlur: h,
onFocus: u,
onClearButtonPress: g,
isReadOnly: d,
isDisabled: f,
isInvalid: c,
"aria-labelledby": s.labelId
});
});
a.displayName = "TanstackMultiSelect";
//#endregion
export { a as TanstackMultiSelect };