mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 12:23:02 +00:00
Merge branch 'master' into tile-required
This commit is contained in:
commit
ae0310cd95
7 changed files with 107 additions and 2 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -1,5 +1,5 @@
|
||||||
name: CI
|
name: CI
|
||||||
on: [push, pull_request]
|
on: [pull_request]
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
@ -14,6 +14,10 @@
|
||||||
|
|
||||||
<FileSource src="/framed/Modal/PassiveModal" />
|
<FileSource src="/framed/Modal/PassiveModal" />
|
||||||
|
|
||||||
|
### Multiple modals
|
||||||
|
|
||||||
|
<FileSource src="/framed/Modal/ModalMultiple" />
|
||||||
|
|
||||||
### Multiple secondary buttons
|
### Multiple secondary buttons
|
||||||
|
|
||||||
Use the `secondaryButtons` prop to render two secondary buttons for a "3-button modal". The prop is a 2-tuple type that supersedes `secondaryButtonText`.
|
Use the `secondaryButtons` prop to render two secondary buttons for a "3-button modal". The prop is a 2-tuple type that supersedes `secondaryButtonText`.
|
||||||
|
|
|
@ -22,6 +22,16 @@ source: Tile/RadioTile.svelte
|
||||||
</RadioTile>
|
</RadioTile>
|
||||||
</TileGroup>
|
</TileGroup>
|
||||||
|
|
||||||
|
### Reactive (one-way binding)
|
||||||
|
|
||||||
|
<FileSource src="/framed/RadioTile/RadioTileReactiveOneWay" />
|
||||||
|
|
||||||
|
### Reactive (two-way binding)
|
||||||
|
|
||||||
|
Binding to the `selected` prop is a more concise approach to managing state.
|
||||||
|
|
||||||
|
<FileSource src="/framed/RadioTile/RadioTileReactive" />
|
||||||
|
|
||||||
### Light variant
|
### Light variant
|
||||||
|
|
||||||
<TileGroup legend="Service pricing tiers">
|
<TileGroup legend="Service pricing tiers">
|
||||||
|
|
38
docs/src/pages/framed/Modal/ModalMultiple.svelte
Normal file
38
docs/src/pages/framed/Modal/ModalMultiple.svelte
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<script>
|
||||||
|
import { Button, Modal } from "carbon-components-svelte";
|
||||||
|
|
||||||
|
let openCreate = false;
|
||||||
|
let openDelete = false;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Button on:click="{() => (openCreate = true)}">Create database</Button>
|
||||||
|
<Button kind="danger-tertiary" on:click="{() => (openDelete = true)}">
|
||||||
|
Delete database
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
bind:open="{openCreate}"
|
||||||
|
modalHeading="Create database"
|
||||||
|
primaryButtonText="Confirm"
|
||||||
|
secondaryButtonText="Cancel"
|
||||||
|
on:click:button--secondary="{() => (openCreate = false)}"
|
||||||
|
on:open
|
||||||
|
on:close
|
||||||
|
on:submit
|
||||||
|
>
|
||||||
|
<p>Create a new Cloudant database in the US South region.</p>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
danger
|
||||||
|
bind:open="{openDelete}"
|
||||||
|
modalHeading="Delete database"
|
||||||
|
primaryButtonText="Delete"
|
||||||
|
secondaryButtonText="Cancel"
|
||||||
|
on:click:button--secondary="{() => (openDelete = false)}"
|
||||||
|
on:open
|
||||||
|
on:close
|
||||||
|
on:submit
|
||||||
|
>
|
||||||
|
<p>This is a permanent action and cannot be undone.</p>
|
||||||
|
</Modal>
|
31
docs/src/pages/framed/RadioTile/RadioTileReactive.svelte
Normal file
31
docs/src/pages/framed/RadioTile/RadioTileReactive.svelte
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<script>
|
||||||
|
import { TileGroup, RadioTile, Button } from "carbon-components-svelte";
|
||||||
|
|
||||||
|
const values = ["Lite plan", "Standard plan", "Plus plan"];
|
||||||
|
|
||||||
|
let selected = values[0];
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<TileGroup legend="Service pricing tiers" bind:selected>
|
||||||
|
{#each values as value}
|
||||||
|
<RadioTile value="{value}">{value}</RadioTile>
|
||||||
|
{/each}
|
||||||
|
</TileGroup>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
Selected: <strong>{selected}</strong>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
|
disabled="{selected === values[1]}"
|
||||||
|
on:click="{() => (selected = values[1])}"
|
||||||
|
>
|
||||||
|
Set to "{values[1]}"
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
div {
|
||||||
|
margin: var(--cds-spacing-05) 0;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,21 @@
|
||||||
|
<script>
|
||||||
|
import { TileGroup, RadioTile } from "carbon-components-svelte";
|
||||||
|
|
||||||
|
const values = ["Lite plan", "Standard plan", "Plus plan"];
|
||||||
|
|
||||||
|
let selected = values[0];
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<TileGroup
|
||||||
|
legend="Service pricing tiers"
|
||||||
|
on:select="{({ detail }) => (selected = detail)}"
|
||||||
|
>
|
||||||
|
{#each values as value}
|
||||||
|
<RadioTile value="{value}" checked="{selected === value}">{value}</RadioTile
|
||||||
|
>
|
||||||
|
{/each}
|
||||||
|
</TileGroup>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
Selected: <strong>{selected}</strong>
|
|
@ -39,13 +39,14 @@
|
||||||
},
|
},
|
||||||
update: (value) => {
|
update: (value) => {
|
||||||
selectedValue.set(value);
|
selectedValue.set(value);
|
||||||
|
dispatch("select", value);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
$: selected = $selectedValue;
|
$: selected = $selectedValue;
|
||||||
|
$: selectedValue.set(selected);
|
||||||
$: inputsName.set(name);
|
$: inputsName.set(name);
|
||||||
$: inputsRequired.set(required);
|
$: inputsRequired.set(required);
|
||||||
$: dispatch("select", $selectedValue);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<fieldset disabled="{disabled}" class:bx--tile-group="{true}" {...$$restProps}>
|
<fieldset disabled="{disabled}" class:bx--tile-group="{true}" {...$$restProps}>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue