@gridsuite/commons-ui 0.63.4 → 0.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/_mocks_/svg.js +1 -3
  2. package/dist/assets/expert-filter-form.css +18 -8
  3. package/dist/components/AuthenticationRouter/AuthenticationRouter.js +88 -97
  4. package/dist/components/CardErrorBoundary/card-error-boundary.js +6 -20
  5. package/dist/components/CustomAGGrid/custom-aggrid.js +47 -49
  6. package/dist/components/DirectoryItemSelector/directory-item-selector.js +10 -40
  7. package/dist/components/ElementSearchDialog/element-search-dialog.js +1 -17
  8. package/dist/components/ElementSearchDialog/equipment-item.js +29 -47
  9. package/dist/components/ElementSearchDialog/tag-renderer.js +2 -8
  10. package/dist/components/ElementSearchDialog/use-element-search.js +1 -4
  11. package/dist/components/FlatParameters/FlatParameters.js +13 -77
  12. package/dist/components/Login/Login.js +9 -34
  13. package/dist/components/Login/Logout.js +3 -26
  14. package/dist/components/MuiVirtualizedTable/ColumnHeader.js +35 -64
  15. package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +4 -17
  16. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.d.ts +1 -1
  17. package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.js +19 -95
  18. package/dist/components/MuiVirtualizedTable/index.d.ts +1 -1
  19. package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.js +2 -6
  20. package/dist/components/OverflowableText/overflowable-text.js +3 -10
  21. package/dist/components/ReportViewer/filter-button.d.ts +1 -1
  22. package/dist/components/ReportViewer/filter-button.js +2 -7
  23. package/dist/components/ReportViewer/log-report-item.js +7 -17
  24. package/dist/components/ReportViewer/log-report.js +4 -13
  25. package/dist/components/ReportViewer/log-table.d.ts +1 -1
  26. package/dist/components/ReportViewer/log-table.js +3 -16
  27. package/dist/components/ReportViewer/multi-select-list.d.ts +1 -1
  28. package/dist/components/ReportViewer/multi-select-list.js +2 -14
  29. package/dist/components/ReportViewer/report-item.js +4 -10
  30. package/dist/components/ReportViewer/report-viewer.d.ts +1 -1
  31. package/dist/components/ReportViewer/report-viewer.js +2 -7
  32. package/dist/components/ReportViewerDialog/report-viewer-dialog.js +1 -13
  33. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.d.ts +1 -1
  34. package/dist/components/SignInCallbackHandler/SignInCallbackHandler.js +1 -4
  35. package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.d.ts +1 -1
  36. package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +1 -4
  37. package/dist/components/SnackbarProvider/SnackbarProvider.js +4 -11
  38. package/dist/components/TopBar/AboutDialog.js +51 -152
  39. package/dist/components/TopBar/GridLogo.d.ts +2 -2
  40. package/dist/components/TopBar/GridLogo.js +8 -41
  41. package/dist/components/TopBar/TopBar.js +197 -328
  42. package/dist/components/TreeViewFinder/TreeViewFinder.js +23 -66
  43. package/dist/components/TreeViewFinder/index.d.ts +2 -2
  44. package/dist/components/dialogs/custom-mui-dialog.d.ts +2 -1
  45. package/dist/components/dialogs/custom-mui-dialog.js +64 -39
  46. package/dist/components/dialogs/modify-element-selection.js +1 -3
  47. package/dist/components/dialogs/popup-confirmation-dialog.d.ts +1 -1
  48. package/dist/components/dialogs/popup-confirmation-dialog.js +8 -15
  49. package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.js +3 -18
  50. package/dist/components/filter/criteria-based/criteria-based-filter-utils.js +3 -9
  51. package/dist/components/filter/criteria-based/criteria-based-form.d.ts +1 -1
  52. package/dist/components/filter/criteria-based/criteria-based-form.js +7 -15
  53. package/dist/components/filter/criteria-based/filter-free-properties.d.ts +1 -1
  54. package/dist/components/filter/criteria-based/filter-free-properties.js +1 -4
  55. package/dist/components/filter/criteria-based/filter-properties.js +16 -24
  56. package/dist/components/filter/criteria-based/filter-property.js +1 -4
  57. package/dist/components/filter/expert/expert-filter-constants.d.ts +10 -3
  58. package/dist/components/filter/expert/expert-filter-constants.js +16 -12
  59. package/dist/components/filter/expert/expert-filter-edition-dialog.js +3 -18
  60. package/dist/components/filter/expert/expert-filter-form.js +1 -7
  61. package/dist/components/filter/expert/expert-filter-utils.js +10 -30
  62. package/dist/components/filter/expert/expert-filter.type.d.ts +3 -1
  63. package/dist/components/filter/expert/expert-filter.type.js +2 -0
  64. package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.js +2 -15
  65. package/dist/components/filter/explicit-naming/explicit-naming-filter-form.d.ts +1 -1
  66. package/dist/components/filter/explicit-naming/explicit-naming-filter-form.js +10 -35
  67. package/dist/components/filter/filter-creation-dialog.js +5 -10
  68. package/dist/components/filter/filter-form.js +3 -17
  69. package/dist/components/filter/utils/filter-api.js +1 -7
  70. package/dist/components/inputs/react-hook-form/ExpandingTextField.js +1 -9
  71. package/dist/components/inputs/react-hook-form/ag-grid-table/bottom-right-buttons.js +14 -52
  72. package/dist/components/inputs/react-hook-form/ag-grid-table/csv-uploader/csv-uploader.js +14 -62
  73. package/dist/components/inputs/react-hook-form/ag-grid-table/custom-ag-grid-table.js +29 -40
  74. package/dist/components/inputs/react-hook-form/autocomplete-inputs/autocomplete-input.js +2 -8
  75. package/dist/components/inputs/react-hook-form/autocomplete-inputs/multiple-autocomplete-input.js +1 -3
  76. package/dist/components/inputs/react-hook-form/booleans/boolean-input.js +1 -7
  77. package/dist/components/inputs/react-hook-form/booleans/checkbox-input.js +1 -9
  78. package/dist/components/inputs/react-hook-form/booleans/switch-input.js +1 -9
  79. package/dist/components/inputs/react-hook-form/description-field.d.ts +8 -0
  80. package/dist/components/inputs/react-hook-form/description-field.js +48 -0
  81. package/dist/components/inputs/react-hook-form/directory-items-input.js +5 -29
  82. package/dist/components/inputs/react-hook-form/error-management/error-input.d.ts +1 -1
  83. package/dist/components/inputs/react-hook-form/provider/custom-form-provider.js +1 -7
  84. package/dist/components/inputs/react-hook-form/radio-input.js +8 -18
  85. package/dist/components/inputs/react-hook-form/range-input.js +1 -4
  86. package/dist/components/inputs/react-hook-form/select-inputs/countries-input.js +1 -9
  87. package/dist/components/inputs/react-hook-form/select-inputs/mui-select-input.js +2 -13
  88. package/dist/components/inputs/react-hook-form/select-inputs/select-input.js +2 -6
  89. package/dist/components/inputs/react-hook-form/slider-input.d.ts +1 -1
  90. package/dist/components/inputs/react-hook-form/slider-input.js +2 -19
  91. package/dist/components/inputs/react-hook-form/unique-name-input.js +1 -9
  92. package/dist/components/inputs/react-hook-form/utils/field-label.d.ts +1 -1
  93. package/dist/components/inputs/react-hook-form/utils/field-label.js +1 -5
  94. package/dist/components/inputs/react-hook-form/utils/submit-button.js +1 -8
  95. package/dist/components/inputs/react-hook-form/utils/text-field-with-adornment.js +18 -47
  96. package/dist/components/inputs/react-query-builder/add-button.js +1 -10
  97. package/dist/components/inputs/react-query-builder/autocomplete-with-favorites.d.ts +12 -0
  98. package/dist/components/inputs/react-query-builder/autocomplete-with-favorites.js +43 -0
  99. package/dist/components/inputs/react-query-builder/composite-rule-editor/group-value-editor.js +14 -27
  100. package/dist/components/inputs/react-query-builder/composite-rule-editor/rule-value-editor.js +1 -3
  101. package/dist/components/inputs/react-query-builder/country-value-editor.js +27 -28
  102. package/dist/components/inputs/react-query-builder/custom-react-query-builder.js +25 -31
  103. package/dist/components/inputs/react-query-builder/element-value-editor.js +1 -10
  104. package/dist/components/inputs/react-query-builder/property-value-editor.js +6 -11
  105. package/dist/components/inputs/react-query-builder/remove-button.js +1 -9
  106. package/dist/components/inputs/react-query-builder/text-value-editor.js +2 -1
  107. package/dist/components/inputs/react-query-builder/translated-value-editor.js +3 -4
  108. package/dist/components/inputs/react-query-builder/use-convert-value.d.ts +1 -1
  109. package/dist/components/inputs/react-query-builder/use-convert-value.js +1 -6
  110. package/dist/components/inputs/react-query-builder/value-editor.js +4 -20
  111. package/dist/components/translations/filter-expert-en.d.ts +2 -0
  112. package/dist/components/translations/filter-expert-en.js +3 -1
  113. package/dist/components/translations/filter-expert-fr.d.ts +2 -0
  114. package/dist/components/translations/filter-expert-fr.js +3 -1
  115. package/dist/hooks/localized-countries-hook.js +1 -3
  116. package/dist/hooks/useConfidentialityWarning.d.ts +8 -0
  117. package/dist/hooks/useConfidentialityWarning.js +14 -0
  118. package/dist/hooks/useDebounce.js +1 -4
  119. package/dist/hooks/useSnackMessage.js +3 -12
  120. package/dist/index.d.ts +11 -9
  121. package/dist/index.js +157 -151
  122. package/dist/services/apps-metadata.d.ts +7 -0
  123. package/dist/services/apps-metadata.js +13 -0
  124. package/dist/services/directory.js +3 -11
  125. package/dist/services/explore.js +2 -8
  126. package/dist/services/index.js +3 -1
  127. package/dist/services/utils.js +4 -12
  128. package/dist/utils/AuthService.js +8 -29
  129. package/dist/utils/UserManagerMock.js +6 -23
  130. package/dist/utils/styles.js +1 -6
  131. package/package.json +1 -1
@@ -102,9 +102,7 @@ function CustomAgGridTable({
102
102
  (rowData == null ? void 0 : rowData.length) && ((_a = gridApi == null ? void 0 : gridApi.api.getRowNode(rowData[0][FieldConstants.AG_GRID_ROW_UUID])) == null ? void 0 : _a.isSelected())
103
103
  );
104
104
  const isLastSelected = Boolean(
105
- (rowData == null ? void 0 : rowData.length) && ((_b = gridApi == null ? void 0 : gridApi.api.getRowNode(
106
- rowData[rowData.length - 1][FieldConstants.AG_GRID_ROW_UUID]
107
- )) == null ? void 0 : _b.isSelected())
105
+ (rowData == null ? void 0 : rowData.length) && ((_b = gridApi == null ? void 0 : gridApi.api.getRowNode(rowData[rowData.length - 1][FieldConstants.AG_GRID_ROW_UUID])) == null ? void 0 : _b.isSelected())
108
106
  );
109
107
  const noRowSelected = selectedRows.length === 0;
110
108
  const getIndex = useCallback(
@@ -185,45 +183,36 @@ function CustomAgGridTable({
185
183
  setIsSortApplied(isAnycolumnhasSort);
186
184
  }, []);
187
185
  return /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
188
- /* @__PURE__ */ jsx(
189
- Grid,
186
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, className: theme.aggrid.theme, sx: style(cssProps).grid, children: /* @__PURE__ */ jsx(
187
+ AgGridReact,
190
188
  {
191
- item: true,
192
- xs: 12,
193
- className: theme.aggrid.theme,
194
- sx: style(cssProps).grid,
195
- children: /* @__PURE__ */ jsx(
196
- AgGridReact,
197
- {
198
- rowData,
199
- onGridReady,
200
- getLocaleText,
201
- cacheOverflowSize: 10,
202
- rowSelection: "multiple",
203
- domLayout: "autoHeight",
204
- rowDragEntireRow: true,
205
- rowDragManaged: true,
206
- onRowDragEnd: (e) => move(getIndex(e.node.data), e.overIndex),
207
- suppressBrowserResizeObserver: true,
208
- columnDefs,
209
- detailRowAutoHeight: true,
210
- onSelectionChanged: () => {
211
- setSelectedRows(gridApi.api.getSelectedRows());
212
- },
213
- onRowDataUpdated: newRowAdded ? onRowDataUpdated : void 0,
214
- onCellEditingStopped,
215
- onSortChanged,
216
- getRowId: (row) => row.data[FieldConstants.AG_GRID_ROW_UUID],
217
- pagination,
218
- paginationPageSize,
219
- suppressRowClickSelection,
220
- alwaysShowVerticalScroll,
221
- stopEditingWhenCellsLoseFocus,
222
- ...props
223
- }
224
- )
189
+ rowData,
190
+ onGridReady,
191
+ getLocaleText,
192
+ cacheOverflowSize: 10,
193
+ rowSelection: "multiple",
194
+ domLayout: "autoHeight",
195
+ rowDragEntireRow: true,
196
+ rowDragManaged: true,
197
+ onRowDragEnd: (e) => move(getIndex(e.node.data), e.overIndex),
198
+ suppressBrowserResizeObserver: true,
199
+ columnDefs,
200
+ detailRowAutoHeight: true,
201
+ onSelectionChanged: () => {
202
+ setSelectedRows(gridApi.api.getSelectedRows());
203
+ },
204
+ onRowDataUpdated: newRowAdded ? onRowDataUpdated : void 0,
205
+ onCellEditingStopped,
206
+ onSortChanged,
207
+ getRowId: (row) => row.data[FieldConstants.AG_GRID_ROW_UUID],
208
+ pagination,
209
+ paginationPageSize,
210
+ suppressRowClickSelection,
211
+ alwaysShowVerticalScroll,
212
+ stopEditingWhenCellsLoseFocus,
213
+ ...props
225
214
  }
226
- ),
215
+ ) }),
227
216
  /* @__PURE__ */ jsx(
228
217
  BottomRightButtons,
229
218
  {
@@ -31,9 +31,7 @@ function AutocompleteInput({
31
31
  onChange(outputTransform(newValue));
32
32
  return;
33
33
  }
34
- const matchingOption = options.find(
35
- (option) => typeof option !== "string" && option.id === newValue
36
- );
34
+ const matchingOption = options.find((option) => typeof option !== "string" && option.id === newValue);
37
35
  if (matchingOption) {
38
36
  onChange(outputTransform(matchingOption));
39
37
  return;
@@ -61,11 +59,7 @@ function AutocompleteInput({
61
59
  ...label && {
62
60
  label: FieldLabel({
63
61
  label,
64
- optional: !isFieldRequired(
65
- name,
66
- validationSchema,
67
- getValues()
68
- ) && !(props == null ? void 0 : props.disabled) && !removeOptional
62
+ optional: !isFieldRequired(name, validationSchema, getValues()) && !(props == null ? void 0 : props.disabled) && !removeOptional
69
63
  })
70
64
  },
71
65
  inputRef: ref,
@@ -18,9 +18,7 @@ function MultipleAutocompleteInput({ name, ...props }) {
18
18
  };
19
19
  const outputTransform = (values) => {
20
20
  const newValues = values.map((val) => val.trim());
21
- return newValues.filter(
22
- (val, index) => newValues.indexOf(val) === index
23
- );
21
+ return newValues.filter((val, index) => newValues.indexOf(val) === index);
24
22
  };
25
23
  return /* @__PURE__ */ jsx(
26
24
  AutocompleteInput,
@@ -27,13 +27,7 @@ function BooleanInput({ name, label, formProps, Input }) {
27
27
  }
28
28
  );
29
29
  if (label) {
30
- return /* @__PURE__ */ jsx(
31
- FormControlLabel,
32
- {
33
- control: CustomInput,
34
- label: intl.formatMessage({ id: label })
35
- }
36
- );
30
+ return /* @__PURE__ */ jsx(FormControlLabel, { control: CustomInput, label: intl.formatMessage({ id: label }) });
37
31
  }
38
32
  return CustomInput;
39
33
  }
@@ -2,15 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { Checkbox } from "@mui/material";
3
3
  import BooleanInput from "./boolean-input.js";
4
4
  function CheckboxInput({ name, label, formProps }) {
5
- return /* @__PURE__ */ jsx(
6
- BooleanInput,
7
- {
8
- name,
9
- label,
10
- formProps,
11
- Input: Checkbox
12
- }
13
- );
5
+ return /* @__PURE__ */ jsx(BooleanInput, { name, label, formProps, Input: Checkbox });
14
6
  }
15
7
  export {
16
8
  CheckboxInput as default
@@ -2,15 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { Switch } from "@mui/material";
3
3
  import BooleanInput from "./boolean-input.js";
4
4
  function SwitchInput({ name, label, formProps }) {
5
- return /* @__PURE__ */ jsx(
6
- BooleanInput,
7
- {
8
- name,
9
- label,
10
- formProps,
11
- Input: Switch
12
- }
13
- );
5
+ return /* @__PURE__ */ jsx(BooleanInput, { name, label, formProps, Input: Switch });
14
6
  }
15
7
  export {
16
8
  SwitchInput as default
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) 2024, RTE (http://www.rte-france.com)
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
+ */
7
+ declare function DescriptionField(): import("react/jsx-runtime").JSX.Element;
8
+ export default DescriptionField;
@@ -0,0 +1,48 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { FormattedMessage } from "react-intl";
4
+ import { Box, Button } from "@mui/material";
5
+ import AddIcon from "@mui/icons-material/Add";
6
+ import DeleteIcon from "@mui/icons-material/Delete";
7
+ import { useFormContext } from "react-hook-form";
8
+ import FieldConstants from "../../../utils/field-constants.js";
9
+ import ExpandingTextField from "./ExpandingTextField.js";
10
+ function DescriptionField() {
11
+ const [isDescriptionFieldVisible, setIsDescriptionFieldVisible] = useState(false);
12
+ const { setValue } = useFormContext();
13
+ const handleOpenDescription = () => {
14
+ setIsDescriptionFieldVisible(true);
15
+ setValue(FieldConstants.DESCRIPTION, "");
16
+ };
17
+ const handleCloseDescription = () => {
18
+ setIsDescriptionFieldVisible(false);
19
+ };
20
+ return /* @__PURE__ */ jsx(Box, { children: !isDescriptionFieldVisible ? /* @__PURE__ */ jsx(Button, { startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: handleOpenDescription, children: /* @__PURE__ */ jsx(FormattedMessage, { id: "AddDescription" }) }) : /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "flex-start" }, children: [
21
+ /* @__PURE__ */ jsx(
22
+ ExpandingTextField,
23
+ {
24
+ name: FieldConstants.DESCRIPTION,
25
+ label: "descriptionProperty",
26
+ minRows: 3,
27
+ rows: 3,
28
+ sx: { flexGrow: 1 }
29
+ }
30
+ ),
31
+ /* @__PURE__ */ jsx(
32
+ Button,
33
+ {
34
+ sx: {
35
+ alignSelf: "flex-end",
36
+ marginLeft: 1,
37
+ padding: 1,
38
+ marginBottom: 2
39
+ },
40
+ onClick: handleCloseDescription,
41
+ children: /* @__PURE__ */ jsx(DeleteIcon, {})
42
+ }
43
+ )
44
+ ] }) });
45
+ }
46
+ export {
47
+ DescriptionField as default
48
+ };
@@ -88,18 +88,12 @@ function DirectoryItemsInput({
88
88
  }
89
89
  if ((selected == null ? void 0 : selected.length) > 0 && (values == null ? void 0 : values.length) > 0) {
90
90
  selected.forEach((chip) => {
91
- remove(
92
- getValues(name).findIndex(
93
- (item) => item.id === chip
94
- )
95
- );
91
+ remove(getValues(name).findIndex((item) => item.id === chip));
96
92
  });
97
93
  }
98
94
  values.forEach((value) => {
99
95
  const { icon, children, ...otherElementAttributes } = value;
100
- if (getValues(name).find(
101
- (v) => (v == null ? void 0 : v.id) === otherElementAttributes.id
102
- ) !== void 0) {
96
+ if (getValues(name).find((v) => (v == null ? void 0 : v.id) === otherElementAttributes.id) !== void 0) {
103
97
  snackError({
104
98
  messageTxt: "",
105
99
  headerId: "directory_items_input/ElementAlreadyUsed"
@@ -113,16 +107,7 @@ function DirectoryItemsInput({
113
107
  setDirectoryItemSelectorOpen(false);
114
108
  setSelected([]);
115
109
  },
116
- [
117
- append,
118
- getValues,
119
- snackError,
120
- name,
121
- onRowChanged,
122
- onChange,
123
- selected,
124
- remove
125
- ]
110
+ [append, getValues, snackError, name, onRowChanged, onChange, selected, remove]
126
111
  );
127
112
  const removeElements = useCallback(
128
113
  (index) => {
@@ -164,11 +149,7 @@ function DirectoryItemsInput({
164
149
  FieldLabel,
165
150
  {
166
151
  label,
167
- optional: labelRequiredFromContext && !isFieldRequired(
168
- name,
169
- validationSchema,
170
- getValues()
171
- )
152
+ optional: labelRequiredFromContext && !isFieldRequired(name, validationSchema, getValues())
172
153
  }
173
154
  ),
174
155
  (elements == null ? void 0 : elements.length) > 0 && /* @__PURE__ */ jsx(FormControl, { sx: styles.formDirectoryElements2, children: elements.map((item, index) => /* @__PURE__ */ jsx(
@@ -180,12 +161,7 @@ function DirectoryItemsInput({
180
161
  label: /* @__PURE__ */ jsx(
181
162
  OverflowableText,
182
163
  {
183
- text: /* @__PURE__ */ jsx(
184
- RawReadOnlyInput,
185
- {
186
- name: `${name}.${index}.${NAME}`
187
- }
188
- ),
164
+ text: /* @__PURE__ */ jsx(RawReadOnlyInput, { name: `${name}.${index}.${NAME}` }),
189
165
  sx: { width: "100%" }
190
166
  }
191
167
  )
@@ -6,7 +6,7 @@ export type ErrorMessage = {
6
6
  } | string;
7
7
  export interface ErrorInputProps {
8
8
  name: string;
9
- InputField: ({ message, }: {
9
+ InputField: ({ message }: {
10
10
  message: string | React.ReactNode;
11
11
  }) => React.ReactNode;
12
12
  }
@@ -9,13 +9,7 @@ const CustomFormContext = createContext({
9
9
  language: getSystemLanguage()
10
10
  });
11
11
  function CustomFormProvider(props) {
12
- const {
13
- validationSchema,
14
- removeOptional,
15
- language,
16
- children,
17
- ...formMethods
18
- } = props;
12
+ const { validationSchema, removeOptional, language, children, ...formMethods } = props;
19
13
  return /* @__PURE__ */ jsx(FormProvider, { ...formMethods, children: /* @__PURE__ */ jsx(
20
14
  CustomFormContext.Provider,
21
15
  {
@@ -9,25 +9,15 @@ function RadioInput({ name, label, id, options, formProps }) {
9
9
  } = useController({ name });
10
10
  return /* @__PURE__ */ jsxs(FormControl, { children: [
11
11
  label && /* @__PURE__ */ jsx(FormLabel, { id: id ?? label, children: /* @__PURE__ */ jsx(FormattedMessage, { id: label }) }),
12
- /* @__PURE__ */ jsx(
13
- RadioGroup,
12
+ /* @__PURE__ */ jsx(RadioGroup, { row: true, "aria-labelledby": id ?? label, value, onChange, ...formProps, children: options.map((option) => /* @__PURE__ */ jsx(
13
+ FormControlLabel,
14
14
  {
15
- row: true,
16
- "aria-labelledby": id ?? label,
17
- value,
18
- onChange,
19
- ...formProps,
20
- children: options.map((option) => /* @__PURE__ */ jsx(
21
- FormControlLabel,
22
- {
23
- control: /* @__PURE__ */ jsx(Radio, {}),
24
- value: option.id,
25
- label: /* @__PURE__ */ jsx(FieldLabel, { label: option.label })
26
- },
27
- option.id
28
- ))
29
- }
30
- )
15
+ control: /* @__PURE__ */ jsx(Radio, {}),
16
+ value: option.id,
17
+ label: /* @__PURE__ */ jsx(FieldLabel, { label: option.label })
18
+ },
19
+ option.id
20
+ )) })
31
21
  ] });
32
22
  }
33
23
  export {
@@ -55,10 +55,7 @@ function RangeInput({ name, label }) {
55
55
  const watchOperationType = useWatch({
56
56
  name: `${name}.${FieldConstants.OPERATION_TYPE}`
57
57
  });
58
- const isOperationTypeRange = useMemo(
59
- () => watchOperationType === RangeType.RANGE.id,
60
- [watchOperationType]
61
- );
58
+ const isOperationTypeRange = useMemo(() => watchOperationType === RangeType.RANGE.id, [watchOperationType]);
62
59
  const firstValueField = /* @__PURE__ */ jsx(
63
60
  FloatInput,
64
61
  {
@@ -25,15 +25,7 @@ function CountriesInput({ name, label }) {
25
25
  getOptionLabel: translateOption,
26
26
  fullWidth: true,
27
27
  multiple: true,
28
- renderTags: (val, getTagsProps) => val.map((code, index) => /* @__PURE__ */ jsx(
29
- Chip,
30
- {
31
- size: "small",
32
- label: translate(code),
33
- ...getTagsProps({ index })
34
- },
35
- code
36
- ))
28
+ renderTags: (val, getTagsProps) => val.map((code, index) => /* @__PURE__ */ jsx(Chip, { size: "small", label: translate(code), ...getTagsProps({ index }) }, code))
37
29
  }
38
30
  );
39
31
  }
@@ -2,24 +2,13 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { FormattedMessage } from "react-intl";
3
3
  import { Select, MenuItem } from "@mui/material";
4
4
  import { useController } from "react-hook-form";
5
- function MuiSelectInput({
6
- name,
7
- options,
8
- ...props
9
- }) {
5
+ function MuiSelectInput({ name, options, ...props }) {
10
6
  const {
11
7
  field: { value, onChange }
12
8
  } = useController({
13
9
  name
14
10
  });
15
- return /* @__PURE__ */ jsx(Select, { value, onChange, ...props, children: options.map((option) => /* @__PURE__ */ jsx(
16
- MenuItem,
17
- {
18
- value: option.id ?? option,
19
- children: /* @__PURE__ */ jsx(FormattedMessage, { id: option.label ?? option })
20
- },
21
- option.id ?? option.label
22
- )) });
11
+ return /* @__PURE__ */ jsx(Select, { value, onChange, ...props, children: options.map((option) => /* @__PURE__ */ jsx(MenuItem, { value: option.id ?? option, children: /* @__PURE__ */ jsx(FormattedMessage, { id: option.label ?? option }) }, option.id ?? option.label)) });
23
12
  }
24
13
  export {
25
14
  MuiSelectInput as default
@@ -9,13 +9,9 @@ function SelectInput(props) {
9
9
  return null;
10
10
  }
11
11
  if (typeof value === "string") {
12
- return options.find(
13
- (option) => typeof option !== "string" && (option == null ? void 0 : option.id) === value
14
- ) || null;
12
+ return options.find((option) => typeof option !== "string" && (option == null ? void 0 : option.id) === value) || null;
15
13
  }
16
- return options.find(
17
- (option) => typeof option !== "string" && (option == null ? void 0 : option.id) === value.id
18
- ) || null;
14
+ return options.find((option) => typeof option !== "string" && (option == null ? void 0 : option.id) === value.id) || null;
19
15
  };
20
16
  const outputTransform = (value) => {
21
17
  if (typeof value === "string") {
@@ -4,5 +4,5 @@ export interface SliderInputProps extends SliderProps {
4
4
  name: string;
5
5
  onValueChanged: (value: any) => void;
6
6
  }
7
- declare function SliderInput({ name, min, max, step, size, onValueChanged, }: SliderInputProps): import("react/jsx-runtime").JSX.Element;
7
+ declare function SliderInput({ name, min, max, step, size, onValueChanged }: SliderInputProps): import("react/jsx-runtime").JSX.Element;
8
8
  export default SliderInput;
@@ -2,14 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { Slider } from "@mui/material";
3
3
  import { useController } from "react-hook-form";
4
4
  import { identity } from "./utils/functions.js";
5
- function SliderInput({
6
- name,
7
- min,
8
- max,
9
- step,
10
- size = "small",
11
- onValueChanged = identity
12
- }) {
5
+ function SliderInput({ name, min, max, step, size = "small", onValueChanged = identity }) {
13
6
  const {
14
7
  field: { onChange, value }
15
8
  } = useController({ name });
@@ -17,17 +10,7 @@ function SliderInput({
17
10
  onValueChanged(newValue);
18
11
  onChange(newValue);
19
12
  };
20
- return /* @__PURE__ */ jsx(
21
- Slider,
22
- {
23
- size,
24
- min,
25
- max,
26
- step,
27
- value,
28
- onChange: handleValueChange
29
- }
30
- );
13
+ return /* @__PURE__ */ jsx(Slider, { size, min, max, step, value, onChange: handleValueChange });
31
14
  }
32
15
  export {
33
16
  SliderInput as default
@@ -84,15 +84,7 @@ function UniqueNameInput({
84
84
  message: "nameEmpty"
85
85
  });
86
86
  }
87
- }, [
88
- debouncedHandleCheckName,
89
- setError,
90
- clearErrors,
91
- name,
92
- value,
93
- isDirty,
94
- selectedDirectory
95
- ]);
87
+ }, [debouncedHandleCheckName, setError, clearErrors, name, value, isDirty, selectedDirectory]);
96
88
  const handleManualChange = (e) => {
97
89
  onChange(e.target.value);
98
90
  onManualChangeCallback == null ? void 0 : onManualChangeCallback();
@@ -9,5 +9,5 @@ type FieldLabelProps = {
9
9
  optional?: boolean;
10
10
  values?: any;
11
11
  };
12
- declare function FieldLabel({ label, optional, values, }: FieldLabelProps): import("react/jsx-runtime").JSX.Element;
12
+ declare function FieldLabel({ label, optional, values }: FieldLabelProps): import("react/jsx-runtime").JSX.Element;
13
13
  export default FieldLabel;
@@ -1,10 +1,6 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { FormattedMessage } from "react-intl";
3
- function FieldLabel({
4
- label,
5
- optional = false,
6
- values = void 0
7
- }) {
3
+ function FieldLabel({ label, optional = false, values = void 0 }) {
8
4
  return /* @__PURE__ */ jsxs(Fragment, { children: [
9
5
  /* @__PURE__ */ jsx(FormattedMessage, { id: label, values }),
10
6
  optional && /* @__PURE__ */ jsx(FormattedMessage, { id: "Optional" })
@@ -4,14 +4,7 @@ import { useFormState } from "react-hook-form";
4
4
  import { FormattedMessage } from "react-intl";
5
5
  function SubmitButton({ ...buttonProps }) {
6
6
  const { isDirty } = useFormState();
7
- return /* @__PURE__ */ jsx(
8
- Button,
9
- {
10
- ...buttonProps,
11
- disabled: !isDirty || ((buttonProps == null ? void 0 : buttonProps.disabled) ?? false),
12
- children: /* @__PURE__ */ jsx(FormattedMessage, { id: "validate" })
13
- }
14
- );
7
+ return /* @__PURE__ */ jsx(Button, { ...buttonProps, disabled: !isDirty || ((buttonProps == null ? void 0 : buttonProps.disabled) ?? false), children: /* @__PURE__ */ jsx(FormattedMessage, { id: "validate" }) });
15
8
  }
16
9
  export {
17
10
  SubmitButton as default
@@ -3,32 +3,22 @@ import { useState, useCallback } from "react";
3
3
  import { Clear } from "@mui/icons-material";
4
4
  import { InputAdornment, IconButton, TextField } from "@mui/material";
5
5
  function TextFieldWithAdornment(props) {
6
- const {
7
- adornmentPosition,
8
- adornmentText,
9
- value,
10
- variant,
11
- handleClearValue,
12
- ...otherProps
13
- } = props;
6
+ const { adornmentPosition, adornmentText, value, variant, handleClearValue, ...otherProps } = props;
14
7
  const [isFocused, setIsFocused] = useState(false);
15
- const getAdornmentStyle = useCallback(
16
- (innerVariant) => {
17
- if (innerVariant === "filled") {
18
- return {
19
- alignItems: "start",
20
- marginBottom: "0.4em"
21
- };
22
- }
23
- if (innerVariant === "standard") {
24
- return {
25
- marginBottom: "0.3em"
26
- };
27
- }
28
- return void 0;
29
- },
30
- []
31
- );
8
+ const getAdornmentStyle = useCallback((innerVariant) => {
9
+ if (innerVariant === "filled") {
10
+ return {
11
+ alignItems: "start",
12
+ marginBottom: "0.4em"
13
+ };
14
+ }
15
+ if (innerVariant === "standard") {
16
+ return {
17
+ marginBottom: "0.3em"
18
+ };
19
+ }
20
+ return void 0;
21
+ }, []);
32
22
  const getClearAdornment = useCallback(
33
23
  (position) => {
34
24
  return /* @__PURE__ */ jsx(InputAdornment, { position, children: /* @__PURE__ */ jsx(IconButton, { onClick: handleClearValue, children: /* @__PURE__ */ jsx(Clear, {}) }) });
@@ -37,14 +27,7 @@ function TextFieldWithAdornment(props) {
37
27
  );
38
28
  const getTextAdornment = useCallback(
39
29
  (position) => {
40
- return /* @__PURE__ */ jsx(
41
- InputAdornment,
42
- {
43
- position,
44
- sx: variant && getAdornmentStyle(variant),
45
- children: adornmentText
46
- }
47
- );
30
+ return /* @__PURE__ */ jsx(InputAdornment, { position, sx: variant && getAdornmentStyle(variant), children: adornmentText });
48
31
  },
49
32
  [adornmentText, getAdornmentStyle, variant]
50
33
  );
@@ -54,26 +37,14 @@ function TextFieldWithAdornment(props) {
54
37
  endAdornment: getTextAdornment("end"),
55
38
  sx: { textAlign: "end" }
56
39
  } : void 0;
57
- }, [
58
- value,
59
- handleClearValue,
60
- getClearAdornment,
61
- isFocused,
62
- getTextAdornment
63
- ]);
40
+ }, [value, handleClearValue, getClearAdornment, isFocused, getTextAdornment]);
64
41
  const withStartAdornmentText = useCallback(() => {
65
42
  return value !== "" || isFocused ? {
66
43
  startAdornment: getTextAdornment("start"),
67
44
  endAdornment: value && handleClearValue && getClearAdornment("end"),
68
45
  sx: { textAlign: "start" }
69
46
  } : void 0;
70
- }, [
71
- value,
72
- handleClearValue,
73
- getClearAdornment,
74
- isFocused,
75
- getTextAdornment
76
- ]);
47
+ }, [value, handleClearValue, getClearAdornment, isFocused, getTextAdornment]);
77
48
  return /* @__PURE__ */ jsx(
78
49
  TextField,
79
50
  {
@@ -4,16 +4,7 @@ import AddIcon from "@mui/icons-material/ControlPoint";
4
4
  import { FormattedMessage } from "react-intl";
5
5
  function AddButton(props) {
6
6
  const { label, handleOnClick } = props;
7
- return /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
8
- Button,
9
- {
10
- startIcon: /* @__PURE__ */ jsx(AddIcon, {}),
11
- onClick: handleOnClick,
12
- size: "small",
13
- className: "add-button",
14
- children: /* @__PURE__ */ jsx(FormattedMessage, { id: label })
15
- }
16
- ) });
7
+ return /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Button, { startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: handleOnClick, size: "small", className: "add-button", children: /* @__PURE__ */ jsx(FormattedMessage, { id: label }) }) });
17
8
  }
18
9
  export {
19
10
  AddButton as default
@@ -0,0 +1,12 @@
1
+ import { AutocompleteProps } from '@mui/material/Autocomplete/Autocomplete';
2
+
3
+ interface AutocompleteWithFavoritesProps<Value> extends Omit<AutocompleteProps<Value, boolean, false, boolean>, 'multiple' | 'renderInput' | 'renderGroup' | 'groupBy'> {
4
+ favorites: Value[];
5
+ valid: boolean;
6
+ }
7
+ /**
8
+ * Autocomplete component which allows to have a few "favorite" options always displayed
9
+ * at the beginning of the selector and separated from the others options
10
+ */
11
+ declare function AutocompleteWithFavorites<Value>({ favorites, valid, options, value, ...otherProps }: AutocompleteWithFavoritesProps<Value>): import("react/jsx-runtime").JSX.Element;
12
+ export default AutocompleteWithFavorites;