{"version":3,"file":"ProgressAnimation.Dkmfuxn3.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/e3hiEP0bXDolxTMyoad0/PvUnZwPoxl7GbZOk6tj8/ProgressAnimation.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function ProgressAnimation(props){const{backgroundColor,progressColor,timeAnimation,orientation,borderRadius,isPlaying,loop,autoStart}=props;const[progress,setProgress]=useState(0);const intervalRef=useRef(null);useEffect(()=>{// Auto-start si activé\nif(autoStart&&progress===0){startAnimation();}},[]);useEffect(()=>{if(isPlaying){startAnimation();}else{pauseAndReset();}return()=>{if(intervalRef.current){clearInterval(intervalRef.current);}};},[isPlaying,timeAnimation,loop]);const startAnimation=()=>{if(intervalRef.current){clearInterval(intervalRef.current);}intervalRef.current=setInterval(()=>{setProgress(prevProgress=>{if(prevProgress>=100){if(loop){return 0// Recommence si loop activé\n;}else{clearInterval(intervalRef.current);return 100// Arrête à 100 si pas de loop\n;}}return prevProgress+1;});},timeAnimation);};const pauseAndReset=()=>{if(intervalRef.current){clearInterval(intervalRef.current);intervalRef.current=null;}setProgress(0)// Reset la progression à 0 quand on met en pause\n;};const isHorizontal=orientation===\"horizontal\";const styles={container:{width:\"100%\",height:\"100%\",position:\"relative\",overflow:\"hidden\",borderRadius:`${borderRadius}px`},background:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",background:backgroundColor,borderRadius:`${borderRadius}px`},progress:{position:\"absolute\",top:0,left:0,width:isHorizontal?`${progress}%`:\"100%\",height:isHorizontal?\"100%\":`${progress}%`,background:progressColor,transition:`all ${timeAnimation}ms linear`,borderRadius:`${borderRadius}px`}};return /*#__PURE__*/_jsxs(\"div\",{style:styles.container,children:[/*#__PURE__*/_jsx(\"div\",{style:styles.background}),/*#__PURE__*/_jsx(\"div\",{style:styles.progress})]});}addPropertyControls(ProgressAnimation,{backgroundColor:{title:\"Background Color\",type:ControlType.Color,defaultValue:\"rgba(255, 222, 198, 1)\"},progressColor:{title:\"Progress Color\",type:ControlType.Color,defaultValue:\"rgba(255, 122, 0, 1)\"},timeAnimation:{title:\"Animation Time (ms)\",type:ControlType.Number,defaultValue:90,min:10,max:1e3,step:10},orientation:{title:\"Orientation\",type:ControlType.Enum,options:[\"horizontal\",\"vertical\"],optionTitles:[\"Horizontal\",\"Vertical\"],defaultValue:\"vertical\"},borderRadius:{title:\"Border Radius\",type:ControlType.Number,defaultValue:0,min:0,max:50,step:1},isPlaying:{title:\"Play / Pause\",type:ControlType.Boolean,defaultValue:true,enabledTitle:\"Play\",disabledTitle:\"Pause\"},loop:{title:\"Loop\",type:ControlType.Boolean,defaultValue:true},autoStart:{title:\"Auto Start\",type:ControlType.Boolean,defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ProgressAnimation\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProgressAnimation.map"],"mappings":"gMAA0J,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,kBAAgB,gBAAc,gBAAc,cAAY,eAAa,YAAU,OAAK,aAAW,EAAW,CAAC,EAAS,GAAaA,EAAS,EAAE,CAAO,EAAYC,EAAO,KAAK,CAAC,MAAc,CACxY,GAAW,IAAW,GAAG,GAAgB,EAAI,EAAE,CAAC,CAAC,OAAkB,EAAW,GAAgB,CAAO,GAAe,KAAY,CAAI,EAAY,SAAS,cAAc,EAAY,QAAQ,GAAM,CAAC,EAAU,EAAc,EAAK,CAAC,CAAC,IAAM,MAAmB,CAAI,EAAY,SAAS,cAAc,EAAY,QAAQ,CAAE,EAAY,QAAQ,gBAAgB,CAAC,EAAY,GAAkB,GAAc,IAAQ,EAAa,GACzZ,cAAc,EAAY,QAAQ,CAAQ,KACvC,EAAa,EAAI,EAAG,EAAc,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