@ttoss/forms 0.32.0 → 0.32.2

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.
@@ -0,0 +1,812 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ import * as React from 'react';
3
+ import { FormErrorMessage, FormField, FormFieldPatternFormat, __name, isCnpjValid } from "./chunk-X42ZUF2A.js";
4
+
5
+ // src/Form.tsx
6
+ import { Box } from "@ttoss/ui";
7
+ import * as React2 from "react";
8
+ import { FormProvider } from "react-hook-form";
9
+ var Form = /* @__PURE__ */__name(({
10
+ children,
11
+ onSubmit,
12
+ sx,
13
+ ...formMethods
14
+ }) => {
15
+ return /* @__PURE__ */React2.createElement(FormProvider, formMethods, /* @__PURE__ */React2.createElement(Box, {
16
+ as: "form",
17
+ variant: "forms.form",
18
+ onSubmit: formMethods.handleSubmit(data => {
19
+ return onSubmit?.(data);
20
+ }),
21
+ sx
22
+ }, children));
23
+ }, "Form");
24
+
25
+ // src/FormFieldCheckbox.tsx
26
+ import { Checkbox } from "@ttoss/ui";
27
+ var FormFieldCheckbox = /* @__PURE__ */__name(({
28
+ disabled,
29
+ ...props
30
+ }) => {
31
+ const {
32
+ label,
33
+ name,
34
+ tooltip,
35
+ inputTooltip,
36
+ warning,
37
+ sx,
38
+ css,
39
+ rules,
40
+ id,
41
+ defaultValue,
42
+ ...checkboxProps
43
+ } = props;
44
+ return /* @__PURE__ */React.createElement(FormField, {
45
+ id,
46
+ label,
47
+ name,
48
+ tooltip,
49
+ inputTooltip,
50
+ warning,
51
+ sx,
52
+ css,
53
+ defaultValue,
54
+ rules,
55
+ disabled,
56
+ render: /* @__PURE__ */__name(({
57
+ field,
58
+ fieldState
59
+ }) => {
60
+ return /* @__PURE__ */React.createElement(Checkbox, {
61
+ ...checkboxProps,
62
+ ...field,
63
+ disabled,
64
+ "aria-invalid": !!fieldState.error
65
+ });
66
+ }, "render")
67
+ });
68
+ }, "FormFieldCheckbox");
69
+
70
+ // src/FormFieldCreditCardNumber.tsx
71
+ var FormFieldCreditCardNumber = /* @__PURE__ */__name(({
72
+ format = "#### #### #### ####",
73
+ placeholder = "1234 1234 1234 1234",
74
+ ...formFieldPatternFormatProps
75
+ }) => {
76
+ return /* @__PURE__ */React.createElement(FormFieldPatternFormat, {
77
+ format,
78
+ placeholder,
79
+ ...formFieldPatternFormatProps
80
+ });
81
+ }, "FormFieldCreditCardNumber");
82
+
83
+ // src/FormFieldNumericFormat.tsx
84
+ import { Input } from "@ttoss/ui";
85
+ import { NumericFormat } from "react-number-format";
86
+ var FormFieldNumericFormat = /* @__PURE__ */__name(({
87
+ disabled,
88
+ ...props
89
+ }) => {
90
+ const {
91
+ label,
92
+ name,
93
+ tooltip,
94
+ inputTooltip,
95
+ warning,
96
+ sx,
97
+ css,
98
+ rules,
99
+ id,
100
+ defaultValue,
101
+ ...numericFormatProps
102
+ } = props;
103
+ return /* @__PURE__ */React.createElement(FormField, {
104
+ id,
105
+ label,
106
+ name,
107
+ tooltip,
108
+ inputTooltip,
109
+ warning,
110
+ sx,
111
+ css,
112
+ defaultValue,
113
+ rules,
114
+ disabled,
115
+ render: /* @__PURE__ */__name(({
116
+ field
117
+ }) => {
118
+ return /* @__PURE__ */React.createElement(NumericFormat, {
119
+ ...numericFormatProps,
120
+ name: field.name,
121
+ value: field.value,
122
+ onBlur: field.onBlur,
123
+ onValueChange: /* @__PURE__ */__name(values => {
124
+ field.onChange(values.floatValue);
125
+ }, "onValueChange"),
126
+ customInput: Input,
127
+ disabled
128
+ });
129
+ }, "render")
130
+ });
131
+ }, "FormFieldNumericFormat");
132
+
133
+ // src/FormFieldCurrencyInput.tsx
134
+ var FormFieldCurrencyInput = /* @__PURE__ */__name(({
135
+ prefix,
136
+ decimalSeparator = ",",
137
+ thousandSeparator = ".",
138
+ ...formFieldNumericFormatProps
139
+ }) => {
140
+ return /* @__PURE__ */React.createElement(FormFieldNumericFormat, {
141
+ fixedDecimalScale: true,
142
+ decimalScale: 2,
143
+ prefix,
144
+ decimalSeparator,
145
+ thousandSeparator,
146
+ placeholder: `${prefix} 0${decimalSeparator}00`,
147
+ allowNegative: false,
148
+ ...formFieldNumericFormatProps
149
+ });
150
+ }, "FormFieldCurrencyInput");
151
+
152
+ // src/FormFieldInput.tsx
153
+ import { Input as Input2 } from "@ttoss/ui";
154
+ var FormFieldInput = /* @__PURE__ */__name(({
155
+ defaultValue = "",
156
+ disabled,
157
+ ...props
158
+ }) => {
159
+ const {
160
+ label,
161
+ name,
162
+ tooltip,
163
+ inputTooltip,
164
+ warning,
165
+ sx,
166
+ css,
167
+ rules,
168
+ id,
169
+ ...inputProps
170
+ } = props;
171
+ return /* @__PURE__ */React.createElement(FormField, {
172
+ id,
173
+ label,
174
+ name,
175
+ tooltip,
176
+ inputTooltip,
177
+ warning,
178
+ sx,
179
+ css,
180
+ defaultValue,
181
+ rules,
182
+ disabled,
183
+ render: /* @__PURE__ */__name(({
184
+ field,
185
+ fieldState
186
+ }) => {
187
+ return /* @__PURE__ */React.createElement(Input2, {
188
+ ...inputProps,
189
+ ...field,
190
+ disabled,
191
+ "aria-invalid": fieldState.error ? "true" : void 0
192
+ });
193
+ }, "render")
194
+ });
195
+ }, "FormFieldInput");
196
+
197
+ // src/FormFieldPassword.tsx
198
+ import { InputPassword } from "@ttoss/ui";
199
+ var FormFieldPassword = /* @__PURE__ */__name(({
200
+ defaultValue = "",
201
+ disabled,
202
+ ...props
203
+ }) => {
204
+ const {
205
+ label,
206
+ name,
207
+ tooltip,
208
+ inputTooltip,
209
+ warning,
210
+ sx,
211
+ css,
212
+ rules,
213
+ id,
214
+ ...inputProps
215
+ } = props;
216
+ return /* @__PURE__ */React.createElement(FormField, {
217
+ id,
218
+ label,
219
+ name,
220
+ tooltip,
221
+ inputTooltip,
222
+ warning,
223
+ sx,
224
+ css,
225
+ defaultValue,
226
+ rules,
227
+ disabled,
228
+ render: /* @__PURE__ */__name(({
229
+ field,
230
+ fieldState
231
+ }) => {
232
+ return /* @__PURE__ */React.createElement(InputPassword, {
233
+ ...inputProps,
234
+ ...field,
235
+ disabled,
236
+ "aria-invalid": fieldState.error ? "true" : void 0
237
+ });
238
+ }, "render")
239
+ });
240
+ }, "FormFieldPassword");
241
+
242
+ // src/FormFieldRadio.tsx
243
+ import { Flex, Label, Radio } from "@ttoss/ui";
244
+ var FormFieldRadio = /* @__PURE__ */__name(({
245
+ disabled,
246
+ options,
247
+ ...props
248
+ }) => {
249
+ const {
250
+ label,
251
+ name,
252
+ tooltip,
253
+ inputTooltip,
254
+ warning,
255
+ sx,
256
+ css,
257
+ rules,
258
+ id,
259
+ defaultValue,
260
+ ...radioProps
261
+ } = props;
262
+ return /* @__PURE__ */React.createElement(FormField, {
263
+ id,
264
+ label,
265
+ name,
266
+ tooltip,
267
+ inputTooltip,
268
+ warning,
269
+ sx,
270
+ css,
271
+ defaultValue,
272
+ rules,
273
+ disabled,
274
+ render: /* @__PURE__ */__name(({
275
+ field
276
+ }) => {
277
+ return /* @__PURE__ */React.createElement(Flex, {
278
+ sx: {
279
+ flexDirection: "column",
280
+ gap: "1"
281
+ }
282
+ }, options.map(option => {
283
+ const key = `form-field-radio-${name}-${option.value}`;
284
+ return /* @__PURE__ */React.createElement(Label, {
285
+ key,
286
+ sx: {
287
+ fontSize: "md"
288
+ }
289
+ }, /* @__PURE__ */React.createElement(Radio, {
290
+ ref: field.ref,
291
+ onChange: field.onChange,
292
+ onBlur: field.onBlur,
293
+ value: option.value,
294
+ checked: field.value === option.value,
295
+ name,
296
+ disabled,
297
+ ...radioProps
298
+ }), option.label);
299
+ }));
300
+ }, "render")
301
+ });
302
+ }, "FormFieldRadio");
303
+
304
+ // src/FormFieldRadioCard.tsx
305
+ import { Box as Box2, Flex as Flex2, Label as Label2, Radio as Radio2, Text } from "@ttoss/ui";
306
+ var FormFieldRadioCard = /* @__PURE__ */__name(({
307
+ disabled,
308
+ ...props
309
+ }) => {
310
+ const {
311
+ label,
312
+ name,
313
+ tooltip,
314
+ inputTooltip,
315
+ warning,
316
+ sx,
317
+ css,
318
+ rules,
319
+ id,
320
+ defaultValue,
321
+ options,
322
+ direction = "column",
323
+ width = "full",
324
+ ...radioProps
325
+ } = props;
326
+ return /* @__PURE__ */React.createElement(FormField, {
327
+ id,
328
+ label,
329
+ name,
330
+ tooltip,
331
+ inputTooltip,
332
+ warning,
333
+ sx,
334
+ css,
335
+ defaultValue,
336
+ rules,
337
+ disabled,
338
+ render: /* @__PURE__ */__name(({
339
+ field
340
+ }) => {
341
+ return /* @__PURE__ */React.createElement(Flex2, {
342
+ sx: {
343
+ flexDirection: direction,
344
+ gap: "4"
345
+ }
346
+ }, options.map(option => {
347
+ const key = `form-field-radio-${name}-${option.value}`;
348
+ return /* @__PURE__ */React.createElement(Box2, {
349
+ key,
350
+ sx: {
351
+ gap: "2",
352
+ width,
353
+ border: "md",
354
+ borderColor: "display.border.muted.default",
355
+ borderRadius: "md"
356
+ }
357
+ }, /* @__PURE__ */React.createElement(Label2, {
358
+ sx: {
359
+ fontSize: "md",
360
+ width: "100%",
361
+ padding: "4"
362
+ }
363
+ }, /* @__PURE__ */React.createElement(Radio2, {
364
+ ...radioProps,
365
+ ref: field.ref,
366
+ onChange: field.onChange,
367
+ onBlur: field.onBlur,
368
+ value: option.value,
369
+ checked: field.value === option.value,
370
+ name,
371
+ disabled
372
+ }), /* @__PURE__ */React.createElement(Flex2, {
373
+ sx: {
374
+ flexDirection: "column",
375
+ gap: "1"
376
+ }
377
+ }, option.label && /* @__PURE__ */React.createElement(Text, null, option.label), option.description && /* @__PURE__ */React.createElement(Text, {
378
+ sx: {
379
+ fontSize: "sm"
380
+ }
381
+ }, option.description))));
382
+ }));
383
+ }, "render")
384
+ });
385
+ }, "FormFieldRadioCard");
386
+
387
+ // src/FormFieldRadioCardIcony.tsx
388
+ import { Box as Box3, Flex as Flex3, Text as Text2 } from "@ttoss/ui";
389
+ import { Tag } from "@ttoss/ui";
390
+ import * as React3 from "react";
391
+ var FormFieldRadioCardIcony = /* @__PURE__ */__name(({
392
+ disabled,
393
+ ...props
394
+ }) => {
395
+ const {
396
+ label,
397
+ name,
398
+ tooltip,
399
+ inputTooltip,
400
+ warning,
401
+ sx,
402
+ css,
403
+ rules,
404
+ id,
405
+ defaultValue,
406
+ options,
407
+ direction = "row",
408
+ width = "full"
409
+ } = props;
410
+ return /* @__PURE__ */React3.createElement(FormField, {
411
+ id,
412
+ label,
413
+ name,
414
+ tooltip,
415
+ inputTooltip,
416
+ warning,
417
+ sx,
418
+ css,
419
+ defaultValue,
420
+ rules,
421
+ disabled,
422
+ render: /* @__PURE__ */__name(({
423
+ field
424
+ }) => {
425
+ const handleOptionClick = /* @__PURE__ */__name(optionValue => {
426
+ if (!disabled) {
427
+ field.onChange(optionValue);
428
+ field.onBlur();
429
+ }
430
+ }, "handleOptionClick");
431
+ return /* @__PURE__ */React3.createElement(Flex3, {
432
+ sx: {
433
+ flexDirection: direction,
434
+ gap: "4"
435
+ }
436
+ }, options.map(option => {
437
+ const key = `form-field-radio-card-${name}-${option.value}`;
438
+ const isSelected = field.value === option.value;
439
+ const IconComponent = option.icon;
440
+ const tag = option.tag;
441
+ return /* @__PURE__ */React3.createElement(Box3, {
442
+ key,
443
+ onClick: /* @__PURE__ */__name(() => {
444
+ return handleOptionClick(option.value);
445
+ }, "onClick"),
446
+ sx: {
447
+ width,
448
+ padding: "6",
449
+ border: isSelected ? "lg" : "md",
450
+ borderColor: isSelected ? "input.background.accent.default" : "input.border.muted.default",
451
+ borderRadius: "md",
452
+ backgroundColor: isSelected ? "feedback.background.positive.default" : "transparent",
453
+ display: "flex",
454
+ flexDirection: "column",
455
+ alignItems: "center",
456
+ justifyContent: "center",
457
+ textAlign: "center",
458
+ cursor: disabled ? "not-allowed" : "pointer",
459
+ opacity: disabled ? 0.5 : 1,
460
+ transition: "all 0.2s ease-in-out"
461
+ }
462
+ }, IconComponent && /* @__PURE__ */React3.createElement(Box3, {
463
+ sx: {
464
+ marginBottom: "2",
465
+ color: "text.primary"
466
+ }
467
+ }, /* @__PURE__ */React3.createElement(IconComponent, {
468
+ size: 24
469
+ })), /* @__PURE__ */React3.createElement(Flex3, {
470
+ sx: {
471
+ flexDirection: "column",
472
+ gap: "1"
473
+ }
474
+ }, option.label && /* @__PURE__ */React3.createElement(Text2, {
475
+ sx: {
476
+ fontSize: "lg",
477
+ fontWeight: "semibold",
478
+ color: "text.primary"
479
+ }
480
+ }, option.label), option.description && /* @__PURE__ */React3.createElement(Text2, {
481
+ sx: {
482
+ fontSize: "md",
483
+ color: "text.secondary"
484
+ }
485
+ }, option.description)), tag?.label && /* @__PURE__ */React3.createElement(Tag, {
486
+ variant: tag?.variant,
487
+ sx: {
488
+ px: "3",
489
+ mt: "2",
490
+ fontSize: "sm",
491
+ ...tag?.sx
492
+ }
493
+ }, tag.label));
494
+ }));
495
+ }, "render")
496
+ });
497
+ }, "FormFieldRadioCardIcony");
498
+
499
+ // src/FormFieldSelect.tsx
500
+ import { Select } from "@ttoss/ui";
501
+ var FormFieldSelect = /* @__PURE__ */__name(({
502
+ disabled,
503
+ ...props
504
+ }) => {
505
+ const {
506
+ label,
507
+ name,
508
+ tooltip,
509
+ inputTooltip,
510
+ warning,
511
+ sx,
512
+ css,
513
+ rules,
514
+ id,
515
+ defaultValue,
516
+ ...selectProps
517
+ } = props;
518
+ return /* @__PURE__ */React.createElement(FormField, {
519
+ id,
520
+ label,
521
+ name,
522
+ tooltip,
523
+ inputTooltip,
524
+ warning,
525
+ sx,
526
+ css,
527
+ defaultValue,
528
+ rules,
529
+ disabled,
530
+ render: /* @__PURE__ */__name(({
531
+ field,
532
+ fieldState
533
+ }) => {
534
+ return /* @__PURE__ */React.createElement(Select, {
535
+ ...selectProps,
536
+ ...field,
537
+ isDisabled: disabled,
538
+ "aria-invalid": fieldState.error ? "true" : void 0
539
+ });
540
+ }, "render")
541
+ });
542
+ }, "FormFieldSelect");
543
+
544
+ // src/FormFieldSwitch.tsx
545
+ import { Switch } from "@ttoss/ui";
546
+ var FormFieldSwitch = /* @__PURE__ */__name(({
547
+ disabled,
548
+ ...props
549
+ }) => {
550
+ const {
551
+ label,
552
+ name,
553
+ tooltip,
554
+ inputTooltip,
555
+ warning,
556
+ sx,
557
+ css,
558
+ rules,
559
+ id,
560
+ defaultValue,
561
+ ...switchProps
562
+ } = props;
563
+ return /* @__PURE__ */React.createElement(FormField, {
564
+ id,
565
+ label,
566
+ name,
567
+ tooltip,
568
+ inputTooltip,
569
+ warning,
570
+ sx,
571
+ css,
572
+ defaultValue,
573
+ rules,
574
+ disabled,
575
+ render: /* @__PURE__ */__name(({
576
+ field,
577
+ fieldState
578
+ }) => {
579
+ return /* @__PURE__ */React.createElement(Switch, {
580
+ ...switchProps,
581
+ ...field,
582
+ disabled,
583
+ "aria-invalid": !!fieldState.error
584
+ });
585
+ }, "render")
586
+ });
587
+ }, "FormFieldSwitch");
588
+
589
+ // src/FormFieldTextarea.tsx
590
+ import { Textarea } from "@ttoss/ui";
591
+ var FormFieldTextarea = /* @__PURE__ */__name(({
592
+ defaultValue = "",
593
+ disabled,
594
+ ...props
595
+ }) => {
596
+ const {
597
+ label,
598
+ name,
599
+ tooltip,
600
+ inputTooltip,
601
+ warning,
602
+ sx,
603
+ css,
604
+ rules,
605
+ id,
606
+ ...textareaProps
607
+ } = props;
608
+ return /* @__PURE__ */React.createElement(FormField, {
609
+ id,
610
+ label,
611
+ name,
612
+ tooltip,
613
+ inputTooltip,
614
+ warning,
615
+ sx,
616
+ css,
617
+ defaultValue,
618
+ rules,
619
+ disabled,
620
+ render: /* @__PURE__ */__name(({
621
+ field,
622
+ fieldState
623
+ }) => {
624
+ return /* @__PURE__ */React.createElement(Textarea, {
625
+ ...textareaProps,
626
+ ...field,
627
+ disabled,
628
+ "aria-invalid": fieldState.error ? "true" : void 0
629
+ });
630
+ }, "render")
631
+ });
632
+ }, "FormFieldTextarea");
633
+
634
+ // src/FormGroup.tsx
635
+ import { Box as Box4, Flex as Flex4, Text as Text3 } from "@ttoss/ui";
636
+ import * as React4 from "react";
637
+ var FormGroupLevelsManagerContext = /* @__PURE__ */React4.createContext({
638
+ levelsLength: 1,
639
+ registerChild: /* @__PURE__ */__name(() => {
640
+ return null;
641
+ }, "registerChild")
642
+ });
643
+ var FormGroupLevelsManager = /* @__PURE__ */__name(({
644
+ children
645
+ }) => {
646
+ const [levelsLength, setLevelsLength] = React4.useState(0);
647
+ const registerChild = React4.useCallback(level => {
648
+ if (level + 1 > levelsLength) {
649
+ setLevelsLength(level + 1);
650
+ }
651
+ }, [levelsLength]);
652
+ return /* @__PURE__ */React4.createElement(FormGroupLevelsManagerContext.Provider, {
653
+ value: {
654
+ levelsLength,
655
+ registerChild
656
+ }
657
+ }, children);
658
+ }, "FormGroupLevelsManager");
659
+ var FormGroupContext = /* @__PURE__ */React4.createContext({});
660
+ var useFormGroup = /* @__PURE__ */__name(() => {
661
+ const {
662
+ parentLevel
663
+ } = React4.useContext(FormGroupContext);
664
+ const {
665
+ levelsLength
666
+ } = React4.useContext(FormGroupLevelsManagerContext);
667
+ return {
668
+ level: parentLevel,
669
+ levelsLength
670
+ };
671
+ }, "useFormGroup");
672
+ var FormGroupWrapper = /* @__PURE__ */__name(({
673
+ title,
674
+ direction,
675
+ children,
676
+ name,
677
+ ...boxProps
678
+ }) => {
679
+ const {
680
+ level
681
+ } = useFormGroup();
682
+ const {
683
+ registerChild
684
+ } = React4.useContext(FormGroupLevelsManagerContext);
685
+ React4.useEffect(() => {
686
+ if (typeof level === "number") {
687
+ registerChild(level);
688
+ }
689
+ }, [level, registerChild]);
690
+ const childrenContainerSx = {
691
+ flexDirection: direction || "column",
692
+ gap: "1",
693
+ width: "100%"
694
+ };
695
+ return /* @__PURE__ */React4.createElement(Box4, {
696
+ "aria-level": level,
697
+ ...boxProps,
698
+ sx: {
699
+ marginTop: level === 0 ? "none" : "4",
700
+ marginBottom: "4",
701
+ ...boxProps.sx
702
+ }
703
+ }, title && /* @__PURE__ */React4.createElement(Box4, {
704
+ sx: {
705
+ marginBottom: "2"
706
+ }
707
+ }, /* @__PURE__ */React4.createElement(Text3, {
708
+ sx: {
709
+ fontSize: "2xl",
710
+ fontWeight: "bold"
711
+ }
712
+ }, title)), /* @__PURE__ */React4.createElement(Flex4, {
713
+ sx: childrenContainerSx
714
+ }, children), name && /* @__PURE__ */React4.createElement(FormErrorMessage, {
715
+ name
716
+ }));
717
+ }, "FormGroupWrapper");
718
+ var FormGroup = /* @__PURE__ */__name(props => {
719
+ const {
720
+ level
721
+ } = useFormGroup();
722
+ const currentLevel = level === void 0 ? 0 : level + 1;
723
+ return /* @__PURE__ */React4.createElement(FormGroupContext.Provider, {
724
+ value: {
725
+ parentLevel: currentLevel
726
+ }
727
+ }, currentLevel === 0 ? /* @__PURE__ */React4.createElement(FormGroupLevelsManager, null, /* @__PURE__ */React4.createElement(FormGroupWrapper, props)) : /* @__PURE__ */React4.createElement(FormGroupWrapper, props));
728
+ }, "FormGroup");
729
+
730
+ // src/yup/i18n.ts
731
+ import { defineMessage } from "@ttoss/react-i18n";
732
+ import { setLocale } from "yup";
733
+ setLocale({
734
+ mixed: {
735
+ required: defineMessage({
736
+ id: "MfWGyg",
737
+ defaultMessage: [{
738
+ "type": 0,
739
+ "value": "Field is required"
740
+ }]
741
+ }),
742
+ notType: /* @__PURE__ */__name(({
743
+ type
744
+ }) => {
745
+ return {
746
+ ...defineMessage({
747
+ id: "ZhaPt0",
748
+ defaultMessage: [{
749
+ "type": 0,
750
+ "value": "Invalid Value for Field of type "
751
+ }, {
752
+ "type": 1,
753
+ "value": "type"
754
+ }]
755
+ }),
756
+ values: {
757
+ type
758
+ }
759
+ };
760
+ }, "notType")
761
+ },
762
+ string: {
763
+ min: /* @__PURE__ */__name(({
764
+ min
765
+ }) => {
766
+ return {
767
+ ...defineMessage({
768
+ id: "D1C6fR",
769
+ defaultMessage: [{
770
+ "type": 0,
771
+ "value": "Field must be at least "
772
+ }, {
773
+ "type": 1,
774
+ "value": "min"
775
+ }, {
776
+ "type": 0,
777
+ "value": " characters"
778
+ }]
779
+ }),
780
+ values: {
781
+ min
782
+ }
783
+ };
784
+ }, "min")
785
+ }
786
+ });
787
+
788
+ // src/yup/schema.ts
789
+ import * as yup from "yup";
790
+ yup.addMethod(yup.string, "cnpj", function () {
791
+ return this.test("valid-cnpj", "Invalid CNPJ", value => {
792
+ return isCnpjValid(value);
793
+ });
794
+ });
795
+ yup.addMethod(yup.string, "password", function ({
796
+ required
797
+ } = {}) {
798
+ const schema = this.trim();
799
+ if (required) {
800
+ schema.required("Password is required");
801
+ }
802
+ return schema.min(8, "Password must be at least 8 characters long");
803
+ });
804
+
805
+ // src/yup/yup.ts
806
+ import * as yup2 from "yup";
807
+
808
+ // src/index.ts
809
+ import { yupResolver } from "@hookform/resolvers/yup";
810
+ import { Controller, FormProvider as FormProvider2, useController, useFieldArray, useForm, useFormContext, useFormState, useWatch } from "react-hook-form";
811
+ export * from "react-hook-form";
812
+ export { Form, FormFieldCheckbox, FormFieldCreditCardNumber, FormFieldNumericFormat, FormFieldCurrencyInput, FormFieldInput, FormFieldPassword, FormFieldRadio, FormFieldRadioCard, FormFieldRadioCardIcony, FormFieldSelect, FormFieldSwitch, FormFieldTextarea, useFormGroup, FormGroup, yup2 as yup, yupResolver, Controller, FormProvider2 as FormProvider, useController, useFieldArray, useForm, useFormContext, useFormState, useWatch };