@s_mart/form 2.7.10 → 2.7.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +31 -9
- package/dist/index.js +22 -22
- package/dist/index.mjs +22 -22
- 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 = {
|
|
@@ -38,11 +39,32 @@ type SelectOption = {
|
|
|
38
39
|
value: string | number | readonly string[] | undefined;
|
|
39
40
|
};
|
|
40
41
|
type SelectProps = SelectProps$1 & ControllerSelect & {
|
|
42
|
+
/**
|
|
43
|
+
* As opções que serão renderizadas no select
|
|
44
|
+
*
|
|
45
|
+
* @type {SelectOption[]}
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* options: [
|
|
49
|
+
* { label: 'Option 1', value: 'option1' },
|
|
50
|
+
* { label: 'Option 2', value: 'option2' },
|
|
51
|
+
* ]
|
|
52
|
+
*/
|
|
41
53
|
options: SelectOption[];
|
|
42
54
|
onInputChange?: (event: SelectChangeEvent, value: string, values: FieldValues) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Se passado o valor, será renderizada abaixo das opções do select, com um divisor e o componente passado
|
|
57
|
+
* @type {ReactNode}
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* <Select
|
|
61
|
+
* options={options}
|
|
62
|
+
* footer={<Button>Footer</Button>}
|
|
63
|
+
*/
|
|
64
|
+
footer?: React.ReactNode;
|
|
43
65
|
};
|
|
44
66
|
|
|
45
|
-
declare const
|
|
67
|
+
declare const _default$5: react.MemoExoticComponent<({ name, rules, defaultValue, shouldUnregister, label, required, options, placeholder, onInputChange, footer, ...rest }: SelectProps) => JSX.Element>;
|
|
46
68
|
|
|
47
69
|
type ControllerSearchable = Omit<ControllerProps, 'render' | 'control'>;
|
|
48
70
|
type SearchableOption = {
|
|
@@ -80,7 +102,7 @@ type SearchableProps = Omit<AutocompleteProps$1<SearchableOption, true, true, tr
|
|
|
80
102
|
noOptionsText?: string;
|
|
81
103
|
};
|
|
82
104
|
|
|
83
|
-
declare const
|
|
105
|
+
declare const _default$4: react.MemoExoticComponent<({ name, rules, defaultValue, shouldUnregister, label, required, options, textFieldProps, noOptionsText, ...rest }: SearchableProps) => JSX.Element>;
|
|
84
106
|
|
|
85
107
|
type ControllerCreatable = Omit<ControllerProps, 'render' | 'control'>;
|
|
86
108
|
type CreatableOption = {
|
|
@@ -149,7 +171,7 @@ type CreatableProps = Omit<AutocompleteProps$1<CreatableOption, true, true, true
|
|
|
149
171
|
})[], values: FieldValues) => void;
|
|
150
172
|
};
|
|
151
173
|
|
|
152
|
-
declare const
|
|
174
|
+
declare const _default$3: react.MemoExoticComponent<({ name, rules, defaultValue, shouldUnregister, label, required, options, onCreateOption, textFieldProps, hideAddButton, onInputChange, ...rest }: CreatableProps) => JSX.Element>;
|
|
153
175
|
|
|
154
176
|
type ControllerCheckbox = Omit<ControllerProps, 'render' | 'control'>;
|
|
155
177
|
type CheckboxProps = CheckboxProps$1 & ControllerCheckbox & {
|
|
@@ -286,7 +308,7 @@ type DatePickerProps = Omit<UseControllerProps, 'control'> & Pick<TextFieldProps
|
|
|
286
308
|
required?: boolean;
|
|
287
309
|
};
|
|
288
310
|
|
|
289
|
-
declare const
|
|
311
|
+
declare const _default$2: react.MemoExoticComponent<({ rules, name, defaultValue, shouldUnregister, datePickerProps, label, required, placeholder, ...rest }: DatePickerProps) => JSX.Element>;
|
|
290
312
|
|
|
291
313
|
type TimePickerProps = Omit<UseControllerProps, 'control'> & Pick<TextFieldProps$1, 'label' | 'error' | 'helperText' | 'size' | 'fullWidth' | 'variant' | 'autoFocus' | 'placeholder'> & {
|
|
292
314
|
timePickerProps?: Partial<TimePickerProps$1<any, any>>;
|
|
@@ -298,7 +320,7 @@ type TimePickerProps = Omit<UseControllerProps, 'control'> & Pick<TextFieldProps
|
|
|
298
320
|
required?: boolean;
|
|
299
321
|
};
|
|
300
322
|
|
|
301
|
-
declare const
|
|
323
|
+
declare const _default$1: react.MemoExoticComponent<({ rules, defaultValue, shouldUnregister, name, required, label, timePickerProps, placeholder, ...rest }: TimePickerProps) => JSX.Element>;
|
|
302
324
|
|
|
303
325
|
type AutocompleteProps<T = any> = Omit<UseControllerProps, 'control'> & Omit<AutocompleteProps$1<T, any, any, any>, 'renderInput' | 'size' | 'onInputChange' | 'onChange'> & {
|
|
304
326
|
/**
|
|
@@ -314,6 +336,6 @@ type AutocompleteProps<T = any> = Omit<UseControllerProps, 'control'> & Omit<Aut
|
|
|
314
336
|
onChange?: (event: SyntheticEvent<Element, Event>, value: any, values: FieldValues) => void;
|
|
315
337
|
};
|
|
316
338
|
|
|
317
|
-
declare const
|
|
339
|
+
declare const _default: react.MemoExoticComponent<({ name, defaultValue, rules, shouldUnregister, label, required, onInputChange, onChange, ...rest }: AutocompleteProps<any>) => JSX.Element>;
|
|
318
340
|
|
|
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 };
|
|
341
|
+
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,19 +1,19 @@
|
|
|
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 h3=Object.create;var K=Object.defineProperty,F3=Object.defineProperties,P3=Object.getOwnPropertyDescriptor,b3=Object.getOwnPropertyDescriptors,w3=Object.getOwnPropertyNames,X=Object.getOwnPropertySymbols,k3=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)=>F3(C,b3(i));var f=(C,i)=>{var e={};for(var n in C)c2.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&&P2.call(C,n)&&(e[n]=C[n]);return e};var v3=(C,i)=>{for(var e in i)K(C,e,{get:i[e],enumerable:!0})},b2=(C,i,e,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of w3(i))!c2.call(C,r)&&r!==e&&K(C,r,{get:()=>i[r],enumerable:!(n=P3(i,r))||n.enumerable});return C};var C2=(C,i,e)=>(e=C!=null?h3(k3(C)):{},b2(i||!C||!C.__esModule?K(e,"default",{value:C,enumerable:!0}):e,C)),S3=C=>b2(K({},"__esModule",{value:!0}),C);var K3={};v3(K3,{Autocomplete:()=>x3,Checkbox:()=>K2,Creatable:()=>Y2,DatePicker:()=>V3,Form:()=>k2,RadioButton:()=>J2,RadioGroup:()=>X2,Searchable:()=>z2,Select:()=>U2,Slider:()=>i3,Switch:()=>Q2,TextField:()=>I2,TimePicker:()=>u3});module.exports=S3(K3);var w2=require("react"),i2=require("react-hook-form");var p2=require("react/jsx-runtime");function B3(u){var t=u,{children:C,onSubmit:i,style:e,disableDefaultValuesUpdate:n}=t,r=f(t,["children","onSubmit","style","disableDefaultValuesUpdate"]);let H=(0,i2.useForm)(r);(0,w2.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,p2.jsx)(i2.FormProvider,V(o({},H),{children:(0,p2.jsx)("form",{onSubmit:a=>{a.preventDefault(),a.stopPropagation(),H.handleSubmit(M=>i(M,H))()},style:e,children:s()})}))}var k2=B3;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,n,r,u;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(u=(r=C[t])==null?void 0:r[H])==null?void 0:u[s]}};var D2=require("react/jsx-runtime"),F=({name:C})=>{var n;let i=(0,T2.useFormContext)(),e=P((n=i==null?void 0:i.formState)==null?void 0:n.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 E=require("react/jsx-runtime"),A3=M=>{var L=M,{name:C,rules:i,defaultValue:e,shouldUnregister:n,label:r,required:u,mask:t,variant:H="outlined",onInputChange:s}=L,a=f(L,["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[m,c]=(0,e2.useState)(!1),d=h=>{var g;return t?(g=z==null?void 0:z[t])==null?void 0:g.format(h):h},Z=h=>{var g;return t?(g=z==null?void 0:z[t])==null?void 0:g.parse(h):h},l=h=>{if(!h||t!=="porcentagem")return;h==null||h.stopPropagation();let g=(h==null?void 0:h.target).value;if(g){let p=String(g);if(p.length>0){let Y=p.indexOf("%");Y>-1&&(h.currentTarget.selectionEnd=Y)}}},k=P(x.formState.errors,C);return(0,E.jsx)(o2.Controller,{control:x.control,name:C,rules:i,defaultValue:e,shouldUnregister:n,render:({field:{value:h,onChange:g}})=>(0,E.jsxs)(O.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,E.jsx)(y,{label:r,required:u}),(0,E.jsx)(O.TextField,V(o({variant:H,autoComplete:"off",defaultValue:e,value:d(h||""),onChange:p=>{var Y,h2;g(Z((Y=p==null?void 0:p.target)==null?void 0:Y.value)),s==null||s(p,(h2=p==null?void 0:p.target)==null?void 0:h2.value,x.watch())},error:Boolean(k)},a),{type:a.type==="password"?m?"text":"password":a.type,InputProps:o({onKeyDown:l,endAdornment:a.type==="password"&&(0,E.jsx)(O.InputAdornment,{position:"end",onClick:()=>c(!m),style:{cursor:"pointer"},children:(0,E.jsx)(G2.LIcon,{icon:m?v2:S2,size:"24px",removeMargin:!0})})},a.InputProps)})),(0,E.jsx)(F,{name:C})]})})},I2=(0,e2.memo)(A3);var $2=require("react"),r2=require("react-hook-form"),B=require("@mui/material");var q2=require("@s_mart/core");var w=require("react/jsx-runtime"),T3=L=>{var x=L,{name:C,rules:i,defaultValue:e,shouldUnregister:n,label:r,required:u,options:t,placeholder:H,onInputChange:s,footer:a}=x,M=f(x,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","onInputChange","footer"]);let m=(0,r2.useFormContext)(),{palette:c}=(0,B.useTheme)();if(!m)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let d=P(m.formState.errors,C);return console.warn=()=>{},(0,w.jsx)(r2.Controller,{control:m.control,name:C,rules:i,defaultValue:e||"",shouldUnregister:n,render:({field:{value:Z,onChange:l}})=>(0,w.jsxs)(B.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,w.jsx)(y,{label:r,required:u}),(0,w.jsxs)(B.Select,V(o({displayEmpty:Boolean(H),variant:"outlined",autoComplete:"off",value:Z||"",onChange:k=>{l(k.target.value),s==null||s(k,k.target.value,m.watch())},error:Boolean(d),size:M.size||"medium"},M),{children:[H&&(0,w.jsx)(B.MenuItem,{disabled:!0,value:"",children:(0,w.jsx)("p",{style:{color:c.grey[400]},children:H})}),t==null?void 0:t.map((k,h)=>(0,w.jsx)(B.MenuItem,{value:k.value,children:k.label},h)),a&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(B.Grid,{px:2,py:1,children:(0,w.jsx)(q2.Divider,{})}),a]})]})),(0,w.jsx)(F,{name:C})]})})},U2=(0,$2.memo)(T3);var R2=require("react"),n2=require("react-hook-form"),_=require("@mui/material");var G=require("react/jsx-runtime"),u2=require("react"),E3=M=>{var L=M,{name:C,rules:i,defaultValue:e,shouldUnregister:n,label:r,required:u,options:t,textFieldProps:H,noOptionsText:s}=L,a=f(L,["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 m=P(x.formState.errors,C);return console.warn=()=>{},(0,G.jsx)(n2.Controller,{control:x.control,name:C,rules:i,defaultValue:e,shouldUnregister:n,render:({field:{onChange:c,value:d}})=>(0,G.jsxs)(_.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,G.jsx)(y,{label:r,required:u}),(0,G.jsx)(_.Autocomplete,V(o({onChange:(Z,l)=>c(l),value:d||null,options:t,noOptionsText:s||"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(Z,l)=>typeof Z=="string"&&typeof l=="string"?Z===l:typeof Z=="object"&&typeof l=="object"?Z.value===l.value:!1,renderOption:(Z,l)=>typeof l=="object"?(0,u2.createElement)("li",V(o({},Z),{key:l.key||l.value}),l.label):(0,u2.createElement)("li",V(o({},Z),{key:l}),l)},a),{renderInput:Z=>(0,G.jsx)(_.TextField,o(o({error:Boolean(m)},Z),H))})),(0,G.jsx)(F,{name:C})]})})},z2=(0,R2.memo)(E3);var j2=require("react"),l2=require("react-hook-form"),I=require("@mui/material");var D=require("@s_mart/utils"),f2=C2(require("@emotion/styled")),g2=require("@emotion/react"),O2=g2.css`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
5
|
-
`,
|
|
5
|
+
`,D3=C=>g2.css`
|
|
6
6
|
.MuiAutocomplete-endAdornment {
|
|
7
7
|
position: relative;
|
|
8
8
|
right: 0;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.creatable {
|
|
12
|
-
${
|
|
12
|
+
${O2}
|
|
13
13
|
|
|
14
14
|
.divider {
|
|
15
15
|
width: 1px;
|
|
16
|
-
height: ${(0,
|
|
16
|
+
height: ${(0,D.toRem)(20)};
|
|
17
17
|
background-color: ${C.palette.grey[400]};
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
color: ${C.palette.grey[600]};
|
|
25
25
|
border-radius: 50%;
|
|
26
26
|
|
|
27
|
-
margin: 0 ${(0,
|
|
28
|
-
width: ${(0,
|
|
29
|
-
height: ${(0,
|
|
27
|
+
margin: 0 ${(0,D.toRem)(6)};
|
|
28
|
+
width: ${(0,D.toRem)(28)};
|
|
29
|
+
height: ${(0,D.toRem)(28)};
|
|
30
30
|
|
|
31
31
|
&:hover {
|
|
32
32
|
cursor: pointer;
|
|
@@ -35,48 +35,48 @@
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
`,
|
|
38
|
+
`,_2=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
|
+
${O2}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
${({hideAddButton:C,theme:i})=>!C&&
|
|
49
|
-
`,
|
|
48
|
+
${({hideAddButton:C,theme:i})=>!C&&D3(i)}
|
|
49
|
+
`,N2=f2.default.div`
|
|
50
50
|
color: ${({theme:C})=>C.palette.text.primary};
|
|
51
51
|
|
|
52
|
-
padding: ${(0,
|
|
53
|
-
margin: ${(0,
|
|
52
|
+
padding: ${(0,D.toRem)(6)} ${(0,D.toRem)(16)};
|
|
53
|
+
margin: ${(0,D.toRem)(-6)} ${(0,D.toRem)(-16)};
|
|
54
54
|
|
|
55
55
|
&:hover {
|
|
56
56
|
cursor: pointer;
|
|
57
57
|
transition: background-color 0.2s ease-in-out;
|
|
58
58
|
background-color: ${({theme:C})=>C.palette.grey[100]};
|
|
59
59
|
}
|
|
60
|
-
`;var
|
|
60
|
+
`;var W2=require("@s_mart/core");var b=require("react/jsx-runtime"),x2=require("react"),G3=x=>{var m=x,{name:C,rules:i,defaultValue:e,shouldUnregister:n,label:r,required:u,options:t,onCreateOption:H,textFieldProps:s,hideAddButton:a,onInputChange:M}=m,L=f(m,["name","rules","defaultValue","shouldUnregister","label","required","options","onCreateOption","textFieldProps","hideAddButton","onInputChange"]);let c=(0,l2.useFormContext)();if(!c)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let d=P(c.formState.errors,C);console.warn=()=>{};let Z=l=>{H?H(l):console.error("onCreateOption n\xE3o foi definido")};return(0,b.jsx)(l2.Controller,{control:c.control,name:C,rules:i,defaultValue:e,shouldUnregister:n,render:({field:{value:l,onChange:k}})=>{let h=(l==null?void 0:l.label)||(l==null?void 0:l.value)||l;return(0,b.jsxs)(I.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,b.jsx)(y,{label:r,required:u}),(0,b.jsx)(_2,{hideAddButton:a,children:(0,b.jsx)(I.Autocomplete,V(o({fullWidth:!0,onChange:(g,p)=>(M==null||M(p,c.watch()),k(p)),options:t,value:l||null,noOptionsText:(0,b.jsx)(N2,{onClick:()=>Z(l),children:(0,b.jsxs)(I.Typography,{children:["Adicionar ",h&&`"${h}"`]})}),isOptionEqualToValue:(g,p)=>p?typeof g=="string"&&typeof p=="string"?g===p:typeof g=="object"&&typeof p=="object"?g.value===p.value:typeof g=="object"&&typeof p=="string":!1,renderOption:(g,p)=>typeof p=="object"?(0,x2.createElement)("li",V(o({},g),{key:p.key||p.value}),p.label):(0,x2.createElement)("li",V(o({},g),{key:p}),p)},L),{renderInput:g=>{let p=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:()=>Z(l),children:(0,b.jsx)(W2.LIcon,{icon:B2,size:"24px",removeMargin:!0})})]})]})});return(0,b.jsx)(I.TextField,o(V(o({},g),{error:Boolean(d),onChange:k,InputProps:p}),s))}}))}),(0,b.jsx)(F,{name:C})]})}})},Y2=(0,j2.memo)(G3);var H2=require("react-hook-form"),N=require("@mui/material");var $=require("react/jsx-runtime"),I3=s=>{var a=s,{name:C,rules:i,defaultValue:e,shouldUnregister:n,label:r,labelPlacement:u,required:t}=a,H=f(a,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let M=(0,H2.useFormContext)();if(!M)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,$.jsx)(H2.Controller,{control:M.control,name:C,rules:i,defaultValue:e,shouldUnregister:n,render:({field:{value:L,onChange:x}})=>(0,$.jsxs)(N.Grid,{display:"flex",flexDirection:"column",children:[(0,$.jsx)(N.FormControlLabel,{control:(0,$.jsx)(N.Checkbox,o({value:L!=null?L:"",defaultValue:L,onChange:x},H)),label:(0,$.jsx)(y,{label:r,required:t,regular:!0}),labelPlacement:u||"end"}),(0,$.jsx)(F,{name:C})]})})},K2=I3;var t2=require("react-hook-form"),j=require("@mui/material");var q=require("react/jsx-runtime"),$3=H=>{var s=H,{name:C,rules:i,defaultValue:e,shouldUnregister:n,label:r,labelPlacement:u}=s,t=f(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,q.jsx)(t2.Controller,{control:a.control,name:C,rules:i,defaultValue:e,shouldUnregister:n,render:({field:{value:M,onChange:L}})=>(0,q.jsxs)(j.Grid,{display:"flex",flexDirection:"column",children:[(0,q.jsx)(j.FormControlLabel,{control:(0,q.jsx)(j.Switch,o({value:M!=null?M:"",defaultValue:M,onChange:L},t)),label:(0,q.jsx)(y,{label:r}),labelPlacement:u||"end"}),(0,q.jsx)(F,{name:C})]})})},Q2=$3;var W=require("@mui/material");var J=require("react/jsx-runtime"),q3=n=>{var r=n,{label:C,labelPlacement:i}=r,e=f(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"})})},J2=q3;var s2=require("react-hook-form"),V2=require("@mui/material");var R=require("react/jsx-runtime"),U3=a=>{var M=a,{name:C,rules:i,defaultValue:e,shouldUnregister:n,label:r,required:u,children:t,orientation:H="row"}=M,s=f(M,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation"]);let L=(0,s2.useFormContext)();if(!L)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return(0,R.jsx)(s2.Controller,{control:L.control,name:C,rules:i,defaultValue:e,shouldUnregister:n,render:({field:{value:x,onChange:m}})=>(0,R.jsxs)(V2.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,R.jsx)(y,{label:r,required:u}),(0,R.jsx)(V2.RadioGroup,V(o({value:x||"",onChange:m,name:C},s),{style:{display:"flex",flexDirection:H},children:t})),(0,R.jsx)(F,{name:C})]})})},X2=U3;var d2=require("react-hook-form"),C3=require("@mui/material");var y2=require("react/jsx-runtime"),R3=u=>{var t=u,{name:C,rules:i,defaultValue:e,shouldUnregister:n}=t,r=f(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:n,render:({field:{value:s,onChange:a}})=>(0,y2.jsx)(C3.Slider,o({value:s||(r==null?void 0:r.min)||0,onChange:a,valueLabelDisplay:"auto"},r))})},i3=R3;var r3=require("react"),L2=require("react-hook-form"),n3=require("@s_mart/core"),l3=require("@mui/material"),H3=require("@mui/x-date-pickers/DatePicker"),t3=require("@mui/x-date-pickers/AdapterDayjs"),s3=require("@mui/x-date-pickers/LocalizationProvider");var v=require("@s_mart/utils"),e3=C2(require("@emotion/styled")),z3=C=>{switch(C){case"small":return(0,v.toRem)(16);default:case"medium":return(0,v.toRem)(20);case"large":return(0,v.toRem)(24)}},O3=C=>{switch(C){case"small":return`${(0,v.toRem)(2)} ${(0,v.toRem)(8)}`;default:case"medium":return`${(0,v.toRem)(6)} ${(0,v.toRem)(8)}`;case"large":return`${(0,v.toRem)(10)}`}},o3=e3.default.div`
|
|
61
61
|
> div > button {
|
|
62
|
-
padding: ${({size:C})=>
|
|
63
|
-
border-radius: 0 ${(0,
|
|
62
|
+
padding: ${({size:C})=>O3(C)};
|
|
63
|
+
border-radius: 0 ${(0,v.toRem)(4)} ${(0,v.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})=>z3(C)};
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
`;var
|
|
71
|
+
`;var A=require("react/jsx-runtime"),_3=a=>{var M=a,{rules:C,name:i,defaultValue:e,shouldUnregister:n,datePickerProps:r,label:u,required:t,placeholder:H}=M,s=f(M,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder"]);let L=(0,L2.useFormContext)();if(!L)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(L.formState.errors,i);return(0,A.jsx)(s3.LocalizationProvider,{dateAdapter:t3.AdapterDayjs,children:(0,A.jsx)(L2.Controller,{control:L.control,name:i,rules:C,defaultValue:e,shouldUnregister:n,render:({field:{value:m,onChange:c}})=>(0,A.jsxs)(n3.Grid,{display:"flex",flexDirection:"column",children:[u&&(0,A.jsx)(y,{label:u,required:t}),(0,A.jsx)(H3.DatePicker,V(o({},r),{value:m!=null?m:null,inputFormat:(r==null?void 0:r.inputFormat)||"DD/MM/YYYY",onChange:c,renderInput:d=>{var Z,l;return(0,A.jsx)(l3.TextField,V(o(V(o({variant:"outlined"},d),{error:Boolean(x)}),s),{inputProps:V(o({},d.inputProps),{placeholder:H||((Z=d.inputProps)==null?void 0:Z.placeholder)}),InputProps:V(o({},d.InputProps),{endAdornment:(0,A.jsx)(o3,{size:s.size,children:(l=d.InputProps)==null?void 0:l.endAdornment})})}))}})),(0,A.jsx)(F,{name:i})]})})})},V3=(0,r3.memo)(_3);var a3=require("@s_mart/core"),M3=require("@mui/x-date-pickers/TimePicker"),Z3=require("@mui/material"),a2=require("react-hook-form"),c3=require("@mui/x-date-pickers/AdapterDayjs"),p3=require("@mui/x-date-pickers/LocalizationProvider");var S=require("@s_mart/utils"),d3=C2(require("@emotion/styled")),N3=C=>{switch(C){case"small":return(0,S.toRem)(16);default:case"medium":return(0,S.toRem)(20);case"large":return(0,S.toRem)(24)}},j3=C=>{switch(C){case"small":return`${(0,S.toRem)(2)} ${(0,S.toRem)(8)}`;default:case"medium":return`${(0,S.toRem)(6)} ${(0,S.toRem)(8)}`;case"large":return`${(0,S.toRem)(10)}`}},L3=d3.default.div`
|
|
72
72
|
> div > button {
|
|
73
|
-
padding: ${({size:C})=>
|
|
74
|
-
border-radius: 0 ${(0,
|
|
73
|
+
padding: ${({size:C})=>j3(C)};
|
|
74
|
+
border-radius: 0 ${(0,S.toRem)(4)} ${(0,S.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})=>N3(C)};
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
`;var
|
|
82
|
+
`;var m3=require("react");var T=require("react/jsx-runtime"),W3=a=>{var M=a,{rules:C,defaultValue:i,shouldUnregister:e,name:n,required:r,label:u,timePickerProps:t,placeholder:H}=M,s=f(M,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder"]);let L=(0,a2.useFormContext)();if(!L)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(L.formState.errors,n);return(0,T.jsx)(p3.LocalizationProvider,{dateAdapter:c3.AdapterDayjs,children:(0,T.jsx)(a2.Controller,{control:L.control,name:n,rules:C,defaultValue:i,shouldUnregister:e,render:({field:{value:m,onChange:c}})=>(0,T.jsxs)(a3.Grid,{display:"flex",flexDirection:"column",children:[u&&(0,T.jsx)(y,{label:u,required:r}),(0,T.jsx)(M3.TimePicker,V(o({value:m!=null?m:null,onChange:c},t),{renderInput:d=>{var Z,l;return(0,T.jsx)(Z3.TextField,V(o(V(o({variant:"outlined"},d),{error:Boolean(x)}),s),{inputProps:V(o({},d.inputProps),{placeholder:H||((Z=d.inputProps)==null?void 0:Z.placeholder)}),InputProps:V(o({},d.InputProps),{endAdornment:(0,T.jsx)(L3,{size:s.size,children:(l=d.InputProps)==null?void 0:l.endAdornment})})}))}})),(0,T.jsx)(F,{name:n})]})})})},u3=(0,m3.memo)(W3);var f3=require("react"),M2=require("react-hook-form"),Z2=require("@mui/material"),g3=require("@s_mart/core");var U=require("react/jsx-runtime"),y3=require("react"),Y3=a=>{var M=a,{name:C,defaultValue:i,rules:e,shouldUnregister:n,label:r,required:u,onInputChange:t,onChange:H}=M,s=f(M,["name","defaultValue","rules","shouldUnregister","label","required","onInputChange","onChange"]);let L=(0,M2.useFormContext)();if(!L)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(L.formState.errors,C);return console.warn=()=>{},(0,U.jsx)(M2.Controller,{name:C,control:L.control,defaultValue:i,rules:e,shouldUnregister:n,render:({field:m})=>(0,U.jsxs)(g3.Grid,{display:"flex",flexDirection:"column",children:[r&&(0,U.jsx)(y,{label:r,required:u}),(0,U.jsx)(Z2.Autocomplete,V(o({onChange:(c,d)=>{m.onChange(d),H==null||H(c,d,L.watch())},onInputChange:(c,d,Z)=>{m.onChange(d),setTimeout(()=>{t==null||t(c,L.watch(C),Z,L.watch())},0)},isOptionEqualToValue:(c,d)=>c.value===d.value,renderOption:(c,d)=>(0,y3.createElement)("li",V(o({},c),{key:d.key||d.value,onClick:Z=>{var l;(l=c.onClick)==null||l.call(c,Z),m.onChange(d)}}),d.label),value:m.value||null},s),{renderInput:c=>{var d,Z,l;return(0,U.jsx)(Z2.TextField,V(o(o({},c),s.textFieldProps),{error:Boolean(x),InputProps:V(o(o({},c.InputProps),(d=s.textFieldProps)==null?void 0:d.InputProps),{inputProps:o(o({},c.inputProps),(l=(Z=s.textFieldProps)==null?void 0:Z.InputProps)==null?void 0:l.inputProps)})}))}})),(0,U.jsx)(F,{name:C})]})})},x3=(0,f3.memo)(Y3);0&&(module.exports={Autocomplete,Checkbox,Creatable,DatePicker,Form,RadioButton,RadioGroup,Searchable,Select,Slider,Switch,TextField,TimePicker});
|
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
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 Z2=Object.defineProperty,c2=Object.defineProperties;var p2=Object.getOwnPropertyDescriptors;var R=Object.getOwnPropertySymbols;var Y=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var W=(C,i,o)=>i in C?Z2(C,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):C[i]=o,e=(C,i)=>{for(var o in i||(i={}))Y.call(i,o)&&W(C,o,i[o]);if(R)for(var o of R(i))K.call(i,o)&&W(C,o,i[o]);return C},V=(C,i)=>c2(C,p2(i));var f=(C,i)=>{var o={};for(var n in C)Y.call(C,n)&&i.indexOf(n)<0&&(o[n]=C[n]);if(C!=null&&R)for(var n of R(C))i.indexOf(n)<0&&K.call(C,n)&&(o[n]=C[n]);return o};import{useEffect as m2}from"react";import{FormProvider as u2,useForm as f2}from"react-hook-form";import{jsx as Q}from"react/jsx-runtime";function g2(u){var t=u,{children:C,onSubmit:i,style:o,disableDefaultValuesUpdate:n}=t,r=f(t,["children","onSubmit","style","disableDefaultValuesUpdate"]);let H=f2(r);m2(()=>{n||H.reset(r.defaultValues)},[r.defaultValues,H.reset]);let s=()=>typeof C=="function"?C(V(e({},H),{onSubmit:H.handleSubmit(a=>i(a,H))})):C;return Q(u2,V(e({},H),{children:Q("form",{onSubmit:a=>{a.preventDefault(),a.stopPropagation(),H.handleSubmit(M=>i(M,H))()},style:o,children:s()})}))}var x2=g2;import{memo as w2,useState as k2}from"react";import{Controller as v2,useFormContext as S2}from"react-hook-form";import{Grid as B2,InputAdornment as A2,TextField as T2}from"@mui/material";var J={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"},X={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 C2={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 E from"@s_mart/masks";import{Typography as i2}from"@mui/material";import{toRem as y2}from"@s_mart/utils";import{jsx as e2,jsxs as h2}from"react/jsx-runtime";var y=({label:C,required:i,regular:o})=>h2("span",{style:{display:"flex",alignItems:"center",gap:y2(2)},children:[e2(i2,{variant:"caption",fontWeight:o?400:700,style:{display:"flex",alignItems:"center"},children:C}),i&&e2(i2,{variant:"caption",fontWeight:900,color:"error",children:"*"})]});import{useFormContext as F2}from"react-hook-form";import{Indicator as P2}from"@s_mart/core";var P=(C,i)=>{var o,n,r,u;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(u=(r=C[t])==null?void 0:r[H])==null?void 0:u[s]}};import{jsx as b2}from"react/jsx-runtime";var F=({name:C})=>{var n;let i=F2(),o=P((n=i==null?void 0:i.formState)==null?void 0:n.errors,C);return o?b2(P2,{severity:"error",children:o==null?void 0:o.message}):null};import{LIcon as E2}from"@s_mart/core";import{jsx as D,jsxs as I2}from"react/jsx-runtime";var D2=M=>{var L=M,{name:C,rules:i,defaultValue:o,shouldUnregister:n,label:r,required:u,mask:t,variant:H="outlined",onInputChange:s}=L,a=f(L,["name","rules","defaultValue","shouldUnregister","label","required","mask","variant","onInputChange"]);let x=S2();if(!x)throw new Error("Para usar o <TextField /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let[m,c]=k2(!1),d=h=>{var g;return t?(g=E==null?void 0:E[t])==null?void 0:g.format(h):h},Z=h=>{var g;return t?(g=E==null?void 0:E[t])==null?void 0:g.parse(h):h},l=h=>{if(!h||t!=="porcentagem")return;h==null||h.stopPropagation();let g=(h==null?void 0:h.target).value;if(g){let p=String(g);if(p.length>0){let G=p.indexOf("%");G>-1&&(h.currentTarget.selectionEnd=G)}}},b=P(x.formState.errors,C);return D(v2,{control:x.control,name:C,rules:i,defaultValue:o,shouldUnregister:n,render:({field:{value:h,onChange:g}})=>I2(B2,{display:"flex",flexDirection:"column",children:[r&&D(y,{label:r,required:u}),D(T2,V(e({variant:H,autoComplete:"off",defaultValue:o,value:d(h||""),onChange:p=>{var G,j;g(Z((G=p==null?void 0:p.target)==null?void 0:G.value)),s==null||s(p,(j=p==null?void 0:p.target)==null?void 0:j.value,x.watch())},error:Boolean(b)},a),{type:a.type==="password"?m?"text":"password":a.type,InputProps:e({onKeyDown:l,endAdornment:a.type==="password"&&D(A2,{position:"end",onClick:()=>c(!m),style:{cursor:"pointer"},children:D(E2,{icon:m?J:X,size:"24px",removeMargin:!0})})},a.InputProps)})),D(F,{name:C})]})})},G2=w2(D2);import{memo as $2}from"react";import{Controller as q2,useFormContext as U2}from"react-hook-form";import{Grid as o2,Select as R2,MenuItem as r2,useTheme as z2}from"@mui/material";import{Divider as O2}from"@s_mart/core";import{Fragment as j2,jsx as S,jsxs as N}from"react/jsx-runtime";var _2=L=>{var x=L,{name:C,rules:i,defaultValue:o,shouldUnregister:n,label:r,required:u,options:t,placeholder:H,onInputChange:s,footer:a}=x,M=f(x,["name","rules","defaultValue","shouldUnregister","label","required","options","placeholder","onInputChange","footer"]);let m=U2(),{palette:c}=z2();if(!m)throw new Error("Para usar o <Select /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let d=P(m.formState.errors,C);return console.warn=()=>{},S(q2,{control:m.control,name:C,rules:i,defaultValue:o||"",shouldUnregister:n,render:({field:{value:Z,onChange:l}})=>N(o2,{display:"flex",flexDirection:"column",children:[r&&S(y,{label:r,required:u}),N(R2,V(e({displayEmpty:Boolean(H),variant:"outlined",autoComplete:"off",value:Z||"",onChange:b=>{l(b.target.value),s==null||s(b,b.target.value,m.watch())},error:Boolean(d),size:M.size||"medium"},M),{children:[H&&S(r2,{disabled:!0,value:"",children:S("p",{style:{color:c.grey[400]},children:H})}),t==null?void 0:t.map((b,h)=>S(r2,{value:b.value,children:b.label},h)),a&&N(j2,{children:[S(o2,{px:2,py:1,children:S(O2,{})}),a]})]})),S(F,{name:C})]})})},N2=$2(_2);import{memo as W2}from"react";import{Controller as Y2,useFormContext as K2}from"react-hook-form";import{Grid as Q2,Autocomplete as J2,TextField as X2}from"@mui/material";import{jsx as I,jsxs as e3}from"react/jsx-runtime";import{createElement as n2}from"react";var C3=M=>{var L=M,{name:C,rules:i,defaultValue:o,shouldUnregister:n,label:r,required:u,options:t,textFieldProps:H,noOptionsText:s}=L,a=f(L,["name","rules","defaultValue","shouldUnregister","label","required","options","textFieldProps","noOptionsText"]);let x=K2();if(!x)throw new Error("Para usar o <Searchable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let m=P(x.formState.errors,C);return console.warn=()=>{},I(Y2,{control:x.control,name:C,rules:i,defaultValue:o,shouldUnregister:n,render:({field:{onChange:c,value:d}})=>e3(Q2,{display:"flex",flexDirection:"column",children:[r&&I(y,{label:r,required:u}),I(J2,V(e({onChange:(Z,l)=>c(l),value:d||null,options:t,noOptionsText:s||"Nenhuma op\xE7\xE3o encontrada",isOptionEqualToValue:(Z,l)=>typeof Z=="string"&&typeof l=="string"?Z===l:typeof Z=="object"&&typeof l=="object"?Z.value===l.value:!1,renderOption:(Z,l)=>typeof l=="object"?n2("li",V(e({},Z),{key:l.key||l.value}),l.label):n2("li",V(e({},Z),{key:l}),l)},a),{renderInput:Z=>I(X2,e(e({error:Boolean(m)},Z),H))})),I(F,{name:C})]})})},i3=W2(C3);import{memo as r3}from"react";import{Controller as n3,useFormContext as l3}from"react-hook-form";import{Grid as H3,Autocomplete as t3,TextField as s3,Typography as V3}from"@mui/material";import{toRem as B}from"@s_mart/utils";import l2 from"@emotion/styled";import{css as H2}from"@emotion/react";var t2=H2`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
5
|
-
`,
|
|
5
|
+
`,o3=C=>H2`
|
|
6
6
|
.MuiAutocomplete-endAdornment {
|
|
7
7
|
position: relative;
|
|
8
8
|
right: 0;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.creatable {
|
|
12
|
-
${
|
|
12
|
+
${t2}
|
|
13
13
|
|
|
14
14
|
.divider {
|
|
15
15
|
width: 1px;
|
|
16
|
-
height: ${
|
|
16
|
+
height: ${B(20)};
|
|
17
17
|
background-color: ${C.palette.grey[400]};
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -24,9 +24,9 @@ var M2=Object.defineProperty,Z2=Object.defineProperties;var c2=Object.getOwnProp
|
|
|
24
24
|
color: ${C.palette.grey[600]};
|
|
25
25
|
border-radius: 50%;
|
|
26
26
|
|
|
27
|
-
margin: 0 ${
|
|
28
|
-
width: ${
|
|
29
|
-
height: ${
|
|
27
|
+
margin: 0 ${B(6)};
|
|
28
|
+
width: ${B(28)};
|
|
29
|
+
height: ${B(28)};
|
|
30
30
|
|
|
31
31
|
&:hover {
|
|
32
32
|
cursor: pointer;
|
|
@@ -35,48 +35,48 @@ var M2=Object.defineProperty,Z2=Object.defineProperties;var c2=Object.getOwnProp
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
`,
|
|
38
|
+
`,s2=l2.div`
|
|
39
39
|
display: flex;
|
|
40
40
|
|
|
41
41
|
div.endAdornments {
|
|
42
42
|
position: absolute;
|
|
43
43
|
right: 0;
|
|
44
44
|
|
|
45
|
-
${
|
|
45
|
+
${t2}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
${({hideAddButton:C,theme:i})=>!C&&
|
|
49
|
-
`,
|
|
48
|
+
${({hideAddButton:C,theme:i})=>!C&&o3(i)}
|
|
49
|
+
`,V2=l2.div`
|
|
50
50
|
color: ${({theme:C})=>C.palette.text.primary};
|
|
51
51
|
|
|
52
|
-
padding: ${
|
|
53
|
-
margin: ${
|
|
52
|
+
padding: ${B(6)} ${B(16)};
|
|
53
|
+
margin: ${B(-6)} ${B(-16)};
|
|
54
54
|
|
|
55
55
|
&:hover {
|
|
56
56
|
cursor: pointer;
|
|
57
57
|
transition: background-color 0.2s ease-in-out;
|
|
58
58
|
background-color: ${({theme:C})=>C.palette.grey[100]};
|
|
59
59
|
}
|
|
60
|
-
`;import{LIcon as
|
|
60
|
+
`;import{LIcon as d3}from"@s_mart/core";import{jsx as w,jsxs as z}from"react/jsx-runtime";import{createElement as d2}from"react";var L3=x=>{var m=x,{name:C,rules:i,defaultValue:o,shouldUnregister:n,label:r,required:u,options:t,onCreateOption:H,textFieldProps:s,hideAddButton:a,onInputChange:M}=m,L=f(m,["name","rules","defaultValue","shouldUnregister","label","required","options","onCreateOption","textFieldProps","hideAddButton","onInputChange"]);let c=l3();if(!c)throw new Error("Para usar o <Creatable /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let d=P(c.formState.errors,C);console.warn=()=>{};let Z=l=>{H?H(l):console.error("onCreateOption n\xE3o foi definido")};return w(n3,{control:c.control,name:C,rules:i,defaultValue:o,shouldUnregister:n,render:({field:{value:l,onChange:b}})=>{let h=(l==null?void 0:l.label)||(l==null?void 0:l.value)||l;return z(H3,{display:"flex",flexDirection:"column",children:[r&&w(y,{label:r,required:u}),w(s2,{hideAddButton:a,children:w(t3,V(e({fullWidth:!0,onChange:(g,p)=>(M==null||M(p,c.watch()),b(p)),options:t,value:l||null,noOptionsText:w(V2,{onClick:()=>Z(l),children:z(V3,{children:["Adicionar ",h&&`"${h}"`]})}),isOptionEqualToValue:(g,p)=>p?typeof g=="string"&&typeof p=="string"?g===p:typeof g=="object"&&typeof p=="object"?g.value===p.value:typeof g=="object"&&typeof p=="string":!1,renderOption:(g,p)=>typeof p=="object"?d2("li",V(e({},g),{key:p.key||p.value}),p.label):d2("li",V(e({},g),{key:p}),p)},L),{renderInput:g=>{let p=a?g.InputProps:V(e({},g.InputProps),{endAdornment:z("div",{className:"endAdornments",children:[g.InputProps.endAdornment,z("div",{className:"creatable",children:[w("div",{className:"divider"}),w("div",{className:"button",onClick:()=>Z(l),children:w(d3,{icon:C2,size:"24px",removeMargin:!0})})]})]})});return w(s3,e(V(e({},g),{error:Boolean(d),onChange:b,InputProps:p}),s))}}))}),w(F,{name:C})]})}})},a3=r3(L3);import{Controller as M3,useFormContext as Z3}from"react-hook-form";import{Grid as c3,Checkbox as p3,FormControlLabel as m3}from"@mui/material";import{jsx as $,jsxs as g3}from"react/jsx-runtime";var u3=s=>{var a=s,{name:C,rules:i,defaultValue:o,shouldUnregister:n,label:r,labelPlacement:u,required:t}=a,H=f(a,["name","rules","defaultValue","shouldUnregister","label","labelPlacement","required"]);let M=Z3();if(!M)throw new Error("Para usar o <Checkbox /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return $(M3,{control:M.control,name:C,rules:i,defaultValue:o,shouldUnregister:n,render:({field:{value:L,onChange:x}})=>g3(c3,{display:"flex",flexDirection:"column",children:[$(m3,{control:$(p3,e({value:L!=null?L:"",defaultValue:L,onChange:x},H)),label:$(y,{label:r,required:t,regular:!0}),labelPlacement:u||"end"}),$(F,{name:C})]})})},f3=u3;import{Controller as x3,useFormContext as y3}from"react-hook-form";import{Grid as h3,Switch as F3,FormControlLabel as P3}from"@mui/material";import{jsx as q,jsxs as k3}from"react/jsx-runtime";var b3=H=>{var s=H,{name:C,rules:i,defaultValue:o,shouldUnregister:n,label:r,labelPlacement:u}=s,t=f(s,["name","rules","defaultValue","shouldUnregister","label","labelPlacement"]);let a=y3();if(!a)throw new Error("Para usar o <Switch /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return q(x3,{control:a.control,name:C,rules:i,defaultValue:o,shouldUnregister:n,render:({field:{value:M,onChange:L}})=>k3(h3,{display:"flex",flexDirection:"column",children:[q(P3,{control:q(F3,e({value:M!=null?M:"",defaultValue:M,onChange:L},t)),label:q(y,{label:r}),labelPlacement:u||"end"}),q(F,{name:C})]})})},w3=b3;import{Grid as v3,Radio as S3,FormControlLabel as B3}from"@mui/material";import{jsx as O}from"react/jsx-runtime";var A3=n=>{var r=n,{label:C,labelPlacement:i}=r,o=f(r,["label","labelPlacement"]);return O(v3,{display:"flex",flexDirection:"column",children:O(B3,{control:O(S3,e({},o)),label:O(y,{label:C}),labelPlacement:i||"end"})})},T3=A3;import{Controller as E3,useFormContext as D3}from"react-hook-form";import{Grid as G3,RadioGroup as I3}from"@mui/material";import{jsx as _,jsxs as U3}from"react/jsx-runtime";var $3=a=>{var M=a,{name:C,rules:i,defaultValue:o,shouldUnregister:n,label:r,required:u,children:t,orientation:H="row"}=M,s=f(M,["name","rules","defaultValue","shouldUnregister","label","required","children","orientation"]);let L=D3();if(!L)throw new Error("Para usar o <RadioGroup /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return _(E3,{control:L.control,name:C,rules:i,defaultValue:o,shouldUnregister:n,render:({field:{value:x,onChange:m}})=>U3(G3,{display:"flex",flexDirection:"column",children:[r&&_(y,{label:r,required:u}),_(I3,V(e({value:x||"",onChange:m,name:C},s),{style:{display:"flex",flexDirection:H},children:t})),_(F,{name:C})]})})},q3=$3;import{Controller as R3,useFormContext as z3}from"react-hook-form";import{Slider as O3}from"@mui/material";import{jsx as L2}from"react/jsx-runtime";var _3=u=>{var t=u,{name:C,rules:i,defaultValue:o,shouldUnregister:n}=t,r=f(t,["name","rules","defaultValue","shouldUnregister"]);let H=z3();if(!H)throw new Error("Para usar o <Slider /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");return L2(R3,{control:H.control,name:C,rules:i,defaultValue:o,shouldUnregister:n,render:({field:{value:s,onChange:a}})=>L2(O3,e({value:s||(r==null?void 0:r.min)||0,onChange:a,valueLabelDisplay:"auto"},r))})},N3=_3;import{memo as K3}from"react";import{Controller as Q3,useFormContext as J3}from"react-hook-form";import{Grid as X3}from"@s_mart/core";import{TextField as C1}from"@mui/material";import{DatePicker as i1}from"@mui/x-date-pickers/DatePicker";import{AdapterDayjs as e1}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as o1}from"@mui/x-date-pickers/LocalizationProvider";import{toRem as k}from"@s_mart/utils";import j3 from"@emotion/styled";var W3=C=>{switch(C){case"small":return k(16);default:case"medium":return k(20);case"large":return k(24)}},Y3=C=>{switch(C){case"small":return`${k(2)} ${k(8)}`;default:case"medium":return`${k(6)} ${k(8)}`;case"large":return`${k(10)}`}},a2=j3.div`
|
|
61
61
|
> div > button {
|
|
62
|
-
padding: ${({size:C})=>
|
|
63
|
-
border-radius: 0 ${
|
|
62
|
+
padding: ${({size:C})=>Y3(C)};
|
|
63
|
+
border-radius: 0 ${k(4)} ${k(4)} 0;
|
|
64
64
|
|
|
65
65
|
margin: 0px -13px 0px 0px;
|
|
66
66
|
|
|
67
67
|
svg {
|
|
68
|
-
width: ${({size:C})=>
|
|
68
|
+
width: ${({size:C})=>W3(C)};
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
`;import{jsx as
|
|
71
|
+
`;import{jsx as A,jsxs as l1}from"react/jsx-runtime";var r1=a=>{var M=a,{rules:C,name:i,defaultValue:o,shouldUnregister:n,datePickerProps:r,label:u,required:t,placeholder:H}=M,s=f(M,["rules","name","defaultValue","shouldUnregister","datePickerProps","label","required","placeholder"]);let L=J3();if(!L)throw new Error("Para usar o <DataPicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(L.formState.errors,i);return A(o1,{dateAdapter:e1,children:A(Q3,{control:L.control,name:i,rules:C,defaultValue:o,shouldUnregister:n,render:({field:{value:m,onChange:c}})=>l1(X3,{display:"flex",flexDirection:"column",children:[u&&A(y,{label:u,required:t}),A(i1,V(e({},r),{value:m!=null?m:null,inputFormat:(r==null?void 0:r.inputFormat)||"DD/MM/YYYY",onChange:c,renderInput:d=>{var Z,l;return A(C1,V(e(V(e({variant:"outlined"},d),{error:Boolean(x)}),s),{inputProps:V(e({},d.inputProps),{placeholder:H||((Z=d.inputProps)==null?void 0:Z.placeholder)}),InputProps:V(e({},d.InputProps),{endAdornment:A(a2,{size:s.size,children:(l=d.InputProps)==null?void 0:l.endAdornment})})}))}})),A(F,{name:i})]})})})},n1=K3(r1);import{Grid as V1}from"@s_mart/core";import{TimePicker as d1}from"@mui/x-date-pickers/TimePicker";import{TextField as L1}from"@mui/material";import{Controller as a1,useFormContext as M1}from"react-hook-form";import{AdapterDayjs as Z1}from"@mui/x-date-pickers/AdapterDayjs";import{LocalizationProvider as c1}from"@mui/x-date-pickers/LocalizationProvider";import{toRem as v}from"@s_mart/utils";import H1 from"@emotion/styled";var t1=C=>{switch(C){case"small":return v(16);default:case"medium":return v(20);case"large":return v(24)}},s1=C=>{switch(C){case"small":return`${v(2)} ${v(8)}`;default:case"medium":return`${v(6)} ${v(8)}`;case"large":return`${v(10)}`}},M2=H1.div`
|
|
72
72
|
> div > button {
|
|
73
|
-
padding: ${({size:C})=>
|
|
74
|
-
border-radius: 0 ${
|
|
73
|
+
padding: ${({size:C})=>s1(C)};
|
|
74
|
+
border-radius: 0 ${v(4)} ${v(4)} 0;
|
|
75
75
|
|
|
76
76
|
margin: 0px -13px 0px 0px;
|
|
77
77
|
|
|
78
78
|
svg {
|
|
79
|
-
width: ${({size:C})=>
|
|
79
|
+
width: ${({size:C})=>t1(C)};
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
`;import{jsx as
|
|
82
|
+
`;import{memo as p1}from"react";import{jsx as T,jsxs as f1}from"react/jsx-runtime";var m1=a=>{var M=a,{rules:C,defaultValue:i,shouldUnregister:o,name:n,required:r,label:u,timePickerProps:t,placeholder:H}=M,s=f(M,["rules","defaultValue","shouldUnregister","name","required","label","timePickerProps","placeholder"]);let L=M1();if(!L)throw new Error("Para usar o <TimePicker /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(L.formState.errors,n);return T(c1,{dateAdapter:Z1,children:T(a1,{control:L.control,name:n,rules:C,defaultValue:i,shouldUnregister:o,render:({field:{value:m,onChange:c}})=>f1(V1,{display:"flex",flexDirection:"column",children:[u&&T(y,{label:u,required:r}),T(d1,V(e({value:m!=null?m:null,onChange:c},t),{renderInput:d=>{var Z,l;return T(L1,V(e(V(e({variant:"outlined"},d),{error:Boolean(x)}),s),{inputProps:V(e({},d.inputProps),{placeholder:H||((Z=d.inputProps)==null?void 0:Z.placeholder)}),InputProps:V(e({},d.InputProps),{endAdornment:T(M2,{size:s.size,children:(l=d.InputProps)==null?void 0:l.endAdornment})})}))}})),T(F,{name:n})]})})})},u1=p1(m1);import{memo as g1}from"react";import{Controller as x1,useFormContext as y1}from"react-hook-form";import{Autocomplete as h1,TextField as F1}from"@mui/material";import{Grid as P1}from"@s_mart/core";import{jsx as U,jsxs as v1}from"react/jsx-runtime";import{createElement as k1}from"react";var b1=a=>{var M=a,{name:C,defaultValue:i,rules:o,shouldUnregister:n,label:r,required:u,onInputChange:t,onChange:H}=M,s=f(M,["name","defaultValue","rules","shouldUnregister","label","required","onInputChange","onChange"]);let L=y1();if(!L)throw new Error("Para usar o <Autocomplete /> \xE9 necess\xE1rio que ele esteja dentro de um <Form />");let x=P(L.formState.errors,C);return console.warn=()=>{},U(x1,{name:C,control:L.control,defaultValue:i,rules:o,shouldUnregister:n,render:({field:m})=>v1(P1,{display:"flex",flexDirection:"column",children:[r&&U(y,{label:r,required:u}),U(h1,V(e({onChange:(c,d)=>{m.onChange(d),H==null||H(c,d,L.watch())},onInputChange:(c,d,Z)=>{m.onChange(d),setTimeout(()=>{t==null||t(c,L.watch(C),Z,L.watch())},0)},isOptionEqualToValue:(c,d)=>c.value===d.value,renderOption:(c,d)=>k1("li",V(e({},c),{key:d.key||d.value,onClick:Z=>{var l;(l=c.onClick)==null||l.call(c,Z),m.onChange(d)}}),d.label),value:m.value||null},s),{renderInput:c=>{var d,Z,l;return U(F1,V(e(e({},c),s.textFieldProps),{error:Boolean(x),InputProps:V(e(e({},c.InputProps),(d=s.textFieldProps)==null?void 0:d.InputProps),{inputProps:e(e({},c.inputProps),(l=(Z=s.textFieldProps)==null?void 0:Z.InputProps)==null?void 0:l.inputProps)})}))}})),U(F,{name:C})]})})},w1=g1(b1);export{w1 as Autocomplete,f3 as Checkbox,a3 as Creatable,n1 as DatePicker,x2 as Form,T3 as RadioButton,q3 as RadioGroup,i3 as Searchable,N2 as Select,N3 as Slider,w3 as Switch,G2 as TextField,u1 as TimePicker};
|