(props: GridItemProps)
| 192 | * Wraps a child element with drag and resize functionality. |
| 193 | */ |
| 194 | export function GridItem(props: GridItemProps): ReactElement { |
| 195 | const { |
| 196 | children, |
| 197 | cols, |
| 198 | containerWidth, |
| 199 | margin, |
| 200 | containerPadding, |
| 201 | rowHeight, |
| 202 | maxRows, |
| 203 | isDraggable, |
| 204 | isResizable, |
| 205 | isBounded, |
| 206 | static: isStatic, |
| 207 | useCSSTransforms = true, |
| 208 | usePercentages = false, |
| 209 | transformScale = 1, |
| 210 | positionStrategy, |
| 211 | dragThreshold = 0, |
| 212 | droppingPosition, |
| 213 | className = "", |
| 214 | style, |
| 215 | handle = "", |
| 216 | cancel = "", |
| 217 | x, |
| 218 | y, |
| 219 | w, |
| 220 | h, |
| 221 | minW = 1, |
| 222 | maxW = Infinity, |
| 223 | minH = 1, |
| 224 | maxH = Infinity, |
| 225 | i, |
| 226 | resizeHandles, |
| 227 | resizeHandle, |
| 228 | constraints = defaultConstraints, |
| 229 | layoutItem, |
| 230 | layout = [], |
| 231 | onDragStart: onDragStartProp, |
| 232 | onDrag: onDragProp, |
| 233 | onDragStop: onDragStopProp, |
| 234 | onResizeStart: onResizeStartProp, |
| 235 | onResize: onResizeProp, |
| 236 | onResizeStop: onResizeStopProp |
| 237 | } = props; |
| 238 | |
| 239 | // State |
| 240 | const [dragging, setDragging] = useState(false); |
| 241 | const [resizing, setResizing] = useState(false); |
| 242 | |
| 243 | // Refs for position tracking (avoid state for React 18 batching) |
| 244 | const elementRef = useRef<HTMLDivElement>(null); |
| 245 | const dragPositionRef = useRef<PartialPosition>({ left: 0, top: 0 }); |
| 246 | const resizePositionRef = useRef<Position>({ |
| 247 | top: 0, |
| 248 | left: 0, |
| 249 | width: 0, |
| 250 | height: 0 |
| 251 | }); |
nothing calls this directly
no test coverage detected
searching dependent graphs…