@centreon/ui 24.4.58 → 24.4.60

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 (584) hide show
  1. package/.storybook/main.js +82 -0
  2. package/.storybook/preview.tsx +21 -0
  3. package/README.md +14 -44
  4. package/jest.config.js +20 -0
  5. package/package.json +36 -113
  6. package/{test/setupTests.js → setupTests.js} +1 -1
  7. package/src/ActionsList/index.stories.tsx +0 -74
  8. package/src/ActionsList/index.tsx +21 -58
  9. package/src/Button/Icon/index.stories.tsx +1 -1
  10. package/src/Button/Icon/index.tsx +4 -13
  11. package/src/Button/Save/StartIcon.tsx +3 -3
  12. package/src/Button/Save/index.stories.tsx +5 -10
  13. package/src/Button/Save/index.tsx +6 -10
  14. package/src/Dialog/Confirm/index.tsx +5 -26
  15. package/src/Dialog/Duplicate/index.test.tsx +1 -1
  16. package/src/Dialog/index.tsx +4 -23
  17. package/src/FallbackPage/FallbackPage.tsx +5 -5
  18. package/src/FileDropZone/index.tsx +2 -4
  19. package/src/Form/CollapsibleGroup.tsx +5 -15
  20. package/src/Form/FormButtons.tsx +4 -2
  21. package/src/Form/Inputs/Autocomplete.tsx +1 -1
  22. package/src/Form/Inputs/ConnectedAutocomplete.tsx +1 -3
  23. package/src/Form/Inputs/Grid.tsx +2 -4
  24. package/src/Form/Inputs/Radio.tsx +5 -16
  25. package/src/Form/Inputs/Switch.tsx +1 -1
  26. package/src/Form/Inputs/Text.tsx +7 -18
  27. package/src/Form/Inputs/index.tsx +16 -34
  28. package/src/Form/Inputs/models.ts +4 -28
  29. package/src/Form/{Form.stories.tsx → index.stories.tsx} +3 -2
  30. package/src/Form/{Form.tsx → index.tsx} +16 -38
  31. package/src/Form/storiesData.tsx +3 -50
  32. package/src/Home.stories.mdx +84 -1
  33. package/src/Image/Image.tsx +1 -11
  34. package/src/Image/index.stories.tsx +2 -2
  35. package/src/Image/index.test.tsx +3 -3
  36. package/src/InputField/Search/PersistentTooltip.tsx +6 -10
  37. package/src/InputField/Search/index.tsx +2 -2
  38. package/src/InputField/Select/Autocomplete/Connected/Multi/index.test.tsx +22 -4
  39. package/src/InputField/Select/Autocomplete/Connected/index.stories.tsx +3 -0
  40. package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +7 -4
  41. package/src/InputField/Select/Autocomplete/Connected/index.tsx +15 -56
  42. package/src/InputField/Select/Autocomplete/Draggable/SortableList.tsx +1 -1
  43. package/src/InputField/Select/Autocomplete/Draggable/SortableListContent.tsx +1 -1
  44. package/src/InputField/Select/Autocomplete/Draggable/index.stories.tsx +2 -0
  45. package/src/InputField/Select/Autocomplete/Draggable/index.tsx +1 -1
  46. package/src/InputField/Select/Autocomplete/Multi/index.tsx +17 -36
  47. package/src/InputField/Select/Autocomplete/index.stories.tsx +10 -1
  48. package/src/InputField/Select/Autocomplete/index.tsx +115 -131
  49. package/src/InputField/Select/IconPopover/index.tsx +3 -3
  50. package/src/InputField/Select/index.tsx +2 -14
  51. package/src/InputField/Text/index.tsx +46 -56
  52. package/src/Listing/ActionBar/index.tsx +18 -25
  53. package/src/Listing/Cell/DataCell.tsx +72 -65
  54. package/src/Listing/Cell/index.tsx +8 -88
  55. package/src/Listing/Header/{_internals/PredefinedSelectionList.tsx → PredefinedSelectionList.tsx} +1 -1
  56. package/src/Listing/Header/{Cell/ListingHeaderCell.tsx → SortableCell/Content.tsx} +83 -18
  57. package/src/Listing/Header/SortableCell/DraggableIcon.tsx +41 -0
  58. package/src/Listing/Header/{ListingHeader.tsx → index.tsx} +106 -29
  59. package/src/Listing/{Row/Row.tsx → Row.tsx} +14 -19
  60. package/src/Listing/Skeleton.tsx +11 -0
  61. package/src/Listing/index.stories.tsx +42 -180
  62. package/src/Listing/index.test.tsx +2 -2
  63. package/src/Listing/index.tsx +273 -286
  64. package/src/Listing/models.ts +0 -2
  65. package/src/Listing/tableAtoms.ts +10 -15
  66. package/src/Listing/useStyleTable.ts +9 -10
  67. package/src/ListingPage/index.stories.tsx +8 -21
  68. package/src/ListingPage/index.tsx +38 -20
  69. package/src/Logo/CentreonLogo.tsx +2 -2
  70. package/src/Module/LicensedModule/LicenseCheck/index.stories.tsx +2 -0
  71. package/src/Module/LicensedModule/LicenseCheck/index.tsx +9 -24
  72. package/src/Module/LicensedModule/index.tsx +1 -7
  73. package/src/Module/index.tsx +4 -2
  74. package/src/Panel/Memoized.tsx +1 -1
  75. package/src/Panel/Section/index.test.tsx +1 -1
  76. package/src/Panel/Section/index.tsx +1 -1
  77. package/src/Panel/index.tsx +7 -11
  78. package/src/PopoverMenu/index.tsx +9 -24
  79. package/src/RichTextEditor/ContentEditable.tsx +24 -70
  80. package/src/RichTextEditor/RichTextEditor.tsx +47 -172
  81. package/src/RichTextEditor/index.stories.tsx +0 -14
  82. package/src/RichTextEditor/plugins/AutoLinkPlugin/index.tsx +5 -53
  83. package/src/RichTextEditor/plugins/FloatingLinkEditorPlugin.tsx +16 -54
  84. package/src/RichTextEditor/plugins/ToolbarPlugin/FormatButtons.tsx +92 -31
  85. package/src/RichTextEditor/plugins/ToolbarPlugin/UndoRedoButtons.tsx +3 -13
  86. package/src/RichTextEditor/plugins/ToolbarPlugin/index.tsx +10 -35
  87. package/src/RichTextEditor/translatedLabels.ts +0 -3
  88. package/src/Snackbar/index.tsx +4 -14
  89. package/src/Snackbar/useSnackbar.tsx +1 -5
  90. package/src/SortableItems/SortableItem.tsx +2 -3
  91. package/src/SortableItems/index.tsx +7 -2
  92. package/src/ThemeProvider/index.tsx +10 -42
  93. package/src/ThemeProvider/palettes.ts +201 -422
  94. package/src/Typography/{Typography.stories.tsx → index.stories.tsx} +5 -5
  95. package/src/WallpaperPage/index.stories.tsx +1 -1
  96. package/src/Wizard/ActionsBar.test.tsx +1 -1
  97. package/src/Wizard/WizardContent.tsx +3 -2
  98. package/src/Wizard/index.stories.tsx +18 -5
  99. package/src/Wizard/index.test.tsx +1 -1
  100. package/src/Wizard/index.tsx +5 -20
  101. package/src/Wizard/models.ts +0 -7
  102. package/src/__image_snapshots__/storyshots-test-js-image-story-shots-listing-loading-with-no-data-1-snap.png +0 -0
  103. package/src/api/QueryProvider.tsx +1 -1
  104. package/src/api/TestQueryProvider.tsx +1 -2
  105. package/src/api/buildListingEndpoint/getSearchQueryParameterValue.ts +26 -35
  106. package/src/api/buildListingEndpoint/index.test.ts +2 -2
  107. package/src/api/buildListingEndpoint/index.ts +1 -1
  108. package/src/api/buildListingEndpoint/models.ts +2 -2
  109. package/src/api/customFetch.ts +3 -22
  110. package/src/api/useFetchQuery/index.ts +37 -62
  111. package/src/api/useMutationQuery/index.test.ts +4 -4
  112. package/src/api/useMutationQuery/index.ts +22 -88
  113. package/src/api/useRequest/index.ts +6 -9
  114. package/src/index.ts +21 -32
  115. package/src/queryParameters/url/index.ts +1 -5
  116. package/src/storyshots.test.js +52 -0
  117. package/{test → src}/testRenderer.tsx +1 -1
  118. package/src/utils/getNormalizedId.ts +3 -1
  119. package/src/utils/useCopyToClipboard.ts +3 -2
  120. package/src/utils/useDebounce.ts +5 -8
  121. package/src/utils/useDeepCallback.ts +3 -1
  122. package/src/utils/useDeepMemo.ts +3 -1
  123. package/src/utils/useIntersectionObserver.ts +5 -5
  124. package/src/utils/useKeyObserver.tsx +3 -1
  125. package/src/utils/useLocaleDateTimeFormat/index.test.tsx +1 -1
  126. package/src/utils/useLocaleDateTimeFormat/index.ts +2 -4
  127. package/src/utils/useLocaleDateTimeFormat/localeFallback.test.tsx +1 -1
  128. package/src/utils/useMemoComponent.ts +1 -1
  129. package/testRunner.js +36 -0
  130. package/tsconfig.json +29 -0
  131. package/types/declarations.d.ts +9 -0
  132. package/public/README.md +0 -39
  133. package/public/mockServiceWorker.js +0 -303
  134. package/src/@assets/README.md +0 -5
  135. package/src/@assets/brand/centreon-logo-one-line-dark.svg +0 -1
  136. package/src/@assets/brand/centreon-logo-one-line-light.svg +0 -1
  137. package/src/@assets/icons/downtime.icon.svg +0 -1
  138. package/src/@types/aria-attributes.d.ts +0 -10
  139. package/src/@types/data-attributes.d.ts +0 -3
  140. package/src/@types/globals.d.ts +0 -9
  141. package/src/@types/vite-env.d.ts +0 -2
  142. package/src/ActionsList/ActionsList.styles.ts +0 -116
  143. package/src/ActionsList/models.ts +0 -8
  144. package/src/Checkbox/Checkbox.tsx +0 -109
  145. package/src/Checkbox/CheckboxGroup/index.stories.tsx +0 -41
  146. package/src/Checkbox/CheckboxGroup/index.tsx +0 -75
  147. package/src/Checkbox/index.stories.tsx +0 -39
  148. package/src/Checkbox/index.tsx +0 -2
  149. package/src/Dashboard/Dashboard.styles.ts +0 -108
  150. package/src/Dashboard/DashboardLayout.stories.tsx +0 -104
  151. package/src/Dashboard/Grid.tsx +0 -70
  152. package/src/Dashboard/Item.tsx +0 -100
  153. package/src/Dashboard/Layout.tsx +0 -79
  154. package/src/Dashboard/index.tsx +0 -9
  155. package/src/Dashboard/utils.ts +0 -28
  156. package/src/Form/Form.cypress.spec.tsx +0 -133
  157. package/src/Form/Form.styles.ts +0 -11
  158. package/src/Form/Inputs/Checkbox.tsx +0 -57
  159. package/src/Form/Inputs/CheckboxGroup.tsx +0 -76
  160. package/src/Form/Inputs/List/Content.tsx +0 -62
  161. package/src/Form/Inputs/List/List.styles.ts +0 -29
  162. package/src/Form/Inputs/List/List.tsx +0 -58
  163. package/src/Form/Inputs/List/useList.ts +0 -81
  164. package/src/Form/index.ts +0 -1
  165. package/src/Graph/BarStack/BarStack.cypress.spec.tsx +0 -154
  166. package/src/Graph/BarStack/BarStack.stories.tsx +0 -123
  167. package/src/Graph/BarStack/BarStack.styles.ts +0 -37
  168. package/src/Graph/BarStack/BarStack.tsx +0 -14
  169. package/src/Graph/BarStack/ResponsiveBarStack.tsx +0 -222
  170. package/src/Graph/BarStack/index.ts +0 -1
  171. package/src/Graph/BarStack/models.ts +0 -20
  172. package/src/Graph/BarStack/useResponsiveBarStack.ts +0 -137
  173. package/src/Graph/Gauge/AnimatedPie.tsx +0 -102
  174. package/src/Graph/Gauge/Gauge.cypress.spec.tsx +0 -102
  175. package/src/Graph/Gauge/Gauge.stories.tsx +0 -159
  176. package/src/Graph/Gauge/Gauge.tsx +0 -41
  177. package/src/Graph/Gauge/PieData.tsx +0 -63
  178. package/src/Graph/Gauge/ResponsiveGauge.tsx +0 -148
  179. package/src/Graph/Gauge/Thresholds.tsx +0 -117
  180. package/src/Graph/Gauge/index.ts +0 -1
  181. package/src/Graph/Gauge/models.ts +0 -20
  182. package/src/Graph/HeatMap/HeatMap.cypress.spec.tsx +0 -145
  183. package/src/Graph/HeatMap/HeatMap.stories.tsx +0 -80
  184. package/src/Graph/HeatMap/HeatMap.styles.tsx +0 -29
  185. package/src/Graph/HeatMap/HeatMap.tsx +0 -12
  186. package/src/Graph/HeatMap/HeatMapData.json +0 -137
  187. package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +0 -104
  188. package/src/Graph/HeatMap/index.ts +0 -1
  189. package/src/Graph/HeatMap/model.ts +0 -33
  190. package/src/Graph/Legend/Legend.tsx +0 -21
  191. package/src/Graph/Legend/index.ts +0 -1
  192. package/src/Graph/Legend/models.ts +0 -11
  193. package/src/Graph/LineChart/BasicComponents/Axes/UnitLabel.tsx +0 -20
  194. package/src/Graph/LineChart/BasicComponents/Axes/index.tsx +0 -88
  195. package/src/Graph/LineChart/BasicComponents/Axes/models.ts +0 -26
  196. package/src/Graph/LineChart/BasicComponents/Axes/useAxisY.ts +0 -100
  197. package/src/Graph/LineChart/BasicComponents/Grids/index.tsx +0 -20
  198. package/src/Graph/LineChart/BasicComponents/Lines/RegularLines/index.tsx +0 -99
  199. package/src/Graph/LineChart/BasicComponents/Lines/RegularLines/useRegularLines.ts +0 -15
  200. package/src/Graph/LineChart/BasicComponents/Lines/StackedLines/index.tsx +0 -81
  201. package/src/Graph/LineChart/BasicComponents/Lines/StackedLines/useStackedLines.ts +0 -39
  202. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/BasicThreshold.tsx +0 -53
  203. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/Circle.tsx +0 -43
  204. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/ThresholdWithPatternLines.tsx +0 -78
  205. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/ThresholdWithVariation.tsx +0 -63
  206. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/helpers/index.ts +0 -69
  207. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/index.tsx +0 -142
  208. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/models.ts +0 -105
  209. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/useCoordinateCircle.ts +0 -46
  210. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/useScaleThreshold.ts +0 -171
  211. package/src/Graph/LineChart/BasicComponents/Lines/index.tsx +0 -189
  212. package/src/Graph/LineChart/BasicComponents/Lines/models.ts +0 -45
  213. package/src/Graph/LineChart/BasicComponents/LoadingProgress.tsx +0 -46
  214. package/src/Graph/LineChart/BasicComponents/ThresholdLine.tsx +0 -64
  215. package/src/Graph/LineChart/BasicComponents/Thresholds.tsx +0 -77
  216. package/src/Graph/LineChart/BasicComponents/useFilterLines.ts +0 -60
  217. package/src/Graph/LineChart/Header/index.tsx +0 -65
  218. package/src/Graph/LineChart/Icons/Downtime.tsx +0 -9
  219. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/GuidingLines.tsx +0 -45
  220. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/RegularAnchorPoint.tsx +0 -66
  221. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/StackedAnchorPoint.tsx +0 -76
  222. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/TooltipAnchorPoint.tsx +0 -96
  223. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/index.tsx +0 -20
  224. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/models.ts +0 -62
  225. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTickGraph.ts +0 -94
  226. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTooltipAnchorPoint.ts +0 -107
  227. package/src/Graph/LineChart/InteractiveComponents/Annotations/Annotation/Area.tsx +0 -114
  228. package/src/Graph/LineChart/InteractiveComponents/Annotations/Annotation/Line.tsx +0 -103
  229. package/src/Graph/LineChart/InteractiveComponents/Annotations/Annotation/index.tsx +0 -81
  230. package/src/Graph/LineChart/InteractiveComponents/Annotations/Area/Downtime.tsx +0 -27
  231. package/src/Graph/LineChart/InteractiveComponents/Annotations/EventAnnotations.tsx +0 -61
  232. package/src/Graph/LineChart/InteractiveComponents/Annotations/Line/Acknowledgement.tsx +0 -27
  233. package/src/Graph/LineChart/InteractiveComponents/Annotations/Line/Comments.tsx +0 -25
  234. package/src/Graph/LineChart/InteractiveComponents/Annotations/annotationsAtoms.ts +0 -183
  235. package/src/Graph/LineChart/InteractiveComponents/Annotations/index.tsx +0 -49
  236. package/src/Graph/LineChart/InteractiveComponents/Annotations/models.ts +0 -25
  237. package/src/Graph/LineChart/InteractiveComponents/Annotations/useAnnotation.ts +0 -56
  238. package/src/Graph/LineChart/InteractiveComponents/Bar.tsx +0 -21
  239. package/src/Graph/LineChart/InteractiveComponents/TimeShiftZones/TimeShiftIcon.tsx +0 -62
  240. package/src/Graph/LineChart/InteractiveComponents/TimeShiftZones/TimeShiftZone.tsx +0 -74
  241. package/src/Graph/LineChart/InteractiveComponents/TimeShiftZones/index.tsx +0 -85
  242. package/src/Graph/LineChart/InteractiveComponents/TimeShiftZones/models.ts +0 -12
  243. package/src/Graph/LineChart/InteractiveComponents/TimeShiftZones/useTimeShiftZones.ts +0 -72
  244. package/src/Graph/LineChart/InteractiveComponents/Tooltip/index.tsx +0 -59
  245. package/src/Graph/LineChart/InteractiveComponents/Tooltip/models.ts +0 -9
  246. package/src/Graph/LineChart/InteractiveComponents/Tooltip/useGraphTooltip.ts +0 -67
  247. package/src/Graph/LineChart/InteractiveComponents/ZoomPreview/index.tsx +0 -38
  248. package/src/Graph/LineChart/InteractiveComponents/ZoomPreview/models.ts +0 -9
  249. package/src/Graph/LineChart/InteractiveComponents/ZoomPreview/useZoomPreview.ts +0 -107
  250. package/src/Graph/LineChart/InteractiveComponents/ZoomPreview/zoomPreviewAtoms.ts +0 -3
  251. package/src/Graph/LineChart/InteractiveComponents/index.tsx +0 -168
  252. package/src/Graph/LineChart/InteractiveComponents/interactionWithGraphAtoms.ts +0 -52
  253. package/src/Graph/LineChart/Legend/InteractiveValue.tsx +0 -22
  254. package/src/Graph/LineChart/Legend/Legend.styles.ts +0 -117
  255. package/src/Graph/LineChart/Legend/LegendContent.tsx +0 -33
  256. package/src/Graph/LineChart/Legend/LegendHeader.tsx +0 -93
  257. package/src/Graph/LineChart/Legend/index.tsx +0 -200
  258. package/src/Graph/LineChart/Legend/models.ts +0 -16
  259. package/src/Graph/LineChart/Legend/useInteractiveValues.ts +0 -99
  260. package/src/Graph/LineChart/Legend/useLegend.ts +0 -104
  261. package/src/Graph/LineChart/LineChart.styles.ts +0 -45
  262. package/src/Graph/LineChart/LineChart.tsx +0 -320
  263. package/src/Graph/LineChart/LoadingSkeleton.tsx +0 -44
  264. package/src/Graph/LineChart/common/index.ts +0 -35
  265. package/src/Graph/LineChart/graphAtoms.ts +0 -3
  266. package/src/Graph/LineChart/helpers/doc.ts +0 -563
  267. package/src/Graph/LineChart/helpers/index.ts +0 -63
  268. package/src/Graph/LineChart/index.stories.tsx +0 -480
  269. package/src/Graph/LineChart/index.tsx +0 -118
  270. package/src/Graph/LineChart/mockedData/annotationData.json +0 -326
  271. package/src/Graph/LineChart/mockedData/exclusionPeriodFirstPeriod.json +0 -588
  272. package/src/Graph/LineChart/mockedData/exclusionPeriodSecondPeriod.json +0 -588
  273. package/src/Graph/LineChart/mockedData/exclusionPeriodThirdPeriod.json +0 -581
  274. package/src/Graph/LineChart/mockedData/lastDay.json +0 -1326
  275. package/src/Graph/LineChart/mockedData/lastDayAreaStack.json +0 -3106
  276. package/src/Graph/LineChart/mockedData/lastDayForward.json +0 -1338
  277. package/src/Graph/LineChart/mockedData/lastDayThreshold.json +0 -2352
  278. package/src/Graph/LineChart/mockedData/lastMonth.json +0 -1674
  279. package/src/Graph/LineChart/mockedData/lastWeek.json +0 -2202
  280. package/src/Graph/LineChart/mockedData/zoomPreview.json +0 -742
  281. package/src/Graph/LineChart/models.ts +0 -146
  282. package/src/Graph/LineChart/translatedLabels.ts +0 -9
  283. package/src/Graph/LineChart/useLineChartData.ts +0 -49
  284. package/src/Graph/LineChart/useLineChartIntersection.ts +0 -36
  285. package/src/Graph/PieChart/PieChart.cypress.spec.tsx +0 -169
  286. package/src/Graph/PieChart/PieChart.stories.tsx +0 -194
  287. package/src/Graph/PieChart/PieChart.styles.ts +0 -39
  288. package/src/Graph/PieChart/PieChart.tsx +0 -14
  289. package/src/Graph/PieChart/ResponsivePie.tsx +0 -254
  290. package/src/Graph/PieChart/index.ts +0 -1
  291. package/src/Graph/PieChart/models.ts +0 -20
  292. package/src/Graph/PieChart/useResponsivePie.ts +0 -85
  293. package/src/Graph/SingleBar/ResponsiveSingleBar.tsx +0 -197
  294. package/src/Graph/SingleBar/SingleBar.cypress.spec.tsx +0 -121
  295. package/src/Graph/SingleBar/SingleBar.stories.tsx +0 -204
  296. package/src/Graph/SingleBar/SingleBar.tsx +0 -25
  297. package/src/Graph/SingleBar/ThresholdLine.tsx +0 -103
  298. package/src/Graph/SingleBar/Thresholds.tsx +0 -50
  299. package/src/Graph/SingleBar/index.ts +0 -1
  300. package/src/Graph/SingleBar/models.ts +0 -10
  301. package/src/Graph/Text/Text.cypress.spec.tsx +0 -101
  302. package/src/Graph/Text/Text.stories.tsx +0 -123
  303. package/src/Graph/Text/Text.styles.ts +0 -17
  304. package/src/Graph/Text/Text.tsx +0 -91
  305. package/src/Graph/Text/index.ts +0 -1
  306. package/src/Graph/common/margins.ts +0 -1
  307. package/src/Graph/common/models.ts +0 -19
  308. package/src/Graph/common/testUtils.ts +0 -71
  309. package/src/Graph/common/timeSeries/index.test.ts +0 -624
  310. package/src/Graph/common/timeSeries/index.ts +0 -634
  311. package/src/Graph/common/timeSeries/models.ts +0 -129
  312. package/src/Graph/common/utils.ts +0 -94
  313. package/src/Graph/index.ts +0 -8
  314. package/src/Graph/translatedLabels.ts +0 -1
  315. package/src/InputField/Number/Number.cypress.spec.tsx +0 -85
  316. package/src/InputField/Number/Number.stories.tsx +0 -66
  317. package/src/InputField/Number/Number.tsx +0 -74
  318. package/src/InputField/Select/Autocomplete/Connected/Multi/MultiConnectedAutocompleteField.cypress.spec.tsx +0 -127
  319. package/src/InputField/Select/Autocomplete/Connected/Multi/utils/index.ts +0 -22
  320. package/src/Listing/Cell/DataCell.styles.ts +0 -27
  321. package/src/Listing/EmptyResult/EmptyResult.tsx +0 -13
  322. package/src/Listing/Header/Cell/ListingHeaderCell.styles.ts +0 -71
  323. package/src/Listing/Header/Cell/SelectActionListingHeaderCell.styles.ts +0 -26
  324. package/src/Listing/Header/Cell/SelectActionListingHeaderCell.tsx +0 -70
  325. package/src/Listing/Header/ListingHeader.styles.ts +0 -16
  326. package/src/Listing/Header/_internals/DraggableIconButton.tsx +0 -35
  327. package/src/Listing/Header/index.ts +0 -1
  328. package/src/Listing/Listing.cypress.spec.tsx +0 -307
  329. package/src/Listing/Listing.styles.ts +0 -78
  330. package/src/Listing/ListingDocs.mdx +0 -61
  331. package/src/Listing/Row/EmptyRow.styles.ts +0 -14
  332. package/src/Listing/Row/EmptyRow.tsx +0 -30
  333. package/src/Listing/Row/SkeletonLoaderRows.tsx +0 -23
  334. package/src/Module/Module.cypress.spec.tsx +0 -129
  335. package/src/ParentSize/ParentSize.tsx +0 -24
  336. package/src/ParentSize/index.ts +0 -1
  337. package/src/RichTextEditor/RichTextEditor.cypress.spec.tsx +0 -408
  338. package/src/RichTextEditor/plugins/ToolbarPlugin/AlignPicker.tsx +0 -116
  339. package/src/RichTextEditor/plugins/ToolbarPlugin/BlockButtons.tsx +0 -155
  340. package/src/RichTextEditor/plugins/ToolbarPlugin/LinkButton.tsx +0 -106
  341. package/src/RichTextEditor/plugins/ToolbarPlugin/ListButton.tsx +0 -155
  342. package/src/RichTextEditor/plugins/ToolbarPlugin/MacrosButton.tsx +0 -75
  343. package/src/RichTextEditor/plugins/ToolbarPlugin/ToolbarPlugin.styles.ts +0 -32
  344. package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.styles.ts +0 -50
  345. package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.tsx +0 -95
  346. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/ErrorText.tsx +0 -14
  347. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +0 -171
  348. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/index.tsx +0 -76
  349. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +0 -59
  350. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/usePickersStartEndDate.ts +0 -82
  351. package/src/TimePeriods/CustomTimePeriod/SimpleCustomTimePeriod.tsx +0 -28
  352. package/src/TimePeriods/CustomTimePeriod/index.tsx +0 -66
  353. package/src/TimePeriods/DateTimePickerInput.tsx +0 -86
  354. package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +0 -68
  355. package/src/TimePeriods/SelectedTimePeriod.tsx +0 -102
  356. package/src/TimePeriods/TimePeriods.cypress.spec.tsx +0 -486
  357. package/src/TimePeriods/TimePeriods.styles.ts +0 -22
  358. package/src/TimePeriods/helpers/index.ts +0 -26
  359. package/src/TimePeriods/index.stories.tsx +0 -121
  360. package/src/TimePeriods/index.tsx +0 -79
  361. package/src/TimePeriods/mockedData.ts +0 -12
  362. package/src/TimePeriods/models.ts +0 -97
  363. package/src/TimePeriods/timePeriodsAtoms.ts +0 -102
  364. package/src/TimePeriods/translatedLabels.ts +0 -9
  365. package/src/TimePeriods/useSortTimePeriods.ts +0 -31
  366. package/src/TimePeriods/useTimePeriod.ts +0 -49
  367. package/src/Typography/EllipsisTypography.tsx +0 -18
  368. package/src/Typography/FluidTypography/FluidTypography.cypress.spec.tsx +0 -27
  369. package/src/Typography/FluidTypography/index.stories.tsx +0 -63
  370. package/src/Typography/FluidTypography/index.tsx +0 -44
  371. package/src/Typography/Subtitle.tsx +0 -55
  372. package/src/__image_snapshots__/storyshots-test-js-image-story-shots-dashboard-normal-1-snap.png +0 -0
  373. package/src/__image_snapshots__/storyshots-test-js-image-story-shots-dashboard-with-item-header-1-snap.png +0 -0
  374. package/src/__image_snapshots__/storyshots-test-js-image-story-shots-dashboard-with-many-panels-1-snap.png +0 -0
  375. package/src/__image_snapshots__/storyshots-test-js-image-story-shots-fluid-typography-basic-1-snap.png +0 -0
  376. package/src/__image_snapshots__/storyshots-test-js-image-story-shots-fluid-typography-with-20-px-height-1-snap.png +0 -0
  377. package/src/__image_snapshots__/storyshots-test-js-image-story-shots-fluid-typography-with-200-px-width-1-snap.png +0 -0
  378. package/src/__image_snapshots__/storyshots-test-js-image-story-shots-fluid-typography-with-heading-5-variant-1-snap.png +0 -0
  379. package/src/__image_snapshots__/storyshots-test-js-image-story-shots-fluid-typography-with-long-text-1-snap.png +0 -0
  380. package/src/__image_snapshots__/storyshots-test-js-image-story-shots-listing-as-empty-state-1-snap.png +0 -0
  381. package/src/__image_snapshots__/storyshots-test-js-image-story-shots-listing-with-editable-and-sortable-columns-1-snap.png +0 -0
  382. package/src/api/useGraphQuery/index.ts +0 -187
  383. package/src/api/useGraphQuery/models.ts +0 -20
  384. package/src/base/tokens/README.md +0 -3
  385. package/src/base/tokens/source/$metadata.json +0 -5
  386. package/src/base/tokens/source/base.json +0 -142
  387. package/src/base/tokens/themes/base.tokens.d.ts +0 -38
  388. package/src/base/tokens/themes/base.tokens.json +0 -695
  389. package/src/base/tokens/themes/base.tokens.ts +0 -38
  390. package/src/base/tokens/themes/ui-dark.tokens.d.ts +0 -38
  391. package/src/base/tokens/themes/ui-dark.tokens.json +0 -695
  392. package/src/base/tokens/themes/ui-dark.tokens.ts +0 -38
  393. package/src/base/tokens/themes/ui-light.tokens.d.ts +0 -38
  394. package/src/base/tokens/themes/ui-light.tokens.json +0 -695
  395. package/src/base/tokens/themes/ui-light.tokens.ts +0 -38
  396. package/src/components/Avatar/Avatar.stories.tsx +0 -23
  397. package/src/components/Avatar/Avatar.styles.ts +0 -11
  398. package/src/components/Avatar/Avatar.tsx +0 -32
  399. package/src/components/Avatar/index.ts +0 -1
  400. package/src/components/Button/Button.stories.tsx +0 -34
  401. package/src/components/Button/Button.styles.ts +0 -44
  402. package/src/components/Button/Button.tsx +0 -78
  403. package/src/components/Button/Icon/IconButton.stories.tsx +0 -18
  404. package/src/components/Button/Icon/IconButton.styles.ts +0 -14
  405. package/src/components/Button/Icon/IconButton.tsx +0 -62
  406. package/src/components/Button/Icon/index.tsx +0 -1
  407. package/src/components/Button/index.ts +0 -2
  408. package/src/components/CollapsibleItem/CollapsibleItem.cypress.spec.tsx +0 -76
  409. package/src/components/CollapsibleItem/CollapsibleItem.stories.tsx +0 -51
  410. package/src/components/CollapsibleItem/CollapsibleItem.tsx +0 -76
  411. package/src/components/CollapsibleItem/index.ts +0 -1
  412. package/src/components/CollapsibleItem/useCollapsibleItemStyles.ts +0 -38
  413. package/src/components/DataTable/DataListing.tsx +0 -6
  414. package/src/components/DataTable/DataTable.cypress.spec.tsx +0 -193
  415. package/src/components/DataTable/DataTable.stories.tsx +0 -91
  416. package/src/components/DataTable/DataTable.styles.ts +0 -30
  417. package/src/components/DataTable/DataTable.tsx +0 -35
  418. package/src/components/DataTable/EmptyState/DataTableEmptyState.stories.tsx +0 -21
  419. package/src/components/DataTable/EmptyState/DataTableEmptyState.styles.ts +0 -26
  420. package/src/components/DataTable/EmptyState/DataTableEmptyState.tsx +0 -53
  421. package/src/components/DataTable/Item/DataTableItem.stories.tsx +0 -25
  422. package/src/components/DataTable/Item/DataTableItem.styles.ts +0 -38
  423. package/src/components/DataTable/Item/DataTableItem.tsx +0 -104
  424. package/src/components/DataTable/Item/DataTableItemSkeleton.tsx +0 -13
  425. package/src/components/DataTable/index.ts +0 -12
  426. package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +0 -373
  427. package/src/components/Form/AccessRights/AccessRights.stories.tsx +0 -119
  428. package/src/components/Form/AccessRights/AccessRights.styles.ts +0 -10
  429. package/src/components/Form/AccessRights/AccessRights.tsx +0 -60
  430. package/src/components/Form/AccessRights/Actions/Actions.styles.ts +0 -14
  431. package/src/components/Form/AccessRights/Actions/Actions.tsx +0 -81
  432. package/src/components/Form/AccessRights/Actions/useActions.ts +0 -79
  433. package/src/components/Form/AccessRights/List/Item.tsx +0 -90
  434. package/src/components/Form/AccessRights/List/List.styles.tsx +0 -45
  435. package/src/components/Form/AccessRights/List/List.tsx +0 -52
  436. package/src/components/Form/AccessRights/List/ListItemSkeleton.tsx +0 -18
  437. package/src/components/Form/AccessRights/List/ListSkeleton.tsx +0 -22
  438. package/src/components/Form/AccessRights/List/RemoveAccessRight.tsx +0 -38
  439. package/src/components/Form/AccessRights/List/StateChip.tsx +0 -28
  440. package/src/components/Form/AccessRights/List/useItem.ts +0 -64
  441. package/src/components/Form/AccessRights/Provider.tsx +0 -15
  442. package/src/components/Form/AccessRights/ShareInput/ContactSwitch.tsx +0 -50
  443. package/src/components/Form/AccessRights/ShareInput/ShareInput.styles.ts +0 -17
  444. package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +0 -78
  445. package/src/components/Form/AccessRights/ShareInput/useShareInput.tsx +0 -113
  446. package/src/components/Form/AccessRights/Stats/Stats.tsx +0 -36
  447. package/src/components/Form/AccessRights/atoms.ts +0 -97
  448. package/src/components/Form/AccessRights/common/RoleSelectField.styles.tsx +0 -7
  449. package/src/components/Form/AccessRights/common/RoleSelectField.tsx +0 -45
  450. package/src/components/Form/AccessRights/models.ts +0 -55
  451. package/src/components/Form/AccessRights/storiesData.ts +0 -222
  452. package/src/components/Form/AccessRights/useAccessRightsInitValues.ts +0 -51
  453. package/src/components/Form/Dashboard/Dashboard.resource.ts +0 -9
  454. package/src/components/Form/Dashboard/DashboardForm.stories.ts +0 -39
  455. package/src/components/Form/Dashboard/DashboardForm.styles.ts +0 -21
  456. package/src/components/Form/Dashboard/DashboardForm.tsx +0 -137
  457. package/src/components/Form/Dashboard/GlobalRefreshFieldOption.tsx +0 -59
  458. package/src/components/Form/Dashboard/index.ts +0 -2
  459. package/src/components/Form/Dashboard/translatedLabels.ts +0 -9
  460. package/src/components/Form/Form.models.ts +0 -1
  461. package/src/components/Form/Form.resource.ts +0 -1
  462. package/src/components/Form/Form.styles.ts +0 -17
  463. package/src/components/Form/FormActions.tsx +0 -57
  464. package/src/components/Form/index.ts +0 -4
  465. package/src/components/Header/PageHeader/PageHeader.stories.tsx +0 -97
  466. package/src/components/Header/PageHeader/PageHeader.styles.ts +0 -126
  467. package/src/components/Header/PageHeader/PageHeader.tsx +0 -15
  468. package/src/components/Header/PageHeader/PageHeaderActions.tsx +0 -17
  469. package/src/components/Header/PageHeader/PageHeaderMain.tsx +0 -15
  470. package/src/components/Header/PageHeader/PageHeaderMenu.tsx +0 -15
  471. package/src/components/Header/PageHeader/PageHeaderMessage.tsx +0 -32
  472. package/src/components/Header/PageHeader/PageHeaderTitle.tsx +0 -47
  473. package/src/components/Header/PageHeader/index.ts +0 -14
  474. package/src/components/Header/index.ts +0 -1
  475. package/src/components/Icon/Icon.styles.ts +0 -0
  476. package/src/components/Icon/Icon.tsx +0 -2
  477. package/src/components/Icon/index.ts +0 -0
  478. package/src/components/Inputs/Switch/Switch.stories.tsx +0 -22
  479. package/src/components/Inputs/Switch/Switch.styles.ts +0 -13
  480. package/src/components/Inputs/Switch/Switch.tsx +0 -18
  481. package/src/components/Inputs/index.ts +0 -1
  482. package/src/components/ItemComposition/Item.tsx +0 -41
  483. package/src/components/ItemComposition/ItemComposition.cypress.spec.tsx +0 -113
  484. package/src/components/ItemComposition/ItemComposition.stories.tsx +0 -92
  485. package/src/components/ItemComposition/ItemComposition.styles.ts +0 -62
  486. package/src/components/ItemComposition/ItemComposition.tsx +0 -71
  487. package/src/components/ItemComposition/index.ts +0 -6
  488. package/src/components/Layout/AreaIndicator.styles.ts +0 -33
  489. package/src/components/Layout/AreaIndicator.tsx +0 -35
  490. package/src/components/Layout/PageLayout/PageLayout.stories.tsx +0 -81
  491. package/src/components/Layout/PageLayout/PageLayout.styles.ts +0 -41
  492. package/src/components/Layout/PageLayout/PageLayout.tsx +0 -21
  493. package/src/components/Layout/PageLayout/PageLayoutActions.tsx +0 -25
  494. package/src/components/Layout/PageLayout/PageLayoutBody.tsx +0 -25
  495. package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +0 -19
  496. package/src/components/Layout/PageLayout/PageQuickAccess.tsx +0 -76
  497. package/src/components/Layout/PageLayout/index.ts +0 -12
  498. package/src/components/Layout/PageLayout.cypress.spec.tsx +0 -66
  499. package/src/components/Layout/index.ts +0 -1
  500. package/src/components/List/Item/Avatar.tsx +0 -21
  501. package/src/components/List/Item/AvatarSkeleton.tsx +0 -17
  502. package/src/components/List/Item/ListItem.stories.tsx +0 -41
  503. package/src/components/List/Item/ListItem.styles.ts +0 -63
  504. package/src/components/List/Item/ListItem.tsx +0 -34
  505. package/src/components/List/Item/Text.tsx +0 -27
  506. package/src/components/List/Item/TextSkeleton.tsx +0 -22
  507. package/src/components/List/Item/index.ts +0 -14
  508. package/src/components/List/List.stories.tsx +0 -70
  509. package/src/components/List/List.styles.ts +0 -8
  510. package/src/components/List/List.tsx +0 -19
  511. package/src/components/List/index.ts +0 -6
  512. package/src/components/Menu/Button/MenuButton.stories.tsx +0 -16
  513. package/src/components/Menu/Button/MenuButton.styles.ts +0 -27
  514. package/src/components/Menu/Button/MenuButton.tsx +0 -67
  515. package/src/components/Menu/Button/index.ts +0 -1
  516. package/src/components/Menu/Menu.stories.tsx +0 -71
  517. package/src/components/Menu/Menu.styles.ts +0 -68
  518. package/src/components/Menu/Menu.tsx +0 -25
  519. package/src/components/Menu/MenuDivider.tsx +0 -13
  520. package/src/components/Menu/MenuItem.tsx +0 -38
  521. package/src/components/Menu/MenuItems.tsx +0 -36
  522. package/src/components/Menu/index.ts +0 -12
  523. package/src/components/Menu/useMenu.tsx +0 -79
  524. package/src/components/Modal/Modal.stories.tsx +0 -142
  525. package/src/components/Modal/Modal.styles.ts +0 -96
  526. package/src/components/Modal/Modal.tsx +0 -79
  527. package/src/components/Modal/ModalActions.tsx +0 -64
  528. package/src/components/Modal/ModalBody.tsx +0 -15
  529. package/src/components/Modal/ModalHeader.tsx +0 -21
  530. package/src/components/Modal/index.ts +0 -12
  531. package/src/components/README.md +0 -3
  532. package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.stories.tsx +0 -62
  533. package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.styles.tsx +0 -22
  534. package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.tsx +0 -68
  535. package/src/components/Tooltip/ConfirmationTooltip/TooltipContent.tsx +0 -31
  536. package/src/components/Tooltip/ConfirmationTooltip/index.ts +0 -1
  537. package/src/components/Tooltip/ConfirmationTooltip/models.ts +0 -18
  538. package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.stories.tsx +0 -70
  539. package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.styles.ts +0 -5
  540. package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.tsx +0 -115
  541. package/src/components/Tooltip/TextOverflowTooltip/index.tsx +0 -1
  542. package/src/components/Tooltip/Tooltip.stories.tsx +0 -41
  543. package/src/components/Tooltip/Tooltip.tsx +0 -57
  544. package/src/components/Tooltip/index.ts +0 -2
  545. package/src/components/index.ts +0 -13
  546. package/src/styles/tokens/themes/_ui-dark.tokens.json +0 -695
  547. package/src/styles/tokens/themes/_ui-light.tokens.json +0 -695
  548. package/src/utils/centreonBaseURL.ts +0 -4
  549. package/src/utils/docsURL.ts +0 -31
  550. package/src/utils/index.ts +0 -24
  551. package/src/utils/panelSize.ts +0 -15
  552. package/src/utils/sanitizedHTML.ts +0 -18
  553. package/src/utils/translatedLabel.ts +0 -2
  554. package/src/utils/useFullscreen/Fullscreen.cypress.spec.tsx +0 -130
  555. package/src/utils/useFullscreen/atoms.ts +0 -3
  556. package/src/utils/useFullscreen/index.ts +0 -2
  557. package/src/utils/useFullscreen/translatedLabels.ts +0 -1
  558. package/src/utils/useFullscreen/useFullscreen.ts +0 -73
  559. package/src/utils/useFullscreen/useFullscreenListener.ts +0 -62
  560. package/src/utils/useInfiniteScrollListing.ts +0 -124
  561. package/src/utils/useLicenseExpirationWarning.test.tsx +0 -148
  562. package/src/utils/useLicenseExpirationWarning.ts +0 -52
  563. package/src/utils/usePluralizedTranslation.ts +0 -21
  564. package/src/utils/useRefreshInterval.ts +0 -39
  565. package/src/utils/useResizeObserver.ts +0 -6
  566. package/src/utils/useThresholds.ts +0 -0
  567. /package/{public/brand → assets}/centreon-logo-one-line-dark.svg +0 -0
  568. /package/{public/brand → assets}/centreon-logo-one-line-light.svg +0 -0
  569. /package/{src/@assets/images → assets}/not-authorized-template-background-dark.svg +0 -0
  570. /package/{src/@assets/images → assets}/not-authorized-template-background-light.svg +0 -0
  571. /package/{public/fonts → fonts/fonts-generated}/roboto-bold-webfont.ttf +0 -0
  572. /package/{public/fonts → fonts/fonts-generated}/roboto-bold-webfont.woff +0 -0
  573. /package/{public/fonts → fonts/fonts-generated}/roboto-bold-webfont.woff2 +0 -0
  574. /package/{public/fonts → fonts/fonts-generated}/roboto-light-webfont.ttf +0 -0
  575. /package/{public/fonts → fonts/fonts-generated}/roboto-light-webfont.woff +0 -0
  576. /package/{public/fonts → fonts/fonts-generated}/roboto-light-webfont.woff2 +0 -0
  577. /package/{public/fonts → fonts/fonts-generated}/roboto-medium-webfont.ttf +0 -0
  578. /package/{public/fonts → fonts/fonts-generated}/roboto-medium-webfont.woff +0 -0
  579. /package/{public/fonts → fonts/fonts-generated}/roboto-medium-webfont.woff2 +0 -0
  580. /package/{public/fonts → fonts/fonts-generated}/roboto-regular-webfont.ttf +0 -0
  581. /package/{public/fonts → fonts/fonts-generated}/roboto-regular-webfont.woff +0 -0
  582. /package/{public/fonts → fonts/fonts-generated}/roboto-regular-webfont.woff2 +0 -0
  583. /package/src/Listing/Header/{_internals/Label.tsx → Label.tsx} +0 -0
  584. /package/src/Typography/{story.utils.tsx → index.tsx} +0 -0
@@ -1,137 +0,0 @@
1
- import { scaleBand, scaleLinear, scaleOrdinal } from '@visx/scale';
2
- import { equals, isEmpty, pluck, reject } from 'ramda';
3
-
4
- import { getValueByUnit } from '../common/utils';
5
- import { LegendScale } from '../Legend/models';
6
-
7
- import { BarType } from './models';
8
-
9
- interface Size {
10
- height: number;
11
- width: number;
12
- }
13
-
14
- interface useBarStackProps {
15
- data: Array<BarType>;
16
- height: number;
17
- legendRef;
18
- size: number;
19
- titleRef;
20
- unit?: 'percentage' | 'number';
21
- variant?: 'vertical' | 'horizontal';
22
- width: number;
23
- }
24
- interface useBarStackState {
25
- areAllValuesNull: boolean;
26
- barSize: Size;
27
- colorScale;
28
- input;
29
- isVerticalBar: boolean;
30
- keys: Array<string>;
31
- legendScale: LegendScale;
32
- svgContainerSize: Size;
33
- svgWrapperWidth: number;
34
- total: number;
35
- xScale;
36
- yScale;
37
- }
38
-
39
- const useResponsiveBarStack = ({
40
- data,
41
- variant,
42
- height,
43
- width,
44
- unit = 'number',
45
- titleRef,
46
- legendRef,
47
- size
48
- }: useBarStackProps): useBarStackState => {
49
- const isVerticalBar = equals(variant, 'vertical');
50
-
51
- const heightOfTitle = titleRef.current?.offsetHeight || 0;
52
- const widthOfLegend = legendRef.current?.offsetWidth || 0;
53
-
54
- const horizontalGap = widthOfLegend > 0 ? 12 : 0;
55
- const verticalGap = heightOfTitle > 0 ? 8 : 0;
56
-
57
- const svgWrapperWidth = isVerticalBar
58
- ? size + 36
59
- : width - widthOfLegend - horizontalGap;
60
-
61
- const svgContainerSize = {
62
- height: isVerticalBar ? height - heightOfTitle - verticalGap : size,
63
- width: isVerticalBar ? size : width - widthOfLegend - horizontalGap
64
- };
65
-
66
- const barSize = {
67
- height: svgContainerSize.height - 16,
68
- width: svgContainerSize.width - 16
69
- };
70
-
71
- const total = Math.floor(data.reduce((acc, { value }) => acc + value, 0));
72
-
73
- const yScale = isVerticalBar
74
- ? scaleLinear({
75
- domain: [0, total]
76
- })
77
- : scaleBand({
78
- domain: [0, 0],
79
- padding: 0
80
- });
81
-
82
- const xScale = isVerticalBar
83
- ? scaleBand({
84
- domain: [0, 0],
85
- padding: 0
86
- })
87
- : scaleLinear({
88
- domain: [0, total]
89
- });
90
-
91
- const keys = pluck('label', data);
92
-
93
- const colorsRange = pluck('color', data);
94
-
95
- const colorScale = scaleOrdinal({
96
- domain: keys,
97
- range: colorsRange
98
- });
99
-
100
- const legendScale = {
101
- domain: data.map(({ value }) => getValueByUnit({ total, unit, value })),
102
- range: colorsRange
103
- };
104
-
105
- const xMax = barSize.width;
106
- const yMax = barSize.height;
107
-
108
- xScale.rangeRound([0, xMax]);
109
- yScale.range([yMax, 0]);
110
-
111
- const input = data.reduce((acc, { label, value }) => {
112
- acc[label] = value;
113
-
114
- return acc;
115
- }, {});
116
-
117
- const values = pluck('value', data);
118
-
119
- const areAllValuesNull = isEmpty(reject((value) => equals(value, 0), values));
120
-
121
- return {
122
- areAllValuesNull,
123
- barSize,
124
- colorScale,
125
- input,
126
- isVerticalBar,
127
- keys,
128
- legendScale,
129
- svgContainerSize,
130
- svgWrapperWidth,
131
- total,
132
- xScale,
133
- yScale
134
- };
135
- };
136
-
137
- export default useResponsiveBarStack;
@@ -1,102 +0,0 @@
1
- import { PieArcDatum, ProvidedProps } from '@visx/shape/lib/shapes/Pie';
2
- import { useTransition, to, animated } from '@react-spring/web';
3
- import { equals, includes, isNil, pluck } from 'ramda';
4
-
5
- import { Typography } from '@mui/material';
6
-
7
- import { Thresholds } from '../common/models';
8
-
9
- type AnimatedStyles = { endAngle: number; opacity: number; startAngle: number };
10
-
11
- const fromLeaveTransition = ({ endAngle }): AnimatedStyles => ({
12
- endAngle,
13
- opacity: 0,
14
- startAngle: -(Math.PI / 2)
15
- });
16
- const enterUpdateTransition = <T,>({
17
- startAngle,
18
- endAngle
19
- }: PieArcDatum<T>): AnimatedStyles => ({
20
- endAngle,
21
- opacity: 1,
22
- startAngle
23
- });
24
-
25
- type AnimatedPieProps<Datum> = ProvidedProps<Datum> & {
26
- animate?: boolean;
27
- getColor: (d: PieArcDatum<Datum>) => string;
28
- getKey: (d: PieArcDatum<Datum>) => string;
29
- hideTooltip?: () => void;
30
- showTooltip?: (args) => void;
31
- thresholds: Thresholds;
32
- };
33
-
34
- const AnimatedPie = <Datum,>({
35
- animate,
36
- arcs,
37
- path,
38
- getKey,
39
- getColor,
40
- showTooltip,
41
- hideTooltip,
42
- thresholds
43
- }: AnimatedPieProps<Datum>): JSX.Element | null => {
44
- const transitions = useTransition?.<PieArcDatum<Datum>, AnimatedStyles>(
45
- arcs,
46
- {
47
- enter: enterUpdateTransition,
48
- from: animate ? fromLeaveTransition : enterUpdateTransition,
49
- keys: getKey,
50
- leave: animate ? fromLeaveTransition : enterUpdateTransition,
51
- update: enterUpdateTransition
52
- }
53
- );
54
-
55
- if (isNil(useTransition)) {
56
- return null;
57
- }
58
-
59
- return transitions((props, arc, { key }) => (
60
- <g key={key}>
61
- <animated.path
62
- d={to([props.startAngle, props.endAngle], (startAngle, endAngle) =>
63
- path({
64
- ...arc,
65
- endAngle,
66
- startAngle
67
- })
68
- )}
69
- data-testid={`${arc.data?.value || arc.data}-arc`}
70
- display={
71
- includes('transparent', arc.data?.name || '') ? 'none' : 'inline'
72
- }
73
- fill={getColor(arc)}
74
- onMouseEnter={(event) => {
75
- const thresholdType = arc.data?.name as string;
76
-
77
- if (equals(thresholdType, 'success')) {
78
- return;
79
- }
80
-
81
- showTooltip?.({
82
- tooltipData: (
83
- <div>
84
- {pluck(
85
- 'label',
86
- thresholds[thresholdType as 'warning' | 'critical']
87
- ).map((label) => (
88
- <Typography key={label}>{label}</Typography>
89
- ))}
90
- </div>
91
- ),
92
- tooltipLeft: event.clientX,
93
- tooltipTop: event.clientY
94
- });
95
- }}
96
- onMouseLeave={() => hideTooltip?.()}
97
- />
98
- </g>
99
- ));
100
- };
101
-
102
- export default AnimatedPie;
@@ -1,102 +0,0 @@
1
- import dataLastWeek from '../LineChart/mockedData/lastWeek.json';
2
- import {
3
- criticalThresholds,
4
- rangedThresholds,
5
- successThresholds,
6
- warningThresholds
7
- } from '../common/testUtils';
8
-
9
- import { Props, Gauge } from './Gauge';
10
-
11
- const initialize = (
12
- args: Omit<Props, 'data' | 'labels' | 'baseColor'>
13
- ): void => {
14
- cy.mount({
15
- Component: (
16
- <div style={{ height: '100vh', width: '100vw' }}>
17
- <Gauge
18
- baseColor="#000"
19
- data={dataLastWeek}
20
- labels={{
21
- critical: 'Critical',
22
- warning: 'Warning'
23
- }}
24
- {...args}
25
- />
26
- </div>
27
- )
28
- });
29
- };
30
-
31
- describe('Gauge', () => {
32
- it('does not display the gauge when there is no data', () => {
33
- initialize({ data: undefined, thresholds: successThresholds });
34
-
35
- cy.contains('0.41 s').should('not.exist');
36
- });
37
-
38
- it('displays the gauge as success when corresponding thresholds are set', () => {
39
- initialize({ thresholds: successThresholds });
40
-
41
- cy.contains('0.41 s').should('have.css', 'fill', 'rgb(136, 185, 34)');
42
- cy.findByTestId('1.1500000000000001-arc').should('be.visible');
43
- cy.findByTestId('0.15000000000000013-arc').should('be.visible');
44
-
45
- cy.makeSnapshot();
46
- });
47
-
48
- it('displays the gauge as warning when corresponding thresholds are set', () => {
49
- initialize({ thresholds: warningThresholds });
50
-
51
- cy.contains('0.41 s').should('have.css', 'fill', 'rgb(253, 155, 39)');
52
- cy.findByTestId('1.25-arc').should('be.visible');
53
- cy.findByTestId('0.15000000000000013-arc').should('be.visible');
54
-
55
- cy.makeSnapshot();
56
- });
57
-
58
- it('displays the gauge as critical when corresponding thresholds are set', () => {
59
- initialize({ thresholds: criticalThresholds });
60
-
61
- cy.contains('0.41 s').should('have.css', 'fill', 'rgb(255, 74, 74)');
62
- cy.findByTestId('0.6399999999999999-arc').should('be.visible');
63
- cy.findByTestId('0.54-arc').should('be.visible');
64
-
65
- cy.makeSnapshot();
66
- });
67
-
68
- it('displays ranged thresholds', () => {
69
- initialize({ thresholds: rangedThresholds });
70
-
71
- cy.findByTestId('0.37-arc').should('be.visible');
72
- cy.findByTestId('0.09999999999999998-arc').should('be.visible');
73
-
74
- cy.makeSnapshot();
75
- });
76
-
77
- it('displays the threshold tooltip when a threshold is hovered', () => {
78
- initialize({ thresholds: successThresholds });
79
-
80
- cy.findByTestId('1.1500000000000001-arc').trigger('mouseover', {
81
- force: true
82
- });
83
-
84
- cy.contains('Warning').should('be.visible');
85
-
86
- cy.findByTestId('0.15000000000000013-arc').trigger('mouseover', {
87
- force: true
88
- });
89
-
90
- cy.contains('Critical').should('be.visible');
91
-
92
- cy.makeSnapshot();
93
- });
94
-
95
- it('displays the value as raw when the prop is set', () => {
96
- initialize({ displayAsRaw: true, thresholds: successThresholds });
97
-
98
- cy.contains('0.40663333333 s').should('be.visible');
99
-
100
- cy.makeSnapshot();
101
- });
102
- });
@@ -1,159 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
-
3
- import dataLastWeek from '../LineChart/mockedData/lastWeek.json';
4
-
5
- import { Gauge } from './Gauge';
6
-
7
- const meta: Meta<typeof Gauge> = {
8
- component: Gauge
9
- };
10
-
11
- export default meta;
12
- type Story = StoryObj<typeof Gauge>;
13
-
14
- const Template = (props): JSX.Element => (
15
- <div style={{ height: '500px', width: '500px' }}>
16
- <Gauge {...props} />
17
- </div>
18
- );
19
-
20
- export const success: Story = {
21
- args: {
22
- data: dataLastWeek,
23
- thresholds: {
24
- critical: [
25
- {
26
- label: 'Critical',
27
- value: 0.6
28
- }
29
- ],
30
- enabled: true,
31
- warning: [
32
- {
33
- label: 'Warning',
34
- value: 0.5
35
- }
36
- ]
37
- }
38
- },
39
- render: Template
40
- };
41
-
42
- export const warning: Story = {
43
- args: {
44
- data: dataLastWeek,
45
- thresholds: {
46
- critical: [
47
- {
48
- label: 'Critical',
49
- value: 0.6
50
- }
51
- ],
52
- enabled: true,
53
- warning: [
54
- {
55
- label: 'Warning',
56
- value: 0.2
57
- }
58
- ]
59
- }
60
- },
61
- render: Template
62
- };
63
-
64
- export const critical: Story = {
65
- args: {
66
- data: dataLastWeek,
67
- thresholds: {
68
- critical: [
69
- {
70
- label: 'Critical',
71
- value: 0.35
72
- }
73
- ],
74
- enabled: true,
75
- warning: [
76
- {
77
- label: 'Warning',
78
- value: 0.13
79
- }
80
- ]
81
- }
82
- },
83
- render: Template
84
- };
85
-
86
- export const withCriticalLowerThanWarning: Story = {
87
- args: {
88
- data: dataLastWeek,
89
- thresholds: {
90
- critical: [
91
- {
92
- label: 'Critical',
93
- value: 0.13
94
- }
95
- ],
96
- enabled: true,
97
- warning: [
98
- {
99
- label: 'Warning',
100
- value: 0.5
101
- }
102
- ]
103
- }
104
- },
105
- render: Template
106
- };
107
-
108
- export const withRangeThresholds: Story = {
109
- args: {
110
- data: dataLastWeek,
111
- thresholds: {
112
- critical: [
113
- {
114
- label: 'Critical',
115
- value: 0.55
116
- },
117
- {
118
- label: 'Critical',
119
- value: 0.65
120
- }
121
- ],
122
- enabled: true,
123
- warning: [
124
- {
125
- label: 'Warning',
126
- value: 0.13
127
- },
128
- {
129
- label: 'Warning',
130
- value: 0.5
131
- }
132
- ]
133
- }
134
- },
135
- render: Template
136
- };
137
-
138
- export const RawValue: Story = {
139
- args: {
140
- data: dataLastWeek,
141
- displayAsRaw: true,
142
- thresholds: {
143
- critical: [
144
- {
145
- label: 'Critical',
146
- value: 0.6
147
- }
148
- ],
149
- enabled: true,
150
- warning: [
151
- {
152
- label: 'Warning',
153
- value: 0.5
154
- }
155
- ]
156
- }
157
- },
158
- render: Template
159
- };
@@ -1,41 +0,0 @@
1
- import { ParentSize } from '../..';
2
- import { LineChartData, Thresholds } from '../common/models';
3
- import { getMetricWithLatestData } from '../common/timeSeries';
4
- import { Metric } from '../common/timeSeries/models';
5
-
6
- import ResponsiveGauge from './ResponsiveGauge';
7
-
8
- export interface Props {
9
- baseColor?: string;
10
- data?: LineChartData;
11
- displayAsRaw?: boolean;
12
- thresholds: Thresholds;
13
- }
14
-
15
- export const Gauge = ({
16
- thresholds,
17
- data,
18
- displayAsRaw,
19
- baseColor
20
- }: Props): JSX.Element | null => {
21
- if (!data) {
22
- return null;
23
- }
24
-
25
- const metric = getMetricWithLatestData(data) as Metric;
26
-
27
- return (
28
- <ParentSize>
29
- {({ width, height }) => (
30
- <ResponsiveGauge
31
- baseColor={baseColor}
32
- displayAsRaw={displayAsRaw}
33
- height={height}
34
- metric={metric}
35
- thresholds={thresholds}
36
- width={width}
37
- />
38
- )}
39
- </ParentSize>
40
- );
41
- };
@@ -1,63 +0,0 @@
1
- import { scaleOrdinal } from '@visx/scale';
2
- import { Pie } from '@visx/shape';
3
- import { identity } from 'ramda';
4
-
5
- import { useTheme } from '@mui/material';
6
-
7
- import { getColorFromDataAndTresholds } from '../common/utils';
8
-
9
- import { thresholdThickness } from './Thresholds';
10
- import AnimatedPie from './AnimatedPie';
11
- import { GaugeProps } from './models';
12
-
13
- const dataThickness = 45;
14
-
15
- const PieData = ({
16
- metric,
17
- adaptedMaxValue,
18
- thresholds,
19
- radius,
20
- baseColor
21
- }: Omit<
22
- GaugeProps,
23
- 'width' | 'height' | 'showTooltip' | 'hideTooltip' | 'thresholdTooltipLabels'
24
- >): JSX.Element => {
25
- const theme = useTheme();
26
-
27
- const pieData = [metric.data[0], adaptedMaxValue - metric.data[0]];
28
- const pieColor = getColorFromDataAndTresholds({
29
- baseColor,
30
- data: metric.data[0],
31
- theme,
32
- thresholds
33
- });
34
-
35
- const getDataColor = scaleOrdinal({
36
- domain: pieData,
37
- range: [pieColor, 'transparent']
38
- });
39
-
40
- return (
41
- <Pie
42
- data={pieData}
43
- endAngle={-Math.PI / 2}
44
- innerRadius={radius - dataThickness}
45
- outerRadius={radius - thresholdThickness * 1.3}
46
- pieSortValues={() => -1}
47
- pieValue={identity}
48
- startAngle={Math.PI / 2}
49
- >
50
- {(pie) => (
51
- <AnimatedPie<number>
52
- {...pie}
53
- animate
54
- getColor={(arc) => getDataColor(arc.data)}
55
- getKey={(arc) => `${arc.data}`}
56
- thresholds={thresholds}
57
- />
58
- )}
59
- </Pie>
60
- );
61
- };
62
-
63
- export default PieData;