mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
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:
parent
aceadbb55c
commit
ea39fdd4a7
4 changed files with 42 additions and 42 deletions
|
@ -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}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue