@allhailai/formfoundry-baseui 1.2.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 ADDED
@@ -0,0 +1,809 @@
1
+ import { useFormFoundryField, useFormMeta, createRegistry } from '@allhailai/formfoundry-core';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { Checkbox } from '@base-ui/react/checkbox';
4
+ import { Field } from '@base-ui/react/field';
5
+ import 'react';
6
+ import { CheckboxGroup } from '@base-ui/react/checkbox-group';
7
+ import { NumberField } from '@base-ui/react/number-field';
8
+ import { Radio } from '@base-ui/react/radio';
9
+ import { RadioGroup } from '@base-ui/react/radio-group';
10
+ import { Select } from '@base-ui/react/select';
11
+ import { Slider } from '@base-ui/react/slider';
12
+ import { Switch } from '@base-ui/react/switch';
13
+ import { Input } from '@base-ui/react/input';
14
+
15
+ function ButtonInput({
16
+ label,
17
+ onClick,
18
+ disabled,
19
+ classNames
20
+ }) {
21
+ return /* @__PURE__ */ jsx(
22
+ "div",
23
+ {
24
+ className: classNames?.outer,
25
+ "data-formfoundry": "button",
26
+ children: /* @__PURE__ */ jsx(
27
+ "button",
28
+ {
29
+ type: "button",
30
+ onClick,
31
+ disabled,
32
+ className: classNames?.input,
33
+ children: label ?? "Button"
34
+ }
35
+ )
36
+ }
37
+ );
38
+ }
39
+ function CheckboxInput({
40
+ name,
41
+ label,
42
+ help,
43
+ validation,
44
+ validationBehavior,
45
+ classNames,
46
+ disabled,
47
+ defaultValue
48
+ }) {
49
+ const field = useFormFoundryField({
50
+ name,
51
+ validation,
52
+ validationBehavior,
53
+ defaultValue: defaultValue ?? false,
54
+ disabled,
55
+ label: typeof label === "string" ? label : void 0,
56
+ inputType: "checkbox"
57
+ });
58
+ return /* @__PURE__ */ jsxs(
59
+ Field.Root,
60
+ {
61
+ name,
62
+ invalid: !field.valid && field.touched,
63
+ disabled,
64
+ className: classNames?.outer,
65
+ "data-formfoundry": "checkbox",
66
+ "data-touched": field.touched || void 0,
67
+ "data-invalid": !field.valid && field.touched || void 0,
68
+ children: [
69
+ /* @__PURE__ */ jsxs("div", { className: classNames?.wrapper, style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
70
+ /* @__PURE__ */ jsx(
71
+ Checkbox.Root,
72
+ {
73
+ id: field.id,
74
+ checked: !!field.value,
75
+ onCheckedChange: (checked) => field.onChange(!!checked),
76
+ onBlur: field.onBlur,
77
+ className: classNames?.input,
78
+ children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: "\u2713" })
79
+ }
80
+ ),
81
+ label && /* @__PURE__ */ jsx(Field.Label, { className: classNames?.label, children: label })
82
+ ] }),
83
+ help && /* @__PURE__ */ jsx(Field.Description, { className: classNames?.help, children: help }),
84
+ field.error && /* @__PURE__ */ jsx(Field.Error, { className: classNames?.message, children: field.error })
85
+ ]
86
+ }
87
+ );
88
+ }
89
+ function normalizeOptions(options) {
90
+ return options.map(
91
+ (opt) => typeof opt === "string" ? { label: opt, value: opt } : opt
92
+ );
93
+ }
94
+ function CheckboxGroupInput({
95
+ name,
96
+ label,
97
+ help,
98
+ validation,
99
+ validationBehavior,
100
+ classNames,
101
+ options: rawOptions = [],
102
+ disabled,
103
+ defaultValue
104
+ }) {
105
+ const options = normalizeOptions(rawOptions);
106
+ const field = useFormFoundryField({
107
+ name,
108
+ validation,
109
+ validationBehavior,
110
+ defaultValue: defaultValue ?? [],
111
+ disabled,
112
+ label: typeof label === "string" ? label : void 0,
113
+ inputType: "checkboxgroup",
114
+ selectOptions: options
115
+ });
116
+ const selectedValues = field.value ?? [];
117
+ return /* @__PURE__ */ jsxs(
118
+ Field.Root,
119
+ {
120
+ name,
121
+ invalid: !field.valid && field.touched,
122
+ disabled,
123
+ className: classNames?.outer,
124
+ "data-formfoundry": "checkboxGroup",
125
+ children: [
126
+ label && /* @__PURE__ */ jsx(Field.Label, { className: classNames?.label, children: label }),
127
+ /* @__PURE__ */ jsx(
128
+ CheckboxGroup,
129
+ {
130
+ value: selectedValues,
131
+ onValueChange: (val) => field.onChange(val),
132
+ className: classNames?.wrapper,
133
+ children: options.map((opt) => /* @__PURE__ */ jsxs("label", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
134
+ /* @__PURE__ */ jsx(Checkbox.Root, { value: opt.value, className: classNames?.input, children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: "\u2713" }) }),
135
+ /* @__PURE__ */ jsx("span", { children: opt.label })
136
+ ] }, opt.value))
137
+ }
138
+ ),
139
+ help && /* @__PURE__ */ jsx(Field.Description, { className: classNames?.help, children: help }),
140
+ field.error && /* @__PURE__ */ jsx(Field.Error, { className: classNames?.message, children: field.error })
141
+ ]
142
+ }
143
+ );
144
+ }
145
+ function ColorInput({
146
+ name,
147
+ label,
148
+ help,
149
+ validation,
150
+ validationBehavior,
151
+ classNames,
152
+ disabled,
153
+ defaultValue
154
+ }) {
155
+ const field = useFormFoundryField({
156
+ name,
157
+ validation,
158
+ validationBehavior,
159
+ defaultValue: defaultValue ?? "#000000",
160
+ disabled,
161
+ label: typeof label === "string" ? label : void 0,
162
+ inputType: "color"
163
+ });
164
+ return /* @__PURE__ */ jsxs(
165
+ Field.Root,
166
+ {
167
+ name,
168
+ invalid: !field.valid && field.touched,
169
+ disabled,
170
+ className: classNames?.outer,
171
+ "data-formfoundry": "color",
172
+ "data-touched": field.touched || void 0,
173
+ "data-invalid": !field.valid && field.touched || void 0,
174
+ children: [
175
+ label && /* @__PURE__ */ jsx(Field.Label, { className: classNames?.label, children: label }),
176
+ /* @__PURE__ */ jsx("div", { className: classNames?.wrapper, children: /* @__PURE__ */ jsx(
177
+ "input",
178
+ {
179
+ id: field.id,
180
+ type: "color",
181
+ value: field.value ?? "#000000",
182
+ onChange: (e) => field.onChange(e.target.value),
183
+ onBlur: field.onBlur,
184
+ className: classNames?.input
185
+ }
186
+ ) }),
187
+ help && /* @__PURE__ */ jsx(Field.Description, { className: classNames?.help, children: help }),
188
+ field.error && /* @__PURE__ */ jsx(Field.Error, { className: classNames?.message, children: field.error })
189
+ ]
190
+ }
191
+ );
192
+ }
193
+ function DateInput({
194
+ name,
195
+ label,
196
+ help,
197
+ validation,
198
+ validationBehavior,
199
+ classNames,
200
+ type = "date",
201
+ placeholder,
202
+ disabled,
203
+ defaultValue,
204
+ min,
205
+ max,
206
+ step
207
+ }) {
208
+ const field = useFormFoundryField({
209
+ name,
210
+ validation,
211
+ validationBehavior,
212
+ defaultValue,
213
+ disabled,
214
+ label: typeof label === "string" ? label : void 0,
215
+ inputType: type ?? "date"
216
+ });
217
+ return /* @__PURE__ */ jsxs(
218
+ Field.Root,
219
+ {
220
+ name,
221
+ invalid: !field.valid && field.touched,
222
+ disabled,
223
+ className: classNames?.outer,
224
+ "data-formfoundry": type,
225
+ "data-touched": field.touched || void 0,
226
+ "data-invalid": !field.valid && field.touched || void 0,
227
+ "data-dirty": field.dirty || void 0,
228
+ children: [
229
+ label && /* @__PURE__ */ jsx(Field.Label, { className: classNames?.label, children: label }),
230
+ /* @__PURE__ */ jsx("div", { className: classNames?.wrapper, children: /* @__PURE__ */ jsx(
231
+ "input",
232
+ {
233
+ id: field.id,
234
+ type,
235
+ value: field.value ?? "",
236
+ onChange: (e) => field.onChange(e.target.value),
237
+ onBlur: field.onBlur,
238
+ placeholder,
239
+ min,
240
+ max,
241
+ step,
242
+ className: classNames?.input
243
+ }
244
+ ) }),
245
+ help && /* @__PURE__ */ jsx(Field.Description, { className: classNames?.help, children: help }),
246
+ field.error && /* @__PURE__ */ jsx(Field.Error, { className: classNames?.message, children: field.error })
247
+ ]
248
+ }
249
+ );
250
+ }
251
+ function FileInput({
252
+ name,
253
+ label,
254
+ help,
255
+ validation,
256
+ validationBehavior,
257
+ classNames,
258
+ disabled,
259
+ defaultValue,
260
+ accept,
261
+ multiple
262
+ }) {
263
+ const field = useFormFoundryField({
264
+ name,
265
+ validation,
266
+ validationBehavior,
267
+ defaultValue,
268
+ disabled,
269
+ label: typeof label === "string" ? label : void 0,
270
+ inputType: "file"
271
+ });
272
+ return /* @__PURE__ */ jsxs(
273
+ Field.Root,
274
+ {
275
+ name,
276
+ invalid: !field.valid && field.touched,
277
+ disabled,
278
+ className: classNames?.outer,
279
+ "data-formfoundry": "file",
280
+ "data-touched": field.touched || void 0,
281
+ "data-invalid": !field.valid && field.touched || void 0,
282
+ children: [
283
+ label && /* @__PURE__ */ jsx(Field.Label, { className: classNames?.label, children: label }),
284
+ /* @__PURE__ */ jsx("div", { className: classNames?.wrapper, children: /* @__PURE__ */ jsx(
285
+ "input",
286
+ {
287
+ id: field.id,
288
+ type: "file",
289
+ accept,
290
+ multiple,
291
+ onChange: (e) => field.onChange(e.target.files),
292
+ onBlur: field.onBlur,
293
+ className: classNames?.input
294
+ }
295
+ ) }),
296
+ help && /* @__PURE__ */ jsx(Field.Description, { className: classNames?.help, children: help }),
297
+ field.error && /* @__PURE__ */ jsx(Field.Error, { className: classNames?.message, children: field.error })
298
+ ]
299
+ }
300
+ );
301
+ }
302
+ function HiddenInput({
303
+ name,
304
+ validation,
305
+ defaultValue
306
+ }) {
307
+ const field = useFormFoundryField({
308
+ name,
309
+ validation,
310
+ defaultValue,
311
+ inputType: "hidden"
312
+ });
313
+ return /* @__PURE__ */ jsx(
314
+ "input",
315
+ {
316
+ type: "hidden",
317
+ id: field.id,
318
+ name,
319
+ value: field.value ?? ""
320
+ }
321
+ );
322
+ }
323
+ function NumberInput({
324
+ name,
325
+ label,
326
+ help,
327
+ validation,
328
+ validationBehavior,
329
+ classNames,
330
+ min,
331
+ max,
332
+ step,
333
+ placeholder,
334
+ disabled,
335
+ defaultValue
336
+ }) {
337
+ const field = useFormFoundryField({
338
+ name,
339
+ validation,
340
+ validationBehavior,
341
+ defaultValue,
342
+ disabled,
343
+ label: typeof label === "string" ? label : void 0,
344
+ inputType: "number"
345
+ });
346
+ return /* @__PURE__ */ jsxs(
347
+ Field.Root,
348
+ {
349
+ name,
350
+ invalid: !field.valid && field.touched,
351
+ disabled,
352
+ className: classNames?.outer,
353
+ "data-formfoundry": "number",
354
+ "data-touched": field.touched || void 0,
355
+ "data-invalid": !field.valid && field.touched || void 0,
356
+ children: [
357
+ label && /* @__PURE__ */ jsx(Field.Label, { className: classNames?.label, children: label }),
358
+ /* @__PURE__ */ jsx(
359
+ NumberField.Root,
360
+ {
361
+ value: field.value,
362
+ onValueChange: (val) => field.onChange(val),
363
+ min,
364
+ max,
365
+ step,
366
+ children: /* @__PURE__ */ jsxs(NumberField.Group, { className: classNames?.wrapper, children: [
367
+ /* @__PURE__ */ jsx(NumberField.Decrement, { children: "\u2212" }),
368
+ /* @__PURE__ */ jsx(
369
+ NumberField.Input,
370
+ {
371
+ id: field.id,
372
+ onBlur: field.onBlur,
373
+ placeholder,
374
+ className: classNames?.input
375
+ }
376
+ ),
377
+ /* @__PURE__ */ jsx(NumberField.Increment, { children: "+" })
378
+ ] })
379
+ }
380
+ ),
381
+ help && /* @__PURE__ */ jsx(Field.Description, { className: classNames?.help, children: help }),
382
+ field.error && /* @__PURE__ */ jsx(Field.Error, { className: classNames?.message, children: field.error })
383
+ ]
384
+ }
385
+ );
386
+ }
387
+ function normalizeOptions2(options) {
388
+ return options.map(
389
+ (opt) => typeof opt === "string" ? { label: opt, value: opt } : opt
390
+ );
391
+ }
392
+ function RadioInput({
393
+ name,
394
+ label,
395
+ help,
396
+ validation,
397
+ validationBehavior,
398
+ classNames,
399
+ options: rawOptions = [],
400
+ disabled,
401
+ defaultValue
402
+ }) {
403
+ const options = normalizeOptions2(rawOptions);
404
+ const field = useFormFoundryField({
405
+ name,
406
+ validation,
407
+ validationBehavior,
408
+ defaultValue,
409
+ disabled,
410
+ label: typeof label === "string" ? label : void 0,
411
+ inputType: "radio",
412
+ selectOptions: options
413
+ });
414
+ return /* @__PURE__ */ jsxs(
415
+ Field.Root,
416
+ {
417
+ name,
418
+ invalid: !field.valid && field.touched,
419
+ disabled,
420
+ className: classNames?.outer,
421
+ "data-formfoundry": "radio",
422
+ "data-touched": field.touched || void 0,
423
+ "data-invalid": !field.valid && field.touched || void 0,
424
+ children: [
425
+ label && /* @__PURE__ */ jsx(Field.Label, { className: classNames?.label, children: label }),
426
+ /* @__PURE__ */ jsx(
427
+ RadioGroup,
428
+ {
429
+ value: field.value,
430
+ onValueChange: (val) => field.onChange(val),
431
+ className: classNames?.wrapper,
432
+ children: options.map((opt) => /* @__PURE__ */ jsxs(
433
+ "label",
434
+ {
435
+ style: { display: "flex", alignItems: "center", gap: "0.5rem" },
436
+ children: [
437
+ /* @__PURE__ */ jsx(
438
+ Radio.Root,
439
+ {
440
+ value: opt.value,
441
+ onBlur: field.onBlur,
442
+ className: classNames?.input,
443
+ children: /* @__PURE__ */ jsx(Radio.Indicator, {})
444
+ }
445
+ ),
446
+ /* @__PURE__ */ jsx("span", { children: opt.label })
447
+ ]
448
+ },
449
+ opt.value
450
+ ))
451
+ }
452
+ ),
453
+ help && /* @__PURE__ */ jsx(Field.Description, { className: classNames?.help, children: help }),
454
+ field.error && /* @__PURE__ */ jsx(Field.Error, { className: classNames?.message, children: field.error })
455
+ ]
456
+ }
457
+ );
458
+ }
459
+ function normalizeOptions3(options) {
460
+ return options.map(
461
+ (opt) => typeof opt === "string" ? { label: opt, value: opt } : opt
462
+ );
463
+ }
464
+ function SelectInput({
465
+ name,
466
+ label,
467
+ help,
468
+ validation,
469
+ validationBehavior,
470
+ classNames,
471
+ options: rawOptions = [],
472
+ placeholder,
473
+ disabled,
474
+ defaultValue
475
+ }) {
476
+ const options = normalizeOptions3(rawOptions);
477
+ const field = useFormFoundryField({
478
+ name,
479
+ validation,
480
+ validationBehavior,
481
+ defaultValue,
482
+ disabled,
483
+ label: typeof label === "string" ? label : void 0,
484
+ inputType: "select",
485
+ selectOptions: options
486
+ });
487
+ return /* @__PURE__ */ jsxs(
488
+ Field.Root,
489
+ {
490
+ name,
491
+ invalid: !field.valid && field.touched,
492
+ disabled,
493
+ className: classNames?.outer,
494
+ "data-formfoundry": "select",
495
+ "data-touched": field.touched || void 0,
496
+ "data-invalid": !field.valid && field.touched || void 0,
497
+ children: [
498
+ label && /* @__PURE__ */ jsx(Field.Label, { className: classNames?.label, children: label }),
499
+ /* @__PURE__ */ jsxs(
500
+ Select.Root,
501
+ {
502
+ value: String(field.value ?? ""),
503
+ onValueChange: (val) => field.onChange(val),
504
+ children: [
505
+ /* @__PURE__ */ jsx(
506
+ Select.Trigger,
507
+ {
508
+ id: field.id,
509
+ onBlur: field.onBlur,
510
+ className: classNames?.input,
511
+ children: /* @__PURE__ */ jsx(Select.Value, { placeholder: placeholder ?? "Select..." })
512
+ }
513
+ ),
514
+ /* @__PURE__ */ jsx(Select.Portal, { children: /* @__PURE__ */ jsx(Select.Positioner, { children: /* @__PURE__ */ jsx(Select.Popup, { className: classNames?.wrapper, children: options.map((opt) => /* @__PURE__ */ jsxs(Select.Item, { value: opt.value, children: [
515
+ /* @__PURE__ */ jsx(Select.ItemText, { children: opt.label }),
516
+ /* @__PURE__ */ jsx(Select.ItemIndicator, { children: "\u2713" })
517
+ ] }, opt.value)) }) }) })
518
+ ]
519
+ }
520
+ ),
521
+ help && /* @__PURE__ */ jsx(Field.Description, { className: classNames?.help, children: help }),
522
+ field.error && /* @__PURE__ */ jsx(Field.Error, { className: classNames?.message, children: field.error })
523
+ ]
524
+ }
525
+ );
526
+ }
527
+ function SliderInput({
528
+ name,
529
+ label,
530
+ help,
531
+ validation,
532
+ validationBehavior,
533
+ classNames,
534
+ min = 0,
535
+ max = 100,
536
+ step = 1,
537
+ disabled,
538
+ defaultValue
539
+ }) {
540
+ const field = useFormFoundryField({
541
+ name,
542
+ validation,
543
+ validationBehavior,
544
+ defaultValue: defaultValue ?? min,
545
+ disabled,
546
+ label: typeof label === "string" ? label : void 0,
547
+ inputType: "slider"
548
+ });
549
+ return /* @__PURE__ */ jsxs(
550
+ Field.Root,
551
+ {
552
+ name,
553
+ invalid: !field.valid && field.touched,
554
+ disabled,
555
+ className: classNames?.outer,
556
+ "data-formfoundry": "slider",
557
+ "data-touched": field.touched || void 0,
558
+ children: [
559
+ label && /* @__PURE__ */ jsxs(Field.Label, { className: classNames?.label, children: [
560
+ label,
561
+ " ",
562
+ field.value !== void 0 && /* @__PURE__ */ jsxs("span", { children: [
563
+ "(",
564
+ String(field.value),
565
+ ")"
566
+ ] })
567
+ ] }),
568
+ /* @__PURE__ */ jsx(
569
+ Slider.Root,
570
+ {
571
+ value: field.value ?? min,
572
+ onValueChange: (val) => field.onChange(val),
573
+ onValueCommitted: () => field.onBlur(),
574
+ min,
575
+ max,
576
+ step,
577
+ className: classNames?.wrapper,
578
+ children: /* @__PURE__ */ jsx(Slider.Control, { children: /* @__PURE__ */ jsxs(Slider.Track, { className: classNames?.input, children: [
579
+ /* @__PURE__ */ jsx(Slider.Indicator, {}),
580
+ /* @__PURE__ */ jsx(Slider.Thumb, { id: field.id })
581
+ ] }) })
582
+ }
583
+ ),
584
+ help && /* @__PURE__ */ jsx(Field.Description, { className: classNames?.help, children: help }),
585
+ field.error && /* @__PURE__ */ jsx(Field.Error, { className: classNames?.message, children: field.error })
586
+ ]
587
+ }
588
+ );
589
+ }
590
+ function SubmitInput({
591
+ label,
592
+ submittingLabel,
593
+ disabled,
594
+ classNames
595
+ }) {
596
+ const meta = useFormMeta();
597
+ return /* @__PURE__ */ jsx(
598
+ "div",
599
+ {
600
+ className: classNames?.outer,
601
+ "data-formfoundry": "submit",
602
+ children: /* @__PURE__ */ jsx(
603
+ "button",
604
+ {
605
+ type: "submit",
606
+ disabled: disabled || meta.isSubmitting,
607
+ className: classNames?.input,
608
+ children: meta.isSubmitting ? submittingLabel ?? "Submitting\u2026" : label ?? "Submit"
609
+ }
610
+ )
611
+ }
612
+ );
613
+ }
614
+ function SwitchInput({
615
+ name,
616
+ label,
617
+ help,
618
+ validation,
619
+ validationBehavior,
620
+ classNames,
621
+ disabled,
622
+ defaultValue
623
+ }) {
624
+ const field = useFormFoundryField({
625
+ name,
626
+ validation,
627
+ validationBehavior,
628
+ defaultValue: defaultValue ?? false,
629
+ disabled,
630
+ label: typeof label === "string" ? label : void 0,
631
+ inputType: "switch"
632
+ });
633
+ return /* @__PURE__ */ jsxs(
634
+ Field.Root,
635
+ {
636
+ name,
637
+ invalid: !field.valid && field.touched,
638
+ disabled,
639
+ className: classNames?.outer,
640
+ "data-formfoundry": "switch",
641
+ "data-touched": field.touched || void 0,
642
+ children: [
643
+ /* @__PURE__ */ jsxs("div", { className: classNames?.wrapper, style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
644
+ /* @__PURE__ */ jsx(
645
+ Switch.Root,
646
+ {
647
+ id: field.id,
648
+ checked: !!field.value,
649
+ onCheckedChange: (checked) => field.onChange(checked),
650
+ onBlur: field.onBlur,
651
+ className: classNames?.input,
652
+ children: /* @__PURE__ */ jsx(Switch.Thumb, {})
653
+ }
654
+ ),
655
+ label && /* @__PURE__ */ jsx(Field.Label, { className: classNames?.label, children: label })
656
+ ] }),
657
+ help && /* @__PURE__ */ jsx(Field.Description, { className: classNames?.help, children: help }),
658
+ field.error && /* @__PURE__ */ jsx(Field.Error, { className: classNames?.message, children: field.error })
659
+ ]
660
+ }
661
+ );
662
+ }
663
+ function TextInput({
664
+ name,
665
+ label,
666
+ help,
667
+ validation,
668
+ validationBehavior,
669
+ classNames,
670
+ type = "text",
671
+ placeholder,
672
+ disabled,
673
+ defaultValue
674
+ }) {
675
+ const field = useFormFoundryField({
676
+ name,
677
+ validation,
678
+ validationBehavior,
679
+ defaultValue,
680
+ disabled,
681
+ label: typeof label === "string" ? label : void 0,
682
+ inputType: type ?? "text"
683
+ });
684
+ return /* @__PURE__ */ jsxs(
685
+ Field.Root,
686
+ {
687
+ name,
688
+ invalid: !field.valid && field.touched,
689
+ disabled,
690
+ className: classNames?.outer,
691
+ "data-formfoundry": "text",
692
+ "data-touched": field.touched || void 0,
693
+ "data-invalid": !field.valid && field.touched || void 0,
694
+ "data-dirty": field.dirty || void 0,
695
+ children: [
696
+ label && /* @__PURE__ */ jsx(Field.Label, { className: classNames?.label, children: label }),
697
+ /* @__PURE__ */ jsx("div", { className: classNames?.wrapper, children: /* @__PURE__ */ jsx(
698
+ Input,
699
+ {
700
+ id: field.id,
701
+ type,
702
+ value: field.value ?? "",
703
+ onChange: (e) => field.onChange(e.target.value),
704
+ onBlur: field.onBlur,
705
+ placeholder,
706
+ className: classNames?.input
707
+ }
708
+ ) }),
709
+ help && /* @__PURE__ */ jsx(Field.Description, { className: classNames?.help, children: help }),
710
+ field.error && /* @__PURE__ */ jsx(Field.Error, { className: classNames?.message, children: field.error })
711
+ ]
712
+ }
713
+ );
714
+ }
715
+ function TextareaInput({
716
+ name,
717
+ label,
718
+ help,
719
+ validation,
720
+ validationBehavior,
721
+ classNames,
722
+ placeholder,
723
+ disabled,
724
+ defaultValue,
725
+ rows = 3,
726
+ cols
727
+ }) {
728
+ const field = useFormFoundryField({
729
+ name,
730
+ validation,
731
+ validationBehavior,
732
+ defaultValue,
733
+ disabled,
734
+ label: typeof label === "string" ? label : void 0,
735
+ inputType: "textarea"
736
+ });
737
+ return /* @__PURE__ */ jsxs(
738
+ Field.Root,
739
+ {
740
+ name,
741
+ invalid: !field.valid && field.touched,
742
+ disabled,
743
+ className: classNames?.outer,
744
+ "data-formfoundry": "textarea",
745
+ "data-touched": field.touched || void 0,
746
+ "data-invalid": !field.valid && field.touched || void 0,
747
+ children: [
748
+ label && /* @__PURE__ */ jsx(Field.Label, { className: classNames?.label, children: label }),
749
+ /* @__PURE__ */ jsx(
750
+ Field.Control,
751
+ {
752
+ render: /* @__PURE__ */ jsx(
753
+ "textarea",
754
+ {
755
+ id: field.id,
756
+ value: field.value ?? "",
757
+ onChange: (e) => field.onChange(e.target.value),
758
+ onBlur: field.onBlur,
759
+ placeholder,
760
+ rows,
761
+ cols,
762
+ className: classNames?.input
763
+ }
764
+ )
765
+ }
766
+ ),
767
+ help && /* @__PURE__ */ jsx(Field.Description, { className: classNames?.help, children: help }),
768
+ field.error && /* @__PURE__ */ jsx(Field.Error, { className: classNames?.message, children: field.error })
769
+ ]
770
+ }
771
+ );
772
+ }
773
+ function createBaseUIRegistry() {
774
+ return createRegistry({
775
+ text: TextInput,
776
+ email: TextInput,
777
+ password: TextInput,
778
+ url: TextInput,
779
+ tel: TextInput,
780
+ number: NumberInput,
781
+ textarea: TextareaInput,
782
+ select: SelectInput,
783
+ checkbox: CheckboxInput,
784
+ checkboxGroup: CheckboxGroupInput,
785
+ switch: SwitchInput,
786
+ radio: RadioInput,
787
+ slider: SliderInput,
788
+ button: ButtonInput,
789
+ submit: SubmitInput,
790
+ hidden: HiddenInput,
791
+ file: FileInput,
792
+ color: ColorInput,
793
+ date: DateInput,
794
+ "datetime-local": DateInput,
795
+ time: DateInput,
796
+ month: DateInput,
797
+ week: DateInput
798
+ });
799
+ }
800
+
801
+ // src/adapter.ts
802
+ var baseUIAdapter = {
803
+ name: "baseui",
804
+ createRegistry: createBaseUIRegistry
805
+ };
806
+
807
+ export { ButtonInput, CheckboxGroupInput, CheckboxInput, ColorInput, DateInput, FileInput, HiddenInput, NumberInput, RadioInput, SelectInput, SliderInput, SubmitInput, SwitchInput, TextInput, TextareaInput, baseUIAdapter, createBaseUIRegistry };
808
+ //# sourceMappingURL=index.js.map
809
+ //# sourceMappingURL=index.js.map