@civicactions/cmsds-open-data-components 2.1.0-alpha.4 → 2.1.0

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 (65) hide show
  1. package/dist/main.js +26 -71
  2. package/dist/main.js.map +1 -1
  3. package/dist/types.d.ts +6 -0
  4. package/dist/types.d.ts.map +1 -1
  5. package/lib/assets/icons/close.js +4 -0
  6. package/lib/assets/icons/copy.js +4 -0
  7. package/lib/assets/icons/download.js +4 -0
  8. package/lib/assets/icons/settings.js +5 -2
  9. package/lib/assets/metadataMapping.js +9 -0
  10. package/lib/commands/index.js +2 -0
  11. package/lib/commands/templates/footer.js +2 -0
  12. package/lib/components/ApiDocumentation/index.js +6 -0
  13. package/lib/components/Breadcrumb/index.js +8 -2
  14. package/lib/components/DataTableDensity/datatabledensity.test.js +5 -0
  15. package/lib/components/DataTableDensity/index.js +7 -1
  16. package/lib/components/DataTableRowChanger/datatablerowchanger.test.js +5 -0
  17. package/lib/components/DataTableRowChanger/index.js +8 -2
  18. package/lib/components/DatasetAdditionalInformation/index.js +17 -4
  19. package/lib/components/DatasetDownloads/datasetdownloads.test.js +5 -0
  20. package/lib/components/DatasetDownloads/index.js +6 -1
  21. package/lib/components/DatasetSearchFacets/dataset_search_facets.test.js +14 -0
  22. package/lib/components/DatasetSearchFacets/index.js +26 -10
  23. package/lib/components/DatasetSearchListItem/datasetsearchlistitem.test.js +9 -1
  24. package/lib/components/DatasetSearchListItem/index.js +17 -6
  25. package/lib/components/DatasetTags/datasettags.test.js +5 -0
  26. package/lib/components/DatasetTags/index.js +6 -0
  27. package/lib/components/Hero/index.js +18 -8
  28. package/lib/components/ManageColumns/index.js +13 -3
  29. package/lib/components/NavBar/index.js +55 -0
  30. package/lib/components/NavLink/index.js +11 -2
  31. package/lib/components/NavLink/navlink.test.js +6 -0
  32. package/lib/components/Pagination/index.js +46 -4
  33. package/lib/components/Pagination/pagination.test.js +478 -367
  34. package/lib/components/ResourceConditionField/ResourceConditionalField.test.js +5 -1
  35. package/lib/components/ResourceConditionField/index.js +62 -30
  36. package/lib/components/ResourceFilter/index.js +39 -10
  37. package/lib/components/ResourceFilter/resourcefilter.test.js +297 -234
  38. package/lib/components/ResourceFooter/index.js +11 -4
  39. package/lib/components/ResourceHeader/index.js +54 -30
  40. package/lib/components/ResourceInformation/index.js +6 -1
  41. package/lib/components/ResourcePreview/index.js +30 -13
  42. package/lib/components/SearchModal/index.js +28 -11
  43. package/lib/components/SubMenu/index.js +20 -5
  44. package/lib/components/TransformedDate/index.js +7 -1
  45. package/lib/components/useAddLoginLink/index.js +13 -3
  46. package/lib/components/useScrollToTop/index.js +6 -1
  47. package/lib/index.js +247 -0
  48. package/lib/templates/APIPage/index.js +6 -1
  49. package/lib/templates/Dataset/DatasetBody.js +42 -12
  50. package/lib/templates/Dataset/index.js +26 -7
  51. package/lib/templates/DatasetSearch/datasetsearch.test.js +70 -50
  52. package/lib/templates/DatasetSearch/index.js +83 -43
  53. package/lib/templates/DrupalPage/index.js +13 -6
  54. package/lib/templates/FilteredResource/FilteredResourceBody.js +43 -15
  55. package/lib/templates/FilteredResource/QueryBuilder.js +59 -17
  56. package/lib/templates/FilteredResource/QueryRow.js +43 -20
  57. package/lib/templates/FilteredResource/QueryTitle.js +18 -2
  58. package/lib/templates/FilteredResource/functions.js +17 -5
  59. package/lib/templates/FilteredResource/index.js +36 -16
  60. package/lib/templates/Footer/footer.test.js +7 -2
  61. package/lib/templates/Footer/index.js +23 -11
  62. package/lib/templates/PageNotFound/index.js +5 -1
  63. package/lib/templates/header/index.js +26 -17
  64. package/lib/templates/mobile_header/index.js +42 -22
  65. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -4,12 +4,11 @@ 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";
8
7
  import $hgUW1$swaggeruireact from "swagger-ui-react";
9
8
  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$dompurify from "dompurify";
13
12
  import $hgUW1$reacttexttruncate from "react-text-truncate";
14
13
  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
14
  import {useMediaQuery as $hgUW1$useMediaQuery} from "react-responsive";
@@ -166,25 +165,14 @@ var $f57121650539d8c5$export$2e2bcd8739ae039 = $f57121650539d8c5$var$NavBar;
166
165
 
167
166
 
168
167
 
169
-
170
- const $c96c4b9ef7203c1f$var$APIPage = ({ hideAuth: hideAuth , additionalParams: additionalParams , rootUrl: rootUrl })=>{
171
- const hasACA = additionalParams && additionalParams.ACA ? true : false;
172
- let params = {
173
- authentication: hideAuth ? false : undefined,
174
- ACA: hasACA ? additionalParams.ACA : undefined,
175
- redirect: hasACA ? false : undefined
176
- };
177
- return /*#__PURE__*/ (0, $hgUW1$jsx)("section", {
168
+ const $c96c4b9ef7203c1f$var$APIPage = ({ hideAuth: hideAuth , additionalParams: additionalParams , rootUrl: rootUrl })=>/*#__PURE__*/ (0, $hgUW1$jsx)("section", {
178
169
  className: "ds-l-container",
179
170
  children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$swaggeruireact), {
180
- url: `${rootUrl}${(0, $hgUW1$qs).stringify(params, {
181
- addQueryPrefix: true
182
- })}`,
171
+ url: `${rootUrl}?${hideAuth ? "authentication=false&" : ""}${additionalParams && additionalParams.ACA ? "ACA=" + additionalParams.ACA + "&redirect=false" : ""}`,
183
172
  docExpansion: "list",
184
173
  defaultModelsExpandDepth: -1
185
174
  })
186
175
  });
187
- };
188
176
  $c96c4b9ef7203c1f$var$APIPage.defaultProps = {
189
177
  hideAuth: true
190
178
  };
@@ -269,7 +257,6 @@ var $61ff88fb3f6ee2c8$export$2e2bcd8739ae039 = $61ff88fb3f6ee2c8$var$withQueryPr
269
257
 
270
258
 
271
259
 
272
-
273
260
  const $bd76a91923d7e8a7$var$TransformedDate = ({ date: date , options: options })=>{
274
261
  const rawDate = new Date(date);
275
262
  let modifiedDate = "";
@@ -292,7 +279,7 @@ var $bd76a91923d7e8a7$export$2e2bcd8739ae039 = $bd76a91923d7e8a7$var$Transformed
292
279
 
293
280
  const $dc6d3aaf3e07417b$var$dangerousDescriptionElement = ({ children: children })=>/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
294
281
  dangerouslySetInnerHTML: {
295
- __html: (0, $hgUW1$dompurify).sanitize(children)
282
+ __html: children
296
283
  }
297
284
  });
298
285
  const $dc6d3aaf3e07417b$var$DatasetSearchListItem = ({ item: item , updateFacets: updateFacets })=>{
@@ -313,7 +300,7 @@ const $dc6d3aaf3e07417b$var$DatasetSearchListItem = ({ item: item , updateFacets
313
300
  className: "ds-l-row ds-u-padding-top--5",
314
301
  children: [
315
302
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
316
- className: "ds-l-sm-col--7 ds-l-col--12",
303
+ className: "ds-l-col--7",
317
304
  children: theme && /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
318
305
  className: "ds-u-padding--0 ds-u-display--flex ds-u-flex-direction--row ds-u-flex-wrap--wrap",
319
306
  children: theme.map((t)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
@@ -326,7 +313,7 @@ const $dc6d3aaf3e07417b$var$DatasetSearchListItem = ({ item: item , updateFacets
326
313
  })
327
314
  }),
328
315
  /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
329
- className: "ds-l-sm-col--5 ds-l-col--12 ds-u-color--gray ds-u-sm-text-align--right",
316
+ className: "ds-l-col--5 ds-u-color--gray ds-u-text-align--right",
330
317
  children: [
331
318
  "Updated ",
332
319
  /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
@@ -887,7 +874,6 @@ var $68d79598b83f3382$export$2e2bcd8739ae039 = $68d79598b83f3382$var$useMetastor
887
874
 
888
875
 
889
876
 
890
-
891
877
  async function $0e7628cf73c71646$export$55f990b5477765d6(id, rootUrl, options, additionalParams) {
892
878
  const { keys: keys , limit: limit , offset: offset , conditions: conditions , sort: sort , groupings: groupings , prepareColumns: prepareColumns , properties: properties , setValues: setValues , setCount: setCount , setColumns: setColumns , setLoading: setLoading , setSchema: setSchema } = options;
893
879
  if (!id) // TODO: Throw error
@@ -1681,63 +1667,34 @@ var $17193a17e26a72da$export$2e2bcd8739ae039 = $17193a17e26a72da$var$DatasetTags
1681
1667
 
1682
1668
 
1683
1669
 
1684
- const $f341c2fd9bc53390$var$DatasetDownloads = ({ dataDictionaryURL: dataDictionaryURL , dataDictionaryType: dataDictionaryType , distributions: distributions })=>{
1685
- function trimDataDictionaryType() {
1686
- let splitDataDictionaryType = dataDictionaryType.split("/");
1687
- let type = splitDataDictionaryType.length > 1 ? splitDataDictionaryType[1] : splitDataDictionaryType[0];
1688
- return type.toUpperCase();
1689
- }
1690
- function getFormatType(dist) {
1691
- if (dist.data.format) return dist.data.format.toUpperCase();
1692
- if (dist.data.mediaType) {
1693
- const mediaType = dist.data.mediaType.split("/");
1694
- if (mediaType.length && mediaType[1]) return mediaType[1].toUpperCase();
1695
- }
1696
- if (dist.data["%Ref:downloadURL"].length && dist.data["%Ref:downloadURL"][0].data) {
1697
- if (dist.data["%Ref:downloadURL"][0].data.mimeType) {
1698
- const mimeType = dist.data["%Ref:downloadURL"][0].data.mimeType.split("/");
1699
- if (mimeType.length && mimeType[1]) return mimeType[1].toUpperCase();
1700
- }
1701
- }
1702
- return "";
1703
- }
1670
+ const $f341c2fd9bc53390$var$DatasetDownloads = ({ downloadURL: downloadURL , type: type })=>{
1704
1671
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1705
- className: "ds-u-margin-bottom--3 ds-u-padding--2 ds-u-border ds-u-border--1 dc-c-dataset-downloads",
1672
+ className: "ds-u-margin-bottom--3 ds-u-padding--2 ds-u-border ds-u-border--1",
1706
1673
  children: [
1707
1674
  /*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
1708
1675
  className: "ds-u-color--primary ds-u-font-size--h3 ds-u-margin-top--0 ds-u-margin-bottom--2 ds-u-padding-bottom--2 ds-u-border ds-u-border-bottom--1",
1709
1676
  children: "Downloads"
1710
1677
  }),
1711
- (distributions.length || dataDictionaryURL && dataDictionaryType) && /*#__PURE__*/ (0, $hgUW1$jsxs)("ul", {
1712
- className: "ds-c-list ds-c-list--bare",
1678
+ /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
1679
+ className: "ds-u-margin-bottom--1 ds-u-color--gray",
1680
+ children: "Resource"
1681
+ }),
1682
+ /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
1683
+ href: downloadURL,
1684
+ className: "ds-u-word-break",
1713
1685
  children: [
1714
- distributions.map((dist)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
1715
- className: "ds-u-padding-bottom--1",
1716
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
1717
- href: dist.data.downloadURL,
1718
- className: "ds-u-word-break",
1719
- children: [
1720
- getFormatType(dist),
1721
- " ",
1722
- "Resource File"
1723
- ]
1724
- })
1725
- }, dist.identifier)),
1726
- dataDictionaryURL && dataDictionaryType && /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
1727
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
1728
- href: dataDictionaryURL,
1729
- children: [
1730
- "Data Dictionary (",
1731
- trimDataDictionaryType(),
1732
- ")"
1733
- ]
1734
- })
1735
- })
1686
+ "Download this resource (",
1687
+ type,
1688
+ ")"
1736
1689
  ]
1737
1690
  })
1738
1691
  ]
1739
1692
  });
1740
1693
  };
1694
+ $f341c2fd9bc53390$var$DatasetDownloads.propTypes = {
1695
+ downloadURL: (0, $hgUW1$proptypes).string.isRequired,
1696
+ type: (0, $hgUW1$proptypes).string.isRequired
1697
+ };
1741
1698
  var $f341c2fd9bc53390$export$2e2bcd8739ae039 = $f341c2fd9bc53390$var$DatasetDownloads;
1742
1699
 
1743
1700
 
@@ -2070,7 +2027,7 @@ const $766b8e351dd607f5$var$DatasetBody = ({ rootUrl: rootUrl , id: id , dataset
2070
2027
  /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
2071
2028
  className: "dc-c-metadata-description",
2072
2029
  dangerouslySetInnerHTML: {
2073
- __html: (0, $hgUW1$dompurify).sanitize(dataset.description)
2030
+ __html: dataset.description
2074
2031
  }
2075
2032
  }),
2076
2033
  resource.columns && Object.keys(resource.schema).length ? /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
@@ -2141,9 +2098,8 @@ const $766b8e351dd607f5$var$DatasetBody = ({ rootUrl: rootUrl , id: id , dataset
2141
2098
  className: "ds-l-md-col--3 ds-l-sm-col--12",
2142
2099
  children: [
2143
2100
  Object.keys(distribution).length ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $f341c2fd9bc53390$export$2e2bcd8739ae039), {
2144
- dataDictionaryURL: dataset.describedBy,
2145
- dataDictionaryType: dataset.describedByType,
2146
- distributions: dataset.distribution
2101
+ downloadURL: distribution.data.downloadURL,
2102
+ type: fileFormat
2147
2103
  }) : "",
2148
2104
  dataset.keyword && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $17193a17e26a72da$export$2e2bcd8739ae039), {
2149
2105
  keywords: dataset.keyword
@@ -4060,7 +4016,6 @@ var $ec3e23baa005dc03$export$2e2bcd8739ae039 = $ec3e23baa005dc03$var$Breadcrumb;
4060
4016
 
4061
4017
 
4062
4018
 
4063
-
4064
4019
 
4065
4020
 
4066
4021
  function $374c4669b044ddf8$var$getStartDate(condition, schema, id) {
@@ -4451,7 +4406,7 @@ const $dd6eb2b30d7ad75d$var$FilteredResourceBody = ({ id: id , dataset: dataset
4451
4406
  /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
4452
4407
  className: "ds-u-margin-top--0 dc-c-metadata-description",
4453
4408
  dangerouslySetInnerHTML: {
4454
- __html: (0, $hgUW1$dompurify).sanitize(distribution.data.description)
4409
+ __html: distribution.data.description
4455
4410
  }
4456
4411
  }),
4457
4412
  resource.columns && Object.keys(resource.schema).length && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $3b6ca952e79f0695$export$2e2bcd8739ae039), {