@s_mart/form 2.8.4 → 2.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -151,7 +151,7 @@ type SearchableProps = Omit<AutocompleteProps$1<SearchableOption, true, true, tr
151
151
  onChange?: (value: any, values: FieldValues) => void;
152
152
  };
153
153
 
154
- declare const _default$4: react.MemoExoticComponent<({ name, rules, defaultValue, shouldUnregister, label, required, options, textFieldProps, noOptionsText, footer, multiple, info, onChange: onChangeProp, onInputChange, ...rest }: SearchableProps) => JSX.Element>;
154
+ declare const _default$4: react.MemoExoticComponent<({ name, rules, defaultValue, shouldUnregister, label, required, options, textFieldProps, noOptionsText, footer, multiple, info, placeholder, onChange: onChangeProp, onInputChange, ...rest }: SearchableProps) => JSX.Element>;
155
155
 
156
156
  type ControllerCreatable = Omit<ControllerProps, 'render' | 'control'>;
157
157
  type CreatableOption = {
@@ -231,7 +231,7 @@ type CreatableProps = Omit<AutocompleteProps$1<CreatableOption, true, true, true
231
231
  onChange?: (value: any, values: FieldValues) => void;
232
232
  };
233
233
 
234
- declare const _default$3: react.MemoExoticComponent<({ name, rules, defaultValue, shouldUnregister, label, required, options, editable, onEditOption, onCreateOption, textFieldProps, hideAddButton, multiple, info, onChange: onChangeProp, onInputChange, ...rest }: CreatableProps) => JSX.Element>;
234
+ declare const _default$3: react.MemoExoticComponent<({ name, rules, defaultValue, shouldUnregister, label, required, options, editable, onEditOption, onCreateOption, textFieldProps, hideAddButton, multiple, info, onChange: onChangeProp, onInputChange, placeholder, ...rest }: CreatableProps) => JSX.Element>;
235
235
 
236
236
  type ControllerCheckbox = Omit<ControllerProps, 'render' | 'control'>;
237
237
  type CheckboxProps = CheckboxProps$1 & ControllerCheckbox & {
@@ -396,6 +396,6 @@ type AutocompleteProps<T = any> = Omit<UseControllerProps, 'control'> & Omit<Aut
396
396
  onChange?: (value: any, values: FieldValues) => void;
397
397
  };
398
398
 
399
- declare const _default: react.MemoExoticComponent<({ name, defaultValue, rules, shouldUnregister, label, required, onInputChange, onChange, ...rest }: AutocompleteProps<any>) => JSX.Element>;
399
+ declare const _default: react.MemoExoticComponent<({ name, defaultValue, rules, shouldUnregister, label, required, placeholder, onInputChange, onChange, ...rest }: AutocompleteProps<any>) => JSX.Element>;
400
400
 
401
401
  export { _default as Autocomplete, AutocompleteProps, Checkbox, CheckboxProps, _default$3 as Creatable, CreatableOption, CreatableProps, _default$2 as DatePicker, DatePickerProps, FooterProps, Form, IFormProps, RadioButton, RadioGroup, RadioGroupProps, RadioProps, _default$4 as Searchable, SearchableOption, SearchableProps, _default$5 as Select, SelectOption, SelectProps, Slider, SliderProps, Switch, SwitchProps, _default$6 as TextField, TextFieldProps, _default$1 as TimePicker, TimePickerProps };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";var B3=Object.create;var l2=Object.defineProperty,A3=Object.defineProperties,E3=Object.getOwnPropertyDescriptor,G3=Object.getOwnPropertyDescriptors,D3=Object.getOwnPropertyNames,s2=Object.getOwnPropertySymbols,I3=Object.getPrototypeOf,P2=Object.prototype.hasOwnProperty,D2=Object.prototype.propertyIsEnumerable;var G2=(C,i,e)=>i in C?l2(C,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):C[i]=e,o=(C,i)=>{for(var e in i||(i={}))P2.call(i,e)&&G2(C,e,i[e]);if(s2)for(var e of s2(i))D2.call(i,e)&&G2(C,e,i[e]);return C},V=(C,i)=>A3(C,G3(i));var g=(C,i)=>{var e={};for(var l in C)P2.call(C,l)&&i.indexOf(l)<0&&(e[l]=C[l]);if(C!=null&&s2)for(var l of s2(C))i.indexOf(l)<0&&D2.call(C,l)&&(e[l]=C[l]);return e};var $3=(C,i)=>{for(var e in i)l2(C,e,{get:i[e],enumerable:!0})},I2=(C,i,e,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of D3(i))!P2.call(C,r)&&r!==e&&l2(C,r,{get:()=>i[r],enumerable:!(l=E3(i,r))||l.enumerable});return C};var d2=(C,i,e)=>(e=C!=null?B3(I3(C)):{},I2(i||!C||!C.__esModule?l2(e,"default",{value:C,enumerable:!0}):e,C)),q3=C=>I2(l2({},"__esModule",{value:!0}),C);var l1={};$3(l1,{Autocomplete:()=>v3,Checkbox:()=>r3,Creatable:()=>o3,DatePicker:()=>m3,Form:()=>q2,RadioButton:()=>n3,RadioGroup:()=>t3,Searchable:()=>J2,Select:()=>K2,Slider:()=>s3,Switch:()=>l3,TextField:()=>Y2,TimePicker:()=>w3});module.exports=q3(l1);var $2=require("react"),V2=require("react-hook-form");var k2=require("react/jsx-runtime");function U3(m){var L=m,{children:C,onSubmit:i,style:e,disableDefaultValuesUpdate:l}=L,r=g(L,["children","onSubmit","style","disableDefaultValuesUpdate"]);let H=(0,V2.useForm)(r);(0,$2.useEffect)(()=>{l||H.reset(r.defaultValues)},[r.defaultValues,H.reset]);let d=()=>typeof C=="function"?C(V(o({},H),{onSubmit:H.handleSubmit(Z=>i(Z,H))})):C;return(0,k2.jsx)(V2.FormProvider,V(o({},H),{children:(0,k2.jsx)("form",{onSubmit:Z=>{Z.preventDefault(),Z.stopPropagation(),H.handleSubmit(M=>i(M,H))()},style:e,children:d()})}))}var q2=U3;var L2=require("react"),a2=require("react-hook-form"),q=require("@mui/material");var U2={description:"M39.0611 23.1367C36.3276 17.015 30.4051 13.2479 24.027 13.0909C17.4971 13.2479 11.5746 17.172 8.84117 23.1367C8.68931 23.6076 8.68931 24.2355 8.84117 24.8633C11.5746 30.985 17.4971 34.7521 23.8752 34.9091C30.4051 34.7521 36.1757 30.828 38.9092 24.8633C39.3648 24.2355 39.3648 23.6076 39.0611 23.1367ZM24.027 32.0837C19.6231 31.9268 16.2822 28.1596 16.4341 23.6076C16.586 19.3695 19.9269 15.7593 24.027 15.7593C28.4309 15.9163 31.7718 19.6835 31.62 24.2355C31.4681 28.4735 28.1272 32.0837 24.027 32.0837ZM24.027 18.5847C23.5715 18.5847 23.1159 18.7417 22.6603 18.7417C23.4196 19.8404 23.2677 21.2531 22.3566 22.3519C21.4454 23.2937 20.0787 23.2937 19.0157 22.5088C18.5601 24.7063 19.3194 27.2178 21.1417 28.4735C22.964 29.7292 25.3938 29.7292 27.0642 28.3165C28.7347 26.9039 29.494 24.3924 28.7347 22.1949C28.1272 19.9974 26.1531 18.5847 24.027 18.5847Z",viewBox:"0 0 48 48",id:"line-eye-solid"},R2={description:"M23.9998 31.7412C19.9223 31.7412 16.6215 28.5851 16.3177 24.5854L10.6785 20.2272C9.93715 21.1573 9.25496 22.1405 8.70447 23.2157C8.58149 23.4589 8.51742 23.7277 8.51742 24.0003C8.51742 24.2729 8.58149 24.5416 8.70447 24.7849C11.6198 30.4731 17.3913 34.3216 23.9998 34.3216C25.4465 34.3216 26.842 34.1066 28.1871 33.7593L25.3976 31.6009C24.9369 31.6899 24.469 31.7369 23.9998 31.7412ZM40.8703 34.8646L34.9273 30.2715C36.7326 28.7501 38.2174 26.8848 39.2952 24.7843C39.4182 24.5411 39.4823 24.2723 39.4823 23.9997C39.4823 23.7272 39.4182 23.4584 39.2952 23.2151C36.3799 17.5269 30.6084 13.6784 23.9998 13.6784C21.2321 13.6817 18.5093 14.3785 16.0801 15.7051L9.24098 10.419C9.15179 10.3496 9.04981 10.2985 8.94085 10.2685C8.83189 10.2385 8.7181 10.2303 8.60597 10.2443C8.49384 10.2584 8.38557 10.2944 8.28736 10.3502C8.18914 10.4061 8.1029 10.4808 8.03356 10.5701L6.97828 11.9285C6.8383 12.1086 6.77557 12.3369 6.8039 12.5633C6.83223 12.7896 6.94929 12.9954 7.12934 13.1354L38.7587 37.581C38.8479 37.6504 38.9499 37.7016 39.0588 37.7315C39.1678 37.7615 39.2816 37.7697 39.3937 37.7557C39.5058 37.7416 39.6141 37.7057 39.7123 37.6498C39.8105 37.5939 39.8968 37.5192 39.9661 37.43L41.0219 36.0715C41.1619 35.8913 41.2245 35.663 41.1961 35.4366C41.1676 35.2103 41.0505 35.0045 40.8703 34.8646ZM30.9938 27.2309L28.8811 25.5977C29.059 25.0835 29.1534 24.5441 29.1606 24C29.1711 23.2034 28.9947 22.4155 28.6454 21.6995C28.2962 20.9836 27.7838 20.3595 27.1496 19.8774C26.5154 19.3953 25.777 19.0687 24.9937 18.9238C24.2103 18.7788 23.4039 18.8197 22.6392 19.0429C22.9634 19.4822 23.1387 20.0135 23.1397 20.5595C23.1317 20.7411 23.1039 20.9214 23.0569 21.097L19.0997 18.0387C20.4743 16.89 22.2085 16.2601 23.9998 16.2588C25.0166 16.2582 26.0235 16.4581 26.9629 16.8469C27.9024 17.2357 28.756 17.8059 29.475 18.5249C30.1939 19.2438 30.7641 20.0974 31.1529 21.0369C31.5418 21.9764 31.7416 22.9833 31.7411 24C31.7411 25.1628 31.4567 26.246 30.9938 27.2309Z",viewBox:"0 0 48 48",id:"line-eye-slash-solid"};var j={description:"M24 8C15.1613 8 8 15.2258 8 24C8 32.8387 15.1613 40 24 40C32.7742 40 40 32.8387 40 24C40 15.2258 32.7742 8 24 8ZM24 15.0968C25.4839 15.0968 26.7097 16.3226 26.7097 17.8065C26.7097 19.3548 25.4839 20.5161 24 20.5161C22.4516 20.5161 21.2903 19.3548 21.2903 17.8065C21.2903 16.3226 22.4516 15.0968 24 15.0968ZM27.6129 31.4839C27.6129 31.9355 27.2258 32.2581 26.8387 32.2581H21.1613C20.7097 32.2581 20.3871 31.9355 20.3871 31.4839V29.9355C20.3871 29.5484 20.7097 29.1613 21.1613 29.1613H21.9355V25.0323H21.1613C20.7097 25.0323 20.3871 24.7097 20.3871 24.2581V22.7097C20.3871 22.3226 20.7097 21.9355 21.1613 21.9355H25.2903C25.6774 21.9355 26.0645 22.3226 26.0645 22.7097V29.1613H26.8387C27.2258 29.1613 27.6129 29.5484 27.6129 29.9355V31.4839Z",viewBox:"0 0 48 48",id:"line-info-circle-solid"},z2={description:"M35.8286 21.8493H26.1506V12.1714C26.1506 11.6338 25.613 11.0961 25.0753 11.0961H22.9247C22.3198 11.0961 21.8493 11.6338 21.8493 12.1714V21.8493H12.1714C11.5666 21.8493 11.0961 22.387 11.0961 22.9247V25.0753C11.0961 25.6802 11.5666 26.1506 12.1714 26.1506H21.8493V35.8286C21.8493 36.4334 22.3198 36.9039 22.9247 36.9039H25.0753C25.613 36.9039 26.1506 36.4334 26.1506 35.8286V26.1506H35.8286C36.3662 26.1506 36.9039 25.6802 36.9039 25.0753V22.9247C36.9039 22.387 36.3662 21.8493 35.8286 21.8493Z",viewBox:"0 0 48 48",id:"line-plus-solid"};var O2={description:"M25.4929 17.0061L30.9936 22.5071L19.049 34.4522L14.1447 34.9936C13.4881 35.0662 12.9334 34.511 13.0065 33.8545L13.5522 28.9465L25.4929 17.0061ZM34.3958 16.1872L31.813 13.6043C31.0073 12.7986 29.7007 12.7986 28.8951 13.6043L26.4652 16.0342L31.966 21.5351L34.3958 19.1052C35.2014 18.2991 35.2014 16.9928 34.3958 16.1872Z",id:"line-pen-solid"};var J=d2(require("@s_mart/masks"));var v2=require("@mui/material"),_2=require("@s_mart/utils"),n2=require("react/jsx-runtime"),w=({label:C,required:i,regular:e})=>(0,n2.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:(0,_2.toRem)(2)},children:[(0,n2.jsx)(v2.Typography,{variant:"caption",fontWeight:e?400:700,style:{display:"flex",alignItems:"center"},children:C}),i&&(0,n2.jsx)(v2.Typography,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});var N2=require("react-hook-form"),j2=require("@s_mart/core");var T=(C,i)=>{var e,l,r,m,L;if(C[i])return C[i];if(i.includes("[")){let[H,d]=i.split("["),[Z,M]=d.split("].");return(l=(e=C[H])==null?void 0:e[Z])==null?void 0:l[M]}if(i.includes(".")){let[H,d,Z]=i.split(".");return Z?(L=(m=C[H])==null?void 0:m[d])==null?void 0:L[Z]:(r=C[H])==null?void 0:r[d]}};var W2=require("react/jsx-runtime"),k=({name:C})=>{var l;let i=(0,N2.useFormContext)(),e=T((l=i==null?void 0:i.formState)==null?void 0:l.errors,C);return e?(0,W2.jsx)(j2.Indicator,{severity:"error",children:e==null?void 0:e.message}):null};var t2=require("@s_mart/core");var B=require("react/jsx-runtime"),R3=x=>{var f=x,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:m,mask:L,variant:H="outlined",info:d,parse:Z,format:M,onInputChange:a}=f,u=g(f,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","info","parse","format","onInputChange"]);let t=(0,a2.useFormContext)();if(!t)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[c,F]=(0,L2.useState)(!1),O=s=>{var y;let n=s;return M&&(n=M(s)),L?(y=J==null?void 0:J[L])==null?void 0:y.format(n):n},A=s=>{var y;let n=s;return Z&&(n=Z(s)),L?(y=J==null?void 0:J[L])==null?void 0:y.parse(n):n},_=s=>{if(!s||L!=="porcentagem")return;s==null||s.stopPropagation();let n=(s==null?void 0:s.target).value;if(n){let y=String(n);if(y.length>0){let N=y.indexOf("%");N>-1&&(s.currentTarget.selectionEnd=N)}}},b=T(t.formState.errors,C);return(0,B.jsx)(a2.Controller,{control:t.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:s,onChange:n}})=>(0,B.jsxs)(q.Grid,{display:"flex",flexDirection:"column",children:[(0,B.jsx)(q.Grid,{item:!0,xs:12,children:(0,B.jsxs)(q.Grid,{container:!0,direction:"row",children:[r&&(0,B.jsx)(q.Grid,{item:!0,children:(0,B.jsx)(w,{label:r,required:m})}),d&&(0,B.jsx)(q.Grid,{item:!0,children:(0,B.jsx)(t2.Tooltip,{title:d,placement:"top",children:(0,B.jsx)("div",{style:{width:"fit-content"},children:(0,B.jsx)(t2.LIcon,{icon:j,color:"#757575"})})})})]})}),(0,B.jsx)(q.TextField,V(o({variant:H,defaultValue:e,value:O(s||""),onChange:y=>{var N,S;n(A((N=y==null?void 0:y.target)==null?void 0:N.value)),a==null||a((S=y==null?void 0:y.target)==null?void 0:S.value,t.watch())},error:Boolean(b)},u),{type:u.type==="password"?c?"text":"password":u.type,autoComplete:u.autoComplete||"off",InputProps:o({onKeyDown:_,endAdornment:u.type==="password"&&(0,B.jsx)(q.InputAdornment,{position:"end",onClick:()=>F(!c),style:{cursor:"pointer"},children:(0,B.jsx)(t2.LIcon,{icon:c?U2:R2,size:"24px",removeMargin:!0})})},u.InputProps)})),(0,B.jsx)(k,{name:C})]})})},Y2=(0,L2.memo)(R3);var M2=require("react"),Z2=require("react-hook-form"),X=require("@s_mart/core"),E=require("@mui/material");var v=require("react/jsx-runtime"),z3=f=>{var t=f,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:m,options:L,placeholder:H,onInputChange:d,footer:Z,multiple:M,info:a,onChange:u}=t,x=g(t,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","onInputChange","footer","multiple","info","onChange"]);let c=(0,Z2.useFormContext)(),{palette:F}=(0,E.useTheme)(),[O,A]=(0,M2.useState)(!1);if(!c)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let _=T(c.formState.errors,C);return console.warn=()=>{},(0,v.jsx)(Z2.Controller,{control:c.control,name:C,rules:i,defaultValue:e||"",shouldUnregister:l,render:({field:{value:b,onChange:s}})=>(0,v.jsxs)(E.Grid,{display:"flex",flexDirection:"column",children:[(0,v.jsx)(E.Grid,{item:!0,xs:12,children:(0,v.jsxs)(E.Grid,{container:!0,direction:"row",children:[r&&(0,v.jsx)(E.Grid,{item:!0,children:(0,v.jsx)(w,{label:r,required:m})}),a&&(0,v.jsx)(E.Grid,{item:!0,children:(0,v.jsx)(X.Tooltip,{title:a,placement:"top",children:(0,v.jsx)("div",{style:{width:"fit-content"},children:(0,v.jsx)(X.LIcon,{icon:j,color:"#757575"})})})})]})}),(0,v.jsxs)(E.Select,V(o({open:O,onOpen:()=>A(!0),onClose:()=>A(!1),displayEmpty:Boolean(H),variant:"outlined",autoComplete:"off",value:b?b||"":M?[]:"",renderValue:n=>{var y;return(y=n==null?void 0:n.label)!=null?y:""},multiple:M,onChange:(n,y)=>{s(n.target.value),d==null||d(n.target.value,c.watch()),u&&u(n.target.value,c.watch())},error:Boolean(_),size:x.size||"medium"},x),{children:[H&&(0,v.jsx)(E.MenuItem,{disabled:!0,value:"",children:(0,v.jsx)("p",{style:{color:F.grey[400]},children:H})}),L==null?void 0:L.map((n,y)=>(0,v.jsx)(E.MenuItem,{value:n,children:n.label},y)),Z&&[(0,v.jsx)(E.Grid,{px:2,py:1,children:(0,v.jsx)(X.Divider,{})},"footer-divider"),(0,v.jsx)("div",{children:Z({closeSelect:()=>A(!1)})},"footer-content")]]})),(0,v.jsx)(k,{name:C})]})})},K2=(0,M2.memo)(z3);var Q2=require("react"),c2=require("react-hook-form"),G=require("@mui/material");var C2=require("@s_mart/core");var h=require("react/jsx-runtime"),S2=require("react"),O3=t=>{var c=t,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:m,options:L,textFieldProps:H,noOptionsText:d,footer:Z,multiple:M,info:a,onChange:u,onInputChange:x}=c,f=g(c,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText","footer","multiple","info","onChange","onInputChange"]);let F=(0,c2.useFormContext)();if(!F)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let O=T(F.formState.errors,C);return console.warn=()=>{},(0,h.jsx)(c2.Controller,{control:F.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{onChange:A,value:_}})=>(0,h.jsxs)(G.Grid,{display:"flex",flexDirection:"column",children:[(0,h.jsx)(G.Grid,{display:"flex",flexDirection:"column",children:(0,h.jsx)(G.Grid,{item:!0,xs:12,children:(0,h.jsxs)(G.Grid,{container:!0,direction:"row",children:[r&&(0,h.jsx)(G.Grid,{item:!0,children:(0,h.jsx)(w,{label:r,required:m})}),a&&(0,h.jsx)(G.Grid,{item:!0,children:(0,h.jsx)(C2.Tooltip,{title:a,placement:"top",children:(0,h.jsx)("div",{style:{width:"fit-content"},children:(0,h.jsx)(C2.LIcon,{icon:j,color:"#757575"})})})})]})})}),(0,h.jsx)(G.Autocomplete,V(o({onChange:(b,s)=>{A(s),u==null||u(s,F.watch())},onInputChange:(b,s,n)=>{n==="input"&&(A(s),setTimeout(()=>{x==null||x(s,F.watch())},0))},value:_||(M?[]:null),options:L,multiple:M,noOptionsText:d||"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(b,s)=>typeof b=="string"&&typeof s=="string"?b===s:typeof b=="object"&&typeof s=="object"?b.value===s.value:!1,renderOption:(b,s)=>typeof s=="object"?(0,S2.createElement)("li",V(o({},b),{key:s.key||s.value}),s.label):(0,S2.createElement)("li",V(o({},b),{key:s}),s),ListboxComponent:b=>(0,h.jsxs)("ul",V(o({},b),{children:[b.children,Z&&(0,h.jsx)("li",{children:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(G.Grid,{px:2,py:1,children:(0,h.jsx)(C2.Divider,{})}),Z]})},"searchable-footer")]}))},f),{renderInput:b=>(0,h.jsx)(G.TextField,o(o({error:Boolean(O)},b),H))})),(0,h.jsx)(k,{name:C})]})})},J2=(0,Q2.memo)(O3);var e3=require("react"),p2=require("react-hook-form"),D=require("@mui/material");var z=require("@s_mart/utils"),T2=d2(require("@emotion/styled")),B2=require("@emotion/react"),X2=B2.css`
1
+ "use strict";var A3=Object.create;var n2=Object.defineProperty,E3=Object.defineProperties,D3=Object.getOwnPropertyDescriptor,G3=Object.getOwnPropertyDescriptors,I3=Object.getOwnPropertyNames,d2=Object.getOwnPropertySymbols,$3=Object.getPrototypeOf,k2=Object.prototype.hasOwnProperty,I2=Object.prototype.propertyIsEnumerable;var G2=(C,i,e)=>i in C?n2(C,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):C[i]=e,o=(C,i)=>{for(var e in i||(i={}))k2.call(i,e)&&G2(C,e,i[e]);if(d2)for(var e of d2(i))I2.call(i,e)&&G2(C,e,i[e]);return C},V=(C,i)=>E3(C,G3(i));var f=(C,i)=>{var e={};for(var l in C)k2.call(C,l)&&i.indexOf(l)<0&&(e[l]=C[l]);if(C!=null&&d2)for(var l of d2(C))i.indexOf(l)<0&&I2.call(C,l)&&(e[l]=C[l]);return e};var q3=(C,i)=>{for(var e in i)n2(C,e,{get:i[e],enumerable:!0})},$2=(C,i,e,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of I3(i))!k2.call(C,r)&&r!==e&&n2(C,r,{get:()=>i[r],enumerable:!(l=D3(i,r))||l.enumerable});return C};var V2=(C,i,e)=>(e=C!=null?A3($3(C)):{},$2(i||!C||!C.__esModule?n2(e,"default",{value:C,enumerable:!0}):e,C)),U3=C=>$2(n2({},"__esModule",{value:!0}),C);var n1={};q3(n1,{Autocomplete:()=>S3,Checkbox:()=>l3,Creatable:()=>r3,DatePicker:()=>u3,Form:()=>U2,RadioButton:()=>t3,RadioGroup:()=>H3,Searchable:()=>X2,Select:()=>Q2,Slider:()=>d3,Switch:()=>n3,TextField:()=>K2,TimePicker:()=>w3});module.exports=U3(n1);var q2=require("react"),L2=require("react-hook-form");var v2=require("react/jsx-runtime");function R3(u){var M=u,{children:C,onSubmit:i,style:e,disableDefaultValuesUpdate:l}=M,r=f(M,["children","onSubmit","style","disableDefaultValuesUpdate"]);let t=(0,L2.useForm)(r);(0,q2.useEffect)(()=>{l||t.reset(r.defaultValues)},[r.defaultValues,t.reset]);let L=()=>typeof C=="function"?C(V(o({},t),{onSubmit:t.handleSubmit(d=>i(d,t))})):C;return(0,v2.jsx)(L2.FormProvider,V(o({},t),{children:(0,v2.jsx)("form",{onSubmit:d=>{d.preventDefault(),d.stopPropagation(),t.handleSubmit(p=>i(p,t))()},style:e,children:L()})}))}var U2=R3;var a2=require("react"),M2=require("react-hook-form"),j=require("@mui/material");var R2={description:"M39.0611 23.1367C36.3276 17.015 30.4051 13.2479 24.027 13.0909C17.4971 13.2479 11.5746 17.172 8.84117 23.1367C8.68931 23.6076 8.68931 24.2355 8.84117 24.8633C11.5746 30.985 17.4971 34.7521 23.8752 34.9091C30.4051 34.7521 36.1757 30.828 38.9092 24.8633C39.3648 24.2355 39.3648 23.6076 39.0611 23.1367ZM24.027 32.0837C19.6231 31.9268 16.2822 28.1596 16.4341 23.6076C16.586 19.3695 19.9269 15.7593 24.027 15.7593C28.4309 15.9163 31.7718 19.6835 31.62 24.2355C31.4681 28.4735 28.1272 32.0837 24.027 32.0837ZM24.027 18.5847C23.5715 18.5847 23.1159 18.7417 22.6603 18.7417C23.4196 19.8404 23.2677 21.2531 22.3566 22.3519C21.4454 23.2937 20.0787 23.2937 19.0157 22.5088C18.5601 24.7063 19.3194 27.2178 21.1417 28.4735C22.964 29.7292 25.3938 29.7292 27.0642 28.3165C28.7347 26.9039 29.494 24.3924 28.7347 22.1949C28.1272 19.9974 26.1531 18.5847 24.027 18.5847Z",viewBox:"0 0 48 48",id:"line-eye-solid"},z2={description:"M23.9998 31.7412C19.9223 31.7412 16.6215 28.5851 16.3177 24.5854L10.6785 20.2272C9.93715 21.1573 9.25496 22.1405 8.70447 23.2157C8.58149 23.4589 8.51742 23.7277 8.51742 24.0003C8.51742 24.2729 8.58149 24.5416 8.70447 24.7849C11.6198 30.4731 17.3913 34.3216 23.9998 34.3216C25.4465 34.3216 26.842 34.1066 28.1871 33.7593L25.3976 31.6009C24.9369 31.6899 24.469 31.7369 23.9998 31.7412ZM40.8703 34.8646L34.9273 30.2715C36.7326 28.7501 38.2174 26.8848 39.2952 24.7843C39.4182 24.5411 39.4823 24.2723 39.4823 23.9997C39.4823 23.7272 39.4182 23.4584 39.2952 23.2151C36.3799 17.5269 30.6084 13.6784 23.9998 13.6784C21.2321 13.6817 18.5093 14.3785 16.0801 15.7051L9.24098 10.419C9.15179 10.3496 9.04981 10.2985 8.94085 10.2685C8.83189 10.2385 8.7181 10.2303 8.60597 10.2443C8.49384 10.2584 8.38557 10.2944 8.28736 10.3502C8.18914 10.4061 8.1029 10.4808 8.03356 10.5701L6.97828 11.9285C6.8383 12.1086 6.77557 12.3369 6.8039 12.5633C6.83223 12.7896 6.94929 12.9954 7.12934 13.1354L38.7587 37.581C38.8479 37.6504 38.9499 37.7016 39.0588 37.7315C39.1678 37.7615 39.2816 37.7697 39.3937 37.7557C39.5058 37.7416 39.6141 37.7057 39.7123 37.6498C39.8105 37.5939 39.8968 37.5192 39.9661 37.43L41.0219 36.0715C41.1619 35.8913 41.2245 35.663 41.1961 35.4366C41.1676 35.2103 41.0505 35.0045 40.8703 34.8646ZM30.9938 27.2309L28.8811 25.5977C29.059 25.0835 29.1534 24.5441 29.1606 24C29.1711 23.2034 28.9947 22.4155 28.6454 21.6995C28.2962 20.9836 27.7838 20.3595 27.1496 19.8774C26.5154 19.3953 25.777 19.0687 24.9937 18.9238C24.2103 18.7788 23.4039 18.8197 22.6392 19.0429C22.9634 19.4822 23.1387 20.0135 23.1397 20.5595C23.1317 20.7411 23.1039 20.9214 23.0569 21.097L19.0997 18.0387C20.4743 16.89 22.2085 16.2601 23.9998 16.2588C25.0166 16.2582 26.0235 16.4581 26.9629 16.8469C27.9024 17.2357 28.756 17.8059 29.475 18.5249C30.1939 19.2438 30.7641 20.0974 31.1529 21.0369C31.5418 21.9764 31.7416 22.9833 31.7411 24C31.7411 25.1628 31.4567 26.246 30.9938 27.2309Z",viewBox:"0 0 48 48",id:"line-eye-slash-solid"};var N={description:"M24 8C15.1613 8 8 15.2258 8 24C8 32.8387 15.1613 40 24 40C32.7742 40 40 32.8387 40 24C40 15.2258 32.7742 8 24 8ZM24 15.0968C25.4839 15.0968 26.7097 16.3226 26.7097 17.8065C26.7097 19.3548 25.4839 20.5161 24 20.5161C22.4516 20.5161 21.2903 19.3548 21.2903 17.8065C21.2903 16.3226 22.4516 15.0968 24 15.0968ZM27.6129 31.4839C27.6129 31.9355 27.2258 32.2581 26.8387 32.2581H21.1613C20.7097 32.2581 20.3871 31.9355 20.3871 31.4839V29.9355C20.3871 29.5484 20.7097 29.1613 21.1613 29.1613H21.9355V25.0323H21.1613C20.7097 25.0323 20.3871 24.7097 20.3871 24.2581V22.7097C20.3871 22.3226 20.7097 21.9355 21.1613 21.9355H25.2903C25.6774 21.9355 26.0645 22.3226 26.0645 22.7097V29.1613H26.8387C27.2258 29.1613 27.6129 29.5484 27.6129 29.9355V31.4839Z",viewBox:"0 0 48 48",id:"line-info-circle-solid"},O2={description:"M35.8286 21.8493H26.1506V12.1714C26.1506 11.6338 25.613 11.0961 25.0753 11.0961H22.9247C22.3198 11.0961 21.8493 11.6338 21.8493 12.1714V21.8493H12.1714C11.5666 21.8493 11.0961 22.387 11.0961 22.9247V25.0753C11.0961 25.6802 11.5666 26.1506 12.1714 26.1506H21.8493V35.8286C21.8493 36.4334 22.3198 36.9039 22.9247 36.9039H25.0753C25.613 36.9039 26.1506 36.4334 26.1506 35.8286V26.1506H35.8286C36.3662 26.1506 36.9039 25.6802 36.9039 25.0753V22.9247C36.9039 22.387 36.3662 21.8493 35.8286 21.8493Z",viewBox:"0 0 48 48",id:"line-plus-solid"};var _2={description:"M25.4929 17.0061L30.9936 22.5071L19.049 34.4522L14.1447 34.9936C13.4881 35.0662 12.9334 34.511 13.0065 33.8545L13.5522 28.9465L25.4929 17.0061ZM34.3958 16.1872L31.813 13.6043C31.0073 12.7986 29.7007 12.7986 28.8951 13.6043L26.4652 16.0342L31.966 21.5351L34.3958 19.1052C35.2014 18.2991 35.2014 16.9928 34.3958 16.1872Z",id:"line-pen-solid"};var J=V2(require("@s_mart/masks"));var S2=require("@mui/material"),N2=require("@s_mart/utils"),t2=require("react/jsx-runtime"),h=({label:C,required:i,regular:e})=>(0,t2.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:(0,N2.toRem)(2)},children:[(0,t2.jsx)(S2.Typography,{variant:"caption",fontWeight:e?400:700,style:{display:"flex",alignItems:"center"},children:C}),i&&(0,t2.jsx)(S2.Typography,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});var j2=require("react-hook-form"),W2=require("@s_mart/core");var S=(C,i)=>{var e,l,r,u,M;if(C[i])return C[i];if(i.includes("[")){let[t,L]=i.split("["),[d,p]=L.split("].");return(l=(e=C[t])==null?void 0:e[d])==null?void 0:l[p]}if(i.includes(".")){let[t,L,d]=i.split(".");return d?(M=(u=C[t])==null?void 0:u[L])==null?void 0:M[d]:(r=C[t])==null?void 0:r[L]}};var Y2=require("react/jsx-runtime"),w=({name:C})=>{var l;let i=(0,j2.useFormContext)(),e=S((l=i==null?void 0:i.formState)==null?void 0:l.errors,C);return e?(0,Y2.jsx)(W2.Indicator,{severity:"error",children:e==null?void 0:e.message}):null};var H2=require("@s_mart/core");var B=require("react/jsx-runtime"),z3=x=>{var P=x,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:u,mask:M,variant:t="outlined",info:L,parse:d,format:p,onInputChange:c}=P,m=f(P,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","info","parse","format","onInputChange"]);let H=(0,M2.useFormContext)();if(!H)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[Z,y]=(0,a2.useState)(!1),v=a=>{var s;let n=a;return p&&(n=p(a)),M?(s=J==null?void 0:J[M])==null?void 0:s.format(n):n},I=a=>{var s;let n=a;return d&&(n=d(a)),M?(s=J==null?void 0:J[M])==null?void 0:s.parse(n):n},A=a=>{if(!a||M!=="porcentagem")return;a==null||a.stopPropagation();let n=(a==null?void 0:a.target).value;if(n){let s=String(n);if(s.length>0){let z=s.indexOf("%");z>-1&&(a.currentTarget.selectionEnd=z)}}},R=S(H.formState.errors,C);return(0,B.jsx)(M2.Controller,{control:H.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:a,onChange:n}})=>(0,B.jsxs)(j.Grid,{display:"flex",flexDirection:"column",children:[(0,B.jsxs)("div",{style:{display:"flex"},children:[r&&(0,B.jsx)(j.Grid,{item:!0,children:(0,B.jsx)(h,{label:r,required:u})}),L&&(0,B.jsx)(j.Grid,{item:!0,children:(0,B.jsx)(H2.Tooltip,{title:L,placement:"top",children:(0,B.jsx)("div",{style:{width:"fit-content"},children:(0,B.jsx)(H2.LIcon,{icon:N,color:"#757575"})})})})]}),(0,B.jsx)(j.TextField,V(o({variant:t,defaultValue:e,value:v(a||""),onChange:s=>{var z,l2;n(I((z=s==null?void 0:s.target)==null?void 0:z.value)),c==null||c((l2=s==null?void 0:s.target)==null?void 0:l2.value,H.watch())},error:Boolean(R)},m),{type:m.type==="password"?Z?"text":"password":m.type,autoComplete:m.autoComplete||"off",InputProps:o({onKeyDown:A,endAdornment:m.type==="password"&&(0,B.jsx)(j.InputAdornment,{position:"end",onClick:()=>y(!Z),style:{cursor:"pointer"},children:(0,B.jsx)(H2.LIcon,{icon:Z?R2:z2,size:"24px",removeMargin:!0})})},m.InputProps)})),(0,B.jsx)(w,{name:C})]})})},K2=(0,a2.memo)(z3);var Z2=require("react"),c2=require("react-hook-form"),X=require("@s_mart/core"),E=require("@mui/material");var k=require("react/jsx-runtime"),O3=P=>{var H=P,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:u,options:M,placeholder:t,onInputChange:L,footer:d,multiple:p,info:c,onChange:m}=H,x=f(H,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","onInputChange","footer","multiple","info","onChange"]);let Z=(0,c2.useFormContext)(),{palette:y}=(0,E.useTheme)(),[v,I]=(0,Z2.useState)(!1);if(!Z)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let A=S(Z.formState.errors,C);return console.warn=()=>{},(0,k.jsx)(c2.Controller,{control:Z.control,name:C,rules:i,defaultValue:e||"",shouldUnregister:l,render:({field:{value:R,onChange:a}})=>(0,k.jsxs)(E.Grid,{display:"flex",flexDirection:"column",children:[(0,k.jsxs)("div",{style:{display:"flex"},children:[r&&(0,k.jsx)(E.Grid,{item:!0,children:(0,k.jsx)(h,{label:r,required:u})}),c&&(0,k.jsx)(E.Grid,{item:!0,children:(0,k.jsx)(X.Tooltip,{title:c,placement:"top",children:(0,k.jsx)("div",{style:{width:"fit-content"},children:(0,k.jsx)(X.LIcon,{icon:N,color:"#757575"})})})})]}),(0,k.jsxs)(E.Select,V(o({open:v,onOpen:()=>I(!0),onClose:()=>I(!1),displayEmpty:Boolean(t),variant:"outlined",autoComplete:"off",value:R?R||"":p?[]:"",renderValue:n=>{if(n.label)return n.label;if(t)return(0,k.jsx)("p",{style:{color:y.grey[400]},children:t})},multiple:p,onChange:n=>{a(n.target.value),L==null||L(n.target.value,Z.watch()),m&&m(n.target.value,Z.watch())},error:Boolean(A),size:x.size||"medium"},x),{children:[t&&(0,k.jsx)(E.MenuItem,{disabled:!0,value:"",children:(0,k.jsx)("p",{style:{color:y.grey[400]},children:t})}),M==null?void 0:M.map((n,s)=>(0,k.jsx)(E.MenuItem,{value:n,children:n.label},s)),d&&[(0,k.jsx)(E.Grid,{px:2,py:1,children:(0,k.jsx)(X.Divider,{})},"footer-divider"),(0,k.jsx)("div",{children:d({closeSelect:()=>I(!1)})},"footer-content")]]})),(0,k.jsx)(w,{name:C})]})})},Q2=(0,Z2.memo)(O3);var J2=require("react"),p2=require("react-hook-form"),O=require("@mui/material");var C2=require("@s_mart/core");var b=require("react/jsx-runtime"),T2=require("react"),_3=Z=>{var y=Z,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:u,options:M,textFieldProps:t,noOptionsText:L,footer:d,multiple:p,info:c,placeholder:m,onChange:x,onInputChange:P}=y,H=f(y,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText","footer","multiple","info","placeholder","onChange","onInputChange"]);let v=(0,p2.useFormContext)();if(!v)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let I=S(v.formState.errors,C);return console.warn=()=>{},(0,b.jsx)(p2.Controller,{control:v.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{onChange:A,value:R}})=>(0,b.jsxs)(O.Grid,{display:"flex",flexDirection:"column",children:[(0,b.jsxs)("div",{style:{display:"flex"},children:[r&&(0,b.jsx)(O.Grid,{item:!0,children:(0,b.jsx)(h,{label:r,required:u})}),c&&(0,b.jsx)(O.Grid,{item:!0,children:(0,b.jsx)(C2.Tooltip,{title:c,placement:"top",children:(0,b.jsx)("div",{style:{width:"fit-content"},children:(0,b.jsx)(C2.LIcon,{icon:N,color:"#757575"})})})})]}),(0,b.jsx)(O.Autocomplete,V(o({onChange:(a,n)=>{A(n),x==null||x(n,v.watch())},onInputChange:(a,n,s)=>{s==="input"&&(A(n),setTimeout(()=>{P==null||P(n,v.watch())},0))},value:R||(p?[]:null),options:M,multiple:p,noOptionsText:L||"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(a,n)=>typeof a=="string"&&typeof n=="string"?a===n:typeof a=="object"&&typeof n=="object"?a.value===n.value:!1,renderOption:(a,n)=>typeof n=="object"?(0,T2.createElement)("li",V(o({},a),{key:n.key||n.value}),n.label):(0,T2.createElement)("li",V(o({},a),{key:n}),n),ListboxComponent:a=>(0,b.jsxs)("ul",V(o({},a),{children:[a.children,d&&(0,b.jsx)("li",{children:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(O.Grid,{px:2,py:1,children:(0,b.jsx)(C2.Divider,{})}),d]})},"searchable-footer")]}))},H),{renderInput:a=>(0,b.jsx)(O.TextField,o(o({error:Boolean(I),placeholder:m},a),t))})),(0,b.jsx)(w,{name:C})]})})},X2=(0,J2.memo)(_3);var o3=require("react"),m2=require("react-hook-form"),$=require("@mui/material");var _=require("@s_mart/utils"),B2=V2(require("@emotion/styled")),A2=require("@emotion/react"),C3=A2.css`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
5
- `,_3=C=>B2.css`
5
+ `,N3=C=>A2.css`
6
6
  .MuiAutocomplete-endAdornment {
7
7
  position: relative;
8
8
  right: 0;
@@ -10,11 +10,11 @@
10
10
 
11
11
  .creatable,
12
12
  .editable {
13
- ${X2}
13
+ ${C3}
14
14
 
15
15
  .divider {
16
16
  width: 1px;
17
- height: ${(0,z.toRem)(20)};
17
+ height: ${(0,_.toRem)(20)};
18
18
  background-color: ${C.palette.grey[400]};
19
19
  }
20
20
 
@@ -25,9 +25,9 @@
25
25
  color: ${C.palette.grey[600]};
26
26
  border-radius: 50%;
27
27
 
28
- margin: 0 ${(0,z.toRem)(6)};
29
- width: ${(0,z.toRem)(28)};
30
- height: ${(0,z.toRem)(28)};
28
+ margin: 0 ${(0,_.toRem)(6)};
29
+ width: ${(0,_.toRem)(28)};
30
+ height: ${(0,_.toRem)(28)};
31
31
 
32
32
  &:hover {
33
33
  cursor: pointer;
@@ -36,48 +36,48 @@
36
36
  }
37
37
  }
38
38
  }
39
- `,C3=T2.default.div`
39
+ `,i3=B2.default.div`
40
40
  display: flex;
41
41
 
42
42
  div.endAdornments {
43
43
  position: absolute;
44
44
  right: 0;
45
45
 
46
- ${X2}
46
+ ${C3}
47
47
  }
48
48
 
49
- ${({hideAddButton:C,theme:i})=>!C&&_3(i)}
50
- `,i3=T2.default.div`
49
+ ${({hideAddButton:C,theme:i})=>!C&&N3(i)}
50
+ `,e3=B2.default.div`
51
51
  color: ${({theme:C})=>C.palette.text.primary};
52
52
 
53
- padding: ${(0,z.toRem)(6)} ${(0,z.toRem)(16)};
54
- margin: ${(0,z.toRem)(-6)} ${(0,z.toRem)(-16)};
53
+ padding: ${(0,_.toRem)(6)} ${(0,_.toRem)(16)};
54
+ margin: ${(0,_.toRem)(-6)} ${(0,_.toRem)(-16)};
55
55
 
56
56
  &:hover {
57
57
  cursor: pointer;
58
58
  transition: background-color 0.2s ease-in-out;
59
59
  background-color: ${({theme:C})=>C.palette.grey[100]};
60
60
  }
61
- `;var i2=require("@s_mart/core");var m2=require("lodash");var p=require("react/jsx-runtime"),A2=require("react"),N3=F=>{var O=F,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:m,options:L,editable:H,onEditOption:d,onCreateOption:Z,textFieldProps:M,hideAddButton:a,multiple:u,info:x,onChange:f,onInputChange:t}=O,c=g(O,["name","rules","defaultValue","shouldUnregister","label","required","options","editable","onEditOption","onCreateOption","textFieldProps","hideAddButton","multiple","info","onChange","onInputChange"]);let A=(0,p2.useFormContext)();if(!A)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let _=T(A.formState.errors,C);console.warn=()=>{};let b=n=>{Z?Z(n):console.error("onCreateOption n\xE3o foi definido")},s=n=>{d?d(n):console.error("onEditOption n\xE3o foi definido")};return(0,p.jsx)(p2.Controller,{control:A.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:n,onChange:y}})=>{let N=(n==null?void 0:n.label)||(n==null?void 0:n.value)||n;return(0,p.jsxs)(D.Grid,{display:"flex",flexDirection:"column",children:[(0,p.jsx)(D.Grid,{item:!0,xs:12,children:(0,p.jsxs)(D.Grid,{container:!0,direction:"row",children:[r&&(0,p.jsx)(D.Grid,{item:!0,children:(0,p.jsx)(w,{label:r,required:m})}),x&&(0,p.jsx)(D.Grid,{item:!0,children:(0,p.jsx)(i2.Tooltip,{title:x,placement:"top",children:(0,p.jsx)("div",{style:{width:"fit-content"},children:(0,p.jsx)(i2.LIcon,{icon:j,color:"#757575"})})})})]})}),(0,p.jsx)(C3,{hideAddButton:a,children:(0,p.jsx)(D.Autocomplete,V(o({fullWidth:!0,onChange:(S,P)=>{y(P),f==null||f(P,A.watch())},onInputChange:(S,P,T3)=>{T3==="input"&&(y(P),setTimeout(()=>{t==null||t(P,A.watch())},0))},options:L,value:n||(u?[]:null),multiple:u,noOptionsText:(0,p.jsx)(i3,{onClick:()=>b(n),children:(0,p.jsxs)(D.Typography,{children:["Adicionar ",N&&`"${N}"`]})}),isOptionEqualToValue:(S,P)=>P?typeof S=="string"&&typeof P=="string"?S===P:typeof S=="object"&&typeof P=="object"?S.value===P.value:typeof S=="object"&&typeof P=="string":!1,renderOption:(S,P)=>typeof P=="object"?(0,A2.createElement)("li",V(o({},S),{key:P.key||P.value}),P.label):(0,A2.createElement)("li",V(o({},S),{key:P}),P)},c),{renderInput:S=>{let P=a?S.InputProps:V(o({},S.InputProps),{endAdornment:(0,p.jsxs)("div",{className:"endAdornments",children:[S.InputProps.endAdornment,H&&(0,m2.isObject)(n)&&!(0,m2.isEmpty)(n)?(0,p.jsxs)("div",{className:"editable",children:[(0,p.jsx)("div",{className:"divider"}),(0,p.jsx)("div",{className:"button",onClick:()=>s(n),children:(0,p.jsx)(i2.LIcon,{icon:O2,size:"24px",removeMargin:!0})})]}):null,(0,p.jsxs)("div",{className:"creatable",children:[(0,p.jsx)("div",{className:"divider"}),(0,p.jsx)("div",{className:"button",onClick:()=>b(n),children:(0,p.jsx)(i2.LIcon,{icon:z2,size:"24px",removeMargin:!0})})]})]})});return(0,p.jsx)(D.TextField,o(V(o({},S),{error:Boolean(_),onChange:y,InputProps:P}),M))}}))}),(0,p.jsx)(k,{name:C})]})}})},o3=(0,e3.memo)(N3);var u2=require("react-hook-form"),e2=require("@mui/material");var W=require("react/jsx-runtime"),j3=d=>{var Z=d,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,labelPlacement:m,required:L}=Z,H=g(Z,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let M=(0,u2.useFormContext)();if(!M)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,W.jsx)(u2.Controller,{control:M.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:a,onChange:u}})=>(0,W.jsxs)(e2.Grid,{display:"flex",flexDirection:"column",children:[(0,W.jsx)(e2.FormControlLabel,{control:(0,W.jsx)(e2.Checkbox,o({value:a!=null?a:"",defaultValue:a,onChange:u},H)),label:(0,W.jsx)(w,{label:r,required:L,regular:!0}),labelPlacement:m||"end"}),(0,W.jsx)(k,{name:C})]})})},r3=j3;var f2=require("react-hook-form"),o2=require("@mui/material");var Y=require("react/jsx-runtime"),W3=H=>{var d=H,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,labelPlacement:m}=d,L=g(d,["name","rules","defaultValue","shouldUnregister","label","labelPlacement"]);let Z=(0,f2.useFormContext)();if(!Z)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,Y.jsx)(f2.Controller,{control:Z.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:M,onChange:a}})=>(0,Y.jsxs)(o2.Grid,{display:"flex",flexDirection:"column",children:[(0,Y.jsx)(o2.FormControlLabel,{control:(0,Y.jsx)(o2.Switch,o({value:M!=null?M:"",defaultValue:M,onChange:a},L)),label:(0,Y.jsx)(w,{label:r}),labelPlacement:m||"end"}),(0,Y.jsx)(k,{name:C})]})})},l3=W3;var r2=require("@mui/material");var H2=require("react/jsx-runtime"),Y3=l=>{var r=l,{label:C,labelPlacement:i}=r,e=g(r,["label","labelPlacement"]);return(0,H2.jsx)(r2.Grid,{display:"flex",flexDirection:"column",children:(0,H2.jsx)(r2.FormControlLabel,{control:(0,H2.jsx)(r2.Radio,o({},e)),label:(0,H2.jsx)(w,{label:C}),labelPlacement:i||"end"})})},n3=Y3;var g2=require("react-hook-form"),x2=require("@mui/material");var Q=require("react/jsx-runtime"),K3=Z=>{var M=Z,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:m,children:L,orientation:H="row"}=M,d=g(M,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation"]);let a=(0,g2.useFormContext)();if(!a)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,Q.jsx)(g2.Controller,{control:a.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:u,onChange:x}})=>(0,Q.jsxs)(x2.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,Q.jsx)(w,{label:r,required:m}),(0,Q.jsx)(x2.RadioGroup,V(o({value:u||"",onChange:x,name:C},d),{style:{display:"flex",flexDirection:H},children:L})),(0,Q.jsx)(k,{name:C})]})})},t3=K3;var y2=require("react-hook-form"),H3=require("@mui/material");var E2=require("react/jsx-runtime"),Q3=m=>{var L=m,{name:C,rules:i,defaultValue:e,shouldUnregister:l}=L,r=g(L,["name","rules","defaultValue","shouldUnregister"]);let H=(0,y2.useFormContext)();if(!H)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,E2.jsx)(y2.Controller,{control:H.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:d,onChange:Z}})=>(0,E2.jsx)(H3.Slider,o({value:d||(r==null?void 0:r.min)||0,onChange:Z,valueLabelDisplay:"auto"},r))})},s3=Q3;var L3=require("react"),h2=require("react-hook-form"),a3=require("@s_mart/core"),M3=require("@mui/material"),Z3=require("@mui/x-date-pickers/DatePicker"),c3=require("@mui/x-date-pickers/AdapterDayjs"),p3=require("@mui/x-date-pickers/LocalizationProvider");var I=require("@s_mart/utils"),d3=d2(require("@emotion/styled")),J3=C=>{switch(C){case"small":return(0,I.toRem)(16);default:case"medium":return(0,I.toRem)(20);case"large":return(0,I.toRem)(24)}},X3=C=>{switch(C){case"small":return`${(0,I.toRem)(2)} ${(0,I.toRem)(8)}`;default:case"medium":return`${(0,I.toRem)(6)} ${(0,I.toRem)(8)}`;case"large":return`${(0,I.toRem)(10)}`}},V3=d3.default.div`
61
+ `;var i2=require("@s_mart/core");var u2=require("lodash");var g=require("react/jsx-runtime"),E2=require("react"),j3=v=>{var I=v,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:u,options:M,editable:t,onEditOption:L,onCreateOption:d,textFieldProps:p,hideAddButton:c,multiple:m,info:x,onChange:P,onInputChange:H,placeholder:Z}=I,y=f(I,["name","rules","defaultValue","shouldUnregister","label","required","options","editable","onEditOption","onCreateOption","textFieldProps","hideAddButton","multiple","info","onChange","onInputChange","placeholder"]);let A=(0,m2.useFormContext)();if(!A)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let R=S(A.formState.errors,C);console.warn=()=>{};let a=s=>{d?d(s):console.error("onCreateOption n\xE3o foi definido")},n=s=>{L?L(s):console.error("onEditOption n\xE3o foi definido")};return(0,g.jsx)(m2.Controller,{control:A.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:s,onChange:z}})=>{let l2=(s==null?void 0:s.label)||(s==null?void 0:s.value)||s;return(0,g.jsxs)($.Grid,{display:"flex",flexDirection:"column",children:[(0,g.jsxs)("div",{style:{display:"flex"},children:[r&&(0,g.jsx)($.Grid,{item:!0,children:(0,g.jsx)(h,{label:r,required:u})}),x&&(0,g.jsx)($.Grid,{item:!0,children:(0,g.jsx)(i2.Tooltip,{title:x,placement:"top",children:(0,g.jsx)("div",{style:{width:"fit-content"},children:(0,g.jsx)(i2.LIcon,{icon:N,color:"#757575"})})})})]}),(0,g.jsx)(i3,{hideAddButton:c,children:(0,g.jsx)($.Autocomplete,V(o({fullWidth:!0,onChange:(T,F)=>{z(F),P==null||P(F,A.watch())},onInputChange:(T,F,B3)=>{B3==="input"&&(z(F),setTimeout(()=>{H==null||H(F,A.watch())},0))},options:M,value:s||(m?[]:null),multiple:m,noOptionsText:(0,g.jsx)(e3,{onClick:()=>a(s),children:(0,g.jsxs)($.Typography,{children:["Adicionar ",l2&&`"${l2}"`]})}),isOptionEqualToValue:(T,F)=>F?typeof T=="string"&&typeof F=="string"?T===F:typeof T=="object"&&typeof F=="object"?T.value===F.value:typeof T=="object"&&typeof F=="string":!1,renderOption:(T,F)=>typeof F=="object"?(0,E2.createElement)("li",V(o({},T),{key:F.key||F.value}),F.label):(0,E2.createElement)("li",V(o({},T),{key:F}),F)},y),{renderInput:T=>{let F=c?T.InputProps:V(o({},T.InputProps),{endAdornment:(0,g.jsxs)("div",{className:"endAdornments",children:[T.InputProps.endAdornment,t&&(0,u2.isObject)(s)&&!(0,u2.isEmpty)(s)?(0,g.jsxs)("div",{className:"editable",children:[(0,g.jsx)("div",{className:"divider"}),(0,g.jsx)("div",{className:"button",onClick:()=>n(s),children:(0,g.jsx)(i2.LIcon,{icon:_2,size:"24px",removeMargin:!0})})]}):null,(0,g.jsxs)("div",{className:"creatable",children:[(0,g.jsx)("div",{className:"divider"}),(0,g.jsx)("div",{className:"button",onClick:()=>a(s),children:(0,g.jsx)(i2.LIcon,{icon:O2,size:"24px",removeMargin:!0})})]})]})});return(0,g.jsx)($.TextField,o(V(o({placeholder:Z},T),{error:Boolean(R),onChange:z,InputProps:F}),p))}}))}),(0,g.jsx)(w,{name:C})]})}})},r3=(0,o3.memo)(j3);var f2=require("react-hook-form"),e2=require("@mui/material");var W=require("react/jsx-runtime"),W3=L=>{var d=L,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,labelPlacement:u,required:M}=d,t=f(d,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let p=(0,f2.useFormContext)();if(!p)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,W.jsx)(f2.Controller,{control:p.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:c,onChange:m}})=>(0,W.jsxs)(e2.Grid,{display:"flex",flexDirection:"column",children:[(0,W.jsx)(e2.FormControlLabel,{control:(0,W.jsx)(e2.Checkbox,o({value:c!=null?c:"",defaultValue:c,onChange:m},t)),label:(0,W.jsx)(h,{label:r,required:M,regular:!0}),labelPlacement:u||"end"}),(0,W.jsx)(w,{name:C})]})})},l3=W3;var g2=require("react-hook-form"),o2=require("@mui/material");var Y=require("react/jsx-runtime"),Y3=t=>{var L=t,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,labelPlacement:u}=L,M=f(L,["name","rules","defaultValue","shouldUnregister","label","labelPlacement"]);let d=(0,g2.useFormContext)();if(!d)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,Y.jsx)(g2.Controller,{control:d.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:p,onChange:c}})=>(0,Y.jsxs)(o2.Grid,{display:"flex",flexDirection:"column",children:[(0,Y.jsx)(o2.FormControlLabel,{control:(0,Y.jsx)(o2.Switch,o({value:p!=null?p:"",defaultValue:p,onChange:c},M)),label:(0,Y.jsx)(h,{label:r}),labelPlacement:u||"end"}),(0,Y.jsx)(w,{name:C})]})})},n3=Y3;var r2=require("@mui/material");var s2=require("react/jsx-runtime"),K3=l=>{var r=l,{label:C,labelPlacement:i}=r,e=f(r,["label","labelPlacement"]);return(0,s2.jsx)(r2.Grid,{display:"flex",flexDirection:"column",children:(0,s2.jsx)(r2.FormControlLabel,{control:(0,s2.jsx)(r2.Radio,o({},e)),label:(0,s2.jsx)(h,{label:C}),labelPlacement:i||"end"})})},t3=K3;var x2=require("react-hook-form"),y2=require("@mui/material");var Q=require("react/jsx-runtime"),Q3=d=>{var p=d,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:u,children:M,orientation:t="row"}=p,L=f(p,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation"]);let c=(0,x2.useFormContext)();if(!c)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,Q.jsx)(x2.Controller,{control:c.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:m,onChange:x}})=>(0,Q.jsxs)(y2.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,Q.jsx)(h,{label:r,required:u}),(0,Q.jsx)(y2.RadioGroup,V(o({value:m||"",onChange:x,name:C},L),{style:{display:"flex",flexDirection:t},children:M})),(0,Q.jsx)(w,{name:C})]})})},H3=Q3;var h2=require("react-hook-form"),s3=require("@mui/material");var D2=require("react/jsx-runtime"),J3=u=>{var M=u,{name:C,rules:i,defaultValue:e,shouldUnregister:l}=M,r=f(M,["name","rules","defaultValue","shouldUnregister"]);let t=(0,h2.useFormContext)();if(!t)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,D2.jsx)(h2.Controller,{control:t.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:L,onChange:d}})=>(0,D2.jsx)(s3.Slider,o({value:L||(r==null?void 0:r.min)||0,onChange:d,valueLabelDisplay:"auto"},r))})},d3=J3;var a3=require("react"),F2=require("react-hook-form"),M3=require("@s_mart/core"),Z3=require("@mui/material"),c3=require("@mui/x-date-pickers/DatePicker"),p3=require("@mui/x-date-pickers/AdapterDayjs"),m3=require("@mui/x-date-pickers/LocalizationProvider");var D=require("@s_mart/utils"),V3=V2(require("@emotion/styled")),X3=C=>{switch(C){case"small":return(0,D.toRem)(16);default:case"medium":return(0,D.toRem)(20);case"large":return(0,D.toRem)(24)}},C1=C=>{switch(C){case"small":return`${(0,D.toRem)(2)} ${(0,D.toRem)(8)}`;default:case"medium":return`${(0,D.toRem)(6)} ${(0,D.toRem)(8)}`;case"large":return`${(0,D.toRem)(10)}`}},L3=V3.default.div`
62
62
  > div > button {
63
- padding: ${({size:C})=>X3(C)};
64
- border-radius: 0 ${(0,I.toRem)(4)} ${(0,I.toRem)(4)} 0;
63
+ padding: ${({size:C})=>C1(C)};
64
+ border-radius: 0 ${(0,D.toRem)(4)} ${(0,D.toRem)(4)} 0;
65
65
 
66
66
  margin: 0px -13px 0px 0px;
67
67
 
68
68
  svg {
69
- width: ${({size:C})=>J3(C)};
69
+ width: ${({size:C})=>X3(C)};
70
70
  }
71
71
  }
72
- `;var U=require("react/jsx-runtime"),C1=Z=>{var M=Z,{rules:C,name:i,defaultValue:e,shouldUnregister:l,datePickerProps:r,label:m,required:L,placeholder:H}=M,d=g(M,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder"]);let a=(0,h2.useFormContext)();if(!a)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let u=T(a.formState.errors,i);return(0,U.jsx)(p3.LocalizationProvider,{dateAdapter:c3.AdapterDayjs,children:(0,U.jsx)(h2.Controller,{control:a.control,name:i,rules:C,defaultValue:e,shouldUnregister:l,render:({field:{value:x,onChange:f}})=>(0,U.jsxs)(a3.Grid,{display:"flex",flexDirection:"column",children:[m&&(0,U.jsx)(w,{label:m,required:L}),(0,U.jsx)(Z3.DatePicker,V(o({},r),{value:x!=null?x:null,inputFormat:(r==null?void 0:r.inputFormat)||"DD/MM/YYYY",onChange:f,renderInput:t=>{var c,F;return(0,U.jsx)(M3.TextField,V(o(V(o({variant:"outlined"},t),{error:Boolean(u)}),d),{inputProps:V(o({},t.inputProps),{placeholder:H||((c=t.inputProps)==null?void 0:c.placeholder)}),InputProps:V(o({},t.InputProps),{endAdornment:(0,U.jsx)(V3,{size:d.size,children:(F=t.InputProps)==null?void 0:F.endAdornment})})}))}})),(0,U.jsx)(k,{name:i})]})})})},m3=(0,L3.memo)(C1);var g3=require("@s_mart/core"),x3=require("@mui/x-date-pickers/TimePicker"),y3=require("@mui/material"),F2=require("react-hook-form"),h3=require("@mui/x-date-pickers/AdapterDayjs"),F3=require("@mui/x-date-pickers/LocalizationProvider");var $=require("@s_mart/utils"),u3=d2(require("@emotion/styled")),i1=C=>{switch(C){case"small":return(0,$.toRem)(16);default:case"medium":return(0,$.toRem)(20);case"large":return(0,$.toRem)(24)}},e1=C=>{switch(C){case"small":return`${(0,$.toRem)(2)} ${(0,$.toRem)(8)}`;default:case"medium":return`${(0,$.toRem)(6)} ${(0,$.toRem)(8)}`;case"large":return`${(0,$.toRem)(10)}`}},f3=u3.default.div`
72
+ `;var q=require("react/jsx-runtime"),i1=d=>{var p=d,{rules:C,name:i,defaultValue:e,shouldUnregister:l,datePickerProps:r,label:u,required:M,placeholder:t}=p,L=f(p,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder"]);let c=(0,F2.useFormContext)();if(!c)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let m=S(c.formState.errors,i);return(0,q.jsx)(m3.LocalizationProvider,{dateAdapter:p3.AdapterDayjs,children:(0,q.jsx)(F2.Controller,{control:c.control,name:i,rules:C,defaultValue:e,shouldUnregister:l,render:({field:{value:x,onChange:P}})=>(0,q.jsxs)(M3.Grid,{display:"flex",flexDirection:"column",children:[u&&(0,q.jsx)(h,{label:u,required:M}),(0,q.jsx)(c3.DatePicker,V(o({},r),{value:x!=null?x:null,inputFormat:(r==null?void 0:r.inputFormat)||"DD/MM/YYYY",onChange:P,renderInput:H=>{var Z,y;return(0,q.jsx)(Z3.TextField,V(o(V(o({variant:"outlined"},H),{error:Boolean(m)}),L),{inputProps:V(o({},H.inputProps),{placeholder:t||((Z=H.inputProps)==null?void 0:Z.placeholder)}),InputProps:V(o({},H.InputProps),{endAdornment:(0,q.jsx)(L3,{size:L.size,children:(y=H.InputProps)==null?void 0:y.endAdornment})})}))}})),(0,q.jsx)(w,{name:i})]})})})},u3=(0,a3.memo)(i1);var x3=require("@s_mart/core"),y3=require("@mui/x-date-pickers/TimePicker"),h3=require("@mui/material"),b2=require("react-hook-form"),F3=require("@mui/x-date-pickers/AdapterDayjs"),b3=require("@mui/x-date-pickers/LocalizationProvider");var G=require("@s_mart/utils"),f3=V2(require("@emotion/styled")),e1=C=>{switch(C){case"small":return(0,G.toRem)(16);default:case"medium":return(0,G.toRem)(20);case"large":return(0,G.toRem)(24)}},o1=C=>{switch(C){case"small":return`${(0,G.toRem)(2)} ${(0,G.toRem)(8)}`;default:case"medium":return`${(0,G.toRem)(6)} ${(0,G.toRem)(8)}`;case"large":return`${(0,G.toRem)(10)}`}},g3=f3.default.div`
73
73
  > div > button {
74
- padding: ${({size:C})=>e1(C)};
75
- border-radius: 0 ${(0,$.toRem)(4)} ${(0,$.toRem)(4)} 0;
74
+ padding: ${({size:C})=>o1(C)};
75
+ border-radius: 0 ${(0,G.toRem)(4)} ${(0,G.toRem)(4)} 0;
76
76
 
77
77
  margin: 0px -13px 0px 0px;
78
78
 
79
79
  svg {
80
- width: ${({size:C})=>i1(C)};
80
+ width: ${({size:C})=>e1(C)};
81
81
  }
82
82
  }
83
- `;var b3=require("react");var R=require("react/jsx-runtime"),o1=Z=>{var M=Z,{rules:C,defaultValue:i,shouldUnregister:e,name:l,required:r,label:m,timePickerProps:L,placeholder:H}=M,d=g(M,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder"]);let a=(0,F2.useFormContext)();if(!a)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let u=T(a.formState.errors,l);return(0,R.jsx)(F3.LocalizationProvider,{dateAdapter:h3.AdapterDayjs,children:(0,R.jsx)(F2.Controller,{control:a.control,name:l,rules:C,defaultValue:i,shouldUnregister:e,render:({field:{value:x,onChange:f}})=>(0,R.jsxs)(g3.Grid,{display:"flex",flexDirection:"column",children:[m&&(0,R.jsx)(w,{label:m,required:r}),(0,R.jsx)(x3.TimePicker,V(o({value:x!=null?x:null,onChange:f},L),{renderInput:t=>{var c,F;return(0,R.jsx)(y3.TextField,V(o(V(o({variant:"outlined"},t),{error:Boolean(u)}),d),{inputProps:V(o({},t.inputProps),{placeholder:H||((c=t.inputProps)==null?void 0:c.placeholder)}),InputProps:V(o({},t.InputProps),{endAdornment:(0,R.jsx)(f3,{size:d.size,children:(F=t.InputProps)==null?void 0:F.endAdornment})})}))}})),(0,R.jsx)(k,{name:l})]})})})},w3=(0,b3.memo)(o1);var P3=require("react"),b2=require("react-hook-form"),w2=require("@mui/material"),k3=require("@s_mart/core");var K=require("react/jsx-runtime"),S3=require("react"),r1=Z=>{var M=Z,{name:C,defaultValue:i,rules:e,shouldUnregister:l,label:r,required:m,onInputChange:L,onChange:H}=M,d=g(M,["name","defaultValue","rules","shouldUnregister","label","required","onInputChange","onChange"]);let a=(0,b2.useFormContext)();if(!a)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let u=T(a.formState.errors,C);return console.warn=()=>{},(0,K.jsx)(b2.Controller,{name:C,control:a.control,defaultValue:i,rules:e,shouldUnregister:l,render:({field:x})=>(0,K.jsxs)(k3.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,K.jsx)(w,{label:r,required:m}),(0,K.jsx)(w2.Autocomplete,V(o({onChange:(f,t)=>{x.onChange(t),H==null||H(t,a.watch())},onInputChange:(f,t,c)=>{c==="input"&&(x.onChange(t),setTimeout(()=>{L==null||L(t,a.watch())},0))},isOptionEqualToValue:(f,t)=>f.value===t.value,renderOption:(f,t)=>(0,S3.createElement)("li",V(o({},f),{key:t.key||t.value,onClick:c=>{var F;(F=f.onClick)==null||F.call(f,c),x.onChange(t)}}),t.label),value:x.value||null},d),{renderInput:f=>{var t,c,F;return(0,K.jsx)(w2.TextField,V(o(o({},f),d.textFieldProps),{error:Boolean(u),InputProps:V(o(o({},f.InputProps),(t=d.textFieldProps)==null?void 0:t.InputProps),{inputProps:o(o({},f.inputProps),(F=(c=d.textFieldProps)==null?void 0:c.InputProps)==null?void 0:F.inputProps)})}))}})),(0,K.jsx)(k,{name:C})]})})},v3=(0,P3.memo)(r1);0&&(module.exports={Autocomplete,Checkbox,Creatable,DatePicker,Form,RadioButton,RadioGroup,Searchable,Select,Slider,Switch,TextField,TimePicker});
83
+ `;var P3=require("react");var U=require("react/jsx-runtime"),r1=d=>{var p=d,{rules:C,defaultValue:i,shouldUnregister:e,name:l,required:r,label:u,timePickerProps:M,placeholder:t}=p,L=f(p,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder"]);let c=(0,b2.useFormContext)();if(!c)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let m=S(c.formState.errors,l);return(0,U.jsx)(b3.LocalizationProvider,{dateAdapter:F3.AdapterDayjs,children:(0,U.jsx)(b2.Controller,{control:c.control,name:l,rules:C,defaultValue:i,shouldUnregister:e,render:({field:{value:x,onChange:P}})=>(0,U.jsxs)(x3.Grid,{display:"flex",flexDirection:"column",children:[u&&(0,U.jsx)(h,{label:u,required:r}),(0,U.jsx)(y3.TimePicker,V(o({value:x!=null?x:null,onChange:P},M),{renderInput:H=>{var Z,y;return(0,U.jsx)(h3.TextField,V(o(V(o({variant:"outlined"},H),{error:Boolean(m)}),L),{inputProps:V(o({},H.inputProps),{placeholder:t||((Z=H.inputProps)==null?void 0:Z.placeholder)}),InputProps:V(o({},H.InputProps),{endAdornment:(0,U.jsx)(g3,{size:L.size,children:(y=H.InputProps)==null?void 0:y.endAdornment})})}))}})),(0,U.jsx)(w,{name:l})]})})})},w3=(0,P3.memo)(r1);var k3=require("react"),P2=require("react-hook-form"),w2=require("@mui/material"),v3=require("@s_mart/core");var K=require("react/jsx-runtime"),T3=require("react"),l1=p=>{var c=p,{name:C,defaultValue:i,rules:e,shouldUnregister:l,label:r,required:u,placeholder:M,onInputChange:t,onChange:L}=c,d=f(c,["name","defaultValue","rules","shouldUnregister","label","required","placeholder","onInputChange","onChange"]);let m=(0,P2.useFormContext)();if(!m)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=S(m.formState.errors,C);return console.warn=()=>{},(0,K.jsx)(P2.Controller,{name:C,control:m.control,defaultValue:i,rules:e,shouldUnregister:l,render:({field:P})=>(0,K.jsxs)(v3.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,K.jsx)(h,{label:r,required:u}),(0,K.jsx)(w2.Autocomplete,V(o({onChange:(H,Z)=>{P.onChange(Z),L==null||L(Z,m.watch())},onInputChange:(H,Z,y)=>{y==="input"&&(P.onChange(Z),setTimeout(()=>{t==null||t(Z,m.watch())},0))},isOptionEqualToValue:(H,Z)=>H.value===Z.value,renderOption:(H,Z)=>(0,T3.createElement)("li",V(o({},H),{key:Z.key||Z.value,onClick:y=>{var v;(v=H.onClick)==null||v.call(H,y),P.onChange(Z)}}),Z.label),value:P.value||null},d),{renderInput:H=>{var Z,y,v;return(0,K.jsx)(w2.TextField,V(o(o({placeholder:M},H),d.textFieldProps),{error:Boolean(x),InputProps:V(o(o({},H.InputProps),(Z=d.textFieldProps)==null?void 0:Z.InputProps),{inputProps:o(o({},H.inputProps),(v=(y=d.textFieldProps)==null?void 0:y.InputProps)==null?void 0:v.inputProps)})}))}})),(0,K.jsx)(w,{name:C})]})})},S3=(0,k3.memo)(l1);0&&(module.exports={Autocomplete,Checkbox,Creatable,DatePicker,Form,RadioButton,RadioGroup,Searchable,Select,Slider,Switch,TextField,TimePicker});
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- var k2=Object.defineProperty,v2=Object.defineProperties;var S2=Object.getOwnPropertyDescriptors;var X=Object.getOwnPropertySymbols;var n2=Object.prototype.hasOwnProperty,t2=Object.prototype.propertyIsEnumerable;var l2=(C,i,o)=>i in C?k2(C,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):C[i]=o,e=(C,i)=>{for(var o in i||(i={}))n2.call(i,o)&&l2(C,o,i[o]);if(X)for(var o of X(i))t2.call(i,o)&&l2(C,o,i[o]);return C},V=(C,i)=>v2(C,S2(i));var f=(C,i)=>{var o={};for(var n in C)n2.call(C,n)&&i.indexOf(n)<0&&(o[n]=C[n]);if(C!=null&&X)for(var n of X(C))i.indexOf(n)<0&&t2.call(C,n)&&(o[n]=C[n]);return o};import{useEffect as T2}from"react";import{FormProvider as B2,useForm as A2}from"react-hook-form";import{jsx as H2}from"react/jsx-runtime";function E2(p){var L=p,{children:C,onSubmit:i,style:o,disableDefaultValuesUpdate:n}=L,l=f(L,["children","onSubmit","style","disableDefaultValuesUpdate"]);let H=A2(l);T2(()=>{n||H.reset(l.defaultValues)},[l.defaultValues,H.reset]);let d=()=>typeof C=="function"?C(V(e({},H),{onSubmit:H.handleSubmit(Z=>i(Z,H))})):C;return H2(B2,V(e({},H),{children:H2("form",{onSubmit:Z=>{Z.preventDefault(),Z.stopPropagation(),H.handleSubmit(M=>i(M,H))()},style:o,children:d()})}))}var G2=E2;import{memo as R2,useState as z2}from"react";import{Controller as O2,useFormContext as _2}from"react-hook-form";import{Grid as W,InputAdornment as N2,TextField as j2}from"@mui/material";var s2={description:"M39.0611 23.1367C36.3276 17.015 30.4051 13.2479 24.027 13.0909C17.4971 13.2479 11.5746 17.172 8.84117 23.1367C8.68931 23.6076 8.68931 24.2355 8.84117 24.8633C11.5746 30.985 17.4971 34.7521 23.8752 34.9091C30.4051 34.7521 36.1757 30.828 38.9092 24.8633C39.3648 24.2355 39.3648 23.6076 39.0611 23.1367ZM24.027 32.0837C19.6231 31.9268 16.2822 28.1596 16.4341 23.6076C16.586 19.3695 19.9269 15.7593 24.027 15.7593C28.4309 15.9163 31.7718 19.6835 31.62 24.2355C31.4681 28.4735 28.1272 32.0837 24.027 32.0837ZM24.027 18.5847C23.5715 18.5847 23.1159 18.7417 22.6603 18.7417C23.4196 19.8404 23.2677 21.2531 22.3566 22.3519C21.4454 23.2937 20.0787 23.2937 19.0157 22.5088C18.5601 24.7063 19.3194 27.2178 21.1417 28.4735C22.964 29.7292 25.3938 29.7292 27.0642 28.3165C28.7347 26.9039 29.494 24.3924 28.7347 22.1949C28.1272 19.9974 26.1531 18.5847 24.027 18.5847Z",viewBox:"0 0 48 48",id:"line-eye-solid"},d2={description:"M23.9998 31.7412C19.9223 31.7412 16.6215 28.5851 16.3177 24.5854L10.6785 20.2272C9.93715 21.1573 9.25496 22.1405 8.70447 23.2157C8.58149 23.4589 8.51742 23.7277 8.51742 24.0003C8.51742 24.2729 8.58149 24.5416 8.70447 24.7849C11.6198 30.4731 17.3913 34.3216 23.9998 34.3216C25.4465 34.3216 26.842 34.1066 28.1871 33.7593L25.3976 31.6009C24.9369 31.6899 24.469 31.7369 23.9998 31.7412ZM40.8703 34.8646L34.9273 30.2715C36.7326 28.7501 38.2174 26.8848 39.2952 24.7843C39.4182 24.5411 39.4823 24.2723 39.4823 23.9997C39.4823 23.7272 39.4182 23.4584 39.2952 23.2151C36.3799 17.5269 30.6084 13.6784 23.9998 13.6784C21.2321 13.6817 18.5093 14.3785 16.0801 15.7051L9.24098 10.419C9.15179 10.3496 9.04981 10.2985 8.94085 10.2685C8.83189 10.2385 8.7181 10.2303 8.60597 10.2443C8.49384 10.2584 8.38557 10.2944 8.28736 10.3502C8.18914 10.4061 8.1029 10.4808 8.03356 10.5701L6.97828 11.9285C6.8383 12.1086 6.77557 12.3369 6.8039 12.5633C6.83223 12.7896 6.94929 12.9954 7.12934 13.1354L38.7587 37.581C38.8479 37.6504 38.9499 37.7016 39.0588 37.7315C39.1678 37.7615 39.2816 37.7697 39.3937 37.7557C39.5058 37.7416 39.6141 37.7057 39.7123 37.6498C39.8105 37.5939 39.8968 37.5192 39.9661 37.43L41.0219 36.0715C41.1619 35.8913 41.2245 35.663 41.1961 35.4366C41.1676 35.2103 41.0505 35.0045 40.8703 34.8646ZM30.9938 27.2309L28.8811 25.5977C29.059 25.0835 29.1534 24.5441 29.1606 24C29.1711 23.2034 28.9947 22.4155 28.6454 21.6995C28.2962 20.9836 27.7838 20.3595 27.1496 19.8774C26.5154 19.3953 25.777 19.0687 24.9937 18.9238C24.2103 18.7788 23.4039 18.8197 22.6392 19.0429C22.9634 19.4822 23.1387 20.0135 23.1397 20.5595C23.1317 20.7411 23.1039 20.9214 23.0569 21.097L19.0997 18.0387C20.4743 16.89 22.2085 16.2601 23.9998 16.2588C25.0166 16.2582 26.0235 16.4581 26.9629 16.8469C27.9024 17.2357 28.756 17.8059 29.475 18.5249C30.1939 19.2438 30.7641 20.0974 31.1529 21.0369C31.5418 21.9764 31.7416 22.9833 31.7411 24C31.7411 25.1628 31.4567 26.246 30.9938 27.2309Z",viewBox:"0 0 48 48",id:"line-eye-slash-solid"};var q={description:"M24 8C15.1613 8 8 15.2258 8 24C8 32.8387 15.1613 40 24 40C32.7742 40 40 32.8387 40 24C40 15.2258 32.7742 8 24 8ZM24 15.0968C25.4839 15.0968 26.7097 16.3226 26.7097 17.8065C26.7097 19.3548 25.4839 20.5161 24 20.5161C22.4516 20.5161 21.2903 19.3548 21.2903 17.8065C21.2903 16.3226 22.4516 15.0968 24 15.0968ZM27.6129 31.4839C27.6129 31.9355 27.2258 32.2581 26.8387 32.2581H21.1613C20.7097 32.2581 20.3871 31.9355 20.3871 31.4839V29.9355C20.3871 29.5484 20.7097 29.1613 21.1613 29.1613H21.9355V25.0323H21.1613C20.7097 25.0323 20.3871 24.7097 20.3871 24.2581V22.7097C20.3871 22.3226 20.7097 21.9355 21.1613 21.9355H25.2903C25.6774 21.9355 26.0645 22.3226 26.0645 22.7097V29.1613H26.8387C27.2258 29.1613 27.6129 29.5484 27.6129 29.9355V31.4839Z",viewBox:"0 0 48 48",id:"line-info-circle-solid"},V2={description:"M35.8286 21.8493H26.1506V12.1714C26.1506 11.6338 25.613 11.0961 25.0753 11.0961H22.9247C22.3198 11.0961 21.8493 11.6338 21.8493 12.1714V21.8493H12.1714C11.5666 21.8493 11.0961 22.387 11.0961 22.9247V25.0753C11.0961 25.6802 11.5666 26.1506 12.1714 26.1506H21.8493V35.8286C21.8493 36.4334 22.3198 36.9039 22.9247 36.9039H25.0753C25.613 36.9039 26.1506 36.4334 26.1506 35.8286V26.1506H35.8286C36.3662 26.1506 36.9039 25.6802 36.9039 25.0753V22.9247C36.9039 22.387 36.3662 21.8493 35.8286 21.8493Z",viewBox:"0 0 48 48",id:"line-plus-solid"};var L2={description:"M25.4929 17.0061L30.9936 22.5071L19.049 34.4522L14.1447 34.9936C13.4881 35.0662 12.9334 34.511 13.0065 33.8545L13.5522 28.9465L25.4929 17.0061ZM34.3958 16.1872L31.813 13.6043C31.0073 12.7986 29.7007 12.7986 28.8951 13.6043L26.4652 16.0342L31.966 21.5351L34.3958 19.1052C35.2014 18.2991 35.2014 16.9928 34.3958 16.1872Z",id:"line-pen-solid"};import*as _ from"@s_mart/masks";import{Typography as a2}from"@mui/material";import{toRem as D2}from"@s_mart/utils";import{jsx as M2,jsxs as I2}from"react/jsx-runtime";var F=({label:C,required:i,regular:o})=>I2("span",{style:{display:"flex",alignItems:"center",gap:D2(2)},children:[M2(a2,{variant:"caption",fontWeight:o?400:700,style:{display:"flex",alignItems:"center"},children:C}),i&&M2(a2,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});import{useFormContext as $2}from"react-hook-form";import{Indicator as q2}from"@s_mart/core";var v=(C,i)=>{var o,n,l,p,L;if(C[i])return C[i];if(i.includes("[")){let[H,d]=i.split("["),[Z,M]=d.split("].");return(n=(o=C[H])==null?void 0:o[Z])==null?void 0:n[M]}if(i.includes(".")){let[H,d,Z]=i.split(".");return Z?(L=(p=C[H])==null?void 0:p[d])==null?void 0:L[Z]:(l=C[H])==null?void 0:l[d]}};import{jsx as U2}from"react/jsx-runtime";var w=({name:C})=>{var n;let i=$2(),o=v((n=i==null?void 0:i.formState)==null?void 0:n.errors,C);return o?U2(q2,{severity:"error",children:o==null?void 0:o.message}):null};import{LIcon as Z2,Tooltip as W2}from"@s_mart/core";import{jsx as A,jsxs as c2}from"react/jsx-runtime";var Y2=g=>{var u=g,{name:C,rules:i,defaultValue:o,shouldUnregister:n,label:l,required:p,mask:L,variant:H="outlined",info:d,parse:Z,format:M,onInputChange:a}=u,m=f(u,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","info","parse","format","onInputChange"]);let t=_2();if(!t)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[c,y]=z2(!1),D=s=>{var x;let r=s;return M&&(r=M(s)),L?(x=_==null?void 0:_[L])==null?void 0:x.format(r):r},B=s=>{var x;let r=s;return Z&&(r=Z(s)),L?(x=_==null?void 0:_[L])==null?void 0:x.parse(r):r},I=s=>{if(!s||L!=="porcentagem")return;s==null||s.stopPropagation();let r=(s==null?void 0:s.target).value;if(r){let x=String(r);if(x.length>0){let $=x.indexOf("%");$>-1&&(s.currentTarget.selectionEnd=$)}}},h=v(t.formState.errors,C);return A(O2,{control:t.control,name:C,rules:i,defaultValue:o,shouldUnregister:n,render:({field:{value:s,onChange:r}})=>c2(W,{display:"flex",flexDirection:"column",children:[A(W,{item:!0,xs:12,children:c2(W,{container:!0,direction:"row",children:[l&&A(W,{item:!0,children:A(F,{label:l,required:p})}),d&&A(W,{item:!0,children:A(W2,{title:d,placement:"top",children:A("div",{style:{width:"fit-content"},children:A(Z2,{icon:q,color:"#757575"})})})})]})}),A(j2,V(e({variant:H,defaultValue:o,value:D(s||""),onChange:x=>{var $,k;r(B(($=x==null?void 0:x.target)==null?void 0:$.value)),a==null||a((k=x==null?void 0:x.target)==null?void 0:k.value,t.watch())},error:Boolean(h)},m),{type:m.type==="password"?c?"text":"password":m.type,autoComplete:m.autoComplete||"off",InputProps:e({onKeyDown:I,endAdornment:m.type==="password"&&A(N2,{position:"end",onClick:()=>y(!c),style:{cursor:"pointer"},children:A(Z2,{icon:c?s2:d2,size:"24px",removeMargin:!0})})},m.InputProps)})),A(w,{name:C})]})})},K2=R2(Y2);import{memo as Q2,useState as J2}from"react";import{Controller as X2,useFormContext as C3}from"react-hook-form";import{Divider as i3,LIcon as e3,Tooltip as o3}from"@s_mart/core";import{Grid as N,Select as r3,MenuItem as p2,useTheme as l3}from"@mui/material";import{jsx as S,jsxs as o2}from"react/jsx-runtime";var n3=u=>{var t=u,{name:C,rules:i,defaultValue:o,shouldUnregister:n,label:l,required:p,options:L,placeholder:H,onInputChange:d,footer:Z,multiple:M,info:a,onChange:m}=t,g=f(t,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","onInputChange","footer","multiple","info","onChange"]);let c=C3(),{palette:y}=l3(),[D,B]=J2(!1);if(!c)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let I=v(c.formState.errors,C);return console.warn=()=>{},S(X2,{control:c.control,name:C,rules:i,defaultValue:o||"",shouldUnregister:n,render:({field:{value:h,onChange:s}})=>o2(N,{display:"flex",flexDirection:"column",children:[S(N,{item:!0,xs:12,children:o2(N,{container:!0,direction:"row",children:[l&&S(N,{item:!0,children:S(F,{label:l,required:p})}),a&&S(N,{item:!0,children:S(o3,{title:a,placement:"top",children:S("div",{style:{width:"fit-content"},children:S(e3,{icon:q,color:"#757575"})})})})]})}),o2(r3,V(e({open:D,onOpen:()=>B(!0),onClose:()=>B(!1),displayEmpty:Boolean(H),variant:"outlined",autoComplete:"off",value:h?h||"":M?[]:"",renderValue:r=>{var x;return(x=r==null?void 0:r.label)!=null?x:""},multiple:M,onChange:(r,x)=>{s(r.target.value),d==null||d(r.target.value,c.watch()),m&&m(r.target.value,c.watch())},error:Boolean(I),size:g.size||"medium"},g),{children:[H&&S(p2,{disabled:!0,value:"",children:S("p",{style:{color:y.grey[400]},children:H})}),L==null?void 0:L.map((r,x)=>S(p2,{value:r,children:r.label},x)),Z&&[S(N,{px:2,py:1,children:S(i3,{})},"footer-divider"),S("div",{children:Z({closeSelect:()=>B(!1)})},"footer-content")]]})),S(w,{name:C})]})})},t3=Q2(n3);import{memo as H3}from"react";import{Controller as s3,useFormContext as d3}from"react-hook-form";import{Grid as R,Autocomplete as V3,TextField as L3}from"@mui/material";import{Divider as a3,LIcon as M3,Tooltip as Z3}from"@s_mart/core";import{Fragment as m3,jsx as T,jsxs as C2}from"react/jsx-runtime";import{createElement as m2}from"react";var c3=t=>{var c=t,{name:C,rules:i,defaultValue:o,shouldUnregister:n,label:l,required:p,options:L,textFieldProps:H,noOptionsText:d,footer:Z,multiple:M,info:a,onChange:m,onInputChange:g}=c,u=f(c,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText","footer","multiple","info","onChange","onInputChange"]);let y=d3();if(!y)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let D=v(y.formState.errors,C);return console.warn=()=>{},T(s3,{control:y.control,name:C,rules:i,defaultValue:o,shouldUnregister:n,render:({field:{onChange:B,value:I}})=>C2(R,{display:"flex",flexDirection:"column",children:[T(R,{display:"flex",flexDirection:"column",children:T(R,{item:!0,xs:12,children:C2(R,{container:!0,direction:"row",children:[l&&T(R,{item:!0,children:T(F,{label:l,required:p})}),a&&T(R,{item:!0,children:T(Z3,{title:a,placement:"top",children:T("div",{style:{width:"fit-content"},children:T(M3,{icon:q,color:"#757575"})})})})]})})}),T(V3,V(e({onChange:(h,s)=>{B(s),m==null||m(s,y.watch())},onInputChange:(h,s,r)=>{r==="input"&&(B(s),setTimeout(()=>{g==null||g(s,y.watch())},0))},value:I||(M?[]:null),options:L,multiple:M,noOptionsText:d||"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(h,s)=>typeof h=="string"&&typeof s=="string"?h===s:typeof h=="object"&&typeof s=="object"?h.value===s.value:!1,renderOption:(h,s)=>typeof s=="object"?m2("li",V(e({},h),{key:s.key||s.value}),s.label):m2("li",V(e({},h),{key:s}),s),ListboxComponent:h=>C2("ul",V(e({},h),{children:[h.children,Z&&T("li",{children:C2(m3,{children:[T(R,{px:2,py:1,children:T(a3,{})}),Z]})},"searchable-footer")]}))},u),{renderInput:h=>T(L3,e(e({error:Boolean(D)},h),H))})),T(w,{name:C})]})})},p3=H3(c3);import{memo as f3}from"react";import{Controller as g3,useFormContext as x3}from"react-hook-form";import{Grid as Y,Autocomplete as y3,TextField as h3,Typography as F3}from"@mui/material";import{toRem as U}from"@s_mart/utils";import u2 from"@emotion/styled";import{css as f2}from"@emotion/react";var g2=f2`
1
+ var v2=Object.defineProperty,S2=Object.defineProperties;var T2=Object.getOwnPropertyDescriptors;var K=Object.getOwnPropertySymbols;var t2=Object.prototype.hasOwnProperty,H2=Object.prototype.propertyIsEnumerable;var n2=(C,i,o)=>i in C?v2(C,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):C[i]=o,e=(C,i)=>{for(var o in i||(i={}))t2.call(i,o)&&n2(C,o,i[o]);if(K)for(var o of K(i))H2.call(i,o)&&n2(C,o,i[o]);return C},V=(C,i)=>S2(C,T2(i));var f=(C,i)=>{var o={};for(var l in C)t2.call(C,l)&&i.indexOf(l)<0&&(o[l]=C[l]);if(C!=null&&K)for(var l of K(C))i.indexOf(l)<0&&H2.call(C,l)&&(o[l]=C[l]);return o};import{useEffect as B2}from"react";import{FormProvider as A2,useForm as E2}from"react-hook-form";import{jsx as s2}from"react/jsx-runtime";function D2(u){var M=u,{children:C,onSubmit:i,style:o,disableDefaultValuesUpdate:l}=M,r=f(M,["children","onSubmit","style","disableDefaultValuesUpdate"]);let t=E2(r);B2(()=>{l||t.reset(r.defaultValues)},[r.defaultValues,t.reset]);let L=()=>typeof C=="function"?C(V(e({},t),{onSubmit:t.handleSubmit(d=>i(d,t))})):C;return s2(A2,V(e({},t),{children:s2("form",{onSubmit:d=>{d.preventDefault(),d.stopPropagation(),t.handleSubmit(p=>i(p,t))()},style:o,children:L()})}))}var G2=D2;import{memo as z2,useState as O2}from"react";import{Controller as _2,useFormContext as N2}from"react-hook-form";import{Grid as e2,InputAdornment as j2,TextField as W2}from"@mui/material";var d2={description:"M39.0611 23.1367C36.3276 17.015 30.4051 13.2479 24.027 13.0909C17.4971 13.2479 11.5746 17.172 8.84117 23.1367C8.68931 23.6076 8.68931 24.2355 8.84117 24.8633C11.5746 30.985 17.4971 34.7521 23.8752 34.9091C30.4051 34.7521 36.1757 30.828 38.9092 24.8633C39.3648 24.2355 39.3648 23.6076 39.0611 23.1367ZM24.027 32.0837C19.6231 31.9268 16.2822 28.1596 16.4341 23.6076C16.586 19.3695 19.9269 15.7593 24.027 15.7593C28.4309 15.9163 31.7718 19.6835 31.62 24.2355C31.4681 28.4735 28.1272 32.0837 24.027 32.0837ZM24.027 18.5847C23.5715 18.5847 23.1159 18.7417 22.6603 18.7417C23.4196 19.8404 23.2677 21.2531 22.3566 22.3519C21.4454 23.2937 20.0787 23.2937 19.0157 22.5088C18.5601 24.7063 19.3194 27.2178 21.1417 28.4735C22.964 29.7292 25.3938 29.7292 27.0642 28.3165C28.7347 26.9039 29.494 24.3924 28.7347 22.1949C28.1272 19.9974 26.1531 18.5847 24.027 18.5847Z",viewBox:"0 0 48 48",id:"line-eye-solid"},V2={description:"M23.9998 31.7412C19.9223 31.7412 16.6215 28.5851 16.3177 24.5854L10.6785 20.2272C9.93715 21.1573 9.25496 22.1405 8.70447 23.2157C8.58149 23.4589 8.51742 23.7277 8.51742 24.0003C8.51742 24.2729 8.58149 24.5416 8.70447 24.7849C11.6198 30.4731 17.3913 34.3216 23.9998 34.3216C25.4465 34.3216 26.842 34.1066 28.1871 33.7593L25.3976 31.6009C24.9369 31.6899 24.469 31.7369 23.9998 31.7412ZM40.8703 34.8646L34.9273 30.2715C36.7326 28.7501 38.2174 26.8848 39.2952 24.7843C39.4182 24.5411 39.4823 24.2723 39.4823 23.9997C39.4823 23.7272 39.4182 23.4584 39.2952 23.2151C36.3799 17.5269 30.6084 13.6784 23.9998 13.6784C21.2321 13.6817 18.5093 14.3785 16.0801 15.7051L9.24098 10.419C9.15179 10.3496 9.04981 10.2985 8.94085 10.2685C8.83189 10.2385 8.7181 10.2303 8.60597 10.2443C8.49384 10.2584 8.38557 10.2944 8.28736 10.3502C8.18914 10.4061 8.1029 10.4808 8.03356 10.5701L6.97828 11.9285C6.8383 12.1086 6.77557 12.3369 6.8039 12.5633C6.83223 12.7896 6.94929 12.9954 7.12934 13.1354L38.7587 37.581C38.8479 37.6504 38.9499 37.7016 39.0588 37.7315C39.1678 37.7615 39.2816 37.7697 39.3937 37.7557C39.5058 37.7416 39.6141 37.7057 39.7123 37.6498C39.8105 37.5939 39.8968 37.5192 39.9661 37.43L41.0219 36.0715C41.1619 35.8913 41.2245 35.663 41.1961 35.4366C41.1676 35.2103 41.0505 35.0045 40.8703 34.8646ZM30.9938 27.2309L28.8811 25.5977C29.059 25.0835 29.1534 24.5441 29.1606 24C29.1711 23.2034 28.9947 22.4155 28.6454 21.6995C28.2962 20.9836 27.7838 20.3595 27.1496 19.8774C26.5154 19.3953 25.777 19.0687 24.9937 18.9238C24.2103 18.7788 23.4039 18.8197 22.6392 19.0429C22.9634 19.4822 23.1387 20.0135 23.1397 20.5595C23.1317 20.7411 23.1039 20.9214 23.0569 21.097L19.0997 18.0387C20.4743 16.89 22.2085 16.2601 23.9998 16.2588C25.0166 16.2582 26.0235 16.4581 26.9629 16.8469C27.9024 17.2357 28.756 17.8059 29.475 18.5249C30.1939 19.2438 30.7641 20.0974 31.1529 21.0369C31.5418 21.9764 31.7416 22.9833 31.7411 24C31.7411 25.1628 31.4567 26.246 30.9938 27.2309Z",viewBox:"0 0 48 48",id:"line-eye-slash-solid"};var q={description:"M24 8C15.1613 8 8 15.2258 8 24C8 32.8387 15.1613 40 24 40C32.7742 40 40 32.8387 40 24C40 15.2258 32.7742 8 24 8ZM24 15.0968C25.4839 15.0968 26.7097 16.3226 26.7097 17.8065C26.7097 19.3548 25.4839 20.5161 24 20.5161C22.4516 20.5161 21.2903 19.3548 21.2903 17.8065C21.2903 16.3226 22.4516 15.0968 24 15.0968ZM27.6129 31.4839C27.6129 31.9355 27.2258 32.2581 26.8387 32.2581H21.1613C20.7097 32.2581 20.3871 31.9355 20.3871 31.4839V29.9355C20.3871 29.5484 20.7097 29.1613 21.1613 29.1613H21.9355V25.0323H21.1613C20.7097 25.0323 20.3871 24.7097 20.3871 24.2581V22.7097C20.3871 22.3226 20.7097 21.9355 21.1613 21.9355H25.2903C25.6774 21.9355 26.0645 22.3226 26.0645 22.7097V29.1613H26.8387C27.2258 29.1613 27.6129 29.5484 27.6129 29.9355V31.4839Z",viewBox:"0 0 48 48",id:"line-info-circle-solid"},L2={description:"M35.8286 21.8493H26.1506V12.1714C26.1506 11.6338 25.613 11.0961 25.0753 11.0961H22.9247C22.3198 11.0961 21.8493 11.6338 21.8493 12.1714V21.8493H12.1714C11.5666 21.8493 11.0961 22.387 11.0961 22.9247V25.0753C11.0961 25.6802 11.5666 26.1506 12.1714 26.1506H21.8493V35.8286C21.8493 36.4334 22.3198 36.9039 22.9247 36.9039H25.0753C25.613 36.9039 26.1506 36.4334 26.1506 35.8286V26.1506H35.8286C36.3662 26.1506 36.9039 25.6802 36.9039 25.0753V22.9247C36.9039 22.387 36.3662 21.8493 35.8286 21.8493Z",viewBox:"0 0 48 48",id:"line-plus-solid"};var a2={description:"M25.4929 17.0061L30.9936 22.5071L19.049 34.4522L14.1447 34.9936C13.4881 35.0662 12.9334 34.511 13.0065 33.8545L13.5522 28.9465L25.4929 17.0061ZM34.3958 16.1872L31.813 13.6043C31.0073 12.7986 29.7007 12.7986 28.8951 13.6043L26.4652 16.0342L31.966 21.5351L34.3958 19.1052C35.2014 18.2991 35.2014 16.9928 34.3958 16.1872Z",id:"line-pen-solid"};import*as O from"@s_mart/masks";import{Typography as M2}from"@mui/material";import{toRem as I2}from"@s_mart/utils";import{jsx as Z2,jsxs as $2}from"react/jsx-runtime";var y=({label:C,required:i,regular:o})=>$2("span",{style:{display:"flex",alignItems:"center",gap:I2(2)},children:[Z2(M2,{variant:"caption",fontWeight:o?400:700,style:{display:"flex",alignItems:"center"},children:C}),i&&Z2(M2,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});import{useFormContext as q2}from"react-hook-form";import{Indicator as U2}from"@s_mart/core";var k=(C,i)=>{var o,l,r,u,M;if(C[i])return C[i];if(i.includes("[")){let[t,L]=i.split("["),[d,p]=L.split("].");return(l=(o=C[t])==null?void 0:o[d])==null?void 0:l[p]}if(i.includes(".")){let[t,L,d]=i.split(".");return d?(M=(u=C[t])==null?void 0:u[L])==null?void 0:M[d]:(r=C[t])==null?void 0:r[L]}};import{jsx as R2}from"react/jsx-runtime";var b=({name:C})=>{var l;let i=q2(),o=k((l=i==null?void 0:i.formState)==null?void 0:l.errors,C);return o?R2(U2,{severity:"error",children:o==null?void 0:o.message}):null};import{LIcon as c2,Tooltip as Y2}from"@s_mart/core";import{jsx as A,jsxs as p2}from"react/jsx-runtime";var K2=g=>{var F=g,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:r,required:u,mask:M,variant:t="outlined",info:L,parse:d,format:p,onInputChange:c}=F,m=f(F,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","info","parse","format","onInputChange"]);let H=N2();if(!H)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[Z,x]=O2(!1),w=a=>{var s;let n=a;return p&&(n=p(a)),M?(s=O==null?void 0:O[M])==null?void 0:s.format(n):n},E=a=>{var s;let n=a;return d&&(n=d(a)),M?(s=O==null?void 0:O[M])==null?void 0:s.parse(n):n},B=a=>{if(!a||M!=="porcentagem")return;a==null||a.stopPropagation();let n=(a==null?void 0:a.target).value;if(n){let s=String(n);if(s.length>0){let $=s.indexOf("%");$>-1&&(a.currentTarget.selectionEnd=$)}}},I=k(H.formState.errors,C);return A(_2,{control:H.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:a,onChange:n}})=>p2(e2,{display:"flex",flexDirection:"column",children:[p2("div",{style:{display:"flex"},children:[r&&A(e2,{item:!0,children:A(y,{label:r,required:u})}),L&&A(e2,{item:!0,children:A(Y2,{title:L,placement:"top",children:A("div",{style:{width:"fit-content"},children:A(c2,{icon:q,color:"#757575"})})})})]}),A(W2,V(e({variant:t,defaultValue:o,value:w(a||""),onChange:s=>{var $,N;n(E(($=s==null?void 0:s.target)==null?void 0:$.value)),c==null||c((N=s==null?void 0:s.target)==null?void 0:N.value,H.watch())},error:Boolean(I)},m),{type:m.type==="password"?Z?"text":"password":m.type,autoComplete:m.autoComplete||"off",InputProps:e({onKeyDown:B,endAdornment:m.type==="password"&&A(j2,{position:"end",onClick:()=>x(!Z),style:{cursor:"pointer"},children:A(c2,{icon:Z?d2:V2,size:"24px",removeMargin:!0})})},m.InputProps)})),A(b,{name:C})]})})},Q2=z2(K2);import{memo as J2,useState as X2}from"react";import{Controller as C3,useFormContext as i3}from"react-hook-form";import{Divider as e3,LIcon as o3,Tooltip as r3}from"@s_mart/core";import{Grid as Q,Select as l3,MenuItem as m2,useTheme as n3}from"@mui/material";import{jsx as S,jsxs as o2}from"react/jsx-runtime";var t3=F=>{var H=F,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:r,required:u,options:M,placeholder:t,onInputChange:L,footer:d,multiple:p,info:c,onChange:m}=H,g=f(H,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","onInputChange","footer","multiple","info","onChange"]);let Z=i3(),{palette:x}=n3(),[w,E]=X2(!1);if(!Z)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let B=k(Z.formState.errors,C);return console.warn=()=>{},S(C3,{control:Z.control,name:C,rules:i,defaultValue:o||"",shouldUnregister:l,render:({field:{value:I,onChange:a}})=>o2(Q,{display:"flex",flexDirection:"column",children:[o2("div",{style:{display:"flex"},children:[r&&S(Q,{item:!0,children:S(y,{label:r,required:u})}),c&&S(Q,{item:!0,children:S(r3,{title:c,placement:"top",children:S("div",{style:{width:"fit-content"},children:S(o3,{icon:q,color:"#757575"})})})})]}),o2(l3,V(e({open:w,onOpen:()=>E(!0),onClose:()=>E(!1),displayEmpty:Boolean(t),variant:"outlined",autoComplete:"off",value:I?I||"":p?[]:"",renderValue:n=>{if(n.label)return n.label;if(t)return S("p",{style:{color:x.grey[400]},children:t})},multiple:p,onChange:n=>{a(n.target.value),L==null||L(n.target.value,Z.watch()),m&&m(n.target.value,Z.watch())},error:Boolean(B),size:g.size||"medium"},g),{children:[t&&S(m2,{disabled:!0,value:"",children:S("p",{style:{color:x.grey[400]},children:t})}),M==null?void 0:M.map((n,s)=>S(m2,{value:n,children:n.label},s)),d&&[S(Q,{px:2,py:1,children:S(e3,{})},"footer-divider"),S("div",{children:d({closeSelect:()=>E(!1)})},"footer-content")]]})),S(b,{name:C})]})})},H3=J2(t3);import{memo as s3}from"react";import{Controller as d3,useFormContext as V3}from"react-hook-form";import{Grid as J,Autocomplete as L3,TextField as a3}from"@mui/material";import{Divider as M3,LIcon as Z3,Tooltip as c3}from"@s_mart/core";import{Fragment as u3,jsx as T,jsxs as X}from"react/jsx-runtime";import{createElement as u2}from"react";var p3=Z=>{var x=Z,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:r,required:u,options:M,textFieldProps:t,noOptionsText:L,footer:d,multiple:p,info:c,placeholder:m,onChange:g,onInputChange:F}=x,H=f(x,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText","footer","multiple","info","placeholder","onChange","onInputChange"]);let w=V3();if(!w)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let E=k(w.formState.errors,C);return console.warn=()=>{},T(d3,{control:w.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{onChange:B,value:I}})=>X(J,{display:"flex",flexDirection:"column",children:[X("div",{style:{display:"flex"},children:[r&&T(J,{item:!0,children:T(y,{label:r,required:u})}),c&&T(J,{item:!0,children:T(c3,{title:c,placement:"top",children:T("div",{style:{width:"fit-content"},children:T(Z3,{icon:q,color:"#757575"})})})})]}),T(L3,V(e({onChange:(a,n)=>{B(n),g==null||g(n,w.watch())},onInputChange:(a,n,s)=>{s==="input"&&(B(n),setTimeout(()=>{F==null||F(n,w.watch())},0))},value:I||(p?[]:null),options:M,multiple:p,noOptionsText:L||"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(a,n)=>typeof a=="string"&&typeof n=="string"?a===n:typeof a=="object"&&typeof n=="object"?a.value===n.value:!1,renderOption:(a,n)=>typeof n=="object"?u2("li",V(e({},a),{key:n.key||n.value}),n.label):u2("li",V(e({},a),{key:n}),n),ListboxComponent:a=>X("ul",V(e({},a),{children:[a.children,d&&T("li",{children:X(u3,{children:[T(J,{px:2,py:1,children:T(M3,{})}),d]})},"searchable-footer")]}))},H),{renderInput:a=>T(a3,e(e({error:Boolean(E),placeholder:m},a),t))})),T(b,{name:C})]})})},m3=s3(p3);import{memo as g3}from"react";import{Controller as x3,useFormContext as y3}from"react-hook-form";import{Grid as r2,Autocomplete as h3,TextField as F3,Typography as b3}from"@mui/material";import{toRem as U}from"@s_mart/utils";import f2 from"@emotion/styled";import{css as g2}from"@emotion/react";var x2=g2`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
5
- `,u3=C=>f2`
5
+ `,f3=C=>g2`
6
6
  .MuiAutocomplete-endAdornment {
7
7
  position: relative;
8
8
  right: 0;
@@ -10,7 +10,7 @@ var k2=Object.defineProperty,v2=Object.defineProperties;var S2=Object.getOwnProp
10
10
 
11
11
  .creatable,
12
12
  .editable {
13
- ${g2}
13
+ ${x2}
14
14
 
15
15
  .divider {
16
16
  width: 1px;
@@ -36,18 +36,18 @@ var k2=Object.defineProperty,v2=Object.defineProperties;var S2=Object.getOwnProp
36
36
  }
37
37
  }
38
38
  }
39
- `,x2=u2.div`
39
+ `,y2=f2.div`
40
40
  display: flex;
41
41
 
42
42
  div.endAdornments {
43
43
  position: absolute;
44
44
  right: 0;
45
45
 
46
- ${g2}
46
+ ${x2}
47
47
  }
48
48
 
49
- ${({hideAddButton:C,theme:i})=>!C&&u3(i)}
50
- `,y2=u2.div`
49
+ ${({hideAddButton:C,theme:i})=>!C&&f3(i)}
50
+ `,h2=f2.div`
51
51
  color: ${({theme:C})=>C.palette.text.primary};
52
52
 
53
53
  padding: ${U(6)} ${U(16)};
@@ -58,26 +58,26 @@ var k2=Object.defineProperty,v2=Object.defineProperties;var S2=Object.getOwnProp
58
58
  transition: background-color 0.2s ease-in-out;
59
59
  background-color: ${({theme:C})=>C.palette.grey[100]};
60
60
  }
61
- `;import{LIcon as r2,Tooltip as b3}from"@s_mart/core";import{isObject as w3,isEmpty as P3}from"lodash";import{jsx as P,jsxs as j}from"react/jsx-runtime";import{createElement as h2}from"react";var k3=y=>{var D=y,{name:C,rules:i,defaultValue:o,shouldUnregister:n,label:l,required:p,options:L,editable:H,onEditOption:d,onCreateOption:Z,textFieldProps:M,hideAddButton:a,multiple:m,info:g,onChange:u,onInputChange:t}=D,c=f(D,["name","rules","defaultValue","shouldUnregister","label","required","options","editable","onEditOption","onCreateOption","textFieldProps","hideAddButton","multiple","info","onChange","onInputChange"]);let B=x3();if(!B)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let I=v(B.formState.errors,C);console.warn=()=>{};let h=r=>{Z?Z(r):console.error("onCreateOption n\xE3o foi definido")},s=r=>{d?d(r):console.error("onEditOption n\xE3o foi definido")};return P(g3,{control:B.control,name:C,rules:i,defaultValue:o,shouldUnregister:n,render:({field:{value:r,onChange:x}})=>{let $=(r==null?void 0:r.label)||(r==null?void 0:r.value)||r;return j(Y,{display:"flex",flexDirection:"column",children:[P(Y,{item:!0,xs:12,children:j(Y,{container:!0,direction:"row",children:[l&&P(Y,{item:!0,children:P(F,{label:l,required:p})}),g&&P(Y,{item:!0,children:P(b3,{title:g,placement:"top",children:P("div",{style:{width:"fit-content"},children:P(r2,{icon:q,color:"#757575"})})})})]})}),P(x2,{hideAddButton:a,children:P(y3,V(e({fullWidth:!0,onChange:(k,b)=>{x(b),u==null||u(b,B.watch())},onInputChange:(k,b,P2)=>{P2==="input"&&(x(b),setTimeout(()=>{t==null||t(b,B.watch())},0))},options:L,value:r||(m?[]:null),multiple:m,noOptionsText:P(y2,{onClick:()=>h(r),children:j(F3,{children:["Adicionar ",$&&`"${$}"`]})}),isOptionEqualToValue:(k,b)=>b?typeof k=="string"&&typeof b=="string"?k===b:typeof k=="object"&&typeof b=="object"?k.value===b.value:typeof k=="object"&&typeof b=="string":!1,renderOption:(k,b)=>typeof b=="object"?h2("li",V(e({},k),{key:b.key||b.value}),b.label):h2("li",V(e({},k),{key:b}),b)},c),{renderInput:k=>{let b=a?k.InputProps:V(e({},k.InputProps),{endAdornment:j("div",{className:"endAdornments",children:[k.InputProps.endAdornment,H&&w3(r)&&!P3(r)?j("div",{className:"editable",children:[P("div",{className:"divider"}),P("div",{className:"button",onClick:()=>s(r),children:P(r2,{icon:L2,size:"24px",removeMargin:!0})})]}):null,j("div",{className:"creatable",children:[P("div",{className:"divider"}),P("div",{className:"button",onClick:()=>h(r),children:P(r2,{icon:V2,size:"24px",removeMargin:!0})})]})]})});return P(h3,e(V(e({},k),{error:Boolean(I),onChange:x,InputProps:b}),M))}}))}),P(w,{name:C})]})}})},v3=f3(k3);import{Controller as S3,useFormContext as T3}from"react-hook-form";import{Grid as B3,Checkbox as A3,FormControlLabel as E3}from"@mui/material";import{jsx as K,jsxs as I3}from"react/jsx-runtime";var G3=d=>{var Z=d,{name:C,rules:i,defaultValue:o,shouldUnregister:n,label:l,labelPlacement:p,required:L}=Z,H=f(Z,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let M=T3();if(!M)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return K(S3,{control:M.control,name:C,rules:i,defaultValue:o,shouldUnregister:n,render:({field:{value:a,onChange:m}})=>I3(B3,{display:"flex",flexDirection:"column",children:[K(E3,{control:K(A3,e({value:a!=null?a:"",defaultValue:a,onChange:m},H)),label:K(F,{label:l,required:L,regular:!0}),labelPlacement:p||"end"}),K(w,{name:C})]})})},D3=G3;import{Controller as $3,useFormContext as q3}from"react-hook-form";import{Grid as U3,Switch as R3,FormControlLabel as z3}from"@mui/material";import{jsx as Q,jsxs as N3}from"react/jsx-runtime";var O3=H=>{var d=H,{name:C,rules:i,defaultValue:o,shouldUnregister:n,label:l,labelPlacement:p}=d,L=f(d,["name","rules","defaultValue","shouldUnregister","label","labelPlacement"]);let Z=q3();if(!Z)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return Q($3,{control:Z.control,name:C,rules:i,defaultValue:o,shouldUnregister:n,render:({field:{value:M,onChange:a}})=>N3(U3,{display:"flex",flexDirection:"column",children:[Q(z3,{control:Q(R3,e({value:M!=null?M:"",defaultValue:M,onChange:a},L)),label:Q(F,{label:l}),labelPlacement:p||"end"}),Q(w,{name:C})]})})},_3=O3;import{Grid as j3,Radio as W3,FormControlLabel as Y3}from"@mui/material";import{jsx as i2}from"react/jsx-runtime";var K3=n=>{var l=n,{label:C,labelPlacement:i}=l,o=f(l,["label","labelPlacement"]);return i2(j3,{display:"flex",flexDirection:"column",children:i2(Y3,{control:i2(W3,e({},o)),label:i2(F,{label:C}),labelPlacement:i||"end"})})},Q3=K3;import{Controller as J3,useFormContext as X3}from"react-hook-form";import{Grid as C1,RadioGroup as i1}from"@mui/material";import{jsx as e2,jsxs as r1}from"react/jsx-runtime";var e1=Z=>{var M=Z,{name:C,rules:i,defaultValue:o,shouldUnregister:n,label:l,required:p,children:L,orientation:H="row"}=M,d=f(M,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation"]);let a=X3();if(!a)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return e2(J3,{control:a.control,name:C,rules:i,defaultValue:o,shouldUnregister:n,render:({field:{value:m,onChange:g}})=>r1(C1,{display:"flex",flexDirection:"column",children:[l&&e2(F,{label:l,required:p}),e2(i1,V(e({value:m||"",onChange:g,name:C},d),{style:{display:"flex",flexDirection:H},children:L})),e2(w,{name:C})]})})},o1=e1;import{Controller as l1,useFormContext as n1}from"react-hook-form";import{Slider as t1}from"@mui/material";import{jsx as F2}from"react/jsx-runtime";var H1=p=>{var L=p,{name:C,rules:i,defaultValue:o,shouldUnregister:n}=L,l=f(L,["name","rules","defaultValue","shouldUnregister"]);let H=n1();if(!H)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return F2(l1,{control:H.control,name:C,rules:i,defaultValue:o,shouldUnregister:n,render:({field:{value:d,onChange:Z}})=>F2(t1,e({value:d||(l==null?void 0:l.min)||0,onChange:Z,valueLabelDisplay:"auto"},l))})},s1=H1;import{memo as a1}from"react";import{Controller as M1,useFormContext as Z1}from"react-hook-form";import{Grid as c1}from"@s_mart/core";import{TextField as p1}from"@mui/material";import{DatePicker as m1}from"@mui/x-date-pickers/DatePicker";import{AdapterDayjs as u1}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as f1}from"@mui/x-date-pickers/LocalizationProvider";import{toRem as E}from"@s_mart/utils";import d1 from"@emotion/styled";var V1=C=>{switch(C){case"small":return E(16);default:case"medium":return E(20);case"large":return E(24)}},L1=C=>{switch(C){case"small":return`${E(2)} ${E(8)}`;default:case"medium":return`${E(6)} ${E(8)}`;case"large":return`${E(10)}`}},b2=d1.div`
61
+ `;import{LIcon as l2,Tooltip as P3}from"@s_mart/core";import{isObject as w3,isEmpty as k3}from"lodash";import{jsx as P,jsxs as _}from"react/jsx-runtime";import{createElement as F2}from"react";var v3=w=>{var E=w,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:r,required:u,options:M,editable:t,onEditOption:L,onCreateOption:d,textFieldProps:p,hideAddButton:c,multiple:m,info:g,onChange:F,onInputChange:H,placeholder:Z}=E,x=f(E,["name","rules","defaultValue","shouldUnregister","label","required","options","editable","onEditOption","onCreateOption","textFieldProps","hideAddButton","multiple","info","onChange","onInputChange","placeholder"]);let B=y3();if(!B)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let I=k(B.formState.errors,C);console.warn=()=>{};let a=s=>{d?d(s):console.error("onCreateOption n\xE3o foi definido")},n=s=>{L?L(s):console.error("onEditOption n\xE3o foi definido")};return P(x3,{control:B.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:s,onChange:$}})=>{let N=(s==null?void 0:s.label)||(s==null?void 0:s.value)||s;return _(r2,{display:"flex",flexDirection:"column",children:[_("div",{style:{display:"flex"},children:[r&&P(r2,{item:!0,children:P(y,{label:r,required:u})}),g&&P(r2,{item:!0,children:P(P3,{title:g,placement:"top",children:P("div",{style:{width:"fit-content"},children:P(l2,{icon:q,color:"#757575"})})})})]}),P(y2,{hideAddButton:c,children:P(h3,V(e({fullWidth:!0,onChange:(v,h)=>{$(h),F==null||F(h,B.watch())},onInputChange:(v,h,k2)=>{k2==="input"&&($(h),setTimeout(()=>{H==null||H(h,B.watch())},0))},options:M,value:s||(m?[]:null),multiple:m,noOptionsText:P(h2,{onClick:()=>a(s),children:_(b3,{children:["Adicionar ",N&&`"${N}"`]})}),isOptionEqualToValue:(v,h)=>h?typeof v=="string"&&typeof h=="string"?v===h:typeof v=="object"&&typeof h=="object"?v.value===h.value:typeof v=="object"&&typeof h=="string":!1,renderOption:(v,h)=>typeof h=="object"?F2("li",V(e({},v),{key:h.key||h.value}),h.label):F2("li",V(e({},v),{key:h}),h)},x),{renderInput:v=>{let h=c?v.InputProps:V(e({},v.InputProps),{endAdornment:_("div",{className:"endAdornments",children:[v.InputProps.endAdornment,t&&w3(s)&&!k3(s)?_("div",{className:"editable",children:[P("div",{className:"divider"}),P("div",{className:"button",onClick:()=>n(s),children:P(l2,{icon:a2,size:"24px",removeMargin:!0})})]}):null,_("div",{className:"creatable",children:[P("div",{className:"divider"}),P("div",{className:"button",onClick:()=>a(s),children:P(l2,{icon:L2,size:"24px",removeMargin:!0})})]})]})});return P(F3,e(V(e({placeholder:Z},v),{error:Boolean(I),onChange:$,InputProps:h}),p))}}))}),P(b,{name:C})]})}})},S3=g3(v3);import{Controller as T3,useFormContext as B3}from"react-hook-form";import{Grid as A3,Checkbox as E3,FormControlLabel as D3}from"@mui/material";import{jsx as j,jsxs as $3}from"react/jsx-runtime";var G3=L=>{var d=L,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:r,labelPlacement:u,required:M}=d,t=f(d,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let p=B3();if(!p)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return j(T3,{control:p.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:c,onChange:m}})=>$3(A3,{display:"flex",flexDirection:"column",children:[j(D3,{control:j(E3,e({value:c!=null?c:"",defaultValue:c,onChange:m},t)),label:j(y,{label:r,required:M,regular:!0}),labelPlacement:u||"end"}),j(b,{name:C})]})})},I3=G3;import{Controller as q3,useFormContext as U3}from"react-hook-form";import{Grid as R3,Switch as z3,FormControlLabel as O3}from"@mui/material";import{jsx as W,jsxs as j3}from"react/jsx-runtime";var _3=t=>{var L=t,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:r,labelPlacement:u}=L,M=f(L,["name","rules","defaultValue","shouldUnregister","label","labelPlacement"]);let d=U3();if(!d)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return W(q3,{control:d.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:p,onChange:c}})=>j3(R3,{display:"flex",flexDirection:"column",children:[W(O3,{control:W(z3,e({value:p!=null?p:"",defaultValue:p,onChange:c},M)),label:W(y,{label:r}),labelPlacement:u||"end"}),W(b,{name:C})]})})},N3=_3;import{Grid as W3,Radio as Y3,FormControlLabel as K3}from"@mui/material";import{jsx as C2}from"react/jsx-runtime";var Q3=l=>{var r=l,{label:C,labelPlacement:i}=r,o=f(r,["label","labelPlacement"]);return C2(W3,{display:"flex",flexDirection:"column",children:C2(K3,{control:C2(Y3,e({},o)),label:C2(y,{label:C}),labelPlacement:i||"end"})})},J3=Q3;import{Controller as X3,useFormContext as C1}from"react-hook-form";import{Grid as i1,RadioGroup as e1}from"@mui/material";import{jsx as i2,jsxs as l1}from"react/jsx-runtime";var o1=d=>{var p=d,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:r,required:u,children:M,orientation:t="row"}=p,L=f(p,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation"]);let c=C1();if(!c)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return i2(X3,{control:c.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:m,onChange:g}})=>l1(i1,{display:"flex",flexDirection:"column",children:[r&&i2(y,{label:r,required:u}),i2(e1,V(e({value:m||"",onChange:g,name:C},L),{style:{display:"flex",flexDirection:t},children:M})),i2(b,{name:C})]})})},r1=o1;import{Controller as n1,useFormContext as t1}from"react-hook-form";import{Slider as H1}from"@mui/material";import{jsx as b2}from"react/jsx-runtime";var s1=u=>{var M=u,{name:C,rules:i,defaultValue:o,shouldUnregister:l}=M,r=f(M,["name","rules","defaultValue","shouldUnregister"]);let t=t1();if(!t)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return b2(n1,{control:t.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:L,onChange:d}})=>b2(H1,e({value:L||(r==null?void 0:r.min)||0,onChange:d,valueLabelDisplay:"auto"},r))})},d1=s1;import{memo as M1}from"react";import{Controller as Z1,useFormContext as c1}from"react-hook-form";import{Grid as p1}from"@s_mart/core";import{TextField as m1}from"@mui/material";import{DatePicker as u1}from"@mui/x-date-pickers/DatePicker";import{AdapterDayjs as f1}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as g1}from"@mui/x-date-pickers/LocalizationProvider";import{toRem as D}from"@s_mart/utils";import V1 from"@emotion/styled";var L1=C=>{switch(C){case"small":return D(16);default:case"medium":return D(20);case"large":return D(24)}},a1=C=>{switch(C){case"small":return`${D(2)} ${D(8)}`;default:case"medium":return`${D(6)} ${D(8)}`;case"large":return`${D(10)}`}},P2=V1.div`
62
62
  > div > button {
63
- padding: ${({size:C})=>L1(C)};
64
- border-radius: 0 ${E(4)} ${E(4)} 0;
63
+ padding: ${({size:C})=>a1(C)};
64
+ border-radius: 0 ${D(4)} ${D(4)} 0;
65
65
 
66
66
  margin: 0px -13px 0px 0px;
67
67
 
68
68
  svg {
69
- width: ${({size:C})=>V1(C)};
69
+ width: ${({size:C})=>L1(C)};
70
70
  }
71
71
  }
72
- `;import{jsx as z,jsxs as y1}from"react/jsx-runtime";var g1=Z=>{var M=Z,{rules:C,name:i,defaultValue:o,shouldUnregister:n,datePickerProps:l,label:p,required:L,placeholder:H}=M,d=f(M,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder"]);let a=Z1();if(!a)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let m=v(a.formState.errors,i);return z(f1,{dateAdapter:u1,children:z(M1,{control:a.control,name:i,rules:C,defaultValue:o,shouldUnregister:n,render:({field:{value:g,onChange:u}})=>y1(c1,{display:"flex",flexDirection:"column",children:[p&&z(F,{label:p,required:L}),z(m1,V(e({},l),{value:g!=null?g:null,inputFormat:(l==null?void 0:l.inputFormat)||"DD/MM/YYYY",onChange:u,renderInput:t=>{var c,y;return z(p1,V(e(V(e({variant:"outlined"},t),{error:Boolean(m)}),d),{inputProps:V(e({},t.inputProps),{placeholder:H||((c=t.inputProps)==null?void 0:c.placeholder)}),InputProps:V(e({},t.InputProps),{endAdornment:z(b2,{size:d.size,children:(y=t.InputProps)==null?void 0:y.endAdornment})})}))}})),z(w,{name:i})]})})})},x1=a1(g1);import{Grid as w1}from"@s_mart/core";import{TimePicker as P1}from"@mui/x-date-pickers/TimePicker";import{TextField as k1}from"@mui/material";import{Controller as v1,useFormContext as S1}from"react-hook-form";import{AdapterDayjs as T1}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as B1}from"@mui/x-date-pickers/LocalizationProvider";import{toRem as G}from"@s_mart/utils";import h1 from"@emotion/styled";var F1=C=>{switch(C){case"small":return G(16);default:case"medium":return G(20);case"large":return G(24)}},b1=C=>{switch(C){case"small":return`${G(2)} ${G(8)}`;default:case"medium":return`${G(6)} ${G(8)}`;case"large":return`${G(10)}`}},w2=h1.div`
72
+ `;import{jsx as R,jsxs as h1}from"react/jsx-runtime";var x1=d=>{var p=d,{rules:C,name:i,defaultValue:o,shouldUnregister:l,datePickerProps:r,label:u,required:M,placeholder:t}=p,L=f(p,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder"]);let c=c1();if(!c)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let m=k(c.formState.errors,i);return R(g1,{dateAdapter:f1,children:R(Z1,{control:c.control,name:i,rules:C,defaultValue:o,shouldUnregister:l,render:({field:{value:g,onChange:F}})=>h1(p1,{display:"flex",flexDirection:"column",children:[u&&R(y,{label:u,required:M}),R(u1,V(e({},r),{value:g!=null?g:null,inputFormat:(r==null?void 0:r.inputFormat)||"DD/MM/YYYY",onChange:F,renderInput:H=>{var Z,x;return R(m1,V(e(V(e({variant:"outlined"},H),{error:Boolean(m)}),L),{inputProps:V(e({},H.inputProps),{placeholder:t||((Z=H.inputProps)==null?void 0:Z.placeholder)}),InputProps:V(e({},H.InputProps),{endAdornment:R(P2,{size:L.size,children:(x=H.InputProps)==null?void 0:x.endAdornment})})}))}})),R(b,{name:i})]})})})},y1=M1(x1);import{Grid as w1}from"@s_mart/core";import{TimePicker as k1}from"@mui/x-date-pickers/TimePicker";import{TextField as v1}from"@mui/material";import{Controller as S1,useFormContext as T1}from"react-hook-form";import{AdapterDayjs as B1}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as A1}from"@mui/x-date-pickers/LocalizationProvider";import{toRem as G}from"@s_mart/utils";import F1 from"@emotion/styled";var b1=C=>{switch(C){case"small":return G(16);default:case"medium":return G(20);case"large":return G(24)}},P1=C=>{switch(C){case"small":return`${G(2)} ${G(8)}`;default:case"medium":return`${G(6)} ${G(8)}`;case"large":return`${G(10)}`}},w2=F1.div`
73
73
  > div > button {
74
- padding: ${({size:C})=>b1(C)};
74
+ padding: ${({size:C})=>P1(C)};
75
75
  border-radius: 0 ${G(4)} ${G(4)} 0;
76
76
 
77
77
  margin: 0px -13px 0px 0px;
78
78
 
79
79
  svg {
80
- width: ${({size:C})=>F1(C)};
80
+ width: ${({size:C})=>b1(C)};
81
81
  }
82
82
  }
83
- `;import{memo as A1}from"react";import{jsx as O,jsxs as D1}from"react/jsx-runtime";var E1=Z=>{var M=Z,{rules:C,defaultValue:i,shouldUnregister:o,name:n,required:l,label:p,timePickerProps:L,placeholder:H}=M,d=f(M,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder"]);let a=S1();if(!a)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let m=v(a.formState.errors,n);return O(B1,{dateAdapter:T1,children:O(v1,{control:a.control,name:n,rules:C,defaultValue:i,shouldUnregister:o,render:({field:{value:g,onChange:u}})=>D1(w1,{display:"flex",flexDirection:"column",children:[p&&O(F,{label:p,required:l}),O(P1,V(e({value:g!=null?g:null,onChange:u},L),{renderInput:t=>{var c,y;return O(k1,V(e(V(e({variant:"outlined"},t),{error:Boolean(m)}),d),{inputProps:V(e({},t.inputProps),{placeholder:H||((c=t.inputProps)==null?void 0:c.placeholder)}),InputProps:V(e({},t.InputProps),{endAdornment:O(w2,{size:d.size,children:(y=t.InputProps)==null?void 0:y.endAdornment})})}))}})),O(w,{name:n})]})})})},G1=A1(E1);import{memo as I1}from"react";import{Controller as $1,useFormContext as q1}from"react-hook-form";import{Autocomplete as U1,TextField as R1}from"@mui/material";import{Grid as z1}from"@s_mart/core";import{jsx as J,jsxs as j1}from"react/jsx-runtime";import{createElement as N1}from"react";var O1=Z=>{var M=Z,{name:C,defaultValue:i,rules:o,shouldUnregister:n,label:l,required:p,onInputChange:L,onChange:H}=M,d=f(M,["name","defaultValue","rules","shouldUnregister","label","required","onInputChange","onChange"]);let a=q1();if(!a)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let m=v(a.formState.errors,C);return console.warn=()=>{},J($1,{name:C,control:a.control,defaultValue:i,rules:o,shouldUnregister:n,render:({field:g})=>j1(z1,{display:"flex",flexDirection:"column",children:[l&&J(F,{label:l,required:p}),J(U1,V(e({onChange:(u,t)=>{g.onChange(t),H==null||H(t,a.watch())},onInputChange:(u,t,c)=>{c==="input"&&(g.onChange(t),setTimeout(()=>{L==null||L(t,a.watch())},0))},isOptionEqualToValue:(u,t)=>u.value===t.value,renderOption:(u,t)=>N1("li",V(e({},u),{key:t.key||t.value,onClick:c=>{var y;(y=u.onClick)==null||y.call(u,c),g.onChange(t)}}),t.label),value:g.value||null},d),{renderInput:u=>{var t,c,y;return J(R1,V(e(e({},u),d.textFieldProps),{error:Boolean(m),InputProps:V(e(e({},u.InputProps),(t=d.textFieldProps)==null?void 0:t.InputProps),{inputProps:e(e({},u.inputProps),(y=(c=d.textFieldProps)==null?void 0:c.InputProps)==null?void 0:y.inputProps)})}))}})),J(w,{name:C})]})})},_1=I1(O1);export{_1 as Autocomplete,D3 as Checkbox,v3 as Creatable,x1 as DatePicker,G2 as Form,Q3 as RadioButton,o1 as RadioGroup,p3 as Searchable,t3 as Select,s1 as Slider,_3 as Switch,K2 as TextField,G1 as TimePicker};
83
+ `;import{memo as E1}from"react";import{jsx as z,jsxs as I1}from"react/jsx-runtime";var D1=d=>{var p=d,{rules:C,defaultValue:i,shouldUnregister:o,name:l,required:r,label:u,timePickerProps:M,placeholder:t}=p,L=f(p,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder"]);let c=T1();if(!c)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let m=k(c.formState.errors,l);return z(A1,{dateAdapter:B1,children:z(S1,{control:c.control,name:l,rules:C,defaultValue:i,shouldUnregister:o,render:({field:{value:g,onChange:F}})=>I1(w1,{display:"flex",flexDirection:"column",children:[u&&z(y,{label:u,required:r}),z(k1,V(e({value:g!=null?g:null,onChange:F},M),{renderInput:H=>{var Z,x;return z(v1,V(e(V(e({variant:"outlined"},H),{error:Boolean(m)}),L),{inputProps:V(e({},H.inputProps),{placeholder:t||((Z=H.inputProps)==null?void 0:Z.placeholder)}),InputProps:V(e({},H.InputProps),{endAdornment:z(w2,{size:L.size,children:(x=H.InputProps)==null?void 0:x.endAdornment})})}))}})),z(b,{name:l})]})})})},G1=E1(D1);import{memo as $1}from"react";import{Controller as q1,useFormContext as U1}from"react-hook-form";import{Autocomplete as R1,TextField as z1}from"@mui/material";import{Grid as O1}from"@s_mart/core";import{jsx as Y,jsxs as W1}from"react/jsx-runtime";import{createElement as j1}from"react";var _1=p=>{var c=p,{name:C,defaultValue:i,rules:o,shouldUnregister:l,label:r,required:u,placeholder:M,onInputChange:t,onChange:L}=c,d=f(c,["name","defaultValue","rules","shouldUnregister","label","required","placeholder","onInputChange","onChange"]);let m=U1();if(!m)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let g=k(m.formState.errors,C);return console.warn=()=>{},Y(q1,{name:C,control:m.control,defaultValue:i,rules:o,shouldUnregister:l,render:({field:F})=>W1(O1,{display:"flex",flexDirection:"column",children:[r&&Y(y,{label:r,required:u}),Y(R1,V(e({onChange:(H,Z)=>{F.onChange(Z),L==null||L(Z,m.watch())},onInputChange:(H,Z,x)=>{x==="input"&&(F.onChange(Z),setTimeout(()=>{t==null||t(Z,m.watch())},0))},isOptionEqualToValue:(H,Z)=>H.value===Z.value,renderOption:(H,Z)=>j1("li",V(e({},H),{key:Z.key||Z.value,onClick:x=>{var w;(w=H.onClick)==null||w.call(H,x),F.onChange(Z)}}),Z.label),value:F.value||null},d),{renderInput:H=>{var Z,x,w;return Y(z1,V(e(e({placeholder:M},H),d.textFieldProps),{error:Boolean(g),InputProps:V(e(e({},H.InputProps),(Z=d.textFieldProps)==null?void 0:Z.InputProps),{inputProps:e(e({},H.inputProps),(w=(x=d.textFieldProps)==null?void 0:x.InputProps)==null?void 0:w.inputProps)})}))}})),Y(b,{name:C})]})})},N1=$1(_1);export{N1 as Autocomplete,I3 as Checkbox,S3 as Creatable,y1 as DatePicker,G2 as Form,J3 as RadioButton,r1 as RadioGroup,m3 as Searchable,H3 as Select,d1 as Slider,N3 as Switch,Q2 as TextField,G1 as TimePicker};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s_mart/form",
3
- "version": "2.8.4",
3
+ "version": "2.8.6",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",