UNPKG

@privy-io/react-auth

Version:

React client for the Privy Auth API

24 lines (22 loc) 1.39 kB
import{jsxs as e,jsx as r,Fragment as o}from"react/jsx-runtime";import{Check as i,Copy as n}from"lucide-react";import{useState as t}from"react";import{styled as c}from"styled-components";let l=c.button` display: flex; align-items: center; justify-content: end; gap: 0.5rem; svg { width: 0.875rem; height: 0.875rem; } `,a=c.span` display: flex; align-items: center; gap: 0.25rem; font-size: 0.875rem; color: var(--privy-color-foreground-2); `,s=c(i)` color: var(--privy-color-icon-success); flex-shrink: 0; `,d=c(n)` color: var(--privy-color-icon-muted); flex-shrink: 0; `;function m({children:o,iconOnly:i,value:n,hideCopyIcon:c,...m}){let[p,h]=t(!1);/*#__PURE__*/return e(l,{...m,onClick:()=>{navigator.clipboard.writeText(n||("string"==typeof o?o:"")).catch(console.error),h(!0),setTimeout((()=>h(!1)),1500)},children:[o," ",p?/*#__PURE__*/e(a,{children:[/*#__PURE__*/r(s,{})," ",!i&&"Copied"]}):!c&&/*#__PURE__*/r(d,{})]})}const p=({value:i,includeChildren:n,children:c,...m})=>{let[p,h]=t(!1),u=()=>{navigator.clipboard.writeText(i).catch(console.error),h(!0),setTimeout((()=>h(!1)),1500)};/*#__PURE__*/return e(o,{children:[n?/*#__PURE__*/r(l,{...m,onClick:u,children:c}):/*#__PURE__*/r(o,{children:c}),/*#__PURE__*/r(l,{...m,onClick:u,children:p?/*#__PURE__*/r(a,{children:/*#__PURE__*/r(s,{})}):/*#__PURE__*/r(d,{})})]})};export{m as C,p as a};