refactor(toggle): forward events, inline functions

Supports #7

- Forward events
- Add style prop
- Remove exported props
- Inline change, keyup functions
- Dispatch only 'toggle' event
This commit is contained in:
Eric Liu 2019-12-20 17:07:37 -08:00
commit ea39fdd4a7
4 changed files with 42 additions and 42 deletions

View file

@ -3,7 +3,7 @@
export { className as class };
export let id = undefined;
export let labelText = undefined;
export let props = {};
export let style = undefined;
import { cx } from '../../lib';
@ -11,7 +11,7 @@
const ariaLabel = labelText ? undefined : $$props['aria-label'] || 'Toggle is loading';
</script>
<div {...props} class={_class}>
<div on:click on:mouseover on:mouseenter on:mouseleave class={_class} {style}>
<input type="checkbox" class={cx('--toggle', '--toggle--small', '--skeleton')} {id} />
<label class={cx('--toggle__label --skeleton')} for={id}>
{#if labelText}