indicate
Version:
Scroll indicator for elements with scrollable overflow.
104 lines (103 loc) • 3.53 kB
TypeScript
import { ReactNode } from 'react';
import { Properties } from 'csstype';
export declare enum Direction {
left = "left",
right = "right",
top = "top",
bottom = "bottom"
}
export declare const directions: Direction[];
export declare const isHorizontal: (direction: Direction) => boolean;
export declare const isVertical: (direction: Direction) => boolean;
export declare const isStart: (direction: Direction) => boolean;
export declare const isEnd: (direction: Direction) => boolean;
export type Inline = false | string;
export type Elements = string | Element | HTMLElement | NodeListOf<Element> | ReactNode;
export interface Theme {
indicator?: ((element: HTMLElement, options: Options, direction: Direction) => CSSProperties | void) | CSSProperties;
hide?: (indicator: HTMLSpanElement) => void | CSSProperties;
show?: (indicator: HTMLSpanElement) => void | CSSProperties;
arrow?: (arrow: HTMLElement, options: Options, direction: Direction) => CSSProperties | void;
outerWrapper?: ((element: HTMLElement, options: Options, table: boolean, inline: Inline) => CSSProperties | void) | CSSProperties;
element?: ((element: HTMLElement, options: Options, table: boolean, inline: Inline) => CSSProperties | void) | CSSProperties;
innerWrapper?: ((element: HTMLElement, options: Options, table: boolean) => CSSProperties | void) | CSSProperties;
observer?: ((element: HTMLElement, options: Options, direction: Direction) => CSSProperties | void) | CSSProperties;
}
type ArrowPosition = 'start' | 'center' | 'end';
export declare const pluginOptionsProperties: string[];
export interface UnpublishedOptions {
outerWrapper?: HTMLElement;
innerWrapper?: HTMLElement;
}
export interface ClickOptions {
denominator?: number;
}
export type ArrowIcon = 'arrow-rounded' | 'pointer-rounded' | 'arrow' | 'pointer';
export interface PluginArrowOptions {
position?: ArrowPosition;
icon?: ArrowIcon;
color?: string;
image?: string;
markup?: Node | string;
}
export interface ArrowOptions {
position: ArrowPosition;
icon: ArrowIcon;
color: string;
image?: string;
markup?: Node | string;
}
export type PluginOptions = {
arrow?: boolean | PluginArrowOptions;
color?: string;
theme?: Theme;
width?: string;
click?: boolean | ClickOptions;
hideScrollbar?: boolean;
moveStylesToWrapper?: boolean;
inlineStyles?: {
[key in keyof Theme]: CSSProperties;
};
} & UnpublishedOptions;
export type Options = {
arrow: false | ArrowOptions;
theme?: Theme;
color: string;
width: string;
click: false | ClickOptions;
hideScrollbar: boolean;
moveStylesToWrapper: boolean;
inlineStyles?: {
[key in keyof Theme]: CSSProperties;
};
} & UnpublishedOptions;
export interface Instance {
outerWrapper: HTMLDivElement;
innerWrapper: HTMLDivElement;
element: HTMLElement;
indicator: {
left: HTMLSpanElement;
right: HTMLSpanElement;
top: HTMLSpanElement;
bottom: HTMLSpanElement;
};
observer: {
left: HTMLSpanElement;
right: HTMLSpanElement;
top: HTMLSpanElement;
bottom: HTMLSpanElement;
};
intersectionObserver: IntersectionObserver;
options: Options;
table: boolean;
inline: Inline;
}
export interface Visibility {
left: boolean;
right: boolean;
top: boolean;
bottom: boolean;
}
export interface CSSProperties extends Properties<string | number> {
}
export {};