import{P}from"./PzText-D5PUnIjq.js";import{e as w,G as V,f as d,X as q,v as I,g as u,q as k,y as A,x as S,p as _,r as B,o as i,C as N,t as O}from"./iframe-Bl-fVlm8.js";import{O as U}from"./floating-vue-C5xzxu-B.js";import"./floating-vue-ByDoVj13.js";import{P as D}from"./PzDomHandler-BU7iMNnt.js";import{_ as E}from"./PzIcon-cRuuou9i.js";import{_ as $}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./preload-helper-C1FmrZbK.js";const j=["aria-label"],F={class:"pz-copy-to-clipboard-content"},r=w({name:"PzCopyToClipboard",__name:"PzCopyToClipboard",props:{content:{},popupText:{default:"Скопійовано"},label:{default:"Скопіювати в буфер обміну"},timeout:{default:1e3},placement:{default:"top"},variant:{default:"text"},buttonClass:{default:""},showIcon:{type:Boolean,default:!0},stopPropagation:{type:Boolean,default:!0}},emits:["copied","error"],setup(e,{emit:z}){const t=e,s=B(!1);let o;const l=z,C=()=>{s.value=!1,o=void 0},h=()=>{o&&clearTimeout(o),s.value=!0,o=setTimeout(C,t.timeout)},T=async p=>{t.stopPropagation&&p.stopPropagation();try{await D.copyToClipboard(t.content),h(),l("copied",t.content)}catch(c){l("error",c)}};return V(()=>{o&&clearTimeout(o)}),(p,c)=>(i(),d("span",{class:u(["pz-copy-to-clipboard",`pz-copy-to-clipboard--${e.variant}`])},[q((i(),d("button",{type:"button",class:u(["pz-copy-to-clipboard-button",e.buttonClass]),"aria-label":e.label,onClick:T},[k("span",F,[A(p.$slots,"default",{},()=>[N(O(e.content),1)],!0)]),e.showIcon||e.variant==="icon"?(i(),S(E,{key:0,class:"pz-copy-to-clipboard-icon",name:"content_copy",size:"16"})):_("",!0)],10,j)),[[I(U),{shown:s.value,content:e.popupText,placement:e.placement,theme:"dark-tooltip",triggers:[]}]])],2))}}),m=$(r,[["__scopeId","data-v-b6d0efa4"]]);r.__docgenInfo=Object.assign({displayName:r.name??r.__name},{name:"PzCopyToClipboard",exportName:"default",displayName:"PzCopyToClipboard",description:"",tags:{},props:[{name:"content",required:!0,type:{name:"string"}},{name:"popupText",required:!1,type:{name:"string"},defaultValue:{func:!1,value:'"Скопійовано"'}},{name:"label",required:!1,type:{name:"string"},defaultValue:{func:!1,value:'"Скопіювати в буфер обміну"'}},{name:"timeout",required:!1,type:{name:"number"},defaultValue:{func:!1,value:"1000"}},{name:"placement",required:!1,type:{name:"Placement"},defaultValue:{func:!1,value:'"top"'}},{name:"variant",required:!1,type:{name:"PzCopyToClipboardVariant"},defaultValue:{func:!1,value:'"text"'}},{name:"buttonClass",required:!1,type:{name:"string"},defaultValue:{func:!1,value:'""'}},{name:"showIcon",required:!1,type:{name:"boolean"},defaultValue:{func:!1,value:"true"}},{name:"stopPropagation",required:!1,type:{name:"boolean"},defaultValue:{func:!1,value:"true"}}],events:[{name:"copied",type:{names:["string"]}},{name:"error",type:{names:["unknown"]}}],slots:[{name:"default"}],sourceFiles:["/builds/Web-Projects/client-services/prozorro-ui/src/components/Actions/PzCopyToClipboard/PzCopyToClipboard.vue"]});const Q={title:"Components/Actions/PzCopyToClipboard",component:m,args:{content:"UA-2026-05-07-000001-a",text:"UA-2026-05-07-000001-a",popupText:"Скопійовано",label:"Скопіювати ідентифікатор",timeout:1e3,placement:"top",variant:"text",buttonClass:"",showIcon:!0,stopPropagation:!0},argTypes:{content:{control:"text",description:"Value copied to the clipboard."},text:{control:"text",description:"Slot text shown in the preview.",table:{category:"Slots"}},popupText:{control:"text",description:"Tooltip text shown after a successful copy."},label:{control:"text",description:"Accessible button label."},timeout:{control:"number",description:"Tooltip visibility duration in milliseconds."},placement:{control:"select",options:["top","top-start","bottom","bottom-start"],description:"Tooltip placement relative to the trigger."},variant:{control:"inline-radio",options:["text","icon"],description:"Visual trigger treatment."},buttonClass:{control:"text",description:"Additional class applied to the native button."},showIcon:{control:"boolean",description:"Shows the copy icon next to text variants."},stopPropagation:{control:"boolean",description:"Stops click propagation before copying."}},render:e=>({components:{pzCopyToClipboard:m,pzText:P},setup(){return{args:e}},template:`
      <section class="pz-copy-to-clipboard-story">
        <div class="pz-copy-to-clipboard-story-header">
          <div>
            <span class="pz-copy-to-clipboard-story-eyebrow">Component API</span>
            <pz-text variant="h4-bold">Copy trigger</pz-text>
          </div>
          <span class="pz-copy-to-clipboard-story-chip">{{ args.variant }}</span>
        </div>

        <div class="pz-copy-to-clipboard-story-preview">
          <pz-copy-to-clipboard v-bind="args">
            {{ args.text }}
          </pz-copy-to-clipboard>
        </div>

        <div class="pz-copy-to-clipboard-story-examples">
          <div class="pz-copy-to-clipboard-story-row">
            <span>UA-2026-05-07-000001-a</span>
            <pz-copy-to-clipboard
              content="UA-2026-05-07-000001-a"
              label="Скопіювати ідентифікатор закупівлі"
              popup-text="Код скопійовано"
              variant="icon"
            />
          </div>

          <div class="pz-copy-to-clipboard-story-row">
            <pz-copy-to-clipboard
              content="prozorro@example.gov.ua"
              popup-text="Email скопійовано"
              label="Скопіювати email"
              :show-icon="false"
            >
              prozorro@example.gov.ua
            </pz-copy-to-clipboard>
          </div>
        </div>
      </section>
    `})},a={},n={args:{variant:"icon",text:"Copy"}};var y,b,f;a.parameters={...a.parameters,docs:{...(y=a.parameters)==null?void 0:y.docs,source:{originalSource:"{}",...(f=(b=a.parameters)==null?void 0:b.docs)==null?void 0:f.source}}};var v,g,x;n.parameters={...n.parameters,docs:{...(v=n.parameters)==null?void 0:v.docs,source:{originalSource:`{
  args: {
    variant: "icon",
    text: "Copy"
  }
}`,...(x=(g=n.parameters)==null?void 0:g.docs)==null?void 0:x.source}}};const R=["Playground","IconOnly"];export{n as IconOnly,a as Playground,R as __namedExportsOrder,Q as default};
