{"version":3,"file":"AudioPlayerButton.VgexYcwk.mjs","names":["useRef","useState","startTransition","p"],"sources":["https:/framerusercontent.com/modules/6bP8kKMcmjyMBZ4dtW9J/8B86K6ARsC5yHBNNpDKj/AudioPlayerButton.js"],"sourcesContent":["// Play/Pause Button with Sound\n// Plays a sound on click, toggles icon between play and pause\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useRef,useState,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * AudioPlayerButton\n *\n * @framerIntrinsicWidth 180\n * @framerIntrinsicHeight 48\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function AudioPlayerButton(props){const{label,audioFile=\"https://framerusercontent.com/assets/8w3IUatLX9a5JVJ6XPCVuHi94.mp3\",background,textColor,iconColor,borderRadius,font,style}=props;const audioRef=useRef(null);const[playing,setPlaying]=useState(false);const[isHovered,setIsHovered]=useState(false);useEffect(()=>{if(!audioRef.current)return;const audio=audioRef.current;const handleEnded=()=>startTransition(()=>setPlaying(false));audio.addEventListener(\"ended\",handleEnded);return()=>audio.removeEventListener(\"ended\",handleEnded);},[]);useEffect(()=>{if(!audioRef.current)return;if(playing){audioRef.current.play();}else{audioRef.current.pause();audioRef.current.currentTime=0;}},[playing]);function handleClick(){startTransition(()=>setPlaying(p=>!p));}if(RenderTarget.current()===RenderTarget.thumbnail)return null;return /*#__PURE__*/_jsxs(\"button\",{style:{...style,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",gap:8,background:isHovered?\"#DADCE3\":background,color:textColor,border:\"none\",borderRadius,padding:\"12px 24px\",cursor:\"pointer\",outline:\"none\",transition:\"background 0.2s ease-in-out\",...font},onClick:handleClick,onMouseEnter:()=>setIsHovered(true),onMouseLeave:()=>setIsHovered(false),\"aria-pressed\":playing,type:\"button\",children:[/*#__PURE__*/_jsx(\"span\",{style:{display:\"flex\",alignItems:\"center\"},children:playing?// Pause icon\n/*#__PURE__*/_jsxs(\"svg\",{width:\"22\",height:\"22\",viewBox:\"0 0 22 22\",fill:\"none\",\"aria-label\":\"Pause\",style:{display:\"block\"},children:[/*#__PURE__*/_jsx(\"rect\",{x:\"5\",y:\"4\",width:\"4\",height:\"14\",rx:\"1.5\",fill:iconColor}),/*#__PURE__*/_jsx(\"rect\",{x:\"13\",y:\"4\",width:\"4\",height:\"14\",rx:\"1.5\",fill:iconColor})]}):// Play icon\n/*#__PURE__*/_jsx(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",width:\"24\",height:\"24\",viewBox:\"0 0 24 24\",fill:\"none\",children:/*#__PURE__*/_jsxs(\"g\",{children:[/*#__PURE__*/_jsx(\"path\",{d:\"M 0 0 L 24 0 L 24 24 L 0 24 Z\",fill:\"rgba(0, 0, 0, 0)\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M 12 2.25 C 6.615 2.25 2.25 6.615 2.25 12 C 2.25 17.385 6.615 21.75 12 21.75 C 17.385 21.75 21.75 17.385 21.75 12 C 21.744 6.618 17.382 2.256 12 2.25 Z M 15.802 12.617 L 10.927 15.992 C 10.697 16.15 10.399 16.168 10.152 16.039 C 9.905 15.909 9.751 15.654 9.75 15.375 L 9.75 8.625 C 9.75 8.346 9.905 8.09 10.152 7.96 C 10.399 7.831 10.698 7.849 10.927 8.008 L 15.802 11.383 C 16.005 11.523 16.126 11.754 16.126 12 C 16.126 12.246 16.005 12.477 15.802 12.617 Z\",fill:\"rgb(0, 18, 77)\"})]})})}),/*#__PURE__*/_jsx(\"span\",{style:{fontWeight:600},children:label}),/*#__PURE__*/_jsx(\"audio\",{ref:audioRef,src:audioFile,preload:\"auto\"})]});}addPropertyControls(AudioPlayerButton,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Listen Now\"},audioFile:{type:ControlType.File,allowedFileTypes:[\"mp3\",\"wav\",\"ogg\"]},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#D8D9DF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#00124D\"},iconColor:{type:ControlType.Color,title:\"Icon Color\",defaultValue:\"#00124D\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:100,min:0,max:100},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"Cabinet Grotesk\",defaultValue:{fontSize:\"18px\",variant:\"Bold\",letterSpacing:\"-0.01em\",lineHeight:\"100%\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AudioPlayerButton\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"180\",\"framerIntrinsicHeight\":\"48\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AudioPlayerButton.map"],"mappings":"6MAUG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,QAAM,YAAU,qEAAqE,aAAW,YAAU,YAAU,eAAa,OAAK,SAAO,EAAY,EAASA,EAAO,KAAK,CAAM,CAAC,EAAQ,GAAYC,EAAS,GAAM,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAC,MAAc,CAAC,GAAG,CAAC,EAAS,QAAQ,OAAO,IAAM,EAAM,EAAS,QAAc,MAAgBC,MAAoB,EAAW,GAAM,CAAC,CAA6C,OAA5C,EAAM,iBAAiB,QAAQ,EAAY,KAAW,EAAM,oBAAoB,QAAQ,EAAY,EAAG,EAAE,CAAC,CAAC,MAAc,CAAK,EAAS,UAAkB,EAAS,EAAS,QAAQ,MAAM,EAAO,EAAS,QAAQ,OAAO,CAAC,EAAS,QAAQ,YAAY,KAAK,CAAC,EAAQ,CAAC,CAAC,SAAS,GAAa,CAAC,MAAoB,EAAW,GAAG,CAACC,EAAE,CAAC,CAAiE,OAA5D,EAAa,SAAS,GAAG,EAAa,UAAiB,KAAyB,EAAM,SAAS,CAAC,MA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