UNPKG

@mescius/dspdfviewer

Version:
47 lines (46 loc) 2.43 kB
//@ts-ignore import { ComponentType, ReactElement, ReactNode } from 'react'; export declare const isString: (value: any) => boolean; export declare const isNull: (value: any) => boolean; export declare const isUndefined: (value: any) => value is undefined; export declare const isObject: (value: any) => boolean; export declare const noop: () => any; export declare const returnFalse: () => boolean; export declare const stringify: (value: any) => string; export declare const swap: (arr: any[], i: number, j: number) => any[]; export declare const createPortalRoot: (rootId: string, modifier: string) => HTMLDivElement; export declare const getColumnClass: (columnsAmount: number) => string; export declare const getRandomString: () => string; /** Helper providing methods for comparing a type of ReactElement with component constructor */ export declare const componentType: { /** Adds a static property `_componentType_` to component constructor. Value of `name` argument must be unique among other component constructors */ set(Component: ComponentType<any>, name: string): void; /** Gets a static property `_componentType_` from component. Used internally by `is` method */ get(Component: ReactElement<any>['type']): string | undefined; /** Compares two components by their `_componentType_` static property */ is(Component1: ReactElement<any>['type'], Component2: ComponentType<any>): boolean; }; export type ARIALabelContextType = { labelId?: string; labelText?: string; labelFor?: string; }; export type ARIALabels = { /** Sets aria-label attribute */ ariaLabel?: string; /** Sets aria-labelledby attribute */ ariaLabelledBy?: string; }; export declare const getAriaLabel: (label?: string, ariaLabel?: string) => string | undefined; export declare const setAriaProps: <T extends ARIALabels>(props: T, { labelId, labelText, labelFor }: ARIALabelContextType) => T; export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; export type Exclude<T, U extends T> = T extends U ? never : T; export type PropsWithDefaults<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>> & { children?: ReactNode; }; export type StaticDefaultProps<T, K extends keyof T> = Required<Pick<T, K>>; export type AnyObject = Record<string, any>; export type Action<T extends string, P = undefined> = { type: T; payload: P; };