Skip to content

Commit

Permalink
Add click event listener type to Menubar.Item Events (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte authored Aug 26, 2023
1 parent 2f281dd commit f4dbdc5
Show file tree
Hide file tree
Showing 7 changed files with 1,524 additions and 1,585 deletions.
5 changes: 5 additions & 0 deletions .changeset/rich-brooms-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"bits-ui": patch
---

Add `click` event listener type to `Menubar.Item` Events
27 changes: 13 additions & 14 deletions src/app.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>

<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>

<body data-sveltekit-preload-data="hover" class="bg-background antialiased font-sans overflow-y-scroll">
<div>
%sveltekit.body%
</div>
</body>

</html>
<body
data-sveltekit-preload-data="hover"
class="bg-background antialiased font-sans overflow-y-scroll"
>
<div>%sveltekit.body%</div>
</body>
</html>
6 changes: 2 additions & 4 deletions src/components/ui/badge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ export const badgeVariants = tv({
base: "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
variants: {
variant: {
default:
"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
secondary:
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
default: "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
destructive:
"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
outline: "text-foreground"
Expand Down
5 changes: 1 addition & 4 deletions src/components/ui/form/form-message.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
</script>

{#if $errors}
<p
class={cn("text-[0.8rem] font-medium text-destructive", className)}
id={formMessageId}
>
<p class={cn("text-[0.8rem] font-medium text-destructive", className)} id={formMessageId}>
{$errors}
</p>
{/if}
5 changes: 2 additions & 3 deletions src/lib/bits/menubar/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ type ArrowProps = Expand<
HTMLDivAttributes;

type ItemEvents<T extends Element = HTMLDivElement> = {
click: CustomEventHandler<PointerEvent, T>;
focusin: CustomEventHandler<FocusEvent, T>;
focusout: CustomEventHandler<FocusEvent, T>;
keydown: CustomEventHandler<KeyboardEvent, T>;
Expand All @@ -115,9 +116,7 @@ type ItemEvents<T extends Element = HTMLDivElement> = {
};

type SubTriggerEvents<T extends Element = HTMLDivElement> = Expand<
Omit<ItemEvents<T>, "pointerdown"> & {
click: CustomEventHandler<MouseEvent, T>;
}
Omit<ItemEvents<T>, "pointerdown">
>;

type CheckboxItemEvents = ItemEvents;
Expand Down
Loading

0 comments on commit f4dbdc5

Please sign in to comment.