mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
Alignment with Carbon version 10.32 (#588)
* feat(code-snippet): add copy functionality - docs: add custom feedback copy text example * feat(tile): support disabled state for SelectableTile, RadioTile Closes #539 * build(rollup): add clipboard-copy to globals * feat(copy-button): add copy functionality * feat(content-switcher): deprecate the light prop - docs: remove the light variant example * fix(toolbar-search): remove outer div * feat(search): add searchClass prop * fix(composed-modal): set hasScrollingContent class on ModalBody * docs(data-table): add expandable size examples * feat(tooltip): add TooltipFooter component * fix(time-picker): correctly display invalidText * feat(breadcrumb): support overflow menu * feat(multi-select): export inputRef prop * chore(deps-dev): upgrade carbon-components to v10.32.0 * feat(form): add noMargin prop to FormGroup * docs(tooltip): document TooltipFooter * feat(context-menu): support danger kind for ContextMenuOption * feat(data-table): support rendering empty table header in skeleton * refactor(types): use shorter import path in DataTableSkeleton * feat(data-table): allow sorting to be disabled for a specific header * docs(data-table): update example to desort the Protocol header As an example, it makes more sense because all the values ("http") are the same. * fix(context-menu): set initial y offset of context menu based on window height #577 * fix(context-menu): render submenu based on viewport constraints #577
This commit is contained in:
parent
f13e3b100e
commit
fa9b90cd79
61 changed files with 825 additions and 233 deletions
|
@ -6,6 +6,8 @@ components: ["Breadcrumb", "BreadcrumbItem"]
|
|||
import {
|
||||
Breadcrumb,
|
||||
BreadcrumbItem,
|
||||
OverflowMenu,
|
||||
OverflowMenuItem
|
||||
} from "carbon-components-svelte";
|
||||
import Preview from "../../components/Preview.svelte";
|
||||
</script>
|
||||
|
@ -27,6 +29,20 @@ See the [Breadcrumbs recipe](/recipes/Breadcrumbs) for a reusable breadcrumbs co
|
|||
<BreadcrumbItem href="/profile" isCurrentPage>Profile</BreadcrumbItem>
|
||||
</Breadcrumb>
|
||||
|
||||
### Overflow menu
|
||||
|
||||
<Breadcrumb>
|
||||
<BreadcrumbItem href="/">Home</BreadcrumbItem>
|
||||
<BreadcrumbItem href="/api">API documentation</BreadcrumbItem>
|
||||
<BreadcrumbItem>
|
||||
<OverflowMenu>
|
||||
<OverflowMenuItem href="/api/data" text="Data" />
|
||||
<OverflowMenuItem href="/api/data/latest" text="Latest" />
|
||||
</OverflowMenu>
|
||||
</BreadcrumbItem>
|
||||
<BreadcrumbItem href="/api/data/latest/usage" isCurrentPage>Usage</BreadcrumbItem>
|
||||
</Breadcrumb>
|
||||
|
||||
### Skeleton
|
||||
|
||||
<Breadcrumb noTrailingSlash skeleton count={3} />
|
|
@ -28,21 +28,27 @@ let comment = `
|
|||
</script>
|
||||
|
||||
<InlineNotification svx-ignore title="Note:" kind="info" hideCloseButton>
|
||||
<div class="body-short-01">By design, the copy button does not copy text to the clipboard. You will need to write your own logic. Refer to the <Link href="/recipes/CopyableCodeSnippet">CopyableCodeSnippet recipe</Link> for an example.</div>
|
||||
<div class="body-short-01">As of version 0.32, the CodeSnippet will copy the provided `code` text when clicking the copy button.</div>
|
||||
</InlineNotification>
|
||||
|
||||
### Default (single-line)
|
||||
|
||||
<CodeSnippet>yarn add -D carbon-components-svelte</CodeSnippet>
|
||||
<CodeSnippet code="yarn add -D carbon-components-svelte" />
|
||||
|
||||
### Inline
|
||||
|
||||
<CodeSnippet type="inline">rm -rf node_modules/</CodeSnippet>
|
||||
<CodeSnippet type="inline" code="rm -rf node_modules/" />
|
||||
|
||||
### Multi-line
|
||||
|
||||
<CodeSnippet type="multi" {code} />
|
||||
|
||||
### Custom copy feedback text
|
||||
|
||||
Use the `feedback` prop to override the default copy button feedback text.
|
||||
|
||||
<CodeSnippet type="multi" {code} feedback="Copied to clipboard" />
|
||||
|
||||
### Hidden copy button
|
||||
|
||||
<CodeSnippet type="multi" {code} hideCopyButton />
|
||||
|
@ -51,7 +57,7 @@ let comment = `
|
|||
|
||||
The `disabled` prop applies only to the `"single"` and `"multi"` code snippet types.
|
||||
|
||||
<CodeSnippet disabled>yarn add -D carbon-components-svelte</CodeSnippet>
|
||||
<CodeSnippet disabled code="yarn add -D carbon-components-svelte" />
|
||||
<br />
|
||||
<CodeSnippet disabled type="multi" code="{comment}" />
|
||||
|
||||
|
|
|
@ -28,13 +28,6 @@ components: ["ContentSwitcher", "Switch"]
|
|||
|
||||
<FileSource src="/framed/ContentSwitcher/ContentSwitcherReactive" />
|
||||
|
||||
### Light variant
|
||||
|
||||
<ContentSwitcher light>
|
||||
<Switch text="Latest news" />
|
||||
<Switch text="Trending" />
|
||||
</ContentSwitcher>
|
||||
|
||||
### Custom switch slot
|
||||
|
||||
<ContentSwitcher>
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
</script>
|
||||
|
||||
<InlineNotification svx-ignore title="Note:" kind="info" hideCloseButton>
|
||||
<div class="body-short-01">By design, the copy button does not copy text to the clipboard. You will need to write your own logic. Refer to the <Link href="/recipes/CopyableCodeSnippet">CopyableCodeSnippet recipe</Link> for an example.</div>
|
||||
<div class="body-short-01">As of version 0.32, this component will copy the provided `code` text when clicking the button.</div>
|
||||
</InlineNotification>
|
||||
|
||||
### Default
|
||||
|
||||
<CopyButton on:click />
|
||||
<CopyButton text="Carbon svelte" />
|
||||
|
||||
### Custom feedback
|
||||
### Custom feedback text
|
||||
|
||||
<CopyButton on:click feedback="Copied to clipboard" />
|
||||
<CopyButton text="Carbon svelte" feedback="Copied to clipboard" />
|
|
@ -550,10 +550,16 @@ The slot name for the table header cells is `"cell-header"`.
|
|||
|
||||
### Sortable
|
||||
|
||||
Set `sortable` to `true` to enable table column sorting.
|
||||
|
||||
To disable sorting on a specific column, set `sort` to `false` in the header object passed to the `headers` prop.
|
||||
|
||||
In the example below, the "Protocol" column is not sortable.
|
||||
|
||||
<DataTable sortable
|
||||
headers="{[
|
||||
{ key: "name", value: "Name" },
|
||||
{ key: "protocol", value: "Protocol" },
|
||||
{ key: "protocol", value: "Protocol", sort: false },
|
||||
{ key: "port", value: "Port" },
|
||||
{ key: "rule", value: "Rule" }
|
||||
]}"
|
||||
|
@ -757,6 +763,189 @@ In the following example, each row in the sortable data table has an overflow me
|
|||
</div>
|
||||
</DataTable>
|
||||
|
||||
### Expandable (compact size)
|
||||
|
||||
<DataTable size="compact" expandable
|
||||
headers="{[
|
||||
{ key: "name", value: "Name" },
|
||||
{ key: "protocol", value: "Protocol" },
|
||||
{ key: "port", value: "Port" },
|
||||
{ key: "rule", value: "Rule" }
|
||||
]}"
|
||||
rows="{[
|
||||
{
|
||||
id: "a",
|
||||
name: "Load Balancer 3",
|
||||
protocol: "HTTP",
|
||||
port: 3000,
|
||||
rule: "Round robin"
|
||||
},
|
||||
{
|
||||
id: "b",
|
||||
name: "Load Balancer 1",
|
||||
protocol: "HTTP",
|
||||
port: 443,
|
||||
rule: "Round robin"
|
||||
},
|
||||
{
|
||||
id: "c",
|
||||
name: "Load Balancer 2",
|
||||
protocol: "HTTP",
|
||||
port: 80,
|
||||
rule: "DNS delegation"
|
||||
},
|
||||
{
|
||||
id: "d",
|
||||
name: "Load Balancer 6",
|
||||
protocol: "HTTP",
|
||||
port: 3000,
|
||||
rule: "Round robin"
|
||||
},
|
||||
{
|
||||
id: "e",
|
||||
name: "Load Balancer 4",
|
||||
protocol: "HTTP",
|
||||
port: 443,
|
||||
rule: "Round robin"
|
||||
},
|
||||
{
|
||||
id: "f",
|
||||
name: "Load Balancer 5",
|
||||
protocol: "HTTP",
|
||||
port: 80,
|
||||
rule: "DNS delegation"
|
||||
},
|
||||
]}"
|
||||
>
|
||||
<div slot="expanded-row" let:row>
|
||||
<pre>
|
||||
{JSON.stringify(row, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
</DataTable>
|
||||
|
||||
### Expandable (short size)
|
||||
|
||||
<DataTable size="short" expandable
|
||||
headers="{[
|
||||
{ key: "name", value: "Name" },
|
||||
{ key: "protocol", value: "Protocol" },
|
||||
{ key: "port", value: "Port" },
|
||||
{ key: "rule", value: "Rule" }
|
||||
]}"
|
||||
rows="{[
|
||||
{
|
||||
id: "a",
|
||||
name: "Load Balancer 3",
|
||||
protocol: "HTTP",
|
||||
port: 3000,
|
||||
rule: "Round robin"
|
||||
},
|
||||
{
|
||||
id: "b",
|
||||
name: "Load Balancer 1",
|
||||
protocol: "HTTP",
|
||||
port: 443,
|
||||
rule: "Round robin"
|
||||
},
|
||||
{
|
||||
id: "c",
|
||||
name: "Load Balancer 2",
|
||||
protocol: "HTTP",
|
||||
port: 80,
|
||||
rule: "DNS delegation"
|
||||
},
|
||||
{
|
||||
id: "d",
|
||||
name: "Load Balancer 6",
|
||||
protocol: "HTTP",
|
||||
port: 3000,
|
||||
rule: "Round robin"
|
||||
},
|
||||
{
|
||||
id: "e",
|
||||
name: "Load Balancer 4",
|
||||
protocol: "HTTP",
|
||||
port: 443,
|
||||
rule: "Round robin"
|
||||
},
|
||||
{
|
||||
id: "f",
|
||||
name: "Load Balancer 5",
|
||||
protocol: "HTTP",
|
||||
port: 80,
|
||||
rule: "DNS delegation"
|
||||
},
|
||||
]}"
|
||||
>
|
||||
<div slot="expanded-row" let:row>
|
||||
<pre>
|
||||
{JSON.stringify(row, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
</DataTable>
|
||||
|
||||
### Expandable (tall size)
|
||||
|
||||
<DataTable size="tall" expandable
|
||||
headers="{[
|
||||
{ key: "name", value: "Name" },
|
||||
{ key: "protocol", value: "Protocol" },
|
||||
{ key: "port", value: "Port" },
|
||||
{ key: "rule", value: "Rule" }
|
||||
]}"
|
||||
rows="{[
|
||||
{
|
||||
id: "a",
|
||||
name: "Load Balancer 3",
|
||||
protocol: "HTTP",
|
||||
port: 3000,
|
||||
rule: "Round robin"
|
||||
},
|
||||
{
|
||||
id: "b",
|
||||
name: "Load Balancer 1",
|
||||
protocol: "HTTP",
|
||||
port: 443,
|
||||
rule: "Round robin"
|
||||
},
|
||||
{
|
||||
id: "c",
|
||||
name: "Load Balancer 2",
|
||||
protocol: "HTTP",
|
||||
port: 80,
|
||||
rule: "DNS delegation"
|
||||
},
|
||||
{
|
||||
id: "d",
|
||||
name: "Load Balancer 6",
|
||||
protocol: "HTTP",
|
||||
port: 3000,
|
||||
rule: "Round robin"
|
||||
},
|
||||
{
|
||||
id: "e",
|
||||
name: "Load Balancer 4",
|
||||
protocol: "HTTP",
|
||||
port: 443,
|
||||
rule: "Round robin"
|
||||
},
|
||||
{
|
||||
id: "f",
|
||||
name: "Load Balancer 5",
|
||||
protocol: "HTTP",
|
||||
port: 80,
|
||||
rule: "DNS delegation"
|
||||
},
|
||||
]}"
|
||||
>
|
||||
<div slot="expanded-row" let:row>
|
||||
<pre>
|
||||
{JSON.stringify(row, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
</DataTable>
|
||||
|
||||
### Batch expansion
|
||||
|
||||
<DataTable batchExpansion
|
||||
|
@ -832,6 +1021,12 @@ In the following example, each row in the sortable data table has an overflow me
|
|||
|
||||
<DataTableSkeleton headers={[{ value: "Name" }, {value: "Protocol"}, {value:"Port"}, { value: "Rule"}]} rows={10} />
|
||||
|
||||
### Skeleton with empty header
|
||||
|
||||
Pass an object with `"empty"` set to `true` to render an empty table header column.
|
||||
|
||||
<DataTableSkeleton headers={[{ value: "Name" }, {value: "Protocol"}, {value:"Port"}, { value: "Rule"}, { empty: true }]} rows={10} />
|
||||
|
||||
### Skeleton without header, toolbar
|
||||
|
||||
<DataTableSkeleton showHeader={false} showToolbar={false} />
|
||||
|
|
|
@ -33,4 +33,18 @@ components: ["TileGroup", "RadioTile"]
|
|||
<RadioTile light value="2">
|
||||
Plus plan
|
||||
</RadioTile>
|
||||
</TileGroup>
|
||||
|
||||
### Disabled state
|
||||
|
||||
<TileGroup legend="Service pricing tiers">
|
||||
<RadioTile value="0" checked>
|
||||
Lite plan
|
||||
</RadioTile>
|
||||
<RadioTile value="1" disabled>
|
||||
Standard plan
|
||||
</RadioTile>
|
||||
<RadioTile value="2" disabled>
|
||||
Plus plan
|
||||
</RadioTile>
|
||||
</TileGroup>
|
|
@ -33,4 +33,18 @@ components: ["SelectableTile"]
|
|||
<SelectableTile light>
|
||||
Multi-select Tile
|
||||
</SelectableTile>
|
||||
</div>
|
||||
|
||||
### Disabled state
|
||||
|
||||
<div role="group" aria-label="selectable tiles">
|
||||
<SelectableTile selected>
|
||||
Multi-select Tile
|
||||
</SelectableTile>
|
||||
<SelectableTile disabled>
|
||||
Multi-select Tile
|
||||
</SelectableTile>
|
||||
<SelectableTile disabled>
|
||||
Multi-select Tile
|
||||
</SelectableTile>
|
||||
</div>
|
|
@ -59,7 +59,21 @@ components: ["TimePicker", "TimePickerSelect", "SelectItem"]
|
|||
</TimePickerSelect>
|
||||
</TimePicker>
|
||||
|
||||
### Disabled
|
||||
### Invalid state
|
||||
|
||||
<TimePicker invalid invalidText="A valid value is required" labelText="Cron job" placeholder="hh:mm">
|
||||
<TimePickerSelect value="PM">
|
||||
<SelectItem value="am" text="AM" />
|
||||
<SelectItem value="pm" text="PM" />
|
||||
</TimePickerSelect>
|
||||
<TimePickerSelect value="PDT">
|
||||
<SelectItem value="pdt" text="PDT" />
|
||||
<SelectItem value="gmt" text="GMT" />
|
||||
</TimePickerSelect>
|
||||
</TimePicker>
|
||||
|
||||
|
||||
### Disabled state
|
||||
|
||||
<TimePicker labelText="Cron job" placeholder="hh:mm" disabled>
|
||||
<TimePickerSelect value="PM" disabled>
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
---
|
||||
components: ["Tooltip", "TooltipFooter"]
|
||||
---
|
||||
|
||||
<script>
|
||||
import { Tooltip, Link, Button } from "carbon-components-svelte";
|
||||
import { Tooltip, TooltipFooter, Link, Button } from "carbon-components-svelte";
|
||||
import Catalog16 from "carbon-icons-svelte/lib/Catalog16";
|
||||
import Preview from "../../components/Preview.svelte";
|
||||
</script>
|
||||
|
@ -45,10 +49,10 @@ By default, the tooltip is triggered by an information icon.
|
|||
<p>
|
||||
Resources are provisioned based on your account's organization.
|
||||
</p>
|
||||
<div class="bx--tooltip__footer">
|
||||
<TooltipFooter selectorPrimaryFocus="#d">
|
||||
<Link href="/">Learn more</Link>
|
||||
<Button size="small">Manage</Button>
|
||||
</div>
|
||||
<Button id="d" size="small">Manage</Button>
|
||||
</TooltipFooter>
|
||||
</Tooltip>
|
||||
|
||||
### Custom icon (component)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue