{"version":3,"file":"OverflowSlider.BUopJ9gi.mjs","names":["React.useMemo","React.useRef","React.useState","React.useCallback","pxPerSec","__esmMin","ne","j","init_npm_react_18_3_1","te","pe","de","window","K","c","ce","_e","init_ssg_sandbox_shims","motion","useInView","useMotionValue","init_framer_motion_DhsWWWsN","addPropertyControls","init_framer_D6uXRwWs","ControlType","useIsStaticRenderer","OverflowSlider","props","renderedItems","items","key","child","index","isStatic","rootRef","trackRef","isFixedWidth","style","isFixedHeight","x","bounds","setBounds","inView","measure","root","track","rootRect","trackRect","viewportWidth","contentWidth","min","current","ro","onResize","clampX","next","applyDelta","delta","onWheel","enableWheel","wheelSpeed","rafRef","hoverDirRef","lastTRef","stopEdgeHover","edgeLoop","enableEdgeHover","dir","lastT","t","dt","edgeSpeed","maybeStartEdgeHover","onMouseMove","rect","localX","leftZone","edgeZone","rightZone","onMouseLeave","justifyContent","align","showGrabCursor","cursor","enableDrag","init_OverflowSlider","init_jsx_runtime","p"],"sources":["https:/framerusercontent.com/modules/60V5m6Wyrr8WJygpvWzz/g6ExbjefsqJbQGnVuUbz/OverflowSlider.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView,useMotionValue}from\"framer-motion\";// Component that takes elements and creates a slider. The elements should be visible outside the slider container. The sliding is done either via scroll/touch drag or by placing the cursor at each end of the container.\n/**\n * @framerIntrinsicWidth 320\n * @framerIntrinsicHeight 120\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function OverflowSlider(props){const{items,gap,padding,align,enableDrag,enableWheel,wheelSpeed,enableEdgeHover,edgeZone,edgeSpeed,cursor,style}=props;const renderedItems=React.useMemo(()=>{return React.Children.map(items,(child,index)=>{const key=/*#__PURE__*/React.isValidElement(child)&&child.key!=null?String(child.key):index;return /*#__PURE__*/_jsx(\"div\",{style:{flex:\"0 0 auto\",flexShrink:0,minWidth:0},children:child},key);});},[items]);const isStatic=useIsStaticRenderer();const rootRef=React.useRef(null);const trackRef=React.useRef(null);const isFixedWidth=style?.width===\"100%\";const isFixedHeight=style?.height===\"100%\";const x=useMotionValue(0);const[bounds,setBounds]=React.useState({min:0,max:0});const inView=useInView(rootRef,{amount:.05});const measure=React.useCallback(()=>{const root=rootRef.current;const track=trackRef.current;if(!root||!track)return;const rootRect=root.getBoundingClientRect();const trackRect=track.getBoundingClientRect();const viewportWidth=rootRect.width;const contentWidth=track.scrollWidth||trackRect.width;const max=0;const min=Math.min(0,viewportWidth-contentWidth);React.startTransition(()=>setBounds({min,max}));const current=x.get();if(current>max)x.set(max);if(current<min)x.set(min);},[x]);React.useEffect(()=>{if(typeof window===\"undefined\")return;measure();const root=rootRef.current;const track=trackRef.current;if(!root||!track)return;let ro=null;if(\"ResizeObserver\"in window){ro=new ResizeObserver(()=>measure());ro.observe(root);ro.observe(track);}const onResize=()=>measure();window.addEventListener(\"resize\",onResize);return()=>{window.removeEventListener(\"resize\",onResize);if(ro)ro.disconnect();};},[measure]);const clampX=React.useCallback(next=>{if(next>bounds.max)return bounds.max;if(next<bounds.min)return bounds.min;return next;},[bounds.max,bounds.min]);const applyDelta=React.useCallback(delta=>{const next=clampX(x.get()+delta);x.set(next);},[clampX,x]);const onWheel=React.useCallback(e=>{if(!enableWheel||isStatic)return;if(!inView)return;// Only respond to horizontal wheel/trackpad scroll.\n// Let vertical scrolling bubble so the page can scroll.\nif(Math.abs(e.deltaX)<=Math.abs(e.deltaY))return;e.preventDefault();const delta=e.deltaX*wheelSpeed;applyDelta(-delta);},[applyDelta,enableWheel,inView,isStatic,wheelSpeed]);const rafRef=React.useRef(null);const hoverDirRef=React.useRef(0);const lastTRef=React.useRef(0);const stopEdgeHover=React.useCallback(()=>{hoverDirRef.current=0;if(rafRef.current!=null&&typeof window!==\"undefined\"){window.cancelAnimationFrame(rafRef.current);rafRef.current=null;}lastTRef.current=0;},[]);const edgeLoop=React.useCallback(t=>{if(typeof window===\"undefined\")return;if(!enableEdgeHover||isStatic||!inView){stopEdgeHover();return;}const dir=hoverDirRef.current;if(dir===0){stopEdgeHover();return;}const lastT=lastTRef.current||t;const dt=Math.min(.05,Math.max(0,(t-lastT)/1e3));lastTRef.current=t;const pxPerSec=edgeSpeed;const delta=dir*pxPerSec*dt;applyDelta(delta);rafRef.current=window.requestAnimationFrame(edgeLoop);},[applyDelta,enableEdgeHover,edgeSpeed,inView,isStatic,stopEdgeHover]);const maybeStartEdgeHover=React.useCallback(()=>{if(typeof window===\"undefined\")return;if(rafRef.current!=null)return;lastTRef.current=0;rafRef.current=window.requestAnimationFrame(edgeLoop);},[edgeLoop]);const onMouseMove=React.useCallback(e=>{if(!enableEdgeHover||isStatic)return;if(!inView)return;const root=rootRef.current;if(!root)return;const rect=root.getBoundingClientRect();const localX=e.clientX-rect.left;const leftZone=Math.max(0,edgeZone);const rightZone=Math.max(0,edgeZone);let dir=0;if(localX<=leftZone)dir=1;else if(localX>=rect.width-rightZone)dir=-1;if(dir===0){hoverDirRef.current=0;stopEdgeHover();return;}// Don’t scroll if already at the end in that direction\nconst current=x.get();if(dir===1&&current>=bounds.max-.5){hoverDirRef.current=0;stopEdgeHover();return;}if(dir===-1&&current<=bounds.min+.5){hoverDirRef.current=0;stopEdgeHover();return;}hoverDirRef.current=dir;maybeStartEdgeHover();},[bounds.max,bounds.min,edgeZone,enableEdgeHover,inView,isStatic,maybeStartEdgeHover,stopEdgeHover,x]);const onMouseLeave=React.useCallback(()=>{stopEdgeHover();},[stopEdgeHover]);const justifyContent=align===\"center\"?\"center\":align===\"end\"?\"flex-end\":\"flex-start\";const showGrabCursor=cursor===\"grab\"&&enableDrag&&!isStatic;return /*#__PURE__*/_jsx(\"div\",{ref:rootRef,style:{...style,position:\"relative\",width:isFixedWidth?\"100%\":\"auto\",height:isFixedHeight?\"100%\":\"auto\",minWidth:5,minHeight:5,overflow:\"visible\",touchAction:enableDrag&&!isStatic?\"pan-y\":\"auto\",cursor:showGrabCursor?\"grab\":\"default\",userSelect:\"none\",display:isFixedWidth||isFixedHeight?\"block\":\"inline-block\"},onWheel:onWheel,onMouseMove:onMouseMove,onMouseLeave:onMouseLeave,\"aria-label\":\"Overflow slider\",role:\"region\",children:/*#__PURE__*/_jsx(motion.div,{ref:trackRef,style:{position:\"relative\",display:\"flex\",flexDirection:\"row\",alignItems:\"stretch\",justifyContent,gap,padding,x:isStatic?0:x,willChange:isStatic?undefined:\"transform\",overflow:\"visible\",minHeight:5},drag:enableDrag&&!isStatic?\"x\":false,dragConstraints:isStatic?undefined:{left:bounds.min,right:bounds.max},dragElastic:.08,dragMomentum:true,onDragStart:()=>{if(showGrabCursor&&typeof document!==\"undefined\"){document.body.style.cursor=\"grabbing\";}},onDragEnd:()=>{if(showGrabCursor&&typeof document!==\"undefined\"){document.body.style.cursor=\"\";}// Clamp after momentum settles a bit\nif(typeof window!==\"undefined\"){window.setTimeout(()=>{const next=clampX(x.get());x.set(next);},0);}},children:renderedItems})});}addPropertyControls(OverflowSlider,{items:{type:ControlType.Slot,title:\"Items\",maxCount:20},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:16,min:0,max:200,step:1,unit:\"px\"},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:0,min:0,max:200,step:1,unit:\"px\"},align:{type:ControlType.Enum,title:\"Align\",defaultValue:\"start\",options:[\"start\",\"center\",\"end\"],optionTitles:[\"Start\",\"Center\",\"End\"],displaySegmentedControl:true},enableDrag:{type:ControlType.Boolean,title:\"Drag\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},enableWheel:{type:ControlType.Boolean,title:\"Wheel\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},wheelSpeed:{type:ControlType.Number,title:\"Wheel Speed\",defaultValue:1,min:.1,max:4,step:.1,hidden:p=>!p.enableWheel},enableEdgeHover:{type:ControlType.Boolean,title:\"Edge Hover\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},edgeZone:{type:ControlType.Number,title:\"Edge Zone\",defaultValue:60,min:0,max:200,step:1,unit:\"px\",hidden:p=>!p.enableEdgeHover},edgeSpeed:{type:ControlType.Number,title:\"Edge Speed\",defaultValue:700,min:0,max:3e3,step:10,unit:\"px/s\",hidden:p=>!p.enableEdgeHover},cursor:{type:ControlType.Enum,title:\"Cursor\",defaultValue:\"grab\",options:[\"default\",\"grab\"],optionTitles:[\"Default\",\"Grab\"],displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"OverflowSlider\",\"slots\":[\"items\"],\"annotations\":{\"framerIntrinsicWidth\":\"320\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"120\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./OverflowSlider.map"],"mappings":"A,2SAOG,SAAwB0B,EAAe,EAAM,CAAC,GAAK,CAAC,QAAM,MAAI,UAAQ,QAAM,aAAW,cAAY,aAAW,kBAAgB,WAAS,YAAU,SAAO,SAAOC,EAAYC,EAAc5B,MAAmBO,EAAsB,IAAIsB,GAAO,EAAM,IAAQ,CAAC,IAAMC,EAAiB,gBAAqBC,CAAK,GAAGA,EAAM,KAAK,KAAK,OAAOA,EAAM,GAAG,EAAEC,EAAM,MAAoB,gBAAK,MAAM,CAAC,MAAM,CAAC,KAAK,WAAW,WAAW,EAAE,SAAS,CAAC,EAAE,SAASD,CAAK,EAAED,CAAG,CAAE,CAAC,EAAI,CAACD,CAAK,CAAC,EAAQI,EAASR,EAAoB,EAAQS,EAAQjC,EAAa,IAAI,EAAQkC,EAASlC,EAAa,IAAI,EAAQmC,EAAaC,GAAO,QAAQ,OAAaC,EAAcD,GAAO,SAAS,OAAaE,EAAEnB,EAAe,CAAC,EAAO,CAACoB,EAAOC,GAAWvC,EAAe,CAAC,IAA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