gantri-components 2.119.0-beta.2 → 2.119.0-beta.4

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,5 +2,5 @@ import React from 'react';
2
2
  import { ButtonMenuProps } from './button-menu.types';
3
3
  export declare const ButtonMenu: {
4
4
  <T extends Record<any, any>>(props: ButtonMenuProps<T>): React.JSX.Element;
5
- defaultProps: Partial<ButtonMenuProps<Record<string, unknown>>>;
5
+ defaultProps: any;
6
6
  };
@@ -1,9 +1,12 @@
1
1
  import { DropdownMenuProps } from '../dropdown-menu/dropdown-menu.types';
2
2
  import { ButtonVariant } from '../button/button.types';
3
- export interface ButtonMenuProps<T = Record<string, unknown>> extends DropdownMenuProps<T> {
3
+ import { TooltipProps } from '../tooltip/tooltip.types';
4
+ export interface ButtonMenuProps<T extends Record<string, unknown>> extends DropdownMenuProps<T> {
4
5
  active?: boolean;
5
6
  buttonClassName?: string;
6
7
  buttonVariant?: ButtonVariant;
8
+ /** Applies to any disabled tooltips within the dropdown menu. */
9
+ disabledTooltipProps?: Partial<TooltipProps>;
7
10
  label?: string;
8
11
  labelTx?: string;
9
12
  labelTxValues?: Record<string, unknown>;
@@ -5,11 +5,14 @@ import { ErrorMessageType, LabelPosition, TextFieldSize, TextFieldVariant } from
5
5
  import { Maybe } from '../../global';
6
6
  import { ResolutionAwareProp } from '../../types/resolution-aware-prop.type';
7
7
  import { TextVariant } from '../typography';
8
+ import { TooltipProps } from '../tooltip/tooltip.types';
8
9
  export type DropdownVariant = 'inline' | 'external';
9
- export interface DropdownProps<T> extends Omit<DropdownMenuProps<T>, 'items'> {
10
+ export interface DropdownProps<T extends Record<string, unknown>> extends Omit<DropdownMenuProps<T>, 'items'> {
10
11
  borderless?: boolean;
11
12
  className?: string;
12
13
  disabled?: boolean;
14
+ /** Applies to any disabled tooltips within the dropdown menu. */
15
+ disabledTooltipProps?: Partial<TooltipProps>;
13
16
  dropdownPopupWidth?: Property.Width<string | number>;
14
17
  dropdownVariant?: DropdownVariant;
15
18
  errorMessage?: ErrorMessageType;
@@ -1,2 +1,2 @@
1
1
  import { DropdownMenuProps } from './dropdown-menu.types';
2
- export declare const DropdownMenuPresets: Partial<DropdownMenuProps>;
2
+ export declare const DropdownMenuPresets: Partial<DropdownMenuProps<Record<string, unknown>>>;
@@ -2,32 +2,42 @@ import { Property } from 'csstype';
2
2
  import { ReactNode } from 'react';
3
3
  import { Maybe } from '../../global';
4
4
  import { Color } from '../../styles';
5
- export interface DropdownMenuProps<T = Record<string, unknown>> {
5
+ import { TooltipProps } from '../tooltip/tooltip.types';
6
+ export interface DropdownMenuProps<T extends DropdownMenuItem<Record<string, unknown>>> {
6
7
  autoSelectFirst?: boolean;
7
8
  borderColor?: Color;
8
9
  className?: string;
10
+ /** Applies to any disabled tooltips within the dropdown menu. */
11
+ disabledTooltipProps?: Partial<TooltipProps>;
9
12
  header?: ReactNode;
10
- idProperty?: keyof T;
13
+ idProperty?: keyof DropdownMenuItem<T>;
11
14
  /** Can optionally include `disabled: true` to any index to disable that item. */
12
- items: T[];
15
+ items: DropdownMenuItem<T>[];
13
16
  /** Sets the alignment of the dropdown items. */
14
17
  justifyContent?: Property.JustifyContent;
15
18
  keepOpenAfterSelection?: boolean;
16
- keyProperty?: (item?: T) => string;
17
- labelProperty?: keyof T | ((item?: T) => string);
18
- labelPropertyTx?: (item?: T) => string;
19
+ keyProperty?: (item?: DropdownMenuItem<T>) => string;
20
+ labelProperty?: keyof T | ((item?: DropdownMenuItem<T>) => string);
21
+ labelPropertyTx?: (item?: DropdownMenuItem<T>) => string;
19
22
  maxHeight?: Property.MaxHeight<string | number>;
20
23
  noShadow?: boolean;
21
24
  onKeyDown?: (event: KeyboardEvent) => void;
22
25
  onPreselectedIndexChange?: (index: number) => void;
23
26
  onSelect?: (item: T | null) => void;
24
27
  /** `item` should contain `isHeading: true` */
25
- renderHeading?: (item: T, index: number) => Maybe<ReactNode>;
26
- renderItem?: (item: T) => Maybe<ReactNode>;
28
+ renderHeading?: (item: DropdownMenuItem<T>, index: number) => Maybe<ReactNode>;
29
+ renderItem?: (item: DropdownMenuItem<T>) => Maybe<ReactNode>;
27
30
  searchType?: 'startsWith' | 'contains' | 'endsWith';
28
31
  searchable?: boolean;
29
32
  /** Optionally provide to highlight multiple items as selected. */
30
- selectedItems?: T[];
33
+ selectedItems?: DropdownMenuItem<T>[];
31
34
  value?: string | number;
32
35
  width?: Property.Width<string | number>;
33
36
  }
37
+ export type DropdownMenuItem<T extends Record<string, unknown>> = T & {
38
+ disabled?: boolean;
39
+ };
40
+ export type DefaultMenuItemKeys = {
41
+ label: string;
42
+ value: number | string;
43
+ };
@@ -1 +1,2 @@
1
1
  export * from './dropdown-menu';
2
+ export * from './dropdown-menu.types';
@@ -1,16 +1,19 @@
1
1
  import { CSSProperties, FocusEvent, ReactElement } from 'react';
2
2
  import { Property } from 'csstype';
3
- import { DropdownMenuProps } from '../dropdown-menu/dropdown-menu.types';
3
+ import { DropdownMenuItem, DropdownMenuProps } from '../dropdown-menu/dropdown-menu.types';
4
4
  import { ErrorMessageType, TextFieldSize } from '../text-field';
5
5
  import { BlurChangeEvent, DropdownChangeEvent } from '../dropdown';
6
6
  import { Maybe } from '../../global';
7
7
  import { ResolutionAwareProp } from '../../types/resolution-aware-prop.type';
8
8
  import { TextVariant } from '../typography';
9
- export interface SearchFieldProps<T = Record<string, unknown>> extends Omit<DropdownMenuProps<T>, 'items'> {
9
+ import { TooltipProps } from '../tooltip/tooltip.types';
10
+ export interface SearchFieldProps<T extends DropdownMenuItem<Record<string, unknown>>> extends Omit<DropdownMenuProps<T>, 'items'> {
10
11
  borderless?: boolean;
11
12
  className?: string;
12
13
  clearButtonText?: string;
13
14
  disabled?: boolean;
15
+ /** Applies to any disabled tooltips within the dropdown menu. */
16
+ disabledTooltipProps?: Partial<TooltipProps>;
14
17
  dropdownPopupWidth?: Property.Width<string | number>;
15
18
  enableSelectedItemsList?: boolean;
16
19
  errorMessage?: ErrorMessageType;
@@ -18,8 +21,8 @@ export interface SearchFieldProps<T = Record<string, unknown>> extends Omit<Drop
18
21
  hideErrors?: boolean;
19
22
  icon?: ReactElement;
20
23
  /** Can optionally include `disabled: true` to any index to disable that item. */
21
- items?: T[];
22
- keyProperty?: (option?: T) => string;
24
+ items?: DropdownMenuItem<T>[];
25
+ keyProperty?: (option?: DropdownMenuItem<T>) => string;
23
26
  labelPosition?: 'top' | 'left';
24
27
  labelText?: string;
25
28
  labelTx?: string;
@@ -31,7 +34,7 @@ export interface SearchFieldProps<T = Record<string, unknown>> extends Omit<Drop
31
34
  minSearchLength?: number;
32
35
  name?: string;
33
36
  onBlur?: (event: BlurChangeEvent) => void;
34
- onChange?: (event: DropdownChangeEvent<T> | DropdownChangeEvent<T[keyof T][]>) => void;
37
+ onChange?: (event: DropdownChangeEvent<DropdownMenuItem<T>> | DropdownChangeEvent<T[keyof T][]>) => void;
35
38
  onFocus?: (event: FocusEvent<HTMLDivElement>) => void;
36
39
  onOpen?: () => void;
37
40
  onTextChange?: (value: string) => void;
@@ -43,7 +46,7 @@ export interface SearchFieldProps<T = Record<string, unknown>> extends Omit<Drop
43
46
  processing?: boolean;
44
47
  processingText?: string;
45
48
  processingTx?: string;
46
- renderPlaceholder?: (option?: T) => Maybe<JSX.Element>;
49
+ renderPlaceholder?: (option?: DropdownMenuItem<T>) => Maybe<JSX.Element>;
47
50
  required?: boolean;
48
51
  resetSelectionOnDisabled?: boolean;
49
52
  /**