dgz-ui-shared
Version:
Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library
2 lines (1 loc) • 1.09 kB
JavaScript
"use strict";const s=require("./jsx-runtime-DUiatUiq.cjs"),e=require("./MyInput-3qarivly.cjs"),E=require("./select-BehdTDP2-DZ8kbyVp.cjs"),d=require("./utils-D0f6bOsw-BmDOeWKv.cjs"),a=({control:r,name:t,label:x,helperText:n,required:R,className:i,rules:h,options:j=[],onChange:u,...c})=>{const m=x&&s.jsxRuntimeExports.jsxs(e.cf,{className:"my-3",children:[x," ",R&&s.jsxRuntimeExports.jsx("span",{className:"text-red-600",children:"*"})]});return!t||!r?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[m,s.jsxRuntimeExports.jsx(E.Ix,{className:d.mo("mt-2",i),...c,options:j}),s.jsxRuntimeExports.jsx(e.df,{children:n})]}):s.jsxRuntimeExports.jsx(e.Gf,{control:r,name:t,rules:h,render:({field:o,formState:p})=>{const f=l=>{o.onChange(l),u&&u(l)};return s.jsxRuntimeExports.jsxs(e.lf,{children:[m,s.jsxRuntimeExports.jsx(e.uf,{children:s.jsxRuntimeExports.jsx(E.Ix,{className:d.mo("mt-2",i),...c,...o,onChange:f,options:j,error:!!e.lodashExports.get(p.errors,`${t}`)})}),s.jsxRuntimeExports.jsx(e.df,{children:n}),s.jsxRuntimeExports.jsx(e.ff,{})]})}})};exports.MySelect=a;