/** * Shared swatch, tooltip, glow and quantity animation controls. */ import { AnimationsTab } from "../tabs/Animations"; import { Toggle } from "../components/Toggle"; import { RangeSlider } from "../components/RangeSlider"; import { ColorPicker } from "../components/ColorPicker"; import { HighlightableField } from "../components/HighlightableField"; import { TooltipAnimationLivePreview } from "./TooltipAnimationLivePreview"; import type { BaseTabProps } from "../tabs/types"; import type { ExtensionSettings, ExtensionTooltipPosition, } from "./presentationTypes"; export interface ExtensionAnimationsSectionProps extends BaseTabProps { navigateToField?: (target: { id: string; tabId: string; subTab?: string; }) => void; } export function ExtensionAnimationsSection({ settings, setSettings, adminColor, navigateToField, }: ExtensionAnimationsSectionProps) { const animationType = (settings.animation_type || "none") as NonNullable< ExtensionSettings["animation_type"] >; const parsedGlowIntensity = Number(settings.glow_intensity); const glowIntensity = Number.isFinite(parsedGlowIntensity) ? parsedGlowIntensity : 15; const glowColor = settings.glow_color || adminColor; const glowUseSwatchColor = !!settings.glow_use_swatch_color; const glowOnHover = settings.glow_on_hover !== false; // Tooltip animation live preview travels with the tooltip animation controls // into the shared Animations tab (rendered only when tooltips are enabled). const validTooltipPositions = ["top", "right", "bottom", "left"] as const; const tooltipPosition = (validTooltipPositions as readonly string[]).includes( String(settings.tooltip_position), ) ? (settings.tooltip_position as ExtensionTooltipPosition) : ("top" as ExtensionTooltipPosition); const tooltipPreviewSignature = [ settings.tooltip_animation || "fade", tooltipPosition, settings.tooltip_fade_in !== false ? "fade-in" : "no-fade-in", settings.tooltip_fade_out !== false ? "fade-out" : "no-fade-out", ].join(":"); const tooltipAnimationPreview = settings.enable_tooltips ? (
Tooltip Animation Preview
Hover over the button to see the animation.