@gridsuite/commons-ui 0.98.0 → 0.100.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 (149) hide show
  1. package/dist/components/announcement/AnnouncementBanner.d.ts +15 -0
  2. package/dist/components/announcement/AnnouncementBanner.js +87 -0
  3. package/dist/components/announcement/AnnouncementNotification.d.ts +7 -0
  4. package/dist/components/announcement/AnnouncementNotification.js +10 -0
  5. package/dist/components/announcement/index.d.ts +3 -0
  6. package/dist/components/announcement/index.js +8 -0
  7. package/dist/components/announcement/useGlobalAnnouncement.d.ts +10 -0
  8. package/dist/components/announcement/useGlobalAnnouncement.js +48 -0
  9. package/dist/components/dialogs/customMuiDialog/CustomMuiDialog.js +1 -1
  10. package/dist/components/index.d.ts +2 -0
  11. package/dist/components/index.js +104 -3
  12. package/dist/components/inputs/index.js +2 -1
  13. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.d.ts +1 -0
  14. package/dist/components/inputs/reactHookForm/DirectoryItemsInput.js +2 -0
  15. package/dist/components/inputs/reactHookForm/index.js +2 -1
  16. package/dist/components/inputs/reactHookForm/text/TextInput.d.ts +3 -1
  17. package/dist/components/inputs/reactHookForm/text/TextInput.js +4 -2
  18. package/dist/components/inputs/reactHookForm/utils/HelperPreviousValue.js +1 -1
  19. package/dist/components/parameters/common/ProviderParam.d.ts +7 -0
  20. package/dist/components/parameters/common/ProviderParam.js +51 -0
  21. package/dist/components/parameters/common/computing-type.d.ts +20 -0
  22. package/dist/components/parameters/common/computing-type.js +46 -0
  23. package/dist/components/parameters/common/constant.d.ts +8 -0
  24. package/dist/components/parameters/common/constant.js +18 -0
  25. package/dist/components/parameters/common/index.d.ts +15 -0
  26. package/dist/components/parameters/common/index.js +61 -0
  27. package/dist/components/parameters/common/limitreductions/columns-definitions.d.ts +77 -0
  28. package/dist/components/parameters/common/limitreductions/columns-definitions.js +83 -0
  29. package/dist/components/parameters/common/limitreductions/index.d.ts +11 -0
  30. package/dist/components/parameters/common/limitreductions/index.js +21 -0
  31. package/dist/components/parameters/common/limitreductions/limit-reduction-table-cell.d.ts +5 -0
  32. package/dist/components/parameters/common/limitreductions/limit-reduction-table-cell.js +38 -0
  33. package/dist/components/parameters/common/limitreductions/limit-reduction-table-row.d.ts +7 -0
  34. package/dist/components/parameters/common/limitreductions/limit-reduction-table-row.js +9 -0
  35. package/dist/components/parameters/common/limitreductions/limit-reductions-form-util.d.ts +29 -0
  36. package/dist/components/parameters/common/limitreductions/limit-reductions-form-util.js +27 -0
  37. package/dist/components/parameters/common/limitreductions/limit-reductions-table-form.d.ts +4 -0
  38. package/dist/components/parameters/common/limitreductions/limit-reductions-table-form.js +87 -0
  39. package/dist/components/parameters/common/line-separator.d.ts +1 -0
  40. package/dist/components/parameters/common/line-separator.js +8 -0
  41. package/dist/components/parameters/common/parameters-creation-dialog.d.ts +13 -0
  42. package/dist/components/parameters/common/parameters-creation-dialog.js +88 -0
  43. package/dist/components/parameters/common/parameters.d.ts +20 -0
  44. package/dist/components/parameters/common/parameters.js +42 -0
  45. package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-cell.d.ts +6 -0
  46. package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-cell.js +42 -0
  47. package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-row.d.ts +8 -0
  48. package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table-row.js +17 -0
  49. package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table.d.ts +8 -0
  50. package/dist/components/parameters/common/voltage-level-table/custom-voltage-level-table.js +55 -0
  51. package/dist/components/parameters/common/voltage-level-table/index.d.ts +9 -0
  52. package/dist/components/parameters/common/voltage-level-table/index.js +8 -0
  53. package/dist/components/parameters/common/widget/index.d.ts +11 -0
  54. package/dist/components/parameters/common/widget/index.js +13 -0
  55. package/dist/components/parameters/common/widget/parameter-float.d.ts +10 -0
  56. package/dist/components/parameters/common/widget/parameter-float.js +51 -0
  57. package/dist/components/parameters/common/widget/parameter-group.d.ts +11 -0
  58. package/dist/components/parameters/common/widget/parameter-group.js +54 -0
  59. package/dist/components/parameters/common/widget/parameter-line-directory-items-input.d.ts +15 -0
  60. package/dist/components/parameters/common/widget/parameter-line-directory-items-input.js +55 -0
  61. package/dist/components/parameters/common/widget/parameter-line-slider.d.ts +12 -0
  62. package/dist/components/parameters/common/widget/parameter-line-slider.js +70 -0
  63. package/dist/components/parameters/common/widget/parameter-switch.d.ts +7 -0
  64. package/dist/components/parameters/common/widget/parameter-switch.js +9 -0
  65. package/dist/components/parameters/index.d.ts +9 -0
  66. package/dist/components/parameters/index.js +94 -0
  67. package/dist/components/parameters/loadflow/constants.d.ts +33 -0
  68. package/dist/components/parameters/loadflow/constants.js +59 -0
  69. package/dist/components/parameters/loadflow/index.d.ts +9 -0
  70. package/dist/components/parameters/loadflow/index.js +31 -0
  71. package/dist/components/parameters/loadflow/load-flow-general-parameters.d.ts +8 -0
  72. package/dist/components/parameters/loadflow/load-flow-general-parameters.js +179 -0
  73. package/dist/components/parameters/loadflow/load-flow-parameter-field.d.ts +19 -0
  74. package/dist/components/parameters/loadflow/load-flow-parameter-field.js +90 -0
  75. package/dist/components/parameters/loadflow/load-flow-parameters-content.d.ts +13 -0
  76. package/dist/components/parameters/loadflow/load-flow-parameters-content.js +82 -0
  77. package/dist/components/parameters/loadflow/load-flow-parameters-context.d.ts +13 -0
  78. package/dist/components/parameters/loadflow/load-flow-parameters-context.js +5 -0
  79. package/dist/components/parameters/loadflow/load-flow-parameters-dialog.d.ts +15 -0
  80. package/dist/components/parameters/loadflow/load-flow-parameters-dialog.js +112 -0
  81. package/dist/components/parameters/loadflow/load-flow-parameters-form.d.ts +9 -0
  82. package/dist/components/parameters/loadflow/load-flow-parameters-form.js +102 -0
  83. package/dist/components/parameters/loadflow/load-flow-parameters-header.d.ts +12 -0
  84. package/dist/components/parameters/loadflow/load-flow-parameters-header.js +84 -0
  85. package/dist/components/parameters/loadflow/load-flow-parameters-inline.d.ts +10 -0
  86. package/dist/components/parameters/loadflow/load-flow-parameters-inline.js +162 -0
  87. package/dist/components/parameters/loadflow/load-flow-parameters-provider.d.ts +4 -0
  88. package/dist/components/parameters/loadflow/load-flow-parameters-provider.js +20 -0
  89. package/dist/components/parameters/loadflow/load-flow-parameters-utils.d.ts +100 -0
  90. package/dist/components/parameters/loadflow/load-flow-parameters-utils.js +158 -0
  91. package/dist/components/parameters/loadflow/use-load-flow-context.d.ts +7 -0
  92. package/dist/components/parameters/loadflow/use-load-flow-context.js +12 -0
  93. package/dist/components/parameters/loadflow/use-load-flow-parameters-form.d.ts +32 -0
  94. package/dist/components/parameters/loadflow/use-load-flow-parameters-form.js +263 -0
  95. package/dist/components/parameters/parameters-style.d.ts +150 -0
  96. package/dist/components/parameters/parameters-style.js +146 -0
  97. package/dist/components/topBar/DevModeBanner.d.ts +1 -0
  98. package/dist/components/topBar/DevModeBanner.js +42 -0
  99. package/dist/components/topBar/TopBar.js +302 -305
  100. package/dist/components/topBar/UserInformationDialog.js +1 -1
  101. package/dist/components/topBar/index.d.ts +3 -2
  102. package/dist/components/topBar/index.js +4 -2
  103. package/dist/hooks/index.d.ts +1 -0
  104. package/dist/hooks/index.js +3 -0
  105. package/dist/hooks/use-parameters-backend.d.ts +11 -0
  106. package/dist/hooks/use-parameters-backend.js +217 -0
  107. package/dist/index.js +135 -5
  108. package/dist/services/explore.d.ts +3 -0
  109. package/dist/services/explore.js +26 -1
  110. package/dist/services/index.d.ts +1 -0
  111. package/dist/services/index.js +9 -3
  112. package/dist/services/loadflow.d.ts +9 -0
  113. package/dist/services/loadflow.js +59 -0
  114. package/dist/services/userAdmin.d.ts +3 -3
  115. package/dist/services/userAdmin.js +9 -1
  116. package/dist/services/utils.d.ts +3 -8
  117. package/dist/services/utils.js +5 -0
  118. package/dist/translations/en/index.d.ts +1 -0
  119. package/dist/translations/en/index.js +2 -0
  120. package/dist/translations/en/parameters.d.ts +67 -0
  121. package/dist/translations/en/parameters.js +64 -0
  122. package/dist/translations/fr/index.d.ts +1 -0
  123. package/dist/translations/fr/index.js +2 -0
  124. package/dist/translations/fr/parameters.d.ts +67 -0
  125. package/dist/translations/fr/parameters.js +64 -0
  126. package/dist/utils/constants/notificationsProvider.d.ts +10 -0
  127. package/dist/utils/constants/notificationsProvider.js +17 -0
  128. package/dist/utils/index.d.ts +1 -0
  129. package/dist/utils/index.js +16 -0
  130. package/dist/utils/types/dynamic-security-analysis.type.d.ts +13 -0
  131. package/dist/utils/types/dynamic-security-analysis.type.js +1 -0
  132. package/dist/utils/types/dynamic-simulation.type.d.ts +111 -0
  133. package/dist/utils/types/dynamic-simulation.type.js +8 -0
  134. package/dist/utils/types/index.d.ts +6 -0
  135. package/dist/utils/types/index.js +11 -0
  136. package/dist/utils/types/loadflow.type.d.ts +11 -0
  137. package/dist/utils/types/loadflow.type.js +1 -0
  138. package/dist/utils/types/metadata.d.ts +1 -0
  139. package/dist/utils/types/non-evacuated-energy.type.d.ts +60 -0
  140. package/dist/utils/types/non-evacuated-energy.type.js +12 -0
  141. package/dist/utils/types/parameters.type.d.ts +41 -0
  142. package/dist/utils/types/parameters.type.js +12 -0
  143. package/dist/utils/types/sensitivity-analysis.type.d.ts +101 -0
  144. package/dist/utils/types/sensitivity-analysis.type.js +16 -0
  145. package/dist/utils/types/types.d.ts +12 -0
  146. package/dist/utils/types/types.js +8 -1
  147. package/package.json +2 -1
  148. package/dist/components/topBar/MessageBanner.d.ts +0 -6
  149. package/dist/components/topBar/MessageBanner.js +0 -54
@@ -10,7 +10,7 @@ import UserInformationDialog from "./UserInformationDialog.js";
10
10
  import UserSettingsDialog from "./UserSettingsDialog.js";
11
11
  import { LIGHT_THEME, DARK_THEME } from "../../utils/styles.js";
12
12
  import { LANG_SYSTEM, LANG_ENGLISH, LANG_FRENCH } from "../../utils/langs.js";
13
- import MessageBanner from "./MessageBanner.js";
13
+ import { DevModeBanner } from "./DevModeBanner.js";
14
14
  const styles = {
15
15
  grow: {
16
16
  flexGrow: 1,
@@ -199,323 +199,320 @@ function TopBar({
199
199
  () => /* @__PURE__ */ jsx(GridLogo, { onClick: onLogoClick, appLogo, appName, appColor }),
200
200
  [onLogoClick, appLogo, appName, appColor]
201
201
  );
202
- return (
203
- // @ts-expect-error appBar style is not defined
204
- /* @__PURE__ */ jsxs(AppBar, { position: "static", color: "default", sx: styles.appBar, children: [
205
- user && developerMode && /* @__PURE__ */ jsx(MessageBanner, { children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/developerModeWarning", defaultMessage: "Developer mode" }) }),
206
- /* @__PURE__ */ jsxs(Toolbar, { children: [
207
- logoClickable,
208
- /* @__PURE__ */ jsx(Box, { sx: styles.grow, children }),
209
- user && /* @__PURE__ */ jsxs(Box, { children: [
210
- /* @__PURE__ */ jsx(
211
- IconButton,
212
- {
213
- "aria-label": "apps",
214
- "aria-controls": "apps-menu",
215
- "aria-haspopup": "true",
216
- onClick: handleClickAppsMenu,
217
- color: "inherit",
218
- children: /* @__PURE__ */ jsx(Apps, {})
219
- }
220
- ),
221
- /* @__PURE__ */ jsx(
222
- StyledMenu,
223
- {
224
- id: "apps-menu",
225
- anchorEl: anchorElAppsMenu,
226
- keepMounted: true,
227
- open: Boolean(anchorElAppsMenu),
228
- onClose: handleCloseAppsMenu,
229
- children: appsAndUrls && appsAndUrls.filter((item) => !item.hiddenInAppsMenu).map((item) => {
230
- var _a;
231
- return /* @__PURE__ */ jsx(
232
- Box,
233
- {
234
- component: "a",
235
- href: (_a = item.url) == null ? void 0 : _a.toString(),
236
- sx: styles.link,
237
- target: "_blank",
238
- rel: "noopener noreferrer",
239
- children: /* @__PURE__ */ jsx(StyledMenuItem, { onClick: handleCloseAppsMenu, children: /* @__PURE__ */ jsxs(ListItemText, { children: [
240
- /* @__PURE__ */ jsx(
241
- "span",
242
- {
243
- style: {
244
- fontWeight: "bold"
245
- },
246
- children: "Grid"
247
- }
248
- ),
249
- /* @__PURE__ */ jsx(
250
- "span",
251
- {
252
- style: {
253
- color: item.appColor === void 0 ? "grey" : item.appColor,
254
- fontWeight: "bold"
255
- },
256
- children: item.name
257
- }
258
- )
259
- ] }) })
260
- },
261
- item.name
262
- );
263
- })
264
- }
265
- )
266
- ] }),
267
- user && /* @__PURE__ */ jsxs(Box, { sx: styles.menuContainer, children: [
268
- /* @__PURE__ */ jsxs(
269
- Button,
270
- {
271
- "aria-controls": "settings-menu",
272
- "aria-haspopup": "true",
273
- sx: styles.showHideMenu,
274
- onClick: handleToggleSettingsMenu,
275
- color: "inherit",
276
- style: anchorElSettingsMenu ? { cursor: "initial" } : { cursor: "pointer" },
277
- children: [
278
- /* @__PURE__ */ jsx(Box, { component: "span", sx: styles.name, children: user.profile.name !== void 0 ? abbreviationFromUserName(user.profile.name) : "" }),
279
- anchorElSettingsMenu ? /* @__PURE__ */ jsx(ArrowDropUp, { sx: styles.arrowIcon }) : /* @__PURE__ */ jsx(ArrowDropDown, { sx: styles.arrowIcon })
280
- ]
281
- }
282
- ),
283
- /* @__PURE__ */ jsx(
284
- Popper,
285
- {
286
- sx: styles.settingsMenu,
287
- open: Boolean(anchorElSettingsMenu),
288
- anchorEl: anchorElSettingsMenu,
289
- children: /* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsx(ClickAwayListener, { onClickAway: handleCloseSettingsMenu, children: /* @__PURE__ */ jsxs(MenuList, { id: "settings-menu", children: [
290
- /* @__PURE__ */ jsxs(StyledMenuItem, { sx: styles.borderBottom, disabled: true, style: { opacity: "1" }, children: [
291
- /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(Person, { fontSize: "small" }) }),
292
- /* @__PURE__ */ jsx(ListItemText, { children: user !== null && /* @__PURE__ */ jsxs(Box, { component: "span", sx: styles.sizeLabel, children: [
293
- user.profile.name,
294
- " ",
295
- /* @__PURE__ */ jsx("br", {}),
296
- /* @__PURE__ */ jsx(Box, { component: "span", sx: styles.userMail, children: user.profile.email })
297
- ] }) })
298
- ] }),
299
- !isHiddenUserInformation() && /* @__PURE__ */ jsxs(
300
- StyledMenuItem,
301
- {
302
- style: { opacity: "1" },
303
- onClick: onUserInformationDialogClicked,
304
- children: [
305
- /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(Badge, { fontSize: "small" }) }),
306
- /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(
307
- FormattedMessage,
308
- {
309
- id: "top-bar/userInformation",
310
- defaultMessage: "User information"
311
- }
312
- ) }) })
313
- ]
314
- }
315
- ),
316
- /* @__PURE__ */ jsxs(StyledMenuItem, { onClick: onUserSettingsDialogClicked, sx: styles.borderBottom, children: [
317
- /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(ManageAccounts, { fontSize: "small" }) }),
318
- /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(
319
- FormattedMessage,
320
- {
321
- id: "top-bar/userSettings",
322
- defaultMessage: "Settings"
323
- }
324
- ) }) })
325
- ] }),
326
- /* @__PURE__ */ jsxs(
327
- StyledMenuItem,
328
- {
329
- sx: styles.borderBottom,
330
- style: { opacity: "1" },
331
- onClick: onAboutClicked,
332
- children: [
333
- /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(HelpOutline, { fontSize: "small" }) }),
334
- /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/about", defaultMessage: "About" }) }) })
335
- ]
336
- }
337
- ),
338
- /* @__PURE__ */ jsxs(
339
- StyledMenuItem,
340
- {
341
- disabled: true,
342
- style: {
343
- opacity: "1",
344
- paddingTop: "10px",
345
- paddingBottom: "10px",
346
- backgroundColor: "transparent"
347
- },
348
- children: [
349
- /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(
350
- FormattedMessage,
351
- {
352
- id: "top-bar/displayMode",
353
- defaultMessage: "Display mode"
354
- }
355
- ) }) }),
356
- /* @__PURE__ */ jsxs(
357
- ToggleButtonGroup,
358
- {
359
- exclusive: true,
360
- value: theme,
361
- size: "large",
362
- sx: styles.toggleButtonGroup,
363
- onChange: changeTheme,
364
- children: [
365
- /* @__PURE__ */ jsx(
366
- ToggleButton,
367
- {
368
- value: LIGHT_THEME,
369
- "aria-label": LIGHT_THEME,
370
- sx: styles.toggleButton,
371
- children: /* @__PURE__ */ jsx(WbSunny, { fontSize: "small" })
372
- }
373
- ),
374
- /* @__PURE__ */ jsx(
375
- ToggleButton,
376
- {
377
- value: DARK_THEME,
378
- "aria-label": DARK_THEME,
379
- sx: styles.toggleButton,
380
- children: /* @__PURE__ */ jsx(Brightness3, { fontSize: "small" })
381
- }
382
- )
383
- ]
384
- }
385
- )
386
- ]
387
- }
388
- ),
389
- onEquipmentLabellingClick && /* @__PURE__ */ jsxs(
390
- StyledMenuItem,
391
- {
392
- disabled: true,
393
- style: {
394
- opacity: "1",
395
- // padding: '0',
396
- paddingTop: "10px",
397
- paddingBottom: "10px",
398
- backgroundColor: "transparent"
399
- },
400
- children: [
401
- /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(
402
- FormattedMessage,
403
- {
404
- id: "top-bar/equipmentLabel",
405
- defaultMessage: "Equipment label"
406
- }
407
- ) }) }),
408
- /* @__PURE__ */ jsxs(
409
- ToggleButtonGroup,
410
- {
411
- exclusive: true,
412
- value: equipmentLabelling,
413
- sx: styles.toggleButtonGroup,
414
- onChange: changeEquipmentLabelling,
415
- children: [
416
- /* @__PURE__ */ jsx(ToggleButton, { value: false, sx: styles.toggleButton, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/id", defaultMessage: "Id" }) }),
417
- /* @__PURE__ */ jsx(ToggleButton, { value: true, sx: styles.toggleButton, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/name", defaultMessage: "Name" }) })
418
- ]
419
- }
420
- )
421
- ]
422
- }
423
- ),
424
- /* @__PURE__ */ jsxs(
425
- StyledMenuItem,
426
- {
427
- disabled: true,
428
- sx: styles.borderBottom,
429
- style: {
430
- opacity: "1",
431
- paddingTop: "10px",
432
- paddingBottom: "10px",
433
- backgroundColor: "transparent"
434
- },
435
- children: [
436
- /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/language", defaultMessage: "Language" }) }) }),
437
- /* @__PURE__ */ jsxs(
438
- ToggleButtonGroup,
439
- {
440
- exclusive: true,
441
- value: language,
442
- sx: styles.toggleButtonGroup,
443
- onChange: changeLanguage,
444
- children: [
445
- /* @__PURE__ */ jsx(
446
- ToggleButton,
447
- {
448
- value: LANG_SYSTEM,
449
- "aria-label": LANG_SYSTEM,
450
- sx: styles.languageToggleButton,
451
- children: /* @__PURE__ */ jsx(Computer, {})
452
- }
453
- ),
454
- /* @__PURE__ */ jsx(
455
- ToggleButton,
456
- {
457
- value: LANG_ENGLISH,
458
- "aria-label": LANG_ENGLISH,
459
- sx: styles.languageToggleButton,
460
- children: "EN"
461
- }
462
- ),
463
- /* @__PURE__ */ jsx(
464
- ToggleButton,
465
- {
466
- value: LANG_FRENCH,
467
- "aria-label": LANG_FRENCH,
468
- sx: styles.toggleButton,
469
- children: "FR"
470
- }
471
- )
472
- ]
473
- }
474
- )
475
- ]
476
- }
477
- ),
478
- /* @__PURE__ */ jsxs(StyledMenuItem, { onClick: onLogoutClick, children: [
479
- /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(ExitToApp, { fontSize: "small" }) }),
480
- /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/logout", defaultMessage: "Logout" }) }) })
481
- ] })
482
- ] }) }) })
483
- }
484
- )
485
- ] }),
202
+ return /* @__PURE__ */ jsxs(AppBar, { position: "static", color: "default", children: [
203
+ user && developerMode && /* @__PURE__ */ jsx(DevModeBanner, {}),
204
+ /* @__PURE__ */ jsxs(Toolbar, { children: [
205
+ logoClickable,
206
+ /* @__PURE__ */ jsx(Box, { sx: styles.grow, children }),
207
+ user && /* @__PURE__ */ jsxs(Box, { children: [
486
208
  /* @__PURE__ */ jsx(
487
- UserInformationDialog,
209
+ IconButton,
488
210
  {
489
- openDialog: userInformationDialogOpen && !!user,
490
- user,
491
- onClose: closeUserInformationDialog
211
+ "aria-label": "apps",
212
+ "aria-controls": "apps-menu",
213
+ "aria-haspopup": "true",
214
+ onClick: handleClickAppsMenu,
215
+ color: "inherit",
216
+ children: /* @__PURE__ */ jsx(Apps, {})
492
217
  }
493
218
  ),
494
219
  /* @__PURE__ */ jsx(
495
- UserSettingsDialog,
220
+ StyledMenu,
221
+ {
222
+ id: "apps-menu",
223
+ anchorEl: anchorElAppsMenu,
224
+ keepMounted: true,
225
+ open: Boolean(anchorElAppsMenu),
226
+ onClose: handleCloseAppsMenu,
227
+ children: appsAndUrls == null ? void 0 : appsAndUrls.filter((item) => !item.hiddenInAppsMenu).map((item) => {
228
+ var _a;
229
+ return /* @__PURE__ */ jsx(
230
+ Box,
231
+ {
232
+ component: "a",
233
+ href: (_a = item.url) == null ? void 0 : _a.toString(),
234
+ sx: styles.link,
235
+ target: "_blank",
236
+ rel: "noopener noreferrer",
237
+ children: /* @__PURE__ */ jsx(StyledMenuItem, { onClick: handleCloseAppsMenu, children: /* @__PURE__ */ jsxs(ListItemText, { children: [
238
+ /* @__PURE__ */ jsx(
239
+ "span",
240
+ {
241
+ style: {
242
+ fontWeight: "bold"
243
+ },
244
+ children: "Grid"
245
+ }
246
+ ),
247
+ /* @__PURE__ */ jsx(
248
+ "span",
249
+ {
250
+ style: {
251
+ color: item.appColor ?? "grey",
252
+ fontWeight: "bold"
253
+ },
254
+ children: item.name
255
+ }
256
+ )
257
+ ] }) })
258
+ },
259
+ item.name
260
+ );
261
+ })
262
+ }
263
+ )
264
+ ] }),
265
+ user && /* @__PURE__ */ jsxs(Box, { sx: styles.menuContainer, children: [
266
+ /* @__PURE__ */ jsxs(
267
+ Button,
496
268
  {
497
- openDialog: userSettingsDialogOpen && !!user,
498
- onClose: closeUserSettingsDialog,
499
- developerMode,
500
- onDeveloperModeClick
269
+ "aria-controls": "settings-menu",
270
+ "aria-haspopup": "true",
271
+ sx: styles.showHideMenu,
272
+ onClick: handleToggleSettingsMenu,
273
+ color: "inherit",
274
+ style: anchorElSettingsMenu ? { cursor: "initial" } : { cursor: "pointer" },
275
+ children: [
276
+ /* @__PURE__ */ jsx(Box, { component: "span", sx: styles.name, children: user.profile.name !== void 0 ? abbreviationFromUserName(user.profile.name) : "" }),
277
+ anchorElSettingsMenu ? /* @__PURE__ */ jsx(ArrowDropUp, { sx: styles.arrowIcon }) : /* @__PURE__ */ jsx(ArrowDropDown, { sx: styles.arrowIcon })
278
+ ]
501
279
  }
502
280
  ),
503
281
  /* @__PURE__ */ jsx(
504
- AboutDialog,
282
+ Popper,
505
283
  {
506
- open: isAboutDialogOpen && !!user,
507
- onClose: () => setAboutDialogOpen(false),
508
- appName,
509
- appVersion,
510
- appLicense,
511
- globalVersionPromise,
512
- additionalModulesPromise,
513
- logo: logoAboutDialog
284
+ sx: styles.settingsMenu,
285
+ open: Boolean(anchorElSettingsMenu),
286
+ anchorEl: anchorElSettingsMenu,
287
+ children: /* @__PURE__ */ jsx(Paper, { children: /* @__PURE__ */ jsx(ClickAwayListener, { onClickAway: handleCloseSettingsMenu, children: /* @__PURE__ */ jsxs(MenuList, { id: "settings-menu", children: [
288
+ /* @__PURE__ */ jsxs(StyledMenuItem, { sx: styles.borderBottom, disabled: true, style: { opacity: "1" }, children: [
289
+ /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(Person, { fontSize: "small" }) }),
290
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsxs(Box, { component: "span", sx: styles.sizeLabel, children: [
291
+ user.profile.name,
292
+ " ",
293
+ /* @__PURE__ */ jsx("br", {}),
294
+ /* @__PURE__ */ jsx(Box, { component: "span", sx: styles.userMail, children: user.profile.email })
295
+ ] }) })
296
+ ] }),
297
+ !isHiddenUserInformation() && /* @__PURE__ */ jsxs(
298
+ StyledMenuItem,
299
+ {
300
+ style: { opacity: "1" },
301
+ onClick: onUserInformationDialogClicked,
302
+ children: [
303
+ /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(Badge, { fontSize: "small" }) }),
304
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(
305
+ FormattedMessage,
306
+ {
307
+ id: "top-bar/userInformation",
308
+ defaultMessage: "User information"
309
+ }
310
+ ) }) })
311
+ ]
312
+ }
313
+ ),
314
+ /* @__PURE__ */ jsxs(StyledMenuItem, { onClick: onUserSettingsDialogClicked, sx: styles.borderBottom, children: [
315
+ /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(ManageAccounts, { fontSize: "small" }) }),
316
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(
317
+ FormattedMessage,
318
+ {
319
+ id: "top-bar/userSettings",
320
+ defaultMessage: "Settings"
321
+ }
322
+ ) }) })
323
+ ] }),
324
+ /* @__PURE__ */ jsxs(
325
+ StyledMenuItem,
326
+ {
327
+ sx: styles.borderBottom,
328
+ style: { opacity: "1" },
329
+ onClick: onAboutClicked,
330
+ children: [
331
+ /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(HelpOutline, { fontSize: "small" }) }),
332
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/about", defaultMessage: "About" }) }) })
333
+ ]
334
+ }
335
+ ),
336
+ /* @__PURE__ */ jsxs(
337
+ StyledMenuItem,
338
+ {
339
+ disabled: true,
340
+ style: {
341
+ opacity: "1",
342
+ paddingTop: "10px",
343
+ paddingBottom: "10px",
344
+ backgroundColor: "transparent"
345
+ },
346
+ children: [
347
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(
348
+ FormattedMessage,
349
+ {
350
+ id: "top-bar/displayMode",
351
+ defaultMessage: "Display mode"
352
+ }
353
+ ) }) }),
354
+ /* @__PURE__ */ jsxs(
355
+ ToggleButtonGroup,
356
+ {
357
+ exclusive: true,
358
+ value: theme,
359
+ size: "large",
360
+ sx: styles.toggleButtonGroup,
361
+ onChange: changeTheme,
362
+ children: [
363
+ /* @__PURE__ */ jsx(
364
+ ToggleButton,
365
+ {
366
+ value: LIGHT_THEME,
367
+ "aria-label": LIGHT_THEME,
368
+ sx: styles.toggleButton,
369
+ children: /* @__PURE__ */ jsx(WbSunny, { fontSize: "small" })
370
+ }
371
+ ),
372
+ /* @__PURE__ */ jsx(
373
+ ToggleButton,
374
+ {
375
+ value: DARK_THEME,
376
+ "aria-label": DARK_THEME,
377
+ sx: styles.toggleButton,
378
+ children: /* @__PURE__ */ jsx(Brightness3, { fontSize: "small" })
379
+ }
380
+ )
381
+ ]
382
+ }
383
+ )
384
+ ]
385
+ }
386
+ ),
387
+ onEquipmentLabellingClick && /* @__PURE__ */ jsxs(
388
+ StyledMenuItem,
389
+ {
390
+ disabled: true,
391
+ style: {
392
+ opacity: "1",
393
+ // padding: '0',
394
+ paddingTop: "10px",
395
+ paddingBottom: "10px",
396
+ backgroundColor: "transparent"
397
+ },
398
+ children: [
399
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(
400
+ FormattedMessage,
401
+ {
402
+ id: "top-bar/equipmentLabel",
403
+ defaultMessage: "Equipment label"
404
+ }
405
+ ) }) }),
406
+ /* @__PURE__ */ jsxs(
407
+ ToggleButtonGroup,
408
+ {
409
+ exclusive: true,
410
+ value: equipmentLabelling,
411
+ sx: styles.toggleButtonGroup,
412
+ onChange: changeEquipmentLabelling,
413
+ children: [
414
+ /* @__PURE__ */ jsx(ToggleButton, { value: false, sx: styles.toggleButton, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/id", defaultMessage: "Id" }) }),
415
+ /* @__PURE__ */ jsx(ToggleButton, { value: true, sx: styles.toggleButton, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/name", defaultMessage: "Name" }) })
416
+ ]
417
+ }
418
+ )
419
+ ]
420
+ }
421
+ ),
422
+ /* @__PURE__ */ jsxs(
423
+ StyledMenuItem,
424
+ {
425
+ disabled: true,
426
+ sx: styles.borderBottom,
427
+ style: {
428
+ opacity: "1",
429
+ paddingTop: "10px",
430
+ paddingBottom: "10px",
431
+ backgroundColor: "transparent"
432
+ },
433
+ children: [
434
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/language", defaultMessage: "Language" }) }) }),
435
+ /* @__PURE__ */ jsxs(
436
+ ToggleButtonGroup,
437
+ {
438
+ exclusive: true,
439
+ value: language,
440
+ sx: styles.toggleButtonGroup,
441
+ onChange: changeLanguage,
442
+ children: [
443
+ /* @__PURE__ */ jsx(
444
+ ToggleButton,
445
+ {
446
+ value: LANG_SYSTEM,
447
+ "aria-label": LANG_SYSTEM,
448
+ sx: styles.languageToggleButton,
449
+ children: /* @__PURE__ */ jsx(Computer, {})
450
+ }
451
+ ),
452
+ /* @__PURE__ */ jsx(
453
+ ToggleButton,
454
+ {
455
+ value: LANG_ENGLISH,
456
+ "aria-label": LANG_ENGLISH,
457
+ sx: styles.languageToggleButton,
458
+ children: "EN"
459
+ }
460
+ ),
461
+ /* @__PURE__ */ jsx(
462
+ ToggleButton,
463
+ {
464
+ value: LANG_FRENCH,
465
+ "aria-label": LANG_FRENCH,
466
+ sx: styles.toggleButton,
467
+ children: "FR"
468
+ }
469
+ )
470
+ ]
471
+ }
472
+ )
473
+ ]
474
+ }
475
+ ),
476
+ /* @__PURE__ */ jsxs(StyledMenuItem, { onClick: onLogoutClick, children: [
477
+ /* @__PURE__ */ jsx(CustomListItemIcon, { children: /* @__PURE__ */ jsx(ExitToApp, { fontSize: "small" }) }),
478
+ /* @__PURE__ */ jsx(ListItemText, { children: /* @__PURE__ */ jsx(Typography, { sx: styles.sizeLabel, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "top-bar/logout", defaultMessage: "Logout" }) }) })
479
+ ] })
480
+ ] }) }) })
514
481
  }
515
482
  )
516
- ] })
483
+ ] }),
484
+ /* @__PURE__ */ jsx(
485
+ UserInformationDialog,
486
+ {
487
+ openDialog: userInformationDialogOpen && !!user,
488
+ user,
489
+ onClose: closeUserInformationDialog
490
+ }
491
+ ),
492
+ /* @__PURE__ */ jsx(
493
+ UserSettingsDialog,
494
+ {
495
+ openDialog: userSettingsDialogOpen && !!user,
496
+ onClose: closeUserSettingsDialog,
497
+ developerMode,
498
+ onDeveloperModeClick
499
+ }
500
+ ),
501
+ /* @__PURE__ */ jsx(
502
+ AboutDialog,
503
+ {
504
+ open: isAboutDialogOpen && !!user,
505
+ onClose: () => setAboutDialogOpen(false),
506
+ appName,
507
+ appVersion,
508
+ appLicense,
509
+ globalVersionPromise,
510
+ additionalModulesPromise,
511
+ logo: logoAboutDialog
512
+ }
513
+ )
517
514
  ] })
518
- );
515
+ ] });
519
516
  }
520
517
  export {
521
518
  TopBar
@@ -3,7 +3,7 @@ import { Dialog, DialogTitle, DialogContent, Grid, Typography, Box, DialogAction
3
3
  import { FormattedMessage } from "react-intl";
4
4
  import { useState, useEffect } from "react";
5
5
  import { CancelButton } from "../inputs/reactHookForm/utils/CancelButton.js";
6
- import fetchUserDetails from "../../services/userAdmin.js";
6
+ import { fetchUserDetails } from "../../services/userAdmin.js";
7
7
  const styles = {
8
8
  DialogTitle: { fontSize: "1.5rem" },
9
9
  DialogContent: { marginTop: "10px" },
@@ -4,6 +4,7 @@
4
4
  * License, v. 2.0. If a copy of the MPL was not distributed with this
5
5
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
6
  */
7
- export * from './TopBar';
8
- export * from './GridLogo';
9
7
  export * from './AboutDialog';
8
+ export * from './GridLogo';
9
+ export * from './DevModeBanner';
10
+ export * from './TopBar';
@@ -1,8 +1,10 @@
1
- import { TopBar } from "./TopBar.js";
2
- import { GridLogo, LogoText } from "./GridLogo.js";
3
1
  import { AboutDialog } from "./AboutDialog.js";
2
+ import { GridLogo, LogoText } from "./GridLogo.js";
3
+ import { DevModeBanner } from "./DevModeBanner.js";
4
+ import { TopBar } from "./TopBar.js";
4
5
  export {
5
6
  AboutDialog,
7
+ DevModeBanner,
6
8
  GridLogo,
7
9
  LogoText,
8
10
  TopBar
@@ -15,3 +15,4 @@ export * from './usePrevious';
15
15
  export * from './useSnackMessage';
16
16
  export * from './useFormatLabelWithUnit';
17
17
  export * from './useSelectAppearance';
18
+ export * from './use-parameters-backend';