@dhis2-ui/header-bar 9.5.0 → 9.6.0

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.
@@ -8,6 +8,8 @@
8
8
  "Debug info": "Debug info",
9
9
  "Close": "Close",
10
10
  "Copy debug info": "Copy debug info",
11
+ "Interpretations": "Interpretations",
12
+ "Messages": "Messages",
11
13
  "Online": "Online",
12
14
  "Offline": "Offline",
13
15
  "Edit profile": "Edit profile",
@@ -18,5 +20,6 @@
18
20
  "Logout": "Logout",
19
21
  "New {{appName}} version available": "New {{appName}} version available",
20
22
  "New app version available": "New app version available",
21
- "Click to reload": "Click to reload"
23
+ "Click to reload": "Click to reload",
24
+ "header bar profile": "header bar profile"
22
25
  }
@@ -15,6 +15,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
15
15
 
16
16
  var _react = _interopRequireDefault(require("react"));
17
17
 
18
+ var _index = _interopRequireDefault(require("./locales/index.js"));
19
+
18
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
21
 
20
22
  function icon(kind) {
@@ -34,12 +36,16 @@ const NotificationIcon = _ref => {
34
36
  count,
35
37
  href,
36
38
  kind,
37
- dataTestId
39
+ dataTestId,
40
+ title,
41
+ 'aria-label': ariaLabel
38
42
  } = _ref;
39
43
  return /*#__PURE__*/_react.default.createElement("a", {
40
44
  dir: "ltr",
41
45
  href: href,
42
46
  "data-test": dataTestId,
47
+ title: _index.default.t(title),
48
+ "aria-label": _index.default.t(ariaLabel),
43
49
  className: _style.default.dynamic([["995028205", [_uiConstants.spacers.dp12, _uiConstants.spacers.dp12, _uiConstants.theme.secondary500, _uiConstants.colors.white, _uiConstants.spacers.dp4]]]) + " " + (kind || "")
44
50
  }, icon(kind), count > 0 && /*#__PURE__*/_react.default.createElement("span", {
45
51
  "data-test": "".concat(dataTestId, "-count"),
@@ -55,7 +61,9 @@ NotificationIcon.defaultProps = {
55
61
  count: 0
56
62
  };
57
63
  NotificationIcon.propTypes = {
64
+ 'aria-label': _propTypes.default.string.isRequired,
58
65
  href: _propTypes.default.string.isRequired,
66
+ title: _propTypes.default.string.isRequired,
59
67
  count: _propTypes.default.number,
60
68
  dataTestId: _propTypes.default.string,
61
69
  kind: _propTypes.default.oneOf(['interpretation', 'message'])
@@ -15,16 +15,12 @@ var _react = _interopRequireDefault(require("react"));
15
15
 
16
16
  var _joinPath = require("./join-path.js");
17
17
 
18
+ var _index = _interopRequireDefault(require("./locales/index.js"));
19
+
18
20
  var _notificationIcon = require("./notification-icon.js");
19
21
 
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
23
 
22
- /*
23
- AUTHORITIES:
24
- - ALL: superuser
25
- - M_dhis-web-interpretation: access to interpretations app
26
- - M_dhis-web-messaging: access to messaging app
27
- */
28
24
  const hasAuthority = (userAuthorities, authId) => Array.isArray(userAuthorities) && userAuthorities.some(userAuthId => userAuthId === 'ALL' || userAuthId === authId);
29
25
 
30
26
  const Notifications = _ref => {
@@ -43,13 +39,17 @@ const Notifications = _ref => {
43
39
  count: interpretations,
44
40
  href: (0, _joinPath.joinPath)(baseUrl, 'dhis-web-interpretation'),
45
41
  kind: "message",
46
- dataTestId: "headerbar-interpretations"
42
+ dataTestId: "headerbar-interpretations",
43
+ title: _index.default.t('Interpretations'),
44
+ "aria-label": _index.default.t('Interpretations')
47
45
  }), hasAuthority(userAuthorities, 'M_dhis-web-messaging') && /*#__PURE__*/_react.default.createElement(_notificationIcon.NotificationIcon, {
48
46
  message: "email",
49
47
  count: messages,
50
48
  href: (0, _joinPath.joinPath)(baseUrl, 'dhis-web-messaging'),
51
49
  kind: "interpretation",
52
- dataTestId: "headerbar-messages"
50
+ dataTestId: "headerbar-messages",
51
+ title: _index.default.t('Messages'),
52
+ "aria-label": _index.default.t('Messages')
53
53
  }), /*#__PURE__*/_react.default.createElement(_style.default, {
54
54
  id: "55705730"
55
55
  }, ["div.jsx-55705730{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%;}"]));
@@ -15,7 +15,9 @@ var _react = _interopRequireWildcard(require("react"));
15
15
 
16
16
  var _debugInfoModal = require("./debug-info/debug-info-modal.js");
17
17
 
18
- var _index = require("./profile-menu/index.js");
18
+ var _index = _interopRequireDefault(require("./locales/index.js"));
19
+
20
+ var _index2 = require("./profile-menu/index.js");
19
21
 
20
22
  var _useOnDocClick = require("./profile/use-on-doc-click.js");
21
23
 
@@ -44,13 +46,15 @@ const Profile = _ref => {
44
46
  className: "jsx-3442481507" + " " + "headerbar-profile"
45
47
  }, /*#__PURE__*/_react.default.createElement("button", {
46
48
  onClick: toggleProfileMenu,
49
+ title: _index.default.t('header bar profile'),
50
+ "aria-label": _index.default.t('header bar profile'),
47
51
  className: "jsx-3442481507" + " " + "headerbar-profile-btn"
48
52
  }, /*#__PURE__*/_react.default.createElement(_userAvatar.UserAvatar, {
49
53
  avatarId: avatarId,
50
54
  name: name,
51
55
  dataTest: "headerbar-profile-icon",
52
56
  medium: true
53
- })), showProfileMenu && /*#__PURE__*/_react.default.createElement(_index.ProfileMenu, {
57
+ })), showProfileMenu && /*#__PURE__*/_react.default.createElement(_index2.ProfileMenu, {
54
58
  avatarId: avatarId,
55
59
  name: name,
56
60
  email: email,
@@ -8,6 +8,8 @@
8
8
  "Debug info": "Debug info",
9
9
  "Close": "Close",
10
10
  "Copy debug info": "Copy debug info",
11
+ "Interpretations": "Interpretations",
12
+ "Messages": "Messages",
11
13
  "Online": "Online",
12
14
  "Offline": "Offline",
13
15
  "Edit profile": "Edit profile",
@@ -18,5 +20,6 @@
18
20
  "Logout": "Logout",
19
21
  "New {{appName}} version available": "New {{appName}} version available",
20
22
  "New app version available": "New app version available",
21
- "Click to reload": "Click to reload"
23
+ "Click to reload": "Click to reload",
24
+ "header bar profile": "header bar profile"
22
25
  }
@@ -3,6 +3,7 @@ import { colors, theme, spacers } from '@dhis2/ui-constants';
3
3
  import { IconMessages24, IconMail24 } from '@dhis2/ui-icons';
4
4
  import PropTypes from 'prop-types';
5
5
  import React from 'react';
6
+ import i18n from './locales/index.js';
6
7
 
7
8
  function icon(kind) {
8
9
  if (kind === 'message') {
@@ -21,12 +22,16 @@ export const NotificationIcon = _ref => {
21
22
  count,
22
23
  href,
23
24
  kind,
24
- dataTestId
25
+ dataTestId,
26
+ title,
27
+ 'aria-label': ariaLabel
25
28
  } = _ref;
26
29
  return /*#__PURE__*/React.createElement("a", {
27
30
  dir: "ltr",
28
31
  href: href,
29
32
  "data-test": dataTestId,
33
+ title: i18n.t(title),
34
+ "aria-label": i18n.t(ariaLabel),
30
35
  className: _JSXStyle.dynamic([["995028205", [spacers.dp12, spacers.dp12, theme.secondary500, colors.white, spacers.dp4]]]) + " " + (kind || "")
31
36
  }, icon(kind), count > 0 && /*#__PURE__*/React.createElement("span", {
32
37
  "data-test": "".concat(dataTestId, "-count"),
@@ -40,7 +45,9 @@ NotificationIcon.defaultProps = {
40
45
  count: 0
41
46
  };
42
47
  NotificationIcon.propTypes = {
48
+ 'aria-label': PropTypes.string.isRequired,
43
49
  href: PropTypes.string.isRequired,
50
+ title: PropTypes.string.isRequired,
44
51
  count: PropTypes.number,
45
52
  dataTestId: PropTypes.string,
46
53
  kind: PropTypes.oneOf(['interpretation', 'message'])
@@ -3,13 +3,8 @@ import { useConfig } from '@dhis2/app-runtime';
3
3
  import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
5
  import { joinPath } from './join-path.js';
6
+ import i18n from './locales/index.js';
6
7
  import { NotificationIcon } from './notification-icon.js';
7
- /*
8
- AUTHORITIES:
9
- - ALL: superuser
10
- - M_dhis-web-interpretation: access to interpretations app
11
- - M_dhis-web-messaging: access to messaging app
12
- */
13
8
 
14
9
  const hasAuthority = (userAuthorities, authId) => Array.isArray(userAuthorities) && userAuthorities.some(userAuthId => userAuthId === 'ALL' || userAuthId === authId);
15
10
 
@@ -29,13 +24,17 @@ export const Notifications = _ref => {
29
24
  count: interpretations,
30
25
  href: joinPath(baseUrl, 'dhis-web-interpretation'),
31
26
  kind: "message",
32
- dataTestId: "headerbar-interpretations"
27
+ dataTestId: "headerbar-interpretations",
28
+ title: i18n.t('Interpretations'),
29
+ "aria-label": i18n.t('Interpretations')
33
30
  }), hasAuthority(userAuthorities, 'M_dhis-web-messaging') && /*#__PURE__*/React.createElement(NotificationIcon, {
34
31
  message: "email",
35
32
  count: messages,
36
33
  href: joinPath(baseUrl, 'dhis-web-messaging'),
37
34
  kind: "interpretation",
38
- dataTestId: "headerbar-messages"
35
+ dataTestId: "headerbar-messages",
36
+ title: i18n.t('Messages'),
37
+ "aria-label": i18n.t('Messages')
39
38
  }), /*#__PURE__*/React.createElement(_JSXStyle, {
40
39
  id: "55705730"
41
40
  }, ["div.jsx-55705730{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%;}"]));
@@ -3,6 +3,7 @@ import { UserAvatar } from '@dhis2-ui/user-avatar';
3
3
  import PropTypes from 'prop-types';
4
4
  import React, { useCallback, useRef, useState } from 'react';
5
5
  import { DebugInfoModal } from './debug-info/debug-info-modal.js';
6
+ import i18n from './locales/index.js';
6
7
  import { ProfileMenu } from './profile-menu/index.js';
7
8
  import { useOnDocClick } from './profile/use-on-doc-click.js';
8
9
 
@@ -25,6 +26,8 @@ const Profile = _ref => {
25
26
  className: "jsx-3442481507" + " " + "headerbar-profile"
26
27
  }, /*#__PURE__*/React.createElement("button", {
27
28
  onClick: toggleProfileMenu,
29
+ title: i18n.t('header bar profile'),
30
+ "aria-label": i18n.t('header bar profile'),
28
31
  className: "jsx-3442481507" + " " + "headerbar-profile-btn"
29
32
  }, /*#__PURE__*/React.createElement(UserAvatar, {
30
33
  avatarId: avatarId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2-ui/header-bar",
3
- "version": "9.5.0",
3
+ "version": "9.6.0",
4
4
  "description": "UI HeaderBar",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,21 +34,21 @@
34
34
  "styled-jsx": "^4"
35
35
  },
36
36
  "dependencies": {
37
- "@dhis2-ui/box": "9.5.0",
38
- "@dhis2-ui/button": "9.5.0",
39
- "@dhis2-ui/card": "9.5.0",
40
- "@dhis2-ui/center": "9.5.0",
41
- "@dhis2-ui/divider": "9.5.0",
42
- "@dhis2-ui/input": "9.5.0",
43
- "@dhis2-ui/layer": "9.5.0",
44
- "@dhis2-ui/loader": "9.5.0",
45
- "@dhis2-ui/logo": "9.5.0",
46
- "@dhis2-ui/menu": "9.5.0",
47
- "@dhis2-ui/modal": "9.5.0",
48
- "@dhis2-ui/user-avatar": "9.5.0",
37
+ "@dhis2-ui/box": "9.6.0",
38
+ "@dhis2-ui/button": "9.6.0",
39
+ "@dhis2-ui/card": "9.6.0",
40
+ "@dhis2-ui/center": "9.6.0",
41
+ "@dhis2-ui/divider": "9.6.0",
42
+ "@dhis2-ui/input": "9.6.0",
43
+ "@dhis2-ui/layer": "9.6.0",
44
+ "@dhis2-ui/loader": "9.6.0",
45
+ "@dhis2-ui/logo": "9.6.0",
46
+ "@dhis2-ui/menu": "9.6.0",
47
+ "@dhis2-ui/modal": "9.6.0",
48
+ "@dhis2-ui/user-avatar": "9.6.0",
49
49
  "@dhis2/prop-types": "^3.1.2",
50
- "@dhis2/ui-constants": "9.5.0",
51
- "@dhis2/ui-icons": "9.5.0",
50
+ "@dhis2/ui-constants": "9.6.0",
51
+ "@dhis2/ui-icons": "9.6.0",
52
52
  "classnames": "^2.3.1",
53
53
  "moment": "^2.29.1",
54
54
  "prop-types": "^15.7.2"