react-easy-social-share
Version:
Social media share for React, Nextjs and React applications.
59 lines (58 loc) • 2.29 kB
TypeScript
/**
* Checks if the user's device is a mobile or tablet device.
*
* @returns A boolean indicating whether the device is a mobile or tablet device.
*/
export declare function isMobileOrTablet(): boolean;
/**
* Opens a custom window or dialog with specified dimensions and configuration options.
*
* @param url - The URL to open in the window or dialog.
* @param options - The options for configuring the window or dialog.
* @param blankTarget - Specifies whether to open the URL in a new blank tab or window.
* @param onClose - The callback function to be called when the window or dialog is closed.
* @returns The opened window or dialog.
*/
export declare function CustomWindow(url: string, { height, width, ...configRest }: {
height: number;
width: number;
[key: string]: any;
}, blankTarget?: boolean, onClose?: (dialog: Window | null) => void): Window;
/**
* Calculates the position (left and top) of a window or dialog to center it on the user's screen.
*
* @param width - The width of the window or dialog.
* @param height - The height of the window or dialog.
* @returns An object containing the left and top positions to center the window or dialog.
*/
export declare const getPositionOnWindowCenter: (width: number, height: number) => {
left: number;
top: number;
};
/**
* Calculates the position (left and top) of an element on the screen to center it horizontally and vertically.
*
* @param width - The width of the element.
* @param height - The height of the element.
* @returns An object containing the left and top positions to center the element on the screen.
*/
export declare const getPositionOnScreenCenter: (width: number, height: number) => {
top: number;
left: number;
};
/**
* Checks if an object is a Promise.
*
* @param obj - The object to check.
* @returns A boolean indicating whether the object is a Promise.
*/
export declare const isPromise: (obj: any | Promise<any>) => boolean;
/**
* Transforms an object into a query string format with URL parameters.
*
* @param object - The object to transform into parameters.
* @returns The query string with URL parameters.
*/
export default function transformObjectToParams(object: {
[key: string]: string | number | undefined | null;
}): string;