@matthiaskrijgsman/mat-ui 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/use-drag-x.d.ts +37 -0
- package/dist/index.js +1852 -1688
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +29 -24
- package/dist/index.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/table/Table.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
type DragXEvent = {
|
|
3
|
+
/** Current pointer X (client) */
|
|
4
|
+
clientX: number;
|
|
5
|
+
/** X where the drag started */
|
|
6
|
+
startX: number;
|
|
7
|
+
/** Total horizontal movement since drag start */
|
|
8
|
+
totalDeltaX: number;
|
|
9
|
+
/** The original pointerdown event target */
|
|
10
|
+
target: EventTarget | null;
|
|
11
|
+
};
|
|
12
|
+
type UseDragXOptions = {
|
|
13
|
+
/** Called on every move with the incremental dx since the previous event */
|
|
14
|
+
onDelta: (dx: number, meta: DragXEvent) => void;
|
|
15
|
+
/** Called once when drag starts */
|
|
16
|
+
onDragStart?: (meta: DragXEvent) => void;
|
|
17
|
+
/** Called once when drag ends */
|
|
18
|
+
onDragEnd?: (meta: DragXEvent) => void;
|
|
19
|
+
/** Disable the hook */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** Restrict to primary button drags (left click); default true */
|
|
22
|
+
primaryButtonOnly?: boolean;
|
|
23
|
+
/** If true, preventDefault on move to avoid scrolling during touch drags */
|
|
24
|
+
preventScrollOnMove?: boolean;
|
|
25
|
+
};
|
|
26
|
+
type DragBind = {
|
|
27
|
+
onPointerDown: (e: React.PointerEvent) => void;
|
|
28
|
+
/** Recommended for the handle to avoid accidental scroll during touch drags */
|
|
29
|
+
style?: React.CSSProperties;
|
|
30
|
+
/** You can also put `touchAction: "none"` in your CSS */
|
|
31
|
+
role?: string;
|
|
32
|
+
};
|
|
33
|
+
export declare function useDragX(options: UseDragXOptions): {
|
|
34
|
+
isDragging: boolean;
|
|
35
|
+
bind: DragBind;
|
|
36
|
+
};
|
|
37
|
+
export {};
|