{"version":3,"file":"HorizontalScroll.CAmX47o7.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/89cSFglclNracpvIBq8W/PfOOebVVwxtfLObxj7Fh/HorizontalScroll.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useRef,useState,useLayoutEffect}from\"react\";import{motion,useTransform,useScroll}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function HorizontalScroll(props){const{items,backgroundColor}=props;const targetRef=useRef(null);const contentRef=useRef(null);const[offset,setOffset]=useState(0);const{scrollYProgress}=useScroll({target:targetRef});useLayoutEffect(()=>{if(!contentRef.current||!window)return;const contentWidth=contentRef.current.scrollWidth;const viewportWidth=window.innerWidth;const distance=contentWidth-viewportWidth;setOffset(-distance);},[items]);const x=useTransform(scrollYProgress,[0,1],[\"0px\",`${offset}px`]);return /*#__PURE__*/_jsx(\"section\",{ref:targetRef,style:{height:\"100%\",backgroundColor},children:/*#__PURE__*/_jsx(\"div\",{style:{position:\"sticky\",top:0,left:0,right:0,display:\"flex\",height:\"100vh\",alignItems:\"center\",overflow:\"hidden\"},children:/*#__PURE__*/_jsx(motion.div,{ref:contentRef,style:{x,display:\"flex\"},children:items.map((item,index)=>/*#__PURE__*/_jsx(\"div\",{style:{flexShrink:0,height:\"100vh\"},children:item},index))})})});}HorizontalScroll.displayName=\"Horizontal Scroll\";addPropertyControls(HorizontalScroll,{items:{type:ControlType.Array,control:{type:ControlType.ComponentInstance}},backgroundColor:{type:ControlType.Color,title:\"Background Color\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HorizontalScroll\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HorizontalScroll.map"],"m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