{"version":3,"file":"PinnedTabletScroll.BcwnermY.mjs","names":["useRef","useState","__esmMin","window","te","init_ssg_sandbox_shims","init_npm_react_18_3_1","_e","de","init_jsx_runtime","p","ce","motion","useScroll","useTransform","init_framer_motion_DhsWWWsN","init_framer_B6PCHH0A","addPropertyControls","ControlType","PinnedTabletScroll","props","containerRef","imageRef","screenRef","imageHeight","setImageHeight","viewportHeight","setViewportHeight","screenHeight","setScreenHeight","isSmallScreen","setIsSmallScreen","updateDimensions","img","image","mockupScreenHeight","browserBarHeight","visibleScreenHeight","bezelSize","scrollAmount","containerHeight","additionalOffset","imageY","scrollYProgress","isMobile","deviceType","isPortrait","tabletOrientation","mobileWidth","tabletColor","screenBorderRadius","browserUrl","init_PinnedTabletScroll","showBrowserButtons"],"sources":["https:/framerusercontent.com/modules/GiAJWmFtucpASokMX8Fb/sG7sMyEEWBO9E1YDZBiE/PinnedTabletScroll.js"],"sourcesContent":["// Pinned section that scrolls an image vertically inside a tablet mockup\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useScroll,useTransform,motion}from\"framer-motion\";import{useRef,useState,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight auto\n */export default function PinnedTabletScroll(props){const{image={src:\"https://framerusercontent.com/images/GfGkADagM4KEibNcIiRUWlfrR0.jpg\",alt:\"Scrolling content\"},deviceType,tabletOrientation,tabletColor,screenBorderRadius,bezelSize,additionalOffset,browserUrl}=props;const containerRef=useRef(null);const imageRef=useRef(null);const screenRef=useRef(null);const[imageHeight,setImageHeight]=useState(0);const[viewportHeight,setViewportHeight]=useState(0);const[screenHeight,setScreenHeight]=useState(0);const[isSmallScreen,setIsSmallScreen]=useState(false);useEffect(()=>{const updateDimensions=()=>{if(imageRef.current){startTransition(()=>{setImageHeight(imageRef.current.offsetHeight);setViewportHeight(window.innerHeight);if(screenRef.current){setScreenHeight(screenRef.current.offsetHeight);}setIsSmallScreen(window.innerWidth<400);});}};const img=imageRef.current;if(img){if(img.complete){updateDimensions();}else{img.addEventListener(\"load\",updateDimensions);}}window.addEventListener(\"resize\",updateDimensions);return()=>{if(img){img.removeEventListener(\"load\",updateDimensions);}window.removeEventListener(\"resize\",updateDimensions);};},[image.src]);// Calculate the mockup screen height (80vh max)\nconst mockupScreenHeight=Math.min(viewportHeight*.8,viewportHeight*.8);// Calculate the actual visible screen height (subtract browser bar if shown)\nconst browserBarHeight=props.showBrowserButtons?40:0;const visibleScreenHeight=screenHeight>0?screenHeight-browserBarHeight:mockupScreenHeight-bezelSize*2-browserBarHeight;// Calculate how much the image needs to scroll\n// The image should scroll until its bottom is visible in the mockup\nconst scrollAmount=imageHeight>visibleScreenHeight?imageHeight-visibleScreenHeight:0;// Container height = scroll amount + viewport height + additional offset\n// This ensures the section stays pinned for the full scroll duration\nconst containerHeight=scrollAmount+viewportHeight+additionalOffset;const{scrollYProgress}=useScroll({target:containerRef,offset:[\"start start\",\"end end\"]});const imageY=useTransform(scrollYProgress,[0,1],[0,-scrollAmount]);const isMobile=deviceType===\"mobile\";const isPortrait=tabletOrientation===\"portrait\";const mobileWidth=isMobile&&isSmallScreen?\"80%\":\"400px\";return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{width:\"100%\",height:`${containerHeight}px`,position:\"relative\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"sticky\",top:0,width:\"100%\",height:\"100vh\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",zIndex:10},children:/*#__PURE__*/_jsxs(\"div\",{style:{width:isMobile?mobileWidth:\"auto\",maxWidth:isMobile?\"550px\":\"none\",height:isMobile?\"auto\":\"auto\",maxHeight:isMobile?\"none\":\"80vh\",aspectRatio:isMobile?\"9 / 16\":isPortrait?\"3 / 4\":\"4 / 3\",backgroundColor:tabletColor,borderRadius:screenBorderRadius+bezelSize,padding:bezelSize,boxShadow:\"0 20px 60px rgba(0, 0, 0, 0.3)\",position:\"relative\"},children:[props.showBrowserButtons&&/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",top:bezelSize,left:bezelSize,right:bezelSize,height:40,backgroundColor:\"#f6f6f6\",borderTopLeftRadius:screenBorderRadius,borderTopRightRadius:screenBorderRadius,display:\"flex\",alignItems:\"center\",padding:\"0 12px\",gap:12,zIndex:1},children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",gap:8},children:[/*#__PURE__*/_jsx(\"div\",{style:{width:12,height:12,borderRadius:\"50%\",backgroundColor:\"#FF5F56\"}}),/*#__PURE__*/_jsx(\"div\",{style:{width:12,height:12,borderRadius:\"50%\",backgroundColor:\"#FFBD2E\"}}),/*#__PURE__*/_jsx(\"div\",{style:{width:12,height:12,borderRadius:\"50%\",backgroundColor:\"#27C93F\"}})]}),/*#__PURE__*/_jsx(\"div\",{style:{flex:1,height:24,backgroundColor:\"#fff\",borderRadius:6,display:\"flex\",alignItems:\"center\",padding:\"0 10px\",fontSize:12,color:\"#666\",overflow:\"hidden\",textOverflow:\"ellipsis\",whiteSpace:\"nowrap\"},children:browserUrl})]}),/*#__PURE__*/_jsx(\"div\",{ref:screenRef,style:{width:\"100%\",height:\"100%\",borderRadius:screenBorderRadius,overflow:\"hidden\",position:\"relative\",backgroundColor:\"#000\"},children:/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",overflow:\"hidden\",position:\"relative\"},children:/*#__PURE__*/_jsx(motion.img,{ref:imageRef,src:image.src,alt:image.alt,style:{width:\"100%\",height:\"auto\",display:\"block\",y:imageY,marginTop:props.showBrowserButtons?40:0}})})})]})}),/*#__PURE__*/_jsx(\"div\",{style:{height:`${scrollAmount+additionalOffset}px`,pointerEvents:\"none\"}})]});}addPropertyControls(PinnedTabletScroll,{deviceType:{type:ControlType.Enum,title:\"Device Type\",options:[\"tablet\",\"mobile\"],optionTitles:[\"Tablet\",\"Mobile\"],defaultValue:\"tablet\",displaySegmentedControl:true},tabletOrientation:{type:ControlType.Enum,title:\"Orientation\",options:[\"landscape\",\"portrait\"],optionTitles:[\"Landscape\",\"Portrait\"],defaultValue:\"landscape\",displaySegmentedControl:true,hidden:({deviceType})=>deviceType===\"mobile\"},image:{type:ControlType.ResponsiveImage,title:\"Image\"},showBrowserButtons:{type:ControlType.Boolean,title:\"Browser Bar\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},browserUrl:{type:ControlType.String,title:\"URL\",defaultValue:\"https://www.example.com\",hidden:({showBrowserButtons})=>!showBrowserButtons},tabletColor:{type:ControlType.Color,title:\"Tablet Color\",defaultValue:\"#1a1a1a\"},screenBorderRadius:{type:ControlType.Number,title:\"Screen Radius\",defaultValue:12,min:0,max:40,step:1,unit:\"px\"},bezelSize:{type:ControlType.Number,title:\"Bezel Size\",defaultValue:20,min:0,max:60,step:1,unit:\"px\"},additionalOffset:{type:ControlType.Number,title:\"Additional Offset\",defaultValue:0,min:0,max:2e3,step:50,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PinnedTabletScroll\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PinnedTabletScroll.map"],"mappings":"A,qRAIG,SAAwBmB,EAAmB,EAAM,CAAC,GAAK,CAAC,QAAM,CAAC,IAAI,sEAAsE,IAAI,mBAAmB,EAAE,aAAW,oBAAkB,cAAY,qBAAmB,YAAU,mBAAiB,cAAYC,EAAYC,EAAarB,EAAO,IAAI,EAAQsB,EAAStB,EAAO,IAAI,EAAQuB,EAAUvB,EAAO,IAAI,EAAO,CAACwB,EAAYC,GAAgBxB,EAAS,CAAC,EAAO,CAACyB,EAAeC,GAAmB1B,EAAS,CAAC,EAAO,CAAC2B,EAAaC,GAAiB5B,EAAS,CAAC,EAAO,CAAC6B,EAAcC,G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