@capitaltg/vero 1.8.2 → 1.10.0

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,18 +58,27 @@ declare type AlertSize = 'sm' | 'default';
58
58
 
59
59
  declare type AlertVariant = 'success' | 'warning' | 'danger' | 'info';
60
60
 
61
- export declare const Autocomplete: default_2.ForwardRefExoticComponent<AutocompleteProps & default_2.RefAttributes<HTMLButtonElement>>;
61
+ export declare const Autocomplete: <T, K extends keyof T, L extends keyof T>(props: AutocompleteProps<T, K, L> & {
62
+ ref?: default_2.ForwardedRef<HTMLButtonElement>;
63
+ }) => default_2.ReactElement;
62
64
 
63
- export declare interface AutocompleteOption {
64
- value: string;
65
- label: string;
66
- }
65
+ declare type AutocompleteFormAttributes = Pick<React.SelectHTMLAttributes<HTMLSelectElement>, 'name' | 'required' | 'autoFocus'>;
67
66
 
68
- export declare interface AutocompleteProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'disabled'> {
69
- loadOptions?: (inputValue: string) => Promise<AutocompleteOption[]>;
70
- options?: AutocompleteOption[];
71
- value: string;
72
- onChange: (value: string) => void;
67
+ export declare interface AutocompleteProps<T, K extends keyof T, L extends keyof T> extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'disabled' | 'value'>, AutocompleteFormAttributes {
68
+ loadOptions?: (inputValue: string) => Promise<T[]>;
69
+ options?: T[];
70
+ value: T[K] | '';
71
+ /**
72
+ * The key to use for the value property in option objects.
73
+ * Must be a key of T.
74
+ */
75
+ valueKey: K;
76
+ /**
77
+ * The key to use for the label property in option objects.
78
+ * Must be a key of T.
79
+ */
80
+ labelKey: L;
81
+ onChange: (value: T[K]) => void;
73
82
  placeholder?: string;
74
83
  emptyMessage?: string;
75
84
  className?: string;
@@ -81,6 +90,26 @@ export declare interface AutocompleteProps extends Omit<ButtonHTMLAttributes<HTM
81
90
  errorMessage?: string;
82
91
  zIndex?: number;
83
92
  isDisabled?: boolean;
93
+ /**
94
+ * Custom render function for each option.
95
+ * Receives the option of type T and returns a React node.
96
+ * If not provided, defaults to rendering a Check icon and the option label.
97
+ */
98
+ renderOption?: (option: T, isSelected: boolean) => React.ReactNode;
99
+ /**
100
+ * The name attribute for form submission.
101
+ * This is required for the autocomplete value to be included in form data.
102
+ */
103
+ name?: string;
104
+ /**
105
+ * Whether the autocomplete is required for form validation.
106
+ * When true, the form cannot be submitted without a selection.
107
+ */
108
+ required?: boolean;
109
+ /**
110
+ * Automatically focuses the autocomplete when the page loads.
111
+ */
112
+ autoFocus?: boolean;
84
113
  }
85
114
 
86
115
  export declare const Badge: React_2.ForwardRefExoticComponent<BadgeProps & React_2.RefAttributes<HTMLDivElement>>;
@@ -154,12 +183,14 @@ export declare function cn(...inputs: ClassValue[]): string;
154
183
 
155
184
  export declare const Combobox: default_2.ForwardRefExoticComponent<ComboboxProps & default_2.RefAttributes<HTMLButtonElement>>;
156
185
 
186
+ declare type ComboboxFormAttributes = Pick<React.SelectHTMLAttributes<HTMLSelectElement>, 'name' | 'required' | 'autoFocus'>;
187
+
157
188
  export declare interface ComboboxOption {
158
189
  value: string;
159
190
  label: string;
160
191
  }
161
192
 
162
- export declare interface ComboboxProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'disabled'> {
193
+ export declare interface ComboboxProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'disabled'>, ComboboxFormAttributes {
163
194
  options: ComboboxOption[];
164
195
  value: string;
165
196
  onChange: (value: string) => void;
@@ -170,6 +201,20 @@ export declare interface ComboboxProps extends Omit<ButtonHTMLAttributes<HTMLBut
170
201
  listClassName?: string;
171
202
  zIndex?: number;
172
203
  isDisabled?: boolean;
204
+ /**
205
+ * The name attribute for form submission.
206
+ * This is required for the combobox value to be included in form data.
207
+ */
208
+ name?: string;
209
+ /**
210
+ * Whether the combobox is required for form validation.
211
+ * When true, the form cannot be submitted without a selection.
212
+ */
213
+ required?: boolean;
214
+ /**
215
+ * Automatically focuses the combobox when the page loads.
216
+ */
217
+ autoFocus?: boolean;
173
218
  }
174
219
 
175
220
  /**
@@ -193,7 +238,9 @@ export declare function configureZIndex(config: Partial<ZIndexConfig>): void;
193
238
 
194
239
  export declare const DatePicker: default_2.ForwardRefExoticComponent<DatePickerProps & default_2.RefAttributes<HTMLButtonElement>>;
195
240
 
196
- export declare interface DatePickerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'disabled' | 'value'> {
241
+ declare type DatePickerFormAttributes = Pick<React.SelectHTMLAttributes<HTMLSelectElement>, 'name' | 'required' | 'autoFocus'>;
242
+
243
+ export declare interface DatePickerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'disabled' | 'value'>, DatePickerFormAttributes {
197
244
  value?: Date;
198
245
  startMonth?: Date;
199
246
  endMonth?: Date;
@@ -202,6 +249,20 @@ export declare interface DatePickerProps extends Omit<ButtonHTMLAttributes<HTMLB
202
249
  className?: string;
203
250
  zIndex?: number;
204
251
  isDisabled?: boolean;
252
+ /**
253
+ * The name attribute for form submission.
254
+ * This is required for the date picker value to be included in form data.
255
+ */
256
+ name?: string;
257
+ /**
258
+ * Whether the date picker is required for form validation.
259
+ * When true, the form cannot be submitted without a date selection.
260
+ */
261
+ required?: boolean;
262
+ /**
263
+ * Automatically focuses the date picker when the page loads.
264
+ */
265
+ autoFocus?: boolean;
205
266
  }
206
267
 
207
268
  export declare interface DateRange {
@@ -211,7 +272,9 @@ export declare interface DateRange {
211
272
 
212
273
  export declare const DateRangePicker: React_2.ForwardRefExoticComponent<DateRangePickerProps & React_2.RefAttributes<HTMLButtonElement>>;
213
274
 
214
- export declare interface DateRangePickerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'disabled' | 'value'> {
275
+ declare type DateRangePickerFormAttributes = Pick<React.SelectHTMLAttributes<HTMLSelectElement>, 'name' | 'required' | 'autoFocus'>;
276
+
277
+ export declare interface DateRangePickerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'disabled' | 'value'>, DateRangePickerFormAttributes {
215
278
  value: DateRange;
216
279
  onChange: (range: DateRange) => void;
217
280
  placeholder?: {
@@ -221,6 +284,20 @@ export declare interface DateRangePickerProps extends Omit<ButtonHTMLAttributes<
221
284
  className?: string;
222
285
  zIndex?: number;
223
286
  isDisabled?: boolean;
287
+ /**
288
+ * The name attribute for form submission.
289
+ * This is required for the date range picker value to be included in form data.
290
+ */
291
+ name?: string;
292
+ /**
293
+ * Whether the date range picker is required for form validation.
294
+ * When true, the form cannot be submitted without a date range selection.
295
+ */
296
+ required?: boolean;
297
+ /**
298
+ * Automatically focuses the date range picker when the page loads.
299
+ */
300
+ autoFocus?: boolean;
224
301
  }
225
302
 
226
303
  export declare const Dialog: FC<DialogPrimitive.DialogProps>;
@@ -369,12 +446,14 @@ declare type MultipleProps = {
369
446
 
370
447
  export declare const MultiSelect: default_2.ForwardRefExoticComponent<MultiSelectProps & default_2.RefAttributes<HTMLDivElement>>;
371
448
 
449
+ declare type MultiSelectFormAttributes = Pick<React.SelectHTMLAttributes<HTMLSelectElement>, 'name' | 'required' | 'autoFocus'>;
450
+
372
451
  export declare interface MultiSelectOption {
373
452
  value: string;
374
453
  label: string;
375
454
  }
376
455
 
377
- export declare interface MultiSelectProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
456
+ export declare interface MultiSelectProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>, MultiSelectFormAttributes {
378
457
  options: MultiSelectOption[];
379
458
  value: string[];
380
459
  onChange: (value: string[]) => void;
@@ -385,6 +464,20 @@ export declare interface MultiSelectProps extends Omit<HTMLAttributes<HTMLDivEle
385
464
  listClassName?: string;
386
465
  zIndex?: number;
387
466
  isDisabled?: boolean;
467
+ /**
468
+ * The name attribute for form submission.
469
+ * This is required for the multi-select value to be included in form data.
470
+ */
471
+ name?: string;
472
+ /**
473
+ * Whether the multi-select is required for form validation.
474
+ * When true, the form cannot be submitted without at least one selection.
475
+ */
476
+ required?: boolean;
477
+ /**
478
+ * Automatically focuses the multi-select when the page loads.
479
+ */
480
+ autoFocus?: boolean;
388
481
  }
389
482
 
390
483
  declare type OmittedPrimitiveProps = Omit<ComponentPropsWithoutRef<typeof AccordionPrimitive.Root>, 'type' | 'value' | 'defaultValue' | 'collapsible' | 'onValueChange'>;
@@ -447,6 +540,8 @@ export declare interface SelectContentProps extends ComponentPropsWithoutRef<typ
447
540
  zIndex?: number;
448
541
  }
449
542
 
543
+ declare type SelectFormAttributes = Pick<React.SelectHTMLAttributes<HTMLSelectElement>, 'name' | 'required' | 'autoFocus'>;
544
+
450
545
  export declare const SelectGroup: React_2.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React_2.RefAttributes<HTMLDivElement>>;
451
546
 
452
547
  export declare const SelectItem: React_2.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
@@ -462,7 +557,7 @@ export declare interface SelectOption {
462
557
  label: string;
463
558
  }
464
559
 
465
- export declare interface SelectProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'disabled'> {
560
+ export declare interface SelectProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'disabled'>, SelectFormAttributes {
466
561
  options: SelectOption[];
467
562
  value: string;
468
563
  onChange: (value: string) => void;
@@ -470,6 +565,20 @@ export declare interface SelectProps extends Omit<ButtonHTMLAttributes<HTMLButto
470
565
  className?: string;
471
566
  zIndex?: number;
472
567
  isDisabled?: boolean;
568
+ /**
569
+ * The name attribute for form submission.
570
+ * This is required for the select value to be included in form data.
571
+ */
572
+ name?: string;
573
+ /**
574
+ * Whether the select is required for form validation.
575
+ * When true, the form cannot be submitted without a selection.
576
+ */
577
+ required?: boolean;
578
+ /**
579
+ * Automatically focuses the select when the page loads.
580
+ */
581
+ autoFocus?: boolean;
473
582
  }
474
583
 
475
584
  export declare const SelectRoot: React_2.FC<SelectPrimitive.SelectProps>;
@@ -606,10 +715,6 @@ export declare interface TabsProps extends ComponentPropsWithoutRef<typeof TabsP
606
715
  * The default value of the active tab when the component is uncontrolled.
607
716
  */
608
717
  defaultValue?: string;
609
- /**
610
- * How tabs are activated. When set to "automatic", tabs are activated when receiving focus. When set to "manual", tabs are activated when clicked.
611
- */
612
- activationMode?: 'automatic' | 'manual';
613
718
  }
614
719
 
615
720
  export declare const TabsTrigger: React_2.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capitaltg/vero",
3
- "version": "1.8.2",
3
+ "version": "1.10.0",
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",