{"version":3,"file":"Button.CpSbuk-d.mjs","names":["React.useState","React.useMemo","React.useCallback","_Fragment"],"sources":["https:/framerusercontent.com/modules/x89M7FZBsYUthz88tL38/bt7qv7dxAA5Ka4TiXEjz/Button.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";function resolveHref(link){if(!link)return\"\";if(typeof link===\"string\")return link;if(typeof link===\"object\"&&link!==null){const o=link;return(typeof o.url===\"string\"?o.url:\"\")||(typeof o.href===\"string\"?o.href:\"\")||(typeof o.link===\"string\"?o.link:\"\")||(typeof o.path===\"string\"?o.path:\"\")||(typeof o.value===\"string\"?o.value:\"\")||\"\";}return\"\";}function navigateToHref(href){if(!href)return;try{if(/^https?:\\/\\//.test(href)){window.location.href=href;}else{window.location.pathname=href;}}catch{// 预览环境可能没有 window\n}}/**\n * 带密码弹窗的「案例」按钮：可配置直接跳转，或验证通过后跳转至配置的链接。\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 48\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function CaseStudyGateButton({directJump=false,link,correctPassword=\"\",buttonLabel=\"View Case Study\",backgroundColor=\"#111111\",textColor=\"#FFFFFF\",textFont={fontFamily:\"system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif\",fontSize:15,fontWeight:600,lineHeight:1.2,letterSpacing:\"-0.01em\"},borderRadius=999,paddingX=24,paddingY=14,borderWidth=0,borderColor=\"transparent\",modalTitle=\"Enter password\",modalHint=\"\",modalTitleFont={fontFamily:\"system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif\",fontSize:18,fontWeight:600,lineHeight:1.25},modalBodyFont={fontFamily:\"system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif\",fontSize:15,fontWeight:400,lineHeight:1.45}}){const[open,setOpen]=React.useState(false);const[input,setInput]=React.useState(\"\");const[error,setError]=React.useState(\"\");const[buttonHovered,setButtonHovered]=React.useState(false);const href=React.useMemo(()=>resolveHref(link),[link]);const handleMainClick=React.useCallback(()=>{if(directJump){if(!href)return;navigateToHref(href);return;}setOpen(true);},[directJump,href]);const close=React.useCallback(()=>{setOpen(false);setInput(\"\");setError(\"\");},[]);const submit=React.useCallback(()=>{const expected=correctPassword??\"\";if(input!==expected){setError(\"Incorrect password\");return;}if(!href){setError(\"No link configured in the sidebar\");return;}close();navigateToHref(href);},[correctPassword,input,href,close]);React.useEffect(()=>{if(!open)return;const onKey=e=>{if(e.key===\"Escape\")close();};window.addEventListener(\"keydown\",onKey);return()=>window.removeEventListener(\"keydown\",onKey);},[open,close]);const buttonStyle={display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",boxSizing:\"border-box\",cursor:\"pointer\",border:borderWidth>0?`${borderWidth}px solid ${borderColor}`:\"none\",borderRadius,padding:`${paddingY}px ${paddingX}px`,backgroundColor,color:textColor,...textFont,maxWidth:\"100%\",transform:buttonHovered?\"scale(1.05)\":\"scale(1)\",transformOrigin:\"center\",transition:\"transform 0.2s ease\"};return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:handleMainClick,onMouseEnter:()=>setButtonHovered(true),onMouseLeave:()=>setButtonHovered(false),style:buttonStyle,children:buttonLabel}),open?/*#__PURE__*/_jsx(\"div\",{role:\"presentation\",style:{position:\"fixed\",inset:0,zIndex:1e5,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding:24,backgroundColor:\"rgba(0,0,0,0.45)\",boxSizing:\"border-box\"},onMouseDown:e=>{if(e.target===e.currentTarget)close();},children:/*#__PURE__*/_jsxs(\"div\",{role:\"dialog\",\"aria-modal\":\"true\",\"aria-labelledby\":\"case-study-gate-title\",style:{width:\"100%\",maxWidth:400,borderRadius:16,padding:24,backgroundColor:\"#fff\",color:\"#111\",boxShadow:\"0 24px 48px rgba(0,0,0,0.18)\"},onMouseDown:e=>e.stopPropagation(),children:[/*#__PURE__*/_jsx(\"h2\",{id:\"case-study-gate-title\",style:{margin:\"0 0 8px\",color:\"#111\",...modalTitleFont},children:modalTitle}),modalHint?/*#__PURE__*/_jsx(\"p\",{style:{margin:\"0 0 16px\",opacity:.75,...modalBodyFont},children:modalHint}):null,/*#__PURE__*/_jsx(\"input\",{type:\"password\",value:input,onChange:e=>{setInput(e.target.value);if(error)setError(\"\");},onKeyDown:e=>{if(e.key===\"Enter\")submit();},placeholder:\"Password\",autoFocus:true,style:{width:\"100%\",boxSizing:\"border-box\",padding:\"12px 14px\",borderRadius:10,border:\"1px solid rgba(0,0,0,0.12)\",marginBottom:12,color:\"#111\",...modalBodyFont}}),error?/*#__PURE__*/_jsx(\"p\",{style:{margin:\"0 0 12px\",color:\"#c00\",...modalBodyFont},children:error}):null,/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",gap:10,justifyContent:\"flex-end\",flexWrap:\"wrap\"},children:[/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:close,style:{padding:\"10px 16px\",borderRadius:10,border:\"1px solid rgba(0,0,0,0.12)\",background:\"#fff\",color:\"#111\",cursor:\"pointer\",...modalBodyFont},children:\"Cancel\"}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:submit,style:{padding:\"10px 16px\",borderRadius:10,border:\"none\",background:\"#111\",color:\"#fff\",cursor:\"pointer\",...modalBodyFont,fontWeight:600},children:\"Continue\"})]})]})}):null]});}addPropertyControls(CaseStudyGateButton,{directJump:{type:ControlType.Boolean,title:\"直接跳转\",defaultValue:false,enabledTitle:\"无需密码\",disabledTitle:\"需密码\"},link:{type:ControlType.Link,title:\"跳转链接\"},correctPassword:{type:ControlType.String,title:\"正确密码\",defaultValue:\"\",obscured:true,hidden:props=>Boolean(props.directJump)},buttonLabel:{type:ControlType.String,title:\"按钮文字\",defaultValue:\"View Case Study\"},backgroundColor:{type:ControlType.Color,title:\"按钮背景色\",defaultValue:\"#111111\"},textColor:{type:ControlType.Color,title:\"文字颜色\",defaultValue:\"#FFFFFF\"},textFont:{type:ControlType.Font,title:\"按钮字体\",controls:\"extended\",defaultFontType:\"sans-serif\"},borderRadius:{type:ControlType.Number,title:\"圆角\",min:0,max:999,defaultValue:999,unit:\"px\"},paddingX:{type:ControlType.Number,title:\"左右内边距\",min:0,max:80,defaultValue:24,unit:\"px\"},paddingY:{type:ControlType.Number,title:\"上下内边距\",min:0,max:48,defaultValue:14,unit:\"px\"},borderWidth:{type:ControlType.Number,title:\"描边粗细\",min:0,max:8,defaultValue:0,unit:\"px\"},borderColor:{type:ControlType.Color,title:\"描边颜色\",defaultValue:\"rgba(0,0,0,0.12)\"},modalTitle:{type:ControlType.String,title:\"弹窗标题\",defaultValue:\"Enter password\",hidden:props=>Boolean(props.directJump)},modalHint:{type:ControlType.String,title:\"弹窗说明\",defaultValue:\"\",displayTextArea:true,hidden:props=>Boolean(props.directJump)},modalTitleFont:{type:ControlType.Font,title:\"弹窗标题字体\",controls:\"extended\",defaultFontType:\"sans-serif\",hidden:props=>Boolean(props.directJump)},modalBodyFont:{type:ControlType.Font,title:\"弹窗正文字体\",controls:\"extended\",defaultFontType:\"sans-serif\",hidden:props=>Boolean(props.directJump)}});\nexport const __FramerMetadata__ = {\"exports\":{\"CaseStudyGateButtonProps\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"reactComponent\",\"name\":\"CaseStudyGateButton\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\",\"framerIntrinsicHeight\":\"48\",\"framerIntrinsicWidth\":\"200\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Button.map"],"mappings":"sNAA+J,SAAS,EAAY,EAAK,CAAC,GAAG,CAAC,EAAK,MAAM,GAAG,GAAG,OAAO,GAAO,SAAS,OAAO,EAAK,GAAG,OA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