@instructure/ui-metric 11.7.3-snapshot-7 → 11.7.3-snapshot-26
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 +5 -2
- package/es/Metric/v1/index.js +29 -32
- package/es/Metric/v1/styles.js +3 -1
- package/es/Metric/v1/theme.js +13 -12
- package/es/Metric/v2/index.js +13 -13
- package/es/Metric/v2/styles.js +3 -1
- package/es/MetricGroup/v1/index.js +16 -18
- package/es/MetricGroup/v1/theme.js +4 -2
- package/es/MetricGroup/v2/index.js +5 -6
- package/es/MetricGroup/v2/theme.js +4 -2
- package/lib/Metric/v1/index.js +29 -32
- package/lib/Metric/v1/styles.js +3 -1
- package/lib/Metric/v1/theme.js +13 -12
- package/lib/Metric/v2/index.js +13 -13
- package/lib/Metric/v2/styles.js +3 -1
- package/lib/MetricGroup/v1/index.js +16 -18
- package/lib/MetricGroup/v1/theme.js +4 -2
- package/lib/MetricGroup/v2/index.js +6 -6
- package/lib/MetricGroup/v2/theme.js +4 -2
- package/package.json +10 -10
- package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +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
|
-
## [11.7.3-snapshot-
|
|
6
|
+
## [11.7.3-snapshot-26](https://github.com/instructure/instructure-ui/compare/v11.7.2...v11.7.3-snapshot-26) (2026-05-05)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **many:** update dependencies, remove lots of Babel plugins, remove Webpack 4 support ([f916fca](https://github.com/instructure/instructure-ui/commit/f916fcafdddcb2d7de401f93e8ff92cfdfa47bba))
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
package/es/Metric/v1/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const _excluded = ["textAlign", "renderLabel", "renderValue", "isGroupChild"];
|
|
3
|
-
var _dec, _class, _Metric;
|
|
1
|
+
var _dec, _class;
|
|
4
2
|
/*
|
|
5
3
|
* The MIT License (MIT)
|
|
6
4
|
*
|
|
@@ -37,50 +35,49 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
37
35
|
category: components
|
|
38
36
|
---
|
|
39
37
|
**/
|
|
40
|
-
let Metric = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
38
|
+
let Metric = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class Metric extends Component {
|
|
39
|
+
static displayName = "Metric";
|
|
40
|
+
static componentId = 'Metric';
|
|
41
|
+
static allowedProps = allowedProps;
|
|
42
|
+
static defaultProps = {
|
|
43
|
+
textAlign: 'center',
|
|
44
|
+
isGroupChild: false
|
|
45
|
+
};
|
|
46
|
+
ref = null;
|
|
47
|
+
handleRef = el => {
|
|
48
|
+
this.ref = el;
|
|
49
|
+
};
|
|
48
50
|
componentDidMount() {
|
|
49
|
-
|
|
50
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
51
|
+
this.props.makeStyles?.();
|
|
51
52
|
}
|
|
52
53
|
componentDidUpdate() {
|
|
53
|
-
|
|
54
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
54
|
+
this.props.makeStyles?.();
|
|
55
55
|
}
|
|
56
56
|
render() {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
const {
|
|
58
|
+
textAlign,
|
|
59
|
+
renderLabel,
|
|
60
|
+
renderValue,
|
|
61
|
+
isGroupChild,
|
|
62
|
+
...rest
|
|
63
|
+
} = this.props;
|
|
64
64
|
return _jsxs("div", {
|
|
65
65
|
...passthroughProps(rest),
|
|
66
|
-
role: isGroupChild ? 'row' :
|
|
67
|
-
css:
|
|
66
|
+
role: isGroupChild ? 'row' : undefined,
|
|
67
|
+
css: this.props.styles?.metric,
|
|
68
68
|
ref: this.handleRef,
|
|
69
69
|
"data-cid": "Metric",
|
|
70
70
|
children: [_jsx("div", {
|
|
71
|
-
role: isGroupChild ? 'rowheader' :
|
|
72
|
-
css:
|
|
71
|
+
role: isGroupChild ? 'rowheader' : undefined,
|
|
72
|
+
css: this.props.styles?.label,
|
|
73
73
|
children: callRenderProp(renderLabel)
|
|
74
74
|
}), _jsx("div", {
|
|
75
|
-
role: isGroupChild ? 'gridcell' :
|
|
76
|
-
css:
|
|
75
|
+
role: isGroupChild ? 'gridcell' : undefined,
|
|
76
|
+
css: this.props.styles?.value,
|
|
77
77
|
children: callRenderProp(renderValue)
|
|
78
78
|
})]
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
-
}
|
|
82
|
-
textAlign: 'center',
|
|
83
|
-
isGroupChild: false
|
|
84
|
-
}, _Metric)) || _class);
|
|
81
|
+
}) || _class);
|
|
85
82
|
export default Metric;
|
|
86
83
|
export { Metric };
|
package/es/Metric/v1/styles.js
CHANGED
|
@@ -32,7 +32,9 @@
|
|
|
32
32
|
* @return {Object} The final style object, which will be used in the component
|
|
33
33
|
*/
|
|
34
34
|
const generateStyle = (componentTheme, props) => {
|
|
35
|
-
const
|
|
35
|
+
const {
|
|
36
|
+
textAlign
|
|
37
|
+
} = props;
|
|
36
38
|
return {
|
|
37
39
|
metric: {
|
|
38
40
|
label: 'metric',
|
package/es/Metric/v1/theme.js
CHANGED
|
@@ -28,11 +28,12 @@
|
|
|
28
28
|
* @return {Object} The final theme object with the overrides and component variables
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
spacing
|
|
34
|
-
typography
|
|
35
|
-
themeName
|
|
31
|
+
const {
|
|
32
|
+
colors,
|
|
33
|
+
spacing,
|
|
34
|
+
typography,
|
|
35
|
+
key: themeName
|
|
36
|
+
} = theme;
|
|
36
37
|
const themeSpecificStyle = {
|
|
37
38
|
canvas: {
|
|
38
39
|
valueColor: theme['ic-brand-font-color-dark'],
|
|
@@ -40,13 +41,13 @@ const generateComponentTheme = theme => {
|
|
|
40
41
|
}
|
|
41
42
|
};
|
|
42
43
|
const componentVariables = {
|
|
43
|
-
padding: `0 ${spacing
|
|
44
|
-
fontFamily: typography
|
|
45
|
-
valueColor: colors
|
|
46
|
-
valueFontSize: typography
|
|
47
|
-
valueFontWeight: typography
|
|
48
|
-
labelColor: colors
|
|
49
|
-
labelFontSize: typography
|
|
44
|
+
padding: `0 ${spacing?.xSmall}`,
|
|
45
|
+
fontFamily: typography?.fontFamily,
|
|
46
|
+
valueColor: colors?.contrasts?.grey125125,
|
|
47
|
+
valueFontSize: typography?.fontSizeXLarge,
|
|
48
|
+
valueFontWeight: typography?.fontWeightBold,
|
|
49
|
+
labelColor: colors?.contrasts?.grey125125,
|
|
50
|
+
labelFontSize: typography?.fontSizeXSmall
|
|
50
51
|
};
|
|
51
52
|
return {
|
|
52
53
|
...componentVariables,
|
package/es/Metric/v2/index.js
CHANGED
|
@@ -33,13 +33,13 @@ category: components
|
|
|
33
33
|
---
|
|
34
34
|
**/
|
|
35
35
|
const Metric = /*#__PURE__*/forwardRef((props, ref) => {
|
|
36
|
-
const
|
|
37
|
-
textAlign =
|
|
38
|
-
renderLabel
|
|
39
|
-
renderValue
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
const {
|
|
37
|
+
textAlign = 'center',
|
|
38
|
+
renderLabel,
|
|
39
|
+
renderValue,
|
|
40
|
+
isGroupChild = false,
|
|
41
|
+
themeOverride
|
|
42
|
+
} = props;
|
|
43
43
|
const styles = useStyle({
|
|
44
44
|
generateStyle,
|
|
45
45
|
themeOverride,
|
|
@@ -51,17 +51,17 @@ const Metric = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
51
51
|
});
|
|
52
52
|
return _jsxs("div", {
|
|
53
53
|
...passthroughProps(props),
|
|
54
|
-
role: isGroupChild ? 'row' :
|
|
55
|
-
css: styles
|
|
54
|
+
role: isGroupChild ? 'row' : undefined,
|
|
55
|
+
css: styles?.metric,
|
|
56
56
|
ref: ref,
|
|
57
57
|
"data-cid": "Metric",
|
|
58
58
|
children: [_jsx("div", {
|
|
59
|
-
role: isGroupChild ? 'rowheader' :
|
|
60
|
-
css: styles
|
|
59
|
+
role: isGroupChild ? 'rowheader' : undefined,
|
|
60
|
+
css: styles?.label,
|
|
61
61
|
children: callRenderProp(renderLabel)
|
|
62
62
|
}), _jsx("div", {
|
|
63
|
-
role: isGroupChild ? 'gridcell' :
|
|
64
|
-
css: styles
|
|
63
|
+
role: isGroupChild ? 'gridcell' : undefined,
|
|
64
|
+
css: styles?.value,
|
|
65
65
|
children: callRenderProp(renderValue)
|
|
66
66
|
})]
|
|
67
67
|
});
|
package/es/Metric/v2/styles.js
CHANGED
|
@@ -32,7 +32,9 @@
|
|
|
32
32
|
* @return {Object} The final style object, which will be used in the component
|
|
33
33
|
*/
|
|
34
34
|
const generateStyle = (componentTheme, params) => {
|
|
35
|
-
const
|
|
35
|
+
const {
|
|
36
|
+
textAlign
|
|
37
|
+
} = params;
|
|
36
38
|
return {
|
|
37
39
|
metric: {
|
|
38
40
|
label: 'metric',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _class
|
|
1
|
+
var _dec, _class;
|
|
2
2
|
/*
|
|
3
3
|
* The MIT License (MIT)
|
|
4
4
|
*
|
|
@@ -35,21 +35,22 @@ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
|
35
35
|
category: components
|
|
36
36
|
---
|
|
37
37
|
**/
|
|
38
|
-
let MetricGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
let MetricGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class MetricGroup extends Component {
|
|
39
|
+
static displayName = "MetricGroup";
|
|
40
|
+
static componentId = 'MetricGroup';
|
|
41
|
+
static allowedProps = allowedProps;
|
|
42
|
+
static defaultProps = {
|
|
43
|
+
children: null
|
|
44
|
+
};
|
|
45
|
+
ref = null;
|
|
46
|
+
handleRef = el => {
|
|
47
|
+
this.ref = el;
|
|
48
|
+
};
|
|
46
49
|
componentDidMount() {
|
|
47
|
-
|
|
48
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
50
|
+
this.props.makeStyles?.();
|
|
49
51
|
}
|
|
50
52
|
componentDidUpdate() {
|
|
51
|
-
|
|
52
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
53
|
+
this.props.makeStyles?.();
|
|
53
54
|
}
|
|
54
55
|
renderChildren() {
|
|
55
56
|
return Children.map(this.props.children, child => {
|
|
@@ -59,10 +60,9 @@ let MetricGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
62
|
render() {
|
|
62
|
-
var _this$props$styles;
|
|
63
63
|
return _jsx("div", {
|
|
64
64
|
...passthroughProps(this.props),
|
|
65
|
-
css:
|
|
65
|
+
css: this.props.styles?.metricGroup,
|
|
66
66
|
role: "grid",
|
|
67
67
|
"aria-readonly": "true",
|
|
68
68
|
ref: this.handleRef,
|
|
@@ -70,8 +70,6 @@ let MetricGroup = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
70
70
|
children: this.renderChildren()
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
}
|
|
74
|
-
children: null
|
|
75
|
-
}, _MetricGroup)) || _class);
|
|
73
|
+
}) || _class);
|
|
76
74
|
export default MetricGroup;
|
|
77
75
|
export { MetricGroup };
|
|
@@ -28,9 +28,11 @@
|
|
|
28
28
|
* @return {Object} The final theme object with the overrides and component variables
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
|
-
const
|
|
31
|
+
const {
|
|
32
|
+
typography
|
|
33
|
+
} = theme;
|
|
32
34
|
const componentVariables = {
|
|
33
|
-
lineHeight: typography
|
|
35
|
+
lineHeight: typography?.lineHeightCondensed
|
|
34
36
|
};
|
|
35
37
|
return {
|
|
36
38
|
...componentVariables
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
-
const _excluded = ["children"];
|
|
3
1
|
/*
|
|
4
2
|
* The MIT License (MIT)
|
|
5
3
|
*
|
|
@@ -34,9 +32,10 @@ category: components
|
|
|
34
32
|
---
|
|
35
33
|
**/
|
|
36
34
|
const MetricGroup = /*#__PURE__*/forwardRef((props, ref) => {
|
|
37
|
-
const
|
|
38
|
-
children =
|
|
39
|
-
rest
|
|
35
|
+
const {
|
|
36
|
+
children = null,
|
|
37
|
+
...rest
|
|
38
|
+
} = props;
|
|
40
39
|
const styles = generateStyle();
|
|
41
40
|
const renderChildren = () => {
|
|
42
41
|
return Children.map(children, child => {
|
|
@@ -47,7 +46,7 @@ const MetricGroup = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
47
46
|
};
|
|
48
47
|
return _jsx("div", {
|
|
49
48
|
...passthroughProps(rest),
|
|
50
|
-
css: styles
|
|
49
|
+
css: styles?.metricGroup,
|
|
51
50
|
role: "grid",
|
|
52
51
|
"aria-readonly": "true",
|
|
53
52
|
ref: ref,
|
|
@@ -28,9 +28,11 @@
|
|
|
28
28
|
* @return {Object} The final theme object with the overrides and component variables
|
|
29
29
|
*/
|
|
30
30
|
const generateComponentTheme = theme => {
|
|
31
|
-
const
|
|
31
|
+
const {
|
|
32
|
+
typography
|
|
33
|
+
} = theme;
|
|
32
34
|
const componentVariables = {
|
|
33
|
-
lineHeight: typography
|
|
35
|
+
lineHeight: typography?.lineHeightCondensed
|
|
34
36
|
};
|
|
35
37
|
return {
|
|
36
38
|
...componentVariables
|
package/lib/Metric/v1/index.js
CHANGED
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.Metric = void 0;
|
|
8
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
8
|
var _react = require("react");
|
|
10
9
|
var _emotion = require("@instructure/emotion");
|
|
11
10
|
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
@@ -14,8 +13,7 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
14
13
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
15
14
|
var _props = require("./props");
|
|
16
15
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
17
|
-
|
|
18
|
-
var _dec, _class, _Metric;
|
|
16
|
+
var _dec, _class;
|
|
19
17
|
/*
|
|
20
18
|
* The MIT License (MIT)
|
|
21
19
|
*
|
|
@@ -44,49 +42,48 @@ var _dec, _class, _Metric;
|
|
|
44
42
|
category: components
|
|
45
43
|
---
|
|
46
44
|
**/
|
|
47
|
-
let Metric = exports.Metric = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
45
|
+
let Metric = exports.Metric = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = class Metric extends _react.Component {
|
|
46
|
+
static displayName = "Metric";
|
|
47
|
+
static componentId = 'Metric';
|
|
48
|
+
static allowedProps = _props.allowedProps;
|
|
49
|
+
static defaultProps = {
|
|
50
|
+
textAlign: 'center',
|
|
51
|
+
isGroupChild: false
|
|
52
|
+
};
|
|
53
|
+
ref = null;
|
|
54
|
+
handleRef = el => {
|
|
55
|
+
this.ref = el;
|
|
56
|
+
};
|
|
55
57
|
componentDidMount() {
|
|
56
|
-
|
|
57
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
58
|
+
this.props.makeStyles?.();
|
|
58
59
|
}
|
|
59
60
|
componentDidUpdate() {
|
|
60
|
-
|
|
61
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
61
|
+
this.props.makeStyles?.();
|
|
62
62
|
}
|
|
63
63
|
render() {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
const {
|
|
65
|
+
textAlign,
|
|
66
|
+
renderLabel,
|
|
67
|
+
renderValue,
|
|
68
|
+
isGroupChild,
|
|
69
|
+
...rest
|
|
70
|
+
} = this.props;
|
|
71
71
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
72
72
|
...(0, _passthroughProps.passthroughProps)(rest),
|
|
73
|
-
role: isGroupChild ? 'row' :
|
|
74
|
-
css:
|
|
73
|
+
role: isGroupChild ? 'row' : undefined,
|
|
74
|
+
css: this.props.styles?.metric,
|
|
75
75
|
ref: this.handleRef,
|
|
76
76
|
"data-cid": "Metric",
|
|
77
77
|
children: [(0, _jsxRuntime.jsx)("div", {
|
|
78
|
-
role: isGroupChild ? 'rowheader' :
|
|
79
|
-
css:
|
|
78
|
+
role: isGroupChild ? 'rowheader' : undefined,
|
|
79
|
+
css: this.props.styles?.label,
|
|
80
80
|
children: (0, _callRenderProp.callRenderProp)(renderLabel)
|
|
81
81
|
}), (0, _jsxRuntime.jsx)("div", {
|
|
82
|
-
role: isGroupChild ? 'gridcell' :
|
|
83
|
-
css:
|
|
82
|
+
role: isGroupChild ? 'gridcell' : undefined,
|
|
83
|
+
css: this.props.styles?.value,
|
|
84
84
|
children: (0, _callRenderProp.callRenderProp)(renderValue)
|
|
85
85
|
})]
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
}
|
|
89
|
-
textAlign: 'center',
|
|
90
|
-
isGroupChild: false
|
|
91
|
-
}, _Metric)) || _class);
|
|
88
|
+
}) || _class);
|
|
92
89
|
var _default = exports.default = Metric;
|
package/lib/Metric/v1/styles.js
CHANGED
|
@@ -38,7 +38,9 @@ exports.default = void 0;
|
|
|
38
38
|
* @return {Object} The final style object, which will be used in the component
|
|
39
39
|
*/
|
|
40
40
|
const generateStyle = (componentTheme, props) => {
|
|
41
|
-
const
|
|
41
|
+
const {
|
|
42
|
+
textAlign
|
|
43
|
+
} = props;
|
|
42
44
|
return {
|
|
43
45
|
metric: {
|
|
44
46
|
label: 'metric',
|
package/lib/Metric/v1/theme.js
CHANGED
|
@@ -34,11 +34,12 @@ exports.default = void 0;
|
|
|
34
34
|
* @return {Object} The final theme object with the overrides and component variables
|
|
35
35
|
*/
|
|
36
36
|
const generateComponentTheme = theme => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
spacing
|
|
40
|
-
typography
|
|
41
|
-
themeName
|
|
37
|
+
const {
|
|
38
|
+
colors,
|
|
39
|
+
spacing,
|
|
40
|
+
typography,
|
|
41
|
+
key: themeName
|
|
42
|
+
} = theme;
|
|
42
43
|
const themeSpecificStyle = {
|
|
43
44
|
canvas: {
|
|
44
45
|
valueColor: theme['ic-brand-font-color-dark'],
|
|
@@ -46,13 +47,13 @@ const generateComponentTheme = theme => {
|
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
49
|
const componentVariables = {
|
|
49
|
-
padding: `0 ${spacing
|
|
50
|
-
fontFamily: typography
|
|
51
|
-
valueColor: colors
|
|
52
|
-
valueFontSize: typography
|
|
53
|
-
valueFontWeight: typography
|
|
54
|
-
labelColor: colors
|
|
55
|
-
labelFontSize: typography
|
|
50
|
+
padding: `0 ${spacing?.xSmall}`,
|
|
51
|
+
fontFamily: typography?.fontFamily,
|
|
52
|
+
valueColor: colors?.contrasts?.grey125125,
|
|
53
|
+
valueFontSize: typography?.fontSizeXLarge,
|
|
54
|
+
valueFontWeight: typography?.fontWeightBold,
|
|
55
|
+
labelColor: colors?.contrasts?.grey125125,
|
|
56
|
+
labelFontSize: typography?.fontSizeXSmall
|
|
56
57
|
};
|
|
57
58
|
return {
|
|
58
59
|
...componentVariables,
|
package/lib/Metric/v2/index.js
CHANGED
|
@@ -41,13 +41,13 @@ category: components
|
|
|
41
41
|
---
|
|
42
42
|
**/
|
|
43
43
|
const Metric = exports.Metric = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
44
|
-
const
|
|
45
|
-
textAlign =
|
|
46
|
-
renderLabel
|
|
47
|
-
renderValue
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
const {
|
|
45
|
+
textAlign = 'center',
|
|
46
|
+
renderLabel,
|
|
47
|
+
renderValue,
|
|
48
|
+
isGroupChild = false,
|
|
49
|
+
themeOverride
|
|
50
|
+
} = props;
|
|
51
51
|
const styles = (0, _emotion.useStyle)({
|
|
52
52
|
generateStyle: _styles.default,
|
|
53
53
|
themeOverride,
|
|
@@ -59,17 +59,17 @@ const Metric = exports.Metric = /*#__PURE__*/(0, _react.forwardRef)((props, ref)
|
|
|
59
59
|
});
|
|
60
60
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
61
61
|
...(0, _passthroughProps.passthroughProps)(props),
|
|
62
|
-
role: isGroupChild ? 'row' :
|
|
63
|
-
css: styles
|
|
62
|
+
role: isGroupChild ? 'row' : undefined,
|
|
63
|
+
css: styles?.metric,
|
|
64
64
|
ref: ref,
|
|
65
65
|
"data-cid": "Metric",
|
|
66
66
|
children: [(0, _jsxRuntime.jsx)("div", {
|
|
67
|
-
role: isGroupChild ? 'rowheader' :
|
|
68
|
-
css: styles
|
|
67
|
+
role: isGroupChild ? 'rowheader' : undefined,
|
|
68
|
+
css: styles?.label,
|
|
69
69
|
children: (0, _callRenderProp.callRenderProp)(renderLabel)
|
|
70
70
|
}), (0, _jsxRuntime.jsx)("div", {
|
|
71
|
-
role: isGroupChild ? 'gridcell' :
|
|
72
|
-
css: styles
|
|
71
|
+
role: isGroupChild ? 'gridcell' : undefined,
|
|
72
|
+
css: styles?.value,
|
|
73
73
|
children: (0, _callRenderProp.callRenderProp)(renderValue)
|
|
74
74
|
})]
|
|
75
75
|
});
|
package/lib/Metric/v2/styles.js
CHANGED
|
@@ -38,7 +38,9 @@ exports.default = void 0;
|
|
|
38
38
|
* @return {Object} The final style object, which will be used in the component
|
|
39
39
|
*/
|
|
40
40
|
const generateStyle = (componentTheme, params) => {
|
|
41
|
-
const
|
|
41
|
+
const {
|
|
42
|
+
textAlign
|
|
43
|
+
} = params;
|
|
42
44
|
return {
|
|
43
45
|
metric: {
|
|
44
46
|
label: 'metric',
|
|
@@ -13,7 +13,7 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
13
13
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
14
14
|
var _props = require("./props");
|
|
15
15
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
16
|
-
var _dec, _class
|
|
16
|
+
var _dec, _class;
|
|
17
17
|
/*
|
|
18
18
|
* The MIT License (MIT)
|
|
19
19
|
*
|
|
@@ -42,21 +42,22 @@ var _dec, _class, _MetricGroup;
|
|
|
42
42
|
category: components
|
|
43
43
|
---
|
|
44
44
|
**/
|
|
45
|
-
let MetricGroup = exports.MetricGroup = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
let MetricGroup = exports.MetricGroup = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = class MetricGroup extends _react.Component {
|
|
46
|
+
static displayName = "MetricGroup";
|
|
47
|
+
static componentId = 'MetricGroup';
|
|
48
|
+
static allowedProps = _props.allowedProps;
|
|
49
|
+
static defaultProps = {
|
|
50
|
+
children: null
|
|
51
|
+
};
|
|
52
|
+
ref = null;
|
|
53
|
+
handleRef = el => {
|
|
54
|
+
this.ref = el;
|
|
55
|
+
};
|
|
53
56
|
componentDidMount() {
|
|
54
|
-
|
|
55
|
-
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
57
|
+
this.props.makeStyles?.();
|
|
56
58
|
}
|
|
57
59
|
componentDidUpdate() {
|
|
58
|
-
|
|
59
|
-
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
60
|
+
this.props.makeStyles?.();
|
|
60
61
|
}
|
|
61
62
|
renderChildren() {
|
|
62
63
|
return _react.Children.map(this.props.children, child => {
|
|
@@ -66,10 +67,9 @@ let MetricGroup = exports.MetricGroup = (_dec = (0, _emotion.withStyleLegacy)(_s
|
|
|
66
67
|
});
|
|
67
68
|
}
|
|
68
69
|
render() {
|
|
69
|
-
var _this$props$styles;
|
|
70
70
|
return (0, _jsxRuntime.jsx)("div", {
|
|
71
71
|
...(0, _passthroughProps.passthroughProps)(this.props),
|
|
72
|
-
css:
|
|
72
|
+
css: this.props.styles?.metricGroup,
|
|
73
73
|
role: "grid",
|
|
74
74
|
"aria-readonly": "true",
|
|
75
75
|
ref: this.handleRef,
|
|
@@ -77,7 +77,5 @@ let MetricGroup = exports.MetricGroup = (_dec = (0, _emotion.withStyleLegacy)(_s
|
|
|
77
77
|
children: this.renderChildren()
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
-
}
|
|
81
|
-
children: null
|
|
82
|
-
}, _MetricGroup)) || _class);
|
|
80
|
+
}) || _class);
|
|
83
81
|
var _default = exports.default = MetricGroup;
|
|
@@ -34,9 +34,11 @@ exports.default = void 0;
|
|
|
34
34
|
* @return {Object} The final theme object with the overrides and component variables
|
|
35
35
|
*/
|
|
36
36
|
const generateComponentTheme = theme => {
|
|
37
|
-
const
|
|
37
|
+
const {
|
|
38
|
+
typography
|
|
39
|
+
} = theme;
|
|
38
40
|
const componentVariables = {
|
|
39
|
-
lineHeight: typography
|
|
41
|
+
lineHeight: typography?.lineHeightCondensed
|
|
40
42
|
};
|
|
41
43
|
return {
|
|
42
44
|
...componentVariables
|