@dhis2-ui/pagination 8.14.9 → 8.15.0-alpha.1

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.
@@ -61,17 +61,15 @@ var _translations26 = _interopRequireDefault(require("./uk/translations.json"));
61
61
 
62
62
  var _translations27 = _interopRequireDefault(require("./ur/translations.json"));
63
63
 
64
- var _translations28 = _interopRequireDefault(require("./uz_Latn/translations.json"));
64
+ var _translations28 = _interopRequireDefault(require("./uz/translations.json"));
65
65
 
66
- var _translations29 = _interopRequireDefault(require("./uz_UZ_Cyrl/translations.json"));
66
+ var _translations29 = _interopRequireDefault(require("./uz_Latn/translations.json"));
67
67
 
68
- var _translations30 = _interopRequireDefault(require("./uz_UZ_Latn/translations.json"));
68
+ var _translations30 = _interopRequireDefault(require("./vi/translations.json"));
69
69
 
70
- var _translations31 = _interopRequireDefault(require("./vi/translations.json"));
70
+ var _translations31 = _interopRequireDefault(require("./zh/translations.json"));
71
71
 
72
- var _translations32 = _interopRequireDefault(require("./zh/translations.json"));
73
-
74
- var _translations33 = _interopRequireDefault(require("./zh_CN/translations.json"));
72
+ var _translations32 = _interopRequireDefault(require("./zh_CN/translations.json"));
75
73
 
76
74
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
77
75
 
@@ -139,17 +137,15 @@ _d2I18n.default.addResources('uk', namespace, _translations26.default);
139
137
 
140
138
  _d2I18n.default.addResources('ur', namespace, _translations27.default);
141
139
 
142
- _d2I18n.default.addResources('uz_Latn', namespace, _translations28.default);
143
-
144
- _d2I18n.default.addResources('uz_UZ_Cyrl', namespace, _translations29.default);
140
+ _d2I18n.default.addResources('uz', namespace, _translations28.default);
145
141
 
146
- _d2I18n.default.addResources('uz_UZ_Latn', namespace, _translations30.default);
142
+ _d2I18n.default.addResources('uz_Latn', namespace, _translations29.default);
147
143
 
148
- _d2I18n.default.addResources('vi', namespace, _translations31.default);
144
+ _d2I18n.default.addResources('vi', namespace, _translations30.default);
149
145
 
150
- _d2I18n.default.addResources('zh', namespace, _translations32.default);
146
+ _d2I18n.default.addResources('zh', namespace, _translations31.default);
151
147
 
152
- _d2I18n.default.addResources('zh_CN', namespace, _translations33.default);
148
+ _d2I18n.default.addResources('zh_CN', namespace, _translations32.default);
153
149
 
154
150
  var _default = _d2I18n.default;
155
151
  exports.default = _default;
@@ -9,8 +9,6 @@ var _style = _interopRequireDefault(require("styled-jsx/style"));
9
9
 
10
10
  var _propTypes = require("@dhis2/prop-types");
11
11
 
12
- var _uiConstants = require("@dhis2/ui-constants");
13
-
14
12
  var _classnames = _interopRequireDefault(require("classnames"));
15
13
 
16
14
  var _propTypes2 = _interopRequireDefault(require("prop-types"));
@@ -71,9 +69,9 @@ const Pagination = _ref => {
71
69
  const showPageSelect = !hidePageSelect && typeof pageCount === 'number' && pageCount > 1 && pageCount <= MAX_PAGE_COUNT;
72
70
  return /*#__PURE__*/_react.default.createElement("div", {
73
71
  "data-test": dataTest,
74
- className: _style.default.dynamic([["3796520840", [_uiConstants.spacers.dp4]]]) + " " + ((0, _classnames.default)('container', className) || "")
72
+ className: "jsx-3647884394" + " " + ((0, _classnames.default)('container', className) || "")
75
73
  }, hidePageSizeSelect ? /*#__PURE__*/_react.default.createElement("div", {
76
- className: _style.default.dynamic([["3796520840", [_uiConstants.spacers.dp4]]]) + " " + "spacer"
74
+ className: "jsx-3647884394" + " " + "spacer"
77
75
  }) : /*#__PURE__*/_react.default.createElement(_pageSizeSelect.PageSizeSelect, {
78
76
  dataTest: dataTest,
79
77
  disabled: disabled,
@@ -91,7 +89,7 @@ const Pagination = _ref => {
91
89
  pageSummaryText: pageSummaryText,
92
90
  total: total
93
91
  }), /*#__PURE__*/_react.default.createElement("div", {
94
- className: _style.default.dynamic([["3796520840", [_uiConstants.spacers.dp4]]]) + " " + "page-navigation"
92
+ className: "jsx-3647884394" + " " + "page-navigation"
95
93
  }, showPageSelect && /*#__PURE__*/_react.default.createElement(_pageSelect.PageSelect, {
96
94
  dataTest: dataTest,
97
95
  disabled: disabled,
@@ -108,9 +106,8 @@ const Pagination = _ref => {
108
106
  isNextDisabled: disabled || isLastPage || page === pageCount,
109
107
  isPreviousDisabled: disabled || page === 1
110
108
  })), /*#__PURE__*/_react.default.createElement(_style.default, {
111
- id: "3796520840",
112
- dynamic: [_uiConstants.spacers.dp4]
113
- }, [".container.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;row-gap:".concat(_uiConstants.spacers.dp4, ";}"), ".spacer.__jsx-style-dynamic-selector{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".page-navigation.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;min-height:32px;}"]));
109
+ id: "3647884394"
110
+ }, [".container.jsx-3647884394{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;}", ".spacer.jsx-3647884394{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".page-navigation.jsx-3647884394{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;min-height:32px;}"]));
114
111
  };
115
112
 
116
113
  exports.Pagination = Pagination;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.WithoutPageSummary = exports.WithoutPageSizeSelect = exports.WithoutGoToPageSelect = exports.WithoutAnySelect = exports.WithCustomPageSummary = exports.PagerAtLastPage = exports.PagerAtFirstPage = exports.NoTotalAtLastPageWithoutPageLength = exports.NoTotalAtLastPage = exports.NoTotal = exports.NarrowWidth = exports.MediumWidth = exports.Disabled = exports.Default = void 0;
6
+ exports.default = exports.WithoutPageSummary = exports.WithoutPageSizeSelect = exports.WithoutGoToPageSelect = exports.WithoutAnySelect = exports.WithCustomPageSummary = exports.PagerAtLastPage = exports.PagerAtFirstPage = exports.NoTotalAtLastPageWithoutPageLength = exports.NoTotalAtLastPage = exports.NoTotal = exports.Disabled = exports.Default = void 0;
7
7
 
8
8
  var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
9
9
 
@@ -106,27 +106,4 @@ exports.WithoutAnySelect = WithoutAnySelect;
106
106
  WithoutAnySelect.args = { ...pagers.atTenthPage,
107
107
  ...WithoutGoToPageSelect.args,
108
108
  ...WithoutPageSizeSelect.args
109
- };
110
-
111
- const InBox = _ref => {
112
- let {
113
- boxWidth,
114
- ...args
115
- } = _ref;
116
- return /*#__PURE__*/_react.default.createElement("div", {
117
- style: {
118
- width: boxWidth
119
- }
120
- }, /*#__PURE__*/_react.default.createElement(_pagination.Pagination, args));
121
- };
122
-
123
- const MediumWidth = InBox.bind({});
124
- exports.MediumWidth = MediumWidth;
125
- MediumWidth.args = { ...pagers.atTenthPage,
126
- boxWidth: 500
127
- };
128
- const NarrowWidth = InBox.bind({});
129
- exports.NarrowWidth = NarrowWidth;
130
- NarrowWidth.args = { ...pagers.atTenthPage,
131
- boxWidth: 100
132
109
  };
@@ -34,9 +34,8 @@ import tetTranslations from './tet/translations.json';
34
34
  import tgTranslations from './tg/translations.json';
35
35
  import ukTranslations from './uk/translations.json';
36
36
  import urTranslations from './ur/translations.json';
37
+ import uzTranslations from './uz/translations.json';
37
38
  import uz_LatnTranslations from './uz_Latn/translations.json';
38
- import uz_UZ_CyrlTranslations from './uz_UZ_Cyrl/translations.json';
39
- import uz_UZ_LatnTranslations from './uz_UZ_Latn/translations.json';
40
39
  import viTranslations from './vi/translations.json';
41
40
  import zhTranslations from './zh/translations.json';
42
41
  import zh_CNTranslations from './zh_CN/translations.json';
@@ -68,9 +67,8 @@ i18n.addResources('tet', namespace, tetTranslations);
68
67
  i18n.addResources('tg', namespace, tgTranslations);
69
68
  i18n.addResources('uk', namespace, ukTranslations);
70
69
  i18n.addResources('ur', namespace, urTranslations);
70
+ i18n.addResources('uz', namespace, uzTranslations);
71
71
  i18n.addResources('uz_Latn', namespace, uz_LatnTranslations);
72
- i18n.addResources('uz_UZ_Cyrl', namespace, uz_UZ_CyrlTranslations);
73
- i18n.addResources('uz_UZ_Latn', namespace, uz_UZ_LatnTranslations);
74
72
  i18n.addResources('vi', namespace, viTranslations);
75
73
  i18n.addResources('zh', namespace, zhTranslations);
76
74
  i18n.addResources('zh_CN', namespace, zh_CNTranslations);
@@ -1,6 +1,5 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
2
  import { requiredIf } from '@dhis2/prop-types';
3
- import { spacers } from '@dhis2/ui-constants';
4
3
  import cx from 'classnames';
5
4
  import PropTypes from 'prop-types';
6
5
  import React from 'react';
@@ -49,9 +48,9 @@ const Pagination = _ref => {
49
48
  const showPageSelect = !hidePageSelect && typeof pageCount === 'number' && pageCount > 1 && pageCount <= MAX_PAGE_COUNT;
50
49
  return /*#__PURE__*/React.createElement("div", {
51
50
  "data-test": dataTest,
52
- className: _JSXStyle.dynamic([["3796520840", [spacers.dp4]]]) + " " + (cx('container', className) || "")
51
+ className: "jsx-3647884394" + " " + (cx('container', className) || "")
53
52
  }, hidePageSizeSelect ? /*#__PURE__*/React.createElement("div", {
54
- className: _JSXStyle.dynamic([["3796520840", [spacers.dp4]]]) + " " + "spacer"
53
+ className: "jsx-3647884394" + " " + "spacer"
55
54
  }) : /*#__PURE__*/React.createElement(PageSizeSelect, {
56
55
  dataTest: dataTest,
57
56
  disabled: disabled,
@@ -69,7 +68,7 @@ const Pagination = _ref => {
69
68
  pageSummaryText: pageSummaryText,
70
69
  total: total
71
70
  }), /*#__PURE__*/React.createElement("div", {
72
- className: _JSXStyle.dynamic([["3796520840", [spacers.dp4]]]) + " " + "page-navigation"
71
+ className: "jsx-3647884394" + " " + "page-navigation"
73
72
  }, showPageSelect && /*#__PURE__*/React.createElement(PageSelect, {
74
73
  dataTest: dataTest,
75
74
  disabled: disabled,
@@ -86,9 +85,8 @@ const Pagination = _ref => {
86
85
  isNextDisabled: disabled || isLastPage || page === pageCount,
87
86
  isPreviousDisabled: disabled || page === 1
88
87
  })), /*#__PURE__*/React.createElement(_JSXStyle, {
89
- id: "3796520840",
90
- dynamic: [spacers.dp4]
91
- }, [".container.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;row-gap:".concat(spacers.dp4, ";}"), ".spacer.__jsx-style-dynamic-selector{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".page-navigation.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;min-height:32px;}"]));
88
+ id: "3647884394"
89
+ }, [".container.jsx-3647884394{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;}", ".spacer.jsx-3647884394{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".page-navigation.jsx-3647884394{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;min-height:32px;}"]));
92
90
  };
93
91
 
94
92
  Pagination.defaultProps = {
@@ -76,25 +76,4 @@ export const WithoutAnySelect = Template.bind({});
76
76
  WithoutAnySelect.args = { ...pagers.atTenthPage,
77
77
  ...WithoutGoToPageSelect.args,
78
78
  ...WithoutPageSizeSelect.args
79
- };
80
-
81
- const InBox = _ref => {
82
- let {
83
- boxWidth,
84
- ...args
85
- } = _ref;
86
- return /*#__PURE__*/React.createElement("div", {
87
- style: {
88
- width: boxWidth
89
- }
90
- }, /*#__PURE__*/React.createElement(Pagination, args));
91
- };
92
-
93
- export const MediumWidth = InBox.bind({});
94
- MediumWidth.args = { ...pagers.atTenthPage,
95
- boxWidth: 500
96
- };
97
- export const NarrowWidth = InBox.bind({});
98
- NarrowWidth.args = { ...pagers.atTenthPage,
99
- boxWidth: 100
100
79
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2-ui/pagination",
3
- "version": "8.14.9",
3
+ "version": "8.15.0-alpha.1",
4
4
  "description": "UI Pagination",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,20 +33,22 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@dhis2/prop-types": "^3.1.2",
36
- "@dhis2-ui/button": "8.14.9",
37
- "@dhis2-ui/select": "8.14.9",
38
- "@dhis2/ui-constants": "8.14.9",
39
- "@dhis2/ui-icons": "8.14.9",
36
+ "@dhis2-ui/button": "8.15.0-alpha.1",
37
+ "@dhis2-ui/select": "8.15.0-alpha.1",
38
+ "@dhis2/ui-constants": "8.15.0-alpha.1",
39
+ "@dhis2/ui-icons": "8.15.0-alpha.1",
40
40
  "classnames": "^2.3.1",
41
41
  "prop-types": "^15.7.2"
42
42
  },
43
43
  "files": [
44
- "build"
44
+ "build",
45
+ "types"
45
46
  ],
46
47
  "devDependencies": {
47
48
  "@dhis2/d2-i18n": "^1.1.0",
48
49
  "react": "16.13",
49
50
  "react-dom": "16.13",
50
51
  "styled-jsx": "^4.0.1"
51
- }
52
+ },
53
+ "types": "types"
52
54
  }
@@ -0,0 +1,28 @@
1
+ import * as React from 'react'
2
+
3
+ type TranslateableProp = string | ((argv0: any) => string)
4
+
5
+ export interface PaginationProps {
6
+ page: number
7
+ pageSize: number
8
+ className?: string
9
+ dataTest?: string
10
+ disabled?: boolean
11
+ hidePageSelect?: boolean
12
+ hidePageSizeSelect?: boolean
13
+ hidePageSummary?: boolean
14
+ isLastPage?: boolean
15
+ nextPageText?: TranslateableProp
16
+ pageCount?: number
17
+ pageLength?: boolean
18
+ pageSelectText?: TranslateableProp
19
+ pageSizeSelectText?: TranslateableProp
20
+ pageSizes?: string[]
21
+ pageSummaryText?: TranslateableProp
22
+ previousPageText?: TranslateableProp
23
+ total?: number
24
+ onPageChange?: (page: number) => void
25
+ onPageSizeChange?: (pageSize: number) => void
26
+ }
27
+
28
+ export const Pagination: React.FC<PaginationProps>
@@ -1,10 +0,0 @@
1
- {
2
- "Page {{page}} of {{pageCount}}, items {{firstItem}}-{{lastItem}} of {{total}}": "",
3
- "Page {{page}}, items {{firstItem}}-{{lastItem}}": "",
4
- "Page {{page}}": "",
5
- "Next": "Кейинги",
6
- "Page": "Sahifa",
7
- "Items per page": "",
8
- "Previous": "Oldingi",
9
- "You are at page {{page}} showing items {{firstItem}}-{{lastItem}}, but there are {{pageCount}} pages and {{total}} items": ""
10
- }
@@ -1,10 +0,0 @@
1
- {
2
- "Page {{page}} of {{pageCount}}, items {{firstItem}}-{{lastItem}} of {{total}}": "",
3
- "Page {{page}}, items {{firstItem}}-{{lastItem}}": "",
4
- "Page {{page}}": "",
5
- "Next": "Кейинги",
6
- "Page": "Sahifa",
7
- "Items per page": "",
8
- "Previous": "Oldingi",
9
- "You are at page {{page}} showing items {{firstItem}}-{{lastItem}}, but there are {{pageCount}} pages and {{total}} items": ""
10
- }