UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

55 lines (54 loc) 2.16 kB
/// <reference types="react" /> import * as PropTypes from 'prop-types'; import { BaseComponent } from '../../Utilities'; import { IStickyProps } from './Sticky.types'; export interface IStickyState { isStickyTop: boolean; isStickyBottom: boolean; } export interface IStickyContext { scrollablePane: PropTypes.Requireable<object>; } export declare class Sticky extends BaseComponent<IStickyProps, IStickyState> { static defaultProps: IStickyProps; static contextTypes: IStickyContext; context: { scrollablePane: { subscribe: (handler: Function) => void; unsubscribe: (handler: Function) => void; addSticky: (sticky: Sticky) => void; removeSticky: (sticky: Sticky) => void; updateStickyRefHeights: () => void; sortSticky: (sticky: Sticky) => void; notifySubscribers: (sort?: boolean) => void; }; }; distanceFromTop: number; private _root; private _stickyContentTop; private _stickyContentBottom; private _nonStickyContent; constructor(props: IStickyProps); readonly root: HTMLDivElement | null; readonly stickyContentTop: HTMLDivElement | null; readonly stickyContentBottom: HTMLDivElement | null; readonly nonStickyContent: HTMLDivElement | null; readonly canStickyTop: boolean; readonly canStickyBottom: boolean; componentDidMount(): void; componentWillUnmount(): void; componentDidUpdate(prevProps: IStickyProps, prevState: IStickyState): void; shouldComponentUpdate(nextProps: IStickyProps, nextState: IStickyState): boolean; render(): JSX.Element; addSticky(stickyContent: HTMLDivElement): void; resetSticky(): void; setDistanceFromTop(container: HTMLDivElement): void; private _getContentStyles(isSticky); private _getStickyPlaceholderHeight(isSticky); private _getNonStickyPlaceholderHeight(); private _onScrollEvent; private _getStickyDistanceFromTop; private _getStickyDistanceFromTopForFooter; private _getNonStickyDistanceFromTop; private _getBackground(); }