@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.
- package/README.md +20 -0
- package/dist/main.js +15 -9
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
- package/dist/scss/components/additional-information-table.scss +0 -9
- package/dist/scss/components/breadcrumb.scss +0 -32
- package/dist/scss/components/dataset-downloads.scss +0 -0
- package/dist/scss/components/dataset-search-facets.scss +0 -10
- package/dist/scss/components/dataset-search-list-item.scss +0 -20
- package/dist/scss/components/dataset-tags.scss +0 -4
- package/dist/scss/components/datatable.scss +0 -24
- package/dist/scss/components/index.scss +0 -9
- package/dist/scss/components/pagination.scss +0 -59
- package/dist/scss/components/resource-information-table.scss +0 -5
- package/dist/scss/index.scss +0 -24
- package/dist/scss/templates/dataset-search.scss +0 -38
- package/dist/scss/templates/dataset.scss +0 -44
- package/dist/scss/templates/filtered-resource.scss +0 -19
- package/dist/scss/templates/footer.scss +0 -83
- package/dist/scss/templates/header.scss +0 -402
- package/dist/scss/templates/index.scss +0 -7
- package/dist/scss/templates/query-builder.scss +0 -22
- package/dist/scss/templates/swagger.scss +0 -21
- package/lib/assets/frequencyMap.js +0 -22
- package/lib/assets/icons/close.js +0 -33
- package/lib/assets/icons/close.jsx +0 -24
- package/lib/assets/icons/copy.js +0 -33
- package/lib/assets/icons/copy.jsx +0 -23
- package/lib/assets/icons/download.js +0 -33
- package/lib/assets/icons/download.jsx +0 -23
- package/lib/assets/icons/settings.js +0 -34
- package/lib/assets/icons/settings.jsx +0 -24
- package/lib/assets/images/CMSGovLogo-O.png +0 -0
- package/lib/assets/images/CMSgov@2x-white-O.png +0 -0
- package/lib/assets/metadataMapping.js +0 -161
- package/lib/assets/metadataMapping.jsx +0 -110
- package/lib/commands/index.js +0 -7
- package/lib/commands/templates/footer.js +0 -61
- package/lib/commands/templates/header.js +0 -84
- package/lib/commands/templates/page_not_found.js +0 -14
- package/lib/components/ApiDocumentation/index.js +0 -24
- package/lib/components/Breadcrumb/index.js +0 -47
- package/lib/components/DataTableDensity/datatabledensity.test.js +0 -30
- package/lib/components/DataTableDensity/index.js +0 -47
- package/lib/components/DataTableRowChanger/datatablerowchanger.test.js +0 -49
- package/lib/components/DataTableRowChanger/index.js +0 -46
- package/lib/components/DatasetAdditionalInformation/index.js +0 -59
- package/lib/components/DatasetDownloads/datasetdownloads.test.js +0 -30
- package/lib/components/DatasetDownloads/index.js +0 -34
- package/lib/components/DatasetSearchFacets/dataset_search_facets.test.js +0 -103
- package/lib/components/DatasetSearchFacets/index.js +0 -104
- package/lib/components/DatasetSearchListItem/datasetsearchlistitem.test.js +0 -44
- package/lib/components/DatasetSearchListItem/index.js +0 -86
- package/lib/components/DatasetTags/datasettags.test.js +0 -40
- package/lib/components/DatasetTags/index.js +0 -38
- package/lib/components/Hero/index.js +0 -92
- package/lib/components/ManageColumns/index.js +0 -36
- package/lib/components/NavBar/index.js +0 -55
- package/lib/components/NavLink/index.js +0 -60
- package/lib/components/NavLink/navlink.test.js +0 -35
- package/lib/components/Pagination/index.js +0 -263
- package/lib/components/Pagination/pagination.test.js +0 -541
- package/lib/components/ResourceConditionField/ResourceConditionalField.test.js +0 -20
- package/lib/components/ResourceConditionField/index.js +0 -246
- package/lib/components/ResourceFilter/index.js +0 -174
- package/lib/components/ResourceFilter/resourcefilter.test.js +0 -440
- package/lib/components/ResourceFooter/index.js +0 -34
- package/lib/components/ResourceHeader/index.js +0 -149
- package/lib/components/ResourceInformation/index.js +0 -37
- package/lib/components/ResourcePreview/index.js +0 -139
- package/lib/components/SearchModal/index.js +0 -116
- package/lib/components/SubMenu/index.js +0 -86
- package/lib/components/TransformedDate/index.js +0 -34
- package/lib/components/useAddLoginLink/index.js +0 -44
- package/lib/components/useScrollToTop/index.js +0 -22
- package/lib/index.js +0 -247
- package/lib/templates/APIPage/index.js +0 -30
- package/lib/templates/Dataset/DatasetBody.js +0 -189
- package/lib/templates/Dataset/index.js +0 -83
- package/lib/templates/DatasetSearch/datasetsearch.test.js +0 -122
- package/lib/templates/DatasetSearch/index.js +0 -356
- package/lib/templates/DrupalPage/index.js +0 -37
- package/lib/templates/FilteredResource/FilteredResourceBody.js +0 -160
- package/lib/templates/FilteredResource/QueryBuilder.js +0 -235
- package/lib/templates/FilteredResource/QueryRow.js +0 -175
- package/lib/templates/FilteredResource/QueryTitle.js +0 -89
- package/lib/templates/FilteredResource/functions.js +0 -142
- package/lib/templates/FilteredResource/index.js +0 -95
- package/lib/templates/Footer/footer.test.js +0 -48
- package/lib/templates/Footer/index.js +0 -366
- package/lib/templates/PageNotFound/index.js +0 -25
- package/lib/templates/header/index.js +0 -112
- 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
|
|
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)
|
|
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)=>{
|