{"version":3,"file":"LinkedCopyButton.CKNm2fNe.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/rrTVqqdamrcfPvQJhSCR/7bx7piI95eSDdLo7EpTS/LinkedCopyButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";export default function CustomCopyButton(props){const{slots,tooltip,toastText,toastBG,toastTextColor,disabled,toastDuration,toastPosition,toastGap,textSize,toastSize,fontFamily}=props;const[isCopied,setIsCopied]=useState(false);const handleCopy=async()=>{if(disabled===\"Yes\"||RenderTarget.current()===RenderTarget.canvas)return;setIsCopied(true);setTimeout(()=>setIsCopied(false),toastDuration*1e3);try{if(navigator.clipboard&&navigator.clipboard.writeText){await navigator.clipboard.writeText(tooltip);}else{const textArea=document.createElement(\"textarea\");textArea.value=tooltip;document.body.appendChild(textArea);textArea.select();document.execCommand(\"copy\");document.body.removeChild(textArea);}}catch(err){console.warn(\"Copy failed:\",err);}};// 위치에 따른 스타일 계산 로직\nconst getToastStyle=()=>{const baseStyle={position:\"absolute\",backgroundColor:toastBG,color:toastTextColor,padding:\"8px 16px\",borderRadius:\"8px\",fontSize:`${toastSize}px`,fontWeight:\"600\",pointerEvents:\"none\",whiteSpace:\"nowrap\",boxShadow:\"0 4px 12px rgba(0,0,0,0.15)\",zIndex:99999};switch(toastPosition){case\"Top\":return{...baseStyle,bottom:`calc(100% + ${toastGap}px)`,left:\"50%\",x:\"-50%\"};case\"Bottom\":return{...baseStyle,top:`calc(100% + ${toastGap}px)`,left:\"50%\",x:\"-50%\"};case\"Left\":return{...baseStyle,right:`calc(100% + ${toastGap}px)`,top:\"50%\",y:\"-50%\"};case\"Right\":return{...baseStyle,left:`calc(100% + ${toastGap}px)`,top:\"50%\",y:\"-50%\"};default:return baseStyle;}};const hasContent=slots&&slots.length>0;return /*#__PURE__*/_jsxs(\"div\",{style:{...containerStyle,fontFamily:fontFamily},children:[/*#__PURE__*/_jsx(\"div\",{onClick:handleCopy,style:{width:\"100%\",height:\"100%\",cursor:disabled===\"Yes\"?\"not-allowed\":\"pointer\",opacity:disabled===\"Yes\"?.5:1,display:\"flex\",justifyContent:\"center\",alignItems:\"center\",fontSize:`${textSize}px`},children:/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",pointerEvents:\"none\"},children:hasContent?slots:/*#__PURE__*/_jsx(\"div\",{style:placeholderStyle,children:\"디자인을 연결해주세요\"})})}),/*#__PURE__*/_jsx(AnimatePresence,{children:isCopied&&/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2},style:getToastStyle(),children:toastText})})]});}const containerStyle={width:\"100%\",height:\"100%\",position:\"relative\",overflow:\"visible\"};const placeholderStyle={width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",background:\"rgba(0,0,0,0.05)\",border:\"1px dashed rgba(0,0,0,0.1)\",borderRadius:8,fontSize:\"12px\",color:\"#999\"};addPropertyControls(CustomCopyButton,{slots:{type:ControlType.ComponentInstance,title:\"Button Content\"},tooltip:{type:ControlType.String,title:\"Copy Content\",defaultValue:\"https://framer.com\"},fontFamily:{type:ControlType.String,title:\"Font Family\",defaultValue:\"Inter, sans-serif\"},textSize:{type:ControlType.Number,title:\"Button Text Size\",defaultValue:16,min:8},toastText:{type:ControlType.String,title:\"Toast Text\",defaultValue:\"복사되었습니다!\"},toastSize:{type:ControlType.Number,title:\"Toast Text Size\",defaultValue:14,min:8},toastPosition:{type:ControlType.Enum,title:\"Toast Side\",options:[\"Top\",\"Bottom\",\"Left\",\"Right\"],defaultValue:\"Top\",displaySegmentedControl:true},toastGap:{type:ControlType.Number,title:\"Toast Gap\",min:-50,max:100,defaultValue:10,unit:\"px\"},toastBG:{type:ControlType.Color,title:\"Toast BG\",defaultValue:\"#000\"},toastTextColor:{type:ControlType.Color,title:\"Toast Color\",defaultValue:\"#FFF\"},toastDuration:{type:ControlType.Number,title:\"Toast Speed\",defaultValue:1.5,step:.1,unit:\"s\"},disabled:{type:ControlType.Enum,title:\"Disabled\",options:[\"Yes\",\"No\"],defaultValue:\"No\",displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CustomCopyButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LinkedCopyButton.map"],"mappings":"8PAAwM,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,QAAM,UAAQ,YAAU,UAAQ,iBAAe,WAAS,gBAAc,gBAAc,WAAS,WAAS,YAAU,cAAY,EAAW,CAAC,EAAS,GAAaA,EAAS,GAAM,CAAO,EAAW,SAAS,CAAI,SAAW,OAAO,EAAa,SAAS,GAAG,EAAa,QAAgC,CAAlB,EAAY,GAAK,CAAC,eAAe,EAAY,GAAM,CAAC,EAAc,IAAI,CAAC,GAAG,CAAC,GAAG,EAAU,WAAW,EAAU,UAAU,UAAW,MAAM,EAAU,UAAU,UAAU,EAAQ,KAAM,CAAC,IAAM,EAAS,SAAS,cAAc,WAAW,CAAC,EAAS,MAAM,EAAQ,SAAS,KAAK,YAAY,EAAS,CAAC,EAAS,QAAQ,CAAC,SAAS,YAAY,OAAO,CAAC,SAAS,KAAK,YAAY,EAAS,QAAS,EAAI,CAAC,QAAQ,KAAK,eAAe,EAAI,IAC56B,MAAkB,CAAC,IAAM,EAAU,CAAC,SAAS,WAAW,gBAAgB,EAAQ,MAAM,EAAe,QAAQ,WAAW,aAAa,MAAM,SAAS,GAAG,EAAU,IAAI,WAAW,MAAM,cAAc,OAAO,WAAW,SAAS,UAAU,8BAA8B,OAAO,MAAM,CAAC,OAAO,EAAP,CAAsB,IAAI,MAAM,MAAM,CAAC,GAAG,EAAU,OAAO,eAAe,EAA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