@gridsuite/commons-ui 0.45.0 → 0.47.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.
Files changed (183) hide show
  1. package/README.md +0 -17
  2. package/dist/components/AuthenticationRouter/AuthenticationRouter.js +147 -0
  3. package/dist/components/CardErrorBoundary/card-error-boundary.js +110 -0
  4. package/dist/components/ElementSearchDialog/element-search-dialog.js +139 -0
  5. package/dist/components/ElementSearchDialog/equipment-item.js +77 -0
  6. package/dist/components/ElementSearchDialog/tag-renderer.js +34 -0
  7. package/dist/components/FlatParameters/FlatParameters.js +411 -0
  8. package/dist/components/Login/Login.js +78 -0
  9. package/dist/components/Login/Logout.js +69 -0
  10. package/dist/components/MuiVirtualizedTable/ColumnHeader.js +127 -0
  11. package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +548 -0
  12. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.js +790 -0
  13. package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.js +87 -0
  14. package/dist/components/OverflowableText/overflowable-text.js +87 -0
  15. package/dist/components/ReportViewer/filter-button.js +64 -0
  16. package/dist/components/ReportViewer/log-report-item.js +95 -0
  17. package/dist/components/ReportViewer/log-report.js +49 -0
  18. package/dist/components/ReportViewer/log-table.js +131 -0
  19. package/dist/components/ReportViewer/multi-select-list.js +40 -0
  20. package/dist/components/ReportViewer/report-item.js +112 -0
  21. package/dist/components/ReportViewer/report-tree-view-context.js +8 -0
  22. package/dist/components/ReportViewer/report-viewer.js +158 -0
  23. package/dist/components/ReportViewerDialog/report-viewer-dialog.js +61 -0
  24. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.js +13 -0
  25. package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +16 -0
  26. package/dist/components/SnackbarProvider/SnackbarProvider.js +28 -0
  27. package/dist/components/TopBar/AboutDialog.js +467 -0
  28. package/dist/components/TopBar/GridLogo.js +71 -0
  29. package/dist/components/TopBar/TopBar.js +679 -0
  30. package/dist/components/TreeViewFinder/TreeViewFinder.js +288 -0
  31. package/dist/components/react-hook-form/autocomplete-input.js +96 -0
  32. package/dist/components/react-hook-form/booleans/boolean-input.js +49 -0
  33. package/dist/components/react-hook-form/booleans/checkbox-input.js +24 -0
  34. package/dist/components/react-hook-form/booleans/switch-input.js +24 -0
  35. package/dist/components/react-hook-form/error-management/error-input.js +42 -0
  36. package/dist/components/react-hook-form/error-management/field-error-alert.js +9 -0
  37. package/dist/components/react-hook-form/error-management/mid-form-error.js +20 -0
  38. package/dist/components/react-hook-form/numbers/float-input.js +51 -0
  39. package/dist/components/react-hook-form/numbers/integer-input.js +36 -0
  40. package/dist/components/react-hook-form/numbers/utils.js +10 -0
  41. package/dist/components/react-hook-form/radio-input.js +44 -0
  42. package/dist/components/react-hook-form/select-input.js +31 -0
  43. package/dist/components/react-hook-form/slider-input.js +43 -0
  44. package/dist/components/react-hook-form/text-input.js +94 -0
  45. package/dist/components/react-hook-form/utils/cancel-button.js +16 -0
  46. package/dist/components/react-hook-form/utils/field-label.js +12 -0
  47. package/dist/components/react-hook-form/utils/functions.js +36 -0
  48. package/dist/components/react-hook-form/utils/submit-button.js +23 -0
  49. package/dist/components/react-hook-form/utils/text-field-with-adornment.js +96 -0
  50. package/dist/components/translations/card-error-boundary-en.js +8 -0
  51. package/dist/components/translations/card-error-boundary-fr.js +8 -0
  52. package/dist/components/translations/common-button-en.js +7 -0
  53. package/dist/components/translations/common-button-fr.js +7 -0
  54. package/dist/components/translations/element-search-en.js +7 -0
  55. package/dist/components/translations/element-search-fr.js +7 -0
  56. package/dist/components/translations/equipment-search-en.js +21 -0
  57. package/dist/components/translations/equipment-search-fr.js +21 -0
  58. package/dist/components/translations/flat-parameters-en.js +8 -0
  59. package/dist/components/translations/flat-parameters-fr.js +8 -0
  60. package/dist/components/translations/login-en.js +14 -0
  61. package/dist/components/translations/login-fr.js +14 -0
  62. package/dist/components/translations/multiple-selection-dialog-en.js +8 -0
  63. package/dist/components/translations/multiple-selection-dialog-fr.js +8 -0
  64. package/dist/components/translations/report-viewer-en.js +8 -0
  65. package/dist/components/translations/report-viewer-fr.js +8 -0
  66. package/dist/components/translations/table-en.js +6 -0
  67. package/dist/components/translations/table-fr.js +6 -0
  68. package/dist/components/translations/top-bar-en.js +27 -0
  69. package/dist/components/translations/top-bar-fr.js +27 -0
  70. package/dist/components/translations/treeview-finder-en.js +12 -0
  71. package/dist/components/translations/treeview-finder-fr.js +12 -0
  72. package/dist/hooks/useDebounce.js +17 -0
  73. package/{es/components/ElementSearchDialog/index.js → dist/hooks/useIntlRef.d.ts} +2 -2
  74. package/dist/hooks/useIntlRef.js +13 -0
  75. package/dist/hooks/useSnackMessage.js +81 -0
  76. package/dist/index.d.ts +225 -0
  77. package/dist/index.js +154 -0
  78. package/dist/utils/AuthService.js +336 -0
  79. package/dist/utils/ElementType.js +38 -0
  80. package/dist/utils/EquipmentType.js +132 -0
  81. package/dist/utils/UserManagerMock.js +85 -0
  82. package/dist/utils/actions.js +71 -0
  83. package/dist/utils/algos.js +24 -0
  84. package/dist/utils/styles.js +13 -0
  85. package/package.json +36 -21
  86. package/es/components/AuthenticationRouter/AuthenticationRouter.js +0 -102
  87. package/es/components/AuthenticationRouter/index.js +0 -7
  88. package/es/components/CardErrorBoundary/card-error-boundary.js +0 -138
  89. package/es/components/CardErrorBoundary/index.js +0 -7
  90. package/es/components/ElementSearchDialog/element-search-dialog.js +0 -153
  91. package/es/components/ElementSearchDialog/equipment-item.js +0 -63
  92. package/es/components/ElementSearchDialog/tag-renderer.js +0 -29
  93. package/es/components/FlatParameters/FlatParameters.js +0 -448
  94. package/es/components/FlatParameters/index.js +0 -8
  95. package/es/components/Login/Login.js +0 -79
  96. package/es/components/Login/Logout.js +0 -78
  97. package/es/components/Login/index.js +0 -7
  98. package/es/components/MuiVirtualizedTable/ColumnHeader.js +0 -125
  99. package/es/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +0 -619
  100. package/es/components/MuiVirtualizedTable/MuiVirtualizedTable.js +0 -780
  101. package/es/components/MuiVirtualizedTable/index.js +0 -9
  102. package/es/components/MultipleSelectionDialog/MultipleSelectionDialog.js +0 -95
  103. package/es/components/MultipleSelectionDialog/index.js +0 -8
  104. package/es/components/OverflowableText/index.js +0 -7
  105. package/es/components/OverflowableText/overflowable-text.js +0 -81
  106. package/es/components/ReportViewer/filter-button.js +0 -77
  107. package/es/components/ReportViewer/index.js +0 -7
  108. package/es/components/ReportViewer/log-report-item.js +0 -97
  109. package/es/components/ReportViewer/log-report.js +0 -63
  110. package/es/components/ReportViewer/log-table.js +0 -130
  111. package/es/components/ReportViewer/multi-select-list.js +0 -56
  112. package/es/components/ReportViewer/report-item.js +0 -131
  113. package/es/components/ReportViewer/report-tree-view-context.js +0 -13
  114. package/es/components/ReportViewer/report-viewer.js +0 -167
  115. package/es/components/ReportViewerDialog/index.js +0 -7
  116. package/es/components/ReportViewerDialog/report-viewer-dialog.js +0 -67
  117. package/es/components/SignInCallbackHandler/SignInCallbackHandler.js +0 -19
  118. package/es/components/SignInCallbackHandler/index.js +0 -7
  119. package/es/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +0 -19
  120. package/es/components/SilentRenewCallbackHandler/index.js +0 -7
  121. package/es/components/SnackbarProvider/SnackbarProvider.js +0 -39
  122. package/es/components/SnackbarProvider/index.js +0 -7
  123. package/es/components/TopBar/AboutDialog.js +0 -456
  124. package/es/components/TopBar/GridLogo.js +0 -73
  125. package/es/components/TopBar/TopBar.js +0 -487
  126. package/es/components/TopBar/index.js +0 -9
  127. package/es/components/TreeViewFinder/TreeViewFinder.js +0 -341
  128. package/es/components/TreeViewFinder/index.js +0 -7
  129. package/es/components/images/powsybl_logo.svg +0 -35
  130. package/es/components/react-hook-form/autocomplete-input.js +0 -110
  131. package/es/components/react-hook-form/booleans/boolean-input.js +0 -56
  132. package/es/components/react-hook-form/booleans/checkbox-input.js +0 -28
  133. package/es/components/react-hook-form/booleans/switch-input.js +0 -28
  134. package/es/components/react-hook-form/error-management/error-input.js +0 -50
  135. package/es/components/react-hook-form/error-management/field-error-alert.js +0 -22
  136. package/es/components/react-hook-form/error-management/mid-form-error.js +0 -25
  137. package/es/components/react-hook-form/numbers/float-input.js +0 -105
  138. package/es/components/react-hook-form/numbers/integer-input.js +0 -35
  139. package/es/components/react-hook-form/numbers/utils.js +0 -6
  140. package/es/components/react-hook-form/radio-input.js +0 -55
  141. package/es/components/react-hook-form/select-input.js +0 -40
  142. package/es/components/react-hook-form/slider-input.js +0 -48
  143. package/es/components/react-hook-form/text-input.js +0 -100
  144. package/es/components/react-hook-form/utils/cancel-button.js +0 -28
  145. package/es/components/react-hook-form/utils/field-label.js +0 -15
  146. package/es/components/react-hook-form/utils/functions.js +0 -42
  147. package/es/components/react-hook-form/utils/submit-button.js +0 -29
  148. package/es/components/react-hook-form/utils/text-field-with-adornment.js +0 -92
  149. package/es/components/translations/card-error-boundary-en.js +0 -13
  150. package/es/components/translations/card-error-boundary-fr.js +0 -13
  151. package/es/components/translations/common-button-en.js +0 -12
  152. package/es/components/translations/common-button-fr.js +0 -12
  153. package/es/components/translations/element-search-en.js +0 -12
  154. package/es/components/translations/element-search-fr.js +0 -12
  155. package/es/components/translations/equipment-search-en.js +0 -26
  156. package/es/components/translations/equipment-search-fr.js +0 -26
  157. package/es/components/translations/flat-parameters-en.js +0 -13
  158. package/es/components/translations/flat-parameters-fr.js +0 -13
  159. package/es/components/translations/inputs-en.js +0 -25
  160. package/es/components/translations/inputs-fr.js +0 -25
  161. package/es/components/translations/login-en.js +0 -19
  162. package/es/components/translations/login-fr.js +0 -19
  163. package/es/components/translations/multiple-selection-dialog-en.js +0 -13
  164. package/es/components/translations/multiple-selection-dialog-fr.js +0 -13
  165. package/es/components/translations/report-viewer-en.js +0 -13
  166. package/es/components/translations/report-viewer-fr.js +0 -13
  167. package/es/components/translations/table-en.js +0 -11
  168. package/es/components/translations/table-fr.js +0 -11
  169. package/es/components/translations/top-bar-en.js +0 -32
  170. package/es/components/translations/top-bar-fr.js +0 -32
  171. package/es/components/translations/treeview-finder-en.js +0 -17
  172. package/es/components/translations/treeview-finder-fr.js +0 -17
  173. package/es/hooks/useDebounce.js +0 -26
  174. package/es/hooks/useIntlRef.js +0 -22
  175. package/es/hooks/useSnackMessage.js +0 -81
  176. package/es/index.js +0 -71
  177. package/es/utils/AuthService.js +0 -312
  178. package/es/utils/ElementType.js +0 -49
  179. package/es/utils/EquipmentType.js +0 -133
  180. package/es/utils/UserManagerMock.js +0 -81
  181. package/es/utils/actions.js +0 -65
  182. package/es/utils/algos.js +0 -29
  183. package/es/utils/styles.js +0 -35
@@ -0,0 +1,679 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import React, { useRef, useState, useMemo } from "react";
3
+ import { FormattedMessage } from "react-intl";
4
+ import { Menu, MenuItem, ListItemIcon, AppBar, Toolbar, Box, IconButton, ListItemText, Button, Popper, Paper, ClickAwayListener, MenuList, Typography, ToggleButtonGroup, ToggleButton, darken } from "@mui/material";
5
+ import { Apps, ArrowDropUp, ArrowDropDown, Person, WbSunny, Brightness3, Computer, Settings, HelpOutline, FullscreenExit, Fullscreen, ExitToApp } from "@mui/icons-material";
6
+ import { styled } from "@mui/system";
7
+ import PropTypes from "prop-types";
8
+ import FullScreen, { fullScreenSupported } from "react-request-fullscreen";
9
+ import GridLogo from "./GridLogo.js";
10
+ import AboutDialog from "./AboutDialog.js";
11
+ const styles = {
12
+ grow: {
13
+ flexGrow: 1,
14
+ display: "flex",
15
+ overflow: "hidden"
16
+ },
17
+ menuContainer: {
18
+ marginLeft: 1
19
+ },
20
+ link: {
21
+ textDecoration: "none",
22
+ color: "inherit"
23
+ },
24
+ name: (theme) => ({
25
+ backgroundColor: darken(theme.palette.background.paper, 0.1),
26
+ paddingTop: "10px",
27
+ borderRadius: "100%",
28
+ fontWeight: "400",
29
+ textTransform: "uppercase",
30
+ height: "48px",
31
+ width: "48px"
32
+ }),
33
+ arrowIcon: {
34
+ fontSize: "40px"
35
+ },
36
+ userMail: {
37
+ fontSize: "14px",
38
+ display: "block"
39
+ },
40
+ borderBottom: {
41
+ borderBottom: "1px solid #ccc"
42
+ },
43
+ borderTop: {
44
+ borderTop: "1px solid #ccc"
45
+ },
46
+ settingsMenu: {
47
+ maxWidth: "385px",
48
+ zIndex: 60
49
+ },
50
+ sizeLabel: {
51
+ fontSize: "16px"
52
+ },
53
+ showHideMenu: {
54
+ padding: "0",
55
+ borderRadius: "25px"
56
+ },
57
+ toggleButtonGroup: {
58
+ marginLeft: "15px",
59
+ pointerEvents: "auto"
60
+ },
61
+ toggleButton: {
62
+ height: "30px",
63
+ width: "48px",
64
+ padding: "7px",
65
+ textTransform: "capitalize"
66
+ },
67
+ languageToggleButton: {
68
+ height: "30px",
69
+ width: "48px"
70
+ }
71
+ };
72
+ const StyledMenu = styled((props) => /* @__PURE__ */ jsx(
73
+ Menu,
74
+ {
75
+ elevation: 0,
76
+ anchorOrigin: {
77
+ vertical: "bottom",
78
+ horizontal: "center"
79
+ },
80
+ transformOrigin: {
81
+ vertical: "top",
82
+ horizontal: "center"
83
+ },
84
+ ...props
85
+ }
86
+ ))({
87
+ "& .MuiMenu-paper": {
88
+ border: "1px solid #d3d4d5"
89
+ }
90
+ });
91
+ const StyledMenuItem = styled(MenuItem)(({ theme }) => ({
92
+ "&:focus": {
93
+ backgroundColor: theme.palette.primary.main,
94
+ "& .MuiListItemIcon-root, & .MuiListItemText-primary": {
95
+ color: theme.palette.common.white
96
+ }
97
+ }
98
+ }));
99
+ const CustomListItemIcon = styled(ListItemIcon)({
100
+ minWidth: "30px",
101
+ paddingRight: "15px",
102
+ borderRadius: "25px"
103
+ });
104
+ const DARK_THEME = "Dark";
105
+ const LIGHT_THEME = "Light";
106
+ const LANG_SYSTEM = "sys";
107
+ const LANG_ENGLISH = "en";
108
+ const LANG_FRENCH = "fr";
109
+ const EN = "EN";
110
+ const FR = "FR";
111
+ const TopBar = ({
112
+ appName,
113
+ appColor,
114
+ appLogo,
115
+ appVersion,
116
+ appLicense,
117
+ onParametersClick,
118
+ onLogoutClick,
119
+ onLogoClick,
120
+ user,
121
+ children,
122
+ appsAndUrls,
123
+ onAboutClick,
124
+ globalVersionPromise,
125
+ additionalModulesPromise,
126
+ onThemeClick,
127
+ theme,
128
+ onEquipmentLabellingClick,
129
+ equipmentLabelling,
130
+ onLanguageClick,
131
+ language
132
+ }) => {
133
+ const [anchorElSettingsMenu, setAnchorElSettingsMenu] = React.useState(null);
134
+ const [anchorElAppsMenu, setAnchorElAppsMenu] = React.useState(null);
135
+ const fullScreenRef = useRef(null);
136
+ const [isFullScreen, setIsFullScreen] = useState(false);
137
+ const handleToggleSettingsMenu = (event) => {
138
+ setAnchorElSettingsMenu(event.currentTarget);
139
+ };
140
+ const handleCloseSettingsMenu = () => {
141
+ setAnchorElSettingsMenu(null);
142
+ };
143
+ const handleClickAppsMenu = (event) => {
144
+ setAnchorElAppsMenu(event.currentTarget);
145
+ };
146
+ const handleCloseAppsMenu = () => {
147
+ setAnchorElAppsMenu(null);
148
+ };
149
+ const onParametersClicked = () => {
150
+ setAnchorElSettingsMenu(null);
151
+ if (onParametersClick) {
152
+ onParametersClick();
153
+ }
154
+ };
155
+ function onFullScreenChange(isFullScreenValue) {
156
+ setAnchorElSettingsMenu(null);
157
+ setIsFullScreen(isFullScreen);
158
+ }
159
+ function requestOrExitFullScreen() {
160
+ setAnchorElSettingsMenu(null);
161
+ fullScreenRef.current.fullScreen();
162
+ }
163
+ const abbreviationFromUserName = (name) => {
164
+ const tab = name.split(" ").map((x) => x.charAt(0));
165
+ if (tab.length === 1) {
166
+ return tab[0];
167
+ } else {
168
+ return tab[0] + tab[tab.length - 1];
169
+ }
170
+ };
171
+ const changeTheme = (event, value) => {
172
+ if (onThemeClick && value !== null) {
173
+ onThemeClick(value);
174
+ }
175
+ };
176
+ const changeEquipmentLabelling = (event, value) => {
177
+ if (onEquipmentLabellingClick && value !== null) {
178
+ onEquipmentLabellingClick(value);
179
+ }
180
+ };
181
+ const changeLanguage = (event, value) => {
182
+ if (onLanguageClick && value !== null) {
183
+ onLanguageClick(value);
184
+ }
185
+ };
186
+ const [isAboutDialogOpen, setAboutDialogOpen] = useState(false);
187
+ const onAboutClicked = () => {
188
+ setAnchorElSettingsMenu(false);
189
+ if (onAboutClick) {
190
+ onAboutClick();
191
+ } else {
192
+ setAboutDialogOpen(true);
193
+ }
194
+ };
195
+ const logo_clickable = useMemo(
196
+ () => /* @__PURE__ */ jsx(
197
+ GridLogo,
198
+ {
199
+ onClick: onLogoClick,
200
+ appLogo,
201
+ appName,
202
+ appColor
203
+ }
204
+ ),
205
+ [onLogoClick, appLogo, appName, appColor]
206
+ );
207
+ return /* @__PURE__ */ jsxs(AppBar, { position: "static", color: "default", sx: styles.appBar, children: [
208
+ /* @__PURE__ */ jsx(
209
+ FullScreen,
210
+ {
211
+ ref: fullScreenRef,
212
+ onFullScreenChange,
213
+ onFullScreenError: (e) => console.debug("full screen error : " + e.message)
214
+ }
215
+ ),
216
+ /* @__PURE__ */ jsxs(Toolbar, { children: [
217
+ logo_clickable,
218
+ /* @__PURE__ */ jsx(Box, { sx: styles.grow, children }),
219
+ user && /* @__PURE__ */ jsxs(Box, { children: [
220
+ /* @__PURE__ */ jsx(
221
+ IconButton,
222
+ {
223
+ "aria-label": "apps",
224
+ "aria-controls": "apps-menu",
225
+ "aria-haspopup": "true",
226
+ onClick: handleClickAppsMenu,
227
+ color: "inherit",
228
+ children: /* @__PURE__ */ jsx(Apps, {})
229
+ }
230
+ ),
231
+ /* @__PURE__ */ jsx(
232
+ StyledMenu,
233
+ {
234
+ id: "apps-menu",
235
+ anchorEl: anchorElAppsMenu,
236
+ keepMounted: true,
237
+ open: Boolean(anchorElAppsMenu),
238
+ onClose: handleCloseAppsMenu,
239
+ children: appsAndUrls && appsAndUrls.filter((item) => !item.hiddenInAppsMenu).map((item) => /* @__PURE__ */ jsx(
240
+ Box,
241
+ {
242
+ component: "a",
243
+ href: item.url,
244
+ sx: styles.link,
245
+ target: "_blank",
246
+ rel: "noopener noreferrer",
247
+ children: /* @__PURE__ */ jsx(
248
+ StyledMenuItem,
249
+ {
250
+ onClick: handleCloseAppsMenu,
251
+ children: /* @__PURE__ */ jsxs(ListItemText, { children: [
252
+ /* @__PURE__ */ jsx(
253
+ "span",
254
+ {
255
+ style: {
256
+ fontWeight: "bold"
257
+ },
258
+ children: "Grid"
259
+ }
260
+ ),
261
+ /* @__PURE__ */ jsx(
262
+ "span",
263
+ {
264
+ style: {
265
+ color: item.appColor === void 0 ? "grey" : item.appColor,
266
+ fontWeight: "bold"
267
+ },
268
+ children: item.name
269
+ }
270
+ )
271
+ ] })
272
+ }
273
+ )
274
+ },
275
+ item.name
276
+ ))
277
+ }
278
+ )
279
+ ] }),
280
+ user && /* @__PURE__ */ jsxs(Box, { sx: styles.menuContainerg, children: [
281
+ /* @__PURE__ */ jsxs(
282
+ Button,
283
+ {
284
+ "aria-controls": "settings-menu",
285
+ "aria-haspopup": "true",
286
+ sx: styles.showHideMenu,
287
+ onClick: handleToggleSettingsMenu,
288
+ color: "inherit",
289
+ style: Boolean(anchorElSettingsMenu) ? { cursor: "initial" } : { cursor: "pointer" },
290
+ children: [
291
+ /* @__PURE__ */ jsx(Box, { component: "span", sx: styles.name, children: user !== null ? abbreviationFromUserName(
292
+ user.profile.name
293
+ ) : "" }),
294
+ anchorElSettingsMenu ? /* @__PURE__ */ jsx(ArrowDropUp, { sx: styles.arrowIcon }) : /* @__PURE__ */ jsx(ArrowDropDown, { sx: styles.arrowIcon })
295
+ ]
296
+ }
297
+ ),
298
+ /* @__PURE__ */ jsx(
299
+ Popper,
300
+ {
301
+ sx: styles.settingsMenu,
302
+ open: Boolean(anchorElSettingsMenu),
303
+ anchorEl: anchorElSettingsMenu,
304
+ children: /* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsx(
305
+ ClickAwayListener,
306
+ {
307
+ onClickAway: handleCloseSettingsMenu,
308
+ children: /* @__PURE__ */ jsxs(MenuList, { id: "settings-menu", children: [
309
+ /* @__PURE__ */ jsxs(
310
+ StyledMenuItem,
311
+ {
312
+ sx: styles.borderBottom,
313
+ disabled: true,
314
+ style: { opacity: "1" },
315
+ children: [
316
+ /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(Person, { fontSize: "small" }) }),
317
+ /* @__PURE__ */ jsx(ListItemText, { disabled: false, children: user !== null && /* @__PURE__ */ jsxs(
318
+ Box,
319
+ {
320
+ component: "span",
321
+ sx: styles.sizeLabel,
322
+ children: [
323
+ user.profile.name,
324
+ " ",
325
+ /* @__PURE__ */ jsx("br", {}),
326
+ /* @__PURE__ */ jsx(
327
+ Box,
328
+ {
329
+ component: "span",
330
+ sx: styles.userMail,
331
+ children: user.profile.email
332
+ }
333
+ )
334
+ ]
335
+ }
336
+ ) })
337
+ ]
338
+ }
339
+ ),
340
+ /* @__PURE__ */ jsxs(
341
+ StyledMenuItem,
342
+ {
343
+ disabled: true,
344
+ style: {
345
+ opacity: "1",
346
+ paddingTop: "10px",
347
+ paddingBottom: "10px",
348
+ backgroundColor: "transparent"
349
+ },
350
+ children: [
351
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(
352
+ Typography,
353
+ {
354
+ sx: styles.sizeLabel,
355
+ children: /* @__PURE__ */ jsx(
356
+ FormattedMessage,
357
+ {
358
+ id: "top-bar/displayMode",
359
+ defaultMessage: "Display mode"
360
+ }
361
+ )
362
+ }
363
+ ) }),
364
+ /* @__PURE__ */ jsxs(
365
+ ToggleButtonGroup,
366
+ {
367
+ exclusive: true,
368
+ value: theme,
369
+ size: "large",
370
+ sx: styles.toggleButtonGroup,
371
+ onChange: changeTheme,
372
+ children: [
373
+ /* @__PURE__ */ jsx(
374
+ ToggleButton,
375
+ {
376
+ value: LIGHT_THEME,
377
+ "aria-label": LIGHT_THEME,
378
+ sx: styles.toggleButton,
379
+ children: /* @__PURE__ */ jsx(WbSunny, { fontSize: "small" })
380
+ }
381
+ ),
382
+ /* @__PURE__ */ jsx(
383
+ ToggleButton,
384
+ {
385
+ value: DARK_THEME,
386
+ "aria-label": DARK_THEME,
387
+ sx: styles.toggleButton,
388
+ children: /* @__PURE__ */ jsx(Brightness3, { fontSize: "small" })
389
+ }
390
+ )
391
+ ]
392
+ }
393
+ )
394
+ ]
395
+ }
396
+ ),
397
+ onEquipmentLabellingClick && /* @__PURE__ */ jsxs(
398
+ StyledMenuItem,
399
+ {
400
+ disabled: true,
401
+ style: {
402
+ opacity: "1",
403
+ // padding: '0',
404
+ paddingTop: "10px",
405
+ paddingBottom: "10px",
406
+ backgroundColor: "transparent"
407
+ },
408
+ children: [
409
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(
410
+ Typography,
411
+ {
412
+ sx: styles.sizeLabel,
413
+ children: /* @__PURE__ */ jsx(
414
+ FormattedMessage,
415
+ {
416
+ id: "top-bar/equipmentLabel",
417
+ defaultMessage: "Equipment label"
418
+ }
419
+ )
420
+ }
421
+ ) }),
422
+ /* @__PURE__ */ jsxs(
423
+ ToggleButtonGroup,
424
+ {
425
+ exclusive: true,
426
+ value: equipmentLabelling,
427
+ sx: styles.toggleButtonGroup,
428
+ onChange: changeEquipmentLabelling,
429
+ children: [
430
+ /* @__PURE__ */ jsx(
431
+ ToggleButton,
432
+ {
433
+ value: false,
434
+ sx: styles.toggleButton,
435
+ children: /* @__PURE__ */ jsx(
436
+ FormattedMessage,
437
+ {
438
+ id: "top-bar/id",
439
+ defaultMessage: "Id"
440
+ }
441
+ )
442
+ }
443
+ ),
444
+ /* @__PURE__ */ jsx(
445
+ ToggleButton,
446
+ {
447
+ value: true,
448
+ sx: styles.toggleButton,
449
+ children: /* @__PURE__ */ jsx(
450
+ FormattedMessage,
451
+ {
452
+ id: "top-bar/name",
453
+ defaultMessage: "Name"
454
+ }
455
+ )
456
+ }
457
+ )
458
+ ]
459
+ }
460
+ )
461
+ ]
462
+ }
463
+ ),
464
+ /* @__PURE__ */ jsxs(
465
+ StyledMenuItem,
466
+ {
467
+ disabled: true,
468
+ style: {
469
+ opacity: "1",
470
+ paddingTop: "10px",
471
+ paddingBottom: "10px",
472
+ backgroundColor: "transparent"
473
+ },
474
+ children: [
475
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(
476
+ Typography,
477
+ {
478
+ sx: styles.sizeLabel,
479
+ children: /* @__PURE__ */ jsx(
480
+ FormattedMessage,
481
+ {
482
+ id: "top-bar/language",
483
+ defaultMessage: "Language"
484
+ }
485
+ )
486
+ }
487
+ ) }),
488
+ /* @__PURE__ */ jsxs(
489
+ ToggleButtonGroup,
490
+ {
491
+ exclusive: true,
492
+ value: language,
493
+ sx: styles.toggleButtonGroup,
494
+ onChange: changeLanguage,
495
+ children: [
496
+ /* @__PURE__ */ jsx(
497
+ ToggleButton,
498
+ {
499
+ value: LANG_SYSTEM,
500
+ "aria-label": LANG_SYSTEM,
501
+ sx: styles.languageToggleButton,
502
+ children: /* @__PURE__ */ jsx(Computer, {})
503
+ }
504
+ ),
505
+ /* @__PURE__ */ jsx(
506
+ ToggleButton,
507
+ {
508
+ value: LANG_ENGLISH,
509
+ "aria-label": LANG_ENGLISH,
510
+ sx: styles.languageToggleButton,
511
+ children: EN
512
+ }
513
+ ),
514
+ /* @__PURE__ */ jsx(
515
+ ToggleButton,
516
+ {
517
+ value: LANG_FRENCH,
518
+ "aria-label": LANG_FRENCH,
519
+ sx: styles.toggleButton,
520
+ children: FR
521
+ }
522
+ )
523
+ ]
524
+ }
525
+ )
526
+ ]
527
+ }
528
+ ),
529
+ onParametersClick && /* @__PURE__ */ jsxs(
530
+ StyledMenuItem,
531
+ {
532
+ onClick: onParametersClicked,
533
+ sx: styles.borderTop,
534
+ children: [
535
+ /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(Settings, { fontSize: "small" }) }),
536
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(
537
+ Typography,
538
+ {
539
+ sx: styles.sizeLabel,
540
+ children: /* @__PURE__ */ jsx(
541
+ FormattedMessage,
542
+ {
543
+ id: "top-bar/settings",
544
+ defaultMessage: "Settings"
545
+ }
546
+ )
547
+ }
548
+ ) })
549
+ ]
550
+ }
551
+ ),
552
+ /* @__PURE__ */ jsxs(
553
+ StyledMenuItem,
554
+ {
555
+ sx: styles.borderBottom,
556
+ style: { opacity: "1" },
557
+ onClick: onAboutClicked,
558
+ children: [
559
+ /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(HelpOutline, { fontSize: "small" }) }),
560
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(
561
+ Typography,
562
+ {
563
+ sx: styles.sizeLabel,
564
+ children: /* @__PURE__ */ jsx(
565
+ FormattedMessage,
566
+ {
567
+ id: "top-bar/about",
568
+ defaultMessage: "About"
569
+ }
570
+ )
571
+ }
572
+ ) })
573
+ ]
574
+ }
575
+ ),
576
+ fullScreenSupported() && /* @__PURE__ */ jsx(
577
+ StyledMenuItem,
578
+ {
579
+ onClick: requestOrExitFullScreen,
580
+ children: isFullScreen ? /* @__PURE__ */ jsxs(Fragment, { children: [
581
+ /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(FullscreenExit, { fontSize: "small" }) }),
582
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(
583
+ Typography,
584
+ {
585
+ sx: styles.sizeLabel,
586
+ children: /* @__PURE__ */ jsx(
587
+ FormattedMessage,
588
+ {
589
+ id: "top-bar/exitFullScreen",
590
+ defaultMessage: "Exit full screen mode"
591
+ }
592
+ )
593
+ }
594
+ ) })
595
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
596
+ /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(Fullscreen, { fontSize: "small" }) }),
597
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(
598
+ Typography,
599
+ {
600
+ sx: styles.sizeLabel,
601
+ children: /* @__PURE__ */ jsx(
602
+ FormattedMessage,
603
+ {
604
+ id: "top-bar/goFullScreen",
605
+ defaultMessage: "Full screen"
606
+ }
607
+ )
608
+ }
609
+ ) })
610
+ ] })
611
+ }
612
+ ),
613
+ /* @__PURE__ */ jsxs(StyledMenuItem, { onClick: onLogoutClick, children: [
614
+ /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(ExitToApp, { fontSize: "small" }) }),
615
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(
616
+ Typography,
617
+ {
618
+ sx: styles.sizeLabel,
619
+ children: /* @__PURE__ */ jsx(
620
+ FormattedMessage,
621
+ {
622
+ id: "top-bar/logout",
623
+ defaultMessage: "Logout"
624
+ }
625
+ )
626
+ }
627
+ ) })
628
+ ] })
629
+ ] })
630
+ }
631
+ ) })
632
+ }
633
+ )
634
+ ] }),
635
+ /* @__PURE__ */ jsx(
636
+ AboutDialog,
637
+ {
638
+ open: isAboutDialogOpen,
639
+ onClose: () => setAboutDialogOpen(false),
640
+ appName,
641
+ appVersion,
642
+ appLicense,
643
+ globalVersionPromise,
644
+ additionalModulesPromise
645
+ }
646
+ )
647
+ ] })
648
+ ] });
649
+ };
650
+ TopBar.propTypes = {
651
+ onParametersClick: PropTypes.func,
652
+ onLogoutClick: PropTypes.func,
653
+ onLogoClick: PropTypes.func,
654
+ appName: PropTypes.string,
655
+ appColor: PropTypes.string,
656
+ appLogo: PropTypes.object,
657
+ appVersion: PropTypes.string,
658
+ appLicense: PropTypes.string,
659
+ user: PropTypes.object,
660
+ children: PropTypes.node,
661
+ appsAndUrls: PropTypes.array,
662
+ onThemeClick: PropTypes.func,
663
+ theme: PropTypes.string,
664
+ onAboutClick: PropTypes.func,
665
+ globalVersionPromise: PropTypes.func,
666
+ additionalModulesPromise: PropTypes.func,
667
+ onEquipmentLabellingClick: PropTypes.func,
668
+ equipmentLabelling: PropTypes.bool,
669
+ onLanguageClick: PropTypes.func.isRequired,
670
+ language: PropTypes.string.isRequired
671
+ };
672
+ export {
673
+ DARK_THEME,
674
+ LANG_ENGLISH,
675
+ LANG_FRENCH,
676
+ LANG_SYSTEM,
677
+ LIGHT_THEME,
678
+ TopBar as default
679
+ };