{"version":3,"file":"ProgressBar.C43rerCP.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/XsmZYAJXZbE43qzn6EE3/73Q19K7Hu9qtKj6i7gWE/ProgressBar.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Progress Bar\n * \n * @framerIntrinsicWidth 400\n * @framerIntrinsicHeight 20\n * \n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function ProgressBar(props){const{duration=5,startColor=\"#0099FF\",endColor=\"#8855FF\",useGradient=true,direction=\"horizontal\",autoStart=true,backgroundColor=\"#EEEEEE\",borderRadius=10}=props;const[progress,setProgress]=useState(0);const[isRunning,setIsRunning]=useState(autoStart);useEffect(()=>{if(!isRunning)return;const startTime=Date.now();const durationMs=duration*1e3;const animate=()=>{const elapsed=Date.now()-startTime;const newProgress=Math.min(elapsed/durationMs*100,100);startTransition(()=>setProgress(newProgress));if(newProgress<100){requestAnimationFrame(animate);}else{startTransition(()=>setIsRunning(false));}};const animationFrame=requestAnimationFrame(animate);return()=>cancelAnimationFrame(animationFrame);},[duration,isRunning]);const handleClick=()=>{startTransition(()=>{setProgress(0);setIsRunning(true);});};const isHorizontal=direction===\"horizontal\";const barBackground=useGradient?isHorizontal?`linear-gradient(to right, ${startColor}, ${endColor})`:`linear-gradient(to bottom, ${startColor}, ${endColor})`:startColor;return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",position:\"relative\",backgroundColor,borderRadius,overflow:\"hidden\",cursor:\"pointer\"},onClick:handleClick,role:\"progressbar\",\"aria-valuenow\":Math.round(progress),\"aria-valuemin\":0,\"aria-valuemax\":100,children:/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,width:isHorizontal?`${progress}%`:\"100%\",height:isHorizontal?\"100%\":`${progress}%`,background:barBackground,transition:\"none\",borderRadius}})});}addPropertyControls(ProgressBar,{duration:{type:ControlType.Number,title:\"Duration\",defaultValue:5,min:.5,max:60,step:.5,unit:\"s\"},useGradient:{type:ControlType.Boolean,title:\"Gradient\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},startColor:{type:ControlType.Color,title:\"Start Color\",defaultValue:\"#0099FF\"},endColor:{type:ControlType.Color,title:\"End Color\",defaultValue:\"#8855FF\",hidden:({useGradient})=>!useGradient},direction:{type:ControlType.Enum,title:\"Direction\",options:[\"horizontal\",\"vertical\"],optionTitles:[\"Horizontal\",\"Vertical\"],defaultValue:\"horizontal\",displaySegmentedControl:true},autoStart:{type:ControlType.Boolean,title:\"Auto Start\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#EEEEEE\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:10,min:0,max:50,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ProgressBar\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"400\",\"framerIntrinsicHeight\":\"20\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProgressBar.map"],"mappings":"wLAQG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,WAAS,EAAE,aAAW,UAAU,WAAS,UAAU,cAAY,GAAK,YAAU,aAAa,YAAU,GAAK,kBAAgB,UAAU,eAAa,IAAI,EAAW,CAAC,EAAS,GAAaA,EAAS,CAAC,EAAO,CAAC,EAAU,GAAcA,EAAS,CAAS,EAAE,MAAc,CAAC,GAAG,CAAC,EAAU,OAAO,IAAM,EAAU,KAAK,IAAI,EAAQ,EAAW,EAAS,IAAU,MAAY,CAAC,IAAM,EAAQ,KAAK,I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