@citygross/components 0.7.186 → 0.7.188

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.
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  export declare type TPagination = {
3
3
  totalItems?: number;
4
4
  fetchItems: (page: number) => void;
@@ -6,5 +6,7 @@ export declare type TPagination = {
6
6
  itemsPerPage?: number;
7
7
  setPage?: (page: number) => void;
8
8
  numOfPaginationsToShow?: number;
9
+ rightIcon?: React.ReactNode;
10
+ leftIcon?: React.ReactNode;
9
11
  };
10
- export declare function Pagination({ totalItems, currentPage, fetchItems, itemsPerPage, setPage, numOfPaginationsToShow }: TPagination): JSX.Element;
12
+ export declare function Pagination({ totalItems, currentPage, fetchItems, itemsPerPage, setPage, numOfPaginationsToShow, rightIcon, leftIcon }: TPagination): JSX.Element;
@@ -1,2 +1,7 @@
1
- export declare const PaginationButtonWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
1
+ declare type TPaginationButtonWrapper = {
2
+ show?: boolean;
3
+ };
4
+ export declare const PaginationButtonWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TPaginationButtonWrapper, never>;
5
+ export declare const LeftPaginationButtonWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, TPaginationButtonWrapper, never>;
2
6
  export declare const Flex: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
7
+ export {};
@@ -39,19 +39,19 @@ function createPagination(totalItems, itemsPerPage, numOfPaginationsToShow) {
39
39
  }
40
40
  function Pagination(_a) {
41
41
  var _b;
42
- var totalItems = _a.totalItems, currentPage = _a.currentPage, fetchItems = _a.fetchItems, itemsPerPage = _a.itemsPerPage, setPage = _a.setPage, _c = _a.numOfPaginationsToShow, numOfPaginationsToShow = _c === void 0 ? 4 : _c;
42
+ var totalItems = _a.totalItems, currentPage = _a.currentPage, fetchItems = _a.fetchItems, itemsPerPage = _a.itemsPerPage, setPage = _a.setPage, _c = _a.numOfPaginationsToShow, numOfPaginationsToShow = _c === void 0 ? 4 : _c, rightIcon = _a.rightIcon, leftIcon = _a.leftIcon;
43
43
  var _d = React.useState(Math.floor((currentPage - 1) / numOfPaginationsToShow)), currentIndex = _d[0], setIndex = _d[1];
44
44
  var pagination = createPagination(totalItems, itemsPerPage, numOfPaginationsToShow);
45
45
  return (React__default["default"].createElement(Box.Box, null, pagination && pagination.length > 0 && (React__default["default"].createElement(Pagination_styles.Flex, null,
46
- currentIndex > 0 && (React__default["default"].createElement(Pagination_styles.PaginationButtonWrapper, null,
46
+ (currentIndex > 0 || leftIcon) && (React__default["default"].createElement(Pagination_styles.LeftPaginationButtonWrapper, { show: currentIndex > 0 },
47
47
  React__default["default"].createElement(PaginationButton.PaginationButton, { color: 'white', onClick: function () {
48
48
  setPage && setPage(currentPage - 1);
49
49
  setIndex(currentIndex - 1);
50
- }, width: 36, height: 36 }, '...'))), (_b = pagination === null || pagination === void 0 ? void 0 : pagination[currentIndex]) === null || _b === void 0 ? void 0 :
50
+ }, width: 36, height: 36 }, leftIcon || '...'))), (_b = pagination === null || pagination === void 0 ? void 0 : pagination[currentIndex]) === null || _b === void 0 ? void 0 :
51
51
  _b.map(function (page) { return (React__default["default"].createElement(Pagination_styles.PaginationButtonWrapper, { key: page },
52
52
  React__default["default"].createElement(PaginationButton.PaginationButton, { color: currentPage === page + 1 ? 'primary' : 'white', width: 36, height: 36, onClick: function () { return fetchItems(page + 1); } }, page + 1))); }),
53
53
  pagination.length > 1 && currentIndex < pagination.length - 1 && (React__default["default"].createElement(Pagination_styles.PaginationButtonWrapper, null,
54
- React__default["default"].createElement(PaginationButton.PaginationButton, { color: 'white', onClick: function () { return setIndex(currentIndex + 1); }, width: 36, height: 36 }, '...')))))));
54
+ React__default["default"].createElement(PaginationButton.PaginationButton, { color: 'white', onClick: function () { return setIndex(currentIndex + 1); }, width: 36, height: 36 }, rightIcon || '...')))))));
55
55
  }
56
56
 
57
57
  exports.Pagination = Pagination;
@@ -10,9 +10,11 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
10
10
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
11
11
 
12
12
  var PaginationButtonWrapper = styled__default["default"].div(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject(["\n padding: 0 ", "px;\n"], ["\n padding: 0 ", "px;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; });
13
- var Flex = styled__default["default"].div(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n display: flex;\n align-items: flex-start;\n justify-content: center;\n"], ["\n display: flex;\n align-items: flex-start;\n justify-content: center;\n"])));
14
- var templateObject_1, templateObject_2;
13
+ var LeftPaginationButtonWrapper = styled__default["default"](PaginationButtonWrapper)(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n padding: 0 ", "px;\n opacity: ", ";\n"], ["\n padding: 0 ", "px;\n opacity: ", ";\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; }, function (props) { return (props.show ? 1 : 0); });
14
+ var Flex = styled__default["default"].div(templateObject_3 || (templateObject_3 = _tslib.__makeTemplateObject(["\n display: flex;\n align-items: flex-start;\n justify-content: center;\n"], ["\n display: flex;\n align-items: flex-start;\n justify-content: center;\n"])));
15
+ var templateObject_1, templateObject_2, templateObject_3;
15
16
 
16
17
  exports.Flex = Flex;
18
+ exports.LeftPaginationButtonWrapper = LeftPaginationButtonWrapper;
17
19
  exports.PaginationButtonWrapper = PaginationButtonWrapper;
18
20
  //# sourceMappingURL=Pagination.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Pagination.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Pagination.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import { PaginationButton } from '../Button/PaginationButton.js';
3
3
  import { Box } from '../Box/Box.js';
4
- import { Flex, PaginationButtonWrapper } from './Pagination.styles.js';
4
+ import { Flex, LeftPaginationButtonWrapper, PaginationButtonWrapper } from './Pagination.styles.js';
5
5
 
6
6
  function createPagination(totalItems, itemsPerPage, numOfPaginationsToShow) {
7
7
  var amountOfPages = Math.ceil((totalItems || 0) / (itemsPerPage !== null && itemsPerPage !== void 0 ? itemsPerPage : 6));
@@ -31,19 +31,19 @@ function createPagination(totalItems, itemsPerPage, numOfPaginationsToShow) {
31
31
  }
32
32
  function Pagination(_a) {
33
33
  var _b;
34
- var totalItems = _a.totalItems, currentPage = _a.currentPage, fetchItems = _a.fetchItems, itemsPerPage = _a.itemsPerPage, setPage = _a.setPage, _c = _a.numOfPaginationsToShow, numOfPaginationsToShow = _c === void 0 ? 4 : _c;
34
+ var totalItems = _a.totalItems, currentPage = _a.currentPage, fetchItems = _a.fetchItems, itemsPerPage = _a.itemsPerPage, setPage = _a.setPage, _c = _a.numOfPaginationsToShow, numOfPaginationsToShow = _c === void 0 ? 4 : _c, rightIcon = _a.rightIcon, leftIcon = _a.leftIcon;
35
35
  var _d = useState(Math.floor((currentPage - 1) / numOfPaginationsToShow)), currentIndex = _d[0], setIndex = _d[1];
36
36
  var pagination = createPagination(totalItems, itemsPerPage, numOfPaginationsToShow);
37
37
  return (React.createElement(Box, null, pagination && pagination.length > 0 && (React.createElement(Flex, null,
38
- currentIndex > 0 && (React.createElement(PaginationButtonWrapper, null,
38
+ (currentIndex > 0 || leftIcon) && (React.createElement(LeftPaginationButtonWrapper, { show: currentIndex > 0 },
39
39
  React.createElement(PaginationButton, { color: 'white', onClick: function () {
40
40
  setPage && setPage(currentPage - 1);
41
41
  setIndex(currentIndex - 1);
42
- }, width: 36, height: 36 }, '...'))), (_b = pagination === null || pagination === void 0 ? void 0 : pagination[currentIndex]) === null || _b === void 0 ? void 0 :
42
+ }, width: 36, height: 36 }, leftIcon || '...'))), (_b = pagination === null || pagination === void 0 ? void 0 : pagination[currentIndex]) === null || _b === void 0 ? void 0 :
43
43
  _b.map(function (page) { return (React.createElement(PaginationButtonWrapper, { key: page },
44
44
  React.createElement(PaginationButton, { color: currentPage === page + 1 ? 'primary' : 'white', width: 36, height: 36, onClick: function () { return fetchItems(page + 1); } }, page + 1))); }),
45
45
  pagination.length > 1 && currentIndex < pagination.length - 1 && (React.createElement(PaginationButtonWrapper, null,
46
- React.createElement(PaginationButton, { color: 'white', onClick: function () { return setIndex(currentIndex + 1); }, width: 36, height: 36 }, '...')))))));
46
+ React.createElement(PaginationButton, { color: 'white', onClick: function () { return setIndex(currentIndex + 1); }, width: 36, height: 36 }, rightIcon || '...')))))));
47
47
  }
48
48
 
49
49
  export { Pagination };
@@ -2,8 +2,9 @@ import { __makeTemplateObject } from '../../../../_virtual/_tslib.js';
2
2
  import styled from 'styled-components';
3
3
 
4
4
  var PaginationButtonWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 0 ", "px;\n"], ["\n padding: 0 ", "px;\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; });
5
- var Flex = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: flex-start;\n justify-content: center;\n"], ["\n display: flex;\n align-items: flex-start;\n justify-content: center;\n"])));
6
- var templateObject_1, templateObject_2;
5
+ var LeftPaginationButtonWrapper = styled(PaginationButtonWrapper)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 0 ", "px;\n opacity: ", ";\n"], ["\n padding: 0 ", "px;\n opacity: ", ";\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xxs; }, function (props) { return (props.show ? 1 : 0); });
6
+ var Flex = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n align-items: flex-start;\n justify-content: center;\n"], ["\n display: flex;\n align-items: flex-start;\n justify-content: center;\n"])));
7
+ var templateObject_1, templateObject_2, templateObject_3;
7
8
 
8
- export { Flex, PaginationButtonWrapper };
9
+ export { Flex, LeftPaginationButtonWrapper, PaginationButtonWrapper };
9
10
  //# sourceMappingURL=Pagination.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Pagination.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
1
+ {"version":3,"file":"Pagination.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citygross/components",
3
- "version": "0.7.186",
3
+ "version": "0.7.188",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "./build/cjs/components/src/index.js",
@@ -71,5 +71,5 @@
71
71
  "moment": "^2.29.1",
72
72
  "react-loading-skeleton": "^2.2.0"
73
73
  },
74
- "gitHead": "1c46ef2a783002e2d2eaa502346c607ea54dbd5c"
74
+ "gitHead": "432a513bd505ca76c986d1cdbce7f47c9748024d"
75
75
  }