mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
* feat(modal): support 3-button modal #528, #472 * fix(modal): "supercede" --> "supersede" * test(modal): test secondaryButtons prop, updated click:button--secondary custom event * docs(modal): add multiple secondary button example for ComposedModal * docs(modal): rename example * fix(modal): do not render secondary button if secondaryButtonText is falsy * docs(composed-modal): add button to re-open modal
31 lines
839 B
Svelte
31 lines
839 B
Svelte
<script>
|
|
import {
|
|
Button,
|
|
ComposedModal,
|
|
ModalHeader,
|
|
ModalBody,
|
|
ModalFooter,
|
|
Checkbox,
|
|
} from "carbon-components-svelte";
|
|
|
|
let open = true;
|
|
let checked = false;
|
|
</script>
|
|
|
|
<Button on:click="{() => (open = true)}">Review changes</Button>
|
|
|
|
<ComposedModal bind:open on:submit="{() => (open = false)}">
|
|
<ModalHeader label="Changes" title="Confirm changes" />
|
|
<ModalBody hasForm>
|
|
<Checkbox labelText="I have reviewed the changes" bind:checked />
|
|
</ModalBody>
|
|
<ModalFooter
|
|
primaryButtonText="Proceed"
|
|
primaryButtonDisabled="{!checked}"
|
|
secondaryButtons="{[{ text: 'Cancel' }, { text: 'Review' }]}"
|
|
on:click:button--secondary="{({ detail }) => {
|
|
if (detail.text === 'Cancel') open = false;
|
|
if (detail.text === 'Review') console.log('Review');
|
|
}}"
|
|
/>
|
|
</ComposedModal>
|