gantri-components 2.184.1 → 2.185.0-beta.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.
|
@@ -8,14 +8,13 @@ import { Maybe } from '../../global';
|
|
|
8
8
|
import { ResolutionAwareProp } from '../../types/resolution-aware-prop.type';
|
|
9
9
|
import { TextVariant } from '../typography';
|
|
10
10
|
import { TooltipProps } from '../tooltip/tooltip.types';
|
|
11
|
+
import { IconProps } from '../icon/icon.types';
|
|
11
12
|
export interface SearchFieldProps<T extends DynamicListItem<Record<any, any> & {
|
|
12
13
|
isAddTag?: boolean;
|
|
13
14
|
}>> extends Omit<DropdownMenuProps<T>, 'items'> {
|
|
14
15
|
borderless?: boolean;
|
|
15
16
|
className?: string;
|
|
16
17
|
clearButtonText?: string;
|
|
17
|
-
/** Create new [creatableLabel]: “tim” */
|
|
18
|
-
creatableLabel?: string;
|
|
19
18
|
disabled?: boolean;
|
|
20
19
|
/** Applies to any disabled tooltips within the dropdown menu. */
|
|
21
20
|
disabledTooltipProps?: Partial<TooltipProps>;
|
|
@@ -26,9 +25,7 @@ export interface SearchFieldProps<T extends DynamicListItem<Record<any, any> & {
|
|
|
26
25
|
filterFn?: (searchBy: string, item: T) => boolean;
|
|
27
26
|
hideErrors?: boolean;
|
|
28
27
|
icon?: ReactElement;
|
|
29
|
-
isCreatable?:
|
|
30
|
-
/** function to determine if the creatable query string is valid to show the creatable dropdown option */
|
|
31
|
-
isValidCreatableItem?: (query: string) => boolean;
|
|
28
|
+
isCreatable?: SearchFieldIsCreatableDef;
|
|
32
29
|
/** Can optionally include `disabled: true` to any index to disable that item. */
|
|
33
30
|
items?: DynamicListItem<T>[];
|
|
34
31
|
keyProperty?: (option?: DynamicListItem<T>) => string;
|
|
@@ -64,9 +61,23 @@ export interface SearchFieldProps<T extends DynamicListItem<Record<any, any> & {
|
|
|
64
61
|
* the new items must be provided after.
|
|
65
62
|
* */
|
|
66
63
|
searchMode?: 'internal' | 'external';
|
|
67
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* The initial values for the selected items list.
|
|
66
|
+
*
|
|
67
|
+
* Not compatible with externally filtering available `items`.
|
|
68
|
+
*/
|
|
68
69
|
selectedItemsList?: T[keyof T][];
|
|
69
70
|
size?: ResolutionAwareProp<TextFieldSize>;
|
|
70
71
|
style?: CSSProperties;
|
|
71
72
|
variant?: 'line' | 'filled';
|
|
72
73
|
}
|
|
74
|
+
export interface SearchFieldIsCreatableDef {
|
|
75
|
+
addToSelectedItemsOnCreate?: boolean;
|
|
76
|
+
enabled: boolean;
|
|
77
|
+
iconColor?: IconProps['color'];
|
|
78
|
+
iconName?: IconProps['name'];
|
|
79
|
+
/** Function to determine if the creatable query string is valid to show the creatable dropdown option */
|
|
80
|
+
isValid?: (query: string) => boolean;
|
|
81
|
+
/** Override label text that appears next to the creatable item. */
|
|
82
|
+
label?: string;
|
|
83
|
+
}
|