@page-speed/forms 0.5.0 → 0.5.1

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/inputs.d.cts CHANGED
@@ -592,48 +592,7 @@ interface MultiSelectProps extends Omit<InputProps<string[]>, "onChange" | "onFo
592
592
  [key: string]: any;
593
593
  }
594
594
  /**
595
- * MultiSelect - High-performance multi-selection dropdown component
596
- *
597
- * A lightweight, accessible multi-select dropdown with search, keyboard navigation,
598
- * and error state support. Designed to work seamlessly with useForm and Field components.
599
- *
600
- * Features:
601
- * - Multiple value selection
602
- * - Full accessibility support (ARIA attributes, role="listbox")
603
- * - Error state styling
604
- * - Controlled input behavior
605
- * - Keyboard navigation (arrow keys, Enter, Escape, Space)
606
- * - Searchable options with filtering
607
- * - Clearable selections
608
- * - Option groups support
609
- * - Loading state for async options
610
- * - Disabled options support
611
- * - Maximum selections limit
612
- * - Select All / Clear All functionality
613
- * - Selected value chips/tags with individual removal
614
- * - Click outside to close
615
- *
616
- * @example
617
- * ```tsx
618
- * const form = useForm({ initialValues: { skills: [] } });
619
- *
620
- * <MultiSelect
621
- * {...form.getFieldProps('skills')}
622
- * placeholder="Select skills"
623
- * options={[
624
- * { value: 'react', label: 'React' },
625
- * { value: 'typescript', label: 'TypeScript' },
626
- * { value: 'node', label: 'Node.js' }
627
- * ]}
628
- * searchable
629
- * clearable
630
- * showSelectAll
631
- * maxSelections={5}
632
- * error={!!form.errors.skills}
633
- * />
634
- * ```
635
- *
636
- * @see https://opensite.ai/developers/page-speed/forms/multi-select
595
+ * MultiSelect - ShadCN Command + Popover multi-select component
637
596
  */
638
597
  declare function MultiSelect({ name, value, onChange, onBlur, onFocus, disabled, required, error, className, placeholder, searchable, clearable, loading, maxSelections, showSelectAll, options, optionGroups, renderOption, renderValue, ...props }: MultiSelectProps): React.JSX.Element;
639
598
  declare namespace MultiSelect {
@@ -738,55 +697,11 @@ interface FileInputProps extends Omit<InputProps<File[]>, "value" | "onChange">
738
697
  /**
739
698
  * FileInput component for file selection with validation, progress tracking, and image cropping
740
699
  *
741
- * Features:
742
- * - Drag-and-drop file upload
743
- * - File type and size validation
744
- * - Image preview thumbnails
745
- * - Upload progress indicators
746
- * - Image cropping with aspect ratio control
747
- * - Multiple file support
748
- *
749
- * @example
750
- * ```tsx
751
- * <FileInput
752
- * name="resume"
753
- * accept=".pdf,.doc,.docx"
754
- * maxSize={5 * 1024 * 1024}
755
- * value={files}
756
- * onChange={(files) => setFiles(files)}
757
- * error={hasError}
758
- * />
759
- * ```
760
- *
761
- * @example
762
- * ```tsx
763
- * // With upload progress
764
- * <FileInput
765
- * name="photos"
766
- * accept="image/*"
767
- * multiple
768
- * value={files}
769
- * onChange={setFiles}
770
- * showProgress
771
- * uploadProgress={progress}
772
- * />
773
- * ```
774
- *
775
- * @example
776
- * ```tsx
777
- * // With image cropping
778
- * <FileInput
779
- * name="avatar"
780
- * accept="image/*"
781
- * value={files}
782
- * onChange={setFiles}
783
- * enableCropping
784
- * cropAspectRatio={1}
785
- * onCropComplete={(blob, file) => {
786
- * // Handle cropped image
787
- * }}
788
- * />
789
- * ```
700
+ * Built on the DiceUI-style FileUpload primitive with form-specific behavior:
701
+ * - Rails/token upload workflow compatibility
702
+ * - External upload progress support
703
+ * - Validation + accessibility wiring
704
+ * - Optional image cropping modal
790
705
  */
791
706
  declare function FileInput({ name, value, onChange, onBlur, placeholder, disabled, required, error, className, accept, maxSize, // 5MB default
792
707
  maxFiles, multiple, showPreview, showProgress, uploadProgress, enableCropping, cropAspectRatio, onCropComplete, onValidationError, onFileRemove, ...props }: FileInputProps): React.JSX.Element;
@@ -1022,176 +937,12 @@ interface DateRangePickerProps extends Omit<InputProps<DateRange>, "onChange"> {
1022
937
  /**
1023
938
  * DateRangePicker - Accessible date range selection component
1024
939
  *
1025
- * A lightweight date range picker with calendar popup for selecting start and end dates.
1026
- * Designed to work seamlessly with useForm and Field components.
1027
- *
1028
- * Features:
1029
- * - Dual calendar view for range selection
1030
- * - Full accessibility support (ARIA attributes, keyboard navigation)
1031
- * - Error state styling
1032
- * - Controlled input behavior
1033
- * - Date range constraints (min/max dates)
1034
- * - Disabled dates support
1035
- * - Clearable selection
1036
- * - Custom date format display
1037
- * - Visual range highlighting
1038
- * - Icon display toggle
1039
- * - Click outside to close
1040
- *
1041
- * @example
1042
- * ```tsx
1043
- * const form = useForm({ initialValues: { dateRange: { start: null, end: null } } });
1044
- *
1045
- * <DateRangePicker
1046
- * {...form.getFieldProps('dateRange')}
1047
- * placeholder="Select date range"
1048
- * format="MM/dd/yyyy"
1049
- * clearable
1050
- * showIcon
1051
- * error={!!form.errors.dateRange}
1052
- * />
1053
- * ```
1054
- *
1055
- * @example
1056
- * ```tsx
1057
- * // With date constraints
1058
- * <DateRangePicker
1059
- * name="vacation"
1060
- * value={vacationRange}
1061
- * onChange={setVacationRange}
1062
- * minDate={new Date()}
1063
- * maxDate={addDays(new Date(), 365)}
1064
- * separator=" to "
1065
- * />
1066
- * ```
1067
- *
1068
- * @see https://opensite.ai/developers/page-speed/forms/date-range-picker
940
+ * Uses ShadCN Calendar + Popover primitives while preserving the existing
941
+ * public API and interaction semantics.
1069
942
  */
1070
943
  declare function DateRangePicker({ name, value, onChange, onBlur, disabled, required, error, className, placeholder, format, minDate, maxDate, disabledDates, isDateDisabled, clearable, showIcon, separator, ...props }: DateRangePickerProps): React.JSX.Element;
1071
944
  declare namespace DateRangePicker {
1072
945
  var displayName: string;
1073
946
  }
1074
947
 
1075
- /**
1076
- * Editor mode type
1077
- */
1078
- type EditorMode = "wysiwyg" | "markdown";
1079
- /**
1080
- * Toolbar button configuration
1081
- */
1082
- interface ToolbarButton {
1083
- command: string;
1084
- icon: string;
1085
- title: string;
1086
- action: (editor: HTMLElement) => void;
1087
- }
1088
- /**
1089
- * RichTextEditor props interface
1090
- */
1091
- interface RichTextEditorProps extends Omit<InputProps<string>, "onChange"> {
1092
- /**
1093
- * Change handler - receives HTML or Markdown content
1094
- */
1095
- onChange: (content: string) => void;
1096
- /**
1097
- * Editor mode - WYSIWYG or Markdown
1098
- * @default "wysiwyg"
1099
- */
1100
- mode?: EditorMode;
1101
- /**
1102
- * Allow mode switching
1103
- * @default false
1104
- */
1105
- allowModeSwitch?: boolean;
1106
- /**
1107
- * Placeholder text when editor is empty
1108
- * @default "Start typing..."
1109
- */
1110
- placeholder?: string;
1111
- /**
1112
- * Minimum height of editor
1113
- * @default "200px"
1114
- */
1115
- minHeight?: string;
1116
- /**
1117
- * Maximum height of editor (enables scrolling)
1118
- */
1119
- maxHeight?: string;
1120
- /**
1121
- * Show toolbar
1122
- * @default true
1123
- */
1124
- showToolbar?: boolean;
1125
- /**
1126
- * Toolbar buttons to display
1127
- * @default ["bold", "italic", "underline", "heading", "bulletList", "orderedList", "link"]
1128
- */
1129
- toolbarButtons?: string[];
1130
- /**
1131
- * Additional native input attributes
1132
- */
1133
- [key: string]: any;
1134
- }
1135
- /**
1136
- * RichTextEditor - Basic rich text editing component with WYSIWYG and Markdown support
1137
- *
1138
- * A lightweight rich text editor with basic formatting capabilities and optional Markdown mode.
1139
- * Designed to work seamlessly with useForm and Field components.
1140
- *
1141
- * Features:
1142
- * - WYSIWYG editor with contentEditable
1143
- * - Markdown editor mode
1144
- * - Configurable toolbar with common formatting options
1145
- * - Full accessibility support
1146
- * - Error state styling
1147
- * - Controlled input behavior
1148
- * - Custom toolbar configuration
1149
- * - Mode switching support
1150
- * - Placeholder text support
1151
- * - Adjustable height constraints
1152
- *
1153
- * Toolbar buttons:
1154
- * - bold: Bold text (**text**)
1155
- * - italic: Italic text (*text*)
1156
- * - underline: Underlined text
1157
- * - heading: Heading levels (H1-H3)
1158
- * - bulletList: Unordered list
1159
- * - orderedList: Ordered list
1160
- * - link: Insert hyperlink
1161
- *
1162
- * @example
1163
- * ```tsx
1164
- * const form = useForm({ initialValues: { content: '' } });
1165
- *
1166
- * <RichTextEditor
1167
- * {...form.getFieldProps('content')}
1168
- * placeholder="Write your content..."
1169
- * mode="wysiwyg"
1170
- * allowModeSwitch
1171
- * showToolbar
1172
- * minHeight="200px"
1173
- * maxHeight="500px"
1174
- * error={!!form.errors.content}
1175
- * />
1176
- * ```
1177
- *
1178
- * @example
1179
- * ```tsx
1180
- * // Markdown mode
1181
- * <RichTextEditor
1182
- * name="description"
1183
- * value={description}
1184
- * onChange={setDescription}
1185
- * mode="markdown"
1186
- * toolbarButtons={["bold", "italic", "heading", "link"]}
1187
- * />
1188
- * ```
1189
- *
1190
- * @see https://opensite.ai/developers/page-speed/forms/rich-text-editor
1191
- */
1192
- declare function RichTextEditor({ name, value, onChange, onBlur, disabled, required, error, className, mode, allowModeSwitch, placeholder, minHeight, maxHeight, showToolbar, toolbarButtons, ...props }: RichTextEditorProps): React.JSX.Element;
1193
- declare namespace RichTextEditor {
1194
- var displayName: string;
1195
- }
1196
-
1197
- export { Checkbox, CheckboxGroup, type CheckboxGroupOption, type CheckboxGroupProps, type CheckboxProps, type CropArea, DatePicker, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, type EditorMode, FileInput, type FileInputProps, type FileUploadProgress, type FileValidationError, MultiSelect, type MultiSelectOption, type MultiSelectOptionGroup, type MultiSelectProps, Radio, type RadioOption, type RadioProps, RichTextEditor, type RichTextEditorProps, Select, type SelectOption, type SelectOptionGroup, type SelectProps, Switch, type SwitchProps, TextArea, type TextAreaProps, TextInput, TimePicker, type TimePickerProps, type TimeValue, type ToolbarButton };
948
+ export { Checkbox, CheckboxGroup, type CheckboxGroupOption, type CheckboxGroupProps, type CheckboxProps, type CropArea, DatePicker, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, FileInput, type FileInputProps, type FileUploadProgress, type FileValidationError, MultiSelect, type MultiSelectOption, type MultiSelectOptionGroup, type MultiSelectProps, Radio, type RadioOption, type RadioProps, Select, type SelectOption, type SelectOptionGroup, type SelectProps, Switch, type SwitchProps, TextArea, type TextAreaProps, TextInput, TimePicker, type TimePickerProps, type TimeValue };
package/dist/inputs.d.ts CHANGED
@@ -592,48 +592,7 @@ interface MultiSelectProps extends Omit<InputProps<string[]>, "onChange" | "onFo
592
592
  [key: string]: any;
593
593
  }
594
594
  /**
595
- * MultiSelect - High-performance multi-selection dropdown component
596
- *
597
- * A lightweight, accessible multi-select dropdown with search, keyboard navigation,
598
- * and error state support. Designed to work seamlessly with useForm and Field components.
599
- *
600
- * Features:
601
- * - Multiple value selection
602
- * - Full accessibility support (ARIA attributes, role="listbox")
603
- * - Error state styling
604
- * - Controlled input behavior
605
- * - Keyboard navigation (arrow keys, Enter, Escape, Space)
606
- * - Searchable options with filtering
607
- * - Clearable selections
608
- * - Option groups support
609
- * - Loading state for async options
610
- * - Disabled options support
611
- * - Maximum selections limit
612
- * - Select All / Clear All functionality
613
- * - Selected value chips/tags with individual removal
614
- * - Click outside to close
615
- *
616
- * @example
617
- * ```tsx
618
- * const form = useForm({ initialValues: { skills: [] } });
619
- *
620
- * <MultiSelect
621
- * {...form.getFieldProps('skills')}
622
- * placeholder="Select skills"
623
- * options={[
624
- * { value: 'react', label: 'React' },
625
- * { value: 'typescript', label: 'TypeScript' },
626
- * { value: 'node', label: 'Node.js' }
627
- * ]}
628
- * searchable
629
- * clearable
630
- * showSelectAll
631
- * maxSelections={5}
632
- * error={!!form.errors.skills}
633
- * />
634
- * ```
635
- *
636
- * @see https://opensite.ai/developers/page-speed/forms/multi-select
595
+ * MultiSelect - ShadCN Command + Popover multi-select component
637
596
  */
638
597
  declare function MultiSelect({ name, value, onChange, onBlur, onFocus, disabled, required, error, className, placeholder, searchable, clearable, loading, maxSelections, showSelectAll, options, optionGroups, renderOption, renderValue, ...props }: MultiSelectProps): React.JSX.Element;
639
598
  declare namespace MultiSelect {
@@ -738,55 +697,11 @@ interface FileInputProps extends Omit<InputProps<File[]>, "value" | "onChange">
738
697
  /**
739
698
  * FileInput component for file selection with validation, progress tracking, and image cropping
740
699
  *
741
- * Features:
742
- * - Drag-and-drop file upload
743
- * - File type and size validation
744
- * - Image preview thumbnails
745
- * - Upload progress indicators
746
- * - Image cropping with aspect ratio control
747
- * - Multiple file support
748
- *
749
- * @example
750
- * ```tsx
751
- * <FileInput
752
- * name="resume"
753
- * accept=".pdf,.doc,.docx"
754
- * maxSize={5 * 1024 * 1024}
755
- * value={files}
756
- * onChange={(files) => setFiles(files)}
757
- * error={hasError}
758
- * />
759
- * ```
760
- *
761
- * @example
762
- * ```tsx
763
- * // With upload progress
764
- * <FileInput
765
- * name="photos"
766
- * accept="image/*"
767
- * multiple
768
- * value={files}
769
- * onChange={setFiles}
770
- * showProgress
771
- * uploadProgress={progress}
772
- * />
773
- * ```
774
- *
775
- * @example
776
- * ```tsx
777
- * // With image cropping
778
- * <FileInput
779
- * name="avatar"
780
- * accept="image/*"
781
- * value={files}
782
- * onChange={setFiles}
783
- * enableCropping
784
- * cropAspectRatio={1}
785
- * onCropComplete={(blob, file) => {
786
- * // Handle cropped image
787
- * }}
788
- * />
789
- * ```
700
+ * Built on the DiceUI-style FileUpload primitive with form-specific behavior:
701
+ * - Rails/token upload workflow compatibility
702
+ * - External upload progress support
703
+ * - Validation + accessibility wiring
704
+ * - Optional image cropping modal
790
705
  */
791
706
  declare function FileInput({ name, value, onChange, onBlur, placeholder, disabled, required, error, className, accept, maxSize, // 5MB default
792
707
  maxFiles, multiple, showPreview, showProgress, uploadProgress, enableCropping, cropAspectRatio, onCropComplete, onValidationError, onFileRemove, ...props }: FileInputProps): React.JSX.Element;
@@ -1022,176 +937,12 @@ interface DateRangePickerProps extends Omit<InputProps<DateRange>, "onChange"> {
1022
937
  /**
1023
938
  * DateRangePicker - Accessible date range selection component
1024
939
  *
1025
- * A lightweight date range picker with calendar popup for selecting start and end dates.
1026
- * Designed to work seamlessly with useForm and Field components.
1027
- *
1028
- * Features:
1029
- * - Dual calendar view for range selection
1030
- * - Full accessibility support (ARIA attributes, keyboard navigation)
1031
- * - Error state styling
1032
- * - Controlled input behavior
1033
- * - Date range constraints (min/max dates)
1034
- * - Disabled dates support
1035
- * - Clearable selection
1036
- * - Custom date format display
1037
- * - Visual range highlighting
1038
- * - Icon display toggle
1039
- * - Click outside to close
1040
- *
1041
- * @example
1042
- * ```tsx
1043
- * const form = useForm({ initialValues: { dateRange: { start: null, end: null } } });
1044
- *
1045
- * <DateRangePicker
1046
- * {...form.getFieldProps('dateRange')}
1047
- * placeholder="Select date range"
1048
- * format="MM/dd/yyyy"
1049
- * clearable
1050
- * showIcon
1051
- * error={!!form.errors.dateRange}
1052
- * />
1053
- * ```
1054
- *
1055
- * @example
1056
- * ```tsx
1057
- * // With date constraints
1058
- * <DateRangePicker
1059
- * name="vacation"
1060
- * value={vacationRange}
1061
- * onChange={setVacationRange}
1062
- * minDate={new Date()}
1063
- * maxDate={addDays(new Date(), 365)}
1064
- * separator=" to "
1065
- * />
1066
- * ```
1067
- *
1068
- * @see https://opensite.ai/developers/page-speed/forms/date-range-picker
940
+ * Uses ShadCN Calendar + Popover primitives while preserving the existing
941
+ * public API and interaction semantics.
1069
942
  */
1070
943
  declare function DateRangePicker({ name, value, onChange, onBlur, disabled, required, error, className, placeholder, format, minDate, maxDate, disabledDates, isDateDisabled, clearable, showIcon, separator, ...props }: DateRangePickerProps): React.JSX.Element;
1071
944
  declare namespace DateRangePicker {
1072
945
  var displayName: string;
1073
946
  }
1074
947
 
1075
- /**
1076
- * Editor mode type
1077
- */
1078
- type EditorMode = "wysiwyg" | "markdown";
1079
- /**
1080
- * Toolbar button configuration
1081
- */
1082
- interface ToolbarButton {
1083
- command: string;
1084
- icon: string;
1085
- title: string;
1086
- action: (editor: HTMLElement) => void;
1087
- }
1088
- /**
1089
- * RichTextEditor props interface
1090
- */
1091
- interface RichTextEditorProps extends Omit<InputProps<string>, "onChange"> {
1092
- /**
1093
- * Change handler - receives HTML or Markdown content
1094
- */
1095
- onChange: (content: string) => void;
1096
- /**
1097
- * Editor mode - WYSIWYG or Markdown
1098
- * @default "wysiwyg"
1099
- */
1100
- mode?: EditorMode;
1101
- /**
1102
- * Allow mode switching
1103
- * @default false
1104
- */
1105
- allowModeSwitch?: boolean;
1106
- /**
1107
- * Placeholder text when editor is empty
1108
- * @default "Start typing..."
1109
- */
1110
- placeholder?: string;
1111
- /**
1112
- * Minimum height of editor
1113
- * @default "200px"
1114
- */
1115
- minHeight?: string;
1116
- /**
1117
- * Maximum height of editor (enables scrolling)
1118
- */
1119
- maxHeight?: string;
1120
- /**
1121
- * Show toolbar
1122
- * @default true
1123
- */
1124
- showToolbar?: boolean;
1125
- /**
1126
- * Toolbar buttons to display
1127
- * @default ["bold", "italic", "underline", "heading", "bulletList", "orderedList", "link"]
1128
- */
1129
- toolbarButtons?: string[];
1130
- /**
1131
- * Additional native input attributes
1132
- */
1133
- [key: string]: any;
1134
- }
1135
- /**
1136
- * RichTextEditor - Basic rich text editing component with WYSIWYG and Markdown support
1137
- *
1138
- * A lightweight rich text editor with basic formatting capabilities and optional Markdown mode.
1139
- * Designed to work seamlessly with useForm and Field components.
1140
- *
1141
- * Features:
1142
- * - WYSIWYG editor with contentEditable
1143
- * - Markdown editor mode
1144
- * - Configurable toolbar with common formatting options
1145
- * - Full accessibility support
1146
- * - Error state styling
1147
- * - Controlled input behavior
1148
- * - Custom toolbar configuration
1149
- * - Mode switching support
1150
- * - Placeholder text support
1151
- * - Adjustable height constraints
1152
- *
1153
- * Toolbar buttons:
1154
- * - bold: Bold text (**text**)
1155
- * - italic: Italic text (*text*)
1156
- * - underline: Underlined text
1157
- * - heading: Heading levels (H1-H3)
1158
- * - bulletList: Unordered list
1159
- * - orderedList: Ordered list
1160
- * - link: Insert hyperlink
1161
- *
1162
- * @example
1163
- * ```tsx
1164
- * const form = useForm({ initialValues: { content: '' } });
1165
- *
1166
- * <RichTextEditor
1167
- * {...form.getFieldProps('content')}
1168
- * placeholder="Write your content..."
1169
- * mode="wysiwyg"
1170
- * allowModeSwitch
1171
- * showToolbar
1172
- * minHeight="200px"
1173
- * maxHeight="500px"
1174
- * error={!!form.errors.content}
1175
- * />
1176
- * ```
1177
- *
1178
- * @example
1179
- * ```tsx
1180
- * // Markdown mode
1181
- * <RichTextEditor
1182
- * name="description"
1183
- * value={description}
1184
- * onChange={setDescription}
1185
- * mode="markdown"
1186
- * toolbarButtons={["bold", "italic", "heading", "link"]}
1187
- * />
1188
- * ```
1189
- *
1190
- * @see https://opensite.ai/developers/page-speed/forms/rich-text-editor
1191
- */
1192
- declare function RichTextEditor({ name, value, onChange, onBlur, disabled, required, error, className, mode, allowModeSwitch, placeholder, minHeight, maxHeight, showToolbar, toolbarButtons, ...props }: RichTextEditorProps): React.JSX.Element;
1193
- declare namespace RichTextEditor {
1194
- var displayName: string;
1195
- }
1196
-
1197
- export { Checkbox, CheckboxGroup, type CheckboxGroupOption, type CheckboxGroupProps, type CheckboxProps, type CropArea, DatePicker, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, type EditorMode, FileInput, type FileInputProps, type FileUploadProgress, type FileValidationError, MultiSelect, type MultiSelectOption, type MultiSelectOptionGroup, type MultiSelectProps, Radio, type RadioOption, type RadioProps, RichTextEditor, type RichTextEditorProps, Select, type SelectOption, type SelectOptionGroup, type SelectProps, Switch, type SwitchProps, TextArea, type TextAreaProps, TextInput, TimePicker, type TimePickerProps, type TimeValue, type ToolbarButton };
948
+ export { Checkbox, CheckboxGroup, type CheckboxGroupOption, type CheckboxGroupProps, type CheckboxProps, type CropArea, DatePicker, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, FileInput, type FileInputProps, type FileUploadProgress, type FileValidationError, MultiSelect, type MultiSelectOption, type MultiSelectOptionGroup, type MultiSelectProps, Radio, type RadioOption, type RadioProps, Select, type SelectOption, type SelectOptionGroup, type SelectProps, Switch, type SwitchProps, TextArea, type TextAreaProps, TextInput, TimePicker, type TimePickerProps, type TimeValue };