@centreon/ui 24.4.30 → 24.4.32

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 (101) hide show
  1. package/package.json +14 -19
  2. package/public/mockServiceWorker.js +1 -1
  3. package/src/Button/Icon/index.tsx +1 -1
  4. package/src/Button/Save/StartIcon.tsx +3 -3
  5. package/src/Button/Save/index.tsx +5 -9
  6. package/src/Checkbox/Checkbox.tsx +2 -2
  7. package/src/Checkbox/CheckboxGroup/index.tsx +2 -2
  8. package/src/Dashboard/Item.tsx +1 -1
  9. package/src/Dashboard/Layout.tsx +2 -2
  10. package/src/Dialog/index.tsx +1 -1
  11. package/src/FallbackPage/FallbackPage.tsx +3 -3
  12. package/src/FileDropZone/index.tsx +1 -3
  13. package/src/Form/Inputs/CheckboxGroup.tsx +4 -1
  14. package/src/Form/Inputs/index.tsx +1 -3
  15. package/src/Form/Inputs/models.ts +1 -9
  16. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/Circle.tsx +2 -2
  17. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/index.tsx +4 -5
  18. package/src/Graph/LineChart/BasicComponents/Thresholds.tsx +2 -2
  19. package/src/Graph/LineChart/BasicComponents/useFilterLines.ts +1 -1
  20. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/GuidingLines.tsx +2 -2
  21. package/src/Graph/LineChart/InteractiveComponents/Annotations/Annotation/index.tsx +3 -2
  22. package/src/Graph/LineChart/InteractiveComponents/Annotations/EventAnnotations.tsx +1 -1
  23. package/src/Graph/LineChart/Legend/useLegend.ts +3 -3
  24. package/src/Graph/LineChart/helpers/doc.ts +13 -16
  25. package/src/Graph/LineChart/helpers/index.ts +1 -1
  26. package/src/Graph/LineChart/index.stories.tsx +2 -4
  27. package/src/Graph/SingleBar/Thresholds.tsx +2 -2
  28. package/src/Graph/Text/Text.stories.tsx +4 -60
  29. package/src/Graph/common/timeSeries/index.ts +3 -3
  30. package/src/InputField/Number/Number.cypress.spec.tsx +85 -0
  31. package/src/InputField/Number/Number.stories.tsx +66 -0
  32. package/src/InputField/Number/Number.tsx +74 -0
  33. package/src/InputField/Search/index.tsx +2 -2
  34. package/src/InputField/Select/Autocomplete/Connected/index.tsx +7 -10
  35. package/src/InputField/Select/Autocomplete/Draggable/SortableList.tsx +1 -1
  36. package/src/InputField/Select/Autocomplete/Draggable/SortableListContent.tsx +1 -1
  37. package/src/InputField/Select/Autocomplete/Draggable/index.tsx +1 -1
  38. package/src/InputField/Select/Autocomplete/index.tsx +115 -121
  39. package/src/InputField/Select/IconPopover/index.tsx +2 -2
  40. package/src/InputField/Select/index.tsx +1 -1
  41. package/src/InputField/Text/index.tsx +40 -40
  42. package/src/Listing/Cell/DataCell.tsx +1 -15
  43. package/src/Listing/Header/ListingHeader.tsx +1 -1
  44. package/src/Listing/Listing.cypress.spec.tsx +2 -2
  45. package/src/Listing/Listing.styles.ts +3 -2
  46. package/src/Listing/index.stories.tsx +3 -14
  47. package/src/Listing/index.tsx +125 -138
  48. package/src/Module/index.tsx +4 -2
  49. package/src/RichTextEditor/RichTextEditor.tsx +1 -12
  50. package/src/SortableItems/index.tsx +7 -2
  51. package/src/ThemeProvider/index.tsx +0 -24
  52. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +3 -8
  53. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +2 -0
  54. package/src/TimePeriods/DateTimePickerInput.tsx +19 -56
  55. package/src/TimePeriods/TimePeriods.cypress.spec.tsx +33 -9
  56. package/src/TimePeriods/helpers/index.ts +1 -1
  57. package/src/TimePeriods/index.stories.tsx +4 -12
  58. package/src/TimePeriods/index.tsx +2 -2
  59. package/src/api/QueryProvider.tsx +1 -1
  60. package/src/api/TestQueryProvider.tsx +1 -1
  61. package/src/api/useFetchQuery/index.ts +23 -27
  62. package/src/api/useMutationQuery/index.ts +21 -45
  63. package/src/components/Button/Icon/IconButton.tsx +2 -6
  64. package/src/components/DataTable/DataTable.stories.tsx +0 -40
  65. package/src/components/DataTable/DataTable.styles.ts +0 -3
  66. package/src/components/DataTable/DataTable.tsx +3 -3
  67. package/src/components/DataTable/Item/DataTableItem.styles.ts +2 -7
  68. package/src/components/DataTable/Item/DataTableItem.tsx +4 -4
  69. package/src/components/DataTable/index.ts +1 -3
  70. package/src/components/Form/AccessRights/__fixtures__/contactAccessRight.mock.ts +0 -2
  71. package/src/components/Form/AccessRights/useAccessRightsForm.utils.ts +1 -1
  72. package/src/components/Form/Dashboard/DashboardForm.tsx +12 -15
  73. package/src/components/Layout/PageLayout/PageLayout.tsx +1 -1
  74. package/src/components/Layout/PageLayout/PageLayoutActions.tsx +0 -1
  75. package/src/components/Layout/PageLayout/PageLayoutBody.tsx +0 -1
  76. package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +1 -5
  77. package/src/components/Layout/PageLayout/index.ts +1 -3
  78. package/src/components/Modal/Modal.styles.ts +3 -4
  79. package/src/components/Modal/ModalActions.tsx +2 -4
  80. package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.stories.tsx +3 -3
  81. package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.tsx +1 -1
  82. package/src/components/Tooltip/ConfirmationTooltip/models.ts +1 -1
  83. package/src/index.ts +3 -2
  84. package/src/queryParameters/url/index.ts +1 -5
  85. package/src/screens/dashboard/DashboardsDetail.stories.tsx +108 -0
  86. package/src/screens/dashboard/DashboardsOverview.stories.tsx +281 -0
  87. package/src/utils/index.ts +1 -1
  88. package/src/utils/useDateTimePickerAdapter.ts +309 -0
  89. package/src/utils/{useLicenseExpirationWarning.test.tsx → useLicenseExpirationWarning.cypress.spec.tsx} +37 -48
  90. package/src/utils/useLicenseExpirationWarning.ts +18 -18
  91. package/src/Form/Form.cypress.spec.tsx +0 -133
  92. package/src/Form/Inputs/List/Content.tsx +0 -62
  93. package/src/Form/Inputs/List/List.styles.ts +0 -29
  94. package/src/Form/Inputs/List/List.tsx +0 -58
  95. package/src/Form/Inputs/List/useList.ts +0 -81
  96. package/src/Module/Module.cypress.spec.tsx +0 -129
  97. package/src/components/DataTable/DataListing.tsx +0 -6
  98. package/src/components/DataTable/DataTable.cypress.spec.tsx +0 -193
  99. package/src/components/Layout/PageLayout/PageQuickAccess.tsx +0 -76
  100. package/src/components/Layout/PageLayout.cypress.spec.tsx +0 -66
  101. package/src/utils/usePluralizedTranslation.ts +0 -21
@@ -179,7 +179,7 @@ const getMetricValuesForUnit = ({
179
179
  ) as Array<number>;
180
180
 
181
181
  return pipe(
182
- filter(propEq(unit, 'unit')) as (line) => Array<Line>,
182
+ filter(propEq('unit', unit)) as (line) => Array<Line>,
183
183
  map(prop('metric_id')),
184
184
  map(getTimeSeriesValuesForMetric),
185
185
  flatten,
@@ -203,7 +203,7 @@ const getLineForMetric = ({
203
203
  lines,
204
204
  metric_id
205
205
  }: LineForMetricProps): Line | undefined =>
206
- find(propEq(metric_id, 'metric_id'), lines);
206
+ find(propEq('metric_id', metric_id), lines);
207
207
 
208
208
  interface LinesTimeSeries {
209
209
  lines: Array<Line>;
@@ -275,7 +275,7 @@ interface HasStackedLines {
275
275
  }
276
276
 
277
277
  const hasUnitStackedLines = ({ lines, unit }: HasStackedLines): boolean =>
278
- pipe(getSortedStackedLines, any(propEq(unit, 'unit')))(lines);
278
+ pipe(getSortedStackedLines, any(propEq('unit', unit)))(lines);
279
279
 
280
280
  const getTimeSeriesForLines = ({
281
281
  lines,
@@ -0,0 +1,85 @@
1
+ import NumberField, { NumberProps } from './Number';
2
+
3
+ const initialize = (props: NumberProps): void => {
4
+ cy.mount({
5
+ Component: <NumberField {...props} />
6
+ });
7
+ };
8
+
9
+ describe('Number field', () => {
10
+ it('displays the placeholder when the field has no default or fallback values', () => {
11
+ initialize({ dataTestId: 'test', onChange: cy.stub() });
12
+
13
+ cy.get('input').should('have.value', '');
14
+ cy.get('input').should('have.attr', 'placeholder', '0');
15
+
16
+ cy.makeSnapshot();
17
+ });
18
+
19
+ it('displays the fallback value as placeholder when the field as no default value', () => {
20
+ initialize({ dataTestId: 'test', fallbackValue: 25, onChange: cy.stub() });
21
+
22
+ cy.get('input').should('have.value', '');
23
+ cy.get('input').should('have.attr', 'placeholder', '25');
24
+
25
+ cy.makeSnapshot();
26
+ });
27
+
28
+ it('displays the default value as placeholder when the field as default value', () => {
29
+ initialize({ dataTestId: 'test', defaultValue: 25, onChange: cy.stub() });
30
+
31
+ cy.get('input').should('have.value', '25');
32
+
33
+ cy.makeSnapshot();
34
+ });
35
+
36
+ it('displays the fallback value when the field is cleared out', () => {
37
+ initialize({
38
+ dataTestId: 'test',
39
+ defaultValue: 25,
40
+ fallbackValue: 10,
41
+ onChange: cy.stub()
42
+ });
43
+
44
+ cy.get('input').should('have.value', '25');
45
+ cy.get('input').clear();
46
+ cy.get('input').should('have.value', '');
47
+ cy.get('input').should('have.attr', 'placeholder', '10');
48
+
49
+ cy.makeSnapshot();
50
+ });
51
+
52
+ it('displays the field using auto size', () => {
53
+ initialize({
54
+ autoSize: true,
55
+ dataTestId: 'test',
56
+ defaultValue: 25,
57
+ onChange: cy.stub()
58
+ });
59
+
60
+ cy.get('input').should('have.value', '25');
61
+
62
+ cy.get('input').type('0');
63
+
64
+ cy.makeSnapshot();
65
+ });
66
+
67
+ it('sets the value to the minimum value configured when a value less than the minimum value is typed in the field', () => {
68
+ initialize({
69
+ dataTestId: 'test',
70
+ defaultValue: 25,
71
+ inputProps: {
72
+ min: 2
73
+ },
74
+ onChange: cy.stub()
75
+ });
76
+
77
+ cy.get('input').should('have.value', '25');
78
+
79
+ cy.get('input').clear().type('-1');
80
+
81
+ cy.get('input').should('have.value', '2');
82
+
83
+ cy.makeSnapshot();
84
+ });
85
+ });
@@ -0,0 +1,66 @@
1
+ /* eslint-disable no-console */
2
+ import { Meta, StoryObj } from '@storybook/react';
3
+
4
+ import NumberField from './Number';
5
+
6
+ const meta: Meta<typeof NumberField> = {
7
+ argTypes: {
8
+ defaultValue: {
9
+ defaultValue: 0,
10
+ description:
11
+ 'The initial value which will be used by the input for the first render',
12
+ type: 'number'
13
+ },
14
+ fallbackValue: {
15
+ defaultValue: 0,
16
+ description: 'This value will be used when the input is cleared',
17
+ type: 'number'
18
+ },
19
+ onChange: {
20
+ description:
21
+ 'The change function with the actual value as parameter. This parameter will be the value when the input is filled but it will be the fallbackValue when the input is cleared out',
22
+ type: 'function'
23
+ }
24
+ },
25
+ component: NumberField
26
+ };
27
+
28
+ export default meta;
29
+ type Story = StoryObj<typeof NumberField>;
30
+
31
+ export const Default: Story = {
32
+ args: {
33
+ onChange: console.log
34
+ }
35
+ };
36
+
37
+ export const WithDefaultValue: Story = {
38
+ args: {
39
+ defaultValue: 25,
40
+ onChange: console.log
41
+ }
42
+ };
43
+
44
+ export const WithFallbackValue: Story = {
45
+ args: {
46
+ fallbackValue: 25,
47
+ onChange: console.log
48
+ }
49
+ };
50
+
51
+ export const WithFallbackValueAndDefaultValue: Story = {
52
+ args: {
53
+ defaultValue: 10,
54
+ fallbackValue: 25,
55
+ onChange: console.log
56
+ }
57
+ };
58
+
59
+ export const WithFallbackValueAndDefaultValueAutoSize: Story = {
60
+ args: {
61
+ autoSize: true,
62
+ defaultValue: 10,
63
+ fallbackValue: 25,
64
+ onChange: console.log
65
+ }
66
+ };
@@ -0,0 +1,74 @@
1
+ import { ChangeEvent, useState } from 'react';
2
+
3
+ import { T, always, cond, isEmpty, isNil } from 'ramda';
4
+
5
+ import TextField, { TextProps } from '../Text';
6
+
7
+ export interface NumberProps
8
+ extends Omit<TextProps, 'defaultValue' | 'onChange'> {
9
+ /**
10
+ * The initial value which will be used by the input for the first render
11
+ */
12
+ defaultValue?: number;
13
+ /**
14
+ * This value will be used when the input is cleared
15
+ */
16
+ fallbackValue?: number;
17
+ /**
18
+ * The change function with the actual value as parameter. This parameter will be the value when the input is filled but it will be the fallbackValue when the input is cleared out
19
+ */
20
+ onChange: (actualValue: number) => void;
21
+ }
22
+
23
+ const NumberField = ({
24
+ fallbackValue = 0,
25
+ defaultValue,
26
+ onChange,
27
+ ...props
28
+ }: NumberProps): JSX.Element => {
29
+ const [placeholder, setPlaceholder] = useState<string | undefined>();
30
+ const [actualValue, setActualValue] = useState(
31
+ defaultValue ? `${defaultValue}` : ''
32
+ );
33
+
34
+ const { inputProps } = props;
35
+
36
+ const changeValue = (event: ChangeEvent<HTMLInputElement>): void => {
37
+ const inputValue = event.target.value;
38
+
39
+ const number = Number(inputValue);
40
+ const campledNumber = cond([
41
+ [() => isEmpty(inputValue), always(fallbackValue)],
42
+ [() => Number.isNaN(number), always(number)],
43
+ [
44
+ T,
45
+ always(
46
+ Math.max(
47
+ !isNil(inputProps?.min) ? inputProps?.min : -Infinity,
48
+ number
49
+ )
50
+ )
51
+ ]
52
+ ])();
53
+
54
+ onChange(campledNumber);
55
+ setPlaceholder(isEmpty(inputValue) ? `${fallbackValue}` : undefined);
56
+ setActualValue(isEmpty(inputValue) ? inputValue : `${campledNumber}`);
57
+ };
58
+
59
+ return (
60
+ <TextField
61
+ defaultValue={defaultValue}
62
+ type="number"
63
+ value={actualValue}
64
+ onChange={changeValue}
65
+ {...props}
66
+ inputProps={inputProps}
67
+ placeholder={
68
+ placeholder || (!defaultValue ? `${fallbackValue}` : undefined)
69
+ }
70
+ />
71
+ );
72
+ };
73
+
74
+ export default NumberField;
@@ -1,8 +1,8 @@
1
1
  import IconSearch from '@mui/icons-material/Search';
2
2
 
3
- import TextField, { Props as TextFieldProps } from '../Text';
3
+ import TextField, { TextProps } from '../Text';
4
4
 
5
- type Props = Omit<TextFieldProps, 'StartAdornment'>;
5
+ type Props = Omit<TextProps, 'StartAdornment'>;
6
6
 
7
7
  const SearchAdornment = (): JSX.Element => <IconSearch />;
8
8
 
@@ -292,16 +292,13 @@ const ConnectedAutocompleteField = (
292
292
  }
293
293
  }, [optionsOpen]);
294
294
 
295
- useEffect(
296
- () => {
297
- setSearchParameter(
298
- !isEmpty(searchConditions)
299
- ? { conditions: searchConditions }
300
- : undefined
301
- );
302
- },
303
- useDeepCompare([searchConditions])
304
- );
295
+ useEffect(() => {
296
+ setSearchParameter(
297
+ !isEmpty(searchConditions)
298
+ ? { conditions: searchConditions }
299
+ : undefined
300
+ );
301
+ }, useDeepCompare([searchConditions]));
305
302
 
306
303
  useEffect(() => {
307
304
  if (!autocompleteChangedValue && !props?.value) {
@@ -49,7 +49,7 @@ const SortableList = ({
49
49
  const dragEnd = ({ items: newItems }): void =>
50
50
  changeItemsOrder(
51
51
  map(
52
- (item) => find(propEq(item, 'id'), items),
52
+ (item) => find(propEq('id', item), items),
53
53
  newItems
54
54
  ) as Array<DraggableSelectEntry>
55
55
  );
@@ -49,7 +49,7 @@ const SortableListContent = ({
49
49
  return;
50
50
  }
51
51
 
52
- const itemIndex = findIndex(propEq(id, 'id'), items);
52
+ const itemIndex = findIndex(propEq('id', id), items);
53
53
 
54
54
  itemHover?.(null);
55
55
  itemClick?.({ index: itemIndex, item: { createOption, id, name } });
@@ -77,7 +77,7 @@ const DraggableAutocomplete = (
77
77
  const deleteValue = (id): void => {
78
78
  itemHover?.(null);
79
79
  setSelectedValues((values: Array<DraggableSelectEntry>) => {
80
- const index = findIndex(propEq(id, 'id'), values);
80
+ const index = findIndex(propEq('id', id), values);
81
81
 
82
82
  const newSelectedValues = remove(index, 1, values);
83
83
 
@@ -141,132 +141,126 @@ type Multiple = boolean;
141
141
  type DisableClearable = boolean;
142
142
  type FreeSolo = boolean;
143
143
 
144
- const AutocompleteField = React.forwardRef(
145
- (
146
- {
147
- options,
148
- label,
149
- placeholder,
150
- loading = false,
151
- onTextChange = (): void => undefined,
152
- endAdornment = undefined,
153
- inputValue,
154
- displayOptionThumbnail = false,
155
- required = false,
156
- error,
157
- displayPopupIcon = true,
158
- autoFocus = false,
159
- hideInput = false,
160
- dataTestId,
161
- autoSize = false,
162
- autoSizeDefaultWidth = 0,
163
- autoSizeCustomPadding,
164
- getOptionItemLabel = (option) => option.name,
165
- ...autocompleteProps
166
- }: Props,
167
- ref?: React.ForwardedRef<HTMLDivElement>
168
- ): JSX.Element => {
169
- const { classes, cx } = useStyles({ hideInput });
170
- const { t } = useTranslation();
171
- const theme = useTheme();
144
+ const AutocompleteField = ({
145
+ options,
146
+ label,
147
+ placeholder,
148
+ loading = false,
149
+ onTextChange = (): void => undefined,
150
+ endAdornment = undefined,
151
+ inputValue,
152
+ displayOptionThumbnail = false,
153
+ required = false,
154
+ error,
155
+ displayPopupIcon = true,
156
+ autoFocus = false,
157
+ hideInput = false,
158
+ dataTestId,
159
+ autoSize = false,
160
+ autoSizeDefaultWidth = 0,
161
+ autoSizeCustomPadding,
162
+ getOptionItemLabel = (option) => option.name,
163
+ ...autocompleteProps
164
+ }: Props): JSX.Element => {
165
+ const { classes, cx } = useStyles({ hideInput });
166
+ const { t } = useTranslation();
167
+ const theme = useTheme();
172
168
 
173
- const areSelectEntriesEqual = (option, value): boolean => {
174
- const identifyingProps = ['id', 'name'];
169
+ const areSelectEntriesEqual = (option, value): boolean => {
170
+ const identifyingProps = ['id', 'name'];
175
171
 
176
- return equals(
177
- pick(identifyingProps, option),
178
- pick(identifyingProps, value)
179
- );
180
- };
181
-
182
- const renderInput = (params): JSX.Element => (
183
- <TextField
184
- {...params}
185
- InputLabelProps={{
186
- classes: {
187
- marginDense: classes.inputLabel,
188
- shrink: classes.inputLabelShrink
189
- }
190
- }}
191
- InputProps={{
192
- ...params.InputProps,
193
- endAdornment: (
194
- <>
195
- {endAdornment && (
196
- <InputAdornment position="end">{endAdornment}</InputAdornment>
197
- )}
198
- {params.InputProps.endAdornment}
199
- </>
200
- ),
201
- style: {
202
- background: 'transparent',
203
- paddingRight: theme.spacing(5)
204
- }
205
- }}
206
- autoFocus={autoFocus}
207
- autoSize={autoSize}
208
- autoSizeCustomPadding={7 + (autoSizeCustomPadding || 0)}
209
- autoSizeDefaultWidth={autoSizeDefaultWidth}
210
- classes={{
211
- root: classes.textfield
212
- }}
213
- error={error}
214
- externalValueForAutoSize={autocompleteProps?.value?.name}
215
- inputProps={{
216
- ...params.inputProps,
217
- 'aria-label': label,
218
- 'data-testid': dataTestId || label,
219
- id: getNormalizedId(label || '')
220
- }}
221
- label={label}
222
- placeholder={isNil(placeholder) ? t(searchLabel) : placeholder}
223
- required={required}
224
- value={inputValue || undefined}
225
- onChange={onTextChange}
226
- />
172
+ return equals(
173
+ pick(identifyingProps, option),
174
+ pick(identifyingProps, value)
227
175
  );
176
+ };
228
177
 
229
- return (
230
- <Autocomplete
231
- disableClearable
232
- classes={{
233
- groupLabel: classes.inputLabel,
234
- inputRoot: cx([
235
- classes.input,
236
- label ? classes.inputWithLabel : classes.inputWithoutLabel
237
- ]),
238
- popper: classes.popper,
239
- root: classes.textfield
240
- }}
241
- forcePopupIcon={displayPopupIcon}
242
- getOptionLabel={(option): string =>
243
- (option as SelectEntry)?.name?.toString() || ''
178
+ const renderInput = (params): JSX.Element => (
179
+ <TextField
180
+ {...params}
181
+ InputLabelProps={{
182
+ classes: {
183
+ marginDense: classes.inputLabel,
184
+ shrink: classes.inputLabelShrink
185
+ }
186
+ }}
187
+ InputProps={{
188
+ ...params.InputProps,
189
+ endAdornment: (
190
+ <>
191
+ {endAdornment && (
192
+ <InputAdornment position="end">{endAdornment}</InputAdornment>
193
+ )}
194
+ {params.InputProps.endAdornment}
195
+ </>
196
+ ),
197
+ style: {
198
+ background: 'transparent',
199
+ paddingRight: theme.spacing(5)
244
200
  }
245
- isOptionEqualToValue={areSelectEntriesEqual}
246
- loading={loading}
247
- loadingText={<LoadingIndicator />}
248
- options={options}
249
- ref={ref}
250
- renderInput={renderInput}
251
- renderOption={(props, option): JSX.Element => {
252
- return (
253
- <li
254
- className={classes.options}
255
- {...(props as React.HTMLAttributes<HTMLLIElement>)}
201
+ }}
202
+ autoFocus={autoFocus}
203
+ autoSize={autoSize}
204
+ autoSizeCustomPadding={7 + (autoSizeCustomPadding || 0)}
205
+ autoSizeDefaultWidth={autoSizeDefaultWidth}
206
+ classes={{
207
+ root: classes.textfield
208
+ }}
209
+ error={error}
210
+ externalValueForAutoSize={autocompleteProps?.value?.name}
211
+ inputProps={{
212
+ ...params.inputProps,
213
+ 'aria-label': label,
214
+ 'data-testid': dataTestId || label,
215
+ id: getNormalizedId(label || '')
216
+ }}
217
+ label={label}
218
+ placeholder={isNil(placeholder) ? t(searchLabel) : placeholder}
219
+ required={required}
220
+ value={inputValue || undefined}
221
+ onChange={onTextChange}
222
+ />
223
+ );
224
+
225
+ return (
226
+ <Autocomplete
227
+ disableClearable
228
+ classes={{
229
+ groupLabel: classes.inputLabel,
230
+ inputRoot: cx([
231
+ classes.input,
232
+ label ? classes.inputWithLabel : classes.inputWithoutLabel
233
+ ]),
234
+ popper: classes.popper,
235
+ root: classes.textfield
236
+ }}
237
+ forcePopupIcon={displayPopupIcon}
238
+ getOptionLabel={(option): string =>
239
+ (option as SelectEntry)?.name?.toString() || ''
240
+ }
241
+ isOptionEqualToValue={areSelectEntriesEqual}
242
+ loading={loading}
243
+ loadingText={<LoadingIndicator />}
244
+ options={options}
245
+ renderInput={renderInput}
246
+ renderOption={(props, option): JSX.Element => {
247
+ return (
248
+ <li
249
+ className={classes.options}
250
+ {...(props as React.HTMLAttributes<HTMLLIElement>)}
251
+ >
252
+ <Option
253
+ thumbnailUrl={displayOptionThumbnail ? option.url : undefined}
256
254
  >
257
- <Option
258
- thumbnailUrl={displayOptionThumbnail ? option.url : undefined}
259
- >
260
- {getOptionItemLabel(option)}
261
- </Option>
262
- </li>
263
- );
264
- }}
265
- size="small"
266
- {...autocompleteProps}
267
- />
268
- );
269
- }
270
- );
255
+ {getOptionItemLabel(option)}
256
+ </Option>
257
+ </li>
258
+ );
259
+ }}
260
+ size="small"
261
+ {...autocompleteProps}
262
+ />
263
+ );
264
+ };
271
265
 
272
266
  export default AutocompleteField;
@@ -73,14 +73,14 @@ const IconPopoverMultiAutocomplete = ({
73
73
  };
74
74
 
75
75
  const isSelected = (id: number | string): boolean => {
76
- return pipe(find(propEq(id, 'id')), Boolean)(value);
76
+ return pipe(find(propEq('id', id)), Boolean)(value);
77
77
  };
78
78
 
79
79
  const unSelect = (option: SelectEntry): void => {
80
80
  const { id } = option;
81
81
 
82
82
  const updatedValue = isSelected(id)
83
- ? reject(propEq(id, 'id'), value)
83
+ ? reject(propEq('id', id), value)
84
84
  : [...value, option];
85
85
 
86
86
  onChange(updatedValue);
@@ -69,7 +69,7 @@ const SelectField = ({
69
69
  const { classes, cx } = useStyles();
70
70
 
71
71
  const getOption = (id): SelectEntry => {
72
- return options.find(propEq(id, 'id')) as SelectEntry;
72
+ return options.find(propEq('id', id)) as SelectEntry;
73
73
  };
74
74
 
75
75
  const changeOption = (event): void => {