2021-03-30 01:23:39 +02:00
|
|
|
<script lang="typescript">
|
2021-03-30 18:57:50 +02:00
|
|
|
import type { Buttons } from "./types";
|
|
|
|
|
2021-04-01 16:29:24 +02:00
|
|
|
export let id = "";
|
|
|
|
export let className = "";
|
|
|
|
export let props: Record<string, string> = {};
|
|
|
|
|
2021-03-30 00:51:44 +02:00
|
|
|
export let buttons: Buttons;
|
2021-04-08 17:26:30 +02:00
|
|
|
export let wraps: boolean;
|
2021-03-29 21:48:31 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
ul {
|
2021-03-30 03:11:51 +02:00
|
|
|
display: flex;
|
2021-04-08 16:31:41 +02:00
|
|
|
overflow-y: auto;
|
2021-03-29 21:48:31 +02:00
|
|
|
|
2021-03-30 00:51:44 +02:00
|
|
|
padding-inline-start: 0;
|
|
|
|
margin-bottom: 0;
|
2021-03-29 21:48:31 +02:00
|
|
|
|
2021-03-31 15:40:11 +02:00
|
|
|
& :global(button),
|
|
|
|
& :global(select) {
|
2021-03-29 21:48:31 +02:00
|
|
|
margin-left: -1px;
|
|
|
|
}
|
2021-03-30 00:51:44 +02:00
|
|
|
}
|
2021-03-29 21:48:31 +02:00
|
|
|
|
2021-04-08 17:26:30 +02:00
|
|
|
.wraps {
|
|
|
|
flex-flow: wrap;
|
|
|
|
}
|
|
|
|
|
2021-03-30 00:51:44 +02:00
|
|
|
li {
|
|
|
|
display: inline-block;
|
2021-03-31 16:24:28 +02:00
|
|
|
margin-bottom: calc(var(--toolbar-size) / 15);
|
2021-03-30 00:51:44 +02:00
|
|
|
|
|
|
|
&:nth-child(1) {
|
2021-03-31 16:24:28 +02:00
|
|
|
margin-left: calc(var(--toolbar-size) / 7.5);
|
2021-03-30 00:51:44 +02:00
|
|
|
|
2021-03-31 15:40:11 +02:00
|
|
|
& > :global(button),
|
|
|
|
& > :global(select) {
|
2021-03-31 16:24:28 +02:00
|
|
|
/* default 0.25rem */
|
|
|
|
border-top-left-radius: calc(var(--toolbar-size) / 7.5);
|
|
|
|
border-bottom-left-radius: calc(var(--toolbar-size) / 7.5);
|
2021-03-30 00:51:44 +02:00
|
|
|
}
|
2021-03-29 21:48:31 +02:00
|
|
|
}
|
|
|
|
|
2021-03-30 00:51:44 +02:00
|
|
|
&:nth-last-child(1) {
|
2021-03-31 16:24:28 +02:00
|
|
|
margin-right: calc(var(--toolbar-size) / 7.5);
|
2021-03-30 00:51:44 +02:00
|
|
|
|
2021-03-31 15:40:11 +02:00
|
|
|
& > :global(button),
|
|
|
|
& > :global(select) {
|
2021-03-31 16:24:28 +02:00
|
|
|
border-top-right-radius: calc(var(--toolbar-size) / 7.5);
|
|
|
|
border-bottom-right-radius: calc(var(--toolbar-size) / 7.5);
|
2021-03-30 00:51:44 +02:00
|
|
|
}
|
2021-03-29 21:48:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
2021-04-08 17:26:30 +02:00
|
|
|
<ul {id} class={className} {...props} class:wraps>
|
2021-03-30 00:51:44 +02:00
|
|
|
{#each buttons as button}
|
|
|
|
<li>
|
|
|
|
{#if Array.isArray(button)}
|
2021-04-08 17:26:30 +02:00
|
|
|
<svelte:self buttons={button} {wraps} />
|
2021-03-30 00:51:44 +02:00
|
|
|
{:else}
|
|
|
|
<svelte:component this={button.component} {...button} />
|
|
|
|
{/if}
|
|
|
|
</li>
|
|
|
|
{/each}
|
|
|
|
</ul>
|