@citygross/components 0.7.183 → 0.7.185
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/build/cjs/components/src/components/MenuListItem/MenuListItem.styles.js +2 -2
- package/build/cjs/components/src/components/Pagination/Pagination.js +5 -4
- package/build/cjs/components/src/components/Pagination/Pagination.js.map +1 -1
- package/build/es/components/src/components/MenuListItem/MenuListItem.styles.js +2 -2
- package/build/es/components/src/components/Pagination/Pagination.js +5 -4
- package/build/es/components/src/components/Pagination/Pagination.js.map +1 -1
- package/package.json +2 -2
|
@@ -13,11 +13,11 @@ var MenuListItemWrapper = styled__default["default"].div(templateObject_1 || (te
|
|
|
13
13
|
var MainCategoryWrapper = styled__default["default"].div(templateObject_2 || (templateObject_2 = _tslib.__makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n padding: ", "px;\n cursor: pointer;\n background-color: ", ";\n min-height: ", "px;\n align-items: center;\n &:hover {\n ", ";\n }\n"], ["\n display: flex;\n justify-content: space-between;\n padding: ", "px;\n cursor: pointer;\n background-color: ", ";\n min-height: ", "px;\n align-items: center;\n &:hover {\n ", ";\n }\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; }, function (props) { var _a; return props.isOpen ? props.backgroundColor : (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.white; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xl; }, function (props) { return props.hoverBackground && "background:".concat(props.hoverBackground); });
|
|
14
14
|
var NestedWrapper = styled__default["default"](MainCategoryWrapper)(templateObject_3 || (templateObject_3 = _tslib.__makeTemplateObject(["\n padding: ", ";\n display: flex;\n flex-direction: column;\n ", "\n"], ["\n padding: ", ";\n display: flex;\n flex-direction: column;\n ", "\n"])), function (props) { var _a; return (props.nested ? 0 : "".concat((_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs, "px")); }, function (props) {
|
|
15
15
|
return props.iconWidth &&
|
|
16
|
-
"* {\n min-width: ".concat(props.iconWidth, ";\n }");
|
|
16
|
+
"* {\n min-width: ".concat(props.iconWidth, "px;\n }");
|
|
17
17
|
});
|
|
18
18
|
var HeaderWrapper = styled__default["default"](MainCategoryWrapper)(templateObject_4 || (templateObject_4 = _tslib.__makeTemplateObject(["\n padding-left: ", "px;\n &:hover {\n text-decoration: underline;\n }\n ", "\n"], ["\n padding-left: ", "px;\n &:hover {\n text-decoration: underline;\n }\n ", "\n"])), function (props) { return props.paddingLeft; }, function (props) {
|
|
19
19
|
return props.iconWidth &&
|
|
20
|
-
"* {\n min-width: ".concat(props.iconWidth, ";\n }");
|
|
20
|
+
"* {\n min-width: ".concat(props.iconWidth, "px;\n }");
|
|
21
21
|
});
|
|
22
22
|
styled__default["default"](MainCategoryWrapper)(templateObject_5 || (templateObject_5 = _tslib.__makeTemplateObject(["\n padding-left: ", "px;\n align-self: flex-start;\n"], ["\n padding-left: ", "px;\n align-self: flex-start;\n"])), function (props) { return props.paddingLeft; });
|
|
23
23
|
var HeaderText = styled__default["default"].h2(templateObject_6 || (templateObject_6 = _tslib.__makeTemplateObject(["\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n"], ["\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size.s4; }, function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.weight.semiBold; }, function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.lineHeight.m2; });
|
|
@@ -38,16 +38,17 @@ function createPagination(totalItems, itemsPerPage, numOfPaginationsToShow) {
|
|
|
38
38
|
return pagination;
|
|
39
39
|
}
|
|
40
40
|
function Pagination(_a) {
|
|
41
|
-
var
|
|
42
|
-
var
|
|
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;
|
|
43
|
+
var _d = React.useState(Math.floor((currentPage - 1) / numOfPaginationsToShow)), currentIndex = _d[0], setIndex = _d[1];
|
|
43
44
|
var pagination = createPagination(totalItems, itemsPerPage, numOfPaginationsToShow);
|
|
44
45
|
return (React__default["default"].createElement(Box.Box, null, pagination && pagination.length > 0 && (React__default["default"].createElement(Pagination_styles.Flex, null,
|
|
45
46
|
currentIndex > 0 && (React__default["default"].createElement(Pagination_styles.PaginationButtonWrapper, null,
|
|
46
47
|
React__default["default"].createElement(PaginationButton.PaginationButton, { color: 'white', onClick: function () {
|
|
47
48
|
setPage && setPage(currentPage - 1);
|
|
48
49
|
setIndex(currentIndex - 1);
|
|
49
|
-
}, width: 36, height: 36 }, '...'))),
|
|
50
|
-
|
|
50
|
+
}, width: 36, height: 36 }, '...'))), (_b = pagination === null || pagination === void 0 ? void 0 : pagination[currentIndex]) === null || _b === void 0 ? void 0 :
|
|
51
|
+
_b.map(function (page) { return (React__default["default"].createElement(Pagination_styles.PaginationButtonWrapper, { key: page },
|
|
51
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))); }),
|
|
52
53
|
pagination.length > 1 && currentIndex < pagination.length - 1 && (React__default["default"].createElement(Pagination_styles.PaginationButtonWrapper, null,
|
|
53
54
|
React__default["default"].createElement(PaginationButton.PaginationButton, { color: 'white', onClick: function () { return setIndex(currentIndex + 1); }, width: 36, height: 36 }, '...')))))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Pagination.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -5,11 +5,11 @@ var MenuListItemWrapper = styled.div(templateObject_1 || (templateObject_1 = __m
|
|
|
5
5
|
var MainCategoryWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n padding: ", "px;\n cursor: pointer;\n background-color: ", ";\n min-height: ", "px;\n align-items: center;\n &:hover {\n ", ";\n }\n"], ["\n display: flex;\n justify-content: space-between;\n padding: ", "px;\n cursor: pointer;\n background-color: ", ";\n min-height: ", "px;\n align-items: center;\n &:hover {\n ", ";\n }\n"])), function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs; }, function (props) { var _a; return props.isOpen ? props.backgroundColor : (_a = props.theme.palette) === null || _a === void 0 ? void 0 : _a.white; }, function (props) { var _a; return (_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xl; }, function (props) { return props.hoverBackground && "background:".concat(props.hoverBackground); });
|
|
6
6
|
var NestedWrapper = styled(MainCategoryWrapper)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: ", ";\n display: flex;\n flex-direction: column;\n ", "\n"], ["\n padding: ", ";\n display: flex;\n flex-direction: column;\n ", "\n"])), function (props) { var _a; return (props.nested ? 0 : "".concat((_a = props.theme.spacings) === null || _a === void 0 ? void 0 : _a.xs, "px")); }, function (props) {
|
|
7
7
|
return props.iconWidth &&
|
|
8
|
-
"* {\n min-width: ".concat(props.iconWidth, ";\n }");
|
|
8
|
+
"* {\n min-width: ".concat(props.iconWidth, "px;\n }");
|
|
9
9
|
});
|
|
10
10
|
var HeaderWrapper = styled(MainCategoryWrapper)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding-left: ", "px;\n &:hover {\n text-decoration: underline;\n }\n ", "\n"], ["\n padding-left: ", "px;\n &:hover {\n text-decoration: underline;\n }\n ", "\n"])), function (props) { return props.paddingLeft; }, function (props) {
|
|
11
11
|
return props.iconWidth &&
|
|
12
|
-
"* {\n min-width: ".concat(props.iconWidth, ";\n }");
|
|
12
|
+
"* {\n min-width: ".concat(props.iconWidth, "px;\n }");
|
|
13
13
|
});
|
|
14
14
|
styled(MainCategoryWrapper)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding-left: ", "px;\n align-self: flex-start;\n"], ["\n padding-left: ", "px;\n align-self: flex-start;\n"])), function (props) { return props.paddingLeft; });
|
|
15
15
|
var HeaderText = styled.h2(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n"], ["\n font-size: ", "px;\n font-weight: ", ";\n line-height: ", "px;\n"])), function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.size.s4; }, function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.weight.semiBold; }, function (props) { var _a; return (_a = props.theme.typography) === null || _a === void 0 ? void 0 : _a.lineHeight.m2; });
|
|
@@ -30,16 +30,17 @@ function createPagination(totalItems, itemsPerPage, numOfPaginationsToShow) {
|
|
|
30
30
|
return pagination;
|
|
31
31
|
}
|
|
32
32
|
function Pagination(_a) {
|
|
33
|
-
var
|
|
34
|
-
var
|
|
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;
|
|
35
|
+
var _d = useState(Math.floor((currentPage - 1) / numOfPaginationsToShow)), currentIndex = _d[0], setIndex = _d[1];
|
|
35
36
|
var pagination = createPagination(totalItems, itemsPerPage, numOfPaginationsToShow);
|
|
36
37
|
return (React.createElement(Box, null, pagination && pagination.length > 0 && (React.createElement(Flex, null,
|
|
37
38
|
currentIndex > 0 && (React.createElement(PaginationButtonWrapper, null,
|
|
38
39
|
React.createElement(PaginationButton, { color: 'white', onClick: function () {
|
|
39
40
|
setPage && setPage(currentPage - 1);
|
|
40
41
|
setIndex(currentIndex - 1);
|
|
41
|
-
}, width: 36, height: 36 }, '...'))),
|
|
42
|
-
|
|
42
|
+
}, width: 36, height: 36 }, '...'))), (_b = pagination === null || pagination === void 0 ? void 0 : pagination[currentIndex]) === null || _b === void 0 ? void 0 :
|
|
43
|
+
_b.map(function (page) { return (React.createElement(PaginationButtonWrapper, { key: page },
|
|
43
44
|
React.createElement(PaginationButton, { color: currentPage === page + 1 ? 'primary' : 'white', width: 36, height: 36, onClick: function () { return fetchItems(page + 1); } }, page + 1))); }),
|
|
44
45
|
pagination.length > 1 && currentIndex < pagination.length - 1 && (React.createElement(PaginationButtonWrapper, null,
|
|
45
46
|
React.createElement(PaginationButton, { color: 'white', onClick: function () { return setIndex(currentIndex + 1); }, width: 36, height: 36 }, '...')))))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Pagination.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citygross/components",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.185",
|
|
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": "
|
|
74
|
+
"gitHead": "aa1a3a7e9cebfc5948a40c485746d3a5839a718f"
|
|
75
75
|
}
|