diff --git a/types/react-custom-scrollbars/index.d.ts b/types/react-custom-scrollbars/index.d.ts index cf9410f81d..88ed144561 100644 --- a/types/react-custom-scrollbars/index.d.ts +++ b/types/react-custom-scrollbars/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for react-css-transition-replace 2.0.1 +// Type definitions for react-custom-scrollbars 4.0 // Project: https://github.com/malte-wessel/react-custom-scrollbars -// Definitions by: David-LeBlanc-git +// Definitions by: David-LeBlanc-git +// kittimiyo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -31,6 +32,8 @@ declare module "react-custom-scrollbars" { renderThumbHorizontal?: React.StatelessComponent; renderThumbVertical?: React.StatelessComponent; + hideTracksWhenNotNeeded?: boolean; + autoHide?: boolean; autoHideTimeout?: number; autoHideDuration?: number; @@ -38,6 +41,10 @@ declare module "react-custom-scrollbars" { thumbSize?: number; thumbMinSize?: number; universal?: boolean; + + autoHeight?: boolean; + autoHeightMin?: number; + autoHeightMax?: number; } export default class Scrollbars extends React.Component { @@ -51,8 +58,8 @@ declare module "react-custom-scrollbars" { getScrollTop(): number; getScrollWidth(): number; getScrollHeight(): number; - getWidth(): number; - getHeight(): number; + getClientWidth(): number; + getClientHeight(): number; getValues(): positionValues; } -} \ No newline at end of file +} diff --git a/types/react-custom-scrollbars/v3/index.d.ts b/types/react-custom-scrollbars/v3/index.d.ts new file mode 100644 index 0000000000..a5ae0da8b2 --- /dev/null +++ b/types/react-custom-scrollbars/v3/index.d.ts @@ -0,0 +1,58 @@ +// Type definitions for react-custom-scrollbars 3.0 +// Project: https://github.com/malte-wessel/react-custom-scrollbars +// Definitions by: David-LeBlanc-git +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import * as React from "react"; + +declare module "react-custom-scrollbars" { + 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 { + onScroll?: React.UIEventHandler; + onScrollFrame?: (values: positionValues) => void; + onScrollStart?: () => void; + onScrollStop?: () => void; + onUpdate?: (values: positionValues) => void; + + renderView?: React.StatelessComponent; + renderTrackHorizontal?: React.StatelessComponent; + renderTrackVertical?: React.StatelessComponent; + renderThumbHorizontal?: React.StatelessComponent; + renderThumbVertical?: React.StatelessComponent; + + autoHide?: boolean; + autoHideTimeout?: number; + autoHideDuration?: number; + + thumbSize?: number; + thumbMinSize?: number; + universal?: boolean; + } + + export default class Scrollbars extends React.Component { + scrollTop(top: number): void; + scrollLeft(left: number): void; + scrollToTop(): void; + scrollToBottom(): void; + scrollToLeft(): void; + scrollToRight(): void; + getScrollLeft(): number; + getScrollTop(): number; + getScrollWidth(): number; + getScrollHeight(): number; + getWidth(): number; + getHeight(): number; + getValues(): positionValues; + } +} diff --git a/types/react-custom-scrollbars/v3/react-custom-scrollbars-tests.tsx b/types/react-custom-scrollbars/v3/react-custom-scrollbars-tests.tsx new file mode 100644 index 0000000000..240061eada --- /dev/null +++ b/types/react-custom-scrollbars/v3/react-custom-scrollbars-tests.tsx @@ -0,0 +1,10 @@ +import * as React from "react" +import { render } from 'react-dom'; +import Scrollbars from "react-custom-scrollbars" + +render( + +
Test
+
, + document.getElementById("main") +) diff --git a/types/react-custom-scrollbars/v3/tsconfig.json b/types/react-custom-scrollbars/v3/tsconfig.json new file mode 100644 index 0000000000..81204a9799 --- /dev/null +++ b/types/react-custom-scrollbars/v3/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "react-custom-scrollbars": ["react-custom-scrollbars/v3"], + "react-custom-scrollbars/*": ["react-custom-scrollbars/v3/*"] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-custom-scrollbars-tests.tsx" + ] +}