UNPKG

@payfit/unity-components

Version:

46 lines (45 loc) 1.54 kB
import { Select as e } from "../select/Select.js"; import { FormHelperText as t } from "../form-field/parts/FormHelperText.js"; import { FormField as n } from "../form-field/FormField.js"; import { FormControl as r } from "../form-field/parts/FormControl.js"; import { FormFeedbackText as i } from "../form-field/parts/FormFeedbackText.js"; import { FormLabel as a } from "../form-field/parts/FormLabel.js"; import { forwardRef as o } from "react"; import { uyTv as s } from "@payfit/unity-themes"; import { jsx as c, jsxs as l } from "react/jsx-runtime"; import { useFormContext as u } from "react-hook-form"; //#region src/components/select-field/SelectField.tsx var d = s({ base: "uy:flex uy:flex-col uy:gap-100" }), f = ({ children: o, feedbackText: s, helperText: f, isRequired: p, label: m, name: h, requiredVariant: g, isDisabled: _, isInvalid: v, isReadOnly: y, placeholder: b, items: x, ...S }, C) => { let { control: w } = u(), T = { isRequired: p, isInvalid: v, isDisabled: _, isReadOnly: y }; return /* @__PURE__ */ l(n, { control: w, name: h, className: d(), ...T, children: [ /* @__PURE__ */ c(a, { requiredVariant: g, children: m }), f && /* @__PURE__ */ c(t, { children: f }), /* @__PURE__ */ c(r, { children: /* @__PURE__ */ c(e, { ref: C, placeholder: b, items: x, ...S, children: o }) }), /* @__PURE__ */ c(i, { children: s }) ] }); }, p = o(function(e, t) { return f(e, t); }); p.displayName = "SelectField"; //#endregion export { p as SelectField };