@ttoss/forms 0.24.9 → 0.25.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.
package/dist/index.js DELETED
@@ -1,773 +0,0 @@
1
- /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- "use strict";
3
-
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __export = (target, all) => {
11
- for (var name in all) __defProp(target, name, {
12
- get: all[name],
13
- enumerable: true
14
- });
15
- };
16
- var __copyProps = (to, from, except, desc) => {
17
- if (from && typeof from === "object" || typeof from === "function") {
18
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
- get: () => from[key],
20
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
- });
22
- }
23
- return to;
24
- };
25
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
26
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
- // If the importer is in node compatibility mode or this is not an ESM
28
- // file that has been converted to a CommonJS file using a Babel-
29
- // compatible transform (i.e. "__esModule" has not been set), then set
30
- // "default" to the CommonJS "module.exports" for node compatibility.
31
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
32
- value: mod,
33
- enumerable: true
34
- }) : target, mod));
35
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
36
- value: true
37
- }), mod);
38
-
39
- // src/index.ts
40
- var src_exports = {};
41
- __export(src_exports, {
42
- Controller: () => import_react_hook_form6.Controller,
43
- Form: () => Form,
44
- FormErrorMessage: () => FormErrorMessage,
45
- FormField: () => FormField,
46
- FormFieldCheckbox: () => FormFieldCheckbox,
47
- FormFieldCreditCardNumber: () => FormFieldCreditCardNumber,
48
- FormFieldCurrencyInput: () => FormFieldCurrencyInput,
49
- FormFieldInput: () => FormFieldInput,
50
- FormFieldNumericFormat: () => FormFieldNumericFormat,
51
- FormFieldPassword: () => FormFieldPassword,
52
- FormFieldPatternFormat: () => FormFieldPatternFormat,
53
- FormFieldRadio: () => FormFieldRadio,
54
- FormFieldSelect: () => FormFieldSelect,
55
- FormFieldTextarea: () => FormFieldTextarea,
56
- FormGroup: () => FormGroup,
57
- FormProvider: () => import_react_hook_form6.FormProvider,
58
- useController: () => import_react_hook_form6.useController,
59
- useFieldArray: () => import_react_hook_form6.useFieldArray,
60
- useForm: () => import_react_hook_form6.useForm,
61
- useFormContext: () => import_react_hook_form6.useFormContext,
62
- useFormGroup: () => useFormGroup,
63
- useFormState: () => import_react_hook_form6.useFormState,
64
- useWatch: () => import_react_hook_form6.useWatch,
65
- yup: () => yup2,
66
- yupResolver: () => import_yup2.yupResolver
67
- });
68
- module.exports = __toCommonJS(src_exports);
69
- var import_yup2 = require("@hookform/resolvers/yup");
70
-
71
- // src/yup/i18n.ts
72
- var import_react_i18n = require("@ttoss/react-i18n");
73
- var import_yup = require("yup");
74
- (0, import_yup.setLocale)({
75
- mixed: {
76
- required: (0, import_react_i18n.defineMessage)({
77
- defaultMessage: "Field is required",
78
- description: "Field is required"
79
- }),
80
- notType: ({
81
- type
82
- }) => {
83
- return {
84
- ...(0, import_react_i18n.defineMessage)({
85
- defaultMessage: "Invalid Value for Field of type {type}",
86
- description: "Invalid Value"
87
- }),
88
- values: {
89
- type
90
- }
91
- };
92
- }
93
- },
94
- string: {
95
- min: ({
96
- min
97
- }) => {
98
- return {
99
- ...(0, import_react_i18n.defineMessage)({
100
- defaultMessage: "Field must be at least {min} characters",
101
- description: "Min length field"
102
- }),
103
- values: {
104
- min
105
- }
106
- };
107
- }
108
- }
109
- });
110
-
111
- // src/yup/schema.ts
112
- var yup = __toESM(require("yup"));
113
-
114
- // src/Brazil/FormFieldCNPJ.tsx
115
- var import_ui = require("@ttoss/ui");
116
- var import_react_number_format = require("react-number-format");
117
- var import_jsx_runtime = require("react/jsx-runtime");
118
- var isCnpjValid = cnpj => {
119
- if (cnpj?.length != 14) {
120
- return false;
121
- }
122
- if (cnpj == "00000000000000" || cnpj == "11111111111111" || cnpj == "22222222222222" || cnpj == "33333333333333" || cnpj == "44444444444444" || cnpj == "55555555555555" || cnpj == "66666666666666" || cnpj == "77777777777777" || cnpj == "88888888888888" || cnpj == "99999999999999") {
123
- return false;
124
- }
125
- let size = cnpj.length - 2;
126
- let numbers = cnpj.substring(0, size);
127
- const digits = cnpj.substring(size);
128
- let soma = 0;
129
- let pos = size - 7;
130
- for (let i = size; i >= 1; i--) {
131
- soma += numbers.charAt(size - i) * pos--;
132
- if (pos < 2) {
133
- pos = 9;
134
- }
135
- }
136
- let result = soma % 11 < 2 ? 0 : 11 - soma % 11;
137
- if (result != digits.charAt(0)) {
138
- return false;
139
- }
140
- size = size + 1;
141
- numbers = cnpj.substring(0, size);
142
- soma = 0;
143
- pos = size - 7;
144
- for (let i = size; i >= 1; i--) {
145
- soma += numbers.charAt(size - i) * pos--;
146
- if (pos < 2) {
147
- pos = 9;
148
- }
149
- }
150
- result = soma % 11 < 2 ? 0 : 11 - soma % 11;
151
- if (result != digits.charAt(1)) {
152
- return false;
153
- }
154
- return true;
155
- };
156
-
157
- // src/yup/schema.ts
158
- yup.addMethod(yup.string, "cnpj", function () {
159
- return this.test("valid-cnpj", "Invalid CNPJ", value => {
160
- return isCnpjValid(value);
161
- });
162
- });
163
-
164
- // src/yup/yup.ts
165
- var yup2 = __toESM(require("yup"));
166
-
167
- // src/Form.tsx
168
- var import_ui2 = require("@ttoss/ui");
169
- var import_react_hook_form = require("react-hook-form");
170
- var import_jsx_runtime2 = require("react/jsx-runtime");
171
- var Form = ({
172
- children,
173
- onSubmit,
174
- sx,
175
- ...formMethods
176
- }) => {
177
- return /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_react_hook_form.FormProvider, {
178
- ...formMethods,
179
- children: /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_ui2.Box, {
180
- as: "form",
181
- variant: "forms.form",
182
- onSubmit: formMethods.handleSubmit(data => {
183
- return onSubmit?.(data);
184
- }),
185
- sx,
186
- children
187
- })
188
- });
189
- };
190
-
191
- // src/FormErrorMessage.tsx
192
- var import_error_message = require("@hookform/error-message");
193
- var import_react_hook_form2 = require("react-hook-form");
194
- var import_react_i18n2 = require("@ttoss/react-i18n");
195
- var import_ui3 = require("@ttoss/ui");
196
- var import_jsx_runtime3 = require("react/jsx-runtime");
197
- var isMessageDescriptor = possibleMessageDescriptor => {
198
- return possibleMessageDescriptor !== void 0 && possibleMessageDescriptor.defaultMessage !== void 0;
199
- };
200
- var FormErrorMessage = ({
201
- name,
202
- disabled
203
- }) => {
204
- const {
205
- formState: {
206
- errors
207
- }
208
- } = (0, import_react_hook_form2.useFormContext)();
209
- return /* @__PURE__ */(0, import_jsx_runtime3.jsx)(import_error_message.ErrorMessage, {
210
- name,
211
- errors,
212
- render: ({
213
- message
214
- }) => {
215
- return /* @__PURE__ */(0, import_jsx_runtime3.jsx)(import_ui3.HelpText, {
216
- negative: true,
217
- disabled,
218
- children: (() => {
219
- if (typeof message === "string") {
220
- return message;
221
- }
222
- if (isMessageDescriptor(message)) {
223
- return /* @__PURE__ */(0, import_jsx_runtime3.jsx)(import_react_i18n2.FormattedMessage, {
224
- ...message
225
- });
226
- }
227
- return JSON.stringify(message);
228
- })()
229
- });
230
- }
231
- });
232
- };
233
-
234
- // src/FormField.tsx
235
- var React = __toESM(require("react"));
236
- var import_react_hook_form3 = require("react-hook-form");
237
- var import_ui4 = require("@ttoss/ui");
238
- var import_jsx_runtime4 = require("react/jsx-runtime");
239
- var FormField = ({
240
- label,
241
- id: idProp,
242
- name,
243
- defaultValue,
244
- disabled,
245
- tooltip,
246
- onTooltipClick,
247
- sx,
248
- css,
249
- render
250
- }) => {
251
- const controllerReturn = (0, import_react_hook_form3.useController)({
252
- name,
253
- defaultValue
254
- });
255
- const id = idProp || `form-field-${name}`;
256
- const memoizedRender = React.useMemo(() => {
257
- return React.Children.map(render(controllerReturn), child => {
258
- return /* @__PURE__ */(0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, {
259
- children: [label && /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_ui4.Label, {
260
- "aria-disabled": disabled,
261
- htmlFor: id,
262
- tooltip,
263
- onTooltipClick,
264
- children: label
265
- }), React.createElement(child.type, {
266
- id,
267
- ...child.props
268
- })]
269
- });
270
- });
271
- }, [controllerReturn, disabled, onTooltipClick, tooltip, id, label, render]);
272
- return /* @__PURE__ */(0, import_jsx_runtime4.jsxs)(import_ui4.Flex, {
273
- sx: {
274
- flexDirection: "column",
275
- width: "100%",
276
- gap: "md",
277
- ...sx
278
- },
279
- css,
280
- children: [memoizedRender, /* @__PURE__ */(0, import_jsx_runtime4.jsx)(FormErrorMessage, {
281
- name
282
- })]
283
- });
284
- };
285
-
286
- // src/FormFieldCheckbox.tsx
287
- var import_ui5 = require("@ttoss/ui");
288
- var import_react_hook_form4 = require("react-hook-form");
289
- var import_jsx_runtime5 = require("react/jsx-runtime");
290
- var FormFieldCheckbox = ({
291
- label,
292
- name,
293
- sx,
294
- ...checkboxProps
295
- }) => {
296
- const {
297
- field: {
298
- onChange,
299
- onBlur,
300
- value,
301
- ref
302
- },
303
- formState: {
304
- errors
305
- }
306
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
307
- } = (0, import_react_hook_form4.useController)({
308
- name,
309
- defaultValue: false
310
- });
311
- const id = `form-field-checkbox-${name}`;
312
- const error = !!errors[name]?.message;
313
- return /* @__PURE__ */(0, import_jsx_runtime5.jsxs)(import_ui5.Flex, {
314
- sx: {
315
- flexDirection: "column",
316
- width: "100%",
317
- ...sx
318
- },
319
- children: [/* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_ui5.Flex, {
320
- sx: {
321
- alignItems: "center"
322
- },
323
- children: /* @__PURE__ */(0, import_jsx_runtime5.jsxs)(import_ui5.Label, {
324
- "aria-disabled": checkboxProps.disabled,
325
- htmlFor: id,
326
- children: [/* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_ui5.Checkbox, {
327
- id,
328
- ref,
329
- checked: value,
330
- onChange,
331
- onBlur,
332
- name,
333
- "aria-invalid": error ? "true" : "false",
334
- ...checkboxProps
335
- }), label]
336
- })
337
- }), /* @__PURE__ */(0, import_jsx_runtime5.jsx)(FormErrorMessage, {
338
- name
339
- })]
340
- });
341
- };
342
-
343
- // src/FormFieldPatternFormat.tsx
344
- var import_ui6 = require("@ttoss/ui");
345
- var import_react_number_format2 = require("react-number-format");
346
- var import_jsx_runtime6 = require("react/jsx-runtime");
347
- var FormFieldPatternFormat = ({
348
- label,
349
- name,
350
- ...patternFormatProps
351
- }) => {
352
- return /* @__PURE__ */(0, import_jsx_runtime6.jsx)(FormField, {
353
- name,
354
- label,
355
- render: ({
356
- field,
357
- fieldState
358
- }) => {
359
- return /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_react_number_format2.PatternFormat, {
360
- name: field.name,
361
- value: field.value,
362
- onBlur: field.onBlur,
363
- onValueChange: values => {
364
- field.onChange(values.value);
365
- },
366
- customInput: import_ui6.Input,
367
- "aria-invalid": Boolean(fieldState.error).valueOf(),
368
- ...patternFormatProps
369
- });
370
- }
371
- });
372
- };
373
-
374
- // src/FormFieldCreditCardNumber.tsx
375
- var import_jsx_runtime7 = require("react/jsx-runtime");
376
- var FormFieldCreditCardNumber = ({
377
- label,
378
- name,
379
- ...formFieldPatternFormatProps
380
- }) => {
381
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(FormFieldPatternFormat, {
382
- name,
383
- label,
384
- format: "#### #### #### ####",
385
- placeholder: "1234 1234 1234 1234",
386
- ...formFieldPatternFormatProps
387
- });
388
- };
389
-
390
- // src/FormFieldNumericFormat.tsx
391
- var import_ui7 = require("@ttoss/ui");
392
- var import_react_number_format3 = require("react-number-format");
393
- var import_jsx_runtime8 = require("react/jsx-runtime");
394
- var FormFieldNumericFormat = ({
395
- label,
396
- name,
397
- ...numericFormatProps
398
- }) => {
399
- return /* @__PURE__ */(0, import_jsx_runtime8.jsx)(FormField, {
400
- label,
401
- name,
402
- render: ({
403
- field
404
- }) => {
405
- return /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_react_number_format3.NumericFormat, {
406
- name: field.name,
407
- value: field.value,
408
- onBlur: field.onBlur,
409
- onValueChange: values => {
410
- field.onChange(values.floatValue);
411
- },
412
- customInput: import_ui7.Input,
413
- ...numericFormatProps
414
- });
415
- }
416
- });
417
- };
418
-
419
- // src/FormFieldCurrencyInput.tsx
420
- var import_jsx_runtime9 = require("react/jsx-runtime");
421
- var FormFieldCurrencyInput = ({
422
- label,
423
- name,
424
- prefix,
425
- decimalSeparator,
426
- thousandSeparator,
427
- ...formFieldNumericFormatProps
428
- }) => {
429
- return /* @__PURE__ */(0, import_jsx_runtime9.jsx)(FormFieldNumericFormat, {
430
- name,
431
- label,
432
- fixedDecimalScale: true,
433
- decimalScale: 2,
434
- prefix,
435
- decimalSeparator,
436
- thousandSeparator,
437
- placeholder: `${prefix} 0${decimalSeparator}00`,
438
- allowNegative: false,
439
- ...formFieldNumericFormatProps
440
- });
441
- };
442
-
443
- // src/FormFieldInput.tsx
444
- var import_ui8 = require("@ttoss/ui");
445
- var import_jsx_runtime10 = require("react/jsx-runtime");
446
- var FormFieldInput = ({
447
- label,
448
- name,
449
- tooltip,
450
- onTooltipClick,
451
- sx,
452
- defaultValue = "",
453
- ...inputProps
454
- }) => {
455
- return /* @__PURE__ */(0, import_jsx_runtime10.jsx)(FormField, {
456
- name,
457
- label,
458
- disabled: inputProps.disabled,
459
- tooltip,
460
- onTooltipClick,
461
- sx,
462
- defaultValue,
463
- render: ({
464
- field,
465
- fieldState
466
- }) => {
467
- return /* @__PURE__ */(0, import_jsx_runtime10.jsx)(import_ui8.Input, {
468
- ...inputProps,
469
- ...field,
470
- "aria-invalid": fieldState.error ? "true" : void 0
471
- });
472
- }
473
- });
474
- };
475
-
476
- // src/FormFieldPassword.tsx
477
- var import_ui9 = require("@ttoss/ui");
478
- var import_jsx_runtime11 = require("react/jsx-runtime");
479
- var FormFieldPassword = ({
480
- label,
481
- name,
482
- tooltip,
483
- onTooltipClick,
484
- sx,
485
- defaultValue = "",
486
- ...inputProps
487
- }) => {
488
- return /* @__PURE__ */(0, import_jsx_runtime11.jsx)(FormField, {
489
- name,
490
- label,
491
- disabled: inputProps.disabled,
492
- tooltip,
493
- onTooltipClick,
494
- sx,
495
- defaultValue,
496
- render: ({
497
- field,
498
- fieldState
499
- }) => {
500
- return /* @__PURE__ */(0, import_jsx_runtime11.jsx)(import_ui9.InputPassword, {
501
- ...inputProps,
502
- ...field,
503
- "aria-invalid": fieldState.error ? "true" : void 0
504
- });
505
- }
506
- });
507
- };
508
-
509
- // src/FormFieldRadio.tsx
510
- var import_ui10 = require("@ttoss/ui");
511
- var import_react_hook_form5 = require("react-hook-form");
512
- var import_jsx_runtime12 = require("react/jsx-runtime");
513
- var FormFieldRadio = ({
514
- label,
515
- name,
516
- options,
517
- sx,
518
- ...radioProps
519
- }) => {
520
- const {
521
- field: {
522
- onChange,
523
- onBlur,
524
- value,
525
- ref
526
- }
527
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
528
- } = (0, import_react_hook_form5.useController)({
529
- name,
530
- defaultValue: ""
531
- });
532
- return /* @__PURE__ */(0, import_jsx_runtime12.jsxs)(import_ui10.Flex, {
533
- sx: {
534
- flexDirection: "column",
535
- width: "100%",
536
- ...sx
537
- },
538
- children: [label && /* @__PURE__ */(0, import_jsx_runtime12.jsx)(import_ui10.Label, {
539
- sx: {
540
- marginBottom: "md"
541
- },
542
- children: label
543
- }), /* @__PURE__ */(0, import_jsx_runtime12.jsx)(import_ui10.Box, {
544
- children: options.map(option => {
545
- const id = `form-field-radio-${name}-${option.value}`;
546
- return /* @__PURE__ */(0, import_jsx_runtime12.jsxs)(import_ui10.Label, {
547
- htmlFor: id,
548
- children: [/* @__PURE__ */(0, import_jsx_runtime12.jsx)(import_ui10.Radio, {
549
- ref,
550
- onChange,
551
- onBlur,
552
- value: option.value,
553
- checked: value === option.value,
554
- name,
555
- id,
556
- ...radioProps
557
- }), option.label]
558
- }, id);
559
- })
560
- }), /* @__PURE__ */(0, import_jsx_runtime12.jsx)(FormErrorMessage, {
561
- name
562
- })]
563
- });
564
- };
565
-
566
- // src/FormFieldSelect.tsx
567
- var import_ui11 = require("@ttoss/ui");
568
- var import_jsx_runtime13 = require("react/jsx-runtime");
569
- var FormFieldSelect = ({
570
- label,
571
- name,
572
- id,
573
- defaultValue,
574
- sx,
575
- css,
576
- disabled,
577
- tooltip,
578
- onTooltipClick,
579
- ...selectProps
580
- }) => {
581
- return /* @__PURE__ */(0, import_jsx_runtime13.jsx)(FormField, {
582
- name,
583
- label,
584
- id,
585
- defaultValue,
586
- disabled,
587
- tooltip,
588
- onTooltipClick,
589
- sx,
590
- css,
591
- render: ({
592
- field,
593
- fieldState
594
- }) => {
595
- return /* @__PURE__ */(0, import_jsx_runtime13.jsx)(import_ui11.Select, {
596
- ...selectProps,
597
- ...field,
598
- isDisabled: disabled,
599
- "aria-invalid": fieldState.error ? "true" : void 0
600
- });
601
- }
602
- });
603
- };
604
-
605
- // src/FormFieldTextarea.tsx
606
- var import_ui12 = require("@ttoss/ui");
607
- var import_jsx_runtime14 = require("react/jsx-runtime");
608
- var FormFieldTextarea = ({
609
- label,
610
- name,
611
- sx,
612
- ...textareaProps
613
- }) => {
614
- const id = `form-field-textarea-${name}`;
615
- return /* @__PURE__ */(0, import_jsx_runtime14.jsx)(FormField, {
616
- label,
617
- name,
618
- id,
619
- sx,
620
- render: ({
621
- field,
622
- fieldState
623
- }) => {
624
- return /* @__PURE__ */(0, import_jsx_runtime14.jsx)(import_ui12.Textarea, {
625
- ...field,
626
- ...textareaProps,
627
- "aria-invalid": fieldState.error ? "true" : void 0
628
- });
629
- }
630
- });
631
- };
632
-
633
- // src/FormGroup.tsx
634
- var React2 = __toESM(require("react"));
635
- var import_ui13 = require("@ttoss/ui");
636
- var import_jsx_runtime15 = require("react/jsx-runtime");
637
- var FormGroupLevelsManagerContext = React2.createContext({
638
- levelsLength: 1,
639
- registerChild: () => {
640
- return null;
641
- }
642
- });
643
- var FormGroupLevelsManager = ({
644
- children
645
- }) => {
646
- const [levelsLength, setLevelsLength] = React2.useState(0);
647
- const registerChild = React2.useCallback(level => {
648
- if (level + 1 > levelsLength) {
649
- setLevelsLength(level + 1);
650
- }
651
- }, [levelsLength]);
652
- return /* @__PURE__ */(0, import_jsx_runtime15.jsx)(FormGroupLevelsManagerContext.Provider, {
653
- value: {
654
- levelsLength,
655
- registerChild
656
- },
657
- children
658
- });
659
- };
660
- var FormGroupContext = React2.createContext({});
661
- var useFormGroup = () => {
662
- const {
663
- parentLevel
664
- } = React2.useContext(FormGroupContext);
665
- const {
666
- levelsLength
667
- } = React2.useContext(FormGroupLevelsManagerContext);
668
- return {
669
- level: parentLevel,
670
- levelsLength
671
- };
672
- };
673
- var FormGroupWrapper = ({
674
- title,
675
- direction,
676
- children,
677
- name,
678
- ...boxProps
679
- }) => {
680
- const {
681
- level
682
- } = useFormGroup();
683
- const {
684
- registerChild
685
- } = React2.useContext(FormGroupLevelsManagerContext);
686
- React2.useEffect(() => {
687
- if (typeof level === "number") {
688
- registerChild(level);
689
- }
690
- }, [level, registerChild]);
691
- const childrenContainerSx = {
692
- flexDirection: direction || "column",
693
- gap: "md",
694
- width: "100%"
695
- };
696
- return /* @__PURE__ */(0, import_jsx_runtime15.jsxs)(import_ui13.Box, {
697
- "aria-level": level,
698
- ...boxProps,
699
- sx: {
700
- marginTop: level === 0 ? "none" : "lg",
701
- marginBottom: "lg",
702
- ...boxProps.sx
703
- },
704
- children: [title && /* @__PURE__ */(0, import_jsx_runtime15.jsx)(import_ui13.Box, {
705
- sx: {
706
- marginBottom: "md"
707
- },
708
- children: /* @__PURE__ */(0, import_jsx_runtime15.jsx)(import_ui13.Text, {
709
- sx: {
710
- fontSize: "2xl",
711
- fontWeight: "bold"
712
- },
713
- children: title
714
- })
715
- }), /* @__PURE__ */(0, import_jsx_runtime15.jsx)(import_ui13.Flex, {
716
- sx: childrenContainerSx,
717
- children
718
- }), name && /* @__PURE__ */(0, import_jsx_runtime15.jsx)(FormErrorMessage, {
719
- name
720
- })]
721
- });
722
- };
723
- var FormGroup = props => {
724
- const {
725
- level
726
- } = useFormGroup();
727
- const currentLevel = level === void 0 ? 0 : level + 1;
728
- return /* @__PURE__ */(0, import_jsx_runtime15.jsx)(FormGroupContext.Provider, {
729
- value: {
730
- parentLevel: currentLevel
731
- },
732
- children: currentLevel === 0 ? /* @__PURE__ */(0, import_jsx_runtime15.jsx)(FormGroupLevelsManager, {
733
- children: /* @__PURE__ */(0, import_jsx_runtime15.jsx)(FormGroupWrapper, {
734
- ...props
735
- })
736
- }) : /* @__PURE__ */(0, import_jsx_runtime15.jsx)(FormGroupWrapper, {
737
- ...props
738
- })
739
- });
740
- };
741
-
742
- // src/index.ts
743
- var import_react_hook_form6 = require("react-hook-form");
744
- __reExport(src_exports, require("react-hook-form"), module.exports);
745
- // Annotate the CommonJS export names for ESM import in node:
746
- 0 && (module.exports = {
747
- Controller,
748
- Form,
749
- FormErrorMessage,
750
- FormField,
751
- FormFieldCheckbox,
752
- FormFieldCreditCardNumber,
753
- FormFieldCurrencyInput,
754
- FormFieldInput,
755
- FormFieldNumericFormat,
756
- FormFieldPassword,
757
- FormFieldPatternFormat,
758
- FormFieldRadio,
759
- FormFieldSelect,
760
- FormFieldTextarea,
761
- FormGroup,
762
- FormProvider,
763
- useController,
764
- useFieldArray,
765
- useForm,
766
- useFormContext,
767
- useFormGroup,
768
- useFormState,
769
- useWatch,
770
- yup,
771
- yupResolver,
772
- ...require("react-hook-form")
773
- });