{"version":3,"file":"CurtainReveal.DAK4nz-a.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/C3Ay5PCOPWB0KXFydsMv/SgHvi6lmdiTKtwn9tSvs/CurtainReveal.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerIntrinsicWidth 1440\n * @framerIntrinsicHeight 900\n */export default function CurtainReveal(props){const{duration,curtainColor,panelCount,style}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[revealed,setRevealed]=useState(false);const[visible,setVisible]=useState(true);const count=Math.max(2,Math.min(12,Math.round(panelCount)));const animationDuration=Math.max(250,duration);useEffect(()=>{// Keep a still curtain in the editor so the component remains selectable.\nif(isCanvas)return;const frame=window.requestAnimationFrame(()=>setRevealed(true));const finishTimer=window.setTimeout(()=>setVisible(false),animationDuration+60);return()=>{window.cancelAnimationFrame(frame);window.clearTimeout(finishTimer);};},[animationDuration,isCanvas]);useEffect(()=>{if(!visible||isCanvas)return;const html=document.documentElement;const body=document.body;const scrollY=window.scrollY;const previous={htmlOverflow:html.style.overflow,bodyOverflow:body.style.overflow,bodyPosition:body.style.position,bodyTop:body.style.top,bodyWidth:body.style.width};html.style.overflow=\"hidden\";body.style.overflow=\"hidden\";body.style.position=\"fixed\";body.style.top=`-${scrollY}px`;body.style.width=\"100%\";return()=>{html.style.overflow=previous.htmlOverflow;body.style.overflow=previous.bodyOverflow;body.style.position=previous.bodyPosition;body.style.top=previous.bodyTop;body.style.width=previous.bodyWidth;window.scrollTo(0,scrollY);};},[visible,isCanvas]);if(!visible)return null;return /*#__PURE__*/_jsxs(\"div\",{className:`cr-root${revealed?\" cr-revealed\":\"\"}`,\"aria-hidden\":\"true\",style:{...style,position:isCanvas?\"absolute\":\"fixed\",inset:0,width:isCanvas?style?.width??\"100%\":\"100vw\",height:isCanvas?style?.height??900:\"100svh\",zIndex:2147483e3,overflow:\"hidden\",isolation:\"isolate\",pointerEvents:\"auto\",background:\"transparent\",[\"--cr-duration\"]:`${animationDuration}ms`,[\"--cr-curtain\"]:curtainColor},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                .cr-root,.cr-root *{box-sizing:border-box}\n                .cr-curtain-panel{position:absolute;z-index:1;top:0;bottom:0;background:var(--cr-curtain);box-shadow:inset 1px 0 rgba(255,255,255,.14),inset -1px 0 rgba(255,255,255,.14);transform:translate3d(0,0,0);transition-property:transform;transition-timing-function:cubic-bezier(.76,0,.24,1);will-change:transform;pointer-events:none}\n                .cr-revealed .cr-curtain-panel{transform:translate3d(0,-105%,0)}\n                @media(prefers-reduced-motion:reduce){.cr-curtain-panel{transition-duration:1ms!important;transition-delay:0ms!important}}\n            `}),Array.from({length:count},(_,index)=>{const center=(count-1)/2;const delay=Math.abs(index-center)*animationDuration*.035;return /*#__PURE__*/_jsx(\"span\",{className:\"cr-curtain-panel\",style:{left:`calc(${index/count*100}% - 1px)`,width:`calc(${100/count}% + 2px)`,transitionDelay:`${delay}ms`,transitionDuration:`${Math.max(1,animationDuration-delay)}ms`}},index);})]});}Object.assign(CurtainReveal,{defaultProps:{duration:1300,curtainColor:\"#F04427\",panelCount:5}});addPropertyControls(CurtainReveal,{duration:{type:ControlType.Number,title:\"Durata (ms)\",min:250,max:6e3,step:50,unit:\"ms\",defaultValue:1300},curtainColor:{type:ControlType.Color,title:\"Colore tenda\",defaultValue:\"#F04427\"},panelCount:{type:ControlType.Number,title:\"Pannelli\",min:2,max:12,step:1,defaultValue:5}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CurtainReveal\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"900\",\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerIntrinsicWidth\":\"1440\",\"framerContractVersion\":\"1\"}},\"__Framer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