Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 0 additions & 58 deletions .changeset/metal-mice-develop.md

This file was deleted.

59 changes: 59 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,64 @@
# @dnd-kit/core

## 6.3.0

### Minor Changes

- [#1539](https://github.com/clauderic/dnd-kit/pull/1539) [`0c6a28d`](https://github.com/clauderic/dnd-kit/commit/0c6a28d1b32c72cfbc6e103c9f430a1e8ebe7301) Thanks [@irobot](https://github.com/irobot)! - Make it possible to add visual cues when using activation constraints.

### Context

Activation constraints are used when we want to prevent accidental dragging or when
pointer press can mean more than "start dragging".

A typical use case is a button that needs to respond to both "click" and "drag" gestures.
Clicks can be distinguished from drags based on how long the pointer was
held pressed.

### The problem

A control that responds differently to a pointer press based on duration or distance can
be confusing to use -- the user has to guess how long to keep holding or how far to keep
dragging until their intent is acknowledged.

Implementing such cues is currently possible by attaching extra event listeners so that
we know when a drag is pending. Furthermore, the listener needs to have access to
the same constraints that were applied to the sensor initiating the drag. This can be
made to work in simple cases, but it becomes error-prone and difficult to maintain in
complex scenarios.

### Solution

This changeset proposes the addition of two new events: `onDragPending` and `onDragAbort`.

#### `onDragPending`

A drag is considered to be pending when the pointer has been pressed and there are
activation constraints that need to be satisfied before a drag can start.

This event is initially fired on pointer press. At this time `offset` (see below) will be
`undefined`.

It will subsequently be fired every time the pointer is moved. This is to enable
visual cues for distance-based activation.

The event's payload contains all the information necessary for providing visual feedback:

```typescript
export interface DragPendingEvent {
id: UniqueIdentifier;
constraint: PointerActivationConstraint;
initialCoordinates: Coordinates;
offset?: Coordinates | undefined;
}
```

#### `onDragAbort`

A drag is considered aborted when an activation constraint for a pending drag was violated.
Useful as a prompt to cancel any visual cue animations currently in progress.
Note that this event will _not_ be fired when dragging ends or is canceled.

## 6.2.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dnd-kit/core",
"version": "6.2.0",
"version": "6.3.0",
"description": "dnd kit – a lightweight React library for building performant and accessible drag and drop experiences",
"author": "Claudéric Demers",
"license": "MIT",
Expand Down
7 changes: 7 additions & 0 deletions packages/modifiers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @dnd-kit/modifiers

## 9.0.0

### Patch Changes

- Updated dependencies [[`0c6a28d`](https://github.com/clauderic/dnd-kit/commit/0c6a28d1b32c72cfbc6e103c9f430a1e8ebe7301)]:
- @dnd-kit/core@6.3.0

## 8.0.0

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/modifiers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dnd-kit/modifiers",
"version": "8.0.0",
"version": "9.0.0",
"description": "Translate modifier presets for use with `@dnd-kit` packages.",
"author": "Claudéric Demers",
"license": "MIT",
Expand Down Expand Up @@ -30,11 +30,11 @@
"tslib": "^2.0.0"
},
"peerDependencies": {
"@dnd-kit/core": "^6.2.0",
"@dnd-kit/core": "^6.3.0",
"react": ">=16.8.0"
},
"devDependencies": {
"@dnd-kit/core": "^6.2.0"
"@dnd-kit/core": "^6.3.0"
},
"publishConfig": {
"access": "public"
Expand Down
7 changes: 7 additions & 0 deletions packages/sortable/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @dnd-kit/sortable

## 10.0.0

### Patch Changes

- Updated dependencies [[`0c6a28d`](https://github.com/clauderic/dnd-kit/commit/0c6a28d1b32c72cfbc6e103c9f430a1e8ebe7301)]:
- @dnd-kit/core@6.3.0

## 9.0.0

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/sortable/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dnd-kit/sortable",
"version": "9.0.0",
"version": "10.0.0",
"description": "Official sortable preset and sensors for dnd kit",
"author": "Claudéric Demers",
"license": "MIT",
Expand Down Expand Up @@ -31,10 +31,10 @@
},
"peerDependencies": {
"react": ">=16.8.0",
"@dnd-kit/core": "^6.2.0"
"@dnd-kit/core": "^6.3.0"
},
"devDependencies": {
"@dnd-kit/core": "^6.2.0"
"@dnd-kit/core": "^6.3.0"
},
"publishConfig": {
"access": "public"
Expand Down