Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: make prop types optional #100

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions packages/components/src/components/autocomplete/autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ type TAutocompleteProps = {
disabled?: boolean;
dropdown_offset: string;
error: string;
has_updating_list: boolean;
hide_list: boolean;
has_updating_list?: boolean;
hide_list?: boolean;
historyValue: string;
input_id: string;
is_alignment_top: boolean;
is_list_visible: boolean;
is_list_visible?: boolean;
list_height: string;
list_items: TItem[];
list_portal_id: string;
not_found_text: string;
not_found_text?: string;
onBlur?: (e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
onHideDropdownList: () => void;
onItemSelection: (item: TItem) => void;
onScrollStop?: () => void;
onShowDropdownList?: () => void;
should_filter_by_char: boolean;
show_list: boolean;
show_list?: boolean;
trailing_icon?: React.ReactElement;
value: string;
};
Expand All @@ -51,7 +51,9 @@ const getFilteredItems = (val: string, list: TItem[], should_filter_by_char = fa
return list.filter(item =>
typeof item === 'string'
? getEnglishCharacters(item).toLowerCase().includes(val) || item.toLowerCase().includes(val)
: getEnglishCharacters(item.text).toLowerCase().includes(val) || item?.text?.toLowerCase().includes(val)
: getEnglishCharacters(item.text || '')
.toLowerCase()
.includes(val) || item?.text?.toLowerCase().includes(val)
);
};
const Autocomplete = React.memo((props: TAutocompleteProps) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type TListItems = {
active_index: number;
is_object_list?: boolean;
list_items: TItem[];
not_found_text: string;
not_found_text?: string;
onItemSelection: (item: TItem) => void;
setActiveIndex: (index: number) => void;
};
Expand All @@ -49,7 +49,7 @@ type TDropDownList = {
onItemSelection: (item: TItem) => void;
setActiveIndex: (index: number) => void;
style: React.CSSProperties;
not_found_text: string;
not_found_text?: string;
portal_id?: string;
dropdown_refs?: TDropdownRefs;
};
Expand Down