@canonical/react-components 2.5.0 → 2.5.2

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.
@@ -35,7 +35,7 @@
35
35
  .toast-notification-list {
36
36
  background-color: white;
37
37
  box-shadow: 0 0 2rem 0.5rem rgb(0 0 0 / 22%);
38
- max-height: calc(100vh - 4.5rem);
38
+ max-height: calc(100dvh - 4.5rem);
39
39
  overflow: auto;
40
40
  padding: 0 0.5rem;
41
41
  z-index: 102;
@@ -155,6 +155,12 @@ const ToastNotificationList = _ref => {
155
155
 
156
156
  // Only filter input data if there are filters present
157
157
  const filteredNotifications = hasFilters ? notifications.filter(notification => filters.has(notification.type)) : notifications;
158
+ (0, _react.useEffect)(() => {
159
+ if (hasFilters && filteredNotifications.length === 0) {
160
+ // if there are no filtered notifications, reset the filters
161
+ setFilters(new Set());
162
+ }
163
+ }, [hasFilters, filteredNotifications]);
158
164
 
159
165
  // Don't assign alert role for notifications when expanded since we don't want
160
166
  // screen readers to announce every existing notification
@@ -35,7 +35,7 @@
35
35
  .toast-notification-list {
36
36
  background-color: white;
37
37
  box-shadow: 0 0 2rem 0.5rem rgb(0 0 0 / 22%);
38
- max-height: calc(100vh - 4.5rem);
38
+ max-height: calc(100dvh - 4.5rem);
39
39
  overflow: auto;
40
40
  padding: 0 0.5rem;
41
41
  z-index: 102;
@@ -3,7 +3,7 @@ import Button from "../../Button";
3
3
  import Icon from "../../Icon";
4
4
  import Notification from "../Notification";
5
5
  import { DefaultTitles } from "../Notification/Notification";
6
- import { useLayoutEffect, useRef, useState } from "react";
6
+ import { useLayoutEffect, useRef, useState, useEffect } from "react";
7
7
  import { createPortal } from "react-dom";
8
8
  import Animate from "./Animate";
9
9
  import { usePrefersReducedMotion } from "../../../hooks";
@@ -148,6 +148,12 @@ var ToastNotificationList = _ref => {
148
148
 
149
149
  // Only filter input data if there are filters present
150
150
  var filteredNotifications = hasFilters ? notifications.filter(notification => filters.has(notification.type)) : notifications;
151
+ useEffect(() => {
152
+ if (hasFilters && filteredNotifications.length === 0) {
153
+ // if there are no filtered notifications, reset the filters
154
+ setFilters(new Set());
155
+ }
156
+ }, [hasFilters, filteredNotifications]);
151
157
 
152
158
  // Don't assign alert role for notifications when expanded since we don't want
153
159
  // screen readers to announce every existing notification
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonical/react-components",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": {