Skip to content

Commit

Permalink
feat: expose more dialog content events (#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte authored Jan 28, 2024
1 parent 9852216 commit 4439baf
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/violet-dodos-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"bits-ui": minor
---

feat: forward/expose `touch` events on `Dialog.Content` & `AlertDialog.Content` components
4 changes: 0 additions & 4 deletions src/content/api-reference/extended-types/index.d.ts

This file was deleted.

20 changes: 20 additions & 0 deletions src/lib/bits/alert-dialog/components/alert-dialog-content.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
on:pointerdown
on:pointermove
on:pointerup
on:touchend
on:touchstart
on:touchcancel
on:touchmove
{...$$restProps}
>
<slot {builder} />
Expand All @@ -59,6 +63,10 @@
on:pointerdown
on:pointermove
on:pointerup
on:touchend
on:touchstart
on:touchcancel
on:touchmove
{...$$restProps}
>
<slot {builder} />
Expand All @@ -71,6 +79,10 @@
on:pointerdown
on:pointermove
on:pointerup
on:touchend
on:touchstart
on:touchcancel
on:touchmove
{...$$restProps}
>
<slot {builder} />
Expand All @@ -83,6 +95,10 @@
on:pointerdown
on:pointermove
on:pointerup
on:touchend
on:touchstart
on:touchcancel
on:touchmove
{...$$restProps}
>
<slot {builder} />
Expand All @@ -94,6 +110,10 @@
on:pointerdown
on:pointermove
on:pointerup
on:touchend
on:touchstart
on:touchcancel
on:touchmove
{...$$restProps}
>
<slot {builder} />
Expand Down
4 changes: 4 additions & 0 deletions src/lib/bits/alert-dialog/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ type ContentEvents<T extends Element = HTMLElement> = {
pointerdown: SvelteEvent<PointerEvent, T>;
pointerup: SvelteEvent<PointerEvent, T>;
pointermove: SvelteEvent<PointerEvent, T>;
touchend: SvelteEvent<TouchEvent, T>;
touchstart: SvelteEvent<TouchEvent, T>;
touchcancel: SvelteEvent<TouchEvent, T>;
touchmove: SvelteEvent<TouchEvent, T>;
};

type ActionEvents = TriggerEvents;
Expand Down
20 changes: 20 additions & 0 deletions src/lib/bits/dialog/components/dialog-content.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
on:pointerdown
on:pointermove
on:pointerup
on:touchend
on:touchstart
on:touchcancel
on:touchmove
>
<slot {builder} />
</div>
Expand All @@ -60,6 +64,10 @@
on:pointerdown
on:pointermove
on:pointerup
on:touchend
on:touchstart
on:touchcancel
on:touchmove
{...$$restProps}
>
<slot {builder} />
Expand All @@ -72,6 +80,10 @@
on:pointerdown
on:pointermove
on:pointerup
on:touchend
on:touchstart
on:touchcancel
on:touchmove
{...$$restProps}
>
<slot {builder} />
Expand All @@ -84,6 +96,10 @@
on:pointerdown
on:pointermove
on:pointerup
on:touchend
on:touchstart
on:touchcancel
on:touchmove
{...$$restProps}
>
<slot {builder} />
Expand All @@ -95,6 +111,10 @@
on:pointerdown
on:pointermove
on:pointerup
on:touchend
on:touchstart
on:touchcancel
on:touchmove
{...$$restProps}
>
<slot {builder} />
Expand Down
4 changes: 4 additions & 0 deletions src/lib/bits/dialog/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ type ContentEvents<T extends Element = HTMLElement> = {
pointerdown: SvelteEvent<PointerEvent, T>;
pointerup: SvelteEvent<PointerEvent, T>;
pointermove: SvelteEvent<PointerEvent, T>;
touchend: SvelteEvent<TouchEvent, T>;
touchstart: SvelteEvent<TouchEvent, T>;
touchcancel: SvelteEvent<TouchEvent, T>;
touchmove: SvelteEvent<TouchEvent, T>;
};

type TriggerEvents<T extends Element = HTMLButtonElement> = {
Expand Down

0 comments on commit 4439baf

Please sign in to comment.