@startupjs-ui/draggable 0.1.5 → 0.1.16
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/CHANGELOG.md +16 -0
- package/README.mdx +35 -7
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.1.16](https://github.com/startupjs/startupjs-ui/compare/v0.1.15...v0.1.16) (2026-02-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @startupjs-ui/draggable
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.1.11](https://github.com/startupjs/startupjs-ui/compare/v0.1.10...v0.1.11) (2026-01-20)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @startupjs-ui/draggable
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [0.1.5](https://github.com/startupjs/startupjs-ui/compare/v0.1.4...v0.1.5) (2025-12-29)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @startupjs-ui/draggable
|
package/README.mdx
CHANGED
|
@@ -21,11 +21,11 @@ import './index.mdx.cssx.styl'
|
|
|
21
21
|
|
|
22
22
|
# Draggable
|
|
23
23
|
|
|
24
|
-
`Draggable` provides simple building blocks for drag
|
|
24
|
+
`Draggable` provides simple building blocks for drag and drop on React Native and React Native Web:
|
|
25
25
|
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
26
|
+
- **DragDropProvider** -- stores drag/drop state and exposes it via context
|
|
27
|
+
- **Droppable** -- marks a drop target and tracks the order of its children
|
|
28
|
+
- **Draggable** -- handles gestures and renders the dragged item into a Portal
|
|
29
29
|
|
|
30
30
|
```jsx
|
|
31
31
|
import { DragDropProvider, Droppable, Draggable } from 'startupjs-ui'
|
|
@@ -34,9 +34,37 @@ import { DragDropProvider, Droppable, Draggable } from 'startupjs-ui'
|
|
|
34
34
|
## How it works
|
|
35
35
|
|
|
36
36
|
1. Wrap the area with `DragDropProvider`.
|
|
37
|
-
2. Inside it render one or more `Droppable`
|
|
38
|
-
3. Render `Draggable`
|
|
39
|
-
4. Update your
|
|
37
|
+
2. Inside it, render one or more `Droppable` containers, each with a unique `dropId`.
|
|
38
|
+
3. Render `Draggable` items inside each `Droppable`, each with a unique `dragId`.
|
|
39
|
+
4. Update your data in the `onDragEnd` callback using `{ dragId, dropId, dropHoverId, hoverIndex }`.
|
|
40
|
+
|
|
41
|
+
## Props
|
|
42
|
+
|
|
43
|
+
### DragDropProvider
|
|
44
|
+
|
|
45
|
+
- **children** -- the content to render inside the provider
|
|
46
|
+
|
|
47
|
+
### Droppable
|
|
48
|
+
|
|
49
|
+
- **dropId** (required) -- a unique identifier for this drop target
|
|
50
|
+
- **type** -- an optional type string for filtering which draggables can be dropped here
|
|
51
|
+
- **style** -- custom styles for the droppable container
|
|
52
|
+
- **onHover** -- called when an active drag enters this droppable area
|
|
53
|
+
- **onLeave** -- called when an active drag leaves this droppable area
|
|
54
|
+
|
|
55
|
+
### Draggable
|
|
56
|
+
|
|
57
|
+
- **dragId** (required) -- a unique identifier for this draggable item
|
|
58
|
+
- **type** -- an optional type string for filtering compatible drop targets
|
|
59
|
+
- **style** -- custom styles for the draggable item
|
|
60
|
+
- **onDragBegin** -- called when the drag gesture starts; receives `{ dragId, dropId, dropHoverId, hoverIndex }`
|
|
61
|
+
- **onDragEnd** -- called when the drag gesture ends; receives `{ dragId, dropId, dropHoverId, hoverIndex }`
|
|
62
|
+
|
|
63
|
+
The callback options contain:
|
|
64
|
+
- `dragId` -- the id of the dragged item
|
|
65
|
+
- `dropId` -- the id of the droppable the item originated from
|
|
66
|
+
- `dropHoverId` -- the id of the droppable the item is currently hovering over
|
|
67
|
+
- `hoverIndex` -- the index position within the hovered droppable
|
|
40
68
|
|
|
41
69
|
## Simple example (reorder in a single list)
|
|
42
70
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs-ui/draggable",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"types": "index.d.ts",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@startupjs-ui/core": "^0.1.
|
|
12
|
-
"@startupjs-ui/portal": "^0.1.
|
|
11
|
+
"@startupjs-ui/core": "^0.1.11",
|
|
12
|
+
"@startupjs-ui/portal": "^0.1.16"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"react": "*",
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"react-native-gesture-handler": "*",
|
|
18
18
|
"startupjs": "*"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "9943aa3566d5d80f5b404473906eb3c0611f9ee5"
|
|
21
21
|
}
|