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 7.12 kB
{"version":3,"sources":["../src/type.ts","../src/shared/svg-wrapper.tsx","../src/shared/constants.ts","../src/loader/line-wave.tsx"],"names":["DEFAULT_COLOR","DEFAULT_WAI_ARIA_ATTRIBUTE","SvgWrapper","styled","props","SVG_NAMESPACE","LineWave","wrapperStyle","visible","wrapperClass","height","width","color","ariaLabel","firstLineColor","middleLineColor","lastLineColor","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,CCgDtB,IAAMC,EAA6C,CAAC,CACzD,aAAAC,CAAAA,CAAe,GACf,OAAA,CAAAC,CAAAA,CAAU,KACV,YAAA,CAAAC,CAAAA,CAAe,EAAA,CACf,MAAA,CAAAC,EAAS,GAAA,CACT,KAAA,CAAAC,EAAQ,GAAA,CACR,KAAA,CAAAC,EAAQZ,CAAAA,CACR,SAAA,CAAAa,EAAY,mBAAA,CACZ,cAAA,CAAAC,EACA,eAAA,CAAAC,CAAAA,CACA,cAAAC,CACF,CAAA,GAEIC,eAACf,CAAAA,CAAA,CACC,KAAA,CAAOK,CAAAA,CACP,SAAUC,CAAAA,CACV,SAAA,CAAWC,EACX,aAAA,CAAY,mBAAA,CACZ,aAAYI,CAAAA,CACX,GAAGZ,EAEJ,QAAA,CAAAiB,eAAAA,CAAC,OACC,OAAA,CAAQ,KAAA,CACR,OAAQ,CAAA,EAAGR,CAAM,GACjB,KAAA,CAAO,CAAA,EAAGC,CAAK,CAAA,CAAA,CACf,MAAON,CAAAA,CACP,CAAA,CAAE,MACF,CAAA,CAAE,KAAA,CACF,QAAQ,aAAA,CACR,gBAAA,CAAiB,cACjB,QAAA,CAAS,UAAA,CACT,cAAY,eAAA,CAEZ,QAAA,CAAA,CAAAY,eAAC,MAAA,CAAA,CACC,CAAA,CAAE,KACF,CAAA,CAAE,IAAA,CACF,KAAA,CAAM,GAAA,CACN,OAAO,IAAA,CACP,IAAA,CAAMH,GAAkBF,CAAAA,CAExB,QAAA,CAAAK,eAAC,kBAAA,CAAA,CACC,aAAA,CAAc,MACd,aAAA,CAAc,WAAA,CACd,KAAK,WAAA,CACL,MAAA,CAAO,iBACP,KAAA,CAAM,GAAA,CACN,IAAI,MAAA,CACJ,WAAA,CAAY,YAAA,CACd,CAAA,CACF,EAEAA,cAAAA,CAAC,MAAA,CAAA,CACC,EAAE,IAAA,CACF,CAAA,CAAE,KACF,KAAA,CAAM,GAAA,CACN,OAAO,IAAA,CACP,IAAA,CAAMF,GAAmBH,CAAAA,CAEzB,QAAA,CAAAK,eAAC,kBAAA,CAAA,CACC,aAAA,CAAc,MACd,aAAA,CAAc,WAAA,CACd,IAAA,CAAK,WAAA,CACL,OAAO,gBAAA,CACP,KAAA,CAAM,OACN,GAAA,CAAI,MAAA,CACJ,YAAY,YAAA,CACd,CAAA,CACF,EAEAA,cAAAA,CAAC,MAAA,CAAA,CACC,EAAE,IAAA,CACF,CAAA,CAAE,KACF,KAAA,CAAM,GAAA,CACN,OAAO,IAAA,CACP,IAAA,CAAMD,CAAAA,EAAiBJ,CAAAA,CAEvB,SAAAK,cAAAA,CAAC,kBAAA,CAAA,CACC,cAAc,KAAA,CACd,aAAA,CAAc,YACd,IAAA,CAAK,WAAA,CACL,OAAO,gBAAA,CACP,KAAA,CAAM,OACN,GAAA,CAAI,MAAA,CACJ,YAAY,YAAA,CACd,CAAA,CACF,GACF,CAAA,CACF","file":"line-wave.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 LineWave loader component.\n * \n * The LineWave loader displays animated lines creating a wave effect.\n * \n * @interface LineWaveProps\n */\ninterface LineWaveProps {\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 first line in the wave. Overrides default color. */\n firstLineColor?: string\n /** Color of the middle line in the wave. Overrides default color. */\n middleLineColor?: string\n /** Color of the last line in the wave. Overrides default color. */\n lastLineColor?: 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\n/**\n * @description contains three lines in a wave motion\n * line colors are changeable\n */\nexport const LineWave: FunctionComponent<LineWaveProps> = ({\n wrapperStyle = {},\n visible = true,\n wrapperClass = '',\n height = 100,\n width = 100,\n color = DEFAULT_COLOR,\n ariaLabel = 'line-wave-loading',\n firstLineColor,\n middleLineColor,\n lastLineColor,\n}) => {\n return (\n <SvgWrapper\n style={wrapperStyle}\n $visible={visible}\n className={wrapperClass}\n data-testid=\"line-wave-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 x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 100 100\"\n enableBackground=\"new 0 0 0 0\"\n xmlSpace=\"preserve\"\n data-testid=\"line-wave-svg\"\n >\n <rect\n x=\"20\"\n y=\"50\"\n width=\"4\"\n height=\"10\"\n fill={firstLineColor || color} /** First bar */\n >\n <animateTransform\n attributeType=\"xml\"\n attributeName=\"transform\"\n type=\"translate\"\n values=\"0 0; 0 20; 0 0\"\n begin=\"0\"\n dur=\"0.6s\"\n repeatCount=\"indefinite\"\n />\n </rect>\n\n <rect\n x=\"30\"\n y=\"50\"\n width=\"4\"\n height=\"10\"\n fill={middleLineColor || color}\n >\n <animateTransform\n attributeType=\"xml\"\n attributeName=\"transform\"\n type=\"translate\"\n values=\"0 0; 0 20; 0 0\"\n begin=\"0.2s\"\n dur=\"0.6s\"\n repeatCount=\"indefinite\"\n />\n </rect>\n\n <rect\n x=\"40\"\n y=\"50\"\n width=\"4\"\n height=\"10\"\n fill={lastLineColor || color} /** last bar */\n >\n <animateTransform\n attributeType=\"xml\"\n attributeName=\"transform\"\n type=\"translate\"\n values=\"0 0; 0 20; 0 0\"\n begin=\"0.4s\"\n dur=\"0.6s\"\n repeatCount=\"indefinite\"\n />\n </rect>\n </svg>\n </SvgWrapper>\n )\n}\n"]}