@centreon/ui 25.1.8 → 25.1.10

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "25.1.8",
3
+ "version": "25.1.10",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -5,13 +5,13 @@ import { Modal } from '../../components/Modal';
5
5
 
6
6
  import {
7
7
  labelDiscard,
8
- labelDoYouWantToQuitWithoutResolving,
9
- labelDoYouWantToResolveErrors,
8
+ labelDoYouWantToQuit,
10
9
  labelDoYouWantToSaveChanges,
11
10
  labelIfYouClickOnDiscard,
12
- labelResolve,
11
+ labelLeave,
13
12
  labelSave,
14
- labelThereAreErrorsInTheForm
13
+ labelStay,
14
+ labelYourFormHasUnsavedChanges
15
15
  } from './translatedLabels';
16
16
 
17
17
  interface Props {
@@ -32,15 +32,17 @@ const UnsavedChangesDialog = ({
32
32
  dialogOpened
33
33
  }: Props): JSX.Element | null => {
34
34
  const { t } = useTranslation();
35
+
35
36
  const labelTitle = isValidForm
36
37
  ? labelDoYouWantToSaveChanges
37
- : labelDoYouWantToResolveErrors;
38
+ : labelDoYouWantToQuit;
38
39
 
39
- const labelConfirm = isValidForm ? labelSave : labelResolve;
40
+ const lebelConfirm = isValidForm ? labelSave : labelLeave;
41
+ const labelCancel = isValidForm ? labelDiscard : labelStay;
40
42
 
41
43
  const labelMessage = isValidForm
42
44
  ? labelIfYouClickOnDiscard
43
- : `${labelThereAreErrorsInTheForm} ${labelDoYouWantToQuitWithoutResolving}`;
45
+ : labelYourFormHasUnsavedChanges;
44
46
 
45
47
  if (not(dialogOpened)) {
46
48
  return null;
@@ -58,11 +60,11 @@ const UnsavedChangesDialog = ({
58
60
  <Modal.Actions
59
61
  disabled={isSubmitting}
60
62
  labels={{
61
- cancel: t(labelDiscard),
62
- confirm: t(labelConfirm)
63
+ cancel: t(labelCancel),
64
+ confirm: t(lebelConfirm)
63
65
  }}
64
- onCancel={discardChanges}
65
- onConfirm={isValidForm ? saveChanges : closeDialog}
66
+ onCancel={isValidForm ? discardChanges : closeDialog}
67
+ onConfirm={isValidForm ? saveChanges : discardChanges}
66
68
  />
67
69
  </Modal>
68
70
  );
@@ -1,22 +1,24 @@
1
1
  export const labelDiscard = 'Discard';
2
- export const labelResolve = 'Resolve';
2
+ export const labelSave = 'Save';
3
+
4
+ export const labelLeave = 'Leave';
5
+ export const labelStay = 'Stay';
6
+
3
7
  export const labelIfYouClickOnDiscard =
4
8
  'If you click on Discard, your changes will not be saved.';
5
- export const labelThereAreErrorsInTheForm = 'There are errors in the form.';
6
- export const labelDoYouWantToQuitWithoutResolving =
7
- 'Do you want to quit the form without resolving the errors?';
9
+ export const labelDoYouWantToQuit = 'Do you want to leave this page?';
10
+
11
+ export const labelYourFormHasUnsavedChanges =
12
+ 'Your changes will not be saved if you leave this page.';
8
13
  export const labelDoYouWantToSaveChanges = 'Do you want to save the changes?';
9
- export const labelDoYouWantToResolveErrors =
10
- 'Do you want to resolve the errors?';
11
- export const labelSave = 'Save';
12
14
 
13
15
  export default {
14
16
  labelDiscard,
15
- labelDoYouWantToQuitWithoutResolving,
16
- labelDoYouWantToResolveErrors,
17
- labelDoYouWantToSaveChanges,
18
- labelIfYouClickOnDiscard,
19
- labelResolve,
20
17
  labelSave,
21
- labelThereAreErrorsInTheForm
18
+ labelLeave,
19
+ labelStay,
20
+ labelIfYouClickOnDiscard,
21
+ labelDoYouWantToQuit,
22
+ labelYourFormHasUnsavedChanges,
23
+ labelDoYouWantToSaveChanges
22
24
  };
@@ -17,7 +17,7 @@ import { ForwardedRef, HTMLAttributes, ReactElement, forwardRef } from 'react';
17
17
  import { SelectEntry } from '..';
18
18
  import { getNormalizedId } from '../../../utils';
19
19
  import TextField from '../../Text';
20
- import { searchLabel } from '../../translatedLabels';
20
+ import { labelClear, labelOpen, searchLabel } from '../../translatedLabels';
21
21
  import Option from '../Option';
22
22
  import { useAutoCompleteStyles } from './autoComplete.styles';
23
23
 
@@ -217,7 +217,15 @@ const AutocompleteField = forwardRef(
217
217
  );
218
218
  }}
219
219
  size="small"
220
- slotProps={autocompleteSlotsAndSlotProps?.slotProps}
220
+ slotProps={{
221
+ ...autocompleteSlotsAndSlotProps?.slotProps,
222
+ clearIndicator: {
223
+ title: t(labelClear)
224
+ },
225
+ popupIndicator: {
226
+ title: t(labelOpen)
227
+ }
228
+ }}
221
229
  {...autocompleteProps}
222
230
  />
223
231
  );
@@ -1 +1,3 @@
1
1
  export const searchLabel = 'Search';
2
+ export const labelOpen = 'Open';
3
+ export const labelClear = 'Clear';