Skip to content
Merged
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
8 changes: 8 additions & 0 deletions .changeset/public-pan-gesture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@astryxdesign/core': patch
'@astryxdesign/cli': patch
---

[feature] `createPanGesture(element, {axis?, onPan})` and `usePanGesture(ref, {axis?, onPan})` report a drag on an element as values: `onPan` gets `{state, translation, velocity}` as the drag begins, changes, ends at the release, or is cancelled, and a finger, a mouse and a pen all drive it. A mouse or pen drag that starts on selectable text selects it instead; give text the drag should move `user-select: none`. `axis` limits the drag to `'x'` or `'y'`; a drag along the other axis is not reported. `translation` counts from where the drag began, so an element that follows it does not jump, and `velocity` at `ended` is the release velocity in pixels per second. The drag claims its touch at UIKit's 10 pt and leaves presses and long presses alone. `destroy()` removes every listener; the hook creates one pan for the element behind `ref` and destroys it at unmount.

@vjeux
2 changes: 2 additions & 0 deletions apps/sandbox/scripts/next-export-routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@
"/templates/PaginationPageSize/",
"/templates/PaginationVariants/",
"/templates/PaginationWithTable/",
"/templates/PanPlayingCard/",
"/templates/PanPlayingCardVanilla/",
"/templates/PopoverBottomSheetAlternative/",
"/templates/PopoverConfirmAction/",
"/templates/PopoverFilterPanel/",
Expand Down
20 changes: 20 additions & 0 deletions internal/shadcn-registry/routes.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -1966,6 +1966,11 @@
"path": "examples/create-animator/playing-cards-in-plain-java-script",
"aliases": []
},
{
"name": "example-create-pan-gesture-a-playing-card-without-react",
"path": "examples/create-pan-gesture/a-playing-card-without-react",
"aliases": []
},
{
"name": "example-date-input-clearable",
"path": "examples/date-input/clearable",
Expand Down Expand Up @@ -3766,6 +3771,11 @@
"path": "examples/use-overflow/editor-toolbar",
"aliases": []
},
{
"name": "example-use-pan-gesture-a-playing-card",
"path": "examples/use-pan-gesture/a-playing-card",
"aliases": []
},
{
"name": "example-use-popover-quick-actions",
"path": "examples/use-popover/quick-actions",
Expand Down Expand Up @@ -3881,6 +3891,11 @@
"path": "hooks/create-animator",
"aliases": []
},
{
"name": "hook-create-pan-gesture",
"path": "hooks/create-pan-gesture",
"aliases": []
},
{
"name": "hook-use-animated-layout",
"path": "hooks/use-animated-layout",
Expand Down Expand Up @@ -4061,6 +4076,11 @@
"path": "hooks/use-overflow",
"aliases": []
},
{
"name": "hook-use-pan-gesture",
"path": "hooks/use-pan-gesture",
"aliases": []
},
{
"name": "hook-use-popover",
"path": "hooks/use-popover",
Expand Down
Loading
Loading