{"version":3,"file":"skeleton.cjs","sources":["../../../components/skeleton/skeleton.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'class-variance-authority';\nimport { CSSProperties, createContext, ReactNode, useContext } from 'react';\nimport styles from './skeleton.module.css';\n\nexport interface SkeletonProps {\n  baseColor?: string;\n  highlightColor?: string;\n  width?: string | number;\n  height?: string | number;\n  borderRadius?: string | number;\n  inline?: boolean;\n  duration?: number;\n  enableAnimation?: boolean;\n  count?: number;\n  style?: CSSProperties;\n  className?: string;\n  containerStyle?: CSSProperties;\n  containerClassName?: string;\n}\n\nconst SkeletonContext = createContext<SkeletonProps | null>(null);\n\ninterface SkeletonProviderProps extends SkeletonProps {\n  children: ReactNode;\n}\n\nconst SkeletonBase = (props: SkeletonProps) => {\n  const contextProps = useContext(SkeletonContext);\n\n  const {\n    baseColor,\n    highlightColor,\n    width,\n    height = 'var(--rs-space-4)',\n    borderRadius = 'var(--rs-radius-2)',\n    inline = false,\n    duration = 1.5,\n    count = 1,\n    enableAnimation = true,\n    style,\n    className,\n    containerStyle,\n    containerClassName\n  } = { ...contextProps, ...props };\n\n  const skeletonClassName = cx(\n    styles.skeleton,\n    inline && styles.inline,\n    enableAnimation && styles.animate,\n    className\n  );\n\n  const Container = inline ? 'span' : 'div';\n  const defaultWidth = inline ? '50px' : '100%';\n\n  return (\n    <Container\n      className={containerClassName}\n      aria-hidden='true'\n      data-slot='skeleton'\n      style={{\n        display: inline ? 'inline-block' : 'flex',\n        flexDirection: !inline ? 'column' : undefined,\n        gap: !inline && count > 1 ? 'var(--rs-space-3)' : undefined,\n        ...containerStyle\n      }}\n    >\n      {Array.from({ length: count }).map((_, i) => (\n        <span\n          key={i}\n          className={skeletonClassName}\n          data-slot='skeleton-item'\n          style={\n            {\n              width: width ?? defaultWidth,\n              height,\n              borderRadius,\n              '--skeleton-base-color': baseColor,\n              '--skeleton-highlight-color': highlightColor,\n              '--skeleton-duration': `${duration}s`,\n              ...style\n            } as CSSProperties\n          }\n        />\n      ))}\n    </Container>\n  );\n};\n\nSkeletonBase.displayName = 'Skeleton';\n\nconst Provider = ({ children, ...props }: SkeletonProviderProps) => {\n  return <SkeletonContext value={props}>{children}</SkeletonContext>;\n};\n\nProvider.displayName = 'Skeleton.Provider';\n\nexport const Skeleton = Object.assign(SkeletonBase, { Provider });\n"],"names":[],"mappings":";;;;;;;;AAsBA;AAMA;AACE;;;;;AA4BA;;;AAQM;AACA;AACD;;;;AAYO;AACA;;AAEA;AACgB;AAM9B;AAEA;AAEA;;AAEA;AAEA;AAEO;;"}