DefinitelyTyped/types/react-custom-scrollbars/index.d.ts
Ryan Price ebec11f23b export v4 react-custom-scrollbars as namespace because it is a UMD module (#37520)
This was done once already for v3 https://github.com/DefinitelyTyped/DefinitelyTyped/pull/37489
Without doing this, tsc complains that node_modules/@types/react-custom-scrollbars/index.d.ts is not a module
This change also allows importing Scrollbars as the module default `import Scrollbars from` or as a named export `import {Scollbars} from` because either work.
Documentation that this is a UMD module: f632d08e72
2019-08-13 15:57:26 -07:00

69 lines
2.0 KiB
TypeScript

// Type definitions for react-custom-scrollbars 4.0
// Project: https://github.com/malte-wessel/react-custom-scrollbars
// Definitions by: David-LeBlanc-git <https://github.com/David-LeBlanc-git>
// kittimiyo <https://github.com/kittimiyo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from "react";
export as namespace ReactCustomScrollbars;
export interface positionValues {
top: number;
left: number;
clientWidth: number;
clientHeight: number;
scrollWidth: number;
scrollHeight: number;
scrollLeft: number;
scrollTop: number;
}
export interface ScrollbarProps extends React.HTMLProps<Scrollbars> {
onScroll?: React.UIEventHandler<any>;
onScrollFrame?: (values: positionValues) => void;
onScrollStart?: () => void;
onScrollStop?: () => void;
onUpdate?: (values: positionValues) => void;
renderView?: React.StatelessComponent<any>;
renderTrackHorizontal?: React.StatelessComponent<any>;
renderTrackVertical?: React.StatelessComponent<any>;
renderThumbHorizontal?: React.StatelessComponent<any>;
renderThumbVertical?: React.StatelessComponent<any>;
tagName?: string;
hideTracksWhenNotNeeded?: boolean;
autoHide?: boolean;
autoHideTimeout?: number;
autoHideDuration?: number;
thumbSize?: number;
thumbMinSize?: number;
universal?: boolean;
autoHeight?: boolean;
autoHeightMin?: number | string;
autoHeightMax?: number | string;
}
export class Scrollbars extends React.Component<ScrollbarProps> {
scrollTop(top: number): void;
scrollLeft(left: number): void;
scrollToTop(): void;
scrollToBottom(): void;
scrollToLeft(): void;
scrollToRight(): void;
getScrollLeft(): number;
getScrollTop(): number;
getScrollWidth(): number;
getScrollHeight(): number;
getClientWidth(): number;
getClientHeight(): number;
getValues(): positionValues;
}
export default Scrollbars;