feat(prettier): add svelteBracketNewLine

This commit is contained in:
josefaidt 2020-09-24 10:50:34 -05:00
commit 398887a3d3
182 changed files with 974 additions and 494 deletions

View file

@ -1 +1 @@
{ "svelteStrictMode": true } { "svelteStrictMode": true, "svelteBracketNewLine": true }

View file

@ -10,4 +10,5 @@
code="{code}" code="{code}"
on:click="{() => { on:click="{() => {
copy(code); copy(code);
}}" /> }}"
/>

View file

@ -17,7 +17,8 @@
platformName="Components Svelte" platformName="Components Svelte"
href="." href="."
rel="prefetch" rel="prefetch"
aria-current="{segment === undefined ? 'page' : undefined}"> aria-current="{segment === undefined ? 'page' : undefined}"
>
<SkipToContent /> <SkipToContent />
<!-- <HeaderNav> <!-- <HeaderNav>
<HeaderNavItem <HeaderNavItem

View file

@ -39,7 +39,8 @@
<Carbon.Accordion <Carbon.Accordion
count="{3}" count="{3}"
skeleton="{skeleton}" skeleton="{skeleton}"
open="{accordionItemOpen}"> open="{accordionItemOpen}"
>
<Carbon.AccordionItem title="Title 1" bind:open="{accordionItemOpen}"> <Carbon.AccordionItem title="Title 1" bind:open="{accordionItemOpen}">
Content 1 Content 1
</Carbon.AccordionItem> </Carbon.AccordionItem>
@ -109,7 +110,8 @@
iconDescription="Primary" iconDescription="Primary"
tooltipPosition="bottom" tooltipPosition="bottom"
tooltipAlignment="center" tooltipAlignment="center"
skeleton="{skeleton}" /> skeleton="{skeleton}"
/>
<Carbon.Button <Carbon.Button
icon="{Add16}" icon="{Add16}"
hasIconOnly hasIconOnly
@ -117,7 +119,8 @@
iconDescription="Secondary" iconDescription="Secondary"
tooltipPosition="bottom" tooltipPosition="bottom"
tooltipAlignment="center" tooltipAlignment="center"
skeleton="{skeleton}" /> skeleton="{skeleton}"
/>
<Carbon.Button <Carbon.Button
icon="{Add16}" icon="{Add16}"
hasIconOnly hasIconOnly
@ -125,7 +128,8 @@
iconDescription="Tertiary" iconDescription="Tertiary"
tooltipPosition="bottom" tooltipPosition="bottom"
tooltipAlignment="center" tooltipAlignment="center"
skeleton="{skeleton}" /> skeleton="{skeleton}"
/>
<Carbon.Button <Carbon.Button
icon="{Add16}" icon="{Add16}"
hasIconOnly hasIconOnly
@ -133,7 +137,8 @@
iconDescription="Ghost" iconDescription="Ghost"
tooltipPosition="bottom" tooltipPosition="bottom"
tooltipAlignment="center" tooltipAlignment="center"
skeleton="{skeleton}" /> skeleton="{skeleton}"
/>
<Carbon.Button <Carbon.Button
icon="{Add16}" icon="{Add16}"
hasIconOnly hasIconOnly
@ -141,7 +146,8 @@
iconDescription="Danger" iconDescription="Danger"
tooltipPosition="bottom" tooltipPosition="bottom"
tooltipAlignment="center" tooltipAlignment="center"
skeleton="{skeleton}" /> skeleton="{skeleton}"
/>
</TileCard> </TileCard>
</Carbon.Column> </Carbon.Column>
</Carbon.Row> </Carbon.Row>
@ -164,11 +170,13 @@
<Carbon.Checkbox <Carbon.Checkbox
indeterminate indeterminate
skeleton="{skeleton}" skeleton="{skeleton}"
labelText="Checkbox label" /> labelText="Checkbox label"
/>
<Carbon.Checkbox <Carbon.Checkbox
indeterminate indeterminate
skeleton="{skeleton}" skeleton="{skeleton}"
labelText="Checkbox label" /> labelText="Checkbox label"
/>
</fieldset> </fieldset>
</TileCard> </TileCard>
</Carbon.Column> </Carbon.Column>

View file

@ -47,7 +47,8 @@
icon="{Code16}" icon="{Code16}"
iconDescription="Usage" iconDescription="Usage"
tooltipAlignment="center" tooltipAlignment="center"
tooltipPosition="top" /> tooltipPosition="top"
/>
<Button <Button
hasIconOnly hasIconOnly
kind="ghost" kind="ghost"
@ -55,7 +56,8 @@
icon="{Code16}" icon="{Code16}"
iconDescription="Usage" iconDescription="Usage"
tooltipAlignment="center" tooltipAlignment="center"
tooltipPosition="top" /> tooltipPosition="top"
/>
</div> </div>
</div> </div>
</Tile> </Tile>

View file

@ -65,21 +65,25 @@
text="Getting Started" text="Getting Started"
href="getting-started" href="getting-started"
rel="prefetch" rel="prefetch"
isSelected="{segment === 'getting-started'}" /> isSelected="{segment === 'getting-started'}"
/>
<SideNavMenu <SideNavMenu
text="Components" text="Components"
expanded="{segment === 'components'}" expanded="{segment === 'components'}"
isSelected="{segment === 'components' && !$tail}"> isSelected="{segment === 'components' && !$tail}"
>
<SideNavMenuItem <SideNavMenuItem
text="Index" text="Index"
href="components" href="components"
rel="prefetch" rel="prefetch"
isSelected="{segment === 'components' && $tail && $tail.slug === 'index'}" /> isSelected="{segment === 'components' && $tail && $tail.slug === 'index'}"
/>
<SideNavMenuItem <SideNavMenuItem
text="Button" text="Button"
href="components/button" href="components/button"
rel="prefetch" rel="prefetch"
isSelected="{segment === 'components' && $tail && $tail.slug === 'button'}" /> isSelected="{segment === 'components' && $tail && $tail.slug === 'button'}"
/>
</SideNavMenu> </SideNavMenu>
</SideNavItems> </SideNavItems>
</SideNav> </SideNav>
@ -88,7 +92,8 @@
<Row> <Row>
<Column <Column
style="display: flex; align-items: center; justify-content: style="display: flex; align-items: center; justify-content:
space-between;"> space-between;"
>
<Breadcrumb> <Breadcrumb>
<BreadcrumbItem href="." isCurrentPage="{!$tail && !segment}"> <BreadcrumbItem href="." isCurrentPage="{!$tail && !segment}">
Home Home

View file

@ -110,7 +110,8 @@
selected="{props[key].default}" selected="{props[key].default}"
on:change="{({ detail }) => { on:change="{({ detail }) => {
defaultProps = { ...defaultProps, [key]: detail }; defaultProps = { ...defaultProps, [key]: detail };
}}"> }}"
>
{#each props[key].values as value} {#each props[key].values as value}
<RadioButton value="{value}" id="{value}" labelText="{value}" /> <RadioButton value="{value}" id="{value}" labelText="{value}" />
{/each} {/each}
@ -125,6 +126,7 @@
code="{data.source}" code="{data.source}"
on:click="{() => { on:click="{() => {
copy(data.source); copy(data.source);
}}" /> }}"
/>
</Column> </Column>
</Row> </Row>

View file

@ -11,7 +11,8 @@
on:click="{() => console.log('click')}" on:click="{() => console.log('click')}"
on:mouseover="{() => console.log('mouseover')}" on:mouseover="{() => console.log('mouseover')}"
on:mouseenter="{() => console.log('mouseenter')}" on:mouseenter="{() => console.log('mouseenter')}"
on:mouseleave="{() => console.log('mouseleave')}"> on:mouseleave="{() => console.log('mouseleave')}"
>
Primary button Primary button
</Button> </Button>
@ -46,7 +47,8 @@
icon="{Add16}" icon="{Add16}"
iconDescription="Primary" iconDescription="Primary"
tooltipPosition="bottom" tooltipPosition="bottom"
tooltipAlignment="center" /> tooltipAlignment="center"
/>
<Button <Button
{...$$props} {...$$props}
@ -55,7 +57,8 @@
icon="{Add16}" icon="{Add16}"
iconDescription="Secondary" iconDescription="Secondary"
tooltipPosition="bottom" tooltipPosition="bottom"
tooltipAlignment="center" /> tooltipAlignment="center"
/>
<Button <Button
{...$$props} {...$$props}
@ -64,7 +67,8 @@
icon="{Add16}" icon="{Add16}"
iconDescription="Tertiary" iconDescription="Tertiary"
tooltipPosition="bottom" tooltipPosition="bottom"
tooltipAlignment="center" /> tooltipAlignment="center"
/>
<Button <Button
{...$$props} {...$$props}
@ -73,7 +77,8 @@
icon="{Add16}" icon="{Add16}"
iconDescription="Ghost" iconDescription="Ghost"
tooltipPosition="bottom" tooltipPosition="bottom"
tooltipAlignment="center" /> tooltipAlignment="center"
/>
<Button <Button
{...$$props} {...$$props}
@ -82,5 +87,6 @@
icon="{Add16}" icon="{Add16}"
iconDescription="Danger" iconDescription="Danger"
tooltipPosition="bottom" tooltipPosition="bottom"
tooltipAlignment="center" /> tooltipAlignment="center"
/>
</div> </div>

View file

@ -27,11 +27,13 @@
<div slot="content" class="content"> <div slot="content" class="content">
<TabContent> <TabContent>
<CopyableCodeSnippet <CopyableCodeSnippet
code="{`yarn add -D carbon-components-svelte`}" /> code="{`yarn add -D carbon-components-svelte`}"
/>
</TabContent> </TabContent>
<TabContent> <TabContent>
<CopyableCodeSnippet <CopyableCodeSnippet
code="{`npm -i -D carbon-components-svelte`}" /> code="{`npm -i -D carbon-components-svelte`}"
/>
</TabContent> </TabContent>
</div> </div>
</Tabs> </Tabs>

View file

@ -49,7 +49,8 @@
<Select <Select
labelText="Carbon theme" labelText="Carbon theme"
bind:selected="{theme}" bind:selected="{theme}"
style="margin-bottom: 1rem"> style="margin-bottom: 1rem"
>
<SelectItem value="white" text="White" /> <SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" /> <SelectItem value="g10" text="Gray 10" />
<SelectItem value="g90" text="Gray 90" /> <SelectItem value="g90" text="Gray 90" />

View file

@ -49,7 +49,8 @@
<Select <Select
labelText="Carbon theme" labelText="Carbon theme"
bind:selected="{theme}" bind:selected="{theme}"
style="margin-bottom: 1rem"> style="margin-bottom: 1rem"
>
<SelectItem value="white" text="White" /> <SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" /> <SelectItem value="g10" text="Gray 10" />
<SelectItem value="g90" text="Gray 90" /> <SelectItem value="g90" text="Gray 90" />

View file

@ -40,7 +40,8 @@
<Select <Select
labelText="Carbon theme" labelText="Carbon theme"
bind:selected="{$carbon_theme}" bind:selected="{$carbon_theme}"
style="margin-bottom: 1rem"> style="margin-bottom: 1rem"
>
<SelectItem value="white" text="White" /> <SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" /> <SelectItem value="g10" text="Gray 10" />
<SelectItem value="g90" text="Gray 90" /> <SelectItem value="g90" text="Gray 90" />

View file

@ -53,12 +53,14 @@
<li> <li>
<a <a
aria-current="{segment === undefined ? 'page' : undefined}" aria-current="{segment === undefined ? 'page' : undefined}"
href=".">home</a> href="."
>home</a>
</li> </li>
<li> <li>
<a <a
aria-current="{segment === 'about' ? 'page' : undefined}" aria-current="{segment === 'about' ? 'page' : undefined}"
href="about">about</a> href="about"
>about</a>
</li> </li>
<!-- for the blog link, we're using rel=prefetch so that Sapper prefetches <!-- for the blog link, we're using rel=prefetch so that Sapper prefetches
@ -67,7 +69,8 @@
<a <a
rel="prefetch" rel="prefetch"
aria-current="{segment === 'blog' ? 'page' : undefined}" aria-current="{segment === 'blog' ? 'page' : undefined}"
href="blog">blog</a> href="blog"
>blog</a>
</li> </li>
</ul> </ul>
</nav> </nav>

View file

@ -41,7 +41,8 @@
<Select <Select
labelText="Carbon theme" labelText="Carbon theme"
bind:selected="{$carbon_theme}" bind:selected="{$carbon_theme}"
style="margin-bottom: 1rem"> style="margin-bottom: 1rem"
>
<SelectItem value="white" text="White" /> <SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" /> <SelectItem value="g10" text="Gray 10" />
<SelectItem value="g90" text="Gray 90" /> <SelectItem value="g90" text="Gray 90" />

View file

@ -44,7 +44,8 @@
<Select <Select
labelText="Carbon theme" labelText="Carbon theme"
bind:selected="{theme}" bind:selected="{theme}"
style="margin-bottom: 1rem"> style="margin-bottom: 1rem"
>
<SelectItem value="white" text="White" /> <SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" /> <SelectItem value="g10" text="Gray 10" />
<SelectItem value="g90" text="Gray 90" /> <SelectItem value="g90" text="Gray 90" />

View file

@ -45,7 +45,8 @@
<Select <Select
labelText="Carbon theme" labelText="Carbon theme"
bind:selected="{theme}" bind:selected="{theme}"
style="margin-bottom: 1rem"> style="margin-bottom: 1rem"
>
<SelectItem value="white" text="White" /> <SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" /> <SelectItem value="g10" text="Gray 10" />
<SelectItem value="g90" text="Gray 90" /> <SelectItem value="g90" text="Gray 90" />

View file

@ -22,11 +22,13 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
{#if open} {#if open}
<li <li
class:bx--accordion__item="{true}" class:bx--accordion__item="{true}"
class:bx--accordion__item--active="{true}"> class:bx--accordion__item--active="{true}"
>
<span class:bx--accordion__heading="{true}"> <span class:bx--accordion__heading="{true}">
<ChevronRight16 class="bx--accordion__arrow" /> <ChevronRight16 class="bx--accordion__arrow" />
<SkeletonText class="bx--accordion__title" /> <SkeletonText class="bx--accordion__title" />

View file

@ -20,7 +20,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave /> on:mouseleave
/>
{:else} {:else}
<ul <ul
class:bx--accordion="{true}" class:bx--accordion="{true}"
@ -29,7 +30,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<slot /> <slot />
</ul> </ul>
{/if} {/if}

View file

@ -31,7 +31,8 @@
on:animationend on:animationend
on:animationend="{() => { on:animationend="{() => {
animation = undefined; animation = undefined;
}}"> }}"
>
<button <button
type="button" type="button"
class:bx--accordion__heading="{true}" class:bx--accordion__heading="{true}"
@ -50,10 +51,12 @@
if (open && key === 'Escape') { if (open && key === 'Escape') {
open = false; open = false;
} }
}}"> }}"
>
<ChevronRight16 <ChevronRight16
class="bx--accordion__arrow" class="bx--accordion__arrow"
aria-label="{iconDescription}" /> aria-label="{iconDescription}"
/>
<div class="bx--accordion__title"> <div class="bx--accordion__title">
<slot name="title">{title}</slot> <slot name="title">{title}</slot>
</div> </div>

View file

@ -20,7 +20,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
{#each Array.from({ length: count }, (_, i) => i) as item, i (item)} {#each Array.from({ length: count }, (_, i) => i) as item, i (item)}
<div class:bx--breadcrumb-item="{true}"> <div class:bx--breadcrumb-item="{true}">
<span class:bx--link="{true}">&nbsp;</span> <span class:bx--link="{true}">&nbsp;</span>

View file

@ -20,7 +20,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave /> on:mouseleave
/>
{:else} {:else}
<nav <nav
aria-label="Breadcrumb" aria-label="Breadcrumb"
@ -28,10 +29,12 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<ol <ol
class:bx--breadcrumb="{true}" class:bx--breadcrumb="{true}"
class:bx--breadcrumb--no-trailing-slash="{noTrailingSlash}"> class:bx--breadcrumb--no-trailing-slash="{noTrailingSlash}"
>
<slot /> <slot />
</ol> </ol>
</nav> </nav>

View file

@ -21,13 +21,15 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
{#if href} {#if href}
<Link href="{href}" aria-current="{$$restProps['aria-current']}"> <Link href="{href}" aria-current="{$$restProps['aria-current']}">
<slot /> <slot />
</Link> </Link>
{:else} {:else}
<slot <slot
props="{{ 'aria-current': $$restProps['aria-current'], class: 'bx--link' }}" /> props="{{ 'aria-current': $$restProps['aria-current'], class: 'bx--link' }}"
/>
{/if} {/if}
</li> </li>

View file

@ -23,7 +23,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
{''} {''}
</a> </a>
{:else} {:else}
@ -35,5 +36,6 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave></div> on:mouseleave
></div>
{/if} {/if}

View file

@ -129,7 +129,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave /> on:mouseleave
/>
{:else} {:else}
{#if as} {#if as}
<slot props="{buttonProps}" /> <slot props="{buttonProps}" />
@ -141,7 +142,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
{#if hasIconOnly} {#if hasIconOnly}
<span class:bx--assistive-text="{true}">{iconDescription}</span> <span class:bx--assistive-text="{true}">{iconDescription}</span>
{/if} {/if}
@ -151,7 +153,8 @@
this="{icon}" this="{icon}"
aria-hidden="true" aria-hidden="true"
class="bx--btn__icon" class="bx--btn__icon"
aria-label="{iconDescription}" /> aria-label="{iconDescription}"
/>
{/if} {/if}
</a> </a>
{:else} {:else}
@ -161,7 +164,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
{#if hasIconOnly} {#if hasIconOnly}
<span class:bx--assistive-text="{true}">{iconDescription}</span> <span class:bx--assistive-text="{true}">{iconDescription}</span>
{/if} {/if}
@ -171,7 +175,8 @@
this="{icon}" this="{icon}"
aria-hidden="true" aria-hidden="true"
class="bx--btn__icon" class="bx--btn__icon"
aria-label="{iconDescription}" /> aria-label="{iconDescription}"
/>
{/if} {/if}
</button> </button>
{/if} {/if}

View file

@ -9,6 +9,7 @@
<div <div
class:bx--btn-set="{true}" class:bx--btn-set="{true}"
class:bx--btn-set--stacked="{stacked}" class:bx--btn-set--stacked="{stacked}"
{...$$restProps}> {...$$restProps}
>
<slot /> <slot />
</div> </div>

View file

@ -6,8 +6,10 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<span <span
class:bx--checkbox-label-text="{true}" class:bx--checkbox-label-text="{true}"
class:bx--skeleton="{true}"></span> class:bx--skeleton="{true}"
></span>
</div> </div>

View file

@ -41,7 +41,8 @@
bind:checked bind:checked
on:check="{({ detail }) => { on:check="{({ detail }) => {
console.log('on:check', detail); console.log('on:check', detail);
}}" /> }}"
/>
<Checkbox {...checkboxProps} id="checkbox-label-2" checked /> <Checkbox {...checkboxProps} id="checkbox-label-2" checked />
</fieldset> </fieldset>
{/if} {/if}

View file

@ -79,7 +79,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave /> on:mouseleave
/>
{:else} {:else}
<div <div
class:bx--form-item="{true}" class:bx--form-item="{true}"
@ -88,7 +89,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<input <input
bind:this="{ref}" bind:this="{ref}"
type="checkbox" type="checkbox"
@ -102,11 +104,13 @@
on:change on:change
on:change="{() => { on:change="{() => {
checked = !checked; checked = !checked;
}}" /> }}"
/>
<label for="{id}" title="{title}" class:bx--checkbox-label="{true}"> <label for="{id}" title="{title}" class:bx--checkbox-label="{true}">
<span <span
class:bx--checkbox-label-text="{true}" class:bx--checkbox-label-text="{true}"
class:bx--visually-hidden="{hideLabel}"> class:bx--visually-hidden="{hideLabel}"
>
{labelText} {labelText}
</span> </span>
</label> </label>

View file

@ -15,7 +15,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<div class:bx--snippet-container="{true}"> <div class:bx--snippet-container="{true}">
{#if type === 'single'} {#if type === 'single'}
<span></span> <span></span>

View file

@ -111,7 +111,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave /> on:mouseleave
/>
{:else} {:else}
{#if type === 'inline'} {#if type === 'inline'}
{#if hideCopyButton} {#if hideCopyButton}
@ -121,7 +122,8 @@
{expanded && 'bx--snippet--expand'} {expanded && 'bx--snippet--expand'}
{light && 'bx--snippet--light'} {light && 'bx--snippet--light'}
{hideCopyButton && 'bx--snippet--no-copy'}" {hideCopyButton && 'bx--snippet--no-copy'}"
{...$$restProps}> {...$$restProps}
>
<code id="{id}"> <code id="{id}">
<slot>{code}</slot> <slot>{code}</slot>
</code> </code>
@ -141,7 +143,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<code id="{id}"> <code id="{id}">
<slot>{code}</slot> <slot>{code}</slot>
</code> </code>
@ -158,12 +161,14 @@
class="{type && `bx--snippet--${type}`} {$$restProps.class}" class="{type && `bx--snippet--${type}`} {$$restProps.class}"
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<div <div
role="{type === 'single' ? 'textbox' : undefined}" role="{type === 'single' ? 'textbox' : undefined}"
tabindex="{type === 'single' ? '0' : undefined}" tabindex="{type === 'single' ? '0' : undefined}"
class:bx--snippet-container="{true}" class:bx--snippet-container="{true}"
aria-label="{$$restProps['aria-label'] || copyLabel || 'code-snippet'}"> aria-label="{$$restProps['aria-label'] || copyLabel || 'code-snippet'}"
>
<code> <code>
<pre bind:this="{ref}"> <pre bind:this="{ref}">
<slot>{code}</slot> <slot>{code}</slot>
@ -176,7 +181,8 @@
feedbackTimeout="{feedbackTimeout}" feedbackTimeout="{feedbackTimeout}"
iconDescription="{copyButtonDescription}" iconDescription="{copyButtonDescription}"
on:click on:click
on:animationend /> on:animationend
/>
{/if} {/if}
{#if showMoreLess} {#if showMoreLess}
<Button <Button
@ -185,11 +191,13 @@
class="bx--snippet-btn--expand" class="bx--snippet-btn--expand"
on:click="{() => { on:click="{() => {
expanded = !expanded; expanded = !expanded;
}}"> }}"
>
<span class:bx--snippet-btn--text="{true}">{expandText}</span> <span class:bx--snippet-btn--text="{true}">{expandText}</span>
<ChevronDown16 <ChevronDown16
class="bx--icon-chevron--down bx--snippet__icon" class="bx--icon-chevron--down bx--snippet__icon"
aria-label="{expandText}" /> aria-label="{expandText}"
/>
</Button> </Button>
{/if} {/if}
</div> </div>

View file

@ -33,21 +33,23 @@
<p> <p>
<code>items</code> must be an array of objects; mandatory fields are `id` and `text`. <code>items</code> must be an array of objects; mandatory fields are `id` and `text`.
</p> </p>
<pre <pre style="margin-top: 1rem;">
style="margin-top: 1rem;"> <code
<code>{'items = Array<{ id: string; text: string; }>'}</code> >{'items = Array<{ id: string; text: string; }>'}</code>
</pre> </pre>
<div style="margin-top: 2rem;"> <div style="margin-top: 2rem;">
<ToggleSmall <ToggleSmall
labelText="Enable filtering" labelText="Enable filtering"
bind:toggled bind:toggled
style="margin-top: 1rem;" /> style="margin-top: 1rem;"
/>
<Button <Button
size="small" size="small"
on:click="{() => { on:click="{() => {
selectedIndex = 1; selectedIndex = 1;
}}" }}"
style="margin-top: 1rem;"> style="margin-top: 1rem;"
>
Set item to "Option 2" Set item to "Option 2"
</Button> </Button>
</div> </div>
@ -65,5 +67,6 @@
console.log('on:clear'); console.log('on:clear');
}}" }}"
items="{items}" items="{items}"
shouldFilterItem="{shouldFilterItem}" /> shouldFilterItem="{shouldFilterItem}"
/>
</div> </div>

View file

@ -183,7 +183,8 @@
<label <label
for="{id}" for="{id}"
class:bx--label="{true}" class:bx--label="{true}"
class:bx--label--disabled="{disabled}"> class:bx--label--disabled="{disabled}"
>
{titleText} {titleText}
</label> </label>
{/if} {/if}
@ -196,7 +197,8 @@
invalidText="{invalidText}" invalidText="{invalidText}"
open="{open}" open="{open}"
light="{light}" light="{light}"
size="{size}"> size="{size}"
>
<ListBoxField <ListBoxField
role="button" role="button"
aria-expanded="{open}" aria-expanded="{open}"
@ -206,7 +208,8 @@
id="{id}" id="{id}"
name="{name}" name="{name}"
disabled="{disabled}" disabled="{disabled}"
translateWithId="{translateWithId}"> translateWithId="{translateWithId}"
>
<input <input
bind:this="{ref}" bind:this="{ref}"
tabindex="0" tabindex="0"
@ -251,7 +254,8 @@
disabled="{disabled}" disabled="{disabled}"
placeholder="{placeholder}" placeholder="{placeholder}"
id="{id}" id="{id}"
value="{inputValue}" /> value="{inputValue}"
/>
{#if invalid} {#if invalid}
<WarningFilled16 class="bx--list-box__invalid-icon" /> <WarningFilled16 class="bx--list-box__invalid-icon" />
{/if} {/if}
@ -265,7 +269,8 @@
}}" }}"
translateWithId="{translateWithId}" translateWithId="{translateWithId}"
disabled="{disabled}" disabled="{disabled}"
open="{open}" /> open="{open}"
/>
{/if} {/if}
<ListBoxMenuIcon <ListBoxMenuIcon
on:click="{(e) => { on:click="{(e) => {
@ -273,7 +278,8 @@
open = !open; open = !open;
}}" }}"
translateWithId="{translateWithId}" translateWithId="{translateWithId}"
open="{open}" /> open="{open}"
/>
</ListBoxField> </ListBoxField>
{#if open} {#if open}
<ListBoxMenu aria-label="{ariaLabel}" id="{id}"> <ListBoxMenu aria-label="{ariaLabel}" id="{id}">
@ -290,7 +296,8 @@
}}" }}"
on:mouseenter="{() => { on:mouseenter="{() => {
highlightedIndex = i; highlightedIndex = i;
}}"> }}"
>
{itemToString(item)} {itemToString(item)}
</ListBoxMenuItem> </ListBoxMenuItem>
{/each} {/each}
@ -300,7 +307,8 @@
{#if !invalid && helperText} {#if !invalid && helperText}
<div <div
class:bx--form__helper-text="{true}" class:bx--form__helper-text="{true}"
class:bx--form__helper-text--disabled="{disabled}"> class:bx--form__helper-text--disabled="{disabled}"
>
{helperText} {helperText}
</div> </div>
{/if} {/if}

View file

@ -18,11 +18,13 @@
{...$$props.composedModal} {...$$props.composedModal}
on:click="{(e) => { on:click="{(e) => {
console.log(e.target); console.log(e.target);
}}"> }}"
>
<ModalHeader {...$$props.modalHeader} /> <ModalHeader {...$$props.modalHeader} />
<ModalBody <ModalBody
{...$$props.modalBody} {...$$props.modalBody}
aria-label="{modalBody.hasScrollingContent ? 'Modal content' : undefined}"> aria-label="{modalBody.hasScrollingContent ? 'Modal content' : undefined}"
>
<div> <div>
<PasswordInput bind:type placeholder="Password Input" aria-level="" /> <PasswordInput bind:type placeholder="Password Input" aria-level="" />
<Button <Button
@ -30,7 +32,8 @@
size="field" size="field"
on:click="{() => { on:click="{() => {
type = type === 'password' ? 'text' : 'password'; type = type === 'password' ? 'text' : 'password';
}}"> }}"
>
Programmatically toggle password Programmatically toggle password
</Button> </Button>
</div> </div>
@ -58,7 +61,8 @@
</ModalHeader> </ModalHeader>
<ModalBody <ModalBody
{...$$props.modalBody} {...$$props.modalBody}
aria-label="{modalBody.hasScrollingContent ? 'Modal content' : undefined}"> aria-label="{modalBody.hasScrollingContent ? 'Modal content' : undefined}"
>
<p> <p>
Please see ModalWrapper for more examples and demo of the functionality. Please see ModalWrapper for more examples and demo of the functionality.
</p> </p>
@ -86,11 +90,13 @@
{...$$props.composedModal} {...$$props.composedModal}
open open
on:close="{() => {}}" on:close="{() => {}}"
on:submit="{() => {}}"> on:submit="{() => {}}"
>
<ModalHeader <ModalHeader
{...$$props.modalHeader} {...$$props.modalHeader}
title="Passive modal title as the message. Should be direct and 3 lines or title="Passive modal title as the message. Should be direct and 3 lines or
less." /> less."
/>
<ModalBody {...$$props.modalBody} /> <ModalBody {...$$props.modalBody} />
<ModalFooter {...$$props.modalFooter} /> <ModalFooter {...$$props.modalFooter} />
</ComposedModal> </ComposedModal>
@ -101,18 +107,21 @@
<Button <Button
on:click="{() => { on:click="{() => {
open = true; open = true;
}}"> }}"
>
Launch composed modal Launch composed modal
</Button> </Button>
</div> </div>
<ComposedModal <ComposedModal
{...$$props.composedModal} {...$$props.composedModal}
open="{open}" open="{open}"
on:close="{() => (open = false)}"> on:close="{() => (open = false)}"
>
<ModalHeader {...$$props.modalHeader} /> <ModalHeader {...$$props.modalHeader} />
<ModalBody <ModalBody
{...$$props.modalBody} {...$$props.modalBody}
aria-label="{modalBody.hasScrollingContent ? 'Modal content' : undefined}"> aria-label="{modalBody.hasScrollingContent ? 'Modal content' : undefined}"
>
<p> <p>
Please see ModalWrapper for more examples and demo of the functionality. Please see ModalWrapper for more examples and demo of the functionality.
</p> </p>

View file

@ -122,14 +122,16 @@
focus(currentTarget); focus(currentTarget);
didOpen = false; didOpen = false;
} }
}}"> }}"
>
<div <div
bind:this="{innerModal}" bind:this="{innerModal}"
class:bx--modal-container="{true}" class:bx--modal-container="{true}"
class="{size && `bx--modal-container--${size}`} {containerClass}" class="{size && `bx--modal-container--${size}`} {containerClass}"
on:click="{() => { on:click="{() => {
didClickInnerModal = true; didClickInnerModal = true;
}}"> }}"
>
<slot /> <slot />
</div> </div>
</div> </div>

View file

@ -17,7 +17,8 @@
role="{hasScrollingContent ? 'region' : undefined}" role="{hasScrollingContent ? 'region' : undefined}"
class:bx--modal-content="{true}" class:bx--modal-content="{true}"
class:bx--modal-content--with-form="{hasForm}" class:bx--modal-content--with-form="{hasForm}"
{...$$restProps}> {...$$restProps}
>
<slot /> <slot />
</div> </div>
{#if hasScrollingContent} {#if hasScrollingContent}

View file

@ -52,7 +52,8 @@
kind="{danger ? 'danger' : 'primary'}" kind="{danger ? 'danger' : 'primary'}"
disabled="{primaryButtonDisabled}" disabled="{primaryButtonDisabled}"
class="{primaryClass}" class="{primaryClass}"
on:click="{submit}"> on:click="{submit}"
>
{primaryButtonText} {primaryButtonText}
</Button> </Button>
{/if} {/if}

View file

@ -52,7 +52,8 @@
<p <p
class:bx--modal-header__label="{true}" class:bx--modal-header__label="{true}"
class:bx--type-delta="{true}" class:bx--type-delta="{true}"
class:labelClass> class:labelClass
>
{label} {label}
</p> </p>
{/if} {/if}
@ -60,7 +61,8 @@
<p <p
class:bx--modal-header__heading="{true}" class:bx--modal-header__heading="{true}"
class:bx--type-beta="{true}" class:bx--type-beta="{true}"
class:titleClass> class:titleClass
>
{title} {title}
</p> </p>
{/if} {/if}
@ -72,7 +74,8 @@
class:bx--modal-close="{true}" class:bx--modal-close="{true}"
class:closeClass class:closeClass
on:click on:click
on:click="{closeModal}"> on:click="{closeModal}"
>
<Close20 class="bx--modal-close__icon {closeIconClass}" /> <Close20 class="bx--modal-close__icon {closeIconClass}" />
</button> </button>
</div> </div>

View file

@ -19,7 +19,8 @@
light="{light}" light="{light}"
on:change="{({ detail }) => { on:change="{({ detail }) => {
console.log('on:change', detail); console.log('on:change', detail);
}}"> }}"
>
<Switch {...$$props} text="First section" /> <Switch {...$$props} text="First section" />
<Switch {...$$props} text="Second section" selected /> <Switch {...$$props} text="Second section" selected />
<Switch {...$$props} text="Third section" /> <Switch {...$$props} text="Third section" />
@ -30,7 +31,8 @@
bind:selectedIndex bind:selectedIndex
on:change="{({ detail }) => { on:change="{({ detail }) => {
console.log('on:change', detail); console.log('on:change', detail);
}}"> }}"
>
<Switch {...$$props} text="First section" /> <Switch {...$$props} text="First section" />
<Switch {...$$props} text="Second section" /> <Switch {...$$props} text="Second section" />
<Switch {...$$props}> <Switch {...$$props}>
@ -44,7 +46,8 @@
style="margin-top: 1.5rem" style="margin-top: 1.5rem"
on:click="{() => { on:click="{() => {
selectedIndex = 1; selectedIndex = 1;
}}"> }}"
>
Programmatically set to second index Programmatically set to second index
</div> </div>
{/if} {/if}

View file

@ -64,6 +64,7 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<slot /> <slot />
</div> </div>

View file

@ -75,7 +75,8 @@
} else if (key === 'ArrowLeft') { } else if (key === 'ArrowLeft') {
ctx.change(-1); ctx.change(-1);
} }
}}"> }}"
>
<span class:bx--content-switcher__label="{true}"> <span class:bx--content-switcher__label="{true}">
<slot>{text}</slot> <slot>{text}</slot>
</span> </span>

View file

@ -51,14 +51,16 @@
if (animationName === 'hide-feedback') { if (animationName === 'hide-feedback') {
animation = undefined; animation = undefined;
} }
}}"> }}"
>
<slot> <slot>
{#if animation}{feedback || $$restProps['aria-label']}{/if} {#if animation}{feedback || $$restProps['aria-label']}{/if}
</slot> </slot>
<span <span
aria-hidden="true" aria-hidden="true"
class:bx--assistive-text="{true}" class:bx--assistive-text="{true}"
class:bx--copy-btn__feedback="{true}"> class:bx--copy-btn__feedback="{true}"
>
{feedback} {feedback}
</span> </span>
</button> </button>

View file

@ -9,4 +9,5 @@
}}" }}"
on:animationend="{(e) => { on:animationend="{(e) => {
console.log('animation end', e.animationName); console.log('animation end', e.animationName);
}}" /> }}"
/>

View file

@ -15,6 +15,7 @@
title="{iconDescription}" title="{iconDescription}"
{...$$restProps} {...$$restProps}
on:click on:click
on:animationend> on:animationend
>
<Copy16 class="bx--snippet__icon" /> <Copy16 class="bx--snippet__icon" />
</Copy> </Copy>

View file

@ -82,7 +82,8 @@
<TableContainer <TableContainer
title="DataTable" title="DataTable"
description="With default options" description="With default options"
{...props.getTableContainerProps()}> {...props.getTableContainerProps()}
>
<Table {...props.getTableProps()}> <Table {...props.getTableProps()}>
<TableHead> <TableHead>
<TableRow> <TableRow>
@ -126,7 +127,8 @@
console.log('on:click:cell', detail); console.log('on:click:cell', detail);
}}" }}"
rows="{rows}" rows="{rows}"
headers="{headers}" /> headers="{headers}"
/>
{:else} {:else}
<DataTable <DataTable
title="{$$props.title}" title="{$$props.title}"
@ -147,5 +149,6 @@
console.log('on:click:cell', detail); console.log('on:click:cell', detail);
}}" }}"
rows="{rows}" rows="{rows}"
headers="{headers}" /> headers="{headers}"
/>
{/if} {/if}

View file

@ -121,7 +121,8 @@
zebra="{zebra}" zebra="{zebra}"
size="{size}" size="{size}"
stickyHeader="{stickyHeader}" stickyHeader="{stickyHeader}"
sortable="{sortable}"> sortable="{sortable}"
>
<TableHead> <TableHead>
<TableRow> <TableRow>
{#each headers as header, i (header.key)} {#each headers as header, i (header.key)}
@ -137,7 +138,8 @@
key: header.key, key: header.key,
sortDirection, sortDirection,
}); });
}}"> }}"
>
{header.value} {header.value}
</TableHeader> </TableHeader>
{/each} {/each}
@ -149,13 +151,15 @@
on:click="{() => { on:click="{() => {
dispatch('click', { row }); dispatch('click', { row });
dispatch('click:row', row); dispatch('click:row', row);
}}"> }}"
>
{#each row.cells as cell, j (cell.key)} {#each row.cells as cell, j (cell.key)}
<TableCell <TableCell
on:click="{() => { on:click="{() => {
dispatch('click', { row, cell }); dispatch('click', { row, cell });
dispatch('click:cell', cell); dispatch('click:cell', cell);
}}"> }}"
>
{cell.value} {cell.value}
</TableCell> </TableCell>
{/each} {/each}

View file

@ -47,7 +47,8 @@
class:bx--data-table--zebra="{zebra}" class:bx--data-table--zebra="{zebra}"
class:bx--data-table--static="{useStaticWidth}" class:bx--data-table--static="{useStaticWidth}"
class:bx--data-table--no-border="{!shouldShowBorder}" class:bx--data-table--no-border="{!shouldShowBorder}"
class:bx--data-table--sticky-header="{stickyHeader}"> class:bx--data-table--sticky-header="{stickyHeader}"
>
<slot /> <slot />
</table> </table>
</section> </section>
@ -62,7 +63,8 @@
class:bx--data-table--static="{useStaticWidth}" class:bx--data-table--static="{useStaticWidth}"
class:bx--data-table--no-border="{!shouldShowBorder}" class:bx--data-table--no-border="{!shouldShowBorder}"
class:bx--data-table--sticky-header="{stickyHeader}" class:bx--data-table--sticky-header="{stickyHeader}"
{...$$restProps}> {...$$restProps}
>
<slot /> <slot />
</table> </table>
{/if} {/if}

View file

@ -21,7 +21,8 @@
<div <div
class:bx--data-table-container="{true}" class:bx--data-table-container="{true}"
class:bx--data-table--max-width="{stickyHeader}" class:bx--data-table--max-width="{stickyHeader}"
{...$$restProps}> {...$$restProps}
>
{#if title} {#if title}
<div class:bx--data-table-header="{true}"> <div class:bx--data-table-header="{true}">
<h4 class:bx--data-table-header__title="{true}">{title}</h4> <h4 class:bx--data-table-header__title="{true}">{title}</h4>

View file

@ -38,19 +38,22 @@
{...$$restProps} {...$$restProps}
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<button <button
class:bx--table-sort="{true}" class:bx--table-sort="{true}"
class:bx--table-sort--active="{active}" class:bx--table-sort--active="{active}"
class:bx--table-sort--ascending="{active && $sortHeader.sortDirection === 'descending'}" class:bx--table-sort--ascending="{active && $sortHeader.sortDirection === 'descending'}"
on:click> on:click
>
<span class:bx--table-header-label="{true}"> <span class:bx--table-header-label="{true}">
<slot /> <slot />
</span> </span>
<ArrowUp20 aria-label="{ariaLabel}" class="bx--table-sort__icon" /> <ArrowUp20 aria-label="{ariaLabel}" class="bx--table-sort__icon" />
<ArrowsVertical20 <ArrowsVertical20
aria-label="{ariaLabel}" aria-label="{ariaLabel}"
class="bx--table-sort__icon-unsorted" /> class="bx--table-sort__icon-unsorted"
/>
</button> </button>
</th> </th>
{:else} {:else}
@ -61,7 +64,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<span class:bx--table-header-label="{true}"> <span class:bx--table-header-label="{true}">
<slot /> <slot />
</span> </span>

View file

@ -14,6 +14,7 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<slot /> <slot />
</tr> </tr>

View file

@ -15,7 +15,7 @@
* Set the size of the data table * Set the size of the data table
* @type {"compact" | "short" | "tall"} [size] * @type {"compact" | "short" | "tall"} [size]
*/ */
export let size = undefined; export let size = undefined;
/** /**
* Set to `true` to apply zebra styles to the datatable rows * Set to `true` to apply zebra styles to the datatable rows
@ -61,7 +61,8 @@
<span <span
class:bx--skeleton="{true}" class:bx--skeleton="{true}"
class:bx--btn="{true}" class:bx--btn="{true}"
class:bx--btn--sm="{true}"></span> class:bx--btn--sm="{true}"
></span>
</div> </div>
</section> </section>
{/if} {/if}
@ -76,7 +77,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<thead> <thead>
<tr> <tr>
{#each cols as col, i (col)} {#each cols as col, i (col)}

View file

@ -18,19 +18,22 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<div <div
class:bx--date-picker="{true}" class:bx--date-picker="{true}"
class:bx--skeleton="{true}" class:bx--skeleton="{true}"
class:bx--date-picker--range="{true}" class:bx--date-picker--range="{true}"
class:bx--date-picker--short="{!range}" class:bx--date-picker--short="{!range}"
class:bx--date-picker--simple="{!range}"> class:bx--date-picker--simple="{!range}"
>
{#each Array.from({ length: range ? 2 : 1 }, (_, i) => i) as input, i (input)} {#each Array.from({ length: range ? 2 : 1 }, (_, i) => i) as input, i (input)}
<div class:bx--date-picker-container="{true}"> <div class:bx--date-picker-container="{true}">
<label for="{id}" class:bx--label="{true}"></label> <label for="{id}" class:bx--label="{true}"></label>
<div <div
class:bx--date-picker__input="{true}" class:bx--date-picker__input="{true}"
class:bx--skeleton="{true}"></div> class:bx--skeleton="{true}"
></div>
</div> </div>
{/each} {/each}
</div> </div>

View file

@ -19,7 +19,8 @@
datePickerType="single" datePickerType="single"
on:change="{({ detail }) => { on:change="{({ detail }) => {
console.log('change', detail); console.log('change', detail);
}}"> }}"
>
<DatePickerInput <DatePickerInput
{...$$props.datePickerInput} {...$$props.datePickerInput}
on:close="{() => { on:close="{() => {
@ -27,13 +28,15 @@
}}" }}"
on:input="{() => { on:input="{() => {
console.log('on:input'); console.log('on:input');
}}" /> }}"
/>
</DatePicker> </DatePicker>
<button <button
on:click|preventDefault="{() => { on:click|preventDefault="{() => {
value = '12/12/2020'; value = '12/12/2020';
}}" }}"
style="margin-top: 1rem"> style="margin-top: 1rem"
>
Set date to 12/12/2020 Set date to 12/12/2020
</button> </button>
</div> </div>
@ -42,11 +45,13 @@
<DatePickerInput <DatePickerInput
{...$$props.datePickerInput} {...$$props.datePickerInput}
id="date-picker-input-id-start" id="date-picker-input-id-start"
labelText="Start date" /> labelText="Start date"
/>
<DatePickerInput <DatePickerInput
{...$$props.datePickerInput} {...$$props.datePickerInput}
id="date-picker-input-id-end" id="date-picker-input-id-end"
labelText="End date" /> labelText="End date"
/>
</DatePicker> </DatePicker>
{:else} {:else}
<DatePicker <DatePicker
@ -55,7 +60,8 @@
bind:value bind:value
on:change="{({ detail }) => { on:change="{({ detail }) => {
console.log('on:change', detail); console.log('on:change', detail);
}}"> }}"
>
<DatePickerInput {...$$props.datePickerInput} /> <DatePickerInput {...$$props.datePickerInput} />
</DatePicker> </DatePicker>
{/if} {/if}

View file

@ -191,7 +191,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<div <div
bind:this="{datePickerRef}" bind:this="{datePickerRef}"
id="{id}" id="{id}"
@ -199,7 +200,8 @@
class:bx--date-picker--short="{short}" class:bx--date-picker--short="{short}"
class:bx--date-picker--light="{light}" class:bx--date-picker--light="{light}"
class="{datePickerType && `bx--date-picker--${datePickerType}`} class="{datePickerType && `bx--date-picker--${datePickerType}`}
{datePickerType === 'range' && $labelTextEmpty && 'bx--date-picker--nolabel'}"> {datePickerType === 'range' && $labelTextEmpty && 'bx--date-picker--nolabel'}"
>
<slot /> <slot />
</div> </div>
</div> </div>

View file

@ -102,13 +102,15 @@
<div <div
class:bx--date-picker-container="{true}" class:bx--date-picker-container="{true}"
class:bx--date-picker--nolabel="{!labelText}" class:bx--date-picker--nolabel="{!labelText}"
{...$$restProps}> {...$$restProps}
>
{#if labelText} {#if labelText}
<label <label
for="{id}" for="{id}"
class:bx--label="{true}" class:bx--label="{true}"
class:bx--visually-hidden="{hideLabel}" class:bx--visually-hidden="{hideLabel}"
class:bx--label--disabled="{disabled}"> class:bx--label--disabled="{disabled}"
>
{labelText} {labelText}
</label> </label>
{/if} {/if}
@ -141,14 +143,16 @@
on:blur on:blur
on:blur="{({ relatedTarget }) => { on:blur="{({ relatedTarget }) => {
blurInput(relatedTarget); blurInput(relatedTarget);
}}" /> }}"
/>
{#if $hasCalendar} {#if $hasCalendar}
<Calendar16 <Calendar16
role="img" role="img"
class="bx--date-picker__icon" class="bx--date-picker__icon"
aria-label="{iconDescription}" aria-label="{iconDescription}"
title="{iconDescription}" title="{iconDescription}"
on:click="{openCalendar}" /> on:click="{openCalendar}"
/>
{/if} {/if}
</div> </div>
{#if invalid} {#if invalid}

View file

@ -16,7 +16,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<div role="button" class:bx--list-box__field="{true}"> <div role="button" class:bx--list-box__field="{true}">
<span class:bx--list-box__label="{true}"></span> <span class:bx--list-box__label="{true}"></span>
</div> </div>

View file

@ -25,16 +25,17 @@
<code>items</code> must be an array of objects; mandatory fields are `id` and <code>items</code> must be an array of objects; mandatory fields are `id` and
`text`. `text`.
</p> </p>
<pre <pre style="margin-top: 1rem;">
style="margin-top: 1rem;"> <code
<code>{'items = Array<{ id: string; text: string; }>'}</code> >{'items = Array<{ id: string; text: string; }>'}</code>
</pre> </pre>
<div style="margin-top: 2rem; margin-bottom: 2rem;"> <div style="margin-top: 2rem; margin-bottom: 2rem;">
<Button <Button
size="small" size="small"
on:click="{() => { on:click="{() => {
selectedIndex = selectedIndex > -1 ? -1 : 1; selectedIndex = selectedIndex > -1 ? -1 : 1;
}}"> }}"
>
{selectedIndex > -1 ? 'Clear selected item' : 'Set item to "Option 2"'} {selectedIndex > -1 ? 'Clear selected item' : 'Set item to "Option 2"'}
</Button> </Button>
</div> </div>

View file

@ -157,12 +157,14 @@
class:bx--dropdown__wrapper--inline="{inline}" class:bx--dropdown__wrapper--inline="{inline}"
class:bx--list-box__wrapper--inline="{inline}" class:bx--list-box__wrapper--inline="{inline}"
class:bx--dropdown__wrapper--inline--invalid="{inline && invalid}" class:bx--dropdown__wrapper--inline--invalid="{inline && invalid}"
{...$$restProps}> {...$$restProps}
>
{#if titleText} {#if titleText}
<label <label
for="{id}" for="{id}"
class:bx--label="{true}" class:bx--label="{true}"
class:bx--label--disabled="{disabled}"> class:bx--label--disabled="{disabled}"
>
{titleText} {titleText}
</label> </label>
{/if} {/if}
@ -184,7 +186,8 @@
open="{open}" open="{open}"
invalid="{invalid}" invalid="{invalid}"
invalidText="{invalidText}" invalidText="{invalidText}"
light="{light}"> light="{light}"
>
{#if invalid} {#if invalid}
<WarningFilled16 class="bx--list-box__invalid-icon" /> <WarningFilled16 class="bx--list-box__invalid-icon" />
{/if} {/if}
@ -217,7 +220,8 @@
}}" }}"
disabled="{disabled}" disabled="{disabled}"
translateWithId="{translateWithId}" translateWithId="{translateWithId}"
id="{id}"> id="{id}"
>
<span class="bx--list-box__label"> <span class="bx--list-box__label">
{#if selectedItem}{itemToString(selectedItem)}{:else}{label}{/if} {#if selectedItem}{itemToString(selectedItem)}{:else}{label}{/if}
</span> </span>
@ -236,7 +240,8 @@
}}" }}"
on:mouseenter="{() => { on:mouseenter="{() => {
highlightedIndex = i; highlightedIndex = i;
}}"> }}"
>
{itemToString(item)} {itemToString(item)}
</ListBoxMenuItem> </ListBoxMenuItem>
{/each} {/each}
@ -246,7 +251,8 @@
{#if !inline && !invalid && helperText} {#if !inline && !invalid && helperText}
<div <div
class:bx--form__helper-text="{true}" class:bx--form__helper-text="{true}"
class:bx--form__helper-text--disabled="{disabled}"> class:bx--form__helper-text--disabled="{disabled}"
>
{helperText} {helperText}
</div> </div>
{/if} {/if}

View file

@ -9,7 +9,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<SkeletonText heading width="100px" /> <SkeletonText heading width="100px" />
<SkeletonText width="225px" class="bx--label-description" /> <SkeletonText width="225px" class="bx--label-description" />
<ButtonSkeleton /> <ButtonSkeleton />

View file

@ -21,7 +21,8 @@
{...$$props} {...$$props}
on:add="{({ detail }) => { on:add="{({ detail }) => {
console.log(detail); console.log(detail);
}}" /> }}"
/>
{:else if story === 'item'} {:else if story === 'item'}
<FileUploaderItem <FileUploaderItem
{...$$props} {...$$props}
@ -30,7 +31,8 @@
}}" }}"
on:click="{() => { on:click="{() => {
console.log('click'); console.log('click');
}}" /> }}"
/>
{:else if story === 'uploader'} {:else if story === 'uploader'}
<div class="bx--file__container"> <div class="bx--file__container">
<FileUploader <FileUploader
@ -42,13 +44,15 @@
}}" }}"
on:remove="{({ detail }) => { on:remove="{({ detail }) => {
console.log('remove', detail); console.log('remove', detail);
}}" /> }}"
/>
<Button <Button
kind="secondary" kind="secondary"
size="small" size="small"
style="margin-top: 1rem" style="margin-top: 1rem"
disabled="{disabled}" disabled="{disabled}"
on:click="{fileUploader.clearFiles}"> on:click="{fileUploader.clearFiles}"
>
Clear File{files.length === 1 ? '' : 's'} Clear File{files.length === 1 ? '' : 's'}
</Button> </Button>
</div> </div>

View file

@ -95,7 +95,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<strong class:bx--file--label="{true}">{labelTitle}</strong> <strong class:bx--file--label="{true}">{labelTitle}</strong>
<p class:bx--label-description="{true}">{labelDescription}</p> <p class:bx--label-description="{true}">{labelDescription}</p>
<FileUploaderButton <FileUploaderButton
@ -108,7 +109,8 @@
on:change on:change
on:change="{({ target }) => { on:change="{({ target }) => {
files = [...target.files].map(({ name }) => name); files = [...target.files].map(({ name }) => name);
}}" /> }}"
/>
<div class:bx--file-container="{true}"> <div class:bx--file-container="{true}">
{#each files as name, i (name)} {#each files as name, i (name)}
<span class:bx--file__selected-file="{true}"> <span class:bx--file__selected-file="{true}">
@ -126,7 +128,8 @@
on:click on:click
on:click="{() => { on:click="{() => {
files = files.filter((_, index) => index !== i); files = files.filter((_, index) => index !== i);
}}" /> }}"
/>
</span> </span>
</span> </span>
{/each} {/each}

View file

@ -79,7 +79,8 @@
if (key === ' ' || key === 'Enter') { if (key === ' ' || key === 'Enter') {
ref.click(); ref.click();
} }
}}"> }}"
>
<span role="{role}">{labelText}</span> <span role="{role}">{labelText}</span>
</label> </label>
<input <input
@ -104,4 +105,5 @@
on:click on:click
on:click="{({ target }) => { on:click="{({ target }) => {
target.value = null; target.value = null;
}}" /> }}"
/>

View file

@ -94,7 +94,8 @@
over = false; over = false;
dispatch('add', validateFiles(dataTransfer.files)); dispatch('add', validateFiles(dataTransfer.files));
} }
}}"> }}"
>
<label <label
for="{id}" for="{id}"
tabindex="{tabindex}" tabindex="{tabindex}"
@ -105,11 +106,13 @@
if (key === ' ' || key === 'Enter') { if (key === ' ' || key === 'Enter') {
ref.click(); ref.click();
} }
}}"> }}"
>
<div <div
role="{role}" role="{role}"
class:bx--file__drop-container="{true}" class:bx--file__drop-container="{true}"
class:bx--file__drop-container--drag-over="{over}"> class:bx--file__drop-container--drag-over="{over}"
>
{labelText} {labelText}
<input <input
bind:this="{ref}" bind:this="{ref}"
@ -128,7 +131,8 @@
on:click on:click
on:click="{({ target }) => { on:click="{({ target }) => {
target.value = null; target.value = null;
}}" /> }}"
/>
</div> </div>
</label> </label>
</div> </div>

View file

@ -54,7 +54,8 @@
{...$$restProps} {...$$restProps}
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<p class:bx--file-filename="{true}">{name}</p> <p class:bx--file-filename="{true}">{name}</p>
<span class:bx--file__state-container="{true}"> <span class:bx--file__state-container="{true}">
<Filename <Filename
@ -68,7 +69,8 @@
}}" }}"
iconDescription="{iconDescription}" iconDescription="{iconDescription}"
status="{status}" status="{status}"
invalid="{invalid}" /> invalid="{invalid}"
/>
</span> </span>
{#if invalid && errorSubject} {#if invalid && errorSubject}
<div class:bx--form-requirement="{true}"> <div class:bx--form-requirement="{true}">

View file

@ -28,7 +28,8 @@
description="{iconDescription}" description="{iconDescription}"
{...$$restProps} {...$$restProps}
small small
withOverlay="{false}" /> withOverlay="{false}"
/>
{/if} {/if}
{#if status === 'edit'} {#if status === 'edit'}
@ -41,7 +42,8 @@
class="bx--file-close" class="bx--file-close"
{...$$restProps} {...$$restProps}
on:click on:click
on:keydown /> on:keydown
/>
{/if} {/if}
{#if status === 'complete'} {#if status === 'complete'}
@ -49,5 +51,6 @@
aria-label="{iconDescription}" aria-label="{iconDescription}"
title="{iconDescription}" title="{iconDescription}"
class="bx--file-complete" class="bx--file-complete"
{...$$restProps} /> {...$$restProps}
/>
{/if} {/if}

View file

@ -17,7 +17,8 @@
<Form <Form
on:submit="{(event) => { on:submit="{(event) => {
console.log('on:submit', event); console.log('on:submit', event);
}}"> }}"
>
<FormGroup {...$$props}> <FormGroup {...$$props}>
<Checkbox id="checkbox-0" labelText="Checkbox Label" checked /> <Checkbox id="checkbox-0" labelText="Checkbox Label" checked />
<Checkbox id="checkbox-1" labelText="Checkbox Label" /> <Checkbox id="checkbox-1" labelText="Checkbox Label" />
@ -29,7 +30,8 @@
min="{0}" min="{0}"
max="{100}" max="{100}"
value="{50}" value="{50}"
step="{10}" /> step="{10}"
/>
<FormGroup legendText="Toggle heading"> <FormGroup legendText="Toggle heading">
<Toggle id="toggle-1" /> <Toggle id="toggle-1" />
<Toggle id="toggle-2" disabled /> <Toggle id="toggle-2" disabled />
@ -38,29 +40,35 @@
<FileUploader <FileUploader
id="file-1" id="file-1"
buttonLabel="Add files" buttonLabel="Add files"
labelDescription="Choose Files..." /> labelDescription="Choose Files..."
/>
</FormGroup> </FormGroup>
<FormGroup legendText="Radio Button heading"> <FormGroup legendText="Radio Button heading">
<RadioButtonGroup <RadioButtonGroup
name="radio-button-group" name="radio-button-group"
defaultSelected="default-selected"> defaultSelected="default-selected"
>
<RadioButton <RadioButton
id="radio-1" id="radio-1"
value="standard" value="standard"
labelText="Standard Radio Button" /> labelText="Standard Radio Button"
/>
<RadioButton <RadioButton
id="radio-2" id="radio-2"
value="default-selected" value="default-selected"
labelText="Default Selected Radio Button" /> labelText="Default Selected Radio Button"
/>
<RadioButton <RadioButton
id="radio-3" id="radio-3"
value="blue" value="blue"
labelText="Standard Radio Button" /> labelText="Standard Radio Button"
/>
<RadioButton <RadioButton
id="radio-4" id="radio-4"
value="disabled" value="disabled"
labelText="Disabled Radio Button" labelText="Disabled Radio Button"
disabled /> disabled
/>
</RadioButtonGroup> </RadioButtonGroup>
</FormGroup> </FormGroup>
<FormGroup legendText="Search"> <FormGroup legendText="Search">
@ -71,7 +79,8 @@
disabled disabled
hidden hidden
value="placeholder-item" value="placeholder-item"
text="Choose an option" /> text="Choose an option"
/>
<SelectItem value="option-1" text="Option 1" /> <SelectItem value="option-1" text="Option 1" />
<SelectItem value="option-2" text="Option 2" /> <SelectItem value="option-2" text="Option 2" />
<SelectItem value="option-3" text="Option 3" /> <SelectItem value="option-3" text="Option 3" />
@ -79,7 +88,8 @@
<TextInput <TextInput
id="text-input-1" id="text-input-1"
labelText="Text Input label" labelText="Text Input label"
placeholder="Placeholder text" /> placeholder="Placeholder text"
/>
<TextInput id="text-input-2" type="password" labelText="Password" required /> <TextInput id="text-input-2" type="password" labelText="Password" required />
<TextInput <TextInput
id="text-input-3" id="text-input-3"
@ -88,12 +98,14 @@
invalidText="Your password must be at least 6 characters as well as contain invalidText="Your password must be at least 6 characters as well as contain
at least one uppercase, one lowercase, and one number." at least one uppercase, one lowercase, and one number."
required required
invalid /> invalid
/>
<TextArea <TextArea
id="text-area" id="text-area"
labelText="Text Area label" labelText="Text Area label"
placeholder="Placeholder text" placeholder="Placeholder text"
rows="{4}" rows="{4}"
cols="{50}" /> cols="{50}"
/>
<Button type="submit">Submit</Button> <Button type="submit">Submit</Button>
</Form> </Form>

View file

@ -5,6 +5,7 @@
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave on:mouseleave
on:submit|preventDefault> on:submit|preventDefault
>
<slot /> <slot />
</form> </form>

View file

@ -31,7 +31,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<legend class:bx--label="{true}">{legendText}</legend> <legend class:bx--label="{true}">{legendText}</legend>
<slot /> <slot />
{#if message} {#if message}

View file

@ -4,6 +4,7 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<slot /> <slot />
</div> </div>

View file

@ -13,6 +13,7 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<slot /> <slot />
</label> </label>

View file

@ -13,4 +13,5 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave></div> on:mouseleave
></div>

View file

@ -25,7 +25,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave /> on:mouseleave
/>
{:else} {:else}
<svelte:component <svelte:component
this="{render}" this="{render}"
@ -33,5 +34,6 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave /> on:mouseleave
/>
{/if} {/if}

View file

@ -43,7 +43,8 @@
style="margin-left: 1rem;" style="margin-left: 1rem;"
description="{loadingDescription}" description="{loadingDescription}"
status="{success ? 'finished' : 'active'}" status="{success ? 'finished' : 'active'}"
aria-live="{ariaLive}" /> aria-live="{ariaLive}"
/>
{:else} {:else}
<Button on:click="{handleSubmit}">Submit</Button> <Button on:click="{handleSubmit}">Submit</Button>
{/if} {/if}

View file

@ -53,7 +53,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<div class:bx--inline-loading__animation="{true}"> <div class:bx--inline-loading__animation="{true}">
{#if status === 'error'} {#if status === 'error'}
<Error20 class="bx--inline-loading--error" /> <Error20 class="bx--inline-loading--error" />
@ -64,7 +65,8 @@
small small
description="{iconDescription}" description="{iconDescription}"
withOverlay="{false}" withOverlay="{false}"
active="{status === 'active'}" /> active="{status === 'active'}"
/>
{/if} {/if}
</div> </div>
{#if description} {#if description}

View file

@ -9,6 +9,6 @@ export const Default = () => ({
href: text("The link href (href)", "#"), href: text("The link href (href)", "#"),
inline: boolean("Use the in-line variant (inline)", false), inline: boolean("Use the in-line variant (inline)", false),
disabled: boolean("Disabled (disabled)", false), disabled: boolean("Disabled (disabled)", false),
visited: boolean('Allow visited styles', false), visited: boolean("Allow visited styles", false),
}, },
}); });

View file

@ -35,7 +35,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<slot /> <slot />
</p> </p>
{:else} {:else}
@ -51,7 +52,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<slot /> <slot />
</a> </a>
{/if} {/if}

View file

@ -59,7 +59,8 @@
e.stopPropagation(); e.stopPropagation();
} }
}}" }}"
on:click|preventDefault|stopPropagation> on:click|preventDefault|stopPropagation
>
<slot /> <slot />
</div> </div>
{#if invalid} {#if invalid}

View file

@ -78,6 +78,7 @@
on:mouseenter on:mouseenter
on:mouseleave on:mouseleave
on:keydown|preventDefault|stopPropagation on:keydown|preventDefault|stopPropagation
on:blur> on:blur
>
<slot /> <slot />
</div> </div>

View file

@ -10,6 +10,7 @@
role="listbox" role="listbox"
id="menu-{id}" id="menu-{id}"
class:bx--list-box__menu="{true}" class:bx--list-box__menu="{true}"
{...$$restProps}> {...$$restProps}
>
<slot /> <slot />
</div> </div>

View file

@ -36,6 +36,7 @@
class:bx--list-box__menu-icon="{true}" class:bx--list-box__menu-icon="{true}"
class:bx--list-box__menu-icon--open="{open}" class:bx--list-box__menu-icon--open="{open}"
{...$$restProps} {...$$restProps}
on:click|preventDefault> on:click|preventDefault
>
<ChevronDown16 aria-label="{description}" title="{description}" /> <ChevronDown16 aria-label="{description}" title="{description}" />
</div> </div>

View file

@ -19,7 +19,8 @@
{...$$restProps} {...$$restProps}
on:click on:click
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<div class:bx--list-box__menu-item__option="{true}"> <div class:bx--list-box__menu-item__option="{true}">
<slot /> <slot />
</div> </div>

View file

@ -75,7 +75,8 @@
if (!disabled && e.key === 'Enter') { if (!disabled && e.key === 'Enter') {
dispatch('clear', e); dispatch('clear', e);
} }
}}"> }}"
>
{#if selectionCount}{selectionCount}{/if} {#if selectionCount}{selectionCount}{/if}
<Close16 /> <Close16 />
</div> </div>

View file

@ -4,6 +4,7 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<slot /> <slot />
</li> </li>

View file

@ -36,14 +36,16 @@
<div <div
class:bx--loading-overlay="{true}" class:bx--loading-overlay="{true}"
class:bx--loading-overlay--stop="{!active}" class:bx--loading-overlay--stop="{!active}"
{...$$restProps}> {...$$restProps}
>
<div <div
aria-atomic="true" aria-atomic="true"
aria-labelledby="{id}" aria-labelledby="{id}"
aria-live="{active ? 'assertive' : 'off'}" aria-live="{active ? 'assertive' : 'off'}"
class:bx--loading="{true}" class:bx--loading="{true}"
class:bx--loading--small="{small}" class:bx--loading--small="{small}"
class:bx--loading--stop="{!active}"> class:bx--loading--stop="{!active}"
>
<!-- svelte-ignore a11y-label-has-associated-control --> <!-- svelte-ignore a11y-label-has-associated-control -->
<label class:bx--visually-hidden="{true}" id="{id}">{description}</label> <label class:bx--visually-hidden="{true}" id="{id}">{description}</label>
<svg class:bx--loading__svg="{true}" viewBox="-75 -75 150 150"> <svg class:bx--loading__svg="{true}" viewBox="-75 -75 150 150">
@ -53,13 +55,15 @@
class:bx--loading__background="{true}" class:bx--loading__background="{true}"
cx="0" cx="0"
cy="0" cy="0"
r="{spinnerRadius}"></circle> r="{spinnerRadius}"
></circle>
{/if} {/if}
<circle <circle
class:bx--loading__stroke="{true}" class:bx--loading__stroke="{true}"
cx="0" cx="0"
cy="0" cy="0"
r="{spinnerRadius}"></circle> r="{spinnerRadius}"
></circle>
</svg> </svg>
</div> </div>
</div> </div>
@ -71,7 +75,8 @@
class:bx--loading="{true}" class:bx--loading="{true}"
class:bx--loading--small="{small}" class:bx--loading--small="{small}"
class:bx--loading--stop="{!active}" class:bx--loading--stop="{!active}"
{...$$restProps}> {...$$restProps}
>
<!-- svelte-ignore a11y-label-has-associated-control --> <!-- svelte-ignore a11y-label-has-associated-control -->
<label class:bx--visually-hidden="{true}" id="{id}">{description}</label> <label class:bx--visually-hidden="{true}" id="{id}">{description}</label>
<svg class:bx--loading__svg="{true}" viewBox="-75 -75 150 150"> <svg class:bx--loading__svg="{true}" viewBox="-75 -75 150 150">
@ -81,13 +86,15 @@
class:bx--loading__background="{true}" class:bx--loading__background="{true}"
cx="0" cx="0"
cy="0" cy="0"
r="{spinnerRadius}"></circle> r="{spinnerRadius}"
></circle>
{/if} {/if}
<circle <circle
class:bx--loading__stroke="{true}" class:bx--loading__stroke="{true}"
cx="0" cx="0"
cy="0" cy="0"
r="{spinnerRadius}"></circle> r="{spinnerRadius}"
></circle>
</svg> </svg>
</div> </div>
{/if} {/if}

View file

@ -11,7 +11,8 @@
<Button <Button
on:click="{() => { on:click="{() => {
open = true; open = true;
}}"> }}"
>
Launch modal Launch modal
</Button> </Button>
</div> </div>
@ -33,7 +34,8 @@
}}" }}"
on:submit="{() => { on:submit="{() => {
console.log('submit'); console.log('submit');
}}"> }}"
>
<div> <div>
<PasswordInput bind:type placeholder="Password Input" aria-level="" /> <PasswordInput bind:type placeholder="Password Input" aria-level="" />
<Button <Button
@ -41,7 +43,8 @@
size="field" size="field"
on:click="{() => { on:click="{() => {
type = type === 'password' ? 'text' : 'password'; type = type === 'password' ? 'text' : 'password';
}}"> }}"
>
Programmatically toggle password Programmatically toggle password
</Button> </Button>
</div> </div>

View file

@ -16,7 +16,7 @@ export const Default = () => ({
open: boolean("Open (open)", true), open: boolean("Open (open)", true),
passiveModal: boolean("Without footer (passiveModal)", false), passiveModal: boolean("Without footer (passiveModal)", false),
danger: boolean("Danger mode (danger)", false), danger: boolean("Danger mode (danger)", false),
alert: boolean('Alert mode (alert)', false), alert: boolean("Alert mode (alert)", false),
shouldSubmitOnEnter: boolean( shouldSubmitOnEnter: boolean(
"Enter key to submit (shouldSubmitOnEnter)", "Enter key to submit (shouldSubmitOnEnter)",
false false

View file

@ -196,7 +196,8 @@
}}" }}"
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<div <div
bind:this="{innerModal}" bind:this="{innerModal}"
role="dialog" role="dialog"
@ -207,7 +208,8 @@
class="{size && `bx--modal-container--${size}`}" class="{size && `bx--modal-container--${size}`}"
on:click="{() => { on:click="{() => {
didClickInnerModal = true; didClickInnerModal = true;
}}"> }}"
>
<div class:bx--modal-header="{true}"> <div class:bx--modal-header="{true}">
{#if passiveModal} {#if passiveModal}
<button <button
@ -218,10 +220,12 @@
class="bx--modal-close" class="bx--modal-close"
on:click="{() => { on:click="{() => {
open = false; open = false;
}}"> }}"
>
<Close20 <Close20
aria-label="{iconDescription}" aria-label="{iconDescription}"
class="bx--modal-close__icon" /> class="bx--modal-close__icon"
/>
</button> </button>
{/if} {/if}
{#if modalLabel} {#if modalLabel}
@ -241,10 +245,12 @@
class:bx--modal-close="{true}" class:bx--modal-close="{true}"
on:click="{() => { on:click="{() => {
open = false; open = false;
}}"> }}"
>
<Close20 <Close20
aria-label="{iconDescription}" aria-label="{iconDescription}"
class="bx--modal-close__icon" /> class="bx--modal-close__icon"
/>
</button> </button>
{/if} {/if}
</div> </div>
@ -256,7 +262,8 @@
tabindex="{hasScrollingContent ? '0' : undefined}" tabindex="{hasScrollingContent ? '0' : undefined}"
role="{hasScrollingContent ? 'region' : undefined}" role="{hasScrollingContent ? 'region' : undefined}"
aria-label="{hasScrollingContent ? ariaLabel : undefined}" aria-label="{hasScrollingContent ? ariaLabel : undefined}"
aria-labelledby="{modalLabel ? modalLabelId : modalHeadingId}"> aria-labelledby="{modalLabel ? modalLabelId : modalHeadingId}"
>
<slot /> <slot />
</div> </div>
{#if hasScrollingContent} {#if hasScrollingContent}
@ -268,7 +275,8 @@
kind="secondary" kind="secondary"
on:click="{() => { on:click="{() => {
dispatch('click:button--secondary'); dispatch('click:button--secondary');
}}"> }}"
>
{secondaryButtonText} {secondaryButtonText}
</Button> </Button>
<Button <Button
@ -276,7 +284,8 @@
disabled="{primaryButtonDisabled}" disabled="{primaryButtonDisabled}"
on:click="{() => { on:click="{() => {
dispatch('submit'); dispatch('submit');
}}"> }}"
>
{primaryButtonText} {primaryButtonText}
</Button> </Button>
</div> </div>

View file

@ -22,7 +22,8 @@
size="small" size="small"
on:click="{() => { on:click="{() => {
selectedIds = selectedIds.length > 0 ? [] : [items[1].id, items[2].id]; selectedIds = selectedIds.length > 0 ? [] : [items[1].id, items[2].id];
}}"> }}"
>
{selectedIds.length > 0 ? 'Clear' : 'Set initial'} selected items {selectedIds.length > 0 ? 'Clear' : 'Set initial'} selected items
</Button> </Button>
</div> </div>
@ -34,5 +35,6 @@
placeholder="Filter..." placeholder="Filter..."
bind:selectedIds bind:selectedIds
bind:items bind:items
bind:value /> bind:value
/>
</div> </div>

View file

@ -259,12 +259,14 @@
class:bx--multi-select__wrapper--inline="{inline}" class:bx--multi-select__wrapper--inline="{inline}"
class:bx--list-box__wrapper--inline="{inline}" class:bx--list-box__wrapper--inline="{inline}"
class:bx--multi-select__wrapper--inline--invalid="{inline && invalid}" class:bx--multi-select__wrapper--inline--invalid="{inline && invalid}"
{...$$restProps}> {...$$restProps}
>
{#if titleText} {#if titleText}
<label <label
for="{id}" for="{id}"
class:bx--label="{true}" class:bx--label="{true}"
class:bx--label--disabled="{disabled}"> class:bx--label--disabled="{disabled}"
>
{titleText} {titleText}
</label> </label>
{/if} {/if}
@ -281,7 +283,8 @@
{filterable && 'bx--multi-select--filterable'} {filterable && 'bx--multi-select--filterable'}
{invalid && 'bx--multi-select--invalid'} {invalid && 'bx--multi-select--invalid'}
{inline && 'bx--multi-select--inline'} {inline && 'bx--multi-select--inline'}
{checked.length > 0 && 'bx--multi-select--selected'}"> {checked.length > 0 && 'bx--multi-select--selected'}"
>
{#if invalid} {#if invalid}
<WarningFilled16 class="bx--list-box__invalid-icon" /> <WarningFilled16 class="bx--list-box__invalid-icon" />
{/if} {/if}
@ -327,7 +330,8 @@
}}" }}"
id="{id}" id="{id}"
disabled="{disabled}" disabled="{disabled}"
translateWithId="{translateWithId}"> translateWithId="{translateWithId}"
>
{#if checked.length > 0} {#if checked.length > 0}
<ListBoxSelection <ListBoxSelection
selectionCount="{checked.length}" selectionCount="{checked.length}"
@ -339,7 +343,8 @@
fieldRef.blur(); fieldRef.blur();
}}" }}"
translateWithId="{translateWithId}" translateWithId="{translateWithId}"
disabled="{disabled}" /> disabled="{disabled}"
/>
{/if} {/if}
{#if filterable} {#if filterable}
<input <input
@ -383,7 +388,8 @@
placeholder="{placeholder}" placeholder="{placeholder}"
id="{id}" id="{id}"
name="{name}" name="{name}"
value="{inputValue}" /> value="{inputValue}"
/>
{#if invalid} {#if invalid}
<WarningFilled16 class="bx--list-box__invalid-icon" /> <WarningFilled16 class="bx--list-box__invalid-icon" />
{/if} {/if}
@ -395,7 +401,8 @@
}}" }}"
translateWithId="{translateWithId}" translateWithId="{translateWithId}"
disabled="{disabled}" disabled="{disabled}"
open="{open}" /> open="{open}"
/>
{/if} {/if}
<ListBoxMenuIcon <ListBoxMenuIcon
on:click="{(e) => { on:click="{(e) => {
@ -403,7 +410,8 @@
open = !open; open = !open;
}}" }}"
translateWithId="{translateWithId}" translateWithId="{translateWithId}"
open="{open}" /> open="{open}"
/>
{/if} {/if}
{#if !filterable} {#if !filterable}
<span class="bx--list-box__label">{label}</span> <span class="bx--list-box__label">{label}</span>
@ -425,7 +433,8 @@
}}" }}"
on:mouseenter="{() => { on:mouseenter="{() => {
highlightedIndex = i; highlightedIndex = i;
}}"> }}"
>
<Checkbox <Checkbox
readonly readonly
tabindex="-1" tabindex="-1"
@ -434,7 +443,8 @@
name="{itemToString(item)}" name="{itemToString(item)}"
labelText="{itemToString(item)}" labelText="{itemToString(item)}"
checked="{item.checked}" checked="{item.checked}"
disabled="{disabled}" /> disabled="{disabled}"
/>
</ListBoxMenuItem> </ListBoxMenuItem>
{/each} {/each}
</ListBoxMenu> </ListBoxMenu>
@ -443,7 +453,8 @@
{#if !inline && !invalid && helperText} {#if !inline && !invalid && helperText}
<div <div
class:bx--form__helper-text="{true}" class:bx--form__helper-text="{true}"
class:bx--form__helper-text--disabled="{disabled}"> class:bx--form__helper-text--disabled="{disabled}"
>
{helperText} {helperText}
</div> </div>
{/if} {/if}

View file

@ -91,16 +91,19 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<div class:bx--inline-notification__details="{true}"> <div class:bx--inline-notification__details="{true}">
<NotificationIcon <NotificationIcon
notificationType="{notificationType}" notificationType="{notificationType}"
kind="{kind}" kind="{kind}"
iconDescription="{iconDescription}" /> iconDescription="{iconDescription}"
/>
<NotificationTextDetails <NotificationTextDetails
title="{title}" title="{title}"
subtitle="{subtitle}" subtitle="{subtitle}"
notificationType="{notificationType}"> notificationType="{notificationType}"
>
<slot /> <slot />
</NotificationTextDetails> </NotificationTextDetails>
</div> </div>
@ -109,7 +112,8 @@
<NotificationButton <NotificationButton
iconDescription="{iconDescription}" iconDescription="{iconDescription}"
notificationType="{notificationType}" notificationType="{notificationType}"
on:click="{close}" /> on:click="{close}"
/>
{/if} {/if}
</div> </div>
{/if} {/if}

View file

@ -11,7 +11,8 @@
{...$$props} {...$$props}
on:close="{() => { on:close="{() => {
console.log('on:close'); console.log('on:close');
}}"> }}"
>
<div slot="actions"> <div slot="actions">
<NotificationActionButton>{$$props.action}</NotificationActionButton> <NotificationActionButton>{$$props.action}</NotificationActionButton>
</div> </div>
@ -22,5 +23,6 @@
on:close="{() => { on:close="{() => {
console.log('on:close'); console.log('on:close');
}}" }}"
style="min-width: 30rem; margin-bottom: .5rem" /> style="min-width: 30rem; margin-bottom: .5rem"
/>
{/if} {/if}

View file

@ -10,6 +10,7 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<slot /> <slot />
</Button> </Button>

View file

@ -36,10 +36,12 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<svelte:component <svelte:component
this="{renderIcon}" this="{renderIcon}"
title="{title}" title="{title}"
class="{notificationType === 'toast' && 'bx--toast-notification__close-icon'} class="{notificationType === 'toast' && 'bx--toast-notification__close-icon'}
{notificationType === 'inline' && 'bx--inline-notification__close-icon'}" /> {notificationType === 'inline' && 'bx--inline-notification__close-icon'}"
/>
</button> </button>

View file

@ -37,4 +37,5 @@
<svelte:component <svelte:component
this="{icons[kind]}" this="{icons[kind]}"
title="{iconDescription}" title="{iconDescription}"
class="bx--{notificationType}-notification__icon" /> class="bx--{notificationType}-notification__icon"
/>

View file

@ -96,23 +96,27 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<NotificationIcon <NotificationIcon
notificationType="{notificationType}" notificationType="{notificationType}"
kind="{kind}" kind="{kind}"
iconDescription="{iconDescription}" /> iconDescription="{iconDescription}"
/>
<NotificationTextDetails <NotificationTextDetails
title="{title}" title="{title}"
subtitle="{subtitle}" subtitle="{subtitle}"
caption="{caption}" caption="{caption}"
notificationType="{notificationType}"> notificationType="{notificationType}"
>
<slot /> <slot />
</NotificationTextDetails> </NotificationTextDetails>
{#if !hideCloseButton} {#if !hideCloseButton}
<NotificationButton <NotificationButton
iconDescription="{iconDescription}" iconDescription="{iconDescription}"
notificationType="{notificationType}" notificationType="{notificationType}"
on:click="{close}" /> on:click="{close}"
/>
{/if} {/if}
</div> </div>
{/if} {/if}

View file

@ -12,7 +12,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
{#if !hideLabel} {#if !hideLabel}
<span class:bx--label="{true}" class:bx--skeleton="{true}"></span> <span class:bx--label="{true}" class:bx--skeleton="{true}"></span>
{/if} {/if}

View file

@ -17,5 +17,6 @@
bind:value bind:value
on:change="{({ detail }) => { on:change="{({ detail }) => {
console.log('on:change', detail); console.log('on:change', detail);
}}" /> }}"
/>
{/if} {/if}

View file

@ -178,7 +178,8 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<div <div
data-invalid="{error || undefined}" data-invalid="{error || undefined}"
class:bx--number="{true}" class:bx--number="{true}"
@ -187,14 +188,16 @@
class:bx--number--light="{light}" class:bx--number--light="{light}"
class:bx--number--nolabel="{hideLabel}" class:bx--number--nolabel="{hideLabel}"
class:bx--number--mobile="{mobile}" class:bx--number--mobile="{mobile}"
class="{size && `bx--number--${size}`}"> class="{size && `bx--number--${size}`}"
>
{#if mobile} {#if mobile}
{#if label} {#if label}
<label <label
for="{id}" for="{id}"
class:bx--label="{true}" class:bx--label="{true}"
class:bx--label--disabled="{disabled}" class:bx--label--disabled="{disabled}"
class:bx--visually-hidden="{hideLabel}"> class:bx--visually-hidden="{hideLabel}"
>
<slot name="label">{label}</slot> <slot name="label">{label}</slot>
</label> </label>
{/if} {/if}
@ -210,7 +213,8 @@
on:click="{() => { on:click="{() => {
updateValue(-1); updateValue(-1);
}}" }}"
disabled="{disabled}"> disabled="{disabled}"
>
<CaretDownGlyph class="down-icon" /> <CaretDownGlyph class="down-icon" />
</button> </button>
<input <input
@ -229,7 +233,8 @@
min="{min}" min="{min}"
step="{step}" step="{step}"
value="{value}" value="{value}"
readonly="{readonly}" /> readonly="{readonly}"
/>
<button <button
type="button" type="button"
aria-live="polite" aria-live="polite"
@ -241,7 +246,8 @@
on:click="{() => { on:click="{() => {
updateValue(1); updateValue(1);
}}" }}"
disabled="{disabled}"> disabled="{disabled}"
>
<CaretUpGlyph class="up-icon" /> <CaretUpGlyph class="up-icon" />
</button> </button>
</div> </div>
@ -251,7 +257,8 @@
for="{id}" for="{id}"
class:bx--label="{true}" class:bx--label="{true}"
class:bx--label--disabled="{disabled}" class:bx--label--disabled="{disabled}"
class:bx--visually-hidden="{hideLabel}"> class:bx--visually-hidden="{hideLabel}"
>
<slot name="label">{label}</slot> <slot name="label">{label}</slot>
</label> </label>
{/if} {/if}
@ -274,7 +281,8 @@
min="{min}" min="{min}"
step="{step}" step="{step}"
value="{value}" value="{value}"
readonly="{readonly}" /> readonly="{readonly}"
/>
{#if invalid} {#if invalid}
<WarningFilled16 class="bx--number__invalid" /> <WarningFilled16 class="bx--number__invalid" />
{/if} {/if}
@ -290,7 +298,8 @@
on:click="{() => { on:click="{() => {
updateValue(1); updateValue(1);
}}" }}"
disabled="{disabled}"> disabled="{disabled}"
>
<CaretUpGlyph class="up-icon" /> <CaretUpGlyph class="up-icon" />
</button> </button>
<button <button
@ -304,7 +313,8 @@
on:click="{() => { on:click="{() => {
updateValue(-1); updateValue(-1);
}}" }}"
disabled="{disabled}"> disabled="{disabled}"
>
<CaretDownGlyph class="down-icon" /> <CaretDownGlyph class="down-icon" />
</button> </button>
</div> </div>
@ -313,7 +323,8 @@
{#if !error && helperText} {#if !error && helperText}
<div <div
class:bx--form__helper-text="{true}" class:bx--form__helper-text="{true}"
class:bx--form__helper-text--disabled="{disabled}"> class:bx--form__helper-text--disabled="{disabled}"
>
{helperText} {helperText}
</div> </div>
{/if} {/if}

View file

@ -13,6 +13,7 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave> on:mouseleave
>
<slot /> <slot />
</ol> </ol>

View file

@ -13,32 +13,38 @@
{...$$props.menu} {...$$props.menu}
on:close="{({ detail }) => { on:close="{({ detail }) => {
console.log('close', detail); console.log('close', detail);
}}"> }}"
>
<OverflowMenuItem <OverflowMenuItem
{...$$props.menuItem} {...$$props.menuItem}
href="https://ibm.com" href="https://ibm.com"
text="Option 1" text="Option 1"
bind:primaryFocus /> bind:primaryFocus
/>
<OverflowMenuItem <OverflowMenuItem
{...$$props.menuItem} {...$$props.menuItem}
href="https://ibm.com" href="https://ibm.com"
text="Option 2 is an example of a really long string and how we text="Option 2 is an example of a really long string and how we
recommend handling this" recommend handling this"
requireTitle /> requireTitle
/>
<OverflowMenuItem <OverflowMenuItem
{...$$props.menuItem} {...$$props.menuItem}
href="https://ibm.com" href="https://ibm.com"
text="Option 3" text="Option 3"
disabled /> disabled
/>
<OverflowMenuItem <OverflowMenuItem
{...$$props.menuItem} {...$$props.menuItem}
href="https://ibm.com" href="https://ibm.com"
text="Option 4" /> text="Option 4"
/>
<OverflowMenuItem <OverflowMenuItem
{...$$props.menuItem} {...$$props.menuItem}
href="https://ibm.com" href="https://ibm.com"
text="Danger option" text="Danger option"
danger /> danger
/>
</OverflowMenu> </OverflowMenu>
{:else if story === 'trigger'} {:else if story === 'trigger'}
<OverflowMenu <OverflowMenu
@ -46,17 +52,20 @@
on:close="{({ detail }) => { on:close="{({ detail }) => {
console.log('close', detail); console.log('close', detail);
}}" }}"
style="width: auto"> style="width: auto"
>
<div slot="menu" style="padding: 0 1rem">Menu</div> <div slot="menu" style="padding: 0 1rem">Menu</div>
<OverflowMenuItem <OverflowMenuItem
{...$$props.menuItem} {...$$props.menuItem}
text="Option 1" text="Option 1"
bind:primaryFocus /> bind:primaryFocus
/>
<OverflowMenuItem <OverflowMenuItem
{...$$props.menuItem} {...$$props.menuItem}
text="Option 2 is an example of a really long string and how we text="Option 2 is an example of a really long string and how we
recommend handling this" recommend handling this"
requireTitle /> requireTitle
/>
<OverflowMenuItem {...$$props.menuItem} text="Option 3" disabled /> <OverflowMenuItem {...$$props.menuItem} text="Option 3" disabled />
<OverflowMenuItem {...$$props.menuItem} text="Option 4" /> <OverflowMenuItem {...$$props.menuItem} text="Option 4" />
<OverflowMenuItem {...$$props.menuItem} text="Danger option" danger /> <OverflowMenuItem {...$$props.menuItem} text="Danger option" danger />
@ -66,16 +75,19 @@
{...$$props.menu} {...$$props.menu}
on:close="{({ detail }) => { on:close="{({ detail }) => {
console.log('close', detail); console.log('close', detail);
}}"> }}"
>
<OverflowMenuItem <OverflowMenuItem
{...$$props.menuItem} {...$$props.menuItem}
text="Option 1" text="Option 1"
bind:primaryFocus /> bind:primaryFocus
/>
<OverflowMenuItem <OverflowMenuItem
{...$$props.menuItem} {...$$props.menuItem}
text="Option 2 is an example of a really long string and how we text="Option 2 is an example of a really long string and how we
recommend handling this" recommend handling this"
requireTitle /> requireTitle
/>
<OverflowMenuItem {...$$props.menuItem} text="Option 3" disabled /> <OverflowMenuItem {...$$props.menuItem} text="Option 3" disabled />
<OverflowMenuItem {...$$props.menuItem} text="Option 4" /> <OverflowMenuItem {...$$props.menuItem} text="Option 4" />
<OverflowMenuItem {...$$props.menuItem} text="Danger option" danger /> <OverflowMenuItem {...$$props.menuItem} text="Danger option" danger />

View file

@ -188,13 +188,15 @@
buttonRef.focus(); buttonRef.focus();
} }
} }
}}"> }}"
>
<slot name="menu"> <slot name="menu">
<svelte:component <svelte:component
this="{icon}" this="{icon}"
aria-label="{iconDescription}" aria-label="{iconDescription}"
title="{iconDescription}" title="{iconDescription}"
class="bx--overflow-menu__icon {iconClass}" /> class="bx--overflow-menu__icon {iconClass}"
/>
</slot> </slot>
{#if open} {#if open}
<ul <ul
@ -207,7 +209,8 @@
class:bx--overflow-menu--flip="{flipped}" class:bx--overflow-menu--flip="{flipped}"
class:bx--overflow-menu-options--open="{open}" class:bx--overflow-menu-options--open="{open}"
class:bx--overflow-menu-options--light="{light}" class:bx--overflow-menu-options--light="{light}"
class:menuOptionsClass> class:menuOptionsClass
>
<slot /> <slot />
</ul> </ul>
{/if} {/if}

Some files were not shown because too many files have changed in this diff Show more