import{e as F,f as o,q as s,B as z,v as h,F as I,u as w,c as l,o as i,g as B,t as T}from"./iframe-Bl-fVlm8.js";import{_ as V}from"./PzIcon-cRuuou9i.js";import{_ as $}from"./_plugin-vue_export-helper-DlAUqK2U.js";const E={class:"pz-pagination","aria-label":"Pagination"},M={class:"pz-pagination__list"},S=["disabled"],j={key:0,class:"pz-pagination__dots","aria-hidden":"true"},L=["aria-current","onClick"],O=["disabled"],m=1,r=F({name:"PzPagination",__name:"PzPagination",props:{modelValue:{},total:{},perPage:{},radius:{default:2}},emits:["update:modelValue"],setup(p,{emit:k}){const a=p,u=k,_=l(()=>Math.ceil(a.total/a.perPage)),f=l(()=>a.modelValue<=1),P=l(()=>a.modelValue>=_.value),N=l(()=>{const t=_.value;if(t<=0)return[];if(t===1)return[{type:"page",page:m}];const c=a.modelValue,e=a.radius,d=m+1,b=t-1,v=Math.max(d,c-e),y=Math.min(b,c+e),n=[{type:"page",page:m}];v>d&&n.push({type:"dots",side:"left"});for(let g=v;g<=y;g++)n.push({type:"page",page:g});return y<b&&n.push({type:"dots",side:"right"}),n.push({type:"page",page:t}),n}),x=t=>{t!==a.modelValue&&u("update:modelValue",t)},C=()=>{f.value||u("update:modelValue",a.modelValue-1)},q=()=>{P.value||u("update:modelValue",a.modelValue+1)};return(t,c)=>(i(),o("nav",E,[s("ul",M,[s("li",null,[s("button",{type:"button",class:"pz-pagination__btn pz-pagination__btn--nav",disabled:f.value,"aria-label":"Попередня сторінка",onClick:C},[z(h(V),{name:"chevron_left",size:"24"})],8,S)]),(i(!0),o(I,null,w(N.value,e=>(i(),o("li",{key:e.type==="page"?`p-${e.page}`:`d-${e.side}`,class:"pz-pagination__item"},[e.type==="dots"?(i(),o("span",j," … ")):(i(),o("button",{key:1,type:"button",class:B(["pz-pagination__btn",{"pz-pagination__btn--active":e.page===p.modelValue}]),"aria-current":e.page===p.modelValue?"page":void 0,onClick:d=>x(e.page)},T(e.page),11,L))]))),128)),s("li",null,[s("button",{type:"button",class:"pz-pagination__btn pz-pagination__btn--nav",disabled:P.value,"aria-label":"Наступна сторінка",onClick:q},[z(h(V),{name:"chevron_right",size:"24"})],8,O)])])]))}}),R=$(r,[["__scopeId","data-v-f128b85c"]]);r.__docgenInfo=Object.assign({displayName:r.name??r.__name},{name:"PzPagination",exportName:"default",displayName:"PzPagination",description:"",tags:{},props:[{name:"modelValue",required:!0,type:{name:"number"}},{name:"total",required:!0,type:{name:"number"}},{name:"perPage",required:!0,type:{name:"number"}},{name:"radius",required:!1,type:{name:"number"},defaultValue:{func:!1,value:"2"}}],sourceFiles:["/builds/Web-Projects/client-services/prozorro-ui/src/components/Navigation/PzPagination/PzPagination.vue"]});export{R as P};
