@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 interface BaseAutocompleteProps<B extends Partial<BaseOption>> {
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: B) => any;
24
- value?: B | B[] | null;
25
- onChange?: (event: SyntheticEvent<Element, Event>, value: string | B | (string | B)[] | null, reason: AutocompleteChangeReason, details?: AutocompleteChangeDetails<B> | undefined) => void;
26
- getOptionLabel: (option: string | B) => 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: B[]) => B[];
30
- }
31
- export interface AutocompleteProps<T extends FieldValues, B extends Partial<BaseOption>> extends Omit<BaseAutocompleteProps<B>, 'value' | 'onChange'> {
32
- name: Path<T>;
33
- control: Control<T>;
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: <B extends BaseOption>({ options, loading, label, placeholder, size, disabled, required, multiple, freeSolo, clearIcon, testId, value, onChange, getOptionLabel, onInputChange, inputValue, filterOptions, onKeyDown, ...props }: BaseAutocompleteProps<B>) => import("react/jsx-runtime").JSX.Element;
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;