mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 12:23:02 +00:00
refactor(docs): use svelte:fragment where applicable
This commit is contained in:
parent
a6ec082e6f
commit
64879d9832
18 changed files with 58 additions and 62 deletions
|
@ -48,9 +48,9 @@
|
||||||
expandedByDefault="{true}"
|
expandedByDefault="{true}"
|
||||||
bind:isSideNavOpen
|
bind:isSideNavOpen
|
||||||
>
|
>
|
||||||
<div slot="skip-to-content">
|
<svelte:fragment slot="skip-to-content">
|
||||||
<SkipToContent />
|
<SkipToContent />
|
||||||
</div>
|
</svelte:fragment>
|
||||||
|
|
||||||
<span slot="platform" class="platform-name">
|
<span slot="platform" class="platform-name">
|
||||||
Carbon Components Svelte
|
Carbon Components Svelte
|
||||||
|
|
|
@ -46,25 +46,25 @@ See the [ExpandableAccordion recipe](/recipes/ExpandableAccordion) for a togglea
|
||||||
|
|
||||||
<Accordion>
|
<Accordion>
|
||||||
<AccordionItem>
|
<AccordionItem>
|
||||||
<div slot="title">
|
<svelte:fragment slot="title">
|
||||||
<h5>Natural Language Classifier</h5>
|
<h5>Natural Language Classifier</h5>
|
||||||
<div>AI / Machine Learning</div>
|
<div>AI / Machine Learning</div>
|
||||||
</div>
|
</svelte:fragment>
|
||||||
<p>Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text.
|
<p>Natural Language Classifier uses advanced natural language processing and machine learning techniques to create custom classification models. Users train their data and the service predicts the appropriate category for the inputted text.
|
||||||
</p>
|
</p>
|
||||||
</AccordionItem>
|
</AccordionItem>
|
||||||
<AccordionItem>
|
<AccordionItem>
|
||||||
<div slot="title">
|
<svelte:fragment slot="title">
|
||||||
<h5>Natural Language Understanding</h5>
|
<h5>Natural Language Understanding</h5>
|
||||||
<div>AI / Machine Learning</div>
|
<div>AI / Machine Learning</div>
|
||||||
</div>
|
</svelte:fragment>
|
||||||
<p>Analyze text to extract meta-data from content such as concepts, entities, emotion, relations, sentiment and more.</p>
|
<p>Analyze text to extract meta-data from content such as concepts, entities, emotion, relations, sentiment and more.</p>
|
||||||
</AccordionItem>
|
</AccordionItem>
|
||||||
<AccordionItem>
|
<AccordionItem>
|
||||||
<div slot="title">
|
<svelte:fragment slot="title">
|
||||||
<h5>Language Translator</h5>
|
<h5>Language Translator</h5>
|
||||||
<div>AI / Machine Learning</div>
|
<div>AI / Machine Learning</div>
|
||||||
</div>
|
</svelte:fragment>
|
||||||
<p>Translate text, documents, and websites from one language to another. Create industry or region-specific translations via the service's customization capability.</p>
|
<p>Translate text, documents, and websites from one language to another. Create industry or region-specific translations via the service's customization capability.</p>
|
||||||
</AccordionItem>
|
</AccordionItem>
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
|
@ -131,20 +131,20 @@ The slot name for the table header cells is `"cell-header"`.
|
||||||
},
|
},
|
||||||
]}"
|
]}"
|
||||||
>
|
>
|
||||||
<span slot="cell-header" let:header>
|
<svelte:fragment slot="cell-header" let:header>
|
||||||
{#if header.key === 'port'}
|
{#if header.key === 'port'}
|
||||||
{header.value} (network)
|
{header.value} (network)
|
||||||
{:else}
|
{:else}
|
||||||
{header.value}
|
{header.value}
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
</svelte:fragment>
|
||||||
<span slot="cell" let:row let:cell>
|
<svelte:fragment slot="cell" let:row let:cell>
|
||||||
{#if cell.key === 'rule' && cell.value === 'Round robin'}
|
{#if cell.key === 'rule' && cell.value === 'Round robin'}
|
||||||
<Link icon={Launch16} href="https://en.wikipedia.org/wiki/Round-robin_DNS" target="_blank">{cell.value}</Link>
|
<Link icon={Launch16} href="https://en.wikipedia.org/wiki/Round-robin_DNS" target="_blank">{cell.value}</Link>
|
||||||
{:else}
|
{:else}
|
||||||
{cell.value}
|
{cell.value}
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
</svelte:fragment>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
|
|
||||||
### With title, description
|
### With title, description
|
||||||
|
@ -1018,11 +1018,11 @@ In the following example, each row in the sortable data table has an overflow me
|
||||||
},
|
},
|
||||||
]}"
|
]}"
|
||||||
>
|
>
|
||||||
<div slot="expanded-row" let:row>
|
<svelte:fragment slot="expanded-row" let:row>
|
||||||
<pre>
|
<pre>
|
||||||
{JSON.stringify(row, null, 2)}
|
{JSON.stringify(row, null, 2)}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</svelte:fragment>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
|
|
||||||
### Non-expandable rows
|
### Non-expandable rows
|
||||||
|
@ -1085,11 +1085,11 @@ Use `nonExpandableRowIds` to specify the ids for rows that should not be expanda
|
||||||
},
|
},
|
||||||
]}"
|
]}"
|
||||||
>
|
>
|
||||||
<div slot="expanded-row" let:row>
|
<svelte:fragment slot="expanded-row" let:row>
|
||||||
<pre>
|
<pre>
|
||||||
{JSON.stringify(row, null, 2)}
|
{JSON.stringify(row, null, 2)}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</svelte:fragment>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
|
|
||||||
### Expandable (short size)
|
### Expandable (short size)
|
||||||
|
@ -1146,11 +1146,11 @@ Use `nonExpandableRowIds` to specify the ids for rows that should not be expanda
|
||||||
},
|
},
|
||||||
]}"
|
]}"
|
||||||
>
|
>
|
||||||
<div slot="expanded-row" let:row>
|
<svelte:fragment slot="expanded-row" let:row>
|
||||||
<pre>
|
<pre>
|
||||||
{JSON.stringify(row, null, 2)}
|
{JSON.stringify(row, null, 2)}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</svelte:fragment>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
|
|
||||||
### Expandable (tall size)
|
### Expandable (tall size)
|
||||||
|
@ -1207,11 +1207,11 @@ Use `nonExpandableRowIds` to specify the ids for rows that should not be expanda
|
||||||
},
|
},
|
||||||
]}"
|
]}"
|
||||||
>
|
>
|
||||||
<div slot="expanded-row" let:row>
|
<svelte:fragment slot="expanded-row" let:row>
|
||||||
<pre>
|
<pre>
|
||||||
{JSON.stringify(row, null, 2)}
|
{JSON.stringify(row, null, 2)}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</svelte:fragment>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
|
|
||||||
### Batch expansion
|
### Batch expansion
|
||||||
|
@ -1268,11 +1268,11 @@ Use `nonExpandableRowIds` to specify the ids for rows that should not be expanda
|
||||||
},
|
},
|
||||||
]}"
|
]}"
|
||||||
>
|
>
|
||||||
<div slot="expanded-row" let:row>
|
<svelte:fragment slot="expanded-row" let:row>
|
||||||
<pre>
|
<pre>
|
||||||
{JSON.stringify(row, null, 2)}
|
{JSON.stringify(row, null, 2)}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</svelte:fragment>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
|
|
||||||
### Skeleton
|
### Skeleton
|
||||||
|
|
|
@ -16,12 +16,12 @@ This utility component uses the [Image API](https://developer.mozilla.org/en-US/
|
||||||
Use the "loading" and "error" named slots to render an element when the image is loading or has an error.
|
Use the "loading" and "error" named slots to render an element when the image is loading or has an error.
|
||||||
|
|
||||||
<ImageLoader src="https://upload.wikimedia.org/wikipedia/commons/5/51/IBM_logo.svg">
|
<ImageLoader src="https://upload.wikimedia.org/wikipedia/commons/5/51/IBM_logo.svg">
|
||||||
<div slot="loading">
|
<svelte:fragment slot="loading">
|
||||||
<InlineLoading />
|
<InlineLoading />
|
||||||
</div>
|
</svelte:fragment>
|
||||||
<div slot="error">
|
<svelte:fragment slot="error">
|
||||||
An error occurred.
|
An error occurred.
|
||||||
</div>
|
</svelte:fragment>
|
||||||
</ImageLoader>
|
</ImageLoader>
|
||||||
|
|
||||||
### With aspect ratio
|
### With aspect ratio
|
||||||
|
|
|
@ -25,9 +25,9 @@ source: Notification/InlineNotification.svelte
|
||||||
### With actions
|
### With actions
|
||||||
|
|
||||||
<InlineNotification kind="warning" title="Scheduled maintenance:" subtitle="Maintenance will last 2-4 hours.">
|
<InlineNotification kind="warning" title="Scheduled maintenance:" subtitle="Maintenance will last 2-4 hours.">
|
||||||
<div slot="actions">
|
<svelte:fragment slot="actions">
|
||||||
<NotificationActionButton>Learn more</NotificationActionButton>
|
<NotificationActionButton>Learn more</NotificationActionButton>
|
||||||
</div>
|
</svelte:fragment>
|
||||||
</InlineNotification>
|
</InlineNotification>
|
||||||
|
|
||||||
### Notification variants
|
### Notification variants
|
||||||
|
|
|
@ -13,11 +13,11 @@ components: ["Tabs", "Tab", "TabContent", "TabsSkeleton"]
|
||||||
<Tab label="Tab label 1" />
|
<Tab label="Tab label 1" />
|
||||||
<Tab label="Tab label 2" />
|
<Tab label="Tab label 2" />
|
||||||
<Tab label="Tab label 3" />
|
<Tab label="Tab label 3" />
|
||||||
<div slot="content">
|
<svelte:fragment slot="content">
|
||||||
<TabContent>Content 1</TabContent>
|
<TabContent>Content 1</TabContent>
|
||||||
<TabContent>Content 2</TabContent>
|
<TabContent>Content 2</TabContent>
|
||||||
<TabContent>Content 3</TabContent>
|
<TabContent>Content 3</TabContent>
|
||||||
</div>
|
</svelte:fragment>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
### Auto width
|
### Auto width
|
||||||
|
@ -30,11 +30,11 @@ Set `autoWidth` to `true` for tabs to have an automatically set width.
|
||||||
<Tab label="Tab label 1" />
|
<Tab label="Tab label 1" />
|
||||||
<Tab label="Tab label 2" />
|
<Tab label="Tab label 2" />
|
||||||
<Tab label="Tab label 3" />
|
<Tab label="Tab label 3" />
|
||||||
<div slot="content">
|
<svelte:fragment slot="content">
|
||||||
<TabContent>Content 1</TabContent>
|
<TabContent>Content 1</TabContent>
|
||||||
<TabContent>Content 2</TabContent>
|
<TabContent>Content 2</TabContent>
|
||||||
<TabContent>Content 3</TabContent>
|
<TabContent>Content 3</TabContent>
|
||||||
</div>
|
</svelte:fragment>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
### Reactive example
|
### Reactive example
|
||||||
|
@ -47,11 +47,11 @@ Set `autoWidth` to `true` for tabs to have an automatically set width.
|
||||||
<Tab label="Tab label 1" />
|
<Tab label="Tab label 1" />
|
||||||
<Tab label="Tab label 2" />
|
<Tab label="Tab label 2" />
|
||||||
<Tab label="Tab label 3" />
|
<Tab label="Tab label 3" />
|
||||||
<div slot="content">
|
<svelte:fragment slot="content">
|
||||||
<TabContent>Content 1</TabContent>
|
<TabContent>Content 1</TabContent>
|
||||||
<TabContent>Content 2</TabContent>
|
<TabContent>Content 2</TabContent>
|
||||||
<TabContent>Content 3</TabContent>
|
<TabContent>Content 3</TabContent>
|
||||||
</div>
|
</svelte:fragment>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
### Skeleton (default)
|
### Skeleton (default)
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<DataTable sortable headers="{headers}" rows="{rows}">
|
<DataTable sortable headers="{headers}" rows="{rows}">
|
||||||
<span slot="cell" let:cell>
|
<svelte:fragment slot="cell" let:cell>
|
||||||
{#if cell.key === "overflow"}
|
{#if cell.key === "overflow"}
|
||||||
<OverflowMenu flipped>
|
<OverflowMenu flipped>
|
||||||
<OverflowMenuItem text="Restart" />
|
<OverflowMenuItem text="Restart" />
|
||||||
|
@ -34,5 +34,5 @@
|
||||||
<OverflowMenuItem danger text="Stop" />
|
<OverflowMenuItem danger text="Stop" />
|
||||||
</OverflowMenu>
|
</OverflowMenu>
|
||||||
{:else}{cell.value}{/if}
|
{:else}{cell.value}{/if}
|
||||||
</span>
|
</svelte:fragment>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
|
|
|
@ -60,9 +60,9 @@
|
||||||
]}"
|
]}"
|
||||||
rows="{rows}"
|
rows="{rows}"
|
||||||
>
|
>
|
||||||
<div slot="expanded-row" let:row>
|
<svelte:fragment slot="expanded-row" let:row>
|
||||||
<pre>
|
<pre>
|
||||||
{JSON.stringify(row, null, 2)}
|
{JSON.stringify(row, null, 2)}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</svelte:fragment>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<ImageLoader bind:this="{imageLoader}" bind:error fadeIn src="{src}">
|
<ImageLoader bind:this="{imageLoader}" bind:error fadeIn src="{src}">
|
||||||
<div slot="error">
|
<svelte:fragment slot="error">
|
||||||
<Button kind="ghost" on:click="{() => imageLoader.loadImage(src)}">
|
<Button kind="ghost" on:click="{() => imageLoader.loadImage(src)}">
|
||||||
Error. Try again
|
Error. Try again
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</svelte:fragment>
|
||||||
</ImageLoader>
|
</ImageLoader>
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
<Tab label="Tab label 1" />
|
<Tab label="Tab label 1" />
|
||||||
<Tab label="Tab label 2" />
|
<Tab label="Tab label 2" />
|
||||||
<Tab label="Tab label 3" />
|
<Tab label="Tab label 3" />
|
||||||
<div slot="content">
|
<svelte:fragment slot="content">
|
||||||
<TabContent>Content 1</TabContent>
|
<TabContent>Content 1</TabContent>
|
||||||
<TabContent>Content 2</TabContent>
|
<TabContent>Content 2</TabContent>
|
||||||
<TabContent>Content 3</TabContent>
|
<TabContent>Content 3</TabContent>
|
||||||
</div>
|
</svelte:fragment>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -15,10 +15,9 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
||||||
<div slot="skip-to-content">
|
<svelte:fragment slot="skip-to-content">
|
||||||
<SkipToContent />
|
<SkipToContent />
|
||||||
</div>
|
</svelte:fragment>
|
||||||
|
|
||||||
<HeaderNav>
|
<HeaderNav>
|
||||||
<HeaderNavItem href="/" text="Link 1" />
|
<HeaderNavItem href="/" text="Link 1" />
|
||||||
<HeaderNavItem href="/" text="Link 2" />
|
<HeaderNavItem href="/" text="Link 2" />
|
||||||
|
|
|
@ -21,10 +21,9 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
||||||
<div slot="skip-to-content">
|
<svelte:fragment slot="skip-to-content">
|
||||||
<SkipToContent />
|
<SkipToContent />
|
||||||
</div>
|
</svelte:fragment>
|
||||||
|
|
||||||
<HeaderNav>
|
<HeaderNav>
|
||||||
<HeaderNavItem href="/" text="Link 1" />
|
<HeaderNavItem href="/" text="Link 1" />
|
||||||
<HeaderNavItem href="/" text="Link 2" />
|
<HeaderNavItem href="/" text="Link 2" />
|
||||||
|
|
|
@ -22,10 +22,9 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
||||||
<div slot="skip-to-content">
|
<svelte:fragment slot="skip-to-content">
|
||||||
<SkipToContent />
|
<SkipToContent />
|
||||||
</div>
|
</svelte:fragment>
|
||||||
|
|
||||||
<HeaderNav>
|
<HeaderNav>
|
||||||
<HeaderNavItem href="/" text="Link 1" />
|
<HeaderNavItem href="/" text="Link 1" />
|
||||||
<HeaderNavItem href="/" text="Link 2" />
|
<HeaderNavItem href="/" text="Link 2" />
|
||||||
|
|
|
@ -66,9 +66,9 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header company="IBM" platformName="Carbon Svelte">
|
<Header company="IBM" platformName="Carbon Svelte">
|
||||||
<div slot="skip-to-content">
|
<svelte:fragment slot="skip-to-content">
|
||||||
<SkipToContent />
|
<SkipToContent />
|
||||||
</div>
|
</svelte:fragment>
|
||||||
<HeaderUtilities>
|
<HeaderUtilities>
|
||||||
<HeaderSearch
|
<HeaderSearch
|
||||||
bind:ref
|
bind:ref
|
||||||
|
|
|
@ -41,9 +41,9 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
||||||
<div slot="skip-to-content">
|
<svelte:fragment slot="skip-to-content">
|
||||||
<SkipToContent />
|
<SkipToContent />
|
||||||
</div>
|
</svelte:fragment>
|
||||||
<HeaderUtilities>
|
<HeaderUtilities>
|
||||||
<HeaderAction bind:isOpen transition="{transitions[selected].value}">
|
<HeaderAction bind:isOpen transition="{transitions[selected].value}">
|
||||||
<HeaderPanelLinks>
|
<HeaderPanelLinks>
|
||||||
|
|
|
@ -27,9 +27,9 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
<Header company="IBM" platformName="Carbon Svelte" bind:isSideNavOpen>
|
||||||
<div slot="skip-to-content">
|
<svelte:fragment slot="skip-to-content">
|
||||||
<SkipToContent />
|
<SkipToContent />
|
||||||
</div>
|
</svelte:fragment>
|
||||||
<HeaderUtilities>
|
<HeaderUtilities>
|
||||||
<HeaderGlobalAction aria-label="Settings" icon="{SettingsAdjust20}" />
|
<HeaderGlobalAction aria-label="Settings" icon="{SettingsAdjust20}" />
|
||||||
<HeaderAction
|
<HeaderAction
|
||||||
|
|
|
@ -25,10 +25,9 @@
|
||||||
platformName="Carbon Svelte"
|
platformName="Carbon Svelte"
|
||||||
bind:isSideNavOpen
|
bind:isSideNavOpen
|
||||||
>
|
>
|
||||||
<div slot="skip-to-content">
|
<svelte:fragment slot="skip-to-content">
|
||||||
<SkipToContent />
|
<SkipToContent />
|
||||||
</div>
|
</svelte:fragment>
|
||||||
|
|
||||||
<HeaderNav>
|
<HeaderNav>
|
||||||
<HeaderNavItem href="/" text="Link 1" />
|
<HeaderNavItem href="/" text="Link 1" />
|
||||||
<HeaderNavItem href="/" text="Link 2" />
|
<HeaderNavItem href="/" text="Link 2" />
|
||||||
|
|
|
@ -131,7 +131,7 @@
|
||||||
<Tab label="CSS StyleSheet" />
|
<Tab label="CSS StyleSheet" />
|
||||||
<Tab label="CDN" />
|
<Tab label="CDN" />
|
||||||
<Tab label="SCSS" />
|
<Tab label="SCSS" />
|
||||||
<div slot="content">
|
<svelte:fragment slot="content">
|
||||||
<TabContent>
|
<TabContent>
|
||||||
<p>
|
<p>
|
||||||
This library ships with six pre-compiled CSS StyleSheets built
|
This library ships with six pre-compiled CSS StyleSheets built
|
||||||
|
@ -199,7 +199,7 @@
|
||||||
for documentation.
|
for documentation.
|
||||||
</p>
|
</p>
|
||||||
</TabContent>
|
</TabContent>
|
||||||
</div>
|
</svelte:fragment>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</Column>
|
</Column>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue