@civicactions/cmsds-open-data-components 4.1.2-alpha.5 → 4.1.2-alpha.7

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
@@ -2988,6 +2988,16 @@ const $d98f94c79ddf4e0e$var$DataTable = ({ columns: columns, sortTransform: sort
2988
2988
  const data = resource.values;
2989
2989
  const [sorting, setSorting] = (0, $hgUW1$useState)([]);
2990
2990
  const dataTableWrapperElement = (0, $hgUW1$useRef)(null);
2991
+ const [loadingAnnouncement, setLoadingAnnouncement] = (0, $hgUW1$useState)("");
2992
+ (0, $hgUW1$useEffect)(()=>{
2993
+ if (loading) setLoadingAnnouncement("Dataset loading");
2994
+ else if (loadingAnnouncement) {
2995
+ const timer = setTimeout(()=>setLoadingAnnouncement(""), 1500);
2996
+ return ()=>clearTimeout(timer);
2997
+ }
2998
+ }, [
2999
+ loading
3000
+ ]);
2991
3001
  const columnHelper = (0, $hgUW1$createColumnHelper)();
2992
3002
  const table_columns = columns.map((col)=>{
2993
3003
  if (col.cell) return columnHelper.accessor(col.accessor, {
@@ -3234,22 +3244,28 @@ const $d98f94c79ddf4e0e$var$DataTable = ({ columns: columns, sortTransform: sort
3234
3244
  }),
3235
3245
  loading && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
3236
3246
  "aria-valuetext": "Dataset loading",
3237
- role: "status",
3247
+ role: "img",
3238
3248
  className: "ds-u-margin--3"
3239
3249
  }),
3240
3250
  !loading && table.getRowModel().rows.length === 0 && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
3241
3251
  variation: "warn",
3252
+ role: "region",
3242
3253
  children: "No results found for the current filters"
3243
3254
  }),
3244
3255
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3245
3256
  "aria-live": "polite",
3257
+ "aria-atomic": "true",
3258
+ "aria-busy": loading,
3259
+ "data-testid": "loading-announcement",
3246
3260
  className: "ds-u-visibility--screen-reader",
3247
- children: loading ? "Dataset loading" : ""
3261
+ children: loadingAnnouncement
3248
3262
  }),
3249
3263
  /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3250
3264
  "aria-live": "assertive",
3265
+ "aria-atomic": "true",
3266
+ "data-testid": "no-results-announcement",
3251
3267
  className: "ds-u-visibility--screen-reader",
3252
- children: !loading && table.getRowModel().rows.length === 0 ? "No results found for the current filters" : ""
3268
+ children: !loading && table.getRowModel().rows.length === 0 ? "Warning: No results found for the current filters" : ""
3253
3269
  })
3254
3270
  ]
3255
3271
  });