@s_mart/form 2.9.5 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -371,7 +371,7 @@ type SliderProps = SliderProps$1 & ControllerSlider & {
371
371
  declare const Slider: ({ name, rules, defaultValue, shouldUnregister, ...rest }: SliderProps) => JSX.Element;
372
372
 
373
373
  type DatePickerProps = Omit<UseControllerProps, 'control'> & Pick<TextFieldProps$1, 'label' | 'error' | 'helperText' | 'size' | 'fullWidth' | 'variant' | 'autoFocus' | 'placeholder'> & {
374
- datePickerProps?: Partial<DatePickerProps$1<any, any>>;
374
+ datePickerProps?: Partial<DatePickerProps$1<any>>;
375
375
  /**
376
376
  * Se `true` irá adicionar um asterisco ao label do campo
377
377
  *
@@ -389,7 +389,7 @@ type DatePickerProps = Omit<UseControllerProps, 'control'> & Pick<TextFieldProps
389
389
  declare const _default$2: react.MemoExoticComponent<({ rules, name, defaultValue, shouldUnregister, datePickerProps, label, required, placeholder, disabled, ...rest }: DatePickerProps) => JSX.Element>;
390
390
 
391
391
  type TimePickerProps = Omit<UseControllerProps, 'control'> & Pick<TextFieldProps$1, 'label' | 'error' | 'helperText' | 'size' | 'fullWidth' | 'variant' | 'autoFocus' | 'placeholder'> & {
392
- timePickerProps?: Partial<TimePickerProps$1<any, any>>;
392
+ timePickerProps?: Partial<TimePickerProps$1<any>>;
393
393
  /**
394
394
  * Se `true` irá adicionar um asterisco ao label do campo
395
395
  *
@@ -439,6 +439,6 @@ type AutocompleteProps<T = any> = Omit<UseControllerProps, 'control'> & Omit<Aut
439
439
  onChange?: (value: any, values: FieldValues) => void;
440
440
  };
441
441
 
442
- declare const _default: react.MemoExoticComponent<({ name, defaultValue, rules, shouldUnregister, label, required, noOptionsText, placeholder, onInputChange, onChange, ...rest }: AutocompleteProps<any>) => JSX.Element>;
442
+ declare const _default: react.MemoExoticComponent<({ name, defaultValue, rules, shouldUnregister, label, required, noOptionsText, placeholder, onInputChange, onChange, ...rest }: AutocompleteProps) => JSX.Element>;
443
443
 
444
444
  export { _default as Autocomplete, AutocompleteProps, Checkbox, CheckboxProps, _default$3 as Creatable, CreatableOption, CreatableProps, _default$2 as DatePicker, DatePickerProps, FooterProps, Form, IFormProps, RadioButton, RadioGroup, RadioGroupProps, RadioProps, _default$4 as Searchable, SearchableOption, SearchableProps, _default$5 as Select, SelectOption, SelectProps, Slider, SliderProps, Switch, SwitchProps, _default$6 as TextField, TextFieldProps, _default$1 as TimePicker, TimePickerProps };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var D0=Object.create;var o1=Object.defineProperty,B0=Object.defineProperties,I0=Object.getOwnPropertyDescriptor,R0=Object.getOwnPropertyDescriptors,q0=Object.getOwnPropertyNames,m1=Object.getOwnPropertySymbols,$0=Object.getPrototypeOf,S1=Object.prototype.hasOwnProperty,U1=Object.prototype.propertyIsEnumerable;var $1=(c,e,i)=>e in c?o1(c,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[e]=i,a=(c,e)=>{for(var i in e||(e={}))S1.call(e,i)&&$1(c,i,e[i]);if(m1)for(var i of m1(e))U1.call(e,i)&&$1(c,i,e[i]);return c},h=(c,e)=>B0(c,R0(e));var y=(c,e)=>{var i={};for(var r in c)S1.call(c,r)&&e.indexOf(r)<0&&(i[r]=c[r]);if(c!=null&&m1)for(var r of m1(c))e.indexOf(r)<0&&U1.call(c,r)&&(i[r]=c[r]);return i};var U0=(c,e)=>{for(var i in e)o1(c,i,{get:e[i],enumerable:!0})},z1=(c,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of q0(e))!S1.call(c,o)&&o!==i&&o1(c,o,{get:()=>e[o],enumerable:!(r=I0(e,o))||r.enumerable});return c};var v1=(c,e,i)=>(i=c!=null?D0($0(c)):{},z1(e||!c||!c.__esModule?o1(i,"default",{value:c,enumerable:!0}):i,c)),z0=c=>z1(o1({},"__esModule",{value:!0}),c);var t2={};U0(t2,{Autocomplete:()=>T0,Checkbox:()=>n0,Creatable:()=>r0,DatePicker:()=>y0,Form:()=>_1,RadioButton:()=>s0,RadioGroup:()=>h0,Searchable:()=>e0,Select:()=>c0,Slider:()=>m0,Switch:()=>t0,TextField:()=>X1,TimePicker:()=>w0});module.exports=z0(t2);var O1=require("react"),Z1=require("react-hook-form");var T1=require("react/jsx-runtime");function O0(V){var m=V,{children:c,onSubmit:e,style:i,disableDefaultValuesUpdate:r}=m,o=y(m,["children","onSubmit","style","disableDefaultValuesUpdate"]);let s=(0,Z1.useForm)(o);(0,O1.useEffect)(()=>{r||s.reset(o.defaultValues)},[o.defaultValues,s.reset]);let v=()=>typeof c=="function"?c(h(a({},s),{onSubmit:s.handleSubmit(t=>e(t,s))})):c;return(0,T1.jsx)(Z1.FormProvider,h(a({},s),{children:(0,T1.jsx)("form",{onSubmit:t=>{t.preventDefault(),t.stopPropagation(),s.handleSubmit(d=>e(d,s))()},style:i,children:v()})}))}var _1=O0;var p1=require("react"),u1=require("react-hook-form"),W=require("@mui/material");var N1={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"},j1={description:"M24 31.7c-4 0-7.4-3.1-7.7-7.1l-5.6-4.4c-.8 1-1.4 2-2 3a1.7 1.7 0 0 0 0 1.6 17.2 17.2 0 0 0 19.5 9l-2.8-2.2-1.4.1ZM40.9 35l-6-4.6c1.8-1.5 3.3-3.4 4.4-5.5a1.7 1.7 0 0 0 0-1.6c-3-5.7-8.7-9.5-15.3-9.5-2.8 0-5.5.7-8 2l-6.8-5.3a.9.9 0 0 0-1.2.2L7 12a.9.9 0 0 0 .1 1.2l31.7 24.5a.9.9 0 0 0 1.2-.2l1-1.3a.9.9 0 0 0-.1-1.2Zm-10-7.7-2-1.6a5 5 0 0 0-6.3-6.6 2.5 2.5 0 0 1 .4 2l-3.9-3a7.7 7.7 0 0 1 10.4.5 7.7 7.7 0 0 1 1.5 8.7Z",id:"line-eye-slash-solid"};var j={description:"M24 8a16 16 0 0 0 0 32 16 16 0 0 0 0-32Zm0 7.1c1.5 0 2.7 1.2 2.7 2.7 0 1.6-1.2 2.7-2.7 2.7a2.6 2.6 0 0 1-2.7-2.7c0-1.5 1.2-2.7 2.7-2.7Zm3.6 16.4c0 .4-.4.8-.8.8h-5.6a.7.7 0 0 1-.8-.8v-1.6c0-.4.3-.7.8-.7h.7V25h-.7a.7.7 0 0 1-.8-.7v-1.6c0-.4.3-.8.8-.8h4c.5 0 .9.4.9.8v6.5h.7c.4 0 .8.3.8.7v1.6Z",id:"line-info-circle-solid"};var W1={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 E1={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 X=v1(require("@s_mart/masks"));var G1=require("@mui/material"),Y1=require("@s_mart/utils"),r1=require("react/jsx-runtime"),P=({label:c,required:e,regular:i})=>(0,r1.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:(0,Y1.toRem)(2)},children:[(0,r1.jsx)(G1.Typography,{variant:"caption",fontWeight:i?400:700,style:{display:"flex",alignItems:"center"},children:c}),e&&(0,r1.jsx)(G1.Typography,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});var K1=require("react-hook-form"),Q1=require("@s_mart/core");var E=(c,e)=>{var i,r,o,V,m;if(c[e])return c[e];if(e.includes("[")){let[s,v]=e.split("["),[t,d]=v.split("].");return(r=(i=c[s])==null?void 0:i[t])==null?void 0:r[d]}if(e.includes(".")){let[s,v,t]=e.split(".");return t?(m=(V=c[s])==null?void 0:V[v])==null?void 0:m[t]:(o=c[s])==null?void 0:o[v]}};var J1=require("react/jsx-runtime"),w=({name:c})=>{var r;let e=(0,K1.useFormContext)(),i=E((r=e==null?void 0:e.formState)==null?void 0:r.errors,c);return i?(0,J1.jsx)(Q1.Indicator,{severity:"error",children:i==null?void 0:i.message}):null};var n1=require("@s_mart/core");var G=require("react/jsx-runtime"),_0=C=>{var k=C,{name:c,rules:e,defaultValue:i,shouldUnregister:r,label:o,required:V,mask:m,variant:s="outlined",info:v,parse:t,format:d,onInputChange:p}=k,u=y(k,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","info","parse","format","onInputChange"]);let g=(0,u1.useFormContext)();if(!g)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[H,n]=(0,p1.useState)(!1),x=F=>{var l;let f=F;return d&&(f=d(F)),m?(l=X==null?void 0:X[m])==null?void 0:l.format(f):f},b=F=>{var l;let f=F;return t&&(f=t(F)),m?(l=X==null?void 0:X[m])==null?void 0:l.parse(f):f},S=F=>{if(!F||m!=="porcentagem")return;F==null||F.stopPropagation();let f=(F==null?void 0:F.target).value;if(f){let l=String(f);if(l.length>0){let T=l.indexOf("%");T>-1&&(F.currentTarget.selectionEnd=T)}}},O=E(g.formState.errors,c);return(0,G.jsx)(u1.Controller,{control:g.control,name:c,rules:e,defaultValue:i,shouldUnregister:r,render:({field:{value:F,onChange:f,ref:l}})=>(0,G.jsxs)(W.Grid,{display:"flex",flexDirection:"column",children:[(0,G.jsxs)("div",{style:{display:"flex"},children:[o&&(0,G.jsx)(W.Grid,{item:!0,children:(0,G.jsx)(P,{label:o,required:V})}),v&&(0,G.jsx)(W.Grid,{item:!0,children:(0,G.jsx)(n1.Tooltip,{title:v,placement:"top",children:(0,G.jsx)("div",{style:{width:"fit-content"},children:(0,G.jsx)(n1.LIcon,{icon:j,color:"#757575"})})})})]}),(0,G.jsx)(W.TextField,h(a({variant:s,defaultValue:i,value:x(F||""),onChange:T=>{var a1;let d1=b((a1=T==null?void 0:T.target)==null?void 0:a1.value);f(d1),p==null||p(d1,g.watch())},error:Boolean(O)},u),{type:u.type==="password"?H?"text":"password":u.type,autoComplete:u.autoComplete||"off",InputProps:a({onKeyDown:S,inputRef:l,endAdornment:u.type==="password"&&(0,G.jsx)(W.InputAdornment,{position:"end",onClick:()=>n(!H),style:{cursor:"pointer"},children:(0,G.jsx)(n1.LIcon,{icon:H?N1:j1,size:"24px",removeMargin:!0})})},u.InputProps)}),c),(0,G.jsx)(w,{name:c})]})})},X1=(0,p1.memo)(_0);var f1=require("react"),M1=require("react-hook-form"),c1=require("@s_mart/core"),D=require("@mui/material");var L=require("react/jsx-runtime"),N0=k=>{var g=k,{name:c,rules:e,defaultValue:i,shouldUnregister:r,label:o,required:V,options:m,placeholder:s,disableOnChangeForm:v=!1,multiple:t,info:d,footer:p,onChange:u}=g,C=y(g,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","disableOnChangeForm","multiple","info","footer","onChange"]);let H=(0,M1.useFormContext)(),{palette:n}=(0,D.useTheme)(),[x,b]=(0,f1.useState)(!1);if(!H)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let S=E(H.formState.errors,c);return console.warn=()=>{},(0,L.jsx)(M1.Controller,{control:H.control,name:c,rules:e,defaultValue:i||"",shouldUnregister:r,render:({field:{value:O,onChange:F,ref:f}})=>(0,L.jsxs)(D.Grid,{display:"flex",flexDirection:"column",children:[(0,L.jsxs)("div",{style:{display:"flex"},children:[o&&(0,L.jsx)(D.Grid,{item:!0,children:(0,L.jsx)(P,{label:o,required:V})}),d&&(0,L.jsx)(D.Grid,{item:!0,children:(0,L.jsx)(c1.Tooltip,{title:d,placement:"top",children:(0,L.jsx)("div",{style:{width:"fit-content"},children:(0,L.jsx)(c1.LIcon,{icon:j,color:"#757575"})})})})]}),(0,L.jsxs)(D.Select,h(a({open:x,onOpen:()=>b(!0),onClose:()=>b(!1),displayEmpty:Boolean(s),variant:"outlined",autoComplete:"off",value:O?O||"":t?[]:"",renderValue:l=>{if(l.label)return l.label;if(s)return(0,L.jsx)("p",{style:{color:n.grey[400]},children:s})},multiple:t,onChange:l=>{!v&&F(l.target.value),u&&u(l.target.value,H.watch())},error:Boolean(S),size:C.size||"medium",inputRef:f},C),{children:[s&&(0,L.jsx)(D.MenuItem,{disabled:!0,value:"",children:(0,L.jsx)("p",{style:{color:n.grey[400]},children:s})}),m==null?void 0:m.map((l,T)=>(0,L.jsx)(D.MenuItem,{value:l,children:(0,L.jsxs)(D.Grid,{container:!0,direction:"column",children:[(0,L.jsx)(D.Grid,{item:!0,children:l.label}),l.afterLabel&&(0,L.jsx)(D.Grid,{item:!0,children:l.afterLabel})]})},T)),p&&[(0,L.jsx)(D.Grid,{px:2,py:1,children:(0,L.jsx)(c1.Divider,{})},"footer-divider"),(0,L.jsx)("div",{children:p({closeSelect:()=>b(!1)})},"footer-content")]]}),c),(0,L.jsx)(w,{name:c})]})})},c0=(0,f1.memo)(N0);var H1=require("react"),V1=require("react-hook-form"),Q=require("@s_mart/core");var I=require("@mui/material");var Z=require("react/jsx-runtime"),D1=require("react"),j0=H=>{var n=H,{name:c,rules:e,defaultValue:i,shouldUnregister:r,label:o,required:V,options:m,textFieldProps:s,noOptionsText:v,footer:t,multiple:d,info:p,placeholder:u,onChange:C,onInputChange:k}=n,g=y(n,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText","footer","multiple","info","placeholder","onChange","onInputChange"]);let x=(0,V1.useFormContext)();if(!x)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let b=E(x.formState.errors,c);return console.warn=()=>{},(0,Z.jsx)(V1.Controller,{control:x.control,name:c,rules:e,defaultValue:i,shouldUnregister:r,render:({field:{onChange:S,value:O,ref:F}})=>(0,Z.jsxs)(I.Grid,{display:"flex",flexDirection:"column",children:[(0,Z.jsxs)("div",{style:{display:"flex"},children:[o&&(0,Z.jsx)(I.Grid,{item:!0,children:(0,Z.jsx)(P,{label:o,required:V})}),p&&(0,Z.jsx)(I.Grid,{item:!0,children:(0,Z.jsx)(Q.Tooltip,{title:p,placement:"top",children:(0,Z.jsx)("div",{style:{width:"fit-content"},children:(0,Z.jsx)(Q.LIcon,{icon:j,color:"#757575"})})})})]}),(0,Z.jsx)(I.Autocomplete,h(a({onChange:(f,l)=>{S(l),C==null||C(l,x.watch())},onInputChange:(f,l,T)=>{T==="input"&&setTimeout(()=>{k==null||k(l,x.watch())},0)},value:O||(d?[]:null),options:m,multiple:d,noOptionsText:(0,Z.jsxs)(Z.Fragment,{children:[v||"Nenhum resultado encontrado",t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(I.Grid,{py:1,children:(0,Z.jsx)(Q.Divider,{})}),t]}):null]}),isOptionEqualToValue:(f,l)=>typeof f=="string"&&typeof l=="string"?f===l:typeof f=="object"&&typeof l=="object"?f.value===l.value:!1,renderOption:(f,l)=>typeof l=="object"?(0,D1.createElement)("li",h(a({},f),{key:l.key||l.value}),(0,Z.jsxs)(I.Grid,{container:!0,direction:"column",children:[(0,Z.jsx)(I.Grid,{item:!0,children:l.label}),l.afterLabel&&(0,Z.jsx)(I.Grid,{item:!0,children:l.afterLabel})]})):(0,D1.createElement)("li",h(a({},f),{key:l}),l),ListboxComponent:(0,H1.forwardRef)(function(l,T){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)("ul",h(a({},l),{ref:T})),!!t&&(0,Z.jsx)("div",h(a({},l),{children:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(I.Grid,{px:2,py:1,children:(0,Z.jsx)(Q.Divider,{})}),t]})}),"searchable-footer")]})})},g),{renderInput:f=>(0,Z.jsx)(I.TextField,h(a(a({error:Boolean(b),placeholder:u},f),s),{inputRef:F}))}),c),(0,Z.jsx)(w,{name:c})]})})},e0=(0,H1.memo)(j0);var o0=require("react"),y1=require("react-hook-form"),R=require("@mui/material");var t1=require("@s_mart/utils"),l0=v1(require("@emotion/styled")),B1=require("@emotion/react"),i0=B1.css`
1
+ "use strict";var D0=Object.create;var o1=Object.defineProperty,B0=Object.defineProperties,I0=Object.getOwnPropertyDescriptor,R0=Object.getOwnPropertyDescriptors,q0=Object.getOwnPropertyNames,m1=Object.getOwnPropertySymbols,$0=Object.getPrototypeOf,S1=Object.prototype.hasOwnProperty,U1=Object.prototype.propertyIsEnumerable;var $1=(c,l,i)=>l in c?o1(c,l,{enumerable:!0,configurable:!0,writable:!0,value:i}):c[l]=i,a=(c,l)=>{for(var i in l||(l={}))S1.call(l,i)&&$1(c,i,l[i]);if(m1)for(var i of m1(l))U1.call(l,i)&&$1(c,i,l[i]);return c},h=(c,l)=>B0(c,R0(l));var y=(c,l)=>{var i={};for(var r in c)S1.call(c,r)&&l.indexOf(r)<0&&(i[r]=c[r]);if(c!=null&&m1)for(var r of m1(c))l.indexOf(r)<0&&U1.call(c,r)&&(i[r]=c[r]);return i};var U0=(c,l)=>{for(var i in l)o1(c,i,{get:l[i],enumerable:!0})},z1=(c,l,i,r)=>{if(l&&typeof l=="object"||typeof l=="function")for(let o of q0(l))!S1.call(c,o)&&o!==i&&o1(c,o,{get:()=>l[o],enumerable:!(r=I0(l,o))||r.enumerable});return c};var v1=(c,l,i)=>(i=c!=null?D0($0(c)):{},z1(l||!c||!c.__esModule?o1(i,"default",{value:c,enumerable:!0}):i,c)),z0=c=>z1(o1({},"__esModule",{value:!0}),c);var t2={};U0(t2,{Autocomplete:()=>T0,Checkbox:()=>n0,Creatable:()=>r0,DatePicker:()=>y0,Form:()=>_1,RadioButton:()=>s0,RadioGroup:()=>h0,Searchable:()=>l0,Select:()=>c0,Slider:()=>m0,Switch:()=>t0,TextField:()=>X1,TimePicker:()=>w0});module.exports=z0(t2);var O1=require("react"),Z1=require("react-hook-form");var T1=require("react/jsx-runtime");function O0(V){var m=V,{children:c,onSubmit:l,style:i,disableDefaultValuesUpdate:r}=m,o=y(m,["children","onSubmit","style","disableDefaultValuesUpdate"]);let s=(0,Z1.useForm)(o);(0,O1.useEffect)(()=>{r||s.reset(o.defaultValues)},[o.defaultValues,s.reset]);let v=()=>typeof c=="function"?c(h(a({},s),{onSubmit:s.handleSubmit(t=>l(t,s))})):c;return(0,T1.jsx)(Z1.FormProvider,h(a({},s),{children:(0,T1.jsx)("form",{onSubmit:t=>{t.preventDefault(),t.stopPropagation(),s.handleSubmit(d=>l(d,s))()},style:i,children:v()})}))}var _1=O0;var p1=require("react"),u1=require("react-hook-form"),j=require("@mui/material");var N1={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"},j1={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 N={description:"M24 8a16 16 0 0 0 0 32 16 16 0 0 0 0-32Zm0 7.1c1.5 0 2.7 1.2 2.7 2.7 0 1.6-1.2 2.7-2.7 2.7a2.6 2.6 0 0 1-2.7-2.7c0-1.5 1.2-2.7 2.7-2.7Zm3.6 16.4c0 .4-.4.8-.8.8h-5.6a.7.7 0 0 1-.8-.8v-1.6c0-.4.3-.7.8-.7h.7V25h-.7a.7.7 0 0 1-.8-.7v-1.6c0-.4.3-.8.8-.8h4c.5 0 .9.4.9.8v6.5h.7c.4 0 .8.3.8.7v1.6Z",id:"line-info-circle-solid"};var W1={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 E1={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 X=v1(require("@s_mart/masks"));var G1=require("@mui/material"),Y1=require("@s_mart/utils"),r1=require("react/jsx-runtime"),P=({label:c,required:l,regular:i})=>(0,r1.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:(0,Y1.toRem)(2)},children:[(0,r1.jsx)(G1.Typography,{variant:"caption",fontWeight:i?400:700,style:{display:"flex",alignItems:"center"},children:c}),l&&(0,r1.jsx)(G1.Typography,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});var K1=require("react-hook-form"),Q1=require("@s_mart/core");var E=(c,l)=>{var i,r,o,V,m;if(c[l])return c[l];if(l.includes("[")){let[s,v]=l.split("["),[t,d]=v.split("].");return(r=(i=c[s])==null?void 0:i[t])==null?void 0:r[d]}if(l.includes(".")){let[s,v,t]=l.split(".");return t?(m=(V=c[s])==null?void 0:V[v])==null?void 0:m[t]:(o=c[s])==null?void 0:o[v]}};var J1=require("react/jsx-runtime"),w=({name:c})=>{var r;let l=(0,K1.useFormContext)(),i=E((r=l==null?void 0:l.formState)==null?void 0:r.errors,c);return i?(0,J1.jsx)(Q1.Indicator,{severity:"error",children:i==null?void 0:i.message}):null};var n1=require("@s_mart/core");var G=require("react/jsx-runtime"),_0=C=>{var k=C,{name:c,rules:l,defaultValue:i,shouldUnregister:r,label:o,required:V,mask:m,variant:s="outlined",info:v,parse:t,format:d,onInputChange:p}=k,u=y(k,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","info","parse","format","onInputChange"]);let x=(0,u1.useFormContext)();if(!x)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[H,n]=(0,p1.useState)(!1),g=F=>{var e;let f=F;return d&&(f=d(F)),m?(e=X==null?void 0:X[m])==null?void 0:e.format(f):f},b=F=>{var e;let f=F;return t&&(f=t(F)),m?(e=X==null?void 0:X[m])==null?void 0:e.parse(f):f},S=F=>{if(!F||m!=="porcentagem")return;F==null||F.stopPropagation();let f=(F==null?void 0:F.target).value;if(f){let e=String(f);if(e.length>0){let T=e.indexOf("%");T>-1&&(F.currentTarget.selectionEnd=T)}}},z=E(x.formState.errors,c);return(0,G.jsx)(u1.Controller,{control:x.control,name:c,rules:l,defaultValue:i,shouldUnregister:r,render:({field:{value:F,onChange:f,ref:e}})=>(0,G.jsxs)(j.Grid,{display:"flex",flexDirection:"column",children:[(0,G.jsxs)("div",{style:{display:"flex"},children:[o&&(0,G.jsx)(j.Grid,{item:!0,children:(0,G.jsx)(P,{label:o,required:V})}),v&&(0,G.jsx)(j.Grid,{item:!0,children:(0,G.jsx)(n1.Tooltip,{title:v,placement:"top",children:(0,G.jsx)("div",{style:{width:"fit-content"},children:(0,G.jsx)(n1.LIcon,{icon:N,color:"#757575"})})})})]}),(0,G.jsx)(j.TextField,h(a({variant:s,defaultValue:i,value:g(F||""),onChange:T=>{var a1;let d1=b((a1=T==null?void 0:T.target)==null?void 0:a1.value);f(d1),p==null||p(d1,x.watch())},error:!!z},u),{type:u.type==="password"?H?"text":"password":u.type,autoComplete:u.autoComplete||"off",InputProps:a({onKeyDown:S,inputRef:e,endAdornment:u.type==="password"&&(0,G.jsx)(j.InputAdornment,{position:"end",onClick:()=>n(!H),style:{cursor:"pointer"},children:(0,G.jsx)(n1.LIcon,{icon:H?N1:j1,size:"24px",removeMargin:!0})})},u.InputProps)}),c),(0,G.jsx)(w,{name:c})]})})},X1=(0,p1.memo)(_0);var f1=require("react"),M1=require("react-hook-form"),c1=require("@s_mart/core"),D=require("@mui/material");var L=require("react/jsx-runtime"),N0=k=>{var x=k,{name:c,rules:l,defaultValue:i,shouldUnregister:r,label:o,required:V,options:m,placeholder:s,disableOnChangeForm:v=!1,multiple:t,info:d,footer:p,onChange:u}=x,C=y(x,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","disableOnChangeForm","multiple","info","footer","onChange"]);let H=(0,M1.useFormContext)(),{palette:n}=(0,D.useTheme)(),[g,b]=(0,f1.useState)(!1);if(!H)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let S=E(H.formState.errors,c);return console.warn=()=>{},(0,L.jsx)(M1.Controller,{control:H.control,name:c,rules:l,defaultValue:i||"",shouldUnregister:r,render:({field:{value:z,onChange:F,ref:f}})=>(0,L.jsxs)(D.Grid,{display:"flex",flexDirection:"column",children:[(0,L.jsxs)("div",{style:{display:"flex"},children:[o&&(0,L.jsx)(D.Grid,{item:!0,children:(0,L.jsx)(P,{label:o,required:V})}),d&&(0,L.jsx)(D.Grid,{item:!0,children:(0,L.jsx)(c1.Tooltip,{title:d,placement:"top",children:(0,L.jsx)("div",{style:{width:"fit-content"},children:(0,L.jsx)(c1.LIcon,{icon:N,color:"#757575"})})})})]}),(0,L.jsxs)(D.Select,h(a({open:g,onOpen:()=>b(!0),onClose:()=>b(!1),displayEmpty:!!s,variant:"outlined",autoComplete:"off",value:z?z||"":t?[]:"",renderValue:e=>{if(e.label)return e.label;if(s)return(0,L.jsx)("p",{style:{color:n.grey[400]},children:s})},multiple:t,onChange:e=>{!v&&F(e.target.value),u&&u(e.target.value,H.watch())},error:!!S,size:C.size||"medium",inputRef:f},C),{children:[s&&(0,L.jsx)(D.MenuItem,{disabled:!0,value:"",children:(0,L.jsx)("p",{style:{color:n.grey[400]},children:s})}),m==null?void 0:m.map((e,T)=>(0,L.jsx)(D.MenuItem,{value:e,children:(0,L.jsxs)(D.Grid,{container:!0,direction:"column",children:[(0,L.jsx)(D.Grid,{item:!0,children:e.label}),e.afterLabel&&(0,L.jsx)(D.Grid,{item:!0,children:e.afterLabel})]})},T)),p&&[(0,L.jsx)(D.Grid,{px:2,py:1,children:(0,L.jsx)(c1.Divider,{})},"footer-divider"),(0,L.jsx)("div",{children:p({closeSelect:()=>b(!1)})},"footer-content")]]}),c),(0,L.jsx)(w,{name:c})]})})},c0=(0,f1.memo)(N0);var H1=require("react"),V1=require("react-hook-form"),Q=require("@s_mart/core");var I=require("@mui/material");var Z=require("react/jsx-runtime"),D1=require("react"),j0=H=>{var n=H,{name:c,rules:l,defaultValue:i,shouldUnregister:r,label:o,required:V,options:m,textFieldProps:s,noOptionsText:v,footer:t,multiple:d,info:p,placeholder:u,onChange:C,onInputChange:k}=n,x=y(n,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText","footer","multiple","info","placeholder","onChange","onInputChange"]);let g=(0,V1.useFormContext)();if(!g)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let b=E(g.formState.errors,c);return console.warn=()=>{},(0,Z.jsx)(V1.Controller,{control:g.control,name:c,rules:l,defaultValue:i,shouldUnregister:r,render:({field:{onChange:S,value:z,ref:F}})=>(0,Z.jsxs)(I.Grid,{display:"flex",flexDirection:"column",children:[(0,Z.jsxs)("div",{style:{display:"flex"},children:[o&&(0,Z.jsx)(I.Grid,{item:!0,children:(0,Z.jsx)(P,{label:o,required:V})}),p&&(0,Z.jsx)(I.Grid,{item:!0,children:(0,Z.jsx)(Q.Tooltip,{title:p,placement:"top",children:(0,Z.jsx)("div",{style:{width:"fit-content"},children:(0,Z.jsx)(Q.LIcon,{icon:N,color:"#757575"})})})})]}),(0,Z.jsx)(I.Autocomplete,h(a({onChange:(f,e)=>{S(e),C==null||C(e,g.watch())},onInputChange:(f,e,T)=>{T==="input"&&setTimeout(()=>{k==null||k(e,g.watch())},0)},value:z||(d?[]:null),options:m,multiple:d,noOptionsText:(0,Z.jsxs)(Z.Fragment,{children:[v||"Nenhum resultado encontrado",t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(I.Grid,{py:1,children:(0,Z.jsx)(Q.Divider,{})}),t]}):null]}),isOptionEqualToValue:(f,e)=>typeof f=="string"&&typeof e=="string"?f===e:typeof f=="object"&&typeof e=="object"?f.value===e.value:!1,renderOption:(f,e)=>typeof e=="object"?(0,D1.createElement)("li",h(a({},f),{key:e.key||e.value}),(0,Z.jsxs)(I.Grid,{container:!0,direction:"column",children:[(0,Z.jsx)(I.Grid,{item:!0,children:e.label}),e.afterLabel&&(0,Z.jsx)(I.Grid,{item:!0,children:e.afterLabel})]})):(0,D1.createElement)("li",h(a({},f),{key:e}),e),ListboxComponent:(0,H1.forwardRef)(function(e,T){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)("ul",h(a({},e),{ref:T})),!!t&&(0,Z.jsx)("div",h(a({},e),{children:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(I.Grid,{px:2,py:1,children:(0,Z.jsx)(Q.Divider,{})}),t]})}),"searchable-footer")]})})},x),{renderInput:f=>(0,Z.jsx)(I.TextField,h(a(a({error:!!b,placeholder:u},f),s),{inputRef:F}))}),c),(0,Z.jsx)(w,{name:c})]})})},l0=(0,H1.memo)(j0);var o0=require("react"),y1=require("react-hook-form"),R=require("@mui/material");var t1=require("@s_mart/utils"),e0=v1(require("@emotion/styled")),B1=require("@emotion/react"),i0=B1.css`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
@@ -36,7 +36,7 @@
36
36
  }
37
37
  }
38
38
  }
39
- `,a0=l0.default.div`
39
+ `,a0=e0.default.div`
40
40
  display: flex;
41
41
 
42
42
  div.endAdornments {
@@ -46,19 +46,19 @@
46
46
  ${i0}
47
47
  }
48
48
 
49
- ${({hideAddButton:c,theme:e})=>!c&&W0(e)}
50
- `;var _=require("@s_mart/core");var g1=require("lodash"),I1=require("@s_mart/utils");var M=require("react/jsx-runtime"),R1=require("react"),Y0=x=>{var b=x,{name:c,rules:e,defaultValue:i,shouldUnregister:r,label:o,required:V,options:m,editable:s,onEditOption:v,onCreateOption:t,textFieldProps:d,hideAddButton:p,multiple:u,info:C,onChange:k,onInputChange:g,placeholder:H}=b,n=y(b,["name","rules","defaultValue","shouldUnregister","label","required","options","editable","onEditOption","onCreateOption","textFieldProps","hideAddButton","multiple","info","onChange","onInputChange","placeholder"]);let S=(0,y1.useFormContext)();if(!S)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let O=E(S.formState.errors,c);console.warn=()=>{};let F=l=>{t?t(l):console.error("onCreateOption n\xE3o foi definido")},f=l=>{v?v(l):console.error("onEditOption n\xE3o foi definido")};return(0,M.jsx)(y1.Controller,{control:S.control,name:c,rules:e,defaultValue:i,shouldUnregister:r,render:({field:{value:l,onChange:T,ref:d1}})=>{let a1=(l==null?void 0:l.label)||(l==null?void 0:l.value)||l;return(0,M.jsxs)(R.Grid,{display:"flex",flexDirection:"column",children:[(0,M.jsxs)("div",{style:{display:"flex"},children:[o&&(0,M.jsx)(R.Grid,{item:!0,children:(0,M.jsx)(P,{label:o,required:V})}),C&&(0,M.jsx)(R.Grid,{item:!0,children:(0,M.jsx)(_.Tooltip,{title:C,placement:"top",children:(0,M.jsx)("div",{style:{width:"fit-content"},children:(0,M.jsx)(_.LIcon,{icon:j,color:"#757575"})})})})]}),(0,M.jsx)(a0,{hideAddButton:p,children:(0,M.jsx)(R.Autocomplete,h(a({fullWidth:!0,onChange:(B,A)=>{T(A),k==null||k(A,S.watch())},onInputChange:(B,A,G0)=>{G0==="input"&&(T(A),setTimeout(()=>{g==null||g(A,S.watch())},0))},options:m,value:l||(u?[]:null),multiple:u,noOptionsText:(0,M.jsxs)(_.Button,{sx:{justifyContent:"flex-start",padding:`${(0,I1.toRem)(6)} ${(0,I1.toRem)(-16)}`,margin:0},fullWidth:!0,onClick:()=>F(l),variant:"text",startIcon:(0,M.jsx)(_.LIcon,{icon:E1}),children:["Adicionar ",a1&&`"${a1}"`]}),isOptionEqualToValue:(B,A)=>A?typeof B=="string"&&typeof A=="string"?B===A:typeof B=="object"&&typeof A=="object"?B.value===A.value:typeof B=="object"&&typeof A=="string":!1,renderOption:(B,A)=>typeof A=="object"?(0,R1.createElement)("li",h(a({},B),{key:A.key||A.value}),(0,M.jsxs)(R.Grid,{container:!0,direction:"column",children:[(0,M.jsx)(R.Grid,{item:!0,children:A.label}),A.afterLabel&&(0,M.jsx)(R.Grid,{item:!0,children:A.afterLabel})]})):(0,R1.createElement)("li",h(a({},B),{key:A}),A)},n),{renderInput:B=>(0,M.jsx)(R.TextField,a(h(a({placeholder:H},B),{error:Boolean(O),onChange:T,InputProps:h(a({},B.InputProps),{inputRef:d1,endAdornment:p?void 0:(0,M.jsxs)("div",{className:"endAdornments",children:[B.InputProps.endAdornment,s&&(0,g1.isObject)(l)&&!(0,g1.isEmpty)(l)?(0,M.jsxs)("div",{className:"editable",children:[(0,M.jsx)("div",{className:"divider"}),(0,M.jsx)("div",{className:"button",onClick:()=>f(l),children:(0,M.jsx)(_.LIcon,{icon:W1,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:()=>F(l),children:(0,M.jsx)(_.LIcon,{icon:E1,size:"24px",removeMargin:!0})})]})]})})}),d))}),c)}),(0,M.jsx)(w,{name:c})]})}})},r0=(0,o0.memo)(Y0);var x1=require("react-hook-form"),e1=require("@mui/material");var Y=require("react/jsx-runtime"),K0=v=>{var t=v,{name:c,rules:e,defaultValue:i,shouldUnregister:r,label:o,labelPlacement:V,required:m}=t,s=y(t,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let d=(0,x1.useFormContext)();if(!d)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,Y.jsx)(x1.Controller,{control:d.control,name:c,rules:e,defaultValue:i,shouldUnregister:r,render:({field:{value:p,onChange:u}})=>(0,Y.jsxs)(e1.Grid,{display:"flex",flexDirection:"column",children:[(0,Y.jsx)(e1.FormControlLabel,{control:(0,Y.jsx)(e1.Checkbox,a({checked:Boolean(p),value:p!=null?p:"",defaultValue:p,onChange:u},s),c),label:(0,Y.jsx)(P,{label:o,required:m,regular:!0}),labelPlacement:V||"end"}),(0,Y.jsx)(w,{name:c})]})})},n0=K0;var F1=require("react-hook-form"),l1=require("@mui/material");var K=require("react/jsx-runtime"),Q0=s=>{var v=s,{name:c,rules:e,defaultValue:i,shouldUnregister:r,label:o,labelPlacement:V}=v,m=y(v,["name","rules","defaultValue","shouldUnregister","label","labelPlacement"]);let t=(0,F1.useFormContext)();if(!t)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,K.jsx)(F1.Controller,{control:t.control,name:c,rules:e,defaultValue:i,shouldUnregister:r,render:({field:{value:d,onChange:p}})=>(0,K.jsxs)(l1.Grid,{display:"flex",flexDirection:"column",children:[(0,K.jsx)(l1.FormControlLabel,{control:(0,K.jsx)(l1.Switch,a({value:d!=null?d:"",checked:d!=null?d:!1,defaultValue:d,onChange:p},m),c),label:(0,K.jsx)(P,{label:o}),labelPlacement:V||"end"}),(0,K.jsx)(w,{name:c})]})})},t0=Q0;var i1=require("@mui/material");var s1=require("react/jsx-runtime"),J0=r=>{var o=r,{label:c,labelPlacement:e}=o,i=y(o,["label","labelPlacement"]);return(0,s1.jsx)(i1.Grid,{display:"flex",flexDirection:"column",children:(0,s1.jsx)(i1.FormControlLabel,{control:(0,s1.jsx)(i1.Radio,a({},i)),label:(0,s1.jsx)(P,{label:c}),labelPlacement:e||"end"})})},s0=J0;var L1=require("react-hook-form"),C1=require("@mui/material");var J=require("react/jsx-runtime"),X0=t=>{var d=t,{name:c,rules:e,defaultValue:i,shouldUnregister:r,label:o,required:V,children:m,orientation:s="row"}=d,v=y(d,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation"]);let p=(0,L1.useFormContext)();if(!p)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,J.jsx)(L1.Controller,{control:p.control,name:c,rules:e,defaultValue:i,shouldUnregister:r,render:({field:{value:u,onChange:C}})=>(0,J.jsxs)(C1.Grid,{display:"flex",flexDirection:"column",children:[o&&(0,J.jsx)(P,{label:o,required:V}),(0,J.jsx)(C1.RadioGroup,h(a({value:u||"",onChange:C,name:c},v),{style:{display:"flex",flexDirection:s},children:m}),c),(0,J.jsx)(w,{name:c})]})})},h0=X0;var b1=require("react-hook-form"),d0=require("@mui/material");var q1=require("react/jsx-runtime"),c2=V=>{var m=V,{name:c,rules:e,defaultValue:i,shouldUnregister:r}=m,o=y(m,["name","rules","defaultValue","shouldUnregister"]);let s=(0,b1.useFormContext)();if(!s)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,q1.jsx)(b1.Controller,{control:s.control,name:c,rules:e,defaultValue:i,shouldUnregister:r,render:({field:{value:v,onChange:t}})=>(0,q1.jsx)(d0.Slider,a({value:v||(o==null?void 0:o.min)||0,onChange:t,valueLabelDisplay:"auto"},o),c)})},m0=c2;var p0=require("react"),P1=require("react-hook-form"),u0=require("@s_mart/core"),f0=require("@mui/material"),M0=require("@mui/x-date-pickers/DatePicker"),H0=require("@mui/x-date-pickers/AdapterDayjs"),V0=require("@mui/x-date-pickers/LocalizationProvider");var q=require("@s_mart/utils"),v0=v1(require("@emotion/styled")),e2=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)}`}},Z0=v0.default.div`
49
+ ${({hideAddButton:c,theme:l})=>!c&&W0(l)}
50
+ `;var O=require("@s_mart/core");var x1=require("lodash"),I1=require("@s_mart/utils");var M=require("react/jsx-runtime"),R1=require("react"),Y0=g=>{var b=g,{name:c,rules:l,defaultValue:i,shouldUnregister:r,label:o,required:V,options:m,editable:s,onEditOption:v,onCreateOption:t,textFieldProps:d,hideAddButton:p,multiple:u,info:C,onChange:k,onInputChange:x,placeholder:H}=b,n=y(b,["name","rules","defaultValue","shouldUnregister","label","required","options","editable","onEditOption","onCreateOption","textFieldProps","hideAddButton","multiple","info","onChange","onInputChange","placeholder"]);let S=(0,y1.useFormContext)();if(!S)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let z=E(S.formState.errors,c);console.warn=()=>{};let F=e=>{t?t(e):console.error("onCreateOption n\xE3o foi definido")},f=e=>{v?v(e):console.error("onEditOption n\xE3o foi definido")};return(0,M.jsx)(y1.Controller,{control:S.control,name:c,rules:l,defaultValue:i,shouldUnregister:r,render:({field:{value:e,onChange:T,ref:d1}})=>{let a1=(e==null?void 0:e.label)||(e==null?void 0:e.value)||e;return(0,M.jsxs)(R.Grid,{display:"flex",flexDirection:"column",children:[(0,M.jsxs)("div",{style:{display:"flex"},children:[o&&(0,M.jsx)(R.Grid,{item:!0,children:(0,M.jsx)(P,{label:o,required:V})}),C&&(0,M.jsx)(R.Grid,{item:!0,children:(0,M.jsx)(O.Tooltip,{title:C,placement:"top",children:(0,M.jsx)("div",{style:{width:"fit-content"},children:(0,M.jsx)(O.LIcon,{icon:N,color:"#757575"})})})})]}),(0,M.jsx)(a0,{hideAddButton:p,children:(0,M.jsx)(R.Autocomplete,h(a({fullWidth:!0,onChange:(B,A)=>{T(A),k==null||k(A,S.watch())},onInputChange:(B,A,G0)=>{G0==="input"&&(T(A),setTimeout(()=>{x==null||x(A,S.watch())},0))},options:m,value:e||(u?[]:null),multiple:u,noOptionsText:(0,M.jsxs)(O.Button,{sx:{justifyContent:"flex-start",padding:`${(0,I1.toRem)(6)} ${(0,I1.toRem)(-16)}`,margin:0},fullWidth:!0,onClick:()=>F(e),variant:"text",startIcon:(0,M.jsx)(O.LIcon,{icon:E1}),children:["Adicionar ",a1&&`"${a1}"`]}),isOptionEqualToValue:(B,A)=>A?typeof B=="string"&&typeof A=="string"?B===A:typeof B=="object"&&typeof A=="object"?B.value===A.value:typeof B=="object"&&typeof A=="string":!1,renderOption:(B,A)=>typeof A=="object"?(0,R1.createElement)("li",h(a({},B),{key:A.key||A.value}),(0,M.jsxs)(R.Grid,{container:!0,direction:"column",children:[(0,M.jsx)(R.Grid,{item:!0,children:A.label}),A.afterLabel&&(0,M.jsx)(R.Grid,{item:!0,children:A.afterLabel})]})):(0,R1.createElement)("li",h(a({},B),{key:A}),A)},n),{renderInput:B=>(0,M.jsx)(R.TextField,a(h(a({placeholder:H},B),{error:!!z,onChange:T,InputProps:h(a({},B.InputProps),{inputRef:d1,endAdornment:p?void 0:(0,M.jsxs)("div",{className:"endAdornments",children:[B.InputProps.endAdornment,s&&(0,x1.isObject)(e)&&!(0,x1.isEmpty)(e)?(0,M.jsxs)("div",{className:"editable",children:[(0,M.jsx)("div",{className:"divider"}),(0,M.jsx)("div",{className:"button",onClick:()=>f(e),children:(0,M.jsx)(O.LIcon,{icon:W1,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:()=>F(e),children:(0,M.jsx)(O.LIcon,{icon:E1,size:"24px",removeMargin:!0})})]})]})})}),d))}),c)}),(0,M.jsx)(w,{name:c})]})}})},r0=(0,o0.memo)(Y0);var g1=require("react-hook-form"),l1=require("@mui/material");var W=require("react/jsx-runtime"),K0=v=>{var t=v,{name:c,rules:l,defaultValue:i,shouldUnregister:r,label:o,labelPlacement:V,required:m}=t,s=y(t,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let d=(0,g1.useFormContext)();if(!d)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,W.jsx)(g1.Controller,{control:d.control,name:c,rules:l,defaultValue:i,shouldUnregister:r,render:({field:{value:p,onChange:u}})=>(0,W.jsxs)(l1.Grid,{display:"flex",flexDirection:"column",children:[(0,W.jsx)(l1.FormControlLabel,{control:(0,W.jsx)(l1.Checkbox,a({checked:!!p,value:p!=null?p:"",defaultValue:p,onChange:u},s),c),label:(0,W.jsx)(P,{label:o,required:m,regular:!0}),labelPlacement:V||"end"}),(0,W.jsx)(w,{name:c})]})})},n0=K0;var F1=require("react-hook-form"),e1=require("@mui/material");var Y=require("react/jsx-runtime"),Q0=s=>{var v=s,{name:c,rules:l,defaultValue:i,shouldUnregister:r,label:o,labelPlacement:V}=v,m=y(v,["name","rules","defaultValue","shouldUnregister","label","labelPlacement"]);let t=(0,F1.useFormContext)();if(!t)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,Y.jsx)(F1.Controller,{control:t.control,name:c,rules:l,defaultValue:i,shouldUnregister:r,render:({field:{value:d,onChange:p}})=>(0,Y.jsxs)(e1.Grid,{display:"flex",flexDirection:"column",children:[(0,Y.jsx)(e1.FormControlLabel,{control:(0,Y.jsx)(e1.Switch,a({value:d!=null?d:"",checked:d!=null?d:!1,defaultValue:d,onChange:p},m),c),label:(0,Y.jsx)(P,{label:o}),labelPlacement:V||"end"}),(0,Y.jsx)(w,{name:c})]})})},t0=Q0;var i1=require("@mui/material");var s1=require("react/jsx-runtime"),J0=r=>{var o=r,{label:c,labelPlacement:l}=o,i=y(o,["label","labelPlacement"]);return(0,s1.jsx)(i1.Grid,{display:"flex",flexDirection:"column",children:(0,s1.jsx)(i1.FormControlLabel,{control:(0,s1.jsx)(i1.Radio,a({},i)),label:(0,s1.jsx)(P,{label:c}),labelPlacement:l||"end"})})},s0=J0;var L1=require("react-hook-form"),C1=require("@mui/material");var J=require("react/jsx-runtime"),X0=t=>{var d=t,{name:c,rules:l,defaultValue:i,shouldUnregister:r,label:o,required:V,children:m,orientation:s="row"}=d,v=y(d,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation"]);let p=(0,L1.useFormContext)();if(!p)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,J.jsx)(L1.Controller,{control:p.control,name:c,rules:l,defaultValue:i,shouldUnregister:r,render:({field:{value:u,onChange:C}})=>(0,J.jsxs)(C1.Grid,{display:"flex",flexDirection:"column",children:[o&&(0,J.jsx)(P,{label:o,required:V}),(0,J.jsx)(C1.RadioGroup,h(a({value:u||"",onChange:C,name:c},v),{style:{display:"flex",flexDirection:s},children:m}),c),(0,J.jsx)(w,{name:c})]})})},h0=X0;var b1=require("react-hook-form"),d0=require("@mui/material");var q1=require("react/jsx-runtime"),c2=V=>{var m=V,{name:c,rules:l,defaultValue:i,shouldUnregister:r}=m,o=y(m,["name","rules","defaultValue","shouldUnregister"]);let s=(0,b1.useFormContext)();if(!s)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,q1.jsx)(b1.Controller,{control:s.control,name:c,rules:l,defaultValue:i,shouldUnregister:r,render:({field:{value:v,onChange:t}})=>(0,q1.jsx)(d0.Slider,a({value:v||(o==null?void 0:o.min)||0,onChange:t,valueLabelDisplay:"auto"},o),c)})},m0=c2;var p0=require("react"),P1=require("react-hook-form"),u0=require("@s_mart/core"),f0=require("@mui/material"),M0=require("@mui/x-date-pickers/DatePicker"),H0=require("@mui/x-date-pickers/AdapterDayjs"),V0=require("@mui/x-date-pickers/LocalizationProvider");var q=require("@s_mart/utils"),v0=v1(require("@emotion/styled")),l2=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)}},e2=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)}`}},Z0=v0.default.div`
51
51
  > div > button {
52
- padding: ${({size:c})=>l2(c)};
52
+ padding: ${({size:c})=>e2(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})=>e2(c)};
58
+ width: ${({size:c})=>l2(c)};
59
59
  }
60
60
  }
61
- `;var N=require("react/jsx-runtime"),g0=require("react"),i2=d=>{var p=d,{rules:c,name:e,defaultValue:i,shouldUnregister:r,datePickerProps:o,label:V,required:m,placeholder:s,disabled:v}=p,t=y(p,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder","disabled"]);let u=(0,P1.useFormContext)();if(!u)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let C=E(u.formState.errors,e);return(0,N.jsx)(V0.LocalizationProvider,{dateAdapter:H0.AdapterDayjs,children:(0,N.jsx)(P1.Controller,{control:u.control,name:e,rules:c,defaultValue:i,shouldUnregister:r,render:({field:{value:k,onChange:g,ref:H}})=>(0,N.jsxs)(u0.Grid,{display:"flex",flexDirection:"column",children:[V&&(0,N.jsx)(P,{label:V,required:m}),(0,g0.createElement)(M0.DatePicker,h(a({},o),{key:e,value:k!=null?k:null,inputFormat:(o==null?void 0:o.inputFormat)||"DD/MM/YYYY",onChange:g,disabled:v,renderInput:n=>{var x,b;return(0,N.jsx)(f0.TextField,h(a(h(a({variant:"outlined"},n),{error:Boolean(C)}),t),{inputProps:h(a({},n.inputProps),{placeholder:s||((x=n.inputProps)==null?void 0:x.placeholder)}),InputProps:h(a({},n.InputProps),{inputRef(S){H(S),typeof n.inputRef=="function"&&n.inputRef(S)},endAdornment:(0,N.jsx)(Z0,{size:t.size,children:(b=n.InputProps)==null?void 0:b.endAdornment})})}))}})),(0,N.jsx)(w,{name:e})]})})})},y0=(0,p0.memo)(i2);var L0=require("react"),k1=require("react-hook-form"),C0=require("@s_mart/core"),b0=require("@mui/material"),P0=require("@mui/x-date-pickers/TimePicker"),k0=require("@mui/x-date-pickers/AdapterDayjs"),A0=require("@mui/x-date-pickers/LocalizationProvider");var $=require("@s_mart/utils"),x0=v1(require("@emotion/styled")),a2=c=>{switch(c){case"small":return(0,$.toRem)(16);default:case"medium":return(0,$.toRem)(20);case"large":return(0,$.toRem)(24)}},o2=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)}`}},F0=x0.default.div`
61
+ `;var K=require("react/jsx-runtime"),x0=require("react"),i2=d=>{var p=d,{rules:c,name:l,defaultValue:i,shouldUnregister:r,datePickerProps:o,label:V,required:m,placeholder:s,disabled:v}=p,t=y(p,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder","disabled"]);let u=(0,P1.useFormContext)();if(!u)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let C=E(u.formState.errors,l);return(0,K.jsx)(V0.LocalizationProvider,{dateAdapter:H0.AdapterDayjs,children:(0,K.jsx)(P1.Controller,{control:u.control,name:l,rules:c,defaultValue:i,shouldUnregister:r,render:({field:{value:k,onChange:x,ref:H}})=>(0,K.jsxs)(u0.Grid,{display:"flex",flexDirection:"column",children:[V&&(0,K.jsx)(P,{label:V,required:m}),(0,x0.createElement)(M0.DatePicker,h(a({},o),{key:l,value:k!=null?k:null,format:(o==null?void 0:o.format)||"DD/MM/YYYY",onChange:x,disabled:v,slots:{textField:f0.TextField},slotProps:{textField:n=>{var g,b;return h(a(h(a({variant:"outlined"},n),{error:!!C}),t),{inputProps:h(a({},n.inputProps),{placeholder:s||((g=n.inputProps)==null?void 0:g.placeholder)}),InputProps:h(a({},n.InputProps),{inputRef(S){H(S),typeof n.inputRef=="function"&&n.inputRef(S)},endAdornment:(0,K.jsx)(Z0,{size:t.size,children:(b=n.InputProps)==null?void 0:b.endAdornment})})})}}})),(0,K.jsx)(w,{name:l})]})})})},y0=(0,p0.memo)(i2);var L0=require("react"),k1=require("react-hook-form"),C0=require("@s_mart/core"),b0=require("@mui/material"),P0=require("@mui/x-date-pickers/TimePicker"),k0=require("@mui/x-date-pickers/AdapterDayjs"),A0=require("@mui/x-date-pickers/LocalizationProvider");var $=require("@s_mart/utils"),g0=v1(require("@emotion/styled")),a2=c=>{switch(c){case"small":return(0,$.toRem)(16);default:case"medium":return(0,$.toRem)(20);case"large":return(0,$.toRem)(24)}},o2=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)}`}},F0=g0.default.div`
62
62
  > div > button {
63
63
  padding: ${({size:c})=>o2(c)};
64
64
  border-radius: 0 ${(0,$.toRem)(4)} ${(0,$.toRem)(4)} 0;
@@ -69,4 +69,4 @@
69
69
  width: ${({size:c})=>a2(c)};
70
70
  }
71
71
  }
72
- `;var z=require("react/jsx-runtime"),r2=d=>{var p=d,{rules:c,defaultValue:e,shouldUnregister:i,name:r,required:o,label:V,timePickerProps:m,placeholder:s,disabled:v}=p,t=y(p,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder","disabled"]);let u=(0,k1.useFormContext)();if(!u)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let C=E(u.formState.errors,r);return(0,z.jsx)(A0.LocalizationProvider,{dateAdapter:k0.AdapterDayjs,children:(0,z.jsx)(k1.Controller,{control:u.control,name:r,rules:c,defaultValue:e,shouldUnregister:i,render:({field:{value:k,onChange:g,ref:H}})=>(0,z.jsxs)(C0.Grid,{display:"flex",flexDirection:"column",children:[V&&(0,z.jsx)(P,{label:V,required:o}),(0,z.jsx)(P0.TimePicker,h(a({value:k!=null?k:null,onChange:g,disabled:v},m),{renderInput:n=>{var x,b;return(0,z.jsx)(b0.TextField,h(a(h(a({variant:"outlined"},n),{error:Boolean(C)}),t),{inputProps:h(a({},n.inputProps),{placeholder:s||((x=n.inputProps)==null?void 0:x.placeholder)}),InputProps:h(a({},n.InputProps),{inputRef(S){H(S),typeof n.inputRef=="function"&&n.inputRef(S)},endAdornment:(0,z.jsx)(F0,{size:t.size,children:(b=n.InputProps)==null?void 0:b.endAdornment})})}))}}),r),(0,z.jsx)(w,{name:r})]})})})},w0=(0,L0.memo)(r2);var S0=require("react"),A1=require("react-hook-form"),w1=require("@mui/material"),h1=require("@s_mart/core");var U=require("react/jsx-runtime"),E0=require("react"),n2=p=>{var u=p,{name:c,defaultValue:e,rules:i,shouldUnregister:r,label:o,required:V,noOptionsText:m,placeholder:s,onInputChange:v,onChange:t}=u,d=y(u,["name","defaultValue","rules","shouldUnregister","label","required","noOptionsText","placeholder","onInputChange","onChange"]);let C=(0,A1.useFormContext)();if(!C)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let k=E(C.formState.errors,c);return console.warn=()=>{},(0,U.jsx)(A1.Controller,{name:c,control:C.control,defaultValue:e,rules:i,shouldUnregister:r,render:({field:g})=>(0,U.jsxs)(h1.Grid,{display:"flex",flexDirection:"column",children:[o&&(0,U.jsx)(P,{label:o,required:V}),(0,U.jsx)(w1.Autocomplete,h(a({onChange:(H,n)=>{g.onChange(n),t==null||t(n,C.watch())},onInputChange:(H,n,x)=>{x==="input"&&(g.onChange(n),setTimeout(()=>{v==null||v(n,C.watch())},0))},isOptionEqualToValue:(H,n)=>H.value===n.value,renderOption:(H,n)=>(0,E0.createElement)("li",h(a({},H),{key:n.key||n.value,onClick:x=>{var b;(b=H.onClick)==null||b.call(H,x),g.onChange(n)}}),(0,U.jsxs)(h1.Grid,{container:!0,direction:"column",children:[(0,U.jsx)(h1.Grid,{item:!0,children:n.label}),n.afterLabel&&(0,U.jsx)(h1.Grid,{item:!0,children:n.afterLabel})]})),value:g.value||null,noOptionsText:m||"Nenhuma op\xE7\xE3o encontrada"},d),{renderInput:H=>{var n,x,b;return(0,U.jsx)(w1.TextField,h(a(a({placeholder:s},H),d.textFieldProps),{error:Boolean(k),InputProps:h(a(a({},H.InputProps),(n=d.textFieldProps)==null?void 0:n.InputProps),{inputRef:g.ref,inputProps:a(a({},H.inputProps),(b=(x=d.textFieldProps)==null?void 0:x.InputProps)==null?void 0:b.inputProps)})}))}}),c),(0,U.jsx)(w,{name:c})]})})},T0=(0,S0.memo)(n2);0&&(module.exports={Autocomplete,Checkbox,Creatable,DatePicker,Form,RadioButton,RadioGroup,Searchable,Select,Slider,Switch,TextField,TimePicker});
72
+ `;var _=require("react/jsx-runtime"),r2=d=>{var p=d,{rules:c,defaultValue:l,shouldUnregister:i,name:r,required:o,label:V,timePickerProps:m,placeholder:s,disabled:v}=p,t=y(p,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder","disabled"]);let u=(0,k1.useFormContext)();if(!u)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let C=E(u.formState.errors,r);return(0,_.jsx)(A0.LocalizationProvider,{dateAdapter:k0.AdapterDayjs,children:(0,_.jsx)(k1.Controller,{control:u.control,name:r,rules:c,defaultValue:l,shouldUnregister:i,render:({field:{value:k,onChange:x,ref:H}})=>(0,_.jsxs)(C0.Grid,{display:"flex",flexDirection:"column",children:[V&&(0,_.jsx)(P,{label:V,required:o}),(0,_.jsx)(P0.TimePicker,h(a({value:k!=null?k:null,onChange:x,disabled:v},m),{slots:{textField:b0.TextField},slotProps:{textField:n=>{var g,b;return h(a(h(a({variant:"outlined"},n),{error:!!C}),t),{inputProps:h(a({},n.inputProps),{placeholder:s||((g=n.inputProps)==null?void 0:g.placeholder)}),InputProps:h(a({},n.InputProps),{inputRef(S){H(S),typeof n.inputRef=="function"&&n.inputRef(S)},endAdornment:(0,_.jsx)(F0,{size:t.size,children:(b=n.InputProps)==null?void 0:b.endAdornment})})})}}}),r),(0,_.jsx)(w,{name:r})]})})})},w0=(0,L0.memo)(r2);var S0=require("react"),A1=require("react-hook-form"),w1=require("@mui/material"),h1=require("@s_mart/core");var U=require("react/jsx-runtime"),E0=require("react"),n2=p=>{var u=p,{name:c,defaultValue:l,rules:i,shouldUnregister:r,label:o,required:V,noOptionsText:m,placeholder:s,onInputChange:v,onChange:t}=u,d=y(u,["name","defaultValue","rules","shouldUnregister","label","required","noOptionsText","placeholder","onInputChange","onChange"]);let C=(0,A1.useFormContext)();if(!C)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let k=E(C.formState.errors,c);return console.warn=()=>{},(0,U.jsx)(A1.Controller,{name:c,control:C.control,defaultValue:l,rules:i,shouldUnregister:r,render:({field:x})=>(0,U.jsxs)(h1.Grid,{display:"flex",flexDirection:"column",children:[o&&(0,U.jsx)(P,{label:o,required:V}),(0,U.jsx)(w1.Autocomplete,h(a({onChange:(H,n)=>{x.onChange(n),t==null||t(n,C.watch())},onInputChange:(H,n,g)=>{g==="input"&&(x.onChange(n),setTimeout(()=>{v==null||v(n,C.watch())},0))},isOptionEqualToValue:(H,n)=>H.value===n.value,renderOption:(H,n)=>(0,E0.createElement)("li",h(a({},H),{key:n.key||n.value,onClick:g=>{var b;(b=H.onClick)==null||b.call(H,g),x.onChange(n)}}),(0,U.jsxs)(h1.Grid,{container:!0,direction:"column",children:[(0,U.jsx)(h1.Grid,{item:!0,children:n.label}),n.afterLabel&&(0,U.jsx)(h1.Grid,{item:!0,children:n.afterLabel})]})),value:x.value||null,noOptionsText:m||"Nenhuma op\xE7\xE3o encontrada"},d),{renderInput:H=>{var n,g,b;return(0,U.jsx)(w1.TextField,h(a(a({placeholder:s},H),d.textFieldProps),{error:!!k,InputProps:h(a(a({},H.InputProps),(n=d.textFieldProps)==null?void 0:n.InputProps),{inputRef:x.ref,inputProps:a(a({},H.inputProps),(b=(g=d.textFieldProps)==null?void 0:g.InputProps)==null?void 0:b.inputProps)})}))}}),c),(0,U.jsx)(w,{name:c})]})})},T0=(0,S0.memo)(n2);0&&(module.exports={Autocomplete,Checkbox,Creatable,DatePicker,Form,RadioButton,RadioGroup,Searchable,Select,Slider,Switch,TextField,TimePicker});
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var E1=Object.defineProperty,G1=Object.defineProperties;var D1=Object.getOwnPropertyDescriptors;var c1=Object.getOwnPropertySymbols;var d1=Object.prototype.hasOwnProperty,m1=Object.prototype.propertyIsEnumerable;var h1=(c,l,a)=>l in c?E1(c,l,{enumerable:!0,configurable:!0,writable:!0,value:a}):c[l]=a,i=(c,l)=>{for(var a in l||(l={}))d1.call(l,a)&&h1(c,a,l[a]);if(c1)for(var a of c1(l))m1.call(l,a)&&h1(c,a,l[a]);return c},h=(c,l)=>G1(c,D1(l));var H=(c,l)=>{var a={};for(var o in c)d1.call(c,o)&&l.indexOf(o)<0&&(a[o]=c[o]);if(c!=null&&c1)for(var o of c1(c))l.indexOf(o)<0&&m1.call(c,o)&&(a[o]=c[o]);return a};import{useEffect as B1}from"react";import{FormProvider as I1,useForm as R1}from"react-hook-form";import{jsx as v1}from"react/jsx-runtime";function q1(M){var m=M,{children:c,onSubmit:l,style:a,disableDefaultValuesUpdate:o}=m,r=H(m,["children","onSubmit","style","disableDefaultValuesUpdate"]);let s=R1(r);B1(()=>{o||s.reset(r.defaultValues)},[r.defaultValues,s.reset]);let v=()=>typeof c=="function"?c(h(i({},s),{onSubmit:s.handleSubmit(t=>l(t,s))})):c;return v1(I1,h(i({},s),{children:v1("form",{onSubmit:t=>{t.preventDefault(),t.stopPropagation(),s.handleSubmit(d=>l(d,s))()},style:a,children:v()})}))}var $1=q1;import{memo as j1,useState as W1}from"react";import{Controller as Y1,useFormContext as K1}from"react-hook-form";import{Grid as s1,InputAdornment as Q1,TextField as J1}from"@mui/material";var Z1={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"},p1={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 q={description:"M24 8a16 16 0 0 0 0 32 16 16 0 0 0 0-32Zm0 7.1c1.5 0 2.7 1.2 2.7 2.7 0 1.6-1.2 2.7-2.7 2.7a2.6 2.6 0 0 1-2.7-2.7c0-1.5 1.2-2.7 2.7-2.7Zm3.6 16.4c0 .4-.4.8-.8.8h-5.6a.7.7 0 0 1-.8-.8v-1.6c0-.4.3-.7.8-.7h.7V25h-.7a.7.7 0 0 1-.8-.7v-1.6c0-.4.3-.8.8-.8h4c.5 0 .9.4.9.8v6.5h.7c.4 0 .8.3.8.7v1.6Z",id:"line-info-circle-solid"};var u1={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 t1={description:"M35.8 21.8h-9.6v-9.6c0-.6-.6-1.1-1.1-1.1h-2.2a1 1 0 0 0-1 1v9.7h-9.7c-.6 0-1.1.6-1.1 1.1v2.2c0 .6.5 1 1 1h9.7v9.7c0 .6.5 1.1 1.1 1.1h2.2c.5 0 1-.5 1-1v-9.7h9.7c.6 0 1.1-.5 1.1-1.1v-2.2c0-.5-.5-1-1-1Z",id:"line-plus-solid"};import*as j from"@s_mart/masks";import{Typography as f1}from"@mui/material";import{toRem as U1}from"@s_mart/utils";import{jsx as M1,jsxs as z1}from"react/jsx-runtime";var L=({label:c,required:l,regular:a})=>z1("span",{style:{display:"flex",alignItems:"center",gap:U1(2)},children:[M1(f1,{variant:"caption",fontWeight:a?400:700,style:{display:"flex",alignItems:"center"},children:c}),l&&M1(f1,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});import{useFormContext as O1}from"react-hook-form";import{Indicator as _1}from"@s_mart/core";var E=(c,l)=>{var a,o,r,M,m;if(c[l])return c[l];if(l.includes("[")){let[s,v]=l.split("["),[t,d]=v.split("].");return(o=(a=c[s])==null?void 0:a[t])==null?void 0:o[d]}if(l.includes(".")){let[s,v,t]=l.split(".");return t?(m=(M=c[s])==null?void 0:M[v])==null?void 0:m[t]:(r=c[s])==null?void 0:r[v]}};import{jsx as N1}from"react/jsx-runtime";var P=({name:c})=>{var o;let l=O1(),a=E((o=l==null?void 0:l.formState)==null?void 0:o.errors,c);return a?N1(_1,{severity:"error",children:a==null?void 0:a.message}):null};import{LIcon as H1,Tooltip as X1}from"@s_mart/core";import{jsx as D,jsxs as V1}from"react/jsx-runtime";var c0=x=>{var C=x,{name:c,rules:l,defaultValue:a,shouldUnregister:o,label:r,required:M,mask:m,variant:s="outlined",info:v,parse:t,format:d,onInputChange:Z}=C,p=H(C,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","info","parse","format","onInputChange"]);let V=K1();if(!V)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[f,n]=W1(!1),y=g=>{var e;let u=g;return d&&(u=d(g)),m?(e=j==null?void 0:j[m])==null?void 0:e.format(u):u},F=g=>{var e;let u=g;return t&&(u=t(g)),m?(e=j==null?void 0:j[m])==null?void 0:e.parse(u):u},w=g=>{if(!g||m!=="porcentagem")return;g==null||g.stopPropagation();let u=(g==null?void 0:g.target).value;if(u){let e=String(u);if(e.length>0){let T=e.indexOf("%");T>-1&&(g.currentTarget.selectionEnd=T)}}},R=E(V.formState.errors,c);return D(Y1,{control:V.control,name:c,rules:l,defaultValue:a,shouldUnregister:o,render:({field:{value:g,onChange:u,ref:e}})=>V1(s1,{display:"flex",flexDirection:"column",children:[V1("div",{style:{display:"flex"},children:[r&&D(s1,{item:!0,children:D(L,{label:r,required:M})}),v&&D(s1,{item:!0,children:D(X1,{title:v,placement:"top",children:D("div",{style:{width:"fit-content"},children:D(H1,{icon:q,color:"#757575"})})})})]}),D(J1,h(i({variant:s,defaultValue:a,value:y(g||""),onChange:T=>{var K;let X=F((K=T==null?void 0:T.target)==null?void 0:K.value);u(X),Z==null||Z(X,V.watch())},error:Boolean(R)},p),{type:p.type==="password"?f?"text":"password":p.type,autoComplete:p.autoComplete||"off",InputProps:i({onKeyDown:w,inputRef:e,endAdornment:p.type==="password"&&D(Q1,{position:"end",onClick:()=>n(!f),style:{cursor:"pointer"},children:D(H1,{icon:f?Z1:p1,size:"24px",removeMargin:!0})})},p.InputProps)}),c),D(P,{name:c})]})})},e0=j1(c0);import{memo as l0,useState as i0}from"react";import{Controller as a0,useFormContext as o0}from"react-hook-form";import{Divider as r0,LIcon as n0,Tooltip as t0}from"@s_mart/core";import{Grid as U,Select as s0,MenuItem as y1,useTheme as h0}from"@mui/material";import{jsx as S,jsxs as e1}from"react/jsx-runtime";var d0=C=>{var V=C,{name:c,rules:l,defaultValue:a,shouldUnregister:o,label:r,required:M,options:m,placeholder:s,disableOnChangeForm:v=!1,multiple:t,info:d,footer:Z,onChange:p}=V,x=H(V,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","disableOnChangeForm","multiple","info","footer","onChange"]);let f=o0(),{palette:n}=h0(),[y,F]=i0(!1);if(!f)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let w=E(f.formState.errors,c);return console.warn=()=>{},S(a0,{control:f.control,name:c,rules:l,defaultValue:a||"",shouldUnregister:o,render:({field:{value:R,onChange:g,ref:u}})=>e1(U,{display:"flex",flexDirection:"column",children:[e1("div",{style:{display:"flex"},children:[r&&S(U,{item:!0,children:S(L,{label:r,required:M})}),d&&S(U,{item:!0,children:S(t0,{title:d,placement:"top",children:S("div",{style:{width:"fit-content"},children:S(n0,{icon:q,color:"#757575"})})})})]}),e1(s0,h(i({open:y,onOpen:()=>F(!0),onClose:()=>F(!1),displayEmpty:Boolean(s),variant:"outlined",autoComplete:"off",value:R?R||"":t?[]:"",renderValue:e=>{if(e.label)return e.label;if(s)return S("p",{style:{color:n.grey[400]},children:s})},multiple:t,onChange:e=>{!v&&g(e.target.value),p&&p(e.target.value,f.watch())},error:Boolean(w),size:x.size||"medium",inputRef:u},x),{children:[s&&S(y1,{disabled:!0,value:"",children:S("p",{style:{color:n.grey[400]},children:s})}),m==null?void 0:m.map((e,T)=>S(y1,{value:e,children:e1(U,{container:!0,direction:"column",children:[S(U,{item:!0,children:e.label}),e.afterLabel&&S(U,{item:!0,children:e.afterLabel})]})},T)),Z&&[S(U,{px:2,py:1,children:S(r0,{})},"footer-divider"),S("div",{children:Z({closeSelect:()=>F(!1)})},"footer-content")]]}),c),S(P,{name:c})]})})},m0=l0(d0);import{forwardRef as v0,memo as Z0}from"react";import{Controller as p0,useFormContext as u0}from"react-hook-form";import{Divider as g1,LIcon as f0,Tooltip as M0}from"@s_mart/core";import{Grid as $,Autocomplete as H0,TextField as V0}from"@mui/material";import{Fragment as l1,jsx as A,jsxs as z}from"react/jsx-runtime";import{createElement as x1}from"react";var y0=f=>{var n=f,{name:c,rules:l,defaultValue:a,shouldUnregister:o,label:r,required:M,options:m,textFieldProps:s,noOptionsText:v,footer:t,multiple:d,info:Z,placeholder:p,onChange:x,onInputChange:C}=n,V=H(n,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText","footer","multiple","info","placeholder","onChange","onInputChange"]);let y=u0();if(!y)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let F=E(y.formState.errors,c);return console.warn=()=>{},A(p0,{control:y.control,name:c,rules:l,defaultValue:a,shouldUnregister:o,render:({field:{onChange:w,value:R,ref:g}})=>z($,{display:"flex",flexDirection:"column",children:[z("div",{style:{display:"flex"},children:[r&&A($,{item:!0,children:A(L,{label:r,required:M})}),Z&&A($,{item:!0,children:A(M0,{title:Z,placement:"top",children:A("div",{style:{width:"fit-content"},children:A(f0,{icon:q,color:"#757575"})})})})]}),A(H0,h(i({onChange:(u,e)=>{w(e),x==null||x(e,y.watch())},onInputChange:(u,e,T)=>{T==="input"&&setTimeout(()=>{C==null||C(e,y.watch())},0)},value:R||(d?[]:null),options:m,multiple:d,noOptionsText:z(l1,{children:[v||"Nenhum resultado encontrado",t?z(l1,{children:[A($,{py:1,children:A(g1,{})}),t]}):null]}),isOptionEqualToValue:(u,e)=>typeof u=="string"&&typeof e=="string"?u===e:typeof u=="object"&&typeof e=="object"?u.value===e.value:!1,renderOption:(u,e)=>typeof e=="object"?x1("li",h(i({},u),{key:e.key||e.value}),z($,{container:!0,direction:"column",children:[A($,{item:!0,children:e.label}),e.afterLabel&&A($,{item:!0,children:e.afterLabel})]})):x1("li",h(i({},u),{key:e}),e),ListboxComponent:v0(function(e,T){return z(l1,{children:[A("ul",h(i({},e),{ref:T})),!!t&&A("div",h(i({},e),{children:z(l1,{children:[A($,{px:2,py:1,children:A(g1,{})}),t]})}),"searchable-footer")]})})},V),{renderInput:u=>A(V0,h(i(i({error:Boolean(F),placeholder:p},u),s),{inputRef:g}))}),c),A(P,{name:c})]})})},g0=Z0(y0);import{memo as L0}from"react";import{Controller as C0,useFormContext as b0}from"react-hook-form";import{Grid as W,Autocomplete as P0,TextField as k0}from"@mui/material";import{toRem as i1}from"@s_mart/utils";import x0 from"@emotion/styled";import{css as F1}from"@emotion/react";var L1=F1`
1
+ var E1=Object.defineProperty,G1=Object.defineProperties;var D1=Object.getOwnPropertyDescriptors;var c1=Object.getOwnPropertySymbols;var d1=Object.prototype.hasOwnProperty,m1=Object.prototype.propertyIsEnumerable;var h1=(c,e,a)=>e in c?E1(c,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):c[e]=a,i=(c,e)=>{for(var a in e||(e={}))d1.call(e,a)&&h1(c,a,e[a]);if(c1)for(var a of c1(e))m1.call(e,a)&&h1(c,a,e[a]);return c},h=(c,e)=>G1(c,D1(e));var H=(c,e)=>{var a={};for(var o in c)d1.call(c,o)&&e.indexOf(o)<0&&(a[o]=c[o]);if(c!=null&&c1)for(var o of c1(c))e.indexOf(o)<0&&m1.call(c,o)&&(a[o]=c[o]);return a};import{useEffect as B1}from"react";import{FormProvider as I1,useForm as R1}from"react-hook-form";import{jsx as v1}from"react/jsx-runtime";function q1(M){var m=M,{children:c,onSubmit:e,style:a,disableDefaultValuesUpdate:o}=m,r=H(m,["children","onSubmit","style","disableDefaultValuesUpdate"]);let s=R1(r);B1(()=>{o||s.reset(r.defaultValues)},[r.defaultValues,s.reset]);let v=()=>typeof c=="function"?c(h(i({},s),{onSubmit:s.handleSubmit(t=>e(t,s))})):c;return v1(I1,h(i({},s),{children:v1("form",{onSubmit:t=>{t.preventDefault(),t.stopPropagation(),s.handleSubmit(d=>e(d,s))()},style:a,children:v()})}))}var $1=q1;import{memo as j1,useState as W1}from"react";import{Controller as Y1,useFormContext as K1}from"react-hook-form";import{Grid as s1,InputAdornment as Q1,TextField as J1}from"@mui/material";var Z1={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"},p1={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 q={description:"M24 8a16 16 0 0 0 0 32 16 16 0 0 0 0-32Zm0 7.1c1.5 0 2.7 1.2 2.7 2.7 0 1.6-1.2 2.7-2.7 2.7a2.6 2.6 0 0 1-2.7-2.7c0-1.5 1.2-2.7 2.7-2.7Zm3.6 16.4c0 .4-.4.8-.8.8h-5.6a.7.7 0 0 1-.8-.8v-1.6c0-.4.3-.7.8-.7h.7V25h-.7a.7.7 0 0 1-.8-.7v-1.6c0-.4.3-.8.8-.8h4c.5 0 .9.4.9.8v6.5h.7c.4 0 .8.3.8.7v1.6Z",id:"line-info-circle-solid"};var u1={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 t1={description:"M35.8 21.8h-9.6v-9.6c0-.6-.6-1.1-1.1-1.1h-2.2a1 1 0 0 0-1 1v9.7h-9.7c-.6 0-1.1.6-1.1 1.1v2.2c0 .6.5 1 1 1h9.7v9.7c0 .6.5 1.1 1.1 1.1h2.2c.5 0 1-.5 1-1v-9.7h9.7c.6 0 1.1-.5 1.1-1.1v-2.2c0-.5-.5-1-1-1Z",id:"line-plus-solid"};import*as N from"@s_mart/masks";import{Typography as f1}from"@mui/material";import{toRem as U1}from"@s_mart/utils";import{jsx as M1,jsxs as z1}from"react/jsx-runtime";var L=({label:c,required:e,regular:a})=>z1("span",{style:{display:"flex",alignItems:"center",gap:U1(2)},children:[M1(f1,{variant:"caption",fontWeight:a?400:700,style:{display:"flex",alignItems:"center"},children:c}),e&&M1(f1,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});import{useFormContext as O1}from"react-hook-form";import{Indicator as _1}from"@s_mart/core";var E=(c,e)=>{var a,o,r,M,m;if(c[e])return c[e];if(e.includes("[")){let[s,v]=e.split("["),[t,d]=v.split("].");return(o=(a=c[s])==null?void 0:a[t])==null?void 0:o[d]}if(e.includes(".")){let[s,v,t]=e.split(".");return t?(m=(M=c[s])==null?void 0:M[v])==null?void 0:m[t]:(r=c[s])==null?void 0:r[v]}};import{jsx as N1}from"react/jsx-runtime";var P=({name:c})=>{var o;let e=O1(),a=E((o=e==null?void 0:e.formState)==null?void 0:o.errors,c);return a?N1(_1,{severity:"error",children:a==null?void 0:a.message}):null};import{LIcon as H1,Tooltip as X1}from"@s_mart/core";import{jsx as D,jsxs as V1}from"react/jsx-runtime";var c0=g=>{var C=g,{name:c,rules:e,defaultValue:a,shouldUnregister:o,label:r,required:M,mask:m,variant:s="outlined",info:v,parse:t,format:d,onInputChange:Z}=C,p=H(C,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","info","parse","format","onInputChange"]);let V=K1();if(!V)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[f,n]=W1(!1),y=x=>{var l;let u=x;return d&&(u=d(x)),m?(l=N==null?void 0:N[m])==null?void 0:l.format(u):u},F=x=>{var l;let u=x;return t&&(u=t(x)),m?(l=N==null?void 0:N[m])==null?void 0:l.parse(u):u},w=x=>{if(!x||m!=="porcentagem")return;x==null||x.stopPropagation();let u=(x==null?void 0:x.target).value;if(u){let l=String(u);if(l.length>0){let T=l.indexOf("%");T>-1&&(x.currentTarget.selectionEnd=T)}}},R=E(V.formState.errors,c);return D(Y1,{control:V.control,name:c,rules:e,defaultValue:a,shouldUnregister:o,render:({field:{value:x,onChange:u,ref:l}})=>V1(s1,{display:"flex",flexDirection:"column",children:[V1("div",{style:{display:"flex"},children:[r&&D(s1,{item:!0,children:D(L,{label:r,required:M})}),v&&D(s1,{item:!0,children:D(X1,{title:v,placement:"top",children:D("div",{style:{width:"fit-content"},children:D(H1,{icon:q,color:"#757575"})})})})]}),D(J1,h(i({variant:s,defaultValue:a,value:y(x||""),onChange:T=>{var Y;let X=F((Y=T==null?void 0:T.target)==null?void 0:Y.value);u(X),Z==null||Z(X,V.watch())},error:!!R},p),{type:p.type==="password"?f?"text":"password":p.type,autoComplete:p.autoComplete||"off",InputProps:i({onKeyDown:w,inputRef:l,endAdornment:p.type==="password"&&D(Q1,{position:"end",onClick:()=>n(!f),style:{cursor:"pointer"},children:D(H1,{icon:f?Z1:p1,size:"24px",removeMargin:!0})})},p.InputProps)}),c),D(P,{name:c})]})})},l0=j1(c0);import{memo as e0,useState as i0}from"react";import{Controller as a0,useFormContext as o0}from"react-hook-form";import{Divider as r0,LIcon as n0,Tooltip as t0}from"@s_mart/core";import{Grid as U,Select as s0,MenuItem as y1,useTheme as h0}from"@mui/material";import{jsx as S,jsxs as l1}from"react/jsx-runtime";var d0=C=>{var V=C,{name:c,rules:e,defaultValue:a,shouldUnregister:o,label:r,required:M,options:m,placeholder:s,disableOnChangeForm:v=!1,multiple:t,info:d,footer:Z,onChange:p}=V,g=H(V,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","disableOnChangeForm","multiple","info","footer","onChange"]);let f=o0(),{palette:n}=h0(),[y,F]=i0(!1);if(!f)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let w=E(f.formState.errors,c);return console.warn=()=>{},S(a0,{control:f.control,name:c,rules:e,defaultValue:a||"",shouldUnregister:o,render:({field:{value:R,onChange:x,ref:u}})=>l1(U,{display:"flex",flexDirection:"column",children:[l1("div",{style:{display:"flex"},children:[r&&S(U,{item:!0,children:S(L,{label:r,required:M})}),d&&S(U,{item:!0,children:S(t0,{title:d,placement:"top",children:S("div",{style:{width:"fit-content"},children:S(n0,{icon:q,color:"#757575"})})})})]}),l1(s0,h(i({open:y,onOpen:()=>F(!0),onClose:()=>F(!1),displayEmpty:!!s,variant:"outlined",autoComplete:"off",value:R?R||"":t?[]:"",renderValue:l=>{if(l.label)return l.label;if(s)return S("p",{style:{color:n.grey[400]},children:s})},multiple:t,onChange:l=>{!v&&x(l.target.value),p&&p(l.target.value,f.watch())},error:!!w,size:g.size||"medium",inputRef:u},g),{children:[s&&S(y1,{disabled:!0,value:"",children:S("p",{style:{color:n.grey[400]},children:s})}),m==null?void 0:m.map((l,T)=>S(y1,{value:l,children:l1(U,{container:!0,direction:"column",children:[S(U,{item:!0,children:l.label}),l.afterLabel&&S(U,{item:!0,children:l.afterLabel})]})},T)),Z&&[S(U,{px:2,py:1,children:S(r0,{})},"footer-divider"),S("div",{children:Z({closeSelect:()=>F(!1)})},"footer-content")]]}),c),S(P,{name:c})]})})},m0=e0(d0);import{forwardRef as v0,memo as Z0}from"react";import{Controller as p0,useFormContext as u0}from"react-hook-form";import{Divider as x1,LIcon as f0,Tooltip as M0}from"@s_mart/core";import{Grid as $,Autocomplete as H0,TextField as V0}from"@mui/material";import{Fragment as e1,jsx as A,jsxs as z}from"react/jsx-runtime";import{createElement as g1}from"react";var y0=f=>{var n=f,{name:c,rules:e,defaultValue:a,shouldUnregister:o,label:r,required:M,options:m,textFieldProps:s,noOptionsText:v,footer:t,multiple:d,info:Z,placeholder:p,onChange:g,onInputChange:C}=n,V=H(n,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText","footer","multiple","info","placeholder","onChange","onInputChange"]);let y=u0();if(!y)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let F=E(y.formState.errors,c);return console.warn=()=>{},A(p0,{control:y.control,name:c,rules:e,defaultValue:a,shouldUnregister:o,render:({field:{onChange:w,value:R,ref:x}})=>z($,{display:"flex",flexDirection:"column",children:[z("div",{style:{display:"flex"},children:[r&&A($,{item:!0,children:A(L,{label:r,required:M})}),Z&&A($,{item:!0,children:A(M0,{title:Z,placement:"top",children:A("div",{style:{width:"fit-content"},children:A(f0,{icon:q,color:"#757575"})})})})]}),A(H0,h(i({onChange:(u,l)=>{w(l),g==null||g(l,y.watch())},onInputChange:(u,l,T)=>{T==="input"&&setTimeout(()=>{C==null||C(l,y.watch())},0)},value:R||(d?[]:null),options:m,multiple:d,noOptionsText:z(e1,{children:[v||"Nenhum resultado encontrado",t?z(e1,{children:[A($,{py:1,children:A(x1,{})}),t]}):null]}),isOptionEqualToValue:(u,l)=>typeof u=="string"&&typeof l=="string"?u===l:typeof u=="object"&&typeof l=="object"?u.value===l.value:!1,renderOption:(u,l)=>typeof l=="object"?g1("li",h(i({},u),{key:l.key||l.value}),z($,{container:!0,direction:"column",children:[A($,{item:!0,children:l.label}),l.afterLabel&&A($,{item:!0,children:l.afterLabel})]})):g1("li",h(i({},u),{key:l}),l),ListboxComponent:v0(function(l,T){return z(e1,{children:[A("ul",h(i({},l),{ref:T})),!!t&&A("div",h(i({},l),{children:z(e1,{children:[A($,{px:2,py:1,children:A(x1,{})}),t]})}),"searchable-footer")]})})},V),{renderInput:u=>A(V0,h(i(i({error:!!F,placeholder:p},u),s),{inputRef:x}))}),c),A(P,{name:c})]})})},x0=Z0(y0);import{memo as L0}from"react";import{Controller as C0,useFormContext as b0}from"react-hook-form";import{Grid as j,Autocomplete as P0,TextField as k0}from"@mui/material";import{toRem as i1}from"@s_mart/utils";import g0 from"@emotion/styled";import{css as F1}from"@emotion/react";var L1=F1`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
@@ -36,7 +36,7 @@ var E1=Object.defineProperty,G1=Object.defineProperties;var D1=Object.getOwnProp
36
36
  }
37
37
  }
38
38
  }
39
- `,C1=x0.div`
39
+ `,C1=g0.div`
40
40
  display: flex;
41
41
 
42
42
  div.endAdornments {
@@ -46,8 +46,8 @@ var E1=Object.defineProperty,G1=Object.defineProperties;var D1=Object.getOwnProp
46
46
  ${L1}
47
47
  }
48
48
 
49
- ${({hideAddButton:c,theme:l})=>!c&&F0(l)}
50
- `;import{LIcon as a1,Tooltip as A0,Button as w0}from"@s_mart/core";import{isObject as S0,isEmpty as T0}from"lodash";import{toRem as b1}from"@s_mart/utils";import{jsx as k,jsxs as O}from"react/jsx-runtime";import{createElement as P1}from"react";var E0=y=>{var F=y,{name:c,rules:l,defaultValue:a,shouldUnregister:o,label:r,required:M,options:m,editable:s,onEditOption:v,onCreateOption:t,textFieldProps:d,hideAddButton:Z,multiple:p,info:x,onChange:C,onInputChange:V,placeholder:f}=F,n=H(F,["name","rules","defaultValue","shouldUnregister","label","required","options","editable","onEditOption","onCreateOption","textFieldProps","hideAddButton","multiple","info","onChange","onInputChange","placeholder"]);let w=b0();if(!w)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let R=E(w.formState.errors,c);console.warn=()=>{};let g=e=>{t?t(e):console.error("onCreateOption n\xE3o foi definido")},u=e=>{v?v(e):console.error("onEditOption n\xE3o foi definido")};return k(C0,{control:w.control,name:c,rules:l,defaultValue:a,shouldUnregister:o,render:({field:{value:e,onChange:T,ref:X}})=>{let K=(e==null?void 0:e.label)||(e==null?void 0:e.value)||e;return O(W,{display:"flex",flexDirection:"column",children:[O("div",{style:{display:"flex"},children:[r&&k(W,{item:!0,children:k(L,{label:r,required:M})}),x&&k(W,{item:!0,children:k(A0,{title:x,placement:"top",children:k("div",{style:{width:"fit-content"},children:k(a1,{icon:q,color:"#757575"})})})})]}),k(C1,{hideAddButton:Z,children:k(P0,h(i({fullWidth:!0,onChange:(G,b)=>{T(b),C==null||C(b,w.watch())},onInputChange:(G,b,T1)=>{T1==="input"&&(T(b),setTimeout(()=>{V==null||V(b,w.watch())},0))},options:m,value:e||(p?[]:null),multiple:p,noOptionsText:O(w0,{sx:{justifyContent:"flex-start",padding:`${b1(6)} ${b1(-16)}`,margin:0},fullWidth:!0,onClick:()=>g(e),variant:"text",startIcon:k(a1,{icon:t1}),children:["Adicionar ",K&&`"${K}"`]}),isOptionEqualToValue:(G,b)=>b?typeof G=="string"&&typeof b=="string"?G===b:typeof G=="object"&&typeof b=="object"?G.value===b.value:typeof G=="object"&&typeof b=="string":!1,renderOption:(G,b)=>typeof b=="object"?P1("li",h(i({},G),{key:b.key||b.value}),O(W,{container:!0,direction:"column",children:[k(W,{item:!0,children:b.label}),b.afterLabel&&k(W,{item:!0,children:b.afterLabel})]})):P1("li",h(i({},G),{key:b}),b)},n),{renderInput:G=>k(k0,i(h(i({placeholder:f},G),{error:Boolean(R),onChange:T,InputProps:h(i({},G.InputProps),{inputRef:X,endAdornment:Z?void 0:O("div",{className:"endAdornments",children:[G.InputProps.endAdornment,s&&S0(e)&&!T0(e)?O("div",{className:"editable",children:[k("div",{className:"divider"}),k("div",{className:"button",onClick:()=>u(e),children:k(a1,{icon:u1,size:"24px",removeMargin:!0})})]}):null,O("div",{className:"creatable",children:[k("div",{className:"divider"}),k("div",{className:"button",onClick:()=>g(e),children:k(a1,{icon:t1,size:"24px",removeMargin:!0})})]})]})})}),d))}),c)}),k(P,{name:c})]})}})},G0=L0(E0);import{Controller as D0,useFormContext as B0}from"react-hook-form";import{Grid as I0,Checkbox as R0,FormControlLabel as q0}from"@mui/material";import{jsx as Q,jsxs as z0}from"react/jsx-runtime";var $0=v=>{var t=v,{name:c,rules:l,defaultValue:a,shouldUnregister:o,label:r,labelPlacement:M,required:m}=t,s=H(t,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let d=B0();if(!d)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return Q(D0,{control:d.control,name:c,rules:l,defaultValue:a,shouldUnregister:o,render:({field:{value:Z,onChange:p}})=>z0(I0,{display:"flex",flexDirection:"column",children:[Q(q0,{control:Q(R0,i({checked:Boolean(Z),value:Z!=null?Z:"",defaultValue:Z,onChange:p},s),c),label:Q(L,{label:r,required:m,regular:!0}),labelPlacement:M||"end"}),Q(P,{name:c})]})})},U0=$0;import{Controller as O0,useFormContext as _0}from"react-hook-form";import{Grid as N0,Switch as j0,FormControlLabel as W0}from"@mui/material";import{jsx as J,jsxs as Q0}from"react/jsx-runtime";var Y0=s=>{var v=s,{name:c,rules:l,defaultValue:a,shouldUnregister:o,label:r,labelPlacement:M}=v,m=H(v,["name","rules","defaultValue","shouldUnregister","label","labelPlacement"]);let t=_0();if(!t)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return J(O0,{control:t.control,name:c,rules:l,defaultValue:a,shouldUnregister:o,render:({field:{value:d,onChange:Z}})=>Q0(N0,{display:"flex",flexDirection:"column",children:[J(W0,{control:J(j0,i({value:d!=null?d:"",checked:d!=null?d:!1,defaultValue:d,onChange:Z},m),c),label:J(L,{label:r}),labelPlacement:M||"end"}),J(P,{name:c})]})})},K0=Y0;import{Grid as J0,Radio as X0,FormControlLabel as c2}from"@mui/material";import{jsx as o1}from"react/jsx-runtime";var e2=o=>{var r=o,{label:c,labelPlacement:l}=r,a=H(r,["label","labelPlacement"]);return o1(J0,{display:"flex",flexDirection:"column",children:o1(c2,{control:o1(X0,i({},a)),label:o1(L,{label:c}),labelPlacement:l||"end"})})},l2=e2;import{Controller as i2,useFormContext as a2}from"react-hook-form";import{Grid as o2,RadioGroup as r2}from"@mui/material";import{jsx as r1,jsxs as s2}from"react/jsx-runtime";var n2=t=>{var d=t,{name:c,rules:l,defaultValue:a,shouldUnregister:o,label:r,required:M,children:m,orientation:s="row"}=d,v=H(d,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation"]);let Z=a2();if(!Z)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return r1(i2,{control:Z.control,name:c,rules:l,defaultValue:a,shouldUnregister:o,render:({field:{value:p,onChange:x}})=>s2(o2,{display:"flex",flexDirection:"column",children:[r&&r1(L,{label:r,required:M}),r1(r2,h(i({value:p||"",onChange:x,name:c},v),{style:{display:"flex",flexDirection:s},children:m}),c),r1(P,{name:c})]})})},t2=n2;import{Controller as h2,useFormContext as d2}from"react-hook-form";import{Slider as m2}from"@mui/material";import{jsx as k1}from"react/jsx-runtime";var v2=M=>{var m=M,{name:c,rules:l,defaultValue:a,shouldUnregister:o}=m,r=H(m,["name","rules","defaultValue","shouldUnregister"]);let s=d2();if(!s)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return k1(h2,{control:s.control,name:c,rules:l,defaultValue:a,shouldUnregister:o,render:({field:{value:v,onChange:t}})=>k1(m2,i({value:v||(r==null?void 0:r.min)||0,onChange:t,valueLabelDisplay:"auto"},r),c)})},Z2=v2;import{memo as M2}from"react";import{Controller as H2,useFormContext as V2}from"react-hook-form";import{Grid as y2}from"@s_mart/core";import{TextField as g2}from"@mui/material";import{DatePicker as x2}from"@mui/x-date-pickers/DatePicker";import{AdapterDayjs as F2}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as L2}from"@mui/x-date-pickers/LocalizationProvider";import{toRem as B}from"@s_mart/utils";import p2 from"@emotion/styled";var u2=c=>{switch(c){case"small":return B(16);default:case"medium":return B(20);case"large":return B(24)}},f2=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`
49
+ ${({hideAddButton:c,theme:e})=>!c&&F0(e)}
50
+ `;import{LIcon as a1,Tooltip as A0,Button as w0}from"@s_mart/core";import{isObject as S0,isEmpty as T0}from"lodash";import{toRem as b1}from"@s_mart/utils";import{jsx as k,jsxs as O}from"react/jsx-runtime";import{createElement as P1}from"react";var E0=y=>{var F=y,{name:c,rules:e,defaultValue:a,shouldUnregister:o,label:r,required:M,options:m,editable:s,onEditOption:v,onCreateOption:t,textFieldProps:d,hideAddButton:Z,multiple:p,info:g,onChange:C,onInputChange:V,placeholder:f}=F,n=H(F,["name","rules","defaultValue","shouldUnregister","label","required","options","editable","onEditOption","onCreateOption","textFieldProps","hideAddButton","multiple","info","onChange","onInputChange","placeholder"]);let w=b0();if(!w)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let R=E(w.formState.errors,c);console.warn=()=>{};let x=l=>{t?t(l):console.error("onCreateOption n\xE3o foi definido")},u=l=>{v?v(l):console.error("onEditOption n\xE3o foi definido")};return k(C0,{control:w.control,name:c,rules:e,defaultValue:a,shouldUnregister:o,render:({field:{value:l,onChange:T,ref:X}})=>{let Y=(l==null?void 0:l.label)||(l==null?void 0:l.value)||l;return O(j,{display:"flex",flexDirection:"column",children:[O("div",{style:{display:"flex"},children:[r&&k(j,{item:!0,children:k(L,{label:r,required:M})}),g&&k(j,{item:!0,children:k(A0,{title:g,placement:"top",children:k("div",{style:{width:"fit-content"},children:k(a1,{icon:q,color:"#757575"})})})})]}),k(C1,{hideAddButton:Z,children:k(P0,h(i({fullWidth:!0,onChange:(G,b)=>{T(b),C==null||C(b,w.watch())},onInputChange:(G,b,T1)=>{T1==="input"&&(T(b),setTimeout(()=>{V==null||V(b,w.watch())},0))},options:m,value:l||(p?[]:null),multiple:p,noOptionsText:O(w0,{sx:{justifyContent:"flex-start",padding:`${b1(6)} ${b1(-16)}`,margin:0},fullWidth:!0,onClick:()=>x(l),variant:"text",startIcon:k(a1,{icon:t1}),children:["Adicionar ",Y&&`"${Y}"`]}),isOptionEqualToValue:(G,b)=>b?typeof G=="string"&&typeof b=="string"?G===b:typeof G=="object"&&typeof b=="object"?G.value===b.value:typeof G=="object"&&typeof b=="string":!1,renderOption:(G,b)=>typeof b=="object"?P1("li",h(i({},G),{key:b.key||b.value}),O(j,{container:!0,direction:"column",children:[k(j,{item:!0,children:b.label}),b.afterLabel&&k(j,{item:!0,children:b.afterLabel})]})):P1("li",h(i({},G),{key:b}),b)},n),{renderInput:G=>k(k0,i(h(i({placeholder:f},G),{error:!!R,onChange:T,InputProps:h(i({},G.InputProps),{inputRef:X,endAdornment:Z?void 0:O("div",{className:"endAdornments",children:[G.InputProps.endAdornment,s&&S0(l)&&!T0(l)?O("div",{className:"editable",children:[k("div",{className:"divider"}),k("div",{className:"button",onClick:()=>u(l),children:k(a1,{icon:u1,size:"24px",removeMargin:!0})})]}):null,O("div",{className:"creatable",children:[k("div",{className:"divider"}),k("div",{className:"button",onClick:()=>x(l),children:k(a1,{icon:t1,size:"24px",removeMargin:!0})})]})]})})}),d))}),c)}),k(P,{name:c})]})}})},G0=L0(E0);import{Controller as D0,useFormContext as B0}from"react-hook-form";import{Grid as I0,Checkbox as R0,FormControlLabel as q0}from"@mui/material";import{jsx as K,jsxs as z0}from"react/jsx-runtime";var $0=v=>{var t=v,{name:c,rules:e,defaultValue:a,shouldUnregister:o,label:r,labelPlacement:M,required:m}=t,s=H(t,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let d=B0();if(!d)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return K(D0,{control:d.control,name:c,rules:e,defaultValue:a,shouldUnregister:o,render:({field:{value:Z,onChange:p}})=>z0(I0,{display:"flex",flexDirection:"column",children:[K(q0,{control:K(R0,i({checked:!!Z,value:Z!=null?Z:"",defaultValue:Z,onChange:p},s),c),label:K(L,{label:r,required:m,regular:!0}),labelPlacement:M||"end"}),K(P,{name:c})]})})},U0=$0;import{Controller as O0,useFormContext as _0}from"react-hook-form";import{Grid as N0,Switch as j0,FormControlLabel as W0}from"@mui/material";import{jsx as Q,jsxs as Q0}from"react/jsx-runtime";var Y0=s=>{var v=s,{name:c,rules:e,defaultValue:a,shouldUnregister:o,label:r,labelPlacement:M}=v,m=H(v,["name","rules","defaultValue","shouldUnregister","label","labelPlacement"]);let t=_0();if(!t)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return Q(O0,{control:t.control,name:c,rules:e,defaultValue:a,shouldUnregister:o,render:({field:{value:d,onChange:Z}})=>Q0(N0,{display:"flex",flexDirection:"column",children:[Q(W0,{control:Q(j0,i({value:d!=null?d:"",checked:d!=null?d:!1,defaultValue:d,onChange:Z},m),c),label:Q(L,{label:r}),labelPlacement:M||"end"}),Q(P,{name:c})]})})},K0=Y0;import{Grid as J0,Radio as X0,FormControlLabel as c2}from"@mui/material";import{jsx as o1}from"react/jsx-runtime";var l2=o=>{var r=o,{label:c,labelPlacement:e}=r,a=H(r,["label","labelPlacement"]);return o1(J0,{display:"flex",flexDirection:"column",children:o1(c2,{control:o1(X0,i({},a)),label:o1(L,{label:c}),labelPlacement:e||"end"})})},e2=l2;import{Controller as i2,useFormContext as a2}from"react-hook-form";import{Grid as o2,RadioGroup as r2}from"@mui/material";import{jsx as r1,jsxs as s2}from"react/jsx-runtime";var n2=t=>{var d=t,{name:c,rules:e,defaultValue:a,shouldUnregister:o,label:r,required:M,children:m,orientation:s="row"}=d,v=H(d,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation"]);let Z=a2();if(!Z)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return r1(i2,{control:Z.control,name:c,rules:e,defaultValue:a,shouldUnregister:o,render:({field:{value:p,onChange:g}})=>s2(o2,{display:"flex",flexDirection:"column",children:[r&&r1(L,{label:r,required:M}),r1(r2,h(i({value:p||"",onChange:g,name:c},v),{style:{display:"flex",flexDirection:s},children:m}),c),r1(P,{name:c})]})})},t2=n2;import{Controller as h2,useFormContext as d2}from"react-hook-form";import{Slider as m2}from"@mui/material";import{jsx as k1}from"react/jsx-runtime";var v2=M=>{var m=M,{name:c,rules:e,defaultValue:a,shouldUnregister:o}=m,r=H(m,["name","rules","defaultValue","shouldUnregister"]);let s=d2();if(!s)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return k1(h2,{control:s.control,name:c,rules:e,defaultValue:a,shouldUnregister:o,render:({field:{value:v,onChange:t}})=>k1(m2,i({value:v||(r==null?void 0:r.min)||0,onChange:t,valueLabelDisplay:"auto"},r),c)})},Z2=v2;import{memo as M2}from"react";import{Controller as H2,useFormContext as V2}from"react-hook-form";import{Grid as y2}from"@s_mart/core";import{TextField as x2}from"@mui/material";import{DatePicker as g2}from"@mui/x-date-pickers/DatePicker";import{AdapterDayjs as F2}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as L2}from"@mui/x-date-pickers/LocalizationProvider";import{toRem as B}from"@s_mart/utils";import p2 from"@emotion/styled";var u2=c=>{switch(c){case"small":return B(16);default:case"medium":return B(20);case"large":return B(24)}},f2=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`
51
51
  > div > button {
52
52
  padding: ${({size:c})=>f2(c)};
53
53
  border-radius: 0 ${B(4)} ${B(4)} 0;
@@ -58,7 +58,7 @@ var E1=Object.defineProperty,G1=Object.defineProperties;var D1=Object.getOwnProp
58
58
  width: ${({size:c})=>u2(c)};
59
59
  }
60
60
  }
61
- `;import{jsx as Y,jsxs as k2}from"react/jsx-runtime";import{createElement as P2}from"react";var C2=d=>{var Z=d,{rules:c,name:l,defaultValue:a,shouldUnregister:o,datePickerProps:r,label:M,required:m,placeholder:s,disabled:v}=Z,t=H(Z,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder","disabled"]);let p=V2();if(!p)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=E(p.formState.errors,l);return Y(L2,{dateAdapter:F2,children:Y(H2,{control:p.control,name:l,rules:c,defaultValue:a,shouldUnregister:o,render:({field:{value:C,onChange:V,ref:f}})=>k2(y2,{display:"flex",flexDirection:"column",children:[M&&Y(L,{label:M,required:m}),P2(x2,h(i({},r),{key:l,value:C!=null?C:null,inputFormat:(r==null?void 0:r.inputFormat)||"DD/MM/YYYY",onChange:V,disabled:v,renderInput:n=>{var y,F;return Y(g2,h(i(h(i({variant:"outlined"},n),{error:Boolean(x)}),t),{inputProps:h(i({},n.inputProps),{placeholder:s||((y=n.inputProps)==null?void 0:y.placeholder)}),InputProps:h(i({},n.InputProps),{inputRef(w){f(w),typeof n.inputRef=="function"&&n.inputRef(w)},endAdornment:Y(A1,{size:t.size,children:(F=n.InputProps)==null?void 0:F.endAdornment})})}))}})),Y(P,{name:l})]})})})},b2=M2(C2);import{memo as T2}from"react";import{Controller as E2,useFormContext as G2}from"react-hook-form";import{Grid as D2}from"@s_mart/core";import{TextField as B2}from"@mui/material";import{TimePicker as I2}from"@mui/x-date-pickers/TimePicker";import{AdapterDayjs as R2}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as q2}from"@mui/x-date-pickers/LocalizationProvider";import{toRem as I}from"@s_mart/utils";import A2 from"@emotion/styled";var w2=c=>{switch(c){case"small":return I(16);default:case"medium":return I(20);case"large":return I(24)}},S2=c=>{switch(c){case"small":return`${I(2)} ${I(8)}`;default:case"medium":return`${I(6)} ${I(8)}`;case"large":return`${I(10)}`}},w1=A2.div`
61
+ `;import{jsx as J,jsxs as k2}from"react/jsx-runtime";import{createElement as P2}from"react";var C2=d=>{var Z=d,{rules:c,name:e,defaultValue:a,shouldUnregister:o,datePickerProps:r,label:M,required:m,placeholder:s,disabled:v}=Z,t=H(Z,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder","disabled"]);let p=V2();if(!p)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let g=E(p.formState.errors,e);return J(L2,{dateAdapter:F2,children:J(H2,{control:p.control,name:e,rules:c,defaultValue:a,shouldUnregister:o,render:({field:{value:C,onChange:V,ref:f}})=>k2(y2,{display:"flex",flexDirection:"column",children:[M&&J(L,{label:M,required:m}),P2(g2,h(i({},r),{key:e,value:C!=null?C:null,format:(r==null?void 0:r.format)||"DD/MM/YYYY",onChange:V,disabled:v,slots:{textField:x2},slotProps:{textField:n=>{var y,F;return h(i(h(i({variant:"outlined"},n),{error:!!g}),t),{inputProps:h(i({},n.inputProps),{placeholder:s||((y=n.inputProps)==null?void 0:y.placeholder)}),InputProps:h(i({},n.InputProps),{inputRef(w){f(w),typeof n.inputRef=="function"&&n.inputRef(w)},endAdornment:J(A1,{size:t.size,children:(F=n.InputProps)==null?void 0:F.endAdornment})})})}}})),J(P,{name:e})]})})})},b2=M2(C2);import{memo as T2}from"react";import{Controller as E2,useFormContext as G2}from"react-hook-form";import{Grid as D2}from"@s_mart/core";import{TextField as B2}from"@mui/material";import{TimePicker as I2}from"@mui/x-date-pickers/TimePicker";import{AdapterDayjs as R2}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as q2}from"@mui/x-date-pickers/LocalizationProvider";import{toRem as I}from"@s_mart/utils";import A2 from"@emotion/styled";var w2=c=>{switch(c){case"small":return I(16);default:case"medium":return I(20);case"large":return I(24)}},S2=c=>{switch(c){case"small":return`${I(2)} ${I(8)}`;default:case"medium":return`${I(6)} ${I(8)}`;case"large":return`${I(10)}`}},w1=A2.div`
62
62
  > div > button {
63
63
  padding: ${({size:c})=>S2(c)};
64
64
  border-radius: 0 ${I(4)} ${I(4)} 0;
@@ -69,4 +69,4 @@ var E1=Object.defineProperty,G1=Object.defineProperties;var D1=Object.getOwnProp
69
69
  width: ${({size:c})=>w2(c)};
70
70
  }
71
71
  }
72
- `;import{jsx as _,jsxs as z2}from"react/jsx-runtime";var $2=d=>{var Z=d,{rules:c,defaultValue:l,shouldUnregister:a,name:o,required:r,label:M,timePickerProps:m,placeholder:s,disabled:v}=Z,t=H(Z,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder","disabled"]);let p=G2();if(!p)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=E(p.formState.errors,o);return _(q2,{dateAdapter:R2,children:_(E2,{control:p.control,name:o,rules:c,defaultValue:l,shouldUnregister:a,render:({field:{value:C,onChange:V,ref:f}})=>z2(D2,{display:"flex",flexDirection:"column",children:[M&&_(L,{label:M,required:r}),_(I2,h(i({value:C!=null?C:null,onChange:V,disabled:v},m),{renderInput:n=>{var y,F;return _(B2,h(i(h(i({variant:"outlined"},n),{error:Boolean(x)}),t),{inputProps:h(i({},n.inputProps),{placeholder:s||((y=n.inputProps)==null?void 0:y.placeholder)}),InputProps:h(i({},n.InputProps),{inputRef(w){f(w),typeof n.inputRef=="function"&&n.inputRef(w)},endAdornment:_(w1,{size:t.size,children:(F=n.InputProps)==null?void 0:F.endAdornment})})}))}}),o),_(P,{name:o})]})})})},U2=T2($2);import{memo as O2}from"react";import{Controller as _2,useFormContext as N2}from"react-hook-form";import{Autocomplete as j2,TextField as W2}from"@mui/material";import{Grid as n1}from"@s_mart/core";import{jsx as N,jsxs as S1}from"react/jsx-runtime";import{createElement as Q2}from"react";var Y2=Z=>{var p=Z,{name:c,defaultValue:l,rules:a,shouldUnregister:o,label:r,required:M,noOptionsText:m,placeholder:s,onInputChange:v,onChange:t}=p,d=H(p,["name","defaultValue","rules","shouldUnregister","label","required","noOptionsText","placeholder","onInputChange","onChange"]);let x=N2();if(!x)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let C=E(x.formState.errors,c);return console.warn=()=>{},N(_2,{name:c,control:x.control,defaultValue:l,rules:a,shouldUnregister:o,render:({field:V})=>S1(n1,{display:"flex",flexDirection:"column",children:[r&&N(L,{label:r,required:M}),N(j2,h(i({onChange:(f,n)=>{V.onChange(n),t==null||t(n,x.watch())},onInputChange:(f,n,y)=>{y==="input"&&(V.onChange(n),setTimeout(()=>{v==null||v(n,x.watch())},0))},isOptionEqualToValue:(f,n)=>f.value===n.value,renderOption:(f,n)=>Q2("li",h(i({},f),{key:n.key||n.value,onClick:y=>{var F;(F=f.onClick)==null||F.call(f,y),V.onChange(n)}}),S1(n1,{container:!0,direction:"column",children:[N(n1,{item:!0,children:n.label}),n.afterLabel&&N(n1,{item:!0,children:n.afterLabel})]})),value:V.value||null,noOptionsText:m||"Nenhuma op\xE7\xE3o encontrada"},d),{renderInput:f=>{var n,y,F;return N(W2,h(i(i({placeholder:s},f),d.textFieldProps),{error:Boolean(C),InputProps:h(i(i({},f.InputProps),(n=d.textFieldProps)==null?void 0:n.InputProps),{inputRef:V.ref,inputProps:i(i({},f.inputProps),(F=(y=d.textFieldProps)==null?void 0:y.InputProps)==null?void 0:F.inputProps)})}))}}),c),N(P,{name:c})]})})},K2=O2(Y2);export{K2 as Autocomplete,U0 as Checkbox,G0 as Creatable,b2 as DatePicker,$1 as Form,l2 as RadioButton,t2 as RadioGroup,g0 as Searchable,m0 as Select,Z2 as Slider,K0 as Switch,e0 as TextField,U2 as TimePicker};
72
+ `;import{jsx as W,jsxs as z2}from"react/jsx-runtime";var $2=d=>{var Z=d,{rules:c,defaultValue:e,shouldUnregister:a,name:o,required:r,label:M,timePickerProps:m,placeholder:s,disabled:v}=Z,t=H(Z,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder","disabled"]);let p=G2();if(!p)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let g=E(p.formState.errors,o);return W(q2,{dateAdapter:R2,children:W(E2,{control:p.control,name:o,rules:c,defaultValue:e,shouldUnregister:a,render:({field:{value:C,onChange:V,ref:f}})=>z2(D2,{display:"flex",flexDirection:"column",children:[M&&W(L,{label:M,required:r}),W(I2,h(i({value:C!=null?C:null,onChange:V,disabled:v},m),{slots:{textField:B2},slotProps:{textField:n=>{var y,F;return h(i(h(i({variant:"outlined"},n),{error:!!g}),t),{inputProps:h(i({},n.inputProps),{placeholder:s||((y=n.inputProps)==null?void 0:y.placeholder)}),InputProps:h(i({},n.InputProps),{inputRef(w){f(w),typeof n.inputRef=="function"&&n.inputRef(w)},endAdornment:W(w1,{size:t.size,children:(F=n.InputProps)==null?void 0:F.endAdornment})})})}}}),o),W(P,{name:o})]})})})},U2=T2($2);import{memo as O2}from"react";import{Controller as _2,useFormContext as N2}from"react-hook-form";import{Autocomplete as j2,TextField as W2}from"@mui/material";import{Grid as n1}from"@s_mart/core";import{jsx as _,jsxs as S1}from"react/jsx-runtime";import{createElement as Q2}from"react";var Y2=Z=>{var p=Z,{name:c,defaultValue:e,rules:a,shouldUnregister:o,label:r,required:M,noOptionsText:m,placeholder:s,onInputChange:v,onChange:t}=p,d=H(p,["name","defaultValue","rules","shouldUnregister","label","required","noOptionsText","placeholder","onInputChange","onChange"]);let g=N2();if(!g)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let C=E(g.formState.errors,c);return console.warn=()=>{},_(_2,{name:c,control:g.control,defaultValue:e,rules:a,shouldUnregister:o,render:({field:V})=>S1(n1,{display:"flex",flexDirection:"column",children:[r&&_(L,{label:r,required:M}),_(j2,h(i({onChange:(f,n)=>{V.onChange(n),t==null||t(n,g.watch())},onInputChange:(f,n,y)=>{y==="input"&&(V.onChange(n),setTimeout(()=>{v==null||v(n,g.watch())},0))},isOptionEqualToValue:(f,n)=>f.value===n.value,renderOption:(f,n)=>Q2("li",h(i({},f),{key:n.key||n.value,onClick:y=>{var F;(F=f.onClick)==null||F.call(f,y),V.onChange(n)}}),S1(n1,{container:!0,direction:"column",children:[_(n1,{item:!0,children:n.label}),n.afterLabel&&_(n1,{item:!0,children:n.afterLabel})]})),value:V.value||null,noOptionsText:m||"Nenhuma op\xE7\xE3o encontrada"},d),{renderInput:f=>{var n,y,F;return _(W2,h(i(i({placeholder:s},f),d.textFieldProps),{error:!!C,InputProps:h(i(i({},f.InputProps),(n=d.textFieldProps)==null?void 0:n.InputProps),{inputRef:V.ref,inputProps:i(i({},f.inputProps),(F=(y=d.textFieldProps)==null?void 0:y.InputProps)==null?void 0:F.inputProps)})}))}}),c),_(P,{name:c})]})})},K2=O2(Y2);export{K2 as Autocomplete,U0 as Checkbox,G0 as Creatable,b2 as DatePicker,$1 as Form,e2 as RadioButton,t2 as RadioGroup,x0 as Searchable,m0 as Select,Z2 as Slider,K0 as Switch,l0 as TextField,U2 as TimePicker};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s_mart/form",
3
- "version": "2.9.5",
3
+ "version": "3.0.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -12,8 +12,7 @@
12
12
  "scripts": {
13
13
  "build": "tsup src/index.tsx --minify --format esm,cjs --dts --external react",
14
14
  "dev": "tsup src/index.tsx --format esm,cjs --watch --dts --external react",
15
- "lint": "eslint src/**/*.ts* --fix",
16
- "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
15
+ "lint": "eslint src/**/*.ts* --fix"
17
16
  },
18
17
  "dependencies": {
19
18
  "@s_mart/core": "*",
@@ -21,24 +20,24 @@
21
20
  "@s_mart/tokens": "*",
22
21
  "@s_mart/typed": "*",
23
22
  "@s_mart/utils": "*",
24
- "@types/react": "18.0.18",
25
- "@types/react-dom": "18.0.6",
23
+ "@types/react": "18.2.5",
24
+ "@types/react-dom": "18.2.4",
26
25
  "lodash": "^4.17.21",
27
- "tsup": "^6.2.3",
28
- "typescript": "^4.9.3"
26
+ "tsup": "^6.7.0",
27
+ "typescript": "^5.0.4"
29
28
  },
30
29
  "peerDependencies": {
31
- "@emotion/react": ">=11.10.4",
32
- "@emotion/styled": ">=11.10.4",
33
- "@mui/material": ">=5.11.2",
34
- "@mui/x-date-pickers": ">=5.0.13",
35
- "@s_mart/core": ">=2.10.0",
36
- "@types/react": ">=18.0.18",
37
- "@types/react-dom": ">=18.0.6",
38
- "react": ">=18.0.0",
39
- "react-dom": ">=18.0.0",
30
+ "@emotion/react": ">=11.10.8",
31
+ "@emotion/styled": ">=11.10.8",
32
+ "@mui/material": ">=5.12.3",
33
+ "@mui/x-date-pickers": ">=6.3.0",
34
+ "@s_mart/core": ">=3.0.0",
35
+ "@types/react": ">=18.2.5",
36
+ "@types/react-dom": ">=18.2.4",
37
+ "react": ">=18.2.0",
38
+ "react-dom": ">=18.2.0",
40
39
  "react-hook-form": ">=7.36.1",
41
- "typescript": ">=4.9.3"
40
+ "typescript": ">=5.0.4"
42
41
  },
43
42
  "devDependencies": {
44
43
  "@s_mart/eslint": "*",