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

View file

@ -0,0 +1,54 @@
<script>
export let value = "";
export let name = undefined;
export let disabled = false;
export let iconDescription = "Open list of options";
export let id = "ccs-" + Math.random().toString(36);
export let labelText = "";
export let hideLabel = true;
import { setContext } from "svelte";
import { writable } from "svelte/store";
import ChevronDownGlyph from "carbon-icons-svelte/lib/ChevronDownGlyph";
const selectedValue = writable(value);
setContext("TimePickerSelect", { selectedValue });
$: selectedValue.set(value);
$: value = $selectedValue;
</script>
<div
class:bx--select={true}
class:bx--time-picker__select={true}
{...$$restProps}
on:click
on:mouseover
on:mouseenter
on:mouseleave>
{#if labelText}
<label
for={id}
class:bx--label={true}
class:bx--visually-hidden={hideLabel}>
{labelText}
</label>
{/if}
<!-- svelte-ignore a11y-no-onchange -->
<select
class:bx--select-input={true}
on:change={({ target }) => {
selectedValue.set(target.value);
}}
{id}
{name}
{disabled}
{value}>
<slot />
</select>
<ChevronDownGlyph
aria-label={iconDescription}
title={iconDescription}
class="bx--select__arrow" />
</div>