UNPKG

2.12 kBTypeScriptView Raw
1import * as React from "react";
2import { AbstractPureComponent } from "../../common";
3import { HandleProps } from "./handleProps";
4/**
5 * Props for the internal <Handle> component needs some additional info from the parent Slider.
6 */
7export interface InternalHandleProps extends HandleProps {
8 disabled?: boolean;
9 label: JSX.Element | string | undefined;
10 max: number;
11 min: number;
12 stepSize: number;
13 tickSize: number;
14 tickSizeRatio: number;
15 vertical: boolean;
16}
17export interface HandleState {
18 /** whether slider handle is currently being dragged */
19 isMoving?: boolean;
20}
21/** Internal component for a Handle with click/drag/keyboard logic to determine a new value. */
22export declare class Handle extends AbstractPureComponent<InternalHandleProps, HandleState> {
23 static displayName: string;
24 state: {
25 isMoving: boolean;
26 };
27 private handleElement;
28 private refHandlers;
29 componentDidMount(): void;
30 render(): JSX.Element;
31 componentWillUnmount(): void;
32 /** Convert client pixel to value between min and max. */
33 clientToValue(clientPixel: number): number;
34 mouseEventClientOffset(event: MouseEvent | React.MouseEvent<HTMLElement>): number;
35 touchEventClientOffset(event: TouchEvent | React.TouchEvent<HTMLElement>): number;
36 beginHandleMovement: (event: MouseEvent | React.MouseEvent<HTMLElement>) => void;
37 beginHandleTouchMovement: (event: TouchEvent | React.TouchEvent<HTMLElement>) => void;
38 protected validateProps(props: InternalHandleProps): void;
39 private getStyleProperties;
40 private endHandleMovement;
41 private endHandleTouchMovement;
42 private handleMoveEndedAt;
43 private handleHandleMovement;
44 private handleHandleTouchMovement;
45 private handleMovedTo;
46 private handleKeyDown;
47 private handleKeyUp;
48 /** Clamp value and invoke callback if it differs from current value */
49 private changeValue;
50 /** Clamp value between min and max props */
51 private clamp;
52 private getHandleElementCenterPixel;
53 private getHandleMidpointAndOffset;
54 private removeDocumentEventListeners;
55}