{"version":3,"file":"Skeleton.mjs","sources":["../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport React from 'react';\nimport styles from './Skeleton.module.css';\n\ntype BaseProps = {\n  /**\n   * CSS class names to augment the layout of the skeleton component. For skeletons,\n   * this is mostly useful to add layout styles (e.g., tailwind CSS margins, flex, etc.)\n   */\n  className?: string;\n  /**\n   * Determine whether there should be an animation in the skeleton state\n   */\n  isAnimating?: boolean;\n} & Omit<\n  React.HTMLAttributes<HTMLDivElement>,\n  'children' | 'style' | 'aria-hidden'\n>;\n\ntype SkeletonProps = BaseProps & {\n  width?: number | string;\n  height?: number | string;\n};\n\n/**\n * ## Usage\n *\n * Placeholder containers that are used for dynamic pages, to represent a proxy of the page layout\n * when content finishes loading. Sizing and shape of the skeletons can be styled and adjusted, and\n * the components can show an animation while on screen.\n *\n * | Type/Use | Description | Example |\n * |----------|-------------|---------|\n * | Block | The default. A rectangle sized by `width` and `height`. | Cards, images, and other blocks of layout. |\n * | Text | `Skeleton.Text` stands in for a line or paragraph of copy. | Headings, body copy, list rows. |\n * | Circle | `Skeleton.Circle` takes a single `width` and uses it for both dimensions. | Avatars and other round elements. |\n *\n * The shimmer runs by default and can be turned off per instance with `isAnimating={false}`. It is\n * also disabled automatically for anyone who has asked for reduced motion.\n *\n * ## Content & Accessibility\n *\n * Every skeleton renders `aria-hidden`, so assistive tech skips the placeholders entirely. Announce\n * the loading state separately, rather than relying on the skeletons to convey that something is\n * on its way.\n *\n * ### Do's\n *\n * * Use `Skeleton` when you have content that may take some time to load, but you know the general shape and positioning of the content.\n * * For `Skeleton`s using text, it's preferred to use the `ch` size in CSS with an approximate character count similar to the eventual content, so that it scales with the adjacent typography preset used.\n * * All other `Skeleton` components should prefer using relative size units (`rem`, `em`, `%`) so that they adapt to user zoom settings.\n *\n * ### Don'ts\n *\n * * Avoid excessive use of `Skeleton`, especially in cases where the page has static content that isn't fetched asynchronously. Only use `Skeleton` for specific chunks of content that may need more time to load.\n * * Avoid very large `Skeleton` instances (e.g., greater than `25vh` / `25vw`). Consider using multiple smaller `Skeleton` instances, or a background color and centered `LoadingIndicator`.\n *\n * ## Resources\n *\n * * https://www.lukew.com/ff/entry.asp?1797\n */\nexport const Skeleton = ({\n  className,\n  isAnimating = true,\n  height,\n  width,\n  ...other\n}: SkeletonProps) => {\n  const componentClassName = clsx(\n    className,\n    styles['skeleton'],\n    isAnimating && styles['skeleton--is-animating'],\n  );\n  return (\n    <div\n      {...other}\n      aria-hidden\n      className={componentClassName}\n      style={{ width, height }}\n    ></div>\n  );\n};\n\ntype TextProps = BaseProps & {\n  height?: number | string;\n  width?: number | string;\n};\n\nconst TextSkeleton = ({\n  className,\n  isAnimating = true,\n  height,\n  width,\n  ...other\n}: TextProps) => {\n  const componentClassName = clsx(\n    className,\n    styles['skeleton'],\n    isAnimating && styles['skeleton--is-animating'],\n  );\n  return (\n    <div\n      {...other}\n      aria-hidden\n      className={componentClassName}\n      style={{ width, height: height }}\n    ></div>\n  );\n};\n\ntype CircleProps = BaseProps & {\n  width?: number | string;\n};\n\nconst CircleSkeleton = ({\n  className,\n  isAnimating = true,\n  width,\n  ...other\n}: CircleProps) => {\n  const componentClassName = clsx(\n    className,\n    styles['skeleton'],\n    styles['skeleton-circle'],\n    isAnimating && styles['skeleton--is-animating'],\n  );\n\n  return (\n    <div\n      {...other}\n      aria-hidden\n      className={componentClassName}\n      style={{ width, height: width }}\n    ></div>\n  );\n};\n\nSkeleton.displayName = 'Skeleton';\nTextSkeleton.displayName = 'Skeleton.Text';\nCircleSkeleton.displayName = 'Skeleton.Circle';\n\nSkeleton.Text = TextSkeleton;\nSkeleton.Circle = CircleSkeleton;\n"],"names":["React"],"mappings":";;;;AAwBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCG;MACU,QAAQ,GAAG,CAAC,EACvB,SAAS,EACT,WAAW,GAAG,IAAI,EAClB,MAAM,EACN,KAAK,EACL,GAAG,KAAK,EACM,KAAI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