{"version":3,"file":"SmoothProgressBar.DDjb4JDP.mjs","names":["React.useRef","React.useMemo"],"sources":["https:/framerusercontent.com/modules/aOcGknbMRs6eOOXjac7P/gdifL86qbhv0aJHNKXnO/SmoothProgressBar.js"],"sourcesContent":["// User instructions: Create an animated continuous smooth progress bar. The bar fill is the layer Frame. Allow selecting the duration and effect settings variables. Add a variable for on/off. The bar component should have a Fill height to its parent and respect the parent's height exactly. Add variables to choose orientation (Horizontal & Vertical) and direction of the fill (Left or Right for horizontal, Top or Bottom for vertical).\nimport{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView,useReducedMotion}from\"framer-motion\";/**\n * Smooth Progress Bar\n *\n * @framerIntrinsicWidth 320\n * @framerIntrinsicHeight 8\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function SmoothProgressBar(props){const{style,enabled,duration,effect,motionTransition,trackColor,fillColor,shimmerColor,radius,orientation,horizontalDirection,verticalDirection}=props;const isStatic=useIsStaticRenderer();const reducedMotion=useReducedMotion();const rootRef=React.useRef(null);const inView=useInView(rootRef,{amount:.2});const safeDuration=React.useMemo(()=>{const n=typeof duration===\"number\"&&Number.isFinite(duration)?duration:1.6;return Math.max(.1,Math.min(60,n));},[duration]);const shouldAnimate=enabled&&!isStatic&&!reducedMotion&&inView;const isHorizontal=orientation===\"horizontal\";const fillBackground=React.useMemo(()=>{if(effect===\"shimmer\"){const gradientDirection=isHorizontal?\"90deg\":\"180deg\";return`linear-gradient(${gradientDirection}, ${fillColor} 0%, ${shimmerColor} 50%, ${fillColor} 100%)`;}return fillColor;},[effect,fillColor,shimmerColor,isHorizontal]);const transition=React.useMemo(()=>{const base=motionTransition&&typeof motionTransition===\"object\"?motionTransition:{};return{...base,duration:safeDuration,repeat:Infinity,repeatType:\"loop\"};},[motionTransition,safeDuration]);const rootStyle={position:\"relative\",overflow:\"hidden\",borderRadius:radius,background:trackColor,width:\"100%\",height:\"100%\",...style};// Determine transform origin and scale property based on orientation and direction\nconst{transformOrigin,scaleProperty}=React.useMemo(()=>{if(isHorizontal){if(horizontalDirection===\"left\"){return{transformOrigin:\"left center\",scaleProperty:\"scaleX\"};}else{return{transformOrigin:\"right center\",scaleProperty:\"scaleX\"};}}else{if(verticalDirection===\"top\"){return{transformOrigin:\"center top\",scaleProperty:\"scaleY\"};}else{return{transformOrigin:\"center bottom\",scaleProperty:\"scaleY\"};}}},[isHorizontal,horizontalDirection,verticalDirection]);const fillStyle={position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",borderRadius:radius,transformOrigin,background:fillBackground,backgroundSize:effect===\"shimmer\"?isHorizontal?\"200% 100%\":\"100% 200%\":undefined,willChange:shouldAnimate?\"transform, background-position\":undefined};// A useful static preview value (and when disabled, show empty).\nconst staticValue=enabled?.65:0;const backgroundPositionProperty=isHorizontal?\"backgroundPositionX\":\"backgroundPositionY\";return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,style:rootStyle,role:\"progressbar\",\"aria-label\":\"Progress\",\"aria-valuemin\":0,\"aria-valuemax\":100,\"aria-valuenow\":shouldAnimate?undefined:Math.round(staticValue*100),\"aria-valuetext\":enabled?shouldAnimate?\"Progressing\":\"Preview\":\"Off\",children:/*#__PURE__*/_jsx(motion.div,{style:fillStyle,initial:{[scaleProperty]:shouldAnimate?0:staticValue,[backgroundPositionProperty]:\"0%\"},animate:shouldAnimate?{[scaleProperty]:[0,1],[backgroundPositionProperty]:effect===\"shimmer\"?[\"0%\",\"200%\"]:undefined}:{[scaleProperty]:staticValue,[backgroundPositionProperty]:\"0%\"},transition:shouldAnimate?transition:undefined})});}addPropertyControls(SmoothProgressBar,{enabled:{type:ControlType.Boolean,title:\"On\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},orientation:{type:ControlType.Enum,title:\"Orientation\",options:[\"horizontal\",\"vertical\"],optionTitles:[\"Horizontal\",\"Vertical\"],defaultValue:\"horizontal\",displaySegmentedControl:true},horizontalDirection:{type:ControlType.Enum,title:\"Direction\",options:[\"left\",\"right\"],optionTitles:[\"Left\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true,hidden:({orientation})=>orientation!==\"horizontal\"},verticalDirection:{type:ControlType.Enum,title:\"Direction\",options:[\"top\",\"bottom\"],optionTitles:[\"Top\",\"Bottom\"],defaultValue:\"top\",displaySegmentedControl:true,hidden:({orientation})=>orientation!==\"vertical\"},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:1.6,min:.1,max:60,step:.05,unit:\"s\"},effect:{type:ControlType.Enum,title:\"Effect\",options:[\"solid\",\"shimmer\"],optionTitles:[\"Solid\",\"Shimmer\"],defaultValue:\"solid\",displaySegmentedControl:true},motionTransition:{type:ControlType.Transition,title:\"Motion\",defaultValue:{type:\"tween\",ease:\"easeInOut\"}},radius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"999px\"},trackColor:{type:ControlType.Color,title:\"Track\",defaultValue:\"#EEEEEE\"},fillColor:{type:ControlType.Color,title:\"Fill\",defaultValue:\"#000000\"},shimmerColor:{type:ControlType.Color,title:\"Shimmer\",defaultValue:\"#CCCCCC\",hidden:({effect})=>effect!==\"shimmer\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SmoothProgressBar\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"8\",\"framerIntrinsicWidth\":\"320\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SmoothProgressBar.map"],"mappings":"wPASG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,QAAM,UAAQ,WAAS,SAAO,mBAAiB,aAAW,YAAU,eAAa,SAAO,cAAY,sBAAoB,qBAAmB,EAAY,EAAS,EAAoB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