{"version":3,"file":"WithScrollAnimation.CBv1PRea.mjs","names":["React","Children"],"sources":["https:/framerusercontent.com/modules/kBRzSVkLZYPMlmMJCX3U/ZqJLVt5DeCIScGEyoVVE/ColumnProgress.js","https:/framerusercontent.com/modules/8KHQKHgsnbCa9ySjuuJX/f5FhTLwvbmfVLrExvy3t/WithScrollAnimation.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion}from\"framer-motion\";const lerpRange=(x1,x2,y1,y2,x)=>(x-x1)*(y2-y1)/(x2-x1)+y1;const clamp=(val,min=0,max=100)=>Math.min(Math.max(val,min),max);/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function ColumnProgress(props){const{scrollValue,ID_number,max_items,variant}=props;const progressHeight=lerpRange((ID_number-1)/max_items,ID_number/max_items,0,100,scrollValue);const palette={light:{col:\"rgba(0,0,0,.06)\",prog:\"black\"},dark:{col:\"rgba(240,240,240,.1)\",prog:\"#fff\"}};const styles={col:{width:6,height:28,background:palette[variant].col,borderRadius:8},prog:{height:clamp(progressHeight)+\"%\",background:palette[variant].prog,borderRadius:8}};return /*#__PURE__*/_jsx(\"div\",{style:styles.col,children:/*#__PURE__*/_jsx(motion.div,{style:styles.prog})});}addPropertyControls(ColumnProgress,{ID_number:{type:ControlType.Number,defaultValue:1,min:1,max:100,step:1,displayStepper:true},max_items:{type:ControlType.Number,defaultValue:3,min:1,max:100,step:1,displayStepper:true},variant:{type:ControlType.Enum,defaultValue:\"light\",options:[\"light\",\"dark\"]}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ColumnProgress\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ColumnProgress.map","// Example: https://tppr.me/RaQl6A\nimport{jsx as _jsx}from\"react/jsx-runtime\";import React,{Children,cloneElement}from\"react\";import{forwardRef}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{AnimatePresence,useMotionValueEvent,useScroll}from\"framer-motion\";// store\nconst useStore=createStore({scrollValue:0});// ==============================================\n// withScrollWrapper\nexport function withScrollWrapper(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const target=React.useRef(null);const[,setStore]=useStore();const{scrollYProgress}=useScroll({target,offset:[\"start 50%\",\"end 50%\"]});useMotionValueEvent(scrollYProgress,\"change\",scrollValue=>{setStore({scrollValue});});return /*#__PURE__*/_jsx(Component,{ref:target,...props});});}// ==============================================\n// withScrollValue\nexport function withScrollValue(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store]=useStore();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,scrollValue:store.scrollValue});});}// ==============================================\n// withScrollAnimation\nfunction getActiveIndexBasedOnPosition(pos=0,maxItems=4){const array=[...Array(maxItems).keys()].map(k=>k*(1/maxItems));return array.findIndex(r=>r>=pos-1/maxItems-.001);}function transition(delay=0){return{duration:.4,delay,ease:[.33,1,.68,1]};}export function withScrollAnimation(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store]=useStore();const{children,...rest}=props;const offset=25;const animProps={initial:{opacity:0,y:offset,transition:transition()},animate:{opacity:1,y:0,transition:transition(.1)},exit:{opacity:0,y:-offset,transition:transition()}};const countChildren=Children.count(children);return /*#__PURE__*/_jsx(Component,{ref:ref,...rest,children:/*#__PURE__*/_jsx(AnimatePresence,{initial:false,children:Children.map(children,(child,idx)=>{if(getActiveIndexBasedOnPosition(store.scrollValue,countChildren)!==idx)return null;return /*#__PURE__*/cloneElement(child,{...animProps});})})});});}// ==============================================\n// withSlideText\nexport function withSlideText(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store]=useStore();const name=props[\"data-framer-name\"]??\"\";const[id=1,max=1]=name.split(\"_\").slice(1).map(r=>+r);const isOpen=getActiveIndexBasedOnPosition(store.scrollValue,max)+1===id;return /*#__PURE__*/_jsx(AnimatePresence,{initial:false,children:isOpen&&/*#__PURE__*/_jsx(Component,{initial:{height:0,opacity:0},animate:{height:\"auto\",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3,ease:\"easeOut\"},...props})});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withScrollValue\":{\"type\":\"reactHoc\",\"name\":\"withScrollValue\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSlideText\":{\"type\":\"reactHoc\",\"name\":\"withSlideText\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withScrollWrapper\":{\"type\":\"reactHoc\",\"name\":\"withScrollWrapper\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withScrollAnimation\":{\"type\":\"reactHoc\",\"name\":\"withScrollAnimation\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WithScrollAnimation.map"],"mappings":"wTAGG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,cAAY,YAAU,YAAU,WAAS,EAAY,EAAe,GAAW,EAAU,GAAG,EAAU,EAAU,EAAU,EAAE,IAAI,EAAY,CAAO,EAAQ,CAAC,MAAM,CAAC,IAAI,kBAAkB,KAAK,QAAQ,CAAC,KAAK,CAAC,IAAI,uBAAuB,KAAK,OAAO,CAAC,CAAO,EAAO,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,WAAW,EAAQ,GAAS,IAAI,aAAa,EAAE,CAAC,KAAK,CAAC,OAAO,EAAM,EAAe,CAAC,IAAI,WAAW,EAAQ,GAAS,KAAK,aAAa,EAAE,CAAC,CAAC,OAAoB,EAAK,MAAM,CAAC,MAAM,EAAO,IAAI,SAAsB,EAAK,EAAO,IAAI,CAAC,MAAM,EAAO,KAAK,CAAC,CAAC,CAAC,sBAH7hB,IAAoD,IAAkC,CAAM,GAAW,EAAG,EAAG,EAAG,EAAG,KAAK,E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