2021-06-05 14:33:35 +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">
|
2022-02-04 09:36:34 +01:00
|
|
|
import { createEventDispatcher, onMount } from "svelte";
|
2021-06-05 14:33:35 +02:00
|
|
|
|
2021-06-21 18:15:41 +02:00
|
|
|
let forId: string;
|
|
|
|
export { forId as for };
|
2022-11-04 01:06:57 +01:00
|
|
|
export let preventMouseClick = false;
|
2021-06-21 18:15:41 +02:00
|
|
|
|
2021-06-05 14:33:35 +02:00
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
|
|
|
|
let spanRef: HTMLSpanElement;
|
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
dispatch("mount", { span: spanRef });
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2023-07-17 06:34:09 +02:00
|
|
|
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
|
|
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
2022-11-04 01:06:57 +01:00
|
|
|
<label
|
|
|
|
bind:this={spanRef}
|
|
|
|
for={forId}
|
|
|
|
on:click={(e) => {
|
|
|
|
if (preventMouseClick) e.preventDefault();
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<slot />
|
|
|
|
</label>
|
2021-11-17 04:49:52 +01:00
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
label {
|
|
|
|
display: inline;
|
|
|
|
}
|
|
|
|
</style>
|