UNPKG

@cgi-learning-hub/ui

Version:

@cgi-learning-hub/ui is an open-source React component library that implements UI for HUB's features

29 lines (25 loc) 4.67 kB
"use strict";const $=require("react"),t=require("./index-DLnSn8GT.cjs"),a=require("./identifier-BoZelETM.cjs"),S=require("./memoTheme-BKfsJx_F.cjs"),M=require("./createSimplePaletteValueFilter-PTK3TAhW.cjs"),h=require("react/jsx-runtime"),n=require("./DefaultPropsProvider-Cnf49AIv.cjs"),q=require("./chainPropTypes-CEUi6Jb4.cjs"),p=require("@emotion/react");function R(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(r,s,i.get?i:{enumerable:!0,get:()=>e[s]})}}return r.default=e,Object.freeze(r)}const N=R($);function x(e){return a.generateUtilityClass("MuiCircularProgress",e)}const z=a.generateUtilityClasses("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]),o=44,g=p.keyframes` 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } `,v=p.keyframes` 0% { stroke-dasharray: 1px, 200px; stroke-dashoffset: 0; } 50% { stroke-dasharray: 100px, 200px; stroke-dashoffset: -15px; } 100% { stroke-dasharray: 1px, 200px; stroke-dashoffset: -126px; } `,U=typeof g!="string"?p.css` animation: ${g} 1.4s linear infinite; `:null,E=typeof v!="string"?p.css` animation: ${v} 1.4s ease-in-out infinite; `:null,F=e=>{const{classes:r,variant:s,color:i,disableShrink:u}=e,y={root:["root",s,`color${a.capitalize(i)}`],svg:["svg"],circle:["circle",`circle${a.capitalize(s)}`,u&&"circleDisableShrink"]};return n.composeClasses(y,x,r)},I=n.styled("span",{name:"MuiCircularProgress",slot:"Root",overridesResolver:(e,r)=>{const{ownerState:s}=e;return[r.root,r[s.variant],r[`color${a.capitalize(s.color)}`]]}})(S.memoTheme(({theme:e})=>({display:"inline-block",variants:[{props:{variant:"determinate"},style:{transition:e.transitions.create("transform")}},{props:{variant:"indeterminate"},style:U||{animation:`${g} 1.4s linear infinite`}},...Object.entries(e.palette).filter(M.createSimplePaletteValueFilter()).map(([r])=>({props:{color:r},style:{color:(e.vars||e).palette[r].main}}))]}))),V=n.styled("svg",{name:"MuiCircularProgress",slot:"Svg"})({display:"block"}),_=n.styled("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(e,r)=>{const{ownerState:s}=e;return[r.circle,r[`circle${a.capitalize(s.variant)}`],s.disableShrink&&r.circleDisableShrink]}})(S.memoTheme(({theme:e})=>({stroke:"currentColor",variants:[{props:{variant:"determinate"},style:{transition:e.transitions.create("stroke-dashoffset")}},{props:{variant:"indeterminate"},style:{strokeDasharray:"80px, 200px",strokeDashoffset:0}},{props:({ownerState:r})=>r.variant==="indeterminate"&&!r.disableShrink,style:E||{animation:`${v} 1.4s ease-in-out infinite`}}]}))),w=N.forwardRef(function(r,s){const i=n.useDefaultProps({props:r,name:"MuiCircularProgress"}),{className:u,color:y="primary",disableShrink:D=!1,size:d=40,style:O,thickness:c=3.6,value:f=0,variant:T="indeterminate",...j}=i,l={...i,color:y,disableShrink:D,size:d,thickness:c,value:f,variant:T},m=F(l),P={},k={},b={};if(T==="determinate"){const C=2*Math.PI*((o-c)/2);P.strokeDasharray=C.toFixed(3),b["aria-valuenow"]=Math.round(f),P.strokeDashoffset=`${((100-f)/100*C).toFixed(3)}px`,k.transform="rotate(-90deg)"}return h.jsx(I,{className:a.clsx(m.root,u),style:{width:d,height:d,...k,...O},ownerState:l,ref:s,role:"progressbar",...b,...j,children:h.jsx(V,{className:m.svg,ownerState:l,viewBox:`${o/2} ${o/2} ${o} ${o}`,children:h.jsx(_,{className:m.circle,style:P,ownerState:l,cx:o,cy:o,r:(o-c)/2,fill:"none",strokeWidth:c})})})});process.env.NODE_ENV!=="production"&&(w.propTypes={classes:t.PropTypes.object,className:t.PropTypes.string,color:t.PropTypes.oneOfType([t.PropTypes.oneOf(["inherit","primary","secondary","error","info","success","warning"]),t.PropTypes.string]),disableShrink:q.chainPropTypes(t.PropTypes.bool,e=>e.disableShrink&&e.variant&&e.variant!=="indeterminate"?new Error("MUI: You have provided the `disableShrink` prop with a variant other than `indeterminate`. This will have no effect."):null),size:t.PropTypes.oneOfType([t.PropTypes.number,t.PropTypes.string]),style:t.PropTypes.object,sx:t.PropTypes.oneOfType([t.PropTypes.arrayOf(t.PropTypes.oneOfType([t.PropTypes.func,t.PropTypes.object,t.PropTypes.bool])),t.PropTypes.func,t.PropTypes.object]),thickness:t.PropTypes.number,value:t.PropTypes.number,variant:t.PropTypes.oneOf(["determinate","indeterminate"])});exports.CircularProgress=w;exports.circularProgressClasses=z;exports.getCircularProgressUtilityClass=x;