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 5.47 kB
{"version":3,"sources":["../src/type.ts","../src/shared/constants.ts","../src/loader/radio.tsx"],"names":["DEFAULT_COLOR","DEFAULT_WAI_ARIA_ATTRIBUTE","SVG_NAMESPACE","Radio","visible","height","width","wrapperClass","wrapperStyle","ariaLabel","colors","jsxs","jsx"],"mappings":"yCAEO,IAAMA,EAAgB,SAAA,CAEhBC,CAAAA,CAA6B,CACxC,WAAA,CAAa,KACb,IAAA,CAAM,aACR,CAAA,CCPO,IAAMC,EAAgB,4BAAA,CC8BtB,IAAMC,CAAAA,CAAuC,CAAC,CACnD,OAAA,CAAAC,CAAAA,CAAU,IAAA,CACV,MAAA,CAAAC,EAAS,IAAA,CACT,KAAA,CAAAC,CAAAA,CAAQ,IAAA,CACR,aAAAC,CAAAA,CAAe,EAAA,CACf,aAAAC,CAAAA,CAAe,GACf,SAAA,CAAAC,CAAAA,CAAY,eAAA,CACZ,MAAA,CAAAC,EAAS,CAACV,CAAAA,CAAeA,CAAAA,CAAeA,CAAa,CACvD,CAAA,GACUI,CAAAA,CACNO,IAAAA,CAAC,KAAA,CAAA,CACC,MAAOL,CAAAA,CACP,MAAA,CAAQD,EACR,KAAA,CAAOH,CAAAA,CACP,QAAQ,aAAA,CACR,mBAAA,CAAoB,UAAA,CACpB,SAAA,CAAWK,EACX,KAAA,CAAOC,CAAAA,CACP,aAAYC,CAAAA,CACZ,aAAA,CAAY,gBACX,GAAGR,CAAAA,CAEJ,QAAA,CAAA,CAAAW,GAAAA,CAAC,UAAO,EAAA,CAAG,IAAA,CAAK,GAAG,IAAA,CAAK,CAAA,CAAE,KAAK,IAAA,CAAMF,CAAAA,CAAO,CAAC,CAAA,CAC3C,SAAAE,GAAAA,CAAC,SAAA,CAAA,CACC,aAAA,CAAc,cAAA,CACd,SAAS,QAAA,CACT,MAAA,CAAO,OAAA,CACP,QAAA,CAAS,UACT,GAAA,CAAI,GAAA,CACJ,MAAM,IAAA,CACN,WAAA,CAAY,aACb,CAAA,CACH,CAAA,CACAA,GAAAA,CAAC,MAAA,CAAA,CACC,EAAE,0BAAA,CACF,IAAA,CAAK,MAAA,CACL,WAAA,CAAY,KACZ,MAAA,CAAQF,CAAAA,CAAO,CAAC,CAAA,CAEhB,SAAAE,GAAAA,CAAC,SAAA,CAAA,CACC,cAAc,gBAAA,CACd,QAAA,CAAS,SACT,MAAA,CAAO,OAAA,CACP,QAAA,CAAS,SAAA,CACT,IAAI,GAAA,CACJ,KAAA,CAAM,MAAA,CACN,WAAA,CAAY,aACb,CAAA,CACH,CAAA,CACAA,GAAAA,CAAC,MAAA,CAAA,CACC,EAAE,0BAAA,CACF,IAAA,CAAK,OACL,WAAA,CAAY,IAAA,CACZ,OAAQF,CAAAA,CAAO,CAAC,CAAA,CAEhB,QAAA,CAAAE,IAAC,SAAA,CAAA,CACC,aAAA,CAAc,iBACd,QAAA,CAAS,QAAA,CACT,OAAO,OAAA,CACP,QAAA,CAAS,SAAA,CACT,GAAA,CAAI,IACJ,KAAA,CAAM,MAAA,CACN,YAAY,YAAA,CACb,CAAA,CACH,GACF,CAAA,CAxDgB","file":"radio.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","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 { SVG_NAMESPACE } from '../shared/constants'\n\n/**\n * Props for the Radio loader component.\n * \n * The Radio loader displays a circular animation with three colored segments\n * that rotate around the center, resembling radio waves or signal indicators.\n * Each segment can have a different color.\n * \n * @interface RadioProps\n */\ninterface RadioProps {\n /** Height of the SVG (number interpreted as px). Defaults to '80'. */\n height?: string | number\n /** Width of the SVG (number interpreted as px). Defaults to '80'. */\n width?: string | number\n /** Array of three colors for the radio segments. Defaults to [DEFAULT_COLOR, DEFAULT_COLOR, DEFAULT_COLOR]. */\n colors?: [string, string, string]\n /** Accessible label announced to screen readers. Defaults to 'radio-loading'. */\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\nexport const Radio: FunctionComponent<RadioProps> = ({\n visible = true,\n height = '80',\n width = '80',\n wrapperClass = '',\n wrapperStyle = {},\n ariaLabel = 'radio-loading',\n colors = [DEFAULT_COLOR, DEFAULT_COLOR, DEFAULT_COLOR],\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=\"radio-bar-svg\"\n {...DEFAULT_WAI_ARIA_ATTRIBUTE}\n >\n <circle cx=\"28\" cy=\"75\" r=\"11\" fill={colors[0]}>\n <animate\n attributeName=\"fill-opacity\"\n calcMode=\"linear\"\n values=\"0;1;1\"\n keyTimes=\"0;0.2;1\"\n dur=\"1\"\n begin=\"0s\"\n repeatCount=\"indefinite\"\n ></animate>\n </circle>\n <path\n d=\"M28 47A28 28 0 0 1 56 75\"\n fill=\"none\"\n strokeWidth=\"10\"\n stroke={colors[1]}\n >\n <animate\n attributeName=\"stroke-opacity\"\n calcMode=\"linear\"\n values=\"0;1;1\"\n keyTimes=\"0;0.2;1\"\n dur=\"1\"\n begin=\"0.1s\"\n repeatCount=\"indefinite\"\n ></animate>\n </path>\n <path\n d=\"M28 25A50 50 0 0 1 78 75\"\n fill=\"none\"\n strokeWidth=\"10\"\n stroke={colors[2]}\n >\n <animate\n attributeName=\"stroke-opacity\"\n calcMode=\"linear\"\n values=\"0;1;1\"\n keyTimes=\"0;0.2;1\"\n dur=\"1\"\n begin=\"0.2s\"\n repeatCount=\"indefinite\"\n ></animate>\n </path>\n </svg>\n )\n}\n"]}