'use client'; import * as React from 'react'; import { motion, type Variants } from 'motion/react'; import { getVariants, useAnimateIconContext, IconWrapper, type IconProps, } from '@/registry/icons/icon'; type LoaderProps = IconProps; const SEGMENT_COUNT = 8; const DURATION = 1.2; const BASE_OPACITY = 0.25; const animations = { default: (() => { const spinner: Record = { group: { initial: {}, animate: {} }, }; for (let i = 1; i <= SEGMENT_COUNT; i++) { const reverseIndex = SEGMENT_COUNT - i; const delay = -(reverseIndex * DURATION) / SEGMENT_COUNT; spinner[`path${i}`] = { initial: { opacity: 1 }, animate: { opacity: [1, BASE_OPACITY], transition: { duration: DURATION, ease: 'linear', repeat: Infinity, repeatType: 'loop', delay, }, }, }; } return spinner as Record; })() satisfies Record, spin: { group: { initial: { rotate: 0 }, animate: { rotate: 360, transition: { duration: 1.5, ease: 'linear', repeat: Infinity, repeatType: 'loop', }, }, }, path1: {}, path2: {}, path3: {}, path4: {}, path5: {}, path6: {}, path7: {}, path8: {}, } satisfies Record, } as const; function IconComponent({ size, ...props }: LoaderProps) { const { controls } = useAnimateIconContext(); const variants = getVariants(animations); return ( ); } function Loader(props: LoaderProps) { return ; } export { animations, Loader, Loader as LoaderIcon, type LoaderProps, type LoaderProps as LoaderIconProps, };