react-reorder-list 0.6.5 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks.d.ts +6 -9
- package/dist/hooks.js +1 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/hooks.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
export declare function useDraggable(initValue?: boolean): {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
onTouchEnd: () => void;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
1
|
+
export declare function useDraggable(initValue?: boolean): readonly [boolean, {
|
|
2
|
+
onMouseEnter: () => void;
|
|
3
|
+
onMouseLeave: () => void;
|
|
4
|
+
onTouchStart: () => void;
|
|
5
|
+
onTouchEnd: () => void;
|
|
6
|
+
}];
|
package/dist/hooks.js
CHANGED
|
@@ -4,5 +4,5 @@ export function useDraggable(initValue = false) {
|
|
|
4
4
|
const enableDragging = () => setDraggable(true);
|
|
5
5
|
const disableDragging = () => setDraggable(false);
|
|
6
6
|
const draggableProps = { onMouseEnter: enableDragging, onMouseLeave: disableDragging, onTouchStart: enableDragging, onTouchEnd: disableDragging };
|
|
7
|
-
return
|
|
7
|
+
return [draggable, draggableProps];
|
|
8
8
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { DetailedHTMLProps, HTMLAttributes, ReactNode } from "react";
|
|
1
|
+
import React, { CSSProperties, DetailedHTMLProps, DragEventHandler, HTMLAttributes, ReactNode, TouchEventHandler } from "react";
|
|
2
2
|
export type Props = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
3
3
|
export type PositionChangeHandler = (params?: {
|
|
4
4
|
start?: number;
|
|
@@ -18,6 +18,18 @@ export type ReorderListProps = {
|
|
|
18
18
|
props?: Props;
|
|
19
19
|
children?: ReactNode;
|
|
20
20
|
};
|
|
21
|
+
export type DivDragEventHandler = DragEventHandler<HTMLDivElement>;
|
|
22
|
+
export type DivTouchEventHandler = TouchEventHandler<HTMLDivElement>;
|
|
23
|
+
export type ReorderItemProps = {
|
|
24
|
+
useOnlyIconToDrag: boolean;
|
|
25
|
+
style: CSSProperties;
|
|
26
|
+
onDragStart?: DivDragEventHandler;
|
|
27
|
+
onDragEnter: DivDragEventHandler;
|
|
28
|
+
onDragEnd: DivDragEventHandler;
|
|
29
|
+
onTouchMove: DivTouchEventHandler;
|
|
30
|
+
onTouchEnd: DivTouchEventHandler;
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
};
|
|
21
33
|
export type { IconProps } from "./icons.js";
|
|
22
34
|
export default function ReorderList({ useOnlyIconToDrag, selectedItemOpacity, animationDuration, watchChildrenUpdates, preserveOrder, onPositionChange, disabled, props, children }: ReorderListProps): React.JSX.Element;
|
|
23
35
|
export declare function ReorderIcon({ children, style, ...props }: Props): React.JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -108,7 +108,7 @@ export default function ReorderList({ useOnlyIconToDrag = false, selectedItemOpa
|
|
|
108
108
|
}
|
|
109
109
|
function ReorderItem(_a, ref) {
|
|
110
110
|
var { useOnlyIconToDrag, onTouchEnd: propOnTouchEnd, children } = _a, props = __rest(_a, ["useOnlyIconToDrag", "onTouchEnd", "children"]);
|
|
111
|
-
const _b = useDraggable(), {
|
|
111
|
+
const [draggable, _b] = useDraggable(), { onTouchEnd: draggableOnTouchEnd } = _b, draggableProps = __rest(_b, ["onTouchEnd"]);
|
|
112
112
|
if (!draggable)
|
|
113
113
|
props.onDragStart = undefined;
|
|
114
114
|
const recursiveClone = (children) => Children.map(children, (child) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-reorder-list",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"description": "A simple react component that facilitates the reordering of JSX/HTML elements through drag-and-drop functionality, allowing for easy position changes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://github.com/SahilAggarwal2004/react-reorder-list#readme",
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"react": ">=
|
|
29
|
+
"react": ">=17.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/react": "^18.2.55"
|