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

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/dist/main.js CHANGED
@@ -4,9 +4,9 @@ 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
12
  import $hgUW1$dompurify from "dompurify";
@@ -166,14 +166,25 @@ var $f57121650539d8c5$export$2e2bcd8739ae039 = $f57121650539d8c5$var$NavBar;
166
166
 
167
167
 
168
168
 
169
- const $c96c4b9ef7203c1f$var$APIPage = ({ hideAuth: hideAuth , additionalParams: additionalParams , rootUrl: rootUrl })=>/*#__PURE__*/ (0, $hgUW1$jsx)("section", {
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", {
170
178
  className: "ds-l-container",
171
179
  children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$swaggeruireact), {
172
- url: `${rootUrl}?${hideAuth ? "authentication=false&" : ""}${additionalParams && additionalParams.ACA ? "ACA=" + additionalParams.ACA + "&redirect=false" : ""}`,
180
+ url: `${rootUrl}${(0, $hgUW1$qs).stringify(params, {
181
+ addQueryPrefix: true
182
+ })}`,
173
183
  docExpansion: "list",
174
184
  defaultModelsExpandDepth: -1
175
185
  })
176
186
  });
187
+ };
177
188
  $c96c4b9ef7203c1f$var$APIPage.defaultProps = {
178
189
  hideAuth: true
179
190
  };
@@ -302,7 +313,7 @@ const $dc6d3aaf3e07417b$var$DatasetSearchListItem = ({ item: item , updateFacets
302
313
  className: "ds-l-row ds-u-padding-top--5",
303
314
  children: [
304
315
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
305
- className: "ds-l-col--7",
316
+ className: "ds-l-sm-col--7 ds-l-col--12",
306
317
  children: theme && /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
307
318
  className: "ds-u-padding--0 ds-u-display--flex ds-u-flex-direction--row ds-u-flex-wrap--wrap",
308
319
  children: theme.map((t)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
@@ -315,7 +326,7 @@ const $dc6d3aaf3e07417b$var$DatasetSearchListItem = ({ item: item , updateFacets
315
326
  })
316
327
  }),
317
328
  /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
318
- className: "ds-l-col--5 ds-u-color--gray ds-u-text-align--right",
329
+ className: "ds-l-sm-col--5 ds-l-col--12 ds-u-color--gray ds-u-sm-text-align--right",
319
330
  children: [
320
331
  "Updated ",
321
332
  /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bd76a91923d7e8a7$export$2e2bcd8739ae039), {
@@ -1676,6 +1687,20 @@ const $f341c2fd9bc53390$var$DatasetDownloads = ({ dataDictionaryURL: dataDiction
1676
1687
  let type = splitDataDictionaryType.length > 1 ? splitDataDictionaryType[1] : splitDataDictionaryType[0];
1677
1688
  return type.toUpperCase();
1678
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
+ }
1679
1704
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
1680
1705
  className: "ds-u-margin-bottom--3 ds-u-padding--2 ds-u-border ds-u-border--1 dc-c-dataset-downloads",
1681
1706
  children: [
@@ -1692,12 +1717,12 @@ const $f341c2fd9bc53390$var$DatasetDownloads = ({ dataDictionaryURL: dataDiction
1692
1717
  href: dist.data.downloadURL,
1693
1718
  className: "ds-u-word-break",
1694
1719
  children: [
1695
- dist.data.format.toUpperCase(),
1720
+ getFormatType(dist),
1696
1721
  " ",
1697
1722
  "Resource File"
1698
1723
  ]
1699
- }, dist.identifier)
1700
- })),
1724
+ })
1725
+ }, dist.identifier)),
1701
1726
  dataDictionaryURL && dataDictionaryType && /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
1702
1727
  children: /*#__PURE__*/ (0, $hgUW1$jsxs)("a", {
1703
1728
  href: dataDictionaryURL,
@@ -1713,10 +1738,6 @@ const $f341c2fd9bc53390$var$DatasetDownloads = ({ dataDictionaryURL: dataDiction
1713
1738
  ]
1714
1739
  });
1715
1740
  };
1716
- $f341c2fd9bc53390$var$DatasetDownloads.propTypes = {
1717
- downloadURL: (0, $hgUW1$proptypes).string.isRequired,
1718
- type: (0, $hgUW1$proptypes).string.isRequired
1719
- };
1720
1741
  var $f341c2fd9bc53390$export$2e2bcd8739ae039 = $f341c2fd9bc53390$var$DatasetDownloads;
1721
1742
 
1722
1743