import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["items","value","size","form","containerEventListener","onChange","getItemKey","getItemAs","getItemAttributes","getItemClickable","getItemLabel","getItemOnClick","getItemRef","className","arrows","hotKeys","outerMostArrows"];import"./PaginationBase.css";import React,{forwardRef}from"react";import{useRefs}from"../../../hooks/useRefs";import{cnMixFlex}from"../../../mixs/MixFlex";import{cn}from"../../../utils/bem";import{paginationArrowIconsMap,withDefaultGetters}from"../helpers";import{PaginationArrow}from"../PaginationArrow";import{PaginationList}from"../PaginationList";import{paginationPropFormDefault,paginationPropSizeDefault}from"../types";import{usePaginationKeys}from"../usePaginationKeys";var cnPaginationBase=cn("PaginationBase"),PaginationBaseRender=function(a,b){var c=withDefaultGetters(a),d=c.items,e=void 0===d?[]:d,f=c.value,g=c.size,h=void 0===g?paginationPropSizeDefault:g,i=c.form,j=void 0===i?paginationPropFormDefault:i,k=c.containerEventListener,l=c.onChange,m=c.getItemKey,n=c.getItemAs,o=c.getItemAttributes,p=c.getItemClickable,q=c.getItemLabel,r=c.getItemOnClick,s=c.getItemRef,t=c.className,u=c.arrows,v=c.hotKeys,w=c.outerMostArrows,x=_objectWithoutProperties(c,_excluded),y=useRefs(2),z=_slicedToArray(y,2),A=z[0],B=z[1];usePaginationKeys({prevButtonRef:A,nextButtonRef:B,containerEventListener:k,hotKeys:v});var C=function(a,b,c,d){if(!a)return null;var e=a.onClick,f=a.icon,g=void 0===f?paginationArrowIconsMap[b]:f,i=a.label,k=a.disabled,l="first"===b||"previous"===b?"start":"end";return React.createElement(PaginationArrow,{label:i,icon:g,disabled:k,ref:c,size:h,form:j,caption:null===d||void 0===d?void 0:d.label,orientation:l,onClick:e})};return React.createElement("div",Object.assign({className:cnPaginationBase(null,[t,cnMixFlex({wrap:"nowrap",gap:"3xs"})]),ref:b},x),(null===w||void 0===w?void 0:w[0])&&C(w[0],"first",void 0),(null===u||void 0===u?void 0:u[0])&&C(u[0],"previous",A,null===v||void 0===v?void 0:v[0]),React.createElement(PaginationList,{items:e,size:h,form:j,value:f,onItemClick:function onItemClick(a,b){var c=b.e;null===l||void 0===l?void 0:l(a,{e:c})},getItemKey:m,getItemAs:n,getItemAttributes:o,getItemClickable:p,getItemLabel:q,getItemOnClick:r,getItemRef:s}),(null===u||void 0===u?void 0:u[1])&&C(u[1],"next",B,null===v||void 0===v?void 0:v[1]),(null===w||void 0===w?void 0:w[1])&&C(w[1],"last",void 0))};export var PaginationBase=forwardRef(PaginationBaseRender);
//# sourceMappingURL=PaginationBase.js.map