@centreon/ui 23.10.121 → 24.4.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 (374) hide show
  1. package/package.json +64 -45
  2. package/public/mockServiceWorker.js +2 -2
  3. package/src/ActionsList/ActionsList.styles.ts +40 -71
  4. package/src/Button/Icon/index.stories.tsx +1 -1
  5. package/src/Button/Icon/index.tsx +2 -2
  6. package/src/Button/Save/StartIcon.tsx +3 -3
  7. package/src/Button/Save/index.tsx +9 -5
  8. package/src/Checkbox/Checkbox.tsx +2 -2
  9. package/src/Checkbox/CheckboxGroup/index.tsx +2 -2
  10. package/src/Checkbox/fonts/roboto-bold-webfont.ttf +0 -0
  11. package/src/Checkbox/fonts/roboto-bold-webfont.woff +0 -0
  12. package/src/Checkbox/fonts/roboto-bold-webfont.woff2 +0 -0
  13. package/src/Checkbox/fonts/roboto-light-webfont.ttf +0 -0
  14. package/src/Checkbox/fonts/roboto-light-webfont.woff +0 -0
  15. package/src/Checkbox/fonts/roboto-light-webfont.woff2 +0 -0
  16. package/src/Checkbox/fonts/roboto-medium-webfont.ttf +0 -0
  17. package/src/Checkbox/fonts/roboto-medium-webfont.woff +0 -0
  18. package/src/Checkbox/fonts/roboto-medium-webfont.woff2 +0 -0
  19. package/src/Checkbox/fonts/roboto-regular-webfont.ttf +0 -0
  20. package/src/Checkbox/fonts/roboto-regular-webfont.woff +0 -0
  21. package/src/Checkbox/fonts/roboto-regular-webfont.woff2 +0 -0
  22. package/src/Dashboard/Dashboard.styles.ts +6 -5
  23. package/src/Dashboard/Item.tsx +1 -1
  24. package/src/Dashboard/Layout.tsx +2 -2
  25. package/src/Dashboard/utils.ts +1 -1
  26. package/src/Dialog/Confirm/index.tsx +10 -2
  27. package/src/Dialog/UnsavedChanges/index.tsx +21 -20
  28. package/src/Dialog/UnsavedChanges/translatedLabels.ts +4 -6
  29. package/src/Dialog/index.tsx +9 -2
  30. package/src/FallbackPage/FallbackPage.tsx +3 -3
  31. package/src/FileDropZone/index.tsx +3 -1
  32. package/src/Form/Form.cypress.spec.tsx +133 -0
  33. package/src/Form/Inputs/Grid.tsx +8 -4
  34. package/src/Form/Inputs/List/Content.tsx +62 -0
  35. package/src/Form/Inputs/List/List.styles.ts +29 -0
  36. package/src/Form/Inputs/List/List.tsx +58 -0
  37. package/src/Form/Inputs/List/useList.ts +81 -0
  38. package/src/Form/Inputs/Text.tsx +3 -1
  39. package/src/Form/Inputs/index.tsx +3 -1
  40. package/src/Form/Inputs/models.ts +23 -13
  41. package/src/Graph/BarStack/BarStack.cypress.spec.tsx +217 -0
  42. package/src/Graph/BarStack/BarStack.stories.tsx +125 -0
  43. package/src/Graph/BarStack/BarStack.styles.ts +66 -0
  44. package/src/Graph/BarStack/BarStack.tsx +14 -0
  45. package/src/Graph/BarStack/Graph.tsx +176 -0
  46. package/src/Graph/BarStack/GraphAndLegend.tsx +119 -0
  47. package/src/Graph/BarStack/ResponsiveBarStack.tsx +114 -0
  48. package/src/Graph/BarStack/constants.ts +5 -0
  49. package/src/Graph/BarStack/index.ts +1 -0
  50. package/src/Graph/BarStack/models.ts +19 -0
  51. package/src/Graph/BarStack/useGraphAndLegend.ts +86 -0
  52. package/src/Graph/BarStack/useResponsiveBarStack.ts +106 -0
  53. package/src/Graph/Gauge/Gauge.cypress.spec.tsx +102 -0
  54. package/src/Graph/Gauge/Gauge.tsx +1 -1
  55. package/src/Graph/HeatMap/HeatMap.cypress.spec.tsx +145 -0
  56. package/src/Graph/HeatMap/HeatMap.stories.tsx +0 -25
  57. package/src/Graph/HeatMap/HeatMap.styles.tsx +1 -0
  58. package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +39 -12
  59. package/src/Graph/HeatMap/model.ts +6 -1
  60. package/src/Graph/Legend/Legend.styles.ts +10 -0
  61. package/src/Graph/Legend/Legend.tsx +26 -0
  62. package/src/Graph/Legend/index.ts +1 -0
  63. package/src/Graph/Legend/models.ts +11 -0
  64. package/src/Graph/LineChart/BasicComponents/Lines/RegularLines/index.tsx +2 -1
  65. package/src/Graph/LineChart/BasicComponents/Lines/StackedLines/index.tsx +3 -4
  66. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/Circle.tsx +2 -2
  67. package/src/Graph/LineChart/BasicComponents/ThresholdLine.tsx +3 -1
  68. package/src/Graph/LineChart/BasicComponents/Thresholds.tsx +2 -2
  69. package/src/Graph/LineChart/BasicComponents/useFilterLines.ts +3 -5
  70. package/src/Graph/LineChart/Header/index.tsx +3 -31
  71. package/src/Graph/LineChart/Icons/Downtime.tsx +3 -3
  72. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/GuidingLines.tsx +2 -2
  73. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTickGraph.ts +9 -11
  74. package/src/Graph/LineChart/InteractiveComponents/Annotations/EventAnnotations.tsx +1 -1
  75. package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx +68 -0
  76. package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +27 -0
  77. package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltipStyles.ts +31 -0
  78. package/src/Graph/LineChart/InteractiveComponents/ZoomPreview/index.tsx +2 -1
  79. package/src/Graph/LineChart/InteractiveComponents/index.tsx +132 -17
  80. package/src/Graph/LineChart/InteractiveComponents/interactionWithGraphAtoms.ts +7 -27
  81. package/src/Graph/LineChart/Legend/Legend.styles.ts +85 -32
  82. package/src/Graph/LineChart/Legend/LegendContent.tsx +12 -6
  83. package/src/Graph/LineChart/Legend/LegendHeader.tsx +66 -27
  84. package/src/Graph/LineChart/Legend/index.tsx +43 -46
  85. package/src/Graph/LineChart/Legend/models.ts +5 -0
  86. package/src/Graph/LineChart/Legend/useLegend.ts +12 -13
  87. package/src/Graph/LineChart/LineChart.cypress.spec.tsx +144 -0
  88. package/src/Graph/LineChart/LineChart.styles.ts +8 -0
  89. package/src/Graph/LineChart/LineChart.tsx +125 -123
  90. package/src/Graph/LineChart/LoadingSkeleton.tsx +2 -2
  91. package/src/Graph/LineChart/helpers/doc.ts +16 -13
  92. package/src/Graph/LineChart/helpers/index.ts +1 -1
  93. package/src/Graph/LineChart/index.stories.tsx +17 -2
  94. package/src/Graph/LineChart/index.tsx +6 -7
  95. package/src/Graph/LineChart/mockedData/curvesWithSameColor.json +252 -0
  96. package/src/Graph/LineChart/mockedData/lastDayWithIncompleteValues.json +1320 -0
  97. package/src/Graph/LineChart/mockedData/lastDayWithNullValues.json +1314 -0
  98. package/src/Graph/LineChart/models.ts +12 -1
  99. package/src/Graph/LineChart/useLineChartData.ts +68 -18
  100. package/src/Graph/PieChart/PieChart.cypress.spec.tsx +154 -0
  101. package/src/Graph/PieChart/PieChart.stories.tsx +194 -0
  102. package/src/Graph/PieChart/PieChart.styles.ts +39 -0
  103. package/src/Graph/PieChart/PieChart.tsx +14 -0
  104. package/src/Graph/PieChart/ResponsivePie.tsx +245 -0
  105. package/src/Graph/PieChart/index.ts +1 -0
  106. package/src/Graph/PieChart/models.ts +20 -0
  107. package/src/Graph/PieChart/useResponsivePie.ts +81 -0
  108. package/src/Graph/SingleBar/SingleBar.cypress.spec.tsx +121 -0
  109. package/src/Graph/SingleBar/Thresholds.tsx +2 -2
  110. package/src/Graph/Text/Text.cypress.spec.tsx +101 -0
  111. package/src/Graph/Text/Text.stories.tsx +60 -4
  112. package/src/Graph/Text/Text.styles.ts +12 -1
  113. package/src/Graph/Text/Text.tsx +17 -12
  114. package/src/Graph/Tree/DescendantNodes.tsx +88 -0
  115. package/src/Graph/Tree/Links.tsx +64 -0
  116. package/src/Graph/Tree/StandaloneTree.tsx +32 -0
  117. package/src/Graph/Tree/Tree.cypress.spec.tsx +171 -0
  118. package/src/Graph/Tree/Tree.stories.tsx +144 -0
  119. package/src/Graph/Tree/Tree.tsx +116 -0
  120. package/src/Graph/Tree/constants.ts +2 -0
  121. package/src/Graph/Tree/index.ts +4 -0
  122. package/src/Graph/Tree/models.ts +52 -0
  123. package/src/Graph/Tree/stories/contents.tsx +164 -0
  124. package/src/Graph/Tree/stories/datas.ts +305 -0
  125. package/src/Graph/Tree/utils.ts +49 -0
  126. package/src/Graph/common/testUtils.ts +71 -0
  127. package/src/Graph/common/timeSeries/index.ts +53 -15
  128. package/src/Graph/common/utils.ts +69 -1
  129. package/src/Graph/index.ts +4 -0
  130. package/src/Icon/BaseIcon.tsx +32 -0
  131. package/src/Icon/DowntimeIcon.tsx +14 -0
  132. package/src/InputField/Number/Number.cypress.spec.tsx +85 -0
  133. package/src/InputField/Number/Number.stories.tsx +66 -0
  134. package/src/InputField/Number/Number.tsx +74 -0
  135. package/src/InputField/Search/index.tsx +2 -2
  136. package/src/InputField/Select/Autocomplete/Connected/Multi/index.test.tsx +22 -1
  137. package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +3 -2
  138. package/src/InputField/Select/Autocomplete/Connected/index.tsx +35 -17
  139. package/src/InputField/Select/Autocomplete/Draggable/SortableList.tsx +1 -1
  140. package/src/InputField/Select/Autocomplete/Draggable/SortableListContent.tsx +1 -1
  141. package/src/InputField/Select/Autocomplete/Draggable/index.tsx +1 -1
  142. package/src/InputField/Select/Autocomplete/Multi/index.stories.tsx +19 -0
  143. package/src/InputField/Select/Autocomplete/Multi/index.tsx +12 -7
  144. package/src/InputField/Select/Autocomplete/index.tsx +129 -116
  145. package/src/InputField/Select/IconPopover/index.tsx +3 -3
  146. package/src/InputField/Select/index.tsx +15 -2
  147. package/src/InputField/Text/index.tsx +53 -46
  148. package/src/Listing/ActionBar/index.tsx +11 -10
  149. package/src/Listing/Cell/DataCell.styles.ts +3 -0
  150. package/src/Listing/Cell/DataCell.tsx +23 -5
  151. package/src/Listing/Header/ListingHeader.tsx +1 -1
  152. package/src/Listing/Listing.cypress.spec.tsx +218 -33
  153. package/src/Listing/Listing.styles.ts +4 -7
  154. package/src/Listing/Row/Row.tsx +7 -3
  155. package/src/Listing/index.stories.tsx +39 -5
  156. package/src/Listing/index.test.tsx +1 -1
  157. package/src/Listing/index.tsx +207 -149
  158. package/src/Listing/models.ts +1 -0
  159. package/src/Listing/useStyleTable.ts +1 -0
  160. package/src/Module/LicensedModule/LicenseCheck/index.tsx +24 -9
  161. package/src/Module/LicensedModule/index.tsx +7 -1
  162. package/src/Module/Module.cypress.spec.tsx +129 -0
  163. package/src/Module/index.tsx +2 -4
  164. package/src/Panel/index.tsx +1 -1
  165. package/src/PopoverMenu/index.tsx +9 -8
  166. package/src/RichTextEditor/ContentEditable.tsx +195 -195
  167. package/src/RichTextEditor/RichTextEditor.cypress.spec.tsx +100 -52
  168. package/src/RichTextEditor/RichTextEditor.tsx +21 -4
  169. package/src/RichTextEditor/plugins/ToolbarPlugin/AlignPicker.tsx +21 -20
  170. package/src/RichTextEditor/plugins/ToolbarPlugin/BlockButtons.tsx +35 -77
  171. package/src/RichTextEditor/plugins/ToolbarPlugin/FormatButtons.tsx +29 -83
  172. package/src/RichTextEditor/plugins/ToolbarPlugin/LinkButton.tsx +106 -0
  173. package/src/RichTextEditor/plugins/ToolbarPlugin/ListButton.tsx +155 -0
  174. package/src/RichTextEditor/plugins/ToolbarPlugin/MacrosButton.tsx +23 -39
  175. package/src/RichTextEditor/plugins/ToolbarPlugin/ToolbarPlugin.styles.ts +24 -14
  176. package/src/RichTextEditor/plugins/ToolbarPlugin/UndoRedoButtons.tsx +6 -0
  177. package/src/RichTextEditor/plugins/ToolbarPlugin/index.tsx +5 -10
  178. package/src/RichTextEditor/translatedLabels.ts +3 -0
  179. package/src/SortableItems/index.tsx +2 -7
  180. package/src/StoryBookThemeProvider/index.tsx +35 -36
  181. package/src/ThemeProvider/index.tsx +39 -12
  182. package/src/ThemeProvider/palettes.ts +15 -12
  183. package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.styles.ts +6 -7
  184. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +10 -6
  185. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +0 -2
  186. package/src/TimePeriods/DateTimePickerInput.tsx +59 -19
  187. package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +12 -9
  188. package/src/TimePeriods/TimePeriods.cypress.spec.tsx +9 -33
  189. package/src/TimePeriods/helpers/index.ts +1 -1
  190. package/src/TimePeriods/index.stories.tsx +12 -4
  191. package/src/TimePeriods/index.tsx +2 -2
  192. package/src/TopCounterElements/TopCounterLayout.tsx +3 -0
  193. package/src/TopCounterElements/useCloseOnLegacyPage.tsx +42 -0
  194. package/src/Typography/FluidTypography/FluidTypography.cypress.spec.tsx +27 -0
  195. package/src/Typography/FluidTypography/index.stories.tsx +2 -2
  196. package/src/Typography/FluidTypography/index.tsx +21 -28
  197. package/src/Typography/Subtitle.tsx +55 -0
  198. package/src/api/QueryProvider.tsx +1 -1
  199. package/src/api/TestQueryProvider.tsx +1 -1
  200. package/src/api/buildListingEndpoint/getSearchQueryParameterValue.ts +7 -1
  201. package/src/api/buildListingEndpoint/models.ts +3 -1
  202. package/src/api/customFetch.ts +12 -3
  203. package/src/api/index.ts +3 -3
  204. package/src/api/useFetchQuery/index.ts +49 -28
  205. package/src/api/useGraphQuery/index.ts +26 -5
  206. package/src/api/useGraphQuery/models.ts +5 -0
  207. package/src/api/useMutationQuery/index.test.ts +4 -4
  208. package/src/api/useMutationQuery/index.ts +65 -20
  209. package/src/components/Button/Icon/IconButton.tsx +6 -2
  210. package/src/components/CollapsibleItem/CollapsibleItem.cypress.spec.tsx +76 -0
  211. package/src/components/CollapsibleItem/CollapsibleItem.stories.tsx +26 -0
  212. package/src/components/CollapsibleItem/CollapsibleItem.tsx +43 -14
  213. package/src/components/CollapsibleItem/useCollapsibleItemStyles.ts +24 -1
  214. package/src/components/DataTable/DataListing.tsx +6 -0
  215. package/src/components/DataTable/DataTable.cypress.spec.tsx +174 -0
  216. package/src/components/DataTable/DataTable.stories.tsx +40 -0
  217. package/src/components/DataTable/DataTable.styles.ts +3 -0
  218. package/src/components/DataTable/DataTable.tsx +3 -3
  219. package/src/components/DataTable/Item/DataTableItem.styles.ts +7 -2
  220. package/src/components/DataTable/Item/DataTableItem.tsx +4 -60
  221. package/src/components/DataTable/index.ts +3 -1
  222. package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +373 -0
  223. package/src/components/Form/AccessRights/AccessRights.stories.tsx +119 -0
  224. package/src/components/Form/AccessRights/AccessRights.styles.ts +10 -0
  225. package/src/components/Form/AccessRights/AccessRights.tsx +60 -0
  226. package/src/components/Form/AccessRights/Actions/Actions.styles.ts +14 -0
  227. package/src/components/Form/AccessRights/Actions/Actions.tsx +81 -0
  228. package/src/components/Form/AccessRights/Actions/useActions.ts +79 -0
  229. package/src/components/Form/AccessRights/List/Item.tsx +90 -0
  230. package/src/components/Form/AccessRights/List/List.styles.tsx +45 -0
  231. package/src/components/Form/AccessRights/List/List.tsx +52 -0
  232. package/src/components/Form/AccessRights/List/ListItemSkeleton.tsx +18 -0
  233. package/src/components/Form/AccessRights/List/ListSkeleton.tsx +22 -0
  234. package/src/components/Form/AccessRights/List/RemoveAccessRight.tsx +38 -0
  235. package/src/components/Form/AccessRights/List/StateChip.tsx +28 -0
  236. package/src/components/Form/AccessRights/List/useItem.ts +64 -0
  237. package/src/components/Form/AccessRights/Provider.tsx +15 -0
  238. package/src/components/Form/AccessRights/ShareInput/ContactSwitch.tsx +50 -0
  239. package/src/components/Form/AccessRights/ShareInput/ShareInput.styles.ts +17 -0
  240. package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +78 -0
  241. package/src/components/Form/AccessRights/ShareInput/useShareInput.tsx +113 -0
  242. package/src/components/Form/AccessRights/Stats/Stats.tsx +36 -0
  243. package/src/components/Form/AccessRights/atoms.ts +97 -0
  244. package/src/components/Form/AccessRights/common/RoleSelectField.styles.tsx +7 -0
  245. package/src/components/Form/AccessRights/common/RoleSelectField.tsx +45 -0
  246. package/src/components/Form/AccessRights/models.ts +55 -0
  247. package/src/components/Form/AccessRights/storiesData.ts +222 -0
  248. package/src/components/Form/AccessRights/useAccessRightsInitValues.ts +51 -0
  249. package/src/components/Form/Dashboard/DashboardDuplicationForm.tsx +85 -0
  250. package/src/components/Form/Dashboard/DashboardForm.tsx +15 -12
  251. package/src/components/Form/Dashboard/index.ts +1 -0
  252. package/src/components/Form/FormActions.tsx +7 -2
  253. package/src/components/Form/index.ts +2 -1
  254. package/src/components/ItemComposition/Item.tsx +1 -1
  255. package/src/components/ItemComposition/ItemComposition.cypress.spec.tsx +113 -0
  256. package/src/components/ItemComposition/ItemComposition.stories.tsx +14 -0
  257. package/src/components/ItemComposition/ItemComposition.styles.ts +36 -3
  258. package/src/components/ItemComposition/ItemComposition.tsx +41 -17
  259. package/src/components/Layout/PageLayout/PageLayout.tsx +1 -1
  260. package/src/components/Layout/PageLayout/PageLayoutActions.tsx +1 -0
  261. package/src/components/Layout/PageLayout/PageLayoutBody.tsx +1 -0
  262. package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +5 -1
  263. package/src/components/Layout/PageLayout/PageQuickAccess.tsx +76 -0
  264. package/src/components/Layout/PageLayout/index.ts +3 -1
  265. package/src/components/Layout/PageLayout.cypress.spec.tsx +66 -0
  266. package/src/components/List/Item/ListItem.styles.ts +6 -0
  267. package/src/components/List/Item/ListItem.tsx +6 -4
  268. package/src/components/List/Item/Text.tsx +5 -3
  269. package/src/components/Menu/Button/MenuButton.tsx +4 -2
  270. package/src/components/Menu/MenuItem.tsx +5 -3
  271. package/src/components/Menu/MenuItems.tsx +4 -3
  272. package/src/components/Modal/ConfirmationModal/ConfirmationModal.cypress.spec.tsx +168 -0
  273. package/src/components/Modal/ConfirmationModal/ConfirmationModal.stories.tsx +62 -0
  274. package/src/components/Modal/ConfirmationModal/ConfirmationModal.tsx +87 -0
  275. package/src/components/Modal/Modal.styles.ts +10 -2
  276. package/src/components/Modal/ModalActions.tsx +4 -2
  277. package/src/components/Modal/index.ts +2 -0
  278. package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.stories.tsx +3 -3
  279. package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.tsx +1 -1
  280. package/src/components/Tooltip/ConfirmationTooltip/models.ts +1 -1
  281. package/src/components/Zoom/Minimap.tsx +127 -0
  282. package/src/components/Zoom/Zoom.cypress.spec.tsx +246 -0
  283. package/src/components/Zoom/Zoom.stories.tsx +115 -0
  284. package/src/components/Zoom/Zoom.styles.tsx +68 -0
  285. package/src/components/Zoom/Zoom.tsx +61 -0
  286. package/src/components/Zoom/ZoomContent.tsx +167 -0
  287. package/src/components/Zoom/constants.ts +2 -0
  288. package/src/components/Zoom/localPoint.ts +51 -0
  289. package/src/components/Zoom/models.ts +25 -0
  290. package/src/components/Zoom/useMinimap.ts +156 -0
  291. package/src/components/Zoom/useZoom.ts +70 -0
  292. package/src/components/Zoom/utils.ts +55 -0
  293. package/src/components/index.ts +1 -0
  294. package/src/fonts/roboto-bold-webfont.ttf +0 -0
  295. package/src/fonts/roboto-bold-webfont.woff +0 -0
  296. package/src/fonts/roboto-bold-webfont.woff2 +0 -0
  297. package/src/fonts/roboto-light-webfont.ttf +0 -0
  298. package/src/fonts/roboto-light-webfont.woff +0 -0
  299. package/src/fonts/roboto-light-webfont.woff2 +0 -0
  300. package/src/fonts/roboto-medium-webfont.ttf +0 -0
  301. package/src/fonts/roboto-medium-webfont.woff +0 -0
  302. package/src/fonts/roboto-medium-webfont.woff2 +0 -0
  303. package/src/fonts/roboto-regular-webfont.ttf +0 -0
  304. package/src/fonts/roboto-regular-webfont.woff +0 -0
  305. package/src/fonts/roboto-regular-webfont.woff2 +0 -0
  306. package/src/index.ts +6 -0
  307. package/src/queryParameters/url/index.ts +5 -1
  308. package/src/utils/index.ts +25 -22
  309. package/src/utils/useFullscreen/Fullscreen.cypress.spec.tsx +133 -0
  310. package/src/utils/useFullscreen/atoms.ts +3 -0
  311. package/src/utils/useFullscreen/index.ts +2 -0
  312. package/src/utils/useFullscreen/translatedLabels.ts +1 -0
  313. package/src/utils/useFullscreen/useFullscreen.ts +73 -0
  314. package/src/utils/useFullscreen/useFullscreenListener.ts +62 -0
  315. package/src/utils/useInfiniteScrollListing.ts +31 -8
  316. package/src/utils/{useLicenseExpirationWarning.cypress.spec.tsx → useLicenseExpirationWarning.test.tsx} +48 -37
  317. package/src/utils/useLicenseExpirationWarning.ts +18 -18
  318. package/src/utils/useLocale/index.ts +10 -0
  319. package/src/utils/useLocale/useLocale.cypress.spec.tsx +40 -0
  320. package/src/utils/useLocaleDateTimeFormat/index.ts +8 -2
  321. package/src/utils/usePluralizedTranslation.ts +21 -0
  322. package/src/@assets/icons/downtime.icon.svg +0 -1
  323. package/src/Graph/LineChart/BasicComponents/LoadingProgress.tsx +0 -46
  324. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/TooltipAnchorPoint.tsx +0 -96
  325. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTooltipAnchorPoint.ts +0 -107
  326. package/src/Graph/LineChart/Legend/InteractiveValue.tsx +0 -22
  327. package/src/Graph/LineChart/Legend/Marker.tsx +0 -43
  328. package/src/Graph/LineChart/Legend/useInteractiveValues.ts +0 -99
  329. package/src/Typography/FluidTypography/useFluidResizeObserver.ts +0 -56
  330. package/src/components/Form/AccessRights/AccessRights.resource.ts +0 -45
  331. package/src/components/Form/AccessRights/AccessRightsForm.stories.tsx +0 -59
  332. package/src/components/Form/AccessRights/AccessRightsForm.styles.ts +0 -21
  333. package/src/components/Form/AccessRights/AccessRightsForm.tsx +0 -67
  334. package/src/components/Form/AccessRights/AccessRightsFormActions.tsx +0 -80
  335. package/src/components/Form/AccessRights/Input/AddAction.tsx +0 -31
  336. package/src/components/Form/AccessRights/Input/ContactAccessRightInput.stories.tsx +0 -54
  337. package/src/components/Form/AccessRights/Input/ContactAccessRightInput.tsx +0 -72
  338. package/src/components/Form/AccessRights/Input/ContactAccessRightsInput.styles.ts +0 -22
  339. package/src/components/Form/AccessRights/Input/ContactInputField.tsx +0 -105
  340. package/src/components/Form/AccessRights/Input/RoleInputField.tsx +0 -29
  341. package/src/components/Form/AccessRights/List/ContactAccessRightsList.stories.tsx +0 -97
  342. package/src/components/Form/AccessRights/List/ContactAccessRightsList.styles.ts +0 -71
  343. package/src/components/Form/AccessRights/List/ContactAccessRightsList.tsx +0 -51
  344. package/src/components/Form/AccessRights/List/ContactAccessRightsListItem.stories.tsx +0 -116
  345. package/src/components/Form/AccessRights/List/ContactAccessRightsListItem.tsx +0 -118
  346. package/src/components/Form/AccessRights/List/ContactAccessRightsListItemSkeleton.tsx +0 -26
  347. package/src/components/Form/AccessRights/List/ContactAccessRightsListSkeleton.tsx +0 -28
  348. package/src/components/Form/AccessRights/Stats/AccessRightsStats.styles.ts +0 -18
  349. package/src/components/Form/AccessRights/Stats/AccessRightsStats.tsx +0 -41
  350. package/src/components/Form/AccessRights/__fixtures__/contactAccessRight.mock.ts +0 -52
  351. package/src/components/Form/AccessRights/common/GroupLabel.styles.ts +0 -18
  352. package/src/components/Form/AccessRights/common/GroupLabel.tsx +0 -15
  353. package/src/components/Form/AccessRights/common/Input.styles.ts +0 -48
  354. package/src/components/Form/AccessRights/common/RoleInputSelect.styles.ts +0 -11
  355. package/src/components/Form/AccessRights/common/RoleInputSelect.tsx +0 -57
  356. package/src/components/Form/AccessRights/index.ts +0 -3
  357. package/src/components/Form/AccessRights/useAccessRightsForm.test.tsx +0 -531
  358. package/src/components/Form/AccessRights/useAccessRightsForm.tsx +0 -282
  359. package/src/components/Form/AccessRights/useAccessRightsForm.utils.ts +0 -41
  360. package/src/screens/dashboard/DashboardsDetail.stories.tsx +0 -108
  361. package/src/screens/dashboard/DashboardsOverview.stories.tsx +0 -281
  362. package/src/utils/useDateTimePickerAdapter.ts +0 -309
  363. /package/{public → src/Button}/fonts/roboto-bold-webfont.ttf +0 -0
  364. /package/{public → src/Button}/fonts/roboto-bold-webfont.woff +0 -0
  365. /package/{public → src/Button}/fonts/roboto-bold-webfont.woff2 +0 -0
  366. /package/{public → src/Button}/fonts/roboto-light-webfont.ttf +0 -0
  367. /package/{public → src/Button}/fonts/roboto-light-webfont.woff +0 -0
  368. /package/{public → src/Button}/fonts/roboto-light-webfont.woff2 +0 -0
  369. /package/{public → src/Button}/fonts/roboto-medium-webfont.ttf +0 -0
  370. /package/{public → src/Button}/fonts/roboto-medium-webfont.woff +0 -0
  371. /package/{public → src/Button}/fonts/roboto-medium-webfont.woff2 +0 -0
  372. /package/{public → src/Button}/fonts/roboto-regular-webfont.ttf +0 -0
  373. /package/{public → src/Button}/fonts/roboto-regular-webfont.woff +0 -0
  374. /package/{public → src/Button}/fonts/roboto-regular-webfont.woff2 +0 -0
@@ -3,8 +3,6 @@ import { makeStyles } from 'tss-react/mui';
3
3
 
4
4
  import { Box, Typography } from '@mui/material';
5
5
 
6
- import EllipsisTypography from '../../Typography/EllipsisTypography';
7
-
8
6
  import heatMapData from './HeatMapData.json';
9
7
 
10
8
  import { HeatMap } from '.';
@@ -22,29 +20,6 @@ const meta: Meta<typeof HeatMap<Data>> = {
22
20
  export default meta;
23
21
  type Story = StoryObj<typeof HeatMap<Data>>;
24
22
 
25
- const TileContent = ({
26
- isSmallestSize,
27
- data
28
- }: {
29
- data: Data;
30
- isSmallestSize: boolean;
31
- }): JSX.Element | false =>
32
- !isSmallestSize && (
33
- <Box
34
- sx={{
35
- alignItems: 'center',
36
- color: 'common.black',
37
- display: 'flex',
38
- flexDirection: 'column',
39
- width: '100%'
40
- }}
41
- >
42
- <EllipsisTypography textAlign="center">{data.host}</EllipsisTypography>
43
- <EllipsisTypography textAlign="center">{data.service}</EllipsisTypography>
44
- <EllipsisTypography textAlign="center">{data.counter}</EllipsisTypography>
45
- </Box>
46
- );
47
-
48
23
  const TooltipContent = ({ data }: { data: Data }): JSX.Element => {
49
24
  return (
50
25
  <Box sx={{ backgroundColor: 'common.white', color: 'common.black' }}>
@@ -7,6 +7,7 @@ export const useHeatMapStyles = makeStyles()((theme) => ({
7
7
  heatMapTile: {
8
8
  alignItems: 'center',
9
9
  aspectRatio: '1 / 1',
10
+ borderRadius: theme.shape.borderRadius,
10
11
  display: 'flex',
11
12
  justifyContent: 'center',
12
13
  width: '100%'
@@ -1,7 +1,7 @@
1
- import { useMemo } from 'react';
1
+ import { useMemo, useRef } from 'react';
2
2
 
3
3
  import { scaleLinear } from '@visx/scale';
4
- import { equals, gt, lt } from 'ramda';
4
+ import { T, equals, gt, lt } from 'ramda';
5
5
 
6
6
  import { Box } from '@mui/material';
7
7
 
@@ -13,6 +13,7 @@ import { useHeatMapStyles } from './HeatMap.styles';
13
13
  const gap = 8;
14
14
  const maxTileSize = 120;
15
15
  const smallestTileSize = 44;
16
+ const toleratedRangeWidth = 10;
16
17
 
17
18
  const ResponsiveHeatMap = <TData,>({
18
19
  width,
@@ -20,9 +21,11 @@ const ResponsiveHeatMap = <TData,>({
20
21
  tiles,
21
22
  arrowClassName,
22
23
  tooltipContent,
23
- tileSizeFixed
24
+ tileSizeFixed,
25
+ displayTooltipCondition = T
24
26
  }: HeatMapProps<TData> & { width: number }): JSX.Element | null => {
25
27
  const { classes, cx } = useHeatMapStyles();
28
+ const previousTileSize = useRef(0);
26
29
 
27
30
  const tileSize = useMemo(() => {
28
31
  const scaleWidth = scaleLinear({
@@ -38,8 +41,14 @@ const ResponsiveHeatMap = <TData,>({
38
41
  tilesLength * maxTileSize + (tilesLength - 1) * gap;
39
42
  const theoricalTotalTilesWidth =
40
43
  tilesLength * tileWidth + (tilesLength - 1) * gap;
44
+ const canUpdateTileSize =
45
+ Math.abs(tileWidth - previousTileSize.current) > toleratedRangeWidth;
41
46
 
42
- if (lt(width, 680) && gt(maxTotalTilesWidth, width)) {
47
+ if (!canUpdateTileSize) {
48
+ return previousTileSize.current;
49
+ }
50
+
51
+ if (lt(width, 680) && gt(maxTotalTilesWidth, width) && !tileSizeFixed) {
43
52
  return smallestTileSize;
44
53
  }
45
54
 
@@ -51,6 +60,8 @@ const ResponsiveHeatMap = <TData,>({
51
60
  }, [width, tiles]);
52
61
 
53
62
  const isSmallestSize = equals(tileSize, smallestTileSize);
63
+ const isMediumSize = !isSmallestSize && lt(tileSize, 90);
64
+ previousTileSize.current = tileSize;
54
65
 
55
66
  if (equals(width, 0)) {
56
67
  return null;
@@ -65,24 +76,40 @@ const ResponsiveHeatMap = <TData,>({
65
76
  }}
66
77
  >
67
78
  {tiles.map(({ backgroundColor, id, data }) => (
68
- <Box className={classes.heatMapTile} key={id} sx={{ backgroundColor }}>
79
+ <Box
80
+ className={classes.heatMapTile}
81
+ data-testid={id}
82
+ key={id}
83
+ sx={{ backgroundColor }}
84
+ >
69
85
  <Tooltip
70
86
  hasCaret
71
87
  classes={{
72
88
  arrow: cx(classes.heatMapTooltipArrow, arrowClassName),
73
89
  tooltip: classes.heatMapTooltip
74
90
  }}
91
+ data-testid={`tooltip-${data?.id}`}
75
92
  followCursor={false}
76
- label={tooltipContent?.({
77
- backgroundColor,
78
- data,
79
- id,
80
- isSmallestSize
81
- })}
93
+ label={
94
+ displayTooltipCondition?.(data) &&
95
+ tooltipContent?.({
96
+ backgroundColor,
97
+ data,
98
+ id,
99
+ isSmallestSize
100
+ })
101
+ }
82
102
  position="right-start"
83
103
  >
84
104
  <div className={classes.heatMapTileContent}>
85
- {children({ backgroundColor, data, id, isSmallestSize })}
105
+ {children({
106
+ backgroundColor,
107
+ data,
108
+ id,
109
+ isMediumSize,
110
+ isSmallestSize,
111
+ tileSize
112
+ })}
86
113
  </div>
87
114
  </Tooltip>
88
115
  </Box>
@@ -10,7 +10,9 @@ interface ChildrenProps<TData> {
10
10
  backgroundColor: string;
11
11
  data: TData;
12
12
  id: string;
13
+ isMediumSize?: boolean;
13
14
  isSmallestSize: boolean;
15
+ tileSize?: number;
14
16
  }
15
17
 
16
18
  export interface HeatMapProps<TData> {
@@ -19,8 +21,11 @@ export interface HeatMapProps<TData> {
19
21
  backgroundColor,
20
22
  id,
21
23
  data,
22
- isSmallestSize
24
+ isSmallestSize,
25
+ tileSize,
26
+ isMediumSize
23
27
  }: ChildrenProps<TData>) => ReactElement | boolean | null;
28
+ displayTooltipCondition?: (data: TData) => boolean;
24
29
  tileSizeFixed?: boolean;
25
30
  tiles: Array<Tile<TData>>;
26
31
  tooltipContent?: ({
@@ -0,0 +1,10 @@
1
+ import { makeStyles } from 'tss-react/mui';
2
+
3
+ export const useStyles = makeStyles()((theme) => ({
4
+ container: {
5
+ border: `1px solid ${theme.palette.divider}`,
6
+ borderRadius: theme.shape.borderRadius,
7
+ padding: theme.spacing(1),
8
+ width: 'fit-content'
9
+ }
10
+ }));
@@ -0,0 +1,26 @@
1
+ import { LegendOrdinal } from '@visx/legend';
2
+ import { scaleOrdinal } from '@visx/scale';
3
+ import { equals } from 'ramda';
4
+
5
+ import { useStyles } from './Legend.styles';
6
+ import { LegendProps } from './models';
7
+
8
+ const Legend = ({ scale, direction = 'column' }: LegendProps): JSX.Element => {
9
+ const { classes } = useStyles();
10
+
11
+ const legendScale = scaleOrdinal({
12
+ domain: scale.domain,
13
+ range: scale.range
14
+ });
15
+
16
+ return (
17
+ <LegendOrdinal
18
+ className={classes.container}
19
+ direction={direction}
20
+ labelMargin={equals(direction, 'row') ? '0 12px 0 0' : '0 0 0 0'}
21
+ scale={legendScale}
22
+ />
23
+ );
24
+ };
25
+
26
+ export default Legend;
@@ -0,0 +1 @@
1
+ export { default as Legend } from './Legend';
@@ -0,0 +1,11 @@
1
+ export type LegendDirection = 'row' | 'column';
2
+
3
+ export interface LegendScale {
4
+ domain: Array<number | string>;
5
+ range: Array<string>;
6
+ }
7
+
8
+ export interface LegendProps {
9
+ direction?: LegendDirection;
10
+ scale: LegendScale;
11
+ }
@@ -55,6 +55,7 @@ const RegularLine = ({
55
55
  if (filled) {
56
56
  return (
57
57
  <Shape.AreaClosed<TimeValue>
58
+ data-metric={metric_id}
58
59
  fill={getFillColor({ areaColor, transparency })}
59
60
  fillRule="nonzero"
60
61
  key={metric_id}
@@ -65,7 +66,7 @@ const RegularLine = ({
65
66
  );
66
67
  }
67
68
 
68
- return <Shape.LinePath<TimeValue> {...props} />;
69
+ return <Shape.LinePath<TimeValue> data-metric={metric_id} {...props} />;
69
70
  };
70
71
 
71
72
  export default memo(RegularLine, (prevProps, nextProps) => {
@@ -45,10 +45,8 @@ const StackLines = ({
45
45
  >
46
46
  {({ stacks, path: linePath }): Array<JSX.Element> => {
47
47
  return stacks.map((stack, index) => {
48
- const { areaColor, transparency, lineColor, highlight } = nth(
49
- index,
50
- lines
51
- ) as Line;
48
+ const { areaColor, transparency, lineColor, highlight, metric_id } =
49
+ nth(index, lines) as Line;
52
50
 
53
51
  return (
54
52
  <g key={`stack-${prop('key', stack)}`}>
@@ -65,6 +63,7 @@ const StackLines = ({
65
63
  )}
66
64
  <path
67
65
  d={linePath(stack) || ''}
66
+ data-metric={metric_id}
68
67
  fill={getFillColor({ areaColor, transparency })}
69
68
  opacity={highlight === false ? 0.3 : 1}
70
69
  stroke={lineColor}
@@ -1,7 +1,7 @@
1
1
  import { Shape } from '@visx/visx';
2
2
  import { isEmpty, isNil } from 'ramda';
3
3
 
4
- import { Circle } from './models';
4
+ import { Circle as CircleModel } from './models';
5
5
  import useCoordinateCircle from './useCoordinateCircle';
6
6
 
7
7
  const Circle = ({
@@ -11,7 +11,7 @@ const Circle = ({
11
11
  timeSeries,
12
12
  getX,
13
13
  getCountDisplayedCircles
14
- }: Circle): JSX.Element | null => {
14
+ }: CircleModel): JSX.Element | null => {
15
15
  const coordinates = useCoordinateCircle({
16
16
  getCountDisplayedCircles,
17
17
  getX,
@@ -2,6 +2,8 @@ import { equals } from 'ramda';
2
2
 
3
3
  import { useTheme } from '@mui/material';
4
4
 
5
+ import { margin } from '../common';
6
+
5
7
  interface Props {
6
8
  hideTooltip: () => void;
7
9
  label: string;
@@ -28,7 +30,7 @@ export const ThresholdLine = ({
28
30
  const onMouseEnter = (): void =>
29
31
  showTooltip({
30
32
  tooltipData: label,
31
- tooltipLeft: 0,
33
+ tooltipLeft: -(margin.left + margin.right),
32
34
  tooltipTop: scaledValue
33
35
  });
34
36
 
@@ -2,7 +2,7 @@ import { equals, isNil } from 'ramda';
2
2
 
3
3
  import { getUnits, getYScale } from '../../common/timeSeries';
4
4
  import { Line } from '../../common/timeSeries/models';
5
- import { Thresholds } from '../../common/models';
5
+ import { Thresholds as ThresholdsModel } from '../../common/models';
6
6
 
7
7
  import { ThresholdLine } from './ThresholdLine';
8
8
 
@@ -13,7 +13,7 @@ interface Props {
13
13
  rightScale: (value: number) => number;
14
14
  showTooltip: (props) => void;
15
15
  thresholdUnit?: string;
16
- thresholds: Thresholds;
16
+ thresholds: ThresholdsModel;
17
17
  width: number;
18
18
  }
19
19
 
@@ -1,6 +1,6 @@
1
1
  import { Dispatch, SetStateAction, useEffect } from 'react';
2
2
 
3
- import { compose, equals, prop, propEq, reject, sortBy, toLower } from 'ramda';
3
+ import { equals, propEq, reject } from 'ramda';
4
4
 
5
5
  import { Line } from '../../common/timeSeries/models';
6
6
 
@@ -28,7 +28,7 @@ const useFilterLines = ({
28
28
  linesGraph,
29
29
  setLinesGraph
30
30
  }: UseFilterLines): Result => {
31
- const displayedLines = reject(propEq('display', false), linesGraph ?? lines);
31
+ const displayedLines = reject(propEq(false, 'display'), linesGraph ?? lines);
32
32
  const filterLines = (): Array<Line> => {
33
33
  const lineOriginMetric = findLineOfOriginMetricThreshold(lines);
34
34
 
@@ -51,9 +51,7 @@ const useFilterLines = ({
51
51
  return;
52
52
  }
53
53
 
54
- const sortedLines = sortBy(compose(toLower, prop('name')), filteredLines);
55
-
56
- setLinesGraph(sortedLines);
54
+ setLinesGraph(filteredLines);
57
55
  }, [lines, displayThreshold]);
58
56
 
59
57
  return { displayedLines, newLines: linesGraph ?? lines };
@@ -1,41 +1,17 @@
1
- import { ScaleLinear } from 'd3-scale';
2
- import { isNil } from 'ramda';
3
-
4
1
  import Typography from '@mui/material/Typography';
5
2
 
6
- import { useLocaleDateTimeFormat, useMemoComponent } from '@centreon/ui';
3
+ import { useMemoComponent } from '@centreon/ui';
7
4
 
8
5
  import { useStyles } from '../LineChart.styles';
9
- import useTickGraph from '../InteractiveComponents/AnchorPoint/useTickGraph';
10
6
  import { LineChartHeader } from '../models';
11
- import { TimeValue } from '../../common/timeSeries/models';
12
7
 
13
8
  interface Props {
14
- displayTimeTick?: boolean;
15
9
  header?: LineChartHeader;
16
- timeSeries: Array<TimeValue>;
17
10
  title: string;
18
- xScale: ScaleLinear<number, number>;
19
11
  }
20
12
 
21
- const Header = ({
22
- title,
23
- displayTimeTick = true,
24
- header,
25
- timeSeries,
26
- xScale
27
- }: Props): JSX.Element => {
13
+ const Header = ({ title, header }: Props): JSX.Element => {
28
14
  const { classes } = useStyles();
29
- const { toDateTime } = useLocaleDateTimeFormat();
30
-
31
- const { tickAxisBottom } = useTickGraph({
32
- timeSeries,
33
- xScale
34
- });
35
- const time =
36
- displayTimeTick && !isNil(tickAxisBottom)
37
- ? toDateTime(tickAxisBottom)
38
- : null;
39
15
 
40
16
  const displayTitle = header?.displayTitle ?? true;
41
17
 
@@ -49,16 +25,12 @@ const Header = ({
49
25
  {title}
50
26
  </Typography>
51
27
  )}
52
-
53
- <Typography align="center" style={{ height: 20 }} variant="body1">
54
- {time}
55
- </Typography>
56
28
  </div>
57
29
  {header?.extraComponent}
58
30
  </div>
59
31
  ),
60
32
 
61
- memoProps: [time, timeSeries, xScale, displayTimeTick, title, header]
33
+ memoProps: [title, header]
62
34
  });
63
35
  };
64
36
 
@@ -1,9 +1,9 @@
1
- import { SvgIcon, SvgIconProps } from '@mui/material';
1
+ import { SvgIconProps } from '@mui/material';
2
2
 
3
- import { ReactComponent as IconDowntime } from '../../../@assets/icons/downtime.icon.svg';
3
+ import { DowntimeIcon } from '../../../Icon/DowntimeIcon';
4
4
 
5
5
  const Downtime = (props: SvgIconProps): JSX.Element => (
6
- <SvgIcon component={IconDowntime} {...props} />
6
+ <DowntimeIcon {...props} />
7
7
  );
8
8
 
9
9
  export default Downtime;
@@ -2,7 +2,7 @@ import { Shape } from '@visx/visx';
2
2
 
3
3
  import { grey } from '@mui/material/colors';
4
4
 
5
- import { GuidingLines } from './models';
5
+ import { GuidingLines as GuidingLinesModel } from './models';
6
6
  import useTickGraph from './useTickGraph';
7
7
 
8
8
  const GuidingLines = ({
@@ -10,7 +10,7 @@ const GuidingLines = ({
10
10
  xScale,
11
11
  graphHeight,
12
12
  graphWidth
13
- }: GuidingLines): JSX.Element | null => {
13
+ }: GuidingLinesModel): JSX.Element | null => {
14
14
  const { positionX, positionY } = useTickGraph({
15
15
  timeSeries,
16
16
  xScale
@@ -2,13 +2,12 @@ import { useEffect, useState } from 'react';
2
2
 
3
3
  import { ScaleLinear } from 'd3-scale';
4
4
  import { useAtomValue } from 'jotai';
5
- import { isEmpty, isNil, not } from 'ramda';
6
5
 
7
6
  import useAxisY from '../../BasicComponents/Axes/useAxisY';
8
7
  import { margin } from '../../common';
9
- import { getMetrics, getTimeValue } from '../../../common/timeSeries';
8
+ import { getTimeValue } from '../../../common/timeSeries';
10
9
  import { Line, TimeValue } from '../../../common/timeSeries/models';
11
- import { mousePositionAtom, timeValueAtom } from '../interactionWithGraphAtoms';
10
+ import { mousePositionAtom } from '../interactionWithGraphAtoms';
12
11
 
13
12
  interface AnchorPointResult {
14
13
  positionX?: number;
@@ -42,14 +41,13 @@ const useTickGraph = ({
42
41
  const { axisRight, axisLeft } = useAxisY({ data: { baseAxis, lines } });
43
42
 
44
43
  const mousePosition = useAtomValue(mousePositionAtom);
45
- const timeValueData = useAtomValue(timeValueAtom);
46
44
 
47
- const metrics = getMetrics(timeValueData as TimeValue);
48
-
49
- const containsMetrics = not(isNil(metrics)) && not(isEmpty(metrics));
50
-
51
- const positionX = mousePosition ? mousePosition[0] - margin.left : undefined;
52
- const positionY = mousePosition ? mousePosition[1] - margin.top : undefined;
45
+ const positionX = mousePosition
46
+ ? mousePosition[0] - margin.left - 4
47
+ : undefined;
48
+ const positionY = mousePosition
49
+ ? mousePosition[1] - margin.top + 2
50
+ : undefined;
53
51
 
54
52
  useEffect(() => {
55
53
  if (!mousePosition) {
@@ -62,7 +60,7 @@ const useTickGraph = ({
62
60
  const mousePositionTimeTick = mousePosition
63
61
  ? getTimeValue({ timeSeries, x: mousePosition[0], xScale }).timeTick
64
62
  : 0;
65
- const timeTickValue = containsMetrics
63
+ const timeTickValue = mousePosition
66
64
  ? new Date(mousePositionTimeTick)
67
65
  : null;
68
66
 
@@ -26,7 +26,7 @@ const EventAnnotations = ({
26
26
  color,
27
27
  annotationHoveredId
28
28
  }: Props): JSX.Element => {
29
- const events = filter(propEq('type', type), data);
29
+ const events = filter(propEq(type, 'type'), data);
30
30
 
31
31
  return (
32
32
  <>
@@ -0,0 +1,68 @@
1
+ import { useAtomValue } from 'jotai';
2
+ import { equals, isNil } from 'ramda';
3
+
4
+ import { Box, Typography } from '@mui/material';
5
+
6
+ import { mousePositionAtom } from '../interactionWithGraphAtoms';
7
+ import { formatMetricValueWithUnit } from '../../../common/timeSeries';
8
+
9
+ import { useGraphValueTooltip } from './useGraphValueTooltip';
10
+ import { useGraphValueTooltipStyles } from './useGraphValueTooltipStyles';
11
+
12
+ interface Props {
13
+ base: number;
14
+ }
15
+
16
+ const GraphValueTooltip = ({ base }: Props): JSX.Element | null => {
17
+ const { classes } = useGraphValueTooltipStyles();
18
+ const mousePosition = useAtomValue(mousePositionAtom);
19
+
20
+ const graphValue = useGraphValueTooltip();
21
+
22
+ if (isNil(graphValue) || isNil(mousePosition)) {
23
+ return null;
24
+ }
25
+
26
+ return (
27
+ <div className={classes.tooltipContainer}>
28
+ <Typography fontWeight="bold">{graphValue.dateTime}</Typography>
29
+ <div className={classes.metrics}>
30
+ {graphValue.metrics.map(({ unit, color, id, value, name }) => {
31
+ const isMetricHighlighted = equals(
32
+ id,
33
+ graphValue.highlightedMetricId
34
+ );
35
+
36
+ return (
37
+ <div
38
+ className={classes.metric}
39
+ data-highlight={isMetricHighlighted}
40
+ data-metric={name}
41
+ key={id}
42
+ >
43
+ <Box
44
+ className={classes.metricColorBox}
45
+ sx={{ backgroundColor: color }}
46
+ />
47
+ <Typography
48
+ className={classes.metricName}
49
+ fontWeight={isMetricHighlighted ? 'bold' : undefined}
50
+ >
51
+ {name}
52
+ </Typography>
53
+ <Typography fontWeight={isMetricHighlighted ? 'bold' : undefined}>
54
+ {formatMetricValueWithUnit({
55
+ base,
56
+ unit,
57
+ value
58
+ })}
59
+ </Typography>
60
+ </div>
61
+ );
62
+ })}
63
+ </div>
64
+ </div>
65
+ );
66
+ };
67
+
68
+ export default GraphValueTooltip;
@@ -0,0 +1,27 @@
1
+ import { useAtomValue } from 'jotai';
2
+ import { isNil } from 'ramda';
3
+
4
+ import { graphTooltipDataAtom } from '../interactionWithGraphAtoms';
5
+ import { useLocaleDateTimeFormat } from '../../../../utils';
6
+ import { GraphTooltipData } from '../../models';
7
+
8
+ interface UseGraphValueTooltipState extends Omit<GraphTooltipData, 'date'> {
9
+ dateTime: string;
10
+ }
11
+
12
+ export const useGraphValueTooltip = (): UseGraphValueTooltipState | null => {
13
+ const { toDate, toTime } = useLocaleDateTimeFormat();
14
+ const graphTooltipData = useAtomValue(graphTooltipDataAtom);
15
+
16
+ if (isNil(graphTooltipData)) {
17
+ return null;
18
+ }
19
+
20
+ const formattedDateTime = `${toDate(graphTooltipData.date)} / ${toTime(graphTooltipData.date)}`;
21
+
22
+ return {
23
+ dateTime: formattedDateTime,
24
+ highlightedMetricId: graphTooltipData.highlightedMetricId,
25
+ metrics: graphTooltipData.metrics
26
+ };
27
+ };
@@ -0,0 +1,31 @@
1
+ import { makeStyles } from 'tss-react/mui';
2
+
3
+ export const useGraphValueTooltipStyles = makeStyles()((theme) => ({
4
+ dateTimeLabel: {
5
+ fontSize: '1.1rem'
6
+ },
7
+ metric: {
8
+ alignItems: 'center',
9
+ display: 'flex',
10
+ gap: theme.spacing(1),
11
+ weidth: '100%'
12
+ },
13
+ metricColorBox: {
14
+ borderRadius: theme.shape.borderRadius,
15
+ flexShrink: 0,
16
+ height: theme.spacing(1.5),
17
+ width: theme.spacing(1.5)
18
+ },
19
+ metricName: {
20
+ flexGrow: 1
21
+ },
22
+ metrics: {
23
+ display: 'flex',
24
+ flexDirection: 'column',
25
+ marginTop: theme.spacing(0.5),
26
+ width: '100%'
27
+ },
28
+ tooltipContainer: {
29
+ padding: theme.spacing(1)
30
+ }
31
+ }));
@@ -1,6 +1,7 @@
1
1
  import { omit } from 'ramda';
2
2
 
3
- import { alpha, useTheme } from '@mui/system';
3
+ import { useTheme } from '@mui/material';
4
+ import { alpha } from '@mui/system';
4
5
 
5
6
  import Bar from '../Bar';
6
7