@buildnbuzz/buzzform 0.1.3 → 0.1.4
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/{adapter-nQW28cyO.d.mts → adapter-u4raoNx9.d.mts} +76 -42
- package/dist/{adapter-nQW28cyO.d.ts → adapter-u4raoNx9.d.ts} +76 -42
- package/dist/{chunk-63LF7K4O.mjs → chunk-4SHWTNBE.mjs} +3 -1
- package/dist/chunk-4SHWTNBE.mjs.map +1 -0
- package/dist/{chunk-HWDQN57Q.mjs → chunk-ATZ2HTUS.mjs} +60 -11
- package/dist/chunk-ATZ2HTUS.mjs.map +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +59 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/rhf.d.mts +1 -1
- package/dist/rhf.d.ts +1 -1
- package/dist/schema.d.mts +5 -4
- package/dist/schema.d.ts +5 -4
- package/dist/schema.js +61 -9
- package/dist/schema.js.map +1 -1
- package/dist/schema.mjs +4 -2
- package/dist/{utils-DgwUn6tN.d.ts → utils-C1Y-xfSp.d.mts} +9 -2
- package/dist/{utils-BRY27BLX.d.mts → utils-D7pdJb3-.d.ts} +9 -2
- package/dist/zod.d.mts +1 -1
- package/dist/zod.d.ts +1 -1
- package/dist/zod.js.map +1 -1
- package/dist/zod.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-63LF7K4O.mjs.map +0 -1
- package/dist/chunk-HWDQN57Q.mjs.map +0 -1
|
@@ -33,7 +33,7 @@ type ValidationFn<TValue = unknown, TData = Record<string, unknown>> = (value: T
|
|
|
33
33
|
*/
|
|
34
34
|
interface ConditionContext {
|
|
35
35
|
/** Current operation */
|
|
36
|
-
operation:
|
|
36
|
+
operation: "create" | "update" | "read";
|
|
37
37
|
/** Path segments to this field */
|
|
38
38
|
path: string[];
|
|
39
39
|
}
|
|
@@ -172,7 +172,7 @@ interface BaseField<TValue = unknown, TData = Record<string, unknown>> {
|
|
|
172
172
|
* Text field
|
|
173
173
|
*/
|
|
174
174
|
interface TextField extends BaseField<string> {
|
|
175
|
-
type:
|
|
175
|
+
type: "text";
|
|
176
176
|
/** Minimum length */
|
|
177
177
|
minLength?: number;
|
|
178
178
|
/** Maximum length */
|
|
@@ -191,7 +191,7 @@ interface TextField extends BaseField<string> {
|
|
|
191
191
|
* Email field
|
|
192
192
|
*/
|
|
193
193
|
interface EmailField extends BaseField<string> {
|
|
194
|
-
type:
|
|
194
|
+
type: "email";
|
|
195
195
|
/** Minimum length */
|
|
196
196
|
minLength?: number;
|
|
197
197
|
/** Maximum length */
|
|
@@ -210,7 +210,7 @@ interface EmailField extends BaseField<string> {
|
|
|
210
210
|
* Password field
|
|
211
211
|
*/
|
|
212
212
|
interface PasswordField extends BaseField<string> {
|
|
213
|
-
type:
|
|
213
|
+
type: "password";
|
|
214
214
|
/** Minimum length (default: 8) */
|
|
215
215
|
minLength?: number;
|
|
216
216
|
/** Maximum length */
|
|
@@ -238,7 +238,7 @@ interface PasswordField extends BaseField<string> {
|
|
|
238
238
|
* Textarea field
|
|
239
239
|
*/
|
|
240
240
|
interface TextareaField extends BaseField<string> {
|
|
241
|
-
type:
|
|
241
|
+
type: "textarea";
|
|
242
242
|
/** Minimum length */
|
|
243
243
|
minLength?: number;
|
|
244
244
|
/** Maximum length */
|
|
@@ -257,7 +257,7 @@ interface TextareaField extends BaseField<string> {
|
|
|
257
257
|
* Number field
|
|
258
258
|
*/
|
|
259
259
|
interface NumberField extends BaseField<number> {
|
|
260
|
-
type:
|
|
260
|
+
type: "number";
|
|
261
261
|
/** Minimum value */
|
|
262
262
|
min?: number;
|
|
263
263
|
/** Maximum value */
|
|
@@ -269,7 +269,7 @@ interface NumberField extends BaseField<number> {
|
|
|
269
269
|
/** Step increment */
|
|
270
270
|
step?: number;
|
|
271
271
|
/** Visual variant */
|
|
272
|
-
variant?:
|
|
272
|
+
variant?: "default" | "stacked" | "pill" | "plain";
|
|
273
273
|
/** Prefix (e.g., "$") */
|
|
274
274
|
prefix?: string;
|
|
275
275
|
/** Suffix (e.g., "%", "kg") */
|
|
@@ -286,7 +286,7 @@ interface NumberField extends BaseField<number> {
|
|
|
286
286
|
* Date field
|
|
287
287
|
*/
|
|
288
288
|
interface DateField extends BaseField<Date> {
|
|
289
|
-
type:
|
|
289
|
+
type: "date";
|
|
290
290
|
/** Minimum date */
|
|
291
291
|
minDate?: Date | string;
|
|
292
292
|
/** Maximum date */
|
|
@@ -308,7 +308,7 @@ interface DateField extends BaseField<Date> {
|
|
|
308
308
|
* Datetime field
|
|
309
309
|
*/
|
|
310
310
|
interface DatetimeField extends BaseField<Date> {
|
|
311
|
-
type:
|
|
311
|
+
type: "datetime";
|
|
312
312
|
/** Minimum date */
|
|
313
313
|
minDate?: Date | string;
|
|
314
314
|
/** Maximum date */
|
|
@@ -353,7 +353,7 @@ interface SelectOption {
|
|
|
353
353
|
* Select field
|
|
354
354
|
*/
|
|
355
355
|
interface SelectField extends BaseField<string | string[] | number | number[] | boolean> {
|
|
356
|
-
type:
|
|
356
|
+
type: "select";
|
|
357
357
|
/** Options (static, string array, or async with context for dependent dropdowns) */
|
|
358
358
|
options: SelectOption[] | string[] | ((context: ValidationContext) => Promise<SelectOption[]>);
|
|
359
359
|
/**
|
|
@@ -364,6 +364,10 @@ interface SelectField extends BaseField<string | string[] | number | number[] |
|
|
|
364
364
|
dependencies?: string[];
|
|
365
365
|
/** Allow multiple selections */
|
|
366
366
|
hasMany?: boolean;
|
|
367
|
+
/** Minimum number of selections (when hasMany is true) */
|
|
368
|
+
minSelected?: number;
|
|
369
|
+
/** Maximum number of selections (when hasMany is true) */
|
|
370
|
+
maxSelected?: number;
|
|
367
371
|
/** UI options */
|
|
368
372
|
ui?: {
|
|
369
373
|
/** Enable search */
|
|
@@ -378,17 +382,47 @@ interface SelectField extends BaseField<string | string[] | number | number[] |
|
|
|
378
382
|
loadingMessage?: string;
|
|
379
383
|
};
|
|
380
384
|
}
|
|
385
|
+
/**
|
|
386
|
+
* Checkbox group field - multiple selections from a list of options
|
|
387
|
+
*/
|
|
388
|
+
interface CheckboxGroupField extends BaseField<Array<string | number | boolean>> {
|
|
389
|
+
type: "checkbox-group";
|
|
390
|
+
/** Static array or async function for options */
|
|
391
|
+
options: SelectOption[] | string[] | ((context: ValidationContext) => Promise<SelectOption[]>);
|
|
392
|
+
/** Paths that trigger options refetch when changed */
|
|
393
|
+
dependencies?: string[];
|
|
394
|
+
/** Minimum number of selections */
|
|
395
|
+
minSelected?: number;
|
|
396
|
+
/** Maximum number of selections */
|
|
397
|
+
maxSelected?: number;
|
|
398
|
+
/** UI options */
|
|
399
|
+
ui?: {
|
|
400
|
+
/** Layout direction */
|
|
401
|
+
direction?: "vertical" | "horizontal";
|
|
402
|
+
/** Grid columns (responsive, 1 on mobile) */
|
|
403
|
+
columns?: 1 | 2 | 3 | 4;
|
|
404
|
+
/** Visual variant */
|
|
405
|
+
variant?: "default" | "card";
|
|
406
|
+
/** Card settings (for variant: 'card') */
|
|
407
|
+
card?: {
|
|
408
|
+
/** Size preset ('sm', 'md', 'lg') */
|
|
409
|
+
size?: "sm" | "md" | "lg";
|
|
410
|
+
/** Show border around cards */
|
|
411
|
+
bordered?: boolean;
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
}
|
|
381
415
|
/**
|
|
382
416
|
* Checkbox field
|
|
383
417
|
*/
|
|
384
418
|
interface CheckboxField extends BaseField<boolean> {
|
|
385
|
-
type:
|
|
419
|
+
type: "checkbox";
|
|
386
420
|
}
|
|
387
421
|
/**
|
|
388
422
|
* Switch field
|
|
389
423
|
*/
|
|
390
424
|
interface SwitchField extends BaseField<boolean> {
|
|
391
|
-
type:
|
|
425
|
+
type: "switch";
|
|
392
426
|
/** UI options */
|
|
393
427
|
ui?: {
|
|
394
428
|
/**
|
|
@@ -397,29 +431,29 @@ interface SwitchField extends BaseField<boolean> {
|
|
|
397
431
|
* - 'start': Switch on left, label on right
|
|
398
432
|
* - 'end': Label on left, switch on right
|
|
399
433
|
*/
|
|
400
|
-
alignment?:
|
|
434
|
+
alignment?: "start" | "end" | "between";
|
|
401
435
|
};
|
|
402
436
|
}
|
|
403
437
|
/**
|
|
404
438
|
* Radio field - single selection from a group of options
|
|
405
439
|
*/
|
|
406
440
|
interface RadioField extends BaseField<string | number | boolean> {
|
|
407
|
-
type:
|
|
441
|
+
type: "radio";
|
|
408
442
|
/** Static array or async function for options */
|
|
409
443
|
options: SelectOption[] | string[] | ((context: ValidationContext) => Promise<SelectOption[]>);
|
|
410
444
|
/** Paths that trigger options refetch when changed */
|
|
411
445
|
dependencies?: string[];
|
|
412
446
|
ui?: {
|
|
413
447
|
/** Visual variant ('default' or 'card') */
|
|
414
|
-
variant?:
|
|
448
|
+
variant?: "default" | "card";
|
|
415
449
|
/** Layout direction for 'default' variant */
|
|
416
|
-
direction?:
|
|
450
|
+
direction?: "vertical" | "horizontal";
|
|
417
451
|
/** Grid columns (responsive, 1 on mobile) */
|
|
418
452
|
columns?: 1 | 2 | 3 | 4;
|
|
419
453
|
/** Card settings (for variant: 'card') */
|
|
420
454
|
card?: {
|
|
421
455
|
/** Size preset ('sm', 'md', 'lg') */
|
|
422
|
-
size?:
|
|
456
|
+
size?: "sm" | "md" | "lg";
|
|
423
457
|
/** Show border around cards */
|
|
424
458
|
bordered?: boolean;
|
|
425
459
|
};
|
|
@@ -429,7 +463,7 @@ interface RadioField extends BaseField<string | number | boolean> {
|
|
|
429
463
|
* Tags field - chip-based multi-value string input
|
|
430
464
|
*/
|
|
431
465
|
interface TagsField extends BaseField<string[]> {
|
|
432
|
-
type:
|
|
466
|
+
type: "tags";
|
|
433
467
|
/** Minimum number of tags */
|
|
434
468
|
minTags?: number;
|
|
435
469
|
/** Maximum number of tags */
|
|
@@ -441,9 +475,9 @@ interface TagsField extends BaseField<string[]> {
|
|
|
441
475
|
/** UI options */
|
|
442
476
|
ui?: {
|
|
443
477
|
/** Keys that create a new tag (default: ['enter']) */
|
|
444
|
-
delimiters?: (
|
|
478
|
+
delimiters?: ("enter" | "comma" | "space" | "tab")[];
|
|
445
479
|
/** Visual variant */
|
|
446
|
-
variant?:
|
|
480
|
+
variant?: "chips" | "pills" | "inline";
|
|
447
481
|
/** Show copy button to copy all tags */
|
|
448
482
|
copyable?: boolean;
|
|
449
483
|
};
|
|
@@ -452,7 +486,7 @@ interface TagsField extends BaseField<string[]> {
|
|
|
452
486
|
* Upload field
|
|
453
487
|
*/
|
|
454
488
|
interface UploadField extends BaseField<File | File[] | string | string[]> {
|
|
455
|
-
type:
|
|
489
|
+
type: "upload";
|
|
456
490
|
/** Allow multiple files */
|
|
457
491
|
hasMany?: boolean;
|
|
458
492
|
/** Minimum files (when hasMany) */
|
|
@@ -466,11 +500,11 @@ interface UploadField extends BaseField<File | File[] | string | string[]> {
|
|
|
466
500
|
/** MIME type filter */
|
|
467
501
|
accept?: string;
|
|
468
502
|
/** Visual variant */
|
|
469
|
-
variant?:
|
|
503
|
+
variant?: "dropzone" | "avatar" | "inline" | "gallery";
|
|
470
504
|
/** Shape (for avatar) */
|
|
471
|
-
shape?:
|
|
505
|
+
shape?: "circle" | "square" | "rounded";
|
|
472
506
|
/** Size preset */
|
|
473
|
-
size?:
|
|
507
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
474
508
|
/** Enable cropping */
|
|
475
509
|
crop?: boolean | {
|
|
476
510
|
aspectRatio?: number;
|
|
@@ -486,15 +520,15 @@ interface UploadField extends BaseField<File | File[] | string | string[]> {
|
|
|
486
520
|
* Group field - wraps fields in a named object
|
|
487
521
|
*/
|
|
488
522
|
interface GroupField extends BaseField<Record<string, unknown>> {
|
|
489
|
-
type:
|
|
523
|
+
type: "group";
|
|
490
524
|
/** Nested fields */
|
|
491
525
|
fields: Field[];
|
|
492
526
|
/** UI options */
|
|
493
527
|
ui?: {
|
|
494
528
|
/** Visual variant ('card', 'flat', 'ghost', 'bordered') */
|
|
495
|
-
variant?:
|
|
529
|
+
variant?: "card" | "flat" | "ghost" | "bordered";
|
|
496
530
|
/** Spacing between fields ('sm', 'md', 'lg') */
|
|
497
|
-
spacing?:
|
|
531
|
+
spacing?: "sm" | "md" | "lg";
|
|
498
532
|
/** Start in collapsed state */
|
|
499
533
|
collapsed?: boolean;
|
|
500
534
|
/** Show error badge */
|
|
@@ -505,7 +539,7 @@ interface GroupField extends BaseField<Record<string, unknown>> {
|
|
|
505
539
|
* Array field - repeatable fields
|
|
506
540
|
*/
|
|
507
541
|
interface ArrayField extends BaseField<unknown[]> {
|
|
508
|
-
type:
|
|
542
|
+
type: "array";
|
|
509
543
|
/** Fields for each array item */
|
|
510
544
|
fields: Field[];
|
|
511
545
|
/** Minimum items */
|
|
@@ -536,7 +570,7 @@ interface ArrayField extends BaseField<unknown[]> {
|
|
|
536
570
|
* Row field - horizontal layout container
|
|
537
571
|
*/
|
|
538
572
|
interface RowField {
|
|
539
|
-
type:
|
|
573
|
+
type: "row";
|
|
540
574
|
/** Fields to display in a row */
|
|
541
575
|
fields: Field[];
|
|
542
576
|
/** Layout options */
|
|
@@ -544,13 +578,13 @@ interface RowField {
|
|
|
544
578
|
/** Gap between fields (e.g., 4, '1rem', '16px') */
|
|
545
579
|
gap?: number | string;
|
|
546
580
|
/** Vertical alignment */
|
|
547
|
-
align?:
|
|
581
|
+
align?: "start" | "center" | "end" | "stretch";
|
|
548
582
|
/** Horizontal distribution */
|
|
549
|
-
justify?:
|
|
583
|
+
justify?: "start" | "center" | "end" | "between";
|
|
550
584
|
/** Allow wrapping to next line */
|
|
551
585
|
wrap?: boolean;
|
|
552
586
|
/** Responsive behavior: 'stack' collapses to vertical on mobile */
|
|
553
|
-
responsive?: boolean |
|
|
587
|
+
responsive?: boolean | "stack";
|
|
554
588
|
};
|
|
555
589
|
}
|
|
556
590
|
/**
|
|
@@ -574,7 +608,7 @@ interface Tab {
|
|
|
574
608
|
* Tabs field - tabbed container
|
|
575
609
|
*/
|
|
576
610
|
interface TabsField {
|
|
577
|
-
type:
|
|
611
|
+
type: "tabs";
|
|
578
612
|
/** Tab definitions */
|
|
579
613
|
tabs: Tab[];
|
|
580
614
|
/** UI options */
|
|
@@ -584,16 +618,16 @@ interface TabsField {
|
|
|
584
618
|
/** Show error badge on tabs with validation errors */
|
|
585
619
|
showErrorBadge?: boolean;
|
|
586
620
|
/** Visual variant */
|
|
587
|
-
variant?:
|
|
621
|
+
variant?: "default" | "line";
|
|
588
622
|
/** Spacing between fields within tabs */
|
|
589
|
-
spacing?:
|
|
623
|
+
spacing?: "sm" | "md" | "lg";
|
|
590
624
|
};
|
|
591
625
|
}
|
|
592
626
|
/**
|
|
593
627
|
* Collapsible field - expandable container
|
|
594
628
|
*/
|
|
595
629
|
interface CollapsibleField {
|
|
596
|
-
type:
|
|
630
|
+
type: "collapsible";
|
|
597
631
|
/** Container label */
|
|
598
632
|
label: string;
|
|
599
633
|
/** Nested fields */
|
|
@@ -603,9 +637,9 @@ interface CollapsibleField {
|
|
|
603
637
|
/** UI options */
|
|
604
638
|
ui?: {
|
|
605
639
|
/** Visual variant ('card', 'flat', 'ghost', 'bordered') */
|
|
606
|
-
variant?:
|
|
640
|
+
variant?: "card" | "flat" | "ghost" | "bordered";
|
|
607
641
|
/** Spacing between fields ('sm', 'md', 'lg') */
|
|
608
|
-
spacing?:
|
|
642
|
+
spacing?: "sm" | "md" | "lg";
|
|
609
643
|
/** Show error badge */
|
|
610
644
|
showErrorBadge?: boolean;
|
|
611
645
|
/** Optional description */
|
|
@@ -619,15 +653,15 @@ interface CollapsibleField {
|
|
|
619
653
|
/**
|
|
620
654
|
* Union of all field types.
|
|
621
655
|
*/
|
|
622
|
-
type Field = TextField | EmailField | PasswordField | TextareaField | NumberField | DateField | DatetimeField | SelectField | CheckboxField | SwitchField | RadioField | TagsField | UploadField | GroupField | ArrayField | RowField | TabsField | CollapsibleField;
|
|
656
|
+
type Field = TextField | EmailField | PasswordField | TextareaField | NumberField | DateField | DatetimeField | SelectField | CheckboxGroupField | CheckboxField | SwitchField | RadioField | TagsField | UploadField | GroupField | ArrayField | RowField | TabsField | CollapsibleField;
|
|
623
657
|
/**
|
|
624
658
|
* Extract field type from a Field.
|
|
625
659
|
*/
|
|
626
|
-
type FieldType = Field[
|
|
660
|
+
type FieldType = Field["type"];
|
|
627
661
|
/**
|
|
628
662
|
* Data fields (fields that hold values).
|
|
629
663
|
*/
|
|
630
|
-
type DataField = TextField | EmailField | PasswordField | TextareaField | NumberField | DateField | DatetimeField | SelectField | CheckboxField | SwitchField | RadioField | TagsField | UploadField | GroupField | ArrayField;
|
|
664
|
+
type DataField = TextField | EmailField | PasswordField | TextareaField | NumberField | DateField | DatetimeField | SelectField | CheckboxGroupField | CheckboxField | SwitchField | RadioField | TagsField | UploadField | GroupField | ArrayField;
|
|
631
665
|
/**
|
|
632
666
|
* Layout fields (fields that organize other fields).
|
|
633
667
|
*/
|
|
@@ -1139,4 +1173,4 @@ type AdapterFactory<TData = Record<string, unknown>> = (options: AdapterOptions<
|
|
|
1139
1173
|
*/
|
|
1140
1174
|
declare function validateAdapter(adapter: FormAdapter, adapterName?: string): void;
|
|
1141
1175
|
|
|
1142
|
-
export { type ArrayHelpers as A, type BaseField as B, type ConditionContext as C, type DateField as D, type EmailField as E, type Field as F, type GroupField as G, type
|
|
1176
|
+
export { type ArrayHelpers as A, type BaseField as B, type ConditionContext as C, type DateField as D, type EmailField as E, type Field as F, type GroupField as G, type RowField as H, type Tab as I, type TabsField as J, type CollapsibleField as K, type FieldType as L, type DataField as M, type NumberField as N, type LayoutField as O, type PasswordField as P, type BuzzFormSchema as Q, type ResolverResult as R, type SetValueOptions as S, type TextField as T, type UseFormOptions as U, type ValidationContext as V, type FormSettings as W, type FormConfig as a, type FormAdapter as b, type FormState as c, type FieldError as d, type Resolver as e, type AdapterOptions as f, type AdapterFactory as g, type ValidationResult as h, type ValidationFn as i, type FieldCondition as j, type FieldComponentProps as k, type FieldInputProps as l, type FieldInputRenderFn as m, type FieldStyle as n, type TextareaField as o, type DatetimeField as p, type SelectOption as q, type SelectField as r, type CheckboxGroupField as s, type CheckboxField as t, type SwitchField as u, validateAdapter as v, type RadioField as w, type TagsField as x, type UploadField as y, type ArrayField as z };
|