@centreon/ui 23.10.1-fix-notification-tests.0 → 23.10.1-hotfix-23-10-next.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 +10 -1
- package/public/mockServiceWorker.js +2 -2
- package/src/ActionsList/ActionsList.styles.ts +116 -0
- package/src/ActionsList/index.stories.tsx +74 -0
- package/src/ActionsList/index.tsx +38 -17
- package/src/ActionsList/models.ts +8 -0
- package/src/Button/Icon/index.tsx +10 -1
- package/src/Checkbox/Checkbox.tsx +20 -18
- package/src/Checkbox/CheckboxGroup/index.tsx +14 -5
- package/src/Dashboard/Dashboard.styles.ts +21 -3
- package/src/Dashboard/Item.tsx +22 -12
- package/src/Dashboard/Layout.tsx +13 -8
- package/src/Form/Inputs/ConnectedAutocomplete.tsx +3 -1
- package/src/Form/Inputs/Radio.tsx +15 -4
- package/src/Form/Inputs/index.tsx +1 -3
- package/src/Form/Inputs/models.ts +3 -2
- package/src/Graph/Gauge/AnimatedPie.tsx +102 -0
- package/src/Graph/Gauge/Gauge.stories.tsx +159 -0
- package/src/Graph/Gauge/Gauge.tsx +41 -0
- package/src/Graph/Gauge/PieData.tsx +63 -0
- package/src/Graph/Gauge/ResponsiveGauge.tsx +148 -0
- package/src/Graph/Gauge/Thresholds.tsx +117 -0
- package/src/Graph/Gauge/index.ts +1 -0
- package/src/Graph/Gauge/models.ts +20 -0
- package/src/Graph/HeatMap/HeatMap.stories.tsx +105 -0
- package/src/Graph/HeatMap/HeatMap.styles.tsx +29 -0
- package/src/Graph/HeatMap/HeatMap.tsx +12 -0
- package/src/Graph/HeatMap/HeatMapData.json +137 -0
- package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +98 -0
- package/src/Graph/HeatMap/index.ts +1 -0
- package/src/Graph/HeatMap/model.ts +33 -0
- package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Axes/index.tsx +3 -3
- package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Axes/models.ts +1 -1
- package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Axes/useAxisY.ts +1 -1
- package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/RegularLines/index.tsx +22 -14
- package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/RegularLines/useRegularLines.ts +2 -2
- package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/StackedLines/index.tsx +13 -8
- package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/StackedLines/useStackedLines.ts +1 -1
- package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/BasicThreshold.tsx +6 -4
- package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/ThresholdWithPatternLines.tsx +8 -3
- package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/ThresholdWithVariation.tsx +6 -2
- package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/index.tsx +6 -2
- package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/models.ts +1 -1
- package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/useScaleThreshold.ts +5 -5
- package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/index.tsx +17 -8
- package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/models.ts +6 -3
- package/src/Graph/LineChart/BasicComponents/ThresholdLine.tsx +64 -0
- package/src/Graph/LineChart/BasicComponents/Thresholds.tsx +77 -0
- package/src/Graph/{BasicComponents → LineChart/BasicComponents}/useFilterLines.ts +12 -12
- package/src/Graph/{Header → LineChart/Header}/index.tsx +11 -11
- package/src/Graph/{Icons → LineChart/Icons}/Downtime.tsx +1 -1
- package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/RegularAnchorPoint.tsx +7 -7
- package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/StackedAnchorPoint.tsx +2 -2
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/TooltipAnchorPoint.tsx +96 -0
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/index.tsx +20 -0
- package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/models.ts +2 -2
- package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/useTickGraph.ts +2 -2
- package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/TimeShiftZones/TimeShiftZone.tsx +1 -1
- package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Tooltip/useGraphTooltip.ts +1 -1
- package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/index.tsx +2 -2
- package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/interactionWithGraphAtoms.ts +2 -1
- package/src/Graph/{Legend → LineChart/Legend}/InteractiveValue.tsx +3 -3
- package/src/Graph/LineChart/Legend/Legend.styles.ts +117 -0
- package/src/Graph/LineChart/Legend/LegendContent.tsx +33 -0
- package/src/Graph/LineChart/Legend/LegendHeader.tsx +93 -0
- package/src/Graph/{Legend → LineChart/Legend}/index.tsx +73 -38
- package/src/Graph/{Legend → LineChart/Legend}/models.ts +5 -0
- package/src/Graph/{Legend → LineChart/Legend}/useInteractiveValues.ts +28 -15
- package/src/Graph/LineChart/Legend/useLegend.ts +104 -0
- package/src/Graph/{Graph.tsx → LineChart/LineChart.tsx} +136 -36
- package/src/Graph/LineChart/graphAtoms.ts +3 -0
- package/src/Graph/{helpers → LineChart/helpers}/index.ts +9 -4
- package/src/Graph/{index.stories.tsx → LineChart/index.stories.tsx} +145 -39
- package/src/Graph/LineChart/index.tsx +115 -0
- package/src/Graph/{models.ts → LineChart/models.ts} +9 -13
- package/src/Graph/{useGraphData.ts → LineChart/useLineChartData.ts} +5 -3
- package/src/Graph/SingleBar/ResponsiveSingleBar.tsx +197 -0
- package/src/Graph/SingleBar/SingleBar.stories.tsx +204 -0
- package/src/Graph/SingleBar/SingleBar.tsx +25 -0
- package/src/Graph/SingleBar/ThresholdLine.tsx +103 -0
- package/src/Graph/SingleBar/Thresholds.tsx +50 -0
- package/src/Graph/SingleBar/index.ts +1 -0
- package/src/Graph/SingleBar/models.ts +10 -0
- package/src/Graph/Text/Text.stories.tsx +67 -0
- package/src/Graph/Text/Text.styles.ts +17 -0
- package/src/Graph/Text/Text.tsx +91 -0
- package/src/Graph/Text/index.ts +1 -0
- package/src/Graph/common/margins.ts +1 -0
- package/src/Graph/common/models.ts +19 -0
- package/src/Graph/{timeSeries → common/timeSeries}/index.test.ts +146 -28
- package/src/Graph/{timeSeries → common/timeSeries}/index.ts +147 -33
- package/src/Graph/{timeSeries → common/timeSeries}/models.ts +13 -4
- package/src/Graph/common/utils.ts +75 -0
- package/src/Graph/index.ts +5 -0
- package/src/InputField/Search/PersistentTooltip.tsx +5 -6
- package/src/InputField/Select/Autocomplete/Connected/Multi/MultiConnectedAutocompleteField.cypress.spec.tsx +5 -39
- package/src/InputField/Select/Autocomplete/Connected/Multi/index.test.tsx +1 -0
- package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +3 -6
- package/src/InputField/Select/Autocomplete/Connected/index.tsx +31 -6
- package/src/InputField/Select/Autocomplete/Multi/index.tsx +32 -15
- package/src/InputField/Select/Autocomplete/index.tsx +4 -1
- package/src/InputField/Select/index.tsx +1 -0
- package/src/InputField/Text/index.tsx +15 -7
- package/src/Listing/ActionBar/index.tsx +14 -7
- package/src/Listing/Cell/DataCell.tsx +8 -8
- package/src/Listing/Cell/index.tsx +7 -7
- package/src/Listing/Header/Cell/ListingHeaderCell.styles.ts +3 -3
- package/src/Listing/Header/Cell/ListingHeaderCell.tsx +2 -2
- package/src/Listing/Header/ListingHeader.tsx +4 -4
- package/src/Listing/Listing.cypress.spec.tsx +19 -17
- package/src/Listing/Listing.styles.ts +6 -1
- package/src/Listing/Row/Row.tsx +3 -3
- package/src/Listing/index.stories.tsx +7 -6
- package/src/Listing/index.tsx +153 -161
- package/src/Listing/tableAtoms.ts +14 -11
- package/src/Listing/useStyleTable.ts +8 -8
- package/src/ListingPage/index.stories.tsx +21 -8
- package/src/ListingPage/index.tsx +19 -37
- package/src/Module/LicensedModule/LicenseCheck/index.tsx +24 -9
- package/src/Module/LicensedModule/index.tsx +7 -1
- package/src/ParentSize/ParentSize.tsx +24 -0
- package/src/ParentSize/index.ts +1 -0
- package/src/PopoverMenu/index.tsx +18 -4
- package/src/RichTextEditor/ContentEditable.tsx +44 -18
- package/src/RichTextEditor/RichTextEditor.cypress.spec.tsx +204 -29
- package/src/RichTextEditor/RichTextEditor.tsx +74 -7
- package/src/RichTextEditor/index.stories.tsx +9 -0
- package/src/RichTextEditor/plugins/AutoLinkPlugin/index.tsx +53 -5
- package/src/RichTextEditor/plugins/FloatingLinkEditorPlugin.tsx +47 -15
- package/src/RichTextEditor/plugins/ToolbarPlugin/AlignPicker.tsx +116 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/BlockButtons.tsx +155 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/FormatButtons.tsx +31 -92
- package/src/RichTextEditor/plugins/ToolbarPlugin/LinkButton.tsx +106 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/ListButton.tsx +155 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/MacrosButton.tsx +29 -41
- package/src/RichTextEditor/plugins/ToolbarPlugin/ToolbarPlugin.styles.ts +32 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/UndoRedoButtons.tsx +13 -3
- package/src/RichTextEditor/plugins/ToolbarPlugin/index.tsx +25 -18
- package/src/RichTextEditor/translatedLabels.ts +3 -0
- package/src/SortableItems/SortableItem.tsx +2 -1
- package/src/ThemeProvider/index.tsx +6 -4
- package/src/ThemeProvider/palettes.ts +9 -6
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +9 -6
- package/src/TimePeriods/CustomTimePeriod/SimpleCustomTimePeriod.tsx +28 -0
- package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +1 -1
- package/src/TimePeriods/TimePeriods.cypress.spec.tsx +1 -1
- package/src/TimePeriods/index.stories.tsx +15 -0
- package/src/TimePeriods/index.tsx +4 -3
- package/src/TopCounterElements/ResourceSubMenu.tsx +3 -1
- package/src/TopCounterElements/TopCounterLayout.tsx +1 -1
- package/src/Typography/EllipsisTypography.tsx +18 -0
- package/src/Typography/Subtitle.tsx +55 -0
- package/src/Wizard/index.tsx +5 -2
- package/src/Wizard/models.ts +1 -0
- package/src/api/buildListingEndpoint/getSearchQueryParameterValue.ts +35 -26
- package/src/api/buildListingEndpoint/index.test.ts +2 -2
- package/src/api/buildListingEndpoint/index.ts +1 -1
- package/src/api/buildListingEndpoint/models.ts +2 -2
- package/src/api/customFetch.ts +12 -3
- package/src/api/useFetchQuery/index.ts +33 -13
- package/src/api/useGraphQuery/index.ts +166 -0
- package/src/api/useGraphQuery/models.ts +15 -0
- package/src/api/useMutationQuery/index.ts +28 -12
- package/src/components/Avatar/Avatar.stories.tsx +23 -0
- package/src/components/Avatar/Avatar.styles.ts +11 -0
- package/src/components/Avatar/Avatar.tsx +32 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/CollapsibleItem/CollapsibleItem.stories.tsx +25 -0
- package/src/components/CollapsibleItem/CollapsibleItem.tsx +47 -0
- package/src/components/CollapsibleItem/index.ts +1 -0
- package/src/components/CollapsibleItem/useCollapsibleItemStyles.ts +15 -0
- package/src/components/DataTable/DataTable.styles.ts +1 -1
- package/src/components/DataTable/Item/DataTableItem.styles.ts +3 -9
- package/src/components/DataTable/Item/DataTableItem.tsx +31 -10
- package/src/components/Form/AccessRightsV2/AccessRights.cypress.spec.tsx +350 -0
- package/src/components/Form/AccessRightsV2/AccessRights.stories.tsx +119 -0
- package/src/components/Form/AccessRightsV2/AccessRights.styles.ts +10 -0
- package/src/components/Form/AccessRightsV2/AccessRights.tsx +60 -0
- package/src/components/Form/AccessRightsV2/Actions/Actions.styles.ts +14 -0
- package/src/components/Form/AccessRightsV2/Actions/Actions.tsx +81 -0
- package/src/components/Form/AccessRightsV2/Actions/useActions.ts +79 -0
- package/src/components/Form/AccessRightsV2/List/Item.tsx +90 -0
- package/src/components/Form/AccessRightsV2/List/List.styles.tsx +45 -0
- package/src/components/Form/AccessRightsV2/List/List.tsx +52 -0
- package/src/components/Form/AccessRightsV2/List/ListItemSkeleton.tsx +18 -0
- package/src/components/Form/AccessRightsV2/List/ListSkeleton.tsx +22 -0
- package/src/components/Form/AccessRightsV2/List/RemoveAccessRight.tsx +38 -0
- package/src/components/Form/AccessRightsV2/List/StateChip.tsx +28 -0
- package/src/components/Form/AccessRightsV2/List/useItem.ts +64 -0
- package/src/components/Form/AccessRightsV2/Provider.tsx +15 -0
- package/src/components/Form/AccessRightsV2/ShareInput/ContactSwitch.tsx +42 -0
- package/src/components/Form/AccessRightsV2/ShareInput/ShareInput.styles.ts +9 -0
- package/src/components/Form/AccessRightsV2/ShareInput/ShareInput.tsx +77 -0
- package/src/components/Form/AccessRightsV2/ShareInput/useShareInput.tsx +109 -0
- package/src/components/Form/AccessRightsV2/Stats/Stats.tsx +36 -0
- package/src/components/Form/AccessRightsV2/atoms.ts +97 -0
- package/src/components/Form/AccessRightsV2/common/RoleSelectField.styles.tsx +7 -0
- package/src/components/Form/AccessRightsV2/common/RoleSelectField.tsx +45 -0
- package/src/components/Form/AccessRightsV2/models.ts +54 -0
- package/src/components/Form/AccessRightsV2/storiesData.ts +221 -0
- package/src/components/Form/AccessRightsV2/useAccessRightsInitValues.ts +51 -0
- package/src/components/Form/Dashboard/Dashboard.resource.ts +5 -0
- package/src/components/Form/Dashboard/DashboardForm.styles.ts +10 -2
- package/src/components/Form/Dashboard/DashboardForm.tsx +34 -1
- package/src/components/Form/Dashboard/GlobalRefreshFieldOption.tsx +59 -0
- package/src/components/Form/Dashboard/translatedLabels.ts +3 -0
- package/src/components/Form/index.ts +1 -0
- package/src/components/Header/PageHeader/PageHeader.styles.ts +29 -2
- package/src/components/Header/PageHeader/PageHeaderMessage.tsx +32 -0
- package/src/components/Header/PageHeader/index.ts +2 -0
- package/src/components/Inputs/Switch/Switch.stories.tsx +22 -0
- package/src/components/Inputs/Switch/Switch.styles.ts +13 -0
- package/src/components/Inputs/Switch/Switch.tsx +18 -0
- package/src/components/Inputs/index.ts +1 -0
- package/src/components/ItemComposition/Item.tsx +41 -0
- package/src/components/ItemComposition/ItemComposition.stories.tsx +78 -0
- package/src/components/ItemComposition/ItemComposition.styles.ts +29 -0
- package/src/components/ItemComposition/ItemComposition.tsx +47 -0
- package/src/components/ItemComposition/index.ts +6 -0
- package/src/components/Layout/PageLayout/PageLayout.styles.ts +6 -5
- package/src/components/Layout/PageLayout/PageLayoutActions.tsx +13 -4
- package/src/components/List/Item/ListItem.styles.ts +6 -0
- package/src/components/List/Item/ListItem.tsx +3 -1
- package/src/components/List/Item/Text.tsx +5 -3
- package/src/components/Menu/Button/MenuButton.tsx +7 -2
- package/src/components/Menu/Menu.styles.ts +6 -8
- package/src/components/Menu/MenuItem.tsx +5 -3
- package/src/components/Menu/MenuItems.tsx +4 -3
- package/src/components/Modal/Modal.stories.tsx +32 -1
- package/src/components/Modal/Modal.styles.ts +34 -3
- package/src/components/Modal/Modal.tsx +23 -3
- package/src/components/Modal/ModalHeader.tsx +1 -1
- package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.stories.tsx +62 -0
- package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.styles.tsx +22 -0
- package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.tsx +68 -0
- package/src/components/Tooltip/ConfirmationTooltip/TooltipContent.tsx +31 -0
- package/src/components/Tooltip/ConfirmationTooltip/index.ts +1 -0
- package/src/components/Tooltip/ConfirmationTooltip/models.ts +18 -0
- package/src/components/Tooltip/Tooltip.tsx +19 -8
- package/src/components/Tooltip/index.ts +1 -0
- package/src/components/index.ts +4 -0
- package/src/index.ts +26 -2
- package/src/utils/centreonBaseURL.ts +4 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/translatedLabel.ts +2 -0
- package/src/utils/useDebounce.ts +7 -2
- package/src/utils/useInfiniteScrollListing.ts +22 -7
- package/src/utils/useLicenseExpirationWarning.cypress.spec.tsx +137 -0
- package/src/utils/useLicenseExpirationWarning.ts +52 -0
- package/src/utils/useLocaleDateTimeFormat/index.ts +3 -0
- package/src/utils/useRefreshInterval.ts +39 -0
- package/src/Graph/InteractiveComponents/AnchorPoint/AnchorPoint.styles.ts +0 -58
- package/src/Graph/InteractiveComponents/AnchorPoint/TooltipAnchorPoint.tsx +0 -70
- package/src/Graph/InteractiveComponents/AnchorPoint/index.tsx +0 -20
- package/src/Graph/Legend/Legend.styles.ts +0 -71
- package/src/Graph/Legend/LegendContent.tsx +0 -27
- package/src/Graph/Legend/LegendHeader.tsx +0 -45
- package/src/Graph/Legend/Marker.tsx +0 -43
- package/src/Graph/Legend/useLegend.ts +0 -114
- package/src/Graph/graphAtoms.ts +0 -6
- package/src/Graph/index.tsx +0 -90
- package/src/components/Tooltip/Tooltip.styles.ts +0 -5
- /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Axes/UnitLabel.tsx +0 -0
- /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Grids/index.tsx +0 -0
- /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/Circle.tsx +0 -0
- /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/helpers/index.ts +0 -0
- /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/Lines/Threshold/useCoordinateCircle.ts +0 -0
- /package/src/Graph/{BasicComponents → LineChart/BasicComponents}/LoadingProgress.tsx +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/GuidingLines.tsx +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/AnchorPoint/useTooltipAnchorPoint.ts +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Annotation/Area.tsx +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Annotation/Line.tsx +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Annotation/index.tsx +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Area/Downtime.tsx +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/EventAnnotations.tsx +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Line/Acknowledgement.tsx +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/Line/Comments.tsx +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/annotationsAtoms.ts +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/index.tsx +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/models.ts +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Annotations/useAnnotation.ts +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Bar.tsx +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/TimeShiftZones/TimeShiftIcon.tsx +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/TimeShiftZones/index.tsx +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/TimeShiftZones/models.ts +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/TimeShiftZones/useTimeShiftZones.ts +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Tooltip/index.tsx +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/Tooltip/models.ts +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/ZoomPreview/index.tsx +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/ZoomPreview/models.ts +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/ZoomPreview/useZoomPreview.ts +0 -0
- /package/src/Graph/{InteractiveComponents → LineChart/InteractiveComponents}/ZoomPreview/zoomPreviewAtoms.ts +0 -0
- /package/src/Graph/{Graph.styles.ts → LineChart/LineChart.styles.ts} +0 -0
- /package/src/Graph/{LoadingSkeleton.tsx → LineChart/LoadingSkeleton.tsx} +0 -0
- /package/src/Graph/{common → LineChart/common}/index.ts +0 -0
- /package/src/Graph/{helpers → LineChart/helpers}/doc.ts +0 -0
- /package/src/Graph/{mockedData → LineChart/mockedData}/annotationData.json +0 -0
- /package/src/Graph/{mockedData → LineChart/mockedData}/exclusionPeriodFirstPeriod.json +0 -0
- /package/src/Graph/{mockedData → LineChart/mockedData}/exclusionPeriodSecondPeriod.json +0 -0
- /package/src/Graph/{mockedData → LineChart/mockedData}/exclusionPeriodThirdPeriod.json +0 -0
- /package/src/Graph/{mockedData → LineChart/mockedData}/lastDay.json +0 -0
- /package/src/Graph/{mockedData → LineChart/mockedData}/lastDayAreaStack.json +0 -0
- /package/src/Graph/{mockedData → LineChart/mockedData}/lastDayForward.json +0 -0
- /package/src/Graph/{mockedData → LineChart/mockedData}/lastDayThreshold.json +0 -0
- /package/src/Graph/{mockedData → LineChart/mockedData}/lastMonth.json +0 -0
- /package/src/Graph/{mockedData → LineChart/mockedData}/lastWeek.json +0 -0
- /package/src/Graph/{mockedData → LineChart/mockedData}/zoomPreview.json +0 -0
- /package/src/Graph/{translatedLabels.ts → LineChart/translatedLabels.ts} +0 -0
- /package/src/Graph/{useGraphIntersection.ts → LineChart/useLineChartIntersection.ts} +0 -0
- /package/src/{components/Header/Header.styles.ts → utils/useThresholds.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@centreon/ui",
|
|
3
|
-
"version": "23.10.1-
|
|
3
|
+
"version": "23.10.1-hotfix-23-10-next.0",
|
|
4
4
|
"description": "Centreon UI Components",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
|
|
@@ -102,10 +102,14 @@
|
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
104
|
"@lexical/link": "0.11.3",
|
|
105
|
+
"@lexical/list": "^0.11.3",
|
|
105
106
|
"@lexical/react": "0.11.3",
|
|
107
|
+
"@lexical/rich-text": "^0.11.3",
|
|
106
108
|
"@lexical/selection": "0.11.3",
|
|
107
109
|
"@lexical/utils": "0.11.3",
|
|
110
|
+
"@react-spring/web": "^9.7.3",
|
|
108
111
|
"@visx/curve": "^2.1.0",
|
|
112
|
+
"@visx/group": "^3.3.0",
|
|
109
113
|
"@visx/pattern": "^3.0.0",
|
|
110
114
|
"@visx/scale": "^3.0.0",
|
|
111
115
|
"@visx/shape": "^2.12.2",
|
|
@@ -115,6 +119,8 @@
|
|
|
115
119
|
"d3-array": "3.2.0",
|
|
116
120
|
"humanize-duration": "^3.27.3",
|
|
117
121
|
"lexical": "0.11.3",
|
|
122
|
+
"msw": "0.49.1",
|
|
123
|
+
"msw-storybook-addon": "^1.10.0",
|
|
118
124
|
"notistack": "^2.0.8",
|
|
119
125
|
"react-grid-layout": "^1.3.4",
|
|
120
126
|
"react-html-parser": "^2.0.2",
|
|
@@ -148,5 +154,8 @@
|
|
|
148
154
|
"jest-junit": {
|
|
149
155
|
"suiteName": "jest tests",
|
|
150
156
|
"output": "./junit.xml"
|
|
157
|
+
},
|
|
158
|
+
"msw": {
|
|
159
|
+
"workerDirectory": "public"
|
|
151
160
|
}
|
|
152
161
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Mock Service Worker (
|
|
5
|
+
* Mock Service Worker (0.49.1).
|
|
6
6
|
* @see https://github.com/mswjs/msw
|
|
7
7
|
* - Please do NOT modify this file.
|
|
8
8
|
* - Please do NOT serve this file on production.
|
|
@@ -300,4 +300,4 @@ function sleep(timeMs) {
|
|
|
300
300
|
async function respondWithMock(response) {
|
|
301
301
|
await sleep(response.delay)
|
|
302
302
|
return new Response(response.body, response)
|
|
303
|
-
}
|
|
303
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { makeStyles } from 'tss-react/mui';
|
|
2
|
+
import { equals } from 'ramda';
|
|
3
|
+
|
|
4
|
+
import { Theme, alpha } from '@mui/material';
|
|
5
|
+
|
|
6
|
+
interface GetBackgroundAndColorProps {
|
|
7
|
+
status: string;
|
|
8
|
+
theme: Theme;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const getColor = ({ theme, status }: GetBackgroundAndColorProps): string =>
|
|
12
|
+
equals(theme.palette.mode, 'dark')
|
|
13
|
+
? theme.palette.common.white
|
|
14
|
+
: theme.palette[status].main;
|
|
15
|
+
|
|
16
|
+
export const useStyles = makeStyles()((theme) => ({
|
|
17
|
+
item: {
|
|
18
|
+
'& .MuiListItemText-secondary': {
|
|
19
|
+
textWrap: 'pretty'
|
|
20
|
+
},
|
|
21
|
+
'&[data-variant="error"]': {
|
|
22
|
+
'& .MuiListItemIcon-root': {
|
|
23
|
+
color: getColor({ status: 'error', theme })
|
|
24
|
+
},
|
|
25
|
+
'&:hover': {
|
|
26
|
+
background: alpha(
|
|
27
|
+
theme.palette.error.main,
|
|
28
|
+
theme.palette.action.focusOpacity
|
|
29
|
+
),
|
|
30
|
+
color: getColor({ status: 'error', theme })
|
|
31
|
+
},
|
|
32
|
+
color: theme.palette.error.main
|
|
33
|
+
},
|
|
34
|
+
'&[data-variant="info"]': {
|
|
35
|
+
'& .MuiListItemIcon-root': {
|
|
36
|
+
color: getColor({ status: 'info', theme })
|
|
37
|
+
},
|
|
38
|
+
'&:hover': {
|
|
39
|
+
background: alpha(
|
|
40
|
+
theme.palette.info.main,
|
|
41
|
+
theme.palette.action.focusOpacity
|
|
42
|
+
),
|
|
43
|
+
color: getColor({ status: 'info', theme })
|
|
44
|
+
},
|
|
45
|
+
color: theme.palette.info.main
|
|
46
|
+
},
|
|
47
|
+
'&[data-variant="pending"]': {
|
|
48
|
+
'& .MuiListItemIcon-root': {
|
|
49
|
+
color: getColor({ status: 'pending', theme })
|
|
50
|
+
},
|
|
51
|
+
'&:hover': {
|
|
52
|
+
background: alpha(
|
|
53
|
+
theme.palette.pending.main,
|
|
54
|
+
theme.palette.action.focusOpacity
|
|
55
|
+
),
|
|
56
|
+
color: getColor({ status: 'pending', theme })
|
|
57
|
+
},
|
|
58
|
+
color: theme.palette.pending.main
|
|
59
|
+
},
|
|
60
|
+
'&[data-variant="primary"]': {
|
|
61
|
+
'& .MuiListItemIcon-root': {
|
|
62
|
+
color: getColor({ status: 'primary', theme })
|
|
63
|
+
},
|
|
64
|
+
'&:hover': {
|
|
65
|
+
background: alpha(
|
|
66
|
+
theme.palette.primary.main,
|
|
67
|
+
theme.palette.action.focusOpacity
|
|
68
|
+
),
|
|
69
|
+
color: getColor({ status: 'primary', theme })
|
|
70
|
+
},
|
|
71
|
+
color: theme.palette.primary.main
|
|
72
|
+
},
|
|
73
|
+
'&[data-variant="secondary"]': {
|
|
74
|
+
'& .MuiListItemIcon-root': {
|
|
75
|
+
color: getColor({ status: 'secondary', theme })
|
|
76
|
+
},
|
|
77
|
+
'&:hover': {
|
|
78
|
+
background: alpha(
|
|
79
|
+
theme.palette.secondary.main,
|
|
80
|
+
theme.palette.action.focusOpacity
|
|
81
|
+
),
|
|
82
|
+
color: getColor({ status: 'secondary', theme })
|
|
83
|
+
},
|
|
84
|
+
color: theme.palette.secondary.main
|
|
85
|
+
},
|
|
86
|
+
'&[data-variant="success"]': {
|
|
87
|
+
'& .MuiListItemIcon-root': {
|
|
88
|
+
color: getColor({ status: 'success', theme })
|
|
89
|
+
},
|
|
90
|
+
'&:hover': {
|
|
91
|
+
background: alpha(
|
|
92
|
+
theme.palette.success.main,
|
|
93
|
+
theme.palette.action.focusOpacity
|
|
94
|
+
),
|
|
95
|
+
color: getColor({ status: 'success', theme })
|
|
96
|
+
},
|
|
97
|
+
color: theme.palette.success.main
|
|
98
|
+
},
|
|
99
|
+
'&[data-variant="warning"]': {
|
|
100
|
+
'& .MuiListItemIcon-root': {
|
|
101
|
+
color: getColor({ status: 'warning', theme })
|
|
102
|
+
},
|
|
103
|
+
'&:hover': {
|
|
104
|
+
background: alpha(
|
|
105
|
+
theme.palette.warning.main,
|
|
106
|
+
theme.palette.action.focusOpacity
|
|
107
|
+
),
|
|
108
|
+
color: getColor({ status: 'warning', theme })
|
|
109
|
+
},
|
|
110
|
+
color: theme.palette.warning.main
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
list: {
|
|
114
|
+
width: '100%'
|
|
115
|
+
}
|
|
116
|
+
}));
|
|
@@ -24,6 +24,68 @@ const actions = [
|
|
|
24
24
|
}
|
|
25
25
|
];
|
|
26
26
|
|
|
27
|
+
const actionsWithVariants = [
|
|
28
|
+
{
|
|
29
|
+
label: 'No variant',
|
|
30
|
+
onClick: (): void => undefined
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: 'Primary',
|
|
34
|
+
onClick: (): void => undefined,
|
|
35
|
+
variant: 'primary'
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: 'Secondary',
|
|
39
|
+
onClick: (): void => undefined,
|
|
40
|
+
variant: 'secondary'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: 'Success',
|
|
44
|
+
onClick: (): void => undefined,
|
|
45
|
+
variant: 'success'
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: 'Warning',
|
|
49
|
+
onClick: (): void => undefined,
|
|
50
|
+
variant: 'warning'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: 'Error',
|
|
54
|
+
onClick: (): void => undefined,
|
|
55
|
+
variant: 'error'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
label: 'Info',
|
|
59
|
+
onClick: (): void => undefined,
|
|
60
|
+
variant: 'info'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: 'Pending',
|
|
64
|
+
onClick: (): void => undefined,
|
|
65
|
+
variant: 'pending'
|
|
66
|
+
}
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
const actionsWithSecondaryLabel = [
|
|
70
|
+
{
|
|
71
|
+
Icon: EditIcon,
|
|
72
|
+
label: 'Edit',
|
|
73
|
+
onClick: (): void => undefined
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
Icon: CopyIcon,
|
|
77
|
+
label: 'Duplicate',
|
|
78
|
+
onClick: (): void => undefined,
|
|
79
|
+
secondaryLabel:
|
|
80
|
+
'This is a secondary label that the purpose is to give a small description about an action'
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
Icon: DeleteIcon,
|
|
84
|
+
label: 'Delete',
|
|
85
|
+
onClick: (): void => undefined
|
|
86
|
+
}
|
|
87
|
+
];
|
|
88
|
+
|
|
27
89
|
export default {
|
|
28
90
|
argTypes: {},
|
|
29
91
|
component: ActionsList,
|
|
@@ -39,3 +101,15 @@ export const Playground = Template.bind({});
|
|
|
39
101
|
Playground.args = {
|
|
40
102
|
actions
|
|
41
103
|
};
|
|
104
|
+
|
|
105
|
+
export const Variants = Template.bind({});
|
|
106
|
+
|
|
107
|
+
Variants.args = {
|
|
108
|
+
actions: actionsWithVariants
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const SecondaryLabel = Template.bind({});
|
|
112
|
+
|
|
113
|
+
SecondaryLabel.args = {
|
|
114
|
+
actions: actionsWithSecondaryLabel
|
|
115
|
+
};
|
|
@@ -1,35 +1,43 @@
|
|
|
1
1
|
/* eslint-disable react/no-array-index-key */
|
|
2
|
-
import { makeStyles } from 'tss-react/mui';
|
|
3
2
|
import { useTranslation } from 'react-i18next';
|
|
4
3
|
import { equals } from 'ramda';
|
|
5
4
|
|
|
6
5
|
import {
|
|
7
|
-
SvgIconProps,
|
|
8
6
|
MenuList,
|
|
9
7
|
MenuItem,
|
|
10
8
|
ListItemText,
|
|
11
9
|
ListItemIcon,
|
|
12
|
-
Divider
|
|
10
|
+
Divider,
|
|
11
|
+
SvgIconTypeMap
|
|
13
12
|
} from '@mui/material';
|
|
13
|
+
import { OverridableComponent } from '@mui/material/OverridableComponent';
|
|
14
|
+
|
|
15
|
+
import { sanitizedHTML } from '..';
|
|
16
|
+
|
|
17
|
+
import { useStyles } from './ActionsList.styles';
|
|
18
|
+
import { ActionVariants } from './models';
|
|
14
19
|
|
|
15
20
|
interface ActionsType {
|
|
16
|
-
Icon?:
|
|
21
|
+
Icon?: OverridableComponent<SvgIconTypeMap<object, 'svg'>> & {
|
|
22
|
+
muiName: string;
|
|
23
|
+
};
|
|
17
24
|
label: string;
|
|
18
25
|
onClick?: (e?) => void;
|
|
26
|
+
secondaryLabel?: string;
|
|
27
|
+
variant?: ActionVariants;
|
|
19
28
|
}
|
|
20
29
|
|
|
30
|
+
export enum ActionsListActionDivider {
|
|
31
|
+
divider = 'divider'
|
|
32
|
+
}
|
|
33
|
+
export type ActionsListActions = Array<ActionsType | ActionsListActionDivider>;
|
|
34
|
+
|
|
21
35
|
interface Props {
|
|
22
|
-
actions:
|
|
36
|
+
actions: ActionsListActions;
|
|
23
37
|
className?: string;
|
|
24
38
|
listItemClassName?: string;
|
|
25
39
|
}
|
|
26
40
|
|
|
27
|
-
const useStyles = makeStyles()({
|
|
28
|
-
list: {
|
|
29
|
-
maxWidth: '100%'
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
41
|
const ActionsList = ({
|
|
34
42
|
className,
|
|
35
43
|
listItemClassName,
|
|
@@ -41,22 +49,35 @@ const ActionsList = ({
|
|
|
41
49
|
return (
|
|
42
50
|
<MenuList className={cx(classes.list, className)}>
|
|
43
51
|
{actions?.map((action, idx) => {
|
|
44
|
-
if (equals(action,
|
|
52
|
+
if (equals(action, ActionsListActionDivider.divider)) {
|
|
45
53
|
return <Divider key={`divider_${idx}`} />;
|
|
46
54
|
}
|
|
47
55
|
|
|
48
|
-
const { label, Icon, onClick } =
|
|
56
|
+
const { label, Icon, onClick, variant, secondaryLabel } =
|
|
57
|
+
action as ActionsType;
|
|
49
58
|
|
|
50
59
|
return (
|
|
51
|
-
<MenuItem
|
|
60
|
+
<MenuItem
|
|
61
|
+
aria-label={label}
|
|
62
|
+
className={classes.item}
|
|
63
|
+
data-variant={variant}
|
|
64
|
+
id={label}
|
|
65
|
+
key={label}
|
|
66
|
+
onClick={onClick}
|
|
67
|
+
>
|
|
52
68
|
{Icon && (
|
|
53
69
|
<ListItemIcon>
|
|
54
70
|
<Icon fontSize="small" />
|
|
55
71
|
</ListItemIcon>
|
|
56
72
|
)}
|
|
57
|
-
<ListItemText
|
|
58
|
-
{
|
|
59
|
-
|
|
73
|
+
<ListItemText
|
|
74
|
+
className={listItemClassName}
|
|
75
|
+
primary={t(label)}
|
|
76
|
+
secondary={
|
|
77
|
+
secondaryLabel &&
|
|
78
|
+
sanitizedHTML({ initialContent: t(secondaryLabel) })
|
|
79
|
+
}
|
|
80
|
+
/>
|
|
60
81
|
</MenuItem>
|
|
61
82
|
);
|
|
62
83
|
})}
|
|
@@ -11,6 +11,9 @@ import { getNormalizedId } from '../../utils';
|
|
|
11
11
|
const useStyles = makeStyles()((theme) => ({
|
|
12
12
|
button: {
|
|
13
13
|
padding: theme.spacing(0.25)
|
|
14
|
+
},
|
|
15
|
+
tooltip: {
|
|
16
|
+
background: theme.palette.background.tooltip
|
|
14
17
|
}
|
|
15
18
|
}));
|
|
16
19
|
|
|
@@ -19,6 +22,7 @@ type Props = {
|
|
|
19
22
|
className?: string;
|
|
20
23
|
onClick: (event) => void;
|
|
21
24
|
title?: string;
|
|
25
|
+
tooltipClassName?: string;
|
|
22
26
|
tooltipPlacement?:
|
|
23
27
|
| 'bottom'
|
|
24
28
|
| 'left'
|
|
@@ -39,12 +43,17 @@ const IconButton = ({
|
|
|
39
43
|
ariaLabel,
|
|
40
44
|
className,
|
|
41
45
|
tooltipPlacement,
|
|
46
|
+
tooltipClassName,
|
|
42
47
|
...props
|
|
43
48
|
}: Props): JSX.Element => {
|
|
44
49
|
const { classes, cx } = useStyles();
|
|
45
50
|
|
|
46
51
|
return (
|
|
47
|
-
<Tooltip
|
|
52
|
+
<Tooltip
|
|
53
|
+
classes={{ tooltip: cx(classes.tooltip, tooltipClassName) }}
|
|
54
|
+
placement={tooltipPlacement}
|
|
55
|
+
title={title}
|
|
56
|
+
>
|
|
48
57
|
<span aria-label={undefined}>
|
|
49
58
|
<MuiIconButton
|
|
50
59
|
aria-label={ariaLabel}
|
|
@@ -2,17 +2,12 @@ import { makeStyles } from 'tss-react/mui';
|
|
|
2
2
|
import { T, always, cond, equals } from 'ramda';
|
|
3
3
|
|
|
4
4
|
import { SvgIconComponent } from '@mui/icons-material';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
Checkbox as MuiCheckbox,
|
|
8
|
-
Box,
|
|
9
|
-
Typography
|
|
10
|
-
} from '@mui/material';
|
|
5
|
+
import Typography, { TypographyTypeMap } from '@mui/material/Typography';
|
|
6
|
+
import { FormControlLabel, Checkbox as MuiCheckbox, Box } from '@mui/material';
|
|
11
7
|
|
|
12
8
|
export type LabelPlacement = 'bottom' | 'top' | 'end' | 'start' | undefined;
|
|
13
9
|
|
|
14
10
|
interface StyleProps {
|
|
15
|
-
disabled: boolean;
|
|
16
11
|
hasIcon: boolean;
|
|
17
12
|
labelPlacement: LabelPlacement;
|
|
18
13
|
}
|
|
@@ -26,7 +21,13 @@ const getLabelSpacing = (labelPlacement, theme): string => {
|
|
|
26
21
|
};
|
|
27
22
|
|
|
28
23
|
const useStyles = makeStyles<StyleProps>()(
|
|
29
|
-
(theme, {
|
|
24
|
+
(theme, { hasIcon, labelPlacement }) => ({
|
|
25
|
+
checkbox: {
|
|
26
|
+
'&.Mui-checked': {
|
|
27
|
+
color: theme.palette.primary.main
|
|
28
|
+
},
|
|
29
|
+
color: theme.palette.primary.main
|
|
30
|
+
},
|
|
30
31
|
container: hasIcon
|
|
31
32
|
? {
|
|
32
33
|
alignItems: 'center',
|
|
@@ -40,13 +41,8 @@ const useStyles = makeStyles<StyleProps>()(
|
|
|
40
41
|
fontSize: theme.spacing(10)
|
|
41
42
|
},
|
|
42
43
|
label: {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
: theme.palette.text.secondary,
|
|
46
|
-
fontSize: theme.typography.body1.fontSize,
|
|
47
|
-
fontWeight: equals(labelPlacement, 'top')
|
|
48
|
-
? theme.typography.fontWeightBold
|
|
49
|
-
: theme.typography.fontWeightMedium,
|
|
44
|
+
fontSize: theme.typography.body2.fontSize,
|
|
45
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
50
46
|
padding: getLabelSpacing(labelPlacement, theme)
|
|
51
47
|
}
|
|
52
48
|
})
|
|
@@ -60,6 +56,7 @@ interface Props {
|
|
|
60
56
|
disabled?: boolean;
|
|
61
57
|
label: string;
|
|
62
58
|
labelPlacement?: LabelPlacement;
|
|
59
|
+
labelProps?: TypographyTypeMap['props'];
|
|
63
60
|
onChange?: (e) => void;
|
|
64
61
|
}
|
|
65
62
|
|
|
@@ -71,10 +68,10 @@ const Checkbox = ({
|
|
|
71
68
|
className,
|
|
72
69
|
disabled = false,
|
|
73
70
|
labelPlacement = 'end',
|
|
74
|
-
dataTestId
|
|
71
|
+
dataTestId,
|
|
72
|
+
labelProps
|
|
75
73
|
}: Props): JSX.Element => {
|
|
76
74
|
const { classes, cx } = useStyles({
|
|
77
|
-
disabled,
|
|
78
75
|
hasIcon: !!Icon,
|
|
79
76
|
labelPlacement
|
|
80
77
|
});
|
|
@@ -86,6 +83,7 @@ const Checkbox = ({
|
|
|
86
83
|
control={
|
|
87
84
|
<MuiCheckbox
|
|
88
85
|
checked={checked}
|
|
86
|
+
className={classes.checkbox}
|
|
89
87
|
color="primary"
|
|
90
88
|
disabled={disabled}
|
|
91
89
|
id={label}
|
|
@@ -96,7 +94,11 @@ const Checkbox = ({
|
|
|
96
94
|
}
|
|
97
95
|
data-testid={dataTestId || ''}
|
|
98
96
|
key={label}
|
|
99
|
-
label={
|
|
97
|
+
label={
|
|
98
|
+
<Typography classes={{ root: classes.label }} {...labelProps}>
|
|
99
|
+
{label}
|
|
100
|
+
</Typography>
|
|
101
|
+
}
|
|
100
102
|
labelPlacement={labelPlacement}
|
|
101
103
|
sx={{ margin: 0, padding: 0 }}
|
|
102
104
|
/>
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { equals, includes } from 'ramda';
|
|
2
2
|
import { makeStyles } from 'tss-react/mui';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import FormGroup, { FormGroupProps } from '@mui/material/FormGroup';
|
|
5
|
+
import { TypographyTypeMap } from '@mui/material/Typography';
|
|
5
6
|
|
|
6
7
|
import Checkbox, { LabelPlacement } from '../Checkbox';
|
|
7
8
|
|
|
8
9
|
interface Props {
|
|
10
|
+
className?: string;
|
|
9
11
|
dataTestId?: string;
|
|
10
12
|
direction?: 'horizontal' | 'vertical';
|
|
11
13
|
disabled?: boolean;
|
|
14
|
+
formGroupProps?: FormGroupProps;
|
|
12
15
|
labelPlacement?: LabelPlacement;
|
|
16
|
+
labelProps?: TypographyTypeMap['props'];
|
|
13
17
|
onChange?: (e) => void;
|
|
14
18
|
options: Array<string>;
|
|
15
19
|
values: Array<string>;
|
|
@@ -34,27 +38,32 @@ const CheckboxGroup = ({
|
|
|
34
38
|
onChange,
|
|
35
39
|
labelPlacement = 'end',
|
|
36
40
|
disabled = false,
|
|
37
|
-
dataTestId
|
|
41
|
+
dataTestId,
|
|
42
|
+
className,
|
|
43
|
+
labelProps,
|
|
44
|
+
formGroupProps
|
|
38
45
|
}: Props): JSX.Element => {
|
|
39
|
-
const { classes } = useStyles();
|
|
46
|
+
const { classes, cx } = useStyles();
|
|
40
47
|
|
|
41
48
|
const row = !equals(direction, 'vertical');
|
|
42
49
|
|
|
43
50
|
return (
|
|
44
51
|
<FormGroup
|
|
45
|
-
|
|
52
|
+
classes={{ root: classes.container }}
|
|
46
53
|
data-testid={dataTestId || ''}
|
|
47
54
|
row={row}
|
|
55
|
+
{...formGroupProps}
|
|
48
56
|
>
|
|
49
57
|
{options.map((value) => {
|
|
50
58
|
return (
|
|
51
59
|
<Checkbox
|
|
52
60
|
checked={includes(value, values)}
|
|
53
|
-
className={classes.checkbox}
|
|
61
|
+
className={cx(classes.checkbox, className)}
|
|
54
62
|
disabled={disabled}
|
|
55
63
|
key={value}
|
|
56
64
|
label={value}
|
|
57
65
|
labelPlacement={labelPlacement}
|
|
66
|
+
labelProps={labelProps}
|
|
58
67
|
onChange={onChange}
|
|
59
68
|
/>
|
|
60
69
|
);
|
|
@@ -69,7 +69,14 @@ export const useDashboardLayoutStyles = makeStyles<boolean>()(
|
|
|
69
69
|
export const useDashboardItemStyles = makeStyles<{ hasHeader: boolean }>()(
|
|
70
70
|
(theme, { hasHeader }) => ({
|
|
71
71
|
widgetContainer: {
|
|
72
|
+
'&[data-padding="false"]': {
|
|
73
|
+
padding: 0
|
|
74
|
+
},
|
|
75
|
+
background: theme.palette.background.widget,
|
|
76
|
+
border: 'none',
|
|
77
|
+
borderRadius: theme.spacing(1),
|
|
72
78
|
height: '100%',
|
|
79
|
+
paddingBottom: theme.spacing(2),
|
|
73
80
|
width: '100%'
|
|
74
81
|
},
|
|
75
82
|
widgetContent: {
|
|
@@ -79,12 +86,23 @@ export const useDashboardItemStyles = makeStyles<{ hasHeader: boolean }>()(
|
|
|
79
86
|
'&:hover': {
|
|
80
87
|
backgroundColor: theme.palette.action.hover
|
|
81
88
|
},
|
|
82
|
-
|
|
83
|
-
|
|
89
|
+
'&[data-canMove="false"]': {
|
|
90
|
+
cursor: 'default'
|
|
91
|
+
},
|
|
92
|
+
'&[data-canMove="true"]': {
|
|
93
|
+
cursor: 'move'
|
|
94
|
+
},
|
|
95
|
+
padding: theme.spacing(0.5, 2),
|
|
96
|
+
position: 'relative'
|
|
97
|
+
},
|
|
98
|
+
widgetHeaderDraggable: {
|
|
99
|
+
height: '100%',
|
|
100
|
+
position: 'absolute',
|
|
101
|
+
width: '100%'
|
|
84
102
|
},
|
|
85
103
|
widgetPadding: {
|
|
86
104
|
overflowX: 'auto',
|
|
87
|
-
padding: hasHeader ? theme.spacing(1, 2,
|
|
105
|
+
padding: hasHeader ? theme.spacing(1, 2, 0) : theme.spacing(1, 2)
|
|
88
106
|
}
|
|
89
107
|
})
|
|
90
108
|
);
|
package/src/Dashboard/Item.tsx
CHANGED
|
@@ -6,15 +6,16 @@ import {
|
|
|
6
6
|
ReactElement
|
|
7
7
|
} from 'react';
|
|
8
8
|
|
|
9
|
-
import { isNil } from 'ramda';
|
|
9
|
+
import { isNil, prop } from 'ramda';
|
|
10
10
|
|
|
11
|
-
import { Card } from '@mui/material';
|
|
11
|
+
import { Card, useTheme } from '@mui/material';
|
|
12
12
|
|
|
13
13
|
import { useMemoComponent } from '../utils';
|
|
14
14
|
|
|
15
15
|
import { useDashboardItemStyles } from './Dashboard.styles';
|
|
16
16
|
|
|
17
17
|
interface DashboardItemProps {
|
|
18
|
+
canMove?: boolean;
|
|
18
19
|
children: ReactElement;
|
|
19
20
|
className?: string;
|
|
20
21
|
disablePadding?: boolean;
|
|
@@ -37,13 +38,15 @@ const Item = forwardRef(
|
|
|
37
38
|
onMouseUp,
|
|
38
39
|
onTouchEnd,
|
|
39
40
|
id,
|
|
40
|
-
disablePadding = false
|
|
41
|
+
disablePadding = false,
|
|
42
|
+
canMove = false
|
|
41
43
|
}: DashboardItemProps,
|
|
42
44
|
ref: ForwardedRef<HTMLDivElement>
|
|
43
45
|
): ReactElement => {
|
|
44
46
|
const hasHeader = !isNil(header);
|
|
45
47
|
|
|
46
48
|
const { classes, cx } = useDashboardItemStyles({ hasHeader });
|
|
49
|
+
const theme = useTheme();
|
|
47
50
|
|
|
48
51
|
const listeners = {
|
|
49
52
|
onMouseDown,
|
|
@@ -56,18 +59,25 @@ const Item = forwardRef(
|
|
|
56
59
|
return useMemoComponent({
|
|
57
60
|
Component: (
|
|
58
61
|
<div
|
|
62
|
+
{...cardContainerListeners}
|
|
59
63
|
className={className}
|
|
60
64
|
ref={ref}
|
|
61
|
-
style={
|
|
62
|
-
|
|
65
|
+
style={{
|
|
66
|
+
...style,
|
|
67
|
+
width: `calc(${prop('width', style) || '0px'} - 12px)`
|
|
68
|
+
}}
|
|
63
69
|
>
|
|
64
|
-
<Card
|
|
70
|
+
<Card
|
|
71
|
+
className={classes.widgetContainer}
|
|
72
|
+
data-padding={!disablePadding}
|
|
73
|
+
>
|
|
65
74
|
{header && (
|
|
66
|
-
<div
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
<div className={classes.widgetHeader} data-canMove={canMove}>
|
|
76
|
+
<div
|
|
77
|
+
{...listeners}
|
|
78
|
+
className={classes.widgetHeaderDraggable}
|
|
79
|
+
data-testid={`${id}_move_panel`}
|
|
80
|
+
/>
|
|
71
81
|
{header}
|
|
72
82
|
</div>
|
|
73
83
|
)}
|
|
@@ -82,7 +92,7 @@ const Item = forwardRef(
|
|
|
82
92
|
</Card>
|
|
83
93
|
</div>
|
|
84
94
|
),
|
|
85
|
-
memoProps: [style, className, header]
|
|
95
|
+
memoProps: [style, className, header, theme.palette.mode, canMove]
|
|
86
96
|
});
|
|
87
97
|
}
|
|
88
98
|
);
|