@seplan/diti-ds
Version:
Reusable UI component library developed by DITI (Technology and Innovation Directorate of SEPLAN PI) based on Mantine and Tailwind CSS
84 lines (68 loc) • 2.6 kB
TypeScript
declare type FilterGroupState = {
[key: string]: Set<string>;
};
declare type FiltersContextType = {
filterGroups: FilterGroupState;
getGroupSelected: (groupKey: string) => Set<string>;
toggleOption: (groupKey: string, value: string) => void;
clearGroup: (groupKey: string) => void;
clearAll: () => void;
getTotalSelectedCount: () => number;
getGroupSelectedCount: (groupKey: string) => number;
page: number | null;
filters: Record<string, any>;
setFilters: (filters: Record<string, any>) => void;
};
declare interface QRCodeOptions {
url: string;
backgroundImagePath?: string;
orientation?: 'portrait' | 'landscape';
qrSize?: number;
qrPositionX?: number;
qrPositionY?: number;
title?: string;
fileName?: string;
}
declare type SelectedItemsContextType = {
selectedItems: Set<string>;
toggle: (value: string) => void;
clear: () => void;
};
export declare function useClipboard(timeout?: number): {
copied: boolean;
copy: (text: string) => Promise<void>;
};
/**
* Custom hook for downloading blobs from API endpoints
* @param options - Optional callbacks for success and error handling
* @returns Object with downloadBlob function, loading state, and error state
*/
export declare function useDownloadBlob(options?: UseDownloadBlobOptions): UseDownloadBlobReturn;
declare interface UseDownloadBlobOptions {
onSuccess?: () => void;
onError?: (error: Error) => void;
}
declare interface UseDownloadBlobReturn {
downloadBlob: (url: string, filename: string, params?: Record<string, string | number | boolean | string[] | undefined>) => Promise<void>;
isLoading: boolean;
error: Error | null;
}
export declare const useFilters: () => FiltersContextType;
export declare function useMediaQuery(query: string): boolean;
export declare function usePaginationReset({ shallow }?: UsePaginationResetParams): {
page: number;
resetPagination: () => void;
};
declare type UsePaginationResetParams = Partial<{
shallow: boolean;
}>;
export declare function useQRCodeGenerator(): {
isGenerating: boolean;
generateAndDownloadPDF: ({ url, backgroundImagePath, orientation, qrSize, qrPositionX, qrPositionY, title, fileName }: QRCodeOptions) => Promise<void>;
};
export declare function useSelectedItems(): SelectedItemsContextType;
export declare const useSortableColumn: (column: string, sortKey: string | null) => {
isSorted: boolean;
isDescending: boolean;
};
export { }