import{P as E}from"./PzKeyValue-Bqw-YOMe.js";import{P as v}from"./PzText-D5PUnIjq.js";import{e as A,f as l,F as V,u as k,v as a,x as q,p as C,o as p,y as K}from"./iframe-Bl-fVlm8.js";import{I,P as w}from"./PzListNav-DBS8u2z6.js";import{P as O}from"./PzScrollTo-KuzwcV-o.js";import{u as F}from"./StaticPagination.composable-CiVqHavQ.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./isArray-DPUC7i9_.js";import"./lodash-CdDiHlzQ.js";import"./PzDomHandler-BU7iMNnt.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./preload-helper-C1FmrZbK.js";import"./PzSelect-CwWCI-kq.js";import"./index-pk-yyh3_.js";import"./floating-vue-C5xzxu-B.js";import"./PzIcon-cRuuou9i.js";import"./PzLabel-avnfC9tn.js";import"./PzPagination-Cjg8KFKz.js";const L={class:"pagination-provider"},n=A({name:"PzPaginationProvider",__name:"PzPaginationProvider",props:{perPage:{default:I.FIVE},data:{},navigationTopElement:{default:void 0},hasAutoScroll:{type:Boolean,default:!1}},setup(e){const t=e,{perPage:b,pageChanged:x,getItems:h,isPaginationAvailable:S,visibleRangeElements:T}=F(t),_=()=>{var r;t.hasAutoScroll&&O.moveByQuerySelector(".pagination-provider",((r=t.navigationTopElement)==null?void 0:r.offsetHeight)||0)};return(r,R)=>(p(),l("div",L,[(p(!0),l(V,null,k(a(h),(N,s)=>K(r.$slots,"item",{item:N,index:s,sequenceNumber:a(T)[0]+s})),256)),a(S)?(p(),q(a(w),{key:0,total:e.data.length,"per-page":a(b),class:"pz-mt-32",onOnInput:a(x),onOnChangePerPage:_},null,8,["total","per-page","onOnInput"])):C("",!0)]))}});n.__docgenInfo=Object.assign({displayName:n.name??n.__name},{name:"PzPaginationProvider",exportName:"default",displayName:"PzPaginationProvider",description:"",tags:{},props:[{name:"perPage",required:!1,type:{name:"number"},defaultValue:{func:!1,value:"ITEMS_PER_PAGE.FIVE"}},{name:"data",required:!0,type:{name:"Array",elements:[{name:"T"}]}},{name:"navigationTopElement",required:!1,type:{name:"HTMLElement"},defaultValue:{func:!1,value:"undefined"}},{name:"hasAutoScroll",required:!1,type:{name:"boolean"},defaultValue:{func:!1,value:"false"}}],slots:[{name:"item",scoped:!0,bindings:[{name:"item",title:"binding"},{name:"index",title:"binding"},{name:"sequence-number",title:"binding"}]}],sourceFiles:["/builds/Web-Projects/client-services/prozorro-ui/src/components/Navigation/PzPaginationProvider/PzPaginationProvider.vue"]});const y=n,M=n,z=E,f=[{id:"row-id",key:"id",labelKey:"Tender ID"},{id:"row-title",key:"title",labelKey:"Title"},{id:"row-amount",key:"amount",labelKey:"Expected value"}],B=12,H=6,D=1e3,G=Array.from({length:B},(e,t)=>({id:`UA-2026-04-17-${String(t+1).padStart(H,"0")}-a`,title:`Закупівля №${t+1}`,amount:`${(t+1)*D} UAH`})),le={title:"Components/Navigation/PzPaginationProvider",component:M,parameters:{docs:{description:{component:"Generic static-pagination wrapper. Slices `data` into pages, exposes each page item through the `item` scoped slot (`{ item, index, sequenceNumber }`), and renders `PzListNav` when the data exceeds `perPage`. Here it is typed as `PzKeyValueData` and paired with `PzKeyValue`."}}},args:{data:G,perPage:5},argTypes:{data:{control:!1,description:"Full data array; the provider paginates it internally."},perPage:{control:{type:"number",min:1},description:"Items per page."}}},o={render:e=>({components:{pzPaginationProvider:y,pzKeyValue:z,pzText:v},setup(){return{args:e,config:f}},template:`
      <div style="max-width: 640px;">
        <pz-pagination-provider :data="args.data" :per-page="args.perPage">
          <template #item="{ item, sequenceNumber }">
            <article style="padding: 12px 0; border-bottom: 1px solid var(--pz-color-stroke-grey);">
              <pz-text variant="body-bold">#{{ sequenceNumber + 1 }}</pz-text>
              <pz-key-value :config="config" :data="item" />
            </article>
          </template>
        </pz-pagination-provider>
      </div>
    `})},i={parameters:{docs:{description:{story:"`has-auto-scroll` scrolls the provider container to top on page change."}}},render:e=>({components:{pzPaginationProvider:y,pzKeyValue:z,pzText:v},setup(){return{args:e,config:f}},template:`
      <div style="max-width: 640px;">
        <pz-pagination-provider :data="args.data" :per-page="args.perPage" :has-auto-scroll="true">
          <template #item="{ item, sequenceNumber }">
            <article style="padding: 12px 0; border-bottom: 1px solid var(--pz-color-stroke-grey);">
              <pz-text variant="body-bold">#{{ sequenceNumber + 1 }}</pz-text>
              <pz-key-value :config="config" :data="item" />
            </article>
          </template>
        </pz-pagination-provider>
      </div>
    `})};var d,m,c;o.parameters={...o.parameters,docs:{...(d=o.parameters)==null?void 0:d.docs,source:{originalSource:`{
  render: (args: PzPaginationProviderStoryArgs) => ({
    components: {
      pzPaginationProvider: pzPaginationProviderStoryComponent,
      pzKeyValue: pzKeyValueStoryComponent,
      pzText: PzText
    },
    setup() {
      return {
        args,
        config
      };
    },
    template: \`
      <div style="max-width: 640px;">
        <pz-pagination-provider :data="args.data" :per-page="args.perPage">
          <template #item="{ item, sequenceNumber }">
            <article style="padding: 12px 0; border-bottom: 1px solid var(--pz-color-stroke-grey);">
              <pz-text variant="body-bold">#{{ sequenceNumber + 1 }}</pz-text>
              <pz-key-value :config="config" :data="item" />
            </article>
          </template>
        </pz-pagination-provider>
      </div>
    \`
  })
}`,...(c=(m=o.parameters)==null?void 0:m.docs)==null?void 0:c.source}}};var g,u,P;i.parameters={...i.parameters,docs:{...(g=i.parameters)==null?void 0:g.docs,source:{originalSource:`{
  parameters: {
    docs: {
      description: {
        story: "\`has-auto-scroll\` scrolls the provider container to top on page change."
      }
    }
  },
  render: (args: PzPaginationProviderStoryArgs) => ({
    components: {
      pzPaginationProvider: pzPaginationProviderStoryComponent,
      pzKeyValue: pzKeyValueStoryComponent,
      pzText: PzText
    },
    setup() {
      return {
        args,
        config
      };
    },
    template: \`
      <div style="max-width: 640px;">
        <pz-pagination-provider :data="args.data" :per-page="args.perPage" :has-auto-scroll="true">
          <template #item="{ item, sequenceNumber }">
            <article style="padding: 12px 0; border-bottom: 1px solid var(--pz-color-stroke-grey);">
              <pz-text variant="body-bold">#{{ sequenceNumber + 1 }}</pz-text>
              <pz-key-value :config="config" :data="item" />
            </article>
          </template>
        </pz-pagination-provider>
      </div>
    \`
  })
}`,...(P=(u=i.parameters)==null?void 0:u.docs)==null?void 0:P.source}}};const de=["Playground","WithAutoScroll"];export{o as Playground,i as WithAutoScroll,de as __namedExportsOrder,le as default};
