refactor(tile): forward events, inline functions

Supports #7, #34

- Forward events, style prop
- Remove unneeded dispatched events
- Remove exported props
This commit is contained in:
Eric Liu 2019-12-20 04:16:50 -08:00
commit a828218d15
9 changed files with 87 additions and 75 deletions

View file

@ -7,9 +7,9 @@
export let name = '';
export let iconDescription = 'Tile checkmark';
export let value = '';
export let tabIndex = 0;
export let tabindex = '0';
export let light = false;
export let props = {};
export let style = undefined;
import { createEventDispatcher } from 'svelte';
import CheckmarkFilled16 from 'carbon-icons-svelte/lib/CheckmarkFilled16';
@ -40,7 +40,6 @@
</script>
<input
{...props}
type="radio"
class={cx('--tile-input')}
on:change
@ -49,7 +48,17 @@
{name}
{value}
{checked} />
<label for={id} class={_class} tabindex={tabIndex} on:keydown={handleKeyDown}>
<label
for={id}
class={_class}
on:click
on:mouseover
on:mouseenter
on:mouseleave
on:keydown
on:keydown={handleKeyDown}
{tabindex}
{style}>
<span class={cx('--tile__checkmark')}>
<CheckmarkFilled16 aria-label={iconDescription} title={iconDescription} />
</span>