{"version":3,"file":"AudioButton.DToW-yS2.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/MhhTKYy6KZm94qUC1nYD/UpmugaQtWBzJaleb3kcn/AudioButton.js"],"sourcesContent":["// Simple minimalist button with speaker icon that toggles mute/unmute and plays attached audio\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useRef,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function AudioButton(props){const{audioFile=\"https://framerusercontent.com/assets/8w3IUatLX9a5JVJ6XPCVuHi94.mp3\",backgroundColor,iconColor,mutedIconColor,size,borderRadius,loop}=props;const[isMuted,setIsMuted]=useState(true);const[isPlaying,setIsPlaying]=useState(false);const audioRef=useRef(null);useEffect(()=>{if(audioRef.current){audioRef.current.loop=loop;}},[loop]);const handleClick=()=>{if(!audioRef.current)return;if(isMuted){audioRef.current.play();startTransition(()=>{setIsMuted(false);setIsPlaying(true);});}else{audioRef.current.pause();audioRef.current.currentTime=0;startTransition(()=>{setIsMuted(true);setIsPlaying(false);});}};const handleEnded=()=>{if(!loop){startTransition(()=>{setIsMuted(true);setIsPlaying(false);});}};return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",position:\"relative\"},children:[/*#__PURE__*/_jsx(\"audio\",{ref:audioRef,src:audioFile,onEnded:handleEnded}),/*#__PURE__*/_jsx(\"button\",{onClick:handleClick,style:{width:size,height:size,backgroundColor,border:\"none\",borderRadius,cursor:\"pointer\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",transition:\"transform 0.1s ease\",padding:0},onMouseDown:e=>{e.currentTarget.style.transform=\"scale(0.95)\";},onMouseUp:e=>{e.currentTarget.style.transform=\"scale(1)\";},onMouseLeave:e=>{e.currentTarget.style.transform=\"scale(1)\";},\"aria-label\":isMuted?\"Play audio\":\"Mute audio\",children:isMuted?/*#__PURE__*/_jsxs(\"svg\",{width:size*.5,height:size*.5,viewBox:\"0 0 24 24\",fill:\"none\",stroke:mutedIconColor,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:[/*#__PURE__*/_jsx(\"polygon\",{points:\"11 5 6 9 2 9 2 15 6 15 11 19 11 5\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"23\",y1:\"9\",x2:\"17\",y2:\"15\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"17\",y1:\"9\",x2:\"23\",y2:\"15\"})]}):/*#__PURE__*/_jsxs(\"svg\",{width:size*.5,height:size*.5,viewBox:\"0 0 24 24\",fill:\"none\",stroke:iconColor,strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:[/*#__PURE__*/_jsx(\"polygon\",{points:\"11 5 6 9 2 9 2 15 6 15 11 19 11 5\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M15.54 8.46a5 5 0 0 1 0 7.07\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M19.07 4.93a10 10 0 0 1 0 14.14\"})]})})]});}addPropertyControls(AudioButton,{audioFile:{type:ControlType.File,allowedFileTypes:[\"mp3\",\"wav\",\"ogg\"]},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#000000\"},iconColor:{type:ControlType.Color,title:\"Icon Color\",defaultValue:\"#FFFFFF\"},mutedIconColor:{type:ControlType.Color,title:\"Muted Icon\",defaultValue:\"#CCCCCC\"},size:{type:ControlType.Number,title:\"Size\",defaultValue:60,min:40,max:120,step:1,unit:\"px\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:30,min:0,max:60,step:1,unit:\"px\"},loop:{type:ControlType.Boolean,title:\"Loop Audio\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AudioButton\",\"slots\":[],\"annotations\":{\"framerContract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