{"version":3,"file":"Copybutton.Xkr0Exay.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/O83SQermkzvkPgtHa9Hy/EcGyghQRloMBEWAe7ATc/Copybutton.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export function CopyButton(props){const{copyText,defaultLabel,successLabel,loadingLabel,height,width,padding,backgroundColor,labelColor,borderRadius,fontSize,loadingTime}=props;const[status,setStatus]=useState(\"idle\");async function handleClick(){if(status===\"loading\")return;setStatus(\"loading\");try{await navigator.clipboard.writeText(copyText);setStatus(\"success\");setTimeout(()=>{setStatus(\"idle\");},loadingTime);}catch(error){console.error(\"복사에 실패했습니다:\",error);setStatus(\"idle\");}}const label=status===\"loading\"?loadingLabel:status===\"success\"?successLabel:defaultLabel;const computedButtonWidth=width===\"fill\"?\"100%\":width;const containerStyle=width===\"fill\"?{width:\"100%\",height:\"100%\"}:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\"};return /*#__PURE__*/_jsx(\"div\",{style:containerStyle,children:/*#__PURE__*/_jsx(\"button\",{style:{height:height,width:computedButtonWidth,backgroundColor:backgroundColor,borderRadius:`${borderRadius}px`,border:\"none\",fontFamily:\"pretendard\",fontSize:`${fontSize}px`,color:labelColor,cursor:status===\"loading\"?\"not-allowed\":\"pointer\",padding:padding,boxSizing:\"border-box\"},onClick:handleClick,disabled:status===\"loading\",children:label})});}addPropertyControls(CopyButton,{copyText:{type:ControlType.String,title:\"Copy Text\",defaultValue:\"Hello World\"},defaultLabel:{type:ControlType.String,title:\"Default Label\",defaultValue:\"Copy Text\"},successLabel:{type:ControlType.String,title:\"Success Label\",defaultValue:\"복사가 완료되었습니다\"},loadingLabel:{type:ControlType.String,title:\"Loading Label\",defaultValue:\"Loading...\"},height:{type:ControlType.String,title:\"Height\",defaultValue:\"40px\"},width:{type:ControlType.String,title:\"Width\",defaultValue:\"auto\",placeholder:\"예: auto, fill, fit-content, 100%\"},padding:{type:ControlType.String,title:\"Padding\",defaultValue:\"0 12px\"},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"#007AFF\"},labelColor:{type:ControlType.Color,title:\"Label Color\",defaultValue:\"#FFFFFF\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:4},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:16},loadingTime:{type:ControlType.Number,title:\"Loading Time (ms)\",defaultValue:2e3}});\nexport const __FramerMetadata__ = {\"exports\":{\"CopyButton\":{\"type\":\"reactComponent\",\"name\":\"CopyButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Copybutton.map"],"mappings":"6SAA2H,SAAgB,EAAW,EAAM,CAAC,GAAK,CAAC,WAAS,eAAa,eAAa,eAAa,SAAO,QAAM,UAAQ,kBAAgB,aAAW,eAAa,WAAS,cAAY,CAAC,EAAW,CAAC,EAAO,EAAU,CAACA,EAAS,QAAQ,eAAe,GAAa,CAAI,OAAS,UAAiB,GAAU,WAAW,GAAG,CAAC,MAAM,EAAU,UAAU,UAAU,GAAU,EAAU,WAAW,eAAe,CAAC,EAAU,OAAS,EAAC,EAAc,OAAM,EAAM,CAAC,QAAQ,MAAM,cAAc,GAAO,EAAU,OAAS,CAAvM,CAAwM,KAAM,EAAM,IAAS,UAAU,EAAa,IAAS,UAAU,EAAa,EAAmB,EAAoB,IAAQ,OAAO,OAAO,EAAY,EAAe,IAAQ,OAAO,CAAC,MAAM,OAAO,OAAO,OAAO,CAAC,CAAC,QAAQ,OAAO,WAAW,SAAS,eAAe,SAAS,CAAC,OAAoB,EAAK,MAAM,CAAC,MAAM,EAAe,SAAsB,EAAK,SAAS,CAAC,MAAM,CAAQ,SAAO,MAAM,EAAoC,kBAAgB,aAAa,GAAG,EAAa,IAAI,OAAO,OAAO,WAAW,aAAa,SAAS,GAAG,EAAS,IAAI,MAAM,EAAW,OAAO,I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