UNPKG

carbon-react

Version:

A library of reusable React components for easily building user interfaces.

27 lines (26 loc) 1.2 kB
/** Helper functions for safer type checking. */ declare const PRIVATE_DRAGGABLE_KEY: unique symbol; declare const PRIVATE_DROP_TARGET_KEY: unique symbol; export type Draggable = { [PRIVATE_DRAGGABLE_KEY]: true; /** Unique identifier of the draggable item */ id: string; /** The index of the draggable item when dragging was initiated */ initialIndex: number; /** Bounding rectangle of the draggable item */ rect: DOMRect; /** Unique identifier of the context instance the item belongs to */ contextId: symbol; }; export type DropTarget = { [PRIVATE_DROP_TARGET_KEY]: true; /** Unique identifier of the drop target */ id: string; /** Unique identifier of the context instance the drop target belongs to */ contextId: symbol; }; export declare function getDraggable(data: Omit<Draggable, typeof PRIVATE_DRAGGABLE_KEY>): Draggable; export declare function getDropTarget(data: Omit<DropTarget, typeof PRIVATE_DROP_TARGET_KEY>): DropTarget; export declare function isDraggable(data: Record<string | symbol, unknown>): data is Draggable; export declare function isDropTarget(data: Record<string | symbol, unknown>): data is DropTarget; export {};