|
| 1 | +import { Component, CSSProperties, SFC } from "react"; |
| 2 | + |
| 3 | +export interface ScrollbarRendererProps { |
| 4 | + className?: string | string[]; |
| 5 | + style?: CSSProperties; |
| 6 | +} |
| 7 | + |
| 8 | +export interface ScrollValues { |
| 9 | + scrollTop: number; |
| 10 | + scrollLeft: number; |
| 11 | + scrollHeight: number; |
| 12 | + scrollWidth: number; |
| 13 | + clientHeight: number; |
| 14 | + clientWidth: number; |
| 15 | +} |
| 16 | + |
| 17 | +export interface ScrollbarProps { |
| 18 | + minimalThumbsSize?: number; |
| 19 | + fallbackScrollbarWidth?: number; |
| 20 | + |
| 21 | + rtl?: boolean; |
| 22 | + momentum?: boolean; |
| 23 | + defaultStyles?: boolean; |
| 24 | + |
| 25 | + permanentScrollbars?: boolean; |
| 26 | + permanentScrollbarX?: boolean; |
| 27 | + permanentScrollbarY?: boolean; |
| 28 | + |
| 29 | + noScroll?: boolean; |
| 30 | + noScrollX?: boolean; |
| 31 | + noScrollY?: boolean; |
| 32 | + |
| 33 | + tagName?: string; |
| 34 | + |
| 35 | + className?: string | string[]; |
| 36 | + wrapperClassName?: string | string[]; |
| 37 | + contentClassName?: string | string[]; |
| 38 | + trackVerticalClassName?: string | string[]; |
| 39 | + trackHorizontalClassName?: string | string[]; |
| 40 | + thumbVerticalClassName?: string | string[]; |
| 41 | + thumbHorizontalClassName?: string | string[]; |
| 42 | + |
| 43 | + style?: CSSProperties; |
| 44 | + wrapperStyle?: CSSProperties; |
| 45 | + contentStyle?: CSSProperties; |
| 46 | + trackVerticalStyle?: CSSProperties; |
| 47 | + trackHorizontalStyle?: CSSProperties; |
| 48 | + thumbVerticalStyle?: CSSProperties; |
| 49 | + thumbHorizontalStyle?: CSSProperties; |
| 50 | + |
| 51 | + onScroll?(current: ScrollValues, instance: Scrollbar): void; |
| 52 | + onScrollStart?(instance: Scrollbar): void; |
| 53 | + onScrollStop?(instance: Scrollbar): void; |
| 54 | + scrollDetectionThreshold?: number; |
| 55 | + |
| 56 | + renderWrapper?: SFC<ScrollbarRendererProps>; |
| 57 | + renderContent?: SFC<ScrollbarRendererProps>; |
| 58 | + renderTrackVertical?: SFC<ScrollbarRendererProps>; |
| 59 | + renderTrackHorizontal?: SFC<ScrollbarRendererProps>; |
| 60 | + renderThumbVertical?: SFC<ScrollbarRendererProps>; |
| 61 | + renderThumbHorizontal?: SFC<ScrollbarRendererProps>; |
| 62 | +} |
| 63 | + |
| 64 | +declare class Scrollbar extends Component<ScrollbarProps> { |
| 65 | + public scrollTop: number; |
| 66 | + public scrollLeft: number; |
| 67 | + public readonly scrollHeight: number; |
| 68 | + public readonly scrollWidth: number; |
| 69 | + public readonly clientHeight: number; |
| 70 | + public readonly clientWidth: number; |
| 71 | + /** |
| 72 | + * Scroll to the top border. |
| 73 | + * |
| 74 | + * @returns The scrollbar instance |
| 75 | + */ |
| 76 | + public scrollToTop(): Scrollbar; |
| 77 | + /** |
| 78 | + * Scroll to the bottom border. |
| 79 | + * |
| 80 | + * @returns The scrollbar instance |
| 81 | + */ |
| 82 | + public scrollToBottom(): Scrollbar; |
| 83 | + /** |
| 84 | + * Scroll to the left border. |
| 85 | + * |
| 86 | + * @returns The scrollbar instance |
| 87 | + */ |
| 88 | + public scrollToLeft(): Scrollbar; |
| 89 | + /** |
| 90 | + * Scroll to the right border. |
| 91 | + * |
| 92 | + * @returns The scrollbar instance |
| 93 | + */ |
| 94 | + public scrollToRight(): Scrollbar; |
| 95 | + /** |
| 96 | + * Updates the scrollbars. By default, this does nothing if content and |
| 97 | + * wrapper sizes are unchanged. |
| 98 | + * |
| 99 | + * @param forced Whether to update the scrollbars even if nothing changed. |
| 100 | + * @param rtlAutodetect Whether to check CSS direction value. |
| 101 | + * |
| 102 | + * @returns The scrollbar instance. |
| 103 | + */ |
| 104 | + public update(forced?: boolean, rtlAutodetect?: boolean): Scrollbar; |
| 105 | +} |
| 106 | + |
| 107 | +export default Scrollbar; |
0 commit comments