@s_mart/form 10.0.0-beta.16 → 10.0.0-beta.18

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.mts CHANGED
@@ -38,9 +38,9 @@ declare const _default$6: ({ name, rules, defaultValue, shouldUnregister, contro
38
38
 
39
39
  type CreatableV2Props<FieldValue, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined> = WithRequired<Omit<AutocompleteProps<FieldValue, Multiple, DisableClearable, FreeSolo>, 'renderInput' | 'options' | 'size' | 'onInputChange' | 'onChange' | 'defaultValue' | 'value'>, 'getOptionKey' | 'getOptionLabel'> & UseControllerProps & {
40
40
  options: FieldValue[];
41
- slotProps?: AutocompleteProps<FieldValue, Multiple, DisableClearable, FreeSolo>['slotProps'] & {
41
+ slotProps?: AutocompleteProps<FieldValue, Multiple, DisableClearable, FreeSolo>['slotProps'] & Partial<{
42
42
  textField: Omit<TextFieldProps$1<'outlined'>, 'variant'>;
43
- };
43
+ }>;
44
44
  label?: React.ReactNode;
45
45
  required?: boolean;
46
46
  /**
@@ -426,7 +426,7 @@ type SwitchProps = SwitchProps$1 & UseControllerProps & {
426
426
  disableIconError?: boolean;
427
427
  };
428
428
 
429
- declare const Switch: ({ name, rules, defaultValue, shouldUnregister, control: controlFromProps, label, labelPlacement, disableIconError, onChange: onChangeProp, disabled, ...rest }: SwitchProps) => react_jsx_runtime.JSX.Element;
429
+ declare const Switch: ({ name, rules, defaultValue, defaultChecked, shouldUnregister, control: controlFromProps, label, labelPlacement, disableIconError, onChange: onChangeProp, ...rest }: SwitchProps) => react_jsx_runtime.JSX.Element;
430
430
 
431
431
  type Masks = 'cpf' | 'cnpj' | 'cpfCnpj' | 'cep' | 'telefone' | 'decimal' | 'decimal3' | 'decimal4' | 'decimal5' | 'porcentagem' | 'porcentagem0' | 'nome' | 'numero' | 'numeroPontuacao' | 'placa' | 'valor' | 'valor3' | 'valor4';
432
432
  type TextFieldProps = TextFieldProps$1 & UseControllerProps & {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{useController as Ge,useFormContext as Ne}from"react-hook-form";import{Checkbox as Ue,FormControlLabel as He}from"@mui/material";import{Indicator as Be}from"@s_mart/core";import{useFormState as De}from"react-hook-form";var E=(e,o)=>o.replace(/[[\]]/g,"").split(".").reduce((l,a)=>l?.[a],e);import{jsx as Ae}from"react/jsx-runtime";var Me=({name:e,disableIcon:o,control:t})=>{let l=De({control:t,name:e}),a=E(l?.errors,e);return a?Ae(Be,{severity:"error",icon:o?!1:void 0,children:a?.message}):null},V=Me;import{Typography as me}from"@mui/material";import{toRem as Oe}from"@s_mart/utils";import{jsx as ue,jsxs as ze}from"react/jsx-runtime";var $e=({label:e,required:o,regular:t})=>ze("span",{style:{display:"flex",alignItems:"center",gap:Oe(2)},children:[ue(me,{variant:"caption",style:{display:"flex",alignItems:"center"},sx:{fontWeight:t?400:700},children:e}),o&&ue(me,{variant:"caption",color:"error",sx:{fontWeight:900},children:"*"})]}),P=$e;var h=class extends Error{constructor(o){super(`O componente ${o} precisa de um control para funcionar. Passe o control como prop ou coloque o componente dentro de um <Form />`),this.name="FormComponentPrecisaDeControl"}};import{memo as qe}from"react";var B=qe;import{jsx as Q,jsxs as We}from"react/jsx-runtime";var _e=({name:e,rules:o,defaultValue:t,shouldUnregister:l,control:a,label:m,labelPlacement:u,required:s,disableIconError:b,onChange:F,...T})=>{let c=Ne()?.control,d=a??c;if(!d)throw new h("Checkbox");let{field:i}=Ge({control:d,name:e,rules:o,defaultValue:t,shouldUnregister:l});return We("span",{children:[Q(He,{control:Q(Ue,{checked:!!i.value,value:i.value??"",defaultValue:i.value,onChange:(p,I)=>{i.onChange(p,I),F?.(p,I)},...T},e),label:Q(P,{label:m,required:s,regular:!0}),labelPlacement:u||"end"}),Q(V,{name:e,disableIcon:b,control:d})]})},Ke=B(_e);import{forwardRef as eo,useCallback as oo,useState as to}from"react";import{useController as ro,useFormContext as lo,useFormState as io}from"react-hook-form";import no from"lodash-es/isObject";import ao from"lodash-es/isEmpty";import so from"lodash-es/isEqual";import{Autocomplete as po,TextField as mo,Divider as ye,Button as uo}from"@mui/material";import{LIcon as re}from"@s_mart/core";import{linePlus as Fe,linePen as fo}from"@s_mart/solid-icons";import{toRem as xe}from"@s_mart/utils";import{css as Ye,styled as Je}from"@mui/material";import{toRem as Z}from"@s_mart/utils";var fe=Ye`
1
+ import{useController as Ge,useFormContext as Ne}from"react-hook-form";import{Checkbox as Ue,FormControlLabel as He}from"@mui/material";import{Indicator as Be}from"@s_mart/core";import{useFormState as De}from"react-hook-form";var E=(e,o)=>o.replace(/[[\]]/g,"").split(".").reduce((l,a)=>l?.[a],e);import{jsx as Ae}from"react/jsx-runtime";var Me=({name:e,disableIcon:o,control:t})=>{let l=De({control:t,name:e}),a=E(l?.errors,e);return a?Ae(Be,{severity:"error",icon:o?!1:void 0,children:a?.message}):null},V=Me;import{Typography as me}from"@mui/material";import{toRem as Oe}from"@s_mart/utils";import{jsx as ue,jsxs as ze}from"react/jsx-runtime";var $e=({label:e,required:o,regular:t})=>ze("span",{style:{display:"flex",alignItems:"center",gap:Oe(2)},children:[ue(me,{variant:"caption",style:{display:"flex",alignItems:"center"},sx:{fontWeight:t?400:700},children:e}),o&&ue(me,{variant:"caption",color:"error",sx:{fontWeight:900},children:"*"})]}),P=$e;var h=class extends Error{constructor(o){super(`O componente ${o} precisa de um control para funcionar. Passe o control como prop ou coloque o componente dentro de um <Form />`),this.name="FormComponentPrecisaDeControl"}};import{memo as qe}from"react";var B=qe;import{jsx as Q,jsxs as We}from"react/jsx-runtime";var _e=({name:e,rules:o,defaultValue:t,shouldUnregister:l,control:a,label:m,labelPlacement:u,required:s,disableIconError:g,onChange:c,...T})=>{let y=Ne()?.control,d=a??y;if(!d)throw new h("Checkbox");let{field:i}=Ge({control:d,name:e,rules:o,defaultValue:t,shouldUnregister:l});return We("span",{children:[Q(He,{control:Q(Ue,{checked:!!i.value,value:i.value??"",defaultValue:i.value,onChange:(p,k)=>{i.onChange(p,k),c?.(p,k)},...T},e),label:Q(P,{label:m,required:s,regular:!0}),labelPlacement:u||"end"}),Q(V,{name:e,disableIcon:g,control:d})]})},Ke=B(_e);import{forwardRef as eo,useCallback as oo,useState as to}from"react";import{useController as ro,useFormContext as lo,useFormState as io}from"react-hook-form";import no from"lodash-es/isObject";import ao from"lodash-es/isEmpty";import so from"lodash-es/isEqual";import{Autocomplete as po,TextField as mo,Divider as ye,Button as uo}from"@mui/material";import{LIcon as re}from"@s_mart/core";import{linePlus as Fe,linePen as fo}from"@s_mart/solid-icons";import{toRem as xe}from"@s_mart/utils";import{css as Ye,styled as Je}from"@mui/material";import{toRem as Z}from"@s_mart/utils";var fe=Ye`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
@@ -49,7 +49,7 @@ import{useController as Ge,useFormContext as Ne}from"react-hook-form";import{Che
49
49
  }
50
50
  }
51
51
  }
52
- `;import{Tooltip as Xe}from"@mui/material";import{LIcon as Qe}from"@s_mart/core";import{lineInfoCircle as Ze}from"@s_mart/solid-icons";import{jsx as te}from"react/jsx-runtime";var je=({title:e})=>te(Xe,{title:e,placement:"top",children:te("div",{style:{width:"fit-content"},children:te(Qe,{icon:Ze,color:"#757575"})})}),H=je;import{Fragment as le,jsx as S,jsxs as A}from"react/jsx-runtime";import{createElement as Fo}from"react";function co(e){let{name:o,rules:t,defaultValue:l,shouldUnregister:a,control:m,label:u,required:s,options:b,footer:F,showCreatableButton:T=!0,showEditableButton:c,onEditOption:d,onCreateOption:i,getOptionKey:p,getOptionLabel:I,getOptionAfterLabel:y,multiple:R,info:k,noOptionsText:n,onChange:g,onInputChange:$,placeholder:z,...x}=e,[U,D]=to(""),f=lo()?.control,r=m??f;if(!r)throw new h("CreatableV2");let v=io({control:r,name:o}),L=E(v.errors,o),_=!T||x.disabled,{field:K}=ro({name:o,control:r,rules:t,defaultValue:l,shouldUnregister:a}),Ie=w=>{let C=0;return e.slotProps?.textField?.slotProps?.input||(C+=2.5),_||(C+=2.56,pe(w)&&(C+=2.56)),!x.disableClearable&&!x.disabled&&(C+=1.3),`${C}rem`},pe=w=>x.disabled?!1:c&&no(w)&&!ao(w),we=()=>x.disabled?!1:T,de=oo(()=>{typeof i<"u"&&(i(U),D(""))},[U,i]),Le=()=>{d?.(K.value)},Re=K.value?K.value:R?[]:null;return A("div",{style:{display:"flex",flexDirection:"column"},children:[A("div",{style:{display:"flex"},children:[u&&S(P,{label:u,required:s}),k&&S(H,{title:k})]}),S(ce,{children:S(po,{fullWidth:!0,onChange:(w,C)=>{D(""),K.onChange(C),g?.(C)},onInputChange:(w,C,W)=>{W==="input"&&(D(C),$?.(C))},slotProps:{...x.slotProps,listbox:{component:eo(function(C,W){return A(le,{children:[S("ul",{...C,ref:W}),typeof F<"u"?A("div",{...C,children:[S("div",{style:{paddingTop:"0.5rem",paddingBottom:"0.5rem"},children:S(ye,{})}),F()]},"creatable-footer"):null]})})}},value:Re,options:b,multiple:R,readOnly:x.disabled,noOptionsText:A(le,{children:[n||"Nenhuma op\xE7\xE3o encontrada",!_&&A(uo,{sx:{justifyContent:"flex-start",padding:`${xe(6)} ${xe(-16)}`,margin:0},fullWidth:!0,onClick:de,variant:"text",startIcon:S(re,{icon:Fe}),children:["Adicionar ",`"${U}"`]}),typeof F<"u"&&A(le,{children:[S("div",{style:{paddingTop:"0.5rem",paddingBottom:"0.5rem"},children:S(ye,{})}),F()]})]}),isOptionEqualToValue:(w,C)=>so(w,C),getOptionLabel:I,getOptionKey:p,renderOption:typeof y=="function"?(w,C)=>{let W=y(C),Ee=p(C);return Fo("li",{...w,key:Ee},A("div",{style:{display:"flex",flexDirection:"column",flex:1},children:[S("span",{children:I(C)}),typeof W=="string"?S("span",{children:W}):W]}))}:void 0,...x,sx:{"& div.MuiInputBase-root":{paddingRight:`${Ie(K.value)} !important`},...x.sx},onBlur:w=>{x?.onBlur?.(w),D("")},renderInput:w=>S(mo,{placeholder:z,...w,error:!!L,...e.slotProps?.textField,slotProps:{input:{...w.InputProps,...e.slotProps?.textField?.slotProps?.input,inputRef:K.ref,endAdornment:A("div",{className:"endAdornments",children:[w.InputProps.endAdornment,e.slotProps?.textField?.slotProps?.input?.endAdornment??null,pe(K.value)?A("div",{className:"editable",children:[S("div",{className:"divider"}),S("div",{className:"button",onKeyUp:Le,children:S(re,{icon:fo,size:"24px",removeMargin:!0})})]}):null,we()&&A("div",{className:"creatable",children:[S("div",{className:"divider"}),S("div",{className:"button",onKeyUp:de,children:S(re,{icon:Fe,size:"24px",removeMargin:!0})})]})]})}}})},o)}),S(V,{name:o,control:r})]})}var yo=B(co);import{Stack as go,TextField as vo}from"@mui/material";import{AdapterDayjs as Co}from"@mui/x-date-pickers/AdapterDayjs";import{DatePicker as Vo}from"@mui/x-date-pickers/DatePicker";import{LocalizationProvider as So}from"@mui/x-date-pickers/LocalizationProvider";import{ptBR as To}from"@mui/x-date-pickers/locales/ptBR";import{composeValidators as ko,date as he}from"@s_mart/rules";import Io from"dayjs/locale/pt-br";import{useController as wo,useFormContext as Lo,useFormState as Ro}from"react-hook-form";import{IconButton as xo,styled as Po}from"@mui/material";import{toRem as q}from"@s_mart/utils";var ho=e=>{switch(e){case"small":return q(16);case"large":return q(24);default:return q(20)}},bo=e=>{switch(e){case"small":return`${q(2)} ${q(8)}`;case"large":return`${q(10)}`;default:return`${q(6)} ${q(8)}`}},Pe=Po(xo)`
52
+ `;import{Tooltip as Xe}from"@mui/material";import{LIcon as Qe}from"@s_mart/core";import{lineInfoCircle as Ze}from"@s_mart/solid-icons";import{jsx as te}from"react/jsx-runtime";var je=({title:e})=>te(Xe,{title:e,placement:"top",children:te("div",{style:{width:"fit-content"},children:te(Qe,{icon:Ze,color:"#757575"})})}),H=je;import{Fragment as le,jsx as S,jsxs as A}from"react/jsx-runtime";import{createElement as Fo}from"react";function co(e){let{name:o,rules:t,defaultValue:l,shouldUnregister:a,control:m,label:u,required:s,options:g,footer:c,showCreatableButton:T=!0,showEditableButton:y,onEditOption:d,onCreateOption:i,getOptionKey:p,getOptionLabel:k,getOptionAfterLabel:F,multiple:R,info:I,noOptionsText:n,onChange:b,onInputChange:$,placeholder:z,...x}=e,[U,D]=to(""),f=lo()?.control,r=m??f;if(!r)throw new h("CreatableV2");let v=io({control:r,name:o}),L=E(v.errors,o),_=!T||x.disabled,{field:K}=ro({name:o,control:r,rules:t,defaultValue:l,shouldUnregister:a}),ke=w=>{let C=0;return e.slotProps?.textField?.slotProps?.input||(C+=2.5),_||(C+=2.56,pe(w)&&(C+=2.56)),!x.disableClearable&&!x.disabled&&(C+=1.3),`${C}rem`},pe=w=>x.disabled?!1:y&&no(w)&&!ao(w),we=()=>x.disabled?!1:T,de=oo(()=>{typeof i<"u"&&(i(U),D(""))},[U,i]),Le=()=>{d?.(K.value)},Re=K.value?K.value:R?[]:null;return A("div",{style:{display:"flex",flexDirection:"column"},children:[A("div",{style:{display:"flex"},children:[u&&S(P,{label:u,required:s}),I&&S(H,{title:I})]}),S(ce,{children:S(po,{fullWidth:!0,onChange:(w,C)=>{D(""),K.onChange(C),b?.(C)},onInputChange:(w,C,W)=>{W==="input"&&(D(C),$?.(C))},slotProps:{...x.slotProps,listbox:{component:eo(function(C,W){return A(le,{children:[S("ul",{...C,ref:W}),typeof c<"u"?A("div",{...C,children:[S("div",{style:{paddingTop:"0.5rem",paddingBottom:"0.5rem"},children:S(ye,{})}),c()]},"creatable-footer"):null]})})}},value:Re,options:g,multiple:R,readOnly:x.disabled,noOptionsText:A(le,{children:[n||"Nenhuma op\xE7\xE3o encontrada",!_&&A(uo,{sx:{justifyContent:"flex-start",padding:`${xe(6)} ${xe(-16)}`,margin:0},fullWidth:!0,onClick:de,variant:"text",startIcon:S(re,{icon:Fe}),children:["Adicionar ",`"${U}"`]}),typeof c<"u"&&A(le,{children:[S("div",{style:{paddingTop:"0.5rem",paddingBottom:"0.5rem"},children:S(ye,{})}),c()]})]}),isOptionEqualToValue:(w,C)=>so(w,C),getOptionLabel:k,getOptionKey:p,renderOption:typeof F=="function"?(w,C)=>{let W=F(C),Ee=p(C);return Fo("li",{...w,key:Ee},A("div",{style:{display:"flex",flexDirection:"column",flex:1},children:[S("span",{children:k(C)}),typeof W=="string"?S("span",{children:W}):W]}))}:void 0,...x,sx:{"& div.MuiInputBase-root":{paddingRight:`${ke(K.value)} !important`},...x.sx},onBlur:w=>{x?.onBlur?.(w),D("")},renderInput:w=>S(mo,{placeholder:z,...w,error:!!L,...e.slotProps?.textField,slotProps:{input:{...w.InputProps,...e.slotProps?.textField?.slotProps?.input,inputRef:K.ref,endAdornment:A("div",{className:"endAdornments",children:[w.InputProps.endAdornment,e.slotProps?.textField?.slotProps?.input?.endAdornment??null,pe(K.value)?A("div",{className:"editable",children:[S("div",{className:"divider"}),S("div",{className:"button",onKeyUp:Le,children:S(re,{icon:fo,size:"24px",removeMargin:!0})})]}):null,we()&&A("div",{className:"creatable",children:[S("div",{className:"divider"}),S("div",{className:"button",onKeyUp:de,children:S(re,{icon:Fe,size:"24px",removeMargin:!0})})]})]})}}})},o)}),S(V,{name:o,control:r})]})}var yo=B(co);import{Stack as go,TextField as vo}from"@mui/material";import{AdapterDayjs as Co}from"@mui/x-date-pickers/AdapterDayjs";import{DatePicker as Vo}from"@mui/x-date-pickers/DatePicker";import{LocalizationProvider as So}from"@mui/x-date-pickers/LocalizationProvider";import{ptBR as To}from"@mui/x-date-pickers/locales/ptBR";import{composeValidators as Io,date as he}from"@s_mart/rules";import ko from"dayjs/locale/pt-br";import{useController as wo,useFormContext as Lo,useFormState as Ro}from"react-hook-form";import{IconButton as xo,styled as Po}from"@mui/material";import{toRem as q}from"@s_mart/utils";var ho=e=>{switch(e){case"small":return q(16);case"large":return q(24);default:return q(20)}},bo=e=>{switch(e){case"small":return`${q(2)} ${q(8)}`;case"large":return`${q(10)}`;default:return`${q(6)} ${q(8)}`}},Pe=Po(xo)`
53
53
  margin: 0px;
54
54
 
55
55
  padding: ${({size:e})=>bo(e)};
@@ -58,7 +58,7 @@ import{useController as Ge,useFormContext as Ne}from"react-hook-form";import{Che
58
58
  svg {
59
59
  width: ${({size:e})=>ho(e)} !important;
60
60
  }
61
- `;import{jsx as j,jsxs as Mo}from"react/jsx-runtime";import{createElement as Do}from"react";var Eo=({rules:e,name:o,defaultValue:t,shouldUnregister:l,control:a,datePickerProps:m,label:u,required:s,placeholder:b,disabled:F,disableIconError:T,...c})=>{let d=Lo()?.control,i=a??d;if(!i)throw new h("DatePicker");let p=Ro({control:i,name:o}),I=E(p.errors,o),y=m?.format||"DD/MM/YYYY",R=e?ko([he(y),e]):he(y),{field:k}=wo({control:i,name:o,rules:R,defaultValue:t,shouldUnregister:l});return j(So,{dateAdapter:Co,adapterLocale:Io,localeText:To.components.MuiLocalizationProvider.defaultProps.localeText,children:Mo(go,{children:[u&&j(P,{label:u,required:s}),Do(Vo,{...m,key:o,value:k.value??null,format:y,onChange:(n,g)=>{k.onChange(n,g),m?.onChange?.(n,g)},disabled:F,slots:{textField:vo,openPickerButton:n=>j(Pe,{...n,size:c.size})},slotProps:{textField:n=>({variant:"outlined",...n,error:!!I,...c,inputProps:{...n.inputProps,placeholder:b||n.inputProps?.placeholder},InputProps:{...n.InputProps,inputRef:g=>{k.ref(g),typeof n.inputRef=="function"&&n.inputRef(g)}}})}}),j(V,{name:o,disableIcon:T,control:i})]})})},Bo=B(Eo);import{FormProvider as Ao}from"react-hook-form";import{jsx as be}from"react/jsx-runtime";function Oo({children:e,style:o,onSubmit:t,...l}){return be(Ao,{...l,children:be("form",{onSubmit:a=>{a.preventDefault(),a.stopPropagation(),t(a)},style:o,children:e})})}var ie=Oo;import{useEffect as $o}from"react";import{useForm as zo}from"react-hook-form";import{zodResolver as qo}from"@hookform/resolvers/zod";var Go=({disableDefaultValuesUpdate:e,onSubmit:o,...t})=>{let l=zo({...t,resolver:t.schema&&qo(t.schema)});return $o(()=>{e||l.reset(t.defaultValues)},[t.defaultValues,l.reset]),{...l,onSubmit:l.handleSubmit(a=>o(a,l))}},ne=Go;import{jsx as Ho}from"react/jsx-runtime";function No({children:e,style:o,...t}){let l=ne(t);return Ho(ie,{...l,style:o,children:typeof e=="function"?e(l):e})}var Uo=No;import{RadioGroup as _o,Stack as Ko}from"@mui/material";import{useController as Wo,useFormContext as Yo}from"react-hook-form";import{jsx as ae,jsxs as Qo}from"react/jsx-runtime";var Jo=({name:e,rules:o,defaultValue:t,shouldUnregister:l,control:a,label:m,required:u,children:s,orientation:b="row",disableIconError:F,...T})=>{let c=Yo()?.control,d=a??c;if(!d)throw new h("RadioGroup");let{field:i}=Wo({control:d,name:e,rules:o,defaultValue:t,shouldUnregister:l});return Qo(Ko,{children:[m&&ae(P,{label:m,required:u}),ae(_o,{value:i.value||"",name:e,...T,onChange:p=>{T?.onChange?.(p,p.target?.value),i.onChange(p)},style:{display:"flex",flexDirection:b},children:s},e),ae(V,{name:e,disableIcon:F,control:d})]})},Xo=Jo;import{FormControlLabel as Zo,Grid2 as jo,Radio as et}from"@mui/material";import{jsx as ee}from"react/jsx-runtime";var ot=({label:e,labelPlacement:o,...t})=>ee(jo,{sx:{display:"flex",flexDirection:"column"},children:ee(Zo,{control:ee(et,{...t}),label:ee(P,{label:e}),labelPlacement:o||"end"})}),tt=ot;import{Autocomplete as rt,Divider as ge,TextField as lt}from"@mui/material";import it from"lodash-es/isEqual";import{forwardRef as nt}from"react";import{useController as at,useFormContext as st,useFormState as pt}from"react-hook-form";import{Fragment as se,jsx as M,jsxs as Y}from"react/jsx-runtime";import{createElement as ut}from"react";var dt=e=>{let{name:o,rules:t,defaultValue:l,shouldUnregister:a,control:m,label:u,required:s,options:b,textFieldProps:F,noOptionsText:T,footer:c,multiple:d,info:i,placeholder:p,onChange:I,onInputChange:y,getOptionAfterLabel:R,getOptionLabel:k,getOptionKey:n,...g}=e,$=st()?.control,z=m??$;if(!z)throw new h("SearchableV2");let x=pt({control:z,name:o}),U=E(x.errors,o),{field:D}=at({name:o,control:z,rules:t,defaultValue:l,shouldUnregister:a}),f=D.value?D.value:d?[]:null;return Y("div",{style:{display:"flex",flexDirection:"column"},children:[Y("div",{style:{display:"flex"},children:[u&&M(P,{label:u,required:s}),i&&M(H,{title:i})]}),M(rt,{onChange:(r,v)=>{D.onChange(v),I?.(v)},onInputChange:(r,v,L)=>{L==="input"&&y?.(v)},value:f,options:b,multiple:d,readOnly:g.disabled,slotProps:{...g.slotProps,listbox:{component:nt(function(v,L){return Y(se,{children:[M("ul",{...v,ref:L}),typeof c<"u"?Y("div",{...v,children:[M("div",{style:{paddingTop:"0.5rem",paddingBottom:"0.5rem"},children:M(ge,{})}),c()]},"searchable-footer"):null]})})}},noOptionsText:Y(se,{children:[T||"Nenhuma op\xE7\xE3o encontrada",typeof c<"u"?Y(se,{children:[M("div",{style:{paddingTop:"0.5rem",paddingBottom:"0.5rem"},children:M(ge,{})}),c()]}):null]}),isOptionEqualToValue:(r,v)=>it(r,v),getOptionLabel:k,getOptionKey:n,renderOption:typeof R=="function"?(r,v)=>{let L=R(v),_=n(v);return ut("li",{...r,key:_},Y("div",{style:{display:"flex",flexDirection:"column",flex:1},children:[M("span",{children:k(v)}),typeof L=="string"?M("span",{children:L}):L]}))}:void 0,...g,renderInput:r=>M(lt,{error:!!U,placeholder:p,...r,...F,inputRef:D.ref})},o),M(V,{name:o,control:z})]})},mt=B(dt);import{useState as yt}from"react";import{useController as Ft,useFormContext as xt,useFormState as Pt}from"react-hook-form";import{IconButton as ht,LIcon as bt}from"@s_mart/core";import{lineTimes as gt}from"@s_mart/regular-icons";import{colorPalette as vt}from"@s_mart/tokens";import{Select as Ct,MenuItem as Vt,Divider as St}from"@mui/material";import{colorPalette as ft}from"@s_mart/tokens";import{jsx as ct}from"react/jsx-runtime";var ve=({value:e,placeholder:o,getOptionLabel:t})=>e===null||e?.length===0?ct("p",{style:{color:ft.neutral[100]},children:o}):t(e);import{Fragment as It,jsx as O,jsxs as J}from"react/jsx-runtime";var Tt=e=>{let{name:o,rules:t,defaultValue:l,shouldUnregister:a,control:m,label:u,required:s,options:b,placeholder:F,clearable:T,info:c,footer:d,onChange:i,variant:p="outlined",getOptionKey:I,getOptionLabel:y,getOptionAfterLabel:R,getOptionIcon:k,...n}=e,g=xt()?.control,$=m??g,[z,x]=yt(!1);if(!$)throw new h("SelectV2");let U=Pt({control:$,name:o}),D=E(U.errors,o),{field:f}=Ft({control:$,name:o,rules:t,defaultValue:l,shouldUnregister:a});return J("div",{style:{display:"flex",flexDirection:"column"},children:[J("div",{style:{display:"flex"},children:[u&&O(P,{label:u,required:s}),c&&O(H,{title:c})]}),J(Ct,{open:z,onOpen:()=>x(!0),onClose:()=>x(!1),displayEmpty:!!F,variant:p,autoComplete:"off",value:f.value||null,renderValue:r=>O(ve,{getOptionLabel:y,placeholder:F,value:r}),onChange:r=>{console.log(r),f.onChange(r.target.value),i?.(r.target.value)},error:!!D,size:n.size||"medium",inputRef:f.ref,...n,endAdornment:J(It,{children:[n.endAdornment,!!(T&&f.value)&&O(ht,{variant:"text",color:"neutral",size:"small",sx:{borderRadius:"50%",position:"absolute",right:"2rem"},style:{padding:0},"aria-label":"Limpar",title:"Limpar",onClick:()=>{f.onChange(null),i?.(null)},children:O(bt,{icon:gt,color:vt.neutral[100],size:"25px",removeMargin:!0})})]}),children:[b.map(r=>{let v=I(r),L=y(r),_=k?.(r);return O(Vt,{value:r,children:J("div",{style:{display:"flex",flexDirection:"column",flex:1},children:[_!==void 0?J("div",{style:{display:"flex",alignItems:"center"},children:[_,L]}):L,O("span",{children:R?.(r)??null})]})},v)}),d!==void 0&&J("div",{children:[O("div",{style:{padding:"8px 16px"},children:O(St,{})},"footer-divider"),O("div",{children:d({closeSelect:()=>x(!1)})},"footer-content")]},"footer")]},o),O(V,{name:o,control:$})]})},kt=B(Tt);import{useController as wt,useFormContext as Lt}from"react-hook-form";import{Slider as Rt}from"@mui/material";import{jsx as Dt}from"react/jsx-runtime";var Et=({name:e,rules:o,defaultValue:t,shouldUnregister:l,control:a,...m})=>{let u=Lt()?.control,s=a??u;if(!s)throw new h("Slider");let{field:b}=wt({control:s,name:e,rules:o,defaultValue:t,shouldUnregister:l});return Dt(Rt,{value:b.value||m?.min||0,onChange:b.onChange,valueLabelDisplay:"auto",...m},e)},Bt=Et;import{FormControlLabel as Mt,Stack as At,Switch as Ot}from"@mui/material";import{useController as $t,useFormContext as zt}from"react-hook-form";import{useCallback as qt}from"react";import{jsx as oe,jsxs as Ut}from"react/jsx-runtime";var Gt=({name:e,rules:o,defaultValue:t,shouldUnregister:l,control:a,label:m,labelPlacement:u="end",disableIconError:s,onChange:b,disabled:F,...T})=>{let c=zt()?.control,d=a??c;if(!d)throw new h("Switch");let{field:i}=$t({control:d,name:e,rules:o,defaultValue:t,shouldUnregister:l,disabled:F}),p=qt((I,y)=>{i.onChange(I,y),b?.(I,y)},[i.onChange,b]);return Ut(At,{children:[oe(Mt,{control:oe(Ot,{ref:i.ref,onBlur:i.onBlur,disabled:i.disabled,value:i.value??"",checked:i.value??!1,onChange:p,...T},e),label:oe(P,{label:m}),labelPlacement:u}),oe(V,{name:e,disableIcon:s,control:d})]})},Nt=Gt;import{InputAdornment as Ht,Stack as _t,TextField as Kt,Tooltip as Wt}from"@mui/material";import{LIcon as Ce}from"@s_mart/core";import*as Ve from"@s_mart/masks";import{lineEye as Yt,lineEyeSlash as Jt,lineInfoCircle as Xt}from"@s_mart/solid-icons";import{useRef as Qt,useState as Zt}from"react";import{useController as jt,useFormContext as er,useFormState as or}from"react-hook-form";import{jsx as G,jsxs as Se}from"react/jsx-runtime";var tr=({name:e,rules:o,defaultValue:t,shouldUnregister:l,control:a,label:m,required:u,mask:s,variant:b="outlined",info:F,parse:T,format:c,onInputChange:d,disableIconError:i,...p})=>{let I=er()?.control,y=a??I,R=Qt(t||void 0);if(!y)throw new h("TextField");let[k,n]=Zt(!1),g=f=>{let r=f;return r=c?.(f)??f,s?Ve?.[s]?.format(r):r},$=f=>{let r=f;return r=T?.(f)??r,s?Ve?.[s]?.parse(r,R.current):r},z=f=>{if(!f||s!=="porcentagem"&&s!=="porcentagem0")return;f?.stopPropagation();let r=(f?.target).value;if(r){let v=String(r);if(v.length>0){let L=v.indexOf("%");L>-1&&(f.currentTarget.selectionEnd=L)}}},{field:x}=jt({control:y,name:e,rules:o,defaultValue:t,shouldUnregister:l}),U=or({control:y,name:e}),D=E(U.errors,e);return Se(_t,{children:[Se("div",{style:{display:"flex"},children:[m&&G("div",{children:G(P,{label:m,required:u})}),F&&G("div",{children:G(Wt,{title:F,placement:"top",children:G("div",{style:{width:"fit-content"},children:G(Ce,{icon:Xt,color:"#757575"})})})})]}),G(Kt,{variant:b,defaultValue:t,value:g(x.value||(x.value!=0?"":x.value)),onChange:f=>{let r=$(f?.target?.value);x.onChange(r),d?.(r),R.current=f.target.value},error:!!D,...p,type:p.type==="password"?k?"text":"password":p.type,autoComplete:p.autoComplete||"off",slotProps:{input:{onKeyDown:z,inputRef:x.ref,endAdornment:p.type==="password"&&G(Ht,{position:"start",onClick:()=>n(!k),style:{cursor:"pointer"},children:G(Ce,{icon:k?Yt:Jt,size:"24px",removeMargin:!0})}),...p.slotProps?.input}}},e),G(V,{name:e,disableIcon:i,control:y})]})},rr=B(tr);import{Stack as sr,TextField as pr}from"@mui/material";import{AdapterDayjs as dr}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as mr}from"@mui/x-date-pickers/LocalizationProvider";import{TimePicker as ur}from"@mui/x-date-pickers/TimePicker";import{ptBR as fr}from"@mui/x-date-pickers/locales/ptBR";import{composeValidators as cr,time as ke}from"@s_mart/rules";import yr from"dayjs/locale/pt-br";import{useController as Fr,useFormContext as xr,useFormState as Pr}from"react-hook-form";import{styled as lr}from"@mui/material";import{IconButton as ir}from"@mui/material";import{toRem as N}from"@s_mart/utils";var nr=e=>{switch(e){case"small":return N(16);case"large":return N(24);default:return N(20)}},ar=e=>{switch(e){case"small":return`${N(2)} ${N(8)}`;case"large":return N(10);default:return`${N(6)} ${N(8)}`}},Te=lr(ir)`
61
+ `;import{jsx as j,jsxs as Mo}from"react/jsx-runtime";import{createElement as Do}from"react";var Eo=({rules:e,name:o,defaultValue:t,shouldUnregister:l,control:a,datePickerProps:m,label:u,required:s,placeholder:g,disabled:c,disableIconError:T,...y})=>{let d=Lo()?.control,i=a??d;if(!i)throw new h("DatePicker");let p=Ro({control:i,name:o}),k=E(p.errors,o),F=m?.format||"DD/MM/YYYY",R=e?Io([he(F),e]):he(F),{field:I}=wo({control:i,name:o,rules:R,defaultValue:t,shouldUnregister:l});return j(So,{dateAdapter:Co,adapterLocale:ko,localeText:To.components.MuiLocalizationProvider.defaultProps.localeText,children:Mo(go,{children:[u&&j(P,{label:u,required:s}),Do(Vo,{...m,key:o,value:I.value??null,format:F,onChange:(n,b)=>{I.onChange(n,b),m?.onChange?.(n,b)},disabled:c,slots:{textField:vo,openPickerButton:n=>j(Pe,{...n,size:y.size})},slotProps:{textField:n=>({variant:"outlined",...n,error:!!k,...y,inputProps:{...n.inputProps,placeholder:g||n.inputProps?.placeholder},InputProps:{...n.InputProps,inputRef:b=>{I.ref(b),typeof n.inputRef=="function"&&n.inputRef(b)}}})}}),j(V,{name:o,disableIcon:T,control:i})]})})},Bo=B(Eo);import{FormProvider as Ao}from"react-hook-form";import{jsx as be}from"react/jsx-runtime";function Oo({children:e,style:o,onSubmit:t,...l}){return be(Ao,{...l,children:be("form",{onSubmit:a=>{a.preventDefault(),a.stopPropagation(),t(a)},style:o,children:e})})}var ie=Oo;import{useEffect as $o}from"react";import{useForm as zo}from"react-hook-form";import{zodResolver as qo}from"@hookform/resolvers/zod";var Go=({disableDefaultValuesUpdate:e,onSubmit:o,...t})=>{let l=zo({...t,resolver:t.schema&&qo(t.schema)});return $o(()=>{e||l.reset(t.defaultValues)},[t.defaultValues,l.reset]),{...l,onSubmit:l.handleSubmit(a=>o(a,l))}},ne=Go;import{jsx as Ho}from"react/jsx-runtime";function No({children:e,style:o,...t}){let l=ne(t);return Ho(ie,{...l,style:o,children:typeof e=="function"?e(l):e})}var Uo=No;import{RadioGroup as _o,Stack as Ko}from"@mui/material";import{useController as Wo,useFormContext as Yo}from"react-hook-form";import{jsx as ae,jsxs as Qo}from"react/jsx-runtime";var Jo=({name:e,rules:o,defaultValue:t,shouldUnregister:l,control:a,label:m,required:u,children:s,orientation:g="row",disableIconError:c,...T})=>{let y=Yo()?.control,d=a??y;if(!d)throw new h("RadioGroup");let{field:i}=Wo({control:d,name:e,rules:o,defaultValue:t,shouldUnregister:l});return Qo(Ko,{children:[m&&ae(P,{label:m,required:u}),ae(_o,{value:i.value||"",name:e,...T,onChange:p=>{T?.onChange?.(p,p.target?.value),i.onChange(p)},style:{display:"flex",flexDirection:g},children:s},e),ae(V,{name:e,disableIcon:c,control:d})]})},Xo=Jo;import{FormControlLabel as Zo,Grid2 as jo,Radio as et}from"@mui/material";import{jsx as ee}from"react/jsx-runtime";var ot=({label:e,labelPlacement:o,...t})=>ee(jo,{sx:{display:"flex",flexDirection:"column"},children:ee(Zo,{control:ee(et,{...t}),label:ee(P,{label:e}),labelPlacement:o||"end"})}),tt=ot;import{Autocomplete as rt,Divider as ge,TextField as lt}from"@mui/material";import it from"lodash-es/isEqual";import{forwardRef as nt}from"react";import{useController as at,useFormContext as st,useFormState as pt}from"react-hook-form";import{Fragment as se,jsx as M,jsxs as Y}from"react/jsx-runtime";import{createElement as ut}from"react";var dt=e=>{let{name:o,rules:t,defaultValue:l,shouldUnregister:a,control:m,label:u,required:s,options:g,textFieldProps:c,noOptionsText:T,footer:y,multiple:d,info:i,placeholder:p,onChange:k,onInputChange:F,getOptionAfterLabel:R,getOptionLabel:I,getOptionKey:n,...b}=e,$=st()?.control,z=m??$;if(!z)throw new h("SearchableV2");let x=pt({control:z,name:o}),U=E(x.errors,o),{field:D}=at({name:o,control:z,rules:t,defaultValue:l,shouldUnregister:a}),f=D.value?D.value:d?[]:null;return Y("div",{style:{display:"flex",flexDirection:"column"},children:[Y("div",{style:{display:"flex"},children:[u&&M(P,{label:u,required:s}),i&&M(H,{title:i})]}),M(rt,{onChange:(r,v)=>{D.onChange(v),k?.(v)},onInputChange:(r,v,L)=>{L==="input"&&F?.(v)},value:f,options:g,multiple:d,readOnly:b.disabled,slotProps:{...b.slotProps,listbox:{component:nt(function(v,L){return Y(se,{children:[M("ul",{...v,ref:L}),typeof y<"u"?Y("div",{...v,children:[M("div",{style:{paddingTop:"0.5rem",paddingBottom:"0.5rem"},children:M(ge,{})}),y()]},"searchable-footer"):null]})})}},noOptionsText:Y(se,{children:[T||"Nenhuma op\xE7\xE3o encontrada",typeof y<"u"?Y(se,{children:[M("div",{style:{paddingTop:"0.5rem",paddingBottom:"0.5rem"},children:M(ge,{})}),y()]}):null]}),isOptionEqualToValue:(r,v)=>it(r,v),getOptionLabel:I,getOptionKey:n,renderOption:typeof R=="function"?(r,v)=>{let L=R(v),_=n(v);return ut("li",{...r,key:_},Y("div",{style:{display:"flex",flexDirection:"column",flex:1},children:[M("span",{children:I(v)}),typeof L=="string"?M("span",{children:L}):L]}))}:void 0,...b,renderInput:r=>M(lt,{error:!!U,placeholder:p,...r,...c,inputRef:D.ref})},o),M(V,{name:o,control:z})]})},mt=B(dt);import{useState as yt}from"react";import{useController as Ft,useFormContext as xt,useFormState as Pt}from"react-hook-form";import{IconButton as ht,LIcon as bt}from"@s_mart/core";import{lineTimes as gt}from"@s_mart/regular-icons";import{colorPalette as vt}from"@s_mart/tokens";import{Select as Ct,MenuItem as Vt,Divider as St}from"@mui/material";import{colorPalette as ft}from"@s_mart/tokens";import{jsx as ct}from"react/jsx-runtime";var ve=({value:e,placeholder:o,getOptionLabel:t})=>e===null||e?.length===0?ct("p",{style:{color:ft.neutral[100]},children:o}):t(e);import{Fragment as kt,jsx as O,jsxs as J}from"react/jsx-runtime";var Tt=e=>{let{name:o,rules:t,defaultValue:l,shouldUnregister:a,control:m,label:u,required:s,options:g,placeholder:c,clearable:T,info:y,footer:d,onChange:i,variant:p="outlined",getOptionKey:k,getOptionLabel:F,getOptionAfterLabel:R,getOptionIcon:I,...n}=e,b=xt()?.control,$=m??b,[z,x]=yt(!1);if(!$)throw new h("SelectV2");let U=Pt({control:$,name:o}),D=E(U.errors,o),{field:f}=Ft({control:$,name:o,rules:t,defaultValue:l,shouldUnregister:a});return J("div",{style:{display:"flex",flexDirection:"column"},children:[J("div",{style:{display:"flex"},children:[u&&O(P,{label:u,required:s}),y&&O(H,{title:y})]}),J(Ct,{open:z,onOpen:()=>x(!0),onClose:()=>x(!1),displayEmpty:!!c,variant:p,autoComplete:"off",value:f.value||null,renderValue:r=>O(ve,{getOptionLabel:F,placeholder:c,value:r}),onChange:r=>{console.log(r),f.onChange(r.target.value),i?.(r.target.value)},error:!!D,size:n.size||"medium",inputRef:f.ref,...n,endAdornment:J(kt,{children:[n.endAdornment,!!(T&&f.value)&&O(ht,{variant:"text",color:"neutral",size:"small",sx:{borderRadius:"50%",position:"absolute",right:"2rem"},style:{padding:0},"aria-label":"Limpar",title:"Limpar",onClick:()=>{f.onChange(null),i?.(null)},children:O(bt,{icon:gt,color:vt.neutral[100],size:"25px",removeMargin:!0})})]}),children:[g.map(r=>{let v=k(r),L=F(r),_=I?.(r);return O(Vt,{value:r,children:J("div",{style:{display:"flex",flexDirection:"column",flex:1},children:[_!==void 0?J("div",{style:{display:"flex",alignItems:"center"},children:[_,L]}):L,O("span",{children:R?.(r)??null})]})},v)}),d!==void 0&&J("div",{children:[O("div",{style:{padding:"8px 16px"},children:O(St,{})},"footer-divider"),O("div",{children:d({closeSelect:()=>x(!1)})},"footer-content")]},"footer")]},o),O(V,{name:o,control:$})]})},It=B(Tt);import{useController as wt,useFormContext as Lt}from"react-hook-form";import{Slider as Rt}from"@mui/material";import{jsx as Dt}from"react/jsx-runtime";var Et=({name:e,rules:o,defaultValue:t,shouldUnregister:l,control:a,...m})=>{let u=Lt()?.control,s=a??u;if(!s)throw new h("Slider");let{field:g}=wt({control:s,name:e,rules:o,defaultValue:t,shouldUnregister:l});return Dt(Rt,{value:g.value||m?.min||0,onChange:g.onChange,valueLabelDisplay:"auto",...m},e)},Bt=Et;import{FormControlLabel as Mt,Stack as At,Switch as Ot}from"@mui/material";import{useController as $t,useFormContext as zt}from"react-hook-form";import{useCallback as qt}from"react";import{jsx as oe,jsxs as Ut}from"react/jsx-runtime";var Gt=({name:e,rules:o,defaultValue:t,defaultChecked:l,shouldUnregister:a,control:m,label:u,labelPlacement:s="end",disableIconError:g,onChange:c,...T})=>{let y=zt()?.control,d=m??y;if(!d)throw new h("Switch");let{field:i}=$t({control:d,name:e,rules:o,defaultValue:l??t??!1,shouldUnregister:a}),p=qt((k,F)=>{i.onChange(F),c?.(k,F)},[i,c]);return Ut(At,{children:[oe(Mt,{control:oe(Ot,{...T,...i,checked:!!i.value,onChange:p}),label:oe(P,{label:u}),labelPlacement:s}),oe(V,{name:e,disableIcon:g,control:d})]})},Nt=Gt;import{InputAdornment as Ht,Stack as _t,TextField as Kt,Tooltip as Wt}from"@mui/material";import{LIcon as Ce}from"@s_mart/core";import*as Ve from"@s_mart/masks";import{lineEye as Yt,lineEyeSlash as Jt,lineInfoCircle as Xt}from"@s_mart/solid-icons";import{useRef as Qt,useState as Zt}from"react";import{useController as jt,useFormContext as er,useFormState as or}from"react-hook-form";import{jsx as G,jsxs as Se}from"react/jsx-runtime";var tr=({name:e,rules:o,defaultValue:t,shouldUnregister:l,control:a,label:m,required:u,mask:s,variant:g="outlined",info:c,parse:T,format:y,onInputChange:d,disableIconError:i,...p})=>{let k=er()?.control,F=a??k,R=Qt(t||void 0);if(!F)throw new h("TextField");let[I,n]=Zt(!1),b=f=>{let r=f;return r=y?.(f)??f,s?Ve?.[s]?.format(r):r},$=f=>{let r=f;return r=T?.(f)??r,s?Ve?.[s]?.parse(r,R.current):r},z=f=>{if(!f||s!=="porcentagem"&&s!=="porcentagem0")return;f?.stopPropagation();let r=(f?.target).value;if(r){let v=String(r);if(v.length>0){let L=v.indexOf("%");L>-1&&(f.currentTarget.selectionEnd=L)}}},{field:x}=jt({control:F,name:e,rules:o,defaultValue:t,shouldUnregister:l}),U=or({control:F,name:e}),D=E(U.errors,e);return Se(_t,{children:[Se("div",{style:{display:"flex"},children:[m&&G("div",{children:G(P,{label:m,required:u})}),c&&G("div",{children:G(Wt,{title:c,placement:"top",children:G("div",{style:{width:"fit-content"},children:G(Ce,{icon:Xt,color:"#757575"})})})})]}),G(Kt,{variant:g,defaultValue:t,value:b(x.value||(x.value!=0?"":x.value)),onChange:f=>{let r=$(f?.target?.value);x.onChange(r),d?.(r),R.current=f.target.value},error:!!D,...p,type:p.type==="password"?I?"text":"password":p.type,autoComplete:p.autoComplete||"off",slotProps:{input:{onKeyDown:z,inputRef:x.ref,endAdornment:p.type==="password"&&G(Ht,{position:"start",onClick:()=>n(!I),style:{cursor:"pointer"},children:G(Ce,{icon:I?Yt:Jt,size:"24px",removeMargin:!0})}),...p.slotProps?.input}}},e),G(V,{name:e,disableIcon:i,control:F})]})},rr=B(tr);import{Stack as sr,TextField as pr}from"@mui/material";import{AdapterDayjs as dr}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as mr}from"@mui/x-date-pickers/LocalizationProvider";import{TimePicker as ur}from"@mui/x-date-pickers/TimePicker";import{ptBR as fr}from"@mui/x-date-pickers/locales/ptBR";import{composeValidators as cr,time as Ie}from"@s_mart/rules";import yr from"dayjs/locale/pt-br";import{useController as Fr,useFormContext as xr,useFormState as Pr}from"react-hook-form";import{styled as lr}from"@mui/material";import{IconButton as ir}from"@mui/material";import{toRem as N}from"@s_mart/utils";var nr=e=>{switch(e){case"small":return N(16);case"large":return N(24);default:return N(20)}},ar=e=>{switch(e){case"small":return`${N(2)} ${N(8)}`;case"large":return N(10);default:return`${N(6)} ${N(8)}`}},Te=lr(ir)`
62
62
  margin: 0px;
63
63
 
64
64
  padding: ${({size:e})=>ar(e)};
@@ -67,4 +67,4 @@ import{useController as Ge,useFormContext as Ne}from"react-hook-form";import{Che
67
67
  svg {
68
68
  width: ${({size:e})=>nr(e)} !important;
69
69
  }
70
- `;import{jsx as X,jsxs as gr}from"react/jsx-runtime";var hr=({rules:e,defaultValue:o,shouldUnregister:t,name:l,control:a,required:m,label:u,timePickerProps:s,placeholder:b,disabled:F,disableIconError:T,...c})=>{let d=xr()?.control,i=a??d;if(!i)throw new h("TimePicker");let p=Pr({control:i,name:l}),I=E(p.errors,l),y=s?.format||"HH:mm",R=e?cr([ke(y),e]):ke(y),{field:k}=Fr({control:i,name:l,rules:R,defaultValue:o,shouldUnregister:t});return X(mr,{dateAdapter:dr,adapterLocale:yr,localeText:fr.components.MuiLocalizationProvider.defaultProps.localeText,children:gr(sr,{children:[u&&X(P,{label:u,required:m}),X(ur,{ampm:!1,format:y,value:k.value??null,disabled:F,...s,onChange:(n,g)=>{k.onChange(n,g),s?.onChange?.(n,g)},slots:{textField:pr,openPickerButton:n=>X(Te,{...n,size:c.size})},slotProps:{textField:n=>({variant:"outlined",...n,error:!!I,...c,inputProps:{...n.inputProps,placeholder:b||n.inputProps?.placeholder},InputProps:{...n.InputProps,inputRef:g=>{k.ref(g),typeof n.inputRef=="function"&&n.inputRef(g)}}})}},l),X(V,{name:l,disableIcon:T,control:i})]})})},br=B(hr);console.log("opa");export{Ke as Checkbox,yo as CreatableV2,Bo as DatePicker,V as FieldError,H as FieldInfo,P as FieldLabel,Uo as Form,ie as FormProvider,tt as RadioButton,Xo as RadioGroup,mt as SearchableV2,kt as SelectV2,Bt as Slider,Nt as Switch,rr as TextField,br as TimePicker,ne as useForm};
70
+ `;import{jsx as X,jsxs as gr}from"react/jsx-runtime";var hr=({rules:e,defaultValue:o,shouldUnregister:t,name:l,control:a,required:m,label:u,timePickerProps:s,placeholder:g,disabled:c,disableIconError:T,...y})=>{let d=xr()?.control,i=a??d;if(!i)throw new h("TimePicker");let p=Pr({control:i,name:l}),k=E(p.errors,l),F=s?.format||"HH:mm",R=e?cr([Ie(F),e]):Ie(F),{field:I}=Fr({control:i,name:l,rules:R,defaultValue:o,shouldUnregister:t});return X(mr,{dateAdapter:dr,adapterLocale:yr,localeText:fr.components.MuiLocalizationProvider.defaultProps.localeText,children:gr(sr,{children:[u&&X(P,{label:u,required:m}),X(ur,{ampm:!1,format:F,value:I.value??null,disabled:c,...s,onChange:(n,b)=>{I.onChange(n,b),s?.onChange?.(n,b)},slots:{textField:pr,openPickerButton:n=>X(Te,{...n,size:y.size})},slotProps:{textField:n=>({variant:"outlined",...n,error:!!k,...y,inputProps:{...n.inputProps,placeholder:g||n.inputProps?.placeholder},InputProps:{...n.InputProps,inputRef:b=>{I.ref(b),typeof n.inputRef=="function"&&n.inputRef(b)}}})}},l),X(V,{name:l,disableIcon:T,control:i})]})})},br=B(hr);console.log("opa");export{Ke as Checkbox,yo as CreatableV2,Bo as DatePicker,V as FieldError,H as FieldInfo,P as FieldLabel,Uo as Form,ie as FormProvider,tt as RadioButton,Xo as RadioGroup,mt as SearchableV2,It as SelectV2,Bt as Slider,Nt as Switch,rr as TextField,br as TimePicker,ne as useForm};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s_mart/form",
3
- "version": "10.0.0-beta.16",
3
+ "version": "10.0.0-beta.18",
4
4
  "main": "./dist/index.mjs",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.mts",
@@ -51,11 +51,11 @@
51
51
  "dayjs": "^1.11.10",
52
52
  "typescript": ">=5.4.2",
53
53
  "@s_mart/core": "10.0.0-beta.8",
54
+ "@s_mart/masks": "5.2.0",
54
55
  "@s_mart/rules": "5.1.2-beta.0",
55
56
  "@s_mart/tokens": "5.1.1",
56
- "@s_mart/masks": "5.2.0",
57
- "@s_mart/utils": "5.3.4",
58
- "@s_mart/typed": "7.2.3"
57
+ "@s_mart/typed": "7.2.3",
58
+ "@s_mart/utils": "5.3.4"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "tsup src/index.tsx --minify --format esm --dts --external react",