budibase/packages/bbui/src/Icon/Icon.svelte

100 lines
2.3 KiB
Svelte
Raw Normal View History

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"
export let name = "Add"
export let hidden = false
2021-04-27 16:30:13 +02:00
export let size = "M"
export let hoverable = false
export let disabled = false
export let color
2024-03-06 10:33:17 +01:00
export let hoverColor
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
>
<div class="icon" class:newStyles>
2024-03-06 10:33:17 +01:00
<svg
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>
<style>
2022-04-25 13:46:45 +02:00
.icon {
position: relative;
display: grid;
place-items: center;
}
2024-03-13 14:58:42 +01:00
.newStyles {
color: var(--spectrum-global-color-gray-700);
}
svg {
transition: color var(--spectrum-global-animation-duration-100, 130ms);
}
svg.hoverable {
pointer-events: all;
}
svg.hoverable:hover {
2024-03-06 10:33:17 +01:00
color: var(--hover-color) !important;
cursor: pointer;
}
Undo/Redo for Design and Automate sections + automations refactor (#9714) * Add full undo/redo support for screens * Add loading states to disable spamming undo/redo * Add keyboard shortcuts for undo and redo * Fix modals not closing in design section when escape is pressed * Remove log * Add smart metadata saving to undo/redo * Add error handling to undo/redo * Add active state to hoverable icons * Fix screen deletion * Always attempt to get latest doc version before deleting in case rev has changed * Move undo listener top level, hide controls when on certain tabs, and improve selection state * Add tooltips to undo/redo control * Update automation section nav to match other sections * Fix automation list padding * Fix some styles in create automation modal * Improve automation section styles and add undo/redo * Update styles in add action modal * Fix button size when creating admin user * Fix styles in add automation step modal * Fix issue selecting disabled automation steps * Reset automation history store when changing app * Reduce spammy unnecessary API calls when editing cron trigger * WIP automation refactor * Rewrite most automation state * Rewrite most of the rest of automation state * Finish refactor of automation state * Fix selection state when selecting new doc after history recreates it * Prune nullish or empty block inputs from automations and avoid sending API requests when no changes have been made * Fix animation issues with automations * Sort automations and refetch list when adding or deleting * Fix formatting * Add back in ability to swap between values and bindings for block inputs * Lint * Format * Fix potential issue in design section when selected screen is unset * Fix automation arrow directions everywhere, tidy up logic and fix crash when using invalid looping * Lint * Fix more cases of automation errors * Fix implicity any TS error * Respect _id specified when creating automations * Fix crash in history store when reverting a change on a doc whose ID has changed * Lint * Ensure cloneDeep helper doesn't crash when a nullish value is passed in * Remove deprecated frontend automation test --------- Co-authored-by: Rory Powell <rory.codes@gmail.com>
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;
}
svg.disabled {
color: var(--spectrum-global-color-gray-500) !important;
pointer-events: none !important;
}
.tooltip {
position: absolute;
pointer-events: none;
left: 50%;
bottom: calc(100% + 4px);
transform: translateX(-50%);
2022-04-25 13:46:45 +02:00
text-align: center;
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);
}
</style>