feat(components): add StructuredList

Closes #27
This commit is contained in:
Eric Liu 2019-12-21 18:59:09 -08:00
commit d326bf1fce
12 changed files with 341 additions and 0 deletions

View file

@ -0,0 +1,37 @@
<script>
let className = undefined;
export { className as class };
export let id = Math.random();
export let value = 'value';
export let title = 'title';
export let name = '';
export let checked = false;
export let style = undefined;
import { getContext } from 'svelte';
import { cx } from '../../lib';
const _class = cx('--structured-list-input', className);
const { selected, update } = getContext('StructuredListWrapper');
if (checked) {
update(value);
}
$: checked = $selected === value;
</script>
<input
type="radio"
tabindex="-1"
class={_class}
on:change={() => {
update(value);
}}
{value}
{name}
{title}
{style}
{id}
{checked} />