2021-06-11 23:15:40 +02:00
|
|
|
<!--
|
|
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
-->
|
2021-06-12 00:18:50 +02:00
|
|
|
<script lang="ts">
|
2022-09-10 10:46:59 +02:00
|
|
|
import { createEventDispatcher, onMount } from "svelte";
|
2022-02-04 09:36:34 +01:00
|
|
|
|
|
|
|
import IconConstrain from "./IconConstrain.svelte";
|
2021-06-12 00:18:50 +02:00
|
|
|
|
2021-06-12 00:38:56 +02:00
|
|
|
let className = "";
|
|
|
|
export { className as class };
|
2021-06-24 17:19:42 +02:00
|
|
|
export let tooltip: string | undefined = undefined;
|
2021-06-12 00:38:56 +02:00
|
|
|
|
2021-10-18 14:01:15 +02:00
|
|
|
export let iconSize = 100;
|
|
|
|
export let widthMultiplier = 1;
|
|
|
|
export let flipX = false;
|
|
|
|
|
2021-06-12 00:18:50 +02:00
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
|
|
|
|
let spanRef: HTMLSpanElement;
|
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
dispatch("mount", { span: spanRef });
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2023-10-12 05:33:36 +02:00
|
|
|
<button
|
2021-06-21 20:24:15 +02:00
|
|
|
bind:this={spanRef}
|
2021-06-24 16:44:08 +02:00
|
|
|
title={tooltip}
|
2021-10-18 14:01:15 +02:00
|
|
|
class="badge {className}"
|
2021-06-21 20:24:15 +02:00
|
|
|
on:click
|
2021-06-24 14:06:57 +02:00
|
|
|
on:mouseenter
|
|
|
|
on:mouseleave
|
2023-10-14 02:20:14 +02:00
|
|
|
tabindex="-1"
|
2021-06-21 20:24:15 +02:00
|
|
|
>
|
2021-10-18 14:01:15 +02:00
|
|
|
<IconConstrain {iconSize} {widthMultiplier} {flipX}>
|
|
|
|
<slot />
|
|
|
|
</IconConstrain>
|
2023-10-12 05:33:36 +02:00
|
|
|
</button>
|
2021-06-11 23:15:40 +02:00
|
|
|
|
|
|
|
<style>
|
|
|
|
.badge {
|
2021-10-18 14:01:15 +02:00
|
|
|
color: var(--badge-color, inherit);
|
2023-10-12 05:33:36 +02:00
|
|
|
border: none;
|
|
|
|
background: transparent;
|
|
|
|
padding: 0;
|
2023-12-12 05:43:48 +01:00
|
|
|
/* remove default macOS styling */
|
|
|
|
box-shadow: none;
|
2023-10-12 05:33:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.badge:hover,
|
|
|
|
.badge:active {
|
|
|
|
border: none;
|
|
|
|
background: transparent;
|
|
|
|
box-shadow: none;
|
2021-06-11 23:15:40 +02:00
|
|
|
}
|
|
|
|
|
2021-06-21 20:24:15 +02:00
|
|
|
.dropdown-toggle::after {
|
|
|
|
display: none;
|
|
|
|
}
|
2021-06-11 23:15:40 +02:00
|
|
|
</style>
|