gantri-components 2.119.0-beta.7 → 2.119.0-beta.8

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.
@@ -1,10 +1,14 @@
1
1
  import { ResolutionAwareProp } from '../../types/resolution-aware-prop.type';
2
2
  import { CellProps } from '../cell/cell.types';
3
3
  import { CheckboxProps } from '../checkbox/checkbox.types';
4
+ import { DynamicListItem } from '../components.types';
4
5
  import { GridProps } from '../grid/grid.types';
6
+ import { TooltipProps } from '../tooltip/tooltip.types';
5
7
  export interface CheckboxListProps<Value extends string | Record<any, any>> extends Partial<CheckboxListDefaultProps<Value>>, Partial<CheckboxProps> {
6
8
  cellProps?: Partial<CellProps>;
7
- getIsDisabled?: (optionName: Value) => boolean;
9
+ /** Applies to any disabled tooltips within the checkbox list. */
10
+ disabledTooltipProps?: Partial<TooltipProps>;
11
+ getIsDisabled?: (optionName: Value, index: number) => boolean;
8
12
  gridProps?: Partial<Omit<GridProps, 'columns'>> & {
9
13
  columns: ResolutionAwareProp<number>;
10
14
  };
@@ -16,9 +20,7 @@ export interface CheckboxListDefaultProps<Value extends string | Record<any, any
16
20
  idProperty: Value extends string ? string : keyof Value;
17
21
  labelProperty: Value extends string ? string : keyof Value;
18
22
  }
19
- export type CheckboxItem<Value extends string | Record<any, any>> = {
20
- disabled?: boolean;
21
- } & (Value extends string ? Record<any, any> : Value);
23
+ export type CheckboxItem<Value extends string | Record<any, any>> = DynamicListItem<Record<any, any>> & (Value extends string ? DynamicListItem<Record<any, any>> : Value);
22
24
  export type OnCheckboxListValueChange<Value extends string | Record<any, any>> = (selectedValues: string[], lastInteractedItem: CheckboxItem<Value> & {
23
25
  isChecked: boolean;
24
26
  }) => void | Promise<void>;
@@ -0,0 +1,8 @@
1
+ export type DynamicListItem<T extends Record<any, any>> = T & {
2
+ disabled?: boolean;
3
+ disabledTooltipDescription?: string;
4
+ };
5
+ export type DynamicListItemDefaultData = {
6
+ label: string;
7
+ value: number | string;
8
+ };
@@ -3,42 +3,35 @@ import { ReactNode } from 'react';
3
3
  import { Maybe } from '../../global';
4
4
  import { Color } from '../../styles';
5
5
  import { TooltipProps } from '../tooltip/tooltip.types';
6
- export interface DropdownMenuProps<T extends DropdownMenuItem<Record<any, any>>> {
6
+ import { DynamicListItem } from '../components.types';
7
+ export interface DropdownMenuProps<T extends DynamicListItem<Record<any, any>>> {
7
8
  autoSelectFirst?: boolean;
8
9
  borderColor?: Color;
9
10
  className?: string;
10
11
  /** Applies to any disabled tooltips within the dropdown menu. */
11
12
  disabledTooltipProps?: Partial<TooltipProps>;
12
13
  header?: ReactNode;
13
- idProperty?: keyof DropdownMenuItem<T>;
14
+ idProperty?: keyof DynamicListItem<T>;
14
15
  /** Can optionally include `disabled: true` to any index to disable that item. */
15
- items: DropdownMenuItem<T>[];
16
+ items: DynamicListItem<T>[];
16
17
  /** Sets the alignment of the dropdown items. */
17
18
  justifyContent?: Property.JustifyContent;
18
19
  keepOpenAfterSelection?: boolean;
19
- keyProperty?: (item?: DropdownMenuItem<T>) => string;
20
- labelProperty?: keyof T | ((item?: DropdownMenuItem<T>) => string);
21
- labelPropertyTx?: (item?: DropdownMenuItem<T>) => string;
20
+ keyProperty?: (item?: DynamicListItem<T>) => string;
21
+ labelProperty?: keyof T | ((item?: DynamicListItem<T>) => string);
22
+ labelPropertyTx?: (item?: DynamicListItem<T>) => string;
22
23
  maxHeight?: Property.MaxHeight<string | number>;
23
24
  noShadow?: boolean;
24
25
  onKeyDown?: (event: KeyboardEvent) => void;
25
26
  onPreselectedIndexChange?: (index: number) => void;
26
27
  onSelect?: (item: T | null) => void;
27
28
  /** `item` should contain `isHeading: true` */
28
- renderHeading?: (item: DropdownMenuItem<T>, index: number) => Maybe<ReactNode>;
29
- renderItem?: (item: DropdownMenuItem<T>) => Maybe<ReactNode>;
29
+ renderHeading?: (item: DynamicListItem<T>, index: number) => Maybe<ReactNode>;
30
+ renderItem?: (item: DynamicListItem<T>) => Maybe<ReactNode>;
30
31
  searchType?: 'startsWith' | 'contains' | 'endsWith';
31
32
  searchable?: boolean;
32
33
  /** Optionally provide to highlight multiple items as selected. */
33
- selectedItems?: DropdownMenuItem<T>[];
34
+ selectedItems?: DynamicListItem<T>[];
34
35
  value?: string | number;
35
36
  width?: Property.Width<string | number>;
36
37
  }
37
- export type DropdownMenuItem<T extends Record<any, any>> = T & {
38
- disabled?: boolean;
39
- disabledTooltipDescription?: string;
40
- };
41
- export type DropdownMenuItemDefaultData = {
42
- label: string;
43
- value: number | string;
44
- };
@@ -41,3 +41,4 @@ export * from './text-field';
41
41
  export * from './toggle';
42
42
  export * from './tooltip';
43
43
  export * from './typography';
44
+ export * from './components.types';
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { RadioTileProps } from './radio-list.types';
3
- export declare const StyledRadioTile: import("styled-components").StyledComponent<{
2
+ import { StyledRadioItemProps } from './radio-list.types';
3
+ export declare const StyledRadioItem: import("styled-components").StyledComponent<{
4
4
  (props: import("../radio/radio.types").RadioProps): import("react").JSX.Element;
5
5
  defaultProps: import("../radio/radio.types").RadioProps;
6
- }, import("styled-components").DefaultTheme, RadioTileProps, never>;
6
+ }, import("styled-components").DefaultTheme, StyledRadioItemProps, never>;
@@ -1,10 +1,14 @@
1
1
  import { ResolutionAwareProp } from '../../types/resolution-aware-prop.type';
2
2
  import { CellProps } from '../cell/cell.types';
3
+ import { DynamicListItem } from '../components.types';
3
4
  import { GridProps } from '../grid/grid.types';
4
5
  import { RadioProps } from '../radio/radio.types';
6
+ import { TooltipProps } from '../tooltip/tooltip.types';
5
7
  export interface RadioListProps<Value extends string> extends Partial<RadioListDefaultProps<Value>>, Partial<Omit<RadioProps, 'onSelected'>> {
6
8
  cellProps?: Partial<CellProps>;
7
- getIsDisabled?: (optionName: Value) => boolean;
9
+ /** Applies to any disabled tooltips within the radio list. */
10
+ disabledTooltipProps?: Partial<TooltipProps>;
11
+ getIsDisabled?: (optionName: Value, index: number) => boolean;
8
12
  gridProps?: Partial<Omit<GridProps, 'columns'>> & {
9
13
  columns: ResolutionAwareProp<number>;
10
14
  };
@@ -17,10 +21,8 @@ export interface RadioListDefaultProps<Value extends string | Record<any, any>>
17
21
  idProperty: Value extends string ? string : keyof Value;
18
22
  labelProperty: Value extends string ? string : keyof Value;
19
23
  }
20
- export type RadioItem = {
21
- disabled?: boolean;
22
- } & Record<any, any>;
23
- export interface RadioTileProps extends RadioProps {
24
+ export type RadioItem = DynamicListItem<Record<any, any>>;
25
+ export interface StyledRadioItemProps extends RadioProps {
24
26
  isChecked: boolean | undefined;
25
27
  showAsTiles: boolean | undefined;
26
28
  }
@@ -1,13 +1,14 @@
1
1
  import { CSSProperties, FocusEvent, ReactElement } from 'react';
2
2
  import { Property } from 'csstype';
3
- import { DropdownMenuItem, DropdownMenuProps } from '../dropdown-menu/dropdown-menu.types';
3
+ import { DropdownMenuProps } from '../dropdown-menu/dropdown-menu.types';
4
+ import { DynamicListItem } from '../components.types';
4
5
  import { ErrorMessageType, TextFieldSize } from '../text-field';
5
6
  import { BlurChangeEvent, DropdownChangeEvent } from '../dropdown';
6
7
  import { Maybe } from '../../global';
7
8
  import { ResolutionAwareProp } from '../../types/resolution-aware-prop.type';
8
9
  import { TextVariant } from '../typography';
9
10
  import { TooltipProps } from '../tooltip/tooltip.types';
10
- export interface SearchFieldProps<T extends DropdownMenuItem<Record<any, any>>> extends Omit<DropdownMenuProps<T>, 'items'> {
11
+ export interface SearchFieldProps<T extends DynamicListItem<Record<any, any>>> extends Omit<DropdownMenuProps<T>, 'items'> {
11
12
  borderless?: boolean;
12
13
  className?: string;
13
14
  clearButtonText?: string;
@@ -21,8 +22,8 @@ export interface SearchFieldProps<T extends DropdownMenuItem<Record<any, any>>>
21
22
  hideErrors?: boolean;
22
23
  icon?: ReactElement;
23
24
  /** Can optionally include `disabled: true` to any index to disable that item. */
24
- items?: DropdownMenuItem<T>[];
25
- keyProperty?: (option?: DropdownMenuItem<T>) => string;
25
+ items?: DynamicListItem<T>[];
26
+ keyProperty?: (option?: DynamicListItem<T>) => string;
26
27
  labelPosition?: 'top' | 'left';
27
28
  labelText?: string;
28
29
  labelTx?: string;
@@ -34,7 +35,7 @@ export interface SearchFieldProps<T extends DropdownMenuItem<Record<any, any>>>
34
35
  minSearchLength?: number;
35
36
  name?: string;
36
37
  onBlur?: (event: BlurChangeEvent) => void;
37
- onChange?: (event: DropdownChangeEvent<DropdownMenuItem<T>> | DropdownChangeEvent<T[keyof T][]>) => void;
38
+ onChange?: (event: DropdownChangeEvent<DynamicListItem<T>> | DropdownChangeEvent<T[keyof T][]>) => void;
38
39
  onFocus?: (event: FocusEvent<HTMLDivElement>) => void;
39
40
  onOpen?: () => void;
40
41
  onTextChange?: (value: string) => void;
@@ -46,7 +47,7 @@ export interface SearchFieldProps<T extends DropdownMenuItem<Record<any, any>>>
46
47
  processing?: boolean;
47
48
  processingText?: string;
48
49
  processingTx?: string;
49
- renderPlaceholder?: (option?: DropdownMenuItem<T>) => Maybe<JSX.Element>;
50
+ renderPlaceholder?: (option?: DynamicListItem<T>) => Maybe<JSX.Element>;
50
51
  required?: boolean;
51
52
  resetSelectionOnDisabled?: boolean;
52
53
  /**