@civicactions/cmsds-open-data-components 2.1.1 → 2.1.3

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 (93) hide show
  1. package/README.md +20 -0
  2. package/dist/main.js +15 -9
  3. package/dist/main.js.map +1 -1
  4. package/package.json +1 -1
  5. package/dist/scss/components/additional-information-table.scss +0 -9
  6. package/dist/scss/components/breadcrumb.scss +0 -32
  7. package/dist/scss/components/dataset-downloads.scss +0 -0
  8. package/dist/scss/components/dataset-search-facets.scss +0 -10
  9. package/dist/scss/components/dataset-search-list-item.scss +0 -20
  10. package/dist/scss/components/dataset-tags.scss +0 -4
  11. package/dist/scss/components/datatable.scss +0 -24
  12. package/dist/scss/components/index.scss +0 -9
  13. package/dist/scss/components/pagination.scss +0 -59
  14. package/dist/scss/components/resource-information-table.scss +0 -5
  15. package/dist/scss/index.scss +0 -24
  16. package/dist/scss/templates/dataset-search.scss +0 -38
  17. package/dist/scss/templates/dataset.scss +0 -44
  18. package/dist/scss/templates/filtered-resource.scss +0 -19
  19. package/dist/scss/templates/footer.scss +0 -83
  20. package/dist/scss/templates/header.scss +0 -402
  21. package/dist/scss/templates/index.scss +0 -7
  22. package/dist/scss/templates/query-builder.scss +0 -22
  23. package/dist/scss/templates/swagger.scss +0 -21
  24. package/lib/assets/frequencyMap.js +0 -22
  25. package/lib/assets/icons/close.js +0 -33
  26. package/lib/assets/icons/close.jsx +0 -24
  27. package/lib/assets/icons/copy.js +0 -33
  28. package/lib/assets/icons/copy.jsx +0 -23
  29. package/lib/assets/icons/download.js +0 -33
  30. package/lib/assets/icons/download.jsx +0 -23
  31. package/lib/assets/icons/settings.js +0 -34
  32. package/lib/assets/icons/settings.jsx +0 -24
  33. package/lib/assets/images/CMSGovLogo-O.png +0 -0
  34. package/lib/assets/images/CMSgov@2x-white-O.png +0 -0
  35. package/lib/assets/metadataMapping.js +0 -161
  36. package/lib/assets/metadataMapping.jsx +0 -110
  37. package/lib/commands/index.js +0 -7
  38. package/lib/commands/templates/footer.js +0 -61
  39. package/lib/commands/templates/header.js +0 -84
  40. package/lib/commands/templates/page_not_found.js +0 -14
  41. package/lib/components/ApiDocumentation/index.js +0 -24
  42. package/lib/components/Breadcrumb/index.js +0 -47
  43. package/lib/components/DataTableDensity/datatabledensity.test.js +0 -30
  44. package/lib/components/DataTableDensity/index.js +0 -47
  45. package/lib/components/DataTableRowChanger/datatablerowchanger.test.js +0 -49
  46. package/lib/components/DataTableRowChanger/index.js +0 -46
  47. package/lib/components/DatasetAdditionalInformation/index.js +0 -59
  48. package/lib/components/DatasetDownloads/datasetdownloads.test.js +0 -30
  49. package/lib/components/DatasetDownloads/index.js +0 -34
  50. package/lib/components/DatasetSearchFacets/dataset_search_facets.test.js +0 -103
  51. package/lib/components/DatasetSearchFacets/index.js +0 -104
  52. package/lib/components/DatasetSearchListItem/datasetsearchlistitem.test.js +0 -44
  53. package/lib/components/DatasetSearchListItem/index.js +0 -86
  54. package/lib/components/DatasetTags/datasettags.test.js +0 -40
  55. package/lib/components/DatasetTags/index.js +0 -38
  56. package/lib/components/Hero/index.js +0 -92
  57. package/lib/components/ManageColumns/index.js +0 -36
  58. package/lib/components/NavBar/index.js +0 -55
  59. package/lib/components/NavLink/index.js +0 -60
  60. package/lib/components/NavLink/navlink.test.js +0 -35
  61. package/lib/components/Pagination/index.js +0 -263
  62. package/lib/components/Pagination/pagination.test.js +0 -541
  63. package/lib/components/ResourceConditionField/ResourceConditionalField.test.js +0 -20
  64. package/lib/components/ResourceConditionField/index.js +0 -246
  65. package/lib/components/ResourceFilter/index.js +0 -174
  66. package/lib/components/ResourceFilter/resourcefilter.test.js +0 -440
  67. package/lib/components/ResourceFooter/index.js +0 -34
  68. package/lib/components/ResourceHeader/index.js +0 -149
  69. package/lib/components/ResourceInformation/index.js +0 -37
  70. package/lib/components/ResourcePreview/index.js +0 -139
  71. package/lib/components/SearchModal/index.js +0 -116
  72. package/lib/components/SubMenu/index.js +0 -86
  73. package/lib/components/TransformedDate/index.js +0 -34
  74. package/lib/components/useAddLoginLink/index.js +0 -44
  75. package/lib/components/useScrollToTop/index.js +0 -22
  76. package/lib/index.js +0 -247
  77. package/lib/templates/APIPage/index.js +0 -30
  78. package/lib/templates/Dataset/DatasetBody.js +0 -189
  79. package/lib/templates/Dataset/index.js +0 -83
  80. package/lib/templates/DatasetSearch/datasetsearch.test.js +0 -122
  81. package/lib/templates/DatasetSearch/index.js +0 -356
  82. package/lib/templates/DrupalPage/index.js +0 -37
  83. package/lib/templates/FilteredResource/FilteredResourceBody.js +0 -160
  84. package/lib/templates/FilteredResource/QueryBuilder.js +0 -235
  85. package/lib/templates/FilteredResource/QueryRow.js +0 -175
  86. package/lib/templates/FilteredResource/QueryTitle.js +0 -89
  87. package/lib/templates/FilteredResource/functions.js +0 -142
  88. package/lib/templates/FilteredResource/index.js +0 -95
  89. package/lib/templates/Footer/footer.test.js +0 -48
  90. package/lib/templates/Footer/index.js +0 -366
  91. package/lib/templates/PageNotFound/index.js +0 -25
  92. package/lib/templates/header/index.js +0 -112
  93. package/lib/templates/mobile_header/index.js +0 -199
package/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # cmsds-open-data-components
2
+
3
+ This repo acts as an upstream common react library for CMS Open Data sites. This library is powered by [Parcel](https://parceljs.org/).
4
+
5
+ ## Local Development
6
+
7
+ For local development, we recommend using [npm workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces).
8
+ Once you have a workspace directory, install this library inside your workspace along any Open Data downstream sites you wish to work on.
9
+
10
+ In the root folder for this project, run `npm run watch` to build local code. Ensure the upstream is using the same version number located in package.json of this repo. Start the upstream site locally as well, and it should load local code from this repo as the dependency. Parcel also provides hot rebuilding while `watch` is running.
11
+
12
+ ## Publishing new versions
13
+
14
+ Run ```npm run build``` to create a production version of the library before publishing to npm.
15
+ Run ```npm publish``` to publish to npm
16
+
17
+ ## Testing
18
+
19
+ Jest tests can be run using:
20
+ ```npm run test```
package/dist/main.js CHANGED
@@ -4,13 +4,13 @@ import $hgUW1$react, {useState as $hgUW1$useState, useRef as $hgUW1$useRef, useE
4
4
  import {Button as $hgUW1$Button, TextField as $hgUW1$TextField, Spinner as $hgUW1$Spinner, Alert as $hgUW1$Alert, Pagination as $hgUW1$Pagination, Dropdown as $hgUW1$Dropdown, Badge as $hgUW1$Badge, Accordion as $hgUW1$Accordion, AccordionItem as $hgUW1$AccordionItem, Choice as $hgUW1$Choice, Tooltip as $hgUW1$Tooltip, Table as $hgUW1$Table, TableHead as $hgUW1$TableHead, TableRow as $hgUW1$TableRow, TableCell as $hgUW1$TableCell, TableBody as $hgUW1$TableBody, Dialog as $hgUW1$Dialog, HelpDrawer as $hgUW1$HelpDrawer} from "@cmsgov/design-system";
5
5
  import $hgUW1$proptypes from "prop-types";
6
6
  import {NavLink as $hgUW1$NavLink, useLocation as $hgUW1$useLocation, useSearchParams as $hgUW1$useSearchParams, Link as $hgUW1$Link, useNavigate as $hgUW1$useNavigate} from "react-router-dom";
7
+ import $hgUW1$qs from "qs";
7
8
  import $hgUW1$swaggeruireact from "swagger-ui-react";
8
9
  import "swagger-ui-react/swagger-ui.css";
9
- import $hgUW1$qs from "qs";
10
10
  import {useQuery as $hgUW1$useQuery, QueryClient as $hgUW1$QueryClient, QueryClientProvider as $hgUW1$QueryClientProvider} from "@tanstack/react-query";
11
11
  import $hgUW1$axios from "axios";
12
- import $hgUW1$reacttexttruncate from "react-text-truncate";
13
12
  import $hgUW1$dompurify from "dompurify";
13
+ import $hgUW1$reacttexttruncate from "react-text-truncate";
14
14
  import {createColumnHelper as $hgUW1$createColumnHelper, useReactTable as $hgUW1$useReactTable, getCoreRowModel as $hgUW1$getCoreRowModel, getSortedRowModel as $hgUW1$getSortedRowModel, flexRender as $hgUW1$flexRender} from "@tanstack/react-table";
15
15
  import {useMediaQuery as $hgUW1$useMediaQuery} from "react-responsive";
16
16
  import {usePopper as $hgUW1$usePopper} from "react-popper";
@@ -622,8 +622,11 @@ const $007dd6bfbe0f2956$var$DatasetSearch = ({ rootUrl: rootUrl , pageTitle: pag
622
622
  encode: false,
623
623
  skipEmptyString: true
624
624
  })}`));
625
- if (data && totalItems != data.data.total) setTotalItems(data.data.total);
626
- const { theme: theme , keyword: keyword } = (0, $116bd29db288848e$export$959638e8dca60ce6)(data ? data.data.facets : []);
625
+ if (data && data.data.total && totalItems != data.data.total) setTotalItems(data.data.total);
626
+ const { theme: theme , keyword: keyword } = data && data.data.facets ? (0, $116bd29db288848e$export$959638e8dca60ce6)(data ? data.data.facets : []) : {
627
+ theme: null,
628
+ keyword: null
629
+ };
627
630
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("section", {
628
631
  className: "ds-l-container",
629
632
  children: [
@@ -681,7 +684,7 @@ const $007dd6bfbe0f2956$var$DatasetSearch = ({ rootUrl: rootUrl , pageTitle: pag
681
684
  children: [
682
685
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
683
686
  children: [
684
- currentResultNumbers && /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
687
+ currentResultNumbers && data && /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
685
688
  className: "ds-u-margin-y--0",
686
689
  role: "region",
687
690
  "aria-live": "polite",
@@ -721,7 +724,7 @@ const $007dd6bfbe0f2956$var$DatasetSearch = ({ rootUrl: rootUrl , pageTitle: pag
721
724
  variation: "error",
722
725
  heading: "No results found."
723
726
  }),
724
- Object.keys(data.data.results).map((key)=>{
727
+ data && data.data.results ? Object.keys(data.data.results).map((key)=>{
725
728
  return data.data.results[key];
726
729
  }).map((item)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
727
730
  className: "ds-u-padding--0",
@@ -729,10 +732,13 @@ const $007dd6bfbe0f2956$var$DatasetSearch = ({ rootUrl: rootUrl , pageTitle: pag
729
732
  item: item,
730
733
  updateFacets: updateSelectedFacets
731
734
  })
732
- }, item.identifier))
735
+ }, item.identifier)) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
736
+ variation: "error",
737
+ heading: "Could not connect to the API."
738
+ })
733
739
  ]
734
740
  }),
735
- data.data.total != 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
741
+ data && data.data.total && data.data.total !== 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
736
742
  id: "test-default",
737
743
  currentPage: Number(page),
738
744
  totalPages: Math.ceil(Number(data.data.total) / pageSize),
@@ -4140,7 +4146,7 @@ const $374c4669b044ddf8$var$QueryRow = ({ id: id , condition: condition , index:
4140
4146
  children: "Value"
4141
4147
  })
4142
4148
  }),
4143
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$reactdatepicker).default, {
4149
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$reactdatepicker), {
4144
4150
  name: `${condition.key}_date_value`,
4145
4151
  selected: (0, $7264a673914aa746$export$e284ae5d89467c8f)(startDate),
4146
4152
  onChange: (date)=>{