@page-speed/forms 0.4.7 → 0.4.9
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/core.cjs +15 -2
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +15 -2
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +86 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -2
- package/dist/index.d.ts +38 -2
- package/dist/index.js +82 -3
- package/dist/index.js.map +1 -1
- package/dist/inputs.cjs +946 -697
- package/dist/inputs.cjs.map +1 -1
- package/dist/inputs.d.cts +93 -182
- package/dist/inputs.d.ts +93 -182
- package/dist/inputs.js +943 -695
- package/dist/inputs.js.map +1 -1
- package/dist/{types-4ppM117e.d.cts → types-DuX3q6A4.d.cts} +1 -1
- package/dist/{types-4ppM117e.d.ts → types-DuX3q6A4.d.ts} +1 -1
- package/dist/validation-rules.d.cts +1 -1
- package/dist/validation-rules.d.ts +1 -1
- package/dist/validation-utils.d.cts +1 -1
- package/dist/validation-utils.d.ts +1 -1
- package/dist/validation-valibot.d.cts +1 -1
- package/dist/validation-valibot.d.ts +1 -1
- package/dist/validation.d.cts +1 -1
- package/dist/validation.d.ts +1 -1
- package/package.json +12 -2
package/dist/inputs.d.ts
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { I as InputProps } from './types-
|
|
2
|
+
import { I as InputProps } from './types-DuX3q6A4.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* TextInput - High-performance text input component
|
|
5
|
+
* TextInput - High-performance text input component (ShadCN-based)
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Built on ShadCN Input component with form-specific behavior:
|
|
8
|
+
* - Error state handling
|
|
9
|
+
* - Valid value indicator (ring-2)
|
|
10
|
+
* - Form integration (onChange, onBlur)
|
|
11
11
|
* - Full accessibility support
|
|
12
|
-
* - Error state styling
|
|
13
|
-
* - Controlled input behavior
|
|
14
|
-
* - All native input attributes supported
|
|
15
12
|
*
|
|
16
13
|
* @example
|
|
17
14
|
* ```tsx
|
|
@@ -74,19 +71,13 @@ interface TextAreaProps extends Omit<InputProps<string>, "onChange"> {
|
|
|
74
71
|
[key: string]: any;
|
|
75
72
|
}
|
|
76
73
|
/**
|
|
77
|
-
* TextArea - High-performance multi-line text input component
|
|
74
|
+
* TextArea - High-performance multi-line text input component (ShadCN-based)
|
|
78
75
|
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
76
|
+
* Built on ShadCN Textarea component with form-specific behavior:
|
|
77
|
+
* - Error state handling
|
|
78
|
+
* - Valid value indicator (ring-2)
|
|
79
|
+
* - Form integration (onChange, onBlur)
|
|
83
80
|
* - Full accessibility support
|
|
84
|
-
* - Error state styling
|
|
85
|
-
* - Controlled input behavior
|
|
86
|
-
* - Configurable rows and columns
|
|
87
|
-
* - Text wrapping options
|
|
88
|
-
* - Character length validation
|
|
89
|
-
* - All native textarea attributes supported
|
|
90
81
|
*
|
|
91
82
|
* @example
|
|
92
83
|
* ```tsx
|
|
@@ -117,12 +108,6 @@ interface CheckboxProps extends Omit<InputProps<boolean>, "onChange" | "placehol
|
|
|
117
108
|
* Change handler - receives boolean checked state
|
|
118
109
|
*/
|
|
119
110
|
onChange: (checked: boolean) => void;
|
|
120
|
-
/**
|
|
121
|
-
* Indeterminate state for partial selections
|
|
122
|
-
* Useful for "select all" checkboxes with some items selected
|
|
123
|
-
* @default false
|
|
124
|
-
*/
|
|
125
|
-
indeterminate?: boolean;
|
|
126
111
|
/**
|
|
127
112
|
* Label text for the checkbox (primary text)
|
|
128
113
|
*/
|
|
@@ -132,8 +117,7 @@ interface CheckboxProps extends Omit<InputProps<boolean>, "onChange" | "placehol
|
|
|
132
117
|
*/
|
|
133
118
|
description?: React.ReactNode;
|
|
134
119
|
/**
|
|
135
|
-
* Layout variant
|
|
136
|
-
* Utilized if any checkboxes have a description
|
|
120
|
+
* Layout variant - automatically enabled if description exists
|
|
137
121
|
* @default false
|
|
138
122
|
*/
|
|
139
123
|
useChoiceCard?: boolean;
|
|
@@ -143,19 +127,14 @@ interface CheckboxProps extends Omit<InputProps<boolean>, "onChange" | "placehol
|
|
|
143
127
|
[key: string]: any;
|
|
144
128
|
}
|
|
145
129
|
/**
|
|
146
|
-
* Checkbox - High-performance boolean input component
|
|
130
|
+
* Checkbox - High-performance boolean input component (ShadCN-based)
|
|
147
131
|
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* -
|
|
153
|
-
* -
|
|
154
|
-
* - Controlled input behavior
|
|
155
|
-
* - Indeterminate state support
|
|
156
|
-
* - Optional label and description text (with nil guards)
|
|
157
|
-
* - Proper field-based layout structure
|
|
158
|
-
* - All native checkbox attributes supported
|
|
132
|
+
* Built on ShadCN Checkbox with form-specific behavior:
|
|
133
|
+
* - Error state handling
|
|
134
|
+
* - Choice Card variant (automatic when description exists)
|
|
135
|
+
* - Label and description support
|
|
136
|
+
* - Form integration (onChange, onBlur)
|
|
137
|
+
* - Full accessibility support
|
|
159
138
|
*
|
|
160
139
|
* @example
|
|
161
140
|
* ```tsx
|
|
@@ -166,25 +145,12 @@ interface CheckboxProps extends Omit<InputProps<boolean>, "onChange" | "placehol
|
|
|
166
145
|
* label="I agree to the terms and conditions"
|
|
167
146
|
* description="By clicking this checkbox, you agree to the terms."
|
|
168
147
|
* error={!!form.errors.terms}
|
|
169
|
-
* aria-describedby={form.errors.terms ? 'terms-error' : undefined}
|
|
170
|
-
* />
|
|
171
|
-
* ```
|
|
172
|
-
*
|
|
173
|
-
* @example
|
|
174
|
-
* ```tsx
|
|
175
|
-
* // With indeterminate state
|
|
176
|
-
* <Checkbox
|
|
177
|
-
* name="selectAll"
|
|
178
|
-
* value={allSelected}
|
|
179
|
-
* onChange={handleSelectAll}
|
|
180
|
-
* indeterminate={someSelected}
|
|
181
|
-
* label="Select all items"
|
|
182
148
|
* />
|
|
183
149
|
* ```
|
|
184
150
|
*
|
|
185
151
|
* @see https://opensite.ai/developers/page-speed/forms/checkbox
|
|
186
152
|
*/
|
|
187
|
-
declare function Checkbox({ name, value, onChange, onBlur, disabled, required, error, className,
|
|
153
|
+
declare function Checkbox({ name, value, onChange, onBlur, disabled, required, error, className, label, description, useChoiceCard, ...props }: CheckboxProps): React.JSX.Element;
|
|
188
154
|
declare namespace Checkbox {
|
|
189
155
|
var displayName: string;
|
|
190
156
|
}
|
|
@@ -383,21 +349,15 @@ interface RadioProps extends Omit<InputProps<string>, "onChange" | "placeholder"
|
|
|
383
349
|
[key: string]: any;
|
|
384
350
|
}
|
|
385
351
|
/**
|
|
386
|
-
* Radio - High-performance single selection component
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
* -
|
|
393
|
-
* -
|
|
394
|
-
* -
|
|
395
|
-
* - Keyboard navigation (arrow keys)
|
|
396
|
-
* - Grid or stacked layout
|
|
397
|
-
* - Optional descriptions for each option (with nil guard)
|
|
398
|
-
* - Individual option disabled state
|
|
399
|
-
* - Card-based styling with proper visual hierarchy
|
|
400
|
-
* - All native radio attributes supported
|
|
352
|
+
* Radio - High-performance single selection component (ShadCN-based)
|
|
353
|
+
*
|
|
354
|
+
* Built on ShadCN RadioGroup with form-specific behavior:
|
|
355
|
+
* - Error state handling
|
|
356
|
+
* - Choice Card variant (automatic when any option has description)
|
|
357
|
+
* - Keyboard navigation (built into RadioGroup)
|
|
358
|
+
* - Grid/stacked layouts
|
|
359
|
+
* - Form integration (onChange, onBlur)
|
|
360
|
+
* - Full accessibility support
|
|
401
361
|
*
|
|
402
362
|
* @example
|
|
403
363
|
* ```tsx
|
|
@@ -412,23 +372,6 @@ interface RadioProps extends Omit<InputProps<string>, "onChange" | "placeholder"
|
|
|
412
372
|
* { value: 'enterprise', label: 'Enterprise', description: '$99/month' }
|
|
413
373
|
* ]}
|
|
414
374
|
* error={!!form.errors.plan}
|
|
415
|
-
* aria-describedby={form.errors.plan ? 'plan-error' : undefined}
|
|
416
|
-
* />
|
|
417
|
-
* ```
|
|
418
|
-
*
|
|
419
|
-
* @example
|
|
420
|
-
* ```tsx
|
|
421
|
-
* // Grid layout
|
|
422
|
-
* <Radio
|
|
423
|
-
* name="size"
|
|
424
|
-
* value={size}
|
|
425
|
-
* onChange={handleSizeChange}
|
|
426
|
-
* layout="grid"
|
|
427
|
-
* options={[
|
|
428
|
-
* { value: 'sm', label: 'Small' },
|
|
429
|
-
* { value: 'md', label: 'Medium' },
|
|
430
|
-
* { value: 'lg', label: 'Large' }
|
|
431
|
-
* ]}
|
|
432
375
|
* />
|
|
433
376
|
* ```
|
|
434
377
|
*
|
|
@@ -440,101 +383,98 @@ declare namespace Radio {
|
|
|
440
383
|
}
|
|
441
384
|
|
|
442
385
|
/**
|
|
443
|
-
*
|
|
386
|
+
* Additional props specific to Switch
|
|
444
387
|
*/
|
|
445
|
-
interface
|
|
388
|
+
interface SwitchProps extends Omit<InputProps<boolean>, "onChange" | "placeholder"> {
|
|
446
389
|
/**
|
|
447
|
-
*
|
|
390
|
+
* Change handler - receives boolean checked state
|
|
448
391
|
*/
|
|
449
|
-
|
|
392
|
+
onChange: (checked: boolean) => void;
|
|
450
393
|
/**
|
|
451
|
-
*
|
|
394
|
+
* Label text for the switch
|
|
452
395
|
*/
|
|
453
|
-
label
|
|
396
|
+
label?: React.ReactNode;
|
|
454
397
|
/**
|
|
455
|
-
*
|
|
398
|
+
* Optional description text below the label
|
|
456
399
|
*/
|
|
400
|
+
description?: React.ReactNode;
|
|
401
|
+
/**
|
|
402
|
+
* Size variant
|
|
403
|
+
* @default "default"
|
|
404
|
+
*/
|
|
405
|
+
size?: "sm" | "default";
|
|
406
|
+
/**
|
|
407
|
+
* Additional native input attributes
|
|
408
|
+
*/
|
|
409
|
+
[key: string]: any;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Switch - High-performance toggle input component (ShadCN-based)
|
|
413
|
+
*
|
|
414
|
+
* Built on ShadCN Switch with form-specific behavior:
|
|
415
|
+
* - Error state handling
|
|
416
|
+
* - Label and description support
|
|
417
|
+
* - Form integration (onChange, onBlur)
|
|
418
|
+
* - Full accessibility support
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* ```tsx
|
|
422
|
+
* const form = useForm({ initialValues: { notifications: false } });
|
|
423
|
+
*
|
|
424
|
+
* <Switch
|
|
425
|
+
* {...form.getFieldProps('notifications')}
|
|
426
|
+
* label="Enable notifications"
|
|
427
|
+
* description="Receive email notifications for important updates"
|
|
428
|
+
* error={!!form.errors.notifications}
|
|
429
|
+
* />
|
|
430
|
+
* ```
|
|
431
|
+
*
|
|
432
|
+
* @see https://opensite.ai/developers/page-speed/forms/switch
|
|
433
|
+
*/
|
|
434
|
+
declare function Switch({ name, value, onChange, onBlur, disabled, required, error, className, label, description, size, ...props }: SwitchProps): React.JSX.Element;
|
|
435
|
+
declare namespace Switch {
|
|
436
|
+
var displayName: string;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Select option type
|
|
441
|
+
*/
|
|
442
|
+
interface SelectOption {
|
|
443
|
+
value: string;
|
|
444
|
+
label: React.ReactNode;
|
|
457
445
|
disabled?: boolean;
|
|
458
446
|
}
|
|
459
447
|
/**
|
|
460
|
-
* Select option group type
|
|
448
|
+
* Select option group type
|
|
461
449
|
*/
|
|
462
450
|
interface SelectOptionGroup {
|
|
463
|
-
/**
|
|
464
|
-
* Group label
|
|
465
|
-
*/
|
|
466
451
|
label: string;
|
|
467
|
-
/**
|
|
468
|
-
* Options in this group
|
|
469
|
-
*/
|
|
470
452
|
options: SelectOption[];
|
|
471
453
|
}
|
|
472
454
|
/**
|
|
473
455
|
* Additional props specific to Select
|
|
474
456
|
*/
|
|
475
457
|
interface SelectProps extends Omit<InputProps<string>, "onChange" | "onFocus"> {
|
|
476
|
-
/**
|
|
477
|
-
* Change handler - receives selected value
|
|
478
|
-
*/
|
|
479
458
|
onChange: (value: string) => void;
|
|
480
|
-
/**
|
|
481
|
-
* Focus handler
|
|
482
|
-
*/
|
|
483
459
|
onFocus?: () => void;
|
|
484
|
-
/**
|
|
485
|
-
* Array of select options (flat structure)
|
|
486
|
-
*/
|
|
487
460
|
options?: SelectOption[];
|
|
488
|
-
/**
|
|
489
|
-
* Array of option groups (grouped structure)
|
|
490
|
-
*/
|
|
491
461
|
optionGroups?: SelectOptionGroup[];
|
|
492
|
-
/**
|
|
493
|
-
* Placeholder text when no option is selected
|
|
494
|
-
* @default "Select..."
|
|
495
|
-
*/
|
|
496
462
|
placeholder?: string;
|
|
497
|
-
/**
|
|
498
|
-
* Enable search/filter functionality
|
|
499
|
-
* @default true
|
|
500
|
-
*/
|
|
501
|
-
searchable?: boolean;
|
|
502
|
-
/**
|
|
503
|
-
* Enable clearable button to reset selection
|
|
504
|
-
* @default true
|
|
505
|
-
*/
|
|
506
|
-
clearable?: boolean;
|
|
507
|
-
/**
|
|
508
|
-
* Loading state for async options
|
|
509
|
-
* @default false
|
|
510
|
-
*/
|
|
511
|
-
loading?: boolean;
|
|
512
|
-
/**
|
|
513
|
-
* Custom render function for options
|
|
514
|
-
*/
|
|
515
463
|
renderOption?: (option: SelectOption) => React.ReactNode;
|
|
516
|
-
/**
|
|
517
|
-
* Additional native input attributes
|
|
518
|
-
*/
|
|
519
464
|
[key: string]: any;
|
|
520
465
|
}
|
|
521
466
|
/**
|
|
522
|
-
* Select - High-performance dropdown selection component
|
|
523
|
-
*
|
|
524
|
-
* A lightweight, accessible select/dropdown with search, keyboard navigation,
|
|
525
|
-
* and error state support. Designed to work seamlessly with useForm and Field components.
|
|
467
|
+
* Select - High-performance dropdown selection component (ShadCN-based)
|
|
526
468
|
*
|
|
527
|
-
*
|
|
528
|
-
* -
|
|
529
|
-
* -
|
|
530
|
-
* -
|
|
531
|
-
* - Keyboard navigation (arrow keys, Enter, Escape, type-ahead)
|
|
532
|
-
* - Searchable options with filtering
|
|
533
|
-
* - Clearable selection
|
|
469
|
+
* Built on ShadCN Select with form-specific behavior:
|
|
470
|
+
* - Error state handling
|
|
471
|
+
* - Valid value indicator (ring-2)
|
|
472
|
+
* - Form integration (onChange, onBlur)
|
|
534
473
|
* - Option groups support
|
|
535
|
-
* -
|
|
536
|
-
*
|
|
537
|
-
*
|
|
474
|
+
* - Full accessibility support
|
|
475
|
+
*
|
|
476
|
+
* NOTE: This is a simplified refactored version. For advanced features like
|
|
477
|
+
* search, clearable, and loading states, use the Command component or MultiSelect.
|
|
538
478
|
*
|
|
539
479
|
* @example
|
|
540
480
|
* ```tsx
|
|
@@ -548,42 +488,13 @@ interface SelectProps extends Omit<InputProps<string>, "onChange" | "onFocus"> {
|
|
|
548
488
|
* { value: 'ca', label: 'Canada' },
|
|
549
489
|
* { value: 'mx', label: 'Mexico' }
|
|
550
490
|
* ]}
|
|
551
|
-
* searchable
|
|
552
|
-
* clearable
|
|
553
491
|
* error={!!form.errors.country}
|
|
554
|
-
* aria-describedby={form.errors.country ? 'country-error' : undefined}
|
|
555
|
-
* />
|
|
556
|
-
* ```
|
|
557
|
-
*
|
|
558
|
-
* @example
|
|
559
|
-
* ```tsx
|
|
560
|
-
* // With option groups
|
|
561
|
-
* <Select
|
|
562
|
-
* name="timezone"
|
|
563
|
-
* value={timezone}
|
|
564
|
-
* onChange={handleTimezoneChange}
|
|
565
|
-
* optionGroups={[
|
|
566
|
-
* {
|
|
567
|
-
* label: 'North America',
|
|
568
|
-
* options: [
|
|
569
|
-
* { value: 'est', label: 'Eastern Time' },
|
|
570
|
-
* { value: 'cst', label: 'Central Time' }
|
|
571
|
-
* ]
|
|
572
|
-
* },
|
|
573
|
-
* {
|
|
574
|
-
* label: 'Europe',
|
|
575
|
-
* options: [
|
|
576
|
-
* { value: 'gmt', label: 'GMT' },
|
|
577
|
-
* { value: 'cet', label: 'Central European Time' }
|
|
578
|
-
* ]
|
|
579
|
-
* }
|
|
580
|
-
* ]}
|
|
581
492
|
* />
|
|
582
493
|
* ```
|
|
583
494
|
*
|
|
584
495
|
* @see https://opensite.ai/developers/page-speed/forms/select
|
|
585
496
|
*/
|
|
586
|
-
declare function Select({ name, value, onChange, onBlur, onFocus, disabled, required, error, className, placeholder,
|
|
497
|
+
declare function Select({ name, value, onChange, onBlur, onFocus, disabled, required, error, className, placeholder, options, optionGroups, renderOption, ...props }: SelectProps): React.JSX.Element;
|
|
587
498
|
declare namespace Select {
|
|
588
499
|
var displayName: string;
|
|
589
500
|
}
|
|
@@ -1283,4 +1194,4 @@ declare namespace RichTextEditor {
|
|
|
1283
1194
|
var displayName: string;
|
|
1284
1195
|
}
|
|
1285
1196
|
|
|
1286
|
-
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, TextArea, type TextAreaProps, TextInput, TimePicker, type TimePickerProps, type TimeValue, type ToolbarButton };
|
|
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 };
|