hu-mouse-pointer-click-0-1
animateicons/hu-mouse-pointer-click-0-1FreeComponent
animateicons publishes no description for this item.
Install it
npx shadcn@latest add https://animateicons.in/r/hu-mouse-pointer-click-0-1.jsonSource
1"use client";23import { cn } from "@/lib/utils";4import type { Variants } from "motion/react";5import {6 LazyMotion,7 domMin,8 m,9 useAnimation,10 useReducedMotion,11} from "motion/react";12import {13 forwardRef,14 useCallback,15 useImperativeHandle,16 useRef,17 type HTMLAttributes,18} from "react";19export interface MousePointerClick01IconHandle {20 startAnimation: () => void;21 stopAnimation: () => void;22}2324interface MousePointerClick01IconProps extends Omit<25 HTMLAttributes<HTMLDivElement>,26 | "color"27 | "onDrag"28 | "onDragStart"29 | "onDragEnd"30 | "onAnimationStart"31 | "onAnimationEnd"32 | "onAnimationIteration"33> {34 size?: number;35 duration?: number;36 isAnimated?: boolean;37 color?: string;38}3940const MousePointerClick01Icon = forwardRef<41 MousePointerClick01IconHandle,42 MousePointerClick01IconProps43>(44 (45 {46 onMouseEnter,47 onMouseLeave,48 className,49 size = 24,50 duration = 1,51 isAnimated = true,52 color,53 ...props54 },55 ref,56 ) => {57 const controls = useAnimation();58 const reduced = useReducedMotion();59 const isControlled = useRef(false);6061 useImperativeHandle(ref, () => {62 isControlled.current = true;63 return {64 startAnimation: () =>65 reduced ? controls.start("normal") : controls.start("animate"),66 stopAnimation: () => controls.start("normal"),67 };68 });6970 const handleEnter = useCallback(71 (e?: React.MouseEvent<HTMLDivElement>) => {72 if (!isAnimated || reduced) return;73 if (!isControlled.current) controls.start("animate");74 else onMouseEnter?.(e as any);75 },76 [controls, reduced, isAnimated, onMouseEnter],77 );7879 const handleLeave = useCallback(80 (e?: React.MouseEvent<HTMLDivElement>) => {81 if (!isControlled.current) controls.start("normal");82 else onMouseLeave?.(e as any);83 },84 [controls, onMouseLeave],85 );8687 const pointerVariants: Variants = {88 normal: {89 scale: 1,90 y: 0,91 },92 animate: {93 scale: [1, 0.95, 1],94 y: [0, 1, 0],95 transition: {96 duration: 0.5 * duration,97 ease: "easeInOut",98 },99 },100 };101102 const clickRayVariants: Variants = {103 normal: {104 opacity: 1,105 scale: 1,106 },107 animate: {108 opacity: [0, 1, 0, 1],109 scale: [0.6, 1.2, 1],110 transition: {111 duration: 0.6 * duration,112 ease: "easeOut",113 },114 },115 };116117 return (118 <LazyMotion features={domMin} strict>119 <m.div120 className={cn("inline-flex items-center justify-center", className)}121 onMouseEnter={handleEnter}122 onMouseLeave={handleLeave}123 {...props}124// … truncated
What it pulls in
npm packages
Files it writes
More from animateicons
All 542 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| hu-activityhu-activity | animateicons | Components | Free | 1 dep | |
| hu-bookmarkhu-bookmark | animateicons | Components | Free | 1 dep | |
| hu-bookmark-checkhu-bookmark-check | animateicons | Components | Free | 1 dep | |
| hu-bookmark-minushu-bookmark-minus | animateicons | Components | Free | 1 dep | |
| hu-bookmark-removehu-bookmark-remove | animateicons | Components | Free | 1 dep | |
| hu-checkhu-check | animateicons | Components | Free | 1 dep | |
| hu-check-checkhu-check-check | animateicons | Components | Free | 1 dep | |
| hu-chevron-righthu-chevron-right | animateicons | Components | Free | 1 dep |
