@centreon/ui 26.5.9 → 26.5.11
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 +3 -1
- package/src/@types/globals.d.ts +21 -0
- package/src/Colors/index.tsx +1 -1
- package/src/Dashboard/Item.tsx +11 -14
- package/src/Dialog/Duplicate/index.tsx +1 -1
- package/src/FileDropZone/useDropzone.test.ts +18 -15
- package/src/Form/Inputs/Checkbox.tsx +6 -3
- package/src/Form/Inputs/CheckboxGroup.tsx +8 -8
- package/src/Form/Inputs/ConnectedAutocomplete.tsx +9 -3
- package/src/Form/Inputs/FieldsTable/FieldsTable.tsx +1 -1
- package/src/Form/Inputs/File.tsx +3 -1
- package/src/Form/Inputs/Grid.tsx +1 -1
- package/src/Form/Inputs/List/List.tsx +8 -7
- package/src/Form/Inputs/List/useList.ts +12 -6
- package/src/Form/Inputs/Radio.tsx +7 -1
- package/src/Form/Inputs/Text.tsx +1 -1
- package/src/Form/Inputs/index.tsx +7 -2
- package/src/Form/storiesData.tsx +5 -2
- package/src/Graph/BarChart/Bar.tsx +2 -2
- package/src/Graph/BarChart/BarChart.tsx +2 -0
- package/src/Graph/BarChart/BarGroup.tsx +3 -0
- package/src/Graph/BarChart/BarStack.tsx +1 -0
- package/src/Graph/BarChart/MemoizedGroup.tsx +3 -1
- package/src/Graph/BarChart/ResponsiveBarChart.tsx +5 -0
- package/src/Graph/BarChart/Tooltip/BarChartTooltip.tsx +4 -0
- package/src/Graph/BarStack/Graph.tsx +3 -0
- package/src/Graph/Chart/BasicComponents/Lines/RegularLines/index.tsx +4 -1
- package/src/Graph/Chart/BasicComponents/Lines/StackedLines/index.tsx +7 -1
- package/src/Graph/Chart/BasicComponents/Lines/Threshold/BasicThreshold.tsx +1 -0
- package/src/Graph/Chart/BasicComponents/Lines/index.tsx +11 -1
- package/src/Graph/Chart/Chart.tsx +9 -0
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/StackedAnchorPoint.tsx +2 -0
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/useTickGraph.ts +2 -0
- package/src/Graph/Chart/InteractiveComponents/Annotations/annotationsAtoms.ts +5 -0
- package/src/Graph/Chart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx +3 -0
- package/src/Graph/Chart/Legend/LegendHeader.tsx +1 -0
- package/src/Graph/Chart/Legend/index.tsx +6 -1
- package/src/Graph/Chart/useChartData.ts +6 -0
- package/src/Graph/Gauge/AnimatedPie.tsx +3 -0
- package/src/Graph/Gauge/PieData.tsx +5 -0
- package/src/Graph/Gauge/ResponsiveGauge.tsx +2 -0
- package/src/Graph/Gauge/Thresholds.tsx +1 -0
- package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +1 -0
- package/src/Graph/SingleBar/ResponsiveSingleBar.tsx +2 -0
- package/src/Graph/Timeline/ResponsiveTimeline.tsx +1 -0
- package/src/Graph/Tree/Links.tsx +1 -0
- package/src/Graph/Tree/Tree.tsx +1 -0
- package/src/Graph/Tree/stories/datas.ts +2 -0
- package/src/Graph/common/Axes/index.tsx +3 -3
- package/src/Graph/common/BaseChart/BaseChart.tsx +3 -0
- package/src/Graph/common/BaseChart/ChartSvgWrapper.tsx +1 -0
- package/src/Graph/common/BaseChart/Header/models.ts +1 -0
- package/src/Graph/common/timeSeries/index.test.ts +17 -1
- package/src/Graph/common/timeSeries/index.ts +12 -0
- package/src/Graph/common/utils.ts +6 -2
- package/src/InputField/Number/Number.tsx +10 -4
- package/src/InputField/Search/PersistentTooltip.tsx +6 -5
- package/src/InputField/Select/Autocomplete/Connected/Single.tsx +3 -1
- package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Connected/index.tsx +5 -1
- package/src/InputField/Select/Autocomplete/Draggable/SortableList.tsx +4 -5
- package/src/InputField/Select/Autocomplete/Draggable/index.tsx +4 -5
- package/src/InputField/Select/Autocomplete/Multi/Listbox.tsx +16 -1
- package/src/InputField/Select/Autocomplete/Multi/Multi.tsx +44 -30
- package/src/InputField/Select/Autocomplete/Multi/index.tsx +1 -0
- package/src/InputField/Select/Autocomplete/index.tsx +7 -1
- package/src/InputField/Select/IconPopover/index.tsx +0 -3
- package/src/InputField/Select/Option.tsx +6 -1
- package/src/InputField/Select/index.tsx +3 -3
- package/src/InputField/Text/index.tsx +11 -3
- package/src/InputField/Text/useAutoSize.ts +2 -2
- package/src/Listing/ActionBar/index.tsx +2 -3
- package/src/Listing/Cell/index.tsx +24 -22
- package/src/Listing/Header/Cell/ListingHeaderCell.styles.ts +7 -0
- package/src/Listing/Header/ListingHeader.tsx +2 -2
- package/src/Listing/Header/_internals/PredefinedSelectionList.tsx +3 -3
- package/src/Listing/index.tsx +29 -34
- package/src/Listing/useStyleTable.ts +1 -1
- package/src/Module/index.tsx +3 -3
- package/src/MultiSelectEntries/index.tsx +1 -1
- package/src/Pagination/Pagination.tsx +1 -1
- package/src/ParentSize/ParentSize.tsx +2 -1
- package/src/PopoverMenu/index.tsx +1 -7
- package/src/RichTextEditor/ContentEditable.tsx +2 -0
- package/src/RichTextEditor/RichTextEditor.tsx +1 -0
- package/src/RichTextEditor/plugins/FloatingLinkEditorPlugin.tsx +1 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/BlockButtons.tsx +1 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/ListButton.tsx +2 -0
- package/src/Snackbar/index.tsx +3 -1
- package/src/SortableItems/Item.tsx +8 -7
- package/src/SortableItems/index.tsx +1 -1
- package/src/ThemeProvider/index.tsx +5 -3
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +3 -2
- package/src/TimePeriods/SelectedTimePeriod.tsx +1 -1
- package/src/TimePeriods/timePeriodsAtoms.ts +1 -1
- package/src/TimePeriods/useSortTimePeriods.ts +1 -1
- package/src/Typography/Subtitle.tsx +3 -1
- package/src/Typography/story.utils.tsx +3 -2
- package/src/Wizard/ActionsBar.tsx +2 -2
- package/src/api/QueryProvider.tsx +1 -2
- package/src/api/buildListingEndpoint/getSearchQueryParameterValue.ts +4 -2
- package/src/api/useGraphQuery/index.ts +11 -6
- package/src/api/useMutationQuery/index.ts +11 -7
- package/src/api/useMutationQuery/useOptimisticMutation.ts +34 -16
- package/src/api/useRequest/index.test.ts +1 -1
- package/src/api/useRequest/index.ts +1 -1
- package/src/components/Button/Button.tsx +2 -2
- package/src/components/CrudPage/Actions/Filters.tsx +1 -1
- package/src/components/CrudPage/Actions/useSearch.tsx +1 -1
- package/src/components/CrudPage/Columns/Actions.tsx +2 -2
- package/src/components/CrudPage/CrudPageRoot.tsx +1 -1
- package/src/components/CrudPage/DeleteModal.tsx +14 -6
- package/src/components/CrudPage/Form/AddModal.tsx +16 -4
- package/src/components/CrudPage/Form/UpdateModal.tsx +2 -2
- package/src/components/CrudPage/Listing.tsx +2 -1
- package/src/components/CrudPage/hooks/useDeleteItem.ts +5 -1
- package/src/components/CrudPage/hooks/useGetItem.ts +3 -3
- package/src/components/DataTable/DataListing.tsx +1 -1
- package/src/components/ExpandableContainer/ExpandableContainer.tsx +1 -0
- package/src/components/Form/AccessRights/Actions/Actions.tsx +1 -1
- package/src/components/Form/AccessRights/Actions/useActions.ts +1 -4
- package/src/components/Form/AccessRights/List/StateChip.tsx +1 -1
- package/src/components/Form/AccessRights/Stats/Stats.tsx +1 -1
- package/src/components/Form/AccessRights/common/RoleSelectField.tsx +4 -6
- package/src/components/Form/Dashboard/DashboardForm.tsx +2 -2
- package/src/components/Header/PageHeader/PageHeader.styles.ts +26 -20
- package/src/components/Menu/useMenu.tsx +3 -3
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.tsx +14 -9
- package/src/components/Modal/Modal.tsx +5 -3
- package/src/components/Modal/ModalActions.tsx +1 -1
- package/src/components/Modal/ModalBody.tsx +2 -2
- package/src/components/Modal/ModalHeader.tsx +2 -2
- package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.tsx +8 -2
- package/src/index.ts +1 -1
- package/src/utils/sanitizedHTML.ts +1 -1
- package/src/utils/useDebounce.ts +3 -1
- package/src/utils/useLicenseExpirationWarning.ts +11 -6
- package/src/utils/useLocaleDateTimeFormat/index.test.tsx +3 -1
- package/src/utils/useLocaleDateTimeFormat/localeFallback.test.tsx +3 -1
- package/src/utils/useMemoComponent.ts +1 -1
- package/src/utils/usePluralizedTranslation.test.ts +2 -0
- package/src/utils/useViewportIntersection.ts +3 -4
|
@@ -7,7 +7,7 @@ import type { ReactElement, ReactNode } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import '../../../src/ThemeProvider/tailwindcss.css';
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import styles from './modal.module.css';
|
|
11
11
|
|
|
12
12
|
export type ModalHeaderProps = {
|
|
13
13
|
children?: ReactNode;
|
|
@@ -18,7 +18,7 @@ const ModalHeader = ({
|
|
|
18
18
|
...rest
|
|
19
19
|
}: ModalHeaderProps & DialogTitleProps): ReactElement => {
|
|
20
20
|
return (
|
|
21
|
-
<div className={modalHeader}>
|
|
21
|
+
<div className={styles.modalHeader}>
|
|
22
22
|
<MuiDialogTitle
|
|
23
23
|
className="p-0 font-bold text-2xl"
|
|
24
24
|
color="primary"
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/** biome-ignore-all lint/a11y/noStaticElementInteractions: need it */
|
|
2
2
|
import { atom, useAtom } from 'jotai';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
type ReactElement,
|
|
5
|
+
type RefObject,
|
|
6
|
+
useCallback,
|
|
7
|
+
useEffect,
|
|
8
|
+
useRef
|
|
9
|
+
} from 'react';
|
|
4
10
|
|
|
5
11
|
import { useResizeObserver } from '../../../utils/useResizeObserver';
|
|
6
12
|
import { Tooltip, type TooltipProps } from '../Tooltip';
|
|
@@ -81,7 +87,7 @@ const TextOverflowTooltip = ({
|
|
|
81
87
|
|
|
82
88
|
useResizeObserver({
|
|
83
89
|
onResize,
|
|
84
|
-
ref: elRef
|
|
90
|
+
ref: elRef as RefObject<HTMLElement>
|
|
85
91
|
});
|
|
86
92
|
|
|
87
93
|
useEffect(() => {
|
package/src/index.ts
CHANGED
|
@@ -88,7 +88,7 @@ export type { Props as MultiAutocompleteFieldProps } from './InputField/Select/A
|
|
|
88
88
|
export { default as MultiAutocompleteField } from './InputField/Select/Autocomplete/Multi';
|
|
89
89
|
export { default as PopoverMultiAutocompleteField } from './InputField/Select/Autocomplete/Multi/Popover';
|
|
90
90
|
export { default as IconPopoverMultiSelectField } from './InputField/Select/IconPopover';
|
|
91
|
-
export type {
|
|
91
|
+
export type { TextProps as TextFieldProps } from './InputField/Text';
|
|
92
92
|
export { default as TextField } from './InputField/Text';
|
|
93
93
|
export { default as LicenseMessage } from './LicenseMessage';
|
|
94
94
|
export type { Props as ListingProps } from './Listing';
|
|
@@ -12,7 +12,7 @@ const sanitizedHTML = ({
|
|
|
12
12
|
}: UseSanitizedHTMLProps): JSX.Element => {
|
|
13
13
|
const sanitizedContent = sanitizeHtml(initialContent, sanitizeOptions);
|
|
14
14
|
|
|
15
|
-
return ReactHtmlParser(sanitizedContent);
|
|
15
|
+
return ReactHtmlParser(sanitizedContent) as JSX.Element;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export { sanitizedHTML };
|
package/src/utils/useDebounce.ts
CHANGED
|
@@ -12,7 +12,9 @@ export const useDebounce = ({
|
|
|
12
12
|
memoProps = []
|
|
13
13
|
}: Props): ((...args) => void) => {
|
|
14
14
|
const timeoutRef = useRef<number | null>(null);
|
|
15
|
-
const ref = useRef()
|
|
15
|
+
const ref = useRef<((...args: Array<unknown>) => void) | undefined>(
|
|
16
|
+
undefined
|
|
17
|
+
);
|
|
16
18
|
|
|
17
19
|
useEffect(() => {
|
|
18
20
|
ref.current = functionToDebounce;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
|
-
import {
|
|
2
|
+
import { isNil, lt, path } from 'ramda';
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
|
|
@@ -24,11 +24,16 @@ export const useLicenseExpirationWarning = ({ module }: Props): void => {
|
|
|
24
24
|
|
|
25
25
|
const currentDate = dayjs();
|
|
26
26
|
|
|
27
|
-
const getExpirationDate =
|
|
28
|
-
path(['result', 'module', 'entities'])
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
const getExpirationDate = (obj: unknown): string => {
|
|
28
|
+
const entities = path(['result', 'module', 'entities'], obj) as
|
|
29
|
+
| Array<Record<string, unknown>>
|
|
30
|
+
| undefined;
|
|
31
|
+
const entity = entities ? entities.find((e) => e.id === module) : undefined;
|
|
32
|
+
return path(
|
|
33
|
+
['license', 'expiration_date'],
|
|
34
|
+
entity as Record<string, unknown>
|
|
35
|
+
) as string;
|
|
36
|
+
};
|
|
32
37
|
|
|
33
38
|
useEffect(() => {
|
|
34
39
|
if (isNil(data)) {
|
|
@@ -2,7 +2,7 @@ import dayjs from "dayjs";
|
|
|
2
2
|
import { useEffect } from "react";
|
|
3
3
|
import "dayjs/locale/en";
|
|
4
4
|
|
|
5
|
-
import { ThemeMode, userAtom } from "@centreon/ui-context";
|
|
5
|
+
import { ListingVariant, ThemeMode, userAtom } from "@centreon/ui-context";
|
|
6
6
|
import { type RenderResult, render } from "@testing-library/react";
|
|
7
7
|
import localizedFormatPlugin from "dayjs/plugin/localizedFormat";
|
|
8
8
|
import timezonePlugin from "dayjs/plugin/timezone";
|
|
@@ -25,6 +25,7 @@ const TestComponent = (): JSX.Element => {
|
|
|
25
25
|
useEffect(() => {
|
|
26
26
|
setUser({
|
|
27
27
|
alias: "admin",
|
|
28
|
+
canManageApiTokens: false,
|
|
28
29
|
default_page: "/monitoring/resources",
|
|
29
30
|
isExportButtonEnabled: false,
|
|
30
31
|
locale: "en",
|
|
@@ -32,6 +33,7 @@ const TestComponent = (): JSX.Element => {
|
|
|
32
33
|
themeMode: ThemeMode.light,
|
|
33
34
|
timezone: "Europe/Paris",
|
|
34
35
|
use_deprecated_pages: false,
|
|
36
|
+
user_interface_density: ListingVariant.compact,
|
|
35
37
|
});
|
|
36
38
|
}, [setUser]);
|
|
37
39
|
|
|
@@ -2,7 +2,7 @@ import dayjs from "dayjs";
|
|
|
2
2
|
import { useEffect } from "react";
|
|
3
3
|
import "dayjs/locale/en";
|
|
4
4
|
|
|
5
|
-
import { ThemeMode, userAtom } from "@centreon/ui-context";
|
|
5
|
+
import { ListingVariant, ThemeMode, userAtom } from "@centreon/ui-context";
|
|
6
6
|
import { type RenderResult, render } from "@testing-library/react";
|
|
7
7
|
import localizedFormatPlugin from "dayjs/plugin/localizedFormat";
|
|
8
8
|
import timezonePlugin from "dayjs/plugin/timezone";
|
|
@@ -25,6 +25,7 @@ const TestComponent = (): JSX.Element => {
|
|
|
25
25
|
useEffect(() => {
|
|
26
26
|
setUser({
|
|
27
27
|
alias: "admin",
|
|
28
|
+
canManageApiTokens: false,
|
|
28
29
|
default_page: "/monitoring/resources",
|
|
29
30
|
isExportButtonEnabled: false,
|
|
30
31
|
locale: "unsupported_locale",
|
|
@@ -32,6 +33,7 @@ const TestComponent = (): JSX.Element => {
|
|
|
32
33
|
themeMode: ThemeMode.light,
|
|
33
34
|
timezone: "Europe/Paris",
|
|
34
35
|
use_deprecated_pages: false,
|
|
36
|
+
user_interface_density: ListingVariant.compact,
|
|
35
37
|
});
|
|
36
38
|
}, [setUser]);
|
|
37
39
|
|
|
@@ -2,7 +2,7 @@ import { equals } from 'ramda';
|
|
|
2
2
|
import { type DependencyList, type ReactElement, useMemo, useRef } from 'react';
|
|
3
3
|
|
|
4
4
|
export const useDeepCompare = (value: DependencyList): Array<number> => {
|
|
5
|
-
const ref = useRef<React.DependencyList>();
|
|
5
|
+
const ref = useRef<React.DependencyList>(undefined);
|
|
6
6
|
const signalRef = useRef<number>(0);
|
|
7
7
|
|
|
8
8
|
if (!equals(value, ref.current)) {
|
|
@@ -7,7 +7,9 @@ import { usePluralizedTranslation } from './usePluralizedTranslation';
|
|
|
7
7
|
|
|
8
8
|
const baseUser = {
|
|
9
9
|
alias: 'admin',
|
|
10
|
+
canManageApiTokens: false,
|
|
10
11
|
isExportButtonEnabled: false,
|
|
12
|
+
locale: 'en' as string | null,
|
|
11
13
|
name: 'admin',
|
|
12
14
|
timezone: 'Europe/Paris',
|
|
13
15
|
use_deprecated_pages: false,
|
|
@@ -32,10 +32,9 @@ export const useViewportIntersection = (
|
|
|
32
32
|
observer.current.disconnect();
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
observer.current = new window.IntersectionObserver(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
);
|
|
35
|
+
observer.current = new window.IntersectionObserver(([newEntry]) => {
|
|
36
|
+
setEntry(newEntry);
|
|
37
|
+
}, options);
|
|
39
38
|
|
|
40
39
|
if (element) {
|
|
41
40
|
observer.current.observe(element);
|