@capitaltg/vero 1.12.0 → 1.13.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.
@@ -58,13 +58,13 @@ declare type AlertSize = 'sm' | 'default';
58
58
 
59
59
  declare type AlertVariant = 'success' | 'warning' | 'danger' | 'info';
60
60
 
61
- export declare const Autocomplete: <T, K extends keyof T, L extends keyof T>(props: AutocompleteProps<T, K, L> & {
61
+ export declare const Autocomplete: <T>(props: AutocompleteProps<T> & {
62
62
  ref?: default_2.ForwardedRef<HTMLButtonElement>;
63
63
  }) => default_2.ReactElement;
64
64
 
65
65
  declare type AutocompleteFormAttributes = Pick<React.SelectHTMLAttributes<HTMLSelectElement>, 'name' | 'required' | 'autoFocus'>;
66
66
 
67
- export declare interface AutocompleteProps<T, K extends keyof T, L extends keyof T> extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'disabled' | 'value'>, AutocompleteFormAttributes {
67
+ export declare interface AutocompleteProps<T> extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'disabled' | 'value'>, AutocompleteFormAttributes {
68
68
  /**
69
69
  * Async function to fetch options based on user input.
70
70
  * Receives the current input value and returns a promise that resolves to an array of options.
@@ -77,26 +77,42 @@ export declare interface AutocompleteProps<T, K extends keyof T, L extends keyof
77
77
  */
78
78
  options?: T[];
79
79
  /**
80
- * The currently selected value. Must match the value of one of the options using the valueKey.
80
+ * The currently selected value as a string.
81
81
  * Use an empty string ('') to represent no selection.
82
82
  */
83
- value: T[K] | '';
83
+ value: string;
84
84
  /**
85
- * The key to use for the value property in option objects.
86
- * Must be a key of T.
85
+ * Derives the unique string value for an option, used for selection matching and onChange.
86
+ * Required unless all options are uniquely identifiable by another means.
87
87
  */
88
- valueKey: K;
88
+ getOptionValue?: (option: T) => string;
89
89
  /**
90
- * The key to use for the label property in option objects.
91
- * Must be a key of T.
90
+ * Derives the display label for an option.
91
+ * Used as the default label in the dropdown and trigger, and as the field searched when
92
+ * filtering static options. If not provided, filtering falls back to the option value string.
92
93
  */
93
- labelKey: L;
94
+ getOptionLabel?: (option: T) => string;
94
95
  /**
95
96
  * Callback function invoked when the selected value changes.
96
- * @param value - The selected value from the option object.
97
+ * @param value - The selected option's value as a string, or empty string when clearing.
97
98
  * @param item - The full option object, or undefined when clearing the selection.
98
99
  */
99
- onChange: (value: T[K], item?: T) => void;
100
+ onChange: (value: string, item?: T) => void;
101
+ /**
102
+ * Custom render function for the selected value shown in the trigger button.
103
+ * Receives the full selected option object. Falls back to getOptionLabel, then the raw value string.
104
+ * @param option - The currently selected option object.
105
+ * @returns A React node to render inside the trigger.
106
+ */
107
+ renderValue?: (option: T) => React.ReactNode;
108
+ /**
109
+ * Custom render function for each option in the dropdown.
110
+ * Receives the option object and whether it's currently selected.
111
+ * If not provided, defaults to rendering a Check icon and the getOptionLabel value.
112
+ * @param isSelected - Whether this option is currently selected.
113
+ * @returns A React node to render for this option.
114
+ */
115
+ renderOption?: (option: T, isSelected: boolean) => React.ReactNode;
100
116
  /**
101
117
  * Placeholder text displayed when no option is selected.
102
118
  * @default 'Select an option...'
@@ -122,7 +138,6 @@ export declare interface AutocompleteProps<T, K extends keyof T, L extends keyof
122
138
  maxSuggestions?: number;
123
139
  /**
124
140
  * Debounce delay for async searches in milliseconds.
125
- * Prevents excessive API calls by waiting for the user to stop typing.
126
141
  * @default 300
127
142
  */
128
143
  debounceMs?: number;
@@ -152,27 +167,15 @@ export declare interface AutocompleteProps<T, K extends keyof T, L extends keyof
152
167
  zIndex?: number;
153
168
  /**
154
169
  * Whether the component is disabled.
155
- * When true, the autocomplete cannot be interacted with.
156
170
  * @default false
157
171
  */
158
172
  isDisabled?: boolean;
159
- /**
160
- * Custom render function for each option in the dropdown.
161
- * Receives the option object and whether it's currently selected.
162
- * If not provided, defaults to rendering a Check icon and the option label.
163
- * @param option - The option object of type T.
164
- * @param isSelected - Whether this option is currently selected.
165
- * @returns A React node to render for this option.
166
- */
167
- renderOption?: (option: T, isSelected: boolean) => React.ReactNode;
168
173
  /**
169
174
  * The name attribute for form submission.
170
- * This is required for the autocomplete value to be included in form data.
171
175
  */
172
176
  name?: string;
173
177
  /**
174
178
  * Whether the autocomplete is required for form validation.
175
- * When true, the form cannot be submitted without a selection.
176
179
  */
177
180
  required?: boolean;
178
181
  /**
@@ -229,6 +232,7 @@ export declare interface CheckboxGroupProps extends Omit<HTMLAttributes<HTMLDivE
229
232
  value: string[];
230
233
  onChange: (value: string[]) => void;
231
234
  className?: string;
235
+ isDisabled?: boolean;
232
236
  /** Number of columns for default and tile variants (vertical orientation). Defaults to 1. */
233
237
  columns?: 1 | 2 | 3 | 4;
234
238
  orientation?: 'horizontal' | 'vertical';
@@ -240,6 +244,7 @@ export declare interface CheckboxOption {
240
244
  id: string;
241
245
  label: string;
242
246
  description?: string;
247
+ isDisabled?: boolean;
243
248
  /** Optional explicit id for the checkbox input. Defaults to `${groupId}-${id}` when CheckboxGroup has an id. */
244
249
  inputId?: string;
245
250
  }
@@ -374,6 +379,8 @@ export declare interface DateRangePickerProps extends Omit<ButtonHTMLAttributes<
374
379
  className?: string;
375
380
  zIndex?: number;
376
381
  isDisabled?: boolean;
382
+ startMonth?: Date;
383
+ endMonth?: Date;
377
384
  /**
378
385
  * The name attribute for form submission.
379
386
  * This is required for the date range picker value to be included in form data.
@@ -444,6 +451,7 @@ export declare interface DropdownButtonProps extends Omit<ComponentPropsWithoutR
444
451
  className?: string;
445
452
  isDisabled?: boolean;
446
453
  align?: 'start' | 'center' | 'end';
454
+ zIndex?: number;
447
455
  }
448
456
 
449
457
  export declare interface DropdownItem {
@@ -602,7 +610,8 @@ export declare const Radio: React_2.ForwardRefExoticComponent<RadioProps & React
602
610
 
603
611
  export declare const RadioGroup: React_2.ForwardRefExoticComponent<RadioGroupProps & React_2.RefAttributes<HTMLDivElement>>;
604
612
 
605
- declare type RadioGroupBaseProps = Omit<ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>, 'onValueChange' | 'onChange'> & {
613
+ declare type RadioGroupBaseProps = Omit<ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>, 'onValueChange' | 'onChange' | 'disabled'> & {
614
+ isDisabled?: boolean;
606
615
  value?: string;
607
616
  onChange?: (value: string) => void;
608
617
  className?: string;
@@ -630,6 +639,7 @@ export declare interface RadioOption {
630
639
  value: string;
631
640
  label: string;
632
641
  description?: string;
642
+ isDisabled?: boolean;
633
643
  /** Optional explicit id for the radio input. Defaults to `${groupId}-${value}` when RadioGroup has an id. */
634
644
  id?: string;
635
645
  }
@@ -647,9 +657,7 @@ export declare interface RadioProps extends Omit<ComponentPropsWithoutRef<typeof
647
657
  */
648
658
  export declare function resetZIndexConfig(): void;
649
659
 
650
- declare const Select: React_2.ForwardRefExoticComponent<SelectProps & React_2.RefAttributes<HTMLButtonElement>>;
651
- export { Select }
652
- export { Select as SingleSelect }
660
+ export declare const Select: React_2.ForwardRefExoticComponent<SelectProps & React_2.RefAttributes<HTMLButtonElement>>;
653
661
 
654
662
  export declare const SelectContent: React_2.ForwardRefExoticComponent<SelectContentProps & React_2.RefAttributes<HTMLDivElement>>;
655
663
 
@@ -734,6 +742,10 @@ declare type SingleOrAccordionProps = {
734
742
  onValueChange?: (value: string) => void;
735
743
  };
736
744
 
745
+ /** @deprecated Use `Select` instead. */
746
+ export declare const SingleSelect: React_2.ForwardRefExoticComponent<SelectProps & React_2.RefAttributes<HTMLButtonElement>>;
747
+
748
+ /** @deprecated Use `SelectProps` instead. */
737
749
  export declare type SingleSelectProps = SelectProps;
738
750
 
739
751
  export declare interface Step {
@@ -801,7 +813,9 @@ export declare interface SwitchGroupProps extends Omit<HTMLAttributes<HTMLDivEle
801
813
  options: SwitchOption[];
802
814
  value: string[];
803
815
  className?: string;
816
+ isDisabled?: boolean;
804
817
  columns?: 1 | 2 | 3 | 4;
818
+ orientation?: 'horizontal' | 'vertical';
805
819
  onChange: (value: string[]) => void;
806
820
  }
807
821
 
@@ -838,9 +852,11 @@ export declare interface TabsProps extends ComponentPropsWithoutRef<typeof TabsP
838
852
  defaultValue?: string;
839
853
  }
840
854
 
841
- export declare const TabsTrigger: React_2.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
855
+ export declare const TabsTrigger: React_2.ForwardRefExoticComponent<TabsTriggerProps & React_2.RefAttributes<HTMLButtonElement>>;
842
856
 
843
- export declare type TabsTriggerProps = ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>;
857
+ export declare interface TabsTriggerProps extends Omit<ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>, 'disabled'> {
858
+ isDisabled?: boolean;
859
+ }
844
860
 
845
861
  export declare const Textarea: default_2.ForwardRefExoticComponent<TextareaProps & default_2.RefAttributes<HTMLTextAreaElement>>;
846
862
 
@@ -851,7 +867,7 @@ export declare interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLT
851
867
 
852
868
  declare type TextTransform = 'uppercase' | 'lowercase' | 'trim' | 'none';
853
869
 
854
- export declare const Tooltip: React_2.ForwardRefExoticComponent<TooltipProps & React_2.RefAttributes<never>>;
870
+ export declare const Tooltip: React_2.ForwardRefExoticComponent<TooltipProps & React_2.RefAttributes<HTMLDivElement>>;
855
871
 
856
872
  export declare interface TooltipProps extends Omit<ComponentPropsWithoutRef<typeof TooltipPrimitive.Root>, 'children'> {
857
873
  children: ReactNode;
@@ -899,7 +915,6 @@ declare type UseAriaDisabledActive = {
899
915
  onPointerDownCapture: (evt: React.PointerEvent) => void;
900
916
  onKeyDown: (evt: React.KeyboardEvent) => void;
901
917
  onKeyUp: (evt: React.KeyboardEvent) => void;
902
- onKeyPress: (evt: React.KeyboardEvent) => void;
903
918
  onInput: (evt: React.FormEvent) => void;
904
919
  onSubmit: (evt: React.FormEvent) => void;
905
920
  onReset: (evt: React.FormEvent) => void;
@@ -971,4 +986,14 @@ export declare type UseFormGroupLayoutOptions = {
971
986
  columns?: 1 | 2 | 3 | 4;
972
987
  };
973
988
 
989
+ /**
990
+ * Validates that a form control has either a label or aria-label, but not both.
991
+ *
992
+ * @param componentName - The name of the component (e.g., 'Radio', 'Checkbox') for error messages
993
+ * @param label - The label prop value
994
+ * @param ariaLabel - The aria-label prop value
995
+ * @throws Error if validation fails
996
+ */
997
+ export declare function validateFormControlProps(componentName: string, label?: React_2.ReactNode, ariaLabel?: string): void;
998
+
974
999
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capitaltg/vero",
3
- "version": "1.12.0",
3
+ "version": "1.13.1",
4
4
  "description": "Accessible, modern, open source React component library inspired by USWDS built with Radix UI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",