@s_mart/form 4.1.0 → 4.1.1
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.js +4 -4
- package/dist/index.mjs +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var y2=Object.create;var L1=Object.defineProperty,b2=Object.defineProperties,x2=Object.getOwnPropertyDescriptor,C2=Object.getOwnPropertyDescriptors,k2=Object.getOwnPropertyNames,P1=Object.getOwnPropertySymbols,A2=Object.getPrototypeOf,X1=Object.prototype.hasOwnProperty,Z0=Object.prototype.propertyIsEnumerable;var m0=(c,a,r)=>a in c?L1(c,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[a]=r,e=(c,a)=>{for(var r in a||(a={}))X1.call(a,r)&&m0(c,r,a[r]);if(P1)for(var r of P1(a))Z0.call(a,r)&&m0(c,r,a[r]);return c},m=(c,a)=>b2(c,C2(a));var $=(c,a)=>{var r={};for(var s in c)X1.call(c,s)&&a.indexOf(s)<0&&(r[s]=c[s]);if(c!=null&&P1)for(var s of P1(c))a.indexOf(s)<0&&Z0.call(c,s)&&(r[s]=c[s]);return r};var p0=(c,a)=>()=>(a||c((a={exports:{}}).exports,a),a.exports),F2=(c,a)=>{for(var r in a)L1(c,r,{get:a[r],enumerable:!0})},u0=(c,a,r,s)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of k2(a))!X1.call(c,o)&&o!==r&&L1(c,o,{get:()=>a[o],enumerable:!(s=x2(a,o))||s.enumerable});return c};var p1=(c,a,r)=>(r=c!=null?y2(A2(c)):{},u0(a||!c||!c.__esModule?L1(r,"default",{value:c,enumerable:!0}):r,c)),S2=c=>u0(L1({},"__esModule",{value:!0}),c);var j0=p0((h0,s0)=>{(function(c,a){typeof h0=="object"&&typeof s0!="undefined"?s0.exports=a():typeof define=="function"&&define.amd?define(a):(c=typeof globalThis!="undefined"?globalThis:c||self).dayjs=a()})(h0,function(){"use strict";var c=1e3,a=6e4,r=36e5,s="millisecond",o="second",V="minute",p="hour",C="day",S="week",u="month",I="quarter",g="year",L="date",k="Invalid Date",A=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,P=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,D={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var l=["th","st","nd","rd"],i=t%100;return"["+t+(l[(i-20)%10]||l[i]||l[0])+"]"}},T=function(t,l,i){var H=String(t);return!H||H.length>=l?t:""+Array(l+1-H.length).join(i)+t},F={s:T,z:function(t){var l=-t.utcOffset(),i=Math.abs(l),H=Math.floor(i/60),n=i%60;return(l<=0?"+":"-")+T(H,2,"0")+":"+T(n,2,"0")},m:function t(l,i){if(l.date()<i.date())return-t(i,l);var H=12*(i.year()-l.year())+(i.month()-l.month()),n=l.clone().add(H,u),f=i-n<0,h=l.clone().add(H+(f?-1:1),u);return+(-(H+(i-n)/(f?n-h:h-n))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:u,y:g,w:S,d:C,D:L,h:p,m:V,s:o,ms:s,Q:I}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return t===void 0}},M="en",b={};b[M]=D;var E=function(t){return t instanceof x},R=function t(l,i,H){var n;if(!l)return M;if(typeof l=="string"){var f=l.toLowerCase();b[f]&&(n=f),i&&(b[f]=i,n=f);var h=l.split("-");if(!n&&h.length>1)return t(h[0])}else{var v=l.name;b[v]=l,n=v}return!H&&n&&(M=n),n||!H&&M},_=function(t,l){if(E(t))return t.clone();var i=typeof l=="object"?l:{};return i.date=t,i.args=arguments,new x(i)},d=F;d.l=R,d.i=E,d.w=function(t,l){return _(t,{locale:l.$L,utc:l.$u,x:l.$x,$offset:l.$offset})};var x=function(){function t(i){this.$L=R(i.locale,null,!0),this.parse(i)}var l=t.prototype;return l.parse=function(i){this.$d=function(H){var n=H.date,f=H.utc;if(n===null)return new Date(NaN);if(d.u(n))return new Date;if(n instanceof Date)return new Date(n);if(typeof n=="string"&&!/Z$/i.test(n)){var h=n.match(A);if(h){var v=h[2]-1||0,G=(h[7]||"0").substring(0,3);return f?new Date(Date.UTC(h[1],v,h[3]||1,h[4]||0,h[5]||0,h[6]||0,G)):new Date(h[1],v,h[3]||1,h[4]||0,h[5]||0,h[6]||0,G)}}return new Date(n)}(i),this.$x=i.x||{},this.init()},l.init=function(){var i=this.$d;this.$y=i.getFullYear(),this.$M=i.getMonth(),this.$D=i.getDate(),this.$W=i.getDay(),this.$H=i.getHours(),this.$m=i.getMinutes(),this.$s=i.getSeconds(),this.$ms=i.getMilliseconds()},l.$utils=function(){return d},l.isValid=function(){return this.$d.toString()!==k},l.isSame=function(i,H){var n=_(i);return this.startOf(H)<=n&&n<=this.endOf(H)},l.isAfter=function(i,H){return _(i)<this.startOf(H)},l.isBefore=function(i,H){return this.endOf(H)<_(i)},l.$g=function(i,H,n){return d.u(i)?this[H]:this.set(n,i)},l.unix=function(){return Math.floor(this.valueOf()/1e3)},l.valueOf=function(){return this.$d.getTime()},l.startOf=function(i,H){var n=this,f=!!d.u(H)||H,h=d.p(i),v=function(Z1,N){var o1=d.w(n.$u?Date.UTC(n.$y,N,Z1):new Date(n.$y,N,Z1),n);return f?o1:o1.endOf(C)},G=function(Z1,N){return d.w(n.toDate()[Z1].apply(n.toDate("s"),(f?[0,0,0,0]:[23,59,59,999]).slice(N)),n)},U=this.$W,z=this.$M,r1=this.$D,a1="set"+(this.$u?"UTC":"");switch(h){case g:return f?v(1,0):v(31,11);case u:return f?v(1,z):v(0,z+1);case S:var V1=this.$locale().weekStart||0,g1=(U<V1?U+7:U)-V1;return v(f?r1-g1:r1+(6-g1),z);case C:case L:return G(a1+"Hours",0);case p:return G(a1+"Minutes",1);case V:return G(a1+"Seconds",2);case o:return G(a1+"Milliseconds",3);default:return this.clone()}},l.endOf=function(i){return this.startOf(i,!1)},l.$set=function(i,H){var n,f=d.p(i),h="set"+(this.$u?"UTC":""),v=(n={},n[C]=h+"Date",n[L]=h+"Date",n[u]=h+"Month",n[g]=h+"FullYear",n[p]=h+"Hours",n[V]=h+"Minutes",n[o]=h+"Seconds",n[s]=h+"Milliseconds",n)[f],G=f===C?this.$D+(H-this.$W):H;if(f===u||f===g){var U=this.clone().set(L,1);U.$d[v](G),U.init(),this.$d=U.set(L,Math.min(this.$D,U.daysInMonth())).$d}else v&&this.$d[v](G);return this.init(),this},l.set=function(i,H){return this.clone().$set(i,H)},l.get=function(i){return this[d.p(i)]()},l.add=function(i,H){var n,f=this;i=Number(i);var h=d.p(H),v=function(z){var r1=_(f);return d.w(r1.date(r1.date()+Math.round(z*i)),f)};if(h===u)return this.set(u,this.$M+i);if(h===g)return this.set(g,this.$y+i);if(h===C)return v(1);if(h===S)return v(7);var G=(n={},n[V]=a,n[p]=r,n[o]=c,n)[h]||1,U=this.$d.getTime()+i*G;return d.w(U,this)},l.subtract=function(i,H){return this.add(-1*i,H)},l.format=function(i){var H=this,n=this.$locale();if(!this.isValid())return n.invalidDate||k;var f=i||"YYYY-MM-DDTHH:mm:ssZ",h=d.z(this),v=this.$H,G=this.$m,U=this.$M,z=n.weekdays,r1=n.months,a1=function(N,o1,Q1,S1){return N&&(N[o1]||N(H,f))||Q1[o1].slice(0,S1)},V1=function(N){return d.s(v%12||12,N,"0")},g1=n.meridiem||function(N,o1,Q1){var S1=N<12?"AM":"PM";return Q1?S1.toLowerCase():S1},Z1={YY:String(this.$y).slice(-2),YYYY:this.$y,M:U+1,MM:d.s(U+1,2,"0"),MMM:a1(n.monthsShort,U,r1,3),MMMM:a1(r1,U),D:this.$D,DD:d.s(this.$D,2,"0"),d:String(this.$W),dd:a1(n.weekdaysMin,this.$W,z,2),ddd:a1(n.weekdaysShort,this.$W,z,3),dddd:z[this.$W],H:String(v),HH:d.s(v,2,"0"),h:V1(1),hh:V1(2),a:g1(v,G,!0),A:g1(v,G,!1),m:String(G),mm:d.s(G,2,"0"),s:String(this.$s),ss:d.s(this.$s,2,"0"),SSS:d.s(this.$ms,3,"0"),Z:h};return f.replace(P,function(N,o1){return o1||Z1[N]||h.replace(":","")})},l.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},l.diff=function(i,H,n){var f,h=d.p(H),v=_(i),G=(v.utcOffset()-this.utcOffset())*a,U=this-v,z=d.m(this,v);return z=(f={},f[g]=z/12,f[u]=z,f[I]=z/3,f[S]=(U-G)/6048e5,f[C]=(U-G)/864e5,f[p]=U/r,f[V]=U/a,f[o]=U/c,f)[h]||U,n?z:d.a(z)},l.daysInMonth=function(){return this.endOf(u).$D},l.$locale=function(){return b[this.$L]},l.locale=function(i,H){if(!i)return this.$L;var n=this.clone(),f=R(i,H,!0);return f&&(n.$L=f),n},l.clone=function(){return d.w(this.$d,this)},l.toDate=function(){return new Date(this.valueOf())},l.toJSON=function(){return this.isValid()?this.toISOString():null},l.toISOString=function(){return this.$d.toISOString()},l.toString=function(){return this.$d.toUTCString()},t}(),Z=x.prototype;return _.prototype=Z,[["$ms",s],["$s",o],["$m",V],["$H",p],["$W",C],["$M",u],["$y",g],["$D",L]].forEach(function(t){Z[t[1]]=function(l){return this.$g(l,t[0],t[1])}}),_.extend=function(t,l){return t.$i||(t(l,x,_),t.$i=!0),_},_.locale=R,_.isDayjs=E,_.unix=function(t){return _(1e3*t)},_.en=b[M],_.Ls=b,_.p={},_})});var d0=p0((t0,v0)=>{(function(c,a){typeof t0=="object"&&typeof v0!="undefined"?v0.exports=a(j0()):typeof define=="function"&&define.amd?define(["dayjs"],a):(c=typeof globalThis!="undefined"?globalThis:c||self).dayjs_locale_pt_br=a(c.dayjs)})(t0,function(c){"use strict";function a(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var r=a(c),s={name:"pt-br",weekdays:"domingo_segunda-feira_ter\xE7a-feira_quarta-feira_quinta-feira_sexta-feira_s\xE1bado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_s\xE1b".split("_"),weekdaysMin:"Do_2\xAA_3\xAA_4\xAA_5\xAA_6\xAA_S\xE1".split("_"),months:"janeiro_fevereiro_mar\xE7o_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),ordinal:function(o){return o+"\xBA"},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [\xE0s] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [\xE0s] HH:mm"},relativeTime:{future:"em %s",past:"h\xE1 %s",s:"poucos segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um m\xEAs",MM:"%d meses",y:"um ano",yy:"%d anos"}};return r.default.locale(s,null,!0),s})});var K2={};F2(K2,{Autocomplete:()=>g2,Checkbox:()=>R0,Creatable:()=>G0,DatePicker:()=>r2,Form:()=>g0,FormProvider:()=>w1,RadioButton:()=>O0,RadioGroup:()=>q0,Searchable:()=>T0,Select:()=>D0,Slider:()=>Y0,Switch:()=>U0,TextField:()=>S0,TimePicker:()=>H2,useForm:()=>D1});module.exports=S2(K2);var M0=require("react-hook-form");var c0=require("react/jsx-runtime"),P2=o=>{var V=o,{children:c,style:a,onSubmit:r}=V,s=$(V,["children","style","onSubmit"]);return(0,c0.jsx)(M0.FormProvider,m(e({},s),{children:(0,c0.jsx)("form",{onSubmit:p=>{p.preventDefault(),p.stopPropagation(),r(p)},style:a,children:c})}))},w1=P2;var H0=require("react"),f0=require("react-hook-form"),V0=require("@hookform/resolvers/zod");var w2=s=>{var o=s,{disableDefaultValuesUpdate:c,onSubmit:a}=o,r=$(o,["disableDefaultValuesUpdate","onSubmit"]);let V=(0,f0.useForm)(m(e({},r),{resolver:r.schema&&(0,V0.zodResolver)(r.schema)}));return(0,H0.useEffect)(()=>{c||V.reset(r.defaultValues)},[r.defaultValues,V.reset]),m(e({},V),{onSubmit:V.handleSubmit(p=>a(p,V))})},D1=w2;var L0=require("react/jsx-runtime");function D2(s){var o=s,{children:c,style:a}=o,r=$(o,["children","style"]);let V=D1(r);return(0,L0.jsx)(w1,m(e({},V),{style:a,children:typeof c=="function"?c(V):c}))}var g0=D2;var $1=require("react"),T1=require("react-hook-form"),h1=require("@mui/material");var y0={description:"M39 23.1a17 17 0 0 0-15-10c-6.5.1-12.4 4-15.2 10V25a17 17 0 0 0 15 10A17 17 0 0 0 39 25c.5-.7.5-1.3.2-1.8Zm-15 9a8 8 0 0 1-7.6-8.5c.2-4.2 3.5-7.8 7.6-7.8a8 8 0 0 1 7.6 8.4c-.1 4.3-3.5 7.9-7.6 7.9Zm0-13.5-1.3.1c.7 1.1.6 2.6-.3 3.7-1 .9-2.3.9-3.4.1-.4 2.2.3 4.7 2.1 6a4.9 4.9 0 0 0 6-.2c1.6-1.4 2.4-4 1.6-6.1a4.9 4.9 0 0 0-4.7-3.6Z",id:"line-eye-solid"},b0={description:"M24 31.7c-4 0-7.4-3.1-7.7-7.1l-5.6-4.4c-.8 1-1.4 2-2 3a1.7 1.7 0 0 0 0 1.6 17.2 17.2 0 0 0 19.5 9l-2.8-2.2-1.4.1ZM40.9 35l-6-4.6c1.8-1.5 3.3-3.4 4.4-5.5a1.7 1.7 0 0 0 0-1.6c-3-5.7-8.7-9.5-15.3-9.5-2.8 0-5.5.7-8 2l-6.8-5.3a.9.9 0 0 0-1.2.2L7 12a.9.9 0 0 0 .1 1.2l31.7 24.5a.9.9 0 0 0 1.2-.2l1-1.3a.9.9 0 0 0-.1-1.2Zm-10-7.7-2-1.6a5 5 0 0 0-6.3-6.6 2.5 2.5 0 0 1 .4 2l-3.9-3a7.7 7.7 0 0 1 10.4.5 7.7 7.7 0 0 1 1.5 8.7Z",id:"line-eye-slash-solid"};var n1={description:"M24 8a16 16 0 0 0 0 32 16 16 0 0 0 0-32Zm0 7.1c1.5 0 2.7 1.2 2.7 2.7 0 1.6-1.2 2.7-2.7 2.7a2.6 2.6 0 0 1-2.7-2.7c0-1.5 1.2-2.7 2.7-2.7Zm3.6 16.4c0 .4-.4.8-.8.8h-5.6a.7.7 0 0 1-.8-.8v-1.6c0-.4.3-.7.8-.7h.7V25h-.7a.7.7 0 0 1-.8-.7v-1.6c0-.4.3-.8.8-.8h4c.5 0 .9.4.9.8v6.5h.7c.4 0 .8.3.8.7v1.6Z",id:"line-info-circle-solid"};var x0={description:"m25.5 17 5.5 5.5-12 12-4.9.5a1 1 0 0 1-1-1.1l.5-5L25.5 17Zm8.9-.8-2.6-2.6a2 2 0 0 0-2.9 0L26.5 16l5.5 5.5 2.4-2.4a2 2 0 0 0 0-3Z",id:"line-pen-solid"};var l0={description:"M35.8 21.8h-9.6v-9.6c0-.6-.6-1.1-1.1-1.1h-2.2a1 1 0 0 0-1 1v9.7h-9.7c-.6 0-1.1.6-1.1 1.1v2.2c0 .6.5 1 1 1h9.7v9.7c0 .6.5 1.1 1.1 1.1h2.2c.5 0 1-.5 1-1v-9.7h9.7c.6 0 1.1-.5 1.1-1.1v-2.2c0-.5-.5-1-1-1Z",id:"line-plus-solid"};var u1=p1(require("@s_mart/masks"));var a0=require("@mui/material"),C0=require("@s_mart/utils"),y1=require("react/jsx-runtime"),O=({label:c,required:a,regular:r})=>(0,y1.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:(0,C0.toRem)(2)},children:[(0,y1.jsx)(a0.Typography,{variant:"caption",fontWeight:r?400:700,style:{display:"flex",alignItems:"center"},children:c}),a&&(0,y1.jsx)(a0.Typography,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});var k0=require("react-hook-form"),A0=require("@s_mart/core");var Y=(c,a)=>a.replace(/[[\]]/g,"").split(".").reduce((s,o)=>s==null?void 0:s[o],c);var F0=require("react/jsx-runtime"),q=({name:c,disableIcon:a})=>{var o;let r=(0,k0.useFormContext)(),s=Y((o=r==null?void 0:r.formState)==null?void 0:o.errors,c);return s?(0,F0.jsx)(A0.Indicator,{severity:"error",icon:a?!1:void 0,children:s==null?void 0:s.message}):null};var b1=require("@s_mart/core");var j=require("react/jsx-runtime"),$2=P=>{var D=P,{name:c,rules:a,defaultValue:r,shouldUnregister:s,label:o,required:V,mask:p,variant:C="outlined",info:S,parse:u,inputMode:I,format:g,onInputChange:L,disableIconError:k}=D,A=$(D,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","info","parse","inputMode","format","onInputChange","disableIconError"]);let T=(0,T1.useFormContext)();if(!T)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[F,M]=(0,$1.useState)(!1),b=d=>{var Z;let x=d;return g&&(x=g(d)),p?(Z=u1==null?void 0:u1[p])==null?void 0:Z.format(x):x},E=d=>{var Z;let x=d;return u&&(x=u(d)),p?(Z=u1==null?void 0:u1[p])==null?void 0:Z.parse(x):x},R=d=>{if(!d||p!=="porcentagem"&&p!=="porcentagem0")return;d==null||d.stopPropagation();let x=(d==null?void 0:d.target).value;if(x){let Z=String(x);if(Z.length>0){let t=Z.indexOf("%");t>-1&&(d.currentTarget.selectionEnd=t)}}},_=Y(T.formState.errors,c);return(0,j.jsx)(T1.Controller,{control:T.control,name:c,rules:a,defaultValue:r,shouldUnregister:s,render:({field:{value:d,onChange:x,ref:Z}})=>(0,j.jsxs)(h1.Grid,{display:"flex",flexDirection:"column",children:[(0,j.jsxs)("div",{style:{display:"flex"},children:[o&&(0,j.jsx)(h1.Grid,{item:!0,children:(0,j.jsx)(O,{label:o,required:V})}),S&&(0,j.jsx)(h1.Grid,{item:!0,children:(0,j.jsx)(b1.Tooltip,{title:S,placement:"top",children:(0,j.jsx)("div",{style:{width:"fit-content"},children:(0,j.jsx)(b1.LIcon,{icon:n1,color:"#757575"})})})})]}),(0,j.jsx)(h1.TextField,m(e({variant:C,defaultValue:r,value:b(d||(d!=0?"":d)),onChange:t=>{var i;let l=E((i=t==null?void 0:t.target)==null?void 0:i.value);x(l),L==null||L(l,T.getValues())},error:!!_},A),{type:A.type==="password"?F?"text":"password":A.type,autoComplete:A.autoComplete||"off",inputProps:e({inputMode:I},A.inputProps),InputProps:e({onKeyDown:R,inputRef:Z,endAdornment:A.type==="password"&&(0,j.jsx)(h1.InputAdornment,{position:"start",onClick:()=>M(!F),style:{cursor:"pointer"},children:(0,j.jsx)(b1.LIcon,{icon:F?y0:b0,size:"24px",removeMargin:!0})})},A.InputProps)}),c),(0,j.jsx)(q,{name:c,disableIcon:k})]})})},S0=(0,$1.memo)($2);var _1=require("react"),B1=require("react-hook-form"),i1=require("@s_mart/core");var P0={description:"m27.4 24.4 7-7c.4-.4.4-1 0-1.5l-1.6-1.6a1 1 0 0 0-1.5 0l-7 7-7-7a1 1 0 0 0-1.4 0l-1.6 1.6a1 1 0 0 0 0 1.5l7 7-7 7a1 1 0 0 0 0 1.4l1.6 1.6c.4.4 1 .4 1.5 0l7-7 7 7c.3.4 1 .4 1.4 0l1.6-1.6c.4-.4.4-1 0-1.5l-7-7Z",id:"line-times-regular"};var w0=require("@s_mart/tokens"),W=require("@mui/material");var B=require("react/jsx-runtime"),T2=D=>{var T=D,{name:c,rules:a,defaultValue:r,shouldUnregister:s,label:o,required:V,options:p,placeholder:C,clearable:S,disableOnChangeForm:u=!1,multiple:I,info:g,footer:L,onChange:k,disableIconError:A}=T,P=$(T,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","clearable","disableOnChangeForm","multiple","info","footer","onChange","disableIconError"]);let F=(0,B1.useFormContext)(),{palette:M}=(0,W.useTheme)(),[b,E]=(0,_1.useState)(!1);if(!F)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let R=Y(F.formState.errors,c);return console.warn=()=>{},(0,B.jsx)(B1.Controller,{control:F.control,name:c,rules:a,defaultValue:r,shouldUnregister:s,render:({field:{value:_,onChange:d,ref:x}})=>(0,B.jsxs)(W.Grid,{display:"flex",flexDirection:"column",children:[(0,B.jsxs)("div",{style:{display:"flex"},children:[o&&(0,B.jsx)(W.Grid,{item:!0,children:(0,B.jsx)(O,{label:o,required:V})}),g&&(0,B.jsx)(W.Grid,{item:!0,children:(0,B.jsx)(i1.Tooltip,{title:g,placement:"top",children:(0,B.jsx)("div",{style:{width:"fit-content"},children:(0,B.jsx)(i1.LIcon,{icon:n1,color:"#757575"})})})})]}),(0,B.jsxs)(W.Select,m(e({open:b,onOpen:()=>E(!0),onClose:()=>E(!1),displayEmpty:!!C,variant:"outlined",autoComplete:"off",value:_?_||"":I?[]:"",renderValue:Z=>{if(Z.label)return Z.label;if(C)return(0,B.jsx)("p",{style:{color:M.grey[400]},children:C})},multiple:I,onChange:Z=>{!u&&d(Z.target.value),k&&k(Z.target.value,F.getValues())},error:!!R,size:P.size||"medium",inputRef:x},P),{endAdornment:(0,B.jsxs)(B.Fragment,{children:[P.endAdornment,!!(S&&_)&&(0,B.jsx)(i1.IconButton,{variant:"text",color:"neutral",size:"small",sx:{borderRadius:"50%",position:"absolute",right:"2rem"},style:{padding:0},"aria-label":"Clear",title:"Clear",onClick:()=>{!u&&d(null),k&&k(null,F.getValues())},children:(0,B.jsx)(i1.LIcon,{icon:P0,color:w0.colorPalette.neutral[100],size:"25px",removeMargin:!0})})]}),children:[C&&(0,B.jsx)(W.MenuItem,{disabled:!0,value:"",children:(0,B.jsx)("p",{style:{color:M.grey[400]},children:C})}),p==null?void 0:p.map((Z,t)=>(0,B.jsx)(W.MenuItem,{value:Z,children:(0,B.jsxs)(W.Grid,{container:!0,direction:"column",children:[(0,B.jsx)(W.Grid,{item:!0,children:Z.label}),Z.afterLabel&&(0,B.jsx)(W.Grid,{item:!0,children:Z.afterLabel})]})},t)),L&&[(0,B.jsx)(W.Grid,{px:2,py:1,children:(0,B.jsx)(i1.Divider,{})},"footer-divider"),(0,B.jsx)("div",{children:L({closeSelect:()=>E(!1)})},"footer-content")]]}),c),(0,B.jsx)(q,{name:c,disableIcon:A})]})})},D0=(0,_1.memo)(T2);var I1=require("react"),E1=require("react-hook-form"),J=require("@mui/material"),d1=require("@s_mart/core");var $0=require("@s_mart/tokens");var w=require("react/jsx-runtime"),i0=require("react"),_2=T=>{var F=T,{name:c,rules:a,defaultValue:r,shouldUnregister:s,label:o,required:V,options:p,textFieldProps:C,noOptionsText:S,footer:u,multiple:I,info:g,placeholder:L,onChange:k,onInputChange:A,disableIconError:P}=F,D=$(F,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText","footer","multiple","info","placeholder","onChange","onInputChange","disableIconError"]);let M=(0,E1.useFormContext)();if(!M)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let b=Y(M.formState.errors,c);return console.warn=()=>{},(0,w.jsx)(E1.Controller,{control:M.control,name:c,rules:a,defaultValue:r,shouldUnregister:s,render:({field:{onChange:E,value:R,ref:_}})=>{var d;return(0,w.jsxs)(J.Grid,{display:"flex",flexDirection:"column",children:[(0,w.jsxs)("div",{style:{display:"flex"},children:[o&&(0,w.jsx)(J.Grid,{item:!0,children:(0,w.jsx)(O,{label:o,required:V})}),g&&(0,w.jsx)(J.Grid,{item:!0,children:(0,w.jsx)(d1.Tooltip,{title:g,placement:"top",children:(0,w.jsx)("div",{style:{width:"fit-content"},children:(0,w.jsx)(d1.LIcon,{icon:n1,color:"#757575"})})})})]}),(0,w.jsx)(J.Autocomplete,m(e({onChange:(x,Z)=>{E(Z),k==null||k(Z,M.getValues())},onInputChange:(x,Z,t)=>{t==="input"&&setTimeout(()=>{A==null||A(Z,M.getValues())},0)},slotProps:m(e({},D.slotProps||{}),{paper:m(e({},(D.slotProps||{}).paper||{}),{sx:e({border:`1px solid ${$0.colorPalette.neutral[30]}`,boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.15)"},((d=(D.slotProps||{}).paper)==null?void 0:d.sx)||{})})}),value:R||(I?[]:null),options:p,multiple:I,noOptionsText:(0,w.jsxs)(w.Fragment,{children:[S||"Nenhum resultado encontrado",u?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(J.Grid,{py:1,children:(0,w.jsx)(d1.Divider,{})}),u]}):null]}),isOptionEqualToValue:(x,Z)=>typeof x=="string"&&typeof Z=="string"?x===Z:typeof x=="object"&&typeof Z=="object"?typeof x.value=="object"&&typeof Z.value=="object"&&x.key!==void 0&&Z.key!==void 0?x.key===Z.key:x.value===Z.value:!1,renderOption:(x,Z)=>typeof Z=="object"?(0,i0.createElement)("li",m(e({},x),{key:Z.key||Z.value}),(0,w.jsxs)(J.Grid,{container:!0,direction:"column",children:[(0,w.jsx)(J.Grid,{item:!0,children:Z.label}),Z.afterLabel&&(0,w.jsx)(J.Grid,{item:!0,children:Z.afterLabel})]})):(0,i0.createElement)("li",m(e({},x),{key:Z}),Z),ListboxComponent:(0,I1.forwardRef)(function(Z,t){return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("ul",m(e({},Z),{ref:t})),!!u&&(0,w.jsx)("div",m(e({},Z),{children:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(J.Grid,{px:2,py:1,children:(0,w.jsx)(d1.Divider,{})}),u]})}),"searchable-footer")]})})},D),{renderInput:x=>(0,w.jsx)(J.TextField,m(e(e({error:!!b,placeholder:L},x),C),{inputRef:_}))}),c),(0,w.jsx)(q,{name:c,disableIcon:P})]})}})},T0=(0,I1.memo)(_2);var G1=require("react"),R1=require("react-hook-form"),U1=require("lodash"),K=require("@mui/material"),Q=require("@s_mart/core"),E0=require("@s_mart/tokens");var r0=require("@s_mart/utils");var x1=require("@s_mart/utils"),_0=p1(require("@emotion/styled")),e0=require("@emotion/react"),B0=e0.css`
|
|
1
|
+
"use strict";var y2=Object.create;var L1=Object.defineProperty,b2=Object.defineProperties,x2=Object.getOwnPropertyDescriptor,C2=Object.getOwnPropertyDescriptors,A2=Object.getOwnPropertyNames,w1=Object.getOwnPropertySymbols,F2=Object.getPrototypeOf,X1=Object.prototype.hasOwnProperty,Z0=Object.prototype.propertyIsEnumerable;var m0=(c,a,o)=>a in c?L1(c,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):c[a]=o,r=(c,a)=>{for(var o in a||(a={}))X1.call(a,o)&&m0(c,o,a[o]);if(w1)for(var o of w1(a))Z0.call(a,o)&&m0(c,o,a[o]);return c},m=(c,a)=>b2(c,C2(a));var T=(c,a)=>{var o={};for(var s in c)X1.call(c,s)&&a.indexOf(s)<0&&(o[s]=c[s]);if(c!=null&&w1)for(var s of w1(c))a.indexOf(s)<0&&Z0.call(c,s)&&(o[s]=c[s]);return o};var p0=(c,a)=>()=>(a||c((a={exports:{}}).exports,a),a.exports),k2=(c,a)=>{for(var o in a)L1(c,o,{get:a[o],enumerable:!0})},u0=(c,a,o,s)=>{if(a&&typeof a=="object"||typeof a=="function")for(let e of A2(a))!X1.call(c,e)&&e!==o&&L1(c,e,{get:()=>a[e],enumerable:!(s=x2(a,e))||s.enumerable});return c};var p1=(c,a,o)=>(o=c!=null?y2(F2(c)):{},u0(a||!c||!c.__esModule?L1(o,"default",{value:c,enumerable:!0}):o,c)),S2=c=>u0(L1({},"__esModule",{value:!0}),c);var j0=p0((h0,s0)=>{(function(c,a){typeof h0=="object"&&typeof s0!="undefined"?s0.exports=a():typeof define=="function"&&define.amd?define(a):(c=typeof globalThis!="undefined"?globalThis:c||self).dayjs=a()})(h0,function(){"use strict";var c=1e3,a=6e4,o=36e5,s="millisecond",e="second",g="minute",p="hour",C="day",S="week",u="month",G="quarter",L="year",y="date",A="Invalid Date",F=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,$={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var l=["th","st","nd","rd"],i=t%100;return"["+t+(l[(i-20)%10]||l[i]||l[0])+"]"}},B=function(t,l,i){var f=String(t);return!f||f.length>=l?t:""+Array(l+1-f.length).join(i)+t},k={s:B,z:function(t){var l=-t.utcOffset(),i=Math.abs(l),f=Math.floor(i/60),n=i%60;return(l<=0?"+":"-")+B(f,2,"0")+":"+B(n,2,"0")},m:function t(l,i){if(l.date()<i.date())return-t(i,l);var f=12*(i.year()-l.year())+(i.month()-l.month()),n=l.clone().add(f,u),V=i-n<0,h=l.clone().add(f+(V?-1:1),u);return+(-(f+(i-n)/(V?n-h:h-n))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:u,y:L,w:S,d:C,D:y,h:p,m:g,s:e,ms:s,Q:G}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return t===void 0}},M="en",H={};H[M]=$;var P=function(t){return t instanceof x},_=function t(l,i,f){var n;if(!l)return M;if(typeof l=="string"){var V=l.toLowerCase();H[V]&&(n=V),i&&(H[V]=i,n=V);var h=l.split("-");if(!n&&h.length>1)return t(h[0])}else{var v=l.name;H[v]=l,n=v}return!f&&n&&(M=n),n||!f&&M},I=function(t,l){if(P(t))return t.clone();var i=typeof l=="object"?l:{};return i.date=t,i.args=arguments,new x(i)},d=k;d.l=_,d.i=P,d.w=function(t,l){return I(t,{locale:l.$L,utc:l.$u,x:l.$x,$offset:l.$offset})};var x=function(){function t(i){this.$L=_(i.locale,null,!0),this.parse(i)}var l=t.prototype;return l.parse=function(i){this.$d=function(f){var n=f.date,V=f.utc;if(n===null)return new Date(NaN);if(d.u(n))return new Date;if(n instanceof Date)return new Date(n);if(typeof n=="string"&&!/Z$/i.test(n)){var h=n.match(F);if(h){var v=h[2]-1||0,R=(h[7]||"0").substring(0,3);return V?new Date(Date.UTC(h[1],v,h[3]||1,h[4]||0,h[5]||0,h[6]||0,R)):new Date(h[1],v,h[3]||1,h[4]||0,h[5]||0,h[6]||0,R)}}return new Date(n)}(i),this.$x=i.x||{},this.init()},l.init=function(){var i=this.$d;this.$y=i.getFullYear(),this.$M=i.getMonth(),this.$D=i.getDate(),this.$W=i.getDay(),this.$H=i.getHours(),this.$m=i.getMinutes(),this.$s=i.getSeconds(),this.$ms=i.getMilliseconds()},l.$utils=function(){return d},l.isValid=function(){return this.$d.toString()!==A},l.isSame=function(i,f){var n=I(i);return this.startOf(f)<=n&&n<=this.endOf(f)},l.isAfter=function(i,f){return I(i)<this.startOf(f)},l.isBefore=function(i,f){return this.endOf(f)<I(i)},l.$g=function(i,f,n){return d.u(i)?this[f]:this.set(n,i)},l.unix=function(){return Math.floor(this.valueOf()/1e3)},l.valueOf=function(){return this.$d.getTime()},l.startOf=function(i,f){var n=this,V=!!d.u(f)||f,h=d.p(i),v=function(Z1,N){var o1=d.w(n.$u?Date.UTC(n.$y,N,Z1):new Date(n.$y,N,Z1),n);return V?o1:o1.endOf(C)},R=function(Z1,N){return d.w(n.toDate()[Z1].apply(n.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(N)),n)},U=this.$W,z=this.$M,r1=this.$D,a1="set"+(this.$u?"UTC":"");switch(h){case L:return V?v(1,0):v(31,11);case u:return V?v(1,z):v(0,z+1);case S:var V1=this.$locale().weekStart||0,g1=(U<V1?U+7:U)-V1;return v(V?r1-g1:r1+(6-g1),z);case C:case y:return R(a1+"Hours",0);case p:return R(a1+"Minutes",1);case g:return R(a1+"Seconds",2);case e:return R(a1+"Milliseconds",3);default:return this.clone()}},l.endOf=function(i){return this.startOf(i,!1)},l.$set=function(i,f){var n,V=d.p(i),h="set"+(this.$u?"UTC":""),v=(n={},n[C]=h+"Date",n[y]=h+"Date",n[u]=h+"Month",n[L]=h+"FullYear",n[p]=h+"Hours",n[g]=h+"Minutes",n[e]=h+"Seconds",n[s]=h+"Milliseconds",n)[V],R=V===C?this.$D+(f-this.$W):f;if(V===u||V===L){var U=this.clone().set(y,1);U.$d[v](R),U.init(),this.$d=U.set(y,Math.min(this.$D,U.daysInMonth())).$d}else v&&this.$d[v](R);return this.init(),this},l.set=function(i,f){return this.clone().$set(i,f)},l.get=function(i){return this[d.p(i)]()},l.add=function(i,f){var n,V=this;i=Number(i);var h=d.p(f),v=function(z){var r1=I(V);return d.w(r1.date(r1.date()+Math.round(z*i)),V)};if(h===u)return this.set(u,this.$M+i);if(h===L)return this.set(L,this.$y+i);if(h===C)return v(1);if(h===S)return v(7);var R=(n={},n[g]=a,n[p]=o,n[e]=c,n)[h]||1,U=this.$d.getTime()+i*R;return d.w(U,this)},l.subtract=function(i,f){return this.add(-1*i,f)},l.format=function(i){var f=this,n=this.$locale();if(!this.isValid())return n.invalidDate||A;var V=i||"YYYY-MM-DDTHH:mm:ssZ",h=d.z(this),v=this.$H,R=this.$m,U=this.$M,z=n.weekdays,r1=n.months,a1=function(N,o1,Q1,S1){return N&&(N[o1]||N(f,V))||Q1[o1].slice(0,S1)},V1=function(N){return d.s(v%12||12,N,"0")},g1=n.meridiem||function(N,o1,Q1){var S1=N<12?"AM":"PM";return Q1?S1.toLowerCase():S1},Z1={YY:String(this.$y).slice(-2),YYYY:this.$y,M:U+1,MM:d.s(U+1,2,"0"),MMM:a1(n.monthsShort,U,r1,3),MMMM:a1(r1,U),D:this.$D,DD:d.s(this.$D,2,"0"),d:String(this.$W),dd:a1(n.weekdaysMin,this.$W,z,2),ddd:a1(n.weekdaysShort,this.$W,z,3),dddd:z[this.$W],H:String(v),HH:d.s(v,2,"0"),h:V1(1),hh:V1(2),a:g1(v,R,!0),A:g1(v,R,!1),m:String(R),mm:d.s(R,2,"0"),s:String(this.$s),ss:d.s(this.$s,2,"0"),SSS:d.s(this.$ms,3,"0"),Z:h};return V.replace(w,function(N,o1){return o1||Z1[N]||h.replace(":","")})},l.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},l.diff=function(i,f,n){var V,h=d.p(f),v=I(i),R=(v.utcOffset()-this.utcOffset())*a,U=this-v,z=d.m(this,v);return z=(V={},V[L]=z/12,V[u]=z,V[G]=z/3,V[S]=(U-R)/6048e5,V[C]=(U-R)/864e5,V[p]=U/o,V[g]=U/a,V[e]=U/c,V)[h]||U,n?z:d.a(z)},l.daysInMonth=function(){return this.endOf(u).$D},l.$locale=function(){return H[this.$L]},l.locale=function(i,f){if(!i)return this.$L;var n=this.clone(),V=_(i,f,!0);return V&&(n.$L=V),n},l.clone=function(){return d.w(this.$d,this)},l.toDate=function(){return new Date(this.valueOf())},l.toJSON=function(){return this.isValid()?this.toISOString():null},l.toISOString=function(){return this.$d.toISOString()},l.toString=function(){return this.$d.toUTCString()},t}(),Z=x.prototype;return I.prototype=Z,[["$ms",s],["$s",e],["$m",g],["$H",p],["$W",C],["$M",u],["$y",L],["$D",y]].forEach(function(t){Z[t[1]]=function(l){return this.$g(l,t[0],t[1])}}),I.extend=function(t,l){return t.$i||(t(l,x,I),t.$i=!0),I},I.locale=_,I.isDayjs=P,I.unix=function(t){return I(1e3*t)},I.en=H[M],I.Ls=H,I.p={},I})});var d0=p0((t0,v0)=>{(function(c,a){typeof t0=="object"&&typeof v0!="undefined"?v0.exports=a(j0()):typeof define=="function"&&define.amd?define(["dayjs"],a):(c=typeof globalThis!="undefined"?globalThis:c||self).dayjs_locale_pt_br=a(c.dayjs)})(t0,function(c){"use strict";function a(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var o=a(c),s={name:"pt-br",weekdays:"domingo_segunda-feira_ter\xE7a-feira_quarta-feira_quinta-feira_sexta-feira_s\xE1bado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_s\xE1b".split("_"),weekdaysMin:"Do_2\xAA_3\xAA_4\xAA_5\xAA_6\xAA_S\xE1".split("_"),months:"janeiro_fevereiro_mar\xE7o_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),ordinal:function(e){return e+"\xBA"},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [\xE0s] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [\xE0s] HH:mm"},relativeTime:{future:"em %s",past:"h\xE1 %s",s:"poucos segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um m\xEAs",MM:"%d meses",y:"um ano",yy:"%d anos"}};return o.default.locale(s,null,!0),s})});var K2={};k2(K2,{Autocomplete:()=>g2,Checkbox:()=>R0,Creatable:()=>G0,DatePicker:()=>r2,Form:()=>g0,FormProvider:()=>P1,RadioButton:()=>O0,RadioGroup:()=>q0,Searchable:()=>T0,Select:()=>D0,Slider:()=>Y0,Switch:()=>U0,TextField:()=>S0,TimePicker:()=>H2,useForm:()=>D1});module.exports=S2(K2);var M0=require("react-hook-form");var c0=require("react/jsx-runtime"),w2=e=>{var g=e,{children:c,style:a,onSubmit:o}=g,s=T(g,["children","style","onSubmit"]);return(0,c0.jsx)(M0.FormProvider,m(r({},s),{children:(0,c0.jsx)("form",{onSubmit:p=>{p.preventDefault(),p.stopPropagation(),o(p)},style:a,children:c})}))},P1=w2;var H0=require("react"),f0=require("react-hook-form"),V0=require("@hookform/resolvers/zod");var P2=s=>{var e=s,{disableDefaultValuesUpdate:c,onSubmit:a}=e,o=T(e,["disableDefaultValuesUpdate","onSubmit"]);let g=(0,f0.useForm)(m(r({},o),{resolver:o.schema&&(0,V0.zodResolver)(o.schema)}));return(0,H0.useEffect)(()=>{c||g.reset(o.defaultValues)},[o.defaultValues,g.reset]),m(r({},g),{onSubmit:g.handleSubmit(p=>a(p,g))})},D1=P2;var L0=require("react/jsx-runtime");function D2(s){var e=s,{children:c,style:a}=e,o=T(e,["children","style"]);let g=D1(o);return(0,L0.jsx)(P1,m(r({},g),{style:a,children:typeof c=="function"?c(g):c}))}var g0=D2;var $1=require("react"),T1=require("react-hook-form"),h1=require("@mui/material");var y0={description:"M39 23.1a17 17 0 0 0-15-10c-6.5.1-12.4 4-15.2 10V25a17 17 0 0 0 15 10A17 17 0 0 0 39 25c.5-.7.5-1.3.2-1.8Zm-15 9a8 8 0 0 1-7.6-8.5c.2-4.2 3.5-7.8 7.6-7.8a8 8 0 0 1 7.6 8.4c-.1 4.3-3.5 7.9-7.6 7.9Zm0-13.5-1.3.1c.7 1.1.6 2.6-.3 3.7-1 .9-2.3.9-3.4.1-.4 2.2.3 4.7 2.1 6a4.9 4.9 0 0 0 6-.2c1.6-1.4 2.4-4 1.6-6.1a4.9 4.9 0 0 0-4.7-3.6Z",id:"line-eye-solid"},b0={description:"M24 31.7c-4 0-7.4-3.1-7.7-7.1l-5.6-4.4c-.8 1-1.4 2-2 3a1.7 1.7 0 0 0 0 1.6 17.2 17.2 0 0 0 19.5 9l-2.8-2.2-1.4.1ZM40.9 35l-6-4.6c1.8-1.5 3.3-3.4 4.4-5.5a1.7 1.7 0 0 0 0-1.6c-3-5.7-8.7-9.5-15.3-9.5-2.8 0-5.5.7-8 2l-6.8-5.3a.9.9 0 0 0-1.2.2L7 12a.9.9 0 0 0 .1 1.2l31.7 24.5a.9.9 0 0 0 1.2-.2l1-1.3a.9.9 0 0 0-.1-1.2Zm-10-7.7-2-1.6a5 5 0 0 0-6.3-6.6 2.5 2.5 0 0 1 .4 2l-3.9-3a7.7 7.7 0 0 1 10.4.5 7.7 7.7 0 0 1 1.5 8.7Z",id:"line-eye-slash-solid"};var n1={description:"M24 8a16 16 0 0 0 0 32 16 16 0 0 0 0-32Zm0 7.1c1.5 0 2.7 1.2 2.7 2.7 0 1.6-1.2 2.7-2.7 2.7a2.6 2.6 0 0 1-2.7-2.7c0-1.5 1.2-2.7 2.7-2.7Zm3.6 16.4c0 .4-.4.8-.8.8h-5.6a.7.7 0 0 1-.8-.8v-1.6c0-.4.3-.7.8-.7h.7V25h-.7a.7.7 0 0 1-.8-.7v-1.6c0-.4.3-.8.8-.8h4c.5 0 .9.4.9.8v6.5h.7c.4 0 .8.3.8.7v1.6Z",id:"line-info-circle-solid"};var x0={description:"m25.5 17 5.5 5.5-12 12-4.9.5a1 1 0 0 1-1-1.1l.5-5L25.5 17Zm8.9-.8-2.6-2.6a2 2 0 0 0-2.9 0L26.5 16l5.5 5.5 2.4-2.4a2 2 0 0 0 0-3Z",id:"line-pen-solid"};var l0={description:"M35.8 21.8h-9.6v-9.6c0-.6-.6-1.1-1.1-1.1h-2.2a1 1 0 0 0-1 1v9.7h-9.7c-.6 0-1.1.6-1.1 1.1v2.2c0 .6.5 1 1 1h9.7v9.7c0 .6.5 1.1 1.1 1.1h2.2c.5 0 1-.5 1-1v-9.7h9.7c.6 0 1.1-.5 1.1-1.1v-2.2c0-.5-.5-1-1-1Z",id:"line-plus-solid"};var u1=p1(require("@s_mart/masks"));var a0=require("@mui/material"),C0=require("@s_mart/utils"),y1=require("react/jsx-runtime"),O=({label:c,required:a,regular:o})=>(0,y1.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:(0,C0.toRem)(2)},children:[(0,y1.jsx)(a0.Typography,{variant:"caption",fontWeight:o?400:700,style:{display:"flex",alignItems:"center"},children:c}),a&&(0,y1.jsx)(a0.Typography,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});var A0=require("react-hook-form"),F0=require("@s_mart/core");var Y=(c,a)=>a.replace(/[[\]]/g,"").split(".").reduce((s,e)=>s==null?void 0:s[e],c);var k0=require("react/jsx-runtime"),q=({name:c,disableIcon:a})=>{var e;let o=(0,A0.useFormContext)(),s=Y((e=o==null?void 0:o.formState)==null?void 0:e.errors,c);return s?(0,k0.jsx)(F0.Indicator,{severity:"error",icon:a?!1:void 0,children:s==null?void 0:s.message}):null};var b1=require("@s_mart/core");var j=require("react/jsx-runtime"),$2=w=>{var $=w,{name:c,rules:a,defaultValue:o,shouldUnregister:s,label:e,required:g,mask:p,variant:C="outlined",info:S,parse:u,inputMode:G,format:L,onInputChange:y,disableIconError:A}=$,F=T($,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","info","parse","inputMode","format","onInputChange","disableIconError"]);let B=(0,T1.useFormContext)();if(!B)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[k,M]=(0,$1.useState)(!1),H=d=>{var Z;let x=d;return L&&(x=L(d)),p?(Z=u1==null?void 0:u1[p])==null?void 0:Z.format(x):x},P=d=>{var Z;let x=d;return u&&(x=u(d)),p?(Z=u1==null?void 0:u1[p])==null?void 0:Z.parse(x):x},_=d=>{if(!d||p!=="porcentagem"&&p!=="porcentagem0")return;d==null||d.stopPropagation();let x=(d==null?void 0:d.target).value;if(x){let Z=String(x);if(Z.length>0){let t=Z.indexOf("%");t>-1&&(d.currentTarget.selectionEnd=t)}}},I=Y(B.formState.errors,c);return(0,j.jsx)(T1.Controller,{control:B.control,name:c,rules:a,defaultValue:o,shouldUnregister:s,render:({field:{value:d,onChange:x,ref:Z}})=>(0,j.jsxs)(h1.Grid,{display:"flex",flexDirection:"column",children:[(0,j.jsxs)("div",{style:{display:"flex"},children:[e&&(0,j.jsx)(h1.Grid,{item:!0,children:(0,j.jsx)(O,{label:e,required:g})}),S&&(0,j.jsx)(h1.Grid,{item:!0,children:(0,j.jsx)(b1.Tooltip,{title:S,placement:"top",children:(0,j.jsx)("div",{style:{width:"fit-content"},children:(0,j.jsx)(b1.LIcon,{icon:n1,color:"#757575"})})})})]}),(0,j.jsx)(h1.TextField,m(r({variant:C,defaultValue:o,value:H(d||(d!=0?"":d)),onChange:t=>{var i;let l=P((i=t==null?void 0:t.target)==null?void 0:i.value);x(l),y==null||y(l,B.getValues())},error:!!I},F),{type:F.type==="password"?k?"text":"password":F.type,autoComplete:F.autoComplete||"off",inputProps:r({inputMode:G},F.inputProps),InputProps:r({onKeyDown:_,inputRef:Z,endAdornment:F.type==="password"&&(0,j.jsx)(h1.InputAdornment,{position:"start",onClick:()=>M(!k),style:{cursor:"pointer"},children:(0,j.jsx)(b1.LIcon,{icon:k?y0:b0,size:"24px",removeMargin:!0})})},F.InputProps)}),c),(0,j.jsx)(q,{name:c,disableIcon:A})]})})},S0=(0,$1.memo)($2);var _1=require("react"),B1=require("react-hook-form"),i1=require("@s_mart/core");var w0={description:"m27.4 24.4 7-7c.4-.4.4-1 0-1.5l-1.6-1.6a1 1 0 0 0-1.5 0l-7 7-7-7a1 1 0 0 0-1.4 0l-1.6 1.6a1 1 0 0 0 0 1.5l7 7-7 7a1 1 0 0 0 0 1.4l1.6 1.6c.4.4 1 .4 1.5 0l7-7 7 7c.3.4 1 .4 1.4 0l1.6-1.6c.4-.4.4-1 0-1.5l-7-7Z",id:"line-times-regular"};var P0=require("@s_mart/tokens"),W=require("@mui/material");var E=require("react/jsx-runtime"),T2=$=>{var B=$,{name:c,rules:a,defaultValue:o,shouldUnregister:s,label:e,required:g,options:p,placeholder:C,clearable:S,disableOnChangeForm:u=!1,multiple:G,info:L,footer:y,onChange:A,disableIconError:F}=B,w=T(B,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","clearable","disableOnChangeForm","multiple","info","footer","onChange","disableIconError"]);let k=(0,B1.useFormContext)(),{palette:M}=(0,W.useTheme)(),[H,P]=(0,_1.useState)(!1);if(!k)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let _=Y(k.formState.errors,c);return console.warn=()=>{},(0,E.jsx)(B1.Controller,{control:k.control,name:c,rules:a,defaultValue:o,shouldUnregister:s,render:({field:{value:I,onChange:d,ref:x}})=>(0,E.jsxs)(W.Grid,{display:"flex",flexDirection:"column",children:[(0,E.jsxs)("div",{style:{display:"flex"},children:[e&&(0,E.jsx)(W.Grid,{item:!0,children:(0,E.jsx)(O,{label:e,required:g})}),L&&(0,E.jsx)(W.Grid,{item:!0,children:(0,E.jsx)(i1.Tooltip,{title:L,placement:"top",children:(0,E.jsx)("div",{style:{width:"fit-content"},children:(0,E.jsx)(i1.LIcon,{icon:n1,color:"#757575"})})})})]}),(0,E.jsxs)(W.Select,m(r({open:H,onOpen:()=>P(!0),onClose:()=>P(!1),displayEmpty:!!C,variant:"outlined",autoComplete:"off",value:I?I||"":G?[]:"",renderValue:Z=>{if(Z.label)return Z.label;if(C)return(0,E.jsx)("p",{style:{color:M.grey[400]},children:C})},multiple:G,onChange:Z=>{!u&&d(Z.target.value),A&&A(Z.target.value,k.getValues())},error:!!_,size:w.size||"medium",inputRef:x},w),{endAdornment:(0,E.jsxs)(E.Fragment,{children:[w.endAdornment,!!(S&&I)&&(0,E.jsx)(i1.IconButton,{variant:"text",color:"neutral",size:"small",sx:{borderRadius:"50%",position:"absolute",right:"2rem"},style:{padding:0},"aria-label":"Clear",title:"Clear",onClick:()=>{!u&&d(null),A&&A(null,k.getValues())},children:(0,E.jsx)(i1.LIcon,{icon:w0,color:P0.colorPalette.neutral[100],size:"25px",removeMargin:!0})})]}),children:[C&&(0,E.jsx)(W.MenuItem,{disabled:!0,value:"",children:(0,E.jsx)("p",{style:{color:M.grey[400]},children:C})}),p==null?void 0:p.map((Z,t)=>(0,E.jsx)(W.MenuItem,{value:Z,children:(0,E.jsxs)(W.Grid,{container:!0,direction:"column",children:[(0,E.jsx)(W.Grid,{item:!0,children:Z.label}),Z.afterLabel&&(0,E.jsx)(W.Grid,{item:!0,children:Z.afterLabel})]})},t)),y&&[(0,E.jsx)(W.Grid,{px:2,py:1,children:(0,E.jsx)(i1.Divider,{})},"footer-divider"),(0,E.jsx)("div",{children:y({closeSelect:()=>P(!1)})},"footer-content")]]}),c),(0,E.jsx)(q,{name:c,disableIcon:F})]})})},D0=(0,_1.memo)(T2);var I1=require("react"),E1=require("react-hook-form"),J=require("@mui/material"),d1=require("@s_mart/core");var $0=require("@s_mart/tokens");var D=require("react/jsx-runtime"),i0=require("react"),_2=B=>{var k=B,{name:c,rules:a,defaultValue:o,shouldUnregister:s,label:e,required:g,options:p,textFieldProps:C,noOptionsText:S,footer:u,multiple:G,info:L,placeholder:y,onChange:A,onInputChange:F,disableIconError:w}=k,$=T(k,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText","footer","multiple","info","placeholder","onChange","onInputChange","disableIconError"]);let M=(0,E1.useFormContext)();if(!M)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let H=Y(M.formState.errors,c);return console.warn=()=>{},(0,D.jsx)(E1.Controller,{control:M.control,name:c,rules:a,defaultValue:o,shouldUnregister:s,render:({field:{onChange:P,value:_,ref:I}})=>{var d;return(0,D.jsxs)(J.Grid,{display:"flex",flexDirection:"column",children:[(0,D.jsxs)("div",{style:{display:"flex"},children:[e&&(0,D.jsx)(J.Grid,{item:!0,children:(0,D.jsx)(O,{label:e,required:g})}),L&&(0,D.jsx)(J.Grid,{item:!0,children:(0,D.jsx)(d1.Tooltip,{title:L,placement:"top",children:(0,D.jsx)("div",{style:{width:"fit-content"},children:(0,D.jsx)(d1.LIcon,{icon:n1,color:"#757575"})})})})]}),(0,D.jsx)(J.Autocomplete,m(r({onChange:(x,Z)=>{P(Z),A==null||A(Z,M.getValues())},onInputChange:(x,Z,t)=>{t==="input"&&setTimeout(()=>{F==null||F(Z,M.getValues())},0)},slotProps:m(r({},$.slotProps||{}),{paper:m(r({},($.slotProps||{}).paper||{}),{sx:r({border:`1px solid ${$0.colorPalette.neutral[30]}`,boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.15)"},((d=($.slotProps||{}).paper)==null?void 0:d.sx)||{})})}),value:_||(G?[]:null),options:p,multiple:G,noOptionsText:(0,D.jsxs)(D.Fragment,{children:[S||"Nenhum resultado encontrado",u?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(J.Grid,{py:1,children:(0,D.jsx)(d1.Divider,{})}),u]}):null]}),isOptionEqualToValue:(x,Z)=>typeof x=="string"&&typeof Z=="string"?x===Z:typeof x=="object"&&typeof Z=="object"?typeof x.value=="object"&&typeof Z.value=="object"&&x.key!==void 0&&Z.key!==void 0?x.key===Z.key:x.value===Z.value:!1,renderOption:(x,Z)=>typeof Z=="object"?(0,i0.createElement)("li",m(r({},x),{key:Z.key||Z.value}),(0,D.jsxs)(J.Grid,{container:!0,direction:"column",children:[(0,D.jsx)(J.Grid,{item:!0,children:Z.label}),Z.afterLabel&&(0,D.jsx)(J.Grid,{item:!0,children:Z.afterLabel})]})):(0,i0.createElement)("li",m(r({},x),{key:Z}),Z),ListboxComponent:(0,I1.forwardRef)(function(Z,t){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("ul",m(r({},Z),{ref:t})),!!u&&(0,D.jsx)("div",m(r({},Z),{children:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(J.Grid,{px:2,py:1,children:(0,D.jsx)(d1.Divider,{})}),u]})}),"searchable-footer")]})})},$),{renderInput:x=>(0,D.jsx)(J.TextField,m(r(r({error:!!H,placeholder:y},x),C),{inputRef:I}))}),c),(0,D.jsx)(q,{name:c,disableIcon:w})]})}})},T0=(0,I1.memo)(_2);var G1=require("react"),R1=require("react-hook-form"),U1=require("lodash"),K=require("@mui/material"),Q=require("@s_mart/core"),E0=require("@s_mart/tokens");var r0=require("@s_mart/utils");var x1=require("@s_mart/utils"),_0=p1(require("@emotion/styled")),e0=require("@emotion/react"),B0=e0.css`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
${({hideAddButton:c,theme:a})=>!c&&B2(a)}
|
|
50
|
-
`;var
|
|
50
|
+
`;var b=require("react/jsx-runtime"),o0=require("react"),I2=H=>{var P=H,{name:c,rules:a,defaultValue:o,shouldUnregister:s,label:e,required:g,options:p,editable:C,footer:S,onEditOption:u,onCreateOption:G,textFieldProps:L,hideAddButton:y,multiple:A,info:F,onChange:w,onInputChange:$,placeholder:B,disableIconError:k}=P,M=T(P,["name","rules","defaultValue","shouldUnregister","label","required","options","editable","footer","onEditOption","onCreateOption","textFieldProps","hideAddButton","multiple","info","onChange","onInputChange","placeholder","disableIconError"]);let _=(0,R1.useFormContext)();if(!_)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let I=Y(_.formState.errors,c),d=l=>{let i=0;return L!=null&&L.InputProps||(i+=2.5),y||(i+=2.56,x(l)&&(i+=2.56)),M.disableClearable||(i+=1.3),i+"rem"},x=l=>C&&(0,U1.isObject)(l)&&!(0,U1.isEmpty)(l);console.warn=()=>{};let Z=l=>{G?G(l):console.error("onCreateOption n\xE3o foi definido")},t=l=>{u?u(l):console.error("onEditOption n\xE3o foi definido")};return(0,b.jsx)(R1.Controller,{control:_.control,name:c,rules:a,defaultValue:o,shouldUnregister:s,render:({field:{value:l,onChange:i,ref:f}})=>{var V;let n=(l==null?void 0:l.label)||(l==null?void 0:l.value)||l;return(0,b.jsxs)(K.Grid,{display:"flex",flexDirection:"column",children:[(0,b.jsxs)("div",{style:{display:"flex"},children:[e&&(0,b.jsx)(K.Grid,{item:!0,children:(0,b.jsx)(O,{label:e,required:g})}),F&&(0,b.jsx)(K.Grid,{item:!0,children:(0,b.jsx)(Q.Tooltip,{title:F,placement:"top",children:(0,b.jsx)("div",{style:{width:"fit-content"},children:(0,b.jsx)(Q.LIcon,{icon:n1,color:"#757575"})})})})]}),(0,b.jsx)(I0,{hideAddButton:y,children:(0,b.jsx)(K.Autocomplete,m(r({fullWidth:!0,onChange:(h,v)=>{i(v),w==null||w(v,_.getValues())},onInputChange:(h,v,R)=>{R==="input"&&setTimeout(()=>{$==null||$(v,_.getValues())},0)},slotProps:m(r({},M.slotProps||{}),{paper:m(r({},(M.slotProps||{}).paper||{}),{sx:r({border:`1px solid ${E0.colorPalette.neutral[30]}`,boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.15)"},((V=(M.slotProps||{}).paper)==null?void 0:V.sx)||{})})}),options:p,value:l||(A?[]:null),multiple:A,noOptionsText:y?void 0:(0,b.jsxs)(Q.Button,{sx:{justifyContent:"flex-start",padding:`${(0,r0.toRem)(6)} ${(0,r0.toRem)(-16)}`,margin:0},fullWidth:!0,onClick:()=>Z(l),variant:"text",startIcon:(0,b.jsx)(Q.LIcon,{icon:l0}),children:["Adicionar ",n&&`"${n}"`]}),isOptionEqualToValue:(h,v)=>v?typeof h=="string"&&typeof v=="string"?h===v:typeof h=="object"&&typeof v=="object"?typeof h.value=="object"&&typeof v.value=="object"&&h.key!==void 0&&v.key!==void 0?h.key===v.key:h.value===v.value:typeof h=="object"&&typeof v=="string":!1,renderOption:(h,v)=>typeof v=="object"?(0,o0.createElement)("li",m(r({},h),{key:v.key||v.value}),(0,b.jsxs)(K.Grid,{container:!0,direction:"column",children:[(0,b.jsx)(K.Grid,{item:!0,children:v.label}),v.afterLabel&&(0,b.jsx)(K.Grid,{item:!0,children:v.afterLabel})]})):(0,o0.createElement)("li",m(r({},h),{key:v}),v),ListboxComponent:(0,G1.forwardRef)(function(v,R){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("ul",m(r({},v),{ref:R})),!!S&&(0,b.jsx)("div",m(r({},v),{children:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(K.Grid,{px:2,py:1,children:(0,b.jsx)(Q.Divider,{})}),S]})}),"creatable-footer")]})})},M),{sx:r({"& div.MuiInputBase-root":{paddingRight:`${d(l)} !important`}},M.sx),renderInput:h=>(0,b.jsx)(K.TextField,r(m(r({placeholder:B},h),{error:!!I,InputProps:m(r({},h.InputProps),{inputRef:f,endAdornment:(0,b.jsxs)("div",{className:"endAdornments",children:[h.InputProps.endAdornment,!y&&(0,b.jsxs)(b.Fragment,{children:[x(l)?(0,b.jsxs)("div",{className:"editable",children:[(0,b.jsx)("div",{className:"divider"}),(0,b.jsx)("div",{className:"button",onClick:()=>t(l),children:(0,b.jsx)(Q.LIcon,{icon:x0,size:"24px",removeMargin:!0})})]}):null,(0,b.jsxs)("div",{className:"creatable",children:[(0,b.jsx)("div",{className:"divider"}),(0,b.jsx)("div",{className:"button",onClick:()=>Z(l),children:(0,b.jsx)(Q.LIcon,{icon:l0,size:"24px",removeMargin:!0})})]})]})]})})}),L))}),c)}),(0,b.jsx)(q,{name:c,disableIcon:k})]})}})},G0=(0,G1.memo)(I2);var O1=require("react-hook-form"),M1=require("@mui/material");var s1=require("react/jsx-runtime"),E2=G=>{var L=G,{name:c,rules:a,defaultValue:o,shouldUnregister:s,label:e,labelPlacement:g,required:p,disableIconError:C,onChange:S}=L,u=T(L,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required","disableIconError","onChange"]);let y=(0,O1.useFormContext)();if(!y)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,s1.jsx)(O1.Controller,{control:y.control,name:c,rules:a,defaultValue:o,shouldUnregister:s,render:({field:{value:A,onChange:F}})=>(0,s1.jsxs)(M1.Grid,{display:"flex",flexDirection:"column",children:[(0,s1.jsx)(M1.FormControlLabel,{control:(0,s1.jsx)(M1.Checkbox,r({checked:!!A,value:A!=null?A:"",defaultValue:A,onChange:(w,$)=>{F(w,$),S==null||S(w,$)}},u),c),label:(0,s1.jsx)(O,{label:e,required:p,regular:!0}),labelPlacement:g||"end"}),(0,s1.jsx)(q,{name:c,disableIcon:C})]})})},R0=E2;var q1=require("react-hook-form"),H1=require("@mui/material");var t1=require("react/jsx-runtime"),G2=u=>{var G=u,{name:c,rules:a,defaultValue:o,shouldUnregister:s,label:e,labelPlacement:g,disableIconError:p,onChange:C}=G,S=T(G,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","disableIconError","onChange"]);let L=(0,q1.useFormContext)();if(!L)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,t1.jsx)(q1.Controller,{control:L.control,name:c,rules:a,defaultValue:o,shouldUnregister:s,render:({field:{value:y,onChange:A}})=>(0,t1.jsxs)(H1.Grid,{display:"flex",flexDirection:"column",children:[(0,t1.jsx)(H1.FormControlLabel,{control:(0,t1.jsx)(H1.Switch,r({value:y!=null?y:"",checked:y!=null?y:!1,defaultValue:y,onChange:(F,w)=>{A(F,w),C==null||C(F,w)}},S),c),label:(0,t1.jsx)(O,{label:e}),labelPlacement:g||"end"}),(0,t1.jsx)(q,{name:c,disableIcon:p})]})})},U0=G2;var f1=require("@mui/material");var C1=require("react/jsx-runtime"),R2=s=>{var e=s,{label:c,labelPlacement:a}=e,o=T(e,["label","labelPlacement"]);return(0,C1.jsx)(f1.Grid,{display:"flex",flexDirection:"column",children:(0,C1.jsx)(f1.FormControlLabel,{control:(0,C1.jsx)(f1.Radio,r({},o)),label:(0,C1.jsx)(O,{label:c}),labelPlacement:a||"end"})})},O0=R2;var z1=require("react-hook-form"),Y1=require("@mui/material");var m1=require("react/jsx-runtime"),U2=G=>{var L=G,{name:c,rules:a,defaultValue:o,shouldUnregister:s,label:e,required:g,children:p,orientation:C="row",disableIconError:S}=L,u=T(L,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation","disableIconError"]);let y=(0,z1.useFormContext)();if(!y)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,m1.jsx)(z1.Controller,{control:y.control,name:c,rules:a,defaultValue:o,shouldUnregister:s,render:({field:{value:A,onChange:F}})=>(0,m1.jsxs)(Y1.Grid,{display:"flex",flexDirection:"column",children:[e&&(0,m1.jsx)(O,{label:e,required:g}),(0,m1.jsx)(Y1.RadioGroup,m(r({value:A||"",name:c},u),{onChange:w=>{var $,B;(B=u==null?void 0:u.onChange)==null||B.call(u,w,($=w.target)==null?void 0:$.value),F(w)},style:{display:"flex",flexDirection:C},children:p}),c),(0,m1.jsx)(q,{name:c,disableIcon:S})]})})},q0=U2;var j1=require("react-hook-form"),z0=require("@mui/material");var n0=require("react/jsx-runtime"),O2=g=>{var p=g,{name:c,rules:a,defaultValue:o,shouldUnregister:s}=p,e=T(p,["name","rules","defaultValue","shouldUnregister"]);let C=(0,j1.useFormContext)();if(!C)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,n0.jsx)(j1.Controller,{control:C.control,name:c,rules:a,defaultValue:o,shouldUnregister:s,render:({field:{value:S,onChange:u}})=>(0,n0.jsx)(z0.Slider,r({value:S||(e==null?void 0:e.min)||0,onChange:u,valueLabelDisplay:"auto"},e),c)})},Y0=O2;var K0=require("react"),W1=require("react-hook-form"),Q0=require("@s_mart/core"),A1=require("@s_mart/rules"),X0=require("@mui/material"),c2=require("@mui/x-date-pickers/DatePicker"),l2=require("@mui/x-date-pickers/AdapterDayjs"),a2=require("@mui/x-date-pickers/LocalizationProvider"),i2=require("@mui/x-date-pickers/locales/ptBR"),e2=p1(d0());var W0=p1(require("@emotion/styled")),N0=require("@mui/material"),X=require("@s_mart/utils"),q2=c=>{switch(c){case"small":return(0,X.toRem)(16);default:case"medium":return(0,X.toRem)(20);case"large":return(0,X.toRem)(24)}},z2=c=>{switch(c){case"small":return`${(0,X.toRem)(2)} ${(0,X.toRem)(8)}`;default:case"medium":return`${(0,X.toRem)(6)} ${(0,X.toRem)(8)}`;case"large":return`${(0,X.toRem)(10)}`}},J0=(0,W0.default)(N0.IconButton)`
|
|
51
51
|
margin: 0px;
|
|
52
52
|
|
|
53
53
|
padding: ${({size:c})=>z2(c)};
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
svg {
|
|
57
57
|
width: ${({size:c})=>q2(c)} !important;
|
|
58
58
|
}
|
|
59
|
-
`;var v1=require("react/jsx-runtime"),o2=require("react"),Y2=
|
|
59
|
+
`;var v1=require("react/jsx-runtime"),o2=require("react"),Y2=L=>{var y=L,{rules:c,name:a,defaultValue:o,shouldUnregister:s,datePickerProps:e,label:g,required:p,placeholder:C,disabled:S,disableIconError:u}=y,G=T(y,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder","disabled","disableIconError"]);let A=(0,W1.useFormContext)();if(!A)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let F=Y(A.formState.errors,a),w=(e==null?void 0:e.format)||"DD/MM/YYYY",$=c?(0,A1.composeValidators)([(0,A1.date)(w),c]):(0,A1.date)(w);return(0,v1.jsx)(a2.LocalizationProvider,{dateAdapter:l2.AdapterDayjs,adapterLocale:e2.default,localeText:i2.ptBR.components.MuiLocalizationProvider.defaultProps.localeText,children:(0,v1.jsx)(W1.Controller,{control:A.control,name:a,rules:$,defaultValue:o,shouldUnregister:s,render:({field:{value:B,onChange:k,ref:M}})=>(0,v1.jsxs)(Q0.Grid,{display:"flex",flexDirection:"column",children:[g&&(0,v1.jsx)(O,{label:g,required:p}),(0,o2.createElement)(c2.DatePicker,m(r({},e),{key:a,value:B!=null?B:null,format:w,onChange:(H,P)=>{var _;k(H,P),(_=e==null?void 0:e.onChange)==null||_.call(e,H,P)},disabled:S,slots:{textField:X0.TextField,openPickerButton:H=>(0,v1.jsx)(J0,m(r({},H),{size:G.size}))},slotProps:{textField:H=>{var P;return m(r(m(r({variant:"outlined"},H),{error:!!F}),G),{inputProps:m(r({},H.inputProps),{placeholder:C||((P=H.inputProps)==null?void 0:P.placeholder)}),InputProps:m(r({},H.InputProps),{inputRef(_){M(_),typeof H.inputRef=="function"&&H.inputRef(_)}})})}}})),(0,v1.jsx)(q,{name:a,disableIcon:u})]})})})},r2=(0,K0.memo)(Y2);var t2=require("react"),N1=require("react-hook-form"),v2=require("@s_mart/core"),F1=require("@s_mart/rules"),d2=require("@mui/material"),m2=require("@mui/x-date-pickers/TimePicker"),Z2=require("@mui/x-date-pickers/AdapterDayjs"),p2=require("@mui/x-date-pickers/LocalizationProvider"),u2=require("@mui/x-date-pickers/locales/ptBR"),M2=p1(d0());var n2=p1(require("@emotion/styled")),h2=require("@mui/material"),c1=require("@s_mart/utils"),j2=c=>{switch(c){case"small":return(0,c1.toRem)(16);default:case"medium":return(0,c1.toRem)(20);case"large":return(0,c1.toRem)(24)}},W2=c=>{switch(c){case"small":return`${(0,c1.toRem)(2)} ${(0,c1.toRem)(8)}`;default:case"medium":return`${(0,c1.toRem)(6)} ${(0,c1.toRem)(8)}`;case"large":return`${(0,c1.toRem)(10)}`}},s2=(0,n2.default)(h2.IconButton)`
|
|
60
60
|
margin: 0px;
|
|
61
61
|
|
|
62
62
|
padding: ${({size:c})=>W2(c)};
|
|
@@ -65,4 +65,4 @@
|
|
|
65
65
|
svg {
|
|
66
66
|
width: ${({size:c})=>j2(c)} !important;
|
|
67
67
|
}
|
|
68
|
-
`;var e1=require("react/jsx-runtime"),N2=
|
|
68
|
+
`;var e1=require("react/jsx-runtime"),N2=L=>{var y=L,{rules:c,defaultValue:a,shouldUnregister:o,name:s,required:e,label:g,timePickerProps:p,placeholder:C,disabled:S,disableIconError:u}=y,G=T(y,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder","disabled","disableIconError"]);let A=(0,N1.useFormContext)();if(!A)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let F=Y(A.formState.errors,s),w=(p==null?void 0:p.format)||"HH:mm",$=c?(0,F1.composeValidators)([(0,F1.time)(w),c]):(0,F1.time)(w);return(0,e1.jsx)(p2.LocalizationProvider,{dateAdapter:Z2.AdapterDayjs,adapterLocale:M2.default,localeText:u2.ptBR.components.MuiLocalizationProvider.defaultProps.localeText,children:(0,e1.jsx)(N1.Controller,{control:A.control,name:s,rules:$,defaultValue:a,shouldUnregister:o,render:({field:{value:B,onChange:k,ref:M}})=>(0,e1.jsxs)(v2.Grid,{display:"flex",flexDirection:"column",children:[g&&(0,e1.jsx)(O,{label:g,required:e}),(0,e1.jsx)(m2.TimePicker,m(r({ampm:!1,format:w,value:B!=null?B:null,disabled:S},p),{onChange:(H,P)=>{var _;k(H,P),(_=p==null?void 0:p.onChange)==null||_.call(p,H,P)},slots:{textField:d2.TextField,openPickerButton:H=>(0,e1.jsx)(s2,m(r({},H),{size:G.size}))},slotProps:{textField:H=>{var P;return m(r(m(r({variant:"outlined"},H),{error:!!F}),G),{inputProps:m(r({},H.inputProps),{placeholder:C||((P=H.inputProps)==null?void 0:P.placeholder)}),InputProps:m(r({},H.InputProps),{inputRef(_){M(_),typeof H.inputRef=="function"&&H.inputRef(_)}})})}}}),s),(0,e1.jsx)(q,{name:s,disableIcon:u})]})})})},H2=(0,t2.memo)(N2);var f2=require("react"),J1=require("react-hook-form"),K1=require("@mui/material"),k1=require("@s_mart/core"),V2=require("@s_mart/tokens");var l1=require("react/jsx-runtime"),L2=require("react"),J2=y=>{var A=y,{name:c,defaultValue:a,rules:o,shouldUnregister:s,label:e,required:g,noOptionsText:p,placeholder:C,onInputChange:S,onChange:u,disableIconError:G}=A,L=T(A,["name","defaultValue","rules","shouldUnregister","label","required","noOptionsText","placeholder","onInputChange","onChange","disableIconError"]);let F=(0,J1.useFormContext)();if(!F)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let w=Y(F.formState.errors,c);return console.warn=()=>{},(0,l1.jsx)(J1.Controller,{name:c,control:F.control,defaultValue:a,rules:o,shouldUnregister:s,render:({field:$})=>{var B;return(0,l1.jsxs)(k1.Grid,{display:"flex",flexDirection:"column",children:[e&&(0,l1.jsx)(O,{label:e,required:g}),(0,l1.jsx)(K1.Autocomplete,m(r({onChange:(k,M)=>{$.onChange(M),u==null||u(M,F.getValues())},onInputChange:(k,M,H)=>{H==="input"&&($.onChange(M),setTimeout(()=>{S==null||S(M,F.getValues())},0))},slotProps:m(r({},L.slotProps||{}),{paper:m(r({},(L.slotProps||{}).paper||{}),{sx:r({border:`1px solid ${V2.colorPalette.neutral[30]}`,boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.15)"},((B=(L.slotProps||{}).paper)==null?void 0:B.sx)||{})})}),isOptionEqualToValue:(k,M)=>k.value===M.value,renderOption:(k,M)=>(0,L2.createElement)("li",m(r({},k),{key:M.key||M.value,onClick:H=>{var P;(P=k.onClick)==null||P.call(k,H),$.onChange(M)}}),(0,l1.jsxs)(k1.Grid,{container:!0,direction:"column",children:[(0,l1.jsx)(k1.Grid,{item:!0,children:M.label}),M.afterLabel&&(0,l1.jsx)(k1.Grid,{item:!0,children:M.afterLabel})]})),value:$.value||null,noOptionsText:p||"Nenhuma op\xE7\xE3o encontrada"},L),{renderInput:k=>{var M,H,P;return(0,l1.jsx)(K1.TextField,m(r(r({placeholder:C},k),L.textFieldProps),{error:!!w,InputProps:m(r(r({},k.InputProps),(M=L.textFieldProps)==null?void 0:M.InputProps),{inputRef:$.ref,inputProps:r(r({},k.inputProps),(P=(H=L.textFieldProps)==null?void 0:H.InputProps)==null?void 0:P.inputProps)})}))}}),c),(0,l1.jsx)(q,{name:c,disableIcon:G})]})}})},g2=(0,f2.memo)(J2);0&&(module.exports={Autocomplete,Checkbox,Creatable,DatePicker,Form,FormProvider,RadioButton,RadioGroup,Searchable,Select,Slider,Switch,TextField,TimePicker,useForm});
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Z0=Object.create;var x1=Object.defineProperty,p0=Object.defineProperties,u0=Object.getOwnPropertyDescriptor,M0=Object.getOwnPropertyDescriptors,H0=Object.getOwnPropertyNames,M1=Object.getOwnPropertySymbols,f0=Object.getPrototypeOf,C1=Object.prototype.hasOwnProperty,I1=Object.prototype.propertyIsEnumerable;var B1=(c,a,n)=>a in c?x1(c,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):c[a]=n,e=(c,a)=>{for(var n in a||(a={}))C1.call(a,n)&&B1(c,n,a[n]);if(M1)for(var n of M1(a))I1.call(a,n)&&B1(c,n,a[n]);return c},m=(c,a)=>p0(c,M0(a));var w=(c,a)=>{var n={};for(var s in c)C1.call(c,s)&&a.indexOf(s)<0&&(n[s]=c[s]);if(c!=null&&M1)for(var s of M1(c))a.indexOf(s)<0&&I1.call(c,s)&&(n[s]=c[s]);return n};var E1=(c,a)=>()=>(a||c((a={exports:{}}).exports,a),a.exports);var V0=(c,a,n,s)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of H0(a))!C1.call(c,r)&&r!==n&&x1(c,r,{get:()=>a[r],enumerable:!(s=u0(a,r))||s.enumerable});return c};var G1=(c,a,n)=>(n=c!=null?Z0(f0(c)):{},V0(a||!c||!c.__esModule?x1(n,"default",{value:c,enumerable:!0}):n,c));var o0=E1((w1,D1)=>{(function(c,a){typeof w1=="object"&&typeof D1!="undefined"?D1.exports=a():typeof define=="function"&&define.amd?define(a):(c=typeof globalThis!="undefined"?globalThis:c||self).dayjs=a()})(w1,function(){"use strict";var c=1e3,a=6e4,n=36e5,s="millisecond",r="second",V="minute",p="hour",x="day",F="week",u="month",T="quarter",g="year",L="date",C="Invalid Date",k=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,S=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,P={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var l=["th","st","nd","rd"],i=t%100;return"["+t+(l[(i-20)%10]||l[i]||l[0])+"]"}},D=function(t,l,i){var H=String(t);return!H||H.length>=l?t:""+Array(l+1-H.length).join(i)+t},A={s:D,z:function(t){var l=-t.utcOffset(),i=Math.abs(l),H=Math.floor(i/60),o=i%60;return(l<=0?"+":"-")+D(H,2,"0")+":"+D(o,2,"0")},m:function t(l,i){if(l.date()<i.date())return-t(i,l);var H=12*(i.year()-l.year())+(i.month()-l.month()),o=l.clone().add(H,u),f=i-o<0,h=l.clone().add(H+(f?-1:1),u);return+(-(H+(i-o)/(f?o-h:h-o))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:u,y:g,w:F,d:x,D:L,h:p,m:V,s:r,ms:s,Q:T}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return t===void 0}},M="en",y={};y[M]=P;var _=function(t){return t instanceof b},E=function t(l,i,H){var o;if(!l)return M;if(typeof l=="string"){var f=l.toLowerCase();y[f]&&(o=f),i&&(y[f]=i,o=f);var h=l.split("-");if(!o&&h.length>1)return t(h[0])}else{var v=l.name;y[v]=l,o=v}return!H&&o&&(M=o),o||!H&&M},$=function(t,l){if(_(t))return t.clone();var i=typeof l=="object"?l:{};return i.date=t,i.args=arguments,new b(i)},d=A;d.l=E,d.i=_,d.w=function(t,l){return $(t,{locale:l.$L,utc:l.$u,x:l.$x,$offset:l.$offset})};var b=function(){function t(i){this.$L=E(i.locale,null,!0),this.parse(i)}var l=t.prototype;return l.parse=function(i){this.$d=function(H){var o=H.date,f=H.utc;if(o===null)return new Date(NaN);if(d.u(o))return new Date;if(o instanceof Date)return new Date(o);if(typeof o=="string"&&!/Z$/i.test(o)){var h=o.match(k);if(h){var v=h[2]-1||0,B=(h[7]||"0").substring(0,3);return f?new Date(Date.UTC(h[1],v,h[3]||1,h[4]||0,h[5]||0,h[6]||0,B)):new Date(h[1],v,h[3]||1,h[4]||0,h[5]||0,h[6]||0,B)}}return new Date(o)}(i),this.$x=i.x||{},this.init()},l.init=function(){var i=this.$d;this.$y=i.getFullYear(),this.$M=i.getMonth(),this.$D=i.getDate(),this.$W=i.getDay(),this.$H=i.getHours(),this.$m=i.getMinutes(),this.$s=i.getSeconds(),this.$ms=i.getMilliseconds()},l.$utils=function(){return d},l.isValid=function(){return this.$d.toString()!==C},l.isSame=function(i,H){var o=$(i);return this.startOf(H)<=o&&o<=this.endOf(H)},l.isAfter=function(i,H){return $(i)<this.startOf(H)},l.isBefore=function(i,H){return this.endOf(H)<$(i)},l.$g=function(i,H,o){return d.u(i)?this[H]:this.set(o,i)},l.unix=function(){return Math.floor(this.valueOf()/1e3)},l.valueOf=function(){return this.$d.getTime()},l.startOf=function(i,H){var o=this,f=!!d.u(H)||H,h=d.p(i),v=function(n1,j){var c1=d.w(o.$u?Date.UTC(o.$y,j,n1):new Date(o.$y,j,n1),o);return f?c1:c1.endOf(x)},B=function(n1,j){return d.w(o.toDate()[n1].apply(o.toDate("s"),(f?[0,0,0,0]:[23,59,59,999]).slice(j)),o)},G=this.$W,z=this.$M,X=this.$D,Q="set"+(this.$u?"UTC":"");switch(h){case g:return f?v(1,0):v(31,11);case u:return f?v(1,z):v(0,z+1);case F:var t1=this.$locale().weekStart||0,v1=(G<t1?G+7:G)-t1;return v(f?X-v1:X+(6-v1),z);case x:case L:return B(Q+"Hours",0);case p:return B(Q+"Minutes",1);case V:return B(Q+"Seconds",2);case r:return B(Q+"Milliseconds",3);default:return this.clone()}},l.endOf=function(i){return this.startOf(i,!1)},l.$set=function(i,H){var o,f=d.p(i),h="set"+(this.$u?"UTC":""),v=(o={},o[x]=h+"Date",o[L]=h+"Date",o[u]=h+"Month",o[g]=h+"FullYear",o[p]=h+"Hours",o[V]=h+"Minutes",o[r]=h+"Seconds",o[s]=h+"Milliseconds",o)[f],B=f===x?this.$D+(H-this.$W):H;if(f===u||f===g){var G=this.clone().set(L,1);G.$d[v](B),G.init(),this.$d=G.set(L,Math.min(this.$D,G.daysInMonth())).$d}else v&&this.$d[v](B);return this.init(),this},l.set=function(i,H){return this.clone().$set(i,H)},l.get=function(i){return this[d.p(i)]()},l.add=function(i,H){var o,f=this;i=Number(i);var h=d.p(H),v=function(z){var X=$(f);return d.w(X.date(X.date()+Math.round(z*i)),f)};if(h===u)return this.set(u,this.$M+i);if(h===g)return this.set(g,this.$y+i);if(h===x)return v(1);if(h===F)return v(7);var B=(o={},o[V]=a,o[p]=n,o[r]=c,o)[h]||1,G=this.$d.getTime()+i*B;return d.w(G,this)},l.subtract=function(i,H){return this.add(-1*i,H)},l.format=function(i){var H=this,o=this.$locale();if(!this.isValid())return o.invalidDate||C;var f=i||"YYYY-MM-DDTHH:mm:ssZ",h=d.z(this),v=this.$H,B=this.$m,G=this.$M,z=o.weekdays,X=o.months,Q=function(j,c1,b1,u1){return j&&(j[c1]||j(H,f))||b1[c1].slice(0,u1)},t1=function(j){return d.s(v%12||12,j,"0")},v1=o.meridiem||function(j,c1,b1){var u1=j<12?"AM":"PM";return b1?u1.toLowerCase():u1},n1={YY:String(this.$y).slice(-2),YYYY:this.$y,M:G+1,MM:d.s(G+1,2,"0"),MMM:Q(o.monthsShort,G,X,3),MMMM:Q(X,G),D:this.$D,DD:d.s(this.$D,2,"0"),d:String(this.$W),dd:Q(o.weekdaysMin,this.$W,z,2),ddd:Q(o.weekdaysShort,this.$W,z,3),dddd:z[this.$W],H:String(v),HH:d.s(v,2,"0"),h:t1(1),hh:t1(2),a:v1(v,B,!0),A:v1(v,B,!1),m:String(B),mm:d.s(B,2,"0"),s:String(this.$s),ss:d.s(this.$s,2,"0"),SSS:d.s(this.$ms,3,"0"),Z:h};return f.replace(S,function(j,c1){return c1||n1[j]||h.replace(":","")})},l.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},l.diff=function(i,H,o){var f,h=d.p(H),v=$(i),B=(v.utcOffset()-this.utcOffset())*a,G=this-v,z=d.m(this,v);return z=(f={},f[g]=z/12,f[u]=z,f[T]=z/3,f[F]=(G-B)/6048e5,f[x]=(G-B)/864e5,f[p]=G/n,f[V]=G/a,f[r]=G/c,f)[h]||G,o?z:d.a(z)},l.daysInMonth=function(){return this.endOf(u).$D},l.$locale=function(){return y[this.$L]},l.locale=function(i,H){if(!i)return this.$L;var o=this.clone(),f=E(i,H,!0);return f&&(o.$L=f),o},l.clone=function(){return d.w(this.$d,this)},l.toDate=function(){return new Date(this.valueOf())},l.toJSON=function(){return this.isValid()?this.toISOString():null},l.toISOString=function(){return this.$d.toISOString()},l.toString=function(){return this.$d.toUTCString()},t}(),Z=b.prototype;return $.prototype=Z,[["$ms",s],["$s",r],["$m",V],["$H",p],["$W",x],["$M",u],["$y",g],["$D",L]].forEach(function(t){Z[t[1]]=function(l){return this.$g(l,t[0],t[1])}}),$.extend=function(t,l){return t.$i||(t(l,b,$),t.$i=!0),$},$.locale=E,$.isDayjs=_,$.unix=function(t){return $(1e3*t)},$.en=y[M],$.Ls=y,$.p={},$})});var _1=E1(($1,T1)=>{(function(c,a){typeof $1=="object"&&typeof T1!="undefined"?T1.exports=a(o0()):typeof define=="function"&&define.amd?define(["dayjs"],a):(c=typeof globalThis!="undefined"?globalThis:c||self).dayjs_locale_pt_br=a(c.dayjs)})($1,function(c){"use strict";function a(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var n=a(c),s={name:"pt-br",weekdays:"domingo_segunda-feira_ter\xE7a-feira_quarta-feira_quinta-feira_sexta-feira_s\xE1bado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_s\xE1b".split("_"),weekdaysMin:"Do_2\xAA_3\xAA_4\xAA_5\xAA_6\xAA_S\xE1".split("_"),months:"janeiro_fevereiro_mar\xE7o_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),ordinal:function(r){return r+"\xBA"},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [\xE0s] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [\xE0s] HH:mm"},relativeTime:{future:"em %s",past:"h\xE1 %s",s:"poucos segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um m\xEAs",MM:"%d meses",y:"um ano",yy:"%d anos"}};return n.default.locale(s,null,!0),s})});import{FormProvider as g0}from"react-hook-form";import{jsx as R1}from"react/jsx-runtime";var L0=r=>{var V=r,{children:c,style:a,onSubmit:n}=V,s=w(V,["children","style","onSubmit"]);return R1(g0,m(e({},s),{children:R1("form",{onSubmit:p=>{p.preventDefault(),p.stopPropagation(),n(p)},style:a,children:c})}))},k1=L0;import{useEffect as y0}from"react";import{useForm as b0}from"react-hook-form";import{zodResolver as x0}from"@hookform/resolvers/zod";var C0=s=>{var r=s,{disableDefaultValuesUpdate:c,onSubmit:a}=r,n=w(r,["disableDefaultValuesUpdate","onSubmit"]);let V=b0(m(e({},n),{resolver:n.schema&&x0(n.schema)}));return y0(()=>{c||V.reset(n.defaultValues)},[n.defaultValues,V.reset]),m(e({},V),{onSubmit:V.handleSubmit(p=>a(p,V))})},A1=C0;import{jsx as F0}from"react/jsx-runtime";function k0(s){var r=s,{children:c,style:a}=r,n=w(r,["children","style"]);let V=A1(n);return F0(k1,m(e({},V),{style:a,children:typeof c=="function"?c(V):c}))}var A0=k0;import{memo as T0,useState as _0}from"react";import{Controller as B0,useFormContext as I0}from"react-hook-form";import{Grid as S1,InputAdornment as E0,TextField as G0}from"@mui/material";var U1={description:"M39 23.1a17 17 0 0 0-15-10c-6.5.1-12.4 4-15.2 10V25a17 17 0 0 0 15 10A17 17 0 0 0 39 25c.5-.7.5-1.3.2-1.8Zm-15 9a8 8 0 0 1-7.6-8.5c.2-4.2 3.5-7.8 7.6-7.8a8 8 0 0 1 7.6 8.4c-.1 4.3-3.5 7.9-7.6 7.9Zm0-13.5-1.3.1c.7 1.1.6 2.6-.3 3.7-1 .9-2.3.9-3.4.1-.4 2.2.3 4.7 2.1 6a4.9 4.9 0 0 0 6-.2c1.6-1.4 2.4-4 1.6-6.1a4.9 4.9 0 0 0-4.7-3.6Z",id:"line-eye-solid"},O1={description:"M24 31.7c-4 0-7.4-3.1-7.7-7.1l-5.6-4.4c-.8 1-1.4 2-2 3a1.7 1.7 0 0 0 0 1.6 17.2 17.2 0 0 0 19.5 9l-2.8-2.2-1.4.1ZM40.9 35l-6-4.6c1.8-1.5 3.3-3.4 4.4-5.5a1.7 1.7 0 0 0 0-1.6c-3-5.7-8.7-9.5-15.3-9.5-2.8 0-5.5.7-8 2l-6.8-5.3a.9.9 0 0 0-1.2.2L7 12a.9.9 0 0 0 .1 1.2l31.7 24.5a.9.9 0 0 0 1.2-.2l1-1.3a.9.9 0 0 0-.1-1.2Zm-10-7.7-2-1.6a5 5 0 0 0-6.3-6.6 2.5 2.5 0 0 1 .4 2l-3.9-3a7.7 7.7 0 0 1 10.4.5 7.7 7.7 0 0 1 1.5 8.7Z",id:"line-eye-slash-solid"};var l1={description:"M24 8a16 16 0 0 0 0 32 16 16 0 0 0 0-32Zm0 7.1c1.5 0 2.7 1.2 2.7 2.7 0 1.6-1.2 2.7-2.7 2.7a2.6 2.6 0 0 1-2.7-2.7c0-1.5 1.2-2.7 2.7-2.7Zm3.6 16.4c0 .4-.4.8-.8.8h-5.6a.7.7 0 0 1-.8-.8v-1.6c0-.4.3-.7.8-.7h.7V25h-.7a.7.7 0 0 1-.8-.7v-1.6c0-.4.3-.8.8-.8h4c.5 0 .9.4.9.8v6.5h.7c.4 0 .8.3.8.7v1.6Z",id:"line-info-circle-solid"};var q1={description:"m25.5 17 5.5 5.5-12 12-4.9.5a1 1 0 0 1-1-1.1l.5-5L25.5 17Zm8.9-.8-2.6-2.6a2 2 0 0 0-2.9 0L26.5 16l5.5 5.5 2.4-2.4a2 2 0 0 0 0-3Z",id:"line-pen-solid"};var F1={description:"M35.8 21.8h-9.6v-9.6c0-.6-.6-1.1-1.1-1.1h-2.2a1 1 0 0 0-1 1v9.7h-9.7c-.6 0-1.1.6-1.1 1.1v2.2c0 .6.5 1 1 1h9.7v9.7c0 .6.5 1.1 1.1 1.1h2.2c.5 0 1-.5 1-1v-9.7h9.7c.6 0 1.1-.5 1.1-1.1v-2.2c0-.5-.5-1-1-1Z",id:"line-plus-solid"};import*as h1 from"@s_mart/masks";import{Typography as z1}from"@mui/material";import{toRem as S0}from"@s_mart/utils";import{jsx as Y1,jsxs as P0}from"react/jsx-runtime";var R=({label:c,required:a,regular:n})=>P0("span",{style:{display:"flex",alignItems:"center",gap:S0(2)},children:[Y1(z1,{variant:"caption",fontWeight:n?400:700,style:{display:"flex",alignItems:"center"},children:c}),a&&Y1(z1,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});import{useFormContext as w0}from"react-hook-form";import{Indicator as D0}from"@s_mart/core";var Y=(c,a)=>a.replace(/[[\]]/g,"").split(".").reduce((s,r)=>s==null?void 0:s[r],c);import{jsx as $0}from"react/jsx-runtime";var U=({name:c,disableIcon:a})=>{var r;let n=w0(),s=Y((r=n==null?void 0:n.formState)==null?void 0:r.errors,c);return s?$0(D0,{severity:"error",icon:a?!1:void 0,children:s==null?void 0:s.message}):null};import{LIcon as j1,Tooltip as R0}from"@s_mart/core";import{jsx as W,jsxs as W1}from"react/jsx-runtime";var U0=S=>{var P=S,{name:c,rules:a,defaultValue:n,shouldUnregister:s,label:r,required:V,mask:p,variant:x="outlined",info:F,parse:u,inputMode:T,format:g,onInputChange:L,disableIconError:C}=P,k=w(P,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","info","parse","inputMode","format","onInputChange","disableIconError"]);let D=I0();if(!D)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[A,M]=_0(!1),y=d=>{var Z;let b=d;return g&&(b=g(d)),p?(Z=h1==null?void 0:h1[p])==null?void 0:Z.format(b):b},_=d=>{var Z;let b=d;return u&&(b=u(d)),p?(Z=h1==null?void 0:h1[p])==null?void 0:Z.parse(b):b},E=d=>{if(!d||p!=="porcentagem"&&p!=="porcentagem0")return;d==null||d.stopPropagation();let b=(d==null?void 0:d.target).value;if(b){let Z=String(b);if(Z.length>0){let t=Z.indexOf("%");t>-1&&(d.currentTarget.selectionEnd=t)}}},$=Y(D.formState.errors,c);return W(B0,{control:D.control,name:c,rules:a,defaultValue:n,shouldUnregister:s,render:({field:{value:d,onChange:b,ref:Z}})=>W1(S1,{display:"flex",flexDirection:"column",children:[W1("div",{style:{display:"flex"},children:[r&&W(S1,{item:!0,children:W(R,{label:r,required:V})}),F&&W(S1,{item:!0,children:W(R0,{title:F,placement:"top",children:W("div",{style:{width:"fit-content"},children:W(j1,{icon:l1,color:"#757575"})})})})]}),W(G0,m(e({variant:x,defaultValue:n,value:y(d||(d!=0?"":d)),onChange:t=>{var i;let l=_((i=t==null?void 0:t.target)==null?void 0:i.value);b(l),L==null||L(l,D.getValues())},error:!!$},k),{type:k.type==="password"?A?"text":"password":k.type,autoComplete:k.autoComplete||"off",inputProps:e({inputMode:T},k.inputProps),InputProps:e({onKeyDown:E,inputRef:Z,endAdornment:k.type==="password"&&W(E0,{position:"start",onClick:()=>M(!A),style:{cursor:"pointer"},children:W(j1,{icon:A?U1:O1,size:"24px",removeMargin:!0})})},k.InputProps)}),c),W(U,{name:c,disableIcon:C})]})})},O0=T0(U0);import{memo as q0,useState as z0}from"react";import{Controller as Y0,useFormContext as j0}from"react-hook-form";import{Divider as W0,IconButton as N0,LIcon as J1,Tooltip as J0}from"@s_mart/core";var N1={description:"m27.4 24.4 7-7c.4-.4.4-1 0-1.5l-1.6-1.6a1 1 0 0 0-1.5 0l-7 7-7-7a1 1 0 0 0-1.4 0l-1.6 1.6a1 1 0 0 0 0 1.5l7 7-7 7a1 1 0 0 0 0 1.4l1.6 1.6c.4.4 1 .4 1.5 0l7-7 7 7c.3.4 1 .4 1.4 0l1.6-1.6c.4-.4.4-1 0-1.5l-7-7Z",id:"line-times-regular"};import{colorPalette as K0}from"@s_mart/tokens";import{Grid as i1,Select as Q0,MenuItem as K1,useTheme as X0}from"@mui/material";import{Fragment as a2,jsx as O,jsxs as d1}from"react/jsx-runtime";var c2=P=>{var D=P,{name:c,rules:a,defaultValue:n,shouldUnregister:s,label:r,required:V,options:p,placeholder:x,clearable:F,disableOnChangeForm:u=!1,multiple:T,info:g,footer:L,onChange:C,disableIconError:k}=D,S=w(D,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","clearable","disableOnChangeForm","multiple","info","footer","onChange","disableIconError"]);let A=j0(),{palette:M}=X0(),[y,_]=z0(!1);if(!A)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let E=Y(A.formState.errors,c);return console.warn=()=>{},O(Y0,{control:A.control,name:c,rules:a,defaultValue:n,shouldUnregister:s,render:({field:{value:$,onChange:d,ref:b}})=>d1(i1,{display:"flex",flexDirection:"column",children:[d1("div",{style:{display:"flex"},children:[r&&O(i1,{item:!0,children:O(R,{label:r,required:V})}),g&&O(i1,{item:!0,children:O(J0,{title:g,placement:"top",children:O("div",{style:{width:"fit-content"},children:O(J1,{icon:l1,color:"#757575"})})})})]}),d1(Q0,m(e({open:y,onOpen:()=>_(!0),onClose:()=>_(!1),displayEmpty:!!x,variant:"outlined",autoComplete:"off",value:$?$||"":T?[]:"",renderValue:Z=>{if(Z.label)return Z.label;if(x)return O("p",{style:{color:M.grey[400]},children:x})},multiple:T,onChange:Z=>{!u&&d(Z.target.value),C&&C(Z.target.value,A.getValues())},error:!!E,size:S.size||"medium",inputRef:b},S),{endAdornment:d1(a2,{children:[S.endAdornment,!!(F&&$)&&O(N0,{variant:"text",color:"neutral",size:"small",sx:{borderRadius:"50%",position:"absolute",right:"2rem"},style:{padding:0},"aria-label":"Clear",title:"Clear",onClick:()=>{!u&&d(null),C&&C(null,A.getValues())},children:O(J1,{icon:N1,color:K0.neutral[100],size:"25px",removeMargin:!0})})]}),children:[x&&O(K1,{disabled:!0,value:"",children:O("p",{style:{color:M.grey[400]},children:x})}),p==null?void 0:p.map((Z,t)=>O(K1,{value:Z,children:d1(i1,{container:!0,direction:"column",children:[O(i1,{item:!0,children:Z.label}),Z.afterLabel&&O(i1,{item:!0,children:Z.afterLabel})]})},t)),L&&[O(i1,{px:2,py:1,children:O(W0,{})},"footer-divider"),O("div",{children:L({closeSelect:()=>_(!1)})},"footer-content")]]}),c),O(U,{name:c,disableIcon:k})]})})},l2=q0(c2);import{forwardRef as i2,memo as e2}from"react";import{Controller as r2,useFormContext as o2}from"react-hook-form";import{Grid as a1,Autocomplete as n2,TextField as h2}from"@mui/material";import{Divider as Q1,LIcon as s2,Tooltip as t2}from"@s_mart/core";import{colorPalette as v2}from"@s_mart/tokens";import{Fragment as H1,jsx as q,jsxs as e1}from"react/jsx-runtime";import{createElement as X1}from"react";var d2=D=>{var A=D,{name:c,rules:a,defaultValue:n,shouldUnregister:s,label:r,required:V,options:p,textFieldProps:x,noOptionsText:F,footer:u,multiple:T,info:g,placeholder:L,onChange:C,onInputChange:k,disableIconError:S}=A,P=w(A,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText","footer","multiple","info","placeholder","onChange","onInputChange","disableIconError"]);let M=o2();if(!M)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let y=Y(M.formState.errors,c);return console.warn=()=>{},q(r2,{control:M.control,name:c,rules:a,defaultValue:n,shouldUnregister:s,render:({field:{onChange:_,value:E,ref:$}})=>{var d;return e1(a1,{display:"flex",flexDirection:"column",children:[e1("div",{style:{display:"flex"},children:[r&&q(a1,{item:!0,children:q(R,{label:r,required:V})}),g&&q(a1,{item:!0,children:q(t2,{title:g,placement:"top",children:q("div",{style:{width:"fit-content"},children:q(s2,{icon:l1,color:"#757575"})})})})]}),q(n2,m(e({onChange:(b,Z)=>{_(Z),C==null||C(Z,M.getValues())},onInputChange:(b,Z,t)=>{t==="input"&&setTimeout(()=>{k==null||k(Z,M.getValues())},0)},slotProps:m(e({},P.slotProps||{}),{paper:m(e({},(P.slotProps||{}).paper||{}),{sx:e({border:`1px solid ${v2.neutral[30]}`,boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.15)"},((d=(P.slotProps||{}).paper)==null?void 0:d.sx)||{})})}),value:E||(T?[]:null),options:p,multiple:T,noOptionsText:e1(H1,{children:[F||"Nenhum resultado encontrado",u?e1(H1,{children:[q(a1,{py:1,children:q(Q1,{})}),u]}):null]}),isOptionEqualToValue:(b,Z)=>typeof b=="string"&&typeof Z=="string"?b===Z:typeof b=="object"&&typeof Z=="object"?typeof b.value=="object"&&typeof Z.value=="object"&&b.key!==void 0&&Z.key!==void 0?b.key===Z.key:b.value===Z.value:!1,renderOption:(b,Z)=>typeof Z=="object"?X1("li",m(e({},b),{key:Z.key||Z.value}),e1(a1,{container:!0,direction:"column",children:[q(a1,{item:!0,children:Z.label}),Z.afterLabel&&q(a1,{item:!0,children:Z.afterLabel})]})):X1("li",m(e({},b),{key:Z}),Z),ListboxComponent:i2(function(Z,t){return e1(H1,{children:[q("ul",m(e({},Z),{ref:t})),!!u&&q("div",m(e({},Z),{children:e1(H1,{children:[q(a1,{px:2,py:1,children:q(Q1,{})}),u]})}),"searchable-footer")]})})},P),{renderInput:b=>q(h2,m(e(e({error:!!y,placeholder:L},b),x),{inputRef:$}))}),c),q(U,{name:c,disableIcon:S})]})}})},m2=e2(d2);import{forwardRef as u2,memo as M2}from"react";import{Controller as H2,useFormContext as f2}from"react-hook-form";import{isObject as V2,isEmpty as g2}from"lodash";import{Grid as r1,Autocomplete as L2,TextField as y2}from"@mui/material";import{LIcon as V1,Tooltip as b2,Button as x2,Divider as C2}from"@s_mart/core";import{colorPalette as k2}from"@s_mart/tokens";import{toRem as i0}from"@s_mart/utils";import{toRem as f1}from"@s_mart/utils";import Z2 from"@emotion/styled";import{css as c0}from"@emotion/react";var l0=c0`
|
|
1
|
+
var Z0=Object.create;var x1=Object.defineProperty,p0=Object.defineProperties,u0=Object.getOwnPropertyDescriptor,M0=Object.getOwnPropertyDescriptors,H0=Object.getOwnPropertyNames,M1=Object.getOwnPropertySymbols,f0=Object.getPrototypeOf,C1=Object.prototype.hasOwnProperty,I1=Object.prototype.propertyIsEnumerable;var B1=(c,a,n)=>a in c?x1(c,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):c[a]=n,r=(c,a)=>{for(var n in a||(a={}))C1.call(a,n)&&B1(c,n,a[n]);if(M1)for(var n of M1(a))I1.call(a,n)&&B1(c,n,a[n]);return c},m=(c,a)=>p0(c,M0(a));var D=(c,a)=>{var n={};for(var s in c)C1.call(c,s)&&a.indexOf(s)<0&&(n[s]=c[s]);if(c!=null&&M1)for(var s of M1(c))a.indexOf(s)<0&&I1.call(c,s)&&(n[s]=c[s]);return n};var E1=(c,a)=>()=>(a||c((a={exports:{}}).exports,a),a.exports);var V0=(c,a,n,s)=>{if(a&&typeof a=="object"||typeof a=="function")for(let e of H0(a))!C1.call(c,e)&&e!==n&&x1(c,e,{get:()=>a[e],enumerable:!(s=u0(a,e))||s.enumerable});return c};var G1=(c,a,n)=>(n=c!=null?Z0(f0(c)):{},V0(a||!c||!c.__esModule?x1(n,"default",{value:c,enumerable:!0}):n,c));var o0=E1((P1,D1)=>{(function(c,a){typeof P1=="object"&&typeof D1!="undefined"?D1.exports=a():typeof define=="function"&&define.amd?define(a):(c=typeof globalThis!="undefined"?globalThis:c||self).dayjs=a()})(P1,function(){"use strict";var c=1e3,a=6e4,n=36e5,s="millisecond",e="second",g="minute",p="hour",x="day",k="week",u="month",B="quarter",L="year",y="date",C="Invalid Date",A=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,S=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,P={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var l=["th","st","nd","rd"],i=t%100;return"["+t+(l[(i-20)%10]||l[i]||l[0])+"]"}},T=function(t,l,i){var f=String(t);return!f||f.length>=l?t:""+Array(l+1-f.length).join(i)+t},F={s:T,z:function(t){var l=-t.utcOffset(),i=Math.abs(l),f=Math.floor(i/60),o=i%60;return(l<=0?"+":"-")+T(f,2,"0")+":"+T(o,2,"0")},m:function t(l,i){if(l.date()<i.date())return-t(i,l);var f=12*(i.year()-l.year())+(i.month()-l.month()),o=l.clone().add(f,u),V=i-o<0,h=l.clone().add(f+(V?-1:1),u);return+(-(f+(i-o)/(V?o-h:h-o))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:u,y:L,w:k,d:x,D:y,h:p,m:g,s:e,ms:s,Q:B}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return t===void 0}},M="en",H={};H[M]=P;var w=function(t){return t instanceof b},$=function t(l,i,f){var o;if(!l)return M;if(typeof l=="string"){var V=l.toLowerCase();H[V]&&(o=V),i&&(H[V]=i,o=V);var h=l.split("-");if(!o&&h.length>1)return t(h[0])}else{var v=l.name;H[v]=l,o=v}return!f&&o&&(M=o),o||!f&&M},_=function(t,l){if(w(t))return t.clone();var i=typeof l=="object"?l:{};return i.date=t,i.args=arguments,new b(i)},d=F;d.l=$,d.i=w,d.w=function(t,l){return _(t,{locale:l.$L,utc:l.$u,x:l.$x,$offset:l.$offset})};var b=function(){function t(i){this.$L=$(i.locale,null,!0),this.parse(i)}var l=t.prototype;return l.parse=function(i){this.$d=function(f){var o=f.date,V=f.utc;if(o===null)return new Date(NaN);if(d.u(o))return new Date;if(o instanceof Date)return new Date(o);if(typeof o=="string"&&!/Z$/i.test(o)){var h=o.match(A);if(h){var v=h[2]-1||0,I=(h[7]||"0").substring(0,3);return V?new Date(Date.UTC(h[1],v,h[3]||1,h[4]||0,h[5]||0,h[6]||0,I)):new Date(h[1],v,h[3]||1,h[4]||0,h[5]||0,h[6]||0,I)}}return new Date(o)}(i),this.$x=i.x||{},this.init()},l.init=function(){var i=this.$d;this.$y=i.getFullYear(),this.$M=i.getMonth(),this.$D=i.getDate(),this.$W=i.getDay(),this.$H=i.getHours(),this.$m=i.getMinutes(),this.$s=i.getSeconds(),this.$ms=i.getMilliseconds()},l.$utils=function(){return d},l.isValid=function(){return this.$d.toString()!==C},l.isSame=function(i,f){var o=_(i);return this.startOf(f)<=o&&o<=this.endOf(f)},l.isAfter=function(i,f){return _(i)<this.startOf(f)},l.isBefore=function(i,f){return this.endOf(f)<_(i)},l.$g=function(i,f,o){return d.u(i)?this[f]:this.set(o,i)},l.unix=function(){return Math.floor(this.valueOf()/1e3)},l.valueOf=function(){return this.$d.getTime()},l.startOf=function(i,f){var o=this,V=!!d.u(f)||f,h=d.p(i),v=function(n1,j){var c1=d.w(o.$u?Date.UTC(o.$y,j,n1):new Date(o.$y,j,n1),o);return V?c1:c1.endOf(x)},I=function(n1,j){return d.w(o.toDate()[n1].apply(o.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(j)),o)},G=this.$W,z=this.$M,X=this.$D,Q="set"+(this.$u?"UTC":"");switch(h){case L:return V?v(1,0):v(31,11);case u:return V?v(1,z):v(0,z+1);case k:var t1=this.$locale().weekStart||0,v1=(G<t1?G+7:G)-t1;return v(V?X-v1:X+(6-v1),z);case x:case y:return I(Q+"Hours",0);case p:return I(Q+"Minutes",1);case g:return I(Q+"Seconds",2);case e:return I(Q+"Milliseconds",3);default:return this.clone()}},l.endOf=function(i){return this.startOf(i,!1)},l.$set=function(i,f){var o,V=d.p(i),h="set"+(this.$u?"UTC":""),v=(o={},o[x]=h+"Date",o[y]=h+"Date",o[u]=h+"Month",o[L]=h+"FullYear",o[p]=h+"Hours",o[g]=h+"Minutes",o[e]=h+"Seconds",o[s]=h+"Milliseconds",o)[V],I=V===x?this.$D+(f-this.$W):f;if(V===u||V===L){var G=this.clone().set(y,1);G.$d[v](I),G.init(),this.$d=G.set(y,Math.min(this.$D,G.daysInMonth())).$d}else v&&this.$d[v](I);return this.init(),this},l.set=function(i,f){return this.clone().$set(i,f)},l.get=function(i){return this[d.p(i)]()},l.add=function(i,f){var o,V=this;i=Number(i);var h=d.p(f),v=function(z){var X=_(V);return d.w(X.date(X.date()+Math.round(z*i)),V)};if(h===u)return this.set(u,this.$M+i);if(h===L)return this.set(L,this.$y+i);if(h===x)return v(1);if(h===k)return v(7);var I=(o={},o[g]=a,o[p]=n,o[e]=c,o)[h]||1,G=this.$d.getTime()+i*I;return d.w(G,this)},l.subtract=function(i,f){return this.add(-1*i,f)},l.format=function(i){var f=this,o=this.$locale();if(!this.isValid())return o.invalidDate||C;var V=i||"YYYY-MM-DDTHH:mm:ssZ",h=d.z(this),v=this.$H,I=this.$m,G=this.$M,z=o.weekdays,X=o.months,Q=function(j,c1,b1,u1){return j&&(j[c1]||j(f,V))||b1[c1].slice(0,u1)},t1=function(j){return d.s(v%12||12,j,"0")},v1=o.meridiem||function(j,c1,b1){var u1=j<12?"AM":"PM";return b1?u1.toLowerCase():u1},n1={YY:String(this.$y).slice(-2),YYYY:this.$y,M:G+1,MM:d.s(G+1,2,"0"),MMM:Q(o.monthsShort,G,X,3),MMMM:Q(X,G),D:this.$D,DD:d.s(this.$D,2,"0"),d:String(this.$W),dd:Q(o.weekdaysMin,this.$W,z,2),ddd:Q(o.weekdaysShort,this.$W,z,3),dddd:z[this.$W],H:String(v),HH:d.s(v,2,"0"),h:t1(1),hh:t1(2),a:v1(v,I,!0),A:v1(v,I,!1),m:String(I),mm:d.s(I,2,"0"),s:String(this.$s),ss:d.s(this.$s,2,"0"),SSS:d.s(this.$ms,3,"0"),Z:h};return V.replace(S,function(j,c1){return c1||n1[j]||h.replace(":","")})},l.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},l.diff=function(i,f,o){var V,h=d.p(f),v=_(i),I=(v.utcOffset()-this.utcOffset())*a,G=this-v,z=d.m(this,v);return z=(V={},V[L]=z/12,V[u]=z,V[B]=z/3,V[k]=(G-I)/6048e5,V[x]=(G-I)/864e5,V[p]=G/n,V[g]=G/a,V[e]=G/c,V)[h]||G,o?z:d.a(z)},l.daysInMonth=function(){return this.endOf(u).$D},l.$locale=function(){return H[this.$L]},l.locale=function(i,f){if(!i)return this.$L;var o=this.clone(),V=$(i,f,!0);return V&&(o.$L=V),o},l.clone=function(){return d.w(this.$d,this)},l.toDate=function(){return new Date(this.valueOf())},l.toJSON=function(){return this.isValid()?this.toISOString():null},l.toISOString=function(){return this.$d.toISOString()},l.toString=function(){return this.$d.toUTCString()},t}(),Z=b.prototype;return _.prototype=Z,[["$ms",s],["$s",e],["$m",g],["$H",p],["$W",x],["$M",u],["$y",L],["$D",y]].forEach(function(t){Z[t[1]]=function(l){return this.$g(l,t[0],t[1])}}),_.extend=function(t,l){return t.$i||(t(l,b,_),t.$i=!0),_},_.locale=$,_.isDayjs=w,_.unix=function(t){return _(1e3*t)},_.en=H[M],_.Ls=H,_.p={},_})});var _1=E1(($1,T1)=>{(function(c,a){typeof $1=="object"&&typeof T1!="undefined"?T1.exports=a(o0()):typeof define=="function"&&define.amd?define(["dayjs"],a):(c=typeof globalThis!="undefined"?globalThis:c||self).dayjs_locale_pt_br=a(c.dayjs)})($1,function(c){"use strict";function a(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var n=a(c),s={name:"pt-br",weekdays:"domingo_segunda-feira_ter\xE7a-feira_quarta-feira_quinta-feira_sexta-feira_s\xE1bado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_s\xE1b".split("_"),weekdaysMin:"Do_2\xAA_3\xAA_4\xAA_5\xAA_6\xAA_S\xE1".split("_"),months:"janeiro_fevereiro_mar\xE7o_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),ordinal:function(e){return e+"\xBA"},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [\xE0s] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [\xE0s] HH:mm"},relativeTime:{future:"em %s",past:"h\xE1 %s",s:"poucos segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um m\xEAs",MM:"%d meses",y:"um ano",yy:"%d anos"}};return n.default.locale(s,null,!0),s})});import{FormProvider as g0}from"react-hook-form";import{jsx as R1}from"react/jsx-runtime";var L0=e=>{var g=e,{children:c,style:a,onSubmit:n}=g,s=D(g,["children","style","onSubmit"]);return R1(g0,m(r({},s),{children:R1("form",{onSubmit:p=>{p.preventDefault(),p.stopPropagation(),n(p)},style:a,children:c})}))},A1=L0;import{useEffect as y0}from"react";import{useForm as b0}from"react-hook-form";import{zodResolver as x0}from"@hookform/resolvers/zod";var C0=s=>{var e=s,{disableDefaultValuesUpdate:c,onSubmit:a}=e,n=D(e,["disableDefaultValuesUpdate","onSubmit"]);let g=b0(m(r({},n),{resolver:n.schema&&x0(n.schema)}));return y0(()=>{c||g.reset(n.defaultValues)},[n.defaultValues,g.reset]),m(r({},g),{onSubmit:g.handleSubmit(p=>a(p,g))})},F1=C0;import{jsx as k0}from"react/jsx-runtime";function A0(s){var e=s,{children:c,style:a}=e,n=D(e,["children","style"]);let g=F1(n);return k0(A1,m(r({},g),{style:a,children:typeof c=="function"?c(g):c}))}var F0=A0;import{memo as T0,useState as _0}from"react";import{Controller as B0,useFormContext as I0}from"react-hook-form";import{Grid as S1,InputAdornment as E0,TextField as G0}from"@mui/material";var U1={description:"M39 23.1a17 17 0 0 0-15-10c-6.5.1-12.4 4-15.2 10V25a17 17 0 0 0 15 10A17 17 0 0 0 39 25c.5-.7.5-1.3.2-1.8Zm-15 9a8 8 0 0 1-7.6-8.5c.2-4.2 3.5-7.8 7.6-7.8a8 8 0 0 1 7.6 8.4c-.1 4.3-3.5 7.9-7.6 7.9Zm0-13.5-1.3.1c.7 1.1.6 2.6-.3 3.7-1 .9-2.3.9-3.4.1-.4 2.2.3 4.7 2.1 6a4.9 4.9 0 0 0 6-.2c1.6-1.4 2.4-4 1.6-6.1a4.9 4.9 0 0 0-4.7-3.6Z",id:"line-eye-solid"},O1={description:"M24 31.7c-4 0-7.4-3.1-7.7-7.1l-5.6-4.4c-.8 1-1.4 2-2 3a1.7 1.7 0 0 0 0 1.6 17.2 17.2 0 0 0 19.5 9l-2.8-2.2-1.4.1ZM40.9 35l-6-4.6c1.8-1.5 3.3-3.4 4.4-5.5a1.7 1.7 0 0 0 0-1.6c-3-5.7-8.7-9.5-15.3-9.5-2.8 0-5.5.7-8 2l-6.8-5.3a.9.9 0 0 0-1.2.2L7 12a.9.9 0 0 0 .1 1.2l31.7 24.5a.9.9 0 0 0 1.2-.2l1-1.3a.9.9 0 0 0-.1-1.2Zm-10-7.7-2-1.6a5 5 0 0 0-6.3-6.6 2.5 2.5 0 0 1 .4 2l-3.9-3a7.7 7.7 0 0 1 10.4.5 7.7 7.7 0 0 1 1.5 8.7Z",id:"line-eye-slash-solid"};var l1={description:"M24 8a16 16 0 0 0 0 32 16 16 0 0 0 0-32Zm0 7.1c1.5 0 2.7 1.2 2.7 2.7 0 1.6-1.2 2.7-2.7 2.7a2.6 2.6 0 0 1-2.7-2.7c0-1.5 1.2-2.7 2.7-2.7Zm3.6 16.4c0 .4-.4.8-.8.8h-5.6a.7.7 0 0 1-.8-.8v-1.6c0-.4.3-.7.8-.7h.7V25h-.7a.7.7 0 0 1-.8-.7v-1.6c0-.4.3-.8.8-.8h4c.5 0 .9.4.9.8v6.5h.7c.4 0 .8.3.8.7v1.6Z",id:"line-info-circle-solid"};var q1={description:"m25.5 17 5.5 5.5-12 12-4.9.5a1 1 0 0 1-1-1.1l.5-5L25.5 17Zm8.9-.8-2.6-2.6a2 2 0 0 0-2.9 0L26.5 16l5.5 5.5 2.4-2.4a2 2 0 0 0 0-3Z",id:"line-pen-solid"};var k1={description:"M35.8 21.8h-9.6v-9.6c0-.6-.6-1.1-1.1-1.1h-2.2a1 1 0 0 0-1 1v9.7h-9.7c-.6 0-1.1.6-1.1 1.1v2.2c0 .6.5 1 1 1h9.7v9.7c0 .6.5 1.1 1.1 1.1h2.2c.5 0 1-.5 1-1v-9.7h9.7c.6 0 1.1-.5 1.1-1.1v-2.2c0-.5-.5-1-1-1Z",id:"line-plus-solid"};import*as h1 from"@s_mart/masks";import{Typography as z1}from"@mui/material";import{toRem as S0}from"@s_mart/utils";import{jsx as Y1,jsxs as w0}from"react/jsx-runtime";var R=({label:c,required:a,regular:n})=>w0("span",{style:{display:"flex",alignItems:"center",gap:S0(2)},children:[Y1(z1,{variant:"caption",fontWeight:n?400:700,style:{display:"flex",alignItems:"center"},children:c}),a&&Y1(z1,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});import{useFormContext as P0}from"react-hook-form";import{Indicator as D0}from"@s_mart/core";var Y=(c,a)=>a.replace(/[[\]]/g,"").split(".").reduce((s,e)=>s==null?void 0:s[e],c);import{jsx as $0}from"react/jsx-runtime";var U=({name:c,disableIcon:a})=>{var e;let n=P0(),s=Y((e=n==null?void 0:n.formState)==null?void 0:e.errors,c);return s?$0(D0,{severity:"error",icon:a?!1:void 0,children:s==null?void 0:s.message}):null};import{LIcon as j1,Tooltip as R0}from"@s_mart/core";import{jsx as W,jsxs as W1}from"react/jsx-runtime";var U0=S=>{var P=S,{name:c,rules:a,defaultValue:n,shouldUnregister:s,label:e,required:g,mask:p,variant:x="outlined",info:k,parse:u,inputMode:B,format:L,onInputChange:y,disableIconError:C}=P,A=D(P,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","info","parse","inputMode","format","onInputChange","disableIconError"]);let T=I0();if(!T)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[F,M]=_0(!1),H=d=>{var Z;let b=d;return L&&(b=L(d)),p?(Z=h1==null?void 0:h1[p])==null?void 0:Z.format(b):b},w=d=>{var Z;let b=d;return u&&(b=u(d)),p?(Z=h1==null?void 0:h1[p])==null?void 0:Z.parse(b):b},$=d=>{if(!d||p!=="porcentagem"&&p!=="porcentagem0")return;d==null||d.stopPropagation();let b=(d==null?void 0:d.target).value;if(b){let Z=String(b);if(Z.length>0){let t=Z.indexOf("%");t>-1&&(d.currentTarget.selectionEnd=t)}}},_=Y(T.formState.errors,c);return W(B0,{control:T.control,name:c,rules:a,defaultValue:n,shouldUnregister:s,render:({field:{value:d,onChange:b,ref:Z}})=>W1(S1,{display:"flex",flexDirection:"column",children:[W1("div",{style:{display:"flex"},children:[e&&W(S1,{item:!0,children:W(R,{label:e,required:g})}),k&&W(S1,{item:!0,children:W(R0,{title:k,placement:"top",children:W("div",{style:{width:"fit-content"},children:W(j1,{icon:l1,color:"#757575"})})})})]}),W(G0,m(r({variant:x,defaultValue:n,value:H(d||(d!=0?"":d)),onChange:t=>{var i;let l=w((i=t==null?void 0:t.target)==null?void 0:i.value);b(l),y==null||y(l,T.getValues())},error:!!_},A),{type:A.type==="password"?F?"text":"password":A.type,autoComplete:A.autoComplete||"off",inputProps:r({inputMode:B},A.inputProps),InputProps:r({onKeyDown:$,inputRef:Z,endAdornment:A.type==="password"&&W(E0,{position:"start",onClick:()=>M(!F),style:{cursor:"pointer"},children:W(j1,{icon:F?U1:O1,size:"24px",removeMargin:!0})})},A.InputProps)}),c),W(U,{name:c,disableIcon:C})]})})},O0=T0(U0);import{memo as q0,useState as z0}from"react";import{Controller as Y0,useFormContext as j0}from"react-hook-form";import{Divider as W0,IconButton as N0,LIcon as J1,Tooltip as J0}from"@s_mart/core";var N1={description:"m27.4 24.4 7-7c.4-.4.4-1 0-1.5l-1.6-1.6a1 1 0 0 0-1.5 0l-7 7-7-7a1 1 0 0 0-1.4 0l-1.6 1.6a1 1 0 0 0 0 1.5l7 7-7 7a1 1 0 0 0 0 1.4l1.6 1.6c.4.4 1 .4 1.5 0l7-7 7 7c.3.4 1 .4 1.4 0l1.6-1.6c.4-.4.4-1 0-1.5l-7-7Z",id:"line-times-regular"};import{colorPalette as K0}from"@s_mart/tokens";import{Grid as i1,Select as Q0,MenuItem as K1,useTheme as X0}from"@mui/material";import{Fragment as a2,jsx as O,jsxs as d1}from"react/jsx-runtime";var c2=P=>{var T=P,{name:c,rules:a,defaultValue:n,shouldUnregister:s,label:e,required:g,options:p,placeholder:x,clearable:k,disableOnChangeForm:u=!1,multiple:B,info:L,footer:y,onChange:C,disableIconError:A}=T,S=D(T,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","clearable","disableOnChangeForm","multiple","info","footer","onChange","disableIconError"]);let F=j0(),{palette:M}=X0(),[H,w]=z0(!1);if(!F)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let $=Y(F.formState.errors,c);return console.warn=()=>{},O(Y0,{control:F.control,name:c,rules:a,defaultValue:n,shouldUnregister:s,render:({field:{value:_,onChange:d,ref:b}})=>d1(i1,{display:"flex",flexDirection:"column",children:[d1("div",{style:{display:"flex"},children:[e&&O(i1,{item:!0,children:O(R,{label:e,required:g})}),L&&O(i1,{item:!0,children:O(J0,{title:L,placement:"top",children:O("div",{style:{width:"fit-content"},children:O(J1,{icon:l1,color:"#757575"})})})})]}),d1(Q0,m(r({open:H,onOpen:()=>w(!0),onClose:()=>w(!1),displayEmpty:!!x,variant:"outlined",autoComplete:"off",value:_?_||"":B?[]:"",renderValue:Z=>{if(Z.label)return Z.label;if(x)return O("p",{style:{color:M.grey[400]},children:x})},multiple:B,onChange:Z=>{!u&&d(Z.target.value),C&&C(Z.target.value,F.getValues())},error:!!$,size:S.size||"medium",inputRef:b},S),{endAdornment:d1(a2,{children:[S.endAdornment,!!(k&&_)&&O(N0,{variant:"text",color:"neutral",size:"small",sx:{borderRadius:"50%",position:"absolute",right:"2rem"},style:{padding:0},"aria-label":"Clear",title:"Clear",onClick:()=>{!u&&d(null),C&&C(null,F.getValues())},children:O(J1,{icon:N1,color:K0.neutral[100],size:"25px",removeMargin:!0})})]}),children:[x&&O(K1,{disabled:!0,value:"",children:O("p",{style:{color:M.grey[400]},children:x})}),p==null?void 0:p.map((Z,t)=>O(K1,{value:Z,children:d1(i1,{container:!0,direction:"column",children:[O(i1,{item:!0,children:Z.label}),Z.afterLabel&&O(i1,{item:!0,children:Z.afterLabel})]})},t)),y&&[O(i1,{px:2,py:1,children:O(W0,{})},"footer-divider"),O("div",{children:y({closeSelect:()=>w(!1)})},"footer-content")]]}),c),O(U,{name:c,disableIcon:A})]})})},l2=q0(c2);import{forwardRef as i2,memo as e2}from"react";import{Controller as r2,useFormContext as o2}from"react-hook-form";import{Grid as a1,Autocomplete as n2,TextField as h2}from"@mui/material";import{Divider as Q1,LIcon as s2,Tooltip as t2}from"@s_mart/core";import{colorPalette as v2}from"@s_mart/tokens";import{Fragment as H1,jsx as q,jsxs as e1}from"react/jsx-runtime";import{createElement as X1}from"react";var d2=T=>{var F=T,{name:c,rules:a,defaultValue:n,shouldUnregister:s,label:e,required:g,options:p,textFieldProps:x,noOptionsText:k,footer:u,multiple:B,info:L,placeholder:y,onChange:C,onInputChange:A,disableIconError:S}=F,P=D(F,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText","footer","multiple","info","placeholder","onChange","onInputChange","disableIconError"]);let M=o2();if(!M)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let H=Y(M.formState.errors,c);return console.warn=()=>{},q(r2,{control:M.control,name:c,rules:a,defaultValue:n,shouldUnregister:s,render:({field:{onChange:w,value:$,ref:_}})=>{var d;return e1(a1,{display:"flex",flexDirection:"column",children:[e1("div",{style:{display:"flex"},children:[e&&q(a1,{item:!0,children:q(R,{label:e,required:g})}),L&&q(a1,{item:!0,children:q(t2,{title:L,placement:"top",children:q("div",{style:{width:"fit-content"},children:q(s2,{icon:l1,color:"#757575"})})})})]}),q(n2,m(r({onChange:(b,Z)=>{w(Z),C==null||C(Z,M.getValues())},onInputChange:(b,Z,t)=>{t==="input"&&setTimeout(()=>{A==null||A(Z,M.getValues())},0)},slotProps:m(r({},P.slotProps||{}),{paper:m(r({},(P.slotProps||{}).paper||{}),{sx:r({border:`1px solid ${v2.neutral[30]}`,boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.15)"},((d=(P.slotProps||{}).paper)==null?void 0:d.sx)||{})})}),value:$||(B?[]:null),options:p,multiple:B,noOptionsText:e1(H1,{children:[k||"Nenhum resultado encontrado",u?e1(H1,{children:[q(a1,{py:1,children:q(Q1,{})}),u]}):null]}),isOptionEqualToValue:(b,Z)=>typeof b=="string"&&typeof Z=="string"?b===Z:typeof b=="object"&&typeof Z=="object"?typeof b.value=="object"&&typeof Z.value=="object"&&b.key!==void 0&&Z.key!==void 0?b.key===Z.key:b.value===Z.value:!1,renderOption:(b,Z)=>typeof Z=="object"?X1("li",m(r({},b),{key:Z.key||Z.value}),e1(a1,{container:!0,direction:"column",children:[q(a1,{item:!0,children:Z.label}),Z.afterLabel&&q(a1,{item:!0,children:Z.afterLabel})]})):X1("li",m(r({},b),{key:Z}),Z),ListboxComponent:i2(function(Z,t){return e1(H1,{children:[q("ul",m(r({},Z),{ref:t})),!!u&&q("div",m(r({},Z),{children:e1(H1,{children:[q(a1,{px:2,py:1,children:q(Q1,{})}),u]})}),"searchable-footer")]})})},P),{renderInput:b=>q(h2,m(r(r({error:!!H,placeholder:y},b),x),{inputRef:_}))}),c),q(U,{name:c,disableIcon:S})]})}})},m2=e2(d2);import{forwardRef as u2,memo as M2}from"react";import{Controller as H2,useFormContext as f2}from"react-hook-form";import{isObject as V2,isEmpty as g2}from"lodash";import{Grid as r1,Autocomplete as L2,TextField as y2}from"@mui/material";import{LIcon as V1,Tooltip as b2,Button as x2,Divider as C2}from"@s_mart/core";import{colorPalette as A2}from"@s_mart/tokens";import{toRem as i0}from"@s_mart/utils";import{toRem as f1}from"@s_mart/utils";import Z2 from"@emotion/styled";import{css as c0}from"@emotion/react";var l0=c0`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
@@ -47,7 +47,7 @@ var Z0=Object.create;var x1=Object.defineProperty,p0=Object.defineProperties,u0=
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
${({hideAddButton:c,theme:a})=>!c&&p2(a)}
|
|
50
|
-
`;import{Fragment as
|
|
50
|
+
`;import{Fragment as w1,jsx as E,jsxs as N}from"react/jsx-runtime";import{createElement as e0}from"react";var F2=H=>{var w=H,{name:c,rules:a,defaultValue:n,shouldUnregister:s,label:e,required:g,options:p,editable:x,footer:k,onEditOption:u,onCreateOption:B,textFieldProps:L,hideAddButton:y,multiple:C,info:A,onChange:S,onInputChange:P,placeholder:T,disableIconError:F}=w,M=D(w,["name","rules","defaultValue","shouldUnregister","label","required","options","editable","footer","onEditOption","onCreateOption","textFieldProps","hideAddButton","multiple","info","onChange","onInputChange","placeholder","disableIconError"]);let $=f2();if(!$)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let _=Y($.formState.errors,c),d=l=>{let i=0;return L!=null&&L.InputProps||(i+=2.5),y||(i+=2.56,b(l)&&(i+=2.56)),M.disableClearable||(i+=1.3),i+"rem"},b=l=>x&&V2(l)&&!g2(l);console.warn=()=>{};let Z=l=>{B?B(l):console.error("onCreateOption n\xE3o foi definido")},t=l=>{u?u(l):console.error("onEditOption n\xE3o foi definido")};return E(H2,{control:$.control,name:c,rules:a,defaultValue:n,shouldUnregister:s,render:({field:{value:l,onChange:i,ref:f}})=>{var V;let o=(l==null?void 0:l.label)||(l==null?void 0:l.value)||l;return N(r1,{display:"flex",flexDirection:"column",children:[N("div",{style:{display:"flex"},children:[e&&E(r1,{item:!0,children:E(R,{label:e,required:g})}),A&&E(r1,{item:!0,children:E(b2,{title:A,placement:"top",children:E("div",{style:{width:"fit-content"},children:E(V1,{icon:l1,color:"#757575"})})})})]}),E(a0,{hideAddButton:y,children:E(L2,m(r({fullWidth:!0,onChange:(h,v)=>{i(v),S==null||S(v,$.getValues())},onInputChange:(h,v,I)=>{I==="input"&&setTimeout(()=>{P==null||P(v,$.getValues())},0)},slotProps:m(r({},M.slotProps||{}),{paper:m(r({},(M.slotProps||{}).paper||{}),{sx:r({border:`1px solid ${A2.neutral[30]}`,boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.15)"},((V=(M.slotProps||{}).paper)==null?void 0:V.sx)||{})})}),options:p,value:l||(C?[]:null),multiple:C,noOptionsText:y?void 0:N(x2,{sx:{justifyContent:"flex-start",padding:`${i0(6)} ${i0(-16)}`,margin:0},fullWidth:!0,onClick:()=>Z(l),variant:"text",startIcon:E(V1,{icon:k1}),children:["Adicionar ",o&&`"${o}"`]}),isOptionEqualToValue:(h,v)=>v?typeof h=="string"&&typeof v=="string"?h===v:typeof h=="object"&&typeof v=="object"?typeof h.value=="object"&&typeof v.value=="object"&&h.key!==void 0&&v.key!==void 0?h.key===v.key:h.value===v.value:typeof h=="object"&&typeof v=="string":!1,renderOption:(h,v)=>typeof v=="object"?e0("li",m(r({},h),{key:v.key||v.value}),N(r1,{container:!0,direction:"column",children:[E(r1,{item:!0,children:v.label}),v.afterLabel&&E(r1,{item:!0,children:v.afterLabel})]})):e0("li",m(r({},h),{key:v}),v),ListboxComponent:u2(function(v,I){return N(w1,{children:[E("ul",m(r({},v),{ref:I})),!!k&&E("div",m(r({},v),{children:N(w1,{children:[E(r1,{px:2,py:1,children:E(C2,{})}),k]})}),"creatable-footer")]})})},M),{sx:r({"& div.MuiInputBase-root":{paddingRight:`${d(l)} !important`}},M.sx),renderInput:h=>E(y2,r(m(r({placeholder:T},h),{error:!!_,InputProps:m(r({},h.InputProps),{inputRef:f,endAdornment:N("div",{className:"endAdornments",children:[h.InputProps.endAdornment,!y&&N(w1,{children:[b(l)?N("div",{className:"editable",children:[E("div",{className:"divider"}),E("div",{className:"button",onClick:()=>t(l),children:E(V1,{icon:q1,size:"24px",removeMargin:!0})})]}):null,N("div",{className:"creatable",children:[E("div",{className:"divider"}),E("div",{className:"button",onClick:()=>Z(l),children:E(V1,{icon:k1,size:"24px",removeMargin:!0})})]})]})]})})}),L))}),c)}),E(U,{name:c,disableIcon:F})]})}})},k2=M2(F2);import{Controller as S2,useFormContext as w2}from"react-hook-form";import{Grid as P2,Checkbox as D2,FormControlLabel as $2}from"@mui/material";import{jsx as m1,jsxs as B2}from"react/jsx-runtime";var T2=B=>{var L=B,{name:c,rules:a,defaultValue:n,shouldUnregister:s,label:e,labelPlacement:g,required:p,disableIconError:x,onChange:k}=L,u=D(L,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required","disableIconError","onChange"]);let y=w2();if(!y)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return m1(S2,{control:y.control,name:c,rules:a,defaultValue:n,shouldUnregister:s,render:({field:{value:C,onChange:A}})=>B2(P2,{display:"flex",flexDirection:"column",children:[m1($2,{control:m1(D2,r({checked:!!C,value:C!=null?C:"",defaultValue:C,onChange:(S,P)=>{A(S,P),k==null||k(S,P)}},u),c),label:m1(R,{label:e,required:p,regular:!0}),labelPlacement:g||"end"}),m1(U,{name:c,disableIcon:x})]})})},_2=T2;import{Controller as I2,useFormContext as E2}from"react-hook-form";import{Grid as G2,Switch as R2,FormControlLabel as U2}from"@mui/material";import{jsx as Z1,jsxs as z2}from"react/jsx-runtime";var O2=u=>{var B=u,{name:c,rules:a,defaultValue:n,shouldUnregister:s,label:e,labelPlacement:g,disableIconError:p,onChange:x}=B,k=D(B,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","disableIconError","onChange"]);let L=E2();if(!L)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return Z1(I2,{control:L.control,name:c,rules:a,defaultValue:n,shouldUnregister:s,render:({field:{value:y,onChange:C}})=>z2(G2,{display:"flex",flexDirection:"column",children:[Z1(U2,{control:Z1(R2,r({value:y!=null?y:"",checked:y!=null?y:!1,defaultValue:y,onChange:(A,S)=>{C(A,S),x==null||x(A,S)}},k),c),label:Z1(R,{label:e}),labelPlacement:g||"end"}),Z1(U,{name:c,disableIcon:p})]})})},q2=O2;import{Grid as Y2,Radio as j2,FormControlLabel as W2}from"@mui/material";import{jsx as g1}from"react/jsx-runtime";var N2=s=>{var e=s,{label:c,labelPlacement:a}=e,n=D(e,["label","labelPlacement"]);return g1(Y2,{display:"flex",flexDirection:"column",children:g1(W2,{control:g1(j2,r({},n)),label:g1(R,{label:c}),labelPlacement:a||"end"})})},J2=N2;import{Controller as K2,useFormContext as Q2}from"react-hook-form";import{Grid as X2,RadioGroup as c3}from"@mui/material";import{jsx as L1,jsxs as i3}from"react/jsx-runtime";var l3=B=>{var L=B,{name:c,rules:a,defaultValue:n,shouldUnregister:s,label:e,required:g,children:p,orientation:x="row",disableIconError:k}=L,u=D(L,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation","disableIconError"]);let y=Q2();if(!y)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return L1(K2,{control:y.control,name:c,rules:a,defaultValue:n,shouldUnregister:s,render:({field:{value:C,onChange:A}})=>i3(X2,{display:"flex",flexDirection:"column",children:[e&&L1(R,{label:e,required:g}),L1(c3,m(r({value:C||"",name:c},u),{onChange:S=>{var P,T;(T=u==null?void 0:u.onChange)==null||T.call(u,S,(P=S.target)==null?void 0:P.value),A(S)},style:{display:"flex",flexDirection:x},children:p}),c),L1(U,{name:c,disableIcon:k})]})})},a3=l3;import{Controller as e3,useFormContext as r3}from"react-hook-form";import{Slider as o3}from"@mui/material";import{jsx as r0}from"react/jsx-runtime";var n3=g=>{var p=g,{name:c,rules:a,defaultValue:n,shouldUnregister:s}=p,e=D(p,["name","rules","defaultValue","shouldUnregister"]);let x=r3();if(!x)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return r0(e3,{control:x.control,name:c,rules:a,defaultValue:n,shouldUnregister:s,render:({field:{value:k,onChange:u}})=>r0(o3,r({value:k||(e==null?void 0:e.min)||0,onChange:u,valueLabelDisplay:"auto"},e),c)})},h3=n3;var s0=G1(_1());import{memo as m3}from"react";import{Controller as Z3,useFormContext as p3}from"react-hook-form";import{Grid as u3}from"@s_mart/core";import{composeValidators as M3,date as h0}from"@s_mart/rules";import{TextField as H3}from"@mui/material";import{DatePicker as f3}from"@mui/x-date-pickers/DatePicker";import{AdapterDayjs as V3}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as g3}from"@mui/x-date-pickers/LocalizationProvider";import{ptBR as L3}from"@mui/x-date-pickers/locales/ptBR";import s3 from"@emotion/styled";import{IconButton as t3}from"@mui/material";import{toRem as J}from"@s_mart/utils";var v3=c=>{switch(c){case"small":return J(16);default:case"medium":return J(20);case"large":return J(24)}},d3=c=>{switch(c){case"small":return`${J(2)} ${J(8)}`;default:case"medium":return`${J(6)} ${J(8)}`;case"large":return`${J(10)}`}},n0=s3(t3)`
|
|
51
51
|
margin: 0px;
|
|
52
52
|
|
|
53
53
|
padding: ${({size:c})=>d3(c)};
|
|
@@ -56,13 +56,13 @@ var Z0=Object.create;var x1=Object.defineProperty,p0=Object.defineProperties,u0=
|
|
|
56
56
|
svg {
|
|
57
57
|
width: ${({size:c})=>v3(c)} !important;
|
|
58
58
|
}
|
|
59
|
-
`;import{jsx as p1,jsxs as C3}from"react/jsx-runtime";import{createElement as x3}from"react";var y3=
|
|
59
|
+
`;import{jsx as p1,jsxs as C3}from"react/jsx-runtime";import{createElement as x3}from"react";var y3=L=>{var y=L,{rules:c,name:a,defaultValue:n,shouldUnregister:s,datePickerProps:e,label:g,required:p,placeholder:x,disabled:k,disableIconError:u}=y,B=D(y,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder","disabled","disableIconError"]);let C=p3();if(!C)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let A=Y(C.formState.errors,a),S=(e==null?void 0:e.format)||"DD/MM/YYYY",P=c?M3([h0(S),c]):h0(S);return p1(g3,{dateAdapter:V3,adapterLocale:s0.default,localeText:L3.components.MuiLocalizationProvider.defaultProps.localeText,children:p1(Z3,{control:C.control,name:a,rules:P,defaultValue:n,shouldUnregister:s,render:({field:{value:T,onChange:F,ref:M}})=>C3(u3,{display:"flex",flexDirection:"column",children:[g&&p1(R,{label:g,required:p}),x3(f3,m(r({},e),{key:a,value:T!=null?T:null,format:S,onChange:(H,w)=>{var $;F(H,w),($=e==null?void 0:e.onChange)==null||$.call(e,H,w)},disabled:k,slots:{textField:H3,openPickerButton:H=>p1(n0,m(r({},H),{size:B.size}))},slotProps:{textField:H=>{var w;return m(r(m(r({variant:"outlined"},H),{error:!!A}),B),{inputProps:m(r({},H.inputProps),{placeholder:x||((w=H.inputProps)==null?void 0:w.placeholder)}),InputProps:m(r({},H.InputProps),{inputRef($){M($),typeof H.inputRef=="function"&&H.inputRef($)}})})}}})),p1(U,{name:a,disableIcon:u})]})})})},b3=m3(y3);var d0=G1(_1());import{memo as w3}from"react";import{Controller as P3,useFormContext as D3}from"react-hook-form";import{Grid as $3}from"@s_mart/core";import{composeValidators as T3,time as v0}from"@s_mart/rules";import{TextField as _3}from"@mui/material";import{TimePicker as B3}from"@mui/x-date-pickers/TimePicker";import{AdapterDayjs as I3}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as E3}from"@mui/x-date-pickers/LocalizationProvider";import{ptBR as G3}from"@mui/x-date-pickers/locales/ptBR";import A3 from"@emotion/styled";import{IconButton as F3}from"@mui/material";import{toRem as K}from"@s_mart/utils";var k3=c=>{switch(c){case"small":return K(16);default:case"medium":return K(20);case"large":return K(24)}},S3=c=>{switch(c){case"small":return`${K(2)} ${K(8)}`;default:case"medium":return`${K(6)} ${K(8)}`;case"large":return`${K(10)}`}},t0=A3(F3)`
|
|
60
60
|
margin: 0px;
|
|
61
61
|
|
|
62
62
|
padding: ${({size:c})=>S3(c)};
|
|
63
63
|
border-radius: 0 ${K(4)} ${K(4)} 0;
|
|
64
64
|
|
|
65
65
|
svg {
|
|
66
|
-
width: ${({size:c})=>
|
|
66
|
+
width: ${({size:c})=>k3(c)} !important;
|
|
67
67
|
}
|
|
68
|
-
`;import{jsx as s1,jsxs as O3}from"react/jsx-runtime";var R3=
|
|
68
|
+
`;import{jsx as s1,jsxs as O3}from"react/jsx-runtime";var R3=L=>{var y=L,{rules:c,defaultValue:a,shouldUnregister:n,name:s,required:e,label:g,timePickerProps:p,placeholder:x,disabled:k,disableIconError:u}=y,B=D(y,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder","disabled","disableIconError"]);let C=D3();if(!C)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let A=Y(C.formState.errors,s),S=(p==null?void 0:p.format)||"HH:mm",P=c?T3([v0(S),c]):v0(S);return s1(E3,{dateAdapter:I3,adapterLocale:d0.default,localeText:G3.components.MuiLocalizationProvider.defaultProps.localeText,children:s1(P3,{control:C.control,name:s,rules:P,defaultValue:a,shouldUnregister:n,render:({field:{value:T,onChange:F,ref:M}})=>O3($3,{display:"flex",flexDirection:"column",children:[g&&s1(R,{label:g,required:e}),s1(B3,m(r({ampm:!1,format:S,value:T!=null?T:null,disabled:k},p),{onChange:(H,w)=>{var $;F(H,w),($=p==null?void 0:p.onChange)==null||$.call(p,H,w)},slots:{textField:_3,openPickerButton:H=>s1(t0,m(r({},H),{size:B.size}))},slotProps:{textField:H=>{var w;return m(r(m(r({variant:"outlined"},H),{error:!!A}),B),{inputProps:m(r({},H.inputProps),{placeholder:x||((w=H.inputProps)==null?void 0:w.placeholder)}),InputProps:m(r({},H.InputProps),{inputRef($){M($),typeof H.inputRef=="function"&&H.inputRef($)}})})}}}),s),s1(U,{name:s,disableIcon:u})]})})})},U3=w3(R3);import{memo as q3}from"react";import{Controller as z3,useFormContext as Y3}from"react-hook-form";import{Autocomplete as j3,TextField as W3}from"@mui/material";import{Grid as y1}from"@s_mart/core";import{colorPalette as N3}from"@s_mart/tokens";import{jsx as o1,jsxs as m0}from"react/jsx-runtime";import{createElement as Q3}from"react";var J3=y=>{var C=y,{name:c,defaultValue:a,rules:n,shouldUnregister:s,label:e,required:g,noOptionsText:p,placeholder:x,onInputChange:k,onChange:u,disableIconError:B}=C,L=D(C,["name","defaultValue","rules","shouldUnregister","label","required","noOptionsText","placeholder","onInputChange","onChange","disableIconError"]);let A=Y3();if(!A)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let S=Y(A.formState.errors,c);return console.warn=()=>{},o1(z3,{name:c,control:A.control,defaultValue:a,rules:n,shouldUnregister:s,render:({field:P})=>{var T;return m0(y1,{display:"flex",flexDirection:"column",children:[e&&o1(R,{label:e,required:g}),o1(j3,m(r({onChange:(F,M)=>{P.onChange(M),u==null||u(M,A.getValues())},onInputChange:(F,M,H)=>{H==="input"&&(P.onChange(M),setTimeout(()=>{k==null||k(M,A.getValues())},0))},slotProps:m(r({},L.slotProps||{}),{paper:m(r({},(L.slotProps||{}).paper||{}),{sx:r({border:`1px solid ${N3.neutral[30]}`,boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.15)"},((T=(L.slotProps||{}).paper)==null?void 0:T.sx)||{})})}),isOptionEqualToValue:(F,M)=>F.value===M.value,renderOption:(F,M)=>Q3("li",m(r({},F),{key:M.key||M.value,onClick:H=>{var w;(w=F.onClick)==null||w.call(F,H),P.onChange(M)}}),m0(y1,{container:!0,direction:"column",children:[o1(y1,{item:!0,children:M.label}),M.afterLabel&&o1(y1,{item:!0,children:M.afterLabel})]})),value:P.value||null,noOptionsText:p||"Nenhuma op\xE7\xE3o encontrada"},L),{renderInput:F=>{var M,H,w;return o1(W3,m(r(r({placeholder:x},F),L.textFieldProps),{error:!!S,InputProps:m(r(r({},F.InputProps),(M=L.textFieldProps)==null?void 0:M.InputProps),{inputRef:P.ref,inputProps:r(r({},F.inputProps),(w=(H=L.textFieldProps)==null?void 0:H.InputProps)==null?void 0:w.inputProps)})}))}}),c),o1(U,{name:c,disableIcon:B})]})}})},K3=q3(J3);export{K3 as Autocomplete,_2 as Checkbox,k2 as Creatable,b3 as DatePicker,F0 as Form,A1 as FormProvider,J2 as RadioButton,a3 as RadioGroup,m2 as Searchable,l2 as Select,h3 as Slider,q2 as Switch,O0 as TextField,U3 as TimePicker,F1 as useForm};
|