react-drag-and-drop-kit 0.0.0 → 1.0.0

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,6 +1,6 @@
1
- # Drag and Drop
1
+ # React Drag and Drop Kit
2
2
 
3
- A lightweight, easy to use React.js library for implementing react-drag-and-drop-kit functionality. This library provides simple components that wrap the native HTML5 Drag and Drop API, making it straightforward to add react-drag-and-drop-kit features to your React applications.
3
+ A lightweight, easy-to-use React.js library for implementing drag-and-drop functionality. This library provides simple components that wrap the native HTML5 Drag and Drop API, making it straightforward to add drag-and-drop features to your React applications.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/react-drag-and-drop-kit)](https://www.npmjs.com/package/react-drag-and-drop-kit)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/react-drag-and-drop-kit)](https://www.npmjs.com/package/react-drag-and-drop-kit)
@@ -9,9 +9,10 @@ A lightweight, easy to use React.js library for implementing react-drag-and-drop
9
9
  ## Features
10
10
 
11
11
  ✨ **Simple and Lightweight** - Minimal API with zero dependencies (besides React)
12
- 🎯 **Type-Safe** - Full TypeScript support
12
+ 🎯 **Type-Safe** - Full TypeScript support with exported types
13
13
  🎨 **Flexible** - Use with any React component
14
- 📦 **Reusable** - Export your own custom data during drag operations
14
+ 📦 **Reusable** - Pass custom data during drag operations
15
+ 🎨 **Styleable** - Built-in support for custom styling via `style` props
15
16
  ⚡ **Performance** - Efficient implementation using native browser APIs
16
17
 
17
18
  ## Installation
@@ -58,15 +59,26 @@ function App() {
58
59
  <Draggable
59
60
  handleDragStart={handleDragStart}
60
61
  dataTransfer={{ id: "item-1", name: "My Item" }}
62
+ style={{
63
+ padding: "20px",
64
+ backgroundColor: "#3498db",
65
+ color: "#fff",
66
+ cursor: "grab",
67
+ }}
61
68
  >
62
- <div style={{ padding: "20px", backgroundColor: "#3498db", color: "#fff" }}>Drag me!</div>
69
+ Drag me!
63
70
  </Draggable>
64
71
  </div>
65
72
 
66
- <DropZone handleDropItem={handleDropItem}>
67
- <div style={{ padding: "20px", backgroundColor: "#2ecc71", minHeight: "100%" }}>
68
- {droppedData ? `Dropped: ${JSON.stringify(droppedData)}` : "Drop here!"}
69
- </div>
73
+ <DropZone
74
+ handleDropItem={handleDropItem}
75
+ style={{
76
+ padding: "20px",
77
+ backgroundColor: "#2ecc71",
78
+ minHeight: "100%",
79
+ }}
80
+ >
81
+ {droppedData ? `Dropped: ${JSON.stringify(droppedData)}` : "Drop here!"}
70
82
  </DropZone>
71
83
  </div>
72
84
  );
@@ -83,18 +95,25 @@ Wraps any React component to make it draggable.
83
95
 
84
96
  #### Props
85
97
 
86
- | Prop | Type | Description |
87
- | ----------------- | -------------------------------------------------- | -------------------------------------------------------------- |
88
- | `children` | `ReactNode` | The content to be dragged |
89
- | `handleDragStart` | `(event: React.DragEvent<HTMLDivElement>) => void` | Callback fired when drag starts |
90
- | `dataTransfer` | `DataTransferInterface` | Custom data object to be transferred during the drag operation |
98
+ | Prop | Type | Required | Description |
99
+ | ----------------- | -------------------------------------------------- | -------- | ------------------------------------------------ |
100
+ | `children` | `ReactNode` | No | The content to be dragged |
101
+ | `handleDragStart` | `(event: React.DragEvent<HTMLDivElement>) => void` | Yes | Callback fired when drag starts |
102
+ | `dataTransfer` | `DataTransferInterface` | No | Custom data object to be transferred during drag |
103
+ | `style` | `React.CSSProperties` | No | Inline CSS styles for the draggable element |
91
104
 
92
105
  #### Example
93
106
 
94
107
  ```tsx
95
108
  <Draggable
96
109
  handleDragStart={(event) => console.log("Dragging...")}
97
- dataTransfer={{ itemId: 123, type: "product" }}
110
+ dataTransfer={{ itemId: "123", type: "product" }}
111
+ style={{
112
+ padding: "10px",
113
+ backgroundColor: "#3498db",
114
+ cursor: "grab",
115
+ borderRadius: "4px",
116
+ }}
98
117
  >
99
118
  <div>Draggable Item</div>
100
119
  </Draggable>
@@ -106,10 +125,11 @@ Creates a drop target that accepts dragged items.
106
125
 
107
126
  #### Props
108
127
 
109
- | Prop | Type | Description |
110
- | ---------------- | ----------------------------------------------------------------------------------- | -------------------------------------- |
111
- | `children` | `ReactNode` | The content of the drop zone |
112
- | `handleDropItem` | `(e: React.DragEvent<HTMLDivElement>, dataTransfer: DataTransferInterface) => void` | Callback fired when an item is dropped |
128
+ | Prop | Type | Required | Description |
129
+ | ---------------- | ----------------------------------------------------------------------------------- | -------- | ------------------------------------------- |
130
+ | `children` | `ReactNode` | No | The content of the drop zone |
131
+ | `handleDropItem` | `(e: React.DragEvent<HTMLDivElement>, dataTransfer: DataTransferInterface) => void` | Yes | Callback fired when an item is dropped |
132
+ | `style` | `React.CSSProperties` | No | Inline CSS styles for the drop zone element |
113
133
 
114
134
  #### Example
115
135
 
@@ -118,6 +138,12 @@ Creates a drop target that accepts dragged items.
118
138
  handleDropItem={(event, dataTransfer) => {
119
139
  console.log("Dropped data:", dataTransfer);
120
140
  }}
141
+ style={{
142
+ border: "2px dashed #667eea",
143
+ padding: "20px",
144
+ minHeight: "300px",
145
+ backgroundColor: "#f0f4ff",
146
+ }}
121
147
  >
122
148
  <div>Drop Target</div>
123
149
  </DropZone>
@@ -135,6 +161,27 @@ interface DataTransferInterface {
135
161
  }
136
162
  ```
137
163
 
164
+ #### `DraggableProps`
165
+
166
+ ```typescript
167
+ type DraggableProps = {
168
+ children?: ReactNode;
169
+ style?: React.CSSProperties;
170
+ handleDragStart: (event: React.DragEvent<HTMLDivElement>) => void;
171
+ dataTransfer?: DataTransferInterface;
172
+ };
173
+ ```
174
+
175
+ #### `DropZoneProps`
176
+
177
+ ```typescript
178
+ type DropZoneProps = {
179
+ children?: ReactNode;
180
+ style?: React.CSSProperties;
181
+ handleDropItem: (e: React.DragEvent<HTMLDivElement>, dataTransfer: DataTransferInterface) => void;
182
+ };
183
+ ```
184
+
138
185
  ## Real-World Example
139
186
 
140
187
  ### Shopping Cart Demo
@@ -142,7 +189,6 @@ interface DataTransferInterface {
142
189
  ```tsx
143
190
  import { useState } from "react";
144
191
  import { Draggable, DropZone, type DataTransferInterface } from "react-drag-and-drop-kit";
145
- import "./App.css";
146
192
 
147
193
  function App() {
148
194
  const products = [
@@ -166,42 +212,42 @@ function App() {
166
212
  key={product.id}
167
213
  dataTransfer={{ id: String(product.id), name: product.name }}
168
214
  handleDragStart={() => console.log(`Dragging ${product.name}`)}
215
+ style={{
216
+ padding: "10px",
217
+ margin: "10px 0",
218
+ backgroundColor: "#3498db",
219
+ color: "#fff",
220
+ cursor: "grab",
221
+ borderRadius: "4px",
222
+ userSelect: "none",
223
+ }}
169
224
  >
170
- <div
171
- style={{
172
- padding: "10px",
173
- margin: "10px 0",
174
- backgroundColor: "#3498db",
175
- color: "#fff",
176
- cursor: "grab",
177
- }}
178
- >
179
- {product.name} - {product.price}
180
- </div>
225
+ {product.name} - {product.price}
181
226
  </Draggable>
182
227
  ))}
183
228
  </div>
184
229
 
185
- <DropZone handleDropItem={handleAddToCart}>
186
- <div
187
- style={{
188
- flex: 1,
189
- backgroundColor: "#ecf0f1",
190
- padding: "20px",
191
- minHeight: "500px",
192
- }}
193
- >
194
- <h2>Shopping Cart</h2>
195
- {cart.length === 0 ? (
196
- <p>Drag items here to add to cart</p>
197
- ) : (
198
- <ul>
199
- {cart.map((item, idx) => (
200
- <li key={idx}>{item.name}</li>
201
- ))}
202
- </ul>
203
- )}
204
- </div>
230
+ <DropZone
231
+ handleDropItem={handleAddToCart}
232
+ style={{
233
+ flex: 1,
234
+ backgroundColor: "#ecf0f1",
235
+ padding: "20px",
236
+ minHeight: "500px",
237
+ borderRadius: "4px",
238
+ border: "2px dashed #bdc3c7",
239
+ }}
240
+ >
241
+ <h2>Shopping Cart</h2>
242
+ {cart.length === 0 ? (
243
+ <p style={{ color: "#7f8c8d" }}>Drag items here to add to cart</p>
244
+ ) : (
245
+ <ul>
246
+ {cart.map((item, idx) => (
247
+ <li key={idx}>{item.name}</li>
248
+ ))}
249
+ </ul>
250
+ )}
205
251
  </DropZone>
206
252
  </div>
207
253
  );
@@ -218,59 +264,82 @@ You can have multiple drop zones and draggable items on the same page:
218
264
 
219
265
  ```tsx
220
266
  <div>
221
- <Draggable dataTransfer={{ id: "1" }} handleDragStart={() => {}}>
222
- <div>Item 1</div>
267
+ <Draggable
268
+ dataTransfer={{ id: "1", label: "Item 1" }}
269
+ handleDragStart={() => {}}
270
+ style={{
271
+ padding: "10px",
272
+ backgroundColor: "#3498db",
273
+ color: "white",
274
+ cursor: "grab",
275
+ marginBottom: "10px",
276
+ }}
277
+ >
278
+ Item 1
223
279
  </Draggable>
224
280
 
225
- <DropZone handleDropItem={(e, data) => console.log("Zone 1:", data)}>
226
- <div>Drop Zone 1</div>
281
+ <DropZone
282
+ handleDropItem={(e, data) => console.log("Zone 1:", data)}
283
+ style={{
284
+ padding: "20px",
285
+ backgroundColor: "#ecf0f1",
286
+ minHeight: "200px",
287
+ marginBottom: "10px",
288
+ borderRadius: "4px",
289
+ }}
290
+ >
291
+ Drop Zone 1
227
292
  </DropZone>
228
293
 
229
- <DropZone handleDropItem={(e, data) => console.log("Zone 2:", data)}>
230
- <div>Drop Zone 2</div>
294
+ <DropZone
295
+ handleDropItem={(e, data) => console.log("Zone 2:", data)}
296
+ style={{
297
+ padding: "20px",
298
+ backgroundColor: "#e8f8f5",
299
+ minHeight: "200px",
300
+ borderRadius: "4px",
301
+ }}
302
+ >
303
+ Drop Zone 2
231
304
  </DropZone>
232
305
  </div>
233
306
  ```
234
307
 
235
- ### Styled Drag and Drop
308
+ ### Drag with Custom Styling
236
309
 
237
- Enhance your react-drag-and-drop-kit with custom CSS:
310
+ Use the `style` prop to create visually appealing drag-and-drop experiences:
238
311
 
239
312
  ```tsx
240
- <style>{`
241
- .draggable {
242
- padding: 15px;
243
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
244
- color: white;
245
- cursor: grab;
246
- border-radius: 8px;
247
- transition: transform 0.2s;
248
- }
249
-
250
- .draggable:active {
251
- cursor: grabbing;
252
- transform: scale(1.05);
253
- }
254
-
255
- .drop-zone {
256
- border: 2px dashed #667eea;
257
- border-radius: 8px;
258
- padding: 20px;
259
- min-height: 300px;
260
- background: rgba(102, 126, 234, 0.1);
261
- }
262
- `}</style>
313
+ const draggableStyle: React.CSSProperties = {
314
+ padding: '15px',
315
+ background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
316
+ color: 'white',
317
+ cursor: 'grab',
318
+ borderRadius: '8px',
319
+ boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
320
+ transition: 'transform 0.2s, boxShadow 0.2s',
321
+ userSelect: 'none'
322
+ };
323
+
324
+ const dropZoneStyle: React.CSSProperties = {
325
+ padding: '20px',
326
+ border: '2px dashed #667eea',
327
+ borderRadius: '8px',
328
+ minHeight: '300px',
329
+ backgroundColor: 'rgba(102, 126, 234, 0.1)',
330
+ transition: 'backgroundColor 0.3s'
331
+ };
263
332
 
264
333
  <Draggable
265
334
  dataTransfer={{ id: '1' }}
266
335
  handleDragStart={() => {}}
267
- className="draggable"
336
+ style={draggableStyle}
268
337
  >
269
- <div>Drag me with style!</div>
338
+ Drag me with style!
270
339
  </Draggable>
271
340
 
272
- <DropZone handleDropItem={() => {}} className="drop-zone">
273
- <div>Styled Drop Zone</div>
341
+ <DropZone handleDropItem={() => {}} style={dropZoneStyle}>
342
+ Styled Drop Zone
274
343
  </DropZone>
275
344
  ```
276
345
 
@@ -290,6 +359,12 @@ import {
290
359
  const handleDrop: DropZoneProps["handleDropItem"] = (event, dataTransfer) => {
291
360
  console.log("Dropped:", dataTransfer);
292
361
  };
362
+
363
+ const draggableConfig: DraggableProps = {
364
+ handleDragStart: (e) => console.log("Start"),
365
+ dataTransfer: { id: "1" },
366
+ style: { cursor: "grab" },
367
+ };
293
368
  ```
294
369
 
295
370
  ## Browser Support
@@ -307,6 +382,7 @@ This library uses the HTML5 Drag and Drop API, which is supported in all modern
307
382
  - The library uses React's native event system for optimal performance
308
383
  - Drag operations are handled efficiently with minimal re-renders
309
384
  - Data transfer is serialized to JSON, so ensure your data is serializable
385
+ - Inline `style` props are recommended for better performance with frequent updates
310
386
 
311
387
  ## Contributing
312
388
 
@@ -327,10 +403,19 @@ This project is licensed under the MIT License - see the LICENSE file for detail
327
403
  **Sanket Kakad**
328
404
 
329
405
  - GitHub: [@sanketskakad](https://github.com/sanketskakad)
330
- - Repository: [react-drag-and-drop-kit](https://github.com/sanketskakad/react-drag-and-drop-kit)
406
+ - Repository: [react-drag-and-drop-kit](https://github.com/sanketskakad/react-drag-and-drop)
331
407
 
332
408
  ## Changelog
333
409
 
410
+ ### Version 1.0.0
411
+
412
+ - ✨ Added `style` prop to both `Draggable` and `DropZone` components
413
+ - ✨ Made `children` and `dataTransfer` optional in component props
414
+ - 🎨 Improved styling flexibility with built-in React CSS properties support
415
+ - 📦 Package renamed to `react-drag-and-drop-kit` for clarity
416
+ - 📝 Enhanced documentation with type definitions
417
+ - 🚀 First major stable release
418
+
334
419
  ### Version 0.0.0
335
420
 
336
421
  Initial release with:
@@ -343,17 +428,23 @@ Initial release with:
343
428
  ## FAQ
344
429
 
345
430
  **Q: Can I drag multiple items at once?**
346
- A: The current version handles single-item dragging. For multi-item selection, you can manage state in your parent component and transfer a reference to multiple items in the `dataTransfer` object.
431
+ A: The current version handles single-element dragging. However, you can transfer multiple item references through the `dataTransfer` object by encoding them as comma-separated strings or JSON.
347
432
 
348
433
  **Q: Can I customize the drag ghost image?**
349
434
  A: Yes, you can use the `setDragImage` method in the `handleDragStart` callback on the drag event.
350
435
 
436
+ **Q: How do I apply custom styles to draggable and drop zone elements?**
437
+ A: Use the `style` prop on both `Draggable` and `DropZone` components. It accepts standard React CSS properties (`React.CSSProperties`).
438
+
351
439
  **Q: Is there any CSS required?**
352
- A: No, the library requires no CSS. However, you may want to add cursor styles and visual feedback for better UX.
440
+ A: No, the library requires no CSS. The `style` prop allows you to add all necessary visual feedback for better UX.
353
441
 
354
442
  **Q: What data types can I transfer?**
355
443
  A: The `dataTransfer` object should contain string values. Convert complex types to JSON strings if needed.
356
444
 
445
+ **Q: Can I use the style prop with CSS-in-JS libraries?**
446
+ A: Yes, the `style` prop accepts any valid `React.CSSProperties` object, making it compatible with styled-components, emotion, and other CSS-in-JS solutions.
447
+
357
448
  ## Support
358
449
 
359
- If you have any questions or issues, please open an issue on the [GitHub repository](https://github.com/sanketskakad/react-drag-and-drop-kit/issues).
450
+ If you have any questions or issues, please open an issue on the [GitHub repository](https://github.com/sanketskakad/react-drag-and-drop/issues).
package/dist/index.d.ts CHANGED
@@ -5,18 +5,20 @@ export declare interface DataTransferInterface {
5
5
  [key: string]: string;
6
6
  }
7
7
 
8
- export declare function Draggable({ children, handleDragStart, dataTransfer }: DraggableProps): JSX.Element;
8
+ export declare function Draggable({ children, handleDragStart, dataTransfer, style }: DraggableProps): JSX.Element;
9
9
 
10
10
  export declare type DraggableProps = {
11
- children: ReactNode;
11
+ children?: ReactNode;
12
+ style?: React.CSSProperties;
12
13
  handleDragStart: (event: React.DragEvent<HTMLDivElement>) => void;
13
- dataTransfer: DataTransferInterface;
14
+ dataTransfer?: DataTransferInterface;
14
15
  };
15
16
 
16
- export declare function DropZone({ children, handleDropItem }: DropZoneProps): JSX.Element;
17
+ export declare function DropZone({ children, handleDropItem, style }: DropZoneProps): JSX.Element;
17
18
 
18
19
  export declare type DropZoneProps = {
19
- children: ReactNode;
20
+ children?: ReactNode;
21
+ style?: React.CSSProperties;
20
22
  handleDropItem: (e: React.DragEvent<HTMLDivElement>, dataTransfer: DataTransferInterface) => void;
21
23
  };
22
24
 
@@ -4,29 +4,29 @@ var Y;
4
4
  function re() {
5
5
  if (Y) return E;
6
6
  Y = 1;
7
- var l = /* @__PURE__ */ Symbol.for("react.transitional.element"), i = /* @__PURE__ */ Symbol.for("react.fragment");
8
- function c(s, o, u) {
9
- var d = null;
10
- if (u !== void 0 && (d = "" + u), o.key !== void 0 && (d = "" + o.key), "key" in o) {
11
- u = {};
12
- for (var m in o)
13
- m !== "key" && (u[m] = o[m]);
14
- } else u = o;
15
- return o = u.ref, {
16
- $$typeof: l,
17
- type: s,
18
- key: d,
19
- ref: o !== void 0 ? o : null,
20
- props: u
7
+ var u = /* @__PURE__ */ Symbol.for("react.transitional.element"), i = /* @__PURE__ */ Symbol.for("react.fragment");
8
+ function l(c, a, s) {
9
+ var f = null;
10
+ if (s !== void 0 && (f = "" + s), a.key !== void 0 && (f = "" + a.key), "key" in a) {
11
+ s = {};
12
+ for (var m in a)
13
+ m !== "key" && (s[m] = a[m]);
14
+ } else s = a;
15
+ return a = s.ref, {
16
+ $$typeof: u,
17
+ type: c,
18
+ key: f,
19
+ ref: a !== void 0 ? a : null,
20
+ props: s
21
21
  };
22
22
  }
23
- return E.Fragment = i, E.jsx = c, E.jsxs = c, E;
23
+ return E.Fragment = i, E.jsx = l, E.jsxs = l, E;
24
24
  }
25
25
  var _ = {};
26
26
  var $;
27
27
  function te() {
28
28
  return $ || ($ = 1, process.env.NODE_ENV !== "production" && (function() {
29
- function l(e) {
29
+ function u(e) {
30
30
  if (e == null) return null;
31
31
  if (typeof e == "function")
32
32
  return e.$$typeof === H ? null : e.displayName || e.name || null;
@@ -59,11 +59,11 @@ function te() {
59
59
  var r = e.render;
60
60
  return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
61
61
  case Z:
62
- return r = e.displayName || null, r !== null ? r : l(e.type) || "Memo";
62
+ return r = e.displayName || null, r !== null ? r : u(e.type) || "Memo";
63
63
  case T:
64
64
  r = e._payload, e = e._init;
65
65
  try {
66
- return l(e(r));
66
+ return u(e(r));
67
67
  } catch {
68
68
  }
69
69
  }
@@ -72,7 +72,7 @@ function te() {
72
72
  function i(e) {
73
73
  return "" + e;
74
74
  }
75
- function c(e) {
75
+ function l(e) {
76
76
  try {
77
77
  i(e);
78
78
  var r = !1;
@@ -81,33 +81,33 @@ function te() {
81
81
  }
82
82
  if (r) {
83
83
  r = console;
84
- var t = r.error, a = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
84
+ var t = r.error, n = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
85
85
  return t.call(
86
86
  r,
87
87
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
88
- a
88
+ n
89
89
  ), i(e);
90
90
  }
91
91
  }
92
- function s(e) {
92
+ function c(e) {
93
93
  if (e === b) return "<>";
94
94
  if (typeof e == "object" && e !== null && e.$$typeof === T)
95
95
  return "<...>";
96
96
  try {
97
- var r = l(e);
97
+ var r = u(e);
98
98
  return r ? "<" + r + ">" : "<...>";
99
99
  } catch {
100
100
  return "<...>";
101
101
  }
102
102
  }
103
- function o() {
103
+ function a() {
104
104
  var e = k.A;
105
105
  return e === null ? null : e.getOwner();
106
106
  }
107
- function u() {
107
+ function s() {
108
108
  return Error("react-stack-top-frame");
109
109
  }
110
- function d(e) {
110
+ function f(e) {
111
111
  if (j.call(e, "key")) {
112
112
  var r = Object.getOwnPropertyDescriptor(e, "key").get;
113
113
  if (r && r.isReactWarning) return !1;
@@ -127,20 +127,20 @@ function te() {
127
127
  });
128
128
  }
129
129
  function L() {
130
- var e = l(this.type);
130
+ var e = u(this.type);
131
131
  return h[e] || (h[e] = !0, console.error(
132
132
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
133
133
  )), e = this.props.ref, e !== void 0 ? e : null;
134
134
  }
135
- function M(e, r, t, a, R, S) {
136
- var n = t.ref;
135
+ function M(e, r, t, n, R, S) {
136
+ var o = t.ref;
137
137
  return e = {
138
138
  $$typeof: y,
139
139
  type: e,
140
140
  key: r,
141
141
  props: t,
142
- _owner: a
143
- }, (n !== void 0 ? n : null) !== null ? Object.defineProperty(e, "ref", {
142
+ _owner: n
143
+ }, (o !== void 0 ? o : null) !== null ? Object.defineProperty(e, "ref", {
144
144
  enumerable: !1,
145
145
  get: L
146
146
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
@@ -165,50 +165,50 @@ function te() {
165
165
  value: S
166
166
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
167
167
  }
168
- function A(e, r, t, a, R, S) {
169
- var n = r.children;
170
- if (n !== void 0)
171
- if (a)
172
- if (Q(n)) {
173
- for (a = 0; a < n.length; a++)
174
- P(n[a]);
175
- Object.freeze && Object.freeze(n);
168
+ function A(e, r, t, n, R, S) {
169
+ var o = r.children;
170
+ if (o !== void 0)
171
+ if (n)
172
+ if (Q(o)) {
173
+ for (n = 0; n < o.length; n++)
174
+ P(o[n]);
175
+ Object.freeze && Object.freeze(o);
176
176
  } else
177
177
  console.error(
178
178
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
179
179
  );
180
- else P(n);
180
+ else P(o);
181
181
  if (j.call(r, "key")) {
182
- n = l(e);
183
- var f = Object.keys(r).filter(function(K) {
182
+ o = u(e);
183
+ var d = Object.keys(r).filter(function(K) {
184
184
  return K !== "key";
185
185
  });
186
- a = 0 < f.length ? "{key: someKey, " + f.join(": ..., ") + ": ...}" : "{key: someKey}", C[n + a] || (f = 0 < f.length ? "{" + f.join(": ..., ") + ": ...}" : "{}", console.error(
186
+ n = 0 < d.length ? "{key: someKey, " + d.join(": ..., ") + ": ...}" : "{key: someKey}", C[o + n] || (d = 0 < d.length ? "{" + d.join(": ..., ") + ": ...}" : "{}", console.error(
187
187
  `A props object containing a "key" prop is being spread into JSX:
188
188
  let props = %s;
189
189
  <%s {...props} />
190
190
  React keys must be passed directly to JSX without using spread:
191
191
  let props = %s;
192
192
  <%s key={someKey} {...props} />`,
193
- a,
194
193
  n,
195
- f,
196
- n
197
- ), C[n + a] = !0);
194
+ o,
195
+ d,
196
+ o
197
+ ), C[o + n] = !0);
198
198
  }
199
- if (n = null, t !== void 0 && (c(t), n = "" + t), d(r) && (c(r.key), n = "" + r.key), "key" in r) {
199
+ if (o = null, t !== void 0 && (l(t), o = "" + t), f(r) && (l(r.key), o = "" + r.key), "key" in r) {
200
200
  t = {};
201
201
  for (var g in r)
202
202
  g !== "key" && (t[g] = r[g]);
203
203
  } else t = r;
204
- return n && m(
204
+ return o && m(
205
205
  t,
206
206
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
207
207
  ), M(
208
208
  e,
209
- n,
209
+ o,
210
210
  t,
211
- o(),
211
+ a(),
212
212
  R,
213
213
  S
214
214
  );
@@ -229,27 +229,27 @@ React keys must be passed directly to JSX without using spread:
229
229
  };
230
230
  var w, h = {}, N = v.react_stack_bottom_frame.bind(
231
231
  v,
232
- u
233
- )(), D = O(s(u)), C = {};
232
+ s
233
+ )(), D = O(c(s)), C = {};
234
234
  _.Fragment = b, _.jsx = function(e, r, t) {
235
- var a = 1e4 > k.recentlyCreatedOwnerStacks++;
235
+ var n = 1e4 > k.recentlyCreatedOwnerStacks++;
236
236
  return A(
237
237
  e,
238
238
  r,
239
239
  t,
240
240
  !1,
241
- a ? Error("react-stack-top-frame") : N,
242
- a ? O(s(e)) : D
241
+ n ? Error("react-stack-top-frame") : N,
242
+ n ? O(c(e)) : D
243
243
  );
244
244
  }, _.jsxs = function(e, r, t) {
245
- var a = 1e4 > k.recentlyCreatedOwnerStacks++;
245
+ var n = 1e4 > k.recentlyCreatedOwnerStacks++;
246
246
  return A(
247
247
  e,
248
248
  r,
249
249
  t,
250
250
  !0,
251
- a ? Error("react-stack-top-frame") : N,
252
- a ? O(s(e)) : D
251
+ n ? Error("react-stack-top-frame") : N,
252
+ n ? O(c(e)) : D
253
253
  );
254
254
  };
255
255
  })()), _;
@@ -259,19 +259,19 @@ function ae() {
259
259
  return I || (I = 1, process.env.NODE_ENV === "production" ? p.exports = re() : p.exports = te()), p.exports;
260
260
  }
261
261
  var F = ae();
262
- function oe({ children: l, handleDragStart: i, dataTransfer: c }) {
263
- const s = (o) => {
264
- o.dataTransfer.setData("dataTransfer", JSON.stringify(c)), i(o);
262
+ function oe({ children: u, handleDragStart: i, dataTransfer: l, style: c }) {
263
+ const a = (s) => {
264
+ s.dataTransfer.setData("dataTransfer", JSON.stringify(l)), i(s);
265
265
  };
266
- return /* @__PURE__ */ F.jsx("div", { draggable: "true", onDragStart: s, children: l });
266
+ return /* @__PURE__ */ F.jsx("div", { style: c, draggable: "true", onDragStart: a, children: u });
267
267
  }
268
- function se({ children: l, handleDropItem: i }) {
269
- const c = (s) => {
270
- s.preventDefault();
271
- const o = s.dataTransfer.getData("dataTransfer"), u = JSON.parse(o);
272
- i(s, u);
268
+ function se({ children: u, handleDropItem: i, style: l }) {
269
+ const c = (a) => {
270
+ a.preventDefault();
271
+ const s = a.dataTransfer.getData("dataTransfer"), f = JSON.parse(s);
272
+ i(a, f);
273
273
  };
274
- return /* @__PURE__ */ F.jsx("div", { onDragOver: (s) => s.preventDefault(), onDrop: c, children: l });
274
+ return /* @__PURE__ */ F.jsx("div", { style: l, onDragOver: (a) => a.preventDefault(), onDrop: c, children: u });
275
275
  }
276
276
  export {
277
277
  oe as Draggable,
@@ -1,6 +1,6 @@
1
- (function(i,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],m):(i=typeof globalThis<"u"?globalThis:i||self,m(i.DragAndDropKit={},i.React))})(this,(function(i,m){"use strict";var v={exports:{}},E={};var P;function W(){if(P)return E;P=1;var l=Symbol.for("react.transitional.element"),f=Symbol.for("react.fragment");function c(s,o,u){var p=null;if(u!==void 0&&(p=""+u),o.key!==void 0&&(p=""+o.key),"key"in o){u={};for(var b in o)b!=="key"&&(u[b]=o[b])}else u=o;return o=u.ref,{$$typeof:l,type:s,key:p,ref:o!==void 0?o:null,props:u}}return E.Fragment=f,E.jsx=c,E.jsxs=c,E}var _={};var j;function J(){return j||(j=1,process.env.NODE_ENV!=="production"&&(function(){function l(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ae?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case g:return"Fragment";case B:return"Profiler";case Z:return"StrictMode";case ee:return"Suspense";case re:return"SuspenseList";case ne:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case X:return"Portal";case Q:return e.displayName||"Context";case H:return(e._context.displayName||"Context")+".Consumer";case K:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case te:return r=e.displayName||null,r!==null?r:l(e.type)||"Memo";case k:r=e._payload,e=e._init;try{return l(e(r))}catch{}}return null}function f(e){return""+e}function c(e){try{f(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,n=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",n),f(e)}}function s(e){if(e===g)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===k)return"<...>";try{var r=l(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function o(){var e=O.A;return e===null?null:e.getOwner()}function u(){return Error("react-stack-top-frame")}function p(e){if(Y.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function b(e,r){function t(){I||(I=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function z(){var e=l(this.type);return $[e]||($[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function G(e,r,t,n,T,y){var a=t.ref;return e={$$typeof:C,type:e,key:r,props:t,_owner:n},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:z}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:T}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:y}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function w(e,r,t,n,T,y){var a=r.children;if(a!==void 0)if(n)if(oe(a)){for(n=0;n<a.length;n++)N(a[n]);Object.freeze&&Object.freeze(a)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else N(a);if(Y.call(r,"key")){a=l(e);var d=Object.keys(r).filter(function(se){return se!=="key"});n=0<d.length?"{key: someKey, "+d.join(": ..., ")+": ...}":"{key: someKey}",L[a+n]||(d=0<d.length?"{"+d.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ (function(i,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],E):(i=typeof globalThis<"u"?globalThis:i||self,E(i.DragAndDropKit={},i.React))})(this,(function(i,E){"use strict";var v={exports:{}},_={};var P;function W(){if(P)return _;P=1;var u=Symbol.for("react.transitional.element"),f=Symbol.for("react.fragment");function l(c,n,s){var d=null;if(s!==void 0&&(d=""+s),n.key!==void 0&&(d=""+n.key),"key"in n){s={};for(var b in n)b!=="key"&&(s[b]=n[b])}else s=n;return n=s.ref,{$$typeof:u,type:c,key:d,ref:n!==void 0?n:null,props:s}}return _.Fragment=f,_.jsx=l,_.jsxs=l,_}var p={};var j;function J(){return j||(j=1,process.env.NODE_ENV!=="production"&&(function(){function u(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ae?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case g:return"Fragment";case B:return"Profiler";case Z:return"StrictMode";case ee:return"Suspense";case re:return"SuspenseList";case ne:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case X:return"Portal";case Q:return e.displayName||"Context";case H:return(e._context.displayName||"Context")+".Consumer";case K:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case te:return r=e.displayName||null,r!==null?r:u(e.type)||"Memo";case k:r=e._payload,e=e._init;try{return u(e(r))}catch{}}return null}function f(e){return""+e}function l(e){try{f(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,a=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",a),f(e)}}function c(e){if(e===g)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===k)return"<...>";try{var r=u(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function n(){var e=O.A;return e===null?null:e.getOwner()}function s(){return Error("react-stack-top-frame")}function d(e){if(Y.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function b(e,r){function t(){I||(I=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function z(){var e=u(this.type);return $[e]||($[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function G(e,r,t,a,T,y){var o=t.ref;return e={$$typeof:C,type:e,key:r,props:t,_owner:a},(o!==void 0?o:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:z}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:T}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:y}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function w(e,r,t,a,T,y){var o=r.children;if(o!==void 0)if(a)if(oe(o)){for(a=0;a<o.length;a++)N(o[a]);Object.freeze&&Object.freeze(o)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else N(o);if(Y.call(r,"key")){o=u(e);var m=Object.keys(r).filter(function(se){return se!=="key"});a=0<m.length?"{key: someKey, "+m.join(": ..., ")+": ...}":"{key: someKey}",L[o+a]||(m=0<m.length?"{"+m.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,n,a,d,a),L[a+n]=!0)}if(a=null,t!==void 0&&(c(t),a=""+t),p(r)&&(c(r.key),a=""+r.key),"key"in r){t={};for(var A in r)A!=="key"&&(t[A]=r[A])}else t=r;return a&&b(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),G(e,a,t,o(),T,y)}function N(e){D(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===k&&(e._payload.status==="fulfilled"?D(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function D(e){return typeof e=="object"&&e!==null&&e.$$typeof===C}var R=m,C=Symbol.for("react.transitional.element"),X=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),Z=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),H=Symbol.for("react.consumer"),Q=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),te=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),ne=Symbol.for("react.activity"),ae=Symbol.for("react.client.reference"),O=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,oe=Array.isArray,S=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(e){return e()}};var I,$={},F=R.react_stack_bottom_frame.bind(R,u)(),M=S(s(u)),L={};_.Fragment=g,_.jsx=function(e,r,t){var n=1e4>O.recentlyCreatedOwnerStacks++;return w(e,r,t,!1,n?Error("react-stack-top-frame"):F,n?S(s(e)):M)},_.jsxs=function(e,r,t){var n=1e4>O.recentlyCreatedOwnerStacks++;return w(e,r,t,!0,n?Error("react-stack-top-frame"):F,n?S(s(e)):M)}})()),_}var h;function U(){return h||(h=1,process.env.NODE_ENV==="production"?v.exports=W():v.exports=J()),v.exports}var x=U();function q({children:l,handleDragStart:f,dataTransfer:c}){const s=o=>{o.dataTransfer.setData("dataTransfer",JSON.stringify(c)),f(o)};return x.jsx("div",{draggable:"true",onDragStart:s,children:l})}function V({children:l,handleDropItem:f}){const c=s=>{s.preventDefault();const o=s.dataTransfer.getData("dataTransfer"),u=JSON.parse(o);f(s,u)};return x.jsx("div",{onDragOver:s=>s.preventDefault(),onDrop:c,children:l})}i.Draggable=q,i.DropZone=V,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
6
+ <%s key={someKey} {...props} />`,a,o,m,o),L[o+a]=!0)}if(o=null,t!==void 0&&(l(t),o=""+t),d(r)&&(l(r.key),o=""+r.key),"key"in r){t={};for(var A in r)A!=="key"&&(t[A]=r[A])}else t=r;return o&&b(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),G(e,o,t,n(),T,y)}function N(e){D(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===k&&(e._payload.status==="fulfilled"?D(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function D(e){return typeof e=="object"&&e!==null&&e.$$typeof===C}var R=E,C=Symbol.for("react.transitional.element"),X=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),Z=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),H=Symbol.for("react.consumer"),Q=Symbol.for("react.context"),K=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),te=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),ne=Symbol.for("react.activity"),ae=Symbol.for("react.client.reference"),O=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,oe=Array.isArray,S=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(e){return e()}};var I,$={},F=R.react_stack_bottom_frame.bind(R,s)(),M=S(c(s)),L={};p.Fragment=g,p.jsx=function(e,r,t){var a=1e4>O.recentlyCreatedOwnerStacks++;return w(e,r,t,!1,a?Error("react-stack-top-frame"):F,a?S(c(e)):M)},p.jsxs=function(e,r,t){var a=1e4>O.recentlyCreatedOwnerStacks++;return w(e,r,t,!0,a?Error("react-stack-top-frame"):F,a?S(c(e)):M)}})()),p}var h;function U(){return h||(h=1,process.env.NODE_ENV==="production"?v.exports=W():v.exports=J()),v.exports}var x=U();function q({children:u,handleDragStart:f,dataTransfer:l,style:c}){const n=s=>{s.dataTransfer.setData("dataTransfer",JSON.stringify(l)),f(s)};return x.jsx("div",{style:c,draggable:"true",onDragStart:n,children:u})}function V({children:u,handleDropItem:f,style:l}){const c=n=>{n.preventDefault();const s=n.dataTransfer.getData("dataTransfer"),d=JSON.parse(s);f(n,d)};return x.jsx("div",{style:l,onDragOver:n=>n.preventDefault(),onDrop:c,children:u})}i.Draggable=q,i.DropZone=V,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "https://github.com/sanketskakad/react-drag-and-drop"
8
8
  },
9
9
  "private": false,
10
- "version": "0.0.0",
10
+ "version": "1.0.0",
11
11
  "description": "An open source, lightweight React.js library for implementing simple and flexible react-drag-and-drop functionality.",
12
12
  "keywords": [
13
13
  "react",