mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 10:51:06 +00:00
chore: lift components folder
This commit is contained in:
parent
76df51674d
commit
2200b29b92
301 changed files with 57 additions and 76 deletions
|
@ -1,56 +0,0 @@
|
|||
<script>
|
||||
export let expanded = false;
|
||||
export let href = "/";
|
||||
export let text = undefined;
|
||||
export let iconDescription = "Expand/Collapse";
|
||||
|
||||
import ChevronDown16 from "carbon-icons-svelte/lib/ChevronDown16";
|
||||
|
||||
let ref = null;
|
||||
</script>
|
||||
|
||||
<svelte:window
|
||||
on:mouseup={({ target }) => {
|
||||
if (ref.contains(target) || target === ref) {
|
||||
expanded = !expanded;
|
||||
} else {
|
||||
if (expanded) {
|
||||
expanded = false;
|
||||
}
|
||||
}
|
||||
}} />
|
||||
|
||||
<li class:bx--header__submenu={true} title={iconDescription}>
|
||||
<a
|
||||
bind:this={ref}
|
||||
role="menuitem"
|
||||
tabindex="0"
|
||||
aria-haspopup="menu"
|
||||
aria-expanded={expanded}
|
||||
aria-label={text}
|
||||
{href}
|
||||
class:bx--header__menu-item={true}
|
||||
class:bx--header__menu-title={true}
|
||||
{...$$restProps}
|
||||
on:keydown
|
||||
on:keydown={({ key }) => {
|
||||
if (key === 'Enter') {
|
||||
expanded = !expanded;
|
||||
}
|
||||
}}
|
||||
on:click|preventDefault
|
||||
on:mouseover
|
||||
on:mouseenter
|
||||
on:mouseleave
|
||||
on:keyup
|
||||
on:focus
|
||||
on:blur>
|
||||
{text}
|
||||
<ChevronDown16
|
||||
aria-label={iconDescription}
|
||||
class="bx--header__menu-arrow" />
|
||||
</a>
|
||||
<ul role="menu" aria-label={text} class:bx--header__menu={true}>
|
||||
<slot />
|
||||
</ul>
|
||||
</li>
|
Loading…
Add table
Add a link
Reference in a new issue