mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-17 11:11:25 +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
|
@ -33,41 +33,41 @@
|
|||
<li
|
||||
tabindex="-1"
|
||||
role="presentation"
|
||||
class:bx--tabs__nav-item="{true}"
|
||||
class:bx--tabs__nav-item--disabled="{disabled}"
|
||||
class:bx--tabs__nav-item--selected="{selected}"
|
||||
class:bx--tabs__nav-item={true}
|
||||
class:bx--tabs__nav-item--disabled={disabled}
|
||||
class:bx--tabs__nav-item--selected={selected}
|
||||
{...$$restProps}
|
||||
on:click|preventDefault
|
||||
on:click|preventDefault="{() => {
|
||||
on:click|preventDefault={() => {
|
||||
if (!disabled) {
|
||||
update(id);
|
||||
}
|
||||
}}"
|
||||
}}
|
||||
on:mouseover
|
||||
on:mouseenter
|
||||
on:mouseleave
|
||||
on:keydown="{({ key }) => {
|
||||
on:keydown={({ key }) => {
|
||||
if (!disabled) {
|
||||
if (key === 'ArrowRight') {
|
||||
if (key === "ArrowRight") {
|
||||
change(1);
|
||||
} else if (key === 'ArrowLeft') {
|
||||
} else if (key === "ArrowLeft") {
|
||||
change(-1);
|
||||
} else if (key === ' ' || key === 'Enter') {
|
||||
} else if (key === " " || key === "Enter") {
|
||||
update(id);
|
||||
}
|
||||
}
|
||||
}}"
|
||||
}}
|
||||
>
|
||||
<a
|
||||
bind:this="{ref}"
|
||||
bind:this={ref}
|
||||
role="tab"
|
||||
tabindex="{disabled ? '-1' : tabindex}"
|
||||
aria-selected="{selected}"
|
||||
aria-disabled="{disabled}"
|
||||
id="{id}"
|
||||
href="{href}"
|
||||
class:bx--tabs__nav-link="{true}"
|
||||
style:width="{$useAutoWidth ? "auto" : undefined}"
|
||||
tabindex={disabled ? "-1" : tabindex}
|
||||
aria-selected={selected}
|
||||
aria-disabled={disabled}
|
||||
{id}
|
||||
{href}
|
||||
class:bx--tabs__nav-link={true}
|
||||
style:width={$useAutoWidth ? "auto" : undefined}
|
||||
>
|
||||
<slot>{label}</slot>
|
||||
</a>
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
|
||||
<div
|
||||
role="tabpanel"
|
||||
aria-labelledby="{tabId}"
|
||||
aria-hidden="{!selected}"
|
||||
hidden="{selected ? undefined : ''}"
|
||||
id="{id}"
|
||||
class:bx--tab-content="{true}"
|
||||
aria-labelledby={tabId}
|
||||
aria-hidden={!selected}
|
||||
hidden={selected ? undefined : ""}
|
||||
{id}
|
||||
class:bx--tab-content={true}
|
||||
{...$$restProps}
|
||||
>
|
||||
<slot />
|
||||
|
|
|
@ -32,13 +32,13 @@
|
|||
|
||||
const tabs = writable([]);
|
||||
const tabsById = derived(tabs, (_) =>
|
||||
_.reduce((a, c) => ({ ...a, [c.id]: c }), {})
|
||||
_.reduce((a, c) => ({ ...a, [c.id]: c }), {}),
|
||||
);
|
||||
const useAutoWidth = writable(autoWidth);
|
||||
const selectedTab = writable(undefined);
|
||||
const content = writable([]);
|
||||
const contentById = derived(content, (_) =>
|
||||
_.reduce((a, c) => ({ ...a, [c.id]: c }), {})
|
||||
_.reduce((a, c) => ({ ...a, [c.id]: c }), {}),
|
||||
);
|
||||
const selectedContent = writable(undefined);
|
||||
|
||||
|
@ -125,42 +125,42 @@
|
|||
|
||||
<div
|
||||
role="navigation"
|
||||
class:bx--tabs="{true}"
|
||||
class:bx--tabs--container="{type === 'container'}"
|
||||
class:bx--tabs={true}
|
||||
class:bx--tabs--container={type === "container"}
|
||||
{...$$restProps}
|
||||
>
|
||||
<div
|
||||
role="listbox"
|
||||
tabindex="0"
|
||||
class:bx--tabs-trigger="{true}"
|
||||
aria-label="{$$props['aria-label'] || 'listbox'}"
|
||||
on:click="{() => {
|
||||
class:bx--tabs-trigger={true}
|
||||
aria-label={$$props["aria-label"] || "listbox"}
|
||||
on:click={() => {
|
||||
dropdownHidden = !dropdownHidden;
|
||||
}}"
|
||||
}}
|
||||
on:keypress
|
||||
on:keypress="{() => {
|
||||
on:keypress={() => {
|
||||
dropdownHidden = !dropdownHidden;
|
||||
}}"
|
||||
}}
|
||||
>
|
||||
<a
|
||||
tabindex="-1"
|
||||
class:bx--tabs-trigger-text="{true}"
|
||||
href="{triggerHref}"
|
||||
class:bx--tabs-trigger-text={true}
|
||||
href={triggerHref}
|
||||
on:click|preventDefault
|
||||
on:click|preventDefault|stopPropagation="{() => {
|
||||
on:click|preventDefault|stopPropagation={() => {
|
||||
dropdownHidden = !dropdownHidden;
|
||||
}}"
|
||||
}}
|
||||
>
|
||||
{#if currentTab}{currentTab.label}{/if}
|
||||
</a>
|
||||
<ChevronDown aria-hidden="true" title="{iconDescription}" />
|
||||
<ChevronDown aria-hidden="true" title={iconDescription} />
|
||||
</div>
|
||||
<!-- svelte-ignore a11y-no-noninteractive-element-to-interactive-role -->
|
||||
<ul
|
||||
bind:this="{refTabList}"
|
||||
bind:this={refTabList}
|
||||
role="tablist"
|
||||
class:bx--tabs__nav="{true}"
|
||||
class:bx--tabs__nav--hidden="{dropdownHidden}"
|
||||
class:bx--tabs__nav={true}
|
||||
class:bx--tabs__nav--hidden={dropdownHidden}
|
||||
>
|
||||
<slot />
|
||||
</ul>
|
||||
|
|
|
@ -12,20 +12,20 @@
|
|||
<!-- svelte-ignore a11y-mouse-events-have-key-events -->
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<div
|
||||
class:bx--tabs="{true}"
|
||||
class:bx--skeleton="{true}"
|
||||
class:bx--tabs--scrollable="{true}"
|
||||
class:bx--tabs--scrollable--container="{type === 'container'}"
|
||||
class:bx--tabs={true}
|
||||
class:bx--skeleton={true}
|
||||
class:bx--tabs--scrollable={true}
|
||||
class:bx--tabs--scrollable--container={type === "container"}
|
||||
{...$$restProps}
|
||||
on:click
|
||||
on:mouseover
|
||||
on:mouseenter
|
||||
on:mouseleave
|
||||
>
|
||||
<ul class:bx--tabs--scrollable__nav="{true}">
|
||||
<ul class:bx--tabs--scrollable__nav={true}>
|
||||
{#each Array.from({ length: count }, (_, i) => i) as item}
|
||||
<li class:bx--tabs--scrollable__nav-item="{true}">
|
||||
<div class:bx--tabs__nav-link="{true}">
|
||||
<li class:bx--tabs--scrollable__nav-item={true}>
|
||||
<div class:bx--tabs__nav-link={true}>
|
||||
<span></span>
|
||||
</div>
|
||||
</li>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue