packageDocumentation module import classnames from "classnames" ; import * as React from "react" ; import { CommonProps } from "../utils/Props" ; import { Icon } from "../icons/IconComponent" ; import { SpinnerSize } from "../loading/Spinner" ; beta deprecated export interface ProgressSpinnerProps extends CommonProps { default value ? : number ; default indeterminate ? : boolean ; default success ? : boolean ; default error ? : boolean ; default size ? : SpinnerSize ; /**
     * Child components
     */ children ? : React . ReactNode ; } beta deprecated export function ProgressSpinner ( props ) { const { value = 0 , indeterminate = false , success = false , error = false , style = { } , size , children , } = props ; let outerClassName = classnames ( "uicore-progress-spinner" ) ; const outerStyle = { ... style } ; const fillStyle = { } ; const dashOffset = 100 - Math . min ( Math . max ( value , 0 ) , 100 ) ; let content ; if ( error ) { outerClassName = classnames ( outerClassName , "error" ) ; content = < Icon iconSpec = "icon-close-2" / > ; } else if ( success ) { outerClassName = classnames ( outerClassName , "success" ) ; content = ( < Icon iconSpec = "icon-checkmark" / > ) ; } else if ( indeterminate ) { outerClassName = classnames ( outerClassName , "indeterminate" ) ; content = children ; } else { outerClassName = classnames ( outerClassName , "determinate" ) ; fillStyle . strokeDashoffset = dashOffset ; content = children ; } setDefaultDimensions ( outerStyle , size ) ; return ( < div className = { outerClassName } style = { outerStyle } > < svg className = "spinner" viewBox = "0 0 40 40" > < circle className = "shape" cx = "20" cy = "20" r = "15.91549" / > < circle className = "fill" cx = "20" cy = "20" r = "15.91549" style = { fillStyle } / > < /svg> { content && < span className = "uicore-progress-spinner-content" > { content } < /span>} < /div>); } const setDefaultDimensions = ( style , inSize ? ) => { let size = 40 ; if ( inSize !== undefined ) { switch ( inSize ) { case SpinnerSize . Small : size = 16 ; break ; case SpinnerSize . Medium : size = 32 ; break ; case SpinnerSize . Large : size = 64 ; break ; case SpinnerSize . XLarge : size = 96 ; break ; } } style . width = style . width ? style . width : size ; style . height = style . height ? style . height : size ; } ;