Skip to content

Commit

Permalink
fix: Add more type definitions (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan authored Mar 17, 2021
1 parent 5a0fa7c commit 96bb6ae
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions packages/fuselage/fuselage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,23 @@ declare module '@rocket.chat/fuselage' {
};
export const ActionButton: ForwardRefExoticComponent<ActionButtonProps>;

type AutoCompleteProps = {
value: unknown[];
filter: string;
setFilter?: (filter: string) => void;
options?: { label: string; value: unknown }[];
renderItem: ElementType;
renderSelected?: ElementType;
onChange: (value: unknown, action: 'remove' | undefined) => void;
getLabel?: (option: { label: string; value: unknown }) => string;
getValue?: (option: { label: string; value: unknown }) => unknown;
renderEmpty?: ElementType;
placeholder?: string;
error?: boolean;
disabled?: boolean;
};
export const AutoComplete: FC<AutoCompleteProps>;

type AvatarProps = Omit<BoxProps, 'title' | 'size'> & {
title?: string;
size?:
Expand Down Expand Up @@ -210,7 +227,7 @@ declare module '@rocket.chat/fuselage' {
inline?: boolean;
actionable?: boolean;
closeable?: boolean;
icon?: ReactElement;
icon?: ReactNode;
title?: string;
variant?: 'neutral' | 'info' | 'success' | 'warning' | 'danger';
onAction?: () => void;
Expand Down Expand Up @@ -269,6 +286,7 @@ declare module '@rocket.chat/fuselage' {
export const Field: ForwardRefExoticComponent<FieldProps> & {
Row: ForwardRefExoticComponent<BoxProps>;
Label: ForwardRefExoticComponent<BoxProps>;
Description: ForwardRefExoticComponent<BoxProps>;
Hint: ForwardRefExoticComponent<BoxProps>;
Error: ForwardRefExoticComponent<BoxProps>;
};
Expand Down Expand Up @@ -325,9 +343,21 @@ declare module '@rocket.chat/fuselage' {
type NumberInputProps = BoxProps;
export const NumberInput: ForwardRefExoticComponent<NumberInputProps>;

type OptionsProps = BoxProps & {
multiple?: boolean;
options: [unknown, string, boolean?][];
cursor: number;
renderItem?: ElementType;
renderEmpty?: ElementType;
onSelect: (option: [unknown, string]) => void;
};
export const Options: ForwardRefExoticComponent<OptionsProps> & {
AvatarSize: AvatarProps['size'];
};

type OptionProps = {
id?: string;
avatar?: typeof Avatar; // eslint-disable-line no-undef
avatar?: ReactNode;
label?: string;
focus?: boolean;
selected?: boolean;
Expand Down

0 comments on commit 96bb6ae

Please sign in to comment.