@bikdotai/bik-component-library 0.0.777 → 0.0.778
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/TablePagination/TablePagination.d.ts +1 -0
- package/dist/cjs/components/TablePagination/TablePagination.js +1 -1
- package/dist/esm/components/TablePagination/TablePagination.d.ts +1 -0
- package/dist/esm/components/TablePagination/TablePagination.js +1 -1
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ export type TablePaginationProps = {
|
|
|
8
8
|
updatePageNumber: (pageNumber: number) => void;
|
|
9
9
|
updatePageSize: (option: DropdownOption | DropdownOption[]) => void;
|
|
10
10
|
showTotalText?: boolean;
|
|
11
|
+
totalTextAlignment?: 'left' | 'right';
|
|
11
12
|
removeBorder?: boolean;
|
|
12
13
|
containerStyle?: React.CSSProperties;
|
|
13
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("../../assets/icons/chevronLeft.svg.js"),t=require("../../assets/icons/chevronRight.svg.js");require("../dropdown/DropdownPopover/index.js");var n=require("../dropdown/Dropdown.js");require("../dropdown/ChipDropdown.js"),require("react"),require("../zeroState/ZeroState.js"),require("lodash/debounce");var r=require("../TypographyStyle.js"),s=require("../../constants/Theme.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var i=require("./TablePagination.styled.js");const a=o=>{let{pageStart:t,pageEnd:n,totalRows:i,shouldShow:a}=o;if(!a)return null;const d=s.DEFAULT_THEME.colorsV2;return e.jsxs(r.BodySecondary,Object.assign({style:{color:d.content.placeholder}},{children:["Showing ",t,"-",n>i?i:n," of"," ",i," results"]}))};exports.TablePagination=d=>{let{pageNumber:l,pageSize:c,totalRows:p,updatePageNumber:u,updatePageSize:g,hidePageSizeOptions:j,showTotalText:h,totalTextAlignment:w="right",containerStyle:m={}}=d;const y=s.DEFAULT_THEME.colorsV2,x=(l-1)*c+1,q=(l-1)*c+c,b=Math.ceil(p/c),S=1==b;let v=[];v=b>=5?l===b?[l-4,l-3,l-2,l-1,l]:1===l?[l,l+1,l+2,l+3,l+4]:2===l?[l-1,l,l+1,l+2,l+3]:l===b-1?[l-3,l-2,l-1,l,l+1]:[l-2,l-1,l,l+1,l+2]:Array.from({length:b},((e,o)=>o+1));const O=[{label:"5 rows per page",value:"5",selected:5===c},{label:"10 rows per page",value:"10",selected:10===c},{label:"20 rows per page",value:"20",selected:20===c}];return e.jsxs(i.StyledTablePaginationContainer,Object.assign({style:m},{children:[!j&&e.jsx("div",{children:e.jsx(n.Dropdown,{size:"small",options:O,onSelect:g,width:"162px"})}),e.jsxs("div",Object.assign({className:"paging__container"},{children:[e.jsx(a,{pageStart:x,pageEnd:q,totalRows:p,shouldShow:!!(!j&&p>0||j&&p>0&&h&&"left"===w)}),e.jsxs("div",Object.assign({className:"pages__buttons-container"},{children:[!S&&e.jsx(i.StyledPagingContainer,Object.assign({active:!1,onClick:()=>{1!==l&&u(Math.max(l-1,1))},disabled:1===l},{children:e.jsx(o.default,{color:y.content.secondary,height:14,width:14})})),v.map((o=>e.jsx(i.StyledPagingContainer,Object.assign({active:o==l,onClick:()=>u(o),style:{display:1==o&&p<=c?"none":"flex"}},{children:e.jsx(r.BodySecondary,Object.assign({style:{color:o==l?y.content.primaryInverse:y.content.secondary}},{children:o}))}),o))),!S&&e.jsx(i.StyledPagingContainer,Object.assign({isLast:!0,active:!1,onClick:()=>{l!==b&&u(Math.min(l+1,b))},disabled:l===b},{children:e.jsx(t.default,{color:y.content.secondary,height:14,width:14})}))]})),e.jsx(a,{pageStart:x,pageEnd:q,totalRows:p,shouldShow:!!(j&&p>0&&h&&"right"===w)})]}))]}))};
|
|
@@ -8,6 +8,7 @@ export type TablePaginationProps = {
|
|
|
8
8
|
updatePageNumber: (pageNumber: number) => void;
|
|
9
9
|
updatePageSize: (option: DropdownOption | DropdownOption[]) => void;
|
|
10
10
|
showTotalText?: boolean;
|
|
11
|
+
totalTextAlignment?: 'left' | 'right';
|
|
11
12
|
removeBorder?: boolean;
|
|
12
13
|
containerStyle?: React.CSSProperties;
|
|
13
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as o}from"react/jsx-runtime";import t from"../../assets/icons/chevronLeft.svg.js";import n from"../../assets/icons/chevronRight.svg.js";import"../dropdown/DropdownPopover/index.js";import{Dropdown as
|
|
1
|
+
import{jsxs as e,jsx as o}from"react/jsx-runtime";import t from"../../assets/icons/chevronLeft.svg.js";import n from"../../assets/icons/chevronRight.svg.js";import"../dropdown/DropdownPopover/index.js";import{Dropdown as r}from"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"react";import"../zeroState/ZeroState.js";import"lodash/debounce";import{BodySecondary as s}from"../TypographyStyle.js";import{DEFAULT_THEME as i}from"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../icon-button/IconButton.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";import{StyledTablePaginationContainer as p,StyledPagingContainer as d}from"./TablePagination.styled.js";const a=o=>{let{pageStart:t,pageEnd:n,totalRows:r,shouldShow:p}=o;if(!p)return null;const d=i.colorsV2;return e(s,Object.assign({style:{color:d.content.placeholder}},{children:["Showing ",t,"-",n>r?r:n," of"," ",r," results"]}))},l=l=>{let{pageNumber:c,pageSize:m,totalRows:h,updatePageNumber:g,updatePageSize:w,hidePageSizeOptions:u,showTotalText:j,totalTextAlignment:y="right",containerStyle:b={}}=l;const S=i.colorsV2,O=(c-1)*m+1,v=(c-1)*m+m,f=Math.ceil(h/m),D=1==f;let x=[];x=f>=5?c===f?[c-4,c-3,c-2,c-1,c]:1===c?[c,c+1,c+2,c+3,c+4]:2===c?[c-1,c,c+1,c+2,c+3]:c===f-1?[c-3,c-2,c-1,c,c+1]:[c-2,c-1,c,c+1,c+2]:Array.from({length:f},((e,o)=>o+1));const M=[{label:"5 rows per page",value:"5",selected:5===m},{label:"10 rows per page",value:"10",selected:10===m},{label:"20 rows per page",value:"20",selected:20===m}];return e(p,Object.assign({style:b},{children:[!u&&o("div",{children:o(r,{size:"small",options:M,onSelect:w,width:"162px"})}),e("div",Object.assign({className:"paging__container"},{children:[o(a,{pageStart:O,pageEnd:v,totalRows:h,shouldShow:!!(!u&&h>0||u&&h>0&&j&&"left"===y)}),e("div",Object.assign({className:"pages__buttons-container"},{children:[!D&&o(d,Object.assign({active:!1,onClick:()=>{1!==c&&g(Math.max(c-1,1))},disabled:1===c},{children:o(t,{color:S.content.secondary,height:14,width:14})})),x.map((e=>o(d,Object.assign({active:e==c,onClick:()=>g(e),style:{display:1==e&&h<=m?"none":"flex"}},{children:o(s,Object.assign({style:{color:e==c?S.content.primaryInverse:S.content.secondary}},{children:e}))}),e))),!D&&o(d,Object.assign({isLast:!0,active:!1,onClick:()=>{c!==f&&g(Math.min(c+1,f))},disabled:c===f},{children:o(n,{color:S.content.secondary,height:14,width:14})}))]})),o(a,{pageStart:O,pageEnd:v,totalRows:h,shouldShow:!!(u&&h>0&&j&&"right"===y)})]}))]}))};export{l as TablePagination};
|