@centreon/ui 23.10.78 → 23.10.80

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": "23.10.78",
3
+ "version": "23.10.80",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
@@ -70,6 +70,7 @@ export const useDashboardItemStyles = makeStyles<{ hasHeader: boolean }>()(
70
70
  (theme, { hasHeader }) => ({
71
71
  widgetContainer: {
72
72
  height: '100%',
73
+ paddingBottom: theme.spacing(2),
73
74
  width: '100%'
74
75
  },
75
76
  widgetContent: {
@@ -89,7 +90,7 @@ export const useDashboardItemStyles = makeStyles<{ hasHeader: boolean }>()(
89
90
  },
90
91
  widgetPadding: {
91
92
  overflowX: 'auto',
92
- padding: hasHeader ? theme.spacing(1, 2, 2) : theme.spacing(1, 2)
93
+ padding: hasHeader ? theme.spacing(1, 2, 0) : theme.spacing(1, 2)
93
94
  }
94
95
  })
95
96
  );
@@ -134,7 +134,7 @@ const ResponsiveGauge = ({
134
134
  ...baseStyles,
135
135
  backgroundColor: theme.palette.background.paper,
136
136
  color: theme.palette.text.primary,
137
- transform: 'translate(-50%, 0)'
137
+ transform: 'translate(-50%, -24px)'
138
138
  }}
139
139
  top={(tooltipTop || 0) - svgTop + 20}
140
140
  >
@@ -127,47 +127,54 @@ const ResponsiveSingleBar = ({
127
127
  const springStyle = useSpring({ width: metricBarWidth });
128
128
 
129
129
  return (
130
- <Box
131
- sx={{
130
+ <div
131
+ style={{
132
132
  height: '100%',
133
- overflow: 'hidden',
134
- position: 'relative',
135
- width: '100%'
133
+ position: 'relative'
136
134
  }}
137
135
  >
138
- <svg height={height} ref={svgRef} width={width}>
139
- <Group.Group>
140
- {text}
141
- <animated.rect
142
- data-testid={`${latestMetricData}-bar-${barColor}`}
143
- fill={barColor}
144
- height={barHeights[size]}
145
- rx={4}
146
- style={springStyle}
147
- x={0}
148
- y={groupMargin + (isSmall ? 0 : 2 * margins.top)}
149
- />
150
- <Bar
151
- fill="transparent"
152
- height={barHeights[size]}
153
- rx={4}
154
- ry={4}
155
- stroke={alpha(theme.palette.text.primary, 0.3)}
156
- width={maxBarWidth}
157
- x={0}
158
- y={groupMargin + (isSmall ? 0 : 2 * margins.top)}
159
- />
160
- {thresholds.enabled && (
161
- <Thresholds
162
- hideTooltip={hideTooltip}
163
- showTooltip={showTooltip}
164
- size={size}
165
- thresholds={thresholds}
166
- xScale={xScale}
136
+ <Box
137
+ sx={{
138
+ height: '100%',
139
+ overflow: 'hidden',
140
+ position: 'relative',
141
+ width: '100%'
142
+ }}
143
+ >
144
+ <svg height={height} ref={svgRef} width={width}>
145
+ <Group.Group>
146
+ {text}
147
+ <animated.rect
148
+ data-testid={`${latestMetricData}-bar-${barColor}`}
149
+ fill={barColor}
150
+ height={barHeights[size]}
151
+ rx={4}
152
+ style={springStyle}
153
+ x={0}
154
+ y={groupMargin + (isSmall ? 0 : 2 * margins.top)}
155
+ />
156
+ <Bar
157
+ fill="transparent"
158
+ height={barHeights[size]}
159
+ rx={4}
160
+ ry={4}
161
+ stroke={alpha(theme.palette.text.primary, 0.3)}
162
+ width={maxBarWidth}
163
+ x={0}
164
+ y={groupMargin + (isSmall ? 0 : 2 * margins.top)}
167
165
  />
168
- )}
169
- </Group.Group>
170
- </svg>
166
+ {thresholds.enabled && (
167
+ <Thresholds
168
+ hideTooltip={hideTooltip}
169
+ showTooltip={showTooltip}
170
+ size={size}
171
+ thresholds={thresholds}
172
+ xScale={xScale}
173
+ />
174
+ )}
175
+ </Group.Group>
176
+ </svg>
177
+ </Box>
171
178
  <Fade in={tooltipOpen}>
172
179
  <Tooltip.Tooltip
173
180
  left={tooltipLeft}
@@ -175,7 +182,7 @@ const ResponsiveSingleBar = ({
175
182
  ...baseStyles,
176
183
  backgroundColor: theme.palette.background.paper,
177
184
  color: theme.palette.text.primary,
178
- transform: `translate(-50%, ${isSmall ? -60 : -20}px)`,
185
+ transform: `translate(-50%, ${isSmall ? -100 : -120}px)`,
179
186
  zIndex: theme.zIndex.tooltip
180
187
  }}
181
188
  top={tooltipTop}
@@ -183,7 +190,7 @@ const ResponsiveSingleBar = ({
183
190
  {tooltipData}
184
191
  </Tooltip.Tooltip>
185
192
  </Fade>
186
- </Box>
193
+ </div>
187
194
  );
188
195
  };
189
196
 
@@ -16,9 +16,6 @@ interface StyleProps {
16
16
  const useStyles = makeStyles<StyleProps>()(
17
17
  (theme, { minInputHeight, editable, error }) => ({
18
18
  container: {
19
- '& p': {
20
- margin: 0
21
- },
22
19
  backgroundColor: theme.palette.background.paper,
23
20
  border: error
24
21
  ? `1px solid ${theme.palette.error.main}`
@@ -41,6 +38,11 @@ const useStyles = makeStyles<StyleProps>()(
41
38
  placeholder: {
42
39
  color: theme.palette.grey[500],
43
40
  pointerEvents: 'none'
41
+ },
42
+ root: {
43
+ '& p,h1,h2,h3,h4,h5,h6,span': {
44
+ margin: 0
45
+ }
44
46
  }
45
47
  })
46
48
  );
@@ -121,11 +123,13 @@ const ContentEditable = ({
121
123
  const shouldResetEditorToInitialState =
122
124
  resetEditorToInitialStateCondition?.();
123
125
 
124
- if (!shouldResetEditorToInitialState || isNil(initialEditorState)) {
126
+ if (!shouldResetEditorToInitialState) {
125
127
  return;
126
128
  }
127
129
 
128
- const newEditorState = editor.parseEditorState(initialEditorState);
130
+ const newEditorState = editor.parseEditorState(
131
+ initialEditorState || defaultState
132
+ );
129
133
 
130
134
  editor.setEditorState(newEditorState);
131
135
  }, [editorState]);
@@ -156,7 +160,8 @@ const ContentEditable = ({
156
160
  return (
157
161
  <div
158
162
  className={cx(
159
- classes.container,
163
+ classes.root,
164
+ editable && classes.container,
160
165
  className,
161
166
  isFocused && classes.inputFocused
162
167
  )}
@@ -67,6 +67,13 @@ withEditableFalse.args = {
67
67
  initialEditorState: JSON.stringify(initialEditorState)
68
68
  };
69
69
 
70
+ export const Disabled = Template.bind({});
71
+ Disabled.args = {
72
+ disabled: true,
73
+ editable: false,
74
+ editorState: JSON.stringify(initialEditorState)
75
+ };
76
+
70
77
  const StoryWithEditableFalseLikePreview = (): JSX.Element => {
71
78
  const [editorState, setEditorState] =
72
79
  useState<EditorState>(initialEditorState);
@@ -59,9 +59,10 @@ export interface SubMenuProps {
59
59
  submenuTitle: string;
60
60
  to: string;
61
61
  }>;
62
+ onClose?: () => void;
62
63
  }
63
64
 
64
- const SubMenu = ({ items }: SubMenuProps): JSX.Element => {
65
+ const SubMenu = ({ items, onClose }: SubMenuProps): JSX.Element => {
65
66
  const { classes, theme } = useStyles();
66
67
 
67
68
  return (
@@ -80,6 +81,7 @@ const SubMenu = ({ items }: SubMenuProps): JSX.Element => {
80
81
  className={classes.submenuItem}
81
82
  key={to}
82
83
  role="none"
84
+ onClick={onClose}
83
85
  >
84
86
  <Link
85
87
  className={classes.link}
@@ -170,7 +170,7 @@ const TopCounterLayout = ({
170
170
  </Badge>
171
171
  </span>
172
172
  <span className={classes.textWrapper}>{title}</span>
173
- {toggled ? <ExpandMoreIcon /> : <ExpandLessIcon />}
173
+ {toggled ? <ExpandLessIcon /> : <ExpandMoreIcon />}
174
174
  </button>
175
175
  </div>
176
176
  <div