{"version":3,"file":"HiddenForTime_1.DVlOsSpl.mjs","names":["useMemo","useState","useRef","p"],"sources":["https:/framerusercontent.com/modules/XxHGRCvZYF11nEkTYHOW/57IJRkfO7jiAHcIHhXjj/HiddenForTime_1.js"],"sourcesContent":["// User wants: a wrapper that keeps content hidden for a custom time, and makes everything inside non-clickable (e.g., forms/fields).\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{startTransition,useEffect,useMemo,useRef,useState}from\"react\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */function HiddenForTime(props){const{children,hideFor,unit,keepSpace,fadeIn,fadeDurationMs,placeholderText,placeholderFont,placeholderTextColor,placeholderBackground,placeholderBorderRadius,placeholderPadding,restartKey,style}=props;const target=RenderTarget.current();const isDesignTime=target===RenderTarget.canvas||target===RenderTarget.thumbnail;const hideForMs=useMemo(()=>{const safe=Number.isFinite(hideFor)?Math.max(0,hideFor):0;return unit===\"s\"?safe*1e3:safe;},[hideFor,unit]);const[revealed,setRevealed]=useState(isDesignTime||hideForMs<=0);useEffect(()=>{if(typeof window===\"undefined\")return;if(isDesignTime){startTransition(()=>setRevealed(true));return;}if(hideForMs<=0){startTransition(()=>setRevealed(true));return;}startTransition(()=>setRevealed(false));const id=window.setTimeout(()=>{startTransition(()=>setRevealed(true));},hideForMs);return()=>window.clearTimeout(id);// eslint-disable-next-line react-hooks/exhaustive-deps\n},[hideForMs,restartKey,isDesignTime]);const contentRef=useRef(null);// Make descendants fully non-interactive while hidden (mouse + keyboard)\nuseEffect(()=>{const el=contentRef.current;if(!el)return;if(typeof window===\"undefined\")return;const shouldDisable=!revealed&&!isDesignTime;// Prefer native \"inert\" if available\ntry{if(shouldDisable){el.inert=true;el.setAttribute(\"aria-hidden\",\"true\");}else{el.inert=false;el.removeAttribute(\"aria-hidden\");}}catch{// ignore\n}},[revealed,isDesignTime]);const sharedOuter=useMemo(()=>({position:\"relative\",width:\"100%\",height:\"100%\",...style}),[style]);const hiddenInteraction=!revealed&&!isDesignTime;const contentStyle=useMemo(()=>{const transition=fadeIn?`opacity ${Math.max(0,fadeDurationMs)}ms ease`:undefined;if(keepSpace){return{position:\"relative\",width:\"100%\",height:\"100%\",pointerEvents:hiddenInteraction?\"none\":\"auto\",opacity:revealed?1:0,transition};}// Collapse mode: remove from layout when hidden\nreturn{display:revealed?\"block\":\"none\",position:\"relative\",width:\"100%\",height:\"100%\",pointerEvents:hiddenInteraction?\"none\":\"auto\",opacity:1};},[fadeDurationMs,fadeIn,hiddenInteraction,keepSpace,revealed]);const placeholderStyle=useMemo(()=>{const transition=fadeIn?`opacity ${Math.max(0,fadeDurationMs)}ms ease`:undefined;const isShown=!revealed&&!isDesignTime;if(!keepSpace){return{display:isShown?\"flex\":\"none\",position:\"relative\",width:\"100%\",height:\"100%\",alignItems:\"center\",justifyContent:\"center\",textAlign:\"center\",background:placeholderBackground,color:placeholderTextColor,borderRadius:placeholderBorderRadius,padding:placeholderPadding,pointerEvents:\"none\",userSelect:\"none\",...placeholderFont};}return{position:\"absolute\",inset:0,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",textAlign:\"center\",background:placeholderBackground,color:placeholderTextColor,borderRadius:placeholderBorderRadius,padding:placeholderPadding,pointerEvents:\"none\",userSelect:\"none\",opacity:isShown?1:0,transition,...placeholderFont};},[fadeDurationMs,fadeIn,isDesignTime,keepSpace,placeholderBackground,placeholderBorderRadius,placeholderPadding,placeholderTextColor,placeholderFont,revealed]);return /*#__PURE__*/_jsxs(\"div\",{style:sharedOuter,children:[/*#__PURE__*/_jsx(\"div\",{ref:contentRef,style:contentStyle,onClickCapture:e=>{if(!hiddenInteraction)return;e.preventDefault();e.stopPropagation();},onPointerDownCapture:e=>{if(!hiddenInteraction)return;e.preventDefault();e.stopPropagation();},onKeyDownCapture:e=>{if(!hiddenInteraction)return;e.preventDefault();e.stopPropagation();},onFocusCapture:e=>{if(!hiddenInteraction)return;// Fallback if inert isn't supported: immediately blur focused element\nconst t=e.target;if(t&&typeof t.blur===\"function\")t.blur();},children:children}),/*#__PURE__*/_jsx(\"div\",{style:placeholderStyle,\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"span\",{style:{width:\"100%\",minWidth:0},children:placeholderText})})]});}export default HiddenForTime;addPropertyControls(HiddenForTime,{children:{type:ControlType.Slot,title:\"Content\",maxCount:1},hideFor:{type:ControlType.Number,title:\"Hide For\",defaultValue:3,min:0,max:120,step:.5},unit:{type:ControlType.Enum,title:\"Unit\",defaultValue:\"s\",options:[\"s\",\"ms\"],optionTitles:[\"Seconds\",\"Milliseconds\"],displaySegmentedControl:true},keepSpace:{type:ControlType.Boolean,title:\"Keep Space\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},fadeIn:{type:ControlType.Boolean,title:\"Fade\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},fadeDurationMs:{type:ControlType.Number,title:\"Fade (ms)\",defaultValue:300,min:0,max:3e3,step:50,hidden:p=>!p.fadeIn},placeholderText:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Please wait…\"},placeholderFont:{type:ControlType.Font,title:\"Placeholder Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"}},placeholderTextColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},placeholderBackground:{type:ControlType.Color,title:\"Background\",defaultValue:\"#F5F5F5\"},placeholderBorderRadius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"8px\"},placeholderPadding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"16px\"},restartKey:{type:ControlType.Number,title:\"Restart Key\",defaultValue:0,min:0,max:999999,step:1,description:\"Increment to restart the timer.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HiddenForTime\",\"slots\":[\"children\"],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HiddenForTime_1.map"],"mappings":"8NAIG,SAAS,EAAc,EAAM,CAAC,GAAK,CAAC,WAAS,UAAQ,OAAK,YAAU,SAAO,iBAAe,kBAAgB,kBAAgB,uBAAqB,wBAAsB,0BAAwB,qBAAmB,aAAW,SAAO,EAAY,EAAO,EAAa,SAAS,CAAO,EAAa,IAAS,EAAa,QAAQ,IAAS,EAAa,UAAgB,EAAUA,MAAY,CAAC,IAAM,EAAK,OAAO,SAAS,EAAQ,CAAC,KAAK,IAAI,EAAE,EAAQ,CAAC,EAAE,OAAO,IAAO,IAAI,EAAK,IAAI,GAAO,CAAC,EAAQ,EAAK,CAAC,CAAM,CAAC,EAAS,GAAaC,EAAS,GAAc,GAAW,EAAE,CAAC,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,GAAG,EAAa,CAAC,MAAoB,EAAY,GAAK,CAAC,CAAC,OAAQ,GAAG,GAAW,EAAE,CAAC,MAAoB,EAAY,GAAK,CAAC,CAAC,OAAQ,MAAoB,EAAY,GAAM,CAAC,CAAC,IAAM,EAAG,EAAO,eAAe,CAAC,MAAoB,EAAY,GAAK,CAAC,EAAG,EAAU,CAAC,UAAU,EAAO,aAAa,EAAG,EAC13B,CAAC,EAAU,EAAW,EAAa,CAAC,CAAC,IAAM,EAAWC,EAAO,KAAK,CACpE,MAAc,CAAC,IAAM,EAAG,EAAW,QAAsB,GAAX,CAAC,GAAoB,IAAS,OAAY,OAAO,IAAM,EAAc,CAAC,GAAU,CAAC,EAC/H,GAAG,CAAI,GAAe,EAAG,MAAM,GAAK,EAAG,aAAa,cAAc,OAAO,GAAO,EAAG,MAAM,GAAM,EAAG,gBAAgB,cAAc,OAAQ,IACrI,CAAC,EAAS,EAAa,C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