@smart-factor/gem-ui-components 0.0.55 → 0.0.57
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,34 +1,27 @@
|
|
|
1
1
|
import { SyntheticEvent } from 'react';
|
|
2
2
|
import { Control, FieldValues, Path } from 'react-hook-form';
|
|
3
|
-
import { AutocompleteChangeDetails, AutocompleteChangeReason } from '@mui/material';
|
|
3
|
+
import { AutocompleteChangeDetails, AutocompleteChangeReason, AutocompleteProps as MuiAutocompleteProps } from '@mui/material';
|
|
4
4
|
|
|
5
5
|
export type BaseOption = string | {
|
|
6
6
|
id?: any;
|
|
7
7
|
[key: string]: any;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
10
|
-
options: B[];
|
|
11
|
-
loading?: boolean;
|
|
9
|
+
export type BaseAutocompleteProps<T extends BaseOption> = Omit<MuiAutocompleteProps<T, boolean, boolean, boolean>, 'renderInput'> & {
|
|
12
10
|
label: string;
|
|
13
11
|
placeholder?: string;
|
|
14
12
|
size?: 'small' | 'medium';
|
|
15
|
-
disabled?: boolean;
|
|
16
13
|
required?: boolean;
|
|
17
|
-
multiple?: boolean;
|
|
18
|
-
freeSolo?: boolean;
|
|
19
|
-
clearIcon?: React.ReactNode;
|
|
20
14
|
['data-testId']?: string;
|
|
21
|
-
onKeyDown?: (e: React.KeyboardEvent) => void;
|
|
22
15
|
testId?: string;
|
|
23
|
-
idGetter?: (option:
|
|
24
|
-
value?:
|
|
25
|
-
onChange?: (event: SyntheticEvent<Element, Event>, value: string |
|
|
26
|
-
getOptionLabel: (option: string |
|
|
16
|
+
idGetter?: (option: T) => any;
|
|
17
|
+
value?: T | T[] | null;
|
|
18
|
+
onChange?: (event: SyntheticEvent<Element, Event>, value: string | T | (string | T)[] | null, reason: AutocompleteChangeReason, details?: AutocompleteChangeDetails<T> | undefined) => void;
|
|
19
|
+
getOptionLabel: (option: string | T) => string;
|
|
27
20
|
onInputChange?: (event: SyntheticEvent<Element, Event>, value: string) => void;
|
|
28
21
|
inputValue?: string;
|
|
29
|
-
filterOptions?: (options:
|
|
30
|
-
}
|
|
31
|
-
export interface AutocompleteProps<
|
|
32
|
-
name: Path<
|
|
33
|
-
control: Control<
|
|
22
|
+
filterOptions?: (options: T[]) => T[];
|
|
23
|
+
};
|
|
24
|
+
export interface AutocompleteProps<TFieldValues extends FieldValues, T extends BaseOption> extends Omit<BaseAutocompleteProps<T>, 'value' | 'onChange'> {
|
|
25
|
+
name: Path<TFieldValues>;
|
|
26
|
+
control: Control<TFieldValues>;
|
|
34
27
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { BaseAutocompleteProps, BaseOption } from '../FormComponents/Autocomplete/types';
|
|
2
2
|
|
|
3
|
-
export declare const SimpleAutocomplete: <
|
|
3
|
+
export declare const SimpleAutocomplete: <T extends BaseOption>({ options, label, placeholder, size, required, testId, value, getOptionLabel, ...props }: BaseAutocompleteProps<T>) => import("react/jsx-runtime").JSX.Element;
|