@s_mart/form 11.0.2 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/checkbox/checkbox.d.ts +3 -0
  2. package/dist/checkbox/checkbox.types.d.ts +28 -0
  3. package/dist/components/fieldError/fieldError.d.ts +4 -0
  4. package/dist/components/fieldError/fieldError.types.d.ts +6 -0
  5. package/dist/components/fieldError/index.d.ts +2 -0
  6. package/dist/components/fieldInfo/fieldInfo.d.ts +3 -0
  7. package/dist/components/fieldInfo/fieldInfo.types.d.ts +3 -0
  8. package/dist/components/fieldInfo/index.d.ts +2 -0
  9. package/dist/components/fieldLabel/fieldLabel.d.ts +3 -0
  10. package/dist/components/fieldLabel/fieldLabel.types.d.ts +5 -0
  11. package/dist/components/fieldLabel/index.d.ts +2 -0
  12. package/dist/creatableV2/creatableV2.d.ts +4 -0
  13. package/dist/creatableV2/creatableV2.styles.d.ts +1 -0
  14. package/dist/creatableV2/creatableV2.types.d.ts +71 -0
  15. package/dist/datePicker/datePicker.d.ts +3 -0
  16. package/dist/datePicker/datePicker.styles.d.ts +1 -0
  17. package/dist/datePicker/datePicker.types.d.ts +33 -0
  18. package/dist/form/form.d.ts +22 -0
  19. package/dist/form/form.types.d.ts +20 -0
  20. package/dist/form/formProvider.d.ts +4 -0
  21. package/dist/form/useForm.d.ts +6 -0
  22. package/dist/formComponentPrecisaDeControl.d.ts +3 -0
  23. package/dist/index.d.ts +32 -0
  24. package/dist/index.mjs +828 -15
  25. package/dist/index.mjs.map +1 -0
  26. package/dist/radio/radioButton/radioButton.d.ts +3 -0
  27. package/dist/radio/radioButton/radioButton.types.d.ts +19 -0
  28. package/dist/radio/radioGroup/radioGroup.d.ts +3 -0
  29. package/dist/radio/radioGroup/radioGroup.types.d.ts +44 -0
  30. package/dist/searchableV2/searchableV2.d.ts +3 -0
  31. package/dist/searchableV2/searchableV2.types.d.ts +51 -0
  32. package/dist/selectV2/selectV2.d.ts +4 -0
  33. package/dist/selectV2/selectV2.types.d.ts +68 -0
  34. package/dist/selectV2/selectV2RenderValue.d.ts +3 -0
  35. package/dist/slider/slider.d.ts +3 -0
  36. package/dist/slider/slider.types.d.ts +20 -0
  37. package/dist/switch/switch.d.ts +3 -0
  38. package/dist/switch/switch.types.d.ts +28 -0
  39. package/dist/textField/textField.d.ts +3 -0
  40. package/dist/textField/textField.types.d.ts +43 -0
  41. package/dist/timePicker/timePicker.d.ts +3 -0
  42. package/dist/timePicker/timePicker.styles.d.ts +1 -0
  43. package/dist/timePicker/timePicker.types.d.ts +33 -0
  44. package/dist/utils/erroFieldFormatado.d.ts +2 -0
  45. package/dist/utils/typedMemo.d.ts +1 -0
  46. package/package.json +48 -48
  47. package/dist/index.d.mts +0 -523
package/package.json CHANGED
@@ -1,67 +1,67 @@
1
1
  {
2
2
  "name": "@s_mart/form",
3
- "version": "11.0.2",
3
+ "version": "16.0.0",
4
+ "license": "MIT",
5
+ "type": "module",
4
6
  "main": "./dist/index.mjs",
5
7
  "module": "./dist/index.mjs",
6
- "types": "./dist/index.d.mts",
8
+ "types": "./dist/index.d.ts",
7
9
  "sideEffects": false,
8
- "license": "MIT",
9
10
  "files": [
10
11
  "dist/**"
11
12
  ],
12
13
  "dependencies": {
13
- "@hookform/resolvers": "^3.1.0",
14
- "lodash-es": "^4.17.21",
15
- "tsup": "8.5.0"
14
+ "@hookform/resolvers": "^5.9.1",
15
+ "lodash-es": "^4.18.1"
16
+ },
17
+ "devDependencies": {
18
+ "@emotion/styled": "^11.14.1",
19
+ "@mui/material": "^9.3.1",
20
+ "@mui/system": "^9.3.0",
21
+ "@mui/x-date-pickers": "^9.12.0",
22
+ "@s_mart/core": "16.0.0",
23
+ "@s_mart/masks": "16.0.0",
24
+ "@s_mart/regular-icons": "16.0.0",
25
+ "@s_mart/rules": "16.0.0",
26
+ "@s_mart/solid-icons": "16.0.0",
27
+ "@s_mart/tokens": "16.0.0",
28
+ "@s_mart/typed": "16.0.0",
29
+ "@s_mart/utils": "16.0.0",
30
+ "@types/lodash-es": "^4.17.12",
31
+ "@types/react": "^19.2.18",
32
+ "@types/react-dom": "^19.2.5",
33
+ "dayjs": "^1.11.23",
34
+ "react": "^19.2.8",
35
+ "react-dom": "^19.2.8",
36
+ "react-hook-form": "^7.85.0",
37
+ "typescript": "^7.0.2"
16
38
  },
17
39
  "peerDependencies": {
18
40
  "@emotion/react": "^11.11.4",
19
41
  "@emotion/styled": "^11.13.0",
20
- "@mui/material": "^7.2.0",
21
- "@mui/system": "^7.2.0",
22
- "@mui/x-date-pickers": "^8.6.0",
23
- "@types/lodash-es": ">=4.17.12",
24
- "@types/node": ">=22.15.17",
25
- "@types/react": "^18.3.12 || ^19.0.0",
26
- "@types/react-dom": "^18.3.1 || ^19.0.0",
27
- "dayjs": "^1.11.10",
28
- "react": "^18.3.1 || ^19.0.0",
29
- "react-dom": "^18.3.1 || ^19.0.0",
30
- "react-hook-form": "^7.51.0",
31
- "typescript": ">=5.4.2",
32
- "zod": "^3.22.4",
33
- "@s_mart/core": "11.0.3",
34
- "@s_mart/masks": "5.4.0",
35
- "@s_mart/regular-icons": "6.0.18",
36
- "@s_mart/rules": "5.3.0",
37
- "@s_mart/solid-icons": "6.0.19",
38
- "@s_mart/tokens": "6.0.0",
39
- "@s_mart/typed": "8.0.1",
40
- "@s_mart/utils": "5.5.0"
41
- },
42
- "devDependencies": {
43
- "@emotion/styled": "^11.13.0",
44
- "@mui/material": "^7.2.0",
45
- "@mui/system": "^7.2.0",
46
- "@mui/x-date-pickers": "^8.6.0",
42
+ "@mui/material": "^9.0.0",
43
+ "@mui/system": "^9.0.0",
44
+ "@mui/x-date-pickers": "^9.0.0",
45
+ "@s_mart/core": "16.0.0",
46
+ "@s_mart/masks": "16.0.0",
47
+ "@s_mart/regular-icons": "16.0.0",
48
+ "@s_mart/rules": "16.0.0",
49
+ "@s_mart/solid-icons": "16.0.0",
50
+ "@s_mart/tokens": "16.0.0",
51
+ "@s_mart/typed": "16.0.0",
52
+ "@s_mart/utils": "16.0.0",
47
53
  "@types/lodash-es": ">=4.17.12",
48
- "@types/node": ">=22.15.17",
49
- "@types/react": "^18.3.12",
50
- "@types/react-dom": "^18.3.1",
54
+ "@types/react": ">=18.3.12",
55
+ "@types/react-dom": ">=18.3.1",
51
56
  "dayjs": "^1.11.10",
52
- "typescript": ">=5.4.2",
53
- "@s_mart/core": "11.0.3",
54
- "@s_mart/masks": "5.4.0",
55
- "@s_mart/rules": "5.3.0",
56
- "@s_mart/tokens": "6.0.0",
57
- "@s_mart/typed": "8.0.1",
58
- "@s_mart/utils": "5.5.0"
59
- },
60
- "overrides": {
61
- "react-is": "^18.3.1"
57
+ "react": ">=18.3.1",
58
+ "react-dom": ">=18.3.1",
59
+ "react-hook-form": "^7.85.0",
60
+ "typescript": ">=7.0.2",
61
+ "zod": "^3.22.4"
62
62
  },
63
63
  "scripts": {
64
- "build": "tsup src/index.tsx --minify --format esm --dts --external react",
65
- "dev": "tsup src/index.tsx --format esm --watch --dts --external react"
64
+ "build": "pnpm run typecheck && vite build",
65
+ "typecheck": "tsc --noEmit"
66
66
  }
67
67
  }
package/dist/index.d.mts DELETED
@@ -1,523 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { CheckboxProps as CheckboxProps$1, AutocompleteProps, TextFieldProps as TextFieldProps$1, AutocompleteValue, AutocompleteFreeSoloValueMapping, RadioGroupProps as RadioGroupProps$1, RadioProps as RadioProps$1, SelectProps, SliderProps as SliderProps$1, SwitchProps as SwitchProps$1 } from '@mui/material';
3
- import * as react_hook_form from 'react-hook-form';
4
- import { UseControllerProps, FieldValues, FieldPath, Control, UseFormProps, UseFormReturn, FormProviderProps, FieldPathValue } from 'react-hook-form';
5
- import { WithRequired } from '@s_mart/typed';
6
- import { DatePickerProps as DatePickerProps$1, TimePickerProps as TimePickerProps$1 } from '@mui/x-date-pickers';
7
- import { z } from 'zod';
8
- import * as react from 'react';
9
-
10
- type CheckboxProps = CheckboxProps$1 & UseControllerProps & {
11
- /**
12
- * O nome do checkbox que será renderizado na tela
13
- * @default ''
14
- * @example 'Nome do checkbox'
15
- * @type string
16
- * @memberof CheckboxProps
17
- */
18
- label?: React.ReactNode;
19
- /**
20
- * Posição do label em relação ao checkbox
21
- * @default 'end'
22
- * @type 'start' | 'end' | 'top' | 'bottom'
23
- * @example
24
- * <Checkbox label="Checkbox" labelPlacement="start" />
25
- */
26
- labelPlacement?: 'start' | 'end' | 'top' | 'bottom';
27
- /**
28
- * Desabilita o ícone de erro da validação do campo.
29
- * @default false
30
- *
31
- * @example
32
- * <TextField disableIconError />
33
- */
34
- disableIconError?: boolean;
35
- };
36
-
37
- declare const _default$6: ({ name, rules, defaultValue, shouldUnregister, control: controlFromProps, label, labelPlacement, required, disableIconError, onChange: onChangeProp, ...rest }: CheckboxProps) => react_jsx_runtime.JSX.Element;
38
-
39
- type CreatableV2Props<FieldValue, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined> = WithRequired<Omit<AutocompleteProps<FieldValue, Multiple, DisableClearable, FreeSolo>, 'renderInput' | 'options' | 'size' | 'onInputChange' | 'onChange' | 'defaultValue' | 'value'>, 'getOptionKey' | 'getOptionLabel'> & UseControllerProps & {
40
- options: FieldValue[];
41
- slotProps?: AutocompleteProps<FieldValue, Multiple, DisableClearable, FreeSolo>['slotProps'] & Partial<{
42
- textField: Omit<TextFieldProps$1<'outlined'>, 'variant'>;
43
- }>;
44
- label?: React.ReactNode;
45
- required?: boolean;
46
- /**
47
- * Define se mostra o botão para criar uma nova opção
48
- * @default true
49
- * @type {boolean}
50
- * @memberof CreatableV2Props
51
- */
52
- showCreatableButton?: boolean;
53
- /**
54
- * Define se mostra o botão para editar uma opção existente
55
- * Só é possível utilizar se a prop `multiple` for `false | undefined`
56
- * @default false
57
- * @type {boolean}
58
- * @memberof CreatableV2Props
59
- */
60
- showEditableButton?: boolean;
61
- /**
62
- * Função que será executada quando o usuário clicar no botão de criar uma nova opção
63
- * @default undefined
64
- * @type {(value: string) => void}
65
- * @memberof CreatableV2Props
66
- */
67
- onCreateOption?: (value: string) => void;
68
- /**
69
- * Função que será executada quando o usuário clicar no botão de editar uma opção
70
- * Só é possível utilizar se a prop `multiple` for `false | undefined`
71
- * Só é possível editar se o valor for um Objeto
72
- *
73
- * @default undefined
74
- * @type {(value: FieldValue) => Promise<void> | void}
75
- * @memberof CreatableV2Props
76
- */
77
- onEditOption?: (value: NonNullable<AutocompleteValue<FieldValue, Multiple, false, false>>) => Promise<void> | void;
78
- /**
79
- * Componente que renderiza no footer do searchable (opcional)
80
- * @example
81
- * footer: (
82
- * <Button onClick={handleClick}>Mostrar mais...</Button>
83
- * )
84
- */
85
- footer?: () => React.ReactNode;
86
- /**
87
- * É o conteúdo passado para a tooltip que renderizará ao lado da label do campo,
88
- * montada à tela como um ícone de informação.
89
- */
90
- info?: React.ReactNode;
91
- onInputChange?: (value: string) => void;
92
- onChange?: (value: AutocompleteValue<FieldValue, Multiple, DisableClearable, FreeSolo> | (DisableClearable extends true ? never : null)) => void;
93
- placeholder?: string;
94
- /**
95
- * Componente renderizado embaixo da option da listagem
96
- */
97
- getOptionAfterLabel?: (option: FieldValue) => string | React.ReactNode;
98
- /**
99
- * Usado para montar a label do valor selecionado no campo
100
- *
101
- * Funciona apenas junto com `getOptionAfterLabel`
102
- *
103
- * Quando não informado é usado o `getOptionLabel`
104
- */
105
- getInputValueLabel?: (option: FieldValue | AutocompleteFreeSoloValueMapping<FreeSolo>) => string;
106
- };
107
-
108
- declare function CreatableV2<FieldValue, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined>(props: CreatableV2Props<FieldValue, Multiple, DisableClearable, FreeSolo>): react_jsx_runtime.JSX.Element;
109
- declare const _default$5: typeof CreatableV2;
110
-
111
- type DatePickerProps = DatePickerProps$1 & UseControllerProps & {
112
- /**
113
- * Se `true` irá adicionar um asterisco ao label do campo
114
- *
115
- * @default false
116
- */
117
- required?: boolean;
118
- /**
119
- * Se `true` irá desabilitar o campo e não será possível interagir com ele
120
- *
121
- * @default false
122
- */
123
- disabled?: boolean;
124
- /**
125
- * Desabilita o ícone de erro da validação do campo.
126
- * @default false
127
- *
128
- * @example
129
- * <TextField disableIconError />
130
- */
131
- disableIconError?: boolean;
132
- };
133
-
134
- declare const _default$4: ({ rules, name, defaultValue, shouldUnregister, control: controlFromProps, label, required, disabled, disableIconError, ...rest }: DatePickerProps) => react_jsx_runtime.JSX.Element;
135
-
136
- type FieldLabelProps = {
137
- label: React.ReactNode;
138
- required?: boolean;
139
- regular?: boolean;
140
- };
141
-
142
- declare const FieldLabel: ({ label, required, regular }: FieldLabelProps) => react_jsx_runtime.JSX.Element;
143
-
144
- type FieldErrorProps<TFieldValues extends FieldValues = FieldValues, TFieldNames extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {
145
- name: TFieldNames;
146
- disableIcon?: boolean;
147
- control: Control<TFieldValues>;
148
- };
149
-
150
- declare const FieldError: <TFieldValues extends FieldValues = FieldValues, TFieldNames extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, disableIcon, control, }: FieldErrorProps<TFieldValues, TFieldNames>) => react_jsx_runtime.JSX.Element | null;
151
-
152
- type FieldInfoProps = {
153
- title: React.ReactNode;
154
- };
155
-
156
- declare const FieldInfo: ({ title }: FieldInfoProps) => react_jsx_runtime.JSX.Element;
157
-
158
- interface IFormProps<T extends FieldValues> extends IUseFormProps<T> {
159
- children: ((methods: UseFormReturn<T> & {
160
- onSubmit: (e?: React.FormEvent | undefined) => Promise<void>;
161
- }) => React.ReactNode) | React.ReactNode;
162
- style?: React.HTMLAttributes<HTMLFormElement>['style'];
163
- }
164
- interface IFormProviderProps<TFieldValues extends FieldValues> extends FormProviderProps<TFieldValues> {
165
- style?: React.HTMLAttributes<HTMLFormElement>['style'];
166
- onSubmit: (e?: React.BaseSyntheticEvent) => void;
167
- }
168
- interface IUseFormProps<TValues extends FieldValues> extends Omit<UseFormProps<TValues>, 'resolver'> {
169
- onSubmit: (data: TValues, methods: UseFormReturn<TValues>) => void;
170
- /**
171
- * Prop que faz com que o formulário não atualize ao mudar o defaultValue
172
- */
173
- disableDefaultValuesUpdate?: boolean;
174
- schema?: z.ZodObject<any> | z.ZodEffects<z.ZodObject<any>>;
175
- }
176
-
177
- /**
178
- * Utilizado overloading para poder passar uma tipagem para o Componente
179
- * @example
180
- * // Não passar uma tipagem, todas as props terão o funcionamento normal, sem tipagem
181
- * <Form onSubmit={({email}) => {}}>
182
- * ...
183
- * </Form>
184
- * @example
185
- * // Passar uma tipagem, todas as props derivadas do react-hook-form terão a tipagem passada no generic
186
- * type Cadastro = {
187
- * email: string;
188
- * }
189
- * <Form<Cadastro> onSubmit={({email}) => {}}>
190
- * ...
191
- * </Form>
192
- */
193
- declare function Form(props: IFormProps<any>): JSX.Element;
194
- declare function Form<T extends FieldValues>(props: IFormProps<T>): JSX.Element;
195
-
196
- declare const useForm: <TValues extends FieldValues>({ disableDefaultValuesUpdate, onSubmit, ...rest }: IUseFormProps<TValues>) => {
197
- onSubmit: (e?: react.BaseSyntheticEvent<object, any, any> | undefined) => Promise<void>;
198
- watch: react_hook_form.UseFormWatch<TValues>;
199
- getValues: react_hook_form.UseFormGetValues<TValues>;
200
- getFieldState: react_hook_form.UseFormGetFieldState<TValues>;
201
- setError: react_hook_form.UseFormSetError<TValues>;
202
- clearErrors: react_hook_form.UseFormClearErrors<TValues>;
203
- setValue: react_hook_form.UseFormSetValue<TValues>;
204
- trigger: react_hook_form.UseFormTrigger<TValues>;
205
- formState: react_hook_form.FormState<TValues>;
206
- resetField: react_hook_form.UseFormResetField<TValues>;
207
- reset: react_hook_form.UseFormReset<TValues>;
208
- handleSubmit: react_hook_form.UseFormHandleSubmit<TValues, undefined>;
209
- unregister: react_hook_form.UseFormUnregister<TValues>;
210
- control: react_hook_form.Control<TValues, any>;
211
- register: react_hook_form.UseFormRegister<TValues>;
212
- setFocus: react_hook_form.UseFormSetFocus<TValues>;
213
- };
214
-
215
- declare function FormProvider<TFieldValues extends FieldValues>({ children, style, onSubmit, ...methods }: IFormProviderProps<TFieldValues>): react_jsx_runtime.JSX.Element;
216
-
217
- type RadioGroupProps = RadioGroupProps$1 & UseControllerProps & {
218
- /**
219
- * O nome do checkbox que será renderizado na tela
220
- * @default ''
221
- * @example 'Nome do checkbox'
222
- * @type React.ReactNode
223
- * @memberof RadioGroupProps
224
- */
225
- label?: React.ReactNode;
226
- /**
227
- * Adiciona um asterisco ao label do radioGroup
228
- * @default false
229
- * @type boolean
230
- * @memberof RadioGroupProps
231
- */
232
- required?: boolean;
233
- /**
234
- * Parte interna do componente para renderizar os RadiosButtons
235
- * @default []
236
- * @type ReactNode
237
- * @memberof RadioGroupProps
238
- * @example
239
- * <Radio value="1" label="Radio 1" />
240
- * <Radio value="2" label="Radio 2" />
241
- */
242
- children: React.ReactNode;
243
- /**
244
- * Define a orientação dos radios buttons dentro do radioGroup
245
- * @default 'row'
246
- * @type 'row' | 'column'
247
- * @memberof RadioGroupProps
248
- */
249
- orientation?: 'row' | 'column';
250
- /**
251
- * Desabilita o ícone de erro da validação do campo.
252
- * @default false
253
- *
254
- * @example
255
- * <TextField disableIconError />
256
- */
257
- disableIconError?: boolean;
258
- };
259
-
260
- declare const RadioGroup: ({ name, rules, defaultValue, shouldUnregister, control: controlFromProps, label, required, children, orientation, disableIconError, ...rest }: RadioGroupProps) => react_jsx_runtime.JSX.Element;
261
-
262
- type RadioProps = RadioProps$1 & {
263
- /**
264
- * O nome do checkbox que será renderizado na tela
265
- * @default ''
266
- * @example 'Nome do checkbox'
267
- * @type React.ReactNode
268
- * @memberof RadioProps
269
- */
270
- label?: React.ReactNode;
271
- /**
272
- * Posição do label em relação ao checkbox
273
- * @default 'end'
274
- * @type 'start' | 'end' | 'top' | 'bottom'
275
- * @example
276
- * <Radio label="Radio" labelPlacement="start" />
277
- */
278
- labelPlacement?: 'start' | 'end' | 'top' | 'bottom';
279
- };
280
-
281
- declare const RadioButton: ({ label, labelPlacement, ...rest }: RadioProps) => react_jsx_runtime.JSX.Element;
282
-
283
- type SearchableV2Props<FieldValue, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined, AutocompleteFieldValue extends AutocompleteValue<FieldValue, Multiple, DisableClearable, FreeSolo> = AutocompleteValue<FieldValue, Multiple, DisableClearable, FreeSolo>> = Omit<AutocompleteProps<FieldValue, Multiple, DisableClearable, FreeSolo>, 'renderInput' | 'size' | 'options' | 'onInputChange' | 'onChange' | 'getOptionLabel' | 'getOptionKey' | 'defaultValue' | 'value'> & UseControllerProps & {
284
- options: FieldValue[];
285
- textFieldProps?: TextFieldProps$1;
286
- label?: React.ReactNode;
287
- required?: boolean;
288
- /**
289
- * Texto que será exibido quando não houver opções para serem exibidas
290
- * @default 'Nenhuma opção encontrada'
291
- */
292
- noOptionsText?: string;
293
- /**
294
- * Componente que renderiza no footer do searchable (opcional)
295
- * @example
296
- * footer: (
297
- * <Button onClick={handleClick}>Mostrar mais...</Button>
298
- * )
299
- */
300
- footer?: () => React.ReactNode;
301
- /**
302
- * É o conteúdo passado para a tooltip que renderizará ao lado da label do campo,
303
- * montada à tela como um ícone de informação.
304
- */
305
- info?: React.ReactNode;
306
- defaultValue?: AutocompleteFieldValue;
307
- value?: AutocompleteFieldValue;
308
- placeholder?: string;
309
- onInputChange?: (value: string) => void;
310
- onChange?: (value: AutocompleteValue<FieldValue, Multiple, DisableClearable, FreeSolo> | (DisableClearable extends true ? never : null)) => void;
311
- /**
312
- * Define a key unica da option
313
- */
314
- getOptionKey: (option: FieldValue | AutocompleteFreeSoloValueMapping<FreeSolo>) => string | number;
315
- /**
316
- * Define a label da option
317
- */
318
- getOptionLabel: (option: FieldValue | AutocompleteFreeSoloValueMapping<FreeSolo>) => string;
319
- /**
320
- * Componente renderizado embaixo da option da listagem
321
- */
322
- getOptionAfterLabel?: (option: FieldValue | AutocompleteFreeSoloValueMapping<FreeSolo>) => string | React.ReactNode;
323
- /**
324
- * Usado para montar a label do valor selecionado no campo
325
- *
326
- * Funciona apenas junto com `getOptionAfterLabel`
327
- *
328
- * Quando não informado é usado o `getOptionLabel`
329
- */
330
- getInputValueLabel?: (option: FieldValue | AutocompleteFreeSoloValueMapping<FreeSolo>) => string;
331
- };
332
-
333
- declare const _default$3: <FieldValue, Multiple extends boolean | undefined = undefined, DisableClearable extends boolean | undefined = undefined, FreeSolo extends boolean | undefined = undefined>(props: SearchableV2Props<FieldValue, Multiple, DisableClearable, FreeSolo>) => react_jsx_runtime.JSX.Element;
334
-
335
- type FooterPropsV2 = {
336
- closeSelect: () => void;
337
- };
338
- type SelectV2Props<FieldValue extends FieldValues | string | number> = Omit<SelectProps<FieldValue>, 'onChange' | 'multiple' | 'defaultValue' | 'variant'> & UseControllerProps & {
339
- variant?: 'filled' | 'outlined' | 'standard';
340
- /**
341
- * As opções que serão renderizadas no select
342
- */
343
- options: FieldValue[];
344
- onChange?: (value: FieldValue | null) => void;
345
- /**
346
- * Função que renderiza o footer do select (opcional) - recebe como parâmetro a função closeSelect que fecha o select
347
- * @param {FooterProps} props
348
- *
349
- * @example
350
- * footer: ({ closeSelect }) => (
351
- * <Button onClick={closeSelect}>Fechar</Button>
352
- * )
353
- *
354
- */
355
- footer?: (props: FooterPropsV2) => React.ReactNode;
356
- /**
357
- * É o conteúdo passado para a tooltip que renderizará ao lado da label do campo,
358
- * montada à tela como um ícone de informação.
359
- */
360
- info?: React.ReactNode;
361
- /**
362
- * Habilita ícone no endAdornment para limpar o valor do campo.
363
- * @default false
364
- *
365
- * @example
366
- * <Select clearable />
367
- */
368
- clearable?: boolean;
369
- placeholder?: string;
370
- defaultValue?: FieldValue;
371
- /**
372
- * Define a key unica da option
373
- */
374
- getOptionKey: (option: FieldValue) => string | number;
375
- /**
376
- * Define a label da option
377
- */
378
- getOptionLabel: (option: FieldValue) => string;
379
- /**
380
- * Componente renderizado embaixo da option da listagem
381
- */
382
- getOptionAfterLabel?: (option: FieldValue) => string | React.ReactNode;
383
- /**
384
- * Usado para montar a label do valor selecionado no campo
385
- *
386
- * Funciona apenas junto com `getOptionAfterLabel`
387
- *
388
- * Quando não informado é usado o `getOptionLabel`
389
- */
390
- getInputValueLabel?: (option: FieldValue) => string;
391
- /**
392
- * Ícone renderizado ao lado da label
393
- */
394
- getOptionIcon?: (option: FieldValue) => React.ReactNode;
395
- };
396
- type SelectV2ReturnValueProps<TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {
397
- value: FieldPathValue<TFieldValues, TFieldName> | null;
398
- placeholder: string | undefined;
399
- getOptionLabel: (option: FieldPathValue<TFieldValues, TFieldName>) => string;
400
- };
401
-
402
- declare const _default$2: <FieldValue extends string | number | FieldValues>(props: SelectV2Props<FieldValue>) => react_jsx_runtime.JSX.Element;
403
-
404
- type SliderProps = SliderProps$1 & UseControllerProps & {
405
- /**
406
- * O nome do switch que será renderizado na tela
407
- * @default ''
408
- * @example 'Nome do switch'
409
- * @type string
410
- * @memberof SliderProps
411
- */
412
- label?: string;
413
- /**
414
- * Posição do label em relação ao switch
415
- * @default 'end'
416
- * @type 'start' | 'end' | 'top' | 'bottom'
417
- * @example
418
- * <Slider label="Slider" labelPlacement="start" />
419
- */
420
- labelPlacement?: 'start' | 'end' | 'top' | 'bottom';
421
- };
422
-
423
- declare const Slider: ({ name, rules, defaultValue, shouldUnregister, control: controlFromProps, ...rest }: SliderProps) => react_jsx_runtime.JSX.Element;
424
-
425
- type SwitchProps = SwitchProps$1 & UseControllerProps & {
426
- /**
427
- * O nome do switch que será renderizado na tela
428
- * @default ''
429
- * @example 'Nome do switch'
430
- * @type React.ReactNode
431
- * @memberof SwitchProps
432
- */
433
- label?: React.ReactNode;
434
- /**
435
- * Posição do label em relação ao switch
436
- * @default 'end'
437
- * @type 'start' | 'end' | 'top' | 'bottom'
438
- * @example
439
- * <Switch label="Switch" labelPlacement="start" />
440
- */
441
- labelPlacement?: 'start' | 'end' | 'top' | 'bottom';
442
- /**
443
- * Desabilita o ícone de erro da validação do campo.
444
- * @default false
445
- *
446
- * @example
447
- * <TextField disableIconError />
448
- */
449
- disableIconError?: boolean;
450
- };
451
-
452
- declare const Switch: ({ name, rules, defaultValue, defaultChecked, shouldUnregister, control: controlFromProps, label, labelPlacement, disableIconError, onChange: onChangeProp, ...rest }: SwitchProps) => react_jsx_runtime.JSX.Element;
453
-
454
- type Masks = 'cpf' | 'cnpj' | 'cpfCnpj' | 'cep' | 'telefone' | 'decimal' | 'decimal3' | 'decimal4' | 'decimal5' | 'porcentagem' | 'porcentagem0' | 'nome' | 'numero' | 'numeroPontuacao' | 'placa' | 'placaSefaz' | 'valor' | 'valor3' | 'valor4';
455
- type TextFieldProps = TextFieldProps$1 & UseControllerProps & {
456
- mask?: Masks;
457
- /**
458
- * @description Função que será executada quando o valor do input for alterado
459
- * @param value valor atual do Field
460
- * @param values valores atuais do Form
461
- *
462
- * @example onInputChange={(values,values) => console.log({value, values})}
463
- */
464
- onInputChange?: (value: string) => void;
465
- /**
466
- * @param value Valor do input
467
- * @returns Valor formatado para o input
468
- *
469
- * @example
470
- * <TextField mask="cpf" parse={(value) => value.replace(/\D/g, '')} />
471
- */
472
- parse?: (value: string) => string;
473
- /**
474
- * @param value Valor do input formatado
475
- * @returns Valor sem formatação para o input
476
- *
477
- * @example
478
- * <TextField mask="cpf" format={(value) => value.replace(/\D/g, '')} />
479
- */
480
- format?: (value: string) => string;
481
- /**
482
- * É o conteúdo passado para a tooltip que renderizará ao lado da label do campo,
483
- * montada à tela como um ícone de informação.
484
- */
485
- info?: React.ReactNode;
486
- /**
487
- * Desabilita o ícone de erro da validação do campo.
488
- * @default false
489
- *
490
- * @example
491
- * <TextField disableIconError />
492
- */
493
- disableIconError?: boolean;
494
- };
495
-
496
- declare const _default$1: ({ name, rules, defaultValue, shouldUnregister, control: controlFromProps, label, required, mask, variant, info, parse, format, onInputChange, disableIconError, ...rest }: TextFieldProps) => react_jsx_runtime.JSX.Element;
497
-
498
- type TimePickerProps = TimePickerProps$1 & UseControllerProps & {
499
- /**
500
- * Se `true` irá adicionar um asterisco ao label do campo
501
- *
502
- * @default false
503
- */
504
- required?: boolean;
505
- /**
506
- * Se `true` irá desabilitar o campo e não será possível interagir com ele
507
- *
508
- * @default false
509
- */
510
- disabled?: boolean;
511
- /**
512
- * Desabilita o ícone de erro da validação do campo.
513
- * @default false
514
- *
515
- * @example
516
- * <TextField disableIconError />
517
- */
518
- disableIconError?: boolean;
519
- };
520
-
521
- declare const _default: ({ rules, defaultValue, shouldUnregister, name, control: controlFromProps, required, label, disabled, disableIconError, ...rest }: TimePickerProps) => react_jsx_runtime.JSX.Element;
522
-
523
- export { _default$6 as Checkbox, type CheckboxProps, _default$5 as CreatableV2, type CreatableV2Props, _default$4 as DatePicker, type DatePickerProps, FieldError, type FieldErrorProps, FieldInfo, type FieldInfoProps, FieldLabel, type FieldLabelProps, type FooterPropsV2, Form, FormProvider, type IFormProps, type IFormProviderProps, type IUseFormProps, type Masks, RadioButton, RadioGroup, type RadioGroupProps, type RadioProps, _default$3 as SearchableV2, type SearchableV2Props, _default$2 as SelectV2, type SelectV2Props, type SelectV2ReturnValueProps, Slider, type SliderProps, Switch, type SwitchProps, _default$1 as TextField, type TextFieldProps, _default as TimePicker, type TimePickerProps, useForm };