dgz-ui-shared
Version:
Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library
59 lines (58 loc) • 1.47 kB
JavaScript
import { jsx as r, jsxs as o } from "react/jsx-runtime";
import { FormField as x, FormItem as N, FormLabel as b, FormControl as u, ReactSelect as C, FormMessage as M } from "dgz-ui/form";
import { cn as a } from "dgz-ui/utils";
import { g as j } from "./MyInput-ByJ5vTAN.es.js";
const L = ({
control: s,
name: e,
label: t,
required: l,
className: i,
rules: d,
options: h = [],
onChange: m,
floatingError: p,
...F
}) => e && s && /* @__PURE__ */ r(
x,
{
control: s,
name: e,
rules: d,
render: ({ field: c, formState: g }) => {
const f = (n) => {
c.onChange(n), m && m(n);
};
return /* @__PURE__ */ o(N, { children: [
t && /* @__PURE__ */ o(b, { className: "block", children: [
t,
" ",
l && /* @__PURE__ */ r("span", { className: "text-red-600", children: "*" })
] }),
/* @__PURE__ */ o("div", { children: [
/* @__PURE__ */ r(u, { children: /* @__PURE__ */ r(
C,
{
className: a(i),
...F,
...c,
onChange: f,
options: h,
error: !!j(g.errors, `${e}`)
}
) }),
/* @__PURE__ */ r(
M,
{
className: a(p && "absolute -bottom-5")
}
)
] })
] });
}
}
) || null;
export {
L as M
};
//# sourceMappingURL=MySelect-CRXtMlbf.es.js.map