UNPKG

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 6.48 kB
{"version":3,"sources":["../src/type.ts","../src/shared/constants.ts","../src/loader/rotating-triangles.tsx"],"names":["DEFAULT_WAI_ARIA_ATTRIBUTE","SVG_NAMESPACE","RotatingTriangles","visible","height","width","wrapperClass","wrapperStyle","ariaLabel","colors","jsx","jsxs"],"mappings":"yDAIO,IAAMA,EAA6B,CACxC,WAAA,CAAa,KACb,IAAA,CAAM,aACR,ECPO,IAAMC,CAAAA,CAAgB,6BCqCtB,IAAMC,CAAAA,CAA+D,CAAC,CAC3E,OAAA,CAAAC,CAAAA,CAAU,IAAA,CACV,OAAAC,CAAAA,CAAS,IAAA,CACT,MAAAC,CAAAA,CAAQ,IAAA,CACR,aAAAC,CAAAA,CAAe,EAAA,CACf,aAAAC,CAAAA,CAAe,GACf,SAAA,CAAAC,CAAAA,CAAY,4BACZ,MAAA,CAAAC,CAAAA,CAAS,CAAC,SAAA,CAAW,SAAA,CAAW,SAAS,CAC3C,IACUN,CAAAA,CACNO,cAAAA,CAAC,OACC,KAAA,CAAOL,CAAAA,CACP,OAAQD,CAAAA,CACR,KAAA,CAAOH,EACP,OAAA,CAAQ,aAAA,CACR,oBAAoB,UAAA,CACpB,SAAA,CAAWK,EACX,KAAA,CAAOC,CAAAA,CACP,aAAYC,CAAAA,CACZ,aAAA,CAAY,wBACX,GAAGR,CAAAA,CAEJ,SAAAU,cAAAA,CAAC,GAAA,CAAA,CAAE,UAAU,kBAAA,CACX,QAAA,CAAAA,eAAC,GAAA,CAAA,CAAE,SAAA,CAAU,aACX,QAAA,CAAAC,eAAAA,CAAC,KAAE,SAAA,CAAU,oBAAA,CACX,UAAAD,cAAAA,CAAC,SAAA,CAAA,CACC,OAAO,6BAAA,CACP,IAAA,CAAMD,CAAAA,CAAO,CAAC,EACd,SAAA,CAAU,qBAAA,CAEV,SAAAC,cAAAA,CAAC,kBAAA,CAAA,CACC,cAAc,WAAA,CACd,IAAA,CAAK,SACL,QAAA,CAAS,QAAA,CACT,OAAO,uBAAA,CACP,QAAA,CAAS,MACT,GAAA,CAAI,IAAA,CACJ,MAAM,IAAA,CACN,WAAA,CAAY,YAAA,CACb,CAAA,CACH,EACAA,cAAAA,CAAC,SAAA,CAAA,CACC,OAAO,oBAAA,CACP,IAAA,CAAMD,EAAO,CAAC,CAAA,CACd,UAAU,uBAAA,CAEV,QAAA,CAAAC,eAAC,kBAAA,CAAA,CACC,aAAA,CAAc,YACd,IAAA,CAAK,QAAA,CACL,SAAS,QAAA,CACT,MAAA,CAAO,2BAAA,CACP,QAAA,CAAS,MACT,GAAA,CAAI,IAAA,CACJ,MAAM,IAAA,CACN,WAAA,CAAY,aACb,CAAA,CACH,CAAA,CACAA,eAAC,SAAA,CAAA,CACC,MAAA,CAAO,sBACP,IAAA,CAAMD,CAAAA,CAAO,CAAC,CAAA,CACd,SAAA,CAAU,2BAEV,QAAA,CAAAC,cAAAA,CAAC,oBACC,aAAA,CAAc,WAAA,CACd,KAAK,QAAA,CACL,QAAA,CAAS,SACT,MAAA,CAAO,yBAAA,CACP,SAAS,KAAA,CACT,GAAA,CAAI,KACJ,KAAA,CAAM,IAAA,CACN,YAAY,YAAA,CACb,CAAA,CACH,GACF,CAAA,CACF,CAAA,CACF,EACF,CAAA,CAnEgB","file":"rotating-triangles.cjs","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","export const SVG_NAMESPACE = 'http://www.w3.org/2000/svg'\n","import { FunctionComponent, CSSProperties } from 'react'\nimport { DEFAULT_WAI_ARIA_ATTRIBUTE } from '../type'\nimport { SVG_NAMESPACE } from '../shared/constants'\n\n/**\n * Props for the RotatingTriangles loader component.\n * \n * The RotatingTriangles loader displays multiple triangles rotating around a center point.\n * \n * @interface RotatingTrianglesProps\n */\ninterface RotatingTrianglesProps {\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. */\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}\n\nexport const RotatingTriangles: FunctionComponent<RotatingTrianglesProps> = ({\n visible = true,\n height = '80',\n width = '80',\n wrapperClass = '',\n wrapperStyle = {},\n ariaLabel = 'rotating-triangle-loading',\n colors = ['#1B5299', '#EF8354', '#DB5461'],\n}) => {\n return !visible ? null : (\n <svg\n width={width}\n height={height}\n xmlns={SVG_NAMESPACE}\n viewBox=\"0 0 100 100\"\n preserveAspectRatio=\"xMidYMid\"\n className={wrapperClass}\n style={wrapperStyle}\n aria-label={ariaLabel}\n data-testid=\"rotating-triangle-svg\"\n {...DEFAULT_WAI_ARIA_ATTRIBUTE}\n >\n <g transform=\"translate(50,42)\">\n <g transform=\"scale(0.8)\">\n <g transform=\"translate(-50,-50)\">\n <polygon\n points=\"72.5,50 50,11 27.5,50 50,50\"\n fill={colors[0]}\n transform=\"rotate(186 50 38.5)\"\n >\n <animateTransform\n attributeName=\"transform\"\n type=\"rotate\"\n calcMode=\"linear\"\n values=\"0 50 38.5;360 50 38.5\"\n keyTimes=\"0;1\"\n dur=\"1s\"\n begin=\"0s\"\n repeatCount=\"indefinite\"\n ></animateTransform>\n </polygon>\n <polygon\n points=\"5,89 50,89 27.5,50\"\n fill={colors[1]}\n transform=\"rotate(186 27.5 77.5)\"\n >\n <animateTransform\n attributeName=\"transform\"\n type=\"rotate\"\n calcMode=\"linear\"\n values=\"0 27.5 77.5;360 27.5 77.5\"\n keyTimes=\"0;1\"\n dur=\"1s\"\n begin=\"0s\"\n repeatCount=\"indefinite\"\n ></animateTransform>\n </polygon>\n <polygon\n points=\"72.5,50 50,89 95,89\"\n fill={colors[2]}\n transform=\"rotate(186 72.2417 77.5)\"\n >\n <animateTransform\n attributeName=\"transform\"\n type=\"rotate\"\n calcMode=\"linear\"\n values=\"0 72.5 77.5;360 72 77.5\"\n keyTimes=\"0;1\"\n dur=\"1s\"\n begin=\"0s\"\n repeatCount=\"indefinite\"\n ></animateTransform>\n </polygon>\n </g>\n </g>\n </g>\n </svg>\n )\n}\n"]}