{"version":3,"file":"MobileGallery.BO2L1RII.mjs","names":["React.useRef","React.useState","React.useCallback","__esmMin","init_ssg_sandbox_shims","te","ne","window","_e","de","init_jsx_runtime","p","init_npm_react_18_3_1","ce","addPropertyControls","init_framer_DKWANagr","ControlType","MobileGallery","viewport","track","position","setPosition","measure","el","list","cards","viewportLeft","index","nearest","distance","card","candidate","count","old","observer","go","target","left","reduced","style","photoRatio","mobilePhotoRatio","label","event","content","previousLabel","nextLabel","item","init_MobileGallery"],"sources":["https:/framerusercontent.com/modules/zSTyVvHohlvlJwxd7MVS/IoNg7NtCYRe9QGqbeDQd/MobileGallery.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerIntrinsicWidth 350\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function MobileGallery({content,label=\"Zdjęcia z wystawy\",previousLabel=\"Poprzednie zdjęcie\",nextLabel=\"Następne zdjęcie\",color=\"#ffffff\",photoRatio=4/3,mobilePhotoRatio=5/4,style}){const viewport=React.useRef(null);const track=React.useRef(null);// Identical initial state on the server and during the first client render.\nconst[position,setPosition]=React.useState({index:0,count:3});const measure=React.useCallback(()=>{const el=viewport.current;const list=track.current;if(!el||!list||el.clientWidth<40)return;const cards=Array.from(list.querySelectorAll('[data-framer-name=\"Mobile gallery card\"]'));if(!cards.length)return;const viewportLeft=el.getBoundingClientRect().left;let index=0;let nearest=Infinity;cards.forEach((card,candidate)=>{const distance=Math.abs(card.getBoundingClientRect().left-viewportLeft);if(distance<nearest){index=candidate;nearest=distance;}});const count=cards.length;React.startTransition(()=>{setPosition(old=>old.index===index&&old.count===count?old:{index,count});});},[]);React.useEffect(()=>{measure();if(typeof ResizeObserver===\"undefined\")return;const observer=new ResizeObserver(measure);if(viewport.current)observer.observe(viewport.current);if(track.current)observer.observe(track.current);return()=>observer.disconnect();},[measure]);function go(index){const el=viewport.current;const list=track.current;if(!el||!list||el.scrollWidth<=el.clientWidth+1)return;const cards=list.querySelectorAll('[data-framer-name=\"Mobile gallery card\"]');const target=cards[Math.max(0,Math.min(cards.length-1,index))];if(!target)return;const left=target.getBoundingClientRect().left-el.getBoundingClientRect().left+el.scrollLeft;const reduced=typeof window!==\"undefined\"&&window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;el.scrollTo({left:Math.max(0,left),behavior:reduced?\"auto\":\"smooth\"});}return /*#__PURE__*/_jsxs(\"div\",{className:\"wi-mobile-gallery\",\"data-current\":position.index+1,style:{...style,position:\"relative\",width:\"100%\",minWidth:0,color,\"--wi-photo-ratio\":photoRatio,\"--wi-mobile-photo-ratio\":mobilePhotoRatio},role:\"region\",\"aria-roledescription\":\"carousel\",\"aria-label\":label,children:[/*#__PURE__*/_jsx(\"style\",{dangerouslySetInnerHTML:{__html:`\n            .wi-mobile-gallery { container-type:inline-size; }\n            .wi-mobile-gallery .wi-gallery-viewport { width:100%; min-width:0; overflow-x:auto; overflow-y:hidden; scrollbar-width:none; scroll-snap-type:x mandatory; overscroll-behavior-x:contain; }\n            .wi-mobile-gallery .wi-gallery-viewport::-webkit-scrollbar { display:none; }\n            .wi-mobile-gallery .wi-gallery-track { width:max-content; padding-right:32px; }\n            .wi-mobile-gallery [data-framer-name=\"Mobile gallery list\"] { display:flex!important; flex-direction:row!important; align-items:flex-start!important; gap:16px!important; width:max-content!important; max-width:none!important; overflow:visible!important; }\n            .wi-mobile-gallery [data-framer-name=\"Mobile gallery card\"] { width:calc(100cqw - 32px)!important; min-width:0!important; flex:none!important; scroll-snap-align:start; scroll-snap-stop:always; }\n            .wi-mobile-gallery [data-framer-name=\"Mobile gallery photo\"] { width:100%!important; height:auto!important; aspect-ratio:var(--wi-mobile-photo-ratio, 1.25)!important; }\n            .wi-mobile-gallery .wi-gallery-controls { display:flex; align-items:center; justify-content:space-between; padding-top:4px; min-height:44px; }\n            .wi-mobile-gallery button:focus-visible,.wi-mobile-gallery .wi-gallery-viewport:focus-visible { outline:2px solid currentColor; outline-offset:-2px; }\n            .wi-mobile-gallery button:disabled { opacity:.3; cursor:default; }\n            @media (max-width:809.98px) {\n                .wi-mobile-gallery [data-framer-name=\"Mobile gallery card\"] { gap:8px!important; }\n                .wi-mobile-gallery[data-current=\"${position.index+1}\"] [data-framer-name=\"Mobile gallery card\"]:not(:nth-child(${position.index+1})) > [data-framer-component-type=\"RichTextContainer\"] { display:none!important; }\n            }\n            @media (min-width:810px) {\n                .wi-mobile-gallery .wi-gallery-viewport { overflow:visible; scroll-snap-type:none; overscroll-behavior-x:auto; }\n                .wi-mobile-gallery .wi-gallery-track { width:100%; padding-right:0; }\n                .wi-mobile-gallery [data-framer-name=\"Mobile gallery list\"] { display:grid!important; grid-template-columns:repeat(3,minmax(0,1fr))!important; align-items:start!important; gap:20px!important; width:100%!important; }\n                .wi-mobile-gallery [data-framer-name=\"Mobile gallery card\"] { width:100%!important; scroll-snap-align:none; scroll-snap-stop:normal; }\n                .wi-mobile-gallery [data-framer-name=\"Mobile gallery photo\"] { height:auto!important; aspect-ratio:var(--wi-photo-ratio, 1.333333)!important; }\n                .wi-mobile-gallery .wi-gallery-controls { display:none; }\n            }\n        `}}),/*#__PURE__*/_jsx(\"div\",{ref:viewport,className:\"wi-gallery-viewport\",tabIndex:0,\"aria-label\":label,onScroll:measure,onKeyDown:event=>{const el=viewport.current;if(!el||el.scrollWidth<=el.clientWidth+1)return;if(event.key===\"ArrowRight\"||event.key===\"ArrowLeft\"||event.key===\"Home\"||event.key===\"End\"){event.preventDefault();go(event.key===\"Home\"?0:event.key===\"End\"?position.count-1:position.index+(event.key===\"ArrowRight\"?1:-1));}},children:/*#__PURE__*/_jsx(\"div\",{ref:track,className:\"wi-gallery-track\",children:content})}),/*#__PURE__*/_jsxs(\"div\",{className:\"wi-gallery-controls\",children:[/*#__PURE__*/_jsxs(\"span\",{style:{fontFamily:'\"Roboto Mono\", monospace',fontSize:14,lineHeight:1.4,fontVariantNumeric:\"tabular-nums\"},\"aria-live\":\"polite\",\"aria-atomic\":\"true\",children:[position.index+1,\" / \",position.count]}),/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",gap:8},children:[{delta:-1,label:previousLabel,path:\"M16 4L8 12L16 20\"},{delta:1,label:nextLabel,path:\"M8 4L16 12L8 20\"}].map(item=>/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":item.label,disabled:item.delta<0?position.index===0:position.index===position.count-1,onClick:()=>go(position.index+item.delta),style:{display:\"grid\",placeItems:\"center\",width:44,height:44,padding:8,border:0,borderRadius:0,background:\"transparent\",color:\"inherit\",cursor:\"pointer\"},children:/*#__PURE__*/_jsx(\"svg\",{width:\"24\",height:\"24\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"1.5\",\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"path\",{d:item.path})})},item.delta))})]})]});}addPropertyControls(MobileGallery,{photoRatio:{type:ControlType.Number,title:\"Photo ratio\",defaultValue:4/3,min:.7,max:2,step:.05},mobilePhotoRatio:{type:ControlType.Number,title:\"Mobile photo ratio\",defaultValue:5/4,min:.7,max:2,step:.05},content:{type:ControlType.Slot,title:\"CMS gallery\",maxCount:1},label:{type:ControlType.String,title:\"Gallery label\",defaultValue:\"Zdjęcia z wystawy\"},previousLabel:{type:ControlType.String,title:\"Previous label\",defaultValue:\"Poprzednie zdjęcie\"},nextLabel:{type:ControlType.String,title:\"Next label\",defaultValue:\"Następne zdjęcie\"},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#ffffff\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MobileGallery\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerIntrinsicWidth\":\"350\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# s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