{"version":3,"file":"ScrollButton.Cqc3JGkd.mjs","names":["_Fragment","useState","useCallback"],"sources":["https:/framerusercontent.com/modules/6CNPSBL3sYFyVwMHoEZ7/ElmO6ac87OoWwp63E1AR/HideScrollbar.js","https:/framerusercontent.com/modules/ATQaZq8qIv5JHlo0ZFEQ/PnLhowCXsgmDSgmQKbJl/ScrollButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";export function hideScrollbar(Component){return props=>{return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{dangerouslySetInnerHTML:{__html:`\n                            .no-scrollbar::-webkit-scrollbar {\n                                display: none;\n                            }\n                        `}}),/*#__PURE__*/_jsx(Component,{...props,id:props.id||props.customId||\"testimonies\",className:`${props.className||\"\"} no-scrollbar`,style:{...props.style,scrollbarWidth:\"none\",msOverflowStyle:\"none\"}})]});};}\nexport const __FramerMetadata__ = {\"exports\":{\"hideScrollbar\":{\"type\":\"reactHoc\",\"name\":\"hideScrollbar\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HideScrollbar.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,useCallback}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion,animate}from\"framer-motion\";export default function ScrollButton(props){const{targetId,direction,customAsset,scrollMode,scrollAmount,scrollAmountDynamic}=props;const[isAtEdge,setIsAtEdge]=useState(false);// Core layout inspector logic\nconst checkScrollPosition=useCallback(container=>{if(!container)return;const{scrollLeft,scrollWidth,clientWidth}=container;// Safeguard: If sizes aren't loaded or fully initialized yet, don't lock anything\nif(clientWidth===0||scrollWidth===0){setIsAtEdge(false);return;}const isScrollable=scrollWidth>clientWidth;// If the element has no horizontal overflow content to scroll through, dim both buttons\nif(!isScrollable){setIsAtEdge(true);return;}if(direction===\"Previous\"){// Dim if we are at or near the starting left edge\nsetIsAtEdge(scrollLeft<=1);}else if(direction===\"Next\"){// Dim if we are at or near the ending right edge\nsetIsAtEdge(Math.ceil(scrollLeft+clientWidth)>=scrollWidth-1);}},[direction]);useEffect(()=>{if(!targetId)return;// Intercepts scroll events from the targeted component\nconst handleGlobalScroll=event=>{const target=event.target;if(target&&target.id===targetId){checkScrollPosition(target);}};// Live DOM checker for viewport resizes and initial load\nconst updateStateByLookup=()=>{const container=document.getElementById(targetId);if(container){checkScrollPosition(container);}};// Global capture phase interceptor handles any current/future DOM instances Framer creates\nwindow.addEventListener(\"scroll\",handleGlobalScroll,true);window.addEventListener(\"resize\",updateStateByLookup);// Continual sync check loop to catch dynamically loaded content/images\nconst syncInterval=setInterval(updateStateByLookup,250);// Run initial check\nupdateStateByLookup();return()=>{window.removeEventListener(\"scroll\",handleGlobalScroll,true);window.removeEventListener(\"resize\",updateStateByLookup);clearInterval(syncInterval);};},[targetId,checkScrollPosition]);// Helper function to evaluate CSS values into raw pixels\nconst getDynamicScrollPixels=expression=>{if(!expression)return 0;try{const tempEl=document.createElement(\"div\");tempEl.style.position=\"absolute\";tempEl.style.visibility=\"hidden\";tempEl.style.width=expression.includes(\"calc\")?expression:`calc(${expression})`;document.body.appendChild(tempEl);const pixels=tempEl.getBoundingClientRect().width;document.body.removeChild(tempEl);return pixels;}catch(error){console.error(\"[ScrollButton] Invalid CSS expression:\",error);return 0;}};const handleScroll=()=>{if(isAtEdge)return;try{const container=document.getElementById(targetId);if(container){let finalAmount=0;if(scrollMode===\"Fixed\"){finalAmount=scrollAmount;}else{finalAmount=getDynamicScrollPixels(scrollAmountDynamic);}const amountToScroll=direction===\"Next\"?finalAmount:-finalAmount;const targetScroll=container.scrollLeft+amountToScroll;// Framer Motion custom animation for butter-smooth scrolling\nanimate(container.scrollLeft,targetScroll,{type:\"spring\",stiffness:250,damping:30,restDelta:.5,onUpdate:latest=>{container.scrollLeft=latest;}});}else{console.warn(`[ScrollButton] Element with ID \"${targetId}\" not found.`);}}catch(error){console.error(`[ScrollButton] Error executing scroll:`,error);}};return /*#__PURE__*/_jsx(motion.div,{onClick:handleScroll,// Motion properties for smooth interaction states\nanimate:{opacity:isAtEdge?.35:1},whileHover:!isAtEdge?{scale:1.05}:{},whileTap:!isAtEdge?{scale:.95}:{},transition:{type:\"spring\",stiffness:400,damping:25},style:{width:\"100%\",height:\"100%\",cursor:isAtEdge?\"default\":\"pointer\",pointerEvents:isAtEdge?\"none\":\"auto\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\",overflow:\"hidden\"},children:customAsset?/*#__PURE__*/_jsx(\"img\",{src:customAsset,alt:`${direction} button`,style:{width:\"100%\",height:\"100%\",objectFit:\"contain\",pointerEvents:\"none\"}}):/*#__PURE__*/_jsx(\"div\",{style:{padding:\"10px 20px\",background:\"#E5E5E5\",borderRadius:\"8px\",color:\"#333\",fontWeight:600},children:direction})});}// Framer Property Controls\naddPropertyControls(ScrollButton,{targetId:{type:ControlType.String,title:\"Target ID\",defaultValue:\"my-carousel\",placeholder:\"Enter the container's ID\"},direction:{type:ControlType.Enum,title:\"Action\",options:[\"Next\",\"Previous\"],defaultValue:\"Next\"},customAsset:{type:ControlType.Image,title:\"Button Asset\"},scrollMode:{type:ControlType.Enum,title:\"Scroll By\",options:[\"Fixed\",\"Dynamic\"],defaultValue:\"Fixed\",displaySegmentedControl:true},scrollAmount:{type:ControlType.Number,title:\"Amount (px)\",defaultValue:300,min:50,max:2e3,step:10,displayStepper:true,hidden:props=>props.scrollMode!==\"Fixed\"},scrollAmountDynamic:{type:ControlType.String,title:\"Amount (CSS)\",defaultValue:\"100dvw - 40px\",placeholder:\"e.g. 100vw - 40px\",hidden:props=>props.scrollMode!==\"Dynamic\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ScrollButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ScrollButton.map"],"mappings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