{"version":3,"file":"MinecraftButton.bPZ1BYoX.mjs","names":["useState","useRef","startTransition"],"sources":["https:/framerusercontent.com/modules/KVsHzUO8fxBE0E6GT7Vp/07QGfPSWpUWhv9sYOEYJ/MinecraftButton.js"],"sourcesContent":["// Minecraft styled button with pixelated border and text\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useState,startTransition,useRef,useEffect}from\"react\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function MinecraftButton(props){const{text=\"Click me!\",backgroundColor=\"#7F7F7F\",borderColor=\"#000000\",textColor=\"#FFFFFF\",hoverTextColor=\"#FFFF00\",hoverBackgroundColor=\"#9F9F9F\",activeBackgroundColor=\"#5F5F5F\",font,glitterDelay=1500,link,style}=props;const[isHovered,setIsHovered]=useState(false);const[isActive,setIsActive]=useState(false);const[showGlitter,setShowGlitter]=useState(false);const hoverSoundRef=useRef(null);const clickSoundRef=useRef(null);const isStatic=useIsStaticRenderer();useEffect(()=>{if(typeof window!==\"undefined\"&&!isStatic){// Minecraft UI hover sound\nhoverSoundRef.current=new Audio(\"https://framerusercontent.com/assets/yJPqY3IWFxvvh4xdL0uXFGqXLs.mp3\");hoverSoundRef.current.volume=.3;hoverSoundRef.current.preload=\"auto\";// Minecraft UI click sound\nclickSoundRef.current=new Audio(\"https://framerusercontent.com/assets/gNle4E2MSGHZiHiwIUKybLPKWs.mp3\");clickSoundRef.current.volume=.4;clickSoundRef.current.preload=\"auto\";}},[]);// Glitter effect interval\nuseEffect(()=>{if(isStatic||isHovered)return;const glitterInterval=setInterval(()=>{startTransition(()=>setShowGlitter(true));setTimeout(()=>{startTransition(()=>setShowGlitter(false));},600);},glitterDelay);return()=>clearInterval(glitterInterval);},[isHovered,isStatic,glitterDelay]);const playHoverSound=()=>{if(hoverSoundRef.current){hoverSoundRef.current.currentTime=0;hoverSoundRef.current.play().catch(()=>{});}};const playClickSound=()=>{if(clickSoundRef.current){clickSoundRef.current.currentTime=0;clickSoundRef.current.play().catch(()=>{});}};const currentBackgroundColor=isActive?activeBackgroundColor:isHovered?hoverBackgroundColor:backgroundColor;const currentTextColor=isHovered?hoverTextColor:textColor;const buttonContent=/*#__PURE__*/_jsxs(\"button\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",backgroundColor:currentBackgroundColor,border:`4px solid ${borderColor}`,borderTop:`2px solid ${borderColor}`,borderLeft:`2px solid ${borderColor}`,borderRight:`6px solid ${borderColor}`,borderBottom:`6px solid ${borderColor}`,boxShadow:`inset 2px 2px 0 rgba(255, 255, 255, 0.3), inset -2px -2px 0 rgba(0, 0, 0, 0.3)`,cursor:\"pointer\",padding:\"16px 24px\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",transition:\"background-color 0.15s ease, transform 0.1s ease\",transform:isActive?\"scale(0.98)\":\"scale(1)\",imageRendering:\"pixelated\",overflow:\"hidden\",...style},onMouseEnter:()=>{playHoverSound();startTransition(()=>setIsHovered(true));},onMouseLeave:()=>{startTransition(()=>{setIsHovered(false);setIsActive(false);});},onMouseDown:()=>{playClickSound();startTransition(()=>setIsActive(true));},onMouseUp:()=>startTransition(()=>setIsActive(false)),children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\",backgroundImage:`url(\"data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E\")`,opacity:.15,pointerEvents:\"none\",imageRendering:\"pixelated\"}}),showGlitter&&!isHovered&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"-50%\",left:\"-20%\",width:\"30%\",height:\"200%\",background:\"linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent)\",transform:\"rotate(15deg)\",pointerEvents:\"none\",animation:\"glitterSweep 0.6s ease-out\",zIndex:2}}),/*#__PURE__*/_jsx(\"style\",{children:`\n                @keyframes glitterSweep {\n                    0% {\n                        left: -20%;\n                    }\n                    100% {\n                        left: 120%;\n                    }\n                }\n            `}),/*#__PURE__*/_jsx(\"span\",{style:{color:currentTextColor,textShadow:`2px 2px 0 rgba(0, 0, 0, 0.5)`,imageRendering:\"pixelated\",WebkitFontSmoothing:\"none\",MozOsxFontSmoothing:\"grayscale\",transition:\"color 0.15s ease\",position:\"relative\",zIndex:1,...font},children:text})]});if(link){return /*#__PURE__*/_jsx(\"a\",{href:link,style:{textDecoration:\"none\",display:\"block\",width:\"100%\",height:\"100%\"},children:buttonContent});}return buttonContent;}addPropertyControls(MinecraftButton,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Click me!\"},link:{type:ControlType.Link,title:\"Link\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#7F7F7F\"},hoverBackgroundColor:{type:ControlType.Color,title:\"Hover Background\",defaultValue:\"#9F9F9F\"},activeBackgroundColor:{type:ControlType.Color,title:\"Active Background\",defaultValue:\"#5F5F5F\"},borderColor:{type:ControlType.Color,title:\"Border Color\",defaultValue:\"#000000\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},hoverTextColor:{type:ControlType.Color,title:\"Hover Text Color\",defaultValue:\"#FFFF00\"},glitterDelay:{type:ControlType.Number,title:\"Glitter Delay\",defaultValue:1500,min:500,max:5e3,step:100,unit:\"ms\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"24px\",variant:\"Bold\",letterSpacing:\"0.05em\",lineHeight:\"1em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MinecraftButton\",\"slots\":[],\"annotations\":{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