2021-04-16 12:24:06 +02:00
|
|
|
<script>
|
2024-03-06 10:33:17 +01:00
|
|
|
import {
|
|
|
|
default as AbsTooltip,
|
|
|
|
TooltipPosition,
|
|
|
|
TooltipType,
|
|
|
|
} from "../Tooltip/AbsTooltip.svelte"
|
2022-04-12 16:34:34 +02:00
|
|
|
|
2021-04-20 21:06:27 +02:00
|
|
|
export let name = "Add"
|
|
|
|
export let hidden = false
|
2021-04-27 16:30:13 +02:00
|
|
|
export let size = "M"
|
2021-04-22 11:58:04 +02:00
|
|
|
export let hoverable = false
|
|
|
|
export let disabled = false
|
2021-12-09 14:08:16 +01:00
|
|
|
export let color
|
2024-03-06 10:33:17 +01:00
|
|
|
export let hoverColor
|
2022-04-12 16:34:34 +02:00
|
|
|
export let tooltip
|
2024-03-06 10:33:17 +01:00
|
|
|
export let tooltipPosition = TooltipPosition.Bottom
|
|
|
|
export let tooltipType = TooltipType.Default
|
|
|
|
export let tooltipColor
|
|
|
|
export let tooltipWrap = true
|
2024-03-13 14:58:42 +01:00
|
|
|
export let newStyles = false
|
2021-04-16 12:24:06 +02:00
|
|
|
</script>
|
|
|
|
|
2024-03-06 10:33:17 +01:00
|
|
|
<AbsTooltip
|
|
|
|
text={tooltip}
|
|
|
|
type={tooltipType}
|
|
|
|
position={tooltipPosition}
|
|
|
|
color={tooltipColor}
|
|
|
|
noWrap={tooltipWrap}
|
2021-04-23 10:33:41 +02:00
|
|
|
>
|
2024-03-15 11:01:38 +01:00
|
|
|
<div class="icon" class:newStyles>
|
2024-03-06 10:33:17 +01:00
|
|
|
<svg
|
2024-07-22 10:27:44 +02:00
|
|
|
on:contextmenu
|
2024-03-06 10:33:17 +01:00
|
|
|
on:click
|
|
|
|
class:hoverable
|
|
|
|
class:disabled
|
|
|
|
class="spectrum-Icon spectrum-Icon--size{size}"
|
|
|
|
focusable="false"
|
|
|
|
aria-hidden={hidden}
|
|
|
|
aria-label={name}
|
|
|
|
style={`${color ? `color: ${color};` : ""} ${
|
|
|
|
hoverColor
|
|
|
|
? `--hover-color: ${hoverColor}`
|
|
|
|
: "--hover-color: var(--spectrum-alias-icon-color-selected-hover)"
|
|
|
|
}`}
|
|
|
|
>
|
|
|
|
<use
|
|
|
|
style="pointer-events: none;"
|
|
|
|
xlink:href="#spectrum-icon-18-{name}"
|
|
|
|
/>
|
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
</AbsTooltip>
|
2021-04-22 11:58:04 +02:00
|
|
|
|
|
|
|
<style>
|
2022-04-25 13:46:45 +02:00
|
|
|
.icon {
|
2022-04-12 16:34:34 +02:00
|
|
|
position: relative;
|
|
|
|
display: grid;
|
|
|
|
place-items: center;
|
|
|
|
}
|
2024-03-13 14:58:42 +01:00
|
|
|
.newStyles {
|
|
|
|
color: var(--spectrum-global-color-gray-700);
|
|
|
|
}
|
2024-08-23 15:38:08 +02:00
|
|
|
svg {
|
|
|
|
transition: color var(--spectrum-global-animation-duration-100, 130ms);
|
|
|
|
}
|
2021-04-22 11:58:04 +02:00
|
|
|
svg.hoverable {
|
|
|
|
pointer-events: all;
|
|
|
|
}
|
|
|
|
svg.hoverable:hover {
|
2024-03-06 10:33:17 +01:00
|
|
|
color: var(--hover-color) !important;
|
2021-04-22 11:58:04 +02:00
|
|
|
cursor: pointer;
|
|
|
|
}
|
2023-02-23 14:55:18 +01:00
|
|
|
svg.hoverable:active {
|
|
|
|
color: var(--spectrum-global-color-blue-400) !important;
|
|
|
|
}
|
2024-03-13 14:58:42 +01:00
|
|
|
.newStyles svg.hoverable:hover,
|
|
|
|
.newStyles svg.hoverable:active {
|
|
|
|
color: var(--spectrum-global-color-gray-900) !important;
|
|
|
|
}
|
2021-04-22 11:58:04 +02:00
|
|
|
svg.disabled {
|
|
|
|
color: var(--spectrum-global-color-gray-500) !important;
|
|
|
|
pointer-events: none !important;
|
|
|
|
}
|
2022-04-12 16:34:34 +02:00
|
|
|
|
|
|
|
.tooltip {
|
|
|
|
position: absolute;
|
|
|
|
pointer-events: none;
|
|
|
|
left: 50%;
|
2023-07-20 13:21:09 +02:00
|
|
|
bottom: calc(100% + 4px);
|
2022-04-12 16:34:34 +02:00
|
|
|
transform: translateX(-50%);
|
2022-04-25 13:46:45 +02:00
|
|
|
text-align: center;
|
2023-07-20 13:21:09 +02:00
|
|
|
z-index: 1;
|
2022-08-17 15:46:38 +02:00
|
|
|
}
|
2023-07-21 11:39:58 +02:00
|
|
|
|
|
|
|
.spectrum-Icon--sizeXS {
|
|
|
|
width: var(--spectrum-global-dimension-size-150);
|
|
|
|
height: var(--spectrum-global-dimension-size-150);
|
|
|
|
}
|
2021-04-22 11:58:04 +02:00
|
|
|
</style>
|