zp-bee
Version:
zp-bee,是一款基于 Dumi,由 React + TypeScript 开发的组件库 🎉。
32 lines (31 loc) • 1.09 kB
TypeScript
import React from 'react';
export declare function isBoolean(value: any): value is boolean;
export declare function isFunction(value: any): value is Function;
/**
* Rect
*
* @param props
*/
declare const Rect: React.FC<RectProps>;
declare type RectProps = UseRectOptions & {
children(args: {
rect: PRect | null;
ref: React.RefObject<any>;
}): JSX.Element;
};
declare function useRect<T extends Element = HTMLElement>(nodeRef: React.RefObject<T | undefined | null>, options?: UseRectOptions): null | DOMRect;
declare function useRect<T extends Element = HTMLElement>(nodeRef: React.RefObject<T | undefined | null>, observe?: UseRectOptions['observe'], onChange?: UseRectOptions['onChange']): null | DOMRect;
declare type UseRectOptions = {
observe?: boolean;
onChange?: (rect: PRect) => void;
};
declare type PRect = Partial<DOMRect> & {
readonly bottom: number;
readonly height: number;
readonly left: number;
readonly right: number;
readonly top: number;
readonly width: number;
};
export default Rect;
export { Rect, useRect };