{"version":3,"file":"FolderOpen.C2cfJnSK.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/aLssgFJhlXOuviU5NVDt/SHAXR7g3VGn0o2PVyl2t/FolderOpen.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{useReducedMotion}from\"framer-motion\";/**\n * FOLDER HOVER OVERRIDES\n * ----------------------------------------------------------------------------\n * Attach in Framer:\n *   inner Stack  → withFolderRoot\n *   frontLayer   → withFrontLayer\n *   left paper   → withPaperLeft\n *   middle paper → withPaperCenter\n *   right paper  → withPaperRight\n *   file         → withFolderBack   (optional)\n *\n * Inside a card-stack card: the folder opens when the CARD is hovered.\n * The card stack makes cards pointer-events: none and routes input to\n * invisible plates, so the folder can't see the pointer directly — it\n * listens for the card stack's \"card-stack-hover\" event on its card.\n *\n * Anywhere else: falls back to normal pointerenter / pointerleave on\n * the folder root, so the component still works standalone.\n *\n * Setup notes:\n *   • Set each paper's rotation to 0 in Framer. The REST values below\n *     own the closed-state rotation, so tweak them to match your layout.\n *   • Turn OFF \"Clip content\" on the inner Stack, the folder component,\n *     and the card 5 component, or the fanned papers get cropped.\n *   • Overrides only run in Preview / on the live site, not the canvas.\n *   • Touch input is ignored for now (proof of concept).\n */// ─── Tuning ──────────────────────────────────────────────────────────────────\nconst PERSPECTIVE=900// px. Lower = more dramatic 3D distortion\n;const FRONT={rest:{rotateX:0,scale:1},open:{rotateX:-25,scale:1.02}};const BACK={rest:{rotateX:0,scale:1},open:{rotateX:8,scale:.97}};const SHADOW_REST=\"0px 2px 6px rgba(0, 0, 0, 0.08)\";const SHADOW_OPEN=\"0px 22px 36px rgba(20, 40, 90, 0.22)\";const PAPER_LEFT={rest:{x:\"0%\",y:\"0%\",rotate:-10,scale:1,boxShadow:SHADOW_REST},open:{x:\"-42%\",y:\"-40%\",rotate:-32,scale:1.04,boxShadow:SHADOW_OPEN}};const PAPER_CENTER={rest:{x:\"0%\",y:\"0%\",rotate:0,scale:1,boxShadow:SHADOW_REST},open:{x:\"0%\",y:\"-55%\",rotate:-3,scale:1.08,boxShadow:SHADOW_OPEN}};const PAPER_RIGHT={rest:{x:\"0%\",y:\"0%\",rotate:10,scale:1,boxShadow:SHADOW_REST},open:{x:\"42%\",y:\"-38%\",rotate:30,scale:1.04,boxShadow:SHADOW_OPEN}};const REDUCED_PAPER_OPEN={y:\"-10%\"};const REDUCED_FLAT={};const SPRING_PAPER_OPEN={type:\"spring\",stiffness:380,damping:17,mass:.9};const SPRING_PAPER_CLOSE={type:\"spring\",stiffness:420,damping:32};const SPRING_FRONT_OPEN={type:\"spring\",stiffness:230,damping:14};const SPRING_FRONT_CLOSE={type:\"spring\",stiffness:320,damping:26};const REDUCED_TWEEN={type:\"tween\",duration:.2,ease:\"easeOut\"};const DELAY={center:{open:0,close:.06},left:{open:.05,close:.02},right:{open:.09,close:0},front:{open:0,close:.1},back:{open:0,close:.1}};const Z={back:0,left:1,center:2,right:3,front:4};// ─── Hover plumbing ──────────────────────────────────────────────────────────\nconst ROOT_ATTR=\"data-folder-root\";// Must match the card stack file.\nconst CARD_ATTR=\"data-card-stack-card\";const CARD_HOVER_ATTR=\"data-card-stack-hovered\";const CARD_HOVER_EVENT=\"card-stack-hover\";function useFolderOpen(node){const[open,setOpen]=useState(false);useEffect(()=>{if(!node)return;// Inside a card-stack card → follow the card's hover state.\nconst card=node.closest(`[${CARD_ATTR}]`);if(card){setOpen(card.hasAttribute(CARD_HOVER_ATTR));const onCardHover=e=>{setOpen(!!e.detail?.hovered);};card.addEventListener(CARD_HOVER_EVENT,onCardHover);return()=>{card.removeEventListener(CARD_HOVER_EVENT,onCardHover);};}// Standalone → plain pointer hover on the folder root.\nconst root=node.closest(`[${ROOT_ATTR}]`)??node.parentElement;if(!root)return;const enter=e=>{if(e.pointerType===\"touch\")return;setOpen(true);};const leave=e=>{if(e.pointerType===\"touch\")return;setOpen(false);};root.addEventListener(\"pointerenter\",enter);root.addEventListener(\"pointerleave\",leave);return()=>{root.removeEventListener(\"pointerenter\",enter);root.removeEventListener(\"pointerleave\",leave);};},[node]);return open;}function AnimatedLayer({Component,componentProps,cfg}){const[node,setNode]=useState(null);const open=useFolderOpen(node);const reduce=useReducedMotion();const target=open?{...cfg.rest,...reduce?cfg.reducedOpen:cfg.open}:cfg.rest;const transition=reduce?REDUCED_TWEEN:{...open?cfg.openSpring:cfg.closeSpring,delay:open?cfg.delay.open:cfg.delay.close};return /*#__PURE__*/_jsx(Component,{...componentProps,ref:setNode,initial:false,animate:target,transition:transition,style:{...componentProps.style,zIndex:cfg.z,willChange:\"transform\",...cfg.style}});}// ─── Overrides ───────────────────────────────────────────────────────────────\nexport function withFolderRoot(Component){return props=>/*#__PURE__*/_jsx(Component,{...props,[ROOT_ATTR]:\"\",style:{...props.style,overflow:\"visible\"}});}export function withFrontLayer(Component){const cfg={rest:FRONT.rest,open:FRONT.open,reducedOpen:REDUCED_FLAT,openSpring:SPRING_FRONT_OPEN,closeSpring:SPRING_FRONT_CLOSE,delay:DELAY.front,z:Z.front,style:{transformOrigin:\"50% 100%\",transformPerspective:PERSPECTIVE,backfaceVisibility:\"hidden\"}};return props=>/*#__PURE__*/_jsx(AnimatedLayer,{Component:Component,componentProps:props,cfg:cfg});}export function withFolderBack(Component){const cfg={rest:BACK.rest,open:BACK.open,reducedOpen:REDUCED_FLAT,openSpring:SPRING_FRONT_OPEN,closeSpring:SPRING_FRONT_CLOSE,delay:DELAY.back,z:Z.back,style:{transformOrigin:\"50% 100%\",transformPerspective:PERSPECTIVE}};return props=>/*#__PURE__*/_jsx(AnimatedLayer,{Component:Component,componentProps:props,cfg:cfg});}const paperStyle={transformOrigin:\"50% 100%\"};export function withPaperLeft(Component){const cfg={rest:PAPER_LEFT.rest,open:PAPER_LEFT.open,reducedOpen:REDUCED_PAPER_OPEN,openSpring:SPRING_PAPER_OPEN,closeSpring:SPRING_PAPER_CLOSE,delay:DELAY.left,z:Z.left,style:paperStyle};return props=>/*#__PURE__*/_jsx(AnimatedLayer,{Component:Component,componentProps:props,cfg:cfg});}export function withPaperCenter(Component){const cfg={rest:PAPER_CENTER.rest,open:PAPER_CENTER.open,reducedOpen:REDUCED_PAPER_OPEN,openSpring:SPRING_PAPER_OPEN,closeSpring:SPRING_PAPER_CLOSE,delay:DELAY.center,z:Z.center,style:paperStyle};return props=>/*#__PURE__*/_jsx(AnimatedLayer,{Component:Component,componentProps:props,cfg:cfg});}export function withPaperRight(Component){const cfg={rest:PAPER_RIGHT.rest,open:PAPER_RIGHT.open,reducedOpen:REDUCED_PAPER_OPEN,openSpring:SPRING_PAPER_OPEN,closeSpring:SPRING_PAPER_CLOSE,delay:DELAY.right,z:Z.right,style:paperStyle};return props=>/*#__PURE__*/_jsx(AnimatedLayer,{Component:Component,componentProps:props,cfg:cfg});}\nexport const __FramerMetadata__ = {\"exports\":{\"withPaperLeft\":{\"type\":\"reactHoc\",\"name\":\"withPaperLeft\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFolderRoot\":{\"type\":\"reactHoc\",\"name\":\"withFolderRoot\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFolderBack\":{\"type\":\"reactHoc\",\"name\":\"withFolderBack\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFrontLayer\":{\"type\":\"reactHoc\",\"name\":\"withFrontLayer\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPaperRight\":{\"type\":\"reactHoc\",\"name\":\"withPaperRight\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPaperCenter\":{\"type\":\"reactHoc\",\"name\":\"withPaperCenter\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FolderOpen.map"],"mappings":"0KA8BiI,SAAS,EAAc,EAAK,CAAC,GAAK,CAAC,EAAK,GAASA,EAAS,EAAK,EAEgO,OAF9N,MAAc,CAAC,GAAG,CAAC,EAAK,OAC1N,IAAM,EAAK,EAAK,QAAQ,IAAI,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