@synerise/ds-metric-card 1.2.7 → 1.2.8
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/CHANGELOG.md +6 -0
- package/dist/MetricCard.js +25 -20
- package/dist/MetricCard.styles.d.ts +1 -3
- package/dist/MetricCard.styles.js +3 -6
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.2.8](https://github.com/Synerise/synerise-design/compare/@synerise/ds-metric-card@1.2.7...@synerise/ds-metric-card@1.2.8) (2026-02-26)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **metric-card:** updated logic for content display ([546cdf6](https://github.com/Synerise/synerise-design/commit/546cdf6abf4d16d37960171f0ee8b3a85772ba9a))
|
|
11
|
+
|
|
6
12
|
## [1.2.7](https://github.com/Synerise/synerise-design/compare/@synerise/ds-metric-card@1.2.6...@synerise/ds-metric-card@1.2.7) (2026-02-23)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @synerise/ds-metric-card
|
package/dist/MetricCard.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["title", "headerRightSide", "hoverValue", "displayValue", "tooltip", "tooltipConfig", "greyBackground", "isLoading", "errorMessage", "copyValue", "texts"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
-
import React from 'react';
|
|
4
|
+
import React, { useMemo, useState } from 'react';
|
|
5
5
|
import Icon, { InfoFillS } from '@synerise/ds-icon';
|
|
6
6
|
import Tooltip from '@synerise/ds-tooltip';
|
|
7
7
|
import { Text } from '@synerise/ds-typography';
|
|
@@ -21,13 +21,30 @@ var MetricCard = function MetricCard(_ref) {
|
|
|
21
21
|
htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
22
22
|
var hasValue = Boolean(hoverValue) || Boolean(displayValue);
|
|
23
23
|
var tooltipVisible = Boolean(tooltip || tooltipConfig);
|
|
24
|
-
var
|
|
25
|
-
hover =
|
|
26
|
-
setHover =
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
var _useState = useState(false),
|
|
25
|
+
hover = _useState[0],
|
|
26
|
+
setHover = _useState[1];
|
|
27
|
+
var content = useMemo(function () {
|
|
28
|
+
if (isLoading) {
|
|
29
|
+
return /*#__PURE__*/React.createElement(S.MetricSkeleton, {
|
|
30
|
+
size: "S",
|
|
31
|
+
width: "M",
|
|
32
|
+
height: 32,
|
|
33
|
+
numberOfSkeletons: 1
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return errorMessage ? /*#__PURE__*/React.createElement(S.MetricInlineAlert, {
|
|
37
|
+
type: "alert",
|
|
38
|
+
message: errorMessage
|
|
39
|
+
}) : /*#__PURE__*/React.createElement(S.MetricValue, {
|
|
40
|
+
ellipsis: {
|
|
41
|
+
tooltip: hoverValue || displayValue
|
|
42
|
+
}
|
|
43
|
+
}, /*#__PURE__*/React.createElement(S.WrapperFormattedNumber, null, displayValue), /*#__PURE__*/React.createElement(S.WrapperNumber, null, hoverValue || displayValue));
|
|
44
|
+
}, [displayValue, errorMessage, hoverValue, isLoading]);
|
|
30
45
|
return /*#__PURE__*/React.createElement(S.MetricContainer, _extends({
|
|
46
|
+
p: "8px 8px 14px 24px",
|
|
47
|
+
radius: 3,
|
|
31
48
|
greyBackground: greyBackground
|
|
32
49
|
}, htmlAttributes), /*#__PURE__*/React.createElement(S.MetricHeaderBar, null, /*#__PURE__*/React.createElement(S.TitleWrapper, {
|
|
33
50
|
header: Boolean(headerRightSide)
|
|
@@ -52,19 +69,7 @@ var MetricCard = function MetricCard(_ref) {
|
|
|
52
69
|
return setHover(false);
|
|
53
70
|
},
|
|
54
71
|
copyable: hasValue
|
|
55
|
-
},
|
|
56
|
-
size: "S",
|
|
57
|
-
width: "M",
|
|
58
|
-
height: 32,
|
|
59
|
-
numberOfSkeletons: 1
|
|
60
|
-
}), showError && /*#__PURE__*/React.createElement(S.MetricInlineAlert, {
|
|
61
|
-
type: "alert",
|
|
62
|
-
message: errorMessage
|
|
63
|
-
}), showContent && /*#__PURE__*/React.createElement(S.MetricValue, {
|
|
64
|
-
ellipsis: {
|
|
65
|
-
tooltip: hoverValue || displayValue
|
|
66
|
-
}
|
|
67
|
-
}, /*#__PURE__*/React.createElement(S.WrapperFormattedNumber, null, displayValue), /*#__PURE__*/React.createElement(S.WrapperNumber, null, hoverValue || displayValue)), typeof copyValue === 'string' && hover && /*#__PURE__*/React.createElement(S.WrapperCopyIcon, null, /*#__PURE__*/React.createElement(S.CopyIcon, {
|
|
72
|
+
}, content, typeof copyValue === 'string' && hover && /*#__PURE__*/React.createElement(S.WrapperCopyIcon, null, /*#__PURE__*/React.createElement(S.CopyIcon, {
|
|
68
73
|
copyValue: copyValue,
|
|
69
74
|
texts: texts
|
|
70
75
|
}))));
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export declare const WrapperFormattedNumber: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
2
|
export declare const WrapperNumber: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export declare const MetricContainer: import("styled-components").StyledComponent<"
|
|
4
|
-
greyBackground?: boolean;
|
|
5
|
-
}, never>;
|
|
3
|
+
export declare const MetricContainer: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Omit<import("@synerise/ds-panel").PanelProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
6
4
|
export declare const CopyIcon: import("styled-components").StyledComponent<({ copyValue, texts, onMouseEnter, onMouseLeave, icon, placement, onCopy, onClick, ...rest }: import("@synerise/ds-copy-icon").CopyIconProps) => React.JSX.Element, any, {}, never>;
|
|
7
5
|
export declare const MetricSkeleton: import("styled-components").StyledComponent<({ size, numberOfSkeletons, width, height, className, }: import("@synerise/ds-skeleton").SkeletonProps) => React.JSX.Element, any, {}, never>;
|
|
8
6
|
export declare const MetricInlineAlert: import("styled-components").StyledComponent<({ className, type, message, withLink, withEmphasis, hoverButton, disabled, customIcon, ...rest }: import("@synerise/ds-inline-alert").InlineAlertProps) => React.JSX.Element, any, {}, never>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import Copy from '@synerise/ds-copy-icon';
|
|
3
3
|
import InlineAlert from '@synerise/ds-inline-alert';
|
|
4
|
+
import Panel from '@synerise/ds-panel';
|
|
4
5
|
import Skeleton from '@synerise/ds-skeleton';
|
|
5
6
|
import { Text } from '@synerise/ds-typography';
|
|
6
7
|
export var WrapperFormattedNumber = styled.div.withConfig({
|
|
@@ -11,14 +12,10 @@ export var WrapperNumber = styled.div.withConfig({
|
|
|
11
12
|
displayName: "MetricCardstyles__WrapperNumber",
|
|
12
13
|
componentId: "sc-1g748a8-1"
|
|
13
14
|
})(["display:none;"]);
|
|
14
|
-
export var MetricContainer = styled.
|
|
15
|
+
export var MetricContainer = styled(Panel).withConfig({
|
|
15
16
|
displayName: "MetricCardstyles__MetricContainer",
|
|
16
17
|
componentId: "sc-1g748a8-2"
|
|
17
|
-
})(["display:flex;flex-direction:column;
|
|
18
|
-
return props.theme.palette.white;
|
|
19
|
-
}, function (props) {
|
|
20
|
-
return props.greyBackground ? "\n box-shadow: 0 4px 12px 0 rgba(35, 41, 54, 0.04);" : "\n box-shadow: 0 0 0 1px " + props.theme.palette['grey-200'];
|
|
21
|
-
});
|
|
18
|
+
})(["display:flex;flex-direction:column;gap:2px;width:100%;"]);
|
|
22
19
|
export var CopyIcon = styled(Copy).withConfig({
|
|
23
20
|
displayName: "MetricCardstyles__CopyIcon",
|
|
24
21
|
componentId: "sc-1g748a8-3"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-metric-card",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.8",
|
|
4
4
|
"description": "MetricCard UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"@synerise/ds-copy-icon": "^1.1.7",
|
|
39
39
|
"@synerise/ds-icon": "^1.14.1",
|
|
40
40
|
"@synerise/ds-inline-alert": "^1.1.13",
|
|
41
|
-
"@synerise/ds-
|
|
41
|
+
"@synerise/ds-panel": "^1.2.1",
|
|
42
|
+
"@synerise/ds-skeleton": "^1.0.42",
|
|
42
43
|
"@synerise/ds-tooltip": "^1.4.7",
|
|
43
44
|
"@synerise/ds-typography": "^1.1.10"
|
|
44
45
|
},
|
|
@@ -51,5 +52,5 @@
|
|
|
51
52
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
52
53
|
"styled-components": "^5.3.3"
|
|
53
54
|
},
|
|
54
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "4ffbd56e9bf6277c4507efeaf000b66b9bb09781"
|
|
55
56
|
}
|