import { forwardRef } from 'react' import Skeleton from './Skeleton' import SkeletonAvatar from './SkeletonAvatar' import SkeletonCard from './SkeletonCard' import type { SkeletonProps } from './types' const SkeletonRoot = forwardRef((props, ref) => ( )) // Convenience aliases (no flat export — they exist only as compound statics) const SkeletonCircle = forwardRef>( (props, ref) => ) const SkeletonRectangle = forwardRef< HTMLDivElement, Omit >((props, ref) => ) const SkeletonRounded = forwardRef< HTMLDivElement, Omit >((props, ref) => ) /** * Enhanced Skeleton with compound component pattern * * Usage: * * * * * * Or traditional: * */ // Statics that reuse a flat export are typed as `typeof` that export so the // emitted declarations state the value identity instead of re-declaring props. const SkeletonCompound: typeof SkeletonRoot & { /** * Avatar skeleton with circular or square shapes and multiple sizes */ Avatar: typeof SkeletonAvatar /** * Card skeleton with default layout or custom children */ Card: typeof SkeletonCard /** * Base skeleton component for custom shapes and layouts */ Base: typeof Skeleton Circle: typeof SkeletonCircle Rectangle: typeof SkeletonRectangle Rounded: typeof SkeletonRounded } = Object.assign(SkeletonRoot, { Avatar: SkeletonAvatar, Card: SkeletonCard, Base: Skeleton, Circle: SkeletonCircle, Rectangle: SkeletonRectangle, Rounded: SkeletonRounded, }) // Display names for better debugging SkeletonCompound.displayName = 'Skeleton' SkeletonCompound.Avatar.displayName = 'Skeleton.Avatar' SkeletonCompound.Card.displayName = 'Skeleton.Card' SkeletonCompound.Base.displayName = 'Skeleton.Base' SkeletonCompound.Circle.displayName = 'Skeleton.Circle' SkeletonCompound.Rectangle.displayName = 'Skeleton.Rectangle' SkeletonCompound.Rounded.displayName = 'Skeleton.Rounded' export default SkeletonCompound