@civicactions/cmsds-open-data-components 3.1.10-alpha.2 → 3.1.10-alpha.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/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./main.css";
2
2
  import {jsxs as $hgUW1$jsxs, jsx as $hgUW1$jsx, Fragment as $hgUW1$Fragment} from "react/jsx-runtime";
3
- import $hgUW1$react, {useState as $hgUW1$useState, useRef as $hgUW1$useRef, useEffect as $hgUW1$useEffect} from "react";
3
+ import $hgUW1$react, {useState as $hgUW1$useState, useRef as $hgUW1$useRef, useEffect as $hgUW1$useEffect, useMemo as $hgUW1$useMemo} from "react";
4
4
  import {Button as $hgUW1$Button, Accordion as $hgUW1$Accordion, AccordionItem as $hgUW1$AccordionItem, TextField as $hgUW1$TextField, Spinner as $hgUW1$Spinner, Dropdown as $hgUW1$Dropdown, Alert as $hgUW1$Alert, Pagination as $hgUW1$Pagination, Dialog as $hgUW1$Dialog, AddIcon as $hgUW1$AddIcon, RemoveIcon as $hgUW1$RemoveIcon, Choice as $hgUW1$Choice, Tabs as $hgUW1$Tabs, TabPanel as $hgUW1$TabPanel, Tooltip as $hgUW1$Tooltip, Badge as $hgUW1$Badge, Table as $hgUW1$Table, TableBody as $hgUW1$TableBody, TableRow as $hgUW1$TableRow, TableCell as $hgUW1$TableCell, TableHead as $hgUW1$TableHead, TooltipIcon as $hgUW1$TooltipIcon} 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";
@@ -2985,11 +2985,7 @@ var $cf6eaefd6b928de3$export$2e2bcd8739ae039 = $cf6eaefd6b928de3$var$DatasetAPI;
2985
2985
 
2986
2986
 
2987
2987
 
2988
- const $6765a74df807d015$var$DataDictionaryTable = ({ tableColumns: tableColumns, tableData: tableData, count: count, pageSize: pageSize, columnFilters: columnFilters })=>{
2989
- const [pagination, setPagination] = (0, $hgUW1$useState)({
2990
- pageIndex: 1,
2991
- pageSize: pageSize
2992
- });
2988
+ const $6765a74df807d015$var$DataDictionaryTable = ({ tableColumns: tableColumns, tableData: tableData, pageSize: pageSize, columnFilters: columnFilters })=>{
2993
2989
  const [sorting, setSorting] = (0, $hgUW1$useState)([]);
2994
2990
  const [ariaLiveFeedback, setAriaLiveFeedback] = (0, $hgUW1$useState)("");
2995
2991
  const mobile = (0, $hgUW1$useMediaQuery)({
@@ -3008,11 +3004,9 @@ const $6765a74df807d015$var$DataDictionaryTable = ({ tableColumns: tableColumns,
3008
3004
  getCoreRowModel: (0, $hgUW1$getCoreRowModel)(),
3009
3005
  getFilteredRowModel: (0, $hgUW1$getFilteredRowModel)(),
3010
3006
  getPaginationRowModel: (0, $hgUW1$getPaginationRowModel)(),
3011
- onPaginationChange: setPagination,
3012
3007
  getSortedRowModel: (0, $hgUW1$getSortedRowModel)(),
3013
3008
  onSortingChange: setSorting,
3014
3009
  state: {
3015
- pagination: pagination,
3016
3010
  sorting: sorting,
3017
3011
  columnFilters: columnFilters
3018
3012
  }
@@ -3055,7 +3049,7 @@ const $6765a74df807d015$var$DataDictionaryTable = ({ tableColumns: tableColumns,
3055
3049
  }, "header" + headerGroup.id))
3056
3050
  }),
3057
3051
  /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableBody), {
3058
- children: table.getFilteredRowModel().rows.map((row, index)=>{
3052
+ children: table.getRowModel().rows.map((row, index)=>{
3059
3053
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableRow), {
3060
3054
  children: row.getVisibleCells().map((cell)=>{
3061
3055
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
@@ -3085,13 +3079,10 @@ const $6765a74df807d015$var$DataDictionaryTable = ({ tableColumns: tableColumns,
3085
3079
  }),
3086
3080
  table.getRowCount() > pageSize ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
3087
3081
  totalPages: table.getPageCount(),
3088
- currentPage: pagination.pageIndex + 1,
3082
+ currentPage: table.getState().pagination.pageIndex + 1,
3089
3083
  onPageChange: (evt, page)=>{
3090
3084
  evt.preventDefault();
3091
- setPagination({
3092
- pageIndex: page - 1,
3093
- pageSize: pageSize
3094
- });
3085
+ table.setPageIndex(page - 1);
3095
3086
  },
3096
3087
  renderHref: (page)=>{
3097
3088
  return "";
@@ -3122,7 +3113,6 @@ const $a24829b27758fe6c$var$SitewideDataDictionaryTable = ({ datasetDictionary:
3122
3113
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6765a74df807d015$export$2e2bcd8739ae039), {
3123
3114
  tableColumns: tableColumns,
3124
3115
  tableData: datasetDictionary,
3125
- count: datasetDictionary.length,
3126
3116
  pageSize: pageSize
3127
3117
  });
3128
3118
  };
@@ -3139,7 +3129,19 @@ var $a24829b27758fe6c$export$2e2bcd8739ae039 = $a24829b27758fe6c$var$SitewideDat
3139
3129
  const $a6e312940f7003ef$var$DatasetDictionaryTable = ({ datasetDictionary: datasetDictionary, pageSize: pageSize })=>{
3140
3130
  const [titleFilter, setTitleFilter] = (0, $hgUW1$useState)("");
3141
3131
  const [typeFilter, setTypeFilter] = (0, $hgUW1$useState)("all");
3142
- const [columnFilters, setColumnFilters] = (0, $hgUW1$useState)([]);
3132
+ const columnFilters = (0, $hgUW1$useMemo)(()=>[
3133
+ {
3134
+ id: "titleResizable",
3135
+ value: titleFilter
3136
+ },
3137
+ {
3138
+ id: "type",
3139
+ value: typeFilter === "all" ? "" : typeFilter
3140
+ }
3141
+ ], [
3142
+ titleFilter,
3143
+ typeFilter
3144
+ ]);
3143
3145
  const tableData = datasetDictionary.map((item)=>{
3144
3146
  return {
3145
3147
  titleResizable: item.title,
@@ -3212,18 +3214,6 @@ const $a6e312940f7003ef$var$DatasetDictionaryTable = ({ datasetDictionary: datas
3212
3214
  label: "Boolean"
3213
3215
  }
3214
3216
  ];
3215
- const setFilters = ()=>{
3216
- setColumnFilters([
3217
- {
3218
- id: "titleResizable",
3219
- value: titleFilter
3220
- },
3221
- {
3222
- id: "type",
3223
- value: typeFilter === "all" ? "" : typeFilter
3224
- }
3225
- ]);
3226
- };
3227
3217
  return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
3228
3218
  children: [
3229
3219
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
@@ -3255,22 +3245,14 @@ const $a6e312940f7003ef$var$DatasetDictionaryTable = ({ datasetDictionary: datas
3255
3245
  }),
3256
3246
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3257
3247
  className: "ds-u-float--right ds-u-padding-y--2 ds-l-col--12 ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end",
3258
- children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3248
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3259
3249
  className: "ds-u-display--flex ds-u-justify-content--end ds-l-col--12 ds-l-md-col--6 ds-u-padding-x--0",
3260
- children: [
3261
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
3262
- onClick: setFilters,
3263
- className: "ds-l-col--5 ds-u-margin-right--0 ds-u-sm-margin-right--1",
3264
- children: "Apply filters"
3265
- }),
3266
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2eec38d4d0dbf714$export$2e2bcd8739ae039), {
3267
- clearFiltersFn: ()=>{
3268
- setTitleFilter("");
3269
- setTypeFilter("all");
3270
- setColumnFilters([]);
3271
- }
3272
- })
3273
- ]
3250
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2eec38d4d0dbf714$export$2e2bcd8739ae039), {
3251
+ clearFiltersFn: ()=>{
3252
+ setTitleFilter("");
3253
+ setTypeFilter("all");
3254
+ }
3255
+ })
3274
3256
  })
3275
3257
  })
3276
3258
  ]
@@ -3281,7 +3263,6 @@ const $a6e312940f7003ef$var$DatasetDictionaryTable = ({ datasetDictionary: datas
3281
3263
  /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6765a74df807d015$export$2e2bcd8739ae039), {
3282
3264
  tableColumns: tableColumns,
3283
3265
  tableData: tableData,
3284
- count: datasetDictionary.length,
3285
3266
  pageSize: pageSize,
3286
3267
  columnFilters: columnFilters
3287
3268
  })