@s_mart/form 2.7.10 → 2.7.11
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 +10 -9
- package/dist/index.js +14 -14
- package/dist/index.mjs +12 -12
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { UseFormProps, UseFormReturn, FieldValues, ControllerProps, UseControllerProps } from 'react-hook-form';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { SyntheticEvent } from 'react';
|
|
2
4
|
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
5
|
import { DatePickerProps as DatePickerProps$1, TimePickerProps as TimePickerProps$1 } from '@mui/x-date-pickers';
|
|
4
|
-
import { SyntheticEvent } from 'react';
|
|
5
6
|
|
|
6
7
|
interface IFormProps<T> extends UseFormProps {
|
|
7
8
|
onSubmit: (data: T, methods: UseFormReturn) => void;
|
|
@@ -30,7 +31,7 @@ type TextFieldProps = TextFieldProps$1 & ControllerTextField & {
|
|
|
30
31
|
onInputChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>, value: string, values: FieldValues) => void;
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
declare const
|
|
34
|
+
declare const _default$6: react.MemoExoticComponent<({ name, rules, defaultValue, shouldUnregister, label, required, mask, variant, onInputChange, ...rest }: TextFieldProps) => JSX.Element>;
|
|
34
35
|
|
|
35
36
|
type ControllerSelect = Omit<ControllerProps, 'render' | 'control'>;
|
|
36
37
|
type SelectOption = {
|
|
@@ -42,7 +43,7 @@ type SelectProps = SelectProps$1 & ControllerSelect & {
|
|
|
42
43
|
onInputChange?: (event: SelectChangeEvent, value: string, values: FieldValues) => void;
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
declare const
|
|
46
|
+
declare const _default$5: react.MemoExoticComponent<({ name, rules, defaultValue, shouldUnregister, label, required, options, placeholder, onInputChange, ...rest }: SelectProps) => JSX.Element>;
|
|
46
47
|
|
|
47
48
|
type ControllerSearchable = Omit<ControllerProps, 'render' | 'control'>;
|
|
48
49
|
type SearchableOption = {
|
|
@@ -80,7 +81,7 @@ type SearchableProps = Omit<AutocompleteProps$1<SearchableOption, true, true, tr
|
|
|
80
81
|
noOptionsText?: string;
|
|
81
82
|
};
|
|
82
83
|
|
|
83
|
-
declare const
|
|
84
|
+
declare const _default$4: react.MemoExoticComponent<({ name, rules, defaultValue, shouldUnregister, label, required, options, textFieldProps, noOptionsText, ...rest }: SearchableProps) => JSX.Element>;
|
|
84
85
|
|
|
85
86
|
type ControllerCreatable = Omit<ControllerProps, 'render' | 'control'>;
|
|
86
87
|
type CreatableOption = {
|
|
@@ -149,7 +150,7 @@ type CreatableProps = Omit<AutocompleteProps$1<CreatableOption, true, true, true
|
|
|
149
150
|
})[], values: FieldValues) => void;
|
|
150
151
|
};
|
|
151
152
|
|
|
152
|
-
declare const
|
|
153
|
+
declare const _default$3: react.MemoExoticComponent<({ name, rules, defaultValue, shouldUnregister, label, required, options, onCreateOption, textFieldProps, hideAddButton, onInputChange, ...rest }: CreatableProps) => JSX.Element>;
|
|
153
154
|
|
|
154
155
|
type ControllerCheckbox = Omit<ControllerProps, 'render' | 'control'>;
|
|
155
156
|
type CheckboxProps = CheckboxProps$1 & ControllerCheckbox & {
|
|
@@ -286,7 +287,7 @@ type DatePickerProps = Omit<UseControllerProps, 'control'> & Pick<TextFieldProps
|
|
|
286
287
|
required?: boolean;
|
|
287
288
|
};
|
|
288
289
|
|
|
289
|
-
declare const
|
|
290
|
+
declare const _default$2: react.MemoExoticComponent<({ rules, name, defaultValue, shouldUnregister, datePickerProps, label, required, placeholder, ...rest }: DatePickerProps) => JSX.Element>;
|
|
290
291
|
|
|
291
292
|
type TimePickerProps = Omit<UseControllerProps, 'control'> & Pick<TextFieldProps$1, 'label' | 'error' | 'helperText' | 'size' | 'fullWidth' | 'variant' | 'autoFocus' | 'placeholder'> & {
|
|
292
293
|
timePickerProps?: Partial<TimePickerProps$1<any, any>>;
|
|
@@ -298,7 +299,7 @@ type TimePickerProps = Omit<UseControllerProps, 'control'> & Pick<TextFieldProps
|
|
|
298
299
|
required?: boolean;
|
|
299
300
|
};
|
|
300
301
|
|
|
301
|
-
declare const
|
|
302
|
+
declare const _default$1: react.MemoExoticComponent<({ rules, defaultValue, shouldUnregister, name, required, label, timePickerProps, placeholder, ...rest }: TimePickerProps) => JSX.Element>;
|
|
302
303
|
|
|
303
304
|
type AutocompleteProps<T = any> = Omit<UseControllerProps, 'control'> & Omit<AutocompleteProps$1<T, any, any, any>, 'renderInput' | 'size' | 'onInputChange' | 'onChange'> & {
|
|
304
305
|
/**
|
|
@@ -314,6 +315,6 @@ type AutocompleteProps<T = any> = Omit<UseControllerProps, 'control'> & Omit<Aut
|
|
|
314
315
|
onChange?: (event: SyntheticEvent<Element, Event>, value: any, values: FieldValues) => void;
|
|
315
316
|
};
|
|
316
317
|
|
|
317
|
-
declare const
|
|
318
|
+
declare const _default: react.MemoExoticComponent<({ name, defaultValue, rules, shouldUnregister, label, required, onInputChange, onChange, ...rest }: AutocompleteProps<any>) => JSX.Element>;
|
|
318
319
|
|
|
319
|
-
export { Autocomplete, AutocompleteProps, Checkbox, CheckboxProps, Creatable, CreatableOption, CreatableProps, DatePicker, DatePickerProps, Form, IFormProps, RadioButton, RadioGroup, RadioGroupProps, RadioProps, Searchable, SearchableOption, SearchableProps, Select, SelectOption, SelectProps, Slider, SliderProps, Switch, SwitchProps, TextField, TextFieldProps, TimePicker, TimePickerProps };
|
|
320
|
+
export { _default as Autocomplete, AutocompleteProps, Checkbox, CheckboxProps, _default$3 as Creatable, CreatableOption, CreatableProps, _default$2 as DatePicker, DatePickerProps, Form, IFormProps, RadioButton, RadioGroup, RadioGroupProps, RadioProps, _default$4 as Searchable, SearchableOption, SearchableProps, _default$5 as Select, SelectOption, SelectProps, Slider, SliderProps, Switch, SwitchProps, _default$6 as TextField, TextFieldProps, _default$1 as TimePicker, TimePickerProps };
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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 n in C)Z2.call(C,n)&&i.indexOf(n)<0&&(e[n]=C[n]);if(C!=null&&X)for(var n of X(C))i.indexOf(n)<0&&F2.call(C,n)&&(e[n]=C[n]);return e};var y3=(C,i)=>{for(var e in i)K(C,e,{get:i[e],enumerable:!0})},P2=(C,i,e,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of g3(i))!Z2.call(C,r)&&r!==e&&K(C,r,{get:()=>i[r],enumerable:!(n=u3(i,r))||n.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:()=>I2,TimePicker:()=>a3});module.exports=h3(z3);var b2=require("react"),i2=require("react-hook-form");var c2=require("react/jsx-runtime");function F3(m){var t=m,{children:C,onSubmit:i,style:e,disableDefaultValuesUpdate:n}=t,r=u(t,["children","onSubmit","style","disableDefaultValuesUpdate"]);let H=(0,i2.useForm)(r);(0,b2.useEffect)(()=>{n||H.reset(r.defaultValues)},[r.defaultValues,H.reset]);let s=()=>typeof C=="function"?C(V(o({},H),{onSubmit:H.handleSubmit(a=>i(a,H))})):C;return(0,c2.jsx)(i2.FormProvider,V(o({},H),{children:(0,c2.jsx)("form",{onSubmit:a=>{a.preventDefault(),a.stopPropagation(),H.handleSubmit(p=>i(p,H))()},style:e,children:s()})}))}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,n,r,m;if(C[i])return C[i];if(i.includes("[")){let[t,H]=i.split("["),[s,a]=H.split("].");return(n=(e=C[t])==null?void 0:e[s])==null?void 0:n[a]}if(i.includes(".")){let[t,H,s]=i.split(".");return(m=(r=C[t])==null?void 0:r[H])==null?void 0:m[s]}};var E2=require("react/jsx-runtime"),h=({name:C})=>{var n;let i=(0,A2.useFormContext)(),e=P((n=i==null?void 0:i.formState)==null?void 0:n.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 A=require("react/jsx-runtime"),P3=p=>{var d=p,{name:C,rules:i,defaultValue:e,shouldUnregister:n,label:r,required:m,mask:t,variant:H="outlined",onInputChange:s}=d,a=u(d,["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,Z]=(0,D2.useState)(!1),L=F=>{var g;return t?(g=z==null?void 0:z[t])==null?void 0:g.format(F):F},M=F=>{var g;return t?(g=z==null?void 0:z[t])==null?void 0:g.parse(F):F},l=F=>{if(!F||t!=="porcentagem")return;F==null||F.stopPropagation();let g=(F==null?void 0:F.target).value;if(g){let c=String(g);if(c.length>0){let Y=c.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:n,render:({field:{value:F,onChange:g}})=>(0,A.jsxs)(O.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,A.jsx)(y,{label:r,required:m}),(0,A.jsx)(O.TextField,V(o({variant:H,autoComplete:"off",defaultValue:e,value:L(F||""),onChange:c=>{var Y,y2;g(M((Y=c==null?void 0:c.target)==null?void 0:Y.value)),s==null||s(c,(y2=c==null?void 0:c.target)==null?void 0:y2.value,x.watch())},error:Boolean(U)},a),{type:a.type==="password"?f?"text":"password":a.type,InputProps:o({onKeyDown:l,endAdornment:a.type==="password"&&(0,A.jsx)(O.InputAdornment,{position:"end",onClick:()=>Z(!f),style:{cursor:"pointer"},children:(0,A.jsx)(G2.LIcon,{icon:f?k2:v2,size:"24px",removeMargin:!0})})},a.InputProps)})),(0,A.jsx)(h,{name:C})]})})},I2=P3;var o2=require("react-hook-form"),T=require("@mui/material");var v=require("react/jsx-runtime"),b3=p=>{var d=p,{name:C,rules:i,defaultValue:e,shouldUnregister:n,label:r,required:m,options:t,placeholder:H,onInputChange:s}=d,a=u(d,["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 Z=P(x.formState.errors,C);return console.warn=()=>{},(0,v.jsx)(o2.Controller,{control:x.control,name:C,rules:i,defaultValue:e||"",shouldUnregister:n,render:({field:{value:L,onChange:M}})=>(0,v.jsxs)(T.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,v.jsx)(y,{label:r,required:m}),(0,v.jsxs)(T.Select,V(o({displayEmpty:Boolean(H),variant:"outlined",autoComplete:"off",value:L||"",onChange:l=>{M(l.target.value),s==null||s(l,l.target.value,x.watch())},error:Boolean(Z),size:a.size||"medium"},a),{children:[H&&(0,v.jsx)(T.MenuItem,{disabled:!0,value:"",children:(0,v.jsx)("p",{style:{color:f.grey[400]},children:H})}),t==null?void 0:t.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 d=p,{name:C,rules:i,defaultValue:e,shouldUnregister:n,label:r,required:m,options:t,textFieldProps:H,noOptionsText:s}=d,a=u(d,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText"]);let x=(0,r2.useFormContext)();if(!x)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let f=P(x.formState.errors,C);return console.warn=()=>{},(0,D.jsx)(r2.Controller,{control:x.control,name:C,rules:i,defaultValue:e,shouldUnregister:n,render:({field:{onChange:Z,value:L}})=>(0,D.jsxs)(_.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,D.jsx)(y,{label:r,required:m}),(0,D.jsx)(_.Autocomplete,V(o({onChange:(M,l)=>Z(l),value:L||null,options:t,noOptionsText:s||"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(M,l)=>typeof M=="string"&&typeof l=="string"?M===l:typeof M=="object"&&typeof l=="object"?M.value===l.value:!1,renderOption:(M,l)=>typeof l=="object"?(0,m2.createElement)("li",V(o({},M),{key:l.key||l.value}),l.label):(0,m2.createElement)("li",V(o({},M),{key:l}),l)},a),{renderInput:M=>(0,D.jsx)(_.TextField,o(o({error:Boolean(f)},M),H))})),(0,D.jsx)(h,{name:C})]})})},q2=w3;var l2=require("react-hook-form"),G=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 y3=Object.create;var K=Object.defineProperty,h3=Object.defineProperties,F3=Object.getOwnPropertyDescriptor,P3=Object.getOwnPropertyDescriptors,b3=Object.getOwnPropertyNames,X=Object.getOwnPropertySymbols,w3=Object.getPrototypeOf,c2=Object.prototype.hasOwnProperty,P2=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={}))c2.call(i,e)&&F2(C,e,i[e]);if(X)for(var e of X(i))P2.call(i,e)&&F2(C,e,i[e]);return C},V=(C,i)=>h3(C,P3(i));var u=(C,i)=>{var e={};for(var l in C)c2.call(C,l)&&i.indexOf(l)<0&&(e[l]=C[l]);if(C!=null&&X)for(var l of X(C))i.indexOf(l)<0&&P2.call(C,l)&&(e[l]=C[l]);return e};var k3=(C,i)=>{for(var e in i)K(C,e,{get:i[e],enumerable:!0})},b2=(C,i,e,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of b3(i))!c2.call(C,r)&&r!==e&&K(C,r,{get:()=>i[r],enumerable:!(l=F3(i,r))||l.enumerable});return C};var C2=(C,i,e)=>(e=C!=null?y3(w3(C)):{},b2(i||!C||!C.__esModule?K(e,"default",{value:C,enumerable:!0}):e,C)),v3=C=>b2(K({},"__esModule",{value:!0}),C);var Y3={};k3(Y3,{Autocomplete:()=>g3,Checkbox:()=>Y2,Creatable:()=>W2,DatePicker:()=>s3,Form:()=>k2,RadioButton:()=>Q2,RadioGroup:()=>J2,Searchable:()=>R2,Select:()=>q2,Slider:()=>C3,Switch:()=>K2,TextField:()=>I2,TimePicker:()=>m3});module.exports=v3(Y3);var w2=require("react"),i2=require("react-hook-form");var p2=require("react/jsx-runtime");function S3(m){var t=m,{children:C,onSubmit:i,style:e,disableDefaultValuesUpdate:l}=t,r=u(t,["children","onSubmit","style","disableDefaultValuesUpdate"]);let H=(0,i2.useForm)(r);(0,w2.useEffect)(()=>{l||H.reset(r.defaultValues)},[r.defaultValues,H.reset]);let s=()=>typeof C=="function"?C(V(o({},H),{onSubmit:H.handleSubmit(a=>i(a,H))})):C;return(0,p2.jsx)(i2.FormProvider,V(o({},H),{children:(0,p2.jsx)("form",{onSubmit:a=>{a.preventDefault(),a.stopPropagation(),H.handleSubmit(p=>i(p,H))()},style:e,children:s()})}))}var k2=S3;var e2=require("react"),o2=require("react-hook-form"),O=require("@mui/material");var v2={description:"M39.0611 23.1367C36.3276 17.015 30.4051 13.2479 24.027 13.0909C17.4971 13.2479 11.5746 17.172 8.84117 23.1367C8.68931 23.6076 8.68931 24.2355 8.84117 24.8633C11.5746 30.985 17.4971 34.7521 23.8752 34.9091C30.4051 34.7521 36.1757 30.828 38.9092 24.8633C39.3648 24.2355 39.3648 23.6076 39.0611 23.1367ZM24.027 32.0837C19.6231 31.9268 16.2822 28.1596 16.4341 23.6076C16.586 19.3695 19.9269 15.7593 24.027 15.7593C28.4309 15.9163 31.7718 19.6835 31.62 24.2355C31.4681 28.4735 28.1272 32.0837 24.027 32.0837ZM24.027 18.5847C23.5715 18.5847 23.1159 18.7417 22.6603 18.7417C23.4196 19.8404 23.2677 21.2531 22.3566 22.3519C21.4454 23.2937 20.0787 23.2937 19.0157 22.5088C18.5601 24.7063 19.3194 27.2178 21.1417 28.4735C22.964 29.7292 25.3938 29.7292 27.0642 28.3165C28.7347 26.9039 29.494 24.3924 28.7347 22.1949C28.1272 19.9974 26.1531 18.5847 24.027 18.5847Z",viewBox:"0 0 48 48",id:"line-eye-solid"},S2={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 B2={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 m2=require("@mui/material"),A2=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,A2.toRem)(2)},children:[(0,Q.jsx)(m2.Typography,{variant:"caption",fontWeight:e?400:700,style:{display:"flex",alignItems:"center"},children:C}),i&&(0,Q.jsx)(m2.Typography,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});var T2=require("react-hook-form"),E2=require("@s_mart/core");var P=(C,i)=>{var e,l,r,m;if(C[i])return C[i];if(i.includes("[")){let[t,H]=i.split("["),[s,a]=H.split("].");return(l=(e=C[t])==null?void 0:e[s])==null?void 0:l[a]}if(i.includes(".")){let[t,H,s]=i.split(".");return(m=(r=C[t])==null?void 0:r[H])==null?void 0:m[s]}};var D2=require("react/jsx-runtime"),h=({name:C})=>{var l;let i=(0,T2.useFormContext)(),e=P((l=i==null?void 0:i.formState)==null?void 0:l.errors,C);return e?(0,D2.jsx)(E2.Indicator,{severity:"error",children:e==null?void 0:e.message}):null};var G2=require("@s_mart/core");var A=require("react/jsx-runtime"),B3=p=>{var d=p,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:m,mask:t,variant:H="outlined",onInputChange:s}=d,a=u(d,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","onInputChange"]);let x=(0,o2.useFormContext)();if(!x)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[f,Z]=(0,e2.useState)(!1),L=F=>{var g;return t?(g=z==null?void 0:z[t])==null?void 0:g.format(F):F},M=F=>{var g;return t?(g=z==null?void 0:z[t])==null?void 0:g.parse(F):F},n=F=>{if(!F||t!=="porcentagem")return;F==null||F.stopPropagation();let g=(F==null?void 0:F.target).value;if(g){let c=String(g);if(c.length>0){let Y=c.indexOf("%");Y>-1&&(F.currentTarget.selectionEnd=Y)}}},R=P(x.formState.errors,C);return(0,A.jsx)(o2.Controller,{control:x.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:F,onChange:g}})=>(0,A.jsxs)(O.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,A.jsx)(y,{label:r,required:m}),(0,A.jsx)(O.TextField,V(o({variant:H,autoComplete:"off",defaultValue:e,value:L(F||""),onChange:c=>{var Y,h2;g(M((Y=c==null?void 0:c.target)==null?void 0:Y.value)),s==null||s(c,(h2=c==null?void 0:c.target)==null?void 0:h2.value,x.watch())},error:Boolean(R)},a),{type:a.type==="password"?f?"text":"password":a.type,InputProps:o({onKeyDown:n,endAdornment:a.type==="password"&&(0,A.jsx)(O.InputAdornment,{position:"end",onClick:()=>Z(!f),style:{cursor:"pointer"},children:(0,A.jsx)(G2.LIcon,{icon:f?v2:S2,size:"24px",removeMargin:!0})})},a.InputProps)})),(0,A.jsx)(h,{name:C})]})})},I2=(0,e2.memo)(B3);var $2=require("react"),r2=require("react-hook-form"),T=require("@mui/material");var v=require("react/jsx-runtime"),A3=p=>{var d=p,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:m,options:t,placeholder:H,onInputChange:s}=d,a=u(d,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","onInputChange"]);let x=(0,r2.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 Z=P(x.formState.errors,C);return console.warn=()=>{},(0,v.jsx)(r2.Controller,{control:x.control,name:C,rules:i,defaultValue:e||"",shouldUnregister:l,render:({field:{value:L,onChange:M}})=>(0,v.jsxs)(T.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,v.jsx)(y,{label:r,required:m}),(0,v.jsxs)(T.Select,V(o({displayEmpty:Boolean(H),variant:"outlined",autoComplete:"off",value:L||"",onChange:n=>{M(n.target.value),s==null||s(n,n.target.value,x.watch())},error:Boolean(Z),size:a.size||"medium"},a),{children:[H&&(0,v.jsx)(T.MenuItem,{disabled:!0,value:"",children:(0,v.jsx)("p",{style:{color:f.grey[400]},children:H})}),t==null?void 0:t.map((n,R)=>(0,v.jsx)(T.MenuItem,{value:n.value,children:n.label},R))]})),(0,v.jsx)(h,{name:C})]})})},q2=(0,$2.memo)(A3);var U2=require("react"),n2=require("react-hook-form"),_=require("@mui/material");var D=require("react/jsx-runtime"),u2=require("react"),T3=p=>{var d=p,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:m,options:t,textFieldProps:H,noOptionsText:s}=d,a=u(d,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText"]);let x=(0,n2.useFormContext)();if(!x)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let f=P(x.formState.errors,C);return console.warn=()=>{},(0,D.jsx)(n2.Controller,{control:x.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{onChange:Z,value:L}})=>(0,D.jsxs)(_.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,D.jsx)(y,{label:r,required:m}),(0,D.jsx)(_.Autocomplete,V(o({onChange:(M,n)=>Z(n),value:L||null,options:t,noOptionsText:s||"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(M,n)=>typeof M=="string"&&typeof n=="string"?M===n:typeof M=="object"&&typeof n=="object"?M.value===n.value:!1,renderOption:(M,n)=>typeof n=="object"?(0,u2.createElement)("li",V(o({},M),{key:n.key||n.value}),n.label):(0,u2.createElement)("li",V(o({},M),{key:n}),n)},a),{renderInput:M=>(0,D.jsx)(_.TextField,o(o({error:Boolean(f)},M),H))})),(0,D.jsx)(h,{name:C})]})})},R2=(0,U2.memo)(T3);var N2=require("react"),l2=require("react-hook-form"),G=require("@mui/material");var E=require("@s_mart/utils"),f2=C2(require("@emotion/styled")),g2=require("@emotion/react"),z2=g2.css`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
5
|
-
`,
|
|
5
|
+
`,E3=C=>g2.css`
|
|
6
6
|
.MuiAutocomplete-endAdornment {
|
|
7
7
|
position: relative;
|
|
8
8
|
right: 0;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.creatable {
|
|
12
|
-
${
|
|
12
|
+
${z2}
|
|
13
13
|
|
|
14
14
|
.divider {
|
|
15
15
|
width: 1px;
|
|
@@ -35,18 +35,18 @@
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
`,
|
|
38
|
+
`,O2=f2.default.div`
|
|
39
39
|
display: flex;
|
|
40
40
|
|
|
41
41
|
div.endAdornments {
|
|
42
42
|
position: absolute;
|
|
43
43
|
right: 0;
|
|
44
44
|
|
|
45
|
-
${
|
|
45
|
+
${z2}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
${({hideAddButton:C,theme:i})=>!C&&
|
|
49
|
-
`,
|
|
48
|
+
${({hideAddButton:C,theme:i})=>!C&&E3(i)}
|
|
49
|
+
`,_2=f2.default.div`
|
|
50
50
|
color: ${({theme:C})=>C.palette.text.primary};
|
|
51
51
|
|
|
52
52
|
padding: ${(0,E.toRem)(6)} ${(0,E.toRem)(16)};
|
|
@@ -57,26 +57,26 @@
|
|
|
57
57
|
transition: background-color 0.2s ease-in-out;
|
|
58
58
|
background-color: ${({theme:C})=>C.palette.grey[100]};
|
|
59
59
|
}
|
|
60
|
-
`;var
|
|
60
|
+
`;var j2=require("@s_mart/core");var b=require("react/jsx-runtime"),x2=require("react"),D3=x=>{var f=x,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:m,options:t,onCreateOption:H,textFieldProps:s,hideAddButton:a,onInputChange:p}=f,d=u(f,["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 L=P(Z.formState.errors,C);console.warn=()=>{};let M=n=>{H?H(n):console.error("onCreateOption n\xE3o foi definido")};return(0,b.jsx)(l2.Controller,{control:Z.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:n,onChange:R}})=>{let F=(n==null?void 0:n.label)||(n==null?void 0:n.value)||n;return(0,b.jsxs)(G.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,b.jsx)(y,{label:r,required:m}),(0,b.jsx)(O2,{hideAddButton:a,children:(0,b.jsx)(G.Autocomplete,V(o({fullWidth:!0,onChange:(g,c)=>(p==null||p(c,Z.watch()),R(c)),options:t,value:n||null,noOptionsText:(0,b.jsx)(_2,{onClick:()=>M(n),children:(0,b.jsxs)(G.Typography,{children:["Adicionar ",F&&`"${F}"`]})}),isOptionEqualToValue:(g,c)=>c?typeof g=="string"&&typeof c=="string"?g===c:typeof g=="object"&&typeof c=="object"?g.value===c.value:typeof g=="object"&&typeof c=="string":!1,renderOption:(g,c)=>typeof c=="object"?(0,x2.createElement)("li",V(o({},g),{key:c.key||c.value}),c.label):(0,x2.createElement)("li",V(o({},g),{key:c}),c)},d),{renderInput:g=>{let c=a?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:()=>M(n),children:(0,b.jsx)(j2.LIcon,{icon:B2,size:"24px",removeMargin:!0})})]})]})});return(0,b.jsx)(G.TextField,o(V(o({},g),{error:Boolean(L),onChange:R,InputProps:c}),s))}}))}),(0,b.jsx)(h,{name:C})]})}})},W2=(0,N2.memo)(D3);var H2=require("react-hook-form"),N=require("@mui/material");var I=require("react/jsx-runtime"),G3=s=>{var a=s,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,labelPlacement:m,required:t}=a,H=u(a,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let p=(0,H2.useFormContext)();if(!p)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,I.jsx)(H2.Controller,{control:p.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:d,onChange:x}})=>(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:x},H)),label:(0,I.jsx)(y,{label:r,required:t,regular:!0}),labelPlacement:m||"end"}),(0,I.jsx)(h,{name:C})]})})},Y2=G3;var t2=require("react-hook-form"),j=require("@mui/material");var $=require("react/jsx-runtime"),I3=H=>{var s=H,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,labelPlacement:m}=s,t=u(s,["name","rules","defaultValue","shouldUnregister","label","labelPlacement"]);let a=(0,t2.useFormContext)();if(!a)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,$.jsx)(t2.Controller,{control:a.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:p,onChange:d}})=>(0,$.jsxs)(j.Grid,{display:"flex",flexDirection:"column",children:[(0,$.jsx)(j.FormControlLabel,{control:(0,$.jsx)(j.Switch,o({value:p!=null?p:"",defaultValue:p,onChange:d},t)),label:(0,$.jsx)(y,{label:r}),labelPlacement:m||"end"}),(0,$.jsx)(h,{name:C})]})})},K2=I3;var W=require("@mui/material");var J=require("react/jsx-runtime"),$3=l=>{var r=l,{label:C,labelPlacement:i}=r,e=u(r,["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"})})},Q2=$3;var s2=require("react-hook-form"),V2=require("@mui/material");var U=require("react/jsx-runtime"),q3=a=>{var p=a,{name:C,rules:i,defaultValue:e,shouldUnregister:l,label:r,required:m,children:t,orientation:H="row"}=p,s=u(p,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation"]);let d=(0,s2.useFormContext)();if(!d)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,U.jsx)(s2.Controller,{control:d.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:x,onChange:f}})=>(0,U.jsxs)(V2.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,U.jsx)(y,{label:r,required:m}),(0,U.jsx)(V2.RadioGroup,V(o({value:x||"",onChange:f,name:C},s),{style:{display:"flex",flexDirection:H},children:t})),(0,U.jsx)(h,{name:C})]})})},J2=q3;var d2=require("react-hook-form"),X2=require("@mui/material");var y2=require("react/jsx-runtime"),U3=m=>{var t=m,{name:C,rules:i,defaultValue:e,shouldUnregister:l}=t,r=u(t,["name","rules","defaultValue","shouldUnregister"]);let H=(0,d2.useFormContext)();if(!H)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,y2.jsx)(d2.Controller,{control:H.control,name:C,rules:i,defaultValue:e,shouldUnregister:l,render:({field:{value:s,onChange:a}})=>(0,y2.jsx)(X2.Slider,o({value:s||(r==null?void 0:r.min)||0,onChange:a,valueLabelDisplay:"auto"},r))})},C3=U3;var o3=require("react"),L2=require("react-hook-form"),r3=require("@s_mart/core"),n3=require("@mui/material"),l3=require("@mui/x-date-pickers/DatePicker"),H3=require("@mui/x-date-pickers/AdapterDayjs"),t3=require("@mui/x-date-pickers/LocalizationProvider");var w=require("@s_mart/utils"),i3=C2(require("@emotion/styled")),R3=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)}},z3=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)}`}},e3=i3.default.div`
|
|
61
61
|
> div > button {
|
|
62
|
-
padding: ${({size:C})=>
|
|
62
|
+
padding: ${({size:C})=>z3(C)};
|
|
63
63
|
border-radius: 0 ${(0,w.toRem)(4)} ${(0,w.toRem)(4)} 0;
|
|
64
64
|
|
|
65
65
|
margin: 0px -13px 0px 0px;
|
|
66
66
|
|
|
67
67
|
svg {
|
|
68
|
-
width: ${({size:C})=>
|
|
68
|
+
width: ${({size:C})=>R3(C)};
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
`;var S=require("react/jsx-runtime"),
|
|
71
|
+
`;var S=require("react/jsx-runtime"),O3=a=>{var p=a,{rules:C,name:i,defaultValue:e,shouldUnregister:l,datePickerProps:r,label:m,required:t,placeholder:H}=p,s=u(p,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder"]);let d=(0,L2.useFormContext)();if(!d)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(d.formState.errors,i);return(0,S.jsx)(t3.LocalizationProvider,{dateAdapter:H3.AdapterDayjs,children:(0,S.jsx)(L2.Controller,{control:d.control,name:i,rules:C,defaultValue:e,shouldUnregister:l,render:({field:{value:f,onChange:Z}})=>(0,S.jsxs)(r3.Grid,{display:"flex",flexDirection:"column",children:[m&&(0,S.jsx)(y,{label:m,required:t}),(0,S.jsx)(l3.DatePicker,V(o({},r),{value:f!=null?f:null,inputFormat:(r==null?void 0:r.inputFormat)||"DD/MM/YYYY",onChange:Z,renderInput:L=>{var M,n;return(0,S.jsx)(n3.TextField,V(o(V(o({variant:"outlined"},L),{error:Boolean(x)}),s),{inputProps:V(o({},L.inputProps),{placeholder:H||((M=L.inputProps)==null?void 0:M.placeholder)}),InputProps:V(o({},L.InputProps),{endAdornment:(0,S.jsx)(e3,{size:s.size,children:(n=L.InputProps)==null?void 0:n.endAdornment})})}))}})),(0,S.jsx)(h,{name:i})]})})})},s3=(0,o3.memo)(O3);var L3=require("@s_mart/core"),a3=require("@mui/x-date-pickers/TimePicker"),M3=require("@mui/material"),a2=require("react-hook-form"),Z3=require("@mui/x-date-pickers/AdapterDayjs"),c3=require("@mui/x-date-pickers/LocalizationProvider");var k=require("@s_mart/utils"),V3=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)}},N3=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)}`}},d3=V3.default.div`
|
|
72
72
|
> div > button {
|
|
73
|
-
padding: ${({size:C})=>
|
|
73
|
+
padding: ${({size:C})=>N3(C)};
|
|
74
74
|
border-radius: 0 ${(0,k.toRem)(4)} ${(0,k.toRem)(4)} 0;
|
|
75
75
|
|
|
76
76
|
margin: 0px -13px 0px 0px;
|
|
77
77
|
|
|
78
78
|
svg {
|
|
79
|
-
width: ${({size:C})
|
|
79
|
+
width: ${({size:C})=>_3(C)};
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
`;var B=require("react/jsx-runtime"),
|
|
82
|
+
`;var p3=require("react");var B=require("react/jsx-runtime"),j3=a=>{var p=a,{rules:C,defaultValue:i,shouldUnregister:e,name:l,required:r,label:m,timePickerProps:t,placeholder:H}=p,s=u(p,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder"]);let d=(0,a2.useFormContext)();if(!d)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(d.formState.errors,l);return(0,B.jsx)(c3.LocalizationProvider,{dateAdapter:Z3.AdapterDayjs,children:(0,B.jsx)(a2.Controller,{control:d.control,name:l,rules:C,defaultValue:i,shouldUnregister:e,render:({field:{value:f,onChange:Z}})=>(0,B.jsxs)(L3.Grid,{display:"flex",flexDirection:"column",children:[m&&(0,B.jsx)(y,{label:m,required:r}),(0,B.jsx)(a3.TimePicker,V(o({value:f!=null?f:null,onChange:Z},t),{renderInput:L=>{var M,n;return(0,B.jsx)(M3.TextField,V(o(V(o({variant:"outlined"},L),{error:Boolean(x)}),s),{inputProps:V(o({},L.inputProps),{placeholder:H||((M=L.inputProps)==null?void 0:M.placeholder)}),InputProps:V(o({},L.InputProps),{endAdornment:(0,B.jsx)(d3,{size:s.size,children:(n=L.InputProps)==null?void 0:n.endAdornment})})}))}})),(0,B.jsx)(h,{name:l})]})})})},m3=(0,p3.memo)(j3);var u3=require("react"),M2=require("react-hook-form"),Z2=require("@mui/material"),f3=require("@s_mart/core");var q=require("react/jsx-runtime"),x3=require("react"),W3=a=>{var p=a,{name:C,defaultValue:i,rules:e,shouldUnregister:l,label:r,required:m,onInputChange:t,onChange:H}=p,s=u(p,["name","defaultValue","rules","shouldUnregister","label","required","onInputChange","onChange"]);let d=(0,M2.useFormContext)();if(!d)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(d.formState.errors,C);return console.warn=()=>{},(0,q.jsx)(M2.Controller,{name:C,control:d.control,defaultValue:i,rules:e,shouldUnregister:l,render:({field:f})=>(0,q.jsxs)(f3.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,q.jsx)(y,{label:r,required:m}),(0,q.jsx)(Z2.Autocomplete,V(o({onChange:(Z,L)=>{f.onChange(L),H==null||H(Z,L,d.watch())},onInputChange:(Z,L,M)=>{f.onChange(L),setTimeout(()=>{t==null||t(Z,d.watch(C),M,d.watch())},0)},isOptionEqualToValue:(Z,L)=>Z.value===L.value,renderOption:(Z,L)=>(0,x3.createElement)("li",V(o({},Z),{key:L.key||L.value,onClick:M=>{var n;(n=Z.onClick)==null||n.call(Z,M),f.onChange(L)}}),L.label),value:f.value||null},s),{renderInput:Z=>{var L,M,n;return(0,q.jsx)(Z2.TextField,V(o(o({},Z),s.textFieldProps),{error:Boolean(x),InputProps:V(o(o({},Z.InputProps),(L=s.textFieldProps)==null?void 0:L.InputProps),{inputProps:o(o({},Z.inputProps),(n=(M=s.textFieldProps)==null?void 0:M.InputProps)==null?void 0:n.inputProps)})}))}})),(0,q.jsx)(h,{name:C})]})})},g3=(0,u3.memo)(W3);0&&(module.exports={Autocomplete,Checkbox,Creatable,DatePicker,Form,RadioButton,RadioGroup,Searchable,Select,Slider,Switch,TextField,TimePicker});
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var 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 n in C)W.call(C,n)&&i.indexOf(n)<0&&(o[n]=C[n]);if(C!=null&&U)for(var n of U(C))i.indexOf(n)<0&&Y.call(C,n)&&(o[n]=C[n]);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(m){var t=m,{children:C,onSubmit:i,style:o,disableDefaultValuesUpdate:n}=t,l=u(t,["children","onSubmit","style","disableDefaultValuesUpdate"]);let H=u2(l);p2(()=>{n||H.reset(l.defaultValues)},[l.defaultValues,H.reset]);let s=()=>typeof C=="function"?C(V(e({},H),{onSubmit:H.handleSubmit(a=>i(a,H))})):C;return K(m2,V(e({},H),{children:K("form",{onSubmit:a=>{a.preventDefault(),a.stopPropagation(),H.handleSubmit(p=>i(p,H))()},style:o,children:s()})}))}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,n,l,m;if(C[i])return C[i];if(i.includes("[")){let[t,H]=i.split("["),[s,a]=H.split("].");return(n=(o=C[t])==null?void 0:o[s])==null?void 0:n[a]}if(i.includes(".")){let[t,H,s]=i.split(".");return(m=(l=C[t])==null?void 0:l[H])==null?void 0:m[s]}};import{jsx as P2}from"react/jsx-runtime";var h=({name:C})=>{var n;let i=h2(),o=P((n=i==null?void 0:i.formState)==null?void 0:n.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=p=>{var d=p,{name:C,rules:i,defaultValue:o,shouldUnregister:n,label:l,required:m,mask:t,variant:H="outlined",onInputChange:s}=d,a=u(d,["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,Z]=b2(!1),L=F=>{var g;return t?(g=T==null?void 0:T[t])==null?void 0:g.format(F):F},M=F=>{var g;return t?(g=T==null?void 0:T[t])==null?void 0:g.parse(F):F},r=F=>{if(!F||t!=="porcentagem")return;F==null||F.stopPropagation();let g=(F==null?void 0:F.target).value;if(g){let c=String(g);if(c.length>0){let G=c.indexOf("%");G>-1&&(F.currentTarget.selectionEnd=G)}}},A=P(x.formState.errors,C);return E(w2,{control:x.control,name:C,rules:i,defaultValue:o,shouldUnregister:n,render:({field:{value:F,onChange:g}})=>D2(v2,{display:"flex",flexDirection:"column",children:[l&&E(y,{label:l,required:m}),E(B2,V(e({variant:H,autoComplete:"off",defaultValue:o,value:L(F||""),onChange:c=>{var G,N;g(M((G=c==null?void 0:c.target)==null?void 0:G.value)),s==null||s(c,(N=c==null?void 0:c.target)==null?void 0:N.value,x.watch())},error:Boolean(A)},a),{type:a.type==="password"?f?"text":"password":a.type,InputProps:e({onKeyDown:r,endAdornment:a.type==="password"&&E(S2,{position:"end",onClick:()=>Z(!f),style:{cursor:"pointer"},children:E(A2,{icon:f?Q:J,size:"24px",removeMargin:!0})})},a.InputProps)})),E(h,{name:C})]})})},E2=T2;import{Controller as G2,useFormContext as I2}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=p=>{var d=p,{name:C,rules:i,defaultValue:o,shouldUnregister:n,label:l,required:m,options:t,placeholder:H,onInputChange:s}=d,a=u(d,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","onInputChange"]);let x=I2(),{palette:f}=R2();if(!x)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let Z=P(x.formState.errors,C);return console.warn=()=>{},D(G2,{control:x.control,name:C,rules:i,defaultValue:o||"",shouldUnregister:n,render:({field:{value:L,onChange:M}})=>o2($2,{display:"flex",flexDirection:"column",children:[l&&D(y,{label:l,required:m}),o2(q2,V(e({displayEmpty:Boolean(H),variant:"outlined",autoComplete:"off",value:L||"",onChange:r=>{M(r.target.value),s==null||s(r,r.target.value,x.watch())},error:Boolean(Z),size:a.size||"medium"},a),{children:[H&&D(e2,{disabled:!0,value:"",children:D("p",{style:{color:f.grey[400]},children:H})}),t==null?void 0:t.map((r,A)=>D(e2,{value:r.value,children:r.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 I,jsxs as Q2}from"react/jsx-runtime";import{createElement as r2}from"react";var Y2=p=>{var d=p,{name:C,rules:i,defaultValue:o,shouldUnregister:n,label:l,required:m,options:t,textFieldProps:H,noOptionsText:s}=d,a=u(d,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText"]);let x=_2();if(!x)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let f=P(x.formState.errors,C);return console.warn=()=>{},I(O2,{control:x.control,name:C,rules:i,defaultValue:o,shouldUnregister:n,render:({field:{onChange:Z,value:L}})=>Q2(N2,{display:"flex",flexDirection:"column",children:[l&&I(y,{label:l,required:m}),I(j2,V(e({onChange:(M,r)=>Z(r),value:L||null,options:t,noOptionsText:s||"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(M,r)=>typeof M=="string"&&typeof r=="string"?M===r:typeof M=="object"&&typeof r=="object"?M.value===r.value:!1,renderOption:(M,r)=>typeof r=="object"?r2("li",V(e({},M),{key:r.key||r.value}),r.label):r2("li",V(e({},M),{key:r}),r)},a),{renderInput:M=>I(W2,e(e({error:Boolean(f)},M),H))})),I(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 R=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(R)for(var o of R(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 l in C)W.call(C,l)&&i.indexOf(l)<0&&(o[l]=C[l]);if(C!=null&&R)for(var l of R(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(m){var t=m,{children:C,onSubmit:i,style:o,disableDefaultValuesUpdate:l}=t,n=u(t,["children","onSubmit","style","disableDefaultValuesUpdate"]);let H=u2(n);p2(()=>{l||H.reset(n.defaultValues)},[n.defaultValues,H.reset]);let s=()=>typeof C=="function"?C(V(e({},H),{onSubmit:H.handleSubmit(a=>i(a,H))})):C;return K(m2,V(e({},H),{children:K("form",{onSubmit:a=>{a.preventDefault(),a.stopPropagation(),H.handleSubmit(p=>i(p,H))()},style:o,children:s()})}))}var g2=f2;import{memo as b2,useState as w2}from"react";import{Controller as k2,useFormContext as v2}from"react-hook-form";import{Grid as S2,InputAdornment as B2,TextField as A2}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,l,n,m;if(C[i])return C[i];if(i.includes("[")){let[t,H]=i.split("["),[s,a]=H.split("].");return(l=(o=C[t])==null?void 0:o[s])==null?void 0:l[a]}if(i.includes(".")){let[t,H,s]=i.split(".");return(m=(n=C[t])==null?void 0:n[H])==null?void 0:m[s]}};import{jsx as P2}from"react/jsx-runtime";var h=({name:C})=>{var l;let i=h2(),o=P((l=i==null?void 0:i.formState)==null?void 0:l.errors,C);return o?P2(F2,{severity:"error",children:o==null?void 0:o.message}):null};import{LIcon as T2}from"@s_mart/core";import{jsx as E,jsxs as G2}from"react/jsx-runtime";var E2=p=>{var d=p,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:n,required:m,mask:t,variant:H="outlined",onInputChange:s}=d,a=u(d,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","onInputChange"]);let x=v2();if(!x)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[f,Z]=w2(!1),L=F=>{var g;return t?(g=T==null?void 0:T[t])==null?void 0:g.format(F):F},M=F=>{var g;return t?(g=T==null?void 0:T[t])==null?void 0:g.parse(F):F},r=F=>{if(!F||t!=="porcentagem")return;F==null||F.stopPropagation();let g=(F==null?void 0:F.target).value;if(g){let c=String(g);if(c.length>0){let G=c.indexOf("%");G>-1&&(F.currentTarget.selectionEnd=G)}}},A=P(x.formState.errors,C);return E(k2,{control:x.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:F,onChange:g}})=>G2(S2,{display:"flex",flexDirection:"column",children:[n&&E(y,{label:n,required:m}),E(A2,V(e({variant:H,autoComplete:"off",defaultValue:o,value:L(F||""),onChange:c=>{var G,N;g(M((G=c==null?void 0:c.target)==null?void 0:G.value)),s==null||s(c,(N=c==null?void 0:c.target)==null?void 0:N.value,x.watch())},error:Boolean(A)},a),{type:a.type==="password"?f?"text":"password":a.type,InputProps:e({onKeyDown:r,endAdornment:a.type==="password"&&E(B2,{position:"end",onClick:()=>Z(!f),style:{cursor:"pointer"},children:E(T2,{icon:f?Q:J,size:"24px",removeMargin:!0})})},a.InputProps)})),E(h,{name:C})]})})},D2=b2(E2);import{memo as I2}from"react";import{Controller as $2,useFormContext as q2}from"react-hook-form";import{Grid as U2,Select as R2,MenuItem as e2,useTheme as z2}from"@mui/material";import{jsx as D,jsxs as o2}from"react/jsx-runtime";var O2=p=>{var d=p,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:n,required:m,options:t,placeholder:H,onInputChange:s}=d,a=u(d,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","onInputChange"]);let x=q2(),{palette:f}=z2();if(!x)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let Z=P(x.formState.errors,C);return console.warn=()=>{},D($2,{control:x.control,name:C,rules:i,defaultValue:o||"",shouldUnregister:l,render:({field:{value:L,onChange:M}})=>o2(U2,{display:"flex",flexDirection:"column",children:[n&&D(y,{label:n,required:m}),o2(R2,V(e({displayEmpty:Boolean(H),variant:"outlined",autoComplete:"off",value:L||"",onChange:r=>{M(r.target.value),s==null||s(r,r.target.value,x.watch())},error:Boolean(Z),size:a.size||"medium"},a),{children:[H&&D(e2,{disabled:!0,value:"",children:D("p",{style:{color:f.grey[400]},children:H})}),t==null?void 0:t.map((r,A)=>D(e2,{value:r.value,children:r.label},A))]})),D(h,{name:C})]})})},_2=I2(O2);import{memo as N2}from"react";import{Controller as j2,useFormContext as W2}from"react-hook-form";import{Grid as Y2,Autocomplete as K2,TextField as Q2}from"@mui/material";import{jsx as I,jsxs as C3}from"react/jsx-runtime";import{createElement as r2}from"react";var J2=p=>{var d=p,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:n,required:m,options:t,textFieldProps:H,noOptionsText:s}=d,a=u(d,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText"]);let x=W2();if(!x)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let f=P(x.formState.errors,C);return console.warn=()=>{},I(j2,{control:x.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{onChange:Z,value:L}})=>C3(Y2,{display:"flex",flexDirection:"column",children:[n&&I(y,{label:n,required:m}),I(K2,V(e({onChange:(M,r)=>Z(r),value:L||null,options:t,noOptionsText:s||"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(M,r)=>typeof M=="string"&&typeof r=="string"?M===r:typeof M=="object"&&typeof r=="object"?M.value===r.value:!1,renderOption:(M,r)=>typeof r=="object"?r2("li",V(e({},M),{key:r.key||r.value}),r.label):r2("li",V(e({},M),{key:r}),r)},a),{renderInput:M=>I(Q2,e(e({error:Boolean(f)},M),H))})),I(h,{name:C})]})})},X2=N2(J2);import{memo as e3}from"react";import{Controller as o3,useFormContext as r3}from"react-hook-form";import{Grid as n3,Autocomplete as l3,TextField as H3,Typography as t3}from"@mui/material";import{toRem as v}from"@s_mart/utils";import n2 from"@emotion/styled";import{css as l2}from"@emotion/react";var H2=l2`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
5
|
-
`,
|
|
5
|
+
`,i3=C=>l2`
|
|
6
6
|
.MuiAutocomplete-endAdornment {
|
|
7
7
|
position: relative;
|
|
8
8
|
right: 0;
|
|
@@ -35,7 +35,7 @@ var M2=Object.defineProperty,Z2=Object.defineProperties;var c2=Object.getOwnProp
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
`,t2=
|
|
38
|
+
`,t2=n2.div`
|
|
39
39
|
display: flex;
|
|
40
40
|
|
|
41
41
|
div.endAdornments {
|
|
@@ -45,8 +45,8 @@ var M2=Object.defineProperty,Z2=Object.defineProperties;var c2=Object.getOwnProp
|
|
|
45
45
|
${H2}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
${({hideAddButton:C,theme:i})=>!C&&
|
|
49
|
-
`,s2=
|
|
48
|
+
${({hideAddButton:C,theme:i})=>!C&&i3(i)}
|
|
49
|
+
`,s2=n2.div`
|
|
50
50
|
color: ${({theme:C})=>C.palette.text.primary};
|
|
51
51
|
|
|
52
52
|
padding: ${v(6)} ${v(16)};
|
|
@@ -57,26 +57,26 @@ var M2=Object.defineProperty,Z2=Object.defineProperties;var c2=Object.getOwnProp
|
|
|
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
|
|
60
|
+
`;import{LIcon as s3}from"@s_mart/core";import{jsx as b,jsxs as z}from"react/jsx-runtime";import{createElement as V2}from"react";var V3=x=>{var f=x,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:n,required:m,options:t,onCreateOption:H,textFieldProps:s,hideAddButton:a,onInputChange:p}=f,d=u(f,["name","rules","defaultValue","shouldUnregister","label","required","options","onCreateOption","textFieldProps","hideAddButton","onInputChange"]);let Z=r3();if(!Z)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let L=P(Z.formState.errors,C);console.warn=()=>{};let M=r=>{H?H(r):console.error("onCreateOption n\xE3o foi definido")};return b(o3,{control:Z.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:r,onChange:A}})=>{let F=(r==null?void 0:r.label)||(r==null?void 0:r.value)||r;return z(n3,{display:"flex",flexDirection:"column",children:[n&&b(y,{label:n,required:m}),b(t2,{hideAddButton:a,children:b(l3,V(e({fullWidth:!0,onChange:(g,c)=>(p==null||p(c,Z.watch()),A(c)),options:t,value:r||null,noOptionsText:b(s2,{onClick:()=>M(r),children:z(t3,{children:["Adicionar ",F&&`"${F}"`]})}),isOptionEqualToValue:(g,c)=>c?typeof g=="string"&&typeof c=="string"?g===c:typeof g=="object"&&typeof c=="object"?g.value===c.value:typeof g=="object"&&typeof c=="string":!1,renderOption:(g,c)=>typeof c=="object"?V2("li",V(e({},g),{key:c.key||c.value}),c.label):V2("li",V(e({},g),{key:c}),c)},d),{renderInput:g=>{let c=a?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:()=>M(r),children:b(s3,{icon:X,size:"24px",removeMargin:!0})})]})]})});return b(H3,e(V(e({},g),{error:Boolean(L),onChange:A,InputProps:c}),s))}}))}),b(h,{name:C})]})}})},d3=e3(V3);import{Controller as L3,useFormContext as a3}from"react-hook-form";import{Grid as M3,Checkbox as Z3,FormControlLabel as c3}from"@mui/material";import{jsx as $,jsxs as u3}from"react/jsx-runtime";var p3=s=>{var a=s,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:n,labelPlacement:m,required:t}=a,H=u(a,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let p=a3();if(!p)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return $(L3,{control:p.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:d,onChange:x}})=>u3(M3,{display:"flex",flexDirection:"column",children:[$(c3,{control:$(Z3,e({value:d!=null?d:"",defaultValue:d,onChange:x},H)),label:$(y,{label:n,required:t,regular:!0}),labelPlacement:m||"end"}),$(h,{name:C})]})})},m3=p3;import{Controller as f3,useFormContext as g3}from"react-hook-form";import{Grid as x3,Switch as y3,FormControlLabel as h3}from"@mui/material";import{jsx as q,jsxs as b3}from"react/jsx-runtime";var F3=H=>{var s=H,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:n,labelPlacement:m}=s,t=u(s,["name","rules","defaultValue","shouldUnregister","label","labelPlacement"]);let a=g3();if(!a)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return q(f3,{control:a.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:p,onChange:d}})=>b3(x3,{display:"flex",flexDirection:"column",children:[q(h3,{control:q(y3,e({value:p!=null?p:"",defaultValue:p,onChange:d},t)),label:q(y,{label:n}),labelPlacement:m||"end"}),q(h,{name:C})]})})},P3=F3;import{Grid as w3,Radio as k3,FormControlLabel as v3}from"@mui/material";import{jsx as O}from"react/jsx-runtime";var S3=l=>{var n=l,{label:C,labelPlacement:i}=n,o=u(n,["label","labelPlacement"]);return O(w3,{display:"flex",flexDirection:"column",children:O(v3,{control:O(k3,e({},o)),label:O(y,{label:C}),labelPlacement:i||"end"})})},B3=S3;import{Controller as A3,useFormContext as T3}from"react-hook-form";import{Grid as E3,RadioGroup as D3}from"@mui/material";import{jsx as _,jsxs as $3}from"react/jsx-runtime";var G3=a=>{var p=a,{name:C,rules:i,defaultValue:o,shouldUnregister:l,label:n,required:m,children:t,orientation:H="row"}=p,s=u(p,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation"]);let d=T3();if(!d)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return _(A3,{control:d.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:x,onChange:f}})=>$3(E3,{display:"flex",flexDirection:"column",children:[n&&_(y,{label:n,required:m}),_(D3,V(e({value:x||"",onChange:f,name:C},s),{style:{display:"flex",flexDirection:H},children:t})),_(h,{name:C})]})})},I3=G3;import{Controller as q3,useFormContext as U3}from"react-hook-form";import{Slider as R3}from"@mui/material";import{jsx as d2}from"react/jsx-runtime";var z3=m=>{var t=m,{name:C,rules:i,defaultValue:o,shouldUnregister:l}=t,n=u(t,["name","rules","defaultValue","shouldUnregister"]);let H=U3();if(!H)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return d2(q3,{control:H.control,name:C,rules:i,defaultValue:o,shouldUnregister:l,render:({field:{value:s,onChange:a}})=>d2(R3,e({value:s||(n==null?void 0:n.min)||0,onChange:a,valueLabelDisplay:"auto"},n))})},O3=z3;import{memo as W3}from"react";import{Controller as Y3,useFormContext as K3}from"react-hook-form";import{Grid as Q3}from"@s_mart/core";import{TextField as J3}from"@mui/material";import{DatePicker as X3}from"@mui/x-date-pickers/DatePicker";import{AdapterDayjs as C1}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as i1}from"@mui/x-date-pickers/LocalizationProvider";import{toRem as w}from"@s_mart/utils";import _3 from"@emotion/styled";var N3=C=>{switch(C){case"small":return w(16);default:case"medium":return w(20);case"large":return w(24)}},j3=C=>{switch(C){case"small":return`${w(2)} ${w(8)}`;default:case"medium":return`${w(6)} ${w(8)}`;case"large":return`${w(10)}`}},L2=_3.div`
|
|
61
61
|
> div > button {
|
|
62
|
-
padding: ${({size:C})=>
|
|
62
|
+
padding: ${({size:C})=>j3(C)};
|
|
63
63
|
border-radius: 0 ${w(4)} ${w(4)} 0;
|
|
64
64
|
|
|
65
65
|
margin: 0px -13px 0px 0px;
|
|
66
66
|
|
|
67
67
|
svg {
|
|
68
|
-
width: ${({size:C})=>
|
|
68
|
+
width: ${({size:C})=>N3(C)};
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
`;import{jsx as S,jsxs as
|
|
71
|
+
`;import{jsx as S,jsxs as r1}from"react/jsx-runtime";var e1=a=>{var p=a,{rules:C,name:i,defaultValue:o,shouldUnregister:l,datePickerProps:n,label:m,required:t,placeholder:H}=p,s=u(p,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder"]);let d=K3();if(!d)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(d.formState.errors,i);return S(i1,{dateAdapter:C1,children:S(Y3,{control:d.control,name:i,rules:C,defaultValue:o,shouldUnregister:l,render:({field:{value:f,onChange:Z}})=>r1(Q3,{display:"flex",flexDirection:"column",children:[m&&S(y,{label:m,required:t}),S(X3,V(e({},n),{value:f!=null?f:null,inputFormat:(n==null?void 0:n.inputFormat)||"DD/MM/YYYY",onChange:Z,renderInput:L=>{var M,r;return S(J3,V(e(V(e({variant:"outlined"},L),{error:Boolean(x)}),s),{inputProps:V(e({},L.inputProps),{placeholder:H||((M=L.inputProps)==null?void 0:M.placeholder)}),InputProps:V(e({},L.InputProps),{endAdornment:S(L2,{size:s.size,children:(r=L.InputProps)==null?void 0:r.endAdornment})})}))}})),S(h,{name:i})]})})})},o1=W3(e1);import{Grid as t1}from"@s_mart/core";import{TimePicker as s1}from"@mui/x-date-pickers/TimePicker";import{TextField as V1}from"@mui/material";import{Controller as d1,useFormContext as L1}from"react-hook-form";import{AdapterDayjs as a1}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as M1}from"@mui/x-date-pickers/LocalizationProvider";import{toRem as k}from"@s_mart/utils";import n1 from"@emotion/styled";var l1=C=>{switch(C){case"small":return k(16);default:case"medium":return k(20);case"large":return k(24)}},H1=C=>{switch(C){case"small":return`${k(2)} ${k(8)}`;default:case"medium":return`${k(6)} ${k(8)}`;case"large":return`${k(10)}`}},a2=n1.div`
|
|
72
72
|
> div > button {
|
|
73
|
-
padding: ${({size:C})=>
|
|
73
|
+
padding: ${({size:C})=>H1(C)};
|
|
74
74
|
border-radius: 0 ${k(4)} ${k(4)} 0;
|
|
75
75
|
|
|
76
76
|
margin: 0px -13px 0px 0px;
|
|
77
77
|
|
|
78
78
|
svg {
|
|
79
|
-
width: ${({size:C})=>
|
|
79
|
+
width: ${({size:C})=>l1(C)};
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
`;import{jsx as B,jsxs as
|
|
82
|
+
`;import{memo as Z1}from"react";import{jsx as B,jsxs as m1}from"react/jsx-runtime";var c1=a=>{var p=a,{rules:C,defaultValue:i,shouldUnregister:o,name:l,required:n,label:m,timePickerProps:t,placeholder:H}=p,s=u(p,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder"]);let d=L1();if(!d)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(d.formState.errors,l);return B(M1,{dateAdapter:a1,children:B(d1,{control:d.control,name:l,rules:C,defaultValue:i,shouldUnregister:o,render:({field:{value:f,onChange:Z}})=>m1(t1,{display:"flex",flexDirection:"column",children:[m&&B(y,{label:m,required:n}),B(s1,V(e({value:f!=null?f:null,onChange:Z},t),{renderInput:L=>{var M,r;return B(V1,V(e(V(e({variant:"outlined"},L),{error:Boolean(x)}),s),{inputProps:V(e({},L.inputProps),{placeholder:H||((M=L.inputProps)==null?void 0:M.placeholder)}),InputProps:V(e({},L.InputProps),{endAdornment:B(a2,{size:s.size,children:(r=L.InputProps)==null?void 0:r.endAdornment})})}))}})),B(h,{name:l})]})})})},p1=Z1(c1);import{memo as u1}from"react";import{Controller as f1,useFormContext as g1}from"react-hook-form";import{Autocomplete as x1,TextField as y1}from"@mui/material";import{Grid as h1}from"@s_mart/core";import{jsx as U,jsxs as w1}from"react/jsx-runtime";import{createElement as b1}from"react";var F1=a=>{var p=a,{name:C,defaultValue:i,rules:o,shouldUnregister:l,label:n,required:m,onInputChange:t,onChange:H}=p,s=u(p,["name","defaultValue","rules","shouldUnregister","label","required","onInputChange","onChange"]);let d=g1();if(!d)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(d.formState.errors,C);return console.warn=()=>{},U(f1,{name:C,control:d.control,defaultValue:i,rules:o,shouldUnregister:l,render:({field:f})=>w1(h1,{display:"flex",flexDirection:"column",children:[n&&U(y,{label:n,required:m}),U(x1,V(e({onChange:(Z,L)=>{f.onChange(L),H==null||H(Z,L,d.watch())},onInputChange:(Z,L,M)=>{f.onChange(L),setTimeout(()=>{t==null||t(Z,d.watch(C),M,d.watch())},0)},isOptionEqualToValue:(Z,L)=>Z.value===L.value,renderOption:(Z,L)=>b1("li",V(e({},Z),{key:L.key||L.value,onClick:M=>{var r;(r=Z.onClick)==null||r.call(Z,M),f.onChange(L)}}),L.label),value:f.value||null},s),{renderInput:Z=>{var L,M,r;return U(y1,V(e(e({},Z),s.textFieldProps),{error:Boolean(x),InputProps:V(e(e({},Z.InputProps),(L=s.textFieldProps)==null?void 0:L.InputProps),{inputProps:e(e({},Z.inputProps),(r=(M=s.textFieldProps)==null?void 0:M.InputProps)==null?void 0:r.inputProps)})}))}})),U(h,{name:C})]})})},P1=u1(F1);export{P1 as Autocomplete,m3 as Checkbox,d3 as Creatable,o1 as DatePicker,g2 as Form,B3 as RadioButton,I3 as RadioGroup,X2 as Searchable,_2 as Select,O3 as Slider,P3 as Switch,D2 as TextField,p1 as TimePicker};
|