@sandlada/mdc
Version:
@sandlada/mdc is an open source component library that follows the Material Design 3 design specifications.
52 lines • 1.82 kB
TypeScript
/**
* @license
* Copyright 2026 Kai-Orion & Sandlada
* SPDX-License-Identifier: MIT
*/
import type { ReactiveController, ReactiveControllerHost } from 'lit';
import { type SideSheetEdge, type SideSheetVariant } from '../side-sheet.interface';
/**
* Host contract for {@link SideSheetDragController}.
*/
export interface ISideSheetDragHost extends ReactiveControllerHost, HTMLElement {
containerRef: () => HTMLElement | null;
headlineRef: () => HTMLElement | null;
scrimRef: () => HTMLElement | null;
enabled: () => boolean;
getVariant: () => SideSheetVariant;
getSheetEdge: () => SideSheetEdge;
}
/**
* Pointer-driven horizontal swipe-to-dismiss controller for side-sheet.
* Tracks horizontal pointer movement, engages after 4px threshold, applies live
* translateX during drag, and decides dismiss vs snap-back on release using distance
* and velocity heuristics per M3 / MDC-Android specifications.
*/
export declare class SideSheetDragController implements ReactiveController {
private readonly host;
private pointerId;
private startX;
private startY;
private engaged;
private canceled;
private currentDx;
private containerWidth;
private lastMoveT;
private lastMoveDx;
private releaseVelocity;
private readonly handlePointerMoveBound;
private readonly handlePointerUpBound;
private readonly handlePointerCancelBound;
constructor(host: ISideSheetDragHost);
hostConnected(): void;
hostDisconnected(): void;
/**
* Cancel any in-flight drag (e.g. when the host calls `hide()` mid-drag).
*/
cancel(): void;
handlePointerDown(event: PointerEvent): void;
private handlePointerMove;
private handlePointerUp;
private resetState;
}
//# sourceMappingURL=side-sheet-drag-controller.d.ts.map