import*as e from"react";import{Popup as l}from"reactjs-popup";import c from"styled-components";import{copyToClipboard as d}from"../../../../../client/app/utils";const b=({text:t,children:r})=>{const[n,o]=e.useState(!1),[a,s]=e.useState(),p=()=>{o(!1)},i=()=>{o(!0),clearTimeout(a),s(setTimeout(()=>p(),1500)),d(t)};return e.createElement(e.Fragment,null,e.createElement(m,{trigger:r,open:n,onOpen:i,onClose:()=>o(!1),position:"top center"},e.createElement("span",null,"Copied!")))},m=c(l)`
  &-content {
    border-radius: var(--border-radius);
    background-color: var(--bg-color-raised);
    padding: var(--spacing-xs);
  }

  &-arrow {
    path {
      fill: var(--bg-color-raised);
    }
  }
`;export{b as CopyAction};
