Files
pymc_console-dist/frontend/dist/assets/DataBox-Cu4AfdhJ.js
T
GitHub Actions Bot 47fb1cb9ad Sync build v0.9.259
Automated sync from private repository.
Commit: ec3865edeb5494487d6f136f10069d9f4ebba76a
2026-02-16 03:48:07 +00:00

2 lines
2.1 KiB
JavaScript

import{r as e,j as t,c as o}from"./vendor-react-j_fHog8x.js";import{o as n}from"./index-D24A8Wxm.js";import{C as s}from"./copy-DVttPFPT.js";const a={standard:"w-3 h-3",compact:"w-2.5 h-2.5",responsive:"w-2.5 h-2.5 sm:w-3 sm:h-3"};function r({children:r,copyValue:c,copy:i=!1,size:l="standard",className:p,title:d,color:u,truncate:m}){const[x,y]=e.useState(!1),[h,w]=e.useState(!1),f=e.useRef(null),v=c??("string"==typeof r?r:""),b=a[l],g=(()=>{if(!m||"string"!=typeof r)return r;const e=r,[t,o]=!0===m?[6,4]:m;return e.length<=t+o+3?e:`${e.slice(0,t)}${e.slice(-o)}`})(),j=e.useCallback(e=>{i&&(e.preventDefault(),e.stopPropagation(),f.current&&clearTimeout(f.current),function(e){var t;if("undefined"!=typeof window&&(window.isSecureContext||"https:"===window.location.protocol||"localhost"===window.location.hostname)&&(null==(t=navigator.clipboard)?void 0:t.writeText))return navigator.clipboard.writeText(e).catch(()=>{}),!0;try{const{scrollX:t,scrollY:o}=window,n=document.createElement("textarea");n.value=e,n.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0;pointer-events:none",n.setAttribute("readonly",""),document.body.appendChild(n),n.focus({preventScroll:!0}),n.select(),n.setSelectionRange(0,e.length);const s=document.execCommand("copy");return document.body.removeChild(n),window.scrollTo(t,o),s}catch(o){return!1}}(v),y(!0),f.current=setTimeout(()=>y(!1),2e3))},[i,v]),C="compact"===l?"data-box-compact":"responsive"===l?"data-box-responsive":"",N=i?d||`Click to copy: ${v}`:d;return i?t.jsxs("button",{type:"button",onClick:j,onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),className:o("data-box interactive",C,"cursor-pointer select-none gap-1","hover-bg",u,p),title:N,"aria-label":`Copy ${v}`,children:[t.jsx("span",{className:o("transition-colors duration-200",x?"text-sys-green":""),children:g}),t.jsx("span",{className:o("flex items-center justify-center","compact"===l?"w-3 h-3":"w-3.5 h-3.5"),children:x?t.jsx(n,{className:o("text-sys-green",b)}):t.jsx(s,{className:o("transition-opacity duration-200",h?"opacity-70":"opacity-40",b)})})]}):t.jsx("span",{className:o("data-box",C,u,p),title:N,children:g})}export{r as D};