From 0b30250e57f173c17cf0a5ad5df68dfcae28dff1 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Tue, 31 Dec 2019 15:47:45 -0800 Subject: [PATCH] refactor(structured-list): make StructuredListWrapper default component --- README.md | 1 - .../StructuredList.Story.svelte | 13 ++++++----- ...stWrapper.svelte => StructuredList.svelte} | 14 ++++++------ .../StructuredList/StructuredListInput.svelte | 22 +++++++++---------- .../StructuredList/StructuredListRow.svelte | 2 +- src/components/StructuredList/index.js | 5 ++++- src/index.js | 7 +++--- 7 files changed, 33 insertions(+), 31 deletions(-) rename src/components/StructuredList/{StructuredListWrapper.svelte => StructuredList.svelte} (78%) diff --git a/README.md b/README.md index 7c17045e..4e306e22 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,6 @@ Currently, the following components are supported: - StructuredListCell - StructuredListRow - StructuredListInput - - StructuredListWrapper - Tabs - Tab - TabContent diff --git a/src/components/StructuredList/StructuredList.Story.svelte b/src/components/StructuredList/StructuredList.Story.svelte index 75eaa452..593bf2e5 100644 --- a/src/components/StructuredList/StructuredList.Story.svelte +++ b/src/components/StructuredList/StructuredList.Story.svelte @@ -9,8 +9,10 @@ import StructuredListHead from './StructuredListHead.svelte'; import StructuredListInput from './StructuredListInput.svelte'; import StructuredListRow from './StructuredListRow.svelte'; - import StructuredListWrapper from './StructuredListWrapper.svelte'; import StructuredListSkeleton from './StructuredList.Skeleton.svelte'; + import StructuredList from './StructuredList.svelte'; + + let selected = 'row-1-value'; @@ -18,10 +20,9 @@ {#if story === 'skeleton'}
-
{:else if story === 'selection'} - + ColumnA @@ -54,9 +55,9 @@ {/each} - + {:else} - + ColumnA @@ -84,7 +85,7 @@ - + {/if}
diff --git a/src/components/StructuredList/StructuredListWrapper.svelte b/src/components/StructuredList/StructuredList.svelte similarity index 78% rename from src/components/StructuredList/StructuredListWrapper.svelte rename to src/components/StructuredList/StructuredList.svelte index b554d406..41d2629e 100644 --- a/src/components/StructuredList/StructuredListWrapper.svelte +++ b/src/components/StructuredList/StructuredList.svelte @@ -1,7 +1,7 @@ @@ -32,8 +32,8 @@ on:mouseover on:mouseenter on:mouseleave - class={cx('--structured-list', border && '--structured-list--border', selection && '--structured-list--selection', className)} aria-label={$$props['aria-label'] || 'Structured list section'} + class={cx('--structured-list', border && '--structured-list--border', selection && '--structured-list--selection', className)} {style}> diff --git a/src/components/StructuredList/StructuredListInput.svelte b/src/components/StructuredList/StructuredListInput.svelte index 449eb73d..bcf433c8 100644 --- a/src/components/StructuredList/StructuredListInput.svelte +++ b/src/components/StructuredList/StructuredListInput.svelte @@ -1,23 +1,23 @@ { update(value); }} - {value} - {name} - {title} - {style} + {checked} {id} - {checked} /> + {name} + {style} + {title} + {value} /> diff --git a/src/components/StructuredList/StructuredListRow.svelte b/src/components/StructuredList/StructuredListRow.svelte index 64c40317..71e79dc8 100644 --- a/src/components/StructuredList/StructuredListRow.svelte +++ b/src/components/StructuredList/StructuredListRow.svelte @@ -3,8 +3,8 @@ export { className as class }; export let head = false; export let label = false; - export let tabindex = '0'; export let style = undefined; + export let tabindex = '0'; import { cx } from '../../lib'; diff --git a/src/components/StructuredList/index.js b/src/components/StructuredList/index.js index 3236f9ed..b1580ea5 100644 --- a/src/components/StructuredList/index.js +++ b/src/components/StructuredList/index.js @@ -1,7 +1,10 @@ +import StructuredList from './StructuredList.svelte'; + +export default StructuredList; + export { default as StructuredListSkeleton } from './StructuredList.Skeleton.svelte'; export { default as StructuredListBody } from './StructuredListBody.svelte'; export { default as StructuredListHead } from './StructuredListHead.svelte'; export { default as StructuredListCell } from './StructuredListCell.svelte'; export { default as StructuredListRow } from './StructuredListRow.svelte'; export { default as StructuredListInput } from './StructuredListInput.svelte'; -export { default as StructuredListWrapper } from './StructuredListWrapper.svelte'; diff --git a/src/index.js b/src/index.js index 109b2b3d..20afa523 100644 --- a/src/index.js +++ b/src/index.js @@ -57,14 +57,13 @@ import Select, { SelectSkeleton, SelectItem, SelectItemGroup } from './component import SkeletonPlaceholder from './components/SkeletonPlaceholder'; import SkeletonText from './components/SkeletonText'; import Slider, { SliderSkeleton } from './components/Slider'; -import { +import StructuredList, { StructuredListSkeleton, StructuredListBody, StructuredListHead, StructuredListCell, StructuredListRow, - StructuredListInput, - StructuredListWrapper + StructuredListInput } from './components/StructuredList'; import Tabs, { Tab, TabContent, TabsSkeleton } from './components/Tabs'; import Tag, { TagSkeleton } from './components/Tag'; @@ -159,13 +158,13 @@ export { Switch, Slider, SliderSkeleton, + StructuredList, StructuredListSkeleton, StructuredListBody, StructuredListHead, StructuredListCell, StructuredListRow, StructuredListInput, - StructuredListWrapper, Tabs, Tab, TabContent,