@grasp-labs/ds-react-components 0.22.1 → 0.23.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.
@@ -2,8 +2,12 @@ import { ComponentProps } from 'react';
2
2
  import { DayPicker, Locale } from 'react-day-picker';
3
3
  type DayPickerClassNamesConfig = Pick<ComponentProps<typeof DayPicker>, "classNames" | "modifiersClassNames">;
4
4
  export type DatePickerProps = {
5
- /** Label text displayed nex to the trigger button */
6
- labelText: string;
5
+ /** Optional id (auto-generated if not provided) */
6
+ id?: string;
7
+ /** Name of the input */
8
+ name?: string;
9
+ /** Whether the textbox is disabled */
10
+ disabled?: boolean;
7
11
  /** Date displayed in trigger button, when date is selected */
8
12
  selectedDate: Date | null;
9
13
  /** Locale used to display texts of date-picker in correct language and present date with correct format */
@@ -18,6 +22,8 @@ export type DatePickerProps = {
18
22
  className?: string;
19
23
  /** Config for class names used to override default styles of calendar */
20
24
  dayPickerClassNames?: DayPickerClassNamesConfig;
25
+ /** Determines if input is invalid */
26
+ "aria-invalid"?: boolean;
21
27
  /** Callback function called when the date is changed */
22
28
  onSelectedDateChange: (selectedDate: Date | null) => void;
23
29
  };
@@ -27,5 +33,5 @@ export type DatePickerProps = {
27
33
  * @param props - The props for the DatePicker component
28
34
  * @returns The rendered date-picker
29
35
  */
30
- export declare const DatePicker: ({ labelText, selectedDate, locale, minDate, maxDate, defaultMonth, className, dayPickerClassNames, onSelectedDateChange, }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
36
+ export declare const DatePicker: ({ id, name, disabled, selectedDate, locale, minDate, maxDate, defaultMonth, className, dayPickerClassNames, onSelectedDateChange, ...props }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
31
37
  export {};
@@ -10,6 +10,7 @@ export type ListItemProps = HTMLProps<HTMLLIElement> & {
10
10
  itemsClassName?: string;
11
11
  };
12
12
  export declare const EMPTY_OPTION_ID = "EMPTY";
13
+ export declare const LOADING_OPTION_ID = "LOADING";
13
14
  /**
14
15
  * A list item component that renders individual options within a List.
15
16
  * Supports checkbox display for multi-select mode and various visual states.
@@ -1,6 +1,7 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { BaseOption } from '../../types/BaseOption';
3
- export type SelectProps<Option extends BaseOption> = {
3
+ import { NoneOf } from '../../types/NoneOf';
4
+ export type BaseSelectProps<Option> = {
4
5
  value: Option | null;
5
6
  setValue: (value: Option | null) => void;
6
7
  prefixContent?: ReactElement;
@@ -13,12 +14,21 @@ export type SelectProps<Option extends BaseOption> = {
13
14
  toggleAriaLabel?: string;
14
15
  noOptionsText?: string;
15
16
  ref?: React.Ref<HTMLInputElement>;
16
- disableSearch?: boolean;
17
17
  className?: string;
18
18
  containerClassName?: string;
19
19
  listClassName?: string;
20
20
  maxHeight?: number;
21
21
  };
22
+ export type ClientSelectProps = {
23
+ disableSearch?: boolean;
24
+ };
25
+ export type ServerSelectProps = {
26
+ onSearch: (search: string) => void;
27
+ debounce?: number;
28
+ isLoading?: boolean;
29
+ loadingText: string;
30
+ };
31
+ export type SelectProps<Option extends BaseOption> = (BaseSelectProps<Option> & ClientSelectProps & NoneOf<ServerSelectProps>) | (BaseSelectProps<Option> & ServerSelectProps & NoneOf<ClientSelectProps>);
22
32
  /**
23
33
  * A dropdown select component with search functionality and keyboard navigation.
24
34
  * Built with Downshift for accessibility and supports custom option filtering.
@@ -27,4 +37,4 @@ export type SelectProps<Option extends BaseOption> = {
27
37
  * @param props - The props for the Select component.
28
38
  * @returns The rendered select dropdown component.
29
39
  */
30
- export declare const Select: <Option extends BaseOption>({ value, setValue, options, id, prefixContent, suffixContent, error, disabled, placeholder, toggleAriaLabel, noOptionsText, ref, disableSearch, className, containerClassName, listClassName, maxHeight, }: SelectProps<Option>) => import("react/jsx-runtime").JSX.Element;
40
+ export declare const Select: <Option extends BaseOption>({ value, setValue, options, id, prefixContent, suffixContent, error, disabled, placeholder, toggleAriaLabel, noOptionsText, ref, disableSearch, className, containerClassName, listClassName, maxHeight, onSearch, debounce, isLoading, loadingText, }: SelectProps<Option>) => import("react/jsx-runtime").JSX.Element;