@civicactions/cmsds-open-data-components 3.0.0-alpha.3 → 3.0.0-alpha.5

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.
Files changed (77) hide show
  1. package/dist/main.css +33 -10
  2. package/dist/main.css.map +1 -1
  3. package/dist/main.js +122 -173
  4. package/dist/main.js.map +1 -1
  5. package/dist/types.d.ts +0 -14
  6. package/dist/types.d.ts.map +1 -1
  7. package/package.json +1 -1
  8. package/lib/assets/frequencyMap.js +0 -22
  9. package/lib/assets/icons/close.js +0 -33
  10. package/lib/assets/icons/close.jsx +0 -24
  11. package/lib/assets/icons/copy.js +0 -33
  12. package/lib/assets/icons/copy.jsx +0 -23
  13. package/lib/assets/icons/download.js +0 -33
  14. package/lib/assets/icons/download.jsx +0 -23
  15. package/lib/assets/icons/settings.js +0 -34
  16. package/lib/assets/icons/settings.jsx +0 -24
  17. package/lib/assets/images/CMSGovLogo-O.png +0 -0
  18. package/lib/assets/images/CMSgov@2x-white-O.png +0 -0
  19. package/lib/assets/metadataMapping.js +0 -161
  20. package/lib/assets/metadataMapping.jsx +0 -110
  21. package/lib/commands/index.js +0 -7
  22. package/lib/commands/templates/footer.js +0 -61
  23. package/lib/commands/templates/header.js +0 -84
  24. package/lib/commands/templates/page_not_found.js +0 -14
  25. package/lib/components/ApiDocumentation/index.js +0 -24
  26. package/lib/components/Breadcrumb/index.js +0 -47
  27. package/lib/components/DataTableDensity/datatabledensity.test.js +0 -30
  28. package/lib/components/DataTableDensity/index.js +0 -47
  29. package/lib/components/DataTableRowChanger/datatablerowchanger.test.js +0 -49
  30. package/lib/components/DataTableRowChanger/index.js +0 -46
  31. package/lib/components/DatasetAdditionalInformation/index.js +0 -59
  32. package/lib/components/DatasetDownloads/datasetdownloads.test.js +0 -30
  33. package/lib/components/DatasetDownloads/index.js +0 -34
  34. package/lib/components/DatasetSearchFacets/dataset_search_facets.test.js +0 -103
  35. package/lib/components/DatasetSearchFacets/index.js +0 -104
  36. package/lib/components/DatasetSearchListItem/datasetsearchlistitem.test.js +0 -44
  37. package/lib/components/DatasetSearchListItem/index.js +0 -86
  38. package/lib/components/DatasetTags/datasettags.test.js +0 -40
  39. package/lib/components/DatasetTags/index.js +0 -38
  40. package/lib/components/Hero/index.js +0 -92
  41. package/lib/components/ManageColumns/index.js +0 -36
  42. package/lib/components/NavBar/index.js +0 -55
  43. package/lib/components/NavLink/index.js +0 -60
  44. package/lib/components/NavLink/navlink.test.js +0 -35
  45. package/lib/components/Pagination/index.js +0 -263
  46. package/lib/components/Pagination/pagination.test.js +0 -541
  47. package/lib/components/ResourceConditionField/ResourceConditionalField.test.js +0 -20
  48. package/lib/components/ResourceConditionField/index.js +0 -246
  49. package/lib/components/ResourceFilter/index.js +0 -174
  50. package/lib/components/ResourceFilter/resourcefilter.test.js +0 -440
  51. package/lib/components/ResourceFooter/index.js +0 -34
  52. package/lib/components/ResourceHeader/index.js +0 -149
  53. package/lib/components/ResourceInformation/index.js +0 -37
  54. package/lib/components/ResourcePreview/index.js +0 -139
  55. package/lib/components/SearchModal/index.js +0 -116
  56. package/lib/components/SubMenu/index.js +0 -86
  57. package/lib/components/TransformedDate/index.js +0 -34
  58. package/lib/components/useAddLoginLink/index.js +0 -44
  59. package/lib/components/useScrollToTop/index.js +0 -22
  60. package/lib/index.js +0 -247
  61. package/lib/templates/APIPage/index.js +0 -30
  62. package/lib/templates/Dataset/DatasetBody.js +0 -189
  63. package/lib/templates/Dataset/index.js +0 -83
  64. package/lib/templates/DatasetSearch/datasetsearch.test.js +0 -122
  65. package/lib/templates/DatasetSearch/index.js +0 -356
  66. package/lib/templates/DrupalPage/index.js +0 -37
  67. package/lib/templates/FilteredResource/FilteredResourceBody.js +0 -160
  68. package/lib/templates/FilteredResource/QueryBuilder.js +0 -235
  69. package/lib/templates/FilteredResource/QueryRow.js +0 -175
  70. package/lib/templates/FilteredResource/QueryTitle.js +0 -89
  71. package/lib/templates/FilteredResource/functions.js +0 -142
  72. package/lib/templates/FilteredResource/index.js +0 -95
  73. package/lib/templates/Footer/footer.test.js +0 -48
  74. package/lib/templates/Footer/index.js +0 -366
  75. package/lib/templates/PageNotFound/index.js +0 -25
  76. package/lib/templates/header/index.js +0 -112
  77. package/lib/templates/mobile_header/index.js +0 -199
@@ -1,263 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports["default"] = void 0;
11
-
12
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
-
14
- var _react = _interopRequireWildcard(require("react"));
15
-
16
- var _designSystem = require("@cmsgov/design-system");
17
-
18
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
-
20
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
-
22
- var Pagination = function Pagination(_ref) {
23
- var totalPages = _ref.totalPages,
24
- currentPage = _ref.currentPage,
25
- buttonAction = _ref.buttonAction;
26
- var maxLength = 7; // Expectation starts at 1
27
- // only shows 7 buttons plus prev/next
28
-
29
- function addFirst() {
30
- // extra + 1 is number of siblings
31
- if (currentPage > 1 + 1) {
32
- return [{
33
- id: 1,
34
- text: 1
35
- }];
36
- } else {
37
- return [];
38
- }
39
- }
40
-
41
- function addLast() {
42
- // extra + 1 is number of siblings
43
- if (currentPage < totalPages) {
44
- return [{
45
- id: totalPages,
46
- text: totalPages
47
- }];
48
- } else {
49
- return [];
50
- }
51
- }
52
-
53
- function addPrev() {
54
- if (currentPage > 1) {
55
- return [{
56
- id: 'previous',
57
- text: 'Previous'
58
- }];
59
- }
60
-
61
- return [{
62
- id: 'previous',
63
- text: 'Previous',
64
- disabled: true
65
- }];
66
- }
67
-
68
- function addNext() {
69
- if (currentPage < totalPages) {
70
- return [{
71
- id: 'next',
72
- text: 'Next'
73
- }];
74
- }
75
-
76
- return [{
77
- id: 'next',
78
- text: 'Next',
79
- disabled: true
80
- }];
81
- }
82
-
83
- function buildSiblings() {
84
- // add check if current page less than totalPages
85
- var siblings = [{
86
- id: currentPage,
87
- text: currentPage,
88
- currentPage: true
89
- }];
90
-
91
- if (currentPage > 1) {
92
- siblings.unshift({
93
- id: currentPage - 1,
94
- text: currentPage - 1
95
- });
96
- }
97
-
98
- if (currentPage < totalPages - 1) {
99
- siblings.push({
100
- id: currentPage + 1,
101
- text: currentPage + 1
102
- });
103
- }
104
-
105
- return siblings;
106
- }
107
-
108
- function buildPreSiblings() {
109
- var preSiblings = [];
110
- var remainingSpots = 0;
111
-
112
- if (currentPage === 4) {
113
- remainingSpots = 1;
114
- preSiblings.push({
115
- id: '2',
116
- text: 2
117
- });
118
- }
119
-
120
- if (currentPage > 4) {
121
- remainingSpots = 1;
122
- preSiblings.push({
123
- id: 'predots',
124
- text: '...'
125
- });
126
- }
127
-
128
- if (currentPage > 4 && currentPage >= totalPages - 2) {
129
- remainingSpots = 1;
130
- preSiblings.push({
131
- id: totalPages - 4,
132
- text: totalPages - 4
133
- });
134
- }
135
-
136
- if (currentPage > 4 && currentPage >= totalPages - 1) {
137
- remainingSpots = 1;
138
- preSiblings.push({
139
- id: totalPages - 3,
140
- text: totalPages - 3
141
- });
142
- }
143
-
144
- if (currentPage > 4 && currentPage === totalPages) {
145
- remainingSpots = 1;
146
- preSiblings.push({
147
- id: totalPages - 2,
148
- text: totalPages - 2
149
- });
150
- }
151
-
152
- return preSiblings;
153
- }
154
-
155
- function buildPostSiblings() {
156
- var postSiblings = [];
157
- var remainingSpots = maxLength - (currentPage + 1) - 1;
158
-
159
- if (currentPage < 5) {
160
- for (var spot = 1; spot < remainingSpots; spot++) {
161
- // console.log('post-spot', spot)
162
- postSiblings.push({
163
- id: currentPage + 1 + spot,
164
- text: currentPage + 1 + spot
165
- });
166
- }
167
-
168
- postSiblings.push({
169
- id: 'postdots',
170
- text: '...'
171
- });
172
- }
173
-
174
- if (currentPage >= 5 && currentPage < totalPages - 3) {
175
- postSiblings.push({
176
- id: 'postdots',
177
- text: '...'
178
- });
179
- }
180
-
181
- if (currentPage >= 5 && currentPage === totalPages - 3) {
182
- postSiblings.push({
183
- id: totalPages - 1,
184
- text: totalPages - 1
185
- });
186
- }
187
-
188
- return postSiblings;
189
- }
190
-
191
- function buttonValue(item) {
192
- if (item === 'Previous') {
193
- return currentPage - 1;
194
- }
195
-
196
- if (item === 'Next') {
197
- return currentPage + 1;
198
- }
199
-
200
- return item;
201
- }
202
-
203
- function addAll() {
204
- var items = (0, _toConsumableArray2["default"])(Array(totalPages));
205
- return items.map(function (item, index) {
206
- return {
207
- id: index + 1,
208
- text: index + 1
209
- };
210
- });
211
- }
212
-
213
- function buildAll() {
214
- if (totalPages > 0 && totalPages <= maxLength) {
215
- return [].concat((0, _toConsumableArray2["default"])(addPrev()), (0, _toConsumableArray2["default"])(addAll()), (0, _toConsumableArray2["default"])(addNext()));
216
- }
217
-
218
- if (totalPages > 0 && totalPages > maxLength) {
219
- return [].concat((0, _toConsumableArray2["default"])(addPrev()), (0, _toConsumableArray2["default"])(addFirst()), (0, _toConsumableArray2["default"])(buildPreSiblings()), (0, _toConsumableArray2["default"])(buildSiblings()), (0, _toConsumableArray2["default"])(buildPostSiblings()), (0, _toConsumableArray2["default"])(addLast()), (0, _toConsumableArray2["default"])(addNext()));
220
- }
221
-
222
- return [];
223
- }
224
-
225
- return /*#__PURE__*/_react["default"].createElement("div", {
226
- className: "dc-pagination"
227
- }, /*#__PURE__*/_react["default"].createElement("nav", null, /*#__PURE__*/_react["default"].createElement("ol", {
228
- className: "ds-u-display--flex ds-u-flex-direction--row ds-u-padding-x--0"
229
- }, buildAll().map(function (item) {
230
- var buttonClass = '';
231
- var liClass = '';
232
-
233
- if (item.text === 'Previous') {
234
- buttonClass = 'dc-pagination--previous__button';
235
- liClass = 'dc-pagination--previous';
236
- }
237
-
238
- if (item.text === 'Next') {
239
- buttonClass = 'dc-pagination--next__button';
240
- liClass = 'dc-pagination--next';
241
- }
242
-
243
- if (item.currentPage || item.text === currentPage) {
244
- buttonClass = 'dc-pagination-current__button';
245
- }
246
-
247
- return /*#__PURE__*/_react["default"].createElement("li", {
248
- key: item.id,
249
- className: liClass
250
- }, item.id === 'postdots' || item.id === 'predots' ? /*#__PURE__*/_react["default"].createElement("span", null, item.text) : /*#__PURE__*/_react["default"].createElement(_designSystem.Button, {
251
- className: buttonClass,
252
- disabled: item.disabled ? item.disabled : false,
253
- size: "small",
254
- variation: "transparent",
255
- onClick: function onClick() {
256
- return buttonAction(buttonValue(item.text));
257
- }
258
- }, item.text));
259
- }))));
260
- };
261
-
262
- var _default = Pagination;
263
- exports["default"] = _default;