@s_mart/form 2.8.10 → 2.8.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +9 -9
- package/dist/index.mjs +15 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var E3=Object.create;var n2=Object.defineProperty,G3=Object.defineProperties,D3=Object.getOwnPropertyDescriptor,I3=Object.getOwnPropertyDescriptors,$3=Object.getOwnPropertyNames,V2=Object.getOwnPropertySymbols,q3=Object.getPrototypeOf,v2=Object.prototype.hasOwnProperty,$2=Object.prototype.propertyIsEnumerable;var I2=(C,i,e)=>i in C?n2(C,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):C[i]=e,o=(C,i)=>{for(var e in i||(i={}))v2.call(i,e)&&I2(C,e,i[e]);if(V2)for(var e of V2(i))$2.call(i,e)&&I2(C,e,i[e]);return C},V=(C,i)=>G3(C,I3(i));var g=(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 U3=(C,i)=>{for(var e in i)n2(C,e,{get:i[e],enumerable:!0})},q2=(C,i,e,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of $3(i))!v2.call(C,r)&&r!==e&&n2(C,r,{get:()=>i[r],enumerable:!(l=D3(i,r))||l.enumerable});return C};var L2=(C,i,e)=>(e=C!=null?E3(q3(C)):{},q2(i||!C||!C.__esModule?n2(e,"default",{value:C,enumerable:!0}):e,C)),R3=C=>q2(n2({},"__esModule",{value:!0}),C);var t1={};U3(t1,{Autocomplete:()=>T3,Checkbox:()=>n3,Creatable:()=>l3,DatePicker:()=>f3,Form:()=>R2,RadioButton:()=>H3,RadioGroup:()=>s3,Searchable:()=>C3,Select:()=>J2,Slider:()=>V3,Switch:()=>t3,TextField:()=>Q2,TimePicker:()=>v3});module.exports=R3(t1);var U2=require("react"),a2=require("react-hook-form");var S2=require("react/jsx-runtime");function z3(f){var M=f,{children:C,onSubmit:i,style:e,disableDefaultValuesUpdate:l}=M,r=g(M,["children","onSubmit","style","disableDefaultValuesUpdate"]);let t=(0,a2.useForm)(r);(0,U2.useEffect)(()=>{l||t.reset(r.defaultValues)},[r.defaultValues,t.reset]);let Z=()=>typeof C=="function"?C(V(o({},t),{onSubmit:t.handleSubmit(d=>i(d,t))})):C;return(0,S2.jsx)(a2.FormProvider,V(o({},t),{children:(0,S2.jsx)("form",{onSubmit:d=>{d.preventDefault(),d.stopPropagation(),t.handleSubmit(p=>i(p,t))()},style:e,children:Z()})}))}var R2=z3;var M2=require("react"),Z2=require("react-hook-form"),W=require("@mui/material");var z2={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"},O2={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"},_2={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 J=L2(require("@s_mart/masks"));var T2=require("@mui/material"),j2=require("@s_mart/utils"),t2=require("react/jsx-runtime"),P=({label:C,required:i,regular:e})=>(0,t2.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:(0,j2.toRem)(2)},children:[(0,t2.jsx)(T2.Typography,{variant:"caption",fontWeight:e?400:700,style:{display:"flex",alignItems:"center"},children:C}),i&&(0,t2.jsx)(T2.Typography,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});var W2=require("react-hook-form"),Y2=require("@s_mart/core");var S=(C,i)=>{var e,l,r,f,M;if(C[i])return C[i];if(i.includes("[")){let[t,Z]=i.split("["),[d,p]=Z.split("].");return(l=(e=C[t])==null?void 0:e[d])==null?void 0:l[p]}if(i.includes(".")){let[t,Z,d]=i.split(".");return d?(M=(f=C[t])==null?void 0:f[Z])==null?void 0:M[d]:(r=C[t])==null?void 0:r[Z]}};var K2=require("react/jsx-runtime"),w=({name:C})=>{var l;let i=(0,W2.useFormContext)(),e=S((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 H2=require("@s_mart/core");var B=require("react/jsx-runtime"),O3=F=>{var k=F,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:f,mask:M,variant:t="outlined",info:Z,parse:d,format:p,onInputChange:c}=k,u=g(k,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","info","parse","format","onInputChange"]);let H=(0,Z2.useFormContext)();if(!H)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[a,b]=(0,M2.useState)(!1),v=L=>{var s;let n=L;return p&&(n=p(L)),M?(s=J==null?void 0:J[M])==null?void 0:s.format(n):n},U=L=>{var s;let n=L;return d&&(n=d(L)),M?(s=J==null?void 0:J[M])==null?void 0:s.parse(n):n},G=L=>{if(!L||M!=="porcentagem")return;L==null||L.stopPropagation();let n=(L==null?void 0:L.target).value;if(n){let s=String(n);if(s.length>0){let O=s.indexOf("%");O>-1&&(L.currentTarget.selectionEnd=O)}}},z=S(H.formState.errors,C);return(0,B.jsx)(Z2.Controller,{control:H.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:L,onChange:n}})=>(0,B.jsxs)(W.Grid,{display:"flex",flexDirection:"column",children:[(0,B.jsxs)("div",{style:{display:"flex"},children:[r&&(0,B.jsx)(W.Grid,{item:!0,children:(0,B.jsx)(P,{label:r,required:f})}),Z&&(0,B.jsx)(W.Grid,{item:!0,children:(0,B.jsx)(H2.Tooltip,{title:Z,placement:"top",children:(0,B.jsx)("div",{style:{width:"fit-content"},children:(0,B.jsx)(H2.LIcon,{icon:j,color:"#757575"})})})})]}),(0,B.jsx)(W.TextField,V(o({variant:t,defaultValue:e,value:v(L||""),onChange:s=>{var O,l2;n(U((O=s==null?void 0:s.target)==null?void 0:O.value)),c==null||c((l2=s==null?void 0:s.target)==null?void 0:l2.value,H.watch())},error:Boolean(z)},u),{type:u.type==="password"?a?"text":"password":u.type,autoComplete:u.autoComplete||"off",InputProps:o({onKeyDown:G,endAdornment:u.type==="password"&&(0,B.jsx)(W.InputAdornment,{position:"end",onClick:()=>b(!a),style:{cursor:"pointer"},children:(0,B.jsx)(H2.LIcon,{icon:a?z2:O2,size:"24px",removeMargin:!0})})},u.InputProps)}),C),(0,B.jsx)(w,{name:C})]})})},Q2=(0,M2.memo)(O3);var c2=require("react"),p2=require("react-hook-form"),X=require("@s_mart/core"),A=require("@mui/material");var h=require("react/jsx-runtime"),_3=k=>{var H=k,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:f,options:M,placeholder:t,disableOnChangeForm:Z=!1,multiple:d,info:p,footer:c,onChange:u}=H,F=g(H,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","disableOnChangeForm","multiple","info","footer","onChange"]);let a=(0,p2.useFormContext)(),{palette:b}=(0,A.useTheme)(),[v,U]=(0,c2.useState)(!1);if(!a)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let G=S(a.formState.errors,C);return console.warn=()=>{},(0,h.jsx)(p2.Controller,{control:a.control,name:C,rules:i,defaultValue:e||"",shouldUnregister:l,render:({field:{value:z,onChange:L}})=>(0,h.jsxs)(A.Grid,{display:"flex",flexDirection:"column",children:[(0,h.jsxs)("div",{style:{display:"flex"},children:[r&&(0,h.jsx)(A.Grid,{item:!0,children:(0,h.jsx)(P,{label:r,required:f})}),p&&(0,h.jsx)(A.Grid,{item:!0,children:(0,h.jsx)(X.Tooltip,{title:p,placement:"top",children:(0,h.jsx)("div",{style:{width:"fit-content"},children:(0,h.jsx)(X.LIcon,{icon:j,color:"#757575"})})})})]}),(0,h.jsxs)(A.Select,V(o({open:v,onOpen:()=>U(!0),onClose:()=>U(!1),displayEmpty:Boolean(t),variant:"outlined",autoComplete:"off",value:z?z||"":d?[]:"",renderValue:n=>{if(n.label)return n.label;if(t)return(0,h.jsx)("p",{style:{color:b.grey[400]},children:t})},multiple:d,onChange:n=>{!Z&&L(n.target.value),u&&u(n.target.value,a.watch())},error:Boolean(G),size:F.size||"medium"},F),{children:[t&&(0,h.jsx)(A.MenuItem,{disabled:!0,value:"",children:(0,h.jsx)("p",{style:{color:b.grey[400]},children:t})}),M==null?void 0:M.map((n,s)=>(0,h.jsx)(A.MenuItem,{value:n,children:(0,h.jsxs)(A.Grid,{container:!0,direction:"column",children:[(0,h.jsx)(A.Grid,{item:!0,children:n.label}),n.afterLabel&&(0,h.jsx)(A.Grid,{item:!0,children:n.afterLabel})]})},s)),c&&[(0,h.jsx)(A.Grid,{px:2,py:1,children:(0,h.jsx)(X.Divider,{})},"footer-divider"),(0,h.jsx)("div",{children:c({closeSelect:()=>U(!1)})},"footer-content")]]}),C),(0,h.jsx)(w,{name:C})]})})},J2=(0,c2.memo)(_3);var X2=require("react"),m2=require("react-hook-form"),C2=require("@s_mart/core");var D=require("@mui/material");var y=require("react/jsx-runtime"),B2=require("react"),N3=a=>{var b=a,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:f,options:M,textFieldProps:t,noOptionsText:Z,footer:d,multiple:p,info:c,placeholder:u,onChange:F,onInputChange:k}=b,H=g(b,["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 U=S(v.formState.errors,C);return console.warn=()=>{},(0,y.jsx)(m2.Controller,{control:v.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{onChange:G,value:z}})=>(0,y.jsxs)(D.Grid,{display:"flex",flexDirection:"column",children:[(0,y.jsxs)("div",{style:{display:"flex"},children:[r&&(0,y.jsx)(D.Grid,{item:!0,children:(0,y.jsx)(P,{label:r,required:f})}),c&&(0,y.jsx)(D.Grid,{item:!0,children:(0,y.jsx)(C2.Tooltip,{title:c,placement:"top",children:(0,y.jsx)("div",{style:{width:"fit-content"},children:(0,y.jsx)(C2.LIcon,{icon:j,color:"#757575"})})})})]}),(0,y.jsx)(D.Autocomplete,V(o({onChange:(L,n)=>{G(n),F==null||F(n,v.watch())},onInputChange:(L,n,s)=>{s==="input"&&(G(n),setTimeout(()=>{k==null||k(n,v.watch())},0))},value:z||(p?[]:null),options:M,multiple:p,noOptionsText:Z||"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(L,n)=>typeof L=="string"&&typeof n=="string"?L===n:typeof L=="object"&&typeof n=="object"?L.value===n.value:!1,renderOption:(L,n)=>typeof n=="object"?(0,B2.createElement)("li",V(o({},L),{key:n.key||n.value}),(0,y.jsxs)(D.Grid,{container:!0,direction:"column",children:[(0,y.jsx)(D.Grid,{item:!0,children:n.label}),n.afterLabel&&(0,y.jsx)(D.Grid,{item:!0,children:n.afterLabel})]})):(0,B2.createElement)("li",V(o({},L),{key:n}),n),ListboxComponent:L=>(0,y.jsxs)("ul",V(o({},L),{children:[L.children,d&&(0,y.jsx)("li",{children:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(D.Grid,{px:2,py:1,children:(0,y.jsx)(C2.Divider,{})}),d]})},"searchable-footer")]}))},H),{renderInput:L=>(0,y.jsx)(D.TextField,o(o({error:Boolean(U),placeholder:u},L),t))}),C),(0,y.jsx)(w,{name:C})]})})},C3=(0,X2.memo)(N3);var r3=require("react"),u2=require("react-hook-form"),E=require("@mui/material");var _=require("@s_mart/utils"),A2=L2(require("@emotion/styled")),E2=require("@emotion/react"),i3=E2.css`
|
|
1
|
+
"use strict";var E3=Object.create;var n2=Object.defineProperty,G3=Object.defineProperties,D3=Object.getOwnPropertyDescriptor,I3=Object.getOwnPropertyDescriptors,$3=Object.getOwnPropertyNames,V2=Object.getOwnPropertySymbols,q3=Object.getPrototypeOf,v2=Object.prototype.hasOwnProperty,R2=Object.prototype.propertyIsEnumerable;var q2=(C,i,e)=>i in C?n2(C,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):C[i]=e,o=(C,i)=>{for(var e in i||(i={}))v2.call(i,e)&&q2(C,e,i[e]);if(V2)for(var e of V2(i))R2.call(i,e)&&q2(C,e,i[e]);return C},d=(C,i)=>G3(C,I3(i));var g=(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&&R2.call(C,l)&&(e[l]=C[l]);return e};var R3=(C,i)=>{for(var e in i)n2(C,e,{get:i[e],enumerable:!0})},U2=(C,i,e,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of $3(i))!v2.call(C,r)&&r!==e&&n2(C,r,{get:()=>i[r],enumerable:!(l=D3(i,r))||l.enumerable});return C};var L2=(C,i,e)=>(e=C!=null?E3(q3(C)):{},U2(i||!C||!C.__esModule?n2(e,"default",{value:C,enumerable:!0}):e,C)),U3=C=>U2(n2({},"__esModule",{value:!0}),C);var t1={};R3(t1,{Autocomplete:()=>T3,Checkbox:()=>n3,Creatable:()=>l3,DatePicker:()=>f3,Form:()=>O2,RadioButton:()=>H3,RadioGroup:()=>s3,Searchable:()=>i3,Select:()=>X2,Slider:()=>V3,Switch:()=>t3,TextField:()=>J2,TimePicker:()=>v3});module.exports=U3(t1);var z2=require("react"),a2=require("react-hook-form");var S2=require("react/jsx-runtime");function z3(f){var M=f,{children:C,onSubmit:i,style:e,disableDefaultValuesUpdate:l}=M,r=g(M,["children","onSubmit","style","disableDefaultValuesUpdate"]);let t=(0,a2.useForm)(r);(0,z2.useEffect)(()=>{l||t.reset(r.defaultValues)},[r.defaultValues,t.reset]);let Z=()=>typeof C=="function"?C(d(o({},t),{onSubmit:t.handleSubmit(V=>i(V,t))})):C;return(0,S2.jsx)(a2.FormProvider,d(o({},t),{children:(0,S2.jsx)("form",{onSubmit:V=>{V.preventDefault(),V.stopPropagation(),t.handleSubmit(p=>i(p,t))()},style:e,children:Z()})}))}var O2=z3;var M2=require("react"),Z2=require("react-hook-form"),Y=require("@mui/material");var _2={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"},N2={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 W={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 j2={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"),W2=require("@s_mart/utils"),t2=require("react/jsx-runtime"),P=({label:C,required:i,regular:e})=>(0,t2.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:(0,W2.toRem)(2)},children:[(0,t2.jsx)(B2.Typography,{variant:"caption",fontWeight:e?400:700,style:{display:"flex",alignItems:"center"},children:C}),i&&(0,t2.jsx)(B2.Typography,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});var Y2=require("react-hook-form"),K2=require("@s_mart/core");var S=(C,i)=>{var e,l,r,f,M;if(C[i])return C[i];if(i.includes("[")){let[t,Z]=i.split("["),[V,p]=Z.split("].");return(l=(e=C[t])==null?void 0:e[V])==null?void 0:l[p]}if(i.includes(".")){let[t,Z,V]=i.split(".");return V?(M=(f=C[t])==null?void 0:f[Z])==null?void 0:M[V]:(r=C[t])==null?void 0:r[Z]}};var Q2=require("react/jsx-runtime"),w=({name:C})=>{var l;let i=(0,Y2.useFormContext)(),e=S((l=i==null?void 0:i.formState)==null?void 0:l.errors,C);return e?(0,Q2.jsx)(K2.Indicator,{severity:"error",children:e==null?void 0:e.message}):null};var H2=require("@s_mart/core");var B=require("react/jsx-runtime"),O3=F=>{var k=F,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:f,mask:M,variant:t="outlined",info:Z,parse:V,format:p,onInputChange:c}=k,u=g(k,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","info","parse","format","onInputChange"]);let H=(0,Z2.useFormContext)();if(!H)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[a,b]=(0,M2.useState)(!1),v=L=>{var s;let n=L;return p&&(n=p(L)),M?(s=X==null?void 0:X[M])==null?void 0:s.format(n):n},R=L=>{var s;let n=L;return V&&(n=V(L)),M?(s=X==null?void 0:X[M])==null?void 0:s.parse(n):n},E=L=>{if(!L||M!=="porcentagem")return;L==null||L.stopPropagation();let n=(L==null?void 0:L.target).value;if(n){let s=String(n);if(s.length>0){let O=s.indexOf("%");O>-1&&(L.currentTarget.selectionEnd=O)}}},z=S(H.formState.errors,C);return(0,B.jsx)(Z2.Controller,{control:H.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:L,onChange:n}})=>(0,B.jsxs)(Y.Grid,{display:"flex",flexDirection:"column",children:[(0,B.jsxs)("div",{style:{display:"flex"},children:[r&&(0,B.jsx)(Y.Grid,{item:!0,children:(0,B.jsx)(P,{label:r,required:f})}),Z&&(0,B.jsx)(Y.Grid,{item:!0,children:(0,B.jsx)(H2.Tooltip,{title:Z,placement:"top",children:(0,B.jsx)("div",{style:{width:"fit-content"},children:(0,B.jsx)(H2.LIcon,{icon:W,color:"#757575"})})})})]}),(0,B.jsx)(Y.TextField,d(o({variant:t,defaultValue:e,value:v(L||""),onChange:s=>{var O,l2;n(R((O=s==null?void 0:s.target)==null?void 0:O.value)),c==null||c((l2=s==null?void 0:s.target)==null?void 0:l2.value,H.watch())},error:Boolean(z)},u),{type:u.type==="password"?a?"text":"password":u.type,autoComplete:u.autoComplete||"off",InputProps:o({onKeyDown:E,endAdornment:u.type==="password"&&(0,B.jsx)(Y.InputAdornment,{position:"end",onClick:()=>b(!a),style:{cursor:"pointer"},children:(0,B.jsx)(H2.LIcon,{icon:a?_2:N2,size:"24px",removeMargin:!0})})},u.InputProps)}),C),(0,B.jsx)(w,{name:C})]})})},J2=(0,M2.memo)(O3);var c2=require("react"),p2=require("react-hook-form"),C2=require("@s_mart/core"),A=require("@mui/material");var h=require("react/jsx-runtime"),_3=k=>{var H=k,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:f,options:M,placeholder:t,disableOnChangeForm:Z=!1,multiple:V,info:p,footer:c,onChange:u}=H,F=g(H,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","disableOnChangeForm","multiple","info","footer","onChange"]);let a=(0,p2.useFormContext)(),{palette:b}=(0,A.useTheme)(),[v,R]=(0,c2.useState)(!1);if(!a)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let E=S(a.formState.errors,C);return console.warn=()=>{},(0,h.jsx)(p2.Controller,{control:a.control,name:C,rules:i,defaultValue:e||"",shouldUnregister:l,render:({field:{value:z,onChange:L}})=>(0,h.jsxs)(A.Grid,{display:"flex",flexDirection:"column",children:[(0,h.jsxs)("div",{style:{display:"flex"},children:[r&&(0,h.jsx)(A.Grid,{item:!0,children:(0,h.jsx)(P,{label:r,required:f})}),p&&(0,h.jsx)(A.Grid,{item:!0,children:(0,h.jsx)(C2.Tooltip,{title:p,placement:"top",children:(0,h.jsx)("div",{style:{width:"fit-content"},children:(0,h.jsx)(C2.LIcon,{icon:W,color:"#757575"})})})})]}),(0,h.jsxs)(A.Select,d(o({open:v,onOpen:()=>R(!0),onClose:()=>R(!1),displayEmpty:Boolean(t),variant:"outlined",autoComplete:"off",value:z?z||"":V?[]:"",renderValue:n=>{if(n.label)return n.label;if(t)return(0,h.jsx)("p",{style:{color:b.grey[400]},children:t})},multiple:V,onChange:n=>{!Z&&L(n.target.value),u&&u(n.target.value,a.watch())},error:Boolean(E),size:F.size||"medium"},F),{children:[t&&(0,h.jsx)(A.MenuItem,{disabled:!0,value:"",children:(0,h.jsx)("p",{style:{color:b.grey[400]},children:t})}),M==null?void 0:M.map((n,s)=>(0,h.jsx)(A.MenuItem,{value:n,children:(0,h.jsxs)(A.Grid,{container:!0,direction:"column",children:[(0,h.jsx)(A.Grid,{item:!0,children:n.label}),n.afterLabel&&(0,h.jsx)(A.Grid,{item:!0,children:n.afterLabel})]})},s)),c&&[(0,h.jsx)(A.Grid,{px:2,py:1,children:(0,h.jsx)(C2.Divider,{})},"footer-divider"),(0,h.jsx)("div",{children:c({closeSelect:()=>R(!1)})},"footer-content")]]}),C),(0,h.jsx)(w,{name:C})]})})},X2=(0,c2.memo)(_3);var C3=require("react"),m2=require("react-hook-form"),i2=require("@s_mart/core");var G=require("@mui/material");var y=require("react/jsx-runtime"),A2=require("react"),N3=a=>{var b=a,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:f,options:M,textFieldProps:t,noOptionsText:Z,footer:V,multiple:p,info:c,placeholder:u,onChange:F,onInputChange:k}=b,H=g(b,["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 R=S(v.formState.errors,C);return console.warn=()=>{},(0,y.jsx)(m2.Controller,{control:v.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{onChange:E,value:z}})=>(0,y.jsxs)(G.Grid,{display:"flex",flexDirection:"column",children:[(0,y.jsxs)("div",{style:{display:"flex"},children:[r&&(0,y.jsx)(G.Grid,{item:!0,children:(0,y.jsx)(P,{label:r,required:f})}),c&&(0,y.jsx)(G.Grid,{item:!0,children:(0,y.jsx)(i2.Tooltip,{title:c,placement:"top",children:(0,y.jsx)("div",{style:{width:"fit-content"},children:(0,y.jsx)(i2.LIcon,{icon:W,color:"#757575"})})})})]}),(0,y.jsx)(G.Autocomplete,d(o({onChange:(L,n)=>{E(n),F==null||F(n,v.watch())},onInputChange:(L,n,s)=>{s==="input"&&(E(n),setTimeout(()=>{k==null||k(n,v.watch())},0))},value:z||(p?[]:null),options:M,multiple:p,noOptionsText:Z||"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(L,n)=>typeof L=="string"&&typeof n=="string"?L===n:typeof L=="object"&&typeof n=="object"?L.value===n.value:!1,renderOption:(L,n)=>typeof n=="object"?(0,A2.createElement)("li",d(o({},L),{key:n.key||n.value}),(0,y.jsxs)(G.Grid,{container:!0,direction:"column",children:[(0,y.jsx)(G.Grid,{item:!0,children:n.label}),n.afterLabel&&(0,y.jsx)(G.Grid,{item:!0,children:n.afterLabel})]})):(0,A2.createElement)("li",d(o({},L),{key:n}),n),ListboxComponent:L=>(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("ul",d(o({},L),{children:L.children})),V&&(0,y.jsx)("div",d(o({},L),{children:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(G.Grid,{px:2,py:1,children:(0,y.jsx)(i2.Divider,{})}),V]})}),"searchable-footer")]})},H),{renderInput:L=>(0,y.jsx)(G.TextField,o(o({error:Boolean(R),placeholder:u},L),t))}),C),(0,y.jsx)(w,{name:C})]})})},i3=(0,C3.memo)(N3);var r3=require("react"),u2=require("react-hook-form"),D=require("@mui/material");var _=require("@s_mart/utils"),E2=L2(require("@emotion/styled")),G2=require("@emotion/react"),e3=G2.css`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
5
|
-
`,j3=C=>
|
|
5
|
+
`,j3=C=>G2.css`
|
|
6
6
|
.MuiAutocomplete-endAdornment {
|
|
7
7
|
position: relative;
|
|
8
8
|
right: 0;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
.creatable,
|
|
12
12
|
.editable {
|
|
13
|
-
${
|
|
13
|
+
${e3}
|
|
14
14
|
|
|
15
15
|
.divider {
|
|
16
16
|
width: 1px;
|
|
@@ -36,18 +36,18 @@
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
`,
|
|
39
|
+
`,o3=E2.default.div`
|
|
40
40
|
display: flex;
|
|
41
41
|
|
|
42
42
|
div.endAdornments {
|
|
43
43
|
position: absolute;
|
|
44
44
|
right: 0;
|
|
45
45
|
|
|
46
|
-
${
|
|
46
|
+
${e3}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
${({hideAddButton:C,theme:i})=>!C&&j3(i)}
|
|
50
|
-
`,
|
|
50
|
+
`,_1=E2.default.div`
|
|
51
51
|
color: ${({theme:C})=>C.palette.text.primary};
|
|
52
52
|
|
|
53
53
|
padding: ${(0,_.toRem)(6)} ${(0,_.toRem)(16)};
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
transition: background-color 0.2s ease-in-out;
|
|
59
59
|
background-color: ${({theme:C})=>C.palette.grey[100]};
|
|
60
60
|
}
|
|
61
|
-
`;var
|
|
61
|
+
`;var N=require("@s_mart/core");var f2=require("lodash"),D2=require("@s_mart/utils");var m=require("react/jsx-runtime"),I2=require("react"),W3=v=>{var R=v,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:f,options:M,editable:t,onEditOption:Z,onCreateOption:V,textFieldProps:p,hideAddButton:c,multiple:u,info:F,onChange:k,onInputChange:H,placeholder:a}=R,b=g(R,["name","rules","defaultValue","shouldUnregister","label","required","options","editable","onEditOption","onCreateOption","textFieldProps","hideAddButton","multiple","info","onChange","onInputChange","placeholder"]);let E=(0,u2.useFormContext)();if(!E)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let z=S(E.formState.errors,C);console.warn=()=>{};let L=s=>{V?V(s):console.error("onCreateOption n\xE3o foi definido")},n=s=>{Z?Z(s):console.error("onEditOption n\xE3o foi definido")};return(0,m.jsx)(u2.Controller,{control:E.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:s,onChange:O}})=>{let l2=(s==null?void 0:s.label)||(s==null?void 0:s.value)||s;return(0,m.jsxs)(D.Grid,{display:"flex",flexDirection:"column",children:[(0,m.jsxs)("div",{style:{display:"flex"},children:[r&&(0,m.jsx)(D.Grid,{item:!0,children:(0,m.jsx)(P,{label:r,required:f})}),F&&(0,m.jsx)(D.Grid,{item:!0,children:(0,m.jsx)(N.Tooltip,{title:F,placement:"top",children:(0,m.jsx)("div",{style:{width:"fit-content"},children:(0,m.jsx)(N.LIcon,{icon:W,color:"#757575"})})})})]}),(0,m.jsx)(o3,{hideAddButton:c,children:(0,m.jsx)(D.Autocomplete,d(o({fullWidth:!0,onChange:(T,x)=>{O(x),k==null||k(x,E.watch())},onInputChange:(T,x,A3)=>{A3==="input"&&(O(x),setTimeout(()=>{H==null||H(x,E.watch())},0))},options:M,value:s||(u?[]:null),multiple:u,noOptionsText:(0,m.jsxs)(N.Button,{sx:{justifyContent:"flex-start",padding:`${(0,D2.toRem)(6)} ${(0,D2.toRem)(-16)}`,margin:0},fullWidth:!0,onClick:()=>L(s),variant:"text",startIcon:(0,m.jsx)(N.LIcon,{icon:T2}),children:["Adicionar ",l2&&`"${l2}"`]}),isOptionEqualToValue:(T,x)=>x?typeof T=="string"&&typeof x=="string"?T===x:typeof T=="object"&&typeof x=="object"?T.value===x.value:typeof T=="object"&&typeof x=="string":!1,renderOption:(T,x)=>typeof x=="object"?(0,I2.createElement)("li",d(o({},T),{key:x.key||x.value}),(0,m.jsxs)(D.Grid,{container:!0,direction:"column",children:[(0,m.jsx)(D.Grid,{item:!0,children:x.label}),x.afterLabel&&(0,m.jsx)(D.Grid,{item:!0,children:x.afterLabel})]})):(0,I2.createElement)("li",d(o({},T),{key:x}),x)},b),{renderInput:T=>{let x=c?T.InputProps:d(o({},T.InputProps),{endAdornment:(0,m.jsxs)("div",{className:"endAdornments",children:[T.InputProps.endAdornment,t&&(0,f2.isObject)(s)&&!(0,f2.isEmpty)(s)?(0,m.jsxs)("div",{className:"editable",children:[(0,m.jsx)("div",{className:"divider"}),(0,m.jsx)("div",{className:"button",onClick:()=>n(s),children:(0,m.jsx)(N.LIcon,{icon:j2,size:"24px",removeMargin:!0})})]}):null,(0,m.jsxs)("div",{className:"creatable",children:[(0,m.jsx)("div",{className:"divider"}),(0,m.jsx)("div",{className:"button",onClick:()=>L(s),children:(0,m.jsx)(N.LIcon,{icon:T2,size:"24px",removeMargin:!0})})]})]})});return(0,m.jsx)(D.TextField,o(d(o({placeholder:a},T),{error:Boolean(z),onChange:O,InputProps:x}),p))}}),C)}),(0,m.jsx)(w,{name:C})]})}})},l3=(0,r3.memo)(W3);var g2=require("react-hook-form"),e2=require("@mui/material");var K=require("react/jsx-runtime"),Y3=Z=>{var V=Z,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,labelPlacement:f,required:M}=V,t=g(V,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let p=(0,g2.useFormContext)();if(!p)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,K.jsx)(g2.Controller,{control:p.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:c,onChange:u}})=>(0,K.jsxs)(e2.Grid,{display:"flex",flexDirection:"column",children:[(0,K.jsx)(e2.FormControlLabel,{control:(0,K.jsx)(e2.Checkbox,o({value:c!=null?c:"",defaultValue:c,onChange:u},t),C),label:(0,K.jsx)(P,{label:r,required:M,regular:!0}),labelPlacement:f||"end"}),(0,K.jsx)(w,{name:C})]})})},n3=Y3;var y2=require("react-hook-form"),o2=require("@mui/material");var Q=require("react/jsx-runtime"),K3=t=>{var Z=t,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,labelPlacement:f}=Z,M=g(Z,["name","rules","defaultValue","shouldUnregister","label","labelPlacement"]);let V=(0,y2.useFormContext)();if(!V)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,Q.jsx)(y2.Controller,{control:V.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:p,onChange:c}})=>(0,Q.jsxs)(o2.Grid,{display:"flex",flexDirection:"column",children:[(0,Q.jsx)(o2.FormControlLabel,{control:(0,Q.jsx)(o2.Switch,o({value:p!=null?p:"",defaultValue:p,onChange:c},M),C),label:(0,Q.jsx)(P,{label:r}),labelPlacement:f||"end"}),(0,Q.jsx)(w,{name:C})]})})},t3=K3;var r2=require("@mui/material");var s2=require("react/jsx-runtime"),Q3=l=>{var r=l,{label:C,labelPlacement:i}=r,e=g(r,["label","labelPlacement"]);return(0,s2.jsx)(r2.Grid,{display:"flex",flexDirection:"column",children:(0,s2.jsx)(r2.FormControlLabel,{control:(0,s2.jsx)(r2.Radio,o({},e)),label:(0,s2.jsx)(P,{label:C}),labelPlacement:i||"end"})})},H3=Q3;var x2=require("react-hook-form"),h2=require("@mui/material");var J=require("react/jsx-runtime"),J3=V=>{var p=V,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:f,children:M,orientation:t="row"}=p,Z=g(p,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation"]);let c=(0,x2.useFormContext)();if(!c)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,J.jsx)(x2.Controller,{control:c.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:u,onChange:F}})=>(0,J.jsxs)(h2.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,J.jsx)(P,{label:r,required:f}),(0,J.jsx)(h2.RadioGroup,d(o({value:u||"",onChange:F,name:C},Z),{style:{display:"flex",flexDirection:t},children:M}),C),(0,J.jsx)(w,{name:C})]})})},s3=J3;var F2=require("react-hook-form"),d3=require("@mui/material");var $2=require("react/jsx-runtime"),X3=f=>{var M=f,{name:C,rules:i,defaultValue:e,shouldUnregister:l}=M,r=g(M,["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,$2.jsx)(F2.Controller,{control:t.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:Z,onChange:V}})=>(0,$2.jsx)(d3.Slider,o({value:Z||(r==null?void 0:r.min)||0,onChange:V,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 I=require("@s_mart/utils"),L3=L2(require("@emotion/styled")),C1=C=>{switch(C){case"small":return(0,I.toRem)(16);default:case"medium":return(0,I.toRem)(20);case"large":return(0,I.toRem)(24)}},i1=C=>{switch(C){case"small":return`${(0,I.toRem)(2)} ${(0,I.toRem)(8)}`;default:case"medium":return`${(0,I.toRem)(6)} ${(0,I.toRem)(8)}`;case"large":return`${(0,I.toRem)(10)}`}},a3=L3.default.div`
|
|
62
62
|
> div > button {
|
|
63
63
|
padding: ${({size:C})=>i1(C)};
|
|
64
64
|
border-radius: 0 ${(0,I.toRem)(4)} ${(0,I.toRem)(4)} 0;
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
width: ${({size:C})=>C1(C)};
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
`;var
|
|
72
|
+
`;var j=require("react/jsx-runtime"),g3=require("react"),e1=V=>{var p=V,{rules:C,name:i,defaultValue:e,shouldUnregister:l,datePickerProps:r,label:f,required:M,placeholder:t}=p,Z=g(p,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder"]);let c=(0,b2.useFormContext)();if(!c)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let u=S(c.formState.errors,i);return(0,j.jsx)(u3.LocalizationProvider,{dateAdapter:m3.AdapterDayjs,children:(0,j.jsx)(b2.Controller,{control:c.control,name:i,rules:C,defaultValue:e,shouldUnregister:l,render:({field:{value:F,onChange:k}})=>(0,j.jsxs)(Z3.Grid,{display:"flex",flexDirection:"column",children:[f&&(0,j.jsx)(P,{label:f,required:M}),(0,g3.createElement)(p3.DatePicker,d(o({},r),{key:i,value:F!=null?F:null,inputFormat:(r==null?void 0:r.inputFormat)||"DD/MM/YYYY",onChange:k,renderInput:H=>{var a,b;return(0,j.jsx)(c3.TextField,d(o(d(o({variant:"outlined"},H),{error:Boolean(u)}),Z),{inputProps:d(o({},H.inputProps),{placeholder:t||((a=H.inputProps)==null?void 0:a.placeholder)}),InputProps:d(o({},H.InputProps),{endAdornment:(0,j.jsx)(a3,{size:Z.size,children:(b=H.InputProps)==null?void 0:b.endAdornment})})}))}})),(0,j.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"),k3=require("@mui/x-date-pickers/LocalizationProvider");var $=require("@s_mart/utils"),y3=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)}`}},x3=y3.default.div`
|
|
73
73
|
> div > button {
|
|
74
74
|
padding: ${({size:C})=>r1(C)};
|
|
75
75
|
border-radius: 0 ${(0,$.toRem)(4)} ${(0,$.toRem)(4)} 0;
|
|
@@ -80,4 +80,4 @@
|
|
|
80
80
|
width: ${({size:C})=>o1(C)};
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
`;var w3=require("react");var
|
|
83
|
+
`;var w3=require("react");var U=require("react/jsx-runtime"),l1=V=>{var p=V,{rules:C,defaultValue:i,shouldUnregister:e,name:l,required:r,label:f,timePickerProps:M,placeholder:t}=p,Z=g(p,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder"]);let c=(0,P2.useFormContext)();if(!c)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let u=S(c.formState.errors,l);return(0,U.jsx)(k3.LocalizationProvider,{dateAdapter:P3.AdapterDayjs,children:(0,U.jsx)(P2.Controller,{control:c.control,name:l,rules:C,defaultValue:i,shouldUnregister:e,render:({field:{value:F,onChange:k}})=>(0,U.jsxs)(h3.Grid,{display:"flex",flexDirection:"column",children:[f&&(0,U.jsx)(P,{label:f,required:r}),(0,U.jsx)(F3.TimePicker,d(o({value:F!=null?F:null,onChange:k},M),{renderInput:H=>{var a,b;return(0,U.jsx)(b3.TextField,d(o(d(o({variant:"outlined"},H),{error:Boolean(u)}),Z),{inputProps:d(o({},H.inputProps),{placeholder:t||((a=H.inputProps)==null?void 0:a.placeholder)}),InputProps:d(o({},H.InputProps),{endAdornment:(0,U.jsx)(x3,{size:Z.size,children:(b=H.InputProps)==null?void 0:b.endAdornment})})}))}}),l),(0,U.jsx)(w,{name:l})]})})})},v3=(0,w3.memo)(l1);var S3=require("react"),k2=require("react-hook-form"),w2=require("@mui/material"),d2=require("@s_mart/core");var q=require("react/jsx-runtime"),B3=require("react"),n1=p=>{var c=p,{name:C,defaultValue:i,rules:e,shouldUnregister:l,label:r,required:f,placeholder:M,onInputChange:t,onChange:Z}=c,V=g(c,["name","defaultValue","rules","shouldUnregister","label","required","placeholder","onInputChange","onChange"]);let u=(0,k2.useFormContext)();if(!u)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let F=S(u.formState.errors,C);return console.warn=()=>{},(0,q.jsx)(k2.Controller,{name:C,control:u.control,defaultValue:i,rules:e,shouldUnregister:l,render:({field:k})=>(0,q.jsxs)(d2.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,q.jsx)(P,{label:r,required:f}),(0,q.jsx)(w2.Autocomplete,d(o({onChange:(H,a)=>{k.onChange(a),Z==null||Z(a,u.watch())},onInputChange:(H,a,b)=>{b==="input"&&(k.onChange(a),setTimeout(()=>{t==null||t(a,u.watch())},0))},isOptionEqualToValue:(H,a)=>H.value===a.value,renderOption:(H,a)=>(0,B3.createElement)("li",d(o({},H),{key:a.key||a.value,onClick:b=>{var v;(v=H.onClick)==null||v.call(H,b),k.onChange(a)}}),(0,q.jsxs)(d2.Grid,{container:!0,direction:"column",children:[(0,q.jsx)(d2.Grid,{item:!0,children:a.label}),a.afterLabel&&(0,q.jsx)(d2.Grid,{item:!0,children:a.afterLabel})]})),value:k.value||null},V),{renderInput:H=>{var a,b,v;return(0,q.jsx)(w2.TextField,d(o(o({placeholder:M},H),V.textFieldProps),{error:Boolean(F),InputProps:d(o(o({},H.InputProps),(a=V.textFieldProps)==null?void 0:a.InputProps),{inputProps:o(o({},H.inputProps),(v=(b=V.textFieldProps)==null?void 0:b.InputProps)==null?void 0:v.inputProps)})}))}}),C),(0,q.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});
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var T2=Object.defineProperty,B2=Object.defineProperties;var A2=Object.getOwnPropertyDescriptors;var C2=Object.getOwnPropertySymbols;var H2=Object.prototype.hasOwnProperty,s2=Object.prototype.propertyIsEnumerable;var t2=(C,i,o)=>i in C?T2(C,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):C[i]=o,e=(C,i)=>{for(var o in i||(i={}))H2.call(i,o)&&t2(C,o,i[o]);if(C2)for(var o of C2(i))s2.call(i,o)&&t2(C,o,i[o]);return C},V=(C,i)=>B2(C,A2(i));var f=(C,i)=>{var o={};for(var l in C)H2.call(C,l)&&i.indexOf(l)<0&&(o[l]=C[l]);if(C!=null&&C2)for(var l of C2(C))i.indexOf(l)<0&&s2.call(C,l)&&(o[l]=C[l]);return o};import{useEffect as E2}from"react";import{FormProvider as G2,useForm as D2}from"react-hook-form";import{jsx as d2}from"react/jsx-runtime";function I2(u){var M=u,{children:C,onSubmit:i,style:o,disableDefaultValuesUpdate:l}=M,n=f(M,["children","onSubmit","style","disableDefaultValuesUpdate"]);let t=D2(n);E2(()=>{l||t.reset(n.defaultValues)},[n.defaultValues,t.reset]);let Z=()=>typeof C=="function"?C(V(e({},t),{onSubmit:t.handleSubmit(d=>i(d,t))})):C;return d2(G2,V(e({},t),{children:d2("form",{onSubmit:d=>{d.preventDefault(),d.stopPropagation(),t.handleSubmit(p=>i(p,t))()},style:o,children:Z()})}))}var $2=I2;import{memo as _2,useState as N2}from"react";import{Controller as j2,useFormContext as W2}from"react-hook-form";import{Grid as l2,InputAdornment as Y2,TextField as K2}from"@mui/material";var V2={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"},L2={description:"M23.9998 31.7412C19.9223 31.7412 16.6215 28.5851 16.3177 24.5854L10.6785 20.2272C9.93715 21.1573 9.25496 22.1405 8.70447 23.2157C8.58149 23.4589 8.51742 23.7277 8.51742 24.0003C8.51742 24.2729 8.58149 24.5416 8.70447 24.7849C11.6198 30.4731 17.3913 34.3216 23.9998 34.3216C25.4465 34.3216 26.842 34.1066 28.1871 33.7593L25.3976 31.6009C24.9369 31.6899 24.469 31.7369 23.9998 31.7412ZM40.8703 34.8646L34.9273 30.2715C36.7326 28.7501 38.2174 26.8848 39.2952 24.7843C39.4182 24.5411 39.4823 24.2723 39.4823 23.9997C39.4823 23.7272 39.4182 23.4584 39.2952 23.2151C36.3799 17.5269 30.6084 13.6784 23.9998 13.6784C21.2321 13.6817 18.5093 14.3785 16.0801 15.7051L9.24098 10.419C9.15179 10.3496 9.04981 10.2985 8.94085 10.2685C8.83189 10.2385 8.7181 10.2303 8.60597 10.2443C8.49384 10.2584 8.38557 10.2944 8.28736 10.3502C8.18914 10.4061 8.1029 10.4808 8.03356 10.5701L6.97828 11.9285C6.8383 12.1086 6.77557 12.3369 6.8039 12.5633C6.83223 12.7896 6.94929 12.9954 7.12934 13.1354L38.7587 37.581C38.8479 37.6504 38.9499 37.7016 39.0588 37.7315C39.1678 37.7615 39.2816 37.7697 39.3937 37.7557C39.5058 37.7416 39.6141 37.7057 39.7123 37.6498C39.8105 37.5939 39.8968 37.5192 39.9661 37.43L41.0219 36.0715C41.1619 35.8913 41.2245 35.663 41.1961 35.4366C41.1676 35.2103 41.0505 35.0045 40.8703 34.8646ZM30.9938 27.2309L28.8811 25.5977C29.059 25.0835 29.1534 24.5441 29.1606 24C29.1711 23.2034 28.9947 22.4155 28.6454 21.6995C28.2962 20.9836 27.7838 20.3595 27.1496 19.8774C26.5154 19.3953 25.777 19.0687 24.9937 18.9238C24.2103 18.7788 23.4039 18.8197 22.6392 19.0429C22.9634 19.4822 23.1387 20.0135 23.1397 20.5595C23.1317 20.7411 23.1039 20.9214 23.0569 21.097L19.0997 18.0387C20.4743 16.89 22.2085 16.2601 23.9998 16.2588C25.0166 16.2582 26.0235 16.4581 26.9629 16.8469C27.9024 17.2357 28.756 17.8059 29.475 18.5249C30.1939 19.2438 30.7641 20.0974 31.1529 21.0369C31.5418 21.9764 31.7416 22.9833 31.7411 24C31.7411 25.1628 31.4567 26.246 30.9938 27.2309Z",viewBox:"0 0 48 48",id:"line-eye-slash-solid"};var q={description:"M24 8C15.1613 8 8 15.2258 8 24C8 32.8387 15.1613 40 24 40C32.7742 40 40 32.8387 40 24C40 15.2258 32.7742 8 24 8ZM24 15.0968C25.4839 15.0968 26.7097 16.3226 26.7097 17.8065C26.7097 19.3548 25.4839 20.5161 24 20.5161C22.4516 20.5161 21.2903 19.3548 21.2903 17.8065C21.2903 16.3226 22.4516 15.0968 24 15.0968ZM27.6129 31.4839C27.6129 31.9355 27.2258 32.2581 26.8387 32.2581H21.1613C20.7097 32.2581 20.3871 31.9355 20.3871 31.4839V29.9355C20.3871 29.5484 20.7097 29.1613 21.1613 29.1613H21.9355V25.0323H21.1613C20.7097 25.0323 20.3871 24.7097 20.3871 24.2581V22.7097C20.3871 22.3226 20.7097 21.9355 21.1613 21.9355H25.2903C25.6774 21.9355 26.0645 22.3226 26.0645 22.7097V29.1613H26.8387C27.2258 29.1613 27.6129 29.5484 27.6129 29.9355V31.4839Z",viewBox:"0 0 48 48",id:"line-info-circle-solid"},a2={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 M2={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 Z2}from"@mui/material";import{toRem as q2}from"@s_mart/utils";import{jsx as c2,jsxs as U2}from"react/jsx-runtime";var h=({label:C,required:i,regular:o})=>U2("span",{style:{display:"flex",alignItems:"center",gap:q2(2)},children:[c2(Z2,{variant:"caption",fontWeight:o?400:700,style:{display:"flex",alignItems:"center"},children:C}),i&&c2(Z2,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});import{useFormContext as R2}from"react-hook-form";import{Indicator as z2}from"@s_mart/core";var v=(C,i)=>{var o,l,n,u,M;if(C[i])return C[i];if(i.includes("[")){let[t,Z]=i.split("["),[d,p]=Z.split("].");return(l=(o=C[t])==null?void 0:o[d])==null?void 0:l[p]}if(i.includes(".")){let[t,Z,d]=i.split(".");return d?(M=(u=C[t])==null?void 0:u[Z])==null?void 0:M[d]:(n=C[t])==null?void 0:n[Z]}};import{jsx as O2}from"react/jsx-runtime";var b=({name:C})=>{var l;let i=R2(),o=v((l=i==null?void 0:i.formState)==null?void 0:l.errors,C);return o?O2(z2,{severity:"error",children:o==null?void 0:o.message}):null};import{LIcon as p2,Tooltip as Q2}from"@s_mart/core";import{jsx as A,jsxs as m2}from"react/jsx-runtime";var J2=y=>{var F=y,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:n,required:u,mask:M,variant:t="outlined",info:Z,parse:d,format:p,onInputChange:c}=F,m=f(F,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","info","parse","format","onInputChange"]);let H=W2();if(!H)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[a,x]=N2(!1),w=L=>{var s;let r=L;return p&&(r=p(L)),M?(s=j==null?void 0:j[M])==null?void 0:s.format(r):r},E=L=>{var s;let r=L;return d&&(r=d(L)),M?(s=j==null?void 0:j[M])==null?void 0:s.parse(r):r},B=L=>{if(!L||M!=="porcentagem")return;L==null||L.stopPropagation();let r=(L==null?void 0:L.target).value;if(r){let s=String(r);if(s.length>0){let $=s.indexOf("%");$>-1&&(L.currentTarget.selectionEnd=$)}}},I=v(H.formState.errors,C);return A(j2,{control:H.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:L,onChange:r}})=>m2(l2,{display:"flex",flexDirection:"column",children:[m2("div",{style:{display:"flex"},children:[n&&A(l2,{item:!0,children:A(h,{label:n,required:u})}),Z&&A(l2,{item:!0,children:A(Q2,{title:Z,placement:"top",children:A("div",{style:{width:"fit-content"},children:A(p2,{icon:q,color:"#757575"})})})})]}),A(K2,V(e({variant:t,defaultValue:o,value:w(L||""),onChange:s=>{var $,K;r(E(($=s==null?void 0:s.target)==null?void 0:$.value)),c==null||c((K=s==null?void 0:s.target)==null?void 0:K.value,H.watch())},error:Boolean(I)},m),{type:m.type==="password"?a?"text":"password":m.type,autoComplete:m.autoComplete||"off",InputProps:e({onKeyDown:B,endAdornment:m.type==="password"&&A(Y2,{position:"end",onClick:()=>x(!a),style:{cursor:"pointer"},children:A(p2,{icon:a?V2:L2,size:"24px",removeMargin:!0})})},m.InputProps)}),C),A(b,{name:C})]})})},X2=_2(J2);import{memo as C3,useState as i3}from"react";import{Controller as e3,useFormContext as o3}from"react-hook-form";import{Divider as r3,LIcon as l3,Tooltip as n3}from"@s_mart/core";import{Grid as R,Select as t3,MenuItem as u2,useTheme as H3}from"@mui/material";import{jsx as k,jsxs as i2}from"react/jsx-runtime";var s3=F=>{var H=F,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:n,required:u,options:M,placeholder:t,disableOnChangeForm:Z=!1,multiple:d,info:p,footer:c,onChange:m}=H,y=f(H,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","disableOnChangeForm","multiple","info","footer","onChange"]);let a=o3(),{palette:x}=H3(),[w,E]=i3(!1);if(!a)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let B=v(a.formState.errors,C);return console.warn=()=>{},k(e3,{control:a.control,name:C,rules:i,defaultValue:o||"",shouldUnregister:l,render:({field:{value:I,onChange:L}})=>i2(R,{display:"flex",flexDirection:"column",children:[i2("div",{style:{display:"flex"},children:[n&&k(R,{item:!0,children:k(h,{label:n,required:u})}),p&&k(R,{item:!0,children:k(n3,{title:p,placement:"top",children:k("div",{style:{width:"fit-content"},children:k(l3,{icon:q,color:"#757575"})})})})]}),i2(t3,V(e({open:w,onOpen:()=>E(!0),onClose:()=>E(!1),displayEmpty:Boolean(t),variant:"outlined",autoComplete:"off",value:I?I||"":d?[]:"",renderValue:r=>{if(r.label)return r.label;if(t)return k("p",{style:{color:x.grey[400]},children:t})},multiple:d,onChange:r=>{!Z&&L(r.target.value),m&&m(r.target.value,a.watch())},error:Boolean(B),size:y.size||"medium"},y),{children:[t&&k(u2,{disabled:!0,value:"",children:k("p",{style:{color:x.grey[400]},children:t})}),M==null?void 0:M.map((r,s)=>k(u2,{value:r,children:i2(R,{container:!0,direction:"column",children:[k(R,{item:!0,children:r.label}),r.afterLabel&&k(R,{item:!0,children:r.afterLabel})]})},s)),c&&[k(R,{px:2,py:1,children:k(r3,{})},"footer-divider"),k("div",{children:c({closeSelect:()=>E(!1)})},"footer-content")]]}),C),k(b,{name:C})]})})},d3=C3(s3);import{memo as V3}from"react";import{Controller as L3,useFormContext as a3}from"react-hook-form";import{Divider as M3,LIcon as Z3,Tooltip as c3}from"@s_mart/core";import{Grid as z,Autocomplete as p3,TextField as m3}from"@mui/material";import{Fragment as g3,jsx as T,jsxs as Q}from"react/jsx-runtime";import{createElement as f2}from"react";var u3=a=>{var x=a,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:n,required:u,options:M,textFieldProps:t,noOptionsText:Z,footer:d,multiple:p,info:c,placeholder:m,onChange:y,onInputChange:F}=x,H=f(x,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText","footer","multiple","info","placeholder","onChange","onInputChange"]);let w=a3();if(!w)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let E=v(w.formState.errors,C);return console.warn=()=>{},T(L3,{control:w.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{onChange:B,value:I}})=>Q(z,{display:"flex",flexDirection:"column",children:[Q("div",{style:{display:"flex"},children:[n&&T(z,{item:!0,children:T(h,{label:n,required:u})}),c&&T(z,{item:!0,children:T(c3,{title:c,placement:"top",children:T("div",{style:{width:"fit-content"},children:T(Z3,{icon:q,color:"#757575"})})})})]}),T(p3,V(e({onChange:(L,r)=>{B(r),y==null||y(r,w.watch())},onInputChange:(L,r,s)=>{s==="input"&&(B(r),setTimeout(()=>{F==null||F(r,w.watch())},0))},value:I||(p?[]:null),options:M,multiple:p,noOptionsText:Z||"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(L,r)=>typeof L=="string"&&typeof r=="string"?L===r:typeof L=="object"&&typeof r=="object"?L.value===r.value:!1,renderOption:(L,r)=>typeof r=="object"?f2("li",V(e({},L),{key:r.key||r.value}),Q(z,{container:!0,direction:"column",children:[T(z,{item:!0,children:r.label}),r.afterLabel&&T(z,{item:!0,children:r.afterLabel})]})):f2("li",V(e({},L),{key:r}),r),ListboxComponent:L=>Q("ul",V(e({},L),{children:[L.children,d&&T("li",{children:Q(g3,{children:[T(z,{px:2,py:1,children:T(M3,{})}),d]})},"searchable-footer")]}))},H),{renderInput:L=>T(m3,e(e({error:Boolean(E),placeholder:m},L),t))}),C),T(b,{name:C})]})})},f3=V3(u3);import{memo as x3}from"react";import{Controller as h3,useFormContext as F3}from"react-hook-form";import{Grid as W,Autocomplete as b3,TextField as P3,Typography as k3}from"@mui/material";import{toRem as U}from"@s_mart/utils";import g2 from"@emotion/styled";import{css as y2}from"@emotion/react";var x2=y2`
|
|
1
|
+
var B2=Object.defineProperty,A2=Object.defineProperties;var E2=Object.getOwnPropertyDescriptors;var C2=Object.getOwnPropertySymbols;var s2=Object.prototype.hasOwnProperty,d2=Object.prototype.propertyIsEnumerable;var H2=(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={}))s2.call(i,o)&&H2(C,o,i[o]);if(C2)for(var o of C2(i))d2.call(i,o)&&H2(C,o,i[o]);return C},d=(C,i)=>A2(C,E2(i));var f=(C,i)=>{var o={};for(var l in C)s2.call(C,l)&&i.indexOf(l)<0&&(o[l]=C[l]);if(C!=null&&C2)for(var l of C2(C))i.indexOf(l)<0&&d2.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 V2}from"react/jsx-runtime";function $2(u){var M=u,{children:C,onSubmit:i,style:o,disableDefaultValuesUpdate:l}=M,n=f(M,["children","onSubmit","style","disableDefaultValuesUpdate"]);let t=I2(n);G2(()=>{l||t.reset(n.defaultValues)},[n.defaultValues,t.reset]);let Z=()=>typeof C=="function"?C(d(e({},t),{onSubmit:t.handleSubmit(V=>i(V,t))})):C;return V2(D2,d(e({},t),{children:V2("form",{onSubmit:V=>{V.preventDefault(),V.stopPropagation(),t.handleSubmit(p=>i(p,t))()},style:o,children:Z()})}))}var q2=$2;import{memo as N2,useState as j2}from"react";import{Controller as W2,useFormContext as Y2}from"react-hook-form";import{Grid as t2,InputAdornment as K2,TextField as Q2}from"@mui/material";var L2={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"},a2={description:"M23.9998 31.7412C19.9223 31.7412 16.6215 28.5851 16.3177 24.5854L10.6785 20.2272C9.93715 21.1573 9.25496 22.1405 8.70447 23.2157C8.58149 23.4589 8.51742 23.7277 8.51742 24.0003C8.51742 24.2729 8.58149 24.5416 8.70447 24.7849C11.6198 30.4731 17.3913 34.3216 23.9998 34.3216C25.4465 34.3216 26.842 34.1066 28.1871 33.7593L25.3976 31.6009C24.9369 31.6899 24.469 31.7369 23.9998 31.7412ZM40.8703 34.8646L34.9273 30.2715C36.7326 28.7501 38.2174 26.8848 39.2952 24.7843C39.4182 24.5411 39.4823 24.2723 39.4823 23.9997C39.4823 23.7272 39.4182 23.4584 39.2952 23.2151C36.3799 17.5269 30.6084 13.6784 23.9998 13.6784C21.2321 13.6817 18.5093 14.3785 16.0801 15.7051L9.24098 10.419C9.15179 10.3496 9.04981 10.2985 8.94085 10.2685C8.83189 10.2385 8.7181 10.2303 8.60597 10.2443C8.49384 10.2584 8.38557 10.2944 8.28736 10.3502C8.18914 10.4061 8.1029 10.4808 8.03356 10.5701L6.97828 11.9285C6.8383 12.1086 6.77557 12.3369 6.8039 12.5633C6.83223 12.7896 6.94929 12.9954 7.12934 13.1354L38.7587 37.581C38.8479 37.6504 38.9499 37.7016 39.0588 37.7315C39.1678 37.7615 39.2816 37.7697 39.3937 37.7557C39.5058 37.7416 39.6141 37.7057 39.7123 37.6498C39.8105 37.5939 39.8968 37.5192 39.9661 37.43L41.0219 36.0715C41.1619 35.8913 41.2245 35.663 41.1961 35.4366C41.1676 35.2103 41.0505 35.0045 40.8703 34.8646ZM30.9938 27.2309L28.8811 25.5977C29.059 25.0835 29.1534 24.5441 29.1606 24C29.1711 23.2034 28.9947 22.4155 28.6454 21.6995C28.2962 20.9836 27.7838 20.3595 27.1496 19.8774C26.5154 19.3953 25.777 19.0687 24.9937 18.9238C24.2103 18.7788 23.4039 18.8197 22.6392 19.0429C22.9634 19.4822 23.1387 20.0135 23.1397 20.5595C23.1317 20.7411 23.1039 20.9214 23.0569 21.097L19.0997 18.0387C20.4743 16.89 22.2085 16.2601 23.9998 16.2588C25.0166 16.2582 26.0235 16.4581 26.9629 16.8469C27.9024 17.2357 28.756 17.8059 29.475 18.5249C30.1939 19.2438 30.7641 20.0974 31.1529 21.0369C31.5418 21.9764 31.7416 22.9833 31.7411 24C31.7411 25.1628 31.4567 26.246 30.9938 27.2309Z",viewBox:"0 0 48 48",id:"line-eye-slash-solid"};var q={description:"M24 8C15.1613 8 8 15.2258 8 24C8 32.8387 15.1613 40 24 40C32.7742 40 40 32.8387 40 24C40 15.2258 32.7742 8 24 8ZM24 15.0968C25.4839 15.0968 26.7097 16.3226 26.7097 17.8065C26.7097 19.3548 25.4839 20.5161 24 20.5161C22.4516 20.5161 21.2903 19.3548 21.2903 17.8065C21.2903 16.3226 22.4516 15.0968 24 15.0968ZM27.6129 31.4839C27.6129 31.9355 27.2258 32.2581 26.8387 32.2581H21.1613C20.7097 32.2581 20.3871 31.9355 20.3871 31.4839V29.9355C20.3871 29.5484 20.7097 29.1613 21.1613 29.1613H21.9355V25.0323H21.1613C20.7097 25.0323 20.3871 24.7097 20.3871 24.2581V22.7097C20.3871 22.3226 20.7097 21.9355 21.1613 21.9355H25.2903C25.6774 21.9355 26.0645 22.3226 26.0645 22.7097V29.1613H26.8387C27.2258 29.1613 27.6129 29.5484 27.6129 29.9355V31.4839Z",viewBox:"0 0 48 48",id:"line-info-circle-solid"},n2={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 M2={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 Z2}from"@mui/material";import{toRem as R2}from"@s_mart/utils";import{jsx as c2,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:[c2(Z2,{variant:"caption",fontWeight:o?400:700,style:{display:"flex",alignItems:"center"},children:C}),i&&c2(Z2,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});import{useFormContext as z2}from"react-hook-form";import{Indicator as O2}from"@s_mart/core";var v=(C,i)=>{var o,l,n,u,M;if(C[i])return C[i];if(i.includes("[")){let[t,Z]=i.split("["),[V,p]=Z.split("].");return(l=(o=C[t])==null?void 0:o[V])==null?void 0:l[p]}if(i.includes(".")){let[t,Z,V]=i.split(".");return V?(M=(u=C[t])==null?void 0:u[Z])==null?void 0:M[V]:(n=C[t])==null?void 0:n[Z]}};import{jsx as _2}from"react/jsx-runtime";var b=({name:C})=>{var l;let i=z2(),o=v((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 p2,Tooltip as J2}from"@s_mart/core";import{jsx as A,jsxs as m2}from"react/jsx-runtime";var X2=y=>{var F=y,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:n,required:u,mask:M,variant:t="outlined",info:Z,parse:V,format:p,onInputChange:c}=F,m=f(F,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","info","parse","format","onInputChange"]);let H=Y2();if(!H)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[a,x]=j2(!1),w=L=>{var s;let r=L;return p&&(r=p(L)),M?(s=j==null?void 0:j[M])==null?void 0:s.format(r):r},E=L=>{var s;let r=L;return V&&(r=V(L)),M?(s=j==null?void 0:j[M])==null?void 0:s.parse(r):r},B=L=>{if(!L||M!=="porcentagem")return;L==null||L.stopPropagation();let r=(L==null?void 0:L.target).value;if(r){let s=String(r);if(s.length>0){let $=s.indexOf("%");$>-1&&(L.currentTarget.selectionEnd=$)}}},I=v(H.formState.errors,C);return A(W2,{control:H.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:L,onChange:r}})=>m2(t2,{display:"flex",flexDirection:"column",children:[m2("div",{style:{display:"flex"},children:[n&&A(t2,{item:!0,children:A(h,{label:n,required:u})}),Z&&A(t2,{item:!0,children:A(J2,{title:Z,placement:"top",children:A("div",{style:{width:"fit-content"},children:A(p2,{icon:q,color:"#757575"})})})})]}),A(Q2,d(e({variant:t,defaultValue:o,value:w(L||""),onChange:s=>{var $,K;r(E(($=s==null?void 0:s.target)==null?void 0:$.value)),c==null||c((K=s==null?void 0:s.target)==null?void 0:K.value,H.watch())},error:Boolean(I)},m),{type:m.type==="password"?a?"text":"password":m.type,autoComplete:m.autoComplete||"off",InputProps:e({onKeyDown:B,endAdornment:m.type==="password"&&A(K2,{position:"end",onClick:()=>x(!a),style:{cursor:"pointer"},children:A(p2,{icon:a?L2:a2,size:"24px",removeMargin:!0})})},m.InputProps)}),C),A(b,{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 u2,useTheme as s3}from"@mui/material";import{jsx as k,jsxs as i2}from"react/jsx-runtime";var d3=F=>{var H=F,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:n,required:u,options:M,placeholder:t,disableOnChangeForm:Z=!1,multiple:V,info:p,footer:c,onChange:m}=H,y=f(H,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","disableOnChangeForm","multiple","info","footer","onChange"]);let a=r3(),{palette:x}=s3(),[w,E]=e3(!1);if(!a)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let B=v(a.formState.errors,C);return console.warn=()=>{},k(o3,{control:a.control,name:C,rules:i,defaultValue:o||"",shouldUnregister:l,render:({field:{value:I,onChange:L}})=>i2(U,{display:"flex",flexDirection:"column",children:[i2("div",{style:{display:"flex"},children:[n&&k(U,{item:!0,children:k(h,{label:n,required:u})}),p&&k(U,{item:!0,children:k(t3,{title:p,placement:"top",children:k("div",{style:{width:"fit-content"},children:k(n3,{icon:q,color:"#757575"})})})})]}),i2(H3,d(e({open:w,onOpen:()=>E(!0),onClose:()=>E(!1),displayEmpty:Boolean(t),variant:"outlined",autoComplete:"off",value:I?I||"":V?[]:"",renderValue:r=>{if(r.label)return r.label;if(t)return k("p",{style:{color:x.grey[400]},children:t})},multiple:V,onChange:r=>{!Z&&L(r.target.value),m&&m(r.target.value,a.watch())},error:Boolean(B),size:y.size||"medium"},y),{children:[t&&k(u2,{disabled:!0,value:"",children:k("p",{style:{color:x.grey[400]},children:t})}),M==null?void 0:M.map((r,s)=>k(u2,{value:r,children:i2(U,{container:!0,direction:"column",children:[k(U,{item:!0,children:r.label}),r.afterLabel&&k(U,{item:!0,children:r.afterLabel})]})},s)),c&&[k(U,{px:2,py:1,children:k(l3,{})},"footer-divider"),k("div",{children:c({closeSelect:()=>E(!1)})},"footer-content")]]}),C),k(b,{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 Z3,LIcon as c3,Tooltip as p3}from"@s_mart/core";import{Grid as z,Autocomplete as m3,TextField as u3}from"@mui/material";import{Fragment as g2,jsx as S,jsxs as Q}from"react/jsx-runtime";import{createElement as f2}from"react";var f3=a=>{var x=a,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:n,required:u,options:M,textFieldProps:t,noOptionsText:Z,footer:V,multiple:p,info:c,placeholder:m,onChange:y,onInputChange:F}=x,H=f(x,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText","footer","multiple","info","placeholder","onChange","onInputChange"]);let w=M3();if(!w)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let E=v(w.formState.errors,C);return console.warn=()=>{},S(a3,{control:w.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{onChange:B,value:I}})=>Q(z,{display:"flex",flexDirection:"column",children:[Q("div",{style:{display:"flex"},children:[n&&S(z,{item:!0,children:S(h,{label:n,required:u})}),c&&S(z,{item:!0,children:S(p3,{title:c,placement:"top",children:S("div",{style:{width:"fit-content"},children:S(c3,{icon:q,color:"#757575"})})})})]}),S(m3,d(e({onChange:(L,r)=>{B(r),y==null||y(r,w.watch())},onInputChange:(L,r,s)=>{s==="input"&&(B(r),setTimeout(()=>{F==null||F(r,w.watch())},0))},value:I||(p?[]:null),options:M,multiple:p,noOptionsText:Z||"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(L,r)=>typeof L=="string"&&typeof r=="string"?L===r:typeof L=="object"&&typeof r=="object"?L.value===r.value:!1,renderOption:(L,r)=>typeof r=="object"?f2("li",d(e({},L),{key:r.key||r.value}),Q(z,{container:!0,direction:"column",children:[S(z,{item:!0,children:r.label}),r.afterLabel&&S(z,{item:!0,children:r.afterLabel})]})):f2("li",d(e({},L),{key:r}),r),ListboxComponent:L=>Q(g2,{children:[S("ul",d(e({},L),{children:L.children})),V&&S("div",d(e({},L),{children:Q(g2,{children:[S(z,{px:2,py:1,children:S(Z3,{})}),V]})}),"searchable-footer")]})},H),{renderInput:L=>S(u3,e(e({error:Boolean(E),placeholder:m},L),t))}),C),S(b,{name:C})]})})},g3=L3(f3);import{memo as x3}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 R}from"@s_mart/utils";import y2 from"@emotion/styled";import{css as x2}from"@emotion/react";var h2=x2`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
5
|
-
`,y3=C=>
|
|
5
|
+
`,y3=C=>x2`
|
|
6
6
|
.MuiAutocomplete-endAdornment {
|
|
7
7
|
position: relative;
|
|
8
8
|
right: 0;
|
|
@@ -10,11 +10,11 @@ var T2=Object.defineProperty,B2=Object.defineProperties;var A2=Object.getOwnProp
|
|
|
10
10
|
|
|
11
11
|
.creatable,
|
|
12
12
|
.editable {
|
|
13
|
-
${
|
|
13
|
+
${h2}
|
|
14
14
|
|
|
15
15
|
.divider {
|
|
16
16
|
width: 1px;
|
|
17
|
-
height: ${
|
|
17
|
+
height: ${R(20)};
|
|
18
18
|
background-color: ${C.palette.grey[400]};
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -25,9 +25,9 @@ var T2=Object.defineProperty,B2=Object.defineProperties;var A2=Object.getOwnProp
|
|
|
25
25
|
color: ${C.palette.grey[600]};
|
|
26
26
|
border-radius: 50%;
|
|
27
27
|
|
|
28
|
-
margin: 0 ${
|
|
29
|
-
width: ${
|
|
30
|
-
height: ${
|
|
28
|
+
margin: 0 ${R(6)};
|
|
29
|
+
width: ${R(28)};
|
|
30
|
+
height: ${R(28)};
|
|
31
31
|
|
|
32
32
|
&:hover {
|
|
33
33
|
cursor: pointer;
|
|
@@ -36,29 +36,29 @@ var T2=Object.defineProperty,B2=Object.defineProperties;var A2=Object.getOwnProp
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
`,
|
|
39
|
+
`,F2=y2.div`
|
|
40
40
|
display: flex;
|
|
41
41
|
|
|
42
42
|
div.endAdornments {
|
|
43
43
|
position: absolute;
|
|
44
44
|
right: 0;
|
|
45
45
|
|
|
46
|
-
${
|
|
46
|
+
${h2}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
${({hideAddButton:C,theme:i})=>!C&&y3(i)}
|
|
50
|
-
`,
|
|
50
|
+
`,t4=y2.div`
|
|
51
51
|
color: ${({theme:C})=>C.palette.text.primary};
|
|
52
52
|
|
|
53
|
-
padding: ${
|
|
54
|
-
margin: ${
|
|
53
|
+
padding: ${R(6)} ${R(16)};
|
|
54
|
+
margin: ${R(-6)} ${R(-16)};
|
|
55
55
|
|
|
56
56
|
&:hover {
|
|
57
57
|
cursor: pointer;
|
|
58
58
|
transition: background-color 0.2s ease-in-out;
|
|
59
59
|
background-color: ${({theme:C})=>C.palette.grey[100]};
|
|
60
60
|
}
|
|
61
|
-
`;import{LIcon as
|
|
61
|
+
`;import{LIcon as e2,Tooltip as k3,Button as w3}from"@s_mart/core";import{isObject as v3,isEmpty as S3}from"lodash";import{toRem as b2}from"@s_mart/utils";import{jsx as P,jsxs as O}from"react/jsx-runtime";import{createElement as P2}from"react";var T3=w=>{var E=w,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:n,required:u,options:M,editable:t,onEditOption:Z,onCreateOption:V,textFieldProps:p,hideAddButton:c,multiple:m,info:y,onChange:F,onInputChange:H,placeholder:a}=E,x=f(E,["name","rules","defaultValue","shouldUnregister","label","required","options","editable","onEditOption","onCreateOption","textFieldProps","hideAddButton","multiple","info","onChange","onInputChange","placeholder"]);let B=F3();if(!B)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let I=v(B.formState.errors,C);console.warn=()=>{};let L=s=>{V?V(s):console.error("onCreateOption n\xE3o foi definido")},r=s=>{Z?Z(s):console.error("onEditOption n\xE3o foi definido")};return P(h3,{control:B.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:s,onChange:$}})=>{let K=(s==null?void 0:s.label)||(s==null?void 0:s.value)||s;return O(W,{display:"flex",flexDirection:"column",children:[O("div",{style:{display:"flex"},children:[n&&P(W,{item:!0,children:P(h,{label:n,required:u})}),y&&P(W,{item:!0,children:P(k3,{title:y,placement:"top",children:P("div",{style:{width:"fit-content"},children:P(e2,{icon:q,color:"#757575"})})})})]}),P(F2,{hideAddButton:c,children:P(b3,d(e({fullWidth:!0,onChange:(T,g)=>{$(g),F==null||F(g,B.watch())},onInputChange:(T,g,T2)=>{T2==="input"&&($(g),setTimeout(()=>{H==null||H(g,B.watch())},0))},options:M,value:s||(m?[]:null),multiple:m,noOptionsText:O(w3,{sx:{justifyContent:"flex-start",padding:`${b2(6)} ${b2(-16)}`,margin:0},fullWidth:!0,onClick:()=>L(s),variant:"text",startIcon:P(e2,{icon:n2}),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"?P2("li",d(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})]})):P2("li",d(e({},T),{key:g}),g)},x),{renderInput:T=>{let g=c?T.InputProps:d(e({},T.InputProps),{endAdornment:O("div",{className:"endAdornments",children:[T.InputProps.endAdornment,t&&v3(s)&&!S3(s)?O("div",{className:"editable",children:[P("div",{className:"divider"}),P("div",{className:"button",onClick:()=>r(s),children:P(e2,{icon:M2,size:"24px",removeMargin:!0})})]}):null,O("div",{className:"creatable",children:[P("div",{className:"divider"}),P("div",{className:"button",onClick:()=>L(s),children:P(e2,{icon:n2,size:"24px",removeMargin:!0})})]})]})});return P(P3,e(d(e({placeholder:a},T),{error:Boolean(I),onChange:$,InputProps:g}),p))}}),C)}),P(b,{name:C})]})}})},B3=x3(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 J,jsxs as R3}from"react/jsx-runtime";var $3=Z=>{var V=Z,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:n,labelPlacement:u,required:M}=V,t=f(V,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let p=E3();if(!p)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return J(A3,{control:p.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:c,onChange:m}})=>R3(G3,{display:"flex",flexDirection:"column",children:[J(I3,{control:J(D3,e({value:c!=null?c:"",defaultValue:c,onChange:m},t),C),label:J(h,{label:n,required:M,regular:!0}),labelPlacement:u||"end"}),J(b,{name:C})]})})},q3=$3;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 X,jsxs as Y3}from"react/jsx-runtime";var j3=t=>{var Z=t,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:n,labelPlacement:u}=Z,M=f(Z,["name","rules","defaultValue","shouldUnregister","label","labelPlacement"]);let V=z3();if(!V)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return X(U3,{control:V.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:p,onChange:c}})=>Y3(O3,{display:"flex",flexDirection:"column",children:[X(N3,{control:X(_3,e({value:p!=null?p:"",defaultValue:p,onChange:c},M),C),label:X(h,{label:n}),labelPlacement:u||"end"}),X(b,{name:C})]})})},W3=j3;import{Grid as K3,Radio as Q3,FormControlLabel as J3}from"@mui/material";import{jsx as o2}from"react/jsx-runtime";var X3=l=>{var n=l,{label:C,labelPlacement:i}=n,o=f(n,["label","labelPlacement"]);return o2(K3,{display:"flex",flexDirection:"column",children:o2(J3,{control:o2(Q3,e({},o)),label:o2(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 r2,jsxs as t1}from"react/jsx-runtime";var l1=V=>{var p=V,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:n,required:u,children:M,orientation:t="row"}=p,Z=f(p,["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 r2(i1,{control:c.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:m,onChange:y}})=>t1(o1,{display:"flex",flexDirection:"column",children:[n&&r2(h,{label:n,required:u}),r2(r1,d(e({value:m||"",onChange:y,name:C},Z),{style:{display:"flex",flexDirection:t},children:M}),C),r2(b,{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 k2}from"react/jsx-runtime";var V1=u=>{var M=u,{name:C,rules:i,defaultValue:o,shouldUnregister:l}=M,n=f(M,["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 k2(H1,{control:t.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:Z,onChange:V}})=>k2(d1,e({value:Z||(n==null?void 0:n.min)||0,onChange:V,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 y1}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as x1}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)}`}},w2=a1.div`
|
|
62
62
|
> div > button {
|
|
63
63
|
padding: ${({size:C})=>Z1(C)};
|
|
64
64
|
border-radius: 0 ${G(4)} ${G(4)} 0;
|
|
@@ -69,7 +69,7 @@ var T2=Object.defineProperty,B2=Object.defineProperties;var A2=Object.getOwnProp
|
|
|
69
69
|
width: ${({size:C})=>M1(C)};
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
`;import{jsx as Y,jsxs as P1}from"react/jsx-runtime";import{createElement as b1}from"react";var h1=
|
|
72
|
+
`;import{jsx as Y,jsxs as P1}from"react/jsx-runtime";import{createElement as b1}from"react";var h1=V=>{var p=V,{rules:C,name:i,defaultValue:o,shouldUnregister:l,datePickerProps:n,label:u,required:M,placeholder:t}=p,Z=f(p,["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 m=v(c.formState.errors,i);return Y(x1,{dateAdapter:y1,children:Y(p1,{control:c.control,name:i,rules:C,defaultValue:o,shouldUnregister:l,render:({field:{value:y,onChange:F}})=>P1(u1,{display:"flex",flexDirection:"column",children:[u&&Y(h,{label:u,required:M}),b1(g1,d(e({},n),{key:i,value:y!=null?y:null,inputFormat:(n==null?void 0:n.inputFormat)||"DD/MM/YYYY",onChange:F,renderInput:H=>{var a,x;return Y(f1,d(e(d(e({variant:"outlined"},H),{error:Boolean(m)}),Z),{inputProps:d(e({},H.inputProps),{placeholder:t||((a=H.inputProps)==null?void 0:a.placeholder)}),InputProps:d(e({},H.InputProps),{endAdornment:Y(w2,{size:Z.size,children:(x=H.InputProps)==null?void 0:x.endAdornment})})}))}})),Y(b,{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 k1 from"@emotion/styled";var w1=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=k1.div`
|
|
73
73
|
> div > button {
|
|
74
74
|
padding: ${({size:C})=>v1(C)};
|
|
75
75
|
border-radius: 0 ${D(4)} ${D(4)} 0;
|
|
@@ -80,4 +80,4 @@ var T2=Object.defineProperty,B2=Object.defineProperties;var A2=Object.getOwnProp
|
|
|
80
80
|
width: ${({size:C})=>w1(C)};
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
`;import{memo as I1}from"react";import{jsx as _,jsxs as
|
|
83
|
+
`;import{memo as I1}from"react";import{jsx as _,jsxs as R1}from"react/jsx-runtime";var $1=V=>{var p=V,{rules:C,defaultValue:i,shouldUnregister:o,name:l,required:n,label:u,timePickerProps:M,placeholder:t}=p,Z=f(p,["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 m=v(c.formState.errors,l);return _(D1,{dateAdapter:G1,children:_(A1,{control:c.control,name:l,rules:C,defaultValue:i,shouldUnregister:o,render:({field:{value:y,onChange:F}})=>R1(S1,{display:"flex",flexDirection:"column",children:[u&&_(h,{label:u,required:n}),_(T1,d(e({value:y!=null?y:null,onChange:F},M),{renderInput:H=>{var a,x;return _(B1,d(e(d(e({variant:"outlined"},H),{error:Boolean(m)}),Z),{inputProps:d(e({},H.inputProps),{placeholder:t||((a=H.inputProps)==null?void 0:a.placeholder)}),InputProps:d(e({},H.InputProps),{endAdornment:_(v2,{size:Z.size,children:(x=H.InputProps)==null?void 0:x.endAdornment})})}))}}),l),_(b,{name:l})]})})})},q1=I1($1);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 l2}from"@s_mart/core";import{jsx as N,jsxs as S2}from"react/jsx-runtime";import{createElement as Y1}from"react";var j1=p=>{var c=p,{name:C,defaultValue:i,rules:o,shouldUnregister:l,label:n,required:u,placeholder:M,onInputChange:t,onChange:Z}=c,V=f(c,["name","defaultValue","rules","shouldUnregister","label","required","placeholder","onInputChange","onChange"]);let m=O1();if(!m)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let y=v(m.formState.errors,C);return console.warn=()=>{},N(z1,{name:C,control:m.control,defaultValue:i,rules:o,shouldUnregister:l,render:({field:F})=>S2(l2,{display:"flex",flexDirection:"column",children:[n&&N(h,{label:n,required:u}),N(_1,d(e({onChange:(H,a)=>{F.onChange(a),Z==null||Z(a,m.watch())},onInputChange:(H,a,x)=>{x==="input"&&(F.onChange(a),setTimeout(()=>{t==null||t(a,m.watch())},0))},isOptionEqualToValue:(H,a)=>H.value===a.value,renderOption:(H,a)=>Y1("li",d(e({},H),{key:a.key||a.value,onClick:x=>{var w;(w=H.onClick)==null||w.call(H,x),F.onChange(a)}}),S2(l2,{container:!0,direction:"column",children:[N(l2,{item:!0,children:a.label}),a.afterLabel&&N(l2,{item:!0,children:a.afterLabel})]})),value:F.value||null},V),{renderInput:H=>{var a,x,w;return N(N1,d(e(e({placeholder:M},H),V.textFieldProps),{error:Boolean(y),InputProps:d(e(e({},H.InputProps),(a=V.textFieldProps)==null?void 0:a.InputProps),{inputProps:e(e({},H.inputProps),(w=(x=V.textFieldProps)==null?void 0:x.InputProps)==null?void 0:w.inputProps)})}))}}),C),N(b,{name:C})]})})},W1=U1(j1);export{W1 as Autocomplete,q3 as Checkbox,B3 as Creatable,F1 as DatePicker,q2 as Form,C1 as RadioButton,n1 as RadioGroup,g3 as Searchable,V3 as Select,L1 as Slider,W3 as Switch,C3 as TextField,q1 as TimePicker};
|