@dhis2-ui/header-bar 8.2.0 → 8.2.1
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 +22 -22
- package/build/cjs/__e2e__/stories/common.js +3 -2
- package/build/cjs/apps.js +65 -51
- package/build/cjs/features/common/index.js +1 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/common.js +1 -4
- 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 -2
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_menu_opens.js +1 -4
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_can_log_out.js +1 -1
- package/build/cjs/features/the_headerbar_contains_a_profile_menu/the_user_name_and_email_are_displayed.js +4 -2
- package/build/cjs/features/the_search_should_escape_regexp_character/the_modules_do_not_contain_items_with_special_chars.js +2 -1
- package/build/cjs/header-bar.js +6 -5
- package/build/cjs/header-bar.stories.js +4 -16
- package/build/cjs/join-path.js +5 -1
- package/build/cjs/notification-icon.js +19 -16
- package/build/cjs/notifications.js +6 -5
- package/build/cjs/online-status.js +14 -12
- package/build/cjs/online-status.styles.js +1 -1
- package/build/cjs/profile/profile-header.js +57 -44
- package/build/cjs/profile/profile-menu.js +26 -22
- package/build/cjs/profile.js +2 -2
- package/build/cjs/title.js +12 -9
- package/build/es/__e2e__/stories/common.js +2 -1
- package/build/es/apps.js +65 -51
- package/build/es/features/common/index.js +1 -1
- package/build/es/features/the_headerbar_contains_a_profile_menu/common.js +1 -4
- 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 +1 -4
- package/build/es/features/the_headerbar_contains_a_profile_menu/the_user_can_log_out.js +1 -1
- package/build/es/features/the_headerbar_contains_a_profile_menu/the_user_name_and_email_are_displayed.js +4 -2
- package/build/es/features/the_search_should_escape_regexp_character/the_modules_do_not_contain_items_with_special_chars.js +2 -1
- package/build/es/header-bar.js +6 -5
- package/build/es/header-bar.stories.js +3 -15
- package/build/es/join-path.js +5 -1
- package/build/es/notification-icon.js +19 -16
- package/build/es/notifications.js +6 -5
- package/build/es/online-status.js +14 -12
- package/build/es/online-status.styles.js +1 -1
- package/build/es/profile/profile-header.js +57 -44
- package/build/es/profile/profile-menu.js +26 -22
- package/build/es/profile.js +2 -2
- package/build/es/title.js +12 -9
- package/package.json +13 -13
|
@@ -21,35 +21,42 @@ var _index = _interopRequireDefault(require("../locales/index.js"));
|
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
24
|
-
const ProfileName =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
24
|
+
const ProfileName = _ref => {
|
|
25
|
+
let {
|
|
26
|
+
children
|
|
27
|
+
} = _ref;
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
29
|
+
"data-test": "headerbar-profile-username",
|
|
30
|
+
className: "jsx-2223023701"
|
|
31
|
+
}, children, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
32
|
+
id: "2223023701"
|
|
33
|
+
}, ["div.jsx-2223023701{margin-bottom:3px;font-size:16px;line-height:19px;}"]));
|
|
34
|
+
};
|
|
32
35
|
|
|
33
36
|
ProfileName.propTypes = {
|
|
34
37
|
children: _propTypes.default.string
|
|
35
38
|
};
|
|
36
39
|
|
|
37
|
-
const ProfileEmail =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
40
|
+
const ProfileEmail = _ref2 => {
|
|
41
|
+
let {
|
|
42
|
+
children
|
|
43
|
+
} = _ref2;
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
+
"data-test": "headerbar-profile-user-email",
|
|
46
|
+
className: "jsx-1072768994"
|
|
47
|
+
}, children, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
48
|
+
id: "1072768994"
|
|
49
|
+
}, ["div.jsx-1072768994{margin-bottom:6px;font-size:14px;line-height:16px;}"]));
|
|
50
|
+
};
|
|
45
51
|
|
|
46
52
|
ProfileEmail.propTypes = {
|
|
47
53
|
children: _propTypes.default.string
|
|
48
54
|
};
|
|
49
55
|
|
|
50
|
-
const ProfileEdit =
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
const ProfileEdit = _ref3 => {
|
|
57
|
+
let {
|
|
58
|
+
children
|
|
59
|
+
} = _ref3;
|
|
53
60
|
const {
|
|
54
61
|
baseUrl
|
|
55
62
|
} = (0, _appRuntime.useConfig)();
|
|
@@ -66,37 +73,43 @@ ProfileEdit.propTypes = {
|
|
|
66
73
|
children: _propTypes.default.string
|
|
67
74
|
};
|
|
68
75
|
|
|
69
|
-
const ProfileDetails =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
},
|
|
76
|
+
const ProfileDetails = _ref4 => {
|
|
77
|
+
let {
|
|
78
|
+
name,
|
|
79
|
+
email
|
|
80
|
+
} = _ref4;
|
|
81
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
82
|
+
className: "jsx-3814112749"
|
|
83
|
+
}, /*#__PURE__*/_react.default.createElement(ProfileName, null, name), /*#__PURE__*/_react.default.createElement(ProfileEmail, null, email), /*#__PURE__*/_react.default.createElement(ProfileEdit, null, _index.default.t('Edit profile')), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
84
|
+
id: "3814112749"
|
|
85
|
+
}, ["div.jsx-3814112749{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;margin-left:20px;color:#000;font-size:14px;font-weight:400;}"]));
|
|
86
|
+
};
|
|
77
87
|
|
|
78
88
|
ProfileDetails.propTypes = {
|
|
79
89
|
email: _propTypes.default.string,
|
|
80
90
|
name: _propTypes.default.string
|
|
81
91
|
};
|
|
82
92
|
|
|
83
|
-
const ProfileHeader =
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
},
|
|
93
|
+
const ProfileHeader = _ref5 => {
|
|
94
|
+
let {
|
|
95
|
+
name,
|
|
96
|
+
email,
|
|
97
|
+
avatarId
|
|
98
|
+
} = _ref5;
|
|
99
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
100
|
+
className: "jsx-3625287538"
|
|
101
|
+
}, /*#__PURE__*/_react.default.createElement(_userAvatar.UserAvatar, {
|
|
102
|
+
avatarId: avatarId,
|
|
103
|
+
name: name,
|
|
104
|
+
dataTest: "headerbar-profile-menu-icon",
|
|
105
|
+
large: true
|
|
106
|
+
}), /*#__PURE__*/_react.default.createElement(ProfileDetails, {
|
|
107
|
+
name: name,
|
|
108
|
+
email: email
|
|
109
|
+
}), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
110
|
+
id: "3625287538"
|
|
111
|
+
}, ["div.jsx-3625287538{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;margin-left:24px;padding-top:20px;}"]));
|
|
112
|
+
};
|
|
100
113
|
|
|
101
114
|
exports.ProfileHeader = ProfileHeader;
|
|
102
115
|
ProfileHeader.propTypes = {
|
|
@@ -47,12 +47,13 @@ const LoadingMask = () => /*#__PURE__*/_react.default.createElement(_layer.Layer
|
|
|
47
47
|
dataTest: "headerbar-profile-menu-loading-mask"
|
|
48
48
|
}, /*#__PURE__*/_react.default.createElement(_center.Center, null, /*#__PURE__*/_react.default.createElement(_loader.CircularLoader, null)));
|
|
49
49
|
|
|
50
|
-
const ProfileContents =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
const ProfileContents = _ref => {
|
|
51
|
+
let {
|
|
52
|
+
name,
|
|
53
|
+
email,
|
|
54
|
+
avatarId,
|
|
55
|
+
helpUrl
|
|
56
|
+
} = _ref;
|
|
56
57
|
const {
|
|
57
58
|
baseUrl
|
|
58
59
|
} = (0, _appRuntime.useConfig)();
|
|
@@ -124,22 +125,25 @@ ProfileContents.propTypes = {
|
|
|
124
125
|
name: _propTypes.default.string
|
|
125
126
|
};
|
|
126
127
|
|
|
127
|
-
const ProfileMenu =
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
},
|
|
128
|
+
const ProfileMenu = _ref2 => {
|
|
129
|
+
let {
|
|
130
|
+
avatarId,
|
|
131
|
+
name,
|
|
132
|
+
email,
|
|
133
|
+
helpUrl
|
|
134
|
+
} = _ref2;
|
|
135
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
136
|
+
"data-test": "headerbar-profile-menu",
|
|
137
|
+
className: "jsx-3620236321"
|
|
138
|
+
}, /*#__PURE__*/_react.default.createElement(ProfileContents, {
|
|
139
|
+
name: name,
|
|
140
|
+
email: email,
|
|
141
|
+
avatarId: avatarId,
|
|
142
|
+
helpUrl: helpUrl
|
|
143
|
+
}), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
144
|
+
id: "3620236321"
|
|
145
|
+
}, ["div.jsx-3620236321{z-index:10000;position:absolute;top:34px;right:-6px;width:310px;border-top:4px solid transparent;}"]));
|
|
146
|
+
};
|
|
143
147
|
|
|
144
148
|
exports.ProfileMenu = ProfileMenu;
|
|
145
149
|
ProfileMenu.propTypes = {
|
package/build/cjs/profile.js
CHANGED
|
@@ -20,8 +20,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
20
20
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
21
|
|
|
22
22
|
class Profile extends _react.default.Component {
|
|
23
|
-
constructor(
|
|
24
|
-
super(...
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
25
|
|
|
26
26
|
_defineProperty(this, "state", {
|
|
27
27
|
show: false
|
package/build/cjs/title.js
CHANGED
|
@@ -13,15 +13,18 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
-
const Title =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
16
|
+
const Title = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
app,
|
|
19
|
+
instance
|
|
20
|
+
} = _ref;
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
22
|
+
"data-test": "headerbar-title",
|
|
23
|
+
className: "jsx-2721515324"
|
|
24
|
+
}, app ? "".concat(instance, " - ").concat(app) : "".concat(instance), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
25
|
+
id: "2721515324"
|
|
26
|
+
}, ["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;}"]));
|
|
27
|
+
};
|
|
25
28
|
|
|
26
29
|
exports.Title = Title;
|
|
27
30
|
Title.propTypes = {
|
|
@@ -318,7 +318,8 @@ export const dataProviderData = {
|
|
|
318
318
|
}; // Trailing "HeaderBar" because storybook is confusing this with the
|
|
319
319
|
// helper from the org unit tree's common.js helper with the same name
|
|
320
320
|
|
|
321
|
-
export const createDecoratorCustomDataProviderHeaderBar = (
|
|
321
|
+
export const createDecoratorCustomDataProviderHeaderBar = function () {
|
|
322
|
+
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dataProviderData;
|
|
322
323
|
return fn => {
|
|
323
324
|
window.dataProviderData = data;
|
|
324
325
|
return /*#__PURE__*/React.createElement(CustomDataProvider, {
|
package/build/es/apps.js
CHANGED
|
@@ -17,10 +17,11 @@ function escapeRegExpCharacters(text) {
|
|
|
17
17
|
return text.replace(/[/.*+?^${}()|[\]\\]/g, '\\$&');
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
function Search({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
function Search(_ref) {
|
|
21
|
+
let {
|
|
22
|
+
value,
|
|
23
|
+
onChange
|
|
24
|
+
} = _ref;
|
|
24
25
|
const {
|
|
25
26
|
baseUrl
|
|
26
27
|
} = useConfig();
|
|
@@ -51,11 +52,12 @@ Search.propTypes = {
|
|
|
51
52
|
onChange: PropTypes.func.isRequired
|
|
52
53
|
};
|
|
53
54
|
|
|
54
|
-
function Item({
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
function Item(_ref2) {
|
|
56
|
+
let {
|
|
57
|
+
name,
|
|
58
|
+
path,
|
|
59
|
+
img
|
|
60
|
+
} = _ref2;
|
|
59
61
|
return /*#__PURE__*/React.createElement("a", {
|
|
60
62
|
href: path,
|
|
61
63
|
className: _JSXStyle.dynamic([["3670725638", [theme.primary050]]])
|
|
@@ -68,7 +70,7 @@ function Item({
|
|
|
68
70
|
}, name), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
69
71
|
id: "3670725638",
|
|
70
72
|
dynamic: [theme.primary050]
|
|
71
|
-
}, ["a.__jsx-style-dynamic-selector{display:inline-block;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-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;width:96px;margin:8px;padding:8px;border-radius:12px;-webkit-text-decoration:none;text-decoration:none;cursor:pointer;}",
|
|
73
|
+
}, ["a.__jsx-style-dynamic-selector{display:inline-block;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-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;width:96px;margin:8px;padding:8px;border-radius:12px;-webkit-text-decoration:none;text-decoration:none;cursor:pointer;}", "a.__jsx-style-dynamic-selector:hover,a.__jsx-style-dynamic-selector:focus{background-color:".concat(theme.primary050, ";cursor:pointer;}"), "a.__jsx-style-dynamic-selector:hover>div.__jsx-style-dynamic-selector{font-weight:500;cursor:pointer;}", "img.__jsx-style-dynamic-selector{width:48px;height:48px;cursor:pointer;}", "div.__jsx-style-dynamic-selector{margin-top:14px;color:rgba(0,0,0,0.87);font-size:12px;-webkit-letter-spacing:0.01em;-moz-letter-spacing:0.01em;-ms-letter-spacing:0.01em;letter-spacing:0.01em;line-height:14px;text-align:center;cursor:pointer;}"]));
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
Item.propTypes = {
|
|
@@ -77,32 +79,37 @@ Item.propTypes = {
|
|
|
77
79
|
path: PropTypes.string
|
|
78
80
|
};
|
|
79
81
|
|
|
80
|
-
function List({
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
function List(_ref3) {
|
|
83
|
+
let {
|
|
84
|
+
apps,
|
|
85
|
+
filter
|
|
86
|
+
} = _ref3;
|
|
84
87
|
return /*#__PURE__*/React.createElement("div", {
|
|
85
88
|
"data-test": "headerbar-apps-menu-list",
|
|
86
89
|
className: "jsx-2076871745"
|
|
87
|
-
}, apps.filter(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
}, apps.filter(_ref4 => {
|
|
91
|
+
let {
|
|
92
|
+
displayName,
|
|
93
|
+
name
|
|
94
|
+
} = _ref4;
|
|
91
95
|
const appName = displayName || name;
|
|
92
96
|
const formattedAppName = appName.toLowerCase();
|
|
93
97
|
const formattedFilter = escapeRegExpCharacters(filter).toLowerCase();
|
|
94
98
|
return filter.length > 0 ? formattedAppName.match(formattedFilter) : true;
|
|
95
|
-
}).map(({
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
}).map((_ref5, idx) => {
|
|
100
|
+
let {
|
|
101
|
+
displayName,
|
|
102
|
+
name,
|
|
103
|
+
defaultAction,
|
|
104
|
+
icon
|
|
105
|
+
} = _ref5;
|
|
106
|
+
return /*#__PURE__*/React.createElement(Item, {
|
|
107
|
+
key: "app-".concat(name, "-").concat(idx),
|
|
108
|
+
name: displayName || name,
|
|
109
|
+
path: defaultAction,
|
|
110
|
+
img: icon
|
|
111
|
+
});
|
|
112
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
106
113
|
id: "2076871745"
|
|
107
114
|
}, ["div.jsx-2076871745{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-align-content:flex-start;-ms-flex-line-pack:start;align-content:flex-start;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;width:30vw;min-width:300px;max-width:560px;min-height:200px;max-height:465px;margin:0 8px 8px 8px;overflow:auto;overflow-x:hidden;}"]));
|
|
108
115
|
}
|
|
@@ -112,22 +119,25 @@ List.propTypes = {
|
|
|
112
119
|
filter: PropTypes.string
|
|
113
120
|
};
|
|
114
121
|
|
|
115
|
-
const AppMenu =
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
},
|
|
122
|
+
const AppMenu = _ref6 => {
|
|
123
|
+
let {
|
|
124
|
+
apps,
|
|
125
|
+
filter,
|
|
126
|
+
onFilterChange
|
|
127
|
+
} = _ref6;
|
|
128
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
"data-test": "headerbar-apps-menu",
|
|
130
|
+
className: "jsx-3879001227"
|
|
131
|
+
}, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(Search, {
|
|
132
|
+
value: filter,
|
|
133
|
+
onChange: onFilterChange
|
|
134
|
+
}), /*#__PURE__*/React.createElement(List, {
|
|
135
|
+
apps: apps,
|
|
136
|
+
filter: filter
|
|
137
|
+
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
138
|
+
id: "3879001227"
|
|
139
|
+
}, ["div.jsx-3879001227{z-index:10000;position:absolute;top:28px;right:-6px;border-top:4px solid transparent;}"]));
|
|
140
|
+
};
|
|
131
141
|
|
|
132
142
|
AppMenu.propTypes = {
|
|
133
143
|
apps: PropTypes.array.isRequired,
|
|
@@ -135,15 +145,19 @@ AppMenu.propTypes = {
|
|
|
135
145
|
filter: PropTypes.string
|
|
136
146
|
};
|
|
137
147
|
|
|
138
|
-
const Apps =
|
|
139
|
-
|
|
140
|
-
|
|
148
|
+
const Apps = _ref7 => {
|
|
149
|
+
let {
|
|
150
|
+
apps
|
|
151
|
+
} = _ref7;
|
|
141
152
|
const [show, setShow] = useState(false);
|
|
142
153
|
const [filter, setFilter] = useState('');
|
|
143
154
|
const handleVisibilityToggle = useCallback(() => setShow(!show), [show]);
|
|
144
|
-
const handleFilterChange = useCallback(
|
|
145
|
-
|
|
146
|
-
|
|
155
|
+
const handleFilterChange = useCallback(_ref8 => {
|
|
156
|
+
let {
|
|
157
|
+
value
|
|
158
|
+
} = _ref8;
|
|
159
|
+
return setFilter(value);
|
|
160
|
+
}, []);
|
|
147
161
|
const containerEl = useRef(null);
|
|
148
162
|
const onDocClick = useCallback(evt => {
|
|
149
163
|
if (containerEl.current && !containerEl.current.contains(evt.target)) {
|
|
@@ -2,7 +2,7 @@ import { Before, Given } from 'cypress-cucumber-preprocessor/steps';
|
|
|
2
2
|
export const baseUrl = 'https://domain.tld/';
|
|
3
3
|
export const webCommons = 'https://domain.tld/dhis-web-commons/';
|
|
4
4
|
Before(() => {
|
|
5
|
-
cy.intercept('GET',
|
|
5
|
+
cy.intercept('GET', "".concat(baseUrl, "api/fileResources/avatarId/data"), {
|
|
6
6
|
fixture: 'HeaderBar/avatar.png'
|
|
7
7
|
}).as('avatar');
|
|
8
8
|
});
|
|
@@ -3,8 +3,5 @@ Then('the HeaderBar does not display the profile menu', () => {
|
|
|
3
3
|
cy.get('[data-test="headerbar-profile-menu"]').should('not.exist');
|
|
4
4
|
});
|
|
5
5
|
When('the user opens the menu', () => {
|
|
6
|
-
cy.get(
|
|
7
|
-
[data-test="headerbar-profile-icon-text"],
|
|
8
|
-
[data-test="headerbar-profile-icon-image"]
|
|
9
|
-
`).click();
|
|
6
|
+
cy.get("\n [data-test=\"headerbar-profile-icon-text\"],\n [data-test=\"headerbar-profile-icon-image\"]\n ").click();
|
|
10
7
|
});
|
|
@@ -3,7 +3,7 @@ import { Given, Then, When } from 'cypress-cucumber-preprocessor/steps';
|
|
|
3
3
|
Given('the HeaderBar loads without an error and the user does not have an avatar', () => {
|
|
4
4
|
cy.visitStory('HeaderBarTesting', 'Default');
|
|
5
5
|
});
|
|
6
|
-
Then(
|
|
6
|
+
Then("the headerbar contains a text icon of size 36px", () => {
|
|
7
7
|
cy.fixture('HeaderBar/me').then(() => {
|
|
8
8
|
cy.get('[data-test="headerbar-profile-icon-text"]').should('be.visible').and('have.css', 'height', '36px').and('have.css', 'width', '36px');
|
|
9
9
|
});
|
|
@@ -11,7 +11,7 @@ Then(`the headerbar contains a text icon of size 36px`, () => {
|
|
|
11
11
|
When('the user clicks on the text icon', () => {
|
|
12
12
|
cy.get('[data-test="headerbar-profile-icon-text"]').click();
|
|
13
13
|
});
|
|
14
|
-
Then(
|
|
14
|
+
Then("the profile menu contains a text icon of size 48px", () => {
|
|
15
15
|
cy.fixture('HeaderBar/me').then(() => {
|
|
16
16
|
cy.get('[data-test="headerbar-profile-menu-icon-text"]').should('be.visible').and('have.css', 'height', '48px').and('have.css', 'width', '48px');
|
|
17
17
|
});
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import '../common/index.js';
|
|
2
2
|
import { When, Then } from 'cypress-cucumber-preprocessor/steps';
|
|
3
3
|
When('the user clicks on the profile icons', () => {
|
|
4
|
-
cy.get(
|
|
5
|
-
[data-test="headerbar-profile-icon-text"],
|
|
6
|
-
[data-test="headerbar-profile-icon-image"]
|
|
7
|
-
`).click();
|
|
4
|
+
cy.get("\n [data-test=\"headerbar-profile-icon-text\"],\n [data-test=\"headerbar-profile-icon-image\"]\n ").click();
|
|
8
5
|
});
|
|
9
6
|
Then('the menu opens', () => {
|
|
10
7
|
cy.get('[data-test="headerbar-profile-menu"]').should('be.visible');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { And, Then } from 'cypress-cucumber-preprocessor/steps';
|
|
2
2
|
import { baseUrl } from '../common/index.js';
|
|
3
|
-
const logoutUrl =
|
|
3
|
+
const logoutUrl = "".concat(baseUrl, "dhis-web-commons-security/logout.action");
|
|
4
4
|
Then('contains a link to log out the user', () => {
|
|
5
5
|
cy.get('[data-test="headerbar-profile-menu"] > li').should(lis => {
|
|
6
6
|
const menuItem = lis.eq(4);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import '../common/index.js';
|
|
2
2
|
import { Then } from 'cypress-cucumber-preprocessor/steps';
|
|
3
3
|
Then('contains the user name', () => {
|
|
4
|
-
cy.all(() => cy.window(), () => cy.get('[data-test="headerbar-profile-username"]')).then(
|
|
4
|
+
cy.all(() => cy.window(), () => cy.get('[data-test="headerbar-profile-username"]')).then(_ref => {
|
|
5
|
+
let [win, $name] = _ref;
|
|
5
6
|
console.log('win.dataProviderData', win.dataProviderData);
|
|
6
7
|
const {
|
|
7
8
|
name
|
|
@@ -10,7 +11,8 @@ Then('contains the user name', () => {
|
|
|
10
11
|
});
|
|
11
12
|
});
|
|
12
13
|
Then('contains the user email', () => {
|
|
13
|
-
cy.all(() => cy.window(), () => cy.get('[data-test="headerbar-profile-user-email"]')).then(
|
|
14
|
+
cy.all(() => cy.window(), () => cy.get('[data-test="headerbar-profile-user-email"]')).then(_ref2 => {
|
|
15
|
+
let [win, $email] = _ref2;
|
|
14
16
|
const {
|
|
15
17
|
email
|
|
16
18
|
} = win.dataProviderData.me;
|
|
@@ -2,7 +2,8 @@ import { Given, Then } from 'cypress-cucumber-preprocessor/steps';
|
|
|
2
2
|
import '../common/index.js';
|
|
3
3
|
Given(/no app name contains a (.*)/, character => {
|
|
4
4
|
// Needs to be wrapped, otherwise for some reason the wrong char is in the scope
|
|
5
|
-
cy.all(() => cy.window(), () => cy.wrap(character)).then(
|
|
5
|
+
cy.all(() => cy.window(), () => cy.wrap(character)).then(_ref => {
|
|
6
|
+
let [win, char] = _ref;
|
|
6
7
|
const {
|
|
7
8
|
dataProviderData
|
|
8
9
|
} = win;
|
package/build/es/header-bar.js
CHANGED
|
@@ -31,12 +31,13 @@ const query = {
|
|
|
31
31
|
resource: 'me/dashboard'
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
export const HeaderBar =
|
|
35
|
-
appName,
|
|
36
|
-
className
|
|
37
|
-
}) => {
|
|
34
|
+
export const HeaderBar = _ref => {
|
|
38
35
|
var _data$user$avatar;
|
|
39
36
|
|
|
37
|
+
let {
|
|
38
|
+
appName,
|
|
39
|
+
className
|
|
40
|
+
} = _ref;
|
|
40
41
|
const {
|
|
41
42
|
baseUrl,
|
|
42
43
|
pwaEnabled,
|
|
@@ -90,7 +91,7 @@ export const HeaderBar = ({
|
|
|
90
91
|
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
91
92
|
id: "3517276904",
|
|
92
93
|
dynamic: [colors.white]
|
|
93
|
-
}, [
|
|
94
|
+
}, [".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;border-bottom:1px solid rgba(32,32,32,0.15);color:".concat(colors.white, ";height:48px;}"), ".right-control-spacer.__jsx-style-dynamic-selector{margin-left:auto;}"]));
|
|
94
95
|
};
|
|
95
96
|
HeaderBar.propTypes = {
|
|
96
97
|
appName: PropTypes.string,
|
|
@@ -2,21 +2,9 @@ import { CustomDataProvider, Provider } from '@dhis2/app-runtime';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { HeaderBar } from './header-bar.js';
|
|
4
4
|
const subtitle = 'The common navigation bar used in all DHIS2 apps';
|
|
5
|
-
const description =
|
|
6
|
-
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.
|
|
7
|
-
|
|
8
|
-
The header bar is included automatically with the App Shell and should not need any configuration.
|
|
9
|
-
|
|
10
|
-
#### Theme
|
|
11
|
-
|
|
12
|
-
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.
|
|
13
|
-
|
|
14
|
-
\`\`\`js
|
|
15
|
-
import { HeaderBar } from '@dhis2/ui'
|
|
16
|
-
\`\`\`
|
|
17
|
-
`;
|
|
5
|
+
const description = "\nThe 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.\n\nThe header bar is included automatically with the App Shell and should not need any configuration.\n\n#### Theme\n\nThe 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.\n\n```js\nimport { HeaderBar } from '@dhis2/ui'\n```\n";
|
|
18
6
|
export default {
|
|
19
|
-
title: '
|
|
7
|
+
title: 'Header Bar',
|
|
20
8
|
component: HeaderBar,
|
|
21
9
|
parameters: {
|
|
22
10
|
componentSubtitle: subtitle,
|
|
@@ -145,7 +133,7 @@ const customLocaleData = { ...customData,
|
|
|
145
133
|
},
|
|
146
134
|
'action::menu/getModules': {
|
|
147
135
|
modules: customData['action::menu/getModules'].modules.map(mod => ({ ...mod,
|
|
148
|
-
displayName:
|
|
136
|
+
displayName: "Le ".concat(mod.displayName)
|
|
149
137
|
}))
|
|
150
138
|
}
|
|
151
139
|
};
|
package/build/es/join-path.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
export const joinPath = (
|
|
1
|
+
export const joinPath = function () {
|
|
2
|
+
for (var _len = arguments.length, parts = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3
|
+
parts[_key] = arguments[_key];
|
|
4
|
+
}
|
|
5
|
+
|
|
2
6
|
const realParts = parts.filter(part => !!part);
|
|
3
7
|
return realParts.map(part => part.replace(/^\/+|\/+$/g, '')).join('/');
|
|
4
8
|
};
|
|
@@ -16,22 +16,25 @@ function icon(kind) {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export const NotificationIcon =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
export const NotificationIcon = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
count,
|
|
22
|
+
href,
|
|
23
|
+
kind,
|
|
24
|
+
dataTestId
|
|
25
|
+
} = _ref;
|
|
26
|
+
return /*#__PURE__*/React.createElement("a", {
|
|
27
|
+
href: href,
|
|
28
|
+
"data-test": dataTestId,
|
|
29
|
+
className: _JSXStyle.dynamic([["2450998793", [spacers.dp12, theme.secondary500, colors.white, spacers.dp4]]]) + " " + (kind || "")
|
|
30
|
+
}, icon(kind), count > 0 && /*#__PURE__*/React.createElement("span", {
|
|
31
|
+
"data-test": "".concat(dataTestId, "-count"),
|
|
32
|
+
className: _JSXStyle.dynamic([["2450998793", [spacers.dp12, theme.secondary500, colors.white, spacers.dp4]]])
|
|
33
|
+
}, count), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
34
|
+
id: "2450998793",
|
|
35
|
+
dynamic: [spacers.dp12, theme.secondary500, colors.white, spacers.dp4]
|
|
36
|
+
}, ["a.__jsx-style-dynamic-selector{position:relative;margin:4px 24px 0 0;cursor:pointer;}", "a.__jsx-style-dynamic-selector:focus{outline:1px dotted white;}", "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:-9px;right:-6px;min-width:18px;min-height:18px;border-radius:".concat(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:").concat(theme.secondary500, ";color:").concat(colors.white, ";font-size:13px;font-weight:600;line-height:15px;text-align:center;cursor:inherit;padding:0 ").concat(spacers.dp4, ";}")]));
|
|
37
|
+
};
|
|
35
38
|
NotificationIcon.defaultProps = {
|
|
36
39
|
count: 0
|
|
37
40
|
};
|