{"version":3,"file":"HorizontalScroll.CObXf0OF.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/W5bVGd7Xkzj5pdlHdVI1/1bpMLdw1m6vtxQeNnqo9/HorizontalScroll.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useLayoutEffect,useRef,useState}from\"react\";import{motion,useScroll,useSpring,useTransform}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n *\n * @framerIntrinsicWidth 800\n * @framerIntrinsicHeight 400\n *\n * @framerDisableUnlink\n */export default function HorizontalScroller(props){const hasLinkedFrame=!!props.children[0];const containerRef=useRef(null);const scrollRef=useRef(null);const sizerRef=useRef(null);const[scrollRange,setScrollRange]=useState(0);const[contentWidth,setContentWidth]=useState(0);useLayoutEffect(()=>{setScrollRange(scrollRef.current.scrollWidth);const onResize=entries=>{for(let entry of entries){setContentWidth(entry.contentRect.width);setScrollRange(scrollRef.current.scrollWidth);}};const onStyleChange=entries=>{for(let entry of entries){setScrollRange(scrollRef.current.scrollWidth);}};const resizeObserver=new ResizeObserver(onResize);resizeObserver.observe(sizerRef.current);const mutationObserver=new MutationObserver(onStyleChange);mutationObserver.observe(scrollRef.current,{attributes:true,attributeFilter:[\"style\"]});return()=>{resizeObserver.disconnect();mutationObserver.disconnect();};},[]);const{scrollYProgress}=useScroll({target:containerRef});const transform=useTransform(scrollYProgress,[0,1],[0,-scrollRange+contentWidth]);const physics={damping:60,mass:1,stiffness:500};const spring=useSpring(transform,physics);return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,...props,children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"sticky\",top:props.top},children:/*#__PURE__*/_jsx(\"div\",{style:{overflow:\"hidden\"},children:/*#__PURE__*/_jsx(motion.div,{ref:scrollRef,style:{x:spring},children:props.children})})}),/*#__PURE__*/_jsx(\"div\",{ref:sizerRef,\"aria-hidden\":\"true\",style:{width:\"100%\",height:scrollRange}})]});}HorizontalScroller.displayName=\"Horizontal Scroller\";addPropertyControls(HorizontalScroller,{children:{type:ControlType.ComponentInstance,title:\"Frame\",description:\"Long, overflowing frame.\"},top:{type:ControlType.Number,title:\"Top\",description:\"Auto sticky.\\n\\n*Note*: Parent containers require their overflows to be visible for sticky to work.\",defaultValue:0,min:0,step:1,displayStepper:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HorizontalScroller\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"800\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerIntrinsicHeight\":\"400\",\"framerDisableUnlink\":\"\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HorizontalScroll.map"],"mappings":"qQAQG,SAAwB,EAAmB,EAAM,CAAwB,EAAM,SAAS,GAAG,IAAM,EAAaA,EAAO,KAAK,CAAO,EAAUA,EAAO,KAAK,CAAO,EAASA,EAAO,KAAK,CAAM,CAAC,EAAY,GAAgBC,EAAS,EAAE,CAAM,CAAC,EAAa,GAAiBA,EAAS,EAAE,CAAC,MAAoB,CAAC,EAAe,EAAU,QAAQ,YAAY,CAAC,IAAM,EAAS,GAAS,CAAC,IAAI,IAAI,KAAS,EAAS,EAAgB,EAAM,YAAY,MAAM,CAAC,EAAe,EAAU,QAAQ,YAAY,EAAU,EAAc,GAAS,CAAC,IAAI,IAAI,KAAS,EAAS,EAAe,EAAU,QAAQ,YAAY,EAAU,EAAe,IAAI,eAAe,EAAS,CAAC,EAAe,QAAQ,EAAS,QAAQ,CAAC,IAAM,EAAiB,IAAI,iBAAiB,EAAc,CAAyF,OAAxF,EAAiB,QAAQ,EAAU,QAAQ,CAAC,WAAW,GAAK,gBAAgB,CAAC,QAAQ,CAAC,CAAC,KAAW,CAAC,EAAe,YAAY,C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