@funkit/connect
Version:
Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.
24 lines (23 loc) • 1.28 kB
TypeScript
export declare const NO_SELECTION_VALUE = "";
export declare const ADDITIONAL_GROUP_KEY = "__additional__";
export interface BaseDropdownOption<T = string> {
label: string;
value: T;
}
export interface BaseDropdownGroup<T = string, G extends string = never> {
key: G;
label: string;
values: T[];
}
export interface OrganizedDropdownGroup<T, G extends string> {
key: G | typeof ADDITIONAL_GROUP_KEY | typeof NO_SELECTION_VALUE;
label: string | undefined;
options: BaseDropdownOption<T>[];
}
export interface OrganizeDropdownGroupsResult<T, G extends string> {
organizedGroups: OrganizedDropdownGroup<T, G>[];
organizedOptions: BaseDropdownOption<T>[];
}
export declare function buildAllOptions<T extends string>(options: BaseDropdownOption<T>[], allowUnselect: boolean, unselectLabel?: string): BaseDropdownOption<T>[];
export declare function filterOptions<T extends string>(allOptions: BaseDropdownOption<T>[], searchInput: string): BaseDropdownOption<T>[];
export declare function organizeDropdownGroups<T extends string, G extends string>(filteredOptions: BaseDropdownOption<T>[], groups: BaseDropdownGroup<T, G>[] | undefined, additionalGroup: 'all' | 'others', additionalGroupLabel: string | undefined): OrganizeDropdownGroupsResult<T, G>;