Merge pull request #250 from IBM/fixes

Fixes
This commit is contained in:
Eric Liu 2020-09-14 08:03:24 -07:00 committed by GitHub
commit cbe4572b06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 63 additions and 43 deletions

View file

@ -12,6 +12,12 @@
{:else if story === 'skeleton'} {:else if story === 'skeleton'}
<PaginationSkeleton /> <PaginationSkeleton />
{:else} {:else}
<Pagination {...$$props}>Pagination</Pagination> <Pagination
{...$$props}
on:update="{({ detail }) => {
console.log(detail);
}}">
Pagination
</Pagination>
{/if} {/if}
</div> </div>

View file

@ -91,17 +91,25 @@
*/ */
export let id = "ccs-" + Math.random().toString(36); export let id = "ccs-" + Math.random().toString(36);
import CaretLeft24 from "carbon-icons-svelte/lib/CaretLeft24"; import { createEventDispatcher } from "svelte";
import CaretRight24 from "carbon-icons-svelte/lib/CaretRight24"; import CaretLeft16 from "carbon-icons-svelte/lib/CaretLeft16";
import CaretRight16 from "carbon-icons-svelte/lib/CaretRight16";
import { Button } from "../Button";
import { Select, SelectItem } from "../Select"; import { Select, SelectItem } from "../Select";
import { afterUpdate, createEventDispatcher } from "svelte";
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
afterUpdate(() => { $: {
dispatch("update", { pageSize: parseInt(pageSize), page: parseInt(page) }); if (typeof page !== "number") {
}); page = Number(page);
}
if (typeof pageSize !== "number") {
pageSize = Number(pageSize);
}
dispatch("update", { pageSize, page });
}
$: totalPages = Math.max(Math.ceil(totalItems / pageSize), 1); $: totalPages = Math.max(Math.ceil(totalItems / pageSize), 1);
$: selectItems = Array.from({ length: totalPages }, (_, i) => i); $: selectItems = Array.from({ length: totalPages }, (_, i) => i);
$: backButtonDisabled = disabled || page === 1; $: backButtonDisabled = disabled || page === 1;
@ -154,29 +162,29 @@
{:else}{pageRangeText(page, totalPages)}{/if} {:else}{pageRangeText(page, totalPages)}{/if}
</span> </span>
{/if} {/if}
<button <Button
type="button" hasIconOnly
aria-label="{backwardText}" kind="ghost"
tooltipAlignment="center"
tooltipPosition="top"
icon="{CaretLeft16}"
iconDescription="{backwardText}"
disabled="{backButtonDisabled}" disabled="{backButtonDisabled}"
class:bx--pagination__button="{true}" class="bx--pagination__button bx--pagination__button--backward {backButtonDisabled ? 'bx--pagination__button--no-index' : ''}"
class:bx--pagination__button--backward="{true}"
class:bx--pagination__button--no-index="{backButtonDisabled}"
on:click="{() => { on:click="{() => {
page--; page--;
}}"> }}" />
<CaretLeft24 /> <Button
</button> hasIconOnly
<button kind="ghost"
type="button" tooltipAlignment="end"
aria-label="{forwardText}" tooltipPosition="top"
icon="{CaretRight16}"
iconDescription="{forwardText}"
disabled="{forwardButtonDisabled}" disabled="{forwardButtonDisabled}"
class:bx--pagination__button="{true}" class="bx--pagination__button bx--pagination__button--forward {forwardButtonDisabled ? 'bx--pagination__button--no-index' : ''}"
class:bx--pagination__button--forward="{true}"
class:bx--pagination__button--no-index="{forwardButtonDisabled}"
on:click="{() => { on:click="{() => {
page++; page++;
}}"> }}" />
<CaretRight24 />
</button>
</div> </div>
</div> </div>

View file

@ -26,7 +26,10 @@
<ProgressStep <ProgressStep
label="First step" label="First step"
description="Step 1: Getting started with Carbon Design System" description="Step 1: Getting started with Carbon Design System"
secondaryLabel="Optional label" /> secondaryLabel="Optional label"
on:click="{() => {
console.log('click');
}}" />
<ProgressStep <ProgressStep
label="Second step with tooltip" label="Second step with tooltip"
description="Step 2: Getting started with Carbon Design System" description="Step 2: Getting started with Carbon Design System"

View file

@ -71,11 +71,13 @@
class:bx--progress-step--incomplete="{!complete && !current}" class:bx--progress-step--incomplete="{!complete && !current}"
class:bx--progress-step--disabled="{disabled}" class:bx--progress-step--disabled="{disabled}"
{...$$restProps}> {...$$restProps}>
<div <button
role="button" disabled="{disabled}"
tabindex="{current ? '-1' : '0'}" aria-disabled="{disabled}"
tabindex="{!current && !disabled ? '0' : '-1'}"
class:bx--progress-step-button="{true}" class:bx--progress-step-button="{true}"
class:bx--progress-step-button--unclickable="{current}" class:bx--progress-step-button--unclickable="{current}"
on:click
on:click="{() => { on:click="{() => {
change(step.index); change(step.index);
}}" }}"
@ -112,5 +114,5 @@
<p class:bx--progress-optional="{true}">{secondaryLabel}</p> <p class:bx--progress-optional="{true}">{secondaryLabel}</p>
{/if} {/if}
<span class:bx--progress-line="{true}"></span> <span class:bx--progress-line="{true}"></span>
</div> </button>
</li> </li>

View file

@ -57,14 +57,21 @@
name="{name}" name="{name}"
value="{value}" value="{value}"
checked="{checked}" checked="{checked}"
tabindex="{tabindex}"
class:bx--tile-input="{true}" class:bx--tile-input="{true}"
on:change on:change
on:change="{() => { on:change="{() => {
update(value); update(value);
}}"
on:keydown
on:keydown="{(e) => {
if (e.key === ' ' || e.key === 'Enter') {
e.preventDefault();
update(value);
}
}}" /> }}" />
<label <label
for="{id}" for="{id}"
tabindex="{tabindex}"
class:bx--tile="{true}" class:bx--tile="{true}"
class:bx--tile--selectable="{true}" class:bx--tile--selectable="{true}"
class:bx--tile--is-selected="{checked}" class:bx--tile--is-selected="{checked}"
@ -73,14 +80,7 @@
on:click on:click
on:mouseover on:mouseover
on:mouseenter on:mouseenter
on:mouseleave on:mouseleave>
on:keydown
on:keydown="{(e) => {
if (e.key === ' ' || e.key === 'Enter') {
e.preventDefault();
update(value);
}
}}">
<span class:bx--tile__checkmark="{true}"> <span class:bx--tile__checkmark="{true}">
<CheckmarkFilled16 <CheckmarkFilled16
aria-label="{iconDescription}" aria-label="{iconDescription}"

View file

@ -52,7 +52,10 @@
{...$$props} {...$$props}
value="{value}" value="{value}"
id="{id}" id="{id}"
labelText="{labelText}"> labelText="{labelText}"
on:keydown="{() => {
console.log('keydown');
}}">
Selectable Tile Selectable Tile
</RadioTile> </RadioTile>
{/each} {/each}

View file

@ -24,7 +24,6 @@
<li class:bx--side-nav__item="{true}" class:bx--side-nav__item--icon="{icon}"> <li class:bx--side-nav__item="{true}" class:bx--side-nav__item--icon="{icon}">
<button <button
type="button" type="button"
aria-haspopup="true"
aria-expanded="{expanded}" aria-expanded="{expanded}"
class:bx--side-nav__submenu="{true}" class:bx--side-nav__submenu="{true}"
{...$$restProps} {...$$restProps}

View file

@ -18,9 +18,8 @@
export let text = undefined; export let text = undefined;
</script> </script>
<li role="none" class:bx--side-nav__menu-item="{true}"> <li class:bx--side-nav__menu-item="{true}">
<a <a
role="menuitem"
aria-current="{isSelected ? 'page' : undefined}" aria-current="{isSelected ? 'page' : undefined}"
href="{href}" href="{href}"
class:bx--side-nav__link="{true}" class:bx--side-nav__link="{true}"