@s_mart/form 2.7.3 → 2.7.5

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
@@ -1,7 +1,7 @@
1
1
  import { UseFormProps, UseFormReturn, FieldValues, ControllerProps, UseControllerProps } from 'react-hook-form';
2
2
  import { TextFieldProps as TextFieldProps$1, SelectProps as SelectProps$1, SelectChangeEvent, AutocompleteProps as AutocompleteProps$1, CheckboxProps as CheckboxProps$1, SwitchProps as SwitchProps$1, RadioProps as RadioProps$1, RadioGroupProps as RadioGroupProps$1, SliderProps as SliderProps$1 } from '@mui/material';
3
- import { DatePickerProps as DatePickerProps$1, TimePickerProps as TimePickerProps$1 } from '@mui/x-date-pickers';
4
3
  import { SyntheticEvent } from 'react';
4
+ import { DatePickerProps as DatePickerProps$1, TimePickerProps as TimePickerProps$1 } from '@mui/x-date-pickers';
5
5
 
6
6
  interface IFormProps<T> extends UseFormProps {
7
7
  onSubmit: (data: T, methods: UseFormReturn) => void;
@@ -46,7 +46,7 @@ type SearchableOption = {
46
46
  label: string;
47
47
  value: string | number | readonly string[] | undefined;
48
48
  } | string;
49
- type SearchableProps = Omit<AutocompleteProps$1<SearchableOption, true, true, true>, 'renderInput' | 'size'> & ControllerSearchable & {
49
+ type SearchableProps = Omit<AutocompleteProps$1<SearchableOption, true, true, true>, 'renderInput' | 'size' | 'onChange' | 'onInputChange'> & ControllerSearchable & {
50
50
  /**
51
51
  * Opções do autocomplete
52
52
  * @default []
@@ -67,11 +67,13 @@ type SearchableProps = Omit<AutocompleteProps$1<SearchableOption, true, true, tr
67
67
  * @memberof SearchableProps
68
68
  */
69
69
  textFieldProps?: TextFieldProps$1;
70
+ onInputChange?: (event: SyntheticEvent<Element, Event>, value: string, reason: string, values: FieldValues) => void;
71
+ onChange?: (event: SyntheticEvent<Element, Event>, value: any, values: FieldValues) => void;
70
72
  label?: React.ReactNode;
71
73
  required?: boolean;
72
74
  };
73
75
 
74
- declare const Searchable: ({ name, rules, defaultValue, shouldUnregister, label, required, options, textFieldProps, ...rest }: SearchableProps) => JSX.Element;
76
+ declare const Searchable: ({ name, rules, defaultValue, shouldUnregister, label, required, options, textFieldProps, onChange, onInputChange, ...rest }: SearchableProps) => JSX.Element;
75
77
 
76
78
  type ControllerCreatable = Omit<ControllerProps, 'render' | 'control'>;
77
79
  type CreatableOption = {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var p3=Object.create;var K=Object.defineProperty,m3=Object.defineProperties,u3=Object.getOwnPropertyDescriptor,f3=Object.getOwnPropertyDescriptors,g3=Object.getOwnPropertyNames,X=Object.getOwnPropertySymbols,x3=Object.getPrototypeOf,Z2=Object.prototype.hasOwnProperty,F2=Object.prototype.propertyIsEnumerable;var h2=(C,i,e)=>i in C?K(C,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):C[i]=e,o=(C,i)=>{for(var e in i||(i={}))Z2.call(i,e)&&h2(C,e,i[e]);if(X)for(var e of X(i))F2.call(i,e)&&h2(C,e,i[e]);return C},V=(C,i)=>m3(C,f3(i));var u=(C,i)=>{var e={};for(var r in C)Z2.call(C,r)&&i.indexOf(r)<0&&(e[r]=C[r]);if(C!=null&&X)for(var r of X(C))i.indexOf(r)<0&&F2.call(C,r)&&(e[r]=C[r]);return e};var y3=(C,i)=>{for(var e in i)K(C,e,{get:i[e],enumerable:!0})},P2=(C,i,e,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let l of g3(i))!Z2.call(C,l)&&l!==e&&K(C,l,{get:()=>i[l],enumerable:!(r=u3(i,l))||r.enumerable});return C};var C2=(C,i,e)=>(e=C!=null?p3(x3(C)):{},P2(i||!C||!C.__esModule?K(e,"default",{value:C,enumerable:!0}):e,C)),h3=C=>P2(K({},"__esModule",{value:!0}),C);var z3={};y3(z3,{Autocomplete:()=>Z3,Checkbox:()=>N2,Creatable:()=>_2,DatePicker:()=>l3,Form:()=>w2,RadioButton:()=>W2,RadioGroup:()=>Y2,Searchable:()=>q2,Select:()=>$2,Slider:()=>Q2,Switch:()=>j2,TextField:()=>G2,TimePicker:()=>a3});module.exports=h3(z3);var b2=require("react"),i2=require("react-hook-form");var c2=require("react/jsx-runtime");function F3(l){var c=l,{children:C,onSubmit:i,style:e}=c,r=u(c,["children","onSubmit","style"]);let n=(0,i2.useForm)(r);(0,b2.useEffect)(()=>{n.reset(r.defaultValues)},[r.defaultValues,n.reset]);let a=()=>typeof C=="function"?C(V(o({},n),{onSubmit:n.handleSubmit(t=>i(t,n))})):C;return(0,c2.jsx)(i2.FormProvider,V(o({},n),{children:(0,c2.jsx)("form",{onSubmit:t=>{t.preventDefault(),t.stopPropagation(),n.handleSubmit(p=>i(p,n))()},style:e,children:a()})}))}var w2=F3;var D2=require("react"),e2=require("react-hook-form"),O=require("@mui/material");var k2={description:"M39.0611 23.1367C36.3276 17.015 30.4051 13.2479 24.027 13.0909C17.4971 13.2479 11.5746 17.172 8.84117 23.1367C8.68931 23.6076 8.68931 24.2355 8.84117 24.8633C11.5746 30.985 17.4971 34.7521 23.8752 34.9091C30.4051 34.7521 36.1757 30.828 38.9092 24.8633C39.3648 24.2355 39.3648 23.6076 39.0611 23.1367ZM24.027 32.0837C19.6231 31.9268 16.2822 28.1596 16.4341 23.6076C16.586 19.3695 19.9269 15.7593 24.027 15.7593C28.4309 15.9163 31.7718 19.6835 31.62 24.2355C31.4681 28.4735 28.1272 32.0837 24.027 32.0837ZM24.027 18.5847C23.5715 18.5847 23.1159 18.7417 22.6603 18.7417C23.4196 19.8404 23.2677 21.2531 22.3566 22.3519C21.4454 23.2937 20.0787 23.2937 19.0157 22.5088C18.5601 24.7063 19.3194 27.2178 21.1417 28.4735C22.964 29.7292 25.3938 29.7292 27.0642 28.3165C28.7347 26.9039 29.494 24.3924 28.7347 22.1949C28.1272 19.9974 26.1531 18.5847 24.027 18.5847Z",viewBox:"0 0 48 48",id:"line-eye-solid"},v2={description:"M23.9998 31.7412C19.9223 31.7412 16.6215 28.5851 16.3177 24.5854L10.6785 20.2272C9.93715 21.1573 9.25496 22.1405 8.70447 23.2157C8.58149 23.4589 8.51742 23.7277 8.51742 24.0003C8.51742 24.2729 8.58149 24.5416 8.70447 24.7849C11.6198 30.4731 17.3913 34.3216 23.9998 34.3216C25.4465 34.3216 26.842 34.1066 28.1871 33.7593L25.3976 31.6009C24.9369 31.6899 24.469 31.7369 23.9998 31.7412ZM40.8703 34.8646L34.9273 30.2715C36.7326 28.7501 38.2174 26.8848 39.2952 24.7843C39.4182 24.5411 39.4823 24.2723 39.4823 23.9997C39.4823 23.7272 39.4182 23.4584 39.2952 23.2151C36.3799 17.5269 30.6084 13.6784 23.9998 13.6784C21.2321 13.6817 18.5093 14.3785 16.0801 15.7051L9.24098 10.419C9.15179 10.3496 9.04981 10.2985 8.94085 10.2685C8.83189 10.2385 8.7181 10.2303 8.60597 10.2443C8.49384 10.2584 8.38557 10.2944 8.28736 10.3502C8.18914 10.4061 8.1029 10.4808 8.03356 10.5701L6.97828 11.9285C6.8383 12.1086 6.77557 12.3369 6.8039 12.5633C6.83223 12.7896 6.94929 12.9954 7.12934 13.1354L38.7587 37.581C38.8479 37.6504 38.9499 37.7016 39.0588 37.7315C39.1678 37.7615 39.2816 37.7697 39.3937 37.7557C39.5058 37.7416 39.6141 37.7057 39.7123 37.6498C39.8105 37.5939 39.8968 37.5192 39.9661 37.43L41.0219 36.0715C41.1619 35.8913 41.2245 35.663 41.1961 35.4366C41.1676 35.2103 41.0505 35.0045 40.8703 34.8646ZM30.9938 27.2309L28.8811 25.5977C29.059 25.0835 29.1534 24.5441 29.1606 24C29.1711 23.2034 28.9947 22.4155 28.6454 21.6995C28.2962 20.9836 27.7838 20.3595 27.1496 19.8774C26.5154 19.3953 25.777 19.0687 24.9937 18.9238C24.2103 18.7788 23.4039 18.8197 22.6392 19.0429C22.9634 19.4822 23.1387 20.0135 23.1397 20.5595C23.1317 20.7411 23.1039 20.9214 23.0569 21.097L19.0997 18.0387C20.4743 16.89 22.2085 16.2601 23.9998 16.2588C25.0166 16.2582 26.0235 16.4581 26.9629 16.8469C27.9024 17.2357 28.756 17.8059 29.475 18.5249C30.1939 19.2438 30.7641 20.0974 31.1529 21.0369C31.5418 21.9764 31.7416 22.9833 31.7411 24C31.7411 25.1628 31.4567 26.246 30.9938 27.2309Z",viewBox:"0 0 48 48",id:"line-eye-slash-solid"};var S2={description:"M35.8286 21.8493H26.1506V12.1714C26.1506 11.6338 25.613 11.0961 25.0753 11.0961H22.9247C22.3198 11.0961 21.8493 11.6338 21.8493 12.1714V21.8493H12.1714C11.5666 21.8493 11.0961 22.387 11.0961 22.9247V25.0753C11.0961 25.6802 11.5666 26.1506 12.1714 26.1506H21.8493V35.8286C21.8493 36.4334 22.3198 36.9039 22.9247 36.9039H25.0753C25.613 36.9039 26.1506 36.4334 26.1506 35.8286V26.1506H35.8286C36.3662 26.1506 36.9039 25.6802 36.9039 25.0753V22.9247C36.9039 22.387 36.3662 21.8493 35.8286 21.8493Z",viewBox:"0 0 48 48",id:"line-plus-solid"};var z=C2(require("@s_mart/masks"));var p2=require("@mui/material"),B2=require("@s_mart/utils"),Q=require("react/jsx-runtime"),y=({label:C,required:i,regular:e})=>(0,Q.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:(0,B2.toRem)(2)},children:[(0,Q.jsx)(p2.Typography,{variant:"caption",fontWeight:e?400:700,style:{display:"flex",alignItems:"center"},children:C}),i&&(0,Q.jsx)(p2.Typography,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});var A2=require("react-hook-form"),T2=require("@s_mart/core");var P=(C,i)=>{var e,r,l,c;if(C[i])return C[i];if(i.includes("[")){let[n,a]=i.split("["),[t,p]=a.split("].");return(r=(e=C[n])==null?void 0:e[t])==null?void 0:r[p]}if(i.includes(".")){let[n,a,t]=i.split(".");return(c=(l=C[n])==null?void 0:l[a])==null?void 0:c[t]}};var E2=require("react/jsx-runtime"),h=({name:C})=>{var r;let i=(0,A2.useFormContext)(),e=P((r=i==null?void 0:i.formState)==null?void 0:r.errors,C);return e?(0,E2.jsx)(T2.Indicator,{severity:"error",children:e==null?void 0:e.message}):null};var I2=require("@s_mart/core");var A=require("react/jsx-runtime"),P3=m=>{var s=m,{name:C,rules:i,defaultValue:e,shouldUnregister:r,label:l,required:c,mask:n,variant:a="outlined",onInputChange:t}=s,p=u(s,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","onInputChange"]);let x=(0,e2.useFormContext)();if(!x)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[f,M]=(0,D2.useState)(!1),H=F=>{var g;return n?(g=z==null?void 0:z[n])==null?void 0:g.format(F):F},d=F=>{var g;return n?(g=z==null?void 0:z[n])==null?void 0:g.parse(F):F},L=F=>{if(!F||n!=="porcentagem")return;F==null||F.stopPropagation();let g=(F==null?void 0:F.target).value;if(g){let Z=String(g);if(Z.length>0){let Y=Z.indexOf("%");Y>-1&&(F.currentTarget.selectionEnd=Y)}}},U=P(x.formState.errors,C);return(0,A.jsx)(e2.Controller,{control:x.control,name:C,rules:i,defaultValue:e,shouldUnregister:r,render:({field:{value:F,onChange:g}})=>(0,A.jsxs)(O.Grid,{display:"flex",flexDirection:"column",children:[l&&(0,A.jsx)(y,{label:l,required:c}),(0,A.jsx)(O.TextField,V(o({variant:a,autoComplete:"off",defaultValue:e,value:H(F||""),onChange:Z=>{var Y,y2;g(d((Y=Z==null?void 0:Z.target)==null?void 0:Y.value)),t==null||t(Z,(y2=Z==null?void 0:Z.target)==null?void 0:y2.value,x.watch())},error:Boolean(U)},p),{type:p.type==="password"?f?"text":"password":p.type,InputProps:o({onKeyDown:L,endAdornment:p.type==="password"&&(0,A.jsx)(O.InputAdornment,{position:"end",onClick:()=>M(!f),style:{cursor:"pointer"},children:(0,A.jsx)(I2.LIcon,{icon:f?k2:v2,size:"24px",removeMargin:!0})})},p.InputProps)})),(0,A.jsx)(h,{name:C})]})})},G2=P3;var o2=require("react-hook-form"),T=require("@mui/material");var v=require("react/jsx-runtime"),b3=m=>{var s=m,{name:C,rules:i,defaultValue:e,shouldUnregister:r,label:l,required:c,options:n,placeholder:a,onInputChange:t}=s,p=u(s,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","onInputChange"]);let x=(0,o2.useFormContext)(),{palette:f}=(0,T.useTheme)();if(!x)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let M=P(x.formState.errors,C);return console.warn=()=>{},(0,v.jsx)(o2.Controller,{control:x.control,name:C,rules:i,defaultValue:e||"",shouldUnregister:r,render:({field:{value:H,onChange:d}})=>(0,v.jsxs)(T.Grid,{display:"flex",flexDirection:"column",children:[l&&(0,v.jsx)(y,{label:l,required:c}),(0,v.jsxs)(T.Select,V(o({displayEmpty:Boolean(a),variant:"outlined",autoComplete:"off",value:H||"",onChange:L=>{d(L.target.value),t==null||t(L,L.target.value,x.watch())},error:Boolean(M),size:p.size||"medium"},p),{children:[a&&(0,v.jsx)(T.MenuItem,{disabled:!0,value:"",children:(0,v.jsx)("p",{style:{color:f.grey[400]},children:a})}),n==null?void 0:n.map((L,U)=>(0,v.jsx)(T.MenuItem,{value:L.value,children:L.label},U))]})),(0,v.jsx)(h,{name:C})]})})},$2=b3;var r2=require("react-hook-form"),_=require("@mui/material");var D=require("react/jsx-runtime"),m2=require("react"),w3=p=>{var m=p,{name:C,rules:i,defaultValue:e,shouldUnregister:r,label:l,required:c,options:n,textFieldProps:a}=m,t=u(m,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps"]);let s=(0,r2.useFormContext)();if(!s)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(s.formState.errors,C);return console.warn=()=>{},(0,D.jsx)(r2.Controller,{control:s.control,name:C,rules:i,defaultValue:e,shouldUnregister:r,render:({field:{onChange:f,value:M}})=>(0,D.jsxs)(_.Grid,{display:"flex",flexDirection:"column",children:[l&&(0,D.jsx)(y,{label:l,required:c}),(0,D.jsx)(_.Autocomplete,V(o({onChange:(H,d)=>f(d),value:M||null,options:n,noOptionsText:"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(H,d)=>typeof H=="string"&&typeof d=="string"?H===d:typeof H=="object"&&typeof d=="object"?H.value===d.value:!1,renderOption:(H,d)=>typeof d=="object"?(0,m2.createElement)("li",V(o({},H),{key:d.key||d.value}),d.label):(0,m2.createElement)("li",V(o({},H),{key:d}),d)},t),{renderInput:H=>(0,D.jsx)(_.TextField,o(o({error:Boolean(x)},H),a))})),(0,D.jsx)(h,{name:C})]})})},q2=w3;var l2=require("react-hook-form"),I=require("@mui/material");var E=require("@s_mart/utils"),u2=C2(require("@emotion/styled")),f2=require("@emotion/react"),R2=f2.css`
1
+ "use strict";var p3=Object.create;var K=Object.defineProperty,m3=Object.defineProperties,u3=Object.getOwnPropertyDescriptor,f3=Object.getOwnPropertyDescriptors,g3=Object.getOwnPropertyNames,X=Object.getOwnPropertySymbols,x3=Object.getPrototypeOf,Z2=Object.prototype.hasOwnProperty,h2=Object.prototype.propertyIsEnumerable;var F2=(C,i,e)=>i in C?K(C,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):C[i]=e,o=(C,i)=>{for(var e in i||(i={}))Z2.call(i,e)&&F2(C,e,i[e]);if(X)for(var e of X(i))h2.call(i,e)&&F2(C,e,i[e]);return C},s=(C,i)=>m3(C,f3(i));var u=(C,i)=>{var e={};for(var r in C)Z2.call(C,r)&&i.indexOf(r)<0&&(e[r]=C[r]);if(C!=null&&X)for(var r of X(C))i.indexOf(r)<0&&h2.call(C,r)&&(e[r]=C[r]);return e};var y3=(C,i)=>{for(var e in i)K(C,e,{get:i[e],enumerable:!0})},P2=(C,i,e,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of g3(i))!Z2.call(C,n)&&n!==e&&K(C,n,{get:()=>i[n],enumerable:!(r=u3(i,n))||r.enumerable});return C};var C2=(C,i,e)=>(e=C!=null?p3(x3(C)):{},P2(i||!C||!C.__esModule?K(e,"default",{value:C,enumerable:!0}):e,C)),F3=C=>P2(K({},"__esModule",{value:!0}),C);var z3={};y3(z3,{Autocomplete:()=>Z3,Checkbox:()=>N2,Creatable:()=>_2,DatePicker:()=>l3,Form:()=>w2,RadioButton:()=>W2,RadioGroup:()=>Y2,Searchable:()=>q2,Select:()=>I2,Slider:()=>Q2,Switch:()=>j2,TextField:()=>$2,TimePicker:()=>a3});module.exports=F3(z3);var b2=require("react"),i2=require("react-hook-form");var c2=require("react/jsx-runtime");function h3(n){var p=n,{children:C,onSubmit:i,style:e}=p,r=u(p,["children","onSubmit","style"]);let H=(0,i2.useForm)(r);(0,b2.useEffect)(()=>{H.reset(r.defaultValues)},[r.defaultValues,H.reset]);let L=()=>typeof C=="function"?C(s(o({},H),{onSubmit:H.handleSubmit(t=>i(t,H))})):C;return(0,c2.jsx)(i2.FormProvider,s(o({},H),{children:(0,c2.jsx)("form",{onSubmit:t=>{t.preventDefault(),t.stopPropagation(),H.handleSubmit(a=>i(a,H))()},style:e,children:L()})}))}var w2=h3;var D2=require("react"),e2=require("react-hook-form"),O=require("@mui/material");var k2={description:"M39.0611 23.1367C36.3276 17.015 30.4051 13.2479 24.027 13.0909C17.4971 13.2479 11.5746 17.172 8.84117 23.1367C8.68931 23.6076 8.68931 24.2355 8.84117 24.8633C11.5746 30.985 17.4971 34.7521 23.8752 34.9091C30.4051 34.7521 36.1757 30.828 38.9092 24.8633C39.3648 24.2355 39.3648 23.6076 39.0611 23.1367ZM24.027 32.0837C19.6231 31.9268 16.2822 28.1596 16.4341 23.6076C16.586 19.3695 19.9269 15.7593 24.027 15.7593C28.4309 15.9163 31.7718 19.6835 31.62 24.2355C31.4681 28.4735 28.1272 32.0837 24.027 32.0837ZM24.027 18.5847C23.5715 18.5847 23.1159 18.7417 22.6603 18.7417C23.4196 19.8404 23.2677 21.2531 22.3566 22.3519C21.4454 23.2937 20.0787 23.2937 19.0157 22.5088C18.5601 24.7063 19.3194 27.2178 21.1417 28.4735C22.964 29.7292 25.3938 29.7292 27.0642 28.3165C28.7347 26.9039 29.494 24.3924 28.7347 22.1949C28.1272 19.9974 26.1531 18.5847 24.027 18.5847Z",viewBox:"0 0 48 48",id:"line-eye-solid"},v2={description:"M23.9998 31.7412C19.9223 31.7412 16.6215 28.5851 16.3177 24.5854L10.6785 20.2272C9.93715 21.1573 9.25496 22.1405 8.70447 23.2157C8.58149 23.4589 8.51742 23.7277 8.51742 24.0003C8.51742 24.2729 8.58149 24.5416 8.70447 24.7849C11.6198 30.4731 17.3913 34.3216 23.9998 34.3216C25.4465 34.3216 26.842 34.1066 28.1871 33.7593L25.3976 31.6009C24.9369 31.6899 24.469 31.7369 23.9998 31.7412ZM40.8703 34.8646L34.9273 30.2715C36.7326 28.7501 38.2174 26.8848 39.2952 24.7843C39.4182 24.5411 39.4823 24.2723 39.4823 23.9997C39.4823 23.7272 39.4182 23.4584 39.2952 23.2151C36.3799 17.5269 30.6084 13.6784 23.9998 13.6784C21.2321 13.6817 18.5093 14.3785 16.0801 15.7051L9.24098 10.419C9.15179 10.3496 9.04981 10.2985 8.94085 10.2685C8.83189 10.2385 8.7181 10.2303 8.60597 10.2443C8.49384 10.2584 8.38557 10.2944 8.28736 10.3502C8.18914 10.4061 8.1029 10.4808 8.03356 10.5701L6.97828 11.9285C6.8383 12.1086 6.77557 12.3369 6.8039 12.5633C6.83223 12.7896 6.94929 12.9954 7.12934 13.1354L38.7587 37.581C38.8479 37.6504 38.9499 37.7016 39.0588 37.7315C39.1678 37.7615 39.2816 37.7697 39.3937 37.7557C39.5058 37.7416 39.6141 37.7057 39.7123 37.6498C39.8105 37.5939 39.8968 37.5192 39.9661 37.43L41.0219 36.0715C41.1619 35.8913 41.2245 35.663 41.1961 35.4366C41.1676 35.2103 41.0505 35.0045 40.8703 34.8646ZM30.9938 27.2309L28.8811 25.5977C29.059 25.0835 29.1534 24.5441 29.1606 24C29.1711 23.2034 28.9947 22.4155 28.6454 21.6995C28.2962 20.9836 27.7838 20.3595 27.1496 19.8774C26.5154 19.3953 25.777 19.0687 24.9937 18.9238C24.2103 18.7788 23.4039 18.8197 22.6392 19.0429C22.9634 19.4822 23.1387 20.0135 23.1397 20.5595C23.1317 20.7411 23.1039 20.9214 23.0569 21.097L19.0997 18.0387C20.4743 16.89 22.2085 16.2601 23.9998 16.2588C25.0166 16.2582 26.0235 16.4581 26.9629 16.8469C27.9024 17.2357 28.756 17.8059 29.475 18.5249C30.1939 19.2438 30.7641 20.0974 31.1529 21.0369C31.5418 21.9764 31.7416 22.9833 31.7411 24C31.7411 25.1628 31.4567 26.246 30.9938 27.2309Z",viewBox:"0 0 48 48",id:"line-eye-slash-solid"};var S2={description:"M35.8286 21.8493H26.1506V12.1714C26.1506 11.6338 25.613 11.0961 25.0753 11.0961H22.9247C22.3198 11.0961 21.8493 11.6338 21.8493 12.1714V21.8493H12.1714C11.5666 21.8493 11.0961 22.387 11.0961 22.9247V25.0753C11.0961 25.6802 11.5666 26.1506 12.1714 26.1506H21.8493V35.8286C21.8493 36.4334 22.3198 36.9039 22.9247 36.9039H25.0753C25.613 36.9039 26.1506 36.4334 26.1506 35.8286V26.1506H35.8286C36.3662 26.1506 36.9039 25.6802 36.9039 25.0753V22.9247C36.9039 22.387 36.3662 21.8493 35.8286 21.8493Z",viewBox:"0 0 48 48",id:"line-plus-solid"};var z=C2(require("@s_mart/masks"));var p2=require("@mui/material"),B2=require("@s_mart/utils"),Q=require("react/jsx-runtime"),y=({label:C,required:i,regular:e})=>(0,Q.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:(0,B2.toRem)(2)},children:[(0,Q.jsx)(p2.Typography,{variant:"caption",fontWeight:e?400:700,style:{display:"flex",alignItems:"center"},children:C}),i&&(0,Q.jsx)(p2.Typography,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});var A2=require("react-hook-form"),T2=require("@s_mart/core");var b=(C,i)=>{var e,r,n,p;if(C[i])return C[i];if(i.includes("[")){let[H,L]=i.split("["),[t,a]=L.split("].");return(r=(e=C[H])==null?void 0:e[t])==null?void 0:r[a]}if(i.includes(".")){let[H,L,t]=i.split(".");return(p=(n=C[H])==null?void 0:n[L])==null?void 0:p[t]}};var E2=require("react/jsx-runtime"),P=({name:C})=>{var r;let i=(0,A2.useFormContext)(),e=b((r=i==null?void 0:i.formState)==null?void 0:r.errors,C);return e?(0,E2.jsx)(T2.Indicator,{severity:"error",children:e==null?void 0:e.message}):null};var G2=require("@s_mart/core");var T=require("react/jsx-runtime"),P3=m=>{var d=m,{name:C,rules:i,defaultValue:e,shouldUnregister:r,label:n,required:p,mask:H,variant:L="outlined",onInputChange:t}=d,a=u(d,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","onInputChange"]);let g=(0,e2.useFormContext)();if(!g)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[M,Z]=(0,D2.useState)(!1),V=h=>{var f;return H?(f=z==null?void 0:z[H])==null?void 0:f.format(h):h},F=h=>{var f;return H?(f=z==null?void 0:z[H])==null?void 0:f.parse(h):h},l=h=>{if(!h||H!=="porcentagem")return;h==null||h.stopPropagation();let f=(h==null?void 0:h.target).value;if(f){let c=String(f);if(c.length>0){let Y=c.indexOf("%");Y>-1&&(h.currentTarget.selectionEnd=Y)}}},x=b(g.formState.errors,C);return(0,T.jsx)(e2.Controller,{control:g.control,name:C,rules:i,defaultValue:e,shouldUnregister:r,render:({field:{value:h,onChange:f}})=>(0,T.jsxs)(O.Grid,{display:"flex",flexDirection:"column",children:[n&&(0,T.jsx)(y,{label:n,required:p}),(0,T.jsx)(O.TextField,s(o({variant:L,autoComplete:"off",defaultValue:e,value:V(h||""),onChange:c=>{var Y,y2;f(F((Y=c==null?void 0:c.target)==null?void 0:Y.value)),t==null||t(c,(y2=c==null?void 0:c.target)==null?void 0:y2.value,g.watch())},error:Boolean(x)},a),{type:a.type==="password"?M?"text":"password":a.type,InputProps:o({onKeyDown:l,endAdornment:a.type==="password"&&(0,T.jsx)(O.InputAdornment,{position:"end",onClick:()=>Z(!M),style:{cursor:"pointer"},children:(0,T.jsx)(G2.LIcon,{icon:M?k2:v2,size:"24px",removeMargin:!0})})},a.InputProps)})),(0,T.jsx)(P,{name:C})]})})},$2=P3;var o2=require("react-hook-form"),E=require("@mui/material");var S=require("react/jsx-runtime"),b3=m=>{var d=m,{name:C,rules:i,defaultValue:e,shouldUnregister:r,label:n,required:p,options:H,placeholder:L,onInputChange:t}=d,a=u(d,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","onInputChange"]);let g=(0,o2.useFormContext)(),{palette:M}=(0,E.useTheme)();if(!g)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let Z=b(g.formState.errors,C);return console.warn=()=>{},(0,S.jsx)(o2.Controller,{control:g.control,name:C,rules:i,defaultValue:e||"",shouldUnregister:r,render:({field:{value:V,onChange:F}})=>(0,S.jsxs)(E.Grid,{display:"flex",flexDirection:"column",children:[n&&(0,S.jsx)(y,{label:n,required:p}),(0,S.jsxs)(E.Select,s(o({displayEmpty:Boolean(L),variant:"outlined",autoComplete:"off",value:V||"",onChange:l=>{F(l.target.value),t==null||t(l,l.target.value,g.watch())},error:Boolean(Z),size:a.size||"medium"},a),{children:[L&&(0,S.jsx)(E.MenuItem,{disabled:!0,value:"",children:(0,S.jsx)("p",{style:{color:M.grey[400]},children:L})}),H==null?void 0:H.map((l,x)=>(0,S.jsx)(E.MenuItem,{value:l.value,children:l.label},x))]})),(0,S.jsx)(P,{name:C})]})})},I2=b3;var r2=require("react-hook-form"),_=require("@mui/material");var G=require("react/jsx-runtime"),m2=require("react"),w3=d=>{var g=d,{name:C,rules:i,defaultValue:e,shouldUnregister:r,label:n,required:p,options:H,textFieldProps:L,onChange:t,onInputChange:a}=g,m=u(g,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","onChange","onInputChange"]);let M=(0,r2.useFormContext)();if(!M)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let Z=b(M.formState.errors,C);return console.warn=()=>{},(0,G.jsx)(r2.Controller,{control:M.control,name:C,rules:i,defaultValue:e,shouldUnregister:r,render:({field:{onChange:V,value:F}})=>(0,G.jsxs)(_.Grid,{display:"flex",flexDirection:"column",children:[n&&(0,G.jsx)(y,{label:n,required:p}),(0,G.jsx)(_.Autocomplete,s(o({onChange:(l,x)=>{V(x),t==null||t(l,x,M.watch())},onInputChange:(l,x,h)=>{V(x),setTimeout(()=>{a==null||a(l,M.watch(C),h,M.watch())},0)},value:F||null,options:H,noOptionsText:"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(l,x)=>typeof l=="string"&&typeof x=="string"?l===x:typeof l=="object"&&typeof x=="object"?l.value===x.value:!1,renderOption:(l,x)=>typeof x=="object"?(0,m2.createElement)("li",s(o({},l),{key:x.key||x.value}),x.label):(0,m2.createElement)("li",s(o({},l),{key:x}),x)},m),{renderInput:l=>(0,G.jsx)(_.TextField,o(o({error:Boolean(Z)},l),L))})),(0,G.jsx)(P,{name:C})]})})},q2=w3;var l2=require("react-hook-form"),$=require("@mui/material");var D=require("@s_mart/utils"),u2=C2(require("@emotion/styled")),f2=require("@emotion/react"),R2=f2.css`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
@@ -13,7 +13,7 @@
13
13
 
14
14
  .divider {
15
15
  width: 1px;
16
- height: ${(0,E.toRem)(20)};
16
+ height: ${(0,D.toRem)(20)};
17
17
  background-color: ${C.palette.grey[400]};
18
18
  }
19
19
 
@@ -24,9 +24,9 @@
24
24
  color: ${C.palette.grey[600]};
25
25
  border-radius: 50%;
26
26
 
27
- margin: 0 ${(0,E.toRem)(6)};
28
- width: ${(0,E.toRem)(28)};
29
- height: ${(0,E.toRem)(28)};
27
+ margin: 0 ${(0,D.toRem)(6)};
28
+ width: ${(0,D.toRem)(28)};
29
+ height: ${(0,D.toRem)(28)};
30
30
 
31
31
  &:hover {
32
32
  cursor: pointer;
@@ -49,18 +49,18 @@
49
49
  `,z2=u2.default.div`
50
50
  color: ${({theme:C})=>C.palette.text.primary};
51
51
 
52
- padding: ${(0,E.toRem)(6)} ${(0,E.toRem)(16)};
53
- margin: ${(0,E.toRem)(-6)} ${(0,E.toRem)(-16)};
52
+ padding: ${(0,D.toRem)(6)} ${(0,D.toRem)(16)};
53
+ margin: ${(0,D.toRem)(-6)} ${(0,D.toRem)(-16)};
54
54
 
55
55
  &:hover {
56
56
  cursor: pointer;
57
57
  transition: background-color 0.2s ease-in-out;
58
58
  background-color: ${({theme:C})=>C.palette.grey[100]};
59
59
  }
60
- `;var O2=require("@s_mart/core");var b=require("react/jsx-runtime"),g2=require("react"),v3=x=>{var f=x,{name:C,rules:i,defaultValue:e,shouldUnregister:r,label:l,required:c,options:n,onCreateOption:a,textFieldProps:t,hideAddButton:p,onInputChange:m}=f,s=u(f,["name","rules","defaultValue","shouldUnregister","label","required","options","onCreateOption","textFieldProps","hideAddButton","onInputChange"]);let M=(0,l2.useFormContext)();if(!M)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let H=P(M.formState.errors,C);console.warn=()=>{};let d=L=>{a?a(L):console.error("onCreateOption n\xE3o foi definido")};return(0,b.jsx)(l2.Controller,{control:M.control,name:C,rules:i,defaultValue:e,shouldUnregister:r,render:({field:{value:L,onChange:U}})=>{let F=(L==null?void 0:L.label)||(L==null?void 0:L.value)||L;return(0,b.jsxs)(I.Grid,{display:"flex",flexDirection:"column",children:[l&&(0,b.jsx)(y,{label:l,required:c}),(0,b.jsx)(U2,{hideAddButton:p,children:(0,b.jsx)(I.Autocomplete,V(o({fullWidth:!0,onChange:(g,Z)=>(m==null||m(Z,M.watch()),U(Z)),options:n,value:L||null,noOptionsText:(0,b.jsx)(z2,{onClick:()=>d(L),children:(0,b.jsxs)(I.Typography,{children:["Adicionar ",F&&`"${F}"`]})}),isOptionEqualToValue:(g,Z)=>Z?typeof g=="string"&&typeof Z=="string"?g===Z:typeof g=="object"&&typeof Z=="object"?g.value===Z.value:typeof g=="object"&&typeof Z=="string":!1,renderOption:(g,Z)=>typeof Z=="object"?(0,g2.createElement)("li",V(o({},g),{key:Z.key||Z.value}),Z.label):(0,g2.createElement)("li",V(o({},g),{key:Z}),Z)},s),{renderInput:g=>{let Z=p?g.InputProps:V(o({},g.InputProps),{endAdornment:(0,b.jsxs)("div",{className:"endAdornments",children:[g.InputProps.endAdornment,(0,b.jsxs)("div",{className:"creatable",children:[(0,b.jsx)("div",{className:"divider"}),(0,b.jsx)("div",{className:"button",onClick:()=>d(L),children:(0,b.jsx)(O2.LIcon,{icon:S2,size:"24px",removeMargin:!0})})]})]})});return(0,b.jsx)(I.TextField,o(V(o({},g),{error:Boolean(H),onChange:U,InputProps:Z}),t))}}))}),(0,b.jsx)(h,{name:C})]})}})},_2=v3;var n2=require("react-hook-form"),N=require("@mui/material");var G=require("react/jsx-runtime"),S3=t=>{var p=t,{name:C,rules:i,defaultValue:e,shouldUnregister:r,label:l,labelPlacement:c,required:n}=p,a=u(p,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let m=(0,n2.useFormContext)();if(!m)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,G.jsx)(n2.Controller,{control:m.control,name:C,rules:i,defaultValue:e,shouldUnregister:r,render:({field:{value:s,onChange:x}})=>(0,G.jsxs)(N.Grid,{display:"flex",flexDirection:"column",children:[(0,G.jsx)(N.FormControlLabel,{control:(0,G.jsx)(N.Checkbox,o({value:s!=null?s:"",defaultValue:s,onChange:x},a)),label:(0,G.jsx)(y,{label:l,required:n,regular:!0}),labelPlacement:c||"end"}),(0,G.jsx)(h,{name:C})]})})},N2=S3;var H2=require("react-hook-form"),j=require("@mui/material");var $=require("react/jsx-runtime"),B3=a=>{var t=a,{name:C,rules:i,defaultValue:e,shouldUnregister:r,label:l,labelPlacement:c}=t,n=u(t,["name","rules","defaultValue","shouldUnregister","label","labelPlacement"]);let p=(0,H2.useFormContext)();if(!p)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,$.jsx)(H2.Controller,{control:p.control,name:C,rules:i,defaultValue:e,shouldUnregister:r,render:({field:{value:m,onChange:s}})=>(0,$.jsxs)(j.Grid,{display:"flex",flexDirection:"column",children:[(0,$.jsx)(j.FormControlLabel,{control:(0,$.jsx)(j.Switch,o({value:m!=null?m:"",defaultValue:m,onChange:s},n)),label:(0,$.jsx)(y,{label:l}),labelPlacement:c||"end"}),(0,$.jsx)(h,{name:C})]})})},j2=B3;var W=require("@mui/material");var J=require("react/jsx-runtime"),A3=r=>{var l=r,{label:C,labelPlacement:i}=l,e=u(l,["label","labelPlacement"]);return(0,J.jsx)(W.Grid,{display:"flex",flexDirection:"column",children:(0,J.jsx)(W.FormControlLabel,{control:(0,J.jsx)(W.Radio,o({},e)),label:(0,J.jsx)(y,{label:C}),labelPlacement:i||"end"})})},W2=A3;var t2=require("react-hook-form"),s2=require("@mui/material");var R=require("react/jsx-runtime"),T3=p=>{var m=p,{name:C,rules:i,defaultValue:e,shouldUnregister:r,label:l,required:c,children:n,orientation:a="row"}=m,t=u(m,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation"]);let s=(0,t2.useFormContext)();if(!s)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,R.jsx)(t2.Controller,{control:s.control,name:C,rules:i,defaultValue:e,shouldUnregister:r,render:({field:{value:x,onChange:f}})=>(0,R.jsxs)(s2.Grid,{display:"flex",flexDirection:"column",children:[l&&(0,R.jsx)(y,{label:l,required:c}),(0,R.jsx)(s2.RadioGroup,V(o({value:x||"",onChange:f,name:C},t),{style:{display:"flex",flexDirection:a},children:n})),(0,R.jsx)(h,{name:C})]})})},Y2=T3;var V2=require("react-hook-form"),K2=require("@mui/material");var x2=require("react/jsx-runtime"),E3=c=>{var n=c,{name:C,rules:i,defaultValue:e,shouldUnregister:r}=n,l=u(n,["name","rules","defaultValue","shouldUnregister"]);let a=(0,V2.useFormContext)();if(!a)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,x2.jsx)(V2.Controller,{control:a.control,name:C,rules:i,defaultValue:e,shouldUnregister:r,render:({field:{value:t,onChange:p}})=>(0,x2.jsx)(K2.Slider,o({value:t||(l==null?void 0:l.min)||0,onChange:p,valueLabelDisplay:"auto"},l))})},Q2=E3;var d2=require("react-hook-form"),C3=require("@s_mart/core"),i3=require("@mui/material"),e3=require("@mui/x-date-pickers/DatePicker"),o3=require("@mui/x-date-pickers/AdapterDayjs"),r3=require("@mui/x-date-pickers/LocalizationProvider");var w=require("@s_mart/utils"),J2=C2(require("@emotion/styled")),D3=C=>{switch(C){case"small":return(0,w.toRem)(16);default:case"medium":return(0,w.toRem)(20);case"large":return(0,w.toRem)(24)}},I3=C=>{switch(C){case"small":return`${(0,w.toRem)(2)} ${(0,w.toRem)(8)}`;default:case"medium":return`${(0,w.toRem)(6)} ${(0,w.toRem)(8)}`;case"large":return`${(0,w.toRem)(10)}`}},X2=J2.default.div`
60
+ `;var O2=require("@s_mart/core");var w=require("react/jsx-runtime"),g2=require("react"),v3=g=>{var M=g,{name:C,rules:i,defaultValue:e,shouldUnregister:r,label:n,required:p,options:H,onCreateOption:L,textFieldProps:t,hideAddButton:a,onInputChange:m}=M,d=u(M,["name","rules","defaultValue","shouldUnregister","label","required","options","onCreateOption","textFieldProps","hideAddButton","onInputChange"]);let Z=(0,l2.useFormContext)();if(!Z)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let V=b(Z.formState.errors,C);console.warn=()=>{};let F=l=>{L?L(l):console.error("onCreateOption n\xE3o foi definido")};return(0,w.jsx)(l2.Controller,{control:Z.control,name:C,rules:i,defaultValue:e,shouldUnregister:r,render:({field:{value:l,onChange:x}})=>{let h=(l==null?void 0:l.label)||(l==null?void 0:l.value)||l;return(0,w.jsxs)($.Grid,{display:"flex",flexDirection:"column",children:[n&&(0,w.jsx)(y,{label:n,required:p}),(0,w.jsx)(U2,{hideAddButton:a,children:(0,w.jsx)($.Autocomplete,s(o({fullWidth:!0,onChange:(f,c)=>(m==null||m(c,Z.watch()),x(c)),options:H,value:l||null,noOptionsText:(0,w.jsx)(z2,{onClick:()=>F(l),children:(0,w.jsxs)($.Typography,{children:["Adicionar ",h&&`"${h}"`]})}),isOptionEqualToValue:(f,c)=>c?typeof f=="string"&&typeof c=="string"?f===c:typeof f=="object"&&typeof c=="object"?f.value===c.value:typeof f=="object"&&typeof c=="string":!1,renderOption:(f,c)=>typeof c=="object"?(0,g2.createElement)("li",s(o({},f),{key:c.key||c.value}),c.label):(0,g2.createElement)("li",s(o({},f),{key:c}),c)},d),{renderInput:f=>{let c=a?f.InputProps:s(o({},f.InputProps),{endAdornment:(0,w.jsxs)("div",{className:"endAdornments",children:[f.InputProps.endAdornment,(0,w.jsxs)("div",{className:"creatable",children:[(0,w.jsx)("div",{className:"divider"}),(0,w.jsx)("div",{className:"button",onClick:()=>F(l),children:(0,w.jsx)(O2.LIcon,{icon:S2,size:"24px",removeMargin:!0})})]})]})});return(0,w.jsx)($.TextField,o(s(o({},f),{error:Boolean(V),onChange:x,InputProps:c}),t))}}))}),(0,w.jsx)(P,{name:C})]})}})},_2=v3;var n2=require("react-hook-form"),N=require("@mui/material");var I=require("react/jsx-runtime"),S3=t=>{var a=t,{name:C,rules:i,defaultValue:e,shouldUnregister:r,label:n,labelPlacement:p,required:H}=a,L=u(a,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let m=(0,n2.useFormContext)();if(!m)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,I.jsx)(n2.Controller,{control:m.control,name:C,rules:i,defaultValue:e,shouldUnregister:r,render:({field:{value:d,onChange:g}})=>(0,I.jsxs)(N.Grid,{display:"flex",flexDirection:"column",children:[(0,I.jsx)(N.FormControlLabel,{control:(0,I.jsx)(N.Checkbox,o({value:d!=null?d:"",defaultValue:d,onChange:g},L)),label:(0,I.jsx)(y,{label:n,required:H,regular:!0}),labelPlacement:p||"end"}),(0,I.jsx)(P,{name:C})]})})},N2=S3;var H2=require("react-hook-form"),j=require("@mui/material");var q=require("react/jsx-runtime"),B3=L=>{var t=L,{name:C,rules:i,defaultValue:e,shouldUnregister:r,label:n,labelPlacement:p}=t,H=u(t,["name","rules","defaultValue","shouldUnregister","label","labelPlacement"]);let a=(0,H2.useFormContext)();if(!a)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,q.jsx)(H2.Controller,{control:a.control,name:C,rules:i,defaultValue:e,shouldUnregister:r,render:({field:{value:m,onChange:d}})=>(0,q.jsxs)(j.Grid,{display:"flex",flexDirection:"column",children:[(0,q.jsx)(j.FormControlLabel,{control:(0,q.jsx)(j.Switch,o({value:m!=null?m:"",defaultValue:m,onChange:d},H)),label:(0,q.jsx)(y,{label:n}),labelPlacement:p||"end"}),(0,q.jsx)(P,{name:C})]})})},j2=B3;var W=require("@mui/material");var J=require("react/jsx-runtime"),A3=r=>{var n=r,{label:C,labelPlacement:i}=n,e=u(n,["label","labelPlacement"]);return(0,J.jsx)(W.Grid,{display:"flex",flexDirection:"column",children:(0,J.jsx)(W.FormControlLabel,{control:(0,J.jsx)(W.Radio,o({},e)),label:(0,J.jsx)(y,{label:C}),labelPlacement:i||"end"})})},W2=A3;var t2=require("react-hook-form"),s2=require("@mui/material");var U=require("react/jsx-runtime"),T3=a=>{var m=a,{name:C,rules:i,defaultValue:e,shouldUnregister:r,label:n,required:p,children:H,orientation:L="row"}=m,t=u(m,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation"]);let d=(0,t2.useFormContext)();if(!d)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,U.jsx)(t2.Controller,{control:d.control,name:C,rules:i,defaultValue:e,shouldUnregister:r,render:({field:{value:g,onChange:M}})=>(0,U.jsxs)(s2.Grid,{display:"flex",flexDirection:"column",children:[n&&(0,U.jsx)(y,{label:n,required:p}),(0,U.jsx)(s2.RadioGroup,s(o({value:g||"",onChange:M,name:C},t),{style:{display:"flex",flexDirection:L},children:H})),(0,U.jsx)(P,{name:C})]})})},Y2=T3;var V2=require("react-hook-form"),K2=require("@mui/material");var x2=require("react/jsx-runtime"),E3=p=>{var H=p,{name:C,rules:i,defaultValue:e,shouldUnregister:r}=H,n=u(H,["name","rules","defaultValue","shouldUnregister"]);let L=(0,V2.useFormContext)();if(!L)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,x2.jsx)(V2.Controller,{control:L.control,name:C,rules:i,defaultValue:e,shouldUnregister:r,render:({field:{value:t,onChange:a}})=>(0,x2.jsx)(K2.Slider,o({value:t||(n==null?void 0:n.min)||0,onChange:a,valueLabelDisplay:"auto"},n))})},Q2=E3;var d2=require("react-hook-form"),C3=require("@s_mart/core"),i3=require("@mui/material"),e3=require("@mui/x-date-pickers/DatePicker"),o3=require("@mui/x-date-pickers/AdapterDayjs"),r3=require("@mui/x-date-pickers/LocalizationProvider");var k=require("@s_mart/utils"),J2=C2(require("@emotion/styled")),D3=C=>{switch(C){case"small":return(0,k.toRem)(16);default:case"medium":return(0,k.toRem)(20);case"large":return(0,k.toRem)(24)}},G3=C=>{switch(C){case"small":return`${(0,k.toRem)(2)} ${(0,k.toRem)(8)}`;default:case"medium":return`${(0,k.toRem)(6)} ${(0,k.toRem)(8)}`;case"large":return`${(0,k.toRem)(10)}`}},X2=J2.default.div`
61
61
  > div > button {
62
- padding: ${({size:C})=>I3(C)};
63
- border-radius: 0 ${(0,w.toRem)(4)} ${(0,w.toRem)(4)} 0;
62
+ padding: ${({size:C})=>G3(C)};
63
+ border-radius: 0 ${(0,k.toRem)(4)} ${(0,k.toRem)(4)} 0;
64
64
 
65
65
  margin: 0px -13px 0px 0px;
66
66
 
@@ -68,15 +68,15 @@
68
68
  width: ${({size:C})=>D3(C)};
69
69
  }
70
70
  }
71
- `;var S=require("react/jsx-runtime"),G3=p=>{var m=p,{rules:C,name:i,defaultValue:e,shouldUnregister:r,datePickerProps:l,label:c,required:n,placeholder:a}=m,t=u(m,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder"]);let s=(0,d2.useFormContext)();if(!s)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(s.formState.errors,i);return console.log(x),(0,S.jsx)(r3.LocalizationProvider,{dateAdapter:o3.AdapterDayjs,children:(0,S.jsx)(d2.Controller,{control:s.control,name:i,rules:C,defaultValue:e,shouldUnregister:r,render:({field:{value:f,onChange:M}})=>(0,S.jsxs)(C3.Grid,{display:"flex",flexDirection:"column",children:[c&&(0,S.jsx)(y,{label:c,required:n}),(0,S.jsx)(e3.DatePicker,V(o({},l),{value:f!=null?f:null,inputFormat:(l==null?void 0:l.inputFormat)||"DD/MM/YYYY",onChange:M,renderInput:H=>{var d,L;return(0,S.jsx)(i3.TextField,V(o(V(o({variant:"outlined"},H),{error:Boolean(x)}),t),{inputProps:V(o({},H.inputProps),{placeholder:a||((d=H.inputProps)==null?void 0:d.placeholder)}),InputProps:V(o({},H.InputProps),{endAdornment:(0,S.jsx)(X2,{size:t.size,children:(L=H.InputProps)==null?void 0:L.endAdornment})})}))}})),(0,S.jsx)(h,{name:i})]})})})},l3=G3;var t3=require("@s_mart/core"),s3=require("@mui/x-date-pickers/TimePicker"),V3=require("@mui/material"),L2=require("react-hook-form"),d3=require("@mui/x-date-pickers/AdapterDayjs"),L3=require("@mui/x-date-pickers/LocalizationProvider");var k=require("@s_mart/utils"),n3=C2(require("@emotion/styled")),$3=C=>{switch(C){case"small":return(0,k.toRem)(16);default:case"medium":return(0,k.toRem)(20);case"large":return(0,k.toRem)(24)}},q3=C=>{switch(C){case"small":return`${(0,k.toRem)(2)} ${(0,k.toRem)(8)}`;default:case"medium":return`${(0,k.toRem)(6)} ${(0,k.toRem)(8)}`;case"large":return`${(0,k.toRem)(10)}`}},H3=n3.default.div`
71
+ `;var B=require("react/jsx-runtime"),$3=a=>{var m=a,{rules:C,name:i,defaultValue:e,shouldUnregister:r,datePickerProps:n,label:p,required:H,placeholder:L}=m,t=u(m,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder"]);let d=(0,d2.useFormContext)();if(!d)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let g=b(d.formState.errors,i);return console.log(g),(0,B.jsx)(r3.LocalizationProvider,{dateAdapter:o3.AdapterDayjs,children:(0,B.jsx)(d2.Controller,{control:d.control,name:i,rules:C,defaultValue:e,shouldUnregister:r,render:({field:{value:M,onChange:Z}})=>(0,B.jsxs)(C3.Grid,{display:"flex",flexDirection:"column",children:[p&&(0,B.jsx)(y,{label:p,required:H}),(0,B.jsx)(e3.DatePicker,s(o({},n),{value:M!=null?M:null,inputFormat:(n==null?void 0:n.inputFormat)||"DD/MM/YYYY",onChange:Z,renderInput:V=>{var F,l;return(0,B.jsx)(i3.TextField,s(o(s(o({variant:"outlined"},V),{error:Boolean(g)}),t),{inputProps:s(o({},V.inputProps),{placeholder:L||((F=V.inputProps)==null?void 0:F.placeholder)}),InputProps:s(o({},V.InputProps),{endAdornment:(0,B.jsx)(X2,{size:t.size,children:(l=V.InputProps)==null?void 0:l.endAdornment})})}))}})),(0,B.jsx)(P,{name:i})]})})})},l3=$3;var t3=require("@s_mart/core"),s3=require("@mui/x-date-pickers/TimePicker"),V3=require("@mui/material"),L2=require("react-hook-form"),d3=require("@mui/x-date-pickers/AdapterDayjs"),L3=require("@mui/x-date-pickers/LocalizationProvider");var v=require("@s_mart/utils"),n3=C2(require("@emotion/styled")),I3=C=>{switch(C){case"small":return(0,v.toRem)(16);default:case"medium":return(0,v.toRem)(20);case"large":return(0,v.toRem)(24)}},q3=C=>{switch(C){case"small":return`${(0,v.toRem)(2)} ${(0,v.toRem)(8)}`;default:case"medium":return`${(0,v.toRem)(6)} ${(0,v.toRem)(8)}`;case"large":return`${(0,v.toRem)(10)}`}},H3=n3.default.div`
72
72
  > div > button {
73
73
  padding: ${({size:C})=>q3(C)};
74
- border-radius: 0 ${(0,k.toRem)(4)} ${(0,k.toRem)(4)} 0;
74
+ border-radius: 0 ${(0,v.toRem)(4)} ${(0,v.toRem)(4)} 0;
75
75
 
76
76
  margin: 0px -13px 0px 0px;
77
77
 
78
78
  svg {
79
- width: ${({size:C})=>$3(C)};
79
+ width: ${({size:C})=>I3(C)};
80
80
  }
81
81
  }
82
- `;var B=require("react/jsx-runtime"),R3=p=>{var m=p,{rules:C,defaultValue:i,shouldUnregister:e,name:r,required:l,label:c,timePickerProps:n,placeholder:a}=m,t=u(m,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder"]);let s=(0,L2.useFormContext)();if(!s)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(s.formState.errors,r);return(0,B.jsx)(L3.LocalizationProvider,{dateAdapter:d3.AdapterDayjs,children:(0,B.jsx)(L2.Controller,{control:s.control,name:r,rules:C,defaultValue:i,shouldUnregister:e,render:({field:{value:f,onChange:M}})=>(0,B.jsxs)(t3.Grid,{display:"flex",flexDirection:"column",children:[c&&(0,B.jsx)(y,{label:c,required:l}),(0,B.jsx)(s3.TimePicker,V(o({value:f!=null?f:null,onChange:M},n),{renderInput:H=>{var d,L;return(0,B.jsx)(V3.TextField,V(o(V(o({variant:"outlined"},H),{error:Boolean(x)}),t),{inputProps:V(o({},H.inputProps),{placeholder:a||((d=H.inputProps)==null?void 0:d.placeholder)}),InputProps:V(o({},H.InputProps),{endAdornment:(0,B.jsx)(H3,{size:t.size,children:(L=H.InputProps)==null?void 0:L.endAdornment})})}))}})),(0,B.jsx)(h,{name:r})]})})})},a3=R3;var a2=require("react-hook-form"),M2=require("@mui/material"),M3=require("@s_mart/core");var q=require("react/jsx-runtime"),c3=require("react"),U3=p=>{var m=p,{name:C,defaultValue:i,rules:e,shouldUnregister:r,label:l,required:c,onInputChange:n,onChange:a}=m,t=u(m,["name","defaultValue","rules","shouldUnregister","label","required","onInputChange","onChange"]);let s=(0,a2.useFormContext)();if(!s)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(s.formState.errors,C);return console.warn=()=>{},(0,q.jsx)(a2.Controller,{name:C,control:s.control,defaultValue:i,rules:e,shouldUnregister:r,render:({field:f})=>(0,q.jsxs)(M3.Grid,{display:"flex",flexDirection:"column",children:[l&&(0,q.jsx)(y,{label:l,required:c}),(0,q.jsx)(M2.Autocomplete,V(o({onChange:(M,H)=>{f.onChange(H),a==null||a(M,H,s.watch())},onInputChange:(M,H,d)=>{f.onChange(H),setTimeout(()=>{n==null||n(M,s.watch(C),d,s.watch())},0)},isOptionEqualToValue:(M,H)=>M.value===H.value,renderOption:(M,H)=>(0,c3.createElement)("li",V(o({},M),{key:H.key||H.value,onClick:d=>{var L;(L=M.onClick)==null||L.call(M,d),f.onChange(H)}}),H.label),value:f.value||null},t),{renderInput:M=>{var H,d,L;return(0,q.jsx)(M2.TextField,V(o(o({},M),t.textFieldProps),{error:Boolean(x),InputProps:V(o(o({},M.InputProps),(H=t.textFieldProps)==null?void 0:H.InputProps),{inputProps:o(o({},M.inputProps),(L=(d=t.textFieldProps)==null?void 0:d.InputProps)==null?void 0:L.inputProps)})}))}})),(0,q.jsx)(h,{name:C})]})})},Z3=U3;0&&(module.exports={Autocomplete,Checkbox,Creatable,DatePicker,Form,RadioButton,RadioGroup,Searchable,Select,Slider,Switch,TextField,TimePicker});
82
+ `;var A=require("react/jsx-runtime"),R3=a=>{var m=a,{rules:C,defaultValue:i,shouldUnregister:e,name:r,required:n,label:p,timePickerProps:H,placeholder:L}=m,t=u(m,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder"]);let d=(0,L2.useFormContext)();if(!d)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let g=b(d.formState.errors,r);return(0,A.jsx)(L3.LocalizationProvider,{dateAdapter:d3.AdapterDayjs,children:(0,A.jsx)(L2.Controller,{control:d.control,name:r,rules:C,defaultValue:i,shouldUnregister:e,render:({field:{value:M,onChange:Z}})=>(0,A.jsxs)(t3.Grid,{display:"flex",flexDirection:"column",children:[p&&(0,A.jsx)(y,{label:p,required:n}),(0,A.jsx)(s3.TimePicker,s(o({value:M!=null?M:null,onChange:Z},H),{renderInput:V=>{var F,l;return(0,A.jsx)(V3.TextField,s(o(s(o({variant:"outlined"},V),{error:Boolean(g)}),t),{inputProps:s(o({},V.inputProps),{placeholder:L||((F=V.inputProps)==null?void 0:F.placeholder)}),InputProps:s(o({},V.InputProps),{endAdornment:(0,A.jsx)(H3,{size:t.size,children:(l=V.InputProps)==null?void 0:l.endAdornment})})}))}})),(0,A.jsx)(P,{name:r})]})})})},a3=R3;var a2=require("react-hook-form"),M2=require("@mui/material"),M3=require("@s_mart/core");var R=require("react/jsx-runtime"),c3=require("react"),U3=a=>{var m=a,{name:C,defaultValue:i,rules:e,shouldUnregister:r,label:n,required:p,onInputChange:H,onChange:L}=m,t=u(m,["name","defaultValue","rules","shouldUnregister","label","required","onInputChange","onChange"]);let d=(0,a2.useFormContext)();if(!d)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let g=b(d.formState.errors,C);return console.warn=()=>{},(0,R.jsx)(a2.Controller,{name:C,control:d.control,defaultValue:i,rules:e,shouldUnregister:r,render:({field:M})=>(0,R.jsxs)(M3.Grid,{display:"flex",flexDirection:"column",children:[n&&(0,R.jsx)(y,{label:n,required:p}),(0,R.jsx)(M2.Autocomplete,s(o({onChange:(Z,V)=>{M.onChange(V),L==null||L(Z,V,d.watch())},onInputChange:(Z,V,F)=>{M.onChange(V),setTimeout(()=>{H==null||H(Z,d.watch(C),F,d.watch())},0)},isOptionEqualToValue:(Z,V)=>Z.value===V.value,renderOption:(Z,V)=>(0,c3.createElement)("li",s(o({},Z),{key:V.key||V.value,onClick:F=>{var l;(l=Z.onClick)==null||l.call(Z,F),M.onChange(V)}}),V.label),value:M.value||null},t),{renderInput:Z=>{var V,F,l;return(0,R.jsx)(M2.TextField,s(o(o({},Z),t.textFieldProps),{error:Boolean(g),InputProps:s(o(o({},Z.InputProps),(V=t.textFieldProps)==null?void 0:V.InputProps),{inputProps:o(o({},Z.inputProps),(l=(F=t.textFieldProps)==null?void 0:F.InputProps)==null?void 0:l.inputProps)})}))}})),(0,R.jsx)(P,{name:C})]})})},Z3=U3;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 M2=Object.defineProperty,Z2=Object.defineProperties;var c2=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;var j=(C,i,o)=>i in C?M2(C,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):C[i]=o,e=(C,i)=>{for(var o in i||(i={}))W.call(i,o)&&j(C,o,i[o]);if(U)for(var o of U(i))Y.call(i,o)&&j(C,o,i[o]);return C},V=(C,i)=>Z2(C,c2(i));var u=(C,i)=>{var o={};for(var r in C)W.call(C,r)&&i.indexOf(r)<0&&(o[r]=C[r]);if(C!=null&&U)for(var r of U(C))i.indexOf(r)<0&&Y.call(C,r)&&(o[r]=C[r]);return o};import{useEffect as p2}from"react";import{FormProvider as m2,useForm as u2}from"react-hook-form";import{jsx as K}from"react/jsx-runtime";function f2(H){var c=H,{children:C,onSubmit:i,style:o}=c,r=u(c,["children","onSubmit","style"]);let l=u2(r);p2(()=>{l.reset(r.defaultValues)},[r.defaultValues,l.reset]);let a=()=>typeof C=="function"?C(V(e({},l),{onSubmit:l.handleSubmit(t=>i(t,l))})):C;return K(m2,V(e({},l),{children:K("form",{onSubmit:t=>{t.preventDefault(),t.stopPropagation(),l.handleSubmit(p=>i(p,l))()},style:o,children:a()})}))}var g2=f2;import{useState as b2}from"react";import{Controller as w2,useFormContext as k2}from"react-hook-form";import{Grid as v2,InputAdornment as S2,TextField as B2}from"@mui/material";var Q={description:"M39.0611 23.1367C36.3276 17.015 30.4051 13.2479 24.027 13.0909C17.4971 13.2479 11.5746 17.172 8.84117 23.1367C8.68931 23.6076 8.68931 24.2355 8.84117 24.8633C11.5746 30.985 17.4971 34.7521 23.8752 34.9091C30.4051 34.7521 36.1757 30.828 38.9092 24.8633C39.3648 24.2355 39.3648 23.6076 39.0611 23.1367ZM24.027 32.0837C19.6231 31.9268 16.2822 28.1596 16.4341 23.6076C16.586 19.3695 19.9269 15.7593 24.027 15.7593C28.4309 15.9163 31.7718 19.6835 31.62 24.2355C31.4681 28.4735 28.1272 32.0837 24.027 32.0837ZM24.027 18.5847C23.5715 18.5847 23.1159 18.7417 22.6603 18.7417C23.4196 19.8404 23.2677 21.2531 22.3566 22.3519C21.4454 23.2937 20.0787 23.2937 19.0157 22.5088C18.5601 24.7063 19.3194 27.2178 21.1417 28.4735C22.964 29.7292 25.3938 29.7292 27.0642 28.3165C28.7347 26.9039 29.494 24.3924 28.7347 22.1949C28.1272 19.9974 26.1531 18.5847 24.027 18.5847Z",viewBox:"0 0 48 48",id:"line-eye-solid"},J={description:"M23.9998 31.7412C19.9223 31.7412 16.6215 28.5851 16.3177 24.5854L10.6785 20.2272C9.93715 21.1573 9.25496 22.1405 8.70447 23.2157C8.58149 23.4589 8.51742 23.7277 8.51742 24.0003C8.51742 24.2729 8.58149 24.5416 8.70447 24.7849C11.6198 30.4731 17.3913 34.3216 23.9998 34.3216C25.4465 34.3216 26.842 34.1066 28.1871 33.7593L25.3976 31.6009C24.9369 31.6899 24.469 31.7369 23.9998 31.7412ZM40.8703 34.8646L34.9273 30.2715C36.7326 28.7501 38.2174 26.8848 39.2952 24.7843C39.4182 24.5411 39.4823 24.2723 39.4823 23.9997C39.4823 23.7272 39.4182 23.4584 39.2952 23.2151C36.3799 17.5269 30.6084 13.6784 23.9998 13.6784C21.2321 13.6817 18.5093 14.3785 16.0801 15.7051L9.24098 10.419C9.15179 10.3496 9.04981 10.2985 8.94085 10.2685C8.83189 10.2385 8.7181 10.2303 8.60597 10.2443C8.49384 10.2584 8.38557 10.2944 8.28736 10.3502C8.18914 10.4061 8.1029 10.4808 8.03356 10.5701L6.97828 11.9285C6.8383 12.1086 6.77557 12.3369 6.8039 12.5633C6.83223 12.7896 6.94929 12.9954 7.12934 13.1354L38.7587 37.581C38.8479 37.6504 38.9499 37.7016 39.0588 37.7315C39.1678 37.7615 39.2816 37.7697 39.3937 37.7557C39.5058 37.7416 39.6141 37.7057 39.7123 37.6498C39.8105 37.5939 39.8968 37.5192 39.9661 37.43L41.0219 36.0715C41.1619 35.8913 41.2245 35.663 41.1961 35.4366C41.1676 35.2103 41.0505 35.0045 40.8703 34.8646ZM30.9938 27.2309L28.8811 25.5977C29.059 25.0835 29.1534 24.5441 29.1606 24C29.1711 23.2034 28.9947 22.4155 28.6454 21.6995C28.2962 20.9836 27.7838 20.3595 27.1496 19.8774C26.5154 19.3953 25.777 19.0687 24.9937 18.9238C24.2103 18.7788 23.4039 18.8197 22.6392 19.0429C22.9634 19.4822 23.1387 20.0135 23.1397 20.5595C23.1317 20.7411 23.1039 20.9214 23.0569 21.097L19.0997 18.0387C20.4743 16.89 22.2085 16.2601 23.9998 16.2588C25.0166 16.2582 26.0235 16.4581 26.9629 16.8469C27.9024 17.2357 28.756 17.8059 29.475 18.5249C30.1939 19.2438 30.7641 20.0974 31.1529 21.0369C31.5418 21.9764 31.7416 22.9833 31.7411 24C31.7411 25.1628 31.4567 26.246 30.9938 27.2309Z",viewBox:"0 0 48 48",id:"line-eye-slash-solid"};var X={description:"M35.8286 21.8493H26.1506V12.1714C26.1506 11.6338 25.613 11.0961 25.0753 11.0961H22.9247C22.3198 11.0961 21.8493 11.6338 21.8493 12.1714V21.8493H12.1714C11.5666 21.8493 11.0961 22.387 11.0961 22.9247V25.0753C11.0961 25.6802 11.5666 26.1506 12.1714 26.1506H21.8493V35.8286C21.8493 36.4334 22.3198 36.9039 22.9247 36.9039H25.0753C25.613 36.9039 26.1506 36.4334 26.1506 35.8286V26.1506H35.8286C36.3662 26.1506 36.9039 25.6802 36.9039 25.0753V22.9247C36.9039 22.387 36.3662 21.8493 35.8286 21.8493Z",viewBox:"0 0 48 48",id:"line-plus-solid"};import*as T from"@s_mart/masks";import{Typography as C2}from"@mui/material";import{toRem as x2}from"@s_mart/utils";import{jsx as i2,jsxs as y2}from"react/jsx-runtime";var y=({label:C,required:i,regular:o})=>y2("span",{style:{display:"flex",alignItems:"center",gap:x2(2)},children:[i2(C2,{variant:"caption",fontWeight:o?400:700,style:{display:"flex",alignItems:"center"},children:C}),i&&i2(C2,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});import{useFormContext as h2}from"react-hook-form";import{Indicator as F2}from"@s_mart/core";var P=(C,i)=>{var o,r,H,c;if(C[i])return C[i];if(i.includes("[")){let[l,a]=i.split("["),[t,p]=a.split("].");return(r=(o=C[l])==null?void 0:o[t])==null?void 0:r[p]}if(i.includes(".")){let[l,a,t]=i.split(".");return(c=(H=C[l])==null?void 0:H[a])==null?void 0:c[t]}};import{jsx as P2}from"react/jsx-runtime";var h=({name:C})=>{var r;let i=h2(),o=P((r=i==null?void 0:i.formState)==null?void 0:r.errors,C);return o?P2(F2,{severity:"error",children:o==null?void 0:o.message}):null};import{LIcon as A2}from"@s_mart/core";import{jsx as E,jsxs as D2}from"react/jsx-runtime";var T2=m=>{var s=m,{name:C,rules:i,defaultValue:o,shouldUnregister:r,label:H,required:c,mask:l,variant:a="outlined",onInputChange:t}=s,p=u(s,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","onInputChange"]);let x=k2();if(!x)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[f,M]=b2(!1),n=F=>{var g;return l?(g=T==null?void 0:T[l])==null?void 0:g.format(F):F},d=F=>{var g;return l?(g=T==null?void 0:T[l])==null?void 0:g.parse(F):F},L=F=>{if(!F||l!=="porcentagem")return;F==null||F.stopPropagation();let g=(F==null?void 0:F.target).value;if(g){let Z=String(g);if(Z.length>0){let I=Z.indexOf("%");I>-1&&(F.currentTarget.selectionEnd=I)}}},A=P(x.formState.errors,C);return E(w2,{control:x.control,name:C,rules:i,defaultValue:o,shouldUnregister:r,render:({field:{value:F,onChange:g}})=>D2(v2,{display:"flex",flexDirection:"column",children:[H&&E(y,{label:H,required:c}),E(B2,V(e({variant:a,autoComplete:"off",defaultValue:o,value:n(F||""),onChange:Z=>{var I,N;g(d((I=Z==null?void 0:Z.target)==null?void 0:I.value)),t==null||t(Z,(N=Z==null?void 0:Z.target)==null?void 0:N.value,x.watch())},error:Boolean(A)},p),{type:p.type==="password"?f?"text":"password":p.type,InputProps:e({onKeyDown:L,endAdornment:p.type==="password"&&E(S2,{position:"end",onClick:()=>M(!f),style:{cursor:"pointer"},children:E(A2,{icon:f?Q:J,size:"24px",removeMargin:!0})})},p.InputProps)})),E(h,{name:C})]})})},E2=T2;import{Controller as I2,useFormContext as G2}from"react-hook-form";import{Grid as $2,Select as q2,MenuItem as e2,useTheme as R2}from"@mui/material";import{jsx as D,jsxs as o2}from"react/jsx-runtime";var U2=m=>{var s=m,{name:C,rules:i,defaultValue:o,shouldUnregister:r,label:H,required:c,options:l,placeholder:a,onInputChange:t}=s,p=u(s,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","onInputChange"]);let x=G2(),{palette:f}=R2();if(!x)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let M=P(x.formState.errors,C);return console.warn=()=>{},D(I2,{control:x.control,name:C,rules:i,defaultValue:o||"",shouldUnregister:r,render:({field:{value:n,onChange:d}})=>o2($2,{display:"flex",flexDirection:"column",children:[H&&D(y,{label:H,required:c}),o2(q2,V(e({displayEmpty:Boolean(a),variant:"outlined",autoComplete:"off",value:n||"",onChange:L=>{d(L.target.value),t==null||t(L,L.target.value,x.watch())},error:Boolean(M),size:p.size||"medium"},p),{children:[a&&D(e2,{disabled:!0,value:"",children:D("p",{style:{color:f.grey[400]},children:a})}),l==null?void 0:l.map((L,A)=>D(e2,{value:L.value,children:L.label},A))]})),D(h,{name:C})]})})},z2=U2;import{Controller as O2,useFormContext as _2}from"react-hook-form";import{Grid as N2,Autocomplete as j2,TextField as W2}from"@mui/material";import{jsx as G,jsxs as Q2}from"react/jsx-runtime";import{createElement as r2}from"react";var Y2=p=>{var m=p,{name:C,rules:i,defaultValue:o,shouldUnregister:r,label:H,required:c,options:l,textFieldProps:a}=m,t=u(m,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps"]);let s=_2();if(!s)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(s.formState.errors,C);return console.warn=()=>{},G(O2,{control:s.control,name:C,rules:i,defaultValue:o,shouldUnregister:r,render:({field:{onChange:f,value:M}})=>Q2(N2,{display:"flex",flexDirection:"column",children:[H&&G(y,{label:H,required:c}),G(j2,V(e({onChange:(n,d)=>f(d),value:M||null,options:l,noOptionsText:"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(n,d)=>typeof n=="string"&&typeof d=="string"?n===d:typeof n=="object"&&typeof d=="object"?n.value===d.value:!1,renderOption:(n,d)=>typeof d=="object"?r2("li",V(e({},n),{key:d.key||d.value}),d.label):r2("li",V(e({},n),{key:d}),d)},t),{renderInput:n=>G(W2,e(e({error:Boolean(x)},n),a))})),G(h,{name:C})]})})},K2=Y2;import{Controller as X2,useFormContext as C3}from"react-hook-form";import{Grid as i3,Autocomplete as e3,TextField as o3,Typography as r3}from"@mui/material";import{toRem as v}from"@s_mart/utils";import l2 from"@emotion/styled";import{css as n2}from"@emotion/react";var H2=n2`
1
+ var M2=Object.defineProperty,Z2=Object.defineProperties;var c2=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable;var j=(C,i,o)=>i in C?M2(C,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):C[i]=o,e=(C,i)=>{for(var o in i||(i={}))W.call(i,o)&&j(C,o,i[o]);if(U)for(var o of U(i))Y.call(i,o)&&j(C,o,i[o]);return C},s=(C,i)=>Z2(C,c2(i));var u=(C,i)=>{var o={};for(var l in C)W.call(C,l)&&i.indexOf(l)<0&&(o[l]=C[l]);if(C!=null&&U)for(var l of U(C))i.indexOf(l)<0&&Y.call(C,l)&&(o[l]=C[l]);return o};import{useEffect as p2}from"react";import{FormProvider as m2,useForm as u2}from"react-hook-form";import{jsx as K}from"react/jsx-runtime";function f2(t){var p=t,{children:C,onSubmit:i,style:o}=p,l=u(p,["children","onSubmit","style"]);let n=u2(l);p2(()=>{n.reset(l.defaultValues)},[l.defaultValues,n.reset]);let L=()=>typeof C=="function"?C(s(e({},n),{onSubmit:n.handleSubmit(H=>i(H,n))})):C;return K(m2,s(e({},n),{children:K("form",{onSubmit:H=>{H.preventDefault(),H.stopPropagation(),n.handleSubmit(a=>i(a,n))()},style:o,children:L()})}))}var g2=f2;import{useState as b2}from"react";import{Controller as w2,useFormContext as k2}from"react-hook-form";import{Grid as v2,InputAdornment as S2,TextField as B2}from"@mui/material";var Q={description:"M39.0611 23.1367C36.3276 17.015 30.4051 13.2479 24.027 13.0909C17.4971 13.2479 11.5746 17.172 8.84117 23.1367C8.68931 23.6076 8.68931 24.2355 8.84117 24.8633C11.5746 30.985 17.4971 34.7521 23.8752 34.9091C30.4051 34.7521 36.1757 30.828 38.9092 24.8633C39.3648 24.2355 39.3648 23.6076 39.0611 23.1367ZM24.027 32.0837C19.6231 31.9268 16.2822 28.1596 16.4341 23.6076C16.586 19.3695 19.9269 15.7593 24.027 15.7593C28.4309 15.9163 31.7718 19.6835 31.62 24.2355C31.4681 28.4735 28.1272 32.0837 24.027 32.0837ZM24.027 18.5847C23.5715 18.5847 23.1159 18.7417 22.6603 18.7417C23.4196 19.8404 23.2677 21.2531 22.3566 22.3519C21.4454 23.2937 20.0787 23.2937 19.0157 22.5088C18.5601 24.7063 19.3194 27.2178 21.1417 28.4735C22.964 29.7292 25.3938 29.7292 27.0642 28.3165C28.7347 26.9039 29.494 24.3924 28.7347 22.1949C28.1272 19.9974 26.1531 18.5847 24.027 18.5847Z",viewBox:"0 0 48 48",id:"line-eye-solid"},J={description:"M23.9998 31.7412C19.9223 31.7412 16.6215 28.5851 16.3177 24.5854L10.6785 20.2272C9.93715 21.1573 9.25496 22.1405 8.70447 23.2157C8.58149 23.4589 8.51742 23.7277 8.51742 24.0003C8.51742 24.2729 8.58149 24.5416 8.70447 24.7849C11.6198 30.4731 17.3913 34.3216 23.9998 34.3216C25.4465 34.3216 26.842 34.1066 28.1871 33.7593L25.3976 31.6009C24.9369 31.6899 24.469 31.7369 23.9998 31.7412ZM40.8703 34.8646L34.9273 30.2715C36.7326 28.7501 38.2174 26.8848 39.2952 24.7843C39.4182 24.5411 39.4823 24.2723 39.4823 23.9997C39.4823 23.7272 39.4182 23.4584 39.2952 23.2151C36.3799 17.5269 30.6084 13.6784 23.9998 13.6784C21.2321 13.6817 18.5093 14.3785 16.0801 15.7051L9.24098 10.419C9.15179 10.3496 9.04981 10.2985 8.94085 10.2685C8.83189 10.2385 8.7181 10.2303 8.60597 10.2443C8.49384 10.2584 8.38557 10.2944 8.28736 10.3502C8.18914 10.4061 8.1029 10.4808 8.03356 10.5701L6.97828 11.9285C6.8383 12.1086 6.77557 12.3369 6.8039 12.5633C6.83223 12.7896 6.94929 12.9954 7.12934 13.1354L38.7587 37.581C38.8479 37.6504 38.9499 37.7016 39.0588 37.7315C39.1678 37.7615 39.2816 37.7697 39.3937 37.7557C39.5058 37.7416 39.6141 37.7057 39.7123 37.6498C39.8105 37.5939 39.8968 37.5192 39.9661 37.43L41.0219 36.0715C41.1619 35.8913 41.2245 35.663 41.1961 35.4366C41.1676 35.2103 41.0505 35.0045 40.8703 34.8646ZM30.9938 27.2309L28.8811 25.5977C29.059 25.0835 29.1534 24.5441 29.1606 24C29.1711 23.2034 28.9947 22.4155 28.6454 21.6995C28.2962 20.9836 27.7838 20.3595 27.1496 19.8774C26.5154 19.3953 25.777 19.0687 24.9937 18.9238C24.2103 18.7788 23.4039 18.8197 22.6392 19.0429C22.9634 19.4822 23.1387 20.0135 23.1397 20.5595C23.1317 20.7411 23.1039 20.9214 23.0569 21.097L19.0997 18.0387C20.4743 16.89 22.2085 16.2601 23.9998 16.2588C25.0166 16.2582 26.0235 16.4581 26.9629 16.8469C27.9024 17.2357 28.756 17.8059 29.475 18.5249C30.1939 19.2438 30.7641 20.0974 31.1529 21.0369C31.5418 21.9764 31.7416 22.9833 31.7411 24C31.7411 25.1628 31.4567 26.246 30.9938 27.2309Z",viewBox:"0 0 48 48",id:"line-eye-slash-solid"};var X={description:"M35.8286 21.8493H26.1506V12.1714C26.1506 11.6338 25.613 11.0961 25.0753 11.0961H22.9247C22.3198 11.0961 21.8493 11.6338 21.8493 12.1714V21.8493H12.1714C11.5666 21.8493 11.0961 22.387 11.0961 22.9247V25.0753C11.0961 25.6802 11.5666 26.1506 12.1714 26.1506H21.8493V35.8286C21.8493 36.4334 22.3198 36.9039 22.9247 36.9039H25.0753C25.613 36.9039 26.1506 36.4334 26.1506 35.8286V26.1506H35.8286C36.3662 26.1506 36.9039 25.6802 36.9039 25.0753V22.9247C36.9039 22.387 36.3662 21.8493 35.8286 21.8493Z",viewBox:"0 0 48 48",id:"line-plus-solid"};import*as T from"@s_mart/masks";import{Typography as C2}from"@mui/material";import{toRem as x2}from"@s_mart/utils";import{jsx as i2,jsxs as y2}from"react/jsx-runtime";var y=({label:C,required:i,regular:o})=>y2("span",{style:{display:"flex",alignItems:"center",gap:x2(2)},children:[i2(C2,{variant:"caption",fontWeight:o?400:700,style:{display:"flex",alignItems:"center"},children:C}),i&&i2(C2,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});import{useFormContext as F2}from"react-hook-form";import{Indicator as h2}from"@s_mart/core";var b=(C,i)=>{var o,l,t,p;if(C[i])return C[i];if(i.includes("[")){let[n,L]=i.split("["),[H,a]=L.split("].");return(l=(o=C[n])==null?void 0:o[H])==null?void 0:l[a]}if(i.includes(".")){let[n,L,H]=i.split(".");return(p=(t=C[n])==null?void 0:t[L])==null?void 0:p[H]}};import{jsx as P2}from"react/jsx-runtime";var P=({name:C})=>{var l;let i=F2(),o=b((l=i==null?void 0:i.formState)==null?void 0:l.errors,C);return o?P2(h2,{severity:"error",children:o==null?void 0:o.message}):null};import{LIcon as A2}from"@s_mart/core";import{jsx as E,jsxs as D2}from"react/jsx-runtime";var T2=m=>{var d=m,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:t,required:p,mask:n,variant:L="outlined",onInputChange:H}=d,a=u(d,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","onInputChange"]);let g=k2();if(!g)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[M,Z]=b2(!1),V=h=>{var f;return n?(f=T==null?void 0:T[n])==null?void 0:f.format(h):h},F=h=>{var f;return n?(f=T==null?void 0:T[n])==null?void 0:f.parse(h):h},r=h=>{if(!h||n!=="porcentagem")return;h==null||h.stopPropagation();let f=(h==null?void 0:h.target).value;if(f){let c=String(f);if(c.length>0){let G=c.indexOf("%");G>-1&&(h.currentTarget.selectionEnd=G)}}},x=b(g.formState.errors,C);return E(w2,{control:g.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:h,onChange:f}})=>D2(v2,{display:"flex",flexDirection:"column",children:[t&&E(y,{label:t,required:p}),E(B2,s(e({variant:L,autoComplete:"off",defaultValue:o,value:V(h||""),onChange:c=>{var G,N;f(F((G=c==null?void 0:c.target)==null?void 0:G.value)),H==null||H(c,(N=c==null?void 0:c.target)==null?void 0:N.value,g.watch())},error:Boolean(x)},a),{type:a.type==="password"?M?"text":"password":a.type,InputProps:e({onKeyDown:r,endAdornment:a.type==="password"&&E(S2,{position:"end",onClick:()=>Z(!M),style:{cursor:"pointer"},children:E(A2,{icon:M?Q:J,size:"24px",removeMargin:!0})})},a.InputProps)})),E(P,{name:C})]})})},E2=T2;import{Controller as G2,useFormContext as $2}from"react-hook-form";import{Grid as I2,Select as q2,MenuItem as e2,useTheme as R2}from"@mui/material";import{jsx as D,jsxs as o2}from"react/jsx-runtime";var U2=m=>{var d=m,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:t,required:p,options:n,placeholder:L,onInputChange:H}=d,a=u(d,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","onInputChange"]);let g=$2(),{palette:M}=R2();if(!g)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let Z=b(g.formState.errors,C);return console.warn=()=>{},D(G2,{control:g.control,name:C,rules:i,defaultValue:o||"",shouldUnregister:l,render:({field:{value:V,onChange:F}})=>o2(I2,{display:"flex",flexDirection:"column",children:[t&&D(y,{label:t,required:p}),o2(q2,s(e({displayEmpty:Boolean(L),variant:"outlined",autoComplete:"off",value:V||"",onChange:r=>{F(r.target.value),H==null||H(r,r.target.value,g.watch())},error:Boolean(Z),size:a.size||"medium"},a),{children:[L&&D(e2,{disabled:!0,value:"",children:D("p",{style:{color:M.grey[400]},children:L})}),n==null?void 0:n.map((r,x)=>D(e2,{value:r.value,children:r.label},x))]})),D(P,{name:C})]})})},z2=U2;import{Controller as O2,useFormContext as _2}from"react-hook-form";import{Grid as N2,Autocomplete as j2,TextField as W2}from"@mui/material";import{jsx as $,jsxs as Q2}from"react/jsx-runtime";import{createElement as r2}from"react";var Y2=d=>{var g=d,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:t,required:p,options:n,textFieldProps:L,onChange:H,onInputChange:a}=g,m=u(g,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","onChange","onInputChange"]);let M=_2();if(!M)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let Z=b(M.formState.errors,C);return console.warn=()=>{},$(O2,{control:M.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{onChange:V,value:F}})=>Q2(N2,{display:"flex",flexDirection:"column",children:[t&&$(y,{label:t,required:p}),$(j2,s(e({onChange:(r,x)=>{V(x),H==null||H(r,x,M.watch())},onInputChange:(r,x,h)=>{V(x),setTimeout(()=>{a==null||a(r,M.watch(C),h,M.watch())},0)},value:F||null,options:n,noOptionsText:"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(r,x)=>typeof r=="string"&&typeof x=="string"?r===x:typeof r=="object"&&typeof x=="object"?r.value===x.value:!1,renderOption:(r,x)=>typeof x=="object"?r2("li",s(e({},r),{key:x.key||x.value}),x.label):r2("li",s(e({},r),{key:x}),x)},m),{renderInput:r=>$(W2,e(e({error:Boolean(Z)},r),L))})),$(P,{name:C})]})})},K2=Y2;import{Controller as X2,useFormContext as C3}from"react-hook-form";import{Grid as i3,Autocomplete as e3,TextField as o3,Typography as r3}from"@mui/material";import{toRem as S}from"@s_mart/utils";import l2 from"@emotion/styled";import{css as n2}from"@emotion/react";var H2=n2`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
@@ -13,7 +13,7 @@ var M2=Object.defineProperty,Z2=Object.defineProperties;var c2=Object.getOwnProp
13
13
 
14
14
  .divider {
15
15
  width: 1px;
16
- height: ${v(20)};
16
+ height: ${S(20)};
17
17
  background-color: ${C.palette.grey[400]};
18
18
  }
19
19
 
@@ -24,9 +24,9 @@ var M2=Object.defineProperty,Z2=Object.defineProperties;var c2=Object.getOwnProp
24
24
  color: ${C.palette.grey[600]};
25
25
  border-radius: 50%;
26
26
 
27
- margin: 0 ${v(6)};
28
- width: ${v(28)};
29
- height: ${v(28)};
27
+ margin: 0 ${S(6)};
28
+ width: ${S(28)};
29
+ height: ${S(28)};
30
30
 
31
31
  &:hover {
32
32
  cursor: pointer;
@@ -49,18 +49,18 @@ var M2=Object.defineProperty,Z2=Object.defineProperties;var c2=Object.getOwnProp
49
49
  `,s2=l2.div`
50
50
  color: ${({theme:C})=>C.palette.text.primary};
51
51
 
52
- padding: ${v(6)} ${v(16)};
53
- margin: ${v(-6)} ${v(-16)};
52
+ padding: ${S(6)} ${S(16)};
53
+ margin: ${S(-6)} ${S(-16)};
54
54
 
55
55
  &:hover {
56
56
  cursor: pointer;
57
57
  transition: background-color 0.2s ease-in-out;
58
58
  background-color: ${({theme:C})=>C.palette.grey[100]};
59
59
  }
60
- `;import{LIcon as l3}from"@s_mart/core";import{jsx as b,jsxs as z}from"react/jsx-runtime";import{createElement as V2}from"react";var n3=x=>{var f=x,{name:C,rules:i,defaultValue:o,shouldUnregister:r,label:H,required:c,options:l,onCreateOption:a,textFieldProps:t,hideAddButton:p,onInputChange:m}=f,s=u(f,["name","rules","defaultValue","shouldUnregister","label","required","options","onCreateOption","textFieldProps","hideAddButton","onInputChange"]);let M=C3();if(!M)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let n=P(M.formState.errors,C);console.warn=()=>{};let d=L=>{a?a(L):console.error("onCreateOption n\xE3o foi definido")};return b(X2,{control:M.control,name:C,rules:i,defaultValue:o,shouldUnregister:r,render:({field:{value:L,onChange:A}})=>{let F=(L==null?void 0:L.label)||(L==null?void 0:L.value)||L;return z(i3,{display:"flex",flexDirection:"column",children:[H&&b(y,{label:H,required:c}),b(t2,{hideAddButton:p,children:b(e3,V(e({fullWidth:!0,onChange:(g,Z)=>(m==null||m(Z,M.watch()),A(Z)),options:l,value:L||null,noOptionsText:b(s2,{onClick:()=>d(L),children:z(r3,{children:["Adicionar ",F&&`"${F}"`]})}),isOptionEqualToValue:(g,Z)=>Z?typeof g=="string"&&typeof Z=="string"?g===Z:typeof g=="object"&&typeof Z=="object"?g.value===Z.value:typeof g=="object"&&typeof Z=="string":!1,renderOption:(g,Z)=>typeof Z=="object"?V2("li",V(e({},g),{key:Z.key||Z.value}),Z.label):V2("li",V(e({},g),{key:Z}),Z)},s),{renderInput:g=>{let Z=p?g.InputProps:V(e({},g.InputProps),{endAdornment:z("div",{className:"endAdornments",children:[g.InputProps.endAdornment,z("div",{className:"creatable",children:[b("div",{className:"divider"}),b("div",{className:"button",onClick:()=>d(L),children:b(l3,{icon:X,size:"24px",removeMargin:!0})})]})]})});return b(o3,e(V(e({},g),{error:Boolean(n),onChange:A,InputProps:Z}),t))}}))}),b(h,{name:C})]})}})},H3=n3;import{Controller as t3,useFormContext as s3}from"react-hook-form";import{Grid as V3,Checkbox as d3,FormControlLabel as L3}from"@mui/material";import{jsx as $,jsxs as Z3}from"react/jsx-runtime";var a3=t=>{var p=t,{name:C,rules:i,defaultValue:o,shouldUnregister:r,label:H,labelPlacement:c,required:l}=p,a=u(p,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let m=s3();if(!m)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return $(t3,{control:m.control,name:C,rules:i,defaultValue:o,shouldUnregister:r,render:({field:{value:s,onChange:x}})=>Z3(V3,{display:"flex",flexDirection:"column",children:[$(L3,{control:$(d3,e({value:s!=null?s:"",defaultValue:s,onChange:x},a)),label:$(y,{label:H,required:l,regular:!0}),labelPlacement:c||"end"}),$(h,{name:C})]})})},M3=a3;import{Controller as c3,useFormContext as p3}from"react-hook-form";import{Grid as m3,Switch as u3,FormControlLabel as f3}from"@mui/material";import{jsx as q,jsxs as y3}from"react/jsx-runtime";var g3=a=>{var t=a,{name:C,rules:i,defaultValue:o,shouldUnregister:r,label:H,labelPlacement:c}=t,l=u(t,["name","rules","defaultValue","shouldUnregister","label","labelPlacement"]);let p=p3();if(!p)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return q(c3,{control:p.control,name:C,rules:i,defaultValue:o,shouldUnregister:r,render:({field:{value:m,onChange:s}})=>y3(m3,{display:"flex",flexDirection:"column",children:[q(f3,{control:q(u3,e({value:m!=null?m:"",defaultValue:m,onChange:s},l)),label:q(y,{label:H}),labelPlacement:c||"end"}),q(h,{name:C})]})})},x3=g3;import{Grid as h3,Radio as F3,FormControlLabel as P3}from"@mui/material";import{jsx as O}from"react/jsx-runtime";var b3=r=>{var H=r,{label:C,labelPlacement:i}=H,o=u(H,["label","labelPlacement"]);return O(h3,{display:"flex",flexDirection:"column",children:O(P3,{control:O(F3,e({},o)),label:O(y,{label:C}),labelPlacement:i||"end"})})},w3=b3;import{Controller as k3,useFormContext as v3}from"react-hook-form";import{Grid as S3,RadioGroup as B3}from"@mui/material";import{jsx as _,jsxs as E3}from"react/jsx-runtime";var A3=p=>{var m=p,{name:C,rules:i,defaultValue:o,shouldUnregister:r,label:H,required:c,children:l,orientation:a="row"}=m,t=u(m,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation"]);let s=v3();if(!s)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return _(k3,{control:s.control,name:C,rules:i,defaultValue:o,shouldUnregister:r,render:({field:{value:x,onChange:f}})=>E3(S3,{display:"flex",flexDirection:"column",children:[H&&_(y,{label:H,required:c}),_(B3,V(e({value:x||"",onChange:f,name:C},t),{style:{display:"flex",flexDirection:a},children:l})),_(h,{name:C})]})})},T3=A3;import{Controller as D3,useFormContext as I3}from"react-hook-form";import{Slider as G3}from"@mui/material";import{jsx as d2}from"react/jsx-runtime";var $3=c=>{var l=c,{name:C,rules:i,defaultValue:o,shouldUnregister:r}=l,H=u(l,["name","rules","defaultValue","shouldUnregister"]);let a=I3();if(!a)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return d2(D3,{control:a.control,name:C,rules:i,defaultValue:o,shouldUnregister:r,render:({field:{value:t,onChange:p}})=>d2(G3,e({value:t||(H==null?void 0:H.min)||0,onChange:p,valueLabelDisplay:"auto"},H))})},q3=$3;import{Controller as O3,useFormContext as _3}from"react-hook-form";import{Grid as N3}from"@s_mart/core";import{TextField as j3}from"@mui/material";import{DatePicker as W3}from"@mui/x-date-pickers/DatePicker";import{AdapterDayjs as Y3}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as K3}from"@mui/x-date-pickers/LocalizationProvider";import{toRem as w}from"@s_mart/utils";import R3 from"@emotion/styled";var U3=C=>{switch(C){case"small":return w(16);default:case"medium":return w(20);case"large":return w(24)}},z3=C=>{switch(C){case"small":return`${w(2)} ${w(8)}`;default:case"medium":return`${w(6)} ${w(8)}`;case"large":return`${w(10)}`}},L2=R3.div`
60
+ `;import{LIcon as l3}from"@s_mart/core";import{jsx as w,jsxs as z}from"react/jsx-runtime";import{createElement as V2}from"react";var n3=g=>{var M=g,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:t,required:p,options:n,onCreateOption:L,textFieldProps:H,hideAddButton:a,onInputChange:m}=M,d=u(M,["name","rules","defaultValue","shouldUnregister","label","required","options","onCreateOption","textFieldProps","hideAddButton","onInputChange"]);let Z=C3();if(!Z)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let V=b(Z.formState.errors,C);console.warn=()=>{};let F=r=>{L?L(r):console.error("onCreateOption n\xE3o foi definido")};return w(X2,{control:Z.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:r,onChange:x}})=>{let h=(r==null?void 0:r.label)||(r==null?void 0:r.value)||r;return z(i3,{display:"flex",flexDirection:"column",children:[t&&w(y,{label:t,required:p}),w(t2,{hideAddButton:a,children:w(e3,s(e({fullWidth:!0,onChange:(f,c)=>(m==null||m(c,Z.watch()),x(c)),options:n,value:r||null,noOptionsText:w(s2,{onClick:()=>F(r),children:z(r3,{children:["Adicionar ",h&&`"${h}"`]})}),isOptionEqualToValue:(f,c)=>c?typeof f=="string"&&typeof c=="string"?f===c:typeof f=="object"&&typeof c=="object"?f.value===c.value:typeof f=="object"&&typeof c=="string":!1,renderOption:(f,c)=>typeof c=="object"?V2("li",s(e({},f),{key:c.key||c.value}),c.label):V2("li",s(e({},f),{key:c}),c)},d),{renderInput:f=>{let c=a?f.InputProps:s(e({},f.InputProps),{endAdornment:z("div",{className:"endAdornments",children:[f.InputProps.endAdornment,z("div",{className:"creatable",children:[w("div",{className:"divider"}),w("div",{className:"button",onClick:()=>F(r),children:w(l3,{icon:X,size:"24px",removeMargin:!0})})]})]})});return w(o3,e(s(e({},f),{error:Boolean(V),onChange:x,InputProps:c}),H))}}))}),w(P,{name:C})]})}})},H3=n3;import{Controller as t3,useFormContext as s3}from"react-hook-form";import{Grid as V3,Checkbox as d3,FormControlLabel as L3}from"@mui/material";import{jsx as I,jsxs as Z3}from"react/jsx-runtime";var a3=H=>{var a=H,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:t,labelPlacement:p,required:n}=a,L=u(a,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let m=s3();if(!m)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return I(t3,{control:m.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:d,onChange:g}})=>Z3(V3,{display:"flex",flexDirection:"column",children:[I(L3,{control:I(d3,e({value:d!=null?d:"",defaultValue:d,onChange:g},L)),label:I(y,{label:t,required:n,regular:!0}),labelPlacement:p||"end"}),I(P,{name:C})]})})},M3=a3;import{Controller as c3,useFormContext as p3}from"react-hook-form";import{Grid as m3,Switch as u3,FormControlLabel as f3}from"@mui/material";import{jsx as q,jsxs as y3}from"react/jsx-runtime";var g3=L=>{var H=L,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:t,labelPlacement:p}=H,n=u(H,["name","rules","defaultValue","shouldUnregister","label","labelPlacement"]);let a=p3();if(!a)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return q(c3,{control:a.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:m,onChange:d}})=>y3(m3,{display:"flex",flexDirection:"column",children:[q(f3,{control:q(u3,e({value:m!=null?m:"",defaultValue:m,onChange:d},n)),label:q(y,{label:t}),labelPlacement:p||"end"}),q(P,{name:C})]})})},x3=g3;import{Grid as F3,Radio as h3,FormControlLabel as P3}from"@mui/material";import{jsx as O}from"react/jsx-runtime";var b3=l=>{var t=l,{label:C,labelPlacement:i}=t,o=u(t,["label","labelPlacement"]);return O(F3,{display:"flex",flexDirection:"column",children:O(P3,{control:O(h3,e({},o)),label:O(y,{label:C}),labelPlacement:i||"end"})})},w3=b3;import{Controller as k3,useFormContext as v3}from"react-hook-form";import{Grid as S3,RadioGroup as B3}from"@mui/material";import{jsx as _,jsxs as E3}from"react/jsx-runtime";var A3=a=>{var m=a,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:t,required:p,children:n,orientation:L="row"}=m,H=u(m,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation"]);let d=v3();if(!d)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return _(k3,{control:d.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:g,onChange:M}})=>E3(S3,{display:"flex",flexDirection:"column",children:[t&&_(y,{label:t,required:p}),_(B3,s(e({value:g||"",onChange:M,name:C},H),{style:{display:"flex",flexDirection:L},children:n})),_(P,{name:C})]})})},T3=A3;import{Controller as D3,useFormContext as G3}from"react-hook-form";import{Slider as $3}from"@mui/material";import{jsx as d2}from"react/jsx-runtime";var I3=p=>{var n=p,{name:C,rules:i,defaultValue:o,shouldUnregister:l}=n,t=u(n,["name","rules","defaultValue","shouldUnregister"]);let L=G3();if(!L)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return d2(D3,{control:L.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:H,onChange:a}})=>d2($3,e({value:H||(t==null?void 0:t.min)||0,onChange:a,valueLabelDisplay:"auto"},t))})},q3=I3;import{Controller as O3,useFormContext as _3}from"react-hook-form";import{Grid as N3}from"@s_mart/core";import{TextField as j3}from"@mui/material";import{DatePicker as W3}from"@mui/x-date-pickers/DatePicker";import{AdapterDayjs as Y3}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as K3}from"@mui/x-date-pickers/LocalizationProvider";import{toRem as k}from"@s_mart/utils";import R3 from"@emotion/styled";var U3=C=>{switch(C){case"small":return k(16);default:case"medium":return k(20);case"large":return k(24)}},z3=C=>{switch(C){case"small":return`${k(2)} ${k(8)}`;default:case"medium":return`${k(6)} ${k(8)}`;case"large":return`${k(10)}`}},L2=R3.div`
61
61
  > div > button {
62
62
  padding: ${({size:C})=>z3(C)};
63
- border-radius: 0 ${w(4)} ${w(4)} 0;
63
+ border-radius: 0 ${k(4)} ${k(4)} 0;
64
64
 
65
65
  margin: 0px -13px 0px 0px;
66
66
 
@@ -68,10 +68,10 @@ var M2=Object.defineProperty,Z2=Object.defineProperties;var c2=Object.getOwnProp
68
68
  width: ${({size:C})=>U3(C)};
69
69
  }
70
70
  }
71
- `;import{jsx as S,jsxs as X3}from"react/jsx-runtime";var Q3=p=>{var m=p,{rules:C,name:i,defaultValue:o,shouldUnregister:r,datePickerProps:H,label:c,required:l,placeholder:a}=m,t=u(m,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder"]);let s=_3();if(!s)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(s.formState.errors,i);return console.log(x),S(K3,{dateAdapter:Y3,children:S(O3,{control:s.control,name:i,rules:C,defaultValue:o,shouldUnregister:r,render:({field:{value:f,onChange:M}})=>X3(N3,{display:"flex",flexDirection:"column",children:[c&&S(y,{label:c,required:l}),S(W3,V(e({},H),{value:f!=null?f:null,inputFormat:(H==null?void 0:H.inputFormat)||"DD/MM/YYYY",onChange:M,renderInput:n=>{var d,L;return S(j3,V(e(V(e({variant:"outlined"},n),{error:Boolean(x)}),t),{inputProps:V(e({},n.inputProps),{placeholder:a||((d=n.inputProps)==null?void 0:d.placeholder)}),InputProps:V(e({},n.InputProps),{endAdornment:S(L2,{size:t.size,children:(L=n.InputProps)==null?void 0:L.endAdornment})})}))}})),S(h,{name:i})]})})})},J3=Q3;import{Grid as o1}from"@s_mart/core";import{TimePicker as r1}from"@mui/x-date-pickers/TimePicker";import{TextField as l1}from"@mui/material";import{Controller as n1,useFormContext as H1}from"react-hook-form";import{AdapterDayjs as t1}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as s1}from"@mui/x-date-pickers/LocalizationProvider";import{toRem as k}from"@s_mart/utils";import C1 from"@emotion/styled";var i1=C=>{switch(C){case"small":return k(16);default:case"medium":return k(20);case"large":return k(24)}},e1=C=>{switch(C){case"small":return`${k(2)} ${k(8)}`;default:case"medium":return`${k(6)} ${k(8)}`;case"large":return`${k(10)}`}},a2=C1.div`
71
+ `;import{jsx as B,jsxs as X3}from"react/jsx-runtime";var Q3=a=>{var m=a,{rules:C,name:i,defaultValue:o,shouldUnregister:l,datePickerProps:t,label:p,required:n,placeholder:L}=m,H=u(m,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder"]);let d=_3();if(!d)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let g=b(d.formState.errors,i);return console.log(g),B(K3,{dateAdapter:Y3,children:B(O3,{control:d.control,name:i,rules:C,defaultValue:o,shouldUnregister:l,render:({field:{value:M,onChange:Z}})=>X3(N3,{display:"flex",flexDirection:"column",children:[p&&B(y,{label:p,required:n}),B(W3,s(e({},t),{value:M!=null?M:null,inputFormat:(t==null?void 0:t.inputFormat)||"DD/MM/YYYY",onChange:Z,renderInput:V=>{var F,r;return B(j3,s(e(s(e({variant:"outlined"},V),{error:Boolean(g)}),H),{inputProps:s(e({},V.inputProps),{placeholder:L||((F=V.inputProps)==null?void 0:F.placeholder)}),InputProps:s(e({},V.InputProps),{endAdornment:B(L2,{size:H.size,children:(r=V.InputProps)==null?void 0:r.endAdornment})})}))}})),B(P,{name:i})]})})})},J3=Q3;import{Grid as o1}from"@s_mart/core";import{TimePicker as r1}from"@mui/x-date-pickers/TimePicker";import{TextField as l1}from"@mui/material";import{Controller as n1,useFormContext as H1}from"react-hook-form";import{AdapterDayjs as t1}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as s1}from"@mui/x-date-pickers/LocalizationProvider";import{toRem as v}from"@s_mart/utils";import C1 from"@emotion/styled";var i1=C=>{switch(C){case"small":return v(16);default:case"medium":return v(20);case"large":return v(24)}},e1=C=>{switch(C){case"small":return`${v(2)} ${v(8)}`;default:case"medium":return`${v(6)} ${v(8)}`;case"large":return`${v(10)}`}},a2=C1.div`
72
72
  > div > button {
73
73
  padding: ${({size:C})=>e1(C)};
74
- border-radius: 0 ${k(4)} ${k(4)} 0;
74
+ border-radius: 0 ${v(4)} ${v(4)} 0;
75
75
 
76
76
  margin: 0px -13px 0px 0px;
77
77
 
@@ -79,4 +79,4 @@ var M2=Object.defineProperty,Z2=Object.defineProperties;var c2=Object.getOwnProp
79
79
  width: ${({size:C})=>i1(C)};
80
80
  }
81
81
  }
82
- `;import{jsx as B,jsxs as L1}from"react/jsx-runtime";var V1=p=>{var m=p,{rules:C,defaultValue:i,shouldUnregister:o,name:r,required:H,label:c,timePickerProps:l,placeholder:a}=m,t=u(m,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder"]);let s=H1();if(!s)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(s.formState.errors,r);return B(s1,{dateAdapter:t1,children:B(n1,{control:s.control,name:r,rules:C,defaultValue:i,shouldUnregister:o,render:({field:{value:f,onChange:M}})=>L1(o1,{display:"flex",flexDirection:"column",children:[c&&B(y,{label:c,required:H}),B(r1,V(e({value:f!=null?f:null,onChange:M},l),{renderInput:n=>{var d,L;return B(l1,V(e(V(e({variant:"outlined"},n),{error:Boolean(x)}),t),{inputProps:V(e({},n.inputProps),{placeholder:a||((d=n.inputProps)==null?void 0:d.placeholder)}),InputProps:V(e({},n.InputProps),{endAdornment:B(a2,{size:t.size,children:(L=n.InputProps)==null?void 0:L.endAdornment})})}))}})),B(h,{name:r})]})})})},d1=V1;import{Controller as a1,useFormContext as M1}from"react-hook-form";import{Autocomplete as Z1,TextField as c1}from"@mui/material";import{Grid as p1}from"@s_mart/core";import{jsx as R,jsxs as g1}from"react/jsx-runtime";import{createElement as f1}from"react";var m1=p=>{var m=p,{name:C,defaultValue:i,rules:o,shouldUnregister:r,label:H,required:c,onInputChange:l,onChange:a}=m,t=u(m,["name","defaultValue","rules","shouldUnregister","label","required","onInputChange","onChange"]);let s=M1();if(!s)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(s.formState.errors,C);return console.warn=()=>{},R(a1,{name:C,control:s.control,defaultValue:i,rules:o,shouldUnregister:r,render:({field:f})=>g1(p1,{display:"flex",flexDirection:"column",children:[H&&R(y,{label:H,required:c}),R(Z1,V(e({onChange:(M,n)=>{f.onChange(n),a==null||a(M,n,s.watch())},onInputChange:(M,n,d)=>{f.onChange(n),setTimeout(()=>{l==null||l(M,s.watch(C),d,s.watch())},0)},isOptionEqualToValue:(M,n)=>M.value===n.value,renderOption:(M,n)=>f1("li",V(e({},M),{key:n.key||n.value,onClick:d=>{var L;(L=M.onClick)==null||L.call(M,d),f.onChange(n)}}),n.label),value:f.value||null},t),{renderInput:M=>{var n,d,L;return R(c1,V(e(e({},M),t.textFieldProps),{error:Boolean(x),InputProps:V(e(e({},M.InputProps),(n=t.textFieldProps)==null?void 0:n.InputProps),{inputProps:e(e({},M.inputProps),(L=(d=t.textFieldProps)==null?void 0:d.InputProps)==null?void 0:L.inputProps)})}))}})),R(h,{name:C})]})})},u1=m1;export{u1 as Autocomplete,M3 as Checkbox,H3 as Creatable,J3 as DatePicker,g2 as Form,w3 as RadioButton,T3 as RadioGroup,K2 as Searchable,z2 as Select,q3 as Slider,x3 as Switch,E2 as TextField,d1 as TimePicker};
82
+ `;import{jsx as A,jsxs as L1}from"react/jsx-runtime";var V1=a=>{var m=a,{rules:C,defaultValue:i,shouldUnregister:o,name:l,required:t,label:p,timePickerProps:n,placeholder:L}=m,H=u(m,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder"]);let d=H1();if(!d)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let g=b(d.formState.errors,l);return A(s1,{dateAdapter:t1,children:A(n1,{control:d.control,name:l,rules:C,defaultValue:i,shouldUnregister:o,render:({field:{value:M,onChange:Z}})=>L1(o1,{display:"flex",flexDirection:"column",children:[p&&A(y,{label:p,required:t}),A(r1,s(e({value:M!=null?M:null,onChange:Z},n),{renderInput:V=>{var F,r;return A(l1,s(e(s(e({variant:"outlined"},V),{error:Boolean(g)}),H),{inputProps:s(e({},V.inputProps),{placeholder:L||((F=V.inputProps)==null?void 0:F.placeholder)}),InputProps:s(e({},V.InputProps),{endAdornment:A(a2,{size:H.size,children:(r=V.InputProps)==null?void 0:r.endAdornment})})}))}})),A(P,{name:l})]})})})},d1=V1;import{Controller as a1,useFormContext as M1}from"react-hook-form";import{Autocomplete as Z1,TextField as c1}from"@mui/material";import{Grid as p1}from"@s_mart/core";import{jsx as R,jsxs as g1}from"react/jsx-runtime";import{createElement as f1}from"react";var m1=a=>{var m=a,{name:C,defaultValue:i,rules:o,shouldUnregister:l,label:t,required:p,onInputChange:n,onChange:L}=m,H=u(m,["name","defaultValue","rules","shouldUnregister","label","required","onInputChange","onChange"]);let d=M1();if(!d)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let g=b(d.formState.errors,C);return console.warn=()=>{},R(a1,{name:C,control:d.control,defaultValue:i,rules:o,shouldUnregister:l,render:({field:M})=>g1(p1,{display:"flex",flexDirection:"column",children:[t&&R(y,{label:t,required:p}),R(Z1,s(e({onChange:(Z,V)=>{M.onChange(V),L==null||L(Z,V,d.watch())},onInputChange:(Z,V,F)=>{M.onChange(V),setTimeout(()=>{n==null||n(Z,d.watch(C),F,d.watch())},0)},isOptionEqualToValue:(Z,V)=>Z.value===V.value,renderOption:(Z,V)=>f1("li",s(e({},Z),{key:V.key||V.value,onClick:F=>{var r;(r=Z.onClick)==null||r.call(Z,F),M.onChange(V)}}),V.label),value:M.value||null},H),{renderInput:Z=>{var V,F,r;return R(c1,s(e(e({},Z),H.textFieldProps),{error:Boolean(g),InputProps:s(e(e({},Z.InputProps),(V=H.textFieldProps)==null?void 0:V.InputProps),{inputProps:e(e({},Z.inputProps),(r=(F=H.textFieldProps)==null?void 0:F.InputProps)==null?void 0:r.inputProps)})}))}})),R(P,{name:C})]})})},u1=m1;export{u1 as Autocomplete,M3 as Checkbox,H3 as Creatable,J3 as DatePicker,g2 as Form,w3 as RadioButton,T3 as RadioGroup,K2 as Searchable,z2 as Select,q3 as Slider,x3 as Switch,E2 as TextField,d1 as TimePicker};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s_mart/form",
3
- "version": "2.7.3",
3
+ "version": "2.7.5",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",