rdesign/frontend/node_modules/use-stick-to-bottom/dist/StickToBottom.d.ts

36 lines
2.1 KiB
TypeScript

/*!---------------------------------------------------------------------------------------------
* Copyright (c) StackBlitz. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as React from "react";
import { type ReactNode } from "react";
import { type GetTargetScrollTop, type ScrollToBottom, type StickToBottomInstance, type StickToBottomOptions, type StickToBottomState, type StopScroll } from "./useStickToBottom.js";
export interface StickToBottomContext {
contentRef: React.MutableRefObject<HTMLElement | null> & React.RefCallback<HTMLElement>;
scrollRef: React.MutableRefObject<HTMLElement | null> & React.RefCallback<HTMLElement>;
scrollToBottom: ScrollToBottom;
stopScroll: StopScroll;
isAtBottom: boolean;
escapedFromLock: boolean;
get targetScrollTop(): GetTargetScrollTop | null;
set targetScrollTop(targetScrollTop: GetTargetScrollTop | null);
state: StickToBottomState;
}
export interface StickToBottomProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children">, StickToBottomOptions {
contextRef?: React.Ref<StickToBottomContext>;
instance?: StickToBottomInstance;
children: ((context: StickToBottomContext) => ReactNode) | ReactNode;
}
export declare function StickToBottom({ instance, children, resize, initial, mass, damping, stiffness, targetScrollTop: currentTargetScrollTop, contextRef, ...props }: StickToBottomProps): ReactNode;
export declare namespace StickToBottom {
interface ContentProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
children: ((context: StickToBottomContext) => ReactNode) | ReactNode;
scrollClassName?: string;
}
function Content({ children, scrollClassName, ...props }: ContentProps): ReactNode;
}
/**
* Use this hook inside a <StickToBottom> component to gain access to whether the component is at the bottom of the scrollable area.
*/
export declare function useStickToBottomContext(): StickToBottomContext;