UNPKG

3.19 kBTypeScriptView Raw
1import * as React from 'react';
2import { IRefObject, IStyleFunctionOrObject } from '../../Utilities';
3import { IStyle, ITheme } from '../../Styling';
4import { ScrollablePaneBase } from './ScrollablePane.base';
5import { Sticky } from '../Sticky/Sticky';
6/**
7 * {@docCategory ScrollablePane}
8 */
9export interface IScrollablePane {
10 /** Triggers a layout update for the pane. */
11 forceLayoutUpdate(): void;
12 /** Gets the current scroll position of the scrollable pane */
13 getScrollPosition(): number;
14}
15/**
16 * {@docCategory ScrollablePane}
17 */
18export interface IScrollablePaneProps extends React.HTMLAttributes<HTMLElement | ScrollablePaneBase> {
19 /**
20 * Optional callback to access the IScrollablePane interface. Use this instead of ref for accessing
21 * the public methods and properties of the component.
22 */
23 componentRef?: IRefObject<IScrollablePane>;
24 /**
25 * Call to provide customized styling that will layer on top of the variant rules
26 */
27 styles?: IStyleFunctionOrObject<IScrollablePaneStyleProps, IScrollablePaneStyles>;
28 /**
29 * Theme provided by HOC.
30 */
31 theme?: ITheme;
32 /**
33 * Additional css class to apply to the ScrollablePane
34 * @defaultvalue undefined
35 */
36 className?: string;
37 /**
38 * Sets the initial scroll position of the ScrollablePane
39 */
40 initialScrollPosition?: number;
41 scrollbarVisibility?: ScrollbarVisibility;
42}
43/**
44 * {@docCategory ScrollablePane}
45 */
46export interface IScrollablePaneStyleProps {
47 /**
48 * Accept theme prop.
49 */
50 theme: ITheme;
51 /**
52 * Accept custom classNames
53 */
54 className?: string;
55 scrollbarVisibility?: IScrollablePaneProps['scrollbarVisibility'];
56}
57/**
58 * {@docCategory ScrollablePane}
59 */
60export interface IScrollablePaneStyles {
61 /**
62 * Style set for the root element.
63 */
64 root: IStyle;
65 /**
66 * Style set for the stickyAbove element.
67 */
68 stickyAbove: IStyle;
69 /**
70 * Style set for the stickyBelow element.
71 */
72 stickyBelow: IStyle;
73 /**
74 * Style set for the stickyBelowItems element.
75 */
76 stickyBelowItems: IStyle;
77 /**
78 * Style set for the contentContainer element.
79 */
80 contentContainer: IStyle;
81}
82/**
83 * {@docCategory ScrollablePane}
84 */
85export declare const ScrollbarVisibility: {
86 auto: "auto";
87 always: "always";
88};
89/**
90 * {@docCategory ScrollablePane}
91 */
92export declare type ScrollbarVisibility = typeof ScrollbarVisibility[keyof typeof ScrollbarVisibility];
93export interface IScrollablePaneContext {
94 scrollablePane?: {
95 subscribe: (handler: (container: HTMLElement, stickyContainer: HTMLElement) => void) => void;
96 unsubscribe: (handler: (container: HTMLElement, stickyContainer: HTMLElement) => void) => void;
97 addSticky: (sticky: Sticky) => void;
98 removeSticky: (sticky: Sticky) => void;
99 updateStickyRefHeights: () => void;
100 sortSticky: (sticky: Sticky, sortAgain?: boolean) => void;
101 notifySubscribers: (sort?: boolean) => void;
102 syncScrollSticky: (sticky: Sticky) => void;
103 };
104}
105export declare const ScrollablePaneContext: React.Context<IScrollablePaneContext>;