@activecollab/components
Version:
ActiveCollab Components
64 lines • 3.22 kB
TypeScript
import React, { ReactElement } from "react";
import { BoardTool } from "./bottomDock";
import { CanvasElementDef, GridSize, ShapeElementState, StickyTextStyle } from "./elements";
import { FileElementDef } from "./fileElement";
import { LinkElementDef } from "./linkElement";
import { ProjectElementDef } from "./projectElements";
/**
* A card is full of its own controls — the URL field, the display toggle, the
* retry button, the toolbar. A mousedown on any of them selects the element but
* must not start a board drag.
*
* The resize grip needs no entry here: the shipped handle calls
* `preventDefault()` on pointerdown, which suppresses the compatibility mouse
* events entirely, so a grip press never reaches this at all.
*/
export declare const NO_DRAG_SELECTOR = "a, button, input, textarea, [data-no-drag]";
/**
* …except a control that IS the whole card.
*
* A placeholder is one big button filling its card, so treating it as a control
* left no surface to grab and the card could not be moved at all. Marked
* drag-through, it does both: moving the pointer drags the card, and releasing
* without moving is still a click that opens the editor or the file picker.
* (Atlassian's rule — make a handle draggable, not the whole element — assumes
* the element has some non-interactive surface. This one has none.)
*/
export declare const DRAG_THROUGH_SELECTOR = "[data-drag-through]";
export interface CanvasElementsProps {
gridSize: GridSize;
snapToGrid: boolean;
activeTool: BoardTool;
onToolUsed: () => void;
selectedId: string | null;
onSelectedIdChange: React.Dispatch<React.SetStateAction<string | null>>;
positions: Record<string, {
x: number;
y: number;
}>;
setPositions: React.Dispatch<React.SetStateAction<Record<string, {
x: number;
y: number;
}>>>;
shapes: Record<string, ShapeElementState>;
setShapes: React.Dispatch<React.SetStateAction<Record<string, ShapeElementState>>>;
stickyStyle: StickyTextStyle;
setStickyStyle: React.Dispatch<React.SetStateAction<StickyTextStyle>>;
links: LinkElementDef[];
setLinks: React.Dispatch<React.SetStateAction<LinkElementDef[]>>;
files: FileElementDef[];
setFiles: React.Dispatch<React.SetStateAction<FileElementDef[]>>;
projectElements: ProjectElementDef[];
setProjectElements: React.Dispatch<React.SetStateAction<ProjectElementDef[]>>;
createdShapes: CanvasElementDef[];
setCreatedShapes: React.Dispatch<React.SetStateAction<CanvasElementDef[]>>;
sizes: Record<string, {
width: number;
height: number;
}>;
rotations: Record<string, number>;
locks: Record<string, boolean>;
setLocks: React.Dispatch<React.SetStateAction<Record<string, boolean>>>;
}
export declare const CanvasElements: ({ gridSize, snapToGrid, activeTool, onToolUsed, selectedId, onSelectedIdChange: setSelectedId, positions, setPositions, shapes, setShapes, stickyStyle, setStickyStyle, links, setLinks, files, setFiles, projectElements, setProjectElements, createdShapes, setCreatedShapes, sizes, rotations, locks, setLocks, }: CanvasElementsProps) => ReactElement;
//# sourceMappingURL=canvasElements.d.ts.map