chore: lift components folder

This commit is contained in:
Eric Liu 2020-07-19 09:06:08 -07:00
commit 2200b29b92
301 changed files with 57 additions and 76 deletions

35
src/Tile/TileGroup.svelte Normal file
View file

@ -0,0 +1,35 @@
<script>
export let selected = undefined;
export let disabled = false;
export let legend = "";
import { createEventDispatcher, setContext } from "svelte";
import { writable } from "svelte/store";
const dispatch = createEventDispatcher();
const selectedValue = writable(selected);
setContext("TileGroup", {
selectedValue,
add: ({ checked, value }) => {
if (checked) {
selectedValue.set(value);
}
},
update: value => {
selectedValue.set(value);
}
});
$: selected = $selectedValue;
$: dispatch("select", $selectedValue);
</script>
<fieldset {disabled} class:bx--tile-group={true} {...$$restProps}>
{#if legend}
<legend class:bx--label={true}>{legend}</legend>
{/if}
<div>
<slot />
</div>
</fieldset>