UNPKG

@numl-react/pagination

Version:

A simple and accessible component for React by numl design

2 lines (1 loc) 3.49 kB
var e=Object.defineProperty,n=Object.prototype.hasOwnProperty,t=Object.getOwnPropertySymbols,r=Object.prototype.propertyIsEnumerable,l=(n,t,r)=>t in n?e(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,c=(e,c)=>{for(var o in c||(c={}))n.call(c,o)&&l(e,o,c[o]);if(t)for(var o of t(c))r.call(c,o)&&l(e,o,c[o]);return e},o=(e,l)=>{var c={};for(var o in e)n.call(e,o)&&l.indexOf(o)<0&&(c[o]=e[o]);if(null!=e&&t)for(var o of t(e))l.indexOf(o)<0&&r.call(e,o)&&(c[o]=e[o]);return c};import i from"react";import*as a from"@numl-react/elements";function d(e){const{size:n="1.25rem"}=e,t=o(e,["size"]);return i.createElement(a.Icon,c({size:n},t))}function u(e){const{children:n,type:t="medium",icon:r,menu:l,selectable:d=!1,dropdownIcon:m=!0,theme:p,onTap:s}=e,h=o(e,["children","type","icon","menu","selectable","dropdownIcon","theme","onTap"]);let f,x;return"small"===t?(f="sm",x="1x 2x"):"medium"===t?(f="md",x="1.5x 2.5x"):"large"===t?(f="lg",x="2x 3x"):"extralarge"===t&&(f="xl",x="2x 4x"),i.createElement(a.Button,c({block:!0,outline:"n",theme:p,size:f,selectable:d,padding:x,onTap:s},h),r&&"string"==typeof r?i.createElement(u.Icon,{padding:"0",name:r,theme:p}):r,n,(g=l)&&null!=g&&""!==g&&void 0!==g&&"object"==typeof l?i.createElement(i.Fragment,null,m?i.createElement(a.DropdownIcon,{theme:p}):null,i.createElement(u.Popup,{width:"max-content"},l)):null);var g}function m(e){const{flow:n="row",label:t,previous:r,type:l="medium",next:m}=e,p=o(e,["flow","label","previous","type","next"]);return i.createElement(u.SegmentedGroup,c({fill:"transparent",flex:!0,items:"stretch",border:"0","group-radius":n,flow:n},p),"string"==typeof r?i.createElement(a.Button,{type:l,id:"previous"},i.createElement(d,{name:r})):i.createElement(a.BaseElement,null,r),t?i.createElement(a.Flex,{flex:!0,items:"center",fill:"bg"},i.createElement(a.Label,{padding:"0 1x",color:"text"},t)):null,"string"==typeof m?i.createElement(a.Button,{type:l,id:"next"},i.createElement(d,{name:m})):i.createElement(a.BaseElement,null,m))}u.Small=e=>{const{children:n=null}=e,t=o(e,["children"]);return i.createElement(u,c({padding:"0.75x 2x",size:"sm"},t),n)},u.Medium=e=>{const{children:n=null}=e,t=o(e,["children"]);return i.createElement(u,c({padding:"1.5x 2.5x",size:"md"},t),n)},u.Large=e=>{const{children:n=null}=e,t=o(e,["children"]);return i.createElement(u,c({padding:"2x 3x",size:"lg"},t),n)},u.ExtraLarge=e=>{const{children:n=null}=e,t=o(e,["children"]);return i.createElement(u,c({padding:"2x 4x",size:"xl"},t),n)},u.Label=function(e){const{children:n}=e,t=o(e,["children"]);return i.createElement(a.Label,c({},t),n)},u.Icon=function(e){const{children:n,padding:t="0 0.5x"}=e,r=o(e,["children","padding"]);return i.createElement(a.Icon,c({padding:t},r),n)},u.Popup=function(e){const{children:n}=e,t=o(e,["children"]);return i.createElement(a.Popup,c({"nu-btnpopup":!0,place:"outside-bottom right"},t),n)},u.Item=function(e){const{children:n,width:t="100%",outline:r="n"}=e,l=o(e,["children","width","outline"]);return i.createElement(a.Menuitem,c({width:t,outline:r},l),n)},u.Checkbox=function(e){const{children:n,padding:t="0"}=e,r=o(e,["children","padding"]);return i.createElement(a.Checkbox,c({padding:t},r),n)},u.Group=function(e){const{children:n}=e,t=o(e,["children"]);return i.createElement(a.Flex,c({flow:"row",fill:"transparent",gap:!0},t),n)},u.SegmentedGroup=function(e){const{children:n}=e,t=o(e,["children"]);return i.createElement(a.ButtonGroup,c({},t),n)};export{m as Pagination};