Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add mousedown and mouseup events to Button component #1491

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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: 4 additions & 4 deletions src/lib/buttons/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
color?: ButtonColor;
shadow?: boolean;
tag?: 'a' | 'button'| 'label';
tag?: 'a' | 'button'| 'label';
checked?: boolean;
}

Expand All @@ -25,7 +25,7 @@
};

type $$Props = AnchorProps | ButtonProps;

const group: SizeType = getContext('group');

export let pill: $$Props['pill'] = false;
Expand Down Expand Up @@ -139,15 +139,15 @@
</script>

{#if href && !disabled}
<a {href} {...$$restProps} class={buttonClass} role="button" on:click on:change on:keydown on:keyup on:touchstart|passive on:touchend on:touchcancel on:mouseenter on:mouseleave>
<a {href} {...$$restProps} class={buttonClass} role="button" on:click on:change on:keydown on:keyup on:touchstart|passive on:touchend on:touchcancel on:mouseenter on:mouseleave on:mouseup on:mousedown>
<slot />
</a>
{:else if tag === 'label'}
<label {...$$restProps} class={buttonClass}>
<slot />
</label>
{:else if tag === 'button' }
<button {type} {...$$restProps} {disabled} class={buttonClass} on:click on:change on:keydown on:keyup on:touchstart|passive on:touchend on:touchcancel on:mouseenter on:mouseleave>
<button {type} {...$$restProps} {disabled} class={buttonClass} on:click on:change on:keydown on:keyup on:touchstart|passive on:touchend on:touchcancel on:mouseenter on:mouseleave on:mouseup on:mousedown>
<slot />
</button>
{:else}
Expand Down