react-reorder-list 0.5.0 → 0.6.1

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/README.md CHANGED
@@ -1,13 +1,19 @@
1
1
  # react-reorder-list
2
+
2
3
  A simple react component that facilitates the reordering of JSX/HTML elements through drag-and-drop functionality, allowing for easy position changes.
4
+
3
5
  ## Features
6
+
4
7
  - Reorders list of elements using drag and drop.
5
8
  - Easy to use
6
9
  - Smooth transition using animation.
7
10
  - Listen to children updates. See [listen to children updates](#listen-to-children-updates)
8
11
  - Handles nested lists easily. See [nested list usage](#nested-list-usage)
12
+
9
13
  ## Installation
14
+
10
15
  To install react-reorder-list
16
+
11
17
  ```bash
12
18
  # with npm:
13
19
  npm install react-reorder-list --save
@@ -21,50 +27,61 @@ To install react-reorder-list
21
27
  # with bun:
22
28
  bun add react-reorder-list
23
29
  ```
30
+
24
31
  ## Usage
32
+
25
33
  `react-reorder-list` default exports `<ReorderList>` component which encapsulates all the list items as its children.
26
34
 
27
35
  Items in this list can be reordered by simply dragging an item and dropping it in place of another item.
36
+
28
37
  #### Basic Usage
38
+
29
39
  Each `<div>` component inside `<ReorderList>` can now be drag-and-dropped to another `<div>` to reorder them.
40
+
30
41
  ```jsx
31
- import React from 'react'
32
- import ReorderList from 'react-reorder-list'
42
+ import React from "react";
43
+ import ReorderList from "react-reorder-list";
33
44
 
34
45
  export default function App() {
35
- return <ReorderList>
36
- {[0, 1, 2, 3, 4].map(i => {
37
- {/* Having a unique key is important */}
38
- return <div key={i}>Item {i}</div>
39
- })}
46
+ return (
47
+ <ReorderList>
48
+ {[0, 1, 2, 3, 4].map((i) => {
49
+ return <div key={i}>Item {i}</div>; // Having a unique key is important
50
+ })}
40
51
  </ReorderList>
52
+ );
41
53
  }
42
54
  ```
55
+
43
56
  #### Usage with ReorderIcon
57
+
44
58
  The dragging behavior can be changed using the `useOnlyIconToDrag` prop of `<ReorderList>` component.
45
59
 
46
60
  If set to `false`, an item can be dragged by clicking anywhere inside the item.
47
61
 
48
62
  If set to `true`, an item can be dragged only using the `<ReorderIcon>` present inside the item.
63
+
49
64
  ```jsx
50
65
  import React from 'react'
51
66
  import ReorderList, { ReorderIcon } from 'react-reorder-list'
52
67
 
53
68
  export default function App() {
54
- return <ReorderList useOnlyIconToDrag={true}>
55
- {[0, 1, 2, 3, 4].map(i => {
56
- return <div key={i}>
57
- <ReorderIcon /> {/* Default icon */}
58
- <ReorderIcon>
59
- {/* Custom icon/component */}
60
- </Reordericon>
61
- <span>{i}</span>
62
- </div>
63
- })}
64
- </ReorderList>
69
+ return <ReorderList useOnlyIconToDrag={true}>
70
+ {[0, 1, 2, 3, 4].map(i => {
71
+ return <div key={i}>
72
+ <ReorderIcon /> {/* Default icon */}
73
+ <ReorderIcon>
74
+ {/* Custom icon/component */}
75
+ </Reordericon>
76
+ <span>{i}</span>
77
+ </div>
78
+ })}
79
+ </ReorderList>
65
80
  }
66
81
  ```
82
+
67
83
  #### Listen to Children Updates
84
+
68
85
  `<ReorderList>` can listen to updates to it's children components using the `watchChildrenUpdates` prop as shown below.
69
86
 
70
87
  If set to `false`, any updates made in children component except reordering by user won't reflect.
@@ -74,59 +91,74 @@ Further if `preserveOrder` is set to false, the order in which new children appe
74
91
  Whereas if `preserveOrder` is set to true, the order of existing items will be preserved as before the update occured and new items will be placed at the end irrespective of their order in children. Also, if an item is being dragged and an update occurs at that moment, that item will be placed at respective location and `onPositionChange` will be called to prevent any inconsistency.
75
92
 
76
93
  NOTE: The props `watchChildrenUpdates` and `preserveOrder` should be used carefully to avoid any unexpected behaviour
94
+
77
95
  ```jsx
78
- import React, { useState } from 'react'
79
- import ReorderList from 'react-reorder-list'
96
+ import React, { useState } from "react";
97
+ import ReorderList from "react-reorder-list";
80
98
 
81
99
  export default function App() {
82
- const [array, setArray] = useState([0, 1, 2, 3, 4])
83
-
84
- function setNewArray() {
85
- setArray(prev => {
86
- const array = []
87
- prev.forEach(_ => {
88
- do {
89
- var item = Math.floor(Math.random() * 9)
90
- } while (array.includes(item))
91
- array.push(item)
92
- })
93
- return array
94
- })
95
- }
96
-
97
- return <div>
98
- <ReorderList watchChildrenUpdates={true} animationDuration={200}>
99
- {array.map(i => <div key={i}>Item {i}</div>)}
100
- </ReorderList>
101
- <button onClick={setNewArray}>Click me</button>
100
+ const [array, setArray] = useState([0, 1, 2, 3, 4]);
101
+
102
+ function setNewArray() {
103
+ setArray((prev) => {
104
+ const array = [];
105
+ prev.forEach((_) => {
106
+ do {
107
+ var item = Math.floor(Math.random() * 9);
108
+ } while (array.includes(item));
109
+ array.push(item);
110
+ });
111
+ return array;
112
+ });
113
+ }
114
+
115
+ return (
116
+ <div>
117
+ <ReorderList watchChildrenUpdates={true} animationDuration={200}>
118
+ {array.map((i) => (
119
+ <div key={i}>Item {i}</div>
120
+ ))}
121
+ </ReorderList>
122
+ <button onClick={setNewArray}>Click me</button>
102
123
  </div>
124
+ );
103
125
  }
104
126
  ```
127
+
105
128
  #### Nested List Usage
129
+
106
130
  ```jsx
107
- import React from 'react'
108
- import ReorderList, { ReorderIcon } from 'react-reorder-list'
131
+ import React from "react";
132
+ import ReorderList, { ReorderIcon } from "react-reorder-list";
109
133
 
110
134
  export default function App() {
111
- return <ReorderList>
112
- {[0, 1, 2].map(i => {
113
- return <div key={i}>
114
- <ReorderIcon />
115
- <span>{'Parent' + i}</span>
116
- <ReorderList useOnlyIconToDrag={true}>
117
- {[0, 1, 2].map(j => {
118
- return <div key={j} style={{ paddingLeft: '16px' }}>
119
- <ReorderIcon />
120
- <span>{'Child' + i + j}</span>
121
- </div>
122
- })}
123
- </ReorderList>
124
- </div>
125
- })}
135
+ return (
136
+ <ReorderList>
137
+ {[0, 1, 2].map((i) => {
138
+ return (
139
+ <div key={i}>
140
+ <ReorderIcon />
141
+ <span>{"Parent" + i}</span>
142
+ <ReorderList useOnlyIconToDrag={true}>
143
+ {[0, 1, 2].map((j) => {
144
+ return (
145
+ <div key={j} style={{ paddingLeft: "16px" }}>
146
+ <ReorderIcon />
147
+ <span>{"Child" + i + j}</span>
148
+ </div>
149
+ );
150
+ })}
151
+ </ReorderList>
152
+ </div>
153
+ );
154
+ })}
126
155
  </ReorderList>
156
+ );
127
157
  }
128
158
  ```
159
+
129
160
  ## ReorderList Component API Reference
161
+
130
162
  Here is the full API for the `<ReorderList>` component, these properties can be set on an instance of ReorderList:
131
163
  | Parameter | Type | Required | Default | Description |
132
164
  | - | - | - | - | - |
@@ -138,19 +170,24 @@ Here is the full API for the `<ReorderList>` component, these properties can be
138
170
  | `onPositionChange` | [`PositionChangeHandler`](#positionchangehandler) | No | - | Function to be executed on item position change. |
139
171
  | `disabled` | `Boolean` | No | false | When set to true, `<ReorderList>` will work as a plain `div` with no functionality. |
140
172
  | `props` | `React.DetailedHTMLProps` | No | - | Props to customize the `<ReorderList>` component. |
173
+
141
174
  ### Types
175
+
142
176
  #### PositionChangeHandler
177
+
143
178
  ```typescript
144
- import { ReactNode } from 'react';
145
- type RevertHandler = () => void
146
- type PositionChangeParams = {
147
- start?: number // Index of the item being dragged
148
- end?: number // Index of the item being displaced by the starting item
149
- oldItems?: ReactNode[] // Array of children before reordering
150
- newItems?: ReactNode[] // Array of children after reordering
151
- revert: RevertHandler // A fallback handler to revert the reordering
152
- }
153
- type PositionChangeHandler = (params?: PositionChangeParams) => void
179
+ import { ReactNode } from "react";
180
+ type RevertHandler = () => void;
181
+ type PositionChangeParams = {
182
+ start?: number; // Index of the item being dragged
183
+ end?: number; // Index of the item being displaced by the starting item
184
+ oldItems?: ReactNode[]; // Array of children before reordering
185
+ newItems?: ReactNode[]; // Array of children after reordering
186
+ revert: RevertHandler; // A fallback handler to revert the reordering
187
+ };
188
+ type PositionChangeHandler = (params?: PositionChangeParams) => void;
154
189
  ```
190
+
155
191
  ## Author
156
- [Sahil Aggarwal](https://www.github.com/SahilAggarwal2004)
192
+
193
+ [Sahil Aggarwal](https://www.github.com/SahilAggarwal2004)
package/dist/animation.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import { useState, useLayoutEffect, Children, useEffect, useRef } from "react";
2
2
  function usePrevious(value) {
3
3
  const prevChildrenRef = useRef();
4
- useEffect(() => { prevChildrenRef.current = value; }, [value]);
4
+ useEffect(() => {
5
+ prevChildrenRef.current = value;
6
+ }, [value]);
5
7
  return prevChildrenRef.current;
6
8
  }
7
- ;
8
9
  function calculateBoundingBoxes(children) {
9
10
  const boundingBoxes = {};
10
- Children.forEach(children, child => boundingBoxes[child.key.split("/.")[0]] = child.ref.current.getBoundingClientRect());
11
+ Children.forEach(children, (child) => (boundingBoxes[child.key.split("/.")[0]] = child.ref.current.getBoundingClientRect()));
11
12
  return boundingBoxes;
12
13
  }
13
- ;
14
14
  export default function Animation({ duration, children }) {
15
15
  const [boundingBox, setBoundingBox] = useState({});
16
16
  const prevBoundingBox = usePrevious(boundingBox);
@@ -22,7 +22,7 @@ export default function Animation({ duration, children }) {
22
22
  }, [children]);
23
23
  useLayoutEffect(() => {
24
24
  if (duration > 0 && prevBoundingBox && Object.keys(prevBoundingBox).length)
25
- Children.forEach(children, child => {
25
+ Children.forEach(children, (child) => {
26
26
  const domNode = child.ref.current;
27
27
  const key = child.key.split("/.")[0];
28
28
  const { left: prevLeft, top: prevTop } = prevBoundingBox[key] || {};
@@ -41,4 +41,3 @@ export default function Animation({ duration, children }) {
41
41
  }, [boundingBox]);
42
42
  return children;
43
43
  }
44
- ;
@@ -0,0 +1,6 @@
1
+ import { DetailedHTMLProps, HTMLAttributes } from "react";
2
+ export type Props = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
3
+ export default function useDraggable(initValue?: boolean): {
4
+ draggable: boolean;
5
+ draggableProps: Props;
6
+ };
package/dist/hooks.js ADDED
@@ -0,0 +1,8 @@
1
+ import { useState } from "react";
2
+ export default function useDraggable(initValue = false) {
3
+ const [draggable, setDraggable] = useState(initValue);
4
+ const enableDragging = () => setDraggable(true);
5
+ const disableDragging = () => setDraggable(false);
6
+ const draggableProps = { onMouseEnter: enableDragging, onMouseLeave: disableDragging, onTouchStart: enableDragging, onTouchEnd: disableDragging };
7
+ return { draggable, draggableProps };
8
+ }
package/dist/icons.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  export function PiDotsSixVerticalBold(props) {
3
- return React.createElement("span", Object.assign({}, props),
3
+ return (React.createElement("span", Object.assign({}, props),
4
4
  React.createElement("svg", { viewBox: "0 0 256 256", fill: "currentColor", width: "1.25rem", height: "1.25rem" },
5
- React.createElement("path", { d: "M108,60A16,16,0,1,1,92,44,16,16,0,0,1,108,60Zm56,16a16,16,0,1,0-16-16A16,16,0,0,0,164,76ZM92,112a16,16,0,1,0,16,16A16,16,0,0,0,92,112Zm72,0a16,16,0,1,0,16,16A16,16,0,0,0,164,112ZM92,180a16,16,0,1,0,16,16A16,16,0,0,0,92,180Zm72,0a16,16,0,1,0,16,16A16,16,0,0,0,164,180Z" })));
5
+ React.createElement("path", { d: "M108,60A16,16,0,1,1,92,44,16,16,0,0,1,108,60Zm56,16a16,16,0,1,0-16-16A16,16,0,0,0,164,76ZM92,112a16,16,0,1,0,16,16A16,16,0,0,0,92,112Zm72,0a16,16,0,1,0,16,16A16,16,0,0,0,164,112ZM92,180a16,16,0,1,0,16,16A16,16,0,0,0,92,180Zm72,0a16,16,0,1,0,16,16A16,16,0,0,0,164,180Z" }))));
6
6
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import React, { DetailedHTMLProps, HTMLAttributes, ReactNode } from "react";
2
- export type Props = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
1
+ import React, { ReactNode } from "react";
2
+ import { Props } from "./hooks.js";
3
+ export type { Props } from "./hooks.js";
3
4
  export type PositionChangeHandler = (params?: {
4
5
  start?: number;
5
6
  end?: number;
@@ -18,6 +19,6 @@ export type ReorderListProps = {
18
19
  props?: Props;
19
20
  children?: ReactNode;
20
21
  };
21
- export type { IconProps } from './icons.js';
22
+ export type { IconProps } from "./icons.js";
22
23
  export default function ReorderList({ useOnlyIconToDrag, selectedItemOpacity, animationDuration, watchChildrenUpdates, preserveOrder, onPositionChange, disabled, props, children }: ReorderListProps): React.JSX.Element;
23
24
  export declare function ReorderIcon({ children, style, ...props }: Props): React.JSX.Element;
package/dist/index.js CHANGED
@@ -12,6 +12,10 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import React, { Children, cloneElement, createRef, forwardRef, isValidElement, useEffect, useMemo, useRef, useState } from "react";
13
13
  import { PiDotsSixVerticalBold } from "./icons.js";
14
14
  import Animation from "./animation.js";
15
+ import useDraggable from "./hooks.js";
16
+ if (typeof window !== "undefined")
17
+ import("drag-drop-touch");
18
+ const scrollThreshold = { x: 10, y: 100 };
15
19
  const ReorderItemRef = forwardRef(ReorderItem);
16
20
  export default function ReorderList({ useOnlyIconToDrag = false, selectedItemOpacity = 0.5, animationDuration = 400, watchChildrenUpdates = false, preserveOrder = false, onPositionChange, disabled = false, props, children }) {
17
21
  const ref = useRef(null);
@@ -20,17 +24,18 @@ export default function ReorderList({ useOnlyIconToDrag = false, selectedItemOpa
20
24
  const [items, setItems] = useState(Children.toArray(children));
21
25
  const [temp, setTemp] = useState({});
22
26
  const [isAnimating, setIsAnimating] = useState(false);
23
- const refs = useMemo(() => items.map(_ => createRef()), [items]);
24
- const findIndex = (key) => key ? items.findIndex(item => { var _a, _b; return ((_b = (_a = item === null || item === void 0 ? void 0 : item.key) === null || _a === void 0 ? void 0 : _a.split(".$").at(-1)) !== null && _b !== void 0 ? _b : item === null || item === void 0 ? void 0 : item.toString()) === key; }) : -1;
27
+ const [scroll, setScroll] = useState();
28
+ const refs = useMemo(() => items.map((_) => createRef()), [items]);
29
+ const findIndex = (key) => (key ? items.findIndex((item) => { var _a, _b; return ((_b = (_a = item === null || item === void 0 ? void 0 : item.key) === null || _a === void 0 ? void 0 : _a.split(".$").at(-1)) !== null && _b !== void 0 ? _b : item === null || item === void 0 ? void 0 : item.toString()) === key; }) : -1);
25
30
  useEffect(() => {
26
31
  if (!watchChildrenUpdates)
27
32
  return;
28
33
  if (selected !== -1)
29
- handleDragEnd(selected, preserveOrder);
34
+ handleDragEnd(null, selected, preserveOrder);
30
35
  if (preserveOrder) {
31
36
  const items = [];
32
37
  const newItems = [];
33
- Children.forEach(children, child => {
38
+ Children.forEach(children, (child) => {
34
39
  var _a;
35
40
  const index = findIndex((_a = child === null || child === void 0 ? void 0 : child.key) !== null && _a !== void 0 ? _a : child === null || child === void 0 ? void 0 : child.toString());
36
41
  if (index === -1)
@@ -38,30 +43,42 @@ export default function ReorderList({ useOnlyIconToDrag = false, selectedItemOpa
38
43
  else
39
44
  items[index] = child;
40
45
  });
41
- setItems(items.filter(item => item !== undefined).concat(newItems));
46
+ setItems(items.filter((item) => item !== undefined).concat(newItems));
42
47
  }
43
48
  else
44
49
  setItems(Children.toArray(children));
45
50
  }, [children]);
46
- function handleDragEnd(end, handlePositionChange = true) {
51
+ useEffect(() => {
52
+ if (!scroll)
53
+ return;
54
+ const { left, top } = scroll;
55
+ const { scrollWidth, scrollHeight } = document.body;
56
+ const interval = setInterval(() => {
57
+ if (left < 0 || top < 0 || scrollWidth - scrollX > innerWidth - left || scrollHeight - scrollY > innerHeight - top)
58
+ scrollBy({ left, top, behavior: "instant" });
59
+ }, 20);
60
+ return () => clearInterval(interval);
61
+ }, [scroll]);
62
+ function handleDragEnd(event, end = selected, handlePositionChange = true) {
63
+ event === null || event === void 0 ? void 0 : event.stopPropagation();
47
64
  if (handlePositionChange && end !== start)
48
65
  onPositionChange === null || onPositionChange === void 0 ? void 0 : onPositionChange({ start, end, oldItems: temp.items, newItems: items, revert: () => setItems(temp.items) });
49
66
  setStart(-1);
50
67
  setSelected(-1);
51
68
  }
52
- return React.createElement("div", Object.assign({ ref: ref }, props), disabled ? children : React.createElement(Animation, { duration: +(start !== -1) && animationDuration }, Children.map(items, (child, i) => {
69
+ return (React.createElement("div", Object.assign({ ref: ref }, props), disabled ? (children) : (React.createElement(Animation, { duration: +(start !== -1 && !scroll) && animationDuration }, Children.map(items, (child, i) => {
53
70
  var _a;
54
- return React.createElement(ReorderItemRef, { key: (_a = child === null || child === void 0 ? void 0 : child.key) !== null && _a !== void 0 ? _a : child === null || child === void 0 ? void 0 : child.toString(), ref: refs[i], useOnlyIconToDrag: useOnlyIconToDrag, style: { opacity: selected === i ? selectedItemOpacity : 1 }, onDragStart: event => {
71
+ return (React.createElement(ReorderItemRef, { key: (_a = child === null || child === void 0 ? void 0 : child.key) !== null && _a !== void 0 ? _a : child === null || child === void 0 ? void 0 : child.toString(), ref: refs[i], useOnlyIconToDrag: useOnlyIconToDrag, style: { opacity: selected === i ? selectedItemOpacity : 1, touchAction: "pan-y" }, onDragStart: (event) => {
55
72
  event.stopPropagation();
56
73
  setStart(i);
57
74
  setSelected(i);
58
75
  setTemp({ items, rect: ref.current.children[i].getBoundingClientRect() });
59
- }, onDragEnter: event => {
76
+ }, onDragEnter: (event) => {
60
77
  event.stopPropagation();
61
78
  if (start === -1 || selected === i || isAnimating)
62
79
  return;
63
80
  const { width: startWidth, height: startHeight } = temp.rect;
64
- const { left, top, width, height } = event.currentTarget.getBoundingClientRect();
81
+ const { left, top, width, height } = event.target.getBoundingClientRect();
65
82
  if (event.clientX - left > Math.min(startWidth, width) || event.clientY - top > Math.min(startHeight, height))
66
83
  return;
67
84
  setSelected(i);
@@ -72,29 +89,36 @@ export default function ReorderList({ useOnlyIconToDrag = false, selectedItemOpa
72
89
  });
73
90
  setIsAnimating(true);
74
91
  setTimeout(() => setIsAnimating(false), animationDuration);
75
- }, onDragEnd: event => {
76
- event.stopPropagation();
77
- handleDragEnd(i);
78
- } }, child);
79
- })));
92
+ }, onDragEnd: handleDragEnd, onTouchMove: (event) => {
93
+ const { clientX, screenX, clientY, screenY } = event.touches[0];
94
+ let left = 0, top = 0;
95
+ if (clientX < scrollThreshold.x)
96
+ left = -5;
97
+ else if (innerWidth - screenX < scrollThreshold.x)
98
+ left = 5;
99
+ if (clientY < scrollThreshold.y)
100
+ top = -10;
101
+ else if (innerHeight - screenY < scrollThreshold.y)
102
+ top = 10;
103
+ setScroll(left || top ? { left, top } : undefined);
104
+ }, onTouchEnd: () => setScroll(undefined) }, child));
105
+ })))));
80
106
  }
81
- function ReorderItem({ useOnlyIconToDrag, style, onDragStart, onDragEnter, onDragEnd, children }, ref) {
82
- const [draggable, setDraggable] = useState(false);
83
- const onPointerEnter = () => setDraggable(true);
84
- const onPointerLeave = () => setDraggable(false);
85
- let props = { draggable, onDragStart, onDragEnter, onDragEnd };
86
- if (!useOnlyIconToDrag)
87
- props = Object.assign(Object.assign({}, props), { onPointerEnter, onPointerLeave });
88
- const recursiveClone = (children) => Children.map(children, child => {
107
+ function ReorderItem(_a, ref) {
108
+ var { useOnlyIconToDrag, onTouchEnd: propOnTouchEnd, children } = _a, props = __rest(_a, ["useOnlyIconToDrag", "onTouchEnd", "children"]);
109
+ const _b = useDraggable(), { draggable } = _b, _c = _b.draggableProps, { onTouchEnd: draggableOnTouchEnd } = _c, draggableProps = __rest(_c, ["onTouchEnd"]);
110
+ const recursiveClone = (children) => Children.map(children, (child) => {
89
111
  if (!isValidElement(child))
90
112
  return child;
91
- const childProps = child.type === ReorderIcon ? { onPointerEnter, onPointerLeave } : {};
92
- return cloneElement(child, Object.assign({ children: recursiveClone(child.props.children) }, childProps));
113
+ return cloneElement(child, Object.assign({ children: recursiveClone(child.props.children) }, (child.type === ReorderIcon && draggableProps)));
93
114
  });
94
- const recursiveChildren = useMemo(() => useOnlyIconToDrag ? recursiveClone(children) : children, [children]);
95
- return React.createElement("div", Object.assign({ ref: ref, style: style }, props), recursiveChildren);
115
+ const recursiveChildren = useMemo(() => (useOnlyIconToDrag ? recursiveClone(children) : children), [useOnlyIconToDrag, children]);
116
+ return (React.createElement("div", Object.assign({ ref: ref, draggable: draggable }, props, (!useOnlyIconToDrag && draggableProps), { onTouchEnd: (event) => {
117
+ draggableOnTouchEnd(event);
118
+ propOnTouchEnd(event);
119
+ } }), recursiveChildren));
96
120
  }
97
121
  export function ReorderIcon(_a) {
98
122
  var { children = React.createElement(PiDotsSixVerticalBold, null), style } = _a, props = __rest(_a, ["children", "style"]);
99
- return React.createElement("span", Object.assign({ style: Object.assign({ cursor: "grab" }, style) }, props), children);
123
+ return (React.createElement("span", Object.assign({ style: Object.assign({ cursor: "grab" }, style) }, props), children));
100
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-reorder-list",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
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",
@@ -32,6 +32,9 @@
32
32
  "devDependencies": {
33
33
  "@types/react": "^18.2.48"
34
34
  },
35
+ "dependencies": {
36
+ "drag-drop-touch": "^1.3.1"
37
+ },
35
38
  "scripts": {
36
39
  "build": "pnpm i && tsc"
37
40
  }