{"version":3,"file":"ButtonSwap.DdueogP2.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/DpypvoqHvJipjWskisHD/ZlaPAHt7yWJKPdgrpYep/ButtonSwap.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Button Square (Text Swap)\n *\n * Matches the site's Button Square: sharp corners, blue fill, white label,\n * arrow-up-right, 20×30 padding. On hover the label scrolls up and a second\n * label (Hover Text) scrolls into place, and the arrow nudges up-right.\n *\n * Action modes:\n * - \"link\": renders an <a> pointing at the Link prop (original behavior)\n * - \"form\": dispatches a window event (\"ubswap:open-form\") carrying Form ID.\n *   Pair with a FormPopup component whose Form ID matches — it will open a\n *   modal containing a native Framer form.\n * - \"scroll\": scrolls to a layer on the same page, found by its layer name\n *   (Framer publishes layer names as data-framer-name). Used where Framer's\n *   link picker won't offer a nested section, e.g. /demo's \"Book a demo\".\n *   Only the copy visible at the current breakpoint is targeted.\n *\n * @framerIntrinsicWidth 180\n * @framerIntrinsicHeight 61\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function ButtonSwap(props){const{text,hoverText,action,formId,link,openInNewTab,scrollTarget,scrollOffset,background,color,showIcon,iconSize,fontSize,paddingX,paddingY,gap,borderRadius,duration,style}=props;const[hovered,setHovered]=useState(false);const lineH=Math.round(fontSize*1.2);// Vertical gap between the two stacked labels. Keeps the off-screen label\n// (and its ~1-2px glyph overflow) outside the clip window so nothing peeks.\nconst gapBetween=Math.round(fontSize*.5);const step=lineH+gapBetween;const ease=\"cubic-bezier(0.2, 0.8, 0.2, 1)\";const second=hoverText||text;const isForm=action===\"form\";const isScroll=action===\"scroll\";const rootStyle={display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",gap:gap,padding:`${paddingY}px ${paddingX}px`,background,color,borderRadius,overflow:\"hidden\",cursor:isForm||isScroll||link?\"pointer\":\"default\",textDecoration:\"none\",fontFamily:\"'Noto Sans', sans-serif\",fontWeight:600,fontSize,letterSpacing:\"-0.02em\",lineHeight:`${lineH}px`,boxSizing:\"border-box\",WebkitTapHighlightColor:\"transparent\",border:\"none\",...style};const windowStyle={height:lineH,width:\"fit-content\",overflow:\"hidden\"};const stackStyle={display:\"flex\",flexDirection:\"column\",alignItems:\"center\",gap:`${gapBetween}px`,transform:hovered?`translateY(-${step}px)`:\"translateY(0)\",transition:`transform ${duration}s ${ease}`,willChange:\"transform\"};const lineStyle={height:lineH,lineHeight:`${lineH}px`,whiteSpace:\"nowrap\",display:\"block\"};const arrowStyle={display:\"inline-flex\",flex:\"none\",color,transform:hovered?\"translate(3px, -3px)\":\"translate(0, 0)\",transition:`transform ${duration}s ${ease}`};const inner=/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{style:windowStyle,children:/*#__PURE__*/_jsxs(\"div\",{style:stackStyle,children:[/*#__PURE__*/_jsx(\"span\",{style:lineStyle,children:text}),/*#__PURE__*/_jsx(\"span\",{style:lineStyle,children:second})]})}),showIcon&&/*#__PURE__*/_jsx(\"span\",{style:arrowStyle,children:/*#__PURE__*/_jsx(\"svg\",{width:iconSize,height:iconSize,viewBox:\"0 0 24 24\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M7 17L17 7M17 7H7M17 7V17\",stroke:\"currentColor\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})})})]});const handlers={onMouseEnter:()=>setHovered(true),onMouseLeave:()=>setHovered(false),onFocus:()=>setHovered(true),onBlur:()=>setHovered(false)};if(isForm){const openForm=()=>{if(typeof window===\"undefined\")return;window.dispatchEvent(new CustomEvent(\"ubswap:open-form\",{detail:{formId:formId||\"default\"}}));};return /*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:openForm,style:rootStyle,\"aria-label\":text,\"aria-haspopup\":\"dialog\",...handlers,children:inner});}if(isScroll){const scrollToTarget=()=>{if(typeof window===\"undefined\")return;const name=(scrollTarget||\"\").trim();if(!name)return;const safe=name.replace(/[\"\\\\]/g,\"\\\\$&\");const matches=Array.from(document.querySelectorAll(`[data-framer-name=\"${safe}\"]`));// Framer renders a copy per breakpoint; use the one on screen.\nconst el=matches.find(m=>m.getClientRects().length>0);if(!el)return;const top=el.getBoundingClientRect().top+window.scrollY-(scrollOffset||0);const reduce=window.matchMedia&&window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;window.scrollTo({top,behavior:reduce?\"auto\":\"smooth\"});};return /*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:scrollToTarget,style:rootStyle,\"aria-label\":text,...handlers,children:inner});}if(link){return /*#__PURE__*/_jsx(\"a\",{href:link,target:openInNewTab?\"_blank\":undefined,rel:openInNewTab?\"noopener noreferrer\":undefined,style:rootStyle,\"aria-label\":text,...handlers,children:inner});}return /*#__PURE__*/_jsx(\"div\",{style:rootStyle,...handlers,children:inner});}ButtonSwap.defaultProps={text:\"Book A Demo\",hoverText:\"Let's go\",action:\"link\",formId:\"\",link:\"\",openInNewTab:false,scrollTarget:\"\",scrollOffset:0,background:\"rgb(37, 114, 185)\",color:\"rgb(255, 255, 255)\",showIcon:true,iconSize:21,fontSize:17,paddingX:30,paddingY:20,gap:16,borderRadius:0,duration:.45};addPropertyControls(ButtonSwap,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Book A Demo\"},hoverText:{type:ControlType.String,title:\"Hover Text\",defaultValue:\"Let's go\"},action:{type:ControlType.Enum,title:\"Action\",options:[\"link\",\"form\",\"scroll\"],optionTitles:[\"Link\",\"Open Form\",\"Scroll\"],defaultValue:\"link\",displaySegmentedControl:true},formId:{type:ControlType.String,title:\"Form ID\",defaultValue:\"\",placeholder:\"e.g. partnerships\",description:\"Must match the Form ID on a FormPopup component on this page.\",hidden:({action})=>action!==\"form\"},link:{type:ControlType.Link,title:\"Link\",hidden:({action})=>action!==\"link\"},openInNewTab:{type:ControlType.Boolean,title:\"New Tab\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\",hidden:({action})=>action!==\"link\"},scrollTarget:{type:ControlType.String,title:\"Scroll To\",defaultValue:\"\",placeholder:\"Layer name, e.g. Book a demo\",description:\"Exact layer name of a section on this page. Renaming that layer breaks the scroll.\",hidden:({action})=>action!==\"scroll\"},scrollOffset:{type:ControlType.Number,title:\"Offset\",defaultValue:0,min:0,max:300,step:4,unit:\"px\",description:\"Space left above the section after scrolling.\",hidden:({action})=>action!==\"scroll\"},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"rgb(37, 114, 185)\"},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"rgb(255, 255, 255)\"},showIcon:{type:ControlType.Boolean,title:\"Show Icon\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},iconSize:{type:ControlType.Number,title:\"Icon Size\",defaultValue:21,min:10,max:48,step:1,hidden:({showIcon})=>!showIcon},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:17,min:10,max:48,step:1},paddingX:{type:ControlType.Number,title:\"Padding X\",defaultValue:30,min:0,max:120,step:1},paddingY:{type:ControlType.Number,title:\"Padding Y\",defaultValue:20,min:0,max:120,step:1},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:16,min:0,max:60,step:1},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:0,min:0,max:100,step:1},duration:{type:ControlType.Number,title:\"Speed\",defaultValue:.45,min:.1,max:1.5,step:.05,unit:\"s\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ButtonSwap\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"61\",\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerIntrinsicWidth\":\"180\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Butt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