@page-speed/forms 0.6.2 → 0.6.3

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 (51) hide show
  1. package/dist/{FormContext-D_K7lO2V.d.ts → FormContext-Db0L3Kwv.d.ts} +1 -1
  2. package/dist/{FormContext-BHKCZ_du.d.cts → FormContext-kKZxeb7G.d.cts} +1 -1
  3. package/dist/{chunk-RS6AXV5S.cjs → chunk-3ED2FKXF.cjs} +100 -59
  4. package/dist/chunk-3ED2FKXF.cjs.map +1 -0
  5. package/dist/{chunk-ZEAH6AKP.js → chunk-H3YJRLVO.js} +93 -52
  6. package/dist/chunk-H3YJRLVO.js.map +1 -0
  7. package/dist/{chunk-455PI4LV.js → chunk-J37BGNM6.js} +5 -4
  8. package/dist/chunk-J37BGNM6.js.map +1 -0
  9. package/dist/{chunk-4ROWNTY6.js → chunk-ML6FGUYS.js} +3 -3
  10. package/dist/{chunk-4ROWNTY6.js.map → chunk-ML6FGUYS.js.map} +1 -1
  11. package/dist/{chunk-QRI5TMES.cjs → chunk-QMWZLGON.cjs} +5 -4
  12. package/dist/chunk-QMWZLGON.cjs.map +1 -0
  13. package/dist/{chunk-MJYEXJ3U.js → chunk-SNSK3TMG.js} +3 -3
  14. package/dist/{chunk-MJYEXJ3U.js.map → chunk-SNSK3TMG.js.map} +1 -1
  15. package/dist/{chunk-ED4UK63G.cjs → chunk-UQ6JPOBF.cjs} +114 -114
  16. package/dist/{chunk-ED4UK63G.cjs.map → chunk-UQ6JPOBF.cjs.map} +1 -1
  17. package/dist/{chunk-MUBEMXI7.cjs → chunk-V545YJFP.cjs} +6 -6
  18. package/dist/{chunk-MUBEMXI7.cjs.map → chunk-V545YJFP.cjs.map} +1 -1
  19. package/dist/core.cjs +10 -10
  20. package/dist/core.d.cts +13 -9
  21. package/dist/core.d.ts +13 -9
  22. package/dist/core.js +3 -3
  23. package/dist/index.cjs +14 -14
  24. package/dist/index.d.cts +2 -2
  25. package/dist/index.d.ts +2 -2
  26. package/dist/index.js +3 -3
  27. package/dist/inputs.cjs +14 -14
  28. package/dist/inputs.d.cts +8 -2
  29. package/dist/inputs.d.ts +8 -2
  30. package/dist/inputs.js +2 -2
  31. package/dist/integration.cjs +17 -17
  32. package/dist/integration.cjs.map +1 -1
  33. package/dist/integration.d.cts +3 -112
  34. package/dist/integration.d.ts +3 -112
  35. package/dist/integration.js +3 -3
  36. package/dist/integration.js.map +1 -1
  37. package/dist/{types-Fbt73kW_.d.ts → types-BPxsUGm_.d.cts} +120 -2
  38. package/dist/{types-Fbt73kW_.d.cts → types-BPxsUGm_.d.ts} +120 -2
  39. package/dist/validation-rules.d.cts +1 -1
  40. package/dist/validation-rules.d.ts +1 -1
  41. package/dist/validation-utils.d.cts +1 -1
  42. package/dist/validation-utils.d.ts +1 -1
  43. package/dist/validation-valibot.d.cts +1 -1
  44. package/dist/validation-valibot.d.ts +1 -1
  45. package/dist/validation.d.cts +1 -1
  46. package/dist/validation.d.ts +1 -1
  47. package/package.json +1 -1
  48. package/dist/chunk-455PI4LV.js.map +0 -1
  49. package/dist/chunk-QRI5TMES.cjs.map +0 -1
  50. package/dist/chunk-RS6AXV5S.cjs.map +0 -1
  51. package/dist/chunk-ZEAH6AKP.js.map +0 -1
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { d as FormSubmissionBehavior, N as NewFormSubmissionActionConfig, m as UseFormReturn } from './types-Fbt73kW_.cjs';
3
+ import { d as FormSubmissionBehavior, N as NewFormSubmissionActionConfig, t as FormFieldConfig, m as UseFormReturn } from './types-BPxsUGm_.cjs';
4
+ export { x as FormFieldType, y as SelectOption, u as generateInitialValues, v as generateValidationSchema, w as getColumnSpanClass } from './types-BPxsUGm_.cjs';
4
5
 
5
6
  /**
6
7
  * @page-speed/forms - Rails API Serializer
@@ -477,116 +478,6 @@ declare class PageSpeedFormSubmissionError extends Error {
477
478
  declare function isValidEmail(value: string): boolean;
478
479
  declare function submitPageSpeedForm(values: Record<string, any>, config?: PageSpeedFormConfig): Promise<unknown>;
479
480
 
480
- /**
481
- * Dynamic form field schema types and helpers.
482
- *
483
- * These utilities are intentionally exposed from the integration layer so
484
- * block/rendering libraries can share one field schema contract.
485
- */
486
- type FormFieldType = "text" | "email" | "search" | "password" | "tel" | "textarea" | "select" | "radio" | "checkbox" | "checkbox-group" | "number" | "url" | "date" | "date-picker" | "date-range" | "time" | "file" | "multi-select";
487
- interface SelectOption {
488
- value: string;
489
- label: string;
490
- disabled?: boolean;
491
- description?: string;
492
- }
493
- interface FormFieldConfig {
494
- /**
495
- * Unique field name (used as the key in form values)
496
- */
497
- name: string;
498
- /**
499
- * Field type
500
- */
501
- type: FormFieldType;
502
- /**
503
- * Display label for the field
504
- */
505
- label: string;
506
- /**
507
- * Placeholder text
508
- */
509
- placeholder?: string;
510
- /**
511
- * Whether the field is required
512
- * @default false
513
- */
514
- required?: boolean;
515
- /**
516
- * Column span in grid layout (1-12)
517
- * @default 12 (full width)
518
- */
519
- columnSpan?: number;
520
- /**
521
- * Options for select/radio/checkbox-group fields
522
- */
523
- options?: SelectOption[];
524
- /**
525
- * Number of rows for textarea
526
- * @default 4
527
- */
528
- rows?: number;
529
- /**
530
- * Custom validation function
531
- * Return undefined for valid, or an error message string for invalid
532
- */
533
- validator?: (value: any, allValues: Record<string, any>) => string | undefined;
534
- /**
535
- * Additional CSS classes for the field wrapper
536
- */
537
- className?: string;
538
- /**
539
- * Whether the field is disabled
540
- * @default false
541
- */
542
- disabled?: boolean;
543
- /**
544
- * Accepted file types for file inputs (MIME types or extensions)
545
- * @example ".pdf,.doc,.docx"
546
- * @example "image/*,application/pdf"
547
- */
548
- accept?: string;
549
- /**
550
- * Maximum file size in bytes for file inputs
551
- * @default 5MB (5 * 1024 * 1024)
552
- */
553
- maxSize?: number;
554
- /**
555
- * Maximum number of files for file inputs
556
- * @default 1
557
- */
558
- maxFiles?: number;
559
- /**
560
- * Allow multiple file selection
561
- * @default false
562
- */
563
- multiple?: boolean;
564
- /**
565
- * Description/help text displayed with the field
566
- */
567
- description?: string;
568
- /**
569
- * Layout for radio/checkbox groups
570
- * @default "stacked"
571
- */
572
- layout?: "grid" | "stacked";
573
- }
574
- /**
575
- * Generate initial values object from form field configs.
576
- */
577
- declare function generateInitialValues(fields: FormFieldConfig[]): Record<string, any>;
578
- /**
579
- * Generate validation schema from form field configs.
580
- */
581
- declare function generateValidationSchema(fields: FormFieldConfig[]): Record<string, (value: any, allValues: Record<string, any>) => string | undefined>;
582
- /**
583
- * Get grid column span class for Tailwind.
584
- *
585
- * On small screens the field is always full-width, then from `md` and up the
586
- * configured span is applied.
587
- */
588
- declare function getColumnSpanClass(span?: number): string;
589
-
590
481
  interface FileUploadProgress {
591
482
  [fileName: string]: number;
592
483
  }
@@ -681,4 +572,4 @@ interface DynamicFormFieldProps {
681
572
  */
682
573
  declare function DynamicFormField({ field, className, uploadProgress, onFileUpload, onFileRemove, isUploading, renderLabel, }: DynamicFormFieldProps): React.JSX.Element;
683
574
 
684
- export { type AdaptedComponentProps, type Block, type BlockAdapterOptions, DynamicFormField, type DynamicFormFieldProps, type FileUploadProgress, type FormErrors, type FormFieldConfig, type FormFieldType, type PageSpeedFormConfig, type PageSpeedFormMethod, type PageSpeedFormSubmissionConfig, PageSpeedFormSubmissionError, type PageSpeedFormSubmissionFormat, type PageSpeedFormSubmissionResult, type RailsApiConfig, type RailsErrorResponse, type SelectOption, type SerializedFormData, type UseContactFormOptions, type UseContactFormReturn, type UseFileUploadOptions, type UseFileUploadReturn, createBlockAdapter, createBlockAdapters, deserializeErrors, generateInitialValues, generateValidationSchema, getColumnSpanClass, isValidEmail, serializeForRails, standardInputTransformer, submitPageSpeedForm, useContactForm, useFileUpload };
575
+ export { type AdaptedComponentProps, type Block, type BlockAdapterOptions, DynamicFormField, type DynamicFormFieldProps, type FileUploadProgress, type FormErrors, FormFieldConfig, type PageSpeedFormConfig, type PageSpeedFormMethod, type PageSpeedFormSubmissionConfig, PageSpeedFormSubmissionError, type PageSpeedFormSubmissionFormat, type PageSpeedFormSubmissionResult, type RailsApiConfig, type RailsErrorResponse, type SerializedFormData, type UseContactFormOptions, type UseContactFormReturn, type UseFileUploadOptions, type UseFileUploadReturn, createBlockAdapter, createBlockAdapters, deserializeErrors, isValidEmail, serializeForRails, standardInputTransformer, submitPageSpeedForm, useContactForm, useFileUpload };
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { d as FormSubmissionBehavior, N as NewFormSubmissionActionConfig, m as UseFormReturn } from './types-Fbt73kW_.js';
3
+ import { d as FormSubmissionBehavior, N as NewFormSubmissionActionConfig, t as FormFieldConfig, m as UseFormReturn } from './types-BPxsUGm_.js';
4
+ export { x as FormFieldType, y as SelectOption, u as generateInitialValues, v as generateValidationSchema, w as getColumnSpanClass } from './types-BPxsUGm_.js';
4
5
 
5
6
  /**
6
7
  * @page-speed/forms - Rails API Serializer
@@ -477,116 +478,6 @@ declare class PageSpeedFormSubmissionError extends Error {
477
478
  declare function isValidEmail(value: string): boolean;
478
479
  declare function submitPageSpeedForm(values: Record<string, any>, config?: PageSpeedFormConfig): Promise<unknown>;
479
480
 
480
- /**
481
- * Dynamic form field schema types and helpers.
482
- *
483
- * These utilities are intentionally exposed from the integration layer so
484
- * block/rendering libraries can share one field schema contract.
485
- */
486
- type FormFieldType = "text" | "email" | "search" | "password" | "tel" | "textarea" | "select" | "radio" | "checkbox" | "checkbox-group" | "number" | "url" | "date" | "date-picker" | "date-range" | "time" | "file" | "multi-select";
487
- interface SelectOption {
488
- value: string;
489
- label: string;
490
- disabled?: boolean;
491
- description?: string;
492
- }
493
- interface FormFieldConfig {
494
- /**
495
- * Unique field name (used as the key in form values)
496
- */
497
- name: string;
498
- /**
499
- * Field type
500
- */
501
- type: FormFieldType;
502
- /**
503
- * Display label for the field
504
- */
505
- label: string;
506
- /**
507
- * Placeholder text
508
- */
509
- placeholder?: string;
510
- /**
511
- * Whether the field is required
512
- * @default false
513
- */
514
- required?: boolean;
515
- /**
516
- * Column span in grid layout (1-12)
517
- * @default 12 (full width)
518
- */
519
- columnSpan?: number;
520
- /**
521
- * Options for select/radio/checkbox-group fields
522
- */
523
- options?: SelectOption[];
524
- /**
525
- * Number of rows for textarea
526
- * @default 4
527
- */
528
- rows?: number;
529
- /**
530
- * Custom validation function
531
- * Return undefined for valid, or an error message string for invalid
532
- */
533
- validator?: (value: any, allValues: Record<string, any>) => string | undefined;
534
- /**
535
- * Additional CSS classes for the field wrapper
536
- */
537
- className?: string;
538
- /**
539
- * Whether the field is disabled
540
- * @default false
541
- */
542
- disabled?: boolean;
543
- /**
544
- * Accepted file types for file inputs (MIME types or extensions)
545
- * @example ".pdf,.doc,.docx"
546
- * @example "image/*,application/pdf"
547
- */
548
- accept?: string;
549
- /**
550
- * Maximum file size in bytes for file inputs
551
- * @default 5MB (5 * 1024 * 1024)
552
- */
553
- maxSize?: number;
554
- /**
555
- * Maximum number of files for file inputs
556
- * @default 1
557
- */
558
- maxFiles?: number;
559
- /**
560
- * Allow multiple file selection
561
- * @default false
562
- */
563
- multiple?: boolean;
564
- /**
565
- * Description/help text displayed with the field
566
- */
567
- description?: string;
568
- /**
569
- * Layout for radio/checkbox groups
570
- * @default "stacked"
571
- */
572
- layout?: "grid" | "stacked";
573
- }
574
- /**
575
- * Generate initial values object from form field configs.
576
- */
577
- declare function generateInitialValues(fields: FormFieldConfig[]): Record<string, any>;
578
- /**
579
- * Generate validation schema from form field configs.
580
- */
581
- declare function generateValidationSchema(fields: FormFieldConfig[]): Record<string, (value: any, allValues: Record<string, any>) => string | undefined>;
582
- /**
583
- * Get grid column span class for Tailwind.
584
- *
585
- * On small screens the field is always full-width, then from `md` and up the
586
- * configured span is applied.
587
- */
588
- declare function getColumnSpanClass(span?: number): string;
589
-
590
481
  interface FileUploadProgress {
591
482
  [fileName: string]: number;
592
483
  }
@@ -681,4 +572,4 @@ interface DynamicFormFieldProps {
681
572
  */
682
573
  declare function DynamicFormField({ field, className, uploadProgress, onFileUpload, onFileRemove, isUploading, renderLabel, }: DynamicFormFieldProps): React.JSX.Element;
683
574
 
684
- export { type AdaptedComponentProps, type Block, type BlockAdapterOptions, DynamicFormField, type DynamicFormFieldProps, type FileUploadProgress, type FormErrors, type FormFieldConfig, type FormFieldType, type PageSpeedFormConfig, type PageSpeedFormMethod, type PageSpeedFormSubmissionConfig, PageSpeedFormSubmissionError, type PageSpeedFormSubmissionFormat, type PageSpeedFormSubmissionResult, type RailsApiConfig, type RailsErrorResponse, type SelectOption, type SerializedFormData, type UseContactFormOptions, type UseContactFormReturn, type UseFileUploadOptions, type UseFileUploadReturn, createBlockAdapter, createBlockAdapters, deserializeErrors, generateInitialValues, generateValidationSchema, getColumnSpanClass, isValidEmail, serializeForRails, standardInputTransformer, submitPageSpeedForm, useContactForm, useFileUpload };
575
+ export { type AdaptedComponentProps, type Block, type BlockAdapterOptions, DynamicFormField, type DynamicFormFieldProps, type FileUploadProgress, type FormErrors, FormFieldConfig, type PageSpeedFormConfig, type PageSpeedFormMethod, type PageSpeedFormSubmissionConfig, PageSpeedFormSubmissionError, type PageSpeedFormSubmissionFormat, type PageSpeedFormSubmissionResult, type RailsApiConfig, type RailsErrorResponse, type SerializedFormData, type UseContactFormOptions, type UseContactFormReturn, type UseFileUploadOptions, type UseFileUploadReturn, createBlockAdapter, createBlockAdapters, deserializeErrors, isValidEmail, serializeForRails, standardInputTransformer, submitPageSpeedForm, useContactForm, useFileUpload };
@@ -1,6 +1,6 @@
1
- import { useForm, Field } from './chunk-MJYEXJ3U.js';
2
- import { TextArea, Select, MultiSelect, Radio, Checkbox, CheckboxGroup, DatePicker, DateRangePicker, TimePicker, FileInput } from './chunk-4ROWNTY6.js';
3
- import { TextInput } from './chunk-455PI4LV.js';
1
+ import { useForm, Field } from './chunk-SNSK3TMG.js';
2
+ import { TextArea, Select, MultiSelect, Radio, Checkbox, CheckboxGroup, DatePicker, DateRangePicker, TimePicker, FileInput } from './chunk-ML6FGUYS.js';
3
+ import { TextInput } from './chunk-J37BGNM6.js';
4
4
  import * as React2 from 'react';
5
5
  import { useState, useCallback, useMemo } from 'react';
6
6