{ "name": "skeleton", "displayName": "Skeleton", "type": "component", "files": [ { "name": "Skeleton.tsx", "content": "import { forwardRef, type CSSProperties } from 'react';\nimport { cn } from '../../utils/cn';\nimport styles from './Skeleton.module.css';\n\nexport type SkeletonVariant = 'text' | 'circular' | 'rectangular';\n\nexport interface SkeletonProps {\n variant?: SkeletonVariant;\n width?: string | number;\n height?: string | number;\n lines?: number;\n className?: string;\n style?: CSSProperties;\n}\n\nfunction normalize(v: string | number | undefined): string | undefined {\n if (v === undefined) return undefined;\n return typeof v === 'number' ? `${v}px` : v;\n}\n\nexport const Skeleton = forwardRef(\n function Skeleton(\n {\n variant = 'text',\n width,\n height,\n lines = 1,\n className,\n style,\n 'data-testid': dataTestId = 'tatva-skeleton',\n }: SkeletonProps & { 'data-testid'?: string },\n ref,\n ) {\n const commonStyle: CSSProperties = {\n width: normalize(width),\n height: normalize(height),\n ...style,\n };\n if (variant === 'text' && lines > 1) {\n return (\n
\n {Array.from({ length: lines }).map((_, i) => (\n \n ))}\n
\n );\n }\n return (\n \n );\n },\n);\n" }, { "name": "Skeleton.module.css", "content": ".base {\n background-color: var(--tatva-color-neutral-200);\n animation: tatva-skeleton-pulse 1.5s ease-in-out infinite;\n border-radius: var(--tatva-radius-sm);\n}\n\n.text {\n height: 1em;\n width: 100%;\n border-radius: var(--tatva-radius-sm);\n}\n\n.circular {\n border-radius: 50%;\n width: 40px;\n height: 40px;\n}\n\n.rectangular {\n border-radius: var(--tatva-radius-md);\n height: 100px;\n}\n\n@keyframes tatva-skeleton-pulse {\n 0%,\n 100% {\n opacity: 0.4;\n }\n 50% {\n opacity: 1;\n }\n}\n" }, { "name": "index.ts", "content": "export { Skeleton } from './Skeleton';\nexport type { SkeletonProps, SkeletonVariant } from './Skeleton';\n" } ], "registryDependencies": [], "dependencies": [], "devDependencies": [] }