{"version":3,"file":"LoadingIndicator.mjs","sources":["../../../src/components/LoadingIndicator/LoadingIndicator.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport React from 'react';\n\nimport type { Size } from '../../util/variant-types';\n\nimport styles from './LoadingIndicator.module.css';\n\nexport type LoadingIndicatorProps = {\n  // Component API\n  /**\n   * CSS class names that can be appended to the component.\n   */\n  className?: string;\n  /**\n   * Aria label of the oval. Default is \"loading\". Will be overridden if ariaLabel is passed in props\n   */\n  ariaLabel?: string;\n  // Design API\n  /**\n   * Layout size of the loader. This affects the overall size and associated\n   * stroke width.\n   */\n  size?: Extract<Size, 'xs' | 'sm' | 'md' | 'lg'>;\n  /**\n   * Whether the oval is visible. Default is true.\n   */\n  isVisible?: boolean;\n};\n\n// Pixel sizes corresponding to EDS size units\nconst loaderSize = {\n  xs: 16, // --eds-spacing-size-1\n  sm: 24, // --eds-spacing-size-2-and-half\n  md: 40, // --eds-spacing-size-5\n  lg: 56, // --eds-spacing-size-7\n};\n\n// Given a loader size, the stroke widths can change\nconst loaderStrokeSize = {\n  xs: 4,\n  sm: 4,\n  md: 4,\n  lg: 4,\n};\n\n// The viewport changes based on adjustments to handle the stroke width\nconst loaderViewportSize = {\n  xs: '-22 -22 46 46',\n  sm: '-22 -22 46 46',\n  md: '-22 -22 46 46',\n  lg: '-22 -22 46 46',\n};\n\n/**\n * ## Usage\n *\n * * **Indeterminate loaders**: use when a process does not have a specific endpoint (e.g., loading a page or fetching a component's content); the ongoing animation creates the perception of better performance.\n * * **Spinners**: use as a secondary choice of loader to Skeleton states.\n *\n * | Type | Description | Example |\n * |------|-------------|---------|\n * | Spinner (Indeterminate) | Circular animation that loops while content loads without known duration. | Page transitions, unknown-length processes. |\n * | Progress Bar (Determinate) | Horizontal bar that fills to show loading progress percentage. | File uploads, installers, long-running tasks with known duration. |\n * | Progress Bar (Indeterminate) | Animated bar without a fixed percentage; shows ongoing activity. | Searching, connecting, polling data with unpredictable timing. |\n * | Skeleton Loader | Placeholder UI shaped like content. | Content-heavy pages, feeds, dashboards. |\n * | Dots/Bouncing loader | Animated dots or shapes to suggest activity. | Messaging input, minimal UIs. |\n * | Inline loader | Small spinner or bar embedded within buttons, fields, or table rows. | \"Saving...\" or \"Submitting...\" buttons, table row actions. |\n * | Fullscreen loader | Large spinner or blocking indicator over the entire screen. | Initial page loads, app boot-up sequences. |\n * | Overlay loader | Semi-transparent spinner overlay on a section of the UI. | Panel refreshes, card-level async operations. |\n * | Looping animation/GIF | Custom animated asset or branded loader. | Branded apps, unique user experiences. |\n * | Success/Failure transition | Loader morphs into a checkmark or error icon. | Submission confirmation. |\n *\n * ### Best Practices\n *\n * * **Do** use other loaders before using the Spinner.\n * * **Don't** overload the page with Spinners; minimize usage.\n */\nexport const LoadingIndicator = ({\n  ariaLabel = 'loading',\n  className,\n  size = 'md',\n  isVisible: visible = true,\n  ...other\n}: LoadingIndicatorProps) => {\n  const componentClassName = clsx(\n    styles['loading-indicator'],\n    !visible && styles['loading-indicator--invisible'],\n    className,\n  );\n\n  // setting the colors to be transparent since we override in CSS\n  // (and have a lint rule prevent token variable use in components)\n  return (\n    <div\n      aria-busy=\"true\"\n      aria-label={ariaLabel}\n      className={componentClassName}\n      data-testid=\"oval-loading\"\n      role=\"status\"\n      {...other}\n    >\n      <svg\n        data-testid=\"oval-svg\"\n        height={loaderSize[size]}\n        stroke=\"transparent\"\n        viewBox={loaderViewportSize[size]}\n        width={loaderSize[size]}\n        xmlns=\"http://www.w3.org/2000/svg\"\n      >\n        <g fill=\"none\" fillRule=\"evenodd\">\n          <g\n            data-testid=\"oval-secondary-group\"\n            strokeWidth={loaderStrokeSize[size]}\n            transform=\"translate(1 1)\"\n          >\n            <circle\n              cx=\"0\"\n              cy=\"0\"\n              r=\"20\"\n              stroke=\"transparent\"\n              strokeOpacity=\".5\"\n              strokeWidth={loaderStrokeSize[size]}\n            ></circle>\n            <path d=\"M20 0c0-9.94-8.06-20-20-20\">\n              <animateTransform\n                attributeName=\"transform\"\n                dur=\"1s\"\n                from=\"0 0 0\"\n                repeatCount=\"indefinite\"\n                to=\"360 0 0\"\n                type=\"rotate\"\n              ></animateTransform>\n            </path>\n          </g>\n        </g>\n      </svg>\n    </div>\n  );\n};\n\nLoadingIndicator.displayName = 'LoadingIndicator';\n"],"names":["React"],"mappings":";;;;AA6BA;AACA,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,EAAE;CACP;AAED;AACA,MAAM,gBAAgB,GAAG;AACvB,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;AACL,IAAA,EAAE,EAAE,CAAC;CACN;AAED;AACA,MAAM,kBAAkB,GAAG;AACzB,IAAA,EAAE,EAAE,eAAe;AACnB,IAAA,EAAE,EAAE,eAAe;AACnB,IAAA,EAAE,EAAE,eAAe;AACnB,IAAA,EAAE,EAAE,eAAe;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;AAuBG;AACI,MAAM,gBAAgB,GAAG,CAAC,EAC/B,SAAS,GAAG,SAAS,EACrB,SAAS,EACT,IAAI,GAAG,IAAI,EACX,SAAS,EAAE,OAAO,GAAG,IAAI,EACzB,GAAG,KAAK,EACc,KAAI;AAC1B,IAAA,MAAM,kBAAkB,GAAG,IAAI,CAC7B,MAAM,CAAC,mBAAmB,CAAC,EAC3B,CAAC,OAAO,IAAI,MAAM,CAAC,8BAA8B,CAAC,EAClD,SAAS,CACV;;;AAID,IAAA,QACEA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,WAAA,EACY,MAAM,EAAA,YAAA,EACJ,SAAS,EACrB,SAAS,EAAE,kBAAkB,EAAA,aAAA,EACjB,cAAc,EAC1B,IAAI,EAAC,QAAQ,KACT,KAAK,EAAA;AAET,QAAAA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,aAAA,EACc,UAAU,E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