{"version":3,"file":"AudioFaderMenu.Bd3dayIB.mjs","names":[],"sources":["https:/framerusercontent.com/modules/doV5Zw6nITJbDRnuicaK/4wpDMBNf4QIoVRxJdL55/AudioFaderMenu.js"],"sourcesContent":["// Audio Console Fader Menu with scalable size\n// User can adjust overall scale to make everything smaller or bigger\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useRef,useCallback,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";const defaultLinks=[{label:\"Home\",link:\"#home\"},{label:\"Work\",link:\"#work\"},{label:\"About\",link:\"#about\"},{label:\"Contact\",link:\"#contact\"}];/**\n * Audio Console Fader Menu (scalable)\n *\n * @framerIntrinsicWidth 320\n * @framerIntrinsicHeight 400\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function AudioFaderMenu(props){const{menuItems=defaultLinks,backgroundColor=\"#181A1B\",faderColor=\"#444\",itemColor=\"#fff\",itemFont,scale=1,style}=props;const isStatic=useIsStaticRenderer();const[fader,setFader]=useState(0);const[hasDragged,setHasDragged]=useState(false);const dragging=useRef(false);const containerRef=useRef(null);// Fader range: 0 (down) to 1 (up)\nconst handleDrag=useCallback(e=>{if(!containerRef.current)return;const rect=containerRef.current.getBoundingClientRect();let y=e.touches?e.touches[0].clientY:e.clientY;let rel=1-Math.min(1,Math.max(0,(y-rect.top)/rect.height));startTransition(()=>setFader(rel));},[]);const handleDown=e=>{e.preventDefault&&e.preventDefault();// Detect tap/click (not drag): if not dragging, toggle up/down\nif((e.type===\"touchstart\"||e.type===\"mousedown\")&&!dragging.current){if(e.touches&&e.touches.length>1)return;if(fader<.05){startTransition(()=>setFader(1));setTimeout(()=>{startTransition(()=>setHasDragged(true));},300);}else if(fader>.95){startTransition(()=>setFader(0));setTimeout(()=>{startTransition(()=>setHasDragged(false));},300);}return;}dragging.current=true;handleDrag(e);window.addEventListener(\"mousemove\",handleDrag);window.addEventListener(\"touchmove\",handleDrag);window.addEventListener(\"mouseup\",handleUp);window.addEventListener(\"touchend\",handleUp);if(!hasDragged)startTransition(()=>setHasDragged(true));// Prevent accidental drag on click/tap\nif(e.type===\"mousedown\"||e.type===\"touchstart\"){window.addEventListener(\"click\",handleUp,{once:true});}// Fix: prevent accidental drag after click/tap\nif(e.type===\"mousedown\"||e.type===\"touchstart\"){setTimeout(()=>{dragging.current=false;},0);}};const handleUp=()=>{dragging.current=false;window.removeEventListener(\"mousemove\",handleDrag);window.removeEventListener(\"touchmove\",handleDrag);window.removeEventListener(\"mouseup\",handleUp);window.removeEventListener(\"touchend\",handleUp);};// For static preview, show fader at 1\nconst faderValue=isStatic?1:fader;// Fix: faderKnobBottom should go from 0 (bottom) to max (top)\n// Scalable sizes\nconst base=1*scale;const faderTrackW=32*base;const faderTrackH=260*base;const faderStemW=12*base;const faderStemR=6*base;const faderKnobW=32*base;const faderKnobH=32*base;const faderKnobR=6*base;const faderKnobBottom=faderValue*(faderTrackH-faderKnobH);const arrowSize=18*base;const menuMinW=120*base;const menuGap=8*base;const menuMarginTop=24*base;const containerPad=32*base;const[hoveredIndex,setHoveredIndex]=useState(-1);return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{...style,position:\"relative\",width:\"100%\",height:\"100%\",background:backgroundColor,borderRadius:16*base,overflow:\"hidden\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"flex-end\",padding:containerPad,boxSizing:\"border-box\",gap:0},children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"row\",alignItems:\"flex-start\",width:\"100%\",justifyContent:\"center\",gap:0},children:[/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:faderTrackW,height:faderTrackH,background:\"transparent\",display:\"flex\",alignItems:\"flex-end\",justifyContent:\"center\",marginRight:8*base},children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",left:\"50%\",top:0,width:faderStemW,height:faderTrackH,background:itemColor,borderRadius:faderStemR,transform:\"translateX(-50%)\"}}),/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",left:\"50%\",bottom:faderKnobBottom,width:faderKnobW,height:faderKnobH,background:itemColor,borderRadius:faderKnobR,boxShadow:\"none\",cursor:isStatic?\"default\":\"grab\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",userSelect:\"none\",transition:isStatic?\"none\":\"bottom 0.5s cubic-bezier(.4,1.6,.6,1)\",zIndex:2,transform:\"translateX(-50%)\"},tabIndex:0,role:\"slider\",\"aria-valuenow\":Math.round(faderValue*100),\"aria-valuemin\":0,\"aria-valuemax\":100,\"aria-orientation\":\"vertical\",onMouseDown:isStatic?undefined:handleDown,onTouchStart:isStatic?undefined:handleDown,children:[/*#__PURE__*/_jsx(\"div\",{style:{width:20*base,height:3*base,background:backgroundColor,borderRadius:2*base,opacity:1,position:\"absolute\",top:10*base,left:6*base}}),/*#__PURE__*/_jsx(\"div\",{style:{width:20*base,height:3*base,background:backgroundColor,borderRadius:2*base,opacity:1,position:\"absolute\",top:19*base,left:6*base}}),faderValue<.05&&!hasDragged&&!isStatic&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",left:\"50%\",bottom:-18*base,transform:\"translateX(-50%)\",animation:\"faderArrowPulse 1.2s infinite\",pointerEvents:\"none\",zIndex:3},children:/*#__PURE__*/_jsxs(\"svg\",{width:arrowSize,height:arrowSize,viewBox:\"0 0 18 18\",fill:\"none\",\"aria-hidden\":\"true\",children:[/*#__PURE__*/_jsx(\"path\",{d:\"M9 4L9 14\",stroke:backgroundColor,strokeWidth:2*base,strokeLinecap:\"round\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M5 8L9 4L13 8\",stroke:backgroundColor,strokeWidth:2*base,strokeLinecap:\"round\"})]})})]})]}),/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",flexDirection:\"column\",alignItems:\"flex-start\",justifyContent:\"flex-start\",gap:0,marginTop:menuMarginTop,marginLeft:0,minWidth:menuMinW},children:menuItems.map((item,i)=>{// Each item appears as fader increases. Staggered fade-in.\n// Fix: ensure last item is fully revealed when fader is all the way up\nconst appearAt=(i+1)/(menuItems.length+1);let t=Math.max(0,Math.min(1,(faderValue-appearAt)*2+.1));if(faderValue>=1)t=1;const isHovered=hoveredIndex===i;const scaleVal=isHovered?1.1*(.8+.2*t):.8+.2*t;return /*#__PURE__*/_jsx(\"a\",{href:item.link,style:{pointerEvents:t>.1?\"auto\":\"none\",opacity:t,transform:`scale(${scaleVal})`,color:itemColor,textDecoration:\"none\",transition:isStatic?\"none\":\"opacity 0.5s, transform 0.3s cubic-bezier(.4,1.6,.6,1)\",...itemFont,fontWeight:undefined,fontStyle:undefined,fontSize:undefined,letterSpacing:undefined,lineHeight:undefined,textAlign:itemFont?.textAlign||\"left\",minWidth:\"max-content\",marginBottom:0,marginTop:i===0?0:menuGap,padding:0},\"aria-label\":item.label,onMouseEnter:()=>setHoveredIndex(i),onMouseLeave:()=>setHoveredIndex(-1),onFocus:()=>setHoveredIndex(i),onBlur:()=>setHoveredIndex(-1),children:item.label},i);})})]}),/*#__PURE__*/_jsx(\"style\",{children:`\n        @keyframes faderArrowPulse {\n          0% { opacity: 0.5; transform: translateX(-50%) translateY(0) scale(1); }\n          50% { opacity: 1; transform: translateX(-50%) translateY(-6px) scale(1.15); }\n          100% { opacity: 0.5; transform: translateX(-50%) translateY(0) scale(1); }\n        }\n      `})]});}addPropertyControls(AudioFaderMenu,{menuItems:{type:ControlType.Array,title:\"Menu Items\",control:{type:ControlType.Object,controls:{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Menu\"},link:{type:ControlType.Link,title:\"Link\",defaultValue:\"#\"}}},defaultValue:defaultLinks,maxCount:6},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#181A1B\"},faderColor:{type:ControlType.Color,title:\"Fader Color\",defaultValue:\"#444\"},itemColor:{type:ControlType.Color,title:\"Item Color\",defaultValue:\"#fff\"},itemFont:{type:ControlType.Font,title:\"Item Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:24,variant:\"Bold\",letterSpacing:\"-0.01em\",lineHeight:\"1.1em\",textAlign:\"center\"}},scale:{type:ControlType.Number,title:\"Scale\",defaultValue:1,min:.5,max:2,step:.05,unit:\"x\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AudioFaderMenu\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"400\",\"framerIntrinsicWidth\":\"320\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AudioFaderMenu.map"],"mappings":"iWAUG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,YAAU,EAAa,kBAAgB,UAAU,aAAW,OAAO,YAAU,OAAO,WAAS,QAAM,EAAE,QAAM,CAAC,EAAY,EAAS,GAAqB,CAAM,CAAC,EAAM,EAAS,CAAC,EAAS,EAAE,CAAM,CAAC,EAAW,EAAc,CAAC,GAAS,EAAM,CAAO,EAAS,GAAO,EAAM,CAAO,EAAa,EAAO,KAAK,CACtV,EAAW,EAAY,GAAG,CAAC,IAAI,EAAa,QAAQ,OAAO,IAAM,EAAK,EAAa,QAAQ,uBAAuB,CAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,GAAG,QAAQ,EAAE,QAAY,EAAI,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI,GAAG,EAAE,EAAK,KAAK,EAAK,OAAO,CAAC,CAAC,EAAgB,IAAI,EAAS,EAAI,CAAC,AAAE,EAAC,CAAE,EAAC,CAAO,EAAW,GAAG,CAChS,GADiS,EAAE,gBAAgB,EAAE,gBAAgB,EACjU,EAAE,OAAO,cAAc,EAAE,OAAO,eAAe,EAAS,QAAQ,CAAC,GAAG,EAAE,SAAS,EAAE,QAAQ,OAA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