{"version":3,"file":"Audio_Button.Crityg2i.mjs","names":["React.useRef","React.useState"],"sources":["https:/framerusercontent.com/modules/MKmKxepK0HjpFybt2gAF/aJZalpZe06JOOsUrsOsS/Audio_Button.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function Audio_Button(props){const audioRef=React.useRef(null);const[playing,setPlaying]=React.useState(false);const toggleAudio=async()=>{const audio=audioRef.current;if(!audio)return;if(playing){audio.pause();}else{try{await audio.play();}catch(e){console.warn(\"Playback failed:\",e);}}};// Ensure Poppins loads on published site\nReact.useEffect(()=>{const id=\"poppins-font-link\";if(document.getElementById(id))return;const link=document.createElement(\"link\");link.id=id;link.rel=\"stylesheet\";link.href=\"https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap\";document.head.appendChild(link);},[]);React.useEffect(()=>{const audio=audioRef.current;if(!audio)return;const onEnded=()=>setPlaying(false);const onPause=()=>setPlaying(false);const onPlay=()=>setPlaying(true);audio.addEventListener(\"ended\",onEnded);audio.addEventListener(\"pause\",onPause);audio.addEventListener(\"play\",onPlay);return()=>{audio.removeEventListener(\"ended\",onEnded);audio.removeEventListener(\"pause\",onPause);audio.removeEventListener(\"play\",onPlay);};},[]);const height=props.heightPx;const width=props.widthPx;const borderW=2;return /*#__PURE__*/_jsx(\"div\",{style:{width,height,display:\"flex\",alignItems:\"center\"},children:/*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",position:\"relative\",borderRadius:999,overflow:\"hidden\",boxSizing:\"border-box\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:0,borderRadius:999,border:`${borderW}px solid ${props.outlineColor}`,background:\"white\",boxSizing:\"border-box\",zIndex:0}}),/*#__PURE__*/_jsxs(\"button\",{onClick:toggleAudio,style:{all:\"unset\",position:\"relative\",zIndex:1,width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"flex-start\",gap:10,cursor:\"pointer\",boxSizing:\"border-box\",WebkitTapHighlightColor:\"transparent\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{width:height+borderW*2,height:height+borderW*2,marginLeft:-borderW*2,borderRadius:999,background:props.accentColor,display:\"grid\",placeItems:\"center\",flex:\"0 0 auto\",position:\"relative\",zIndex:2},children:playing?/*#__PURE__*/_jsxs(\"svg\",{width:height*.36,height:height*.36,viewBox:\"0 0 24 24\",fill:\"white\",children:[/*#__PURE__*/_jsx(\"rect\",{x:\"7\",y:\"2\",width:\"4\",height:\"18\",rx:\"1\"}),/*#__PURE__*/_jsx(\"rect\",{x:\"15\",y:\"2\",width:\"4\",height:\"18\",rx:\"1\"})]}):/*#__PURE__*/_jsx(\"svg\",{width:height*.52,height:height*.52,viewBox:\"0 0 24 24\",fill:\"white\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M8 5c0-.9 1-1.4 1.7-1l10 6c.7.4.7 1.5 0 1.9l-10 6c-.7.4-1.7-.1-1.7-1V5z\"})})}),/*#__PURE__*/_jsx(\"span\",{style:{fontFamily:\"Poppins, sans-serif\",fontSize:props.fontSize,fontWeight:500,color:props.textColor,whiteSpace:\"nowrap\",width:props.labelWidthPx,textAlign:\"left\",opacity:.95},children:playing?props.pauseLabel:props.playLabel}),/*#__PURE__*/_jsx(\"audio\",{ref:audioRef,src:props.audioUrl,preload:\"none\"})]})]})});}addPropertyControls(Audio_Button,{audioUrl:{type:ControlType.String,title:\"Audio URL\"},playLabel:{type:ControlType.String,title:\"Play label\",defaultValue:\"Preview\"},pauseLabel:{type:ControlType.String,title:\"Pause label\",defaultValue:\"Pause\"},accentColor:{type:ControlType.Color,title:\"Accent\",defaultValue:\"#E91E63\"},outlineColor:{type:ControlType.Color,title:\"Outline\",defaultValue:\"#E91E63\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#111111\"},widthPx:{type:ControlType.Number,title:\"Width\",defaultValue:112,min:80,max:400},heightPx:{type:ControlType.Number,title:\"Height\",defaultValue:32,min:32,max:80},labelWidthPx:{type:ControlType.Number,title:\"Label width\",defaultValue:112,min:50,max:200},fontSize:{type:ControlType.Number,title:\"Font size\",defaultValue:14,min:10,max:24}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Audio_Button\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Audio_Button.map"],"mappings":"+LAAyI,SAAwB,EAAa,EAAM,CAAC,IAAM,EAASA,EAAa,KAAK,CAAM,CAAC,EAAQ,GAAYC,EAAe,GAAM,CAAO,EAAY,SAAS,CAAC,IAAM,EAAM,EAAS,QAAY,KAAa,GAAG,EAAS,EAAM,OAAO,MAAO,GAAG,CAAC,MAAM,EAAM,MAAM,OAAQ,EAAE,CAAC,QAAQ,KAAK,mBAAmB,EAAE,GACpb,MAAoB,CAAC,IAAM,EAAG,oBAAoB,GAAG,SAAS,eAAe,EAAG,CAAC,OAAO,IAAM,EAAK,SAAS,cAAc,OAAO,CAAC,EAAK,GAAG,EAAG,EAAK,IAAI,aAAa,EAAK,KAAK,iFAAiF,SAAS,KAAK,YAAY,EAAK,EAAG,EAAE,CAAC,CAAC,MAAoB,CAAC,IAAM,EAAM,EAAS,QAAQ,GAAG,CAAC,EAAM,OAAO,IAAM,MAAY,EAAW,GAAM,CAAO,MAAY,EAAW,GAAM,CAAO,MAAW,EAAW,GAAK,CAAuH,OAAtH,EAAM,iBAAiB,QAAQ,EAAQ,CAAC,EAAM,iBAAiB,QAAQ,EAAQ,CAAC,EAAM,iBAAiB,OAAO,EAAO,KAAW,CAAC,EAAM,oBAAoB,QAAQ,EAAQ,CAAC,EAAM,oBAAoB,QAAQ,EAAQ,CAAC,EAAM,oBAAoB,OAAO,EAAO,GAAK,EAAE,CAAC,CAAC,IAAM,EAAO,EAAM,SAAe,EAAM,EAAM,QAAwB,OAAoB,EAAK,M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