mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
* chore(deps-dev): remove @carbon/themes * chore(deps-dev): bump devDependencies * fix(tabs): forward click event to Tab * feat(toggle): dispatch toggle event * feat(tag): dispatch close event * feat(tooltip-icon): make tooltipText slottable * feat(dropdown): add hideLabel prop * docs(select): add "Hidden label" example * refactor(modal): use class directive * feat(modal): dispatch transitionend event * chore(deps-dev): upgrade carbon-components to 10.28.0-rc.0 * feat(date-picker): add warn state * feat(tag): support small size variant * fix(search): add semantic role * feat(toolbar-search): add disabled state * fix(composed-modal): add aria-label prop, update header semantic tags * chore(deps-dev): upgrade carbon-components to v10.28 * docs(overflow-menu): add light variant example * docs(link): document OutboundLink in Component API * chore(tooltip-icon): rename slot to "tooltipText" * docs(component-api): wrap code blocks to minimize width * docs(aspect-ratio): remove inline outline style * fix(tab): do not trigger focus when mounting * docs(tabs): add reactive example Closes #438
62 lines
1.4 KiB
Svelte
62 lines
1.4 KiB
Svelte
<script>
|
|
/** Specify the modal title */
|
|
export let title = "";
|
|
|
|
/** Specify the modal label */
|
|
export let label = "";
|
|
|
|
/** Specify the label class */
|
|
export let labelClass = "";
|
|
|
|
/** Specify the title class */
|
|
export let titleClass = "";
|
|
|
|
/** Specify the close class */
|
|
export let closeClass = "";
|
|
|
|
/** Specify the close icon class */
|
|
export let closeIconClass = "";
|
|
|
|
/** Specify the ARIA label for the close icon */
|
|
export let iconDescription = "Close";
|
|
|
|
import { getContext } from "svelte";
|
|
import Close20 from "carbon-icons-svelte/lib/Close20/Close20.svelte";
|
|
|
|
const { closeModal, updateLabel } = getContext("ComposedModal");
|
|
|
|
$: updateLabel(label);
|
|
</script>
|
|
|
|
<div class:bx--modal-header="{true}" {...$$restProps}>
|
|
{#if label}
|
|
<h2
|
|
class:bx--modal-header__label="{true}"
|
|
class:bx--type-delta="{true}"
|
|
class="{labelClass}"
|
|
>
|
|
{label}
|
|
</h2>
|
|
{/if}
|
|
{#if title}
|
|
<h3
|
|
class:bx--modal-header__heading="{true}"
|
|
class:bx--type-beta="{true}"
|
|
class="{titleClass}"
|
|
>
|
|
{title}
|
|
</h3>
|
|
{/if}
|
|
<slot />
|
|
<button
|
|
type="button"
|
|
title="{iconDescription}"
|
|
aria-label="{iconDescription}"
|
|
class:bx--modal-close="{true}"
|
|
class="{closeClass}"
|
|
on:click
|
|
on:click="{closeModal}"
|
|
>
|
|
<Close20 class="bx--modal-close__icon {closeIconClass}" />
|
|
</button>
|
|
</div>
|