@dhis2-ui/header-bar 9.11.0 → 9.11.1-beta.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/build/cjs/__e2e__/{header-bar.stories.e2e.js → header-bar.e2e.stories.js} +2 -20
- package/build/cjs/__e2e__/stories/common.js +12 -33
- package/build/cjs/__e2e__/stories/custom-application-title.js +3 -8
- package/build/cjs/__e2e__/stories/default.js +1 -7
- package/build/cjs/__e2e__/stories/me-with-avatar.js +3 -8
- package/build/cjs/__e2e__/stories/modulesWithSpecialCharacters.js +2 -3
- package/build/cjs/__e2e__/stories/online-status-message.js +4 -14
- package/build/cjs/__e2e__/stories/pwa-enabled.js +3 -8
- package/build/cjs/__e2e__/stories/user-has-all-authority.js +5 -9
- package/build/cjs/__e2e__/stories/user-has-no-authorities.js +5 -9
- package/build/cjs/__e2e__/stories/user-has-web-interpretation-and-messaging-authority.js +5 -9
- package/build/cjs/__e2e__/stories/user-has-web-interpretation-authority.js +5 -9
- package/build/cjs/__e2e__/stories/user-has-web-messaging-authority.js +5 -9
- package/build/cjs/__e2e__/stories/with-debug-info-edge-cases.js +11 -18
- package/build/cjs/__e2e__/stories/with-special-app-name-character.js +5 -9
- package/build/cjs/__e2e__/stories/with-update-available-notification.js +6 -13
- package/build/cjs/__e2e__/stories/zero-unread-interpretations.js +3 -8
- package/build/cjs/__e2e__/stories/zero-unread-messages.js +3 -8
- package/build/cjs/apps.js +9 -34
- package/build/cjs/debug-info/debug-info-menu-item.js +4 -17
- package/build/cjs/debug-info/debug-info-modal.js +2 -15
- package/build/cjs/debug-info/debug-info-table.js +2 -9
- package/build/cjs/debug-info/use-debug-info.js +0 -5
- package/build/cjs/features/common/index.js +3 -7
- package/build/cjs/features/the_headerbar_can_display_online_status/the_headerbar_displays_online_status.js +9 -5
- package/build/cjs/features/the_headerbar_conditionally_renders_notification_icons/the_headerbar_conditionally_renders_notification_icons.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_menu_to_all_apps/common.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_menu_to_all_apps/the_app_menu_closes_when_the_user_clicks_outside.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_menu_to_all_apps/the_headerbar_contains_a_menu_icon.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_menu_to_all_apps/the_user_will_be_offered_a_menu_with_5_apps.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/common.js +4 -2
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_headerbar_shows_a_text_icon_if_the_user_does_not_have_an_avatar.js +2 -3
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_headerbar_shows_an_image_icon_if_the_user_has_an_avatar.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_menu_opens.js +4 -2
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_profile_menu_closes_when_the_user_clicks_outside.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_edit_his_profile.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_go_to_his_account.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_go_to_the_about_dhis2_page.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_go_to_the_help_page.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_go_to_the_settings.js +0 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_log_out.js +16 -14
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_name_and_email_are_displayed.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_interpretations_and_an_unread_count/the_headerbar_displays_a_link_to_the_interpretations.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_interpretations_and_an_unread_count/there_are_no_unread_interpretations.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_interpretations_and_an_unread_count/there_are_some_unread_interpretations.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_messages_and_an_unread_count/the_headerbar_displays_a_link_to_the_messages.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_messages_and_an_unread_count/there_are_no_unread_messages.js +0 -1
- package/build/cjs/features/the_headerbar_displays_a_link_to_messages_and_an_unread_count/there_are_some_unread_messages.js +0 -1
- package/build/cjs/features/the_headerbar_should_contain_a_logo_that_links_to_the_homepage/headerbar_contains_logo.js +0 -2
- package/build/cjs/features/the_headerbar_should_display_app_update_notification/index.js +0 -1
- package/build/cjs/features/the_headerbar_should_display_debug_version_infos/index.js +0 -1
- package/build/cjs/features/the_headerbar_should_display_the_title_provided_by_the_backend_and_the_app/the_headerbar_displays_the_custom_title.js +0 -1
- package/build/cjs/features/the_search_should_escape_regexp_character/common.js +0 -1
- package/build/cjs/features/the_search_should_escape_regexp_character/the_modules_do_not_contain_items_with_special_chars.js +0 -1
- package/build/cjs/features/the_search_should_escape_regexp_character/the_user_searches_for_an_app_with_a_regex_character.js +2 -4
- package/build/cjs/header-bar-context.js +3 -13
- package/build/cjs/header-bar.js +8 -31
- package/build/cjs/{header-bar.stories.js → header-bar.prod.stories.js} +33 -40
- package/build/cjs/index.js +0 -1
- package/build/cjs/join-path.js +0 -3
- package/build/cjs/locales/index.js +3 -77
- package/build/cjs/logo-image.js +2 -15
- package/build/cjs/logo.js +1 -8
- package/build/cjs/notification-icon.js +3 -13
- package/build/cjs/notifications.js +1 -12
- package/build/cjs/online-status.js +6 -16
- package/build/cjs/online-status.styles.js +2 -5
- package/build/cjs/profile/use-on-doc-click.js +0 -4
- package/build/cjs/profile/use-on-doc-click.test.js +0 -2
- package/build/cjs/profile-menu/index.js +0 -2
- package/build/cjs/profile-menu/profile-header.js +2 -20
- package/build/cjs/profile-menu/profile-menu.js +10 -33
- package/build/cjs/profile-menu/update-notification.js +3 -17
- package/build/cjs/profile.js +5 -19
- package/build/cjs/title.js +2 -8
- package/build/es/__e2e__/stories/common.js +3 -8
- package/build/es/__e2e__/stories/custom-application-title.js +2 -1
- package/build/es/__e2e__/stories/me-with-avatar.js +2 -1
- package/build/es/__e2e__/stories/online-status-message.js +3 -4
- package/build/es/__e2e__/stories/pwa-enabled.js +2 -1
- package/build/es/__e2e__/stories/user-has-all-authority.js +4 -2
- package/build/es/__e2e__/stories/user-has-no-authorities.js +4 -2
- package/build/es/__e2e__/stories/user-has-web-interpretation-and-messaging-authority.js +4 -2
- package/build/es/__e2e__/stories/user-has-web-interpretation-authority.js +4 -2
- package/build/es/__e2e__/stories/user-has-web-messaging-authority.js +4 -2
- package/build/es/__e2e__/stories/with-debug-info-edge-cases.js +10 -5
- package/build/es/__e2e__/stories/with-special-app-name-character.js +4 -2
- package/build/es/__e2e__/stories/with-update-available-notification.js +4 -2
- package/build/es/__e2e__/stories/zero-unread-interpretations.js +2 -1
- package/build/es/__e2e__/stories/zero-unread-messages.js +2 -1
- package/build/es/apps.js +6 -16
- package/build/es/debug-info/debug-info-menu-item.js +3 -5
- package/build/es/debug-info/debug-info-modal.js +1 -3
- package/build/es/debug-info/debug-info-table.js +1 -3
- package/build/es/features/common/index.js +1 -1
- package/build/es/features/the_headerbar_can_display_online_status/the_headerbar_displays_online_status.js +11 -5
- package/build/es/features/the_headerbar_contains_a_profile_menu/common.js +4 -1
- package/build/es/features/the_headerbar_contains_a_profile_menu/the_headerbar_shows_a_text_icon_if_the_user_does_not_have_an_avatar.js +2 -2
- package/build/es/features/the_headerbar_contains_a_profile_menu/the_menu_opens.js +4 -1
- package/build/es/features/the_headerbar_contains_a_profile_menu/the_user_can_log_out.js +15 -11
- package/build/es/features/the_search_should_escape_regexp_character/the_user_searches_for_an_app_with_a_regex_character.js +2 -1
- package/build/es/header-bar.js +5 -6
- package/build/es/{header-bar.stories.js → header-bar.prod.stories.js} +32 -11
- package/build/es/join-path.js +0 -1
- package/build/es/logo-image.js +1 -7
- package/build/es/notification-icon.js +2 -4
- package/build/es/notifications.js +0 -2
- package/build/es/online-status.js +6 -6
- package/build/es/online-status.styles.js +1 -1
- package/build/es/profile/use-on-doc-click.js +0 -1
- package/build/es/profile-menu/profile-header.js +1 -9
- package/build/es/profile-menu/profile-menu.js +7 -8
- package/build/es/profile-menu/update-notification.js +2 -4
- package/build/es/profile.js +1 -3
- package/build/es/title.js +1 -1
- package/package.json +18 -18
- /package/build/es/__e2e__/{header-bar.stories.e2e.js → header-bar.e2e.stories.js} +0 -0
package/build/es/header-bar.js
CHANGED
|
@@ -34,7 +34,6 @@ const query = {
|
|
|
34
34
|
};
|
|
35
35
|
export const HeaderBar = _ref => {
|
|
36
36
|
var _data$user$avatar;
|
|
37
|
-
|
|
38
37
|
let {
|
|
39
38
|
appName,
|
|
40
39
|
className,
|
|
@@ -53,13 +52,14 @@ export const HeaderBar = _ref => {
|
|
|
53
52
|
} = useDataQuery(query);
|
|
54
53
|
const apps = useMemo(() => {
|
|
55
54
|
const getPath = path => path.startsWith('http:') || path.startsWith('https:') ? path : joinPath(baseUrl, 'api', path);
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
return data === null || data === void 0 ? void 0 : data.apps.modules.map(app => ({
|
|
56
|
+
...app,
|
|
58
57
|
icon: getPath(app.icon),
|
|
59
58
|
defaultAction: getPath(app.defaultAction)
|
|
60
59
|
}));
|
|
61
|
-
}, [data, baseUrl]);
|
|
60
|
+
}, [data, baseUrl]);
|
|
62
61
|
|
|
62
|
+
// See https://jira.dhis2.org/browse/LIBS-180
|
|
63
63
|
if (!loading && !error) {
|
|
64
64
|
// TODO: This will run every render which is probably wrong!
|
|
65
65
|
// Also, setting the global locale shouldn't be done in the headerbar
|
|
@@ -67,7 +67,6 @@ export const HeaderBar = _ref => {
|
|
|
67
67
|
i18n.setDefaultNamespace('default');
|
|
68
68
|
i18n.changeLanguage(locale);
|
|
69
69
|
}
|
|
70
|
-
|
|
71
70
|
return /*#__PURE__*/React.createElement(HeaderBarContextProvider, {
|
|
72
71
|
updateAvailable: updateAvailable,
|
|
73
72
|
onApplyAvailableUpdate: onApplyAvailableUpdate
|
|
@@ -96,7 +95,7 @@ export const HeaderBar = _ref => {
|
|
|
96
95
|
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
97
96
|
id: "4230161118",
|
|
98
97
|
dynamic: [colors.white]
|
|
99
|
-
}, [
|
|
98
|
+
}, [`.main.__jsx-style-dynamic-selector{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;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;background-color:#2c6693;color:${colors.white};height:48px;}`, ".right-control-spacer.__jsx-style-dynamic-selector{margin-inline-start:auto;}"])));
|
|
100
99
|
};
|
|
101
100
|
HeaderBar.propTypes = {
|
|
102
101
|
appName: PropTypes.string,
|
|
@@ -4,7 +4,19 @@ import { createDecoratorProvider, mockOfflineInterface, providerConfig } from '.
|
|
|
4
4
|
import { OnlineStatusMessageUpdate } from './__e2e__/stories/online-status-message.js';
|
|
5
5
|
import { HeaderBar } from './header-bar.js';
|
|
6
6
|
const subtitle = 'The common navigation bar used in all DHIS2 apps';
|
|
7
|
-
const description =
|
|
7
|
+
const description = `
|
|
8
|
+
The header bar is mandatory for all apps. This creates a stable, understandable point of reference for the user across all kinds of different apps. It must always be displayed fixed to the top of the screen. Do not interfere or obstruct interaction with the header bar.
|
|
9
|
+
|
|
10
|
+
The header bar is included automatically with the App Shell and should not need any configuration.
|
|
11
|
+
|
|
12
|
+
#### Theme
|
|
13
|
+
|
|
14
|
+
The header bar can be themeed to suit the brand/color of your DHIS2 instance. The color of the text/icons will be automatically adjusted based on the selected color.
|
|
15
|
+
|
|
16
|
+
\`\`\`js
|
|
17
|
+
import { HeaderBar } from '@dhis2/ui'
|
|
18
|
+
\`\`\`
|
|
19
|
+
`;
|
|
8
20
|
const customData = {
|
|
9
21
|
'systemSettings/applicationTitle': {
|
|
10
22
|
applicationTitle: 'Foobar'
|
|
@@ -98,30 +110,36 @@ const customData = {
|
|
|
98
110
|
unreadMessageConversations: 5
|
|
99
111
|
}
|
|
100
112
|
};
|
|
101
|
-
const customLogoData = {
|
|
113
|
+
const customLogoData = {
|
|
114
|
+
...customData,
|
|
102
115
|
'staticContent/logo_banner': {
|
|
103
116
|
images: {
|
|
104
117
|
png: 'https://via.placeholder.com/150x50'
|
|
105
118
|
}
|
|
106
119
|
}
|
|
107
120
|
};
|
|
108
|
-
const customLocaleData = {
|
|
121
|
+
const customLocaleData = {
|
|
122
|
+
...customData,
|
|
109
123
|
'systemSettings/applicationTitle': {
|
|
110
124
|
applicationTitle: 'Le Gros Foobar'
|
|
111
125
|
},
|
|
112
|
-
me: {
|
|
126
|
+
me: {
|
|
127
|
+
...customData.me,
|
|
113
128
|
settings: {
|
|
114
129
|
keyUiLocale: 'fr'
|
|
115
130
|
}
|
|
116
131
|
},
|
|
117
132
|
'action::menu/getModules': {
|
|
118
|
-
modules: customData['action::menu/getModules'].modules.map(mod => ({
|
|
119
|
-
|
|
133
|
+
modules: customData['action::menu/getModules'].modules.map(mod => ({
|
|
134
|
+
...mod,
|
|
135
|
+
displayName: `Le ${mod.displayName}`
|
|
120
136
|
}))
|
|
121
137
|
}
|
|
122
138
|
};
|
|
123
|
-
const customAuthoritiesData = {
|
|
124
|
-
|
|
139
|
+
const customAuthoritiesData = {
|
|
140
|
+
...customData,
|
|
141
|
+
me: {
|
|
142
|
+
...customData.me,
|
|
125
143
|
authorities: ['M_dhis-web-messaging']
|
|
126
144
|
}
|
|
127
145
|
};
|
|
@@ -180,7 +198,8 @@ export const WithOnlineStatus = () => /*#__PURE__*/React.createElement(CustomDat
|
|
|
180
198
|
}, /*#__PURE__*/React.createElement(HeaderBar, {
|
|
181
199
|
appName: "Exemple!"
|
|
182
200
|
}));
|
|
183
|
-
WithOnlineStatus.decorators = [createDecoratorProvider({
|
|
201
|
+
WithOnlineStatus.decorators = [createDecoratorProvider({
|
|
202
|
+
...providerConfig,
|
|
184
203
|
pwaEnabled: true
|
|
185
204
|
})];
|
|
186
205
|
WithOnlineStatus.parameters = {
|
|
@@ -211,9 +230,11 @@ export const RTLHeader = () => /*#__PURE__*/React.createElement(CustomDataProvid
|
|
|
211
230
|
}, /*#__PURE__*/React.createElement(HeaderBar, {
|
|
212
231
|
appName: "Example!"
|
|
213
232
|
})));
|
|
214
|
-
WithOnlineStatusMessage.decorators = [createDecoratorProvider({
|
|
233
|
+
WithOnlineStatusMessage.decorators = [createDecoratorProvider({
|
|
234
|
+
...providerConfig,
|
|
215
235
|
pwaEnabled: true
|
|
216
|
-
}, {
|
|
236
|
+
}, {
|
|
237
|
+
...mockOfflineInterface,
|
|
217
238
|
latestIsConnected: false
|
|
218
239
|
})];
|
|
219
240
|
WithOnlineStatusMessage.parameters = {
|
package/build/es/join-path.js
CHANGED
|
@@ -2,7 +2,6 @@ export const joinPath = function () {
|
|
|
2
2
|
for (var _len = arguments.length, parts = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3
3
|
parts[_key] = arguments[_key];
|
|
4
4
|
}
|
|
5
|
-
|
|
6
5
|
const realParts = parts.filter(part => !!part);
|
|
7
6
|
return realParts.map(part => part.replace(/^\/+|\/+$/g, '')).join('/');
|
|
8
7
|
};
|
package/build/es/logo-image.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import { LogoIconWhite } from '@dhis2-ui/logo';
|
|
3
2
|
import { useDataQuery } from '@dhis2/app-runtime';
|
|
3
|
+
import { LogoIconWhite } from '@dhis2-ui/logo';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
const logoStyles = {
|
|
6
6
|
styles: /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
@@ -13,22 +13,17 @@ const query = {
|
|
|
13
13
|
resource: 'staticContent/logo_banner'
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
|
|
17
16
|
const pathExists = data => data && data.customLogo && data.customLogo.images && data.customLogo.images.png;
|
|
18
|
-
|
|
19
17
|
export const LogoImage = () => {
|
|
20
18
|
const {
|
|
21
19
|
loading,
|
|
22
20
|
error,
|
|
23
21
|
data
|
|
24
22
|
} = useDataQuery(query);
|
|
25
|
-
|
|
26
23
|
if (loading) {
|
|
27
24
|
return null;
|
|
28
25
|
}
|
|
29
|
-
|
|
30
26
|
let Logo;
|
|
31
|
-
|
|
32
27
|
if (!error && pathExists(data)) {
|
|
33
28
|
Logo = /*#__PURE__*/React.createElement("img", {
|
|
34
29
|
alt: "Headerbar Logo",
|
|
@@ -40,7 +35,6 @@ export const LogoImage = () => {
|
|
|
40
35
|
className: logoStyles.className
|
|
41
36
|
});
|
|
42
37
|
}
|
|
43
|
-
|
|
44
38
|
return /*#__PURE__*/React.createElement("div", {
|
|
45
39
|
className: "jsx-3930434724"
|
|
46
40
|
}, Logo, logoStyles.styles, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
@@ -4,7 +4,6 @@ import { IconMessages24, IconMail24 } from '@dhis2/ui-icons';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import i18n from './locales/index.js';
|
|
7
|
-
|
|
8
7
|
function icon(kind) {
|
|
9
8
|
if (kind === 'message') {
|
|
10
9
|
return /*#__PURE__*/React.createElement(IconMessages24, {
|
|
@@ -16,7 +15,6 @@ function icon(kind) {
|
|
|
16
15
|
});
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
export const NotificationIcon = _ref => {
|
|
21
19
|
let {
|
|
22
20
|
count,
|
|
@@ -34,12 +32,12 @@ export const NotificationIcon = _ref => {
|
|
|
34
32
|
"aria-label": i18n.t(ariaLabel),
|
|
35
33
|
className: _JSXStyle.dynamic([["995028205", [spacers.dp12, spacers.dp12, theme.secondary500, colors.white, spacers.dp4]]]) + " " + (kind || "")
|
|
36
34
|
}, icon(kind), count > 0 && /*#__PURE__*/React.createElement("span", {
|
|
37
|
-
"data-test":
|
|
35
|
+
"data-test": `${dataTestId}-count`,
|
|
38
36
|
className: _JSXStyle.dynamic([["995028205", [spacers.dp12, spacers.dp12, theme.secondary500, colors.white, spacers.dp4]]])
|
|
39
37
|
}, count), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
40
38
|
id: "995028205",
|
|
41
39
|
dynamic: [spacers.dp12, spacers.dp12, theme.secondary500, colors.white, spacers.dp4]
|
|
42
|
-
}, [
|
|
40
|
+
}, [`a.__jsx-style-dynamic-selector{position:relative;margin:0;cursor:pointer;padding:0 ${spacers.dp12};height:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}`, "a.__jsx-style-dynamic-selector:focus{outline:2px solid white;outline-offset:-2px;}", "a.__jsx-style-dynamic-selector:focus.__jsx-style-dynamic-selector:not(:focus-visible){outline:none;}", "a.__jsx-style-dynamic-selector:hover{background:#1a557f;}", "a.__jsx-style-dynamic-selector:active{background:#104067;}", `span.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;z-index:1;position:absolute;top:3px;inset-inline-end:2px;min-width:18px;min-height:18px;border-radius:${spacers.dp12};box-shadow:0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px 0 rgba(0,0,0,0.06);background-color:${theme.secondary500};color:${colors.white};font-size:13px;font-weight:600;line-height:15px;text-align:center;cursor:inherit;padding:0 ${spacers.dp4};}`]));
|
|
43
41
|
};
|
|
44
42
|
NotificationIcon.defaultProps = {
|
|
45
43
|
count: 0
|
|
@@ -5,9 +5,7 @@ import React from 'react';
|
|
|
5
5
|
import { joinPath } from './join-path.js';
|
|
6
6
|
import i18n from './locales/index.js';
|
|
7
7
|
import { NotificationIcon } from './notification-icon.js';
|
|
8
|
-
|
|
9
8
|
const hasAuthority = (userAuthorities, authId) => Array.isArray(userAuthorities) && userAuthorities.some(userAuthId => userAuthId === 'ALL' || userAuthId === authId);
|
|
10
|
-
|
|
11
9
|
export const Notifications = _ref => {
|
|
12
10
|
let {
|
|
13
11
|
interpretations,
|
|
@@ -5,8 +5,8 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import i18n from './locales/index.js';
|
|
7
7
|
import styles from './online-status.styles.js';
|
|
8
|
-
/** A badge to display online/offline status in the header bar */
|
|
9
8
|
|
|
9
|
+
/** A badge to display online/offline status in the header bar */
|
|
10
10
|
export function OnlineStatus(_ref) {
|
|
11
11
|
let {
|
|
12
12
|
dense
|
|
@@ -20,15 +20,15 @@ export function OnlineStatus(_ref) {
|
|
|
20
20
|
const displayStatus = online ? i18n.t('Online') : i18n.t('Offline');
|
|
21
21
|
return /*#__PURE__*/React.createElement("div", {
|
|
22
22
|
"data-test": "headerbar-online-status",
|
|
23
|
-
className:
|
|
23
|
+
className: `jsx-${styles.__hash}` + " " + (cx('container', dense ? 'bar' : 'badge') || "")
|
|
24
24
|
}, onlineStatusMessage && !dense && /*#__PURE__*/React.createElement("span", {
|
|
25
|
-
className:
|
|
25
|
+
className: `jsx-${styles.__hash}` + " " + "info unselectable"
|
|
26
26
|
}, onlineStatusMessage), /*#__PURE__*/React.createElement("div", {
|
|
27
|
-
className:
|
|
27
|
+
className: `jsx-${styles.__hash}` + " " + (cx('icon', online ? 'online' : 'offline') || "")
|
|
28
28
|
}), /*#__PURE__*/React.createElement("span", {
|
|
29
|
-
className:
|
|
29
|
+
className: `jsx-${styles.__hash}` + " " + "label unselectable"
|
|
30
30
|
}, displayStatus), onlineStatusMessage && dense && /*#__PURE__*/React.createElement("span", {
|
|
31
|
-
className:
|
|
31
|
+
className: `jsx-${styles.__hash}` + " " + "info-dense unselectable"
|
|
32
32
|
}, onlineStatusMessage), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
33
33
|
id: styles.__hash
|
|
34
34
|
}, styles));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { colors, spacers } from '@dhis2/ui-constants';
|
|
2
|
-
const _defaultExport = [
|
|
2
|
+
const _defaultExport = [`.container.jsx-2382375945{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;background-color:#104167;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;color:${colors.grey100};}`, `.container.badge.jsx-2382375945{margin-inline-end:${spacers.dp8};padding:${spacers.dp8};border-radius:5px;font-size:14px;}`, `.container.bar.jsx-2382375945{display:none;padding:0px ${spacers.dp4};min-height:24px;font-size:13px;}`, "@media (max-width:480px){.container.badge.jsx-2382375945{display:none;}.container.bar.jsx-2382375945{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}}", ".unselectable.jsx-2382375945{cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}", `.info.jsx-2382375945{margin-inline-end:${spacers.dp16};}`, `.info-dense.jsx-2382375945{margin-inline-start:${spacers.dp12};font-size:12px;}`, `.icon.jsx-2382375945{width:8px;min-width:8px;height:8px;border-radius:8px;margin-inline-end:${spacers.dp4};}`, `.icon.online.jsx-2382375945{background-color:${colors.teal400};}`, `.icon.offline.jsx-2382375945{background-color:transparent;border:1px solid ${colors.yellow300};}`, `.icon.reconnecting.jsx-2382375945{background:${colors.grey300};-webkit-animation:fadeinout 2s linear infinite;-webkit-animation:fadeinout-jsx-2382375945 2s linear infinite;animation:fadeinout-jsx-2382375945 2s linear infinite;opacity:0;}`, "@-webkit-keyframes fadeinout{50%.jsx-2382375945{opacity:1;}}", "@-webkit-keyframes fadeinout-jsx-2382375945{50%{opacity:1;}}", "@keyframes fadeinout-jsx-2382375945{50%{opacity:1;}}", ".label.jsx-2382375945{-webkit-letter-spacing:0.5px;-moz-letter-spacing:0.5px;-ms-letter-spacing:0.5px;letter-spacing:0.5px;}"];
|
|
3
3
|
_defaultExport.__hash = "2382375945";
|
|
4
4
|
export default _defaultExport;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import { UserAvatar } from '@dhis2-ui/user-avatar';
|
|
3
2
|
import { useConfig } from '@dhis2/app-runtime';
|
|
3
|
+
import { UserAvatar } from '@dhis2-ui/user-avatar';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { joinPath } from '../join-path.js';
|
|
7
7
|
import i18n from '../locales/index.js';
|
|
8
|
-
|
|
9
8
|
const ProfileName = _ref => {
|
|
10
9
|
let {
|
|
11
10
|
children
|
|
@@ -17,11 +16,9 @@ const ProfileName = _ref => {
|
|
|
17
16
|
id: "2223023701"
|
|
18
17
|
}, ["div.jsx-2223023701{margin-bottom:3px;font-size:16px;line-height:19px;}"]));
|
|
19
18
|
};
|
|
20
|
-
|
|
21
19
|
ProfileName.propTypes = {
|
|
22
20
|
children: PropTypes.string
|
|
23
21
|
};
|
|
24
|
-
|
|
25
22
|
const ProfileEmail = _ref2 => {
|
|
26
23
|
let {
|
|
27
24
|
children
|
|
@@ -33,11 +30,9 @@ const ProfileEmail = _ref2 => {
|
|
|
33
30
|
id: "1072768994"
|
|
34
31
|
}, ["div.jsx-1072768994{margin-bottom:6px;font-size:14px;line-height:16px;}"]));
|
|
35
32
|
};
|
|
36
|
-
|
|
37
33
|
ProfileEmail.propTypes = {
|
|
38
34
|
children: PropTypes.string
|
|
39
35
|
};
|
|
40
|
-
|
|
41
36
|
const ProfileEdit = _ref3 => {
|
|
42
37
|
let {
|
|
43
38
|
children
|
|
@@ -53,11 +48,9 @@ const ProfileEdit = _ref3 => {
|
|
|
53
48
|
id: "233684196"
|
|
54
49
|
}, ["a.jsx-233684196{color:rgba(0,0,0,0.87);font-size:12px;line-height:14px;-webkit-text-decoration:underline;text-decoration:underline;cursor:pointer;}"]));
|
|
55
50
|
};
|
|
56
|
-
|
|
57
51
|
ProfileEdit.propTypes = {
|
|
58
52
|
children: PropTypes.string
|
|
59
53
|
};
|
|
60
|
-
|
|
61
54
|
const ProfileDetails = _ref4 => {
|
|
62
55
|
let {
|
|
63
56
|
name,
|
|
@@ -69,7 +62,6 @@ const ProfileDetails = _ref4 => {
|
|
|
69
62
|
id: "4236878114"
|
|
70
63
|
}, ["div.jsx-4236878114{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;margin-inline-start:20px;color:#000;font-size:14px;font-weight:400;}"]));
|
|
71
64
|
};
|
|
72
|
-
|
|
73
65
|
ProfileDetails.propTypes = {
|
|
74
66
|
email: PropTypes.string,
|
|
75
67
|
name: PropTypes.string
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import { clearSensitiveCaches, useConfig } from '@dhis2/app-runtime';
|
|
3
|
+
import { colors } from '@dhis2/ui-constants';
|
|
4
|
+
import { IconSettings24, IconInfo24, IconLogOut24, IconUser24, IconQuestion24 } from '@dhis2/ui-icons';
|
|
2
5
|
import { Card } from '@dhis2-ui/card';
|
|
3
6
|
import { Center } from '@dhis2-ui/center';
|
|
4
7
|
import { Divider } from '@dhis2-ui/divider';
|
|
5
8
|
import { Layer } from '@dhis2-ui/layer';
|
|
6
9
|
import { CircularLoader } from '@dhis2-ui/loader';
|
|
7
10
|
import { MenuDivider, MenuItem } from '@dhis2-ui/menu';
|
|
8
|
-
import { clearSensitiveCaches, useConfig } from '@dhis2/app-runtime';
|
|
9
|
-
import { colors } from '@dhis2/ui-constants';
|
|
10
|
-
import { IconSettings24, IconInfo24, IconLogOut24, IconUser24, IconQuestion24 } from '@dhis2/ui-icons';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import React, { useState } from 'react';
|
|
13
13
|
import { DebugInfoMenuItem } from '../debug-info/debug-info-menu-item.js';
|
|
@@ -15,13 +15,11 @@ import { joinPath } from '../join-path.js';
|
|
|
15
15
|
import i18n from '../locales/index.js';
|
|
16
16
|
import { ProfileHeader } from './profile-header.js';
|
|
17
17
|
import { UpdateNotification } from './update-notification.js';
|
|
18
|
-
|
|
19
18
|
const LoadingMask = () => /*#__PURE__*/React.createElement(Layer, {
|
|
20
19
|
translucent: true,
|
|
21
20
|
disablePortal: true,
|
|
22
21
|
dataTest: "headerbar-profile-menu-loading-mask"
|
|
23
22
|
}, /*#__PURE__*/React.createElement(Center, null, /*#__PURE__*/React.createElement(CircularLoader, null)));
|
|
24
|
-
|
|
25
23
|
const ProfileContents = _ref => {
|
|
26
24
|
let {
|
|
27
25
|
name,
|
|
@@ -75,7 +73,8 @@ const ProfileContents = _ref => {
|
|
|
75
73
|
color: colors.grey700
|
|
76
74
|
})
|
|
77
75
|
}), /*#__PURE__*/React.createElement(MenuItem, {
|
|
78
|
-
href: joinPath(baseUrl, 'dhis-web-commons-security/logout.action')
|
|
76
|
+
href: joinPath(baseUrl, 'dhis-web-commons-security/logout.action')
|
|
77
|
+
// NB: By MenuItem implementation, this callback
|
|
79
78
|
// overwrites default navigation behavior but maintains
|
|
80
79
|
// the href attribute
|
|
81
80
|
,
|
|
@@ -101,7 +100,6 @@ const ProfileContents = _ref => {
|
|
|
101
100
|
id: "2099675810"
|
|
102
101
|
}, ["div.jsx-2099675810{width:100%;padding:0;}", "ul.jsx-2099675810{padding:0;margin:0;}", "a.jsx-2099675810,a.jsx-2099675810:hover,a.jsx-2099675810:focus,a.jsx-2099675810:active,a.jsx-2099675810:visited{-webkit-text-decoration:none;text-decoration:none;display:block;}"]));
|
|
103
102
|
};
|
|
104
|
-
|
|
105
103
|
ProfileContents.propTypes = {
|
|
106
104
|
hideProfileMenu: PropTypes.func.isRequired,
|
|
107
105
|
showDebugInfoModal: PropTypes.func.isRequired,
|
|
@@ -111,7 +109,8 @@ ProfileContents.propTypes = {
|
|
|
111
109
|
name: PropTypes.string
|
|
112
110
|
};
|
|
113
111
|
export const ProfileMenu = _ref2 => {
|
|
114
|
-
let {
|
|
112
|
+
let {
|
|
113
|
+
...props
|
|
115
114
|
} = _ref2;
|
|
116
115
|
return /*#__PURE__*/React.createElement("div", {
|
|
117
116
|
"data-test": "headerbar-profile-menu",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
-
import { MenuItem } from '@dhis2-ui/menu';
|
|
3
2
|
import { useConfig } from '@dhis2/app-runtime';
|
|
4
3
|
import { colors } from '@dhis2/ui-constants';
|
|
4
|
+
import { MenuItem } from '@dhis2-ui/menu';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { useHeaderBarContext } from '../header-bar-context.js';
|
|
@@ -17,12 +17,10 @@ export function UpdateNotification(_ref) {
|
|
|
17
17
|
updateAvailable,
|
|
18
18
|
onApplyAvailableUpdate
|
|
19
19
|
} = useHeaderBarContext();
|
|
20
|
-
|
|
21
20
|
const onClick = () => {
|
|
22
21
|
hideProfileMenu();
|
|
23
22
|
onApplyAvailableUpdate === null || onApplyAvailableUpdate === void 0 ? void 0 : onApplyAvailableUpdate();
|
|
24
23
|
};
|
|
25
|
-
|
|
26
24
|
const updateNotificationLabel = /*#__PURE__*/React.createElement("div", {
|
|
27
25
|
className: _JSXStyle.dynamic([["4135170305", [colors.blue600]]]) + " " + "root"
|
|
28
26
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -38,7 +36,7 @@ export function UpdateNotification(_ref) {
|
|
|
38
36
|
}), i18n.t('Click to reload')), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
39
37
|
id: "4135170305",
|
|
40
38
|
dynamic: [colors.blue600]
|
|
41
|
-
}, [".root.__jsx-style-dynamic-selector{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;font-size:14px;line-height:17px;}",
|
|
39
|
+
}, [".root.__jsx-style-dynamic-selector{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;font-size:14px;line-height:17px;}", `.badge.__jsx-style-dynamic-selector{display:inline-block;width:12px;height:12px;margin:0 8px;border-radius:6px;background-color:${colors.blue600};}`, ".spacer.__jsx-style-dynamic-selector{display:inline-block;width:8px;}", ".message.__jsx-style-dynamic-selector{display:inline-block;}"]));
|
|
42
40
|
return updateAvailable ? /*#__PURE__*/React.createElement(MenuItem, {
|
|
43
41
|
dense: true,
|
|
44
42
|
onClick: onClick,
|
package/build/es/profile.js
CHANGED
|
@@ -4,9 +4,8 @@ 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
6
|
import i18n from './locales/index.js';
|
|
7
|
-
import { ProfileMenu } from './profile-menu/index.js';
|
|
8
7
|
import { useOnDocClick } from './profile/use-on-doc-click.js';
|
|
9
|
-
|
|
8
|
+
import { ProfileMenu } from './profile-menu/index.js';
|
|
10
9
|
const Profile = _ref => {
|
|
11
10
|
let {
|
|
12
11
|
name,
|
|
@@ -51,7 +50,6 @@ const Profile = _ref => {
|
|
|
51
50
|
id: "3442481507"
|
|
52
51
|
}, [".headerbar-profile.jsx-3442481507{position:relative;height:100%;}", ".headerbar-profile-btn.jsx-3442481507{background:transparent;padding:6px;border:0;cursor:pointer;}", ".headerbar-profile-btn.jsx-3442481507:focus{outline:2px solid white;outline-offset:-2px;}", ".headerbar-profile-btn.jsx-3442481507:focus.jsx-3442481507:not(:focus-visible){outline:none;}", ".headerbar-profile-btn.jsx-3442481507:hover{background:#1a557f;}", ".headerbar-profile-btn.jsx-3442481507:active{background:#104067;}"]));
|
|
53
52
|
};
|
|
54
|
-
|
|
55
53
|
Profile.propTypes = {
|
|
56
54
|
name: PropTypes.string.isRequired,
|
|
57
55
|
avatarId: PropTypes.string,
|
package/build/es/title.js
CHANGED
|
@@ -9,7 +9,7 @@ export const Title = _ref => {
|
|
|
9
9
|
return /*#__PURE__*/React.createElement("div", {
|
|
10
10
|
"data-test": "headerbar-title",
|
|
11
11
|
className: "jsx-2721515324"
|
|
12
|
-
}, app ?
|
|
12
|
+
}, app ? `${instance} - ${app}` : `${instance}`, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
13
13
|
id: "2721515324"
|
|
14
14
|
}, ["div.jsx-2721515324{overflow:hidden;text-overflow:ellipsis;font-size:14px;font-weight:500;-webkit-letter-spacing:0.01em;-moz-letter-spacing:0.01em;-ms-letter-spacing:0.01em;letter-spacing:0.01em;white-space:nowrap;}"]));
|
|
15
15
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2-ui/header-bar",
|
|
3
|
-
"version": "9.11.
|
|
3
|
+
"version": "9.11.1-beta.2",
|
|
4
4
|
"description": "UI HeaderBar",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,33 +22,33 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
|
-
"start": "
|
|
25
|
+
"start": "storybook dev -c ../../storybook/config --port 5000",
|
|
26
26
|
"build": "d2-app-scripts build",
|
|
27
27
|
"test": "d2-app-scripts test --jestConfig ../../jest.config.shared.js"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@dhis2/app-runtime": "^3",
|
|
31
31
|
"@dhis2/d2-i18n": "^1",
|
|
32
|
-
"react": "^16.
|
|
33
|
-
"react-dom": "^16.
|
|
32
|
+
"react": "^16.13",
|
|
33
|
+
"react-dom": "^16.13",
|
|
34
34
|
"styled-jsx": "^4"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@dhis2-ui/box": "9.11.
|
|
38
|
-
"@dhis2-ui/button": "9.11.
|
|
39
|
-
"@dhis2-ui/card": "9.11.
|
|
40
|
-
"@dhis2-ui/center": "9.11.
|
|
41
|
-
"@dhis2-ui/divider": "9.11.
|
|
42
|
-
"@dhis2-ui/input": "9.11.
|
|
43
|
-
"@dhis2-ui/layer": "9.11.
|
|
44
|
-
"@dhis2-ui/loader": "9.11.
|
|
45
|
-
"@dhis2-ui/logo": "9.11.
|
|
46
|
-
"@dhis2-ui/menu": "9.11.
|
|
47
|
-
"@dhis2-ui/modal": "9.11.
|
|
48
|
-
"@dhis2-ui/user-avatar": "9.11.
|
|
37
|
+
"@dhis2-ui/box": "9.11.1-beta.2",
|
|
38
|
+
"@dhis2-ui/button": "9.11.1-beta.2",
|
|
39
|
+
"@dhis2-ui/card": "9.11.1-beta.2",
|
|
40
|
+
"@dhis2-ui/center": "9.11.1-beta.2",
|
|
41
|
+
"@dhis2-ui/divider": "9.11.1-beta.2",
|
|
42
|
+
"@dhis2-ui/input": "9.11.1-beta.2",
|
|
43
|
+
"@dhis2-ui/layer": "9.11.1-beta.2",
|
|
44
|
+
"@dhis2-ui/loader": "9.11.1-beta.2",
|
|
45
|
+
"@dhis2-ui/logo": "9.11.1-beta.2",
|
|
46
|
+
"@dhis2-ui/menu": "9.11.1-beta.2",
|
|
47
|
+
"@dhis2-ui/modal": "9.11.1-beta.2",
|
|
48
|
+
"@dhis2-ui/user-avatar": "9.11.1-beta.2",
|
|
49
49
|
"@dhis2/prop-types": "^3.1.2",
|
|
50
|
-
"@dhis2/ui-constants": "9.11.
|
|
51
|
-
"@dhis2/ui-icons": "9.11.
|
|
50
|
+
"@dhis2/ui-constants": "9.11.1-beta.2",
|
|
51
|
+
"@dhis2/ui-icons": "9.11.1-beta.2",
|
|
52
52
|
"classnames": "^2.3.1",
|
|
53
53
|
"moment": "^2.29.1",
|
|
54
54
|
"prop-types": "^15.7.2"
|
|
File without changes
|