2021-06-12 10:25:11 +02:00
|
|
|
<!--
|
|
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
-->
|
|
|
|
<script lang="ts">
|
2021-11-17 04:49:52 +01:00
|
|
|
import Col from "../components/Col.svelte";
|
2022-02-04 09:36:34 +01:00
|
|
|
import Row from "../components/Row.svelte";
|
2022-06-01 12:26:16 +02:00
|
|
|
import Switch from "../components/Switch.svelte";
|
2021-06-12 10:25:11 +02:00
|
|
|
import Label from "./Label.svelte";
|
|
|
|
import RevertButton from "./RevertButton.svelte";
|
2022-02-04 09:36:34 +01:00
|
|
|
import TooltipLabel from "./TooltipLabel.svelte";
|
2021-06-12 10:25:11 +02:00
|
|
|
|
|
|
|
export let value: boolean;
|
|
|
|
export let defaultValue: boolean;
|
|
|
|
export let markdownTooltip: string | undefined = undefined;
|
2021-06-21 18:15:41 +02:00
|
|
|
|
|
|
|
const id = Math.random().toString(36).substring(2);
|
2021-06-12 10:25:11 +02:00
|
|
|
</script>
|
|
|
|
|
2021-11-17 04:49:52 +01:00
|
|
|
<Row --cols={6}>
|
|
|
|
<Col --col-size={4}
|
|
|
|
>{#if markdownTooltip}<TooltipLabel for={id} {markdownTooltip}
|
2021-06-21 18:15:41 +02:00
|
|
|
><slot /></TooltipLabel
|
2021-11-17 04:49:52 +01:00
|
|
|
>{:else}<Label for={id}><slot /></Label>{/if}</Col
|
|
|
|
>
|
|
|
|
<Col --col-justify="flex-end">
|
2021-06-21 18:15:41 +02:00
|
|
|
<Switch {id} bind:value />
|
2021-06-22 01:41:31 +02:00
|
|
|
<RevertButton bind:value {defaultValue} />
|
2021-06-12 10:25:11 +02:00
|
|
|
</Col>
|
|
|
|
</Row>
|