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,40 @@
<script>
export let tooltipText = "";
export let align = "center"; // "start" | "center" | "end"
export let direction = "bottom"; // "top" | "right" | "bottom" | "left"
export let id = "ccs-" + Math.random().toString(36);
export let ref = null;
$: hidden = false;
</script>
<svelte:body
on:keydown={e => {
if (e.key === 'Escape') {
hidden = true;
}
}} />
<button
bind:this={ref}
aria-describedby={id}
class:bx--tooltip__trigger={true}
class:bx--tooltip--a11y={true}
class:bx--tooltip--hidden={hidden}
class="{direction && `bx--tooltip--${direction}`}
{align && `bx--tooltip--align-${align}`}"
{...$$restProps}
on:click
on:mouseover
on:mouseenter
on:mouseenter={() => {
hidden = false;
}}
on:mouseleave
on:focus
on:focus={() => {
hidden = false;
}}>
<span {id} class:bx--assistive-text={true}>{tooltipText}</span>
<slot />
</button>