import type { ReactElement, HTMLAttributes, Ref } from "react"; import type SlAnimationElement from "@shoelace-style/shoelace/dist/components/animation/animation.js"; import { SlCancelEvent, SlFinishEvent, SlStartEvent } from "../events"; export type { SlAnimationElement }; export type SlAnimationCancelEvent = SlCancelEvent; export type SlAnimationFinishEvent = SlFinishEvent; export type SlAnimationStartEvent = SlStartEvent; export interface SlAnimationProps extends HTMLAttributes { ref?: Ref; /** * The name of the built-in animation to use. For custom animations, use the `keyframes` prop. */ name?: string; /** * Plays the animation. When omitted, the animation will be paused. This attribute will be automatically removed when * the animation finishes or gets canceled. */ play?: boolean; /** * The number of milliseconds to delay the start of the animation. */ delay?: number; /** * Determines the direction of playback as well as the behavior when reaching the end of an iteration. * [Learn more](https://developer.mozilla.org/en-US/docs/Web/CSS/animation-direction) */ direction?: PlaybackDirection; /** * The number of milliseconds each iteration of the animation takes to complete. */ duration?: number; /** * The easing function to use for the animation. This can be a Shoelace easing function or a custom easing function * such as `cubic-bezier(0, 1, .76, 1.14)`. */ easing?: string; /** * The number of milliseconds to delay after the active period of an animation sequence. */ endDelay?: number; /** * Sets how the animation applies styles to its target before and after its execution. */ fill?: FillMode; /** * The number of iterations to run before the animation completes. Defaults to `Infinity`, which loops. */ iterations?: any; /** * The offset at which to start the animation, usually between 0 (start) and 1 (end). */ iterationStart?: number; /** * Sets the animation's playback rate. The default is `1`, which plays the animation at a normal speed. Setting this * to `2`, for example, will double the animation's speed. A negative value can be used to reverse the animation. This * value can be changed without causing the animation to restart. */ playbackRate?: number; /** * Emitted when the animation is canceled. */ onSlCancel?: (event: SlAnimationCancelEvent) => void; /** * Emitted when the animation is canceled. */ onSlCancelCapture?: (event: SlAnimationCancelEvent) => void; /** * Emitted when the animation finishes. */ onSlFinish?: (event: SlAnimationFinishEvent) => void; /** * Emitted when the animation finishes. */ onSlFinishCapture?: (event: SlAnimationFinishEvent) => void; /** * Emitted when the animation starts or restarts. */ onSlStart?: (event: SlAnimationStartEvent) => void; /** * Emitted when the animation starts or restarts. */ onSlStartCapture?: (event: SlAnimationStartEvent) => void; } /** * Animate elements declaratively with nearly 100 baked-in presets, or roll your own with custom keyframes. Powered by the [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API). */ export default function SlAnimation( props: SlAnimationProps, ): ReactElement;