2021-05-06 18:51:44 +02:00
|
|
|
<!--
|
|
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
-->
|
2021-10-26 00:43:02 +02:00
|
|
|
<script lang="ts">
|
2021-11-24 22:17:41 +01:00
|
|
|
import { pageTheme } from "../sveltelib/theme";
|
2021-05-06 19:26:50 +02:00
|
|
|
|
2021-05-06 18:51:44 +02:00
|
|
|
export let id: string | undefined = undefined;
|
2021-05-06 19:26:50 +02:00
|
|
|
let className: string = "";
|
2021-05-06 18:51:44 +02:00
|
|
|
export { className as class };
|
|
|
|
|
2021-05-27 17:13:36 +02:00
|
|
|
export let size: number | undefined = undefined;
|
|
|
|
export let wrap: boolean | undefined = undefined;
|
|
|
|
|
|
|
|
$: buttonSize = size ? `--buttons-size: ${size}rem; ` : "";
|
|
|
|
let buttonWrap: string;
|
|
|
|
$: if (wrap === undefined) {
|
|
|
|
buttonWrap = "";
|
|
|
|
} else {
|
|
|
|
buttonWrap = wrap ? `--buttons-wrap: wrap; ` : `--buttons-wrap: nowrap; `;
|
|
|
|
}
|
|
|
|
|
|
|
|
$: style = buttonSize + buttonWrap;
|
2021-05-06 18:51:44 +02:00
|
|
|
</script>
|
|
|
|
|
2021-05-06 19:26:50 +02:00
|
|
|
<div
|
|
|
|
{id}
|
2021-10-18 14:01:15 +02:00
|
|
|
class="button-toolbar btn-toolbar {className}"
|
2021-11-24 22:17:41 +01:00
|
|
|
class:nightMode={$pageTheme.isDark}
|
2022-11-23 07:50:15 +01:00
|
|
|
style:--icon-align="baseline"
|
2021-05-27 17:13:36 +02:00
|
|
|
{style}
|
2021-05-26 01:21:33 +02:00
|
|
|
role="toolbar"
|
2021-06-29 20:13:28 +02:00
|
|
|
on:focusout
|
2021-05-26 01:21:33 +02:00
|
|
|
>
|
2021-05-06 18:51:44 +02:00
|
|
|
<slot />
|
|
|
|
</div>
|
2021-05-27 17:13:36 +02:00
|
|
|
|
|
|
|
<style lang="scss">
|
2021-10-18 14:01:15 +02:00
|
|
|
.button-toolbar {
|
2021-05-27 17:13:36 +02:00
|
|
|
flex-wrap: var(--buttons-wrap);
|
2021-11-17 04:49:52 +01:00
|
|
|
padding-left: 0.15rem;
|
2021-10-18 14:01:15 +02:00
|
|
|
|
2022-02-03 05:52:11 +01:00
|
|
|
:global(.button-group) {
|
2021-10-18 14:01:15 +02:00
|
|
|
/* TODO replace with gap once available */
|
|
|
|
margin-right: 0.15rem;
|
|
|
|
margin-bottom: 0.15rem;
|
|
|
|
}
|
2021-05-27 17:13:36 +02:00
|
|
|
}
|
|
|
|
</style>
|