@centreon/ui 23.10.122 → 24.4.1-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.
- package/package.json +59 -41
- package/public/mockServiceWorker.js +2 -2
- package/src/ActionsList/ActionsList.styles.ts +40 -71
- package/src/Button/Icon/index.stories.tsx +1 -1
- package/src/Button/Icon/index.tsx +2 -2
- package/src/Button/Save/StartIcon.tsx +3 -3
- package/src/Button/Save/index.tsx +9 -5
- package/src/Checkbox/Checkbox.tsx +2 -2
- package/src/Checkbox/CheckboxGroup/index.tsx +2 -2
- package/src/Checkbox/fonts/roboto-bold-webfont.ttf +0 -0
- package/src/Checkbox/fonts/roboto-bold-webfont.woff +0 -0
- package/src/Checkbox/fonts/roboto-bold-webfont.woff2 +0 -0
- package/src/Checkbox/fonts/roboto-light-webfont.ttf +0 -0
- package/src/Checkbox/fonts/roboto-light-webfont.woff +0 -0
- package/src/Checkbox/fonts/roboto-light-webfont.woff2 +0 -0
- package/src/Checkbox/fonts/roboto-medium-webfont.ttf +0 -0
- package/src/Checkbox/fonts/roboto-medium-webfont.woff +0 -0
- package/src/Checkbox/fonts/roboto-medium-webfont.woff2 +0 -0
- package/src/Checkbox/fonts/roboto-regular-webfont.ttf +0 -0
- package/src/Checkbox/fonts/roboto-regular-webfont.woff +0 -0
- package/src/Checkbox/fonts/roboto-regular-webfont.woff2 +0 -0
- package/src/Dashboard/Dashboard.styles.ts +6 -5
- package/src/Dashboard/Item.tsx +1 -1
- package/src/Dashboard/Layout.tsx +2 -2
- package/src/Dashboard/utils.ts +1 -1
- package/src/Dialog/Confirm/index.tsx +10 -2
- package/src/Dialog/UnsavedChanges/index.tsx +21 -20
- package/src/Dialog/UnsavedChanges/translatedLabels.ts +4 -6
- package/src/Dialog/index.tsx +9 -2
- package/src/FallbackPage/FallbackPage.tsx +3 -3
- package/src/FileDropZone/index.tsx +3 -1
- package/src/Form/Form.cypress.spec.tsx +133 -0
- package/src/Form/Inputs/Grid.tsx +8 -4
- package/src/Form/Inputs/List/Content.tsx +62 -0
- package/src/Form/Inputs/List/List.styles.ts +29 -0
- package/src/Form/Inputs/List/List.tsx +58 -0
- package/src/Form/Inputs/List/useList.ts +81 -0
- package/src/Form/Inputs/Text.tsx +3 -1
- package/src/Form/Inputs/index.tsx +3 -1
- package/src/Form/Inputs/models.ts +23 -13
- package/src/Graph/BarStack/BarStack.cypress.spec.tsx +139 -0
- package/src/Graph/BarStack/BarStack.stories.tsx +123 -0
- package/src/Graph/BarStack/BarStack.styles.ts +37 -0
- package/src/Graph/BarStack/BarStack.tsx +14 -0
- package/src/Graph/BarStack/ResponsiveBarStack.tsx +211 -0
- package/src/Graph/BarStack/index.ts +1 -0
- package/src/Graph/BarStack/models.ts +20 -0
- package/src/Graph/BarStack/useResponsiveBarStack.ts +131 -0
- package/src/Graph/Gauge/Gauge.cypress.spec.tsx +102 -0
- package/src/Graph/Gauge/Gauge.tsx +1 -1
- package/src/Graph/HeatMap/HeatMap.cypress.spec.tsx +145 -0
- package/src/Graph/HeatMap/HeatMap.stories.tsx +0 -25
- package/src/Graph/HeatMap/HeatMap.styles.tsx +1 -0
- package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +20 -10
- package/src/Graph/HeatMap/model.ts +1 -0
- package/src/Graph/Legend/Legend.tsx +21 -0
- package/src/Graph/Legend/index.ts +1 -0
- package/src/Graph/Legend/models.ts +11 -0
- package/src/Graph/LineChart/BasicComponents/Lines/RegularLines/index.tsx +2 -1
- package/src/Graph/LineChart/BasicComponents/Lines/StackedLines/index.tsx +3 -4
- package/src/Graph/LineChart/BasicComponents/Lines/Threshold/Circle.tsx +2 -2
- package/src/Graph/LineChart/BasicComponents/ThresholdLine.tsx +3 -1
- package/src/Graph/LineChart/BasicComponents/Thresholds.tsx +2 -2
- package/src/Graph/LineChart/BasicComponents/useFilterLines.ts +3 -5
- package/src/Graph/LineChart/Header/index.tsx +3 -31
- package/src/Graph/LineChart/Icons/Downtime.tsx +3 -3
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/GuidingLines.tsx +2 -2
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTickGraph.ts +9 -11
- package/src/Graph/LineChart/InteractiveComponents/Annotations/EventAnnotations.tsx +1 -1
- package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx +68 -0
- package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +27 -0
- package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltipStyles.ts +31 -0
- package/src/Graph/LineChart/InteractiveComponents/ZoomPreview/index.tsx +2 -1
- package/src/Graph/LineChart/InteractiveComponents/index.tsx +132 -17
- package/src/Graph/LineChart/InteractiveComponents/interactionWithGraphAtoms.ts +7 -27
- package/src/Graph/LineChart/Legend/Legend.styles.ts +75 -33
- package/src/Graph/LineChart/Legend/LegendContent.tsx +12 -6
- package/src/Graph/LineChart/Legend/LegendHeader.tsx +66 -27
- package/src/Graph/LineChart/Legend/index.tsx +35 -45
- package/src/Graph/LineChart/Legend/models.ts +5 -0
- package/src/Graph/LineChart/Legend/useLegend.ts +12 -13
- package/src/Graph/LineChart/LineChart.cypress.spec.tsx +144 -0
- package/src/Graph/LineChart/LineChart.styles.ts +8 -0
- package/src/Graph/LineChart/LineChart.tsx +118 -117
- package/src/Graph/LineChart/LoadingSkeleton.tsx +2 -2
- package/src/Graph/LineChart/helpers/doc.ts +16 -13
- package/src/Graph/LineChart/helpers/index.ts +1 -1
- package/src/Graph/LineChart/index.stories.tsx +17 -2
- package/src/Graph/LineChart/index.tsx +6 -7
- package/src/Graph/LineChart/mockedData/curvesWithSameColor.json +252 -0
- package/src/Graph/LineChart/mockedData/lastDayWithIncompleteValues.json +1320 -0
- package/src/Graph/LineChart/mockedData/lastDayWithNullValues.json +1314 -0
- package/src/Graph/LineChart/models.ts +12 -1
- package/src/Graph/LineChart/useLineChartData.ts +57 -18
- package/src/Graph/PieChart/PieChart.cypress.spec.tsx +154 -0
- package/src/Graph/PieChart/PieChart.stories.tsx +194 -0
- package/src/Graph/PieChart/PieChart.styles.ts +39 -0
- package/src/Graph/PieChart/PieChart.tsx +14 -0
- package/src/Graph/PieChart/ResponsivePie.tsx +245 -0
- package/src/Graph/PieChart/index.ts +1 -0
- package/src/Graph/PieChart/models.ts +20 -0
- package/src/Graph/PieChart/useResponsivePie.ts +81 -0
- package/src/Graph/SingleBar/SingleBar.cypress.spec.tsx +121 -0
- package/src/Graph/SingleBar/Thresholds.tsx +2 -2
- package/src/Graph/Text/Text.cypress.spec.tsx +101 -0
- package/src/Graph/Text/Text.stories.tsx +60 -4
- package/src/Graph/Text/Text.styles.ts +12 -1
- package/src/Graph/Text/Text.tsx +17 -12
- package/src/Graph/Tree/DescendantNodes.tsx +88 -0
- package/src/Graph/Tree/Links.tsx +64 -0
- package/src/Graph/Tree/StandaloneTree.tsx +32 -0
- package/src/Graph/Tree/Tree.cypress.spec.tsx +171 -0
- package/src/Graph/Tree/Tree.stories.tsx +144 -0
- package/src/Graph/Tree/Tree.tsx +116 -0
- package/src/Graph/Tree/constants.ts +2 -0
- package/src/Graph/Tree/index.ts +4 -0
- package/src/Graph/Tree/models.ts +52 -0
- package/src/Graph/Tree/stories/contents.tsx +164 -0
- package/src/Graph/Tree/stories/datas.ts +305 -0
- package/src/Graph/Tree/utils.ts +49 -0
- package/src/Graph/common/testUtils.ts +71 -0
- package/src/Graph/common/timeSeries/index.ts +53 -15
- package/src/Graph/common/utils.ts +68 -1
- package/src/Graph/index.ts +4 -0
- package/src/Icon/BaseIcon.tsx +32 -0
- package/src/Icon/DowntimeIcon.tsx +14 -0
- package/src/InputField/Number/Number.cypress.spec.tsx +85 -0
- package/src/InputField/Number/Number.stories.tsx +66 -0
- package/src/InputField/Number/Number.tsx +74 -0
- package/src/InputField/Search/index.tsx +2 -2
- package/src/InputField/Select/Autocomplete/Connected/Multi/index.test.tsx +1 -0
- package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +1 -0
- package/src/InputField/Select/Autocomplete/Connected/index.tsx +25 -10
- package/src/InputField/Select/Autocomplete/Draggable/SortableList.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Draggable/SortableListContent.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Draggable/index.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Multi/index.tsx +4 -2
- package/src/InputField/Select/Autocomplete/index.tsx +129 -116
- package/src/InputField/Select/IconPopover/index.tsx +3 -3
- package/src/InputField/Select/index.tsx +15 -2
- package/src/InputField/Text/index.tsx +46 -41
- package/src/Listing/ActionBar/index.tsx +11 -10
- package/src/Listing/Cell/DataCell.styles.ts +3 -0
- package/src/Listing/Cell/DataCell.tsx +23 -5
- package/src/Listing/Header/ListingHeader.tsx +1 -1
- package/src/Listing/Listing.cypress.spec.tsx +218 -33
- package/src/Listing/Listing.styles.ts +4 -7
- package/src/Listing/Row/Row.tsx +7 -3
- package/src/Listing/index.stories.tsx +39 -5
- package/src/Listing/index.test.tsx +1 -1
- package/src/Listing/index.tsx +207 -149
- package/src/Listing/models.ts +1 -0
- package/src/Listing/useStyleTable.ts +1 -0
- package/src/Module/LicensedModule/LicenseCheck/index.tsx +24 -9
- package/src/Module/LicensedModule/index.tsx +7 -1
- package/src/Module/Module.cypress.spec.tsx +129 -0
- package/src/Module/index.tsx +2 -4
- package/src/Panel/index.tsx +1 -1
- package/src/PopoverMenu/index.tsx +9 -8
- package/src/RichTextEditor/ContentEditable.tsx +195 -195
- package/src/RichTextEditor/RichTextEditor.tsx +12 -1
- package/src/SortableItems/index.tsx +2 -7
- package/src/StoryBookThemeProvider/index.tsx +35 -36
- package/src/ThemeProvider/index.tsx +39 -12
- package/src/ThemeProvider/palettes.ts +15 -12
- package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.styles.ts +6 -7
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +8 -3
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +0 -2
- package/src/TimePeriods/DateTimePickerInput.tsx +56 -19
- package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +12 -9
- package/src/TimePeriods/TimePeriods.cypress.spec.tsx +9 -33
- package/src/TimePeriods/helpers/index.ts +1 -1
- package/src/TimePeriods/index.stories.tsx +12 -4
- package/src/TimePeriods/index.tsx +2 -2
- package/src/TopCounterElements/TopCounterLayout.tsx +3 -0
- package/src/TopCounterElements/useCloseOnLegacyPage.tsx +42 -0
- package/src/Typography/FluidTypography/FluidTypography.cypress.spec.tsx +27 -0
- package/src/Typography/FluidTypography/index.stories.tsx +2 -2
- package/src/Typography/FluidTypography/index.tsx +21 -28
- package/src/Typography/Subtitle.tsx +55 -0
- package/src/api/QueryProvider.tsx +1 -1
- package/src/api/TestQueryProvider.tsx +1 -1
- package/src/api/buildListingEndpoint/models.ts +2 -1
- package/src/api/customFetch.ts +12 -3
- package/src/api/index.ts +3 -3
- package/src/api/useFetchQuery/index.ts +49 -28
- package/src/api/useGraphQuery/index.ts +26 -5
- package/src/api/useGraphQuery/models.ts +5 -0
- package/src/api/useMutationQuery/index.test.ts +4 -4
- package/src/api/useMutationQuery/index.ts +65 -20
- package/src/components/Button/Icon/IconButton.tsx +6 -2
- package/src/components/CollapsibleItem/CollapsibleItem.cypress.spec.tsx +76 -0
- package/src/components/CollapsibleItem/CollapsibleItem.stories.tsx +26 -0
- package/src/components/CollapsibleItem/CollapsibleItem.tsx +43 -14
- package/src/components/CollapsibleItem/useCollapsibleItemStyles.ts +24 -1
- package/src/components/DataTable/DataListing.tsx +6 -0
- package/src/components/DataTable/DataTable.cypress.spec.tsx +174 -0
- package/src/components/DataTable/DataTable.stories.tsx +40 -0
- package/src/components/DataTable/DataTable.styles.ts +3 -0
- package/src/components/DataTable/DataTable.tsx +3 -3
- package/src/components/DataTable/Item/DataTableItem.styles.ts +7 -2
- package/src/components/DataTable/Item/DataTableItem.tsx +4 -60
- package/src/components/DataTable/index.ts +3 -1
- package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +373 -0
- package/src/components/Form/AccessRights/AccessRights.stories.tsx +119 -0
- package/src/components/Form/AccessRights/AccessRights.styles.ts +10 -0
- package/src/components/Form/AccessRights/AccessRights.tsx +60 -0
- package/src/components/Form/AccessRights/Actions/Actions.styles.ts +14 -0
- package/src/components/Form/AccessRights/Actions/Actions.tsx +81 -0
- package/src/components/Form/AccessRights/Actions/useActions.ts +79 -0
- package/src/components/Form/AccessRights/List/Item.tsx +90 -0
- package/src/components/Form/AccessRights/List/List.styles.tsx +45 -0
- package/src/components/Form/AccessRights/List/List.tsx +52 -0
- package/src/components/Form/AccessRights/List/ListItemSkeleton.tsx +18 -0
- package/src/components/Form/AccessRights/List/ListSkeleton.tsx +22 -0
- package/src/components/Form/AccessRights/List/RemoveAccessRight.tsx +38 -0
- package/src/components/Form/AccessRights/List/StateChip.tsx +28 -0
- package/src/components/Form/AccessRights/List/useItem.ts +64 -0
- package/src/components/Form/AccessRights/Provider.tsx +15 -0
- package/src/components/Form/AccessRights/ShareInput/ContactSwitch.tsx +50 -0
- package/src/components/Form/AccessRights/ShareInput/ShareInput.styles.ts +17 -0
- package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +78 -0
- package/src/components/Form/AccessRights/ShareInput/useShareInput.tsx +113 -0
- package/src/components/Form/AccessRights/Stats/Stats.tsx +36 -0
- package/src/components/Form/AccessRights/atoms.ts +97 -0
- package/src/components/Form/AccessRights/common/RoleSelectField.styles.tsx +7 -0
- package/src/components/Form/AccessRights/common/RoleSelectField.tsx +45 -0
- package/src/components/Form/AccessRights/models.ts +55 -0
- package/src/components/Form/AccessRights/storiesData.ts +222 -0
- package/src/components/Form/AccessRights/useAccessRightsInitValues.ts +51 -0
- package/src/components/Form/Dashboard/DashboardDuplicationForm.tsx +85 -0
- package/src/components/Form/Dashboard/DashboardForm.tsx +15 -12
- package/src/components/Form/Dashboard/index.ts +1 -0
- package/src/components/Form/FormActions.tsx +7 -2
- package/src/components/Form/index.ts +2 -1
- package/src/components/ItemComposition/Item.tsx +1 -1
- package/src/components/ItemComposition/ItemComposition.cypress.spec.tsx +113 -0
- package/src/components/ItemComposition/ItemComposition.stories.tsx +14 -0
- package/src/components/ItemComposition/ItemComposition.styles.ts +36 -3
- package/src/components/ItemComposition/ItemComposition.tsx +41 -17
- package/src/components/Layout/PageLayout/PageLayout.tsx +1 -1
- package/src/components/Layout/PageLayout/PageLayoutActions.tsx +1 -0
- package/src/components/Layout/PageLayout/PageLayoutBody.tsx +1 -0
- package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +5 -1
- package/src/components/Layout/PageLayout/PageQuickAccess.tsx +76 -0
- package/src/components/Layout/PageLayout/index.ts +3 -1
- package/src/components/Layout/PageLayout.cypress.spec.tsx +66 -0
- package/src/components/List/Item/ListItem.styles.ts +6 -0
- package/src/components/List/Item/ListItem.tsx +6 -4
- package/src/components/List/Item/Text.tsx +5 -3
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.cypress.spec.tsx +168 -0
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.stories.tsx +62 -0
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.tsx +87 -0
- package/src/components/Modal/Modal.styles.ts +10 -2
- package/src/components/Modal/ModalActions.tsx +4 -2
- package/src/components/Modal/index.ts +2 -0
- package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.stories.tsx +3 -3
- package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.tsx +1 -1
- package/src/components/Tooltip/ConfirmationTooltip/models.ts +1 -1
- package/src/components/Zoom/Minimap.tsx +127 -0
- package/src/components/Zoom/Zoom.cypress.spec.tsx +246 -0
- package/src/components/Zoom/Zoom.stories.tsx +115 -0
- package/src/components/Zoom/Zoom.styles.tsx +68 -0
- package/src/components/Zoom/Zoom.tsx +61 -0
- package/src/components/Zoom/ZoomContent.tsx +167 -0
- package/src/components/Zoom/constants.ts +2 -0
- package/src/components/Zoom/localPoint.ts +51 -0
- package/src/components/Zoom/models.ts +25 -0
- package/src/components/Zoom/useMinimap.ts +156 -0
- package/src/components/Zoom/useZoom.ts +70 -0
- package/src/components/Zoom/utils.ts +55 -0
- package/src/components/index.ts +1 -0
- package/src/fonts/roboto-bold-webfont.ttf +0 -0
- package/src/fonts/roboto-bold-webfont.woff +0 -0
- package/src/fonts/roboto-bold-webfont.woff2 +0 -0
- package/src/fonts/roboto-light-webfont.ttf +0 -0
- package/src/fonts/roboto-light-webfont.woff +0 -0
- package/src/fonts/roboto-light-webfont.woff2 +0 -0
- package/src/fonts/roboto-medium-webfont.ttf +0 -0
- package/src/fonts/roboto-medium-webfont.woff +0 -0
- package/src/fonts/roboto-medium-webfont.woff2 +0 -0
- package/src/fonts/roboto-regular-webfont.ttf +0 -0
- package/src/fonts/roboto-regular-webfont.woff +0 -0
- package/src/fonts/roboto-regular-webfont.woff2 +0 -0
- package/src/index.ts +6 -0
- package/src/queryParameters/url/index.ts +5 -1
- package/src/utils/index.ts +3 -1
- package/src/utils/useFullscreen/Fullscreen.cypress.spec.tsx +130 -0
- package/src/utils/useFullscreen/atoms.ts +3 -0
- package/src/utils/useFullscreen/index.ts +2 -0
- package/src/utils/useFullscreen/translatedLabels.ts +1 -0
- package/src/utils/useFullscreen/useFullscreen.ts +73 -0
- package/src/utils/useFullscreen/useFullscreenListener.ts +62 -0
- package/src/utils/useInfiniteScrollListing.ts +31 -8
- package/src/utils/{useLicenseExpirationWarning.cypress.spec.tsx → useLicenseExpirationWarning.test.tsx} +48 -37
- package/src/utils/useLicenseExpirationWarning.ts +18 -18
- package/src/utils/useLocaleDateTimeFormat/index.ts +3 -0
- package/src/utils/usePluralizedTranslation.ts +21 -0
- package/src/@assets/icons/downtime.icon.svg +0 -1
- package/src/Graph/LineChart/BasicComponents/LoadingProgress.tsx +0 -46
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/TooltipAnchorPoint.tsx +0 -96
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTooltipAnchorPoint.ts +0 -107
- package/src/Graph/LineChart/Legend/InteractiveValue.tsx +0 -22
- package/src/Graph/LineChart/Legend/Marker.tsx +0 -43
- package/src/Graph/LineChart/Legend/useInteractiveValues.ts +0 -99
- package/src/Typography/FluidTypography/useFluidResizeObserver.ts +0 -56
- package/src/components/Form/AccessRights/AccessRights.resource.ts +0 -45
- package/src/components/Form/AccessRights/AccessRightsForm.stories.tsx +0 -59
- package/src/components/Form/AccessRights/AccessRightsForm.styles.ts +0 -21
- package/src/components/Form/AccessRights/AccessRightsForm.tsx +0 -67
- package/src/components/Form/AccessRights/AccessRightsFormActions.tsx +0 -80
- package/src/components/Form/AccessRights/Input/AddAction.tsx +0 -31
- package/src/components/Form/AccessRights/Input/ContactAccessRightInput.stories.tsx +0 -54
- package/src/components/Form/AccessRights/Input/ContactAccessRightInput.tsx +0 -72
- package/src/components/Form/AccessRights/Input/ContactAccessRightsInput.styles.ts +0 -22
- package/src/components/Form/AccessRights/Input/ContactInputField.tsx +0 -105
- package/src/components/Form/AccessRights/Input/RoleInputField.tsx +0 -29
- package/src/components/Form/AccessRights/List/ContactAccessRightsList.stories.tsx +0 -97
- package/src/components/Form/AccessRights/List/ContactAccessRightsList.styles.ts +0 -71
- package/src/components/Form/AccessRights/List/ContactAccessRightsList.tsx +0 -51
- package/src/components/Form/AccessRights/List/ContactAccessRightsListItem.stories.tsx +0 -116
- package/src/components/Form/AccessRights/List/ContactAccessRightsListItem.tsx +0 -118
- package/src/components/Form/AccessRights/List/ContactAccessRightsListItemSkeleton.tsx +0 -26
- package/src/components/Form/AccessRights/List/ContactAccessRightsListSkeleton.tsx +0 -28
- package/src/components/Form/AccessRights/Stats/AccessRightsStats.styles.ts +0 -18
- package/src/components/Form/AccessRights/Stats/AccessRightsStats.tsx +0 -41
- package/src/components/Form/AccessRights/__fixtures__/contactAccessRight.mock.ts +0 -52
- package/src/components/Form/AccessRights/common/GroupLabel.styles.ts +0 -18
- package/src/components/Form/AccessRights/common/GroupLabel.tsx +0 -15
- package/src/components/Form/AccessRights/common/Input.styles.ts +0 -48
- package/src/components/Form/AccessRights/common/RoleInputSelect.styles.ts +0 -11
- package/src/components/Form/AccessRights/common/RoleInputSelect.tsx +0 -57
- package/src/components/Form/AccessRights/index.ts +0 -3
- package/src/components/Form/AccessRights/useAccessRightsForm.test.tsx +0 -531
- package/src/components/Form/AccessRights/useAccessRightsForm.tsx +0 -282
- package/src/components/Form/AccessRights/useAccessRightsForm.utils.ts +0 -41
- package/src/screens/dashboard/DashboardsDetail.stories.tsx +0 -108
- package/src/screens/dashboard/DashboardsOverview.stories.tsx +0 -281
- package/src/utils/useDateTimePickerAdapter.ts +0 -309
- /package/{public → src/Button}/fonts/roboto-bold-webfont.ttf +0 -0
- /package/{public → src/Button}/fonts/roboto-bold-webfont.woff +0 -0
- /package/{public → src/Button}/fonts/roboto-bold-webfont.woff2 +0 -0
- /package/{public → src/Button}/fonts/roboto-light-webfont.ttf +0 -0
- /package/{public → src/Button}/fonts/roboto-light-webfont.woff +0 -0
- /package/{public → src/Button}/fonts/roboto-light-webfont.woff2 +0 -0
- /package/{public → src/Button}/fonts/roboto-medium-webfont.ttf +0 -0
- /package/{public → src/Button}/fonts/roboto-medium-webfont.woff +0 -0
- /package/{public → src/Button}/fonts/roboto-medium-webfont.woff2 +0 -0
- /package/{public → src/Button}/fonts/roboto-regular-webfont.ttf +0 -0
- /package/{public → src/Button}/fonts/roboto-regular-webfont.woff +0 -0
- /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
|
|
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:
|
|
88
|
-
description:
|
|
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:
|
|
97
|
-
interval:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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:
|
|
107
|
+
type: string()
|
|
105
108
|
}),
|
|
106
|
-
name:
|
|
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 }))
|
|
@@ -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={
|
|
50
|
+
disabled={isSubmitDisabled}
|
|
46
51
|
size="medium"
|
|
47
52
|
type="submit"
|
|
48
53
|
variant="primary"
|
|
@@ -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: '
|
|
23
|
-
|
|
55
|
+
display: 'grid',
|
|
56
|
+
gridAutoFlow: 'column',
|
|
24
57
|
width: '100%'
|
|
25
58
|
},
|
|
26
59
|
visibilityHiden: {
|
|
27
|
-
|
|
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
|
-
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
};
|
|
@@ -11,5 +11,9 @@ export const PageLayoutHeader = ({
|
|
|
11
11
|
}: PageLayoutHeaderProps): JSX.Element => {
|
|
12
12
|
const { classes } = useStyles();
|
|
13
13
|
|
|
14
|
-
return
|
|
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
|
|
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={
|
|
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
|
/>
|