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