@page-speed/forms 0.4.4 → 0.4.6

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
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { I as InputProps } from './types-BBif0kuP.cjs';
2
+ import { I as InputProps } from './types-4ppM117e.cjs';
3
3
 
4
4
  /**
5
5
  * TextInput - High-performance text input component
@@ -588,6 +588,147 @@ declare namespace Select {
588
588
  var displayName: string;
589
589
  }
590
590
 
591
+ /**
592
+ * Multi-select option type
593
+ */
594
+ interface MultiSelectOption {
595
+ /**
596
+ * The value for this option
597
+ */
598
+ value: string;
599
+ /**
600
+ * Display label for the option
601
+ */
602
+ label: React.ReactNode;
603
+ /**
604
+ * Whether this option is disabled
605
+ */
606
+ disabled?: boolean;
607
+ }
608
+ /**
609
+ * Multi-select option group type for organizing options
610
+ */
611
+ interface MultiSelectOptionGroup {
612
+ /**
613
+ * Group label
614
+ */
615
+ label: string;
616
+ /**
617
+ * Options in this group
618
+ */
619
+ options: MultiSelectOption[];
620
+ }
621
+ /**
622
+ * Additional props specific to MultiSelect
623
+ */
624
+ interface MultiSelectProps extends Omit<InputProps<string[]>, "onChange" | "onFocus"> {
625
+ /**
626
+ * Change handler - receives array of selected values
627
+ */
628
+ onChange: (value: string[]) => void;
629
+ /**
630
+ * Focus handler
631
+ */
632
+ onFocus?: () => void;
633
+ /**
634
+ * Array of select options (flat structure)
635
+ */
636
+ options?: MultiSelectOption[];
637
+ /**
638
+ * Array of option groups (grouped structure)
639
+ */
640
+ optionGroups?: MultiSelectOptionGroup[];
641
+ /**
642
+ * Placeholder text when no options are selected
643
+ * @default "Select..."
644
+ */
645
+ placeholder?: string;
646
+ /**
647
+ * Enable search/filter functionality
648
+ * @default true
649
+ */
650
+ searchable?: boolean;
651
+ /**
652
+ * Enable clearable button to reset all selections
653
+ * @default true
654
+ */
655
+ clearable?: boolean;
656
+ /**
657
+ * Loading state for async options
658
+ * @default false
659
+ */
660
+ loading?: boolean;
661
+ /**
662
+ * Maximum number of selections allowed
663
+ */
664
+ maxSelections?: number;
665
+ /**
666
+ * Show "Select All" button
667
+ * @default false
668
+ */
669
+ showSelectAll?: boolean;
670
+ /**
671
+ * Custom render function for options
672
+ */
673
+ renderOption?: (option: MultiSelectOption) => React.ReactNode;
674
+ /**
675
+ * Custom render function for selected value chips/tags
676
+ */
677
+ renderValue?: (option: MultiSelectOption) => React.ReactNode;
678
+ /**
679
+ * Additional native input attributes
680
+ */
681
+ [key: string]: any;
682
+ }
683
+ /**
684
+ * MultiSelect - High-performance multi-selection dropdown component
685
+ *
686
+ * A lightweight, accessible multi-select dropdown with search, keyboard navigation,
687
+ * and error state support. Designed to work seamlessly with useForm and Field components.
688
+ *
689
+ * Features:
690
+ * - Multiple value selection
691
+ * - Full accessibility support (ARIA attributes, role="listbox")
692
+ * - Error state styling
693
+ * - Controlled input behavior
694
+ * - Keyboard navigation (arrow keys, Enter, Escape, Space)
695
+ * - Searchable options with filtering
696
+ * - Clearable selections
697
+ * - Option groups support
698
+ * - Loading state for async options
699
+ * - Disabled options support
700
+ * - Maximum selections limit
701
+ * - Select All / Clear All functionality
702
+ * - Selected value chips/tags with individual removal
703
+ * - Click outside to close
704
+ *
705
+ * @example
706
+ * ```tsx
707
+ * const form = useForm({ initialValues: { skills: [] } });
708
+ *
709
+ * <MultiSelect
710
+ * {...form.getFieldProps('skills')}
711
+ * placeholder="Select skills"
712
+ * options={[
713
+ * { value: 'react', label: 'React' },
714
+ * { value: 'typescript', label: 'TypeScript' },
715
+ * { value: 'node', label: 'Node.js' }
716
+ * ]}
717
+ * searchable
718
+ * clearable
719
+ * showSelectAll
720
+ * maxSelections={5}
721
+ * error={!!form.errors.skills}
722
+ * />
723
+ * ```
724
+ *
725
+ * @see https://opensite.ai/developers/page-speed/forms/multi-select
726
+ */
727
+ 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;
728
+ declare namespace MultiSelect {
729
+ var displayName: string;
730
+ }
731
+
591
732
  /**
592
733
  * File validation error details
593
734
  */
@@ -1142,4 +1283,4 @@ declare namespace RichTextEditor {
1142
1283
  var displayName: string;
1143
1284
  }
1144
1285
 
1145
- 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, 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 };
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 };
package/dist/inputs.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { I as InputProps } from './types-BBif0kuP.js';
2
+ import { I as InputProps } from './types-4ppM117e.js';
3
3
 
4
4
  /**
5
5
  * TextInput - High-performance text input component
@@ -588,6 +588,147 @@ declare namespace Select {
588
588
  var displayName: string;
589
589
  }
590
590
 
591
+ /**
592
+ * Multi-select option type
593
+ */
594
+ interface MultiSelectOption {
595
+ /**
596
+ * The value for this option
597
+ */
598
+ value: string;
599
+ /**
600
+ * Display label for the option
601
+ */
602
+ label: React.ReactNode;
603
+ /**
604
+ * Whether this option is disabled
605
+ */
606
+ disabled?: boolean;
607
+ }
608
+ /**
609
+ * Multi-select option group type for organizing options
610
+ */
611
+ interface MultiSelectOptionGroup {
612
+ /**
613
+ * Group label
614
+ */
615
+ label: string;
616
+ /**
617
+ * Options in this group
618
+ */
619
+ options: MultiSelectOption[];
620
+ }
621
+ /**
622
+ * Additional props specific to MultiSelect
623
+ */
624
+ interface MultiSelectProps extends Omit<InputProps<string[]>, "onChange" | "onFocus"> {
625
+ /**
626
+ * Change handler - receives array of selected values
627
+ */
628
+ onChange: (value: string[]) => void;
629
+ /**
630
+ * Focus handler
631
+ */
632
+ onFocus?: () => void;
633
+ /**
634
+ * Array of select options (flat structure)
635
+ */
636
+ options?: MultiSelectOption[];
637
+ /**
638
+ * Array of option groups (grouped structure)
639
+ */
640
+ optionGroups?: MultiSelectOptionGroup[];
641
+ /**
642
+ * Placeholder text when no options are selected
643
+ * @default "Select..."
644
+ */
645
+ placeholder?: string;
646
+ /**
647
+ * Enable search/filter functionality
648
+ * @default true
649
+ */
650
+ searchable?: boolean;
651
+ /**
652
+ * Enable clearable button to reset all selections
653
+ * @default true
654
+ */
655
+ clearable?: boolean;
656
+ /**
657
+ * Loading state for async options
658
+ * @default false
659
+ */
660
+ loading?: boolean;
661
+ /**
662
+ * Maximum number of selections allowed
663
+ */
664
+ maxSelections?: number;
665
+ /**
666
+ * Show "Select All" button
667
+ * @default false
668
+ */
669
+ showSelectAll?: boolean;
670
+ /**
671
+ * Custom render function for options
672
+ */
673
+ renderOption?: (option: MultiSelectOption) => React.ReactNode;
674
+ /**
675
+ * Custom render function for selected value chips/tags
676
+ */
677
+ renderValue?: (option: MultiSelectOption) => React.ReactNode;
678
+ /**
679
+ * Additional native input attributes
680
+ */
681
+ [key: string]: any;
682
+ }
683
+ /**
684
+ * MultiSelect - High-performance multi-selection dropdown component
685
+ *
686
+ * A lightweight, accessible multi-select dropdown with search, keyboard navigation,
687
+ * and error state support. Designed to work seamlessly with useForm and Field components.
688
+ *
689
+ * Features:
690
+ * - Multiple value selection
691
+ * - Full accessibility support (ARIA attributes, role="listbox")
692
+ * - Error state styling
693
+ * - Controlled input behavior
694
+ * - Keyboard navigation (arrow keys, Enter, Escape, Space)
695
+ * - Searchable options with filtering
696
+ * - Clearable selections
697
+ * - Option groups support
698
+ * - Loading state for async options
699
+ * - Disabled options support
700
+ * - Maximum selections limit
701
+ * - Select All / Clear All functionality
702
+ * - Selected value chips/tags with individual removal
703
+ * - Click outside to close
704
+ *
705
+ * @example
706
+ * ```tsx
707
+ * const form = useForm({ initialValues: { skills: [] } });
708
+ *
709
+ * <MultiSelect
710
+ * {...form.getFieldProps('skills')}
711
+ * placeholder="Select skills"
712
+ * options={[
713
+ * { value: 'react', label: 'React' },
714
+ * { value: 'typescript', label: 'TypeScript' },
715
+ * { value: 'node', label: 'Node.js' }
716
+ * ]}
717
+ * searchable
718
+ * clearable
719
+ * showSelectAll
720
+ * maxSelections={5}
721
+ * error={!!form.errors.skills}
722
+ * />
723
+ * ```
724
+ *
725
+ * @see https://opensite.ai/developers/page-speed/forms/multi-select
726
+ */
727
+ 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;
728
+ declare namespace MultiSelect {
729
+ var displayName: string;
730
+ }
731
+
591
732
  /**
592
733
  * File validation error details
593
734
  */
@@ -1142,4 +1283,4 @@ declare namespace RichTextEditor {
1142
1283
  var displayName: string;
1143
1284
  }
1144
1285
 
1145
- 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, 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 };
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 };