@centreon/ui 25.3.3 → 25.4.0-MON-191119-npm-develop.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 (187) hide show
  1. package/package.json +25 -11
  2. package/public/mockServiceWorker.js +8 -31
  3. package/src/ActionsList/index.tsx +1 -0
  4. package/src/Button/Icon/index.tsx +3 -1
  5. package/src/Button/Save/index.stories.tsx +1 -0
  6. package/src/Checkbox/Checkbox.tsx +3 -1
  7. package/src/Checkbox/CheckboxGroup/index.tsx +6 -1
  8. package/src/Colors/index.tsx +1 -1
  9. package/src/Dashboard/Dashboard.styles.ts +1 -1
  10. package/src/Dashboard/Layout.tsx +1 -1
  11. package/src/Dialog/UnsavedChanges/index.stories.tsx +1 -0
  12. package/src/Form/CollapsibleGroup.tsx +13 -13
  13. package/src/Form/Form.cypress.spec.tsx +137 -2
  14. package/src/Form/Form.stories.tsx +11 -31
  15. package/src/Form/Form.tsx +2 -0
  16. package/src/Form/Inputs/Checkbox.tsx +3 -2
  17. package/src/Form/Inputs/ConnectedAutocomplete.tsx +6 -1
  18. package/src/Form/Inputs/Grid.tsx +18 -29
  19. package/src/Form/Inputs/SubGroupDivider.tsx +7 -0
  20. package/src/Form/Inputs/Text.tsx +1 -0
  21. package/src/Form/Inputs/index.tsx +31 -24
  22. package/src/Form/Inputs/models.ts +8 -1
  23. package/src/Form/Section/FormSection.tsx +34 -0
  24. package/src/Form/Section/PanelTabs.tsx +13 -0
  25. package/src/Form/Section/navigateToSection.ts +9 -0
  26. package/src/Form/storiesData.tsx +14 -4
  27. package/src/Graph/BarChart/BarChart.cypress.spec.tsx +46 -6
  28. package/src/Graph/BarChart/BarChart.stories.tsx +60 -0
  29. package/src/Graph/BarChart/BarChart.tsx +56 -32
  30. package/src/Graph/BarChart/BarGroup.tsx +22 -32
  31. package/src/Graph/BarChart/MemoizedGroup.tsx +8 -11
  32. package/src/Graph/BarChart/ResponsiveBarChart.tsx +145 -32
  33. package/src/Graph/BarChart/Tooltip/BarChartTooltip.tsx +2 -2
  34. package/src/Graph/Chart/BasicComponents/Lines/StackedLines/index.tsx +7 -1
  35. package/src/Graph/Chart/BasicComponents/Lines/StackedLines/useStackedLines.ts +18 -45
  36. package/src/Graph/Chart/BasicComponents/Lines/index.tsx +42 -28
  37. package/src/Graph/Chart/Chart.cypress.spec.tsx +85 -15
  38. package/src/Graph/Chart/Chart.stories.tsx +84 -1
  39. package/src/Graph/Chart/Chart.tsx +17 -4
  40. package/src/Graph/Chart/InteractiveComponents/AnchorPoint/RegularAnchorPoint.tsx +8 -2
  41. package/src/Graph/Chart/InteractiveComponents/AnchorPoint/StackedAnchorPoint.tsx +10 -3
  42. package/src/Graph/Chart/InteractiveComponents/AnchorPoint/useTickGraph.ts +19 -2
  43. package/src/Graph/Chart/InteractiveComponents/Annotations/Annotation/index.tsx +1 -1
  44. package/src/Graph/Chart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +2 -4
  45. package/src/Graph/Chart/InteractiveComponents/ZoomPreview/index.tsx +14 -3
  46. package/src/Graph/Chart/InteractiveComponents/ZoomPreview/models.ts +3 -0
  47. package/src/Graph/Chart/InteractiveComponents/ZoomPreview/useZoomPreview.ts +12 -10
  48. package/src/Graph/Chart/InteractiveComponents/index.tsx +63 -5
  49. package/src/Graph/Chart/Legend/index.tsx +26 -2
  50. package/src/Graph/Chart/helpers/index.ts +4 -3
  51. package/src/Graph/Chart/index.tsx +45 -45
  52. package/src/Graph/Chart/models.ts +8 -0
  53. package/src/Graph/Chart/useChartData.ts +14 -2
  54. package/src/Graph/Gauge/Gauge.tsx +18 -14
  55. package/src/Graph/Gauge/ResponsiveGauge.tsx +10 -6
  56. package/src/Graph/Gauge/useResizeObserver.ts +68 -0
  57. package/src/Graph/SingleBar/ResponsiveSingleBar.tsx +18 -16
  58. package/src/Graph/SingleBar/ThresholdLine.tsx +4 -4
  59. package/src/Graph/SingleBar/models.ts +1 -0
  60. package/src/Graph/Text/Text.styles.ts +2 -2
  61. package/src/Graph/Text/Text.tsx +23 -10
  62. package/src/Graph/Timeline/ResponsiveTimeline.tsx +4 -0
  63. package/src/Graph/Timeline/Timeline.tsx +21 -4
  64. package/src/Graph/Tree/Links.tsx +2 -2
  65. package/src/Graph/Tree/Tree.tsx +2 -2
  66. package/src/Graph/Tree/constants.ts +1 -1
  67. package/src/Graph/common/BaseChart/BaseChart.tsx +6 -1
  68. package/src/Graph/common/BaseChart/ChartSvgWrapper.tsx +5 -4
  69. package/src/Graph/common/BaseChart/Header/index.tsx +3 -1
  70. package/src/Graph/common/BaseChart/useComputeBaseChartDimensions.ts +13 -9
  71. package/src/Graph/common/timeSeries/index.test.ts +20 -0
  72. package/src/Graph/common/timeSeries/index.ts +225 -44
  73. package/src/Graph/common/timeSeries/models.ts +6 -2
  74. package/src/Graph/common/utils.ts +45 -12
  75. package/src/Graph/index.ts +3 -1
  76. package/src/Graph/mockedData/dataWithMissingPoint.json +74 -0
  77. package/src/Graph/mockedData/pingServiceWithStackedKeys.json +205 -0
  78. package/src/Icon/RegexIcon.tsx +20 -0
  79. package/src/Icon/index.ts +1 -0
  80. package/src/InputField/Select/Autocomplete/Connected/Multi/MultiConnectedAutocompleteField.cypress.spec.tsx +68 -14
  81. package/src/InputField/Select/Autocomplete/Connected/index.tsx +49 -14
  82. package/src/InputField/Select/Autocomplete/Multi/Listbox.tsx +78 -0
  83. package/src/InputField/Select/Autocomplete/Multi/Multi.styles.ts +26 -0
  84. package/src/InputField/Select/Autocomplete/Multi/Multi.tsx +124 -0
  85. package/src/InputField/Select/Autocomplete/Multi/index.tsx +1 -117
  86. package/src/InputField/Select/Autocomplete/index.tsx +28 -17
  87. package/src/InputField/Select/Option.tsx +3 -3
  88. package/src/InputField/Select/index.tsx +4 -0
  89. package/src/InputField/Text/index.tsx +4 -2
  90. package/src/InputField/translatedLabels.ts +4 -0
  91. package/src/Listing/ActionBar/Pagination.tsx +10 -23
  92. package/src/Listing/ActionBar/PaginationActions.tsx +1 -10
  93. package/src/Listing/ActionBar/index.tsx +1 -1
  94. package/src/Listing/Cell/DataCell.tsx +6 -6
  95. package/src/Listing/Cell/EllipsisTypography.tsx +10 -32
  96. package/src/Listing/Cell/index.tsx +57 -89
  97. package/src/Listing/Checkbox.tsx +8 -20
  98. package/src/Listing/Header/Cell/ListingHeaderCell.tsx +17 -14
  99. package/src/Listing/Header/Cell/SelectActionListingHeaderCell.tsx +5 -9
  100. package/src/Listing/Header/ListingHeader.tsx +2 -5
  101. package/src/Listing/Header/_internals/Label.tsx +1 -17
  102. package/src/Listing/Row/EmptyRow.tsx +2 -6
  103. package/src/Listing/Row/Row.tsx +7 -36
  104. package/src/Listing/index.stories.tsx +1 -0
  105. package/src/Listing/index.tsx +26 -26
  106. package/src/Listing/useStyleTable.ts +58 -32
  107. package/src/ListingPage/index.stories.tsx +1 -0
  108. package/src/Module/index.tsx +8 -2
  109. package/src/MultiSelectEntries/index.stories.tsx +1 -0
  110. package/src/MultiSelectEntries/index.tsx +1 -1
  111. package/src/Pagination/Pagination.cypress.spec.tsx +137 -0
  112. package/src/Pagination/Pagination.stories.tsx +46 -0
  113. package/src/Pagination/Pagination.styles.ts +56 -0
  114. package/src/Pagination/Pagination.tsx +146 -0
  115. package/src/Pagination/index.ts +3 -0
  116. package/src/Pagination/utils.ts +7 -0
  117. package/src/SortableItems/index.stories.tsx +2 -2
  118. package/src/StoryBookThemeProvider/index.tsx +3 -1
  119. package/src/ThemeProvider/base.css +49 -0
  120. package/src/ThemeProvider/index.tsx +21 -47
  121. package/src/ThemeProvider/palettes.ts +5 -3
  122. package/src/ThemeProvider/tailwindcss.css +230 -0
  123. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +9 -11
  124. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +1 -0
  125. package/src/TimePeriods/DateTimePickerInput.tsx +3 -1
  126. package/src/api/customFetch.ts +0 -9
  127. package/src/api/models.ts +9 -0
  128. package/src/api/useBulkResponse.ts +58 -0
  129. package/src/api/useGraphQuery/index.ts +108 -12
  130. package/src/components/Avatar/Avatar.stories.tsx +1 -0
  131. package/src/components/Button/Button.module.css +38 -0
  132. package/src/components/Button/Button.stories.tsx +25 -0
  133. package/src/components/Button/Button.tsx +2 -5
  134. package/src/components/CrudPage/Actions/Actions.styles.ts +15 -1
  135. package/src/components/CrudPage/Actions/Actions.tsx +7 -4
  136. package/src/components/CrudPage/Actions/Search.tsx +15 -14
  137. package/src/components/CrudPage/CrudPage.stories.tsx +1 -0
  138. package/src/components/CrudPage/CrudPageRoot.tsx +1 -1
  139. package/src/components/DataTable/DataTable.stories.tsx +1 -0
  140. package/src/components/DataTable/EmptyState/DataTableEmptyState.stories.tsx +1 -0
  141. package/src/components/DataTable/EmptyState/DataTableEmptyState.styles.ts +3 -1
  142. package/src/components/DataTable/EmptyState/DataTableEmptyState.tsx +4 -1
  143. package/src/components/DataTable/Item/DataTableItem.stories.tsx +1 -0
  144. package/src/components/Form/AccessRights/AccessRights.stories.tsx +1 -0
  145. package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +4 -3
  146. package/src/components/Form/AccessRights/ShareInput/useShareInput.tsx +15 -10
  147. package/src/components/Form/FormActions.tsx +21 -12
  148. package/src/components/Header/PageHeader/PageHeader.styles.ts +5 -5
  149. package/src/components/Layout/AreaIndicator.tsx +4 -6
  150. package/src/components/Layout/PageLayout/PageLayout.stories.tsx +1 -0
  151. package/src/components/Layout/PageLayout/PageLayout.styles.ts +1 -1
  152. package/src/components/Layout/PageLayout/PageLayout.tsx +9 -3
  153. package/src/components/Layout/PageLayout/PageLayoutActions.tsx +5 -3
  154. package/src/components/Layout/PageLayout/PageLayoutBody.tsx +5 -3
  155. package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +5 -3
  156. package/src/components/Layout/PageLayout/PageQuickAccess.tsx +17 -17
  157. package/src/components/Menu/Button/MenuButton.tsx +6 -6
  158. package/src/components/Menu/MenuDivider.tsx +1 -5
  159. package/src/components/Menu/MenuItem.tsx +1 -5
  160. package/src/components/Menu/MenuItems.tsx +5 -4
  161. package/src/components/Modal/ConfirmationModal/ConfirmationModal.stories.tsx +1 -0
  162. package/src/components/Modal/ConfirmationModal/ConfirmationModal.tsx +4 -1
  163. package/src/components/Modal/Modal.stories.tsx +21 -0
  164. package/src/components/Modal/Modal.styles.ts +1 -19
  165. package/src/components/Modal/Modal.tsx +1 -1
  166. package/src/components/Modal/ModalBody.tsx +6 -4
  167. package/src/components/Modal/ModalHeader.tsx +9 -5
  168. package/src/components/Modal/modal.module.css +16 -0
  169. package/src/components/Tabs/Tab.styles.ts +0 -6
  170. package/src/components/Tabs/Tabs.tsx +37 -15
  171. package/src/index.ts +4 -0
  172. package/src/queryParameters/url/index.ts +7 -2
  173. package/src/utils/index.ts +1 -0
  174. package/src/utils/useLocale/index.ts +9 -0
  175. package/src/utils/useLocale/useLocale.cypress.spec.tsx +38 -0
  176. package/src/utils/useLocaleDateTimeFormat/index.ts +4 -2
  177. package/src/utils/usePluralizedTranslation.ts +2 -3
  178. package/src/Listing/Cell/DataCell.styles.ts +0 -27
  179. package/src/Listing/Header/Cell/ListingHeaderCell.styles.ts +0 -71
  180. package/src/Listing/Header/Cell/SelectActionListingHeaderCell.styles.ts +0 -26
  181. package/src/Listing/Header/ListingHeader.styles.ts +0 -16
  182. package/src/Listing/Listing.styles.ts +0 -78
  183. package/src/Listing/Row/EmptyRow.styles.ts +0 -14
  184. package/src/components/Button/Button.styles.ts +0 -44
  185. package/src/components/Layout/AreaIndicator.styles.ts +0 -33
  186. package/src/components/Menu/Button/MenuButton.styles.ts +0 -27
  187. package/src/components/Menu/Menu.styles.ts +0 -68
@@ -0,0 +1,124 @@
1
+ import { compose, includes, map, prop, reject, sortBy, toLower } from 'ramda';
2
+ import { JSX } from 'react';
3
+
4
+ import { Chip, ChipProps, Tooltip } from '@mui/material';
5
+ import { UseAutocompleteProps } from '@mui/material/useAutocomplete';
6
+
7
+ import Autocomplete, { Props as AutocompleteProps } from '..';
8
+ import { SelectEntry } from '../..';
9
+ import Option from '../../Option';
10
+ import ListboxComponent from './Listbox';
11
+ import { useStyles } from './Multi.styles';
12
+
13
+ type Multiple = boolean;
14
+ type DisableClearable = boolean;
15
+ type FreeSolo = boolean;
16
+
17
+ export interface Props
18
+ extends Omit<AutocompleteProps, 'renderTags' | 'renderOption' | 'multiple'>,
19
+ Omit<
20
+ UseAutocompleteProps<SelectEntry, Multiple, DisableClearable, FreeSolo>,
21
+ 'multiple'
22
+ > {
23
+ chipProps?: ChipProps;
24
+ disableSortedOptions?: boolean;
25
+ disableSelectAll?: boolean;
26
+ getOptionTooltipLabel?: (option) => string;
27
+ getTagLabel?: (option) => string;
28
+ optionProperty?: string;
29
+ customRenderTags?: (tags: React.ReactNode) => React.ReactNode;
30
+ total?: number;
31
+ }
32
+
33
+ const MultiAutocompleteField = ({
34
+ value,
35
+ options,
36
+ disableSortedOptions = false,
37
+ disableSelectAll = true,
38
+ optionProperty = 'name',
39
+ getOptionLabel = (option): string => option.name,
40
+ getTagLabel = (option): string => option[optionProperty],
41
+ getOptionTooltipLabel,
42
+ chipProps,
43
+ customRenderTags,
44
+ onChange,
45
+ total,
46
+ ...props
47
+ }: Props): JSX.Element => {
48
+ const { classes } = useStyles();
49
+
50
+ const renderTags = (renderedValue, getTagProps): Array<JSX.Element> =>
51
+ renderedValue.map((option, index) => {
52
+ return (
53
+ <Tooltip
54
+ key={option.id}
55
+ placement="top"
56
+ title={getOptionTooltipLabel?.(option)}
57
+ >
58
+ <Chip
59
+ classes={{
60
+ deleteIcon: classes.deleteIcon,
61
+ root: classes.tag
62
+ }}
63
+ data-testid={`tag-option-chip-${option.id}`}
64
+ label={getTagLabel(option)}
65
+ size="medium"
66
+ {...getTagProps({ index })}
67
+ {...chipProps}
68
+ onDelete={(event) => chipProps?.onDelete?.(event, option)}
69
+ />
70
+ </Tooltip>
71
+ );
72
+ });
73
+
74
+ const getLimitTagsText = (more): JSX.Element => <Option>{`+${more}`}</Option>;
75
+
76
+ const values = (value as Array<SelectEntry>) || [];
77
+
78
+ const isOptionSelected = ({ id }): boolean => {
79
+ const valueIds = map(prop('id'), values);
80
+
81
+ return includes(id, valueIds);
82
+ };
83
+
84
+ const sortByName = sortBy(compose(toLower, prop(optionProperty)));
85
+
86
+ const autocompleteOptions = disableSortedOptions
87
+ ? options
88
+ : sortByName([...values, ...reject(isOptionSelected, options)]);
89
+
90
+ return (
91
+ <Autocomplete
92
+ disableCloseOnSelect
93
+ displayOptionThumbnail
94
+ multiple
95
+ getLimitTagsText={getLimitTagsText}
96
+ options={autocompleteOptions}
97
+ renderOption={(renderProps, option, { selected }): JSX.Element => (
98
+ <li
99
+ key={option.id}
100
+ {...(renderProps as React.HTMLAttributes<HTMLLIElement>)}
101
+ >
102
+ <Option checkboxSelected={selected}>{getOptionLabel(option)}</Option>
103
+ </li>
104
+ )}
105
+ value={values}
106
+ renderTags={(renderedValue, getTagProps): React.ReactNode =>
107
+ customRenderTags
108
+ ? customRenderTags(renderTags(renderedValue, getTagProps))
109
+ : renderTags(renderedValue, getTagProps)
110
+ }
111
+ ListboxComponent={ListboxComponent({
112
+ total,
113
+ onChange,
114
+ isOptionSelected,
115
+ disableSelectAll,
116
+ options
117
+ })}
118
+ onChange={onChange}
119
+ {...props}
120
+ />
121
+ );
122
+ };
123
+
124
+ export default MultiAutocompleteField;
@@ -1,119 +1,3 @@
1
- import { compose, includes, map, prop, reject, sortBy, toLower } from 'ramda';
2
- import { makeStyles } from 'tss-react/mui';
3
-
4
- import { Chip, ChipProps, Tooltip } from '@mui/material';
5
- import { UseAutocompleteProps } from '@mui/material/useAutocomplete';
6
-
7
- import Autocomplete, { Props as AutocompleteProps } from '..';
8
- import { SelectEntry } from '../..';
9
- import Option from '../../Option';
10
-
11
- const useStyles = makeStyles()((theme) => ({
12
- deleteIcon: {
13
- height: theme.spacing(1.5),
14
- width: theme.spacing(1.5)
15
- },
16
- tag: {
17
- fontSize: theme.typography.caption.fontSize
18
- }
19
- }));
20
-
21
- type Multiple = boolean;
22
- type DisableClearable = boolean;
23
- type FreeSolo = boolean;
24
-
25
- export interface Props
26
- extends Omit<AutocompleteProps, 'renderTags' | 'renderOption' | 'multiple'>,
27
- Omit<
28
- UseAutocompleteProps<SelectEntry, Multiple, DisableClearable, FreeSolo>,
29
- 'multiple'
30
- > {
31
- chipProps?: ChipProps;
32
- disableSortedOptions?: boolean;
33
- getOptionTooltipLabel?: (option) => string;
34
- getTagLabel?: (option) => string;
35
- optionProperty?: string;
36
- customRenderTags?: (tags: React.ReactNode) => React.ReactNode;
37
- }
38
-
39
- const MultiAutocompleteField = ({
40
- value,
41
- options,
42
- disableSortedOptions = false,
43
- optionProperty = 'name',
44
- getOptionLabel = (option): string => option.name,
45
- getTagLabel = (option): string => option[optionProperty],
46
- getOptionTooltipLabel,
47
- chipProps,
48
- customRenderTags,
49
- ...props
50
- }: Props): JSX.Element => {
51
- const { classes } = useStyles();
52
-
53
- const renderTags = (renderedValue, getTagProps): Array<JSX.Element> =>
54
- renderedValue.map((option, index) => {
55
- return (
56
- <Tooltip
57
- key={option.id}
58
- placement="top"
59
- title={getOptionTooltipLabel?.(option)}
60
- >
61
- <Chip
62
- classes={{
63
- deleteIcon: classes.deleteIcon,
64
- root: classes.tag
65
- }}
66
- data-testid={`tag-option-chip-${option.id}`}
67
- label={getTagLabel(option)}
68
- size="medium"
69
- {...getTagProps({ index })}
70
- {...chipProps}
71
- onDelete={(event) => chipProps?.onDelete?.(event, option)}
72
- />
73
- </Tooltip>
74
- );
75
- });
76
-
77
- const getLimitTagsText = (more): JSX.Element => <Option>{`+${more}`}</Option>;
78
-
79
- const values = (value as Array<SelectEntry>) || [];
80
-
81
- const isOptionSelected = ({ id }): boolean => {
82
- const valueIds = map(prop('id'), values);
83
-
84
- return includes(id, valueIds);
85
- };
86
-
87
- const sortByName = sortBy(compose(toLower, prop(optionProperty)));
88
-
89
- const autocompleteOptions = disableSortedOptions
90
- ? options
91
- : sortByName([...values, ...reject(isOptionSelected, options)]);
92
-
93
- return (
94
- <Autocomplete
95
- disableCloseOnSelect
96
- displayOptionThumbnail
97
- multiple
98
- getLimitTagsText={getLimitTagsText}
99
- options={autocompleteOptions}
100
- renderOption={(renderProps, option, { selected }): JSX.Element => (
101
- <li
102
- key={option.id}
103
- {...(renderProps as React.HTMLAttributes<HTMLLIElement>)}
104
- >
105
- <Option checkboxSelected={selected}>{getOptionLabel(option)}</Option>
106
- </li>
107
- )}
108
- renderTags={(renderedValue, getTagProps): React.ReactNode =>
109
- customRenderTags
110
- ? customRenderTags(renderTags(renderedValue, getTagProps))
111
- : renderTags(renderedValue, getTagProps)
112
- }
113
- value={value}
114
- {...props}
115
- />
116
- );
117
- };
1
+ import MultiAutocompleteField from './Multi';
118
2
 
119
3
  export default MultiAutocompleteField;
@@ -13,6 +13,7 @@ import { AutocompleteSlotsAndSlotProps } from '@mui/material/Autocomplete';
13
13
  import { TextFieldSlotsAndSlotProps } from '@mui/material/TextField';
14
14
  import { UseAutocompleteProps } from '@mui/material/useAutocomplete';
15
15
 
16
+ import type { AutocompleteRenderOptionState } from '@mui/material/Autocomplete';
16
17
  import { ForwardedRef, HTMLAttributes, ReactElement, forwardRef } from 'react';
17
18
  import { SelectEntry } from '..';
18
19
  import { getNormalizedId } from '../../../utils';
@@ -33,6 +34,11 @@ export type Props = {
33
34
  error?: string;
34
35
  getOptionItemLabel?: (option) => string;
35
36
  hideInput?: boolean;
37
+ renderOption?: (
38
+ renderProps: HTMLAttributes<HTMLLIElement>,
39
+ option: SelectEntry,
40
+ state: AutocompleteRenderOptionState
41
+ ) => ReactElement;
36
42
  label: string;
37
43
  loading?: boolean;
38
44
  onTextChange?;
@@ -52,7 +58,7 @@ export type Props = {
52
58
  > &
53
59
  UseAutocompleteProps<SelectEntry, Multiple, DisableClearable, FreeSolo>;
54
60
 
55
- const LoadingIndicator = (): JSX.Element => {
61
+ const LoadingIndicator = (): ReactElement => {
56
62
  const { classes } = useAutoCompleteStyles({});
57
63
 
58
64
  return (
@@ -90,10 +96,11 @@ const AutocompleteField = forwardRef(
90
96
  forceInputRenderValue = false,
91
97
  textFieldSlotsAndSlotProps,
92
98
  autocompleteSlotsAndSlotProps,
99
+ renderOption,
93
100
  ...autocompleteProps
94
101
  }: Props,
95
102
  ref?: ForwardedRef<HTMLDivElement>
96
- ): JSX.Element => {
103
+ ): ReactElement => {
97
104
  const { classes, cx } = useAutoCompleteStyles({ hideInput });
98
105
  const { t } = useTranslation();
99
106
  const theme = useTheme();
@@ -107,7 +114,24 @@ const AutocompleteField = forwardRef(
107
114
  );
108
115
  };
109
116
 
110
- const renderInput = (params): JSX.Element => {
117
+ const renderOptions = renderOption
118
+ ? renderOption
119
+ : (props, option): ReactElement => {
120
+ return (
121
+ <li
122
+ className={classes.options}
123
+ {...(props as HTMLAttributes<HTMLLIElement>)}
124
+ >
125
+ <Option
126
+ thumbnailUrl={displayOptionThumbnail ? option.url : undefined}
127
+ >
128
+ {getOptionItemLabel(option)}
129
+ </Option>
130
+ </li>
131
+ );
132
+ };
133
+
134
+ const renderInput = (params): ReactElement => {
111
135
  return (
112
136
  <TextField
113
137
  {...params}
@@ -202,20 +226,7 @@ const AutocompleteField = forwardRef(
202
226
  options={options}
203
227
  ref={ref}
204
228
  renderInput={renderInput}
205
- renderOption={(props, option): JSX.Element => {
206
- return (
207
- <li
208
- className={classes.options}
209
- {...(props as HTMLAttributes<HTMLLIElement>)}
210
- >
211
- <Option
212
- thumbnailUrl={displayOptionThumbnail ? option.url : undefined}
213
- >
214
- {getOptionItemLabel(option)}
215
- </Option>
216
- </li>
217
- );
218
- }}
229
+ renderOption={renderOptions}
219
230
  size="small"
220
231
  slotProps={{
221
232
  ...autocompleteSlotsAndSlotProps?.slotProps,
@@ -1,4 +1,4 @@
1
- import { RefObject, forwardRef } from 'react';
1
+ import { ReactElement, RefObject, forwardRef } from 'react';
2
2
 
3
3
  import { equals, isNil } from 'ramda';
4
4
  import { makeStyles } from 'tss-react/mui';
@@ -28,12 +28,12 @@ const useStyles = makeStyles()((theme) => ({
28
28
 
29
29
  interface Props {
30
30
  checkboxSelected?: boolean;
31
- children: string;
31
+ children: string | ReactElement;
32
32
  thumbnailUrl?: string;
33
33
  }
34
34
 
35
35
  const Option = forwardRef(
36
- ({ children, checkboxSelected, thumbnailUrl }: Props, ref): JSX.Element => {
36
+ ({ children, checkboxSelected, thumbnailUrl }: Props, ref): ReactElement => {
37
37
  const { classes } = useStyles();
38
38
 
39
39
  return (
@@ -4,6 +4,7 @@ import { makeStyles } from 'tss-react/mui';
4
4
  import {
5
5
  Divider,
6
6
  FormControl,
7
+ FormControlProps,
7
8
  FormHelperText,
8
9
  InputLabel,
9
10
  ListSubheader,
@@ -59,6 +60,7 @@ type Props = {
59
60
  onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
60
61
  options: Array<SelectEntry>;
61
62
  selectedOptionId: number | string;
63
+ formControlProps: FormControlProps;
62
64
  } & Omit<SelectProps, 'error'>;
63
65
 
64
66
  const SelectField = ({
@@ -72,6 +74,7 @@ const SelectField = ({
72
74
  ariaLabel,
73
75
  inputProps,
74
76
  compact = false,
77
+ formControlProps,
75
78
  ...props
76
79
  }: Props): JSX.Element => {
77
80
  const { classes, cx } = useStyles();
@@ -92,6 +95,7 @@ const SelectField = ({
92
95
  error={!isNil(error)}
93
96
  fullWidth={fullWidth}
94
97
  size="small"
98
+ {...formControlProps}
95
99
  >
96
100
  {label && <InputLabel>{label}</InputLabel>}
97
101
  <Select
@@ -98,6 +98,7 @@ export type TextProps = {
98
98
  transparent?: boolean;
99
99
  value?: string;
100
100
  textFieldSlotsAndSlotProps?: TextFieldSlotsAndSlotProps<InputProps>;
101
+ forceUncontrolled?: boolean;
101
102
  } & Omit<TextFieldProps, 'variant' | 'size' | 'error'>;
102
103
 
103
104
  const TextField = forwardRef(
@@ -123,6 +124,7 @@ const TextField = forwardRef(
123
124
  containerClassName,
124
125
  type,
125
126
  textFieldSlotsAndSlotProps,
127
+ forceUncontrolled,
126
128
  ...rest
127
129
  }: TextProps,
128
130
  ref: React.ForwardedRef<HTMLDivElement>
@@ -141,7 +143,7 @@ const TextField = forwardRef(
141
143
  const tooltipTitle = displayErrorInTooltip && !isNil(error) ? error : '';
142
144
 
143
145
  const getValueProps = useCallback((): object => {
144
- if (debounced) {
146
+ if (debounced || forceUncontrolled) {
145
147
  return {};
146
148
  }
147
149
  if (defaultValue) {
@@ -149,7 +151,7 @@ const TextField = forwardRef(
149
151
  }
150
152
 
151
153
  return { value: innerValue };
152
- }, [innerValue, debounced, defaultValue]);
154
+ }, [innerValue, debounced, defaultValue, forceUncontrolled]);
153
155
 
154
156
  return (
155
157
  <Box
@@ -1,3 +1,7 @@
1
1
  export const searchLabel = 'Search';
2
2
  export const labelOpen = 'Open';
3
3
  export const labelClear = 'Clear';
4
+
5
+ export const labelSelectAll = 'Select all';
6
+ export const labelUnSelectAll = 'Unselect all';
7
+ export const labelElementsFound = '{{total}} element(s) found';
@@ -1,32 +1,19 @@
1
1
  import { memo } from 'react';
2
2
 
3
3
  import { equals } from 'ramda';
4
- import { makeStyles } from 'tss-react/mui';
5
4
 
6
5
  import TablePagination from '@mui/material/TablePagination';
7
6
 
8
- const useStyles = makeStyles()((theme) => ({
9
- toolbar: {
10
- height: theme.spacing(4),
11
- overflow: 'hidden',
12
- paddingLeft: 5
13
- }
14
- }));
15
-
16
- const Pagination = (props): JSX.Element => {
17
- const { classes } = useStyles();
18
-
19
- return (
20
- <TablePagination
21
- classes={{
22
- toolbar: classes.toolbar
23
- }}
24
- component="div"
25
- data-testid="Listing Pagination"
26
- {...props}
27
- />
28
- );
29
- };
7
+ const Pagination = (props): JSX.Element => (
8
+ <TablePagination
9
+ classes={{
10
+ toolbar: 'pl-1 overflow-hidden h-8'
11
+ }}
12
+ component="div"
13
+ data-testid="Listing Pagination"
14
+ {...props}
15
+ />
16
+ );
30
17
 
31
18
  const MemoizedPagination = memo(
32
19
  Pagination,
@@ -1,5 +1,4 @@
1
1
  import { useTranslation } from 'react-i18next';
2
- import { makeStyles } from 'tss-react/mui';
3
2
 
4
3
  import FirstPageIcon from '@mui/icons-material/FirstPage';
5
4
  import KeyboardArrowLeft from '@mui/icons-material/KeyboardArrowLeft';
@@ -15,20 +14,12 @@ import {
15
14
  labelPreviousPage
16
15
  } from '../translatedLabels';
17
16
 
18
- const useStyles = makeStyles()((theme) => ({
19
- root: {
20
- color: theme.palette.text.secondary,
21
- flexShrink: 0
22
- }
23
- }));
24
-
25
17
  const PaginationActions = ({
26
18
  onPageChange,
27
19
  page,
28
20
  rowsPerPage,
29
21
  count
30
22
  }: TablePaginationActionsProps): JSX.Element => {
31
- const { classes } = useStyles();
32
23
  const { t } = useTranslation();
33
24
 
34
25
  const changeToFirstPage = (event): void => {
@@ -53,7 +44,7 @@ const PaginationActions = ({
53
44
  };
54
45
 
55
46
  return (
56
- <div className={classes.root}>
47
+ <div className="shrink-0 text-text-secondary">
57
48
  <IconButton
58
49
  aria-label={t(labelFirstPage) || ''}
59
50
  disabled={isFirstPage}
@@ -29,7 +29,7 @@ const useStyles = makeStyles<StyleProps>()(
29
29
  },
30
30
  actions: {
31
31
  flex: 1,
32
- padding: theme.spacing(1, 0)
32
+ padding: theme.spacing(1, 1, 1, 0)
33
33
  },
34
34
  container: {
35
35
  alignItems: 'center',
@@ -14,7 +14,6 @@ import {
14
14
  } from '../models';
15
15
  import useStyleTable from '../useStyleTable';
16
16
 
17
- import { useStyles } from './DataCell.styles';
18
17
  import EllipsisTypography from './EllipsisTypography';
19
18
 
20
19
  import Cell from '.';
@@ -46,7 +45,6 @@ const DataCell = ({
46
45
  labelCollapse,
47
46
  labelExpand
48
47
  }: Props): JSX.Element | null => {
49
- const { classes, cx } = useStyles();
50
48
  const { dataStyle } = useStyleTable({ listingVariant });
51
49
 
52
50
  const commonCellProps = {
@@ -78,12 +76,13 @@ const DataCell = ({
78
76
  disableRowCondition={disableRowCondition(row)}
79
77
  formattedString={formattedString}
80
78
  isRowHovered={isRowHovered}
79
+ isRowHighlighted={isRowHighlighted}
81
80
  />
82
81
  );
83
82
 
84
83
  return (
85
84
  <Cell
86
- className={classes.cell}
85
+ className="flex items-center h-full overflow-hidden whitespace-nowrap"
87
86
  isRowHighlighted={isRowHighlighted}
88
87
  listingVariant={listingVariant}
89
88
  style={{
@@ -110,7 +109,7 @@ const DataCell = ({
110
109
  if (isCellHidden) {
111
110
  return (
112
111
  <Cell
113
- className={classes.cell}
112
+ className="flex items-center h-full overflow-hidden whitespace-nowrap"
114
113
  isRowHighlighted={isRowHighlighted}
115
114
  listingVariant={listingVariant}
116
115
  onClick={(e): void => {
@@ -127,7 +126,7 @@ const DataCell = ({
127
126
 
128
127
  return (
129
128
  <Cell
130
- className={cx(classes.cell, clickable && classes.clickable)}
129
+ className={`flex align-items h-full overflow-hidden whitespace-nowrap ${clickable && 'cursor-default'}`}
131
130
  isRowHighlighted={isRowHighlighted}
132
131
  listingVariant={listingVariant}
133
132
  style={{
@@ -156,6 +155,7 @@ const DataCell = ({
156
155
  disableRowCondition={disableRowCondition(row)}
157
156
  formattedString={formattedString}
158
157
  isRowHovered={isRowHovered}
158
+ isRowHighlighted={isRowHighlighted}
159
159
  />
160
160
  );
161
161
  }}
@@ -280,4 +280,4 @@ const MemoizedDataCell = memo<Props>(
280
280
  );
281
281
 
282
282
  export default MemoizedDataCell;
283
- export { useStyles, type Props };
283
+ export type { Props };
@@ -1,50 +1,28 @@
1
- import { makeStyles } from 'tss-react/mui';
2
-
3
1
  import { Typography } from '@mui/material';
4
2
 
5
3
  import { TableStyleAtom as TableStyle } from '../models';
6
4
 
7
- interface StylesProps {
8
- body: TableStyle['body'];
9
- }
10
-
11
- const useStyles = makeStyles<StylesProps>()((theme, { body }) => ({
12
- rowNotHovered: {
13
- color: theme.palette.text.secondary
14
- },
15
- text: {
16
- fontSize: body.fontSize,
17
- overflow: 'hidden',
18
- textOverflow: 'ellipsis',
19
- whiteSpace: 'nowrap'
20
- }
21
- }));
22
-
23
5
  interface Ellipsis {
24
6
  className?: string;
25
7
  dataStyle: TableStyle;
26
8
  disableRowCondition: boolean;
27
9
  formattedString: string;
28
10
  isRowHovered: boolean;
11
+ isRowHighlighted?: boolean;
29
12
  }
30
13
  const EllipsisTypography = ({
31
14
  formattedString,
32
15
  isRowHovered,
33
16
  disableRowCondition,
34
17
  className,
35
- dataStyle
36
- }: Ellipsis): JSX.Element => {
37
- const { cx, classes } = useStyles({ body: dataStyle.body });
38
-
39
- return (
40
- <Typography
41
- className={cx(className, classes.text, {
42
- [classes.rowNotHovered]: !isRowHovered || disableRowCondition
43
- })}
44
- >
45
- {formattedString}
46
- </Typography>
47
- );
48
- };
18
+ dataStyle,
19
+ isRowHighlighted
20
+ }: Ellipsis): JSX.Element => (
21
+ <Typography
22
+ className={`${className} text-[${dataStyle.body.fontSize}] truncate ${!isRowHighlighted && (!isRowHovered || disableRowCondition) && 'text-text-secondary'}`}
23
+ >
24
+ {formattedString}
25
+ </Typography>
26
+ );
49
27
 
50
28
  export default EllipsisTypography;