@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,81 +0,0 @@
1
- import { useMemo, useRef } from 'react';
2
-
3
- import { FormikValues, useFormikContext } from 'formik';
4
- import {
5
- append,
6
- equals,
7
- inc,
8
- isEmpty,
9
- pluck,
10
- prop,
11
- reject,
12
- sortBy
13
- } from 'ramda';
14
-
15
- import { SelectEntry } from '../../..';
16
-
17
- interface UseListState {
18
- addItem: (newItem: SelectEntry) => void;
19
- deleteItem: (id: string) => () => void;
20
- sortList: (items: Array<string>) => void;
21
- sortedList: Array<unknown>;
22
- }
23
-
24
- export const useList = ({ fieldName }): UseListState => {
25
- const { values, setFieldValue } = useFormikContext<FormikValues>();
26
- const maxOrder = useRef(0);
27
-
28
- const list = values[fieldName];
29
-
30
- const sortedList = useMemo(
31
- () =>
32
- sortBy(prop('order'), list).map(({ id, ...props }) => ({
33
- id: `${id}`,
34
- ...props
35
- })),
36
- [list]
37
- );
38
-
39
- const addItem = (newItem: SelectEntry): void => {
40
- setFieldValue(
41
- fieldName,
42
- append(
43
- {
44
- ...newItem,
45
- id: (newItem as SelectEntry).id as number,
46
- order: inc(maxOrder.current)
47
- },
48
- list
49
- )
50
- );
51
- };
52
-
53
- const deleteItem = (id: string) => (): void => {
54
- const newItems = reject((item) => equals(Number(id), item.id))(list);
55
-
56
- setFieldValue(fieldName, newItems);
57
- };
58
-
59
- const sortList = (items: Array<string>): void => {
60
- const newOrderedList = items.map((itemId, idx) => {
61
- const item = sortedList.find(({ id }) => equals(id, itemId));
62
-
63
- return {
64
- ...item,
65
- id: Number(item?.id),
66
- order: inc(idx)
67
- };
68
- });
69
-
70
- setFieldValue(fieldName, newOrderedList);
71
- };
72
-
73
- maxOrder.current = isEmpty(list) ? 0 : Math.max(...pluck('order', list));
74
-
75
- return {
76
- addItem,
77
- deleteItem,
78
- sortList,
79
- sortedList
80
- };
81
- };
package/src/Form/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './Form';
@@ -1,154 +0,0 @@
1
- import numeral from 'numeral';
2
-
3
- import BarStack from './BarStack';
4
- import { BarType, BarStackProps } from './models';
5
-
6
- const defaultData = [
7
- { color: '#88B922', label: 'Ok', value: 148 },
8
- { color: '#999999', label: 'Unknown', value: 13 },
9
- { color: '#F7931A', label: 'Warning', value: 16 },
10
- { color: '#FF6666', label: 'Down', value: 62 }
11
- ];
12
-
13
- const dataWithNullValues = [
14
- { color: '#88B922', label: 'Ok', value: 0 },
15
- { color: '#999999', label: 'Unknown', value: 0 },
16
- { color: '#F7931A', label: 'Warning', value: 0 },
17
- { color: '#FF6666', label: 'Down', value: 0 }
18
- ];
19
-
20
- const total = Math.floor(
21
- defaultData.reduce((acc, { value }) => acc + value, 0)
22
- );
23
-
24
- const TooltipContent = ({ label, color, value }: BarType): JSX.Element => {
25
- return (
26
- <div data-testid={`tooltip-${label}`} style={{ color }}>
27
- {label} : {value}
28
- </div>
29
- );
30
- };
31
-
32
- const initialize = ({
33
- width = '400px',
34
- height = '400px',
35
- data = defaultData,
36
- ...args
37
- }: Omit<BarStackProps, 'data'> & {
38
- data?;
39
- height?: string;
40
- width?: string;
41
- }): void => {
42
- cy.mount({
43
- Component: (
44
- <div style={{ height, width }}>
45
- <BarStack {...args} data={data} />
46
- </div>
47
- )
48
- });
49
- };
50
-
51
- describe('Bar stack', () => {
52
- it('renders Bar stack correctly with provided data', () => {
53
- initialize({});
54
-
55
- defaultData.forEach(({ label }) => {
56
- cy.findByTestId(label).should('be.visible');
57
- });
58
-
59
- cy.makeSnapshot();
60
- });
61
-
62
- it('adjusts size based on the provided width and height', () => {
63
- initialize({ displayLegend: false, height: '300px', width: '300px' });
64
-
65
- cy.findByTestId('barStack').should('have.css', 'height', '300px');
66
-
67
- cy.makeSnapshot();
68
- });
69
-
70
- it('renders as a horizontal bar when variant is set to "horizontal"', () => {
71
- initialize({ variant: 'horizontal' });
72
- cy.get('[data-variant="horizontal"]').should('exist');
73
-
74
- cy.makeSnapshot();
75
- });
76
-
77
- it('renders as a vertical bar when variant is set to "vertical"', () => {
78
- initialize({ variant: 'vertical' });
79
- cy.get('[data-variant="vertical"]').should('exist');
80
-
81
- cy.makeSnapshot();
82
- });
83
-
84
- it('displays tooltip with correct information on hover', () => {
85
- initialize({ TooltipContent });
86
-
87
- defaultData.forEach(({ label, value }) => {
88
- cy.findByTestId(label).trigger('mouseover', { force: true });
89
-
90
- cy.findByTestId(`tooltip-${label}`)
91
- .should('contain', label)
92
- .and('contain', numeral(value).format('0a').toUpperCase());
93
- });
94
-
95
- cy.makeSnapshot();
96
- });
97
-
98
- it('conditionally displays values on rects based on displayValues prop', () => {
99
- initialize({ displayValues: true });
100
- defaultData.forEach(({ value }, index) => {
101
- cy.findAllByTestId('value')
102
- .eq(index)
103
- .children()
104
- .eq(0)
105
- .should('have.text', value);
106
- });
107
-
108
- initialize({ displayValues: false });
109
- cy.findAllByTestId('value').should('not.exist');
110
-
111
- cy.makeSnapshot();
112
- });
113
-
114
- it('displays values on rects in percentage unit when displayValues is set to true and unit to percentage', () => {
115
- initialize({ displayValues: true, unit: 'percentage' });
116
- defaultData.forEach(({ value }, index) => {
117
- cy.findAllByTestId('value')
118
- .eq(index)
119
- .children()
120
- .eq(0)
121
- .should('have.text', `${((value * 100) / total).toFixed(1)}%`);
122
- });
123
-
124
- cy.makeSnapshot();
125
- });
126
-
127
- it('displays Legend component based on displayLegend prop', () => {
128
- initialize({ displayLegend: true });
129
- cy.findByTestId('Legend').should('be.visible');
130
-
131
- initialize({ displayLegend: false });
132
- cy.findByTestId('Legend').should('not.exist');
133
-
134
- cy.makeSnapshot();
135
- });
136
-
137
- it('displays the title when the title is giving', () => {
138
- initialize({ title: 'host' });
139
- cy.findByTestId('Title').should('be.visible');
140
-
141
- initialize({});
142
- cy.findByTestId('Title').should('not.exist');
143
-
144
- cy.makeSnapshot();
145
- });
146
-
147
- it('displays a message "No Data Available" when all values are null', () => {
148
- initialize({ data: dataWithNullValues, title: 'host' });
149
-
150
- cy.contains('No Data Available');
151
-
152
- cy.makeSnapshot();
153
- });
154
- });
@@ -1,123 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
-
3
- import { BarType } from './models';
4
-
5
- import { BarStack } from '.';
6
-
7
- const data = [
8
- { color: '#88B922', label: 'Ok', value: 148 },
9
- { color: '#999999', label: 'Unknown', value: 63 },
10
- { color: '#F7931A', label: 'Warning', value: 16 },
11
- { color: '#FF6666', label: 'Down', value: 13 }
12
- ];
13
-
14
- const dataWithBigNumbers = [
15
- { color: '#88B922', label: 'Ok', value: 260000 },
16
- { color: '#999999', label: 'Unknown', value: 1010900 },
17
- { color: '#F7931A', label: 'Warning', value: 63114 },
18
- { color: '#FF6666', label: 'Down', value: 122222 }
19
- ];
20
-
21
- const dataWithSmallNumber = [
22
- { color: '#88B922', label: 'Ok', value: 148 },
23
- { color: '#999999', label: 'Unknown', value: 42 },
24
- { color: '#F7931A', label: 'Warning', value: 7 },
25
- { color: '#FF6666', label: 'Down', value: 5 }
26
- ];
27
-
28
- const meta: Meta<typeof BarStack> = {
29
- component: BarStack
30
- };
31
-
32
- export default meta;
33
- type Story = StoryObj<typeof BarStack>;
34
-
35
- const TooltipContent = ({ label, color, value }: BarType): JSX.Element => {
36
- return (
37
- <div style={{ color }}>
38
- {label} : {value}
39
- </div>
40
- );
41
- };
42
-
43
- const Template = (args): JSX.Element => {
44
- return (
45
- <div style={{ height: '300px', width: '500px' }}>
46
- <BarStack {...args} />
47
- </div>
48
- );
49
- };
50
-
51
- export const Vertical: Story = {
52
- args: { data, title: 'hosts' },
53
- render: Template
54
- };
55
-
56
- export const WithoutTitle: Story = {
57
- args: { data },
58
- render: Template
59
- };
60
-
61
- export const WithoutLegend: Story = {
62
- args: { data, displayLegend: false, title: 'hosts' },
63
-
64
- render: Template
65
- };
66
-
67
- export const withDisplayedValues: Story = {
68
- args: { data, displayValues: true, title: 'hosts' },
69
- render: Template
70
- };
71
-
72
- export const WithPencentage: Story = {
73
- args: { data, displayValues: true, title: 'hosts', unit: 'percentage' },
74
- render: Template
75
- };
76
-
77
- export const WithTooltip: Story = {
78
- args: { TooltipContent, data, title: 'hosts' },
79
- render: Template
80
- };
81
-
82
- export const WithBigNumbers: Story = {
83
- args: {
84
- TooltipContent,
85
- data: dataWithBigNumbers,
86
- displayValues: true,
87
- title: 'hosts'
88
- },
89
- render: Template
90
- };
91
-
92
- export const WithSmallNumbers: Story = {
93
- args: {
94
- TooltipContent,
95
- data: dataWithSmallNumber,
96
- displayValues: true,
97
- title: 'hosts'
98
- },
99
- render: Template
100
- };
101
-
102
- export const Horizontal: Story = {
103
- args: {
104
- TooltipContent,
105
- data,
106
- displayValues: true,
107
- title: 'hosts',
108
- variant: 'horizontal'
109
- },
110
- render: Template
111
- };
112
-
113
- export const HorizontalWithoutLegend: Story = {
114
- args: {
115
- TooltipContent,
116
- data,
117
- displayLegend: false,
118
- displayValues: true,
119
- title: 'hosts',
120
- variant: 'horizontal'
121
- },
122
- render: Template
123
- };
@@ -1,37 +0,0 @@
1
- import { makeStyles } from 'tss-react/mui';
2
-
3
- export const useBarStackStyles = makeStyles()((theme) => ({
4
- barStackTooltip: {
5
- backgroundColor: theme.palette.background.paper,
6
- color: theme.palette.text.primary,
7
- padding: 0,
8
- position: 'relative'
9
- },
10
- container: {
11
- alignItems: 'center',
12
- display: 'flex',
13
- gap: theme.spacing(1.5),
14
- justifyContent: 'center'
15
- },
16
- svgContainer: {
17
- alignItems: 'center',
18
- backgroundColor: theme.palette.background.panelGroups,
19
- borderRadius: theme.spacing(1.25),
20
- display: 'flex',
21
- justifyContent: 'center'
22
- },
23
- svgWrapper: {
24
- alignItems: 'center',
25
- display: 'flex',
26
- flexDirection: 'column',
27
- gap: theme.spacing(1),
28
- justifyContent: 'center'
29
- },
30
- title: {
31
- fontSize: theme.typography.h6.fontSize,
32
- fontWeight: theme.typography.fontWeightMedium,
33
- margin: 0,
34
- padding: 0,
35
- textAlign: 'center'
36
- }
37
- }));
@@ -1,14 +0,0 @@
1
- import { ParentSize } from '../..';
2
-
3
- import ResponsiveBarStack from './ResponsiveBarStack';
4
- import { BarStackProps } from './models';
5
-
6
- const Bar = (props: BarStackProps): JSX.Element => (
7
- <ParentSize>
8
- {({ width, height }) => (
9
- <ResponsiveBarStack {...props} height={height} width={width} />
10
- )}
11
- </ParentSize>
12
- );
13
-
14
- export default Bar;
@@ -1,222 +0,0 @@
1
- import { useRef } from 'react';
2
-
3
- import { BarStack as BarStackVertical, BarStackHorizontal } from '@visx/shape';
4
- import { Group } from '@visx/group';
5
- import numeral from 'numeral';
6
- import { Text } from '@visx/text';
7
- import { useTranslation } from 'react-i18next';
8
- import { equals } from 'ramda';
9
-
10
- import { Typography } from '@mui/material';
11
-
12
- import { Tooltip } from '../../components';
13
- import { LegendProps } from '../Legend/models';
14
- import { Legend as LegendComponent } from '../Legend';
15
- import { getValueByUnit } from '../common/utils';
16
- import { labelNoDataFound as defaultlabelNoDataFound } from '../translatedLabels';
17
-
18
- import { BarStackProps } from './models';
19
- import { useBarStackStyles } from './BarStack.styles';
20
- import useResponsiveBarStack from './useResponsiveBarStack';
21
-
22
- const DefaultLengd = ({ scale, direction }: LegendProps): JSX.Element => (
23
- <LegendComponent direction={direction} scale={scale} />
24
- );
25
-
26
- const BarStack = ({
27
- title,
28
- data,
29
- width,
30
- height,
31
- size = 72,
32
- onSingleBarClick,
33
- displayLegend = true,
34
- TooltipContent,
35
- Legend = DefaultLengd,
36
- unit = 'number',
37
- displayValues,
38
- variant = 'vertical',
39
- legendDirection = 'column',
40
- labelNoDataFound = defaultlabelNoDataFound
41
- }: BarStackProps & { height: number; width: number }): JSX.Element => {
42
- const { t } = useTranslation();
43
- const { classes } = useBarStackStyles();
44
-
45
- const titleRef = useRef(null);
46
- const legendRef = useRef(null);
47
-
48
- const {
49
- barSize,
50
- colorScale,
51
- input,
52
- keys,
53
- legendScale,
54
- total,
55
- xScale,
56
- yScale,
57
- svgWrapperWidth,
58
- svgContainerSize,
59
- isVerticalBar,
60
- areAllValuesNull
61
- } = useResponsiveBarStack({
62
- data,
63
- height,
64
- legendRef,
65
- size,
66
- titleRef,
67
- unit,
68
- variant,
69
- width
70
- });
71
-
72
- const BarStackComponent = isVerticalBar
73
- ? BarStackVertical
74
- : BarStackHorizontal;
75
-
76
- if (areAllValuesNull) {
77
- return (
78
- <div className={classes.container} style={{ height, width }}>
79
- <Typography variant="h3">{t(labelNoDataFound)}</Typography>
80
- </div>
81
- );
82
- }
83
-
84
- return (
85
- <div className={classes.container} style={{ height, width }}>
86
- <div
87
- className={classes.svgWrapper}
88
- style={{
89
- height,
90
- width: svgWrapperWidth
91
- }}
92
- >
93
- {title && (
94
- <div className={classes.title} data-testid="Title" ref={titleRef}>
95
- {`${numeral(total).format('0a').toUpperCase()} `} {t(title)}
96
- </div>
97
- )}
98
- <div
99
- className={classes.svgContainer}
100
- data-testid="barStack"
101
- style={svgContainerSize}
102
- >
103
- <svg
104
- data-variant={variant}
105
- height={barSize.height}
106
- width={barSize.width}
107
- >
108
- <Group>
109
- <BarStackComponent
110
- color={colorScale}
111
- data={[input]}
112
- keys={keys}
113
- {...(isVerticalBar
114
- ? { x: () => undefined }
115
- : { y: () => undefined })}
116
- xScale={xScale}
117
- yScale={yScale}
118
- >
119
- {(barStacks) =>
120
- barStacks.map((barStack) =>
121
- barStack.bars.map((bar) => {
122
- const shouldDisplayValues = (): boolean => {
123
- if (bar.height < 10) {
124
- return false;
125
- }
126
-
127
- return (
128
- (equals(unit, 'number') && bar.width > 10) ||
129
- (equals(unit, 'percentage') && bar.width > 25)
130
- );
131
- };
132
-
133
- const TextX = bar.x + bar.width / 2;
134
- const TextY = bar.y + bar.height / 2;
135
-
136
- const onClick = (): void => {
137
- onSingleBarClick?.(bar);
138
- };
139
-
140
- return (
141
- <Tooltip
142
- hasCaret
143
- classes={{
144
- tooltip: classes.barStackTooltip
145
- }}
146
- followCursor={false}
147
- key={`bar-stack-${barStack.index}-${bar.index}`}
148
- label={
149
- TooltipContent && (
150
- <TooltipContent
151
- color={bar.color}
152
- label={bar.key}
153
- title={title}
154
- total={total}
155
- value={barStack.bars[0].bar.data[barStack.key]}
156
- />
157
- )
158
- }
159
- position={
160
- isVerticalBar ? 'right-start' : 'bottom-start'
161
- }
162
- >
163
- <g data-testid={bar.key} onClick={onClick}>
164
- <rect
165
- cursor="pointer"
166
- fill={bar.color}
167
- height={
168
- isVerticalBar ? bar.height - 1 : bar.height
169
- }
170
- key={`bar-stack-${barStack.index}-${bar.index}`}
171
- ry={10}
172
- width={isVerticalBar ? bar.width : bar.width - 1}
173
- x={bar.x}
174
- y={bar.y}
175
- />
176
- {displayValues && shouldDisplayValues() && (
177
- <Text
178
- cursor="pointer"
179
- data-testid="value"
180
- fill="#000"
181
- fontSize={12}
182
- fontWeight={600}
183
- textAnchor="middle"
184
- verticalAnchor="middle"
185
- x={TextX}
186
- y={TextY}
187
- >
188
- {getValueByUnit({
189
- total,
190
- unit,
191
- value: barStack.bars[0].bar.data[barStack.key]
192
- })}
193
- </Text>
194
- )}
195
- </g>
196
- </Tooltip>
197
- );
198
- })
199
- )
200
- }
201
- </BarStackComponent>
202
- </Group>
203
- </svg>
204
- </div>
205
- </div>
206
- {displayLegend && (
207
- <div data-testid="Legend" ref={legendRef}>
208
- <Legend
209
- data={data}
210
- direction={legendDirection}
211
- scale={legendScale}
212
- title={title}
213
- total={total}
214
- unit={unit}
215
- />
216
- </div>
217
- )}
218
- </div>
219
- );
220
- };
221
-
222
- export default BarStack;
@@ -1 +0,0 @@
1
- export { default as BarStack } from './BarStack';
@@ -1,20 +0,0 @@
1
- export interface BarType {
2
- color: string;
3
- label: string;
4
- value: number;
5
- }
6
-
7
- export type BarStackProps = {
8
- Legend?: ({ scale, data, title, total, unit, direction }) => JSX.Element;
9
- TooltipContent?: (barData) => JSX.Element | boolean | null;
10
- data: Array<BarType>;
11
- displayLegend?: boolean;
12
- displayValues?: boolean;
13
- labelNoDataFound?: string;
14
- legendDirection?: 'row' | 'column';
15
- onSingleBarClick?: (barData) => void;
16
- size?: number;
17
- title?: string;
18
- unit?: 'percentage' | 'number';
19
- variant?: 'vertical' | 'horizontal';
20
- };