@s_mart/form 4.4.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +22 -22
- package/package.json +30 -25
- package/dist/index.js +0 -68
package/dist/index.d.ts
CHANGED
|
@@ -110,7 +110,7 @@ type TextFieldProps = TextFieldProps$1 & ControllerTextField & {
|
|
|
110
110
|
|
|
111
111
|
declare const _default$6: react.MemoExoticComponent<({ name, rules, defaultValue, shouldUnregister, label, required, mask, variant, info, parse, inputMode, format, onInputChange, disableIconError, ...rest }: TextFieldProps) => react_jsx_runtime.JSX.Element>;
|
|
112
112
|
|
|
113
|
-
declare const _default$5: react.MemoExoticComponent<({ name, rules, defaultValue, shouldUnregister, label, required, options, placeholder, clearable, disableOnChangeForm, multiple, info, footer, onChange: onChangeProp, disableIconError, ...rest }: SelectProps) => react_jsx_runtime.JSX.Element>;
|
|
113
|
+
declare const _default$5: react.MemoExoticComponent<({ name, rules, defaultValue, shouldUnregister, label, required, options, placeholder, clearable, disableOnChangeForm, multiple, info, footer, onChange: onChangeProp, disableIconError, variant, ...rest }: SelectProps) => react_jsx_runtime.JSX.Element>;
|
|
114
114
|
|
|
115
115
|
type ControllerSelect = Omit<ControllerProps, 'render' | 'control'>;
|
|
116
116
|
type SelectOption = {
|
|
@@ -240,6 +240,7 @@ type SearchableProps = Omit<AutocompleteProps$1<SearchableOption, true, true, tr
|
|
|
240
240
|
* <TextField disableIconError />
|
|
241
241
|
*/
|
|
242
242
|
disableIconError?: boolean;
|
|
243
|
+
placeholder?: string;
|
|
243
244
|
};
|
|
244
245
|
|
|
245
246
|
declare const _default$4: react.MemoExoticComponent<({ name, rules, defaultValue, shouldUnregister, label, required, options, textFieldProps, noOptionsText, footer, multiple, info, placeholder, onChange: onChangeProp, onInputChange, disableIconError, ...rest }: SearchableProps) => react_jsx_runtime.JSX.Element>;
|
|
@@ -340,6 +341,7 @@ type CreatableProps = Omit<AutocompleteProps$1<CreatableOption, true, true, true
|
|
|
340
341
|
* <TextField disableIconError />
|
|
341
342
|
*/
|
|
342
343
|
disableIconError?: boolean;
|
|
344
|
+
placeholder?: string;
|
|
343
345
|
};
|
|
344
346
|
|
|
345
347
|
declare const _default$3: react.MemoExoticComponent<({ name, rules, defaultValue, shouldUnregister, label, required, options, editable, footer, onEditOption, onCreateOption, textFieldProps, hideAddButton, multiple, info, onChange: onChangeProp, onInputChange, placeholder, disableIconError, ...rest }: CreatableProps) => react_jsx_runtime.JSX.Element>;
|
|
@@ -584,6 +586,7 @@ type AutocompleteProps<T = any> = Omit<UseControllerProps, 'control'> & Omit<Aut
|
|
|
584
586
|
* <TextField disableIconError />
|
|
585
587
|
*/
|
|
586
588
|
disableIconError?: boolean;
|
|
589
|
+
placeholder?: string;
|
|
587
590
|
};
|
|
588
591
|
|
|
589
592
|
declare const _default: react.MemoExoticComponent<({ name, defaultValue, rules, shouldUnregister, label, required, noOptionsText, placeholder, onInputChange, onChange, disableIconError, ...rest }: AutocompleteProps) => react_jsx_runtime.JSX.Element>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
var o0=Object.create;var P1=Object.defineProperty;var n0=Object.getOwnPropertyDescriptor;var h0=Object.getOwnPropertyNames;var s0=Object.getPrototypeOf,t0=Object.prototype.hasOwnProperty;var S1=(c,i)=>()=>(i||c((i={exports:{}}).exports,i),i.exports);var v0=(c,i,v,d)=>{if(i&&typeof i=="object"||typeof i=="function")for(let h of h0(i))!t0.call(c,h)&&h!==v&&P1(c,h,{get:()=>i[h],enumerable:!(d=n0(i,h))||d.enumerable});return c};var w1=(c,i,v)=>(v=c!=null?o0(s0(c)):{},v0(i||!c||!c.__esModule?P1(v,"default",{value:c,enumerable:!0}):v,c));var Q1=S1((C1,x1)=>{(function(c,i){typeof C1=="object"&&typeof x1<"u"?x1.exports=i():typeof define=="function"&&define.amd?define(i):(c=typeof globalThis<"u"?globalThis:c||self).dayjs=i()})(C1,function(){"use strict";var c=1e3,i=6e4,v=36e5,d="millisecond",h="second",b="minute",f="hour",L="day",A="week",u="month",C="quarter",m="year",y="date",V="Invalid Date",x=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,k=/\[([^\]]+)]|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,M={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(o){var e=["th","st","nd","rd"],a=o%100;return"["+o+(e[(a-20)%10]||e[a]||e[0])+"]"}},S=function(o,e,a){var s=String(o);return!s||s.length>=e?o:""+Array(e+1-s.length).join(a)+o},g={s:S,z:function(o){var e=-o.utcOffset(),a=Math.abs(e),s=Math.floor(a/60),l=a%60;return(e<=0?"+":"-")+S(s,2,"0")+":"+S(l,2,"0")},m:function o(e,a){if(e.date()<a.date())return-o(a,e);var s=12*(a.year()-e.year())+(a.month()-e.month()),l=e.clone().add(s,u),r=a-l<0,Z=e.clone().add(s+(r?-1:1),u);return+(-(s+(a-l)/(r?l-Z:Z-l))||0)},a:function(o){return o<0?Math.ceil(o)||0:Math.floor(o)},p:function(o){return{M:u,y:m,w:A,d:L,D:y,h:f,m:b,s:h,ms:d,Q:C}[o]||String(o||"").toLowerCase().replace(/s$/,"")},u:function(o){return o===void 0}},H="en",D={};D[H]=M;var R=function(o){return o instanceof U},p=function o(e,a,s){var l;if(!e)return H;if(typeof e=="string"){var r=e.toLowerCase();D[r]&&(l=r),a&&(D[r]=a,l=r);var Z=e.split("-");if(!l&&Z.length>1)return o(Z[0])}else{var F=e.name;D[F]=e,l=F}return!s&&l&&(H=l),l||!s&&H},n=function(o,e){if(R(o))return o.clone();var a=typeof e=="object"?e:{};return a.date=o,a.args=arguments,new U(a)},t=g;t.l=p,t.i=R,t.w=function(o,e){return n(o,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var U=function(){function o(a){this.$L=p(a.locale,null,!0),this.parse(a)}var e=o.prototype;return e.parse=function(a){this.$d=function(s){var l=s.date,r=s.utc;if(l===null)return new Date(NaN);if(t.u(l))return new Date;if(l instanceof Date)return new Date(l);if(typeof l=="string"&&!/Z$/i.test(l)){var Z=l.match(x);if(Z){var F=Z[2]-1||0,T=(Z[7]||"0").substring(0,3);return r?new Date(Date.UTC(Z[1],F,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,T)):new Date(Z[1],F,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,T)}}return new Date(l)}(a),this.$x=a.x||{},this.init()},e.init=function(){var a=this.$d;this.$y=a.getFullYear(),this.$M=a.getMonth(),this.$D=a.getDate(),this.$W=a.getDay(),this.$H=a.getHours(),this.$m=a.getMinutes(),this.$s=a.getSeconds(),this.$ms=a.getMilliseconds()},e.$utils=function(){return t},e.isValid=function(){return this.$d.toString()!==V},e.isSame=function(a,s){var l=n(a);return this.startOf(s)<=l&&l<=this.endOf(s)},e.isAfter=function(a,s){return n(a)<this.startOf(s)},e.isBefore=function(a,s){return this.endOf(s)<n(a)},e.$g=function(a,s,l){return t.u(a)?this[s]:this.set(l,a)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(a,s){var l=this,r=!!t.u(s)||s,Z=t.p(a),F=function(c1,O){var N=t.w(l.$u?Date.UTC(l.$y,O,c1):new Date(l.$y,O,c1),l);return r?N:N.endOf(L)},T=function(c1,O){return t.w(l.toDate()[c1].apply(l.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(O)),l)},B=this.$W,E=this.$M,z=this.$D,r1="set"+(this.$u?"UTC":"");switch(Z){case m:return r?F(1,0):F(31,11);case u:return r?F(1,E):F(0,E+1);case A:var X=this.$locale().weekStart||0,n1=(B<X?B+7:B)-X;return F(r?z-n1:z+(6-n1),E);case L:case y:return T(r1+"Hours",0);case f:return T(r1+"Minutes",1);case b:return T(r1+"Seconds",2);case h:return T(r1+"Milliseconds",3);default:return this.clone()}},e.endOf=function(a){return this.startOf(a,!1)},e.$set=function(a,s){var l,r=t.p(a),Z="set"+(this.$u?"UTC":""),F=(l={},l[L]=Z+"Date",l[y]=Z+"Date",l[u]=Z+"Month",l[m]=Z+"FullYear",l[f]=Z+"Hours",l[b]=Z+"Minutes",l[h]=Z+"Seconds",l[d]=Z+"Milliseconds",l)[r],T=r===L?this.$D+(s-this.$W):s;if(r===u||r===m){var B=this.clone().set(y,1);B.$d[F](T),B.init(),this.$d=B.set(y,Math.min(this.$D,B.daysInMonth())).$d}else F&&this.$d[F](T);return this.init(),this},e.set=function(a,s){return this.clone().$set(a,s)},e.get=function(a){return this[t.p(a)]()},e.add=function(a,s){var l,r=this;a=Number(a);var Z=t.p(s),F=function(E){var z=n(r);return t.w(z.date(z.date()+Math.round(E*a)),r)};if(Z===u)return this.set(u,this.$M+a);if(Z===m)return this.set(m,this.$y+a);if(Z===L)return F(1);if(Z===A)return F(7);var T=(l={},l[b]=i,l[f]=v,l[h]=c,l)[Z]||1,B=this.$d.getTime()+a*T;return t.w(B,this)},e.subtract=function(a,s){return this.add(-1*a,s)},e.format=function(a){var s=this,l=this.$locale();if(!this.isValid())return l.invalidDate||V;var r=a||"YYYY-MM-DDTHH:mm:ssZ",Z=t.z(this),F=this.$H,T=this.$m,B=this.$M,E=l.weekdays,z=l.months,r1=l.meridiem,X=function(O,N,h1,m1){return O&&(O[N]||O(s,r))||h1[N].slice(0,m1)},n1=function(O){return t.s(F%12||12,O,"0")},c1=r1||function(O,N,h1){var m1=O<12?"AM":"PM";return h1?m1.toLowerCase():m1};return r.replace(k,function(O,N){return N||function(h1){switch(h1){case"YY":return String(s.$y).slice(-2);case"YYYY":return t.s(s.$y,4,"0");case"M":return B+1;case"MM":return t.s(B+1,2,"0");case"MMM":return X(l.monthsShort,B,z,3);case"MMMM":return X(z,B);case"D":return s.$D;case"DD":return t.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return X(l.weekdaysMin,s.$W,E,2);case"ddd":return X(l.weekdaysShort,s.$W,E,3);case"dddd":return E[s.$W];case"H":return String(F);case"HH":return t.s(F,2,"0");case"h":return n1(1);case"hh":return n1(2);case"a":return c1(F,T,!0);case"A":return c1(F,T,!1);case"m":return String(T);case"mm":return t.s(T,2,"0");case"s":return String(s.$s);case"ss":return t.s(s.$s,2,"0");case"SSS":return t.s(s.$ms,3,"0");case"Z":return Z}return null}(O)||Z.replace(":","")})},e.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},e.diff=function(a,s,l){var r,Z=this,F=t.p(s),T=n(a),B=(T.utcOffset()-this.utcOffset())*i,E=this-T,z=function(){return t.m(Z,T)};switch(F){case m:r=z()/12;break;case u:r=z();break;case C:r=z()/3;break;case A:r=(E-B)/6048e5;break;case L:r=(E-B)/864e5;break;case f:r=E/v;break;case b:r=E/i;break;case h:r=E/c;break;default:r=E}return l?r:t.a(r)},e.daysInMonth=function(){return this.endOf(u).$D},e.$locale=function(){return D[this.$L]},e.locale=function(a,s){if(!a)return this.$L;var l=this.clone(),r=p(a,s,!0);return r&&(l.$L=r),l},e.clone=function(){return t.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},o}(),Q=U.prototype;return n.prototype=Q,[["$ms",d],["$s",h],["$m",b],["$H",f],["$W",L],["$M",u],["$y",m],["$D",y]].forEach(function(o){Q[o[1]]=function(e){return this.$g(e,o[0],o[1])}}),n.extend=function(o,e){return o.$i||(o(e,U,n),o.$i=!0),n},n.locale=p,n.isDayjs=R,n.unix=function(o){return n(1e3*o)},n.en=D[H],n.Ls=D,n.p={},n})});var F1=S1((k1,A1)=>{(function(c,i){typeof k1=="object"&&typeof A1<"u"?A1.exports=i(Q1()):typeof define=="function"&&define.amd?define(["dayjs"],i):(c=typeof globalThis<"u"?globalThis:c||self).dayjs_locale_pt_br=i(c.dayjs)})(k1,function(c){"use strict";function i(h){return h&&typeof h=="object"&&"default"in h?h:{default:h}}var v=i(c),d={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(h){return h+"\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 v.default.locale(d,null,!0),d})});import{FormProvider as d0}from"react-hook-form";import{jsx as T1}from"react/jsx-runtime";function m0({children:c,style:i,onSubmit:v,...d}){return T1(d0,{...d,children:T1("form",{onSubmit:h=>{h.preventDefault(),h.stopPropagation(),v(h)},style:i,children:c})})}var V1=m0;import{useEffect as Z0}from"react";import{useForm as p0}from"react-hook-form";import{zodResolver as u0}from"@hookform/resolvers/zod";var M0=({disableDefaultValuesUpdate:c,onSubmit:i,...v})=>{let d=p0({...v,resolver:v.schema&&u0(v.schema)});return Z0(()=>{c||d.reset(v.defaultValues)},[v.defaultValues,d.reset]),{...d,onSubmit:d.handleSubmit(h=>i(h,d))}},g1=M0;import{jsx as V0}from"react/jsx-runtime";function H0({children:c,style:i,...v}){let d=g1(v);return V0(V1,{...d,style:i,children:typeof c=="function"?c(d):c})}var f0=H0;import{memo as k0,useState as A0}from"react";import{Controller as F0,useFormContext as P0}from"react-hook-form";import{Grid as y1,InputAdornment as S0,TextField as w0}from"@mui/material";var D1={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"},$1={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 J={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 B1={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 L1={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 E1 from"@s_mart/masks";import{Typography as I1}from"@mui/material";import{toRem as g0}from"@s_mart/utils";import{jsx as _1,jsxs as y0}from"react/jsx-runtime";var L0=({label:c,required:i,regular:v})=>y0("span",{style:{display:"flex",alignItems:"center",gap:g0(2)},children:[_1(I1,{variant:"caption",fontWeight:v?400:700,style:{display:"flex",alignItems:"center"},children:c}),i&&_1(I1,{variant:"caption",fontWeight:900,color:"error",children:"*"})]}),w=L0;import{useFormContext as b0}from"react-hook-form";import{Indicator as C0}from"@s_mart/core";var G=(c,i)=>i.replace(/[[\]]/g,"").split(".").reduce((d,h)=>d?.[h],c);import{jsx as x0}from"react/jsx-runtime";var $=({name:c,disableIcon:i})=>{let v=b0(),d=G(v?.formState?.errors,c);return d?x0(C0,{severity:"error",icon:i?!1:void 0,children:d?.message}):null};import{LIcon as G1,Tooltip as T0}from"@s_mart/core";import{jsx as q,jsxs as U1}from"react/jsx-runtime";var D0=({name:c,rules:i,defaultValue:v,shouldUnregister:d,label:h,required:b,mask:f,variant:L="outlined",info:A,parse:u,inputMode:C,format:m,onInputChange:y,disableIconError:V,...x})=>{let k=P0();if(!k)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[M,S]=A0(!1),g=p=>{let n=p;return m&&(n=m(p)),f?E1?.[f]?.format(n):n},H=p=>{let n=p;return u&&(n=u(p)),f?E1?.[f]?.parse(n):n},D=p=>{if(!p||f!=="porcentagem"&&f!=="porcentagem0")return;p?.stopPropagation();let n=(p?.target).value;if(n){let t=String(n);if(t.length>0){let U=t.indexOf("%");U>-1&&(p.currentTarget.selectionEnd=U)}}},R=G(k.formState.errors,c);return q(F0,{control:k.control,name:c,rules:i,defaultValue:v,shouldUnregister:d,render:({field:{value:p,onChange:n,ref:t}})=>U1(y1,{display:"flex",flexDirection:"column",children:[U1("div",{style:{display:"flex"},children:[h&&q(y1,{item:!0,children:q(w,{label:h,required:b})}),A&&q(y1,{item:!0,children:q(T0,{title:A,placement:"top",children:q("div",{style:{width:"fit-content"},children:q(G1,{icon:J,color:"#757575"})})})})]}),q(w0,{variant:L,defaultValue:v,value:g(p||(p!=0?"":p)),onChange:U=>{let Q=H(U?.target?.value);n(Q),y?.(Q,k.getValues())},error:!!R,...x,type:x.type==="password"?M?"text":"password":x.type,autoComplete:x.autoComplete||"off",inputProps:{inputMode:C,...x.inputProps},InputProps:{onKeyDown:D,inputRef:t,endAdornment:x.type==="password"&&q(S0,{position:"start",onClick:()=>S(!M),style:{cursor:"pointer"},children:q(G1,{icon:M?D1:$1,size:"24px",removeMargin:!0})}),...x.InputProps}},c),q($,{name:c,disableIcon:V})]})})},$0=k0(D0);import{memo as B0,useState as I0}from"react";import{Controller as _0,useFormContext as E0}from"react-hook-form";import{Divider as G0,IconButton as U0,LIcon as R1,Tooltip as O0}from"@s_mart/core";var O1={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 R0}from"@s_mart/tokens";import{Grid as l1,Select as z0,MenuItem as q0,useTheme as Y0}from"@mui/material";import{Fragment as N0,jsx as _,jsxs as s1}from"react/jsx-runtime";var j0=({name:c,rules:i,defaultValue:v,shouldUnregister:d,label:h,required:b,options:f,placeholder:L,clearable:A,disableOnChangeForm:u=!1,multiple:C,info:m,footer:y,onChange:V,disableIconError:x,...k})=>{let M=E0(),{palette:S}=Y0(),[g,H]=I0(!1);if(!M)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let D=G(M.formState.errors,c);return console.warn=()=>{},_(_0,{control:M.control,name:c,rules:i,defaultValue:v,shouldUnregister:d,render:({field:{value:R,onChange:p,ref:n}})=>s1(l1,{display:"flex",flexDirection:"column",children:[s1("div",{style:{display:"flex"},children:[h&&_(l1,{item:!0,children:_(w,{label:h,required:b})}),m&&_(l1,{item:!0,children:_(O0,{title:m,placement:"top",children:_("div",{style:{width:"fit-content"},children:_(R1,{icon:J,color:"#757575"})})})})]}),s1(z0,{open:g,onOpen:()=>H(!0),onClose:()=>H(!1),displayEmpty:!!L,variant:"outlined",autoComplete:"off",value:R?R||"":C?[]:"",renderValue:t=>{if(t.label)return t.label;if(L)return _("p",{style:{color:S.grey[400]},children:L})},multiple:C,onChange:t=>{!u&&p(t.target.value),V&&V(t.target.value,M.getValues())},error:!!D,size:k.size||"medium",inputRef:n,...k,endAdornment:s1(N0,{children:[k.endAdornment,!!(A&&R)&&_(U0,{variant:"text",color:"neutral",size:"small",sx:{borderRadius:"50%",position:"absolute",right:"2rem"},style:{padding:0},"aria-label":"Clear",title:"Clear",onClick:()=>{!u&&p(null),V&&V(null,M.getValues())},children:_(R1,{icon:O1,color:R0.neutral[100],size:"25px",removeMargin:!0})})]}),children:[f?.map((t,U)=>_(q0,{value:t,children:s1(l1,{container:!0,direction:"column",children:[_(l1,{item:!0,children:t.label}),t.afterLabel&&_(l1,{item:!0,children:t.afterLabel})]})},U)),y&&[_(l1,{px:2,py:1,children:_(G0,{})},"footer-divider"),_("div",{children:y({closeSelect:()=>H(!1)})},"footer-content")]]},c),_($,{name:c,disableIcon:x})]})})},W0=B0(j0);import{forwardRef as J0,memo as K0}from"react";import{Controller as Q0,useFormContext as X0}from"react-hook-form";import{Grid as K,Autocomplete as c2,TextField as l2}from"@mui/material";import{Divider as z1,LIcon as a2,Tooltip as e2}from"@s_mart/core";import{colorPalette as i2}from"@s_mart/tokens";import{Fragment as Z1,jsx as I,jsxs as a1}from"react/jsx-runtime";import{createElement as q1}from"react";var r2=({name:c,rules:i,defaultValue:v,shouldUnregister:d,label:h,required:b,options:f,textFieldProps:L,noOptionsText:A,footer:u,multiple:C,info:m,placeholder:y,onChange:V,onInputChange:x,disableIconError:k,...M})=>{let S=X0();if(!S)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let g=G(S.formState.errors,c);return console.warn=()=>{},I(Q0,{control:S.control,name:c,rules:i,defaultValue:v,shouldUnregister:d,render:({field:{onChange:H,value:D,ref:R}})=>a1(K,{display:"flex",flexDirection:"column",children:[a1("div",{style:{display:"flex"},children:[h&&I(K,{item:!0,children:I(w,{label:h,required:b})}),m&&I(K,{item:!0,children:I(e2,{title:m,placement:"top",children:I("div",{style:{width:"fit-content"},children:I(a2,{icon:J,color:"#757575"})})})})]}),I(c2,{onChange:(p,n)=>{H(n),V?.(n,S.getValues())},onInputChange:(p,n,t)=>{t==="input"&&setTimeout(()=>{x?.(n,S.getValues())},0)},slotProps:{...M.slotProps||{},paper:{...(M.slotProps||{}).paper||{},sx:{border:`1px solid ${i2.neutral[30]}`,boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.15)",...(M.slotProps||{}).paper?.sx||{}}}},value:D||(C?[]:null),options:f,multiple:C,readOnly:M.disabled,noOptionsText:a1(Z1,{children:[A||"Nenhum resultado encontrado",u?a1(Z1,{children:[I(K,{py:1,children:I(z1,{})}),u]}):null]}),isOptionEqualToValue:(p,n)=>typeof p=="string"&&typeof n=="string"?p===n:typeof p=="object"&&typeof n=="object"?typeof p.value=="object"&&typeof n.value=="object"&&p.key!==void 0&&n.key!==void 0?p.key===n.key:p.value===n.value:!1,renderOption:(p,n)=>typeof n=="object"?q1("li",{...p,key:n.key||n.value},a1(K,{container:!0,direction:"column",children:[I(K,{item:!0,children:n.label}),n.afterLabel&&I(K,{item:!0,children:n.afterLabel})]})):q1("li",{...p,key:n},n),ListboxComponent:J0(function(n,t){return a1(Z1,{children:[I("ul",{...n,ref:t}),!!u&&I("div",{...n,children:a1(Z1,{children:[I(K,{px:2,py:1,children:I(z1,{})}),u]})},"searchable-footer")]})}),...M,renderInput:p=>I(l2,{error:!!g,placeholder:y,...p,...L,inputRef:R})},c),I($,{name:c,disableIcon:k})]})})},o2=K0(r2);import{forwardRef as s2,memo as t2}from"react";import{Controller as v2,useFormContext as d2}from"react-hook-form";import{isObject as m2,isEmpty as Z2}from"lodash";import{Grid as e1,Autocomplete as p2,TextField as u2}from"@mui/material";import{LIcon as u1,Tooltip as M2,Button as H2,Divider as f2}from"@s_mart/core";import{colorPalette as V2}from"@s_mart/tokens";import{toRem as N1}from"@s_mart/utils";import{toRem as p1}from"@s_mart/utils";import n2 from"@emotion/styled";import{css as Y1}from"@emotion/react";var j1=Y1`
|
|
1
|
+
import{FormProvider as Ve}from"react-hook-form";import{jsx as de}from"react/jsx-runtime";function Re({children:e,style:r,onSubmit:i,...t}){return de(Ve,{...t,children:de("form",{onSubmit:n=>{n.preventDefault(),n.stopPropagation(),i(n)},style:r,children:e})})}var ie=Re;import{useEffect as Ee}from"react";import{useForm as Be}from"react-hook-form";import{zodResolver as Ae}from"@hookform/resolvers/zod";var De=({disableDefaultValuesUpdate:e,onSubmit:r,...i})=>{let t=Be({...i,resolver:i.schema&&Ae(i.schema)});return Ee(()=>{e||t.reset(i.defaultValues)},[i.defaultValues,t.reset]),{...t,onSubmit:t.handleSubmit(n=>r(n,t))}},le=De;import{jsx as ze}from"react/jsx-runtime";function $e({children:e,style:r,...i}){let t=le(i);return ze(ie,{...t,style:r,children:typeof e=="function"?e(t):e})}var Me=$e;import{memo as He,useState as We}from"react";import{Controller as Ye,useFormContext as Je}from"react-hook-form";import{Grid as ne,InputAdornment as Ke,TextField as Xe}from"@mui/material";import{lineEye as Qe,lineEyeSlash as Ze,lineInfoCircle as eo}from"@s_mart/solid-icons";import*as ue from"@s_mart/masks";import{Typography as pe}from"@mui/material";import{toRem as qe}from"@s_mart/utils";import{jsx as me,jsxs as Oe}from"react/jsx-runtime";var _e=({label:e,required:r,regular:i})=>Oe("span",{style:{display:"flex",alignItems:"center",gap:qe(2)},children:[me(pe,{variant:"caption",fontWeight:i?400:700,style:{display:"flex",alignItems:"center"},children:e}),r&&me(pe,{variant:"caption",fontWeight:900,color:"error",children:"*"})]}),v=_e;import{useFormContext as Ue}from"react-hook-form";import{Indicator as je}from"@s_mart/core";var V=(e,r)=>r.replace(/[[\]]/g,"").split(".").reduce((t,n)=>t?.[n],e);import{jsx as Ne}from"react/jsx-runtime";var T=({name:e,disableIcon:r})=>{let i=Ue(),t=V(i?.formState?.errors,e);return t?Ne(je,{severity:"error",icon:r?!1:void 0,children:t?.message}):null};import{LIcon as fe,Tooltip as oo}from"@s_mart/core";import{jsx as B,jsxs as ce}from"react/jsx-runtime";var ro=({name:e,rules:r,defaultValue:i,shouldUnregister:t,label:n,required:b,mask:m,variant:g="outlined",info:I,parse:c,inputMode:u,format:a,onInputChange:F,disableIconError:d,...x})=>{let P=Je();if(!P)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[s,C]=We(!1),p=l=>{let o=l;return a&&(o=a(l)),m?ue?.[m]?.format(o):o},f=l=>{let o=l;return c&&(o=c(l)),m?ue?.[m]?.parse(o):o},R=l=>{if(!l||m!=="porcentagem"&&m!=="porcentagem0")return;l?.stopPropagation();let o=(l?.target).value;if(o){let E=String(o);if(E.length>0){let w=E.indexOf("%");w>-1&&(l.currentTarget.selectionEnd=w)}}},z=V(P.formState.errors,e);return B(Ye,{control:P.control,name:e,rules:r,defaultValue:i,shouldUnregister:t,render:({field:{value:l,onChange:o,ref:E}})=>ce(ne,{display:"flex",flexDirection:"column",children:[ce("div",{style:{display:"flex"},children:[n&&B(ne,{item:!0,children:B(v,{label:n,required:b})}),I&&B(ne,{item:!0,children:B(oo,{title:I,placement:"top",children:B("div",{style:{width:"fit-content"},children:B(fe,{icon:eo,color:"#757575"})})})})]}),B(Xe,{variant:g,defaultValue:i,value:p(l||(l!=0?"":l)),onChange:w=>{let N=f(w?.target?.value);o(N),F?.(N,P.getValues())},error:!!z,...x,type:x.type==="password"?s?"text":"password":x.type,autoComplete:x.autoComplete||"off",inputProps:{inputMode:u,...x.inputProps},InputProps:{onKeyDown:R,inputRef:E,endAdornment:x.type==="password"&&B(Ke,{position:"start",onClick:()=>C(!s),style:{cursor:"pointer"},children:B(fe,{icon:s?Qe:Ze,size:"24px",removeMargin:!0})}),...x.InputProps}},e),B(T,{name:e,disableIcon:d})]})})},to=He(ro);import{memo as io,useState as lo}from"react";import{Controller as no,useFormContext as ao}from"react-hook-form";import{Divider as so,IconButton as po,LIcon as xe,Tooltip as mo}from"@s_mart/core";import{lineTimes as uo}from"@s_mart/regular-icons";import{lineInfoCircle as fo}from"@s_mart/solid-icons";import{colorPalette as co}from"@s_mart/tokens";import{Grid as _,Select as xo,MenuItem as yo,useTheme as Fo}from"@mui/material";import{Fragment as ho,jsx as L,jsxs as W}from"react/jsx-runtime";var Po=({name:e,rules:r,defaultValue:i,shouldUnregister:t,label:n,required:b,options:m,placeholder:g,clearable:I,disableOnChangeForm:c=!1,multiple:u,info:a,footer:F,onChange:d,disableIconError:x,variant:P="outlined",...s})=>{let C=ao(),{palette:p}=Fo(),[f,R]=lo(!1);if(!C)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let z=V(C.formState.errors,e);return console.warn=()=>{},L(no,{control:C.control,name:e,rules:r,defaultValue:i,shouldUnregister:t,render:({field:{value:l,onChange:o,ref:E}})=>W(_,{display:"flex",flexDirection:"column",children:[W("div",{style:{display:"flex"},children:[n&&L(_,{item:!0,children:L(v,{label:n,required:b})}),a&&L(_,{item:!0,children:L(mo,{title:a,placement:"top",children:L("div",{style:{width:"fit-content"},children:L(xe,{icon:fo,color:"#757575"})})})})]}),W(xo,{open:f,onOpen:()=>R(!0),onClose:()=>R(!1),displayEmpty:!!g,variant:P,autoComplete:"off",value:l?l||"":u?[]:"",renderValue:w=>{if(w.label)return w.label;if(g)return L("p",{style:{color:p.grey[400]},children:g})},multiple:u,onChange:w=>{!c&&o(w.target.value),d&&d(w.target.value,C.getValues())},error:!!z,size:s.size||"medium",inputRef:E,...s,endAdornment:W(ho,{children:[s.endAdornment,!!(I&&l)&&L(po,{variant:"text",color:"neutral",size:"small",sx:{borderRadius:"50%",position:"absolute",right:"2rem"},style:{padding:0},"aria-label":"Clear",title:"Clear",onClick:()=>{!c&&o(null),d&&d(null,C.getValues())},children:L(xe,{icon:uo,color:co.neutral[100],size:"25px",removeMargin:!0})})]}),children:[m?.map((w,N)=>L(yo,{value:w,children:W(_,{container:!0,direction:"column",children:[L(_,{item:!0,children:w.label}),w.afterLabel&&L(_,{item:!0,children:w.afterLabel})]})},N)),F&&[L(_,{px:2,py:1,children:L(so,{})},"footer-divider"),L("div",{children:F({closeSelect:()=>R(!1)})},"footer-content")]]},e),L(T,{name:e,disableIcon:x})]})})},bo=io(Po);import{forwardRef as go,memo as Co}from"react";import{Controller as vo,useFormContext as Io}from"react-hook-form";import{Grid as M,Autocomplete as To,TextField as ko}from"@mui/material";import{Divider as ye,LIcon as wo,Tooltip as So}from"@s_mart/core";import{lineInfoCircle as Go}from"@s_mart/solid-icons";import{colorPalette as Lo}from"@s_mart/tokens";import{Fragment as X,jsx as G,jsxs as O}from"react/jsx-runtime";import{createElement as Fe}from"react";var Vo=({name:e,rules:r,defaultValue:i,shouldUnregister:t,label:n,required:b,options:m,textFieldProps:g,noOptionsText:I,footer:c,multiple:u,info:a,placeholder:F,onChange:d,onInputChange:x,disableIconError:P,...s})=>{let C=Io();if(!C)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let p=V(C.formState.errors,e);return console.warn=()=>{},G(vo,{control:C.control,name:e,rules:r,defaultValue:i,shouldUnregister:t,render:({field:{onChange:f,value:R,ref:z}})=>O(M,{display:"flex",flexDirection:"column",children:[O("div",{style:{display:"flex"},children:[n&&G(M,{item:!0,children:G(v,{label:n,required:b})}),a&&G(M,{item:!0,children:G(So,{title:a,placement:"top",children:G("div",{style:{width:"fit-content"},children:G(wo,{icon:Go,color:"#757575"})})})})]}),G(To,{onChange:(l,o)=>{f(o),d?.(o,C.getValues())},onInputChange:(l,o,E)=>{E==="input"&&setTimeout(()=>{x?.(o,C.getValues())},0)},slotProps:{...s.slotProps||{},paper:{...(s.slotProps||{}).paper||{},sx:{border:`1px solid ${Lo.neutral[30]}`,boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.15)",...(s.slotProps||{}).paper?.sx||{}}}},value:R||(u?[]:null),options:m,multiple:u,readOnly:s.disabled,noOptionsText:O(X,{children:[I||"Nenhum resultado encontrado",c?O(X,{children:[G(M,{py:1,children:G(ye,{})}),c]}):null]}),isOptionEqualToValue:(l,o)=>typeof l=="string"&&typeof o=="string"?l===o:typeof l=="object"&&typeof o=="object"?typeof l.value=="object"&&typeof o.value=="object"&&l.key!==void 0&&o.key!==void 0?l.key===o.key:l.value===o.value:!1,renderOption:(l,o)=>typeof o=="object"?Fe("li",{...l,key:o.key||o.value},O(M,{container:!0,direction:"column",children:[G(M,{item:!0,children:o.label}),o.afterLabel&&G(M,{item:!0,children:o.afterLabel})]})):Fe("li",{...l,key:o},o),ListboxComponent:go(function(o,E){return O(X,{children:[G("ul",{...o,ref:E}),!!c&&G("div",{...o,children:O(X,{children:[G(M,{px:2,py:1,children:G(ye,{})}),c]})},"searchable-footer")]})}),...s,renderInput:l=>G(ko,{error:!!p,placeholder:F,...l,...g,inputRef:z})},e),G(T,{name:e,disableIcon:P})]})})},Ro=Co(Vo);import{forwardRef as Ao,memo as Do}from"react";import{Controller as $o,useFormContext as Mo}from"react-hook-form";import{isObject as zo,isEmpty as qo}from"lodash-es";import{Grid as U,Autocomplete as _o,TextField as Oo}from"@mui/material";import{LIcon as Z,Tooltip as Uo,Button as jo,Divider as No}from"@s_mart/core";import{colorPalette as Ho}from"@s_mart/tokens";import{linePlus as ge,linePen as Wo,lineInfoCircle as Yo}from"@s_mart/solid-icons";import{toRem as Ce}from"@s_mart/utils";import{toRem as Q}from"@s_mart/utils";import Eo from"@emotion/styled";import{css as Pe}from"@emotion/react";var be=Pe`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
5
|
-
`,
|
|
5
|
+
`,Bo=e=>Pe`
|
|
6
6
|
.creatable,
|
|
7
7
|
.editable {
|
|
8
|
-
${
|
|
8
|
+
${be}
|
|
9
9
|
|
|
10
10
|
.divider {
|
|
11
11
|
width: 1px;
|
|
12
|
-
height: ${
|
|
13
|
-
background-color: ${
|
|
12
|
+
height: ${Q(20)};
|
|
13
|
+
background-color: ${e.palette.grey[400]};
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.button {
|
|
17
17
|
display: flex;
|
|
18
18
|
justify-content: center;
|
|
19
19
|
align-items: center;
|
|
20
|
-
color: ${
|
|
20
|
+
color: ${e.palette.grey[600]};
|
|
21
21
|
border-radius: 50%;
|
|
22
22
|
|
|
23
|
-
margin: 0 ${
|
|
24
|
-
width: ${
|
|
25
|
-
height: ${
|
|
23
|
+
margin: 0 ${Q(6)};
|
|
24
|
+
width: ${Q(28)};
|
|
25
|
+
height: ${Q(28)};
|
|
26
26
|
|
|
27
27
|
&:hover {
|
|
28
28
|
cursor: pointer;
|
|
29
|
-
background-color: ${
|
|
29
|
+
background-color: ${e.palette.grey[100]};
|
|
30
30
|
transition: background-color 0.2s ease-in-out;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
`,
|
|
34
|
+
`,he=Eo.div`
|
|
35
35
|
display: flex;
|
|
36
36
|
|
|
37
37
|
div.endAdornments {
|
|
38
38
|
position: absolute;
|
|
39
39
|
right: 0;
|
|
40
40
|
|
|
41
|
-
${
|
|
41
|
+
${be}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
.MuiAutocomplete-endAdornment {
|
|
@@ -46,23 +46,23 @@ var o0=Object.create;var P1=Object.defineProperty;var n0=Object.getOwnPropertyDe
|
|
|
46
46
|
right: 0;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
${({hideAddButton:
|
|
50
|
-
`;import{Fragment as
|
|
49
|
+
${({hideAddButton:e,theme:r})=>!e&&Bo(r)}
|
|
50
|
+
`;import{Fragment as ae,jsx as h,jsxs as A}from"react/jsx-runtime";import{createElement as ve}from"react";var Jo=({name:e,rules:r,defaultValue:i,shouldUnregister:t,label:n,required:b,options:m,editable:g,footer:I,onEditOption:c,onCreateOption:u,textFieldProps:a,hideAddButton:F,multiple:d,info:x,onChange:P,onInputChange:s,placeholder:C,disableIconError:p,...f})=>{let R=Mo();if(!R)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let z=V(R.formState.errors,e),l=F||f.disabled,o=k=>{let q=0;return a?.InputProps||(q+=2.5),l||(q+=2.56,E(k)&&(q+=2.56)),!f.disableClearable&&!f.disabled&&(q+=1.3),q+"rem"},E=k=>f.disabled?!1:g&&zo(k)&&!qo(k);console.warn=()=>{};let w=k=>{u?u(k):console.error("onCreateOption n\xE3o foi definido")},N=k=>{c?c(k):console.error("onEditOption n\xE3o foi definido")};return h($o,{control:R.control,name:e,rules:r,defaultValue:i,shouldUnregister:t,render:({field:{value:k,onChange:q,ref:Le}})=>{let se=k?.label||k?.value||k;return A(U,{display:"flex",flexDirection:"column",children:[A("div",{style:{display:"flex"},children:[n&&h(U,{item:!0,children:h(v,{label:n,required:b})}),x&&h(U,{item:!0,children:h(Uo,{title:x,placement:"top",children:h("div",{style:{width:"fit-content"},children:h(Z,{icon:Yo,color:"#757575"})})})})]}),h(he,{hideAddButton:l,children:h(_o,{fullWidth:!0,onChange:(S,y)=>{q(y),P?.(y,R.getValues())},onInputChange:(S,y,te)=>{te==="input"&&setTimeout(()=>{s?.(y,R.getValues())},0)},slotProps:{...f.slotProps||{},paper:{...(f.slotProps||{}).paper||{},sx:{border:`1px solid ${Ho.neutral[30]}`,boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.15)",...(f.slotProps||{}).paper?.sx||{}}}},options:m,value:k||(d?[]:null),multiple:d,readOnly:f.disabled,noOptionsText:l?void 0:A(jo,{sx:{justifyContent:"flex-start",padding:`${Ce(6)} ${Ce(-16)}`,margin:0},fullWidth:!0,onClick:()=>w(k),variant:"text",startIcon:h(Z,{icon:ge}),children:["Adicionar ",se&&`"${se}"`]}),isOptionEqualToValue:(S,y)=>y?typeof S=="string"&&typeof y=="string"?S===y:typeof S=="object"&&typeof y=="object"?typeof S.value=="object"&&typeof y.value=="object"&&S.key!==void 0&&y.key!==void 0?S.key===y.key:S.value===y.value:typeof S=="object"&&typeof y=="string":!1,renderOption:(S,y)=>typeof y=="object"?ve("li",{...S,key:y.key||y.value},A(U,{container:!0,direction:"column",children:[h(U,{item:!0,children:y.label}),y.afterLabel&&h(U,{item:!0,children:y.afterLabel})]})):ve("li",{...S,key:y},y),ListboxComponent:Ao(function(y,te){return A(ae,{children:[h("ul",{...y,ref:te}),!!I&&h("div",{...y,children:A(ae,{children:[h(U,{px:2,py:1,children:h(No,{})}),I]})},"creatable-footer")]})}),...f,sx:{"& div.MuiInputBase-root":{paddingRight:`${o(k)} !important`},...f.sx},renderInput:S=>h(Oo,{placeholder:C,...S,error:!!z,InputProps:{...S.InputProps,inputRef:Le,endAdornment:A("div",{className:"endAdornments",children:[S.InputProps.endAdornment,!l&&A(ae,{children:[E(k)?A("div",{className:"editable",children:[h("div",{className:"divider"}),h("div",{className:"button",onClick:()=>N(k),children:h(Z,{icon:Wo,size:"24px",removeMargin:!0})})]}):null,A("div",{className:"creatable",children:[h("div",{className:"divider"}),h("div",{className:"button",onClick:()=>w(k),children:h(Z,{icon:ge,size:"24px",removeMargin:!0})})]})]})]})},...a})},e)}),h(T,{name:e,disableIcon:p})]})}})},Ko=Do(Jo);import{Controller as Xo,useFormContext as Qo}from"react-hook-form";import{Grid as Zo,Checkbox as er,FormControlLabel as or}from"@mui/material";import{jsx as Y,jsxs as ir}from"react/jsx-runtime";var rr=({name:e,rules:r,defaultValue:i,shouldUnregister:t,label:n,labelPlacement:b,required:m,disableIconError:g,onChange:I,...c})=>{let u=Qo();if(!u)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return Y(Xo,{control:u.control,name:e,rules:r,defaultValue:i,shouldUnregister:t,render:({field:{value:a,onChange:F}})=>ir(Zo,{display:"flex",flexDirection:"column",children:[Y(or,{control:Y(er,{checked:!!a,value:a??"",defaultValue:a,onChange:(d,x)=>{F(d,x),I?.(d,x)},...c},e),label:Y(v,{label:n,required:m,regular:!0}),labelPlacement:b||"end"}),Y(T,{name:e,disableIcon:g})]})})},tr=rr;import{Controller as lr,useFormContext as nr}from"react-hook-form";import{Grid as ar,Switch as sr,FormControlLabel as dr}from"@mui/material";import{jsx as J,jsxs as ur}from"react/jsx-runtime";var pr=({name:e,rules:r,defaultValue:i,shouldUnregister:t,label:n,labelPlacement:b,disableIconError:m,onChange:g,...I})=>{let c=nr();if(!c)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return J(lr,{control:c.control,name:e,rules:r,defaultValue:i,shouldUnregister:t,render:({field:{value:u,onChange:a}})=>ur(ar,{display:"flex",flexDirection:"column",children:[J(dr,{control:J(sr,{value:u??"",checked:u??!1,defaultValue:u,onChange:(F,d)=>{a(F,d),g?.(F,d)},...I},e),label:J(v,{label:n}),labelPlacement:b||"end"}),J(T,{name:e,disableIcon:m})]})})},mr=pr;import{Grid as fr,Radio as cr,FormControlLabel as xr}from"@mui/material";import{jsx as ee}from"react/jsx-runtime";var yr=({label:e,labelPlacement:r,...i})=>ee(fr,{display:"flex",flexDirection:"column",children:ee(xr,{control:ee(cr,{...i}),label:ee(v,{label:e}),labelPlacement:r||"end"})}),Fr=yr;import{Controller as Pr,useFormContext as br}from"react-hook-form";import{Grid as hr,RadioGroup as gr}from"@mui/material";import{jsx as oe,jsxs as Ir}from"react/jsx-runtime";var Cr=({name:e,rules:r,defaultValue:i,shouldUnregister:t,label:n,required:b,children:m,orientation:g="row",disableIconError:I,...c})=>{let u=br();if(!u)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return oe(Pr,{control:u.control,name:e,rules:r,defaultValue:i,shouldUnregister:t,render:({field:{value:a,onChange:F}})=>Ir(hr,{display:"flex",flexDirection:"column",children:[n&&oe(v,{label:n,required:b}),oe(gr,{value:a||"",name:e,...c,onChange:d=>{c?.onChange?.(d,d.target?.value),F(d)},style:{display:"flex",flexDirection:g},children:m},e),oe(T,{name:e,disableIcon:I})]})})},vr=Cr;import{Controller as Tr,useFormContext as kr}from"react-hook-form";import{Slider as wr}from"@mui/material";import{jsx as Ie}from"react/jsx-runtime";var Sr=({name:e,rules:r,defaultValue:i,shouldUnregister:t,...n})=>{let b=kr();if(!b)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return Ie(Tr,{control:b.control,name:e,rules:r,defaultValue:i,shouldUnregister:t,render:({field:{value:m,onChange:g}})=>Ie(wr,{value:m||n?.min||0,onChange:g,valueLabelDisplay:"auto",...n},e)})},Gr=Sr;import{memo as Br}from"react";import{Controller as Ar,useFormContext as Dr}from"react-hook-form";import{Grid as $r}from"@s_mart/core";import{composeValidators as Mr,date as ke}from"@s_mart/rules";import{TextField as zr}from"@mui/material";import{DatePicker as qr}from"@mui/x-date-pickers/DatePicker";import{AdapterDayjs as _r}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as Or}from"@mui/x-date-pickers/LocalizationProvider";import{ptBR as Ur}from"@mui/x-date-pickers/locales/ptBR";import jr from"dayjs/locale/pt-br";import Lr from"@emotion/styled";import{IconButton as Vr}from"@mui/material";import{toRem as D}from"@s_mart/utils";var Rr=e=>{switch(e){case"small":return D(16);default:case"medium":return D(20);case"large":return D(24)}},Er=e=>{switch(e){case"small":return`${D(2)} ${D(8)}`;default:case"medium":return`${D(6)} ${D(8)}`;case"large":return`${D(10)}`}},Te=Lr(Vr)`
|
|
51
51
|
margin: 0px;
|
|
52
52
|
|
|
53
|
-
padding: ${({size:
|
|
54
|
-
border-radius: 0 ${
|
|
53
|
+
padding: ${({size:e})=>Er(e)};
|
|
54
|
+
border-radius: 0 ${D(4)} ${D(4)} 0;
|
|
55
55
|
|
|
56
56
|
svg {
|
|
57
|
-
width: ${({size:
|
|
57
|
+
width: ${({size:e})=>Rr(e)} !important;
|
|
58
58
|
}
|
|
59
|
-
`;import{jsx as
|
|
59
|
+
`;import{jsx as K,jsxs as Yr}from"react/jsx-runtime";import{createElement as Wr}from"react";var Nr=({rules:e,name:r,defaultValue:i,shouldUnregister:t,datePickerProps:n,label:b,required:m,placeholder:g,disabled:I,disableIconError:c,...u})=>{let a=Dr();if(!a)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let F=V(a.formState.errors,r),d=n?.format||"DD/MM/YYYY",x=e?Mr([ke(d),e]):ke(d);return K(Or,{dateAdapter:_r,adapterLocale:jr,localeText:Ur.components.MuiLocalizationProvider.defaultProps.localeText,children:K(Ar,{control:a.control,name:r,rules:x,defaultValue:i,shouldUnregister:t,render:({field:{value:P,onChange:s,ref:C}})=>Yr($r,{display:"flex",flexDirection:"column",children:[b&&K(v,{label:b,required:m}),Wr(qr,{...n,key:r,value:P??null,format:d,onChange:(p,f)=>{s(p,f),n?.onChange?.(p,f)},disabled:I,slots:{textField:zr,openPickerButton:p=>K(Te,{...p,size:u.size})},slotProps:{textField:p=>({variant:"outlined",...p,error:!!F,...u,inputProps:{...p.inputProps,placeholder:g||p.inputProps?.placeholder},InputProps:{...p.InputProps,inputRef(f){C(f),typeof p.inputRef=="function"&&p.inputRef(f)}}})}}),K(T,{name:r,disableIcon:c})]})})})},Hr=Br(Nr);import{memo as Zr}from"react";import{Controller as et,useFormContext as ot}from"react-hook-form";import{Grid as rt}from"@s_mart/core";import{composeValidators as tt,time as Se}from"@s_mart/rules";import{TextField as it}from"@mui/material";import{TimePicker as lt}from"@mui/x-date-pickers/TimePicker";import{AdapterDayjs as nt}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as at}from"@mui/x-date-pickers/LocalizationProvider";import{ptBR as st}from"@mui/x-date-pickers/locales/ptBR";import dt from"dayjs/locale/pt-br";import Jr from"@emotion/styled";import{IconButton as Kr}from"@mui/material";import{toRem as $}from"@s_mart/utils";var Xr=e=>{switch(e){case"small":return $(16);default:case"medium":return $(20);case"large":return $(24)}},Qr=e=>{switch(e){case"small":return`${$(2)} ${$(8)}`;default:case"medium":return`${$(6)} ${$(8)}`;case"large":return`${$(10)}`}},we=Jr(Kr)`
|
|
60
60
|
margin: 0px;
|
|
61
61
|
|
|
62
|
-
padding: ${({size:
|
|
63
|
-
border-radius: 0 ${
|
|
62
|
+
padding: ${({size:e})=>Qr(e)};
|
|
63
|
+
border-radius: 0 ${$(4)} ${$(4)} 0;
|
|
64
64
|
|
|
65
65
|
svg {
|
|
66
|
-
width: ${({size:
|
|
66
|
+
width: ${({size:e})=>Xr(e)} !important;
|
|
67
67
|
}
|
|
68
|
-
`;import{jsx as
|
|
68
|
+
`;import{jsx as H,jsxs as ut}from"react/jsx-runtime";var pt=({rules:e,defaultValue:r,shouldUnregister:i,name:t,required:n,label:b,timePickerProps:m,placeholder:g,disabled:I,disableIconError:c,...u})=>{let a=ot();if(!a)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let F=V(a.formState.errors,t),d=m?.format||"HH:mm",x=e?tt([Se(d),e]):Se(d);return H(at,{dateAdapter:nt,adapterLocale:dt,localeText:st.components.MuiLocalizationProvider.defaultProps.localeText,children:H(et,{control:a.control,name:t,rules:x,defaultValue:r,shouldUnregister:i,render:({field:{value:P,onChange:s,ref:C}})=>ut(rt,{display:"flex",flexDirection:"column",children:[b&&H(v,{label:b,required:n}),H(lt,{ampm:!1,format:d,value:P??null,disabled:I,...m,onChange:(p,f)=>{s(p,f),m?.onChange?.(p,f)},slots:{textField:it,openPickerButton:p=>H(we,{...p,size:u.size})},slotProps:{textField:p=>({variant:"outlined",...p,error:!!F,...u,inputProps:{...p.inputProps,placeholder:g||p.inputProps?.placeholder},InputProps:{...p.InputProps,inputRef(f){C(f),typeof p.inputRef=="function"&&p.inputRef(f)}}})}},t),H(T,{name:t,disableIcon:c})]})})})},mt=Zr(pt);import{memo as ft}from"react";import{Controller as ct,useFormContext as xt}from"react-hook-form";import{Autocomplete as yt,TextField as Ft}from"@mui/material";import{Grid as re}from"@s_mart/core";import{colorPalette as Pt}from"@s_mart/tokens";import{jsx as j,jsxs as Ge}from"react/jsx-runtime";import{createElement as gt}from"react";var bt=({name:e,defaultValue:r,rules:i,shouldUnregister:t,label:n,required:b,noOptionsText:m,placeholder:g,onInputChange:I,onChange:c,disableIconError:u,...a})=>{let F=xt();if(!F)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let d=V(F.formState.errors,e);return console.warn=()=>{},j(ct,{name:e,control:F.control,defaultValue:r,rules:i,shouldUnregister:t,render:({field:x})=>Ge(re,{display:"flex",flexDirection:"column",children:[n&&j(v,{label:n,required:b}),j(yt,{onChange:(P,s)=>{x.onChange(s),c?.(s,F.getValues())},onInputChange:(P,s,C)=>{C==="input"&&(x.onChange(s),setTimeout(()=>{I?.(s,F.getValues())},0))},slotProps:{...a.slotProps||{},paper:{...(a.slotProps||{}).paper||{},sx:{border:`1px solid ${Pt.neutral[30]}`,boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.15)",...(a.slotProps||{}).paper?.sx||{}}}},isOptionEqualToValue:(P,s)=>P.value===s.value,renderOption:(P,s)=>gt("li",{...P,key:s.key||s.value,onClick:C=>{P.onClick?.(C),x.onChange(s)}},Ge(re,{container:!0,direction:"column",children:[j(re,{item:!0,children:s.label}),s.afterLabel&&j(re,{item:!0,children:s.afterLabel})]})),value:x.value||null,readOnly:a.disabled,noOptionsText:m||"Nenhuma op\xE7\xE3o encontrada",...a,renderInput:P=>j(Ft,{placeholder:g,...P,...a.textFieldProps,error:!!d,InputProps:{...P.InputProps,...a.textFieldProps?.InputProps,inputRef:x.ref,inputProps:{...P.inputProps,...a.textFieldProps?.InputProps?.inputProps}}})},e),j(T,{name:e,disableIcon:u})]})})},ht=ft(bt);export{ht as Autocomplete,tr as Checkbox,Ko as Creatable,Hr as DatePicker,v as FieldLabel,Me as Form,ie as FormProvider,Fr as RadioButton,vr as RadioGroup,Ro as Searchable,bo as Select,Gr as Slider,mr as Switch,to as TextField,mt as TimePicker,le as useForm};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@s_mart/form",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -9,47 +9,52 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist/**"
|
|
11
11
|
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"build": "tsup src/index.tsx --minify --format esm,cjs --dts --external react",
|
|
14
|
-
"dev": "tsup src/index.tsx --format esm,cjs --watch --dts --external react",
|
|
15
|
-
"lint": "eslint src/**/*.ts* --fix"
|
|
16
|
-
},
|
|
17
12
|
"dependencies": {
|
|
18
13
|
"@hookform/resolvers": "^3.1.0",
|
|
19
|
-
"
|
|
20
|
-
"@s_mart/masks": "*",
|
|
21
|
-
"@s_mart/rules": "*",
|
|
22
|
-
"@s_mart/tokens": "*",
|
|
23
|
-
"@s_mart/typed": "*",
|
|
24
|
-
"@s_mart/utils": "*",
|
|
14
|
+
"dayjs": "^1.11.10",
|
|
25
15
|
"@types/react": "^18.2.21",
|
|
26
16
|
"@types/react-dom": "^18.2.7",
|
|
27
|
-
"lodash": "
|
|
17
|
+
"@types/lodash-es": ">=4.17.12",
|
|
18
|
+
"lodash-es": "^4.17.21",
|
|
28
19
|
"tsup": "^6.7.0",
|
|
29
|
-
"typescript": "^5.2.2"
|
|
20
|
+
"typescript": "^5.2.2",
|
|
21
|
+
"@s_mart/core": "5.0.0",
|
|
22
|
+
"@s_mart/masks": "5.0.0",
|
|
23
|
+
"eslint-config-smarten": "4.0.1",
|
|
24
|
+
"@s_mart/rules": "5.0.0",
|
|
25
|
+
"@s_mart/solid-icons": "5.0.0",
|
|
26
|
+
"@s_mart/regular-icons": "5.0.0",
|
|
27
|
+
"@s_mart/tokens": "5.0.0",
|
|
28
|
+
"@s_mart/typed": "5.0.0",
|
|
29
|
+
"@s_mart/utils": "5.0.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@emotion/react": ">=11.10.8",
|
|
33
33
|
"@emotion/styled": ">=11.10.8",
|
|
34
34
|
"@mui/material": ">=5.14.6",
|
|
35
35
|
"@mui/x-date-pickers": ">=6.3.0",
|
|
36
|
-
"@s_mart/core": "*",
|
|
37
|
-
"@s_mart/masks": "*",
|
|
38
|
-
"@s_mart/rules": "*",
|
|
39
|
-
"@s_mart/tokens": "*",
|
|
40
|
-
"@s_mart/typed": "*",
|
|
41
|
-
"@s_mart/utils": "*",
|
|
42
36
|
"@types/react": ">=18.2.5",
|
|
43
37
|
"@types/react-dom": ">=18.2.7",
|
|
38
|
+
"@types/lodash-es": ">=4.17.12",
|
|
39
|
+
"dayjs": "^1.11.10",
|
|
44
40
|
"react": ">=18.2.0",
|
|
45
41
|
"react-dom": ">=18.2.0",
|
|
46
42
|
"react-hook-form": ">=7.36.1",
|
|
47
43
|
"typescript": ">=5.2.2",
|
|
48
|
-
"zod": ">=3.21.4"
|
|
44
|
+
"zod": ">=3.21.4",
|
|
45
|
+
"@s_mart/core": "5.0.0",
|
|
46
|
+
"@s_mart/masks": "5.0.0",
|
|
47
|
+
"@s_mart/rules": "5.0.0",
|
|
48
|
+
"@s_mart/tokens": "5.0.0",
|
|
49
|
+
"@s_mart/typed": "5.0.0",
|
|
50
|
+
"@s_mart/utils": "5.0.0"
|
|
49
51
|
},
|
|
50
52
|
"devDependencies": {
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
"eslint": "^8.47.0"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsup src/index.tsx --minify --format esm --dts --external react",
|
|
57
|
+
"dev": "tsup src/index.tsx --format esm --watch --dts --external react",
|
|
58
|
+
"lint": "eslint src/**/*.ts* --fix"
|
|
54
59
|
}
|
|
55
|
-
}
|
|
60
|
+
}
|
package/dist/index.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";var u2=Object.create;var k1=Object.defineProperty;var M2=Object.getOwnPropertyDescriptor;var H2=Object.getOwnPropertyNames;var f2=Object.getPrototypeOf,V2=Object.prototype.hasOwnProperty;var n0=(c,i)=>()=>(i||c((i={exports:{}}).exports,i),i.exports),g2=(c,i)=>{for(var t in i)k1(c,t,{get:i[t],enumerable:!0})},h0=(c,i,t,d)=>{if(i&&typeof i=="object"||typeof i=="function")for(let h of H2(i))!V2.call(c,h)&&h!==t&&k1(c,h,{get:()=>i[h],enumerable:!(d=M2(i,h))||d.enumerable});return c};var m1=(c,i,t)=>(t=c!=null?u2(f2(c)):{},h0(i||!c||!c.__esModule?k1(t,"default",{value:c,enumerable:!0}):t,c)),L2=c=>h0(k1({},"__esModule",{value:!0}),c);var G0=n0((a0,e0)=>{(function(c,i){typeof a0=="object"&&typeof e0<"u"?e0.exports=i():typeof define=="function"&&define.amd?define(i):(c=typeof globalThis<"u"?globalThis:c||self).dayjs=i()})(a0,function(){"use strict";var c=1e3,i=6e4,t=36e5,d="millisecond",h="second",x="minute",V="hour",y="day",P="week",M="month",k="quarter",m="year",b="date",g="Invalid Date",A=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,F=/\[([^\]]+)]|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,H={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(o){var e=["th","st","nd","rd"],a=o%100;return"["+o+(e[(a-20)%10]||e[a]||e[0])+"]"}},D=function(o,e,a){var s=String(o);return!s||s.length>=e?o:""+Array(e+1-s.length).join(a)+o},L={s:D,z:function(o){var e=-o.utcOffset(),a=Math.abs(e),s=Math.floor(a/60),l=a%60;return(e<=0?"+":"-")+D(s,2,"0")+":"+D(l,2,"0")},m:function o(e,a){if(e.date()<a.date())return-o(a,e);var s=12*(a.year()-e.year())+(a.month()-e.month()),l=e.clone().add(s,M),r=a-l<0,Z=e.clone().add(s+(r?-1:1),M);return+(-(s+(a-l)/(r?l-Z:Z-l))||0)},a:function(o){return o<0?Math.ceil(o)||0:Math.floor(o)},p:function(o){return{M,y:m,w:P,d:y,D:b,h:V,m:x,s:h,ms:d,Q:k}[o]||String(o||"").toLowerCase().replace(/s$/,"")},u:function(o){return o===void 0}},f="en",B={};B[f]=H;var q=function(o){return o instanceof O},p=function o(e,a,s){var l;if(!e)return f;if(typeof e=="string"){var r=e.toLowerCase();B[r]&&(l=r),a&&(B[r]=a,l=r);var Z=e.split("-");if(!l&&Z.length>1)return o(Z[0])}else{var S=e.name;B[S]=e,l=S}return!s&&l&&(f=l),l||!s&&f},n=function(o,e){if(q(o))return o.clone();var a=typeof e=="object"?e:{};return a.date=o,a.args=arguments,new O(a)},v=L;v.l=p,v.i=q,v.w=function(o,e){return n(o,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var O=function(){function o(a){this.$L=p(a.locale,null,!0),this.parse(a)}var e=o.prototype;return e.parse=function(a){this.$d=function(s){var l=s.date,r=s.utc;if(l===null)return new Date(NaN);if(v.u(l))return new Date;if(l instanceof Date)return new Date(l);if(typeof l=="string"&&!/Z$/i.test(l)){var Z=l.match(A);if(Z){var S=Z[2]-1||0,$=(Z[7]||"0").substring(0,3);return r?new Date(Date.UTC(Z[1],S,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,$)):new Date(Z[1],S,Z[3]||1,Z[4]||0,Z[5]||0,Z[6]||0,$)}}return new Date(l)}(a),this.$x=a.x||{},this.init()},e.init=function(){var a=this.$d;this.$y=a.getFullYear(),this.$M=a.getMonth(),this.$D=a.getDate(),this.$W=a.getDay(),this.$H=a.getHours(),this.$m=a.getMinutes(),this.$s=a.getSeconds(),this.$ms=a.getMilliseconds()},e.$utils=function(){return v},e.isValid=function(){return this.$d.toString()!==g},e.isSame=function(a,s){var l=n(a);return this.startOf(s)<=l&&l<=this.endOf(s)},e.isAfter=function(a,s){return n(a)<this.startOf(s)},e.isBefore=function(a,s){return this.endOf(s)<n(a)},e.$g=function(a,s,l){return v.u(a)?this[s]:this.set(l,a)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(a,s){var l=this,r=!!v.u(s)||s,Z=v.p(a),S=function(s1,R){var l1=v.w(l.$u?Date.UTC(l.$y,R,s1):new Date(l.$y,R,s1),l);return r?l1:l1.endOf(y)},$=function(s1,R){return v.w(l.toDate()[s1].apply(l.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(R)),l)},_=this.$W,E=this.$M,j=this.$D,d1="set"+(this.$u?"UTC":"");switch(Z){case m:return r?S(1,0):S(31,11);case M:return r?S(1,E):S(0,E+1);case P:var h1=this.$locale().weekStart||0,M1=(_<h1?_+7:_)-h1;return S(r?j-M1:j+(6-M1),E);case y:case b:return $(d1+"Hours",0);case V:return $(d1+"Minutes",1);case x:return $(d1+"Seconds",2);case h:return $(d1+"Milliseconds",3);default:return this.clone()}},e.endOf=function(a){return this.startOf(a,!1)},e.$set=function(a,s){var l,r=v.p(a),Z="set"+(this.$u?"UTC":""),S=(l={},l[y]=Z+"Date",l[b]=Z+"Date",l[M]=Z+"Month",l[m]=Z+"FullYear",l[V]=Z+"Hours",l[x]=Z+"Minutes",l[h]=Z+"Seconds",l[d]=Z+"Milliseconds",l)[r],$=r===y?this.$D+(s-this.$W):s;if(r===M||r===m){var _=this.clone().set(b,1);_.$d[S]($),_.init(),this.$d=_.set(b,Math.min(this.$D,_.daysInMonth())).$d}else S&&this.$d[S]($);return this.init(),this},e.set=function(a,s){return this.clone().$set(a,s)},e.get=function(a){return this[v.p(a)]()},e.add=function(a,s){var l,r=this;a=Number(a);var Z=v.p(s),S=function(E){var j=n(r);return v.w(j.date(j.date()+Math.round(E*a)),r)};if(Z===M)return this.set(M,this.$M+a);if(Z===m)return this.set(m,this.$y+a);if(Z===y)return S(1);if(Z===P)return S(7);var $=(l={},l[x]=i,l[V]=t,l[h]=c,l)[Z]||1,_=this.$d.getTime()+a*$;return v.w(_,this)},e.subtract=function(a,s){return this.add(-1*a,s)},e.format=function(a){var s=this,l=this.$locale();if(!this.isValid())return l.invalidDate||g;var r=a||"YYYY-MM-DDTHH:mm:ssZ",Z=v.z(this),S=this.$H,$=this.$m,_=this.$M,E=l.weekdays,j=l.months,d1=l.meridiem,h1=function(R,l1,H1,x1){return R&&(R[l1]||R(s,r))||H1[l1].slice(0,x1)},M1=function(R){return v.s(S%12||12,R,"0")},s1=d1||function(R,l1,H1){var x1=R<12?"AM":"PM";return H1?x1.toLowerCase():x1};return r.replace(F,function(R,l1){return l1||function(H1){switch(H1){case"YY":return String(s.$y).slice(-2);case"YYYY":return v.s(s.$y,4,"0");case"M":return _+1;case"MM":return v.s(_+1,2,"0");case"MMM":return h1(l.monthsShort,_,j,3);case"MMMM":return h1(j,_);case"D":return s.$D;case"DD":return v.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return h1(l.weekdaysMin,s.$W,E,2);case"ddd":return h1(l.weekdaysShort,s.$W,E,3);case"dddd":return E[s.$W];case"H":return String(S);case"HH":return v.s(S,2,"0");case"h":return M1(1);case"hh":return M1(2);case"a":return s1(S,$,!0);case"A":return s1(S,$,!1);case"m":return String($);case"mm":return v.s($,2,"0");case"s":return String(s.$s);case"ss":return v.s(s.$s,2,"0");case"SSS":return v.s(s.$ms,3,"0");case"Z":return Z}return null}(R)||Z.replace(":","")})},e.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},e.diff=function(a,s,l){var r,Z=this,S=v.p(s),$=n(a),_=($.utcOffset()-this.utcOffset())*i,E=this-$,j=function(){return v.m(Z,$)};switch(S){case m:r=j()/12;break;case M:r=j();break;case k:r=j()/3;break;case P:r=(E-_)/6048e5;break;case y:r=(E-_)/864e5;break;case V:r=E/t;break;case x:r=E/i;break;case h:r=E/c;break;default:r=E}return l?r:v.a(r)},e.daysInMonth=function(){return this.endOf(M).$D},e.$locale=function(){return B[this.$L]},e.locale=function(a,s){if(!a)return this.$L;var l=this.clone(),r=p(a,s,!0);return r&&(l.$L=r),l},e.clone=function(){return v.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},o}(),n1=O.prototype;return n.prototype=n1,[["$ms",d],["$s",h],["$m",x],["$H",V],["$W",y],["$M",M],["$y",m],["$D",b]].forEach(function(o){n1[o[1]]=function(e){return this.$g(e,o[0],o[1])}}),n.extend=function(o,e){return o.$i||(o(e,O,n),o.$i=!0),n},n.locale=p,n.isDayjs=q,n.unix=function(o){return n(1e3*o)},n.en=B[f],n.Ls=B,n.p={},n})});var o0=n0((i0,r0)=>{(function(c,i){typeof i0=="object"&&typeof r0<"u"?r0.exports=i(G0()):typeof define=="function"&&define.amd?define(["dayjs"],i):(c=typeof globalThis<"u"?globalThis:c||self).dayjs_locale_pt_br=i(c.dayjs)})(i0,function(c){"use strict";function i(h){return h&&typeof h=="object"&&"default"in h?h:{default:h}}var t=i(c),d={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(h){return h+"\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 t.default.locale(d,null,!0),d})});var z2={};g2(z2,{Autocomplete:()=>Z2,Checkbox:()=>D0,Creatable:()=>T0,DatePicker:()=>Q0,FieldLabel:()=>T,Form:()=>m0,FormProvider:()=>A1,RadioButton:()=>B0,RadioGroup:()=>I0,Searchable:()=>A0,Select:()=>x0,Slider:()=>E0,Switch:()=>$0,TextField:()=>y0,TimePicker:()=>v2,useForm:()=>F1});module.exports=L2(z2);var s0=require("react-hook-form"),W1=require("react/jsx-runtime");function y2({children:c,style:i,onSubmit:t,...d}){return(0,W1.jsx)(s0.FormProvider,{...d,children:(0,W1.jsx)("form",{onSubmit:h=>{h.preventDefault(),h.stopPropagation(),t(h)},style:i,children:c})})}var A1=y2;var t0=require("react"),v0=require("react-hook-form"),d0=require("@hookform/resolvers/zod"),b2=({disableDefaultValuesUpdate:c,onSubmit:i,...t})=>{let d=(0,v0.useForm)({...t,resolver:t.schema&&(0,d0.zodResolver)(t.schema)});return(0,t0.useEffect)(()=>{c||d.reset(t.defaultValues)},[t.defaultValues,d.reset]),{...d,onSubmit:d.handleSubmit(h=>i(h,d))}},F1=b2;var Z0=require("react/jsx-runtime");function C2({children:c,style:i,...t}){let d=F1(t);return(0,Z0.jsx)(A1,{...d,style:i,children:typeof c=="function"?c(d):c})}var m0=C2;var P1=require("react"),S1=require("react-hook-form"),e1=require("@mui/material");var p0={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"},u0={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 a1={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 M0={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 N1={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 L0=m1(require("@s_mart/masks"));var J1=require("@mui/material"),H0=require("@s_mart/utils"),f1=require("react/jsx-runtime"),x2=({label:c,required:i,regular:t})=>(0,f1.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:(0,H0.toRem)(2)},children:[(0,f1.jsx)(J1.Typography,{variant:"caption",fontWeight:t?400:700,style:{display:"flex",alignItems:"center"},children:c}),i&&(0,f1.jsx)(J1.Typography,{variant:"caption",fontWeight:900,color:"error",children:"*"})]}),T=x2;var f0=require("react-hook-form"),V0=require("@s_mart/core");var G=(c,i)=>i.replace(/[[\]]/g,"").split(".").reduce((d,h)=>d?.[h],c);var g0=require("react/jsx-runtime"),I=({name:c,disableIcon:i})=>{let t=(0,f0.useFormContext)(),d=G(t?.formState?.errors,c);return d?(0,g0.jsx)(V0.Indicator,{severity:"error",icon:i?!1:void 0,children:d?.message}):null};var V1=require("@s_mart/core");var U=require("react/jsx-runtime"),k2=({name:c,rules:i,defaultValue:t,shouldUnregister:d,label:h,required:x,mask:V,variant:y="outlined",info:P,parse:M,inputMode:k,format:m,onInputChange:b,disableIconError:g,...A})=>{let F=(0,S1.useFormContext)();if(!F)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[H,D]=(0,P1.useState)(!1),L=p=>{let n=p;return m&&(n=m(p)),V?L0?.[V]?.format(n):n},f=p=>{let n=p;return M&&(n=M(p)),V?L0?.[V]?.parse(n):n},B=p=>{if(!p||V!=="porcentagem"&&V!=="porcentagem0")return;p?.stopPropagation();let n=(p?.target).value;if(n){let v=String(n);if(v.length>0){let O=v.indexOf("%");O>-1&&(p.currentTarget.selectionEnd=O)}}},q=G(F.formState.errors,c);return(0,U.jsx)(S1.Controller,{control:F.control,name:c,rules:i,defaultValue:t,shouldUnregister:d,render:({field:{value:p,onChange:n,ref:v}})=>(0,U.jsxs)(e1.Grid,{display:"flex",flexDirection:"column",children:[(0,U.jsxs)("div",{style:{display:"flex"},children:[h&&(0,U.jsx)(e1.Grid,{item:!0,children:(0,U.jsx)(T,{label:h,required:x})}),P&&(0,U.jsx)(e1.Grid,{item:!0,children:(0,U.jsx)(V1.Tooltip,{title:P,placement:"top",children:(0,U.jsx)("div",{style:{width:"fit-content"},children:(0,U.jsx)(V1.LIcon,{icon:a1,color:"#757575"})})})})]}),(0,U.jsx)(e1.TextField,{variant:y,defaultValue:t,value:L(p||(p!=0?"":p)),onChange:O=>{let n1=f(O?.target?.value);n(n1),b?.(n1,F.getValues())},error:!!q,...A,type:A.type==="password"?H?"text":"password":A.type,autoComplete:A.autoComplete||"off",inputProps:{inputMode:k,...A.inputProps},InputProps:{onKeyDown:B,inputRef:v,endAdornment:A.type==="password"&&(0,U.jsx)(e1.InputAdornment,{position:"start",onClick:()=>D(!H),style:{cursor:"pointer"},children:(0,U.jsx)(V1.LIcon,{icon:H?p0:u0,size:"24px",removeMargin:!0})}),...A.InputProps}},c),(0,U.jsx)(I,{name:c,disableIcon:g})]})})},y0=(0,P1.memo)(k2);var w1=require("react"),T1=require("react-hook-form"),X=require("@s_mart/core");var b0={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 C0=require("@s_mart/tokens"),z=require("@mui/material");var w=require("react/jsx-runtime"),A2=({name:c,rules:i,defaultValue:t,shouldUnregister:d,label:h,required:x,options:V,placeholder:y,clearable:P,disableOnChangeForm:M=!1,multiple:k,info:m,footer:b,onChange:g,disableIconError:A,...F})=>{let H=(0,T1.useFormContext)(),{palette:D}=(0,z.useTheme)(),[L,f]=(0,w1.useState)(!1);if(!H)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let B=G(H.formState.errors,c);return console.warn=()=>{},(0,w.jsx)(T1.Controller,{control:H.control,name:c,rules:i,defaultValue:t,shouldUnregister:d,render:({field:{value:q,onChange:p,ref:n}})=>(0,w.jsxs)(z.Grid,{display:"flex",flexDirection:"column",children:[(0,w.jsxs)("div",{style:{display:"flex"},children:[h&&(0,w.jsx)(z.Grid,{item:!0,children:(0,w.jsx)(T,{label:h,required:x})}),m&&(0,w.jsx)(z.Grid,{item:!0,children:(0,w.jsx)(X.Tooltip,{title:m,placement:"top",children:(0,w.jsx)("div",{style:{width:"fit-content"},children:(0,w.jsx)(X.LIcon,{icon:a1,color:"#757575"})})})})]}),(0,w.jsxs)(z.Select,{open:L,onOpen:()=>f(!0),onClose:()=>f(!1),displayEmpty:!!y,variant:"outlined",autoComplete:"off",value:q?q||"":k?[]:"",renderValue:v=>{if(v.label)return v.label;if(y)return(0,w.jsx)("p",{style:{color:D.grey[400]},children:y})},multiple:k,onChange:v=>{!M&&p(v.target.value),g&&g(v.target.value,H.getValues())},error:!!B,size:F.size||"medium",inputRef:n,...F,endAdornment:(0,w.jsxs)(w.Fragment,{children:[F.endAdornment,!!(P&&q)&&(0,w.jsx)(X.IconButton,{variant:"text",color:"neutral",size:"small",sx:{borderRadius:"50%",position:"absolute",right:"2rem"},style:{padding:0},"aria-label":"Clear",title:"Clear",onClick:()=>{!M&&p(null),g&&g(null,H.getValues())},children:(0,w.jsx)(X.LIcon,{icon:b0,color:C0.colorPalette.neutral[100],size:"25px",removeMargin:!0})})]}),children:[V?.map((v,O)=>(0,w.jsx)(z.MenuItem,{value:v,children:(0,w.jsxs)(z.Grid,{container:!0,direction:"column",children:[(0,w.jsx)(z.Grid,{item:!0,children:v.label}),v.afterLabel&&(0,w.jsx)(z.Grid,{item:!0,children:v.afterLabel})]})},O)),b&&[(0,w.jsx)(z.Grid,{px:2,py:1,children:(0,w.jsx)(X.Divider,{})},"footer-divider"),(0,w.jsx)("div",{children:b({closeSelect:()=>f(!1)})},"footer-content")]]},c),(0,w.jsx)(I,{name:c,disableIcon:A})]})})},x0=(0,w1.memo)(A2);var D1=require("react"),$1=require("react-hook-form"),Y=require("@mui/material"),t1=require("@s_mart/core");var k0=require("@s_mart/tokens");var C=require("react/jsx-runtime"),K1=require("react"),F2=({name:c,rules:i,defaultValue:t,shouldUnregister:d,label:h,required:x,options:V,textFieldProps:y,noOptionsText:P,footer:M,multiple:k,info:m,placeholder:b,onChange:g,onInputChange:A,disableIconError:F,...H})=>{let D=(0,$1.useFormContext)();if(!D)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let L=G(D.formState.errors,c);return console.warn=()=>{},(0,C.jsx)($1.Controller,{control:D.control,name:c,rules:i,defaultValue:t,shouldUnregister:d,render:({field:{onChange:f,value:B,ref:q}})=>(0,C.jsxs)(Y.Grid,{display:"flex",flexDirection:"column",children:[(0,C.jsxs)("div",{style:{display:"flex"},children:[h&&(0,C.jsx)(Y.Grid,{item:!0,children:(0,C.jsx)(T,{label:h,required:x})}),m&&(0,C.jsx)(Y.Grid,{item:!0,children:(0,C.jsx)(t1.Tooltip,{title:m,placement:"top",children:(0,C.jsx)("div",{style:{width:"fit-content"},children:(0,C.jsx)(t1.LIcon,{icon:a1,color:"#757575"})})})})]}),(0,C.jsx)(Y.Autocomplete,{onChange:(p,n)=>{f(n),g?.(n,D.getValues())},onInputChange:(p,n,v)=>{v==="input"&&setTimeout(()=>{A?.(n,D.getValues())},0)},slotProps:{...H.slotProps||{},paper:{...(H.slotProps||{}).paper||{},sx:{border:`1px solid ${k0.colorPalette.neutral[30]}`,boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.15)",...(H.slotProps||{}).paper?.sx||{}}}},value:B||(k?[]:null),options:V,multiple:k,readOnly:H.disabled,noOptionsText:(0,C.jsxs)(C.Fragment,{children:[P||"Nenhum resultado encontrado",M?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Y.Grid,{py:1,children:(0,C.jsx)(t1.Divider,{})}),M]}):null]}),isOptionEqualToValue:(p,n)=>typeof p=="string"&&typeof n=="string"?p===n:typeof p=="object"&&typeof n=="object"?typeof p.value=="object"&&typeof n.value=="object"&&p.key!==void 0&&n.key!==void 0?p.key===n.key:p.value===n.value:!1,renderOption:(p,n)=>typeof n=="object"?(0,K1.createElement)("li",{...p,key:n.key||n.value},(0,C.jsxs)(Y.Grid,{container:!0,direction:"column",children:[(0,C.jsx)(Y.Grid,{item:!0,children:n.label}),n.afterLabel&&(0,C.jsx)(Y.Grid,{item:!0,children:n.afterLabel})]})):(0,K1.createElement)("li",{...p,key:n},n),ListboxComponent:(0,D1.forwardRef)(function(n,v){return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("ul",{...n,ref:v}),!!M&&(0,C.jsx)("div",{...n,children:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Y.Grid,{px:2,py:1,children:(0,C.jsx)(t1.Divider,{})}),M]})},"searchable-footer")]})}),...H,renderInput:p=>(0,C.jsx)(Y.TextField,{error:!!L,placeholder:b,...p,...y,inputRef:q})},c),(0,C.jsx)(I,{name:c,disableIcon:F})]})})},A0=(0,D1.memo)(F2);var B1=require("react"),I1=require("react-hook-form"),_1=require("lodash"),W=require("@mui/material"),N=require("@s_mart/core"),w0=require("@s_mart/tokens");var X1=require("@s_mart/utils");var g1=require("@s_mart/utils"),F0=m1(require("@emotion/styled")),Q1=require("@emotion/react"),P0=Q1.css`
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
justify-content: center;
|
|
5
|
-
`,P2=c=>Q1.css`
|
|
6
|
-
.creatable,
|
|
7
|
-
.editable {
|
|
8
|
-
${P0}
|
|
9
|
-
|
|
10
|
-
.divider {
|
|
11
|
-
width: 1px;
|
|
12
|
-
height: ${(0,g1.toRem)(20)};
|
|
13
|
-
background-color: ${c.palette.grey[400]};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.button {
|
|
17
|
-
display: flex;
|
|
18
|
-
justify-content: center;
|
|
19
|
-
align-items: center;
|
|
20
|
-
color: ${c.palette.grey[600]};
|
|
21
|
-
border-radius: 50%;
|
|
22
|
-
|
|
23
|
-
margin: 0 ${(0,g1.toRem)(6)};
|
|
24
|
-
width: ${(0,g1.toRem)(28)};
|
|
25
|
-
height: ${(0,g1.toRem)(28)};
|
|
26
|
-
|
|
27
|
-
&:hover {
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
background-color: ${c.palette.grey[100]};
|
|
30
|
-
transition: background-color 0.2s ease-in-out;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
`,S0=F0.default.div`
|
|
35
|
-
display: flex;
|
|
36
|
-
|
|
37
|
-
div.endAdornments {
|
|
38
|
-
position: absolute;
|
|
39
|
-
right: 0;
|
|
40
|
-
|
|
41
|
-
${P0}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.MuiAutocomplete-endAdornment {
|
|
45
|
-
position: relative;
|
|
46
|
-
right: 0;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
${({hideAddButton:c,theme:i})=>!c&&P2(i)}
|
|
50
|
-
`;var u=require("react/jsx-runtime"),c0=require("react"),S2=({name:c,rules:i,defaultValue:t,shouldUnregister:d,label:h,required:x,options:V,editable:y,footer:P,onEditOption:M,onCreateOption:k,textFieldProps:m,hideAddButton:b,multiple:g,info:A,onChange:F,onInputChange:H,placeholder:D,disableIconError:L,...f})=>{let B=(0,I1.useFormContext)();if(!B)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let q=G(B.formState.errors,c),p=b||f.disabled,n=o=>{let e=0;return m?.InputProps||(e+=2.5),p||(e+=2.56,v(o)&&(e+=2.56)),!f.disableClearable&&!f.disabled&&(e+=1.3),e+"rem"},v=o=>f.disabled?!1:y&&(0,_1.isObject)(o)&&!(0,_1.isEmpty)(o);console.warn=()=>{};let O=o=>{k?k(o):console.error("onCreateOption n\xE3o foi definido")},n1=o=>{M?M(o):console.error("onEditOption n\xE3o foi definido")};return(0,u.jsx)(I1.Controller,{control:B.control,name:c,rules:i,defaultValue:t,shouldUnregister:d,render:({field:{value:o,onChange:e,ref:a}})=>{let s=o?.label||o?.value||o;return(0,u.jsxs)(W.Grid,{display:"flex",flexDirection:"column",children:[(0,u.jsxs)("div",{style:{display:"flex"},children:[h&&(0,u.jsx)(W.Grid,{item:!0,children:(0,u.jsx)(T,{label:h,required:x})}),A&&(0,u.jsx)(W.Grid,{item:!0,children:(0,u.jsx)(N.Tooltip,{title:A,placement:"top",children:(0,u.jsx)("div",{style:{width:"fit-content"},children:(0,u.jsx)(N.LIcon,{icon:a1,color:"#757575"})})})})]}),(0,u.jsx)(S0,{hideAddButton:p,children:(0,u.jsx)(W.Autocomplete,{fullWidth:!0,onChange:(l,r)=>{e(r),F?.(r,B.getValues())},onInputChange:(l,r,Z)=>{Z==="input"&&setTimeout(()=>{H?.(r,B.getValues())},0)},slotProps:{...f.slotProps||{},paper:{...(f.slotProps||{}).paper||{},sx:{border:`1px solid ${w0.colorPalette.neutral[30]}`,boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.15)",...(f.slotProps||{}).paper?.sx||{}}}},options:V,value:o||(g?[]:null),multiple:g,readOnly:f.disabled,noOptionsText:p?void 0:(0,u.jsxs)(N.Button,{sx:{justifyContent:"flex-start",padding:`${(0,X1.toRem)(6)} ${(0,X1.toRem)(-16)}`,margin:0},fullWidth:!0,onClick:()=>O(o),variant:"text",startIcon:(0,u.jsx)(N.LIcon,{icon:N1}),children:["Adicionar ",s&&`"${s}"`]}),isOptionEqualToValue:(l,r)=>r?typeof l=="string"&&typeof r=="string"?l===r:typeof l=="object"&&typeof r=="object"?typeof l.value=="object"&&typeof r.value=="object"&&l.key!==void 0&&r.key!==void 0?l.key===r.key:l.value===r.value:typeof l=="object"&&typeof r=="string":!1,renderOption:(l,r)=>typeof r=="object"?(0,c0.createElement)("li",{...l,key:r.key||r.value},(0,u.jsxs)(W.Grid,{container:!0,direction:"column",children:[(0,u.jsx)(W.Grid,{item:!0,children:r.label}),r.afterLabel&&(0,u.jsx)(W.Grid,{item:!0,children:r.afterLabel})]})):(0,c0.createElement)("li",{...l,key:r},r),ListboxComponent:(0,B1.forwardRef)(function(r,Z){return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("ul",{...r,ref:Z}),!!P&&(0,u.jsx)("div",{...r,children:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(W.Grid,{px:2,py:1,children:(0,u.jsx)(N.Divider,{})}),P]})},"creatable-footer")]})}),...f,sx:{"& div.MuiInputBase-root":{paddingRight:`${n(o)} !important`},...f.sx},renderInput:l=>(0,u.jsx)(W.TextField,{placeholder:D,...l,error:!!q,InputProps:{...l.InputProps,inputRef:a,endAdornment:(0,u.jsxs)("div",{className:"endAdornments",children:[l.InputProps.endAdornment,!p&&(0,u.jsxs)(u.Fragment,{children:[v(o)?(0,u.jsxs)("div",{className:"editable",children:[(0,u.jsx)("div",{className:"divider"}),(0,u.jsx)("div",{className:"button",onClick:()=>n1(o),children:(0,u.jsx)(N.LIcon,{icon:M0,size:"24px",removeMargin:!0})})]}):null,(0,u.jsxs)("div",{className:"creatable",children:[(0,u.jsx)("div",{className:"divider"}),(0,u.jsx)("div",{className:"button",onClick:()=>O(o),children:(0,u.jsx)(N.LIcon,{icon:N1,size:"24px",removeMargin:!0})})]})]})]})},...m})},c)}),(0,u.jsx)(I,{name:c,disableIcon:L})]})}})},T0=(0,B1.memo)(S2);var E1=require("react-hook-form"),Z1=require("@mui/material");var i1=require("react/jsx-runtime"),w2=({name:c,rules:i,defaultValue:t,shouldUnregister:d,label:h,labelPlacement:x,required:V,disableIconError:y,onChange:P,...M})=>{let k=(0,E1.useFormContext)();if(!k)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,i1.jsx)(E1.Controller,{control:k.control,name:c,rules:i,defaultValue:t,shouldUnregister:d,render:({field:{value:m,onChange:b}})=>(0,i1.jsxs)(Z1.Grid,{display:"flex",flexDirection:"column",children:[(0,i1.jsx)(Z1.FormControlLabel,{control:(0,i1.jsx)(Z1.Checkbox,{checked:!!m,value:m??"",defaultValue:m,onChange:(g,A)=>{b(g,A),P?.(g,A)},...M},c),label:(0,i1.jsx)(T,{label:h,required:V,regular:!0}),labelPlacement:x||"end"}),(0,i1.jsx)(I,{name:c,disableIcon:y})]})})},D0=w2;var G1=require("react-hook-form"),p1=require("@mui/material");var r1=require("react/jsx-runtime"),T2=({name:c,rules:i,defaultValue:t,shouldUnregister:d,label:h,labelPlacement:x,disableIconError:V,onChange:y,...P})=>{let M=(0,G1.useFormContext)();if(!M)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,r1.jsx)(G1.Controller,{control:M.control,name:c,rules:i,defaultValue:t,shouldUnregister:d,render:({field:{value:k,onChange:m}})=>(0,r1.jsxs)(p1.Grid,{display:"flex",flexDirection:"column",children:[(0,r1.jsx)(p1.FormControlLabel,{control:(0,r1.jsx)(p1.Switch,{value:k??"",checked:k??!1,defaultValue:k,onChange:(b,g)=>{m(b,g),y?.(b,g)},...P},c),label:(0,r1.jsx)(T,{label:h}),labelPlacement:x||"end"}),(0,r1.jsx)(I,{name:c,disableIcon:V})]})})},$0=T2;var u1=require("@mui/material");var L1=require("react/jsx-runtime"),D2=({label:c,labelPlacement:i,...t})=>(0,L1.jsx)(u1.Grid,{display:"flex",flexDirection:"column",children:(0,L1.jsx)(u1.FormControlLabel,{control:(0,L1.jsx)(u1.Radio,{...t}),label:(0,L1.jsx)(T,{label:c}),labelPlacement:i||"end"})}),B0=D2;var U1=require("react-hook-form"),O1=require("@mui/material");var v1=require("react/jsx-runtime"),$2=({name:c,rules:i,defaultValue:t,shouldUnregister:d,label:h,required:x,children:V,orientation:y="row",disableIconError:P,...M})=>{let k=(0,U1.useFormContext)();if(!k)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,v1.jsx)(U1.Controller,{control:k.control,name:c,rules:i,defaultValue:t,shouldUnregister:d,render:({field:{value:m,onChange:b}})=>(0,v1.jsxs)(O1.Grid,{display:"flex",flexDirection:"column",children:[h&&(0,v1.jsx)(T,{label:h,required:x}),(0,v1.jsx)(O1.RadioGroup,{value:m||"",name:c,...M,onChange:g=>{M?.onChange?.(g,g.target?.value),b(g)},style:{display:"flex",flexDirection:y},children:V},c),(0,v1.jsx)(I,{name:c,disableIcon:P})]})})},I0=$2;var R1=require("react-hook-form"),_0=require("@mui/material"),l0=require("react/jsx-runtime"),B2=({name:c,rules:i,defaultValue:t,shouldUnregister:d,...h})=>{let x=(0,R1.useFormContext)();if(!x)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,l0.jsx)(R1.Controller,{control:x.control,name:c,rules:i,defaultValue:t,shouldUnregister:d,render:({field:{value:V,onChange:y}})=>(0,l0.jsx)(_0.Slider,{value:V||h?.min||0,onChange:y,valueLabelDisplay:"auto",...h},c)})},E0=B2;var z0=require("react"),z1=require("react-hook-form"),q0=require("@s_mart/core"),y1=require("@s_mart/rules"),Y0=require("@mui/material"),j0=require("@mui/x-date-pickers/DatePicker"),W0=require("@mui/x-date-pickers/AdapterDayjs"),N0=require("@mui/x-date-pickers/LocalizationProvider"),J0=require("@mui/x-date-pickers/locales/ptBR"),K0=m1(o0());var U0=m1(require("@emotion/styled")),O0=require("@mui/material"),J=require("@s_mart/utils"),I2=c=>{switch(c){case"small":return(0,J.toRem)(16);default:case"medium":return(0,J.toRem)(20);case"large":return(0,J.toRem)(24)}},_2=c=>{switch(c){case"small":return`${(0,J.toRem)(2)} ${(0,J.toRem)(8)}`;default:case"medium":return`${(0,J.toRem)(6)} ${(0,J.toRem)(8)}`;case"large":return`${(0,J.toRem)(10)}`}},R0=(0,U0.default)(O0.IconButton)`
|
|
51
|
-
margin: 0px;
|
|
52
|
-
|
|
53
|
-
padding: ${({size:c})=>_2(c)};
|
|
54
|
-
border-radius: 0 ${(0,J.toRem)(4)} ${(0,J.toRem)(4)} 0;
|
|
55
|
-
|
|
56
|
-
svg {
|
|
57
|
-
width: ${({size:c})=>I2(c)} !important;
|
|
58
|
-
}
|
|
59
|
-
`;var o1=require("react/jsx-runtime"),X0=require("react"),E2=({rules:c,name:i,defaultValue:t,shouldUnregister:d,datePickerProps:h,label:x,required:V,placeholder:y,disabled:P,disableIconError:M,...k})=>{let m=(0,z1.useFormContext)();if(!m)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let b=G(m.formState.errors,i),g=h?.format||"DD/MM/YYYY",A=c?(0,y1.composeValidators)([(0,y1.date)(g),c]):(0,y1.date)(g);return(0,o1.jsx)(N0.LocalizationProvider,{dateAdapter:W0.AdapterDayjs,adapterLocale:K0.default,localeText:J0.ptBR.components.MuiLocalizationProvider.defaultProps.localeText,children:(0,o1.jsx)(z1.Controller,{control:m.control,name:i,rules:A,defaultValue:t,shouldUnregister:d,render:({field:{value:F,onChange:H,ref:D}})=>(0,o1.jsxs)(q0.Grid,{display:"flex",flexDirection:"column",children:[x&&(0,o1.jsx)(T,{label:x,required:V}),(0,X0.createElement)(j0.DatePicker,{...h,key:i,value:F??null,format:g,onChange:(L,f)=>{H(L,f),h?.onChange?.(L,f)},disabled:P,slots:{textField:Y0.TextField,openPickerButton:L=>(0,o1.jsx)(R0,{...L,size:k.size})},slotProps:{textField:L=>({variant:"outlined",...L,error:!!b,...k,inputProps:{...L.inputProps,placeholder:y||L.inputProps?.placeholder},InputProps:{...L.InputProps,inputRef(f){D(f),typeof L.inputRef=="function"&&L.inputRef(f)}}})}}),(0,o1.jsx)(I,{name:i,disableIcon:M})]})})})},Q0=(0,z0.memo)(E2);var e2=require("react"),q1=require("react-hook-form"),i2=require("@s_mart/core"),b1=require("@s_mart/rules"),r2=require("@mui/material"),o2=require("@mui/x-date-pickers/TimePicker"),n2=require("@mui/x-date-pickers/AdapterDayjs"),h2=require("@mui/x-date-pickers/LocalizationProvider"),s2=require("@mui/x-date-pickers/locales/ptBR"),t2=m1(o0());var c2=m1(require("@emotion/styled")),l2=require("@mui/material"),K=require("@s_mart/utils"),G2=c=>{switch(c){case"small":return(0,K.toRem)(16);default:case"medium":return(0,K.toRem)(20);case"large":return(0,K.toRem)(24)}},U2=c=>{switch(c){case"small":return`${(0,K.toRem)(2)} ${(0,K.toRem)(8)}`;default:case"medium":return`${(0,K.toRem)(6)} ${(0,K.toRem)(8)}`;case"large":return`${(0,K.toRem)(10)}`}},a2=(0,c2.default)(l2.IconButton)`
|
|
60
|
-
margin: 0px;
|
|
61
|
-
|
|
62
|
-
padding: ${({size:c})=>U2(c)};
|
|
63
|
-
border-radius: 0 ${(0,K.toRem)(4)} ${(0,K.toRem)(4)} 0;
|
|
64
|
-
|
|
65
|
-
svg {
|
|
66
|
-
width: ${({size:c})=>G2(c)} !important;
|
|
67
|
-
}
|
|
68
|
-
`;var c1=require("react/jsx-runtime"),O2=({rules:c,defaultValue:i,shouldUnregister:t,name:d,required:h,label:x,timePickerProps:V,placeholder:y,disabled:P,disableIconError:M,...k})=>{let m=(0,q1.useFormContext)();if(!m)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let b=G(m.formState.errors,d),g=V?.format||"HH:mm",A=c?(0,b1.composeValidators)([(0,b1.time)(g),c]):(0,b1.time)(g);return(0,c1.jsx)(h2.LocalizationProvider,{dateAdapter:n2.AdapterDayjs,adapterLocale:t2.default,localeText:s2.ptBR.components.MuiLocalizationProvider.defaultProps.localeText,children:(0,c1.jsx)(q1.Controller,{control:m.control,name:d,rules:A,defaultValue:i,shouldUnregister:t,render:({field:{value:F,onChange:H,ref:D}})=>(0,c1.jsxs)(i2.Grid,{display:"flex",flexDirection:"column",children:[x&&(0,c1.jsx)(T,{label:x,required:h}),(0,c1.jsx)(o2.TimePicker,{ampm:!1,format:g,value:F??null,disabled:P,...V,onChange:(L,f)=>{H(L,f),V?.onChange?.(L,f)},slots:{textField:r2.TextField,openPickerButton:L=>(0,c1.jsx)(a2,{...L,size:k.size})},slotProps:{textField:L=>({variant:"outlined",...L,error:!!b,...k,inputProps:{...L.inputProps,placeholder:y||L.inputProps?.placeholder},InputProps:{...L.InputProps,inputRef(f){D(f),typeof L.inputRef=="function"&&L.inputRef(f)}}})}},d),(0,c1.jsx)(I,{name:d,disableIcon:M})]})})})},v2=(0,e2.memo)(O2);var d2=require("react"),Y1=require("react-hook-form"),j1=require("@mui/material"),C1=require("@s_mart/core"),m2=require("@s_mart/tokens");var Q=require("react/jsx-runtime"),p2=require("react"),R2=({name:c,defaultValue:i,rules:t,shouldUnregister:d,label:h,required:x,noOptionsText:V,placeholder:y,onInputChange:P,onChange:M,disableIconError:k,...m})=>{let b=(0,Y1.useFormContext)();if(!b)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let g=G(b.formState.errors,c);return console.warn=()=>{},(0,Q.jsx)(Y1.Controller,{name:c,control:b.control,defaultValue:i,rules:t,shouldUnregister:d,render:({field:A})=>(0,Q.jsxs)(C1.Grid,{display:"flex",flexDirection:"column",children:[h&&(0,Q.jsx)(T,{label:h,required:x}),(0,Q.jsx)(j1.Autocomplete,{onChange:(F,H)=>{A.onChange(H),M?.(H,b.getValues())},onInputChange:(F,H,D)=>{D==="input"&&(A.onChange(H),setTimeout(()=>{P?.(H,b.getValues())},0))},slotProps:{...m.slotProps||{},paper:{...(m.slotProps||{}).paper||{},sx:{border:`1px solid ${m2.colorPalette.neutral[30]}`,boxShadow:"0px 2px 4px rgba(0, 0, 0, 0.15)",...(m.slotProps||{}).paper?.sx||{}}}},isOptionEqualToValue:(F,H)=>F.value===H.value,renderOption:(F,H)=>(0,p2.createElement)("li",{...F,key:H.key||H.value,onClick:D=>{F.onClick?.(D),A.onChange(H)}},(0,Q.jsxs)(C1.Grid,{container:!0,direction:"column",children:[(0,Q.jsx)(C1.Grid,{item:!0,children:H.label}),H.afterLabel&&(0,Q.jsx)(C1.Grid,{item:!0,children:H.afterLabel})]})),value:A.value||null,readOnly:m.disabled,noOptionsText:V||"Nenhuma op\xE7\xE3o encontrada",...m,renderInput:F=>(0,Q.jsx)(j1.TextField,{placeholder:y,...F,...m.textFieldProps,error:!!g,InputProps:{...F.InputProps,...m.textFieldProps?.InputProps,inputRef:A.ref,inputProps:{...F.inputProps,...m.textFieldProps?.InputProps?.inputProps}}})},c),(0,Q.jsx)(I,{name:c,disableIcon:k})]})})},Z2=(0,d2.memo)(R2);0&&(module.exports={Autocomplete,Checkbox,Creatable,DatePicker,FieldLabel,Form,FormProvider,RadioButton,RadioGroup,Searchable,Select,Slider,Switch,TextField,TimePicker,useForm});
|