{"version":3,"file":"HiddenForTime_1.DVVsSW4i.mjs","names":["useMemo","useState","useRef","useCallback","_Fragment"],"sources":["https:/framerusercontent.com/modules/XxHGRCvZYF11nEkTYHOW/wL3pojq3xPCGi5ew8OWS/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,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{startTransition,useCallback,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 isDesignTime=useMemo(()=>{const target=RenderTarget.current();return 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);const[dismissed,setDismissed]=useState(false);const shellRef=useRef(null);useEffect(()=>{if(typeof window===\"undefined\")return;if(dismissed)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},[dismissed,hideForMs,restartKey,isDesignTime]);const interactiveRef=useRef(null);const dismissAndDisableShell=useCallback(()=>{const shell=shellRef.current;if(shell){shell.style.pointerEvents=\"none\";shell.style.opacity=\"0\";shell.style.visibility=\"hidden\";shell.style.display=\"none\";shell.setAttribute(\"aria-hidden\",\"true\");}startTransition(()=>setDismissed(true));},[]);useEffect(()=>{const shell=shellRef.current;if(!shell)return;const onDismiss=()=>dismissAndDisableShell();shell.addEventListener(\"hiddenForTime:dismiss\",onDismiss);return()=>{shell.removeEventListener(\"hiddenForTime:dismiss\",onDismiss);};},[dismissAndDisableShell,revealed,dismissed]);// Make descendants fully non-interactive while hidden/dismissed (mouse + keyboard)\nuseEffect(()=>{const el=interactiveRef.current;if(!el)return;if(typeof window===\"undefined\")return;const shouldDisable=dismissed||!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}},[dismissed,revealed,isDesignTime]);const sharedOuter=useMemo(()=>({position:\"relative\",width:\"100%\",height:\"100%\",...style,// Always keep the shell non-interactive so it can never steal clicks.\n    pointerEvents:\"none\"}),[style]);const hiddenInteraction=dismissed||!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:\"none\",opacity:revealed?1:0,transition};}// Collapse mode: remove from layout when hidden\nreturn{display:revealed?\"block\":\"none\",position:\"relative\",width:\"100%\",height:\"100%\",pointerEvents:\"none\",opacity:1};},[fadeDurationMs,fadeIn,hiddenInteraction,keepSpace,revealed]);const interactiveStyle=useMemo(()=>({// No own box/hit area. Lets only actual rendered children receive events.\n    display:\"contents\",pointerEvents:hiddenInteraction?\"none\":\"auto\"}),[hiddenInteraction]);const placeholderStyle=useMemo(()=>{const transition=fadeIn?`opacity ${Math.max(0,fadeDurationMs)}ms ease`:undefined;const isShown=!dismissed&&!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,dismissed,revealed]);const shouldMountChildren=isDesignTime||revealed&&!dismissed;const isRuntimeWaiting=!isDesignTime&&!revealed&&!dismissed;const isRuntimeDismissed=!isDesignTime&&dismissed;const rootStyle=useMemo(()=>({...sharedOuter,...isRuntimeWaiting||isRuntimeDismissed?{height:0,minHeight:0,opacity:0,overflow:\"visible\",background:\"transparent\",pointerEvents:\"none\"}:{height:\"auto\",minHeight:0,overflow:\"visible\"}}),[sharedOuter,isRuntimeWaiting,isRuntimeDismissed]);return /*#__PURE__*/_jsx(\"div\",{ref:shellRef,style:rootStyle,\"data-hidden-for-time-shell\":\"true\",children:shouldMountChildren?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{style:contentStyle,children:/*#__PURE__*/_jsx(\"div\",{ref:interactiveRef,style:interactiveStyle,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})})]}):null});}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\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HiddenForTime_1.map"],"mappings":"4OAIG,SAAS,EAA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