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.91 kB
Source Map (JSON)
{"version":3,"sources":["../src/type.ts","../src/shared/svg-wrapper.tsx","../src/shared/constants.ts","../src/loader/three-circles.tsx"],"names":["DEFAULT_COLOR","DEFAULT_WAI_ARIA_ATTRIBUTE","SvgWrapper","styled","props","SVG_NAMESPACE","ThreeCircles","wrapperStyle","visible","wrapperClass","height","width","color","ariaLabel","outerCircleColor","innerCircleColor","middleCircleColor","jsx","jsxs"],"mappings":"wMAEO,IAAMA,CAAAA,CAAgB,SAAA,CAEhBC,CAAAA,CAA6B,CACxC,YAAa,IAAA,CACb,IAAA,CAAM,aACR,CAAA,CCLO,IAAMC,EAAaC,kBAAAA,CAAO,GAAA;AAAA,WAAA,EACpBC,CAAAA,EAAUA,CAAAA,CAAM,QAAA,CAAW,MAAA,CAAS,MAAO,CAAA;ACHjD,CAAA,CAAA,IAAMC,EAAgB,4BAAA,CCuCtB,IAAMC,CAAAA,CAAqD,CAAC,CACjE,YAAA,CAAAC,CAAAA,CAAe,EAAC,CAChB,OAAA,CAAAC,EAAU,IAAA,CACV,YAAA,CAAAC,CAAAA,CAAe,EAAA,CACf,OAAAC,CAAAA,CAAS,GAAA,CACT,MAAAC,CAAAA,CAAQ,GAAA,CACR,MAAAC,CAAAA,CAAQZ,CAAAA,CACR,SAAA,CAAAa,CAAAA,CAAY,wBACZ,gBAAA,CAAAC,CAAAA,CACA,iBAAAC,CAAAA,CACA,iBAAA,CAAAC,CACF,CAAA,GAEIC,cAAAA,CAACf,CAAAA,CAAA,CACC,MAAOK,CAAAA,CACP,QAAA,CAAUC,EACV,SAAA,CAAWC,CAAAA,CACX,cAAY,uBAAA,CACZ,YAAA,CAAYI,CAAAA,CACX,GAAGZ,EAEJ,QAAA,CAAAiB,eAAAA,CAAC,OACC,OAAA,CAAQ,KAAA,CACR,OAAQ,CAAA,EAAGR,CAAM,CAAA,CAAA,CACjB,KAAA,CAAO,GAAGC,CAAK,CAAA,CAAA,CACf,MAAON,CAAAA,CACP,OAAA,CAAQ,cACR,gBAAA,CAAiB,iBAAA,CACjB,SAAS,UAAA,CACT,aAAA,CAAY,oBAEZ,QAAA,CAAA,CAAAY,cAAAA,CAAC,QACC,IAAA,CAAMH,CAAAA,EAAoBF,EAC1B,CAAA,CAAE,CAAA;AAAA,uCAAA,CAAA,CAGF,QAAA,CAAAK,cAAAA,CAAC,kBAAA,CAAA,CACC,aAAA,CAAc,WAAA,CACd,cAAc,KAAA,CACd,IAAA,CAAK,QAAA,CACL,GAAA,CAAI,IAAA,CACJ,IAAA,CAAK,UACL,EAAA,CAAG,WAAA,CACH,WAAA,CAAY,YAAA,CACd,CAAA,CACF,CAAA,CACAA,eAAC,MAAA,CAAA,CACC,IAAA,CAAMD,CAAAA,EAAqBJ,CAAAA,CAC3B,CAAA,CAAE,CAAA;AAAA,uCAAA,CAAA,CAGF,QAAA,CAAAK,cAAAA,CAAC,kBAAA,CAAA,CACC,aAAA,CAAc,WAAA,CACd,cAAc,KAAA,CACd,IAAA,CAAK,QAAA,CACL,GAAA,CAAI,IAAA,CACJ,IAAA,CAAK,UACL,EAAA,CAAG,YAAA,CACH,WAAA,CAAY,YAAA,CACd,CAAA,CACF,CAAA,CACAA,eAAC,MAAA,CAAA,CACC,IAAA,CAAMF,CAAAA,EAAoBH,CAAAA,CAC1B,CAAA,CAAE,CAAA;AAAA,WAAA,CAAA,CAGF,SAAAK,cAAAA,CAAC,kBAAA,CAAA,CACC,cAAc,WAAA,CACd,aAAA,CAAc,MACd,IAAA,CAAK,QAAA,CACL,IAAI,IAAA,CACJ,IAAA,CAAK,UACL,EAAA,CAAG,WAAA,CACH,YAAY,YAAA,CACd,CAAA,CACF,GACF,CAAA,CACF","file":"three-circles.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","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 ThreeCircles loader component.\n * \n * The ThreeCircles loader displays three circles with animated movement patterns.\n * \n * @interface ThreeCirclesProps\n */\ninterface ThreeCirclesProps {\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 /** Color of the outer circle. Overrides default color. */\n outerCircleColor?: string\n /** Color of the middle circle. Overrides default color. */\n middleCircleColor?: string\n /** Color of the inner circle. Overrides default color. */\n innerCircleColor?: 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\n/**\n * @description contains three circles rotating in opposite direction\n * outer circle, middle circle and inner circle color can be set from props.\n */\nexport const ThreeCircles: FunctionComponent<ThreeCirclesProps> = ({\n wrapperStyle = {},\n visible = true,\n wrapperClass = '',\n height = 100,\n width = 100,\n color = DEFAULT_COLOR,\n ariaLabel = 'three-circles-loading',\n outerCircleColor,\n innerCircleColor,\n middleCircleColor,\n}) => {\n return (\n <SvgWrapper\n style={wrapperStyle}\n $visible={visible}\n className={wrapperClass}\n data-testid=\"three-circles-wrapper\"\n aria-label={ariaLabel}\n {...DEFAULT_WAI_ARIA_ATTRIBUTE}\n >\n <svg\n version=\"1.1\"\n height={`${height}`}\n width={`${width}`}\n xmlns={SVG_NAMESPACE}\n viewBox=\"0 0 100 100\"\n enableBackground=\"new 0 0 100 100\"\n xmlSpace=\"preserve\"\n data-testid=\"three-circles-svg\"\n >\n <path\n fill={outerCircleColor || color} /** outer circle */\n d=\"M31.6,3.5C5.9,13.6-6.6,42.7,3.5,68.4c10.1,25.7,39.2,38.3,64.9,28.1l-3.1-7.9c-21.3,8.4-45.4-2-53.8-23.3\n c-8.4-21.3,2-45.4,23.3-53.8L31.6,3.5z\"\n >\n <animateTransform\n attributeName=\"transform\"\n attributeType=\"XML\"\n type=\"rotate\"\n dur=\"2s\"\n from=\"0 50 50\"\n to=\"360 50 50\"\n repeatCount=\"indefinite\"\n />\n </path>\n <path\n fill={middleCircleColor || color} /** Middle circle */\n d=\"M42.3,39.6c5.7-4.3,13.9-3.1,18.1,2.7c4.3,5.7,3.1,13.9-2.7,18.1l4.1,5.5c8.8-6.5,10.6-19,4.1-27.7\n c-6.5-8.8-19-10.6-27.7-4.1L42.3,39.6z\"\n >\n <animateTransform\n attributeName=\"transform\"\n attributeType=\"XML\"\n type=\"rotate\"\n dur=\"1s\"\n from=\"0 50 50\"\n to=\"-360 50 50\"\n repeatCount=\"indefinite\"\n />\n </path>\n <path\n fill={innerCircleColor || color} /** Inner circle */\n d=\"M82,35.7C74.1,18,53.4,10.1,35.7,18S10.1,46.6,18,64.3l7.6-3.4c-6-13.5,0-29.3,13.5-35.3s29.3,0,35.3,13.5\n L82,35.7z\"\n >\n <animateTransform\n attributeName=\"transform\"\n attributeType=\"XML\"\n type=\"rotate\"\n dur=\"2s\"\n from=\"0 50 50\"\n to=\"360 50 50\"\n repeatCount=\"indefinite\"\n />\n </path>\n </svg>\n </SvgWrapper>\n )\n}\n"]}