@dhis2/analytics 25.1.21 → 25.2.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 (58) hide show
  1. package/build/cjs/__demo__/FileMenu.stories.js +8 -6
  2. package/build/cjs/__demo__/Toolbar.stories.js +77 -0
  3. package/build/cjs/components/FileMenu/FileMenu.js +21 -59
  4. package/build/cjs/components/FileMenu/__tests__/FileMenu.spec.js +318 -194
  5. package/build/cjs/components/Options/VisualizationOptions.js +3 -1
  6. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuBar.js +107 -0
  7. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuDropdown.js +66 -0
  8. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuList.js +94 -0
  9. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuListItem.js +99 -0
  10. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuListItem.styles.js +13 -0
  11. package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuBar.spec.js +219 -0
  12. package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuDropdown.spec.js +23 -0
  13. package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuList.spec.js +56 -0
  14. package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuListItem.spec.js +50 -0
  15. package/build/cjs/components/Toolbar/HoverMenuBar/index.js +37 -0
  16. package/build/cjs/components/Toolbar/InterpretationsAndDetailsToggler.js +50 -0
  17. package/build/cjs/components/Toolbar/MenuButton.styles.js +13 -0
  18. package/build/cjs/components/Toolbar/Toolbar.js +39 -0
  19. package/build/cjs/components/Toolbar/ToolbarSidebar.js +45 -0
  20. package/build/cjs/components/Toolbar/UpdateButton.js +57 -0
  21. package/build/cjs/components/Toolbar/__tests__/InterpretationsAndDetailsToggler.spec.js +50 -0
  22. package/build/cjs/components/Toolbar/__tests__/Toolbar.spec.js +24 -0
  23. package/build/cjs/components/Toolbar/__tests__/ToolbarSidebar.spec.js +30 -0
  24. package/build/cjs/components/Toolbar/__tests__/UpdateButton.spec.js +44 -0
  25. package/build/cjs/components/Toolbar/index.js +57 -0
  26. package/build/cjs/index.js +304 -46
  27. package/build/cjs/locales/en/translations.json +1 -0
  28. package/build/cjs/locales/es/translations.json +48 -48
  29. package/build/es/__demo__/FileMenu.stories.js +7 -6
  30. package/build/es/__demo__/Toolbar.stories.js +69 -0
  31. package/build/es/components/FileMenu/FileMenu.js +20 -57
  32. package/build/es/components/FileMenu/__tests__/FileMenu.spec.js +293 -189
  33. package/build/es/components/Options/VisualizationOptions.js +3 -1
  34. package/build/es/components/Toolbar/HoverMenuBar/HoverMenuBar.js +90 -0
  35. package/build/es/components/Toolbar/HoverMenuBar/HoverMenuDropdown.js +44 -0
  36. package/build/es/components/Toolbar/HoverMenuBar/HoverMenuList.js +75 -0
  37. package/build/es/components/Toolbar/HoverMenuBar/HoverMenuListItem.js +78 -0
  38. package/build/es/components/Toolbar/HoverMenuBar/HoverMenuListItem.styles.js +4 -0
  39. package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuBar.spec.js +168 -0
  40. package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuDropdown.spec.js +16 -0
  41. package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuList.spec.js +49 -0
  42. package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuListItem.spec.js +41 -0
  43. package/build/es/components/Toolbar/HoverMenuBar/index.js +4 -0
  44. package/build/es/components/Toolbar/InterpretationsAndDetailsToggler.js +33 -0
  45. package/build/es/components/Toolbar/MenuButton.styles.js +4 -0
  46. package/build/es/components/Toolbar/Toolbar.js +24 -0
  47. package/build/es/components/Toolbar/ToolbarSidebar.js +29 -0
  48. package/build/es/components/Toolbar/UpdateButton.js +38 -0
  49. package/build/es/components/Toolbar/__tests__/InterpretationsAndDetailsToggler.spec.js +43 -0
  50. package/build/es/components/Toolbar/__tests__/Toolbar.spec.js +17 -0
  51. package/build/es/components/Toolbar/__tests__/ToolbarSidebar.spec.js +23 -0
  52. package/build/es/components/Toolbar/__tests__/UpdateButton.spec.js +37 -0
  53. package/build/es/components/Toolbar/index.js +5 -0
  54. package/build/es/index.js +1 -0
  55. package/build/es/locales/en/translations.json +1 -0
  56. package/build/es/locales/es/translations.json +48 -48
  57. package/package.json +3 -1
  58. package/CHANGELOG.md +0 -4037
@@ -8,7 +8,7 @@
8
8
  "No description": "Sin descripción",
9
9
  "Last updated {{time}}": "Última actualización {{time}}",
10
10
  "Created {{time}} by {{author}}": "Creado {{time}} por {{author}}",
11
- "Created {{time}}": "",
11
+ "Created {{time}}": "Creado {{time}}",
12
12
  "Viewed {{count}} times": "",
13
13
  "Viewed {{count}} times_plural": "",
14
14
  "Notifications": "Notificaciones",
@@ -16,33 +16,33 @@
16
16
  "Unsubscribe": "Cancelar la suscripción",
17
17
  "Subscribe to get updates about new interpretations.": "Suscríbase para recibir actualizaciones sobre nuevas interpretaciones.",
18
18
  "Subscribe": "Suscribirse",
19
- "About this map": "",
19
+ "About this map": "Acerca de este mapa",
20
20
  "About this line list": "",
21
21
  "About this visualization": "Acerca de esta visualización",
22
22
  "This app could not retrieve required data.": "Esta aplicación no pudo recuperar los datos requeridos.",
23
23
  "Network error": "Error de red",
24
- "Data / Edit calculation": "",
25
- "Data / New calculation": "",
26
- "Remove item": "",
27
- "Check formula": "",
28
- "Calculation name": "",
29
- "Shown in table headers and chart axes/legends": "",
30
- "Delete calculation": "",
24
+ "Data / Edit calculation": "Datos / Editar cálculo",
25
+ "Data / New calculation": "Datos / Nuevo cálculo",
26
+ "Remove item": "Quitar elemento",
27
+ "Check formula": "Comprobar fórmula",
28
+ "Calculation name": "Nombre del cálculo",
29
+ "Shown in table headers and chart axes/legends": "Se muestra en los encabezados de las tablas y en los ejes/leyendas de los gráficos",
30
+ "Delete calculation": "Eliminar cálculo",
31
31
  "Cancel": "Cancelar",
32
- "The calculation can only be saved with a valid formula": "",
33
- "Add a name to save this calculation": "",
34
- "Save calculation": "",
35
- "Are you sure you want to delete this calculation? It may be used by other visualizations.": "",
32
+ "The calculation can only be saved with a valid formula": "El cálculo solo puede guardarse con una fórmula válida",
33
+ "Add a name to save this calculation": "Añadir un nombre para guardar este cálculo",
34
+ "Save calculation": "Guardar cálculo",
35
+ "Are you sure you want to delete this calculation? It may be used by other visualizations.": "¿Está seguro de que desea eliminar este cálculo? Puede ser utilizado por otras visualizaciones.",
36
36
  "Yes, delete": "si, eliminar",
37
37
  "Totals only": "Solo totales",
38
38
  "Details only": "Solo detalles",
39
39
  "Loading": "Cargando",
40
40
  "Data elements": "Elementos de datos",
41
- "Search by data element name": "",
41
+ "Search by data element name": "Búsqueda por nombre de elemento de datos",
42
42
  "No data elements found for \"{{- searchTerm}}\"": "No se han encontrado elementos de datos para \"{{- searchTerm}}\"",
43
43
  "No data elements found": "No se han encontrado elementos de datos",
44
- "Drag items here, or double click in the list, to start building a calculation formula": "",
45
- "Math operators": "",
44
+ "Drag items here, or double click in the list, to start building a calculation formula": "Arrastre elementos aquí, o haga doble clic en la lista, para comenzar a crear una fórmula de cálculo",
45
+ "Math operators": "Operadores matemáticos",
46
46
  "Data Type": "Tipo de datos",
47
47
  "All types": "Todos los tipos",
48
48
  "Disaggregation": "Desagregación",
@@ -51,15 +51,15 @@
51
51
  "No items selected": "No hay elementos seleccionados",
52
52
  "Selected Items": "Elementos seleccionados",
53
53
  "No indicators found": "No se han encontrado indicadores",
54
- "No data sets found": "",
54
+ "No data sets found": "No se han encontrado sets de datos",
55
55
  "No event data items found": "",
56
56
  "No program indicators found": "No se han encontrado indicadores de programa",
57
57
  "No indicators found for \"{{- searchTerm}}\"": "No se han encontrado indicadores para \"{{- searchTerm}}\"",
58
- "No data sets found for \"{{- searchTerm}}\"": "",
58
+ "No data sets found for \"{{- searchTerm}}\"": "No se han encontrado sets de datos para \"{{- searchTerm}}\"",
59
59
  "No event data items found for \"{{- searchTerm}}\"": "",
60
60
  "No program indicators found for \"{{- searchTerm}}\"": "No se han encontrado indicadores de programa para \"{{- searchTerm}}\"",
61
61
  "Nothing found for \"{{- searchTerm}}\"": "No se encontró nada para \"{{- searchTerm}}\"",
62
- "Calculation": "",
62
+ "Calculation": "Cálculo",
63
63
  "Metric type": "Tipo de métrica",
64
64
  "All metrics": "Todas las métricas",
65
65
  "Move to {{axisName}}": "Mover a {{Nombredeleje}}",
@@ -98,7 +98,7 @@
98
98
  "Name": "Nombre",
99
99
  "Description": "Descripción",
100
100
  "Rename": "Renombrar",
101
- "{{- objectName}} (copy)": "",
101
+ "{{- objectName}} (copy)": "{{- objectName}} (copia)",
102
102
  "Save {{fileType}} as": "Guardar {{fileType}} como",
103
103
  "event report": "informe de evento",
104
104
  "line list": "",
@@ -110,10 +110,10 @@
110
110
  "Could not update comment": "No se pudo actualizar el comentario",
111
111
  "Enter comment text": "Introducir el texto del comentario",
112
112
  "Update": "Actualizar",
113
- "Viewing interpretation: {{- visualisationName}}": "",
113
+ "Viewing interpretation: {{- visualisationName}}": "Visualización de la interpretación: {{- visualisationName}}",
114
114
  "Could not load interpretation": "No se pudo cargar la interpretación",
115
- "The interpretation couldn’t be displayed. Try again or contact your system administrator.": "",
116
- "Hide interpretation": "",
115
+ "The interpretation couldn’t be displayed. Try again or contact your system administrator.": "No se ha podido mostrar la interpretación. Vuelva a intentarlo o póngase en contacto con el administrador del sistema.",
116
+ "Hide interpretation": "Ocultar interpretación",
117
117
  "Write an interpretation": "Escribir una interpretación",
118
118
  "Post interpretation": "",
119
119
  "Interpretations": "Interpretaciones",
@@ -121,20 +121,20 @@
121
121
  "Like": "como",
122
122
  "Reply": "Responder",
123
123
  "Share": "Compartir",
124
- "See interpretation": "",
124
+ "See interpretation": "Ver interpretación",
125
125
  "Manage sharing": "Administrar compartir",
126
- "Could not update interpretation": "",
127
- "Enter interpretation text": "",
128
- "Bold text": "",
129
- "Italic text": "",
130
- "Link to a URL": "",
131
- "Mention a user": "",
132
- "Add emoji": "",
133
- "Preview": "",
134
- "Back to write mode": "",
135
- "Too many results. Try refining the search.": "",
136
- "Search for a user": "",
137
- "Searching for \"{{- searchText}}\"": "",
126
+ "Could not update interpretation": "No se pudo actualizar la interpretación",
127
+ "Enter interpretation text": "Introducir el texto de la interpretación",
128
+ "Bold text": "Texto en negrita",
129
+ "Italic text": "Texto en cursiva",
130
+ "Link to a URL": "Enlace a una URL",
131
+ "Mention a user": "Mencionar a un usuario",
132
+ "Add emoji": "Añadir emoji",
133
+ "Preview": "Vista previa",
134
+ "Back to write mode": "Volver al modo de escritura",
135
+ "Too many results. Try refining the search.": "Demasiados resultados. Intenta refinar la búsqueda.",
136
+ "Search for a user": "Buscar un usuario",
137
+ "Searching for \"{{- searchText}}\"": "Buscando \"{{- searchText}}\"",
138
138
  "No results found": "No results found",
139
139
  "Not available offline": "No disponible sin conexión a internet",
140
140
  "Created by": "Creado por",
@@ -273,7 +273,7 @@
273
273
  "Choose a locale to translate from the menu above": "",
274
274
  "Translate: {{objectName}}": "Traducir: {{objectName}}",
275
275
  "Save translations": "Guardar traducciones",
276
- "Cannot save while offline": "",
276
+ "Cannot save while offline": "No se puede guardar sin conexión a internet",
277
277
  "Could not load translations": "No se pudieron cargar las traducciones",
278
278
  "Retry": "Reintentar",
279
279
  "Series": "Series",
@@ -301,8 +301,8 @@
301
301
  "Loading data element groups": "Cargando grupos de elementos de datos",
302
302
  "Data sets": "Sets de datos",
303
303
  "Data set": "Set de Datos\\:",
304
- "All data sets": "",
305
- "Loading data sets": "",
304
+ "All data sets": "Todos los sets de datos",
305
+ "Loading data sets": "Cargando sets de datos",
306
306
  "Event data items": "Datos de eventos",
307
307
  "All programs": "Todos los programas",
308
308
  "Event data item": "Event data item",
@@ -310,15 +310,15 @@
310
310
  "Loading programs": "Cargando programas",
311
311
  "Program indicators": "Indicadores de programa",
312
312
  "Program indicator": "Indicador de Programa",
313
- "Calculations": "",
313
+ "Calculations": "Cálculos",
314
314
  "Number": "Número",
315
- "Formula is empty. Add items to the formula from the lists on the left.": "",
316
- "Consecutive math operators": "",
317
- "Consecutive data elements": "",
318
- "Starts or ends with a math operator": "",
319
- "Empty parentheses": "",
320
- "Missing right parenthesis )": "",
321
- "Missing left parenthesis (": "",
315
+ "Formula is empty. Add items to the formula from the lists on the left.": "La fórmula está vacía. Añada elementos a la fórmula desde las listas de la izquierda.",
316
+ "Consecutive math operators": "Operadores matemáticos consecutivos",
317
+ "Consecutive data elements": "Elementos de datos consecutivos",
318
+ "Starts or ends with a math operator": "Comienza o termina con un operador matemático",
319
+ "Empty parentheses": "Paréntesis vacíos",
320
+ "Missing right parenthesis )": "Falta el paréntesis derecho )",
321
+ "Missing left parenthesis (": "Falta el paréntesis izquierdo (",
322
322
  "Extra Small": "Extra pequeño",
323
323
  "Small": "Pequeña",
324
324
  "Regular": "Normal",
@@ -375,5 +375,5 @@
375
375
  "Axis {{axisId}}": "Eje {{axisId}}",
376
376
  "{{count}} items": "",
377
377
  "{{count}} items_plural": "",
378
- "Reset zoom": ""
378
+ "Reset zoom": "Restablecer zoom"
379
379
  }
@@ -2,6 +2,7 @@ import { Provider } from '@dhis2/app-runtime';
2
2
  import { storiesOf } from '@storybook/react';
3
3
  import React from 'react';
4
4
  import { FileMenu } from '../components/FileMenu/FileMenu.js';
5
+ import { HoverMenuBar } from '../components/Toolbar/index.js';
5
6
  const configMock = {
6
7
  baseUrl: 'http://localhost:8080',
7
8
  apiVersion: 33
@@ -52,19 +53,19 @@ const visReadonlyObject = { ...visObject,
52
53
  };
53
54
  storiesOf('FileMenu', module).add('Simple', () => /*#__PURE__*/React.createElement(Provider, {
54
55
  config: configMock
55
- }, /*#__PURE__*/React.createElement(FileMenu, {
56
+ }, /*#__PURE__*/React.createElement(HoverMenuBar, null, /*#__PURE__*/React.createElement(FileMenu, {
56
57
  currentUser: user,
57
58
  fileType: "visualization"
58
- }))).add('With AO', () => /*#__PURE__*/React.createElement(Provider, {
59
+ })))).add('With AO', () => /*#__PURE__*/React.createElement(Provider, {
59
60
  config: configMock
60
- }, /*#__PURE__*/React.createElement(FileMenu, {
61
+ }, /*#__PURE__*/React.createElement(HoverMenuBar, null, /*#__PURE__*/React.createElement(FileMenu, {
61
62
  currentUser: user,
62
63
  fileType: "visualization",
63
64
  fileObject: visObject
64
- }))).add('With readonly AO', () => /*#__PURE__*/React.createElement(Provider, {
65
+ })))).add('With readonly AO', () => /*#__PURE__*/React.createElement(Provider, {
65
66
  config: configMock
66
- }, /*#__PURE__*/React.createElement(FileMenu, {
67
+ }, /*#__PURE__*/React.createElement(HoverMenuBar, null, /*#__PURE__*/React.createElement(FileMenu, {
67
68
  currentUser: user,
68
69
  fileType: "visualization",
69
70
  fileObject: visReadonlyObject
70
- })));
71
+ }))));
@@ -0,0 +1,69 @@
1
+ import { storiesOf } from '@storybook/react';
2
+ import React, { useState } from 'react';
3
+ import { HoverMenuBar, HoverMenuDropdown, HoverMenuList, HoverMenuListItem, InterpretationsAndDetailsToggler, Toolbar, ToolbarSidebar, UpdateButton } from '../components/Toolbar/index.js';
4
+
5
+ function ToolbarWithState() {
6
+ const [isHidden, setIsHidden] = useState(false);
7
+ const [isSidebarShowing, setIsSidebarShowing] = useState(false);
8
+ return /*#__PURE__*/React.createElement(Toolbar, null, /*#__PURE__*/React.createElement(ToolbarSidebar, {
9
+ isHidden: isHidden
10
+ }, /*#__PURE__*/React.createElement("span", null, "Toolbar side bar"), /*#__PURE__*/React.createElement("a", {
11
+ style: {
12
+ paddingLeft: 12,
13
+ textDecoration: 'underline',
14
+ cursor: 'pointer'
15
+ },
16
+ onClick: () => setIsHidden(true)
17
+ }, "click to hide")), /*#__PURE__*/React.createElement(UpdateButton, null), /*#__PURE__*/React.createElement(HoverMenuBar, null, /*#__PURE__*/React.createElement(HoverMenuDropdown, {
18
+ label: "Menu A"
19
+ }, /*#__PURE__*/React.createElement(HoverMenuList, null, /*#__PURE__*/React.createElement(HoverMenuListItem, {
20
+ label: "Menu item A.1"
21
+ }), /*#__PURE__*/React.createElement(HoverMenuListItem, {
22
+ label: "Menu item A.2"
23
+ }), /*#__PURE__*/React.createElement(HoverMenuListItem, {
24
+ label: "Menu item A.3"
25
+ }))), /*#__PURE__*/React.createElement(HoverMenuDropdown, {
26
+ label: "Menu B"
27
+ }, /*#__PURE__*/React.createElement(HoverMenuList, null, /*#__PURE__*/React.createElement(HoverMenuListItem, {
28
+ label: "Menu item B.1"
29
+ }, /*#__PURE__*/React.createElement(HoverMenuListItem, {
30
+ label: "Menu item B.1.1"
31
+ }), /*#__PURE__*/React.createElement(HoverMenuListItem, {
32
+ label: "Menu item B.1.2"
33
+ }), /*#__PURE__*/React.createElement(HoverMenuListItem, {
34
+ label: "Menu item B.1.3"
35
+ })), /*#__PURE__*/React.createElement(HoverMenuListItem, {
36
+ label: "Menu item B.2"
37
+ }, /*#__PURE__*/React.createElement(HoverMenuListItem, {
38
+ label: "Menu item B.2.1"
39
+ }), /*#__PURE__*/React.createElement(HoverMenuListItem, {
40
+ label: "Menu item B.2.2"
41
+ }), /*#__PURE__*/React.createElement(HoverMenuListItem, {
42
+ label: "Menu item B.2.3"
43
+ })), /*#__PURE__*/React.createElement(HoverMenuListItem, {
44
+ label: "Menu item B.3",
45
+ disabled: true
46
+ }, /*#__PURE__*/React.createElement(HoverMenuListItem, {
47
+ label: "Menu item B.3.1"
48
+ }), /*#__PURE__*/React.createElement(HoverMenuListItem, {
49
+ label: "Menu item B.3.2"
50
+ }), /*#__PURE__*/React.createElement(HoverMenuListItem, {
51
+ label: "Menu item B.3.3"
52
+ })))), /*#__PURE__*/React.createElement(HoverMenuDropdown, {
53
+ label: "Menu C",
54
+ disabled: true
55
+ }, /*#__PURE__*/React.createElement(HoverMenuList, null, /*#__PURE__*/React.createElement(HoverMenuListItem, {
56
+ label: "Menu item C.1"
57
+ }), /*#__PURE__*/React.createElement(HoverMenuListItem, {
58
+ label: "Menu item C.2"
59
+ }), /*#__PURE__*/React.createElement(HoverMenuListItem, {
60
+ label: "Menu item C.3"
61
+ })))), /*#__PURE__*/React.createElement(InterpretationsAndDetailsToggler, {
62
+ isShowing: isSidebarShowing,
63
+ onClick: () => setIsSidebarShowing(current => !current)
64
+ }));
65
+ }
66
+
67
+ storiesOf('Toolbar', module).add('default', () => {
68
+ return /*#__PURE__*/React.createElement(ToolbarWithState, null);
69
+ });
@@ -1,12 +1,11 @@
1
- import _JSXStyle from "styled-jsx/style";
2
- import { IconAdd24, IconLaunch24, IconSave24, IconEdit24, IconTranslate24, IconShare24, IconLink24, IconDelete24, SharingDialog, colors, FlyoutMenu, Layer, MenuItem, MenuDivider, Popper } from '@dhis2/ui';
1
+ import { IconAdd24, IconLaunch24, IconSave24, IconEdit24, IconTranslate24, IconShare24, IconLink24, IconDelete24, SharingDialog, colors, MenuDivider } from '@dhis2/ui';
3
2
  import PropTypes from 'prop-types';
4
- import React, { createRef, useState } from 'react';
3
+ import React, { useState } from 'react';
5
4
  import i18n from '../../locales/index.js';
6
5
  import { OpenFileDialog } from '../OpenFileDialog/OpenFileDialog.js';
6
+ import { HoverMenuListItem, HoverMenuList, HoverMenuDropdown } from '../Toolbar/index.js';
7
7
  import { TranslationDialog } from '../TranslationDialog/index.js';
8
8
  import { DeleteDialog } from './DeleteDialog.js';
9
- import { fileMenuStyles } from './FileMenu.styles.js';
10
9
  import { GetLinkDialog } from './GetLinkDialog.js';
11
10
  import { RenameDialog } from './RenameDialog.js';
12
11
  import { SaveAsDialog } from './SaveAsDialog.js';
@@ -30,24 +29,14 @@ export const FileMenu = _ref => {
30
29
  onError,
31
30
  onTranslate
32
31
  } = _ref;
33
- const [menuIsOpen, setMenuIsOpen] = useState(false);
34
- const [currentDialog, setCurrentDialog] = useState(null); // Escape key press closes the menu
35
-
36
- const onKeyDown = e => {
37
- if ((e === null || e === void 0 ? void 0 : e.keyCode) === 27) {
38
- setMenuIsOpen(false);
39
- }
40
- };
32
+ const [currentDialog, setCurrentDialog] = useState(null);
41
33
 
42
34
  const onMenuItemClick = dialogToOpen => () => {
43
- setMenuIsOpen(false);
44
35
  setCurrentDialog(dialogToOpen);
45
36
  };
46
37
 
47
38
  const onDialogClose = () => setCurrentDialog(null);
48
39
 
49
- const toggleMenu = () => setMenuIsOpen(!menuIsOpen);
50
-
51
40
  const onDeleteConfirm = () => {
52
41
  // The dialog must be closed before calling the callback
53
42
  // otherwise the fileObject is changed to null before the
@@ -57,8 +46,6 @@ export const FileMenu = _ref => {
57
46
  onDelete();
58
47
  };
59
48
 
60
- const buttonRef = /*#__PURE__*/createRef();
61
-
62
49
  const renderDialog = () => {
63
50
  switch (currentDialog) {
64
51
  case 'rename':
@@ -120,19 +107,7 @@ export const FileMenu = _ref => {
120
107
 
121
108
  const iconActiveColor = colors.grey700;
122
109
  const iconInactiveColor = colors.grey500;
123
- return /*#__PURE__*/React.createElement("div", {
124
- onKeyDown: onKeyDown,
125
- className: "jsx-".concat(fileMenuStyles.__hash)
126
- }, /*#__PURE__*/React.createElement(_JSXStyle, {
127
- id: fileMenuStyles.__hash
128
- }, fileMenuStyles), /*#__PURE__*/React.createElement("div", {
129
- ref: buttonRef,
130
- className: "jsx-".concat(fileMenuStyles.__hash)
131
- }, /*#__PURE__*/React.createElement("button", {
132
- onClick: toggleMenu,
133
- "data-test": "file-menu-toggle",
134
- className: "jsx-".concat(fileMenuStyles.__hash) + " " + "menu-toggle"
135
- }, i18n.t('File'))), /*#__PURE__*/React.createElement(OpenFileDialog, {
110
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(OpenFileDialog, {
136
111
  open: currentDialog === 'open',
137
112
  type: fileType,
138
113
  filterVisTypes: filterVisTypes,
@@ -144,45 +119,33 @@ export const FileMenu = _ref => {
144
119
  },
145
120
  onNew: onNew,
146
121
  currentUser: currentUser
147
- }), menuIsOpen && /*#__PURE__*/React.createElement(Layer, {
148
- onBackdropClick: toggleMenu,
149
- position: "fixed",
150
- level: 2000,
151
- dataTest: "file-menu-toggle-layer"
152
- }, /*#__PURE__*/React.createElement(Popper, {
153
- reference: buttonRef,
154
- placement: "bottom-start"
155
- }, /*#__PURE__*/React.createElement(FlyoutMenu, {
122
+ }), /*#__PURE__*/React.createElement(HoverMenuDropdown, {
123
+ label: i18n.t('File')
124
+ }, /*#__PURE__*/React.createElement(HoverMenuList, {
156
125
  dataTest: "file-menu-container"
157
- }, /*#__PURE__*/React.createElement(MenuItem, {
126
+ }, /*#__PURE__*/React.createElement(HoverMenuListItem, {
158
127
  label: i18n.t('New'),
159
128
  icon: /*#__PURE__*/React.createElement(IconAdd24, {
160
129
  color: iconActiveColor
161
130
  }),
162
- onClick: () => {
163
- toggleMenu();
164
- onNew();
165
- },
131
+ onClick: onNew,
166
132
  dataTest: "file-menu-new"
167
- }), /*#__PURE__*/React.createElement(MenuDivider, null), /*#__PURE__*/React.createElement(MenuItem, {
133
+ }), /*#__PURE__*/React.createElement(MenuDivider, null), /*#__PURE__*/React.createElement(HoverMenuListItem, {
168
134
  label: i18n.t('Open…'),
169
135
  icon: /*#__PURE__*/React.createElement(IconLaunch24, {
170
136
  color: iconActiveColor
171
137
  }),
172
138
  onClick: onMenuItemClick('open'),
173
139
  dataTest: "file-menu-open"
174
- }), /*#__PURE__*/React.createElement(MenuItem, {
140
+ }), /*#__PURE__*/React.createElement(HoverMenuListItem, {
175
141
  label: fileObject !== null && fileObject !== void 0 && fileObject.id ? i18n.t('Save') : i18n.t('Save…'),
176
142
  icon: /*#__PURE__*/React.createElement(IconSave24, {
177
143
  color: !onSave || !(!(fileObject !== null && fileObject !== void 0 && fileObject.id) || fileObject !== null && fileObject !== void 0 && (_fileObject$access = fileObject.access) !== null && _fileObject$access !== void 0 && _fileObject$access.update) ? iconInactiveColor : iconActiveColor
178
144
  }),
179
145
  disabled: !onSave || !(!(fileObject !== null && fileObject !== void 0 && fileObject.id) || fileObject !== null && fileObject !== void 0 && (_fileObject$access2 = fileObject.access) !== null && _fileObject$access2 !== void 0 && _fileObject$access2.update),
180
- onClick: fileObject !== null && fileObject !== void 0 && fileObject.id ? () => {
181
- toggleMenu();
182
- onSave();
183
- } : onMenuItemClick('saveas'),
146
+ onClick: fileObject !== null && fileObject !== void 0 && fileObject.id ? onSave : onMenuItemClick('saveas'),
184
147
  dataTest: "file-menu-save"
185
- }), /*#__PURE__*/React.createElement(MenuItem, {
148
+ }), /*#__PURE__*/React.createElement(HoverMenuListItem, {
186
149
  label: i18n.t('Save as…'),
187
150
  icon: /*#__PURE__*/React.createElement(IconSave24, {
188
151
  color: !(onSaveAs && fileObject !== null && fileObject !== void 0 && fileObject.id) ? iconInactiveColor : iconActiveColor
@@ -190,7 +153,7 @@ export const FileMenu = _ref => {
190
153
  disabled: !(onSaveAs && fileObject !== null && fileObject !== void 0 && fileObject.id),
191
154
  onClick: onMenuItemClick('saveas'),
192
155
  dataTest: "file-menu-saveas"
193
- }), /*#__PURE__*/React.createElement(MenuItem, {
156
+ }), /*#__PURE__*/React.createElement(HoverMenuListItem, {
194
157
  label: i18n.t('Rename…'),
195
158
  icon: /*#__PURE__*/React.createElement(IconEdit24, {
196
159
  color: fileObject !== null && fileObject !== void 0 && fileObject.id && fileObject !== null && fileObject !== void 0 && (_fileObject$access3 = fileObject.access) !== null && _fileObject$access3 !== void 0 && _fileObject$access3.update ? iconActiveColor : iconInactiveColor
@@ -198,7 +161,7 @@ export const FileMenu = _ref => {
198
161
  disabled: !(fileObject !== null && fileObject !== void 0 && fileObject.id && fileObject !== null && fileObject !== void 0 && (_fileObject$access4 = fileObject.access) !== null && _fileObject$access4 !== void 0 && _fileObject$access4.update),
199
162
  onClick: onMenuItemClick('rename'),
200
163
  dataTest: "file-menu-rename"
201
- }), /*#__PURE__*/React.createElement(MenuItem, {
164
+ }), /*#__PURE__*/React.createElement(HoverMenuListItem, {
202
165
  label: i18n.t('Translate…'),
203
166
  icon: /*#__PURE__*/React.createElement(IconTranslate24, {
204
167
  color: fileObject !== null && fileObject !== void 0 && fileObject.id && fileObject !== null && fileObject !== void 0 && (_fileObject$access5 = fileObject.access) !== null && _fileObject$access5 !== void 0 && _fileObject$access5.update ? iconActiveColor : iconInactiveColor
@@ -206,7 +169,7 @@ export const FileMenu = _ref => {
206
169
  disabled: !(fileObject !== null && fileObject !== void 0 && fileObject.id && fileObject !== null && fileObject !== void 0 && (_fileObject$access6 = fileObject.access) !== null && _fileObject$access6 !== void 0 && _fileObject$access6.update),
207
170
  onClick: onMenuItemClick('translate'),
208
171
  dataTest: "file-menu-translate"
209
- }), /*#__PURE__*/React.createElement(MenuDivider, null), /*#__PURE__*/React.createElement(MenuItem, {
172
+ }), /*#__PURE__*/React.createElement(MenuDivider, null), /*#__PURE__*/React.createElement(HoverMenuListItem, {
210
173
  label: i18n.t('Share…'),
211
174
  icon: /*#__PURE__*/React.createElement(IconShare24, {
212
175
  color: fileObject !== null && fileObject !== void 0 && fileObject.id && fileObject !== null && fileObject !== void 0 && (_fileObject$access7 = fileObject.access) !== null && _fileObject$access7 !== void 0 && _fileObject$access7.manage ? iconActiveColor : iconInactiveColor
@@ -214,7 +177,7 @@ export const FileMenu = _ref => {
214
177
  disabled: !(fileObject !== null && fileObject !== void 0 && fileObject.id && fileObject !== null && fileObject !== void 0 && (_fileObject$access8 = fileObject.access) !== null && _fileObject$access8 !== void 0 && _fileObject$access8.manage),
215
178
  onClick: onMenuItemClick('sharing'),
216
179
  dataTest: "file-menu-sharing"
217
- }), /*#__PURE__*/React.createElement(MenuItem, {
180
+ }), /*#__PURE__*/React.createElement(HoverMenuListItem, {
218
181
  label: i18n.t('Get link…'),
219
182
  icon: /*#__PURE__*/React.createElement(IconLink24, {
220
183
  color: fileObject !== null && fileObject !== void 0 && fileObject.id ? iconActiveColor : iconInactiveColor
@@ -222,7 +185,7 @@ export const FileMenu = _ref => {
222
185
  disabled: !(fileObject !== null && fileObject !== void 0 && fileObject.id),
223
186
  onClick: onMenuItemClick('getlink'),
224
187
  dataTest: "file-menu-getlink"
225
- }), /*#__PURE__*/React.createElement(MenuDivider, null), /*#__PURE__*/React.createElement(MenuItem, {
188
+ }), /*#__PURE__*/React.createElement(MenuDivider, null), /*#__PURE__*/React.createElement(HoverMenuListItem, {
226
189
  label: i18n.t('Delete'),
227
190
  destructive: true,
228
191
  icon: /*#__PURE__*/React.createElement(IconDelete24, {
@@ -231,7 +194,7 @@ export const FileMenu = _ref => {
231
194
  disabled: !(fileObject !== null && fileObject !== void 0 && fileObject.id && fileObject !== null && fileObject !== void 0 && (_fileObject$access10 = fileObject.access) !== null && _fileObject$access10 !== void 0 && _fileObject$access10.delete),
232
195
  onClick: onMenuItemClick('delete'),
233
196
  dataTest: "file-menu-delete"
234
- })))), renderDialog());
197
+ }))), renderDialog());
235
198
  };
236
199
  FileMenu.defaultProps = {
237
200
  onDelete: Function.prototype,