@centreon/ui 24.4.1-SAAS-1230.0 → 24.4.1-fix-component-tests-24-04.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 (140) hide show
  1. package/package.json +48 -40
  2. package/src/ActionsList/ActionsList.styles.ts +40 -71
  3. package/src/Dashboard/Dashboard.styles.ts +6 -5
  4. package/src/Dialog/Confirm/index.tsx +10 -2
  5. package/src/Dialog/UnsavedChanges/index.tsx +21 -20
  6. package/src/Dialog/UnsavedChanges/translatedLabels.ts +4 -6
  7. package/src/Dialog/index.tsx +8 -1
  8. package/src/Form/Inputs/CheckboxGroup.tsx +4 -1
  9. package/src/Form/Inputs/Text.tsx +3 -1
  10. package/src/Form/Inputs/models.ts +1 -0
  11. package/src/Graph/BarStack/BarStack.cypress.spec.tsx +139 -0
  12. package/src/Graph/BarStack/BarStack.stories.tsx +123 -0
  13. package/src/Graph/BarStack/BarStack.styles.ts +37 -0
  14. package/src/Graph/BarStack/BarStack.tsx +14 -0
  15. package/src/Graph/BarStack/ResponsiveBarStack.tsx +209 -0
  16. package/src/Graph/BarStack/index.ts +1 -0
  17. package/src/Graph/BarStack/models.ts +19 -0
  18. package/src/Graph/BarStack/useResponsiveBarStack.ts +131 -0
  19. package/src/Graph/Gauge/Gauge.cypress.spec.tsx +102 -0
  20. package/src/Graph/Gauge/Gauge.tsx +1 -1
  21. package/src/Graph/HeatMap/HeatMap.cypress.spec.tsx +145 -0
  22. package/src/Graph/HeatMap/HeatMap.stories.tsx +0 -25
  23. package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +8 -2
  24. package/src/Graph/Legend/Legend.tsx +21 -0
  25. package/src/Graph/Legend/index.ts +1 -0
  26. package/src/Graph/Legend/models.ts +11 -0
  27. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/index.tsx +4 -5
  28. package/src/Graph/LineChart/BasicComponents/ThresholdLine.tsx +3 -1
  29. package/src/Graph/LineChart/Header/index.tsx +3 -31
  30. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTickGraph.ts +9 -11
  31. package/src/Graph/LineChart/InteractiveComponents/Annotations/Annotation/index.tsx +3 -2
  32. package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx +68 -0
  33. package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +27 -0
  34. package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltipStyles.ts +31 -0
  35. package/src/Graph/LineChart/InteractiveComponents/index.tsx +132 -17
  36. package/src/Graph/LineChart/InteractiveComponents/interactionWithGraphAtoms.ts +7 -27
  37. package/src/Graph/LineChart/Legend/Legend.styles.ts +4 -8
  38. package/src/Graph/LineChart/Legend/LegendHeader.tsx +10 -22
  39. package/src/Graph/LineChart/Legend/index.tsx +10 -47
  40. package/src/Graph/LineChart/LineChart.cypress.spec.tsx +91 -0
  41. package/src/Graph/LineChart/LineChart.styles.ts +8 -0
  42. package/src/Graph/LineChart/LineChart.tsx +102 -115
  43. package/src/Graph/LineChart/LoadingSkeleton.tsx +2 -2
  44. package/src/Graph/LineChart/index.tsx +2 -6
  45. package/src/Graph/LineChart/mockedData/lastDayWithIncompleteValues.json +1320 -0
  46. package/src/Graph/LineChart/mockedData/lastDayWithNullValues.json +1314 -0
  47. package/src/Graph/LineChart/models.ts +12 -1
  48. package/src/Graph/PieChart/PieChart.cypress.spec.tsx +154 -0
  49. package/src/Graph/PieChart/PieChart.stories.tsx +194 -0
  50. package/src/Graph/PieChart/PieChart.styles.ts +39 -0
  51. package/src/Graph/PieChart/PieChart.tsx +14 -0
  52. package/src/Graph/PieChart/ResponsivePie.tsx +243 -0
  53. package/src/Graph/PieChart/index.ts +1 -0
  54. package/src/Graph/PieChart/models.ts +19 -0
  55. package/src/Graph/PieChart/useResponsivePie.ts +81 -0
  56. package/src/Graph/SingleBar/SingleBar.cypress.spec.tsx +121 -0
  57. package/src/Graph/Text/Text.cypress.spec.tsx +101 -0
  58. package/src/Graph/Text/Text.styles.ts +12 -1
  59. package/src/Graph/Text/Text.tsx +17 -12
  60. package/src/Graph/Tree/DescendantNodes.tsx +88 -0
  61. package/src/Graph/Tree/Links.tsx +64 -0
  62. package/src/Graph/Tree/StandaloneTree.tsx +32 -0
  63. package/src/Graph/Tree/Tree.cypress.spec.tsx +171 -0
  64. package/src/Graph/Tree/Tree.stories.tsx +144 -0
  65. package/src/Graph/Tree/Tree.tsx +116 -0
  66. package/src/Graph/Tree/constants.ts +2 -0
  67. package/src/Graph/Tree/index.ts +4 -0
  68. package/src/Graph/Tree/models.ts +52 -0
  69. package/src/Graph/Tree/stories/contents.tsx +164 -0
  70. package/src/Graph/Tree/stories/datas.ts +305 -0
  71. package/src/Graph/Tree/utils.ts +49 -0
  72. package/src/Graph/common/testUtils.ts +71 -0
  73. package/src/Graph/common/timeSeries/index.ts +50 -12
  74. package/src/Graph/common/utils.ts +19 -0
  75. package/src/Graph/index.ts +4 -0
  76. package/src/InputField/Select/Autocomplete/Multi/index.tsx +4 -2
  77. package/src/InputField/Select/Autocomplete/index.tsx +10 -3
  78. package/src/InputField/Select/index.tsx +14 -1
  79. package/src/Listing/ActionBar/index.tsx +9 -8
  80. package/src/Listing/Cell/DataCell.styles.ts +3 -0
  81. package/src/Listing/Cell/DataCell.tsx +8 -4
  82. package/src/Listing/Listing.cypress.spec.tsx +218 -33
  83. package/src/Listing/Listing.styles.ts +3 -5
  84. package/src/Listing/Row/Row.tsx +7 -3
  85. package/src/Listing/index.stories.tsx +25 -2
  86. package/src/Listing/index.test.tsx +1 -1
  87. package/src/Listing/index.tsx +79 -34
  88. package/src/Listing/models.ts +1 -0
  89. package/src/Listing/useStyleTable.ts +1 -0
  90. package/src/PopoverMenu/index.tsx +6 -5
  91. package/src/ThemeProvider/index.tsx +3 -0
  92. package/src/TopCounterElements/TopCounterLayout.tsx +3 -0
  93. package/src/TopCounterElements/useCloseOnLegacyPage.tsx +39 -0
  94. package/src/Typography/FluidTypography/FluidTypography.cypress.spec.tsx +27 -0
  95. package/src/Typography/FluidTypography/index.stories.tsx +2 -2
  96. package/src/Typography/FluidTypography/index.tsx +21 -28
  97. package/src/api/index.ts +3 -3
  98. package/src/components/DataTable/DataTable.cypress.spec.tsx +14 -33
  99. package/src/components/DataTable/Item/DataTableItem.tsx +4 -60
  100. package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +13 -13
  101. package/src/components/Form/AccessRights/ShareInput/ContactSwitch.tsx +3 -3
  102. package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +1 -0
  103. package/src/components/Form/AccessRights/storiesData.ts +22 -22
  104. package/src/components/Form/Dashboard/DashboardDuplicationForm.tsx +85 -0
  105. package/src/components/Form/Dashboard/index.ts +1 -0
  106. package/src/components/Form/FormActions.tsx +7 -2
  107. package/src/components/ItemComposition/ItemComposition.styles.ts +2 -2
  108. package/src/components/List/Item/ListItem.tsx +3 -3
  109. package/src/components/Modal/ConfirmationModal/ConfirmationModal.cypress.spec.tsx +168 -0
  110. package/src/components/Modal/ConfirmationModal/ConfirmationModal.stories.tsx +62 -0
  111. package/src/components/Modal/ConfirmationModal/ConfirmationModal.tsx +87 -0
  112. package/src/components/Modal/Modal.styles.ts +8 -3
  113. package/src/components/Modal/index.ts +2 -0
  114. package/src/components/Zoom/Minimap.tsx +127 -0
  115. package/src/components/Zoom/Zoom.cypress.spec.tsx +246 -0
  116. package/src/components/Zoom/Zoom.stories.tsx +115 -0
  117. package/src/components/Zoom/Zoom.styles.tsx +68 -0
  118. package/src/components/Zoom/Zoom.tsx +61 -0
  119. package/src/components/Zoom/ZoomContent.tsx +167 -0
  120. package/src/components/Zoom/constants.ts +2 -0
  121. package/src/components/Zoom/localPoint.ts +51 -0
  122. package/src/components/Zoom/models.ts +25 -0
  123. package/src/components/Zoom/useMinimap.ts +156 -0
  124. package/src/components/Zoom/useZoom.ts +70 -0
  125. package/src/components/Zoom/utils.ts +55 -0
  126. package/src/components/index.ts +1 -0
  127. package/src/utils/index.ts +1 -0
  128. package/src/utils/useFullscreen/Fullscreen.cypress.spec.tsx +130 -0
  129. package/src/utils/useFullscreen/atoms.ts +3 -0
  130. package/src/utils/useFullscreen/index.ts +2 -0
  131. package/src/utils/useFullscreen/translatedLabels.ts +1 -0
  132. package/src/utils/useFullscreen/useFullscreen.ts +73 -0
  133. package/src/utils/useFullscreen/useFullscreenListener.ts +62 -0
  134. package/src/utils/useInfiniteScrollListing.ts +4 -1
  135. package/src/Graph/LineChart/BasicComponents/LoadingProgress.tsx +0 -46
  136. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/TooltipAnchorPoint.tsx +0 -96
  137. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTooltipAnchorPoint.ts +0 -107
  138. package/src/Graph/LineChart/Legend/InteractiveValue.tsx +0 -22
  139. package/src/Graph/LineChart/Legend/useInteractiveValues.ts +0 -99
  140. package/src/Typography/FluidTypography/useFluidResizeObserver.ts +0 -56
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "24.4.1-SAAS-1230.0",
3
+ "version": "24.4.1-fix-component-tests-24-04.0",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
+ "update:deps": "pnpx npm-check-updates -i --format group",
6
7
  "eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
7
8
  "eslint:fix": "pnpm eslint --fix",
8
9
  "storybook": "storybook dev -p 9001 -c .storybook",
@@ -28,6 +29,7 @@
28
29
  "author": {
29
30
  "name": "centreon@centreon.com"
30
31
  },
32
+ "baseCodeCoveragePercentage": 60,
31
33
  "license": "GPL-2.0",
32
34
  "bugs": {
33
35
  "url": "https://github.com/centreon/centreon/issues"
@@ -47,11 +49,11 @@
47
49
  "test/*"
48
50
  ],
49
51
  "devDependencies": {
50
- "@cypress/react": "^7.0.2",
51
- "@cypress/webpack-dev-server": "^3.2.3",
52
- "@faker-js/faker": "^8.0.2",
53
- "@mdx-js/react": "^2.1.4",
54
- "@simonsmith/cypress-image-snapshot": "^6.1.0",
52
+ "@cypress/react": "^8.0.0",
53
+ "@cypress/webpack-dev-server": "^3.7.4",
54
+ "@faker-js/faker": "^8.4.1",
55
+ "@mdx-js/react": "^3.0.1",
56
+ "@simonsmith/cypress-image-snapshot": "^9.0.1",
55
57
  "@storybook/addon-a11y": "^7.0.9",
56
58
  "@storybook/addon-docs": "^7.0.9",
57
59
  "@storybook/addon-essentials": "^7.0.9",
@@ -61,27 +63,26 @@
61
63
  "@storybook/builder-vite": "^7.0.9",
62
64
  "@storybook/jest": "^0.1.0",
63
65
  "@storybook/manager-api": "^7.0.9",
64
- "@storybook/mdx2-csf": "^1.0.0",
66
+ "@storybook/mdx2-csf": "^1.1.0",
65
67
  "@storybook/preview-api": "^7.0.9",
66
68
  "@storybook/react": "^7.0.9",
67
69
  "@storybook/react-vite": "^7.0.9",
68
- "@storybook/test-runner": "^0.10.0",
70
+ "@storybook/test-runner": "^0.16.0",
69
71
  "@storybook/testing-library": "^0.1.0",
70
72
  "@storybook/theming": "^7.0.9",
71
73
  "@testing-library/cypress": "^8.0.7",
72
74
  "@testing-library/jest-dom": "^5.16.5",
73
75
  "@testing-library/react": "^13.4.0",
74
76
  "@testing-library/react-hooks": "^8.0.1",
75
- "@types/cypress": "^1.1.3",
76
- "@types/jest": "^27.5.0",
77
+ "@types/jest": "^29.5.12",
77
78
  "@types/mocha": "^10.0.6",
78
- "@types/ramda": "^0.29.6",
79
- "@types/react": "^18.0.26",
80
- "@types/testing-library__jest-dom": "^5.14.6",
81
- "@vitejs/plugin-react": "^4.0.0",
82
- "@vitejs/plugin-react-swc": "^3.3.0",
83
- "axios-mock-adapter": "^1.21.4",
84
- "cypress": "^13.3.1",
79
+ "@types/ramda": "^0.29.9",
80
+ "@types/react": "^18.2.65",
81
+ "@types/testing-library__jest-dom": "^6.0.0",
82
+ "@vitejs/plugin-react": "^4.2.1",
83
+ "@vitejs/plugin-react-swc": "^3.6.0",
84
+ "axios-mock-adapter": "^1.22.0",
85
+ "cypress": "^13.7.1",
85
86
  "identity-obj-proxy": "^3.0.0",
86
87
  "jest-transform-stub": "^2.0.0",
87
88
  "mochawesome": "^7.1.3",
@@ -92,46 +93,53 @@
92
93
  "react-dom": "^18.2.0",
93
94
  "react-test-renderer": "^18.2.0",
94
95
  "remark-gfm": "^3.0.1",
95
- "sass": "^1.62.1",
96
96
  "speed-measure-vite-plugin": "^0.1.2",
97
- "storybook": "^7.0.9",
98
- "storybook-addon-mock": "^4.0.0",
99
- "storybook-dark-mode": "^3.0.0",
100
- "style-dictionary": "^3.8.0",
101
- "ts-node": "^10.9.1",
97
+ "storybook": "^7.6.8",
98
+ "storybook-addon-mock": "^4.3.0",
99
+ "storybook-dark-mode": "^3.0.3",
100
+ "style-dictionary": "^3.9.2",
101
+ "ts-node": "^10.9.2",
102
102
  "use-resize-observer": "^9.1.0",
103
103
  "vite": "^4.3.5",
104
104
  "vite-plugin-istanbul": "^5.0.0",
105
105
  "vite-plugin-svgr": "^3.2.0",
106
- "vite-plugin-turbosnap": "^1.0.2"
106
+ "vite-plugin-turbosnap": "^1.0.3"
107
107
  },
108
108
  "dependencies": {
109
- "@lexical/html": "^0.12.2",
110
- "@lexical/link": "^0.12.2",
111
- "@lexical/list": "^0.12.2",
112
- "@lexical/react": "^0.12.2",
113
- "@lexical/rich-text": "^0.12.2",
114
- "@lexical/selection": "^0.12.2",
115
- "@lexical/utils": "^0.12.2",
109
+ "@lexical/html": "^0.12.6",
110
+ "@lexical/link": "^0.12.6",
111
+ "@lexical/list": "^0.12.6",
112
+ "@lexical/react": "^0.12.6",
113
+ "@lexical/rich-text": "^0.12.6",
114
+ "@lexical/selection": "^0.12.6",
115
+ "@lexical/utils": "^0.12.6",
116
116
  "@react-spring/web": "^9.7.3",
117
+ "@visx/clip-path": "^3.3.0",
117
118
  "@visx/curve": "^2.1.0",
119
+ "@visx/event": "^3.3.0",
118
120
  "@visx/group": "^3.3.0",
119
- "@visx/pattern": "^3.0.0",
120
- "@visx/scale": "^3.0.0",
121
- "@visx/shape": "^2.12.2",
121
+ "@visx/hierarchy": "^3.3.0",
122
+ "@visx/legend": "^3.5.0",
123
+ "@visx/pattern": "^3.3.0",
124
+ "@visx/point": "^3.3.0",
125
+ "@visx/scale": "^3.5.0",
126
+ "@visx/shape": "^2.18.0",
127
+ "@visx/text": "^3.3.0",
122
128
  "@visx/threshold": "^2.12.2",
123
129
  "@visx/visx": "2.16.0",
130
+ "@visx/zoom": "^3.3.0",
124
131
  "anylogger": "^1.0.11",
125
- "d3-array": "3.2.0",
126
- "humanize-duration": "^3.27.3",
127
- "lexical": "^0.12.2",
132
+ "d3-array": "3.2.4",
133
+ "humanize-duration": "^3.31.0",
134
+ "lexical": "^0.12.6",
128
135
  "notistack": "^3.0.1",
136
+ "numeral": "^2.0.6",
129
137
  "ramda": "0.29.1",
130
- "react-grid-layout": "^1.3.4",
138
+ "react-grid-layout": "^1.4.4",
131
139
  "react-html-parser": "^2.0.2",
132
140
  "react-resizable": "^3.0.5",
133
141
  "react-transition-group": "^4.4.5",
134
- "sanitize-html": "^2.10.0",
142
+ "sanitize-html": "^2.12.1",
135
143
  "ulog": "^2.0.0-beta.19"
136
144
  },
137
145
  "peerDependencies": {
@@ -143,7 +151,7 @@
143
151
  "@mui/material": "5.x",
144
152
  "@mui/styles": "5.x",
145
153
  "@tanstack/react-query": "5.x",
146
- "axios": "0.x",
154
+ "axios": ">= 1.6.4",
147
155
  "dayjs": "1.x",
148
156
  "formik": "2.x",
149
157
  "jotai": "2.x",
@@ -1,7 +1,7 @@
1
1
  import { makeStyles } from 'tss-react/mui';
2
2
  import { equals } from 'ramda';
3
3
 
4
- import { Theme, alpha } from '@mui/material';
4
+ import { Theme } from '@mui/material';
5
5
 
6
6
  interface GetBackgroundAndColorProps {
7
7
  status: string;
@@ -18,96 +18,65 @@ export const useStyles = makeStyles()((theme) => ({
18
18
  '& .MuiListItemText-secondary': {
19
19
  textWrap: 'pretty'
20
20
  },
21
- '&[data-variant="error"]': {
21
+
22
+ '&:hover': {
22
23
  '& .MuiListItemIcon-root': {
23
- color: getColor({ status: 'error', theme })
24
- },
24
+ color: getColor({ status: 'info', theme })
25
+ }
26
+ },
27
+ '&[data-variant="error"]': {
25
28
  '&:hover': {
26
- background: alpha(
27
- theme.palette.error.main,
28
- theme.palette.action.focusOpacity
29
- ),
30
- color: getColor({ status: 'error', theme })
31
- },
32
- color: theme.palette.error.main
29
+ '& .MuiListItemIcon-root': {
30
+ color: getColor({ status: 'error', theme })
31
+ }
32
+ }
33
33
  },
34
34
  '&[data-variant="info"]': {
35
- '& .MuiListItemIcon-root': {
36
- color: getColor({ status: 'info', theme })
37
- },
38
35
  '&:hover': {
39
- background: alpha(
40
- theme.palette.info.main,
41
- theme.palette.action.focusOpacity
42
- ),
43
- color: getColor({ status: 'info', theme })
44
- },
45
- color: theme.palette.info.main
36
+ '& .MuiListItemIcon-root': {
37
+ color: getColor({ status: 'info', theme })
38
+ }
39
+ }
46
40
  },
41
+
47
42
  '&[data-variant="pending"]': {
48
- '& .MuiListItemIcon-root': {
49
- color: getColor({ status: 'pending', theme })
50
- },
51
43
  '&:hover': {
52
- background: alpha(
53
- theme.palette.pending.main,
54
- theme.palette.action.focusOpacity
55
- ),
56
- color: getColor({ status: 'pending', theme })
57
- },
58
- color: theme.palette.pending.main
44
+ '& .MuiListItemIcon-root': {
45
+ color: getColor({ status: 'pending', theme })
46
+ }
47
+ }
59
48
  },
49
+
60
50
  '&[data-variant="primary"]': {
61
- '& .MuiListItemIcon-root': {
62
- color: getColor({ status: 'primary', theme })
63
- },
64
51
  '&:hover': {
65
- background: alpha(
66
- theme.palette.primary.main,
67
- theme.palette.action.focusOpacity
68
- ),
69
- color: getColor({ status: 'primary', theme })
70
- },
71
- color: theme.palette.primary.main
52
+ '& .MuiListItemIcon-root': {
53
+ color: getColor({ status: 'primary', theme })
54
+ }
55
+ }
72
56
  },
57
+
73
58
  '&[data-variant="secondary"]': {
74
- '& .MuiListItemIcon-root': {
75
- color: getColor({ status: 'secondary', theme })
76
- },
77
59
  '&:hover': {
78
- background: alpha(
79
- theme.palette.secondary.main,
80
- theme.palette.action.focusOpacity
81
- ),
82
- color: getColor({ status: 'secondary', theme })
83
- },
84
- color: theme.palette.secondary.main
60
+ '& .MuiListItemIcon-root': {
61
+ color: getColor({ status: 'secondary', theme })
62
+ }
63
+ }
85
64
  },
65
+
86
66
  '&[data-variant="success"]': {
87
- '& .MuiListItemIcon-root': {
88
- color: getColor({ status: 'success', theme })
89
- },
90
67
  '&:hover': {
91
- background: alpha(
92
- theme.palette.success.main,
93
- theme.palette.action.focusOpacity
94
- ),
95
- color: getColor({ status: 'success', theme })
96
- },
97
- color: theme.palette.success.main
68
+ '& .MuiListItemIcon-root': {
69
+ color: getColor({ status: 'success', theme })
70
+ }
71
+ }
98
72
  },
73
+
99
74
  '&[data-variant="warning"]': {
100
- '& .MuiListItemIcon-root': {
101
- color: getColor({ status: 'warning', theme })
102
- },
103
75
  '&:hover': {
104
- background: alpha(
105
- theme.palette.warning.main,
106
- theme.palette.action.focusOpacity
107
- ),
108
- color: getColor({ status: 'warning', theme })
109
- },
110
- color: theme.palette.warning.main
76
+ '& .MuiListItemIcon-root': {
77
+ color: getColor({ status: 'warning', theme })
78
+ }
79
+ }
111
80
  }
112
81
  },
113
82
  list: {
@@ -76,11 +76,12 @@ export const useDashboardItemStyles = makeStyles<{ hasHeader: boolean }>()(
76
76
  border: 'none',
77
77
  borderRadius: theme.spacing(1),
78
78
  height: '100%',
79
- paddingBottom: theme.spacing(2),
80
79
  width: '100%'
81
80
  },
82
81
  widgetContent: {
83
- height: '100%'
82
+ height: hasHeader
83
+ ? `calc(100% - ${theme.spacing(3.5)} - ${theme.spacing(0.5)})`
84
+ : `calc(100% - ${theme.spacing(3.5)})`
84
85
  },
85
86
  widgetHeader: {
86
87
  '&:hover': {
@@ -92,17 +93,17 @@ export const useDashboardItemStyles = makeStyles<{ hasHeader: boolean }>()(
92
93
  '&[data-canMove="true"]': {
93
94
  cursor: 'move'
94
95
  },
95
- padding: theme.spacing(0.5, 2),
96
+ padding: theme.spacing(0, 1.5),
96
97
  position: 'relative'
97
98
  },
98
99
  widgetHeaderDraggable: {
99
100
  height: '100%',
100
101
  position: 'absolute',
101
- width: '100%'
102
+ width: '95%'
102
103
  },
103
104
  widgetPadding: {
104
105
  overflowX: 'auto',
105
- padding: hasHeader ? theme.spacing(1, 2, 0) : theme.spacing(1, 2)
106
+ padding: theme.spacing(0.5, 1.5, 1.5)
106
107
  }
107
108
  })
108
109
  );
@@ -1,4 +1,4 @@
1
- import { DialogContentText, Typography } from '@mui/material';
1
+ import { ButtonProps, DialogContentText, Typography } from '@mui/material';
2
2
 
3
3
  import Dialog, { Props as DialogProps } from '..';
4
4
 
@@ -6,15 +6,23 @@ type Props = DialogProps & {
6
6
  children?: JSX.Element;
7
7
  labelMessage?: string | null;
8
8
  labelSecondMessage?: string | null;
9
+ restCancelButtonProps?: ButtonProps;
10
+ restConfirmButtonProps?: ButtonProps;
9
11
  };
10
12
 
11
13
  const Confirm = ({
12
14
  labelMessage,
13
15
  labelSecondMessage,
14
16
  children,
17
+ restCancelButtonProps,
18
+ restConfirmButtonProps,
15
19
  ...rest
16
20
  }: Props): JSX.Element => (
17
- <Dialog {...rest}>
21
+ <Dialog
22
+ restCancelButtonProps={restCancelButtonProps}
23
+ restConfirmButtonProps={restConfirmButtonProps}
24
+ {...rest}
25
+ >
18
26
  <DialogContentText>
19
27
  {labelMessage && <Typography>{labelMessage}</Typography>}
20
28
  {labelSecondMessage && <Typography>{labelSecondMessage}</Typography>}
@@ -1,18 +1,17 @@
1
1
  import { not } from 'ramda';
2
2
  import { useTranslation } from 'react-i18next';
3
3
 
4
- import { ConfirmDialog } from '../..';
4
+ import { Modal } from '../../components/Modal';
5
5
 
6
6
  import {
7
7
  labelDiscard,
8
8
  labelDoYouWantToQuitWithoutResolving,
9
- labelDoYouWantToQuitWithoutSaving,
10
9
  labelDoYouWantToResolveErrors,
11
10
  labelDoYouWantToSaveChanges,
12
11
  labelResolve,
13
12
  labelSave,
14
13
  labelThereAreErrorsInTheForm,
15
- labelYourFormHasUnsavedChanges
14
+ labelIfYouClickOnDiscard
16
15
  } from './translatedLabels';
17
16
 
18
17
  interface Props {
@@ -40,30 +39,32 @@ const UnsavedChangesDialog = ({
40
39
  const labelConfirm = isValidForm ? labelSave : labelResolve;
41
40
 
42
41
  const labelMessage = `${
43
- isValidForm ? labelYourFormHasUnsavedChanges : labelThereAreErrorsInTheForm
44
- }. ${
45
- isValidForm
46
- ? labelDoYouWantToQuitWithoutSaving
47
- : labelDoYouWantToQuitWithoutResolving
48
- }`;
42
+ isValidForm ? labelIfYouClickOnDiscard : labelThereAreErrorsInTheForm
43
+ }. ${isValidForm ? '' : labelDoYouWantToQuitWithoutResolving}`;
49
44
 
50
45
  if (not(dialogOpened)) {
51
46
  return null;
52
47
  }
53
48
 
54
49
  return (
55
- <ConfirmDialog
56
- confirmDisabled={isSubmitting}
57
- labelCancel={t(labelDiscard)}
58
- labelConfirm={t(labelConfirm)}
59
- labelMessage={t(labelMessage)}
60
- labelTitle={t(labelTitle)}
50
+ <Modal
51
+ hasCloseButton
61
52
  open={dialogOpened}
62
- submitting={isSubmitting}
63
- onBackdropClick={closeDialog}
64
- onCancel={discardChanges}
65
- onConfirm={isValidForm ? saveChanges : closeDialog}
66
- />
53
+ size="medium"
54
+ onClose={closeDialog}
55
+ >
56
+ <Modal.Header>{t(labelTitle)}</Modal.Header>
57
+ <Modal.Body>{t(labelMessage)}</Modal.Body>
58
+ <Modal.Actions
59
+ disabled={isSubmitting}
60
+ labels={{
61
+ cancel: t(labelDiscard),
62
+ confirm: t(labelConfirm)
63
+ }}
64
+ onCancel={discardChanges}
65
+ onConfirm={isValidForm ? saveChanges : closeDialog}
66
+ />
67
+ </Modal>
67
68
  );
68
69
  };
69
70
 
@@ -1,9 +1,8 @@
1
1
  export const labelDiscard = 'Discard';
2
2
  export const labelResolve = 'Resolve';
3
- export const labelYourFormHasUnsavedChanges = 'Your form has unsaved changes';
3
+ export const labelIfYouClickOnDiscard =
4
+ 'If you click on Discard, your changes will not be saved.';
4
5
  export const labelThereAreErrorsInTheForm = 'There are errors in the form';
5
- export const labelDoYouWantToQuitWithoutSaving =
6
- 'Do you want to quit the form without saving the changes?';
7
6
  export const labelDoYouWantToQuitWithoutResolving =
8
7
  'Do you want to quit the form without resolving the errors?';
9
8
  export const labelDoYouWantToSaveChanges = 'Do you want to save the changes?';
@@ -14,11 +13,10 @@ export const labelSave = 'Save';
14
13
  export default {
15
14
  labelDiscard,
16
15
  labelDoYouWantToQuitWithoutResolving,
17
- labelDoYouWantToQuitWithoutSaving,
18
16
  labelDoYouWantToResolveErrors,
19
17
  labelDoYouWantToSaveChanges,
18
+ labelIfYouClickOnDiscard,
20
19
  labelResolve,
21
20
  labelSave,
22
- labelThereAreErrorsInTheForm,
23
- labelYourFormHasUnsavedChanges
21
+ labelThereAreErrorsInTheForm
24
22
  };
@@ -9,7 +9,8 @@ import {
9
9
  DialogContent,
10
10
  DialogActions,
11
11
  DialogProps,
12
- CircularProgress
12
+ CircularProgress,
13
+ ButtonProps
13
14
  } from '@mui/material';
14
15
 
15
16
  import { DataTestAttributes } from '../@types/data-attributes';
@@ -48,6 +49,8 @@ export type Props = {
48
49
  onClose?: () => void;
49
50
  onConfirm: (event, value?) => void;
50
51
  open: boolean;
52
+ restCancelButtonProps?: ButtonProps;
53
+ restConfirmButtonProps?: ButtonProps;
51
54
  submitting?: boolean;
52
55
  } & DialogProps &
53
56
  DataTestAttributes;
@@ -70,6 +73,8 @@ const Dialog = ({
70
73
  dialogContentClassName,
71
74
  dialogActionsClassName,
72
75
  dialogConfirmButtonClassName,
76
+ restCancelButtonProps,
77
+ restConfirmButtonProps,
73
78
  ...rest
74
79
  }: Props): JSX.Element => {
75
80
  const { classes, cx } = useStyles({ contentWidth });
@@ -101,6 +106,7 @@ const Dialog = ({
101
106
  data-testid="Cancel"
102
107
  disabled={cancelDisabled}
103
108
  onClick={onCancel}
109
+ {...restCancelButtonProps}
104
110
  >
105
111
  {labelCancel}
106
112
  </Button>
@@ -113,6 +119,7 @@ const Dialog = ({
113
119
  disabled={confirmDisabled}
114
120
  endIcon={submitting && <CircularProgress size={15} />}
115
121
  onClick={onConfirm}
122
+ {...restConfirmButtonProps}
116
123
  >
117
124
  {labelConfirm}
118
125
  </Button>
@@ -46,7 +46,10 @@ const CheckboxGroup = ({
46
46
  return;
47
47
  }
48
48
 
49
- setFieldValue(fieldName, value?.filter((elm) => !equals(elm, label)));
49
+ setFieldValue(
50
+ fieldName,
51
+ value?.filter((elm) => !equals(elm, label))
52
+ );
50
53
  };
51
54
 
52
55
  return useMemoComponent({
@@ -29,7 +29,8 @@ const Text = ({
29
29
  getRequired,
30
30
  change,
31
31
  additionalMemoProps,
32
- text
32
+ text,
33
+ autoFocus
33
34
  }: InputPropsWithoutGroup): JSX.Element => {
34
35
  const { t } = useTranslation();
35
36
 
@@ -109,6 +110,7 @@ const Text = ({
109
110
  fullWidth
110
111
  EndAdornment={EndAdornment}
111
112
  ariaLabel={t(label) || ''}
113
+ autoFocus={autoFocus}
112
114
  dataTestId={dataTestId || ''}
113
115
  disabled={disabled}
114
116
  error={error as string | undefined}
@@ -33,6 +33,7 @@ export interface InputProps {
33
33
  additionalLabel?: string | JSX.Element;
34
34
  additionalLabelClassName?: string;
35
35
  additionalMemoProps?: Array<unknown>;
36
+ autoFocus?: boolean;
36
37
  autocomplete?: {
37
38
  creatable?: boolean;
38
39
  options: Array<SelectEntry>;