mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
chore: format files with Prettier 3
This commit is contained in:
parent
1dcd09bd98
commit
8e996dc683
391 changed files with 3725 additions and 3785 deletions
|
@ -98,18 +98,18 @@
|
|||
|
||||
<!-- svelte-ignore a11y-mouse-events-have-key-events -->
|
||||
<div
|
||||
bind:this="{ref}"
|
||||
bind:this={ref}
|
||||
role="presentation"
|
||||
class:bx--modal="{true}"
|
||||
class:is-visible="{open}"
|
||||
class:bx--modal--danger="{danger}"
|
||||
class:bx--modal={true}
|
||||
class:is-visible={open}
|
||||
class:bx--modal--danger={danger}
|
||||
{...$$restProps}
|
||||
on:keydown
|
||||
on:keydown="{(e) => {
|
||||
on:keydown={(e) => {
|
||||
if (open) {
|
||||
if (e.key === 'Escape') {
|
||||
if (e.key === "Escape") {
|
||||
open = false;
|
||||
} else if (e.key === 'Tab') {
|
||||
} else if (e.key === "Tab") {
|
||||
// taken from github.com/carbon-design-system/carbon/packages/react/src/internal/keyboard/navigation.js
|
||||
const selectorTabbable = `
|
||||
a[href], area[href], input:not([disabled]):not([tabindex='-1']),
|
||||
|
@ -130,41 +130,41 @@
|
|||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
}}"
|
||||
}}
|
||||
on:click
|
||||
on:click="{() => {
|
||||
on:click={() => {
|
||||
if (!didClickInnerModal && !preventCloseOnClickOutside) open = false;
|
||||
didClickInnerModal = false;
|
||||
}}"
|
||||
}}
|
||||
on:mouseover
|
||||
on:mouseenter
|
||||
on:mouseleave
|
||||
on:transitionend="{({ propertyName, currentTarget }) => {
|
||||
if (propertyName === 'transform') {
|
||||
dispatch('transitionend', { open });
|
||||
on:transitionend={({ propertyName, currentTarget }) => {
|
||||
if (propertyName === "transform") {
|
||||
dispatch("transitionend", { open });
|
||||
}
|
||||
|
||||
if (didOpen) {
|
||||
focus(currentTarget);
|
||||
didOpen = false;
|
||||
}
|
||||
}}"
|
||||
}}
|
||||
>
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
||||
<div
|
||||
bind:this="{innerModal}"
|
||||
bind:this={innerModal}
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label="{$$props['aria-label'] || $label || undefined}"
|
||||
class:bx--modal-container="{true}"
|
||||
class:bx--modal-container--xs="{size === 'xs'}"
|
||||
class:bx--modal-container--sm="{size === 'sm'}"
|
||||
class:bx--modal-container--lg="{size === 'lg'}"
|
||||
class="{containerClass}"
|
||||
on:click="{() => {
|
||||
aria-label={$$props["aria-label"] || $label || undefined}
|
||||
class:bx--modal-container={true}
|
||||
class:bx--modal-container--xs={size === "xs"}
|
||||
class:bx--modal-container--sm={size === "sm"}
|
||||
class:bx--modal-container--lg={size === "lg"}
|
||||
class={containerClass}
|
||||
on:click={() => {
|
||||
didClickInnerModal = true;
|
||||
}}"
|
||||
}}
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
|
|
|
@ -8,15 +8,15 @@
|
|||
|
||||
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
||||
<div
|
||||
tabindex="{hasScrollingContent ? '0' : undefined}"
|
||||
role="{hasScrollingContent ? 'region' : undefined}"
|
||||
class:bx--modal-content="{true}"
|
||||
class:bx--modal-content--with-form="{hasForm}"
|
||||
class:bx--modal-scroll-content="{hasScrollingContent}"
|
||||
tabindex={hasScrollingContent ? "0" : undefined}
|
||||
role={hasScrollingContent ? "region" : undefined}
|
||||
class:bx--modal-content={true}
|
||||
class:bx--modal-content--with-form={hasForm}
|
||||
class:bx--modal-scroll-content={hasScrollingContent}
|
||||
{...$$restProps}
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
{#if hasScrollingContent}
|
||||
<div class:bx--modal-content--overflow-indicator="{true}"></div>
|
||||
<div class:bx--modal-content--overflow-indicator={true}></div>
|
||||
{/if}
|
||||
|
|
|
@ -48,17 +48,17 @@
|
|||
</script>
|
||||
|
||||
<div
|
||||
class:bx--modal-footer="{true}"
|
||||
class:bx--modal-footer--three-button="{secondaryButtons.length === 2}"
|
||||
class:bx--modal-footer={true}
|
||||
class:bx--modal-footer--three-button={secondaryButtons.length === 2}
|
||||
{...$$restProps}
|
||||
>
|
||||
{#if secondaryButtons.length > 0}
|
||||
{#each secondaryButtons as button}
|
||||
<Button
|
||||
kind="secondary"
|
||||
on:click="{() => {
|
||||
dispatch('click:button--secondary', { text: button.text });
|
||||
}}"
|
||||
on:click={() => {
|
||||
dispatch("click:button--secondary", { text: button.text });
|
||||
}}
|
||||
>
|
||||
{button.text}
|
||||
</Button>
|
||||
|
@ -66,22 +66,22 @@
|
|||
{:else if secondaryButtonText}
|
||||
<Button
|
||||
kind="secondary"
|
||||
class="{secondaryClass}"
|
||||
on:click="{() => {
|
||||
class={secondaryClass}
|
||||
on:click={() => {
|
||||
closeModal();
|
||||
dispatch('click:button--secondary', { text: secondaryButtonText });
|
||||
}}"
|
||||
dispatch("click:button--secondary", { text: secondaryButtonText });
|
||||
}}
|
||||
>
|
||||
{secondaryButtonText}
|
||||
</Button>
|
||||
{/if}
|
||||
{#if primaryButtonText}
|
||||
<Button
|
||||
kind="{danger ? 'danger' : 'primary'}"
|
||||
disabled="{primaryButtonDisabled}"
|
||||
class="{primaryClass}"
|
||||
icon="{primaryButtonIcon}"
|
||||
on:click="{submit}"
|
||||
kind={danger ? "danger" : "primary"}
|
||||
disabled={primaryButtonDisabled}
|
||||
class={primaryClass}
|
||||
icon={primaryButtonIcon}
|
||||
on:click={submit}
|
||||
>
|
||||
{primaryButtonText}
|
||||
</Button>
|
||||
|
|
|
@ -28,21 +28,21 @@
|
|||
$: updateLabel(label);
|
||||
</script>
|
||||
|
||||
<div class:bx--modal-header="{true}" {...$$restProps}>
|
||||
<div class:bx--modal-header={true} {...$$restProps}>
|
||||
{#if label}
|
||||
<h2
|
||||
class:bx--modal-header__label="{true}"
|
||||
class:bx--type-delta="{true}"
|
||||
class="{labelClass}"
|
||||
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}"
|
||||
class:bx--modal-header__heading={true}
|
||||
class:bx--type-beta={true}
|
||||
class={titleClass}
|
||||
>
|
||||
{title}
|
||||
</h3>
|
||||
|
@ -50,14 +50,14 @@
|
|||
<slot />
|
||||
<button
|
||||
type="button"
|
||||
aria-label="{iconDescription}"
|
||||
class:bx--modal-close="{true}"
|
||||
class="{closeClass}"
|
||||
aria-label={iconDescription}
|
||||
class:bx--modal-close={true}
|
||||
class={closeClass}
|
||||
on:click
|
||||
on:click="{closeModal}"
|
||||
on:click={closeModal}
|
||||
>
|
||||
<Close
|
||||
size="{20}"
|
||||
size={20}
|
||||
class="bx--modal-close__icon {closeIconClass}"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue