UNPKG

@bothub-chat/ui

Version:

Bothub UI Components

2 lines (1 loc) 1.11 kB
import{jsx as o,jsxs as t}from"react/jsx-runtime";import{useState as r,useCallback as i}from"react";import{ReferralCardLinkStyled as e,ReferralCardLinkText as s,ReferralCardLinkCopyIcon as m}from"./styled.js";import"tslib";import{IconProvider as c}from"../../../icon/context.js";import"../../../icon/styled.js";import"@react-spring/web";import"react-dom";import"../../../portal/styled.js";import"../../../tooltip/styled.js";import"../../../tooltip/arrow/styled.js";import"../../../../theme/index.js";import"../../../tooltip/context.js";import{CheckSmallIcon as n}from"../../../../icons/check-small/index.js";import{CopyIcon as l}from"../../../../icons/copy/index.js";import{useTheme as p}from"../../../../theme/hook.js";const a=({className:a,tabIndex:d=0,children:j,onCopy:x})=>{const f=p(),[h,y]=r(!1),[u,b]=r(!1),k=i((()=>{y(!0)}),[]),w=i((()=>{y(!1),b(!1)}),[]),C=i((()=>{u||(null==x||x(j),b(!0))}),[u,j,x]);return o(c,{size:18,fill:f.colors.accent.primary,children:t(e,{className:a,tabIndex:d,onFocus:k,onBlur:w,onClick:C,children:[o(s,{children:j}),o(m,{as:h?n:l})]})})};export{a as ReferralCardLink};