UNPKG

@atlaskit/icon

Version:

An icon is a symbol representing a command, device, directory, or common action.

45 lines (44 loc) • 1.74 kB
/** * @jsxRuntime classic * @jsx jsx */ import { type ReactNode } from 'react'; export interface AnimatedIconTriggerProps { /** * Animated icons inside this component respond to its active state. */ children: ReactNode; /** * What activates the trigger. Defaults to `hover`. * * - `hover`: active while hovered, or while keyboard focus is inside. Leaving interrupts the motion. * - `click`: becomes active on a click inside (which includes keyboard activation of buttons and links). * Hover and focus are ignored, and the motion always plays through to completion. * * Ignored when `isActive` is set. */ trigger?: 'hover' | 'click'; /** * Controls the active state. When set, no wrapper element is rendered and `trigger` is ignored. * Use this to trigger motion from something else, such as a loading state. */ isActive?: boolean; /** * Called when an icon inside has finished animating and asks for the active state to be cleared. * Only used when `isActive` is set; update your state here to make `isActive` false. */ onReset?: () => void; /** * A unique string that appears as a data attribute `data-testid` on the wrapper element, * which is only rendered when `isActive` is not set. */ testId?: string; } /** * __Animated icon trigger__ * * Tells animated icons inside it when to animate, without passing props or refs down. * Becomes active on hover (and keyboard focus) or on click, depending on `trigger`. */ declare const AnimatedIconTrigger: ({ children, isActive: isActiveProp, onReset, testId, trigger, }: AnimatedIconTriggerProps) => JSX.Element; export default AnimatedIconTrigger;