{"version":3,"file":"Copy_emial_button.D-eFjBW7.mjs","names":["useState","useRef","useMemo","useCallback"],"sources":["https:/framerusercontent.com/modules/EctXfwDdP2M8F0EocXJh/Exxp3tZpEzOmPbSkXnaO/Copy_emial_button.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{startTransition,useCallback,useEffect,useMemo,useRef,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function CopyButton(props){const{copyValue,label,hoverLabel,copiedLabel,revertDelayMs,background,hoverBackground,textColor,copiedTextColor,borderWidth,borderColor,borderStyle,radius,paddingX,paddingY,textTransform,font}=props;const[isCopied,setIsCopied]=useState(false);const[isHovered,setIsHovered]=useState(false);const timeoutRef=useRef(null);const visibleLabel=useMemo(()=>isCopied?copiedLabel:isHovered?hoverLabel:label,[isCopied,isHovered,copiedLabel,hoverLabel,label]);useEffect(()=>{return()=>{if(typeof window!==\"undefined\"&&timeoutRef.current!==null){window.clearTimeout(timeoutRef.current);}};},[]);const handleClick=useCallback(async()=>{startTransition(()=>setIsHovered(false));if(typeof navigator===\"undefined\"||!navigator.clipboard)return;try{await navigator.clipboard.writeText(copyValue);startTransition(()=>setIsCopied(true));if(typeof window!==\"undefined\"&&timeoutRef.current!==null){window.clearTimeout(timeoutRef.current);}if(typeof window!==\"undefined\"){timeoutRef.current=window.setTimeout(()=>{startTransition(()=>setIsCopied(false));},revertDelayMs);}}catch(_error){// Silent fail to keep interaction non-breaking in restricted environments.\n}},[copyValue,revertDelayMs]);const handlePointerEnter=useCallback(event=>{if(event.pointerType===\"mouse\"){startTransition(()=>setIsHovered(true));}},[]);const handlePointerLeave=useCallback(event=>{if(event.pointerType===\"mouse\"){startTransition(()=>setIsHovered(false));}},[]);const clearHoverState=useCallback(()=>{startTransition(()=>setIsHovered(false));},[]);return /*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:handleClick,onPointerEnter:handlePointerEnter,onPointerLeave:handlePointerLeave,onPointerDown:clearHoverState,onTouchStart:clearHoverState,\"aria-live\":\"polite\",style:{position:\"relative\",border:borderWidth<=0?\"none\":`${borderWidth}px ${borderStyle} ${borderColor}`,outline:\"none\",cursor:\"pointer\",background:!isCopied&&isHovered?hoverBackground:background,color:isCopied?copiedTextColor:textColor,borderRadius:radius,padding:`${paddingY}px ${paddingX}px`,fontSize:font.fontSize,lineHeight:font.lineHeight,letterSpacing:font.letterSpacing,textAlign:font.textAlign,fontWeight:font.fontWeight,fontStyle:font.fontStyle,fontFamily:font.fontFamily,textTransform,transition:\"color 0.2s ease, background-color 0.2s ease\",width:\"100%\",height:\"100%\"},children:visibleLabel});}addPropertyControls(CopyButton,{copyValue:{type:ControlType.String,title:\"Copy Value\",defaultValue:\"hello@kropka.pl\"},label:{type:ControlType.String,title:\"Label\",defaultValue:\"Email me\"},hoverLabel:{type:ControlType.String,title:\"Hover Label\",defaultValue:\"Copy Email\"},copiedLabel:{type:ControlType.String,title:\"Copied Label\",defaultValue:\"Copied ✓\"},revertDelayMs:{type:ControlType.Number,title:\"Revert Delay\",defaultValue:2200,min:300,max:1e4,step:100,unit:\"ms\"},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"#F7F6F2\"},hoverBackground:{type:ControlType.Color,title:\"Hover Bg\",defaultValue:\"#696969\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#000000\"},copiedTextColor:{type:ControlType.Color,title:\"Copied Text\",defaultValue:\"#193969\"},borderWidth:{type:ControlType.Number,title:\"Border W\",defaultValue:1,min:0,max:20,step:1},borderColor:{type:ControlType.Color,title:\"Border\",defaultValue:\"#D9D9D4\"},borderStyle:{type:ControlType.Enum,title:\"Border Style\",defaultValue:\"solid\",options:[\"solid\",\"dashed\",\"dotted\"],optionTitles:[\"Solid\",\"Dashed\",\"Dotted\"]},radius:{type:ControlType.Number,title:\"Radius\",defaultValue:4,min:0,max:999,step:1},paddingX:{type:ControlType.Number,title:\"Padding X\",defaultValue:16,min:0,max:80,step:1},paddingY:{type:ControlType.Number,title:\"Padding Y\",defaultValue:10,min:0,max:80,step:1},textTransform:{type:ControlType.Enum,title:\"Text Case\",defaultValue:\"uppercase\",options:[\"none\",\"uppercase\"],optionTitles:[\"Normal\",\"Uppercase\"]},font:{type:ControlType.Font,title:\"Label Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CopyButton\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Copy_emial_button.map"],"mappings":"kOAGG,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,YAAU,QAAM,aAAW,cAAY,gBAAc,aAAW,kBAAgB,YAAU,kBAAgB,cAAY,cAAY,cAAY,SAAO,WAAS,WAAS,gBAAc,QAAM,EAAW,CAAC,EAAS,GAAaA,EAAS,EAAK,EAAO,CAAC,EAAU,GAAcA,EAAS,EAAK,EAAQ,EAAWC,EAAO,IAAI,EAAQ,EAAaC,MAAY,EAAS,EAAY,EAAU,EAAW,EAAM,CAAC,EAAS,EAAU,EAAY,EAAW,CAAK,CAAC,EAAE,UAAyB,CAAW,IAAS,QAAa,EAAW,UAAU,MAAM,EAAO,aAAa,EAAW,OAAO,CAAG,EAAI,CAAC,CAAC,EAAE,IAAM,EAAYC,EAAY,SAAS,CAAC,SAAoB,EAAa,EAAK,CAAC,EAAK,EAAO,IAAY,QAAa,CAAC,EAAU,WAAiB,GAAG,CAAC,MAAM,EAAU,UAAU,UAAU,CAAS,EAAE,MAAoB,EAAY,EAAI,CAAC,EAAY,IAAS,QAAa,EAAW,UAAU,MAAM,EAAO,aAAa,EAAW,OAAO,EAAa,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