{"version":3,"file":"WhatsappButton.Dh2k0STf.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/9jirl4XcYAnvDblSTbxg/I684JzmXo0XAs1ueToYg/WhatsappButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect,useRef,startTransition}from\"react\";export default function WhatsAppProfessional(props){const{text,font,isMobile,borderRadius,link,style}=props;const containerRef=useRef(null);const[scaleFactor,setScaleFactor]=useState(1);const[isHovered,setIsHovered]=useState(false);// Colore ufficiale WhatsApp\nconst WA_GREEN=\"#25D366\";useEffect(()=>{const updateScale=()=>{if(!containerRef.current)return;const width=containerRef.current.offsetWidth;const clampedWidth=Math.max(200,Math.min(800,width));startTransition(()=>{setScaleFactor(clampedWidth/375);});};const ro=new ResizeObserver(updateScale);if(containerRef.current)ro.observe(containerRef.current);updateScale();return()=>ro.disconnect();},[]);const activeHover=isHovered&&!isMobile;const fontSize=(font?.fontSize||18)*scaleFactor;const btnHeight=fontSize*3;const anchor=6*scaleFactor;const iconWrapSize=btnHeight-anchor*2;const customEase=\"cubic-bezier(0.4, 0, 0.2, 1)\";const duration=\"0.4s\";return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",display:\"flex\"},children:/*#__PURE__*/_jsxs(\"a\",{href:link,target:\"_blank\",onMouseEnter:()=>setIsHovered(true),onMouseLeave:()=>setIsHovered(false),style:{...style,textDecoration:\"none\",position:\"relative\",display:\"flex\",alignItems:\"center\",height:btnHeight,// Padding calcolato per lasciare spazio all'icona a sinistra\npaddingLeft:iconWrapSize+anchor*2.5,paddingRight:fontSize*1.5,backgroundColor:WA_GREEN,borderRadius:borderRadius*scaleFactor,border:\"none\",cursor:\"pointer\",overflow:\"hidden\",marginRight:\"auto\",width:\"auto\",outline:\"none\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{...font,fontSize:`${fontSize}px`,color:\"#FFFFFF\",fontWeight:font?.fontWeight||600,zIndex:1,whiteSpace:\"nowrap\",pointerEvents:\"none\",transition:`all ${duration} ${customEase}`,opacity:activeHover?0:1,transform:activeHover?`scale(0.95) translateX(10px)`:\"translateX(0)\"},children:text}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:anchor,left:anchor,bottom:anchor,// Si espande verso destra coprendo il testo\nright:activeHover?anchor:`calc(100% - ${iconWrapSize+anchor}px)`,backgroundColor:WA_GREEN,borderRadius:activeHover?borderRadius*scaleFactor*.9:\"50%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",transition:`all ${duration} ${customEase}`,zIndex:2,willChange:\"right, border-radius\"},children:/*#__PURE__*/_jsx(\"svg\",{viewBox:\"0 0 24 24\",width:fontSize*1.4,height:fontSize*1.4,fill:\"white\",style:{transition:`transform ${duration} ${customEase}`,transform:activeHover?\"scale(1.1)\":\"scale(1)\",// L'icona rimane visivamente fissa a sinistra mentre il wrap si espande\nposition:\"absolute\",left:activeHover?`calc(50% - ${fontSize*1.4/2}px)`// Centra nel bottone espanso\n:`calc(50% - ${fontSize*1.4/2}px)`},children:/*#__PURE__*/_jsx(\"path\",{d:\"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L0 24l6.335-1.662c1.72.938 3.659 1.432 5.633 1.433h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z\"})})})]})});}addPropertyControls(WhatsAppProfessional,{link:{type:ControlType.Link,title:\"Link\"},text:{type:ControlType.String,title:\"Testo\",defaultValue:\"Contattaci su WhatsApp\"},isMobile:{type:ControlType.Boolean,title:\"No Hover (Mobile)\",defaultValue:false},font:{type:ControlType.Font,title:\"Font\"},borderRadius:{type:ControlType.Number,title:\"Raggio\",defaultValue:100}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"WhatsAppProfessional\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WhatsappButton.map"],"mappings":"sMAA0K,SAAwB,EAAqB,EAAM,CAAC,GAAK,CAAC,OAAK,OAAK,WAAS,eAAa,OAAK,SAAO,EAAY,EAAaA,EAAO,KAAK,CAAM,CAAC,EAAY,GAAgBC,EAAS,EAAE,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAC3Y,EAAS,UAAU,MAAc,CAAC,IAAM,MAAgB,CAAC,GAAG,CAAC,EAAa,QAAQ,OAAO,IAAM,EAAM,EAAa,QAAQ,YAAkB,EAAa,KAAK,IAAI,IAAI,KAAK,IAAI,IAAI,EAAM,CAAC,CAAC,MAAoB,CAAC,EAAe,EAAa,IAAI,EAAG,EAAS,EAAG,IAAI,eAAe,EAAY,CAAwE,OAApE,EAAa,SAAQ,EAA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