react-reorder-list
Advanced tools
Comparing version 0.6.4 to 0.6.5
@@ -1,10 +0,9 @@ | ||
import { MouseEvent, TouchEvent } from "react"; | ||
export declare function useDraggable(initValue?: boolean): { | ||
draggable: boolean; | ||
draggableProps: { | ||
onMouseEnter: (event: MouseEvent | TouchEvent) => void; | ||
onMouseLeave: (event: MouseEvent | TouchEvent) => void; | ||
onTouchStart: (event: MouseEvent | TouchEvent) => void; | ||
onTouchEnd: (event: MouseEvent | TouchEvent) => void; | ||
onMouseEnter: () => void; | ||
onMouseLeave: () => void; | ||
onTouchStart: () => void; | ||
onTouchEnd: () => void; | ||
}; | ||
}; |
import { useState } from "react"; | ||
export function useDraggable(initValue = false) { | ||
const [draggable, setDraggable] = useState(initValue); | ||
const enableDragging = (event) => { | ||
event.stopPropagation(); | ||
setDraggable(true); | ||
}; | ||
const disableDragging = (event) => { | ||
event.stopPropagation(); | ||
setDraggable(false); | ||
}; | ||
const enableDragging = () => setDraggable(true); | ||
const disableDragging = () => setDraggable(false); | ||
const draggableProps = { onMouseEnter: enableDragging, onMouseLeave: disableDragging, onTouchStart: enableDragging, onTouchEnd: disableDragging }; | ||
return { draggable, draggableProps }; | ||
} |
@@ -93,3 +93,2 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
}, onDragEnd: handleDragEnd, onTouchMove: (event) => { | ||
event.stopPropagation(); | ||
if (start === -1) | ||
@@ -123,4 +122,3 @@ return; | ||
return (React.createElement("div", Object.assign({ ref: ref, draggable: draggable }, props, (!useOnlyIconToDrag && draggableProps), { onTouchEnd: (event) => { | ||
event.stopPropagation(); | ||
draggableOnTouchEnd(event); | ||
draggableOnTouchEnd(); | ||
propOnTouchEnd(event); | ||
@@ -127,0 +125,0 @@ } }), recursiveChildren)); |
{ | ||
"name": "react-reorder-list", | ||
"version": "0.6.4", | ||
"version": "0.6.5", | ||
"description": "A simple react component that facilitates the reordering of JSX/HTML elements through drag-and-drop functionality, allowing for easy position changes.", | ||
@@ -32,3 +32,3 @@ "type": "module", | ||
"devDependencies": { | ||
"@types/react": "^18.2.54" | ||
"@types/react": "^18.2.55" | ||
}, | ||
@@ -35,0 +35,0 @@ "dependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21023
229