{"version":3,"file":"SnapRow.BwpkTFPs.mjs","names":["useRef","__esmMin","init_npm_react_18_3_1","de","c","J","init_jsx_runtime","ce","injectCssOnce","s","css","isScroller","o","el","findScroller","root","all","withScrollSnap","wrap","scroller","CLASS","Component","props","scrollRow","node","from","row","first","gap","step","dir","withPrev","withNext","init_SnapRow"],"sources":["https:/framerusercontent.com/modules/77tdrNAaxrY04mvxNaYt/Is3hkHOt8y5P3WejlI9Q/SnapRow.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef}from\"react\";const CLASS=\"orica-snap\";const css=`\n.${CLASS} { scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }\n.${CLASS}::-webkit-scrollbar { display: none; }\n.${CLASS} > * { scroll-snap-align: start; }\n`;function injectCssOnce(){if(typeof document===\"undefined\")return;if(document.getElementById(\"orica-snap-css\"))return;const s=document.createElement(\"style\");s.id=\"orica-snap-css\";s.textContent=css;document.head.appendChild(s);}function isScroller(el){const o=getComputedStyle(el).overflowX;return o===\"auto\"||o===\"scroll\";}function findScroller(root){if(isScroller(root))return root;const all=root.querySelectorAll(\"*\");for(const el of Array.from(all))if(isScroller(el))return el;return null;}// ---------- Scroll-snap row ----------\nexport function withScrollSnap(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const wrap=useRef(null);useEffect(()=>{injectCssOnce();const root=wrap.current;if(!root)return;const scroller=findScroller(root);if(!scroller)return;scroller.classList.add(CLASS);// snap to the row's own left padding, so cards align to the page margin\nscroller.style.scrollPaddingLeft=getComputedStyle(scroller).paddingLeft;});return /*#__PURE__*/_jsx(\"div\",{ref:wrap,style:{display:\"contents\"},children:/*#__PURE__*/_jsx(Component,{ref:ref,...props})});});}// ---------- Prev / Next buttons ----------\nfunction scrollRow(from,dir){let node=from?.parentElement??null;while(node&&!node.querySelector(\".\"+CLASS))node=node.parentElement;const row=node?.querySelector(\".\"+CLASS);if(!row)return;const first=row.firstElementChild;const gap=parseFloat(getComputedStyle(row).columnGap)||0;const step=first?first.getBoundingClientRect().width+gap:row.clientWidth;row.scrollBy({left:dir*step,behavior:\"smooth\"});}export function withPrev(Component){return /*#__PURE__*/forwardRef((props,ref)=>/*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:e=>scrollRow(e.currentTarget,-1)}));}export function withNext(Component){return /*#__PURE__*/forwardRef((props,ref)=>/*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:e=>scrollRow(e.currentTarget,1)}));}\nexport const __FramerMetadata__ = {\"exports\":{\"withPrev\":{\"type\":\"reactHoc\",\"name\":\"withPrev\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withScrollSnap\":{\"type\":\"reactHoc\",\"name\":\"withScrollSnap\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withNext\":{\"type\":\"reactHoc\",\"name\":\"withNext\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SnapRow.map"],"mappings":"A,gIAIE,SAASQ,GAAe,CAAyC,GAArC,OAAO,SAAW,KAAsB,SAAS,eAAe,gBAAgB,EAAE,OAAO,IAAMC,EAAE,SAAS,cAAc,OAAO,EAAE,EAAE,GAAG,iBAAiB,EAAE,YAAYC,EAAI,SAAS,KAAK,YAAYD,CAAC,CAAE,CAAC,SAASE,EAAW,EAAG,CAAC,IAAMC,EAAE,iBAAiBC,CAAE,CAAC,CAAC,UAAU,OAAOD,IAAI,QAAQA,IAAI,QAAS,CAAC,SAASE,EAAa,EAAK,CAAC,GAAGH,EAAWI,CAAI,EAAE,OAAOA,EAAK,IAAMC,EAAID,EAAK,iBAAiB,GAAG,EAAE,IAAI,IAAMF,KAAM,MAAM,KAAKG,CAAG,EAAE,GAAGL,EAAWE,CAAE,EAAE,OAAOA,EAAG,OAAO,IAAK,CAC9e,SAAgBI,EAAe,EAAU,CAAC,MAAoB,iBAAY,EAAM,IAAM,CAAC,IAAMC,EAAKlB,EA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