@smart-factor/gem-ui-components 0.0.55 → 0.0.56
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,7 +1,7 @@
|
|
|
1
1
|
import { AutocompleteProps } from '@mui/material';
|
|
2
2
|
|
|
3
|
-
type StyledAutocompleteProps<T> = AutocompleteProps<T,
|
|
3
|
+
type StyledAutocompleteProps<T, Multiple extends boolean = false, DisableClearable extends boolean = false, FreeSolo extends boolean = false> = AutocompleteProps<T, Multiple, DisableClearable, FreeSolo> & {
|
|
4
4
|
isError?: boolean;
|
|
5
5
|
};
|
|
6
|
-
export declare const StyledAutocomplete: <T>(props: StyledAutocompleteProps<T>) => JSX.Element;
|
|
6
|
+
export declare const StyledAutocomplete: <T, Multiple extends boolean = false, DisableClearable extends boolean = false, FreeSolo extends boolean = false>(props: StyledAutocompleteProps<T, Multiple, DisableClearable, FreeSolo>) => JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -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, Multiple extends boolean = boolean, DisableClearable extends boolean = boolean, FreeSolo extends boolean = boolean> = Omit<MuiAutocompleteProps<T, Multiple, DisableClearable, FreeSolo, 'div'>, '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,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AutocompleteProps as MuiAutocompleteProps } from '@mui/material';
|
|
2
|
+
import { BaseOption } from '../FormComponents/Autocomplete/types';
|
|
2
3
|
|
|
3
|
-
export declare const SimpleAutocomplete: <
|
|
4
|
+
export declare const SimpleAutocomplete: <T extends BaseOption, Multiple extends boolean = false, DisableClearable extends boolean = false, FreeSolo extends boolean = false>({ options, label, placeholder, size, required, testId, value, getOptionLabel, ...props }: Omit<MuiAutocompleteProps<T, Multiple, DisableClearable, FreeSolo, 'div'>, 'renderInput'> & {
|
|
5
|
+
label: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
testId?: string;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|