react-loader-spinner
Version:
react-spinner-loader provides simple React.js spinner component which can be implemented for async wait operation before data load to the view.
1 lines • 7.62 kB
Source Map (JSON)
{"version":3,"sources":["../src/type.ts","../src/shared/svg-wrapper.tsx","../src/shared/constants.ts","../src/loader/three-dots.tsx"],"names":["DEFAULT_COLOR","DEFAULT_WAI_ARIA_ATTRIBUTE","SvgWrapper","styled","props","SVG_NAMESPACE","ThreeDots","height","width","radius","color","ariaLabel","wrapperStyle","wrapperClass","visible","jsx","jsxs"],"mappings":"0EAEO,IAAMA,CAAAA,CAAgB,SAAA,CAEhBC,CAAAA,CAA6B,CACxC,YAAa,IAAA,CACb,IAAA,CAAM,aACR,CAAA,CCLO,IAAMC,EAAaC,CAAAA,CAAO,GAAA;AAAA,WAAA,EACpBC,CAAAA,EAAUA,CAAAA,CAAM,QAAA,CAAW,MAAA,CAAS,MAAO,CAAA;ECHjD,IAAMC,CAAAA,CAAgB,4BAAA,CCwCtB,IAAMC,CAAAA,CAA+C,CAAC,CAC3D,OAAAC,CAAAA,CAAS,EAAA,CACT,KAAA,CAAAC,CAAAA,CAAQ,EAAA,CACR,MAAA,CAAAC,EAAS,CAAA,CACT,KAAA,CAAAC,CAAAA,CAAQV,CAAAA,CACR,SAAA,CAAAW,CAAAA,CAAY,qBACZ,YAAA,CAAAC,CAAAA,CACA,YAAA,CAAAC,CAAAA,CACA,OAAA,CAAAC,CAAAA,CAAU,IACZ,CAAA,GACEC,GAAAA,CAACb,CAAAA,CAAA,CACC,KAAA,CAAOU,CAAAA,CACP,SAAUE,CAAAA,CACV,SAAA,CAAWD,CAAAA,CACX,aAAA,CAAY,oBAAA,CACZ,YAAA,CAAYF,EACX,GAAGV,CAAAA,CAEJ,QAAA,CAAAe,IAAAA,CAAC,KAAA,CAAA,CACC,KAAA,CAAOR,EACP,MAAA,CAAQD,CAAAA,CACR,OAAA,CAAQ,YAAA,CACR,KAAA,CAAOF,CAAAA,CACP,KAAMK,CAAAA,CACN,aAAA,CAAY,gBAAA,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QAAA,CAAA,CAAO,EAAA,CAAG,MAAM,EAAA,CAAG,IAAA,CAAK,CAAA,CAAG,MAAA,CAAOP,CAAM,CAAA,CAAI,EAC3C,QAAA,CAAA,CAAAM,GAAAA,CAAC,SAAA,CAAA,CACC,aAAA,CAAc,GAAA,CACd,IAAA,CAAK,KACL,EAAA,CAAG,IAAA,CACH,KAAA,CAAM,IAAA,CACN,GAAA,CAAI,MAAA,CACJ,OAAO,SAAA,CACP,QAAA,CAAS,QAAA,CACT,WAAA,CAAY,YAAA,CACd,CAAA,CACAA,IAAC,SAAA,CAAA,CACC,aAAA,CAAc,cAAA,CACd,IAAA,CAAK,GAAA,CACL,EAAA,CAAG,IACH,KAAA,CAAM,IAAA,CACN,GAAA,CAAI,MAAA,CACJ,MAAA,CAAO,QAAA,CACP,QAAA,CAAS,QAAA,CACT,WAAA,CAAY,YAAA,CACd,CAAA,CAAA,CACF,CAAA,CAAA,CACF,CAAA,CACF","file":"three-dots.mjs","sourcesContent":["import { CSSProperties } from 'react'\n\nexport const DEFAULT_COLOR = '#4fa94d'\n\nexport const DEFAULT_WAI_ARIA_ATTRIBUTE = {\n 'aria-busy': true,\n role: 'progressbar',\n}\n\n// Reuse React's CSSProperties for consistent style typing across components\nexport type Style = CSSProperties\n\n// PrimaryProps includes common props shared by experimental components\nexport interface PrimaryProps {\n height?: string | number\n width?: string | number\n color?: string\n ariaLabel?: string\n wrapperStyle?: CSSProperties\n wrapperClass?: string\n visible?: boolean\n}\n\n\n","import styled from 'styled-components'\n\nexport const SvgWrapper = styled.div<{ $visible: boolean }>`\n display: ${props => (props.$visible ? 'flex' : 'none')};\n`\n","export const SVG_NAMESPACE = 'http://www.w3.org/2000/svg'\n","import { FunctionComponent, CSSProperties } from 'react'\nimport { DEFAULT_COLOR, DEFAULT_WAI_ARIA_ATTRIBUTE } from '../type'\nimport { SvgWrapper } from '../shared/svg-wrapper'\nimport { SVG_NAMESPACE } from '../shared/constants'\n\n/**\n * Props for the ThreeDots loader component.\n * \n * The ThreeDots loader displays three dots that bounce up and down in sequence.\n * \n * @interface ThreeDotsProps\n */\ninterface ThreeDotsProps {\n /** Height of the SVG (number interpreted as px). */\n height?: string | number\n /** Width of the SVG (number interpreted as px). */\n width?: string | number\n /** Primary color applied to the loader. Defaults to DEFAULT_COLOR. */\n color?: string\n /** Accessible label announced to screen readers. */\n ariaLabel?: string\n /** Inline style object applied to the wrapper element. */\n wrapperStyle?: CSSProperties\n /** CSS class applied to the wrapper for custom styling. */\n wrapperClass?: string\n /** When false, the loader is not rendered. Defaults to true. */\n visible?: boolean\n /** \n * Provide multiple colors to render a gradient instead of a solid color.\n * When 2 or more colors are supplied a gradient will be applied to the loader.\n */\n colors?: string[]\n /** Type of gradient (linear or radial). Defaults to linear. */\n gradientType?: 'linear' | 'radial'\n /** Angle (in degrees) applied via rotate() transform for linear gradients. */\n gradientAngle?: number\n /** The radius of the dots */\n radius?: string | number\n}\n\nexport const ThreeDots: FunctionComponent<ThreeDotsProps> = ({\n height = 80,\n width = 80,\n radius = 9,\n color = DEFAULT_COLOR,\n ariaLabel = 'three-dots-loading',\n wrapperStyle,\n wrapperClass,\n visible = true,\n}) => (\n <SvgWrapper\n style={wrapperStyle}\n $visible={visible}\n className={wrapperClass}\n data-testid=\"three-dots-loading\"\n aria-label={ariaLabel}\n {...DEFAULT_WAI_ARIA_ATTRIBUTE}\n >\n <svg\n width={width}\n height={height}\n viewBox=\"0 0 120 30\"\n xmlns={SVG_NAMESPACE}\n fill={color}\n data-testid=\"three-dots-svg\"\n >\n <circle cx=\"15\" cy=\"15\" r={Number(radius) + 6}>\n <animate\n attributeName=\"r\"\n from=\"15\"\n to=\"15\"\n begin=\"0s\"\n dur=\"0.8s\"\n values=\"15;9;15\"\n calcMode=\"linear\"\n repeatCount=\"indefinite\"\n />\n <animate\n attributeName=\"fill-opacity\"\n from=\"1\"\n to=\"1\"\n begin=\"0s\"\n dur=\"0.8s\"\n values=\"1;.5;1\"\n calcMode=\"linear\"\n repeatCount=\"indefinite\"\n />\n </circle>\n <circle\n cx=\"60\"\n cy=\"15\"\n r={radius}\n attributeName=\"fill-opacity\"\n from=\"1\"\n to=\"0.3\"\n >\n <animate\n attributeName=\"r\"\n from=\"9\"\n to=\"9\"\n begin=\"0s\"\n dur=\"0.8s\"\n values=\"9;15;9\"\n calcMode=\"linear\"\n repeatCount=\"indefinite\"\n />\n <animate\n attributeName=\"fill-opacity\"\n from=\"0.5\"\n to=\"0.5\"\n begin=\"0s\"\n dur=\"0.8s\"\n values=\".5;1;.5\"\n calcMode=\"linear\"\n repeatCount=\"indefinite\"\n />\n </circle>\n <circle cx=\"105\" cy=\"15\" r={Number(radius) + 6}>\n <animate\n attributeName=\"r\"\n from=\"15\"\n to=\"15\"\n begin=\"0s\"\n dur=\"0.8s\"\n values=\"15;9;15\"\n calcMode=\"linear\"\n repeatCount=\"indefinite\"\n />\n <animate\n attributeName=\"fill-opacity\"\n from=\"1\"\n to=\"1\"\n begin=\"0s\"\n dur=\"0.8s\"\n values=\"1;.5;1\"\n calcMode=\"linear\"\n repeatCount=\"indefinite\"\n />\n </circle>\n </svg>\n </SvgWrapper>\n)\n"]}