Skip to content

Commit

Permalink
fix: correct item events (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte authored Nov 14, 2023
1 parent 9cfca74 commit 268cf30
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/happy-tomatoes-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"bits-ui": patch
---

fix: correct item events
3 changes: 1 addition & 2 deletions src/lib/bits/toggle-group/components/ToggleGroup.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<script lang="ts">
import { melt } from "@melt-ui/svelte";
import { setCtx, getAttrs } from "../ctx.js";
import type { Events, Props } from "../types.js";
import type { Props } from "../types.js";
type T = $$Generic<"single" | "multiple">;
type $$Props = Props<T>;
type $$Events = Events;
export let kind: $$Props["kind"] = "single" as T;
export let disabled: $$Props["disabled"] = undefined;
export let loop: $$Props["loop"] = undefined;
Expand Down
5 changes: 3 additions & 2 deletions src/lib/bits/toggle-group/components/ToggleGroupItem.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<script lang="ts">
import { melt } from "@melt-ui/svelte";
import { getCtx, getAttrs } from "../ctx";
import type { ItemProps } from "../types";
import { getCtx, getAttrs } from "../ctx.js";
import type { ItemProps, ItemEvents } from "../types.js";
import { createDispatcher } from "$lib/internal";
type $$Props = ItemProps;
type $$Events = ItemEvents;
export let value: $$Props["value"];
export let disabled: $$Props["disabled"] = false;
Expand Down
6 changes: 3 additions & 3 deletions src/lib/bits/toggle-group/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type ItemProps = {
} & AsChild &
HTMLButtonAttributes;

type Events<T extends Element = HTMLButtonElement> = {
type ItemEvents<T extends Element = HTMLButtonElement> = {
click: CustomEventHandler<MouseEvent, T>;
keydown: CustomEventHandler<KeyboardEvent, T>;
};
Expand All @@ -37,7 +37,7 @@ export type {
Props as ToggleGroupProps,
ItemProps as ToggleGroupItemProps,
//
Events,
ItemEvents,
//
Events as ToggleGroupEvents
ItemEvents as ToggleGroupItemEvents
};

0 comments on commit 268cf30

Please sign in to comment.