{"version":3,"file":"CTMButton.BMVkIRbs.mjs","names":["useId","useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/coEE8vbJi8iEBGcyPM3W/GXWMJDbsgERxsbLL2sj7/CTMButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useId,useRef}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * CTM Button\n *\n * La pillola \"Parliamone\" del brand con tre animazioni a scelta:\n * Shimmer (riflesso periodico + scale in hover), Carica (riempimento\n * verde con scossa del fulmine), Elettrico (bottone magnetico con\n * scarica che corre sul bordo). Due stili: Fill (pieno) e Stroke\n * (sfondo trasparente + bordo nel colore del testo; in Carica il\n * riempimento usa BG come colore del testo).\n *\n * @framerIntrinsicWidth 220\n * @framerIntrinsicHeight 64\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any\n */export default function CTMButton(props){const{label=\"Parliamone\",animation=\"elettrico\",variant=\"fill\",strokeWidth=1.5,bg=\"#0A0A0A\",fg=\"#00FFAD\",hoverFg,showBolt=true,boltSize=20,gap=12,padding=\"20px 36px\",pill=true,radius=12,link,newTab=false,labelFont,style}=props;const isStatic=useIsStaticRenderer();const rawId=useId();const cls=\"ctmb\"+rawId.replace(/[^a-zA-Z0-9]/g,\"\");const rootRef=useRef(null);const ringRef=useRef(null);const r=pill?999:Math.max(0,radius);useEffect(()=>{if(isStatic||typeof window===\"undefined\")return;if(animation!==\"elettrico\")return;const el=rootRef.current;const ring=ringRef.current;if(!el||!ring)return;const update=()=>{const h=el.getBoundingClientRect().height;// pillola: segue l'altezza; raggio custom: raggio esterno del ring (+3)\nconst rx=pill?(h+8)/2-1:Math.min(r+3,(h+8)/2-1);ring.setAttribute(\"rx\",String(Math.max(2,rx)));};update();const ro=new ResizeObserver(update);ro.observe(el);return()=>ro.disconnect();},[isStatic,animation,pill,r]);const boltClip=\"polygon(59% 0, 0 57%, 44% 60%, 41% 100%, 100% 40%, 56% 38%)\";let css=`\n.${cls} {\n    position: relative;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    gap: ${gap}px;\n    box-sizing: border-box;\n    border: ${variant===\"stroke\"?`${strokeWidth}px solid ${fg}`:\"none\"};\n    border-radius: ${r}px;\n    background: ${variant===\"stroke\"?\"transparent\":bg};\n    color: ${fg};\n    padding: ${padding};\n    cursor: pointer;\n    text-decoration: none;\n    -webkit-tap-highlight-color: transparent;\n}\n.${cls}:focus { outline: none; }\n.${cls}:focus-visible { outline: 2px solid ${fg}; outline-offset: 3px; }\n.${cls} .ctmb-label, .${cls} .ctmb-bolt { position: relative; z-index: 1; }\n.${cls} .ctmb-bolt {\n    display: inline-block; width: ${boltSize*.75}px; height: ${boltSize}px; flex: none;\n    background: ${fg};\n    clip-path: ${boltClip};\n}`;// colore hover custom di testo+fulmine (vuoto = nessun cambio);\n// per Carica l'override sta nel suo blocco (regole con delay)\nif(!isStatic&&hoverFg&&animation!==\"carica\"){css+=`\n.${cls} .ctmb-label, .${cls} .ctmb-bolt { transition: color 0.3s ease, background 0.3s ease; }\n.${cls}:hover .ctmb-label { color: ${hoverFg}; }\n.${cls}:hover .ctmb-bolt { background: ${hoverFg}; }`;}if(!isStatic&&animation===\"shimmer\"){css+=`\n.${cls} { overflow: hidden; transition: box-shadow 0.3s ease; }\n.${cls}-root { transition: transform 0.3s cubic-bezier(0.2,0.8,0.2,1); }\n.${cls}-root:hover { transform: scale(1.045); }\n.${cls}::before {\n    content: '';\n    position: absolute; top: -20%; bottom: -20%; width: 55%; left: 0;\n    background: linear-gradient(105deg, transparent 0%, color-mix(in srgb, ${fg} 24%, transparent) 45%, rgba(255,255,255,0.30) 50%, color-mix(in srgb, ${fg} 24%, transparent) 55%, transparent 100%);\n    transform: translateX(-180%) skewX(-18deg);\n    will-change: transform;\n    animation: ${cls}-sweep 3.4s cubic-bezier(0.6,0.1,0.3,0.9) infinite;\n}\n/* animare \"left\" fa layout a ogni frame anche fuori viewport: con transform\n   il riflesso viaggia sul compositor */\n@keyframes ${cls}-sweep {\n    0%, 55% { transform: translateX(-180%) skewX(-18deg); }\n    100% { transform: translateX(320%) skewX(-18deg); }\n}\n.${cls}-root:hover .${cls} { box-shadow: 0 8px 32px color-mix(in srgb, ${fg} 35%, transparent); }`;}if(!isStatic&&animation===\"carica\"){css+=`\n.${cls} { overflow: hidden; }\n.${cls} .ctmb-fill {\n    position: absolute; inset: -2px;\n    border-radius: ${pill?999:r+2}px;\n    background: ${fg};\n    transform: scaleX(0); transform-origin: left;\n    transition: transform 1.1s cubic-bezier(0.3,0,0.2,1);\n}\n.${cls}:hover .ctmb-fill { transform: scaleX(1); }\n.${cls} { transition: background-color 0s linear 0s; }\n.${cls}:hover { background-color: ${fg}; transition: background-color 0s linear 1.05s; }\n.${cls} .ctmb-label { transition: color 0.35s ease 0.45s; }\n.${cls} .ctmb-bolt { transition: background 0.35s ease 0.45s; }\n.${cls}:hover .ctmb-label { color: ${hoverFg??bg}; }\n.${cls}:hover .ctmb-bolt { background: ${hoverFg??bg}; animation: ${cls}-shake 0.5s ease-in-out 0.55s; }\n@keyframes ${cls}-shake {\n    0%, 100% { transform: none; }\n    20% { transform: translateX(-2px) rotate(-6deg); }\n    40% { transform: translateX(2px) rotate(6deg); }\n    60% { transform: translateX(-2px) rotate(-4deg); }\n    80% { transform: translateX(1px) rotate(3deg); }\n}\n.${cls}::after {\n    content: '';\n    position: absolute; inset: -3px;\n    border-radius: ${pill?999:r+3}px;\n    border: 2px solid ${fg};\n    opacity: 0; transform: scale(0.9);\n    pointer-events: none;\n}\n.${cls}:hover::after { animation: ${cls}-ring 0.6s ease-out 1.05s; }\n@keyframes ${cls}-ring {\n    0% { opacity: 0.9; transform: scale(0.96); }\n    100% { opacity: 0; transform: scale(1.35); }\n}`;}if(!isStatic&&animation===\"elettrico\"){css+=`\n.${cls} { transition: transform 0.15s ease-out; overflow: visible; }\n.${cls} .ctmb-ring {\n    position: absolute; inset: -4px;\n    width: calc(100% + 8px); height: calc(100% + 8px);\n    pointer-events: none; overflow: visible;\n}\n.${cls} .ctmb-ring rect {\n    fill: none;\n    stroke: ${fg};\n    stroke-width: 2;\n    stroke-dasharray: 46 640;\n    stroke-linecap: round;\n    opacity: 0;\n    filter: drop-shadow(0 0 6px ${fg});\n}\n/* la scarica girava in loop anche a opacity 0 — cio\\xe8 sempre, e su touch\n   senza mai essere vista */\n.${cls}:hover .ctmb-ring rect {\n    opacity: 1;\n    animation: ${cls}-travel 2.4s linear infinite;\n}\n@keyframes ${cls}-travel { 0% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -686; } }\n.${cls}:hover .ctmb-bolt { animation: ${cls}-flicker 0.8s steps(2, end) infinite; }\n@keyframes ${cls}-flicker {\n    0%, 45%, 55%, 82%, 100% { opacity: 1; }\n    50% { opacity: 0.35; }\n    78% { opacity: 0.6; }\n}`;}css+=`\n@media (prefers-reduced-motion: reduce) {\n    .${cls}, .${cls}-root, .${cls}::before, .${cls}::after,\n    .${cls} .ctmb-fill, .${cls} .ctmb-bolt, .${cls} .ctmb-ring rect {\n        animation: none !important;\n        transition: none !important;\n    }\n}`;const magnetic=!isStatic&&animation===\"elettrico\"?{onMouseMove:e=>{const el=rootRef.current;if(!el)return;const r=el.getBoundingClientRect();const dx=(e.clientX-r.left-r.width/2)/r.width;const dy=(e.clientY-r.top-r.height/2)/r.height;el.style.transform=`translate(${dx*10}px, ${dy*8}px)`;},onMouseLeave:()=>{const el=rootRef.current;if(el)el.style.transform=\"\";}}:{};const inner=/*#__PURE__*/_jsxs(_Fragment,{children:[animation===\"carica\"&&!isStatic&&/*#__PURE__*/_jsx(\"span\",{className:\"ctmb-fill\",\"aria-hidden\":\"true\"}),animation===\"elettrico\"&&!isStatic&&/*#__PURE__*/_jsx(\"svg\",{className:\"ctmb-ring\",\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"rect\",{ref:ringRef,x:\"1\",y:\"1\",rx:\"40\",width:\"calc(100% - 2px)\",height:\"calc(100% - 2px)\"})}),/*#__PURE__*/_jsx(\"span\",{className:\"ctmb-label\",style:{fontSize:20,fontWeight:500,whiteSpace:\"nowrap\",...labelFont},children:label}),showBolt&&/*#__PURE__*/_jsx(\"span\",{className:\"ctmb-bolt\",\"aria-hidden\":\"true\"})]});const shared={className:cls,style:{flex:1,width:\"100%\",height:\"100%\"},...magnetic};return /*#__PURE__*/_jsxs(\"div\",{className:`${cls}-root`,style:{...style,display:\"flex\",position:\"relative\"},children:[/*#__PURE__*/_jsx(\"style\",{dangerouslySetInnerHTML:{__html:css}}),link?/*#__PURE__*/_jsx(\"a\",{...shared,ref:rootRef,href:link,target:newTab?\"_blank\":undefined,rel:newTab?\"noopener noreferrer\":undefined,children:inner}):/*#__PURE__*/_jsx(\"button\",{...shared,ref:rootRef,type:\"button\",children:inner})]});}addPropertyControls(CTMButton,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Parliamone\"},animation:{type:ControlType.Enum,title:\"Animation\",options:[\"shimmer\",\"carica\",\"elettrico\"],optionTitles:[\"Shimmer\",\"Carica\",\"Elettrico\"],defaultValue:\"elettrico\"},variant:{type:ControlType.Enum,title:\"Style\",options:[\"fill\",\"stroke\"],optionTitles:[\"Fill\",\"Stroke\"],defaultValue:\"fill\",displaySegmentedControl:true},strokeWidth:{type:ControlType.Number,title:\"Stroke Width\",defaultValue:1.5,min:1,max:4,step:.5,unit:\"px\",hidden:props=>props.variant!==\"stroke\"},bg:{type:ControlType.Color,title:\"BG\",description:\"Stroke: text color when Carica fills\",defaultValue:\"#0A0A0A\"},fg:{type:ControlType.Color,title:\"Text & Bolt\",defaultValue:\"#00FFAD\"},hoverFg:{type:ControlType.Color,title:\"Text & Bolt Hover\",optional:true,description:\"Empty = no change on hover\"},showBolt:{type:ControlType.Boolean,title:\"Bolt\",defaultValue:true},boltSize:{type:ControlType.Number,title:\"Bolt Size\",defaultValue:20,min:10,max:48,step:1,unit:\"px\",hidden:props=>!props.showBolt},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:12,min:0,max:40,step:1,unit:\"px\"},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"20px 36px\"},pill:{type:ControlType.Boolean,title:\"Pill\",defaultValue:true},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:12,min:0,max:80,step:1,unit:\"px\",hidden:props=>props.pill!==false},link:{type:ControlType.Link,title:\"Link\"},newTab:{type:ControlType.Boolean,title:\"New Tab\",defaultValue:false,hidden:props=>!props.link},labelFont:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"20px\",variant:\"Medium\",lineHeight:\"1em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CTMButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"220\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"64\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CTMButton.map"],"mappings":"4NAeG,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,QAAM,aAAa,YAAU,YAAY,UAAQ,OAAO,cAAY,IAAI,KAAG,UAAU,KAAG,UAAU,UAAQ,WAAS,GAAK,WAAS,GAAG,MAAI,GAAG,UAAQ,YAAY,OAAK,GAAK,SAAO,GAAG,OAAK,SAAO,GAAM,YAAU,SAAO,EAAY,EAAS,EAAoB,EAA4B,EAAI,OAAlBA,EAA6B,CAAC,CAAC,QAAQ,gBAAgB,EAAE,EAAQ,EAAQC,EAAO,IAAI,EAAQ,EAAQA,EAAO,IAAI,EAAQ,EAAE,EAAK,IAAI,KAAK,IAAI,EAAE,CAAM,EAAE,MAAc,CAAiD,GAA7C,GAAiB,IAAS,QAAsB,IAAY,YAAY,OAAO,IAAM,EAAG,EAAQ,QAAc,EAAK,E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