@centreon/ui 23.10.122 → 24.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. package/package.json +64 -45
  2. package/public/mockServiceWorker.js +2 -2
  3. package/src/ActionsList/ActionsList.styles.ts +40 -71
  4. package/src/Button/Icon/index.stories.tsx +1 -1
  5. package/src/Button/Icon/index.tsx +2 -2
  6. package/src/Button/Save/StartIcon.tsx +3 -3
  7. package/src/Button/Save/index.tsx +9 -5
  8. package/src/Checkbox/Checkbox.tsx +2 -2
  9. package/src/Checkbox/CheckboxGroup/index.tsx +2 -2
  10. package/src/Checkbox/fonts/roboto-bold-webfont.ttf +0 -0
  11. package/src/Checkbox/fonts/roboto-bold-webfont.woff +0 -0
  12. package/src/Checkbox/fonts/roboto-bold-webfont.woff2 +0 -0
  13. package/src/Checkbox/fonts/roboto-light-webfont.ttf +0 -0
  14. package/src/Checkbox/fonts/roboto-light-webfont.woff +0 -0
  15. package/src/Checkbox/fonts/roboto-light-webfont.woff2 +0 -0
  16. package/src/Checkbox/fonts/roboto-medium-webfont.ttf +0 -0
  17. package/src/Checkbox/fonts/roboto-medium-webfont.woff +0 -0
  18. package/src/Checkbox/fonts/roboto-medium-webfont.woff2 +0 -0
  19. package/src/Checkbox/fonts/roboto-regular-webfont.ttf +0 -0
  20. package/src/Checkbox/fonts/roboto-regular-webfont.woff +0 -0
  21. package/src/Checkbox/fonts/roboto-regular-webfont.woff2 +0 -0
  22. package/src/Dashboard/Dashboard.styles.ts +6 -5
  23. package/src/Dashboard/Item.tsx +1 -1
  24. package/src/Dashboard/Layout.tsx +2 -2
  25. package/src/Dashboard/utils.ts +1 -1
  26. package/src/Dialog/Confirm/index.tsx +10 -2
  27. package/src/Dialog/UnsavedChanges/index.tsx +21 -20
  28. package/src/Dialog/UnsavedChanges/translatedLabels.ts +4 -6
  29. package/src/Dialog/index.tsx +9 -2
  30. package/src/FallbackPage/FallbackPage.tsx +3 -3
  31. package/src/FileDropZone/index.tsx +3 -1
  32. package/src/Form/Form.cypress.spec.tsx +133 -0
  33. package/src/Form/Inputs/Grid.tsx +8 -4
  34. package/src/Form/Inputs/List/Content.tsx +62 -0
  35. package/src/Form/Inputs/List/List.styles.ts +29 -0
  36. package/src/Form/Inputs/List/List.tsx +58 -0
  37. package/src/Form/Inputs/List/useList.ts +81 -0
  38. package/src/Form/Inputs/Text.tsx +3 -1
  39. package/src/Form/Inputs/index.tsx +3 -1
  40. package/src/Form/Inputs/models.ts +23 -13
  41. package/src/Graph/BarStack/BarStack.cypress.spec.tsx +217 -0
  42. package/src/Graph/BarStack/BarStack.stories.tsx +125 -0
  43. package/src/Graph/BarStack/BarStack.styles.ts +66 -0
  44. package/src/Graph/BarStack/BarStack.tsx +14 -0
  45. package/src/Graph/BarStack/Graph.tsx +176 -0
  46. package/src/Graph/BarStack/GraphAndLegend.tsx +119 -0
  47. package/src/Graph/BarStack/ResponsiveBarStack.tsx +114 -0
  48. package/src/Graph/BarStack/constants.ts +5 -0
  49. package/src/Graph/BarStack/index.ts +1 -0
  50. package/src/Graph/BarStack/models.ts +19 -0
  51. package/src/Graph/BarStack/useGraphAndLegend.ts +86 -0
  52. package/src/Graph/BarStack/useResponsiveBarStack.ts +106 -0
  53. package/src/Graph/Gauge/Gauge.cypress.spec.tsx +102 -0
  54. package/src/Graph/Gauge/Gauge.tsx +1 -1
  55. package/src/Graph/HeatMap/HeatMap.cypress.spec.tsx +145 -0
  56. package/src/Graph/HeatMap/HeatMap.stories.tsx +0 -25
  57. package/src/Graph/HeatMap/HeatMap.styles.tsx +1 -0
  58. package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +39 -12
  59. package/src/Graph/HeatMap/model.ts +6 -1
  60. package/src/Graph/Legend/Legend.styles.ts +10 -0
  61. package/src/Graph/Legend/Legend.tsx +26 -0
  62. package/src/Graph/Legend/index.ts +1 -0
  63. package/src/Graph/Legend/models.ts +11 -0
  64. package/src/Graph/LineChart/BasicComponents/Lines/RegularLines/index.tsx +2 -1
  65. package/src/Graph/LineChart/BasicComponents/Lines/StackedLines/index.tsx +3 -4
  66. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/Circle.tsx +2 -2
  67. package/src/Graph/LineChart/BasicComponents/ThresholdLine.tsx +3 -1
  68. package/src/Graph/LineChart/BasicComponents/Thresholds.tsx +2 -2
  69. package/src/Graph/LineChart/BasicComponents/useFilterLines.ts +3 -5
  70. package/src/Graph/LineChart/Header/index.tsx +3 -31
  71. package/src/Graph/LineChart/Icons/Downtime.tsx +3 -3
  72. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/GuidingLines.tsx +2 -2
  73. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTickGraph.ts +9 -11
  74. package/src/Graph/LineChart/InteractiveComponents/Annotations/EventAnnotations.tsx +1 -1
  75. package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx +68 -0
  76. package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +27 -0
  77. package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltipStyles.ts +31 -0
  78. package/src/Graph/LineChart/InteractiveComponents/ZoomPreview/index.tsx +2 -1
  79. package/src/Graph/LineChart/InteractiveComponents/index.tsx +132 -17
  80. package/src/Graph/LineChart/InteractiveComponents/interactionWithGraphAtoms.ts +7 -27
  81. package/src/Graph/LineChart/Legend/Legend.styles.ts +85 -32
  82. package/src/Graph/LineChart/Legend/LegendContent.tsx +12 -6
  83. package/src/Graph/LineChart/Legend/LegendHeader.tsx +66 -27
  84. package/src/Graph/LineChart/Legend/index.tsx +43 -46
  85. package/src/Graph/LineChart/Legend/models.ts +5 -0
  86. package/src/Graph/LineChart/Legend/useLegend.ts +12 -13
  87. package/src/Graph/LineChart/LineChart.cypress.spec.tsx +144 -0
  88. package/src/Graph/LineChart/LineChart.styles.ts +8 -0
  89. package/src/Graph/LineChart/LineChart.tsx +125 -123
  90. package/src/Graph/LineChart/LoadingSkeleton.tsx +2 -2
  91. package/src/Graph/LineChart/helpers/doc.ts +16 -13
  92. package/src/Graph/LineChart/helpers/index.ts +1 -1
  93. package/src/Graph/LineChart/index.stories.tsx +17 -2
  94. package/src/Graph/LineChart/index.tsx +6 -7
  95. package/src/Graph/LineChart/mockedData/curvesWithSameColor.json +252 -0
  96. package/src/Graph/LineChart/mockedData/lastDayWithIncompleteValues.json +1320 -0
  97. package/src/Graph/LineChart/mockedData/lastDayWithNullValues.json +1314 -0
  98. package/src/Graph/LineChart/models.ts +12 -1
  99. package/src/Graph/LineChart/useLineChartData.ts +68 -18
  100. package/src/Graph/PieChart/PieChart.cypress.spec.tsx +154 -0
  101. package/src/Graph/PieChart/PieChart.stories.tsx +194 -0
  102. package/src/Graph/PieChart/PieChart.styles.ts +39 -0
  103. package/src/Graph/PieChart/PieChart.tsx +14 -0
  104. package/src/Graph/PieChart/ResponsivePie.tsx +245 -0
  105. package/src/Graph/PieChart/index.ts +1 -0
  106. package/src/Graph/PieChart/models.ts +20 -0
  107. package/src/Graph/PieChart/useResponsivePie.ts +81 -0
  108. package/src/Graph/SingleBar/SingleBar.cypress.spec.tsx +121 -0
  109. package/src/Graph/SingleBar/Thresholds.tsx +2 -2
  110. package/src/Graph/Text/Text.cypress.spec.tsx +101 -0
  111. package/src/Graph/Text/Text.stories.tsx +60 -4
  112. package/src/Graph/Text/Text.styles.ts +12 -1
  113. package/src/Graph/Text/Text.tsx +17 -12
  114. package/src/Graph/Tree/DescendantNodes.tsx +88 -0
  115. package/src/Graph/Tree/Links.tsx +64 -0
  116. package/src/Graph/Tree/StandaloneTree.tsx +32 -0
  117. package/src/Graph/Tree/Tree.cypress.spec.tsx +171 -0
  118. package/src/Graph/Tree/Tree.stories.tsx +144 -0
  119. package/src/Graph/Tree/Tree.tsx +116 -0
  120. package/src/Graph/Tree/constants.ts +2 -0
  121. package/src/Graph/Tree/index.ts +4 -0
  122. package/src/Graph/Tree/models.ts +52 -0
  123. package/src/Graph/Tree/stories/contents.tsx +164 -0
  124. package/src/Graph/Tree/stories/datas.ts +305 -0
  125. package/src/Graph/Tree/utils.ts +49 -0
  126. package/src/Graph/common/testUtils.ts +71 -0
  127. package/src/Graph/common/timeSeries/index.ts +53 -15
  128. package/src/Graph/common/utils.ts +69 -1
  129. package/src/Graph/index.ts +4 -0
  130. package/src/Icon/BaseIcon.tsx +32 -0
  131. package/src/Icon/DowntimeIcon.tsx +14 -0
  132. package/src/InputField/Number/Number.cypress.spec.tsx +85 -0
  133. package/src/InputField/Number/Number.stories.tsx +66 -0
  134. package/src/InputField/Number/Number.tsx +74 -0
  135. package/src/InputField/Search/index.tsx +2 -2
  136. package/src/InputField/Select/Autocomplete/Connected/Multi/index.test.tsx +22 -1
  137. package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +3 -2
  138. package/src/InputField/Select/Autocomplete/Connected/index.tsx +35 -17
  139. package/src/InputField/Select/Autocomplete/Draggable/SortableList.tsx +1 -1
  140. package/src/InputField/Select/Autocomplete/Draggable/SortableListContent.tsx +1 -1
  141. package/src/InputField/Select/Autocomplete/Draggable/index.tsx +1 -1
  142. package/src/InputField/Select/Autocomplete/Multi/index.stories.tsx +19 -0
  143. package/src/InputField/Select/Autocomplete/Multi/index.tsx +12 -7
  144. package/src/InputField/Select/Autocomplete/index.tsx +129 -116
  145. package/src/InputField/Select/IconPopover/index.tsx +3 -3
  146. package/src/InputField/Select/index.tsx +15 -2
  147. package/src/InputField/Text/index.tsx +53 -46
  148. package/src/Listing/ActionBar/index.tsx +11 -10
  149. package/src/Listing/Cell/DataCell.styles.ts +3 -0
  150. package/src/Listing/Cell/DataCell.tsx +23 -5
  151. package/src/Listing/Header/ListingHeader.tsx +1 -1
  152. package/src/Listing/Listing.cypress.spec.tsx +218 -33
  153. package/src/Listing/Listing.styles.ts +4 -7
  154. package/src/Listing/Row/Row.tsx +7 -3
  155. package/src/Listing/index.stories.tsx +39 -5
  156. package/src/Listing/index.test.tsx +1 -1
  157. package/src/Listing/index.tsx +207 -149
  158. package/src/Listing/models.ts +1 -0
  159. package/src/Listing/useStyleTable.ts +1 -0
  160. package/src/Module/LicensedModule/LicenseCheck/index.tsx +24 -9
  161. package/src/Module/LicensedModule/index.tsx +7 -1
  162. package/src/Module/Module.cypress.spec.tsx +129 -0
  163. package/src/Module/index.tsx +2 -4
  164. package/src/Panel/index.tsx +1 -1
  165. package/src/PopoverMenu/index.tsx +9 -8
  166. package/src/RichTextEditor/ContentEditable.tsx +195 -195
  167. package/src/RichTextEditor/RichTextEditor.tsx +12 -1
  168. package/src/SortableItems/index.tsx +2 -7
  169. package/src/StoryBookThemeProvider/index.tsx +35 -36
  170. package/src/ThemeProvider/index.tsx +39 -12
  171. package/src/ThemeProvider/palettes.ts +15 -12
  172. package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.styles.ts +6 -7
  173. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +10 -6
  174. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +0 -2
  175. package/src/TimePeriods/DateTimePickerInput.tsx +59 -19
  176. package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +12 -9
  177. package/src/TimePeriods/TimePeriods.cypress.spec.tsx +9 -33
  178. package/src/TimePeriods/helpers/index.ts +1 -1
  179. package/src/TimePeriods/index.stories.tsx +12 -4
  180. package/src/TimePeriods/index.tsx +2 -2
  181. package/src/TopCounterElements/TopCounterLayout.tsx +3 -0
  182. package/src/TopCounterElements/useCloseOnLegacyPage.tsx +42 -0
  183. package/src/Typography/FluidTypography/FluidTypography.cypress.spec.tsx +27 -0
  184. package/src/Typography/FluidTypography/index.stories.tsx +2 -2
  185. package/src/Typography/FluidTypography/index.tsx +21 -28
  186. package/src/Typography/Subtitle.tsx +55 -0
  187. package/src/api/QueryProvider.tsx +1 -1
  188. package/src/api/TestQueryProvider.tsx +1 -1
  189. package/src/api/buildListingEndpoint/getSearchQueryParameterValue.ts +7 -1
  190. package/src/api/buildListingEndpoint/models.ts +3 -1
  191. package/src/api/customFetch.ts +12 -3
  192. package/src/api/index.ts +3 -3
  193. package/src/api/useFetchQuery/index.ts +49 -28
  194. package/src/api/useGraphQuery/index.ts +26 -5
  195. package/src/api/useGraphQuery/models.ts +5 -0
  196. package/src/api/useMutationQuery/index.test.ts +4 -4
  197. package/src/api/useMutationQuery/index.ts +65 -20
  198. package/src/components/Button/Icon/IconButton.tsx +6 -2
  199. package/src/components/CollapsibleItem/CollapsibleItem.cypress.spec.tsx +76 -0
  200. package/src/components/CollapsibleItem/CollapsibleItem.stories.tsx +26 -0
  201. package/src/components/CollapsibleItem/CollapsibleItem.tsx +43 -14
  202. package/src/components/CollapsibleItem/useCollapsibleItemStyles.ts +24 -1
  203. package/src/components/DataTable/DataListing.tsx +6 -0
  204. package/src/components/DataTable/DataTable.cypress.spec.tsx +174 -0
  205. package/src/components/DataTable/DataTable.stories.tsx +40 -0
  206. package/src/components/DataTable/DataTable.styles.ts +3 -0
  207. package/src/components/DataTable/DataTable.tsx +3 -3
  208. package/src/components/DataTable/Item/DataTableItem.styles.ts +7 -2
  209. package/src/components/DataTable/Item/DataTableItem.tsx +4 -60
  210. package/src/components/DataTable/index.ts +3 -1
  211. package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +373 -0
  212. package/src/components/Form/AccessRights/AccessRights.stories.tsx +119 -0
  213. package/src/components/Form/AccessRights/AccessRights.styles.ts +10 -0
  214. package/src/components/Form/AccessRights/AccessRights.tsx +60 -0
  215. package/src/components/Form/AccessRights/Actions/Actions.styles.ts +14 -0
  216. package/src/components/Form/AccessRights/Actions/Actions.tsx +81 -0
  217. package/src/components/Form/AccessRights/Actions/useActions.ts +79 -0
  218. package/src/components/Form/AccessRights/List/Item.tsx +90 -0
  219. package/src/components/Form/AccessRights/List/List.styles.tsx +45 -0
  220. package/src/components/Form/AccessRights/List/List.tsx +52 -0
  221. package/src/components/Form/AccessRights/List/ListItemSkeleton.tsx +18 -0
  222. package/src/components/Form/AccessRights/List/ListSkeleton.tsx +22 -0
  223. package/src/components/Form/AccessRights/List/RemoveAccessRight.tsx +38 -0
  224. package/src/components/Form/AccessRights/List/StateChip.tsx +28 -0
  225. package/src/components/Form/AccessRights/List/useItem.ts +64 -0
  226. package/src/components/Form/AccessRights/Provider.tsx +15 -0
  227. package/src/components/Form/AccessRights/ShareInput/ContactSwitch.tsx +50 -0
  228. package/src/components/Form/AccessRights/ShareInput/ShareInput.styles.ts +17 -0
  229. package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +78 -0
  230. package/src/components/Form/AccessRights/ShareInput/useShareInput.tsx +113 -0
  231. package/src/components/Form/AccessRights/Stats/Stats.tsx +36 -0
  232. package/src/components/Form/AccessRights/atoms.ts +97 -0
  233. package/src/components/Form/AccessRights/common/RoleSelectField.styles.tsx +7 -0
  234. package/src/components/Form/AccessRights/common/RoleSelectField.tsx +45 -0
  235. package/src/components/Form/AccessRights/models.ts +55 -0
  236. package/src/components/Form/AccessRights/storiesData.ts +222 -0
  237. package/src/components/Form/AccessRights/useAccessRightsInitValues.ts +51 -0
  238. package/src/components/Form/Dashboard/DashboardDuplicationForm.tsx +85 -0
  239. package/src/components/Form/Dashboard/DashboardForm.tsx +15 -12
  240. package/src/components/Form/Dashboard/index.ts +1 -0
  241. package/src/components/Form/FormActions.tsx +7 -2
  242. package/src/components/Form/index.ts +2 -1
  243. package/src/components/ItemComposition/Item.tsx +1 -1
  244. package/src/components/ItemComposition/ItemComposition.cypress.spec.tsx +113 -0
  245. package/src/components/ItemComposition/ItemComposition.stories.tsx +14 -0
  246. package/src/components/ItemComposition/ItemComposition.styles.ts +36 -3
  247. package/src/components/ItemComposition/ItemComposition.tsx +41 -17
  248. package/src/components/Layout/PageLayout/PageLayout.tsx +1 -1
  249. package/src/components/Layout/PageLayout/PageLayoutActions.tsx +1 -0
  250. package/src/components/Layout/PageLayout/PageLayoutBody.tsx +1 -0
  251. package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +5 -1
  252. package/src/components/Layout/PageLayout/PageQuickAccess.tsx +76 -0
  253. package/src/components/Layout/PageLayout/index.ts +3 -1
  254. package/src/components/Layout/PageLayout.cypress.spec.tsx +66 -0
  255. package/src/components/List/Item/ListItem.styles.ts +6 -0
  256. package/src/components/List/Item/ListItem.tsx +6 -4
  257. package/src/components/List/Item/Text.tsx +5 -3
  258. package/src/components/Modal/ConfirmationModal/ConfirmationModal.cypress.spec.tsx +168 -0
  259. package/src/components/Modal/ConfirmationModal/ConfirmationModal.stories.tsx +62 -0
  260. package/src/components/Modal/ConfirmationModal/ConfirmationModal.tsx +87 -0
  261. package/src/components/Modal/Modal.styles.ts +10 -2
  262. package/src/components/Modal/ModalActions.tsx +4 -2
  263. package/src/components/Modal/index.ts +2 -0
  264. package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.stories.tsx +3 -3
  265. package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.tsx +1 -1
  266. package/src/components/Tooltip/ConfirmationTooltip/models.ts +1 -1
  267. package/src/components/Zoom/Minimap.tsx +127 -0
  268. package/src/components/Zoom/Zoom.cypress.spec.tsx +246 -0
  269. package/src/components/Zoom/Zoom.stories.tsx +115 -0
  270. package/src/components/Zoom/Zoom.styles.tsx +68 -0
  271. package/src/components/Zoom/Zoom.tsx +61 -0
  272. package/src/components/Zoom/ZoomContent.tsx +167 -0
  273. package/src/components/Zoom/constants.ts +2 -0
  274. package/src/components/Zoom/localPoint.ts +51 -0
  275. package/src/components/Zoom/models.ts +25 -0
  276. package/src/components/Zoom/useMinimap.ts +156 -0
  277. package/src/components/Zoom/useZoom.ts +70 -0
  278. package/src/components/Zoom/utils.ts +55 -0
  279. package/src/components/index.ts +1 -0
  280. package/src/fonts/roboto-bold-webfont.ttf +0 -0
  281. package/src/fonts/roboto-bold-webfont.woff +0 -0
  282. package/src/fonts/roboto-bold-webfont.woff2 +0 -0
  283. package/src/fonts/roboto-light-webfont.ttf +0 -0
  284. package/src/fonts/roboto-light-webfont.woff +0 -0
  285. package/src/fonts/roboto-light-webfont.woff2 +0 -0
  286. package/src/fonts/roboto-medium-webfont.ttf +0 -0
  287. package/src/fonts/roboto-medium-webfont.woff +0 -0
  288. package/src/fonts/roboto-medium-webfont.woff2 +0 -0
  289. package/src/fonts/roboto-regular-webfont.ttf +0 -0
  290. package/src/fonts/roboto-regular-webfont.woff +0 -0
  291. package/src/fonts/roboto-regular-webfont.woff2 +0 -0
  292. package/src/index.ts +6 -0
  293. package/src/queryParameters/url/index.ts +5 -1
  294. package/src/utils/index.ts +25 -22
  295. package/src/utils/useFullscreen/Fullscreen.cypress.spec.tsx +133 -0
  296. package/src/utils/useFullscreen/atoms.ts +3 -0
  297. package/src/utils/useFullscreen/index.ts +2 -0
  298. package/src/utils/useFullscreen/translatedLabels.ts +1 -0
  299. package/src/utils/useFullscreen/useFullscreen.ts +73 -0
  300. package/src/utils/useFullscreen/useFullscreenListener.ts +62 -0
  301. package/src/utils/useInfiniteScrollListing.ts +31 -8
  302. package/src/utils/{useLicenseExpirationWarning.cypress.spec.tsx → useLicenseExpirationWarning.test.tsx} +48 -37
  303. package/src/utils/useLicenseExpirationWarning.ts +18 -18
  304. package/src/utils/useLocale/index.ts +10 -0
  305. package/src/utils/useLocale/useLocale.cypress.spec.tsx +40 -0
  306. package/src/utils/useLocaleDateTimeFormat/index.ts +8 -2
  307. package/src/utils/usePluralizedTranslation.ts +21 -0
  308. package/src/@assets/icons/downtime.icon.svg +0 -1
  309. package/src/Graph/LineChart/BasicComponents/LoadingProgress.tsx +0 -46
  310. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/TooltipAnchorPoint.tsx +0 -96
  311. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTooltipAnchorPoint.ts +0 -107
  312. package/src/Graph/LineChart/Legend/InteractiveValue.tsx +0 -22
  313. package/src/Graph/LineChart/Legend/Marker.tsx +0 -43
  314. package/src/Graph/LineChart/Legend/useInteractiveValues.ts +0 -99
  315. package/src/Typography/FluidTypography/useFluidResizeObserver.ts +0 -56
  316. package/src/components/Form/AccessRights/AccessRights.resource.ts +0 -45
  317. package/src/components/Form/AccessRights/AccessRightsForm.stories.tsx +0 -59
  318. package/src/components/Form/AccessRights/AccessRightsForm.styles.ts +0 -21
  319. package/src/components/Form/AccessRights/AccessRightsForm.tsx +0 -67
  320. package/src/components/Form/AccessRights/AccessRightsFormActions.tsx +0 -80
  321. package/src/components/Form/AccessRights/Input/AddAction.tsx +0 -31
  322. package/src/components/Form/AccessRights/Input/ContactAccessRightInput.stories.tsx +0 -54
  323. package/src/components/Form/AccessRights/Input/ContactAccessRightInput.tsx +0 -72
  324. package/src/components/Form/AccessRights/Input/ContactAccessRightsInput.styles.ts +0 -22
  325. package/src/components/Form/AccessRights/Input/ContactInputField.tsx +0 -105
  326. package/src/components/Form/AccessRights/Input/RoleInputField.tsx +0 -29
  327. package/src/components/Form/AccessRights/List/ContactAccessRightsList.stories.tsx +0 -97
  328. package/src/components/Form/AccessRights/List/ContactAccessRightsList.styles.ts +0 -71
  329. package/src/components/Form/AccessRights/List/ContactAccessRightsList.tsx +0 -51
  330. package/src/components/Form/AccessRights/List/ContactAccessRightsListItem.stories.tsx +0 -116
  331. package/src/components/Form/AccessRights/List/ContactAccessRightsListItem.tsx +0 -118
  332. package/src/components/Form/AccessRights/List/ContactAccessRightsListItemSkeleton.tsx +0 -26
  333. package/src/components/Form/AccessRights/List/ContactAccessRightsListSkeleton.tsx +0 -28
  334. package/src/components/Form/AccessRights/Stats/AccessRightsStats.styles.ts +0 -18
  335. package/src/components/Form/AccessRights/Stats/AccessRightsStats.tsx +0 -41
  336. package/src/components/Form/AccessRights/__fixtures__/contactAccessRight.mock.ts +0 -52
  337. package/src/components/Form/AccessRights/common/GroupLabel.styles.ts +0 -18
  338. package/src/components/Form/AccessRights/common/GroupLabel.tsx +0 -15
  339. package/src/components/Form/AccessRights/common/Input.styles.ts +0 -48
  340. package/src/components/Form/AccessRights/common/RoleInputSelect.styles.ts +0 -11
  341. package/src/components/Form/AccessRights/common/RoleInputSelect.tsx +0 -57
  342. package/src/components/Form/AccessRights/index.ts +0 -3
  343. package/src/components/Form/AccessRights/useAccessRightsForm.test.tsx +0 -531
  344. package/src/components/Form/AccessRights/useAccessRightsForm.tsx +0 -282
  345. package/src/components/Form/AccessRights/useAccessRightsForm.utils.ts +0 -41
  346. package/src/screens/dashboard/DashboardsDetail.stories.tsx +0 -108
  347. package/src/screens/dashboard/DashboardsOverview.stories.tsx +0 -281
  348. package/src/utils/useDateTimePickerAdapter.ts +0 -309
  349. /package/{public → src/Button}/fonts/roboto-bold-webfont.ttf +0 -0
  350. /package/{public → src/Button}/fonts/roboto-bold-webfont.woff +0 -0
  351. /package/{public → src/Button}/fonts/roboto-bold-webfont.woff2 +0 -0
  352. /package/{public → src/Button}/fonts/roboto-light-webfont.ttf +0 -0
  353. /package/{public → src/Button}/fonts/roboto-light-webfont.woff +0 -0
  354. /package/{public → src/Button}/fonts/roboto-light-webfont.woff2 +0 -0
  355. /package/{public → src/Button}/fonts/roboto-medium-webfont.ttf +0 -0
  356. /package/{public → src/Button}/fonts/roboto-medium-webfont.woff +0 -0
  357. /package/{public → src/Button}/fonts/roboto-medium-webfont.woff2 +0 -0
  358. /package/{public → src/Button}/fonts/roboto-regular-webfont.ttf +0 -0
  359. /package/{public → src/Button}/fonts/roboto-regular-webfont.woff +0 -0
  360. /package/{public → src/Button}/fonts/roboto-regular-webfont.woff2 +0 -0
@@ -1,7 +1,8 @@
1
1
  import { ReactElement, useCallback, useMemo } from 'react';
2
2
 
3
- import * as Yup from 'yup';
3
+ import { string, number, object } from 'yup';
4
4
  import { useTranslation } from 'react-i18next';
5
+ import { equals } from 'ramda';
5
6
 
6
7
  import { InputType } from '../../../Form/Inputs/models';
7
8
  import { Form, FormProps } from '../../../Form';
@@ -84,8 +85,8 @@ const DashboardForm = ({
84
85
  }
85
86
  ],
86
87
  submit: (values, bag) => onSubmit?.(values, bag),
87
- validationSchema: Yup.object().shape({
88
- description: Yup.string()
88
+ validationSchema: object({
89
+ description: string()
89
90
  .label(labels?.entity?.description || '')
90
91
  .max(
91
92
  180,
@@ -93,17 +94,19 @@ const DashboardForm = ({
93
94
  `${p.label} ${t(labelMustBeMost)} ${p.max} ${t(labelCharacters)}`
94
95
  )
95
96
  .nullable(),
96
- globalRefreshInterval: Yup.object().shape({
97
- interval: Yup.number().when('type', {
98
- is: 'global',
99
- otherwise: Yup.number().nullable(),
100
- then: Yup.number()
101
- .min(1, ({ min }) => t(labelMustBeAtLeast, { min }))
102
- .required(t(labelRequired) as string)
97
+ globalRefreshInterval: object({
98
+ interval: number().when('type', ([type], schema) => {
99
+ if (equals(type, 'manual')) {
100
+ schema
101
+ .min(1, ({ min }) => t(labelMustBeAtLeast, { min }))
102
+ .required(t(labelRequired) as string);
103
+ }
104
+
105
+ return schema.nullable();
103
106
  }),
104
- type: Yup.string()
107
+ type: string()
105
108
  }),
106
- name: Yup.string()
109
+ name: string()
107
110
  .label(labels?.entity?.name)
108
111
  .min(3, ({ min, label }) => t(labelMustBeAtLeast, { label, min }))
109
112
  .max(50, ({ max, label }) => t(labelMustBeMost, { label, max }))
@@ -1,2 +1,3 @@
1
1
  export * from './DashboardForm';
2
2
  export * from './Dashboard.resource';
3
+ export * from './DashboardDuplicationForm';
@@ -8,6 +8,7 @@ import { FormVariant } from './Form.models';
8
8
  import { useStyles } from './Form.styles';
9
9
 
10
10
  export type FormActionsProps = {
11
+ enableSubmitWhenNotDirty?: boolean;
11
12
  labels: FormActionsLabels;
12
13
  onCancel: () => void;
13
14
  variant: FormVariant;
@@ -21,12 +22,16 @@ export type FormActionsLabels = {
21
22
  const FormActions = <TResource extends object>({
22
23
  labels,
23
24
  onCancel,
24
- variant
25
+ variant,
26
+ enableSubmitWhenNotDirty
25
27
  }: FormActionsProps): ReactElement => {
26
28
  const { classes } = useStyles();
27
29
  const { isSubmitting, dirty, isValid, submitForm } =
28
30
  useFormikContext<TResource>();
29
31
 
32
+ const isSubmitDisabled =
33
+ isSubmitting || (!dirty && !enableSubmitWhenNotDirty) || !isValid;
34
+
30
35
  return (
31
36
  <div className={classes.actions}>
32
37
  <Button
@@ -42,7 +47,7 @@ const FormActions = <TResource extends object>({
42
47
  <Button
43
48
  aria-label={labels.submit[variant]}
44
49
  data-testid="submit"
45
- disabled={isSubmitting || !dirty || !isValid}
50
+ disabled={isSubmitDisabled}
46
51
  size="medium"
47
52
  type="submit"
48
53
  variant="primary"
@@ -1,3 +1,4 @@
1
1
  export * from './Form.models';
2
2
  export * from './Dashboard';
3
- export * from './AccessRights';
3
+ export { default as AccessRights } from './AccessRights/AccessRights';
4
+ export { default as AccessRightsV2 } from './AccessRights/AccessRights';
@@ -7,7 +7,7 @@ import { IconButton } from '..';
7
7
  import { useItemStyles } from './ItemComposition.styles';
8
8
 
9
9
  type Props = {
10
- children: Array<ReactElement>;
10
+ children: ReactElement | Array<ReactElement>;
11
11
  className?: string;
12
12
  deleteButtonHidden?: boolean;
13
13
  labelDelete: string;
@@ -0,0 +1,113 @@
1
+ import { Props } from './ItemComposition';
2
+
3
+ import { ItemComposition } from '.';
4
+
5
+ const initialize = ({
6
+ deleteButtonHidden,
7
+ ...props
8
+ }: Partial<Props> & {
9
+ deleteButtonHidden?: boolean;
10
+ }): unknown => {
11
+ const addItem = cy.stub();
12
+ const deleteItem = cy.stub();
13
+
14
+ cy.mount({
15
+ Component: (
16
+ <ItemComposition {...props} labelAdd="Add" onAddItem={addItem}>
17
+ <ItemComposition.Item
18
+ deleteButtonHidden={deleteButtonHidden}
19
+ labelDelete="Delete"
20
+ onDeleteItem={deleteItem}
21
+ >
22
+ <div>Item 1</div>
23
+ </ItemComposition.Item>
24
+ <ItemComposition.Item
25
+ deleteButtonHidden={deleteButtonHidden}
26
+ labelDelete="Delete"
27
+ onDeleteItem={deleteItem}
28
+ >
29
+ <div>Item 2</div>
30
+ </ItemComposition.Item>
31
+ </ItemComposition>
32
+ )
33
+ });
34
+
35
+ return {
36
+ addItem,
37
+ deleteItem
38
+ };
39
+ };
40
+
41
+ describe('ItemComposition', () => {
42
+ it('displays the component', () => {
43
+ initialize({});
44
+
45
+ cy.contains('Item 1').should('be.visible');
46
+ cy.contains('Item 2').should('be.visible');
47
+ cy.findAllByTestId('Delete').should('have.length', 2);
48
+ cy.findByTestId('Add').should('be.enabled');
49
+
50
+ cy.makeSnapshot();
51
+ });
52
+
53
+ it('displays the component with a secondary label', () => {
54
+ initialize({ secondaryLabel: 'Secondary label' });
55
+
56
+ cy.contains('Secondary label').should('be.visible');
57
+
58
+ cy.makeSnapshot();
59
+ });
60
+
61
+ it('displays add button as hidden when the prop is set to true', () => {
62
+ initialize({ addbuttonDisabled: true });
63
+
64
+ cy.findByTestId('Add').should('be.disabled');
65
+
66
+ cy.makeSnapshot();
67
+ });
68
+
69
+ it('does not display the add button when the prop is set to true', () => {
70
+ initialize({ addButtonHidden: true });
71
+
72
+ cy.findByTestId('Add').should('not.exist');
73
+
74
+ cy.makeSnapshot();
75
+ });
76
+
77
+ it('does not display the delete button when the prop is set to true', () => {
78
+ initialize({ deleteButtonHidden: true });
79
+
80
+ cy.findByTestId('Delete').should('not.exist');
81
+
82
+ cy.makeSnapshot();
83
+ });
84
+
85
+ it('calls the add function when the button is clicked', () => {
86
+ const { addItem } = initialize({});
87
+
88
+ cy.findByTestId('Add')
89
+ .click()
90
+ .then(() => {
91
+ expect(addItem).to.have.been.calledWith();
92
+ });
93
+ });
94
+
95
+ it('calls the delete function when the button is clicked', () => {
96
+ const { deleteItem } = initialize({});
97
+
98
+ cy.findAllByTestId('Delete')
99
+ .eq(1)
100
+ .click()
101
+ .then(() => {
102
+ expect(deleteItem).to.have.been.calledWith();
103
+ });
104
+ });
105
+
106
+ it('displays items as linked when the prop is set to true', () => {
107
+ initialize({ displayItemsAsLinked: true });
108
+
109
+ cy.get('[data-linked]').should('be.visible');
110
+
111
+ cy.makeSnapshot();
112
+ });
113
+ });
@@ -76,3 +76,17 @@ export const WithSelectInputs: Story = {
76
76
  onAddItem: stub
77
77
  }
78
78
  };
79
+
80
+ export const WithLinkedItems: Story = {
81
+ args: {
82
+ children: [...Array(5)].map((_, i) => (
83
+ <ItemComposition.Item key={i} labelDelete="Delete" onDeleteItem={stub}>
84
+ <Typography>Item 1</Typography>
85
+ <Typography>Item 2</Typography>
86
+ </ItemComposition.Item>
87
+ )),
88
+ displayItemsAsLinked: true,
89
+ labelAdd: 'Add',
90
+ onAddItem: stub
91
+ }
92
+ };
@@ -1,12 +1,45 @@
1
1
  import { makeStyles } from 'tss-react/mui';
2
2
 
3
3
  export const useItemCompositionStyles = makeStyles()((theme) => ({
4
+ buttonAndSecondaryLabel: {
5
+ alignItems: 'center',
6
+ display: 'flex',
7
+ flexDirection: 'row',
8
+ justifyContent: 'space-between',
9
+ width: '100%'
10
+ },
4
11
  itemCompositionContainer: {
12
+ width: '100%'
13
+ },
14
+ itemCompositionItems: {
5
15
  alignItems: 'flex-start',
6
16
  display: 'flex',
7
17
  flexDirection: 'column',
8
18
  gap: theme.spacing(2),
9
19
  width: '100%'
20
+ },
21
+ itemCompositionItemsAndLink: {
22
+ display: 'flex',
23
+ flexDirection: 'row-reverse',
24
+ gap: theme.spacing(0.5),
25
+ width: '100%'
26
+ },
27
+ linkIcon: {
28
+ backgroundColor: theme.palette.background.paper,
29
+ padding: theme.spacing(0.5, 0),
30
+ transform: `rotate3d(0, 0, 1, 90deg) translate3d(0, ${theme.spacing(
31
+ 1.6
32
+ )}, 0)`
33
+ },
34
+ linkedItems: {
35
+ alignItems: 'center',
36
+ border: `1px solid ${theme.palette.divider}`,
37
+ borderRight: 'none',
38
+ display: 'flex',
39
+ margin: theme.spacing(2, 0, 2, 1),
40
+ minHeight: '100%',
41
+ position: 'relative',
42
+ width: theme.spacing(1)
10
43
  }
11
44
  }));
12
45
 
@@ -19,11 +52,11 @@ export const useItemStyles = makeStyles()((theme) => ({
19
52
  width: '100%'
20
53
  },
21
54
  itemContent: {
22
- display: 'flex',
23
- flexDirection: 'row',
55
+ display: 'grid',
56
+ gridAutoFlow: 'column',
24
57
  width: '100%'
25
58
  },
26
59
  visibilityHiden: {
27
- visibility: 'hidden'
60
+ display: 'none'
28
61
  }
29
62
  }));
@@ -1,18 +1,24 @@
1
1
  import { ReactElement } from 'react';
2
2
 
3
+ import { gt } from 'ramda';
4
+
3
5
  import AddIcon from '@mui/icons-material/Add';
6
+ import LinkIcon from '@mui/icons-material/Link';
7
+ import { Typography } from '@mui/material';
4
8
 
5
9
  import { Button } from '..';
6
10
 
7
11
  import { useItemCompositionStyles } from './ItemComposition.styles';
8
12
 
9
- type Props = {
13
+ export type Props = {
10
14
  IconAdd?;
11
15
  addButtonHidden?: boolean;
12
16
  addbuttonDisabled?: boolean;
13
17
  children: Array<ReactElement>;
18
+ displayItemsAsLinked?: boolean;
14
19
  labelAdd: string;
15
20
  onAddItem: () => void;
21
+ secondaryLabel?: string;
16
22
  };
17
23
 
18
24
  export const ItemComposition = ({
@@ -21,27 +27,45 @@ export const ItemComposition = ({
21
27
  labelAdd,
22
28
  addbuttonDisabled,
23
29
  addButtonHidden,
24
- IconAdd
30
+ IconAdd,
31
+ displayItemsAsLinked,
32
+ secondaryLabel
25
33
  }: Props): JSX.Element => {
26
34
  const { classes } = useItemCompositionStyles();
27
35
 
36
+ const hasMoreThanOneChildren = gt(children.length, 1);
37
+
28
38
  return (
29
39
  <div className={classes.itemCompositionContainer}>
30
- {children}
31
- {!addButtonHidden && (
32
- <Button
33
- aria-label={labelAdd}
34
- data-testid={labelAdd}
35
- disabled={addbuttonDisabled}
36
- icon={IconAdd || <AddIcon />}
37
- iconVariant="start"
38
- size="small"
39
- variant="ghost"
40
- onClick={onAddItem}
41
- >
42
- {labelAdd}
43
- </Button>
44
- )}
40
+ <div className={classes.itemCompositionItemsAndLink}>
41
+ <div className={classes.itemCompositionItems}>{children}</div>
42
+ {displayItemsAsLinked && hasMoreThanOneChildren && (
43
+ <div data-linked className={classes.linkedItems}>
44
+ <LinkIcon className={classes.linkIcon} viewBox="0 0 24 24" />
45
+ </div>
46
+ )}
47
+ </div>
48
+ <div className={classes.buttonAndSecondaryLabel}>
49
+ {!addButtonHidden && (
50
+ <Button
51
+ aria-label={labelAdd}
52
+ data-testid={labelAdd}
53
+ disabled={addbuttonDisabled}
54
+ icon={IconAdd || <AddIcon />}
55
+ iconVariant="start"
56
+ size="small"
57
+ variant="ghost"
58
+ onClick={onAddItem}
59
+ >
60
+ {labelAdd}
61
+ </Button>
62
+ )}
63
+ {secondaryLabel && (
64
+ <Typography sx={{ color: 'text.secondary' }}>
65
+ {secondaryLabel}
66
+ </Typography>
67
+ )}
68
+ </div>
45
69
  </div>
46
70
  );
47
71
  };
@@ -14,7 +14,7 @@ export const PageLayout = ({
14
14
  const { classes } = useStyles();
15
15
 
16
16
  return (
17
- <section className={classes.pageLayout} data-variant={variant}>
17
+ <section className={classes.pageLayout} data-variant={variant} id="page">
18
18
  {children}
19
19
  </section>
20
20
  );
@@ -17,6 +17,7 @@ export const PageLayoutActions = ({
17
17
  <section
18
18
  className={classes.pageLayoutActions}
19
19
  data-row-reverse={rowReverse}
20
+ id="actions"
20
21
  >
21
22
  {children}
22
23
  </section>
@@ -17,6 +17,7 @@ export const PageLayoutBody = ({
17
17
  <section
18
18
  className={classes.pageLayoutBody}
19
19
  data-has-background={hasBackground}
20
+ id="page-body"
20
21
  >
21
22
  {children}
22
23
  </section>
@@ -11,5 +11,9 @@ export const PageLayoutHeader = ({
11
11
  }: PageLayoutHeaderProps): JSX.Element => {
12
12
  const { classes } = useStyles();
13
13
 
14
- return <header className={classes.pageLayoutHeader}>{children}</header>;
14
+ return (
15
+ <header className={classes.pageLayoutHeader} id="header">
16
+ {children}
17
+ </header>
18
+ );
15
19
  };
@@ -0,0 +1,76 @@
1
+ import { useTranslation } from 'react-i18next';
2
+
3
+ import AddIcon from '@mui/icons-material/Add';
4
+ import ArrowBackIcon from '@mui/icons-material/ArrowBack';
5
+
6
+ import { Button, Menu } from '../..';
7
+
8
+ interface NamedEntity {
9
+ id: number | string;
10
+ name: string;
11
+ }
12
+
13
+ type Props = {
14
+ create: () => void;
15
+ elements: Array<NamedEntity>;
16
+ goBack: () => void;
17
+ isActive: (id: number | string) => boolean;
18
+ labels: {
19
+ create: string;
20
+ goBack: string;
21
+ };
22
+ navigateToElement: (id: number | string) => () => void;
23
+ };
24
+
25
+ export const PageQuickAccess = ({
26
+ elements,
27
+ isActive,
28
+ navigateToElement,
29
+ goBack,
30
+ create,
31
+ labels
32
+ }: Props): JSX.Element => {
33
+ const { t } = useTranslation();
34
+
35
+ return (
36
+ <Menu>
37
+ <Menu.Button data-testid="quickaccess" />
38
+ <Menu.Items>
39
+ {elements &&
40
+ elements.map((element) => (
41
+ <Menu.Item
42
+ key={`${element.id}`}
43
+ onClick={navigateToElement(element.id)}
44
+ {...(isActive(element.id) && {
45
+ isActive: true,
46
+ isDisabled: true
47
+ })}
48
+ >
49
+ {element.name}
50
+ </Menu.Item>
51
+ ))}
52
+ <Menu.Divider key="divider" />
53
+ <Menu.Item key="create">
54
+ <>
55
+ <Button
56
+ icon={<ArrowBackIcon />}
57
+ iconVariant="start"
58
+ variant="ghost"
59
+ onClick={goBack}
60
+ >
61
+ {t(labels.goBack)}
62
+ </Button>
63
+ <Button
64
+ icon={<AddIcon />}
65
+ iconVariant="start"
66
+ variant="secondary"
67
+ onClick={create}
68
+ >
69
+ {t(labels.create)}
70
+ </Button>
71
+ </>
72
+ </Menu.Item>
73
+ </Menu.Items>
74
+ </Menu>
75
+ );
76
+ };
@@ -2,9 +2,11 @@ import { PageLayout as PageLayoutRoot } from './PageLayout';
2
2
  import { PageLayoutHeader } from './PageLayoutHeader';
3
3
  import { PageLayoutBody } from './PageLayoutBody';
4
4
  import { PageLayoutActions } from './PageLayoutActions';
5
+ import { PageQuickAccess } from './PageQuickAccess';
5
6
 
6
7
  export const PageLayout = Object.assign(PageLayoutRoot, {
7
8
  Actions: PageLayoutActions,
8
9
  Body: PageLayoutBody,
9
- Header: PageLayoutHeader
10
+ Header: PageLayoutHeader,
11
+ QuickAccess: PageQuickAccess
10
12
  });
@@ -0,0 +1,66 @@
1
+ import { T } from 'ramda';
2
+
3
+ import { PageHeader } from '..';
4
+
5
+ import { AreaIndicator } from './AreaIndicator';
6
+
7
+ import { PageLayout } from '.';
8
+
9
+ const initialize = (): void => {
10
+ cy.mount({
11
+ Component: (
12
+ <PageLayout>
13
+ <PageLayout.Header>
14
+ <PageHeader>
15
+ <PageHeader.Menu>
16
+ <PageLayout.QuickAccess
17
+ create={cy.stub()}
18
+ elements={[
19
+ {
20
+ id: 1,
21
+ name: 'Entity'
22
+ }
23
+ ]}
24
+ goBack={cy.stub()}
25
+ isActive={T}
26
+ labels={{
27
+ create: 'Create',
28
+ goBack: 'Go back'
29
+ }}
30
+ navigateToElement={cy.stub()}
31
+ />
32
+ </PageHeader.Menu>
33
+ <PageHeader.Main>
34
+ <PageHeader.Title description="Description" title="Title" />
35
+ </PageHeader.Main>
36
+ <PageHeader.Actions>Actions</PageHeader.Actions>
37
+ </PageHeader>
38
+ </PageLayout.Header>
39
+ <PageLayout.Body>
40
+ <PageLayout.Actions>
41
+ <AreaIndicator name="Body actions" />
42
+ </PageLayout.Actions>
43
+ <h1>Content</h1>
44
+ </PageLayout.Body>
45
+ </PageLayout>
46
+ )
47
+ });
48
+ };
49
+
50
+ describe('Page layout', () => {
51
+ beforeEach(initialize);
52
+
53
+ it('displays the page layout', () => {
54
+ cy.makeSnapshot();
55
+ });
56
+
57
+ it('opens the quick access poppin when the corresponding logo is displayed', () => {
58
+ cy.findByTestId('quickaccess').click();
59
+
60
+ cy.contains('Entity').should('be.visible');
61
+ cy.contains('Create').should('be.visible');
62
+ cy.contains('Go back').should('be.visible');
63
+
64
+ cy.makeSnapshot();
65
+ });
66
+ });
@@ -23,6 +23,12 @@ export const useStyles = makeStyles()((theme) => ({
23
23
  paddingBottom: theme.spacing(1),
24
24
  paddingTop: theme.spacing(1)
25
25
  },
26
+ secondary: {
27
+ alignItems: 'center',
28
+ display: 'flex',
29
+ flexDirection: 'row',
30
+ gap: theme.spacing(1)
31
+ },
26
32
  text: {
27
33
  '&, &.MuiListItemText-root': {
28
34
  '& .MuiListItemText-primary': {
@@ -1,10 +1,10 @@
1
1
  import { ForwardedRef, forwardRef, ReactElement, ReactNode } from 'react';
2
2
 
3
- import { ListItem as MuiListItem } from '@mui/material';
3
+ import { ListItemProps, ListItem as MuiListItem } from '@mui/material';
4
4
 
5
5
  import { useStyles } from './ListItem.styles';
6
6
 
7
- type ListItemProps = {
7
+ type Props = {
8
8
  action?: ReactElement;
9
9
  children: ReactNode | Array<ReactNode>;
10
10
  className?: string;
@@ -12,7 +12,7 @@ type ListItemProps = {
12
12
 
13
13
  export const ListItem = forwardRef(
14
14
  (
15
- { action, children, className, ...attr }: ListItemProps,
15
+ { action, children, className, ...attr }: Props & ListItemProps,
16
16
  ref?: ForwardedRef<HTMLLIElement>
17
17
  ) => {
18
18
  const { classes, cx } = useStyles();
@@ -22,7 +22,9 @@ export const ListItem = forwardRef(
22
22
  disableGutters
23
23
  className={cx(classes.listItem, className)}
24
24
  ref={ref}
25
- secondaryAction={action}
25
+ secondaryAction={
26
+ action && <div className={classes.secondary}>{action}</div>
27
+ }
26
28
  {...attr}
27
29
  >
28
30
  {children}
@@ -5,19 +5,21 @@ import { ListItemText as MuiListItemText } from '@mui/material';
5
5
  import { useStyles } from './ListItem.styles';
6
6
 
7
7
  type TextProps = {
8
+ className?: string;
8
9
  primaryText: ReactNode;
9
10
  secondaryText?: ReactNode;
10
11
  };
11
12
 
12
13
  export const Text = ({
13
14
  primaryText,
14
- secondaryText
15
+ secondaryText,
16
+ className
15
17
  }: TextProps): ReactElement => {
16
- const { classes } = useStyles();
18
+ const { classes, cx } = useStyles();
17
19
 
18
20
  return (
19
21
  <MuiListItemText
20
- className={classes.text}
22
+ className={cx(classes.text, className)}
21
23
  primary={primaryText}
22
24
  secondary={secondaryText}
23
25
  />