@micha.bigler/ui-core-micha 4.40.1 → 4.40.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.40.2 - UCM-SHELL-10
4
+
5
+ Notification and account menu buttons include their visible unread count or
6
+ avatar initials in their accessible names while retaining their existing
7
+ menu behavior.
8
+
3
9
  ## 4.40.1 - UCM-AUTH-18
4
10
 
5
11
  The English, French and Swahili signup password-too-short messages now match the existing local and server error wording.
@@ -54,7 +54,7 @@ export function UserMenu({ resolveLink, items = [], profileLink = '/account', av
54
54
  handleClose();
55
55
  (_a = item.onSelect) === null || _a === void 0 ? void 0 : _a.call(item);
56
56
  };
57
- return (_jsxs(_Fragment, { children: [_jsx(IconButton, { "aria-label": t('UserMenu.TITLE'), color: "inherit", onClick: (event) => setAnchorEl(event.currentTarget), children: _jsx(Avatar, { src: avatarSrc, sx: {
57
+ return (_jsxs(_Fragment, { children: [_jsx(IconButton, { "aria-label": [t('UserMenu.TITLE'), !avatarSrc && getInitials(user)].filter(Boolean).join(' '), color: "inherit", onClick: (event) => setAnchorEl(event.currentTarget), children: _jsx(Avatar, { src: avatarSrc, sx: {
58
58
  width: 32,
59
59
  height: 32,
60
60
  fontSize: '0.8rem',
@@ -1,5 +1,6 @@
1
1
  export const notificationsTranslations = {
2
2
  'NotificationBell.TITLE': { de: 'Benachrichtigungen', fr: 'Notifications', en: 'Notifications', sw: 'Arifa' },
3
+ 'NotificationBell.UNREAD': { de: '{{count}} ungelesen', fr: '{{count}} non lues', en: '{{count}} unread', sw: '{{count}} ambazo hazijasomwa' },
3
4
  'NotificationBell.EMPTY': { de: 'Keine Benachrichtigungen vorhanden.', fr: 'Aucune notification.', en: 'No notifications.', sw: 'Hakuna arifa.' },
4
5
  'NotificationBell.LOAD_MORE': { de: 'Mehr laden', fr: 'Charger plus', en: 'Load more', sw: 'Pakia zaidi' },
5
6
  'NotificationBell.LOADING': { de: 'Wird geladen…', fr: 'Chargement…', en: 'Loading…', sw: 'Inapakia…' },
@@ -20,7 +20,7 @@ export function NotificationBell({ resolveLink }) {
20
20
  if (resolveLink && typeof ((_a = notification.content) === null || _a === void 0 ? void 0 : _a.link) === 'string' && notification.content.link)
21
21
  resolveLink(notification.content.link);
22
22
  };
23
- return (_jsxs(_Fragment, { children: [_jsx(IconButton, { "aria-label": t('NotificationBell.TITLE'), color: "inherit", onClick: (event) => setAnchorEl(event.currentTarget), children: _jsx(Badge, { badgeContent: unreadCount, color: "error", max: 99, children: _jsx(NotificationsIcon, {}) }) }), _jsx(Menu, { anchorEl: anchorEl, anchorOrigin: { horizontal: 'right', vertical: 'bottom' }, onClose: () => setAnchorEl(null), open: open, transformOrigin: { horizontal: 'right', vertical: 'top' }, children: _jsxs(Box, { sx: { width: 320, maxWidth: 'calc(100vw - 32px)' }, children: [_jsxs(Box, { sx: { alignItems: 'center', display: 'flex', justifyContent: 'space-between', px: 2, py: 1 }, children: [_jsx(Typography, { variant: "subtitle1", children: t('NotificationBell.TITLE') }), (canMarkAll ? unreadCount > 0 : unreadIds.length > 0) && (_jsx(Button, { disabled: marking, onClick: () => canMarkAll ? markAllSeen() : Promise.resolve(markSeen(unreadIds)).catch(() => { }), size: "small", children: t(canMarkAll ? 'NotificationBell.MARK_ALL' : 'NotificationBell.MARK_LOADED') }))] }), markError && _jsx(Typography, { role: "alert", sx: { px: 2 }, children: t('NotificationBell.MARK_ERROR') }), notifications.length === 0 ? (_jsx(Typography, { sx: { px: 2, py: 2 }, variant: "body2", children: t('NotificationBell.EMPTY') })) : (_jsx(List, { dense: true, disablePadding: true, children: notifications.map((notification) => { var _a, _b, _c; var _d; return (_jsx(ListItemButton, { onClick: () => handleItemClick(notification), children: _jsx(ListItemText, { primary: t((_a = notification.content) === null || _a === void 0 ? void 0 : _a.title_key, ((_b = notification.content) === null || _b === void 0 ? void 0 : _b.params) || {}), secondary: ((_c = notification.content) === null || _c === void 0 ? void 0 : _c.body_key)
23
+ return (_jsxs(_Fragment, { children: [_jsx(IconButton, { "aria-label": `${t('NotificationBell.TITLE')} ${t('NotificationBell.UNREAD', { count: unreadCount > 99 ? '99+' : unreadCount })}`, color: "inherit", onClick: (event) => setAnchorEl(event.currentTarget), children: _jsx(Badge, { badgeContent: unreadCount, color: "error", max: 99, children: _jsx(NotificationsIcon, {}) }) }), _jsx(Menu, { anchorEl: anchorEl, anchorOrigin: { horizontal: 'right', vertical: 'bottom' }, onClose: () => setAnchorEl(null), open: open, transformOrigin: { horizontal: 'right', vertical: 'top' }, children: _jsxs(Box, { sx: { width: 320, maxWidth: 'calc(100vw - 32px)' }, children: [_jsxs(Box, { sx: { alignItems: 'center', display: 'flex', justifyContent: 'space-between', px: 2, py: 1 }, children: [_jsx(Typography, { variant: "subtitle1", children: t('NotificationBell.TITLE') }), (canMarkAll ? unreadCount > 0 : unreadIds.length > 0) && (_jsx(Button, { disabled: marking, onClick: () => canMarkAll ? markAllSeen() : Promise.resolve(markSeen(unreadIds)).catch(() => { }), size: "small", children: t(canMarkAll ? 'NotificationBell.MARK_ALL' : 'NotificationBell.MARK_LOADED') }))] }), markError && _jsx(Typography, { role: "alert", sx: { px: 2 }, children: t('NotificationBell.MARK_ERROR') }), notifications.length === 0 ? (_jsx(Typography, { sx: { px: 2, py: 2 }, variant: "body2", children: t('NotificationBell.EMPTY') })) : (_jsx(List, { dense: true, disablePadding: true, children: notifications.map((notification) => { var _a, _b, _c; var _d; return (_jsx(ListItemButton, { onClick: () => handleItemClick(notification), children: _jsx(ListItemText, { primary: t((_a = notification.content) === null || _a === void 0 ? void 0 : _a.title_key, ((_b = notification.content) === null || _b === void 0 ? void 0 : _b.params) || {}), secondary: ((_c = notification.content) === null || _c === void 0 ? void 0 : _c.body_key)
24
24
  ? t(notification.content.body_key, notification.content.params || {})
25
25
  : undefined, slotProps: { primary: { fontWeight: notification.seen || notification.dismissed ? 'regular' : 'bold' } } }) }, (_d = notification.id) !== null && _d !== void 0 ? _d : notification.notification_id)); }) })), feedError && _jsx(Typography, { role: "alert", sx: { px: 2 }, children: t('NotificationBell.LOAD_ERROR') }), feedError && !hasMore && _jsx(Button, { onClick: () => refresh().catch(() => { }), children: t('NotificationBell.RETRY') }), hasMore && _jsx(Button, { disabled: loadingMore, onClick: loadMore, children: t(loadingMore ? 'NotificationBell.LOADING' : feedError ? 'NotificationBell.RETRY' : 'NotificationBell.LOAD_MORE') }), !feedError && !hasMore && notifications.length > 0 && _jsx(Typography, { sx: { px: 2, py: 1 }, variant: "body2", children: t('NotificationBell.END') })] }) })] }));
26
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micha.bigler/ui-core-micha",
3
- "version": "4.40.1",
3
+ "version": "4.40.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "exports": {
@@ -72,6 +72,7 @@
72
72
  "@testing-library/react": "^16.3.3",
73
73
  "@testing-library/user-event": "14.6.9",
74
74
  "@vitejs/plugin-react": "^6.3.0",
75
+ "axe-core": "4.14.1",
75
76
  "i18next": "^26.7.2",
76
77
  "jsdom": "^30.1.3",
77
78
  "react-i18next": "^17.1.13",