mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
Align v10.34 (#621)
* feat(theme): add g80 theme * docs(data-table): use link with icon variant * feat(search): support expandable variant * fix(file-uploaded): use semantic p element instead of strong * feat(side-nav): dispatch open, close, click:overlay events * refactor(ui-shell): remove usage of deprecated Icon component * feat(ui-shell): allow custom hamburger menu icons * feat(button): support xl size * fix(code-snippet): wrap code element with pre * refactor(button): use button specific tooltip class for icon-only variant * feat(password-input): support warning, inline props * feat(data-table): support medium size
This commit is contained in:
parent
630e19b57a
commit
f9909827d0
36 changed files with 572 additions and 197 deletions
|
@ -8,18 +8,31 @@
|
|||
/** Set to `true` to toggle the open state */
|
||||
export let isOpen = false;
|
||||
|
||||
/**
|
||||
* Specify the icon from `carbon-icons-svelte` to render for the closed state
|
||||
* Defaults to `Menu20`
|
||||
* @type {typeof import("carbon-icons-svelte").CarbonIcon}
|
||||
*/
|
||||
export let iconMenu = Menu20;
|
||||
|
||||
/**
|
||||
* Specify the icon from `carbon-icons-svelte` to render for the opened state
|
||||
* Defaults to `Close20`
|
||||
* @type {typeof import("carbon-icons-svelte").CarbonIcon}
|
||||
*/
|
||||
export let iconClose = Close20;
|
||||
|
||||
/** Obtain a reference to the HTML button element */
|
||||
export let ref = null;
|
||||
|
||||
import Close20 from "carbon-icons-svelte/lib/Close20/Close20.svelte";
|
||||
import Menu20 from "carbon-icons-svelte/lib/Menu20/Menu20.svelte";
|
||||
import { Icon } from "../../Icon";
|
||||
</script>
|
||||
|
||||
<button
|
||||
bind:this="{ref}"
|
||||
type="button"
|
||||
title="Open menu"
|
||||
title="{ariaLabel}"
|
||||
aria-label="{ariaLabel}"
|
||||
class:bx--header__action="{true}"
|
||||
class:bx--header__menu-trigger="{true}"
|
||||
|
@ -28,8 +41,5 @@
|
|||
on:click
|
||||
on:click="{() => (isOpen = !isOpen)}"
|
||||
>
|
||||
<Icon
|
||||
title="{isOpen ? 'Close' : 'Open Menu'}"
|
||||
render="{isOpen ? Close20 : Menu20}"
|
||||
/>
|
||||
<svelte:component this="{isOpen ? iconClose : iconMenu}" />
|
||||
</button>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue