@lunit/oui 2.2.21 → 2.2.22
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.
|
@@ -10,52 +10,24 @@ function EllipsisTypography({ children, heightThreshold: heightThresholdProp, to
|
|
|
10
10
|
const [showTooltip, setShowTooltip] = useState(false);
|
|
11
11
|
const { addResizeHandler, removeResizeHandler } = useContext(ResizeObserverContext);
|
|
12
12
|
useEffect(() => {
|
|
13
|
-
if (typographyRef.current)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
showTooltip) {
|
|
23
|
-
setShowTooltip(false);
|
|
24
|
-
}
|
|
25
|
-
break;
|
|
26
|
-
case 'column':
|
|
27
|
-
default:
|
|
28
|
-
if (target.scrollHeight - target.clientHeight > heightThreshold && !showTooltip) {
|
|
29
|
-
setShowTooltip(true);
|
|
30
|
-
}
|
|
31
|
-
else if (target.scrollHeight - target.clientHeight <= heightThreshold &&
|
|
32
|
-
showTooltip) {
|
|
33
|
-
setShowTooltip(false);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
if (addResizeHandler) {
|
|
38
|
-
console.log(addResizeHandler);
|
|
39
|
-
addResizeHandler(target, resizeHandler);
|
|
40
|
-
}
|
|
41
|
-
return () => {
|
|
42
|
-
if (removeResizeHandler)
|
|
43
|
-
removeResizeHandler(target);
|
|
44
|
-
};
|
|
13
|
+
if (!typographyRef.current)
|
|
14
|
+
return;
|
|
15
|
+
const target = typographyRef.current;
|
|
16
|
+
const checkOverflow = () => {
|
|
17
|
+
const isOverflowing = target.scrollHeight - target.clientHeight > heightThreshold;
|
|
18
|
+
setShowTooltip(isOverflowing);
|
|
19
|
+
};
|
|
20
|
+
if (addResizeHandler) {
|
|
21
|
+
addResizeHandler(target, checkOverflow);
|
|
45
22
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
console.log(showTooltip);
|
|
56
|
-
if (showTooltip) {
|
|
57
|
-
return (_jsx(Tooltip, { title: children, placement: tooltipPlacement, size: "small", children: _jsx(StyledTypography, { ...otherProps, ref: typographyRef, direction: direction, maxLines: maxLines, children: children }) }));
|
|
58
|
-
}
|
|
59
|
-
return (_jsx(StyledTypography, { ...otherProps, ref: typographyRef, direction: direction, maxLines: maxLines, children: children }));
|
|
23
|
+
checkOverflow();
|
|
24
|
+
return () => {
|
|
25
|
+
if (removeResizeHandler) {
|
|
26
|
+
removeResizeHandler(target);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}, [heightThreshold, addResizeHandler, removeResizeHandler]);
|
|
30
|
+
const TypographyComponent = (_jsx(StyledTypography, { ...otherProps, ref: typographyRef, direction: direction, maxLines: maxLines, children: children }));
|
|
31
|
+
return showTooltip ? (_jsx(Tooltip, { title: children, placement: tooltipPlacement, size: "small", children: TypographyComponent })) : (TypographyComponent);
|
|
60
32
|
}
|
|
61
33
|
export default EllipsisTypography;
|
|
@@ -99,7 +99,9 @@ const segmentStyle = (color, width, square) => {
|
|
|
99
99
|
export const GraphSegment = styled('span', {
|
|
100
100
|
shouldForwardProp: (prop) => !['color', 'width', 'square'].includes(prop.toString()),
|
|
101
101
|
})(({ color, width, square }) => {
|
|
102
|
+
// cover undefined and empty string
|
|
103
|
+
const barColor = color && color.length ? color : 'red';
|
|
102
104
|
return {
|
|
103
|
-
...segmentStyle(
|
|
105
|
+
...segmentStyle(barColor, width, square ?? false), // fallback color
|
|
104
106
|
};
|
|
105
107
|
});
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Typography } from '@mui/material';
|
|
3
2
|
import { calculateFontSize, doBorderRadius } from './Histogram.utils';
|
|
4
3
|
import { HistogramTabsContainer, TabButton } from './Histogram.styled';
|
|
4
|
+
import { EllipsisTypography } from '../../components';
|
|
5
5
|
const HistogramTabs = ({ options, active, onChange }) => {
|
|
6
6
|
return (_jsx(HistogramTabsContainer, { children: options.map((tabLabel, idx) => {
|
|
7
7
|
const fontSize = calculateFontSize(tabLabel);
|
|
8
8
|
return (_jsx(TabButton, { disableRipple: true, active: idx === active, onClick: () => onChange(idx), sx: {
|
|
9
9
|
padding: '4px 6px',
|
|
10
10
|
borderRadius: doBorderRadius(idx, options.length),
|
|
11
|
-
}, children: _jsx(
|
|
11
|
+
}, children: _jsx(EllipsisTypography, { variant: "body_sb1", sx: {
|
|
12
12
|
fontSize: `${fontSize}px`,
|
|
13
|
-
whiteSpace: 'nowrap',
|
|
14
|
-
overflow: 'hidden',
|
|
15
|
-
textOverflow: 'ellipsis',
|
|
16
|
-
width: '100%',
|
|
17
13
|
}, children: tabLabel }) }, tabLabel));
|
|
18
14
|
}) }));
|
|
19
15
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunit/oui",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.22",
|
|
4
4
|
"validate-branch-name": {
|
|
5
5
|
"pattern": "^(main|develop)|(feature|fix|release|hotfix|qe)/.+$",
|
|
6
6
|
"errorMsg": "The branch name is not correct. Please check the pattern. (ex. feature/add-something)"
|