2022-01-19 19:33:58 +01:00
|
|
|
<script>
|
|
|
|
import Tooltip from "./Tooltip.svelte"
|
|
|
|
import Icon from "../Icon/Icon.svelte"
|
|
|
|
|
|
|
|
export let tooltip = ""
|
|
|
|
export let size = "M"
|
|
|
|
|
|
|
|
let showTooltip = false
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class:container={!!tooltip}>
|
|
|
|
<slot />
|
|
|
|
{#if tooltip}
|
|
|
|
<div class="icon-container">
|
|
|
|
<div
|
|
|
|
class="icon"
|
|
|
|
class:icon-small={size === "M" || size === "S"}
|
|
|
|
on:mouseover={() => (showTooltip = true)}
|
|
|
|
on:mouseleave={() => (showTooltip = false)}
|
2022-02-07 19:47:10 +01:00
|
|
|
on:focus
|
2022-01-19 19:33:58 +01:00
|
|
|
>
|
|
|
|
<Icon name="InfoOutline" size="S" disabled={true} />
|
|
|
|
</div>
|
|
|
|
{#if showTooltip}
|
|
|
|
<div class="tooltip">
|
|
|
|
<Tooltip textWrapping={true} direction={"bottom"} text={tooltip} />
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.container {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
.icon-container {
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
margin-left: 5px;
|
|
|
|
margin-right: 5px;
|
|
|
|
}
|
|
|
|
.tooltip {
|
|
|
|
position: absolute;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
top: 15px;
|
2022-02-07 19:47:10 +01:00
|
|
|
z-index: 100;
|
2022-01-19 19:33:58 +01:00
|
|
|
width: 160px;
|
|
|
|
}
|
|
|
|
.icon {
|
|
|
|
transform: scale(0.75);
|
|
|
|
}
|
|
|
|
.icon-small {
|
2022-09-13 12:52:31 +02:00
|
|
|
margin-bottom: -2px;
|
2022-01-19 19:33:58 +01:00
|
|
|
}
|
|
|
|
</style>
|