@instructure/ui-metric 11.6.0 → 11.6.1-snapshot-129

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 (102) hide show
  1. package/CHANGELOG.md +29 -280
  2. package/es/Metric/{index.js → v1/index.js} +1 -1
  3. package/es/Metric/v2/index.js +71 -0
  4. package/es/Metric/v2/props.js +26 -0
  5. package/es/Metric/v2/styles.js +65 -0
  6. package/es/MetricGroup/{index.js → v1/index.js} +1 -1
  7. package/es/MetricGroup/v2/index.js +60 -0
  8. package/es/{index.js → MetricGroup/v2/props.js} +3 -2
  9. package/es/MetricGroup/v2/styles.js +44 -0
  10. package/es/MetricGroup/v2/theme.js +39 -0
  11. package/es/exports/a.js +25 -0
  12. package/es/exports/b.js +25 -0
  13. package/lib/Metric/{index.js → v1/index.js} +1 -1
  14. package/lib/Metric/v2/index.js +78 -0
  15. package/lib/Metric/v2/props.js +31 -0
  16. package/lib/Metric/v2/styles.js +71 -0
  17. package/lib/MetricGroup/{index.js → v1/index.js} +1 -1
  18. package/lib/MetricGroup/v2/index.js +66 -0
  19. package/lib/MetricGroup/v2/props.js +31 -0
  20. package/lib/MetricGroup/v2/styles.js +50 -0
  21. package/lib/MetricGroup/v2/theme.js +45 -0
  22. package/lib/{index.js → exports/a.js} +4 -4
  23. package/lib/exports/b.js +19 -0
  24. package/package.json +38 -16
  25. package/src/Metric/{index.tsx → v1/index.tsx} +1 -1
  26. package/src/Metric/v2/README.md +30 -0
  27. package/src/Metric/v2/index.tsx +79 -0
  28. package/src/Metric/v2/props.ts +63 -0
  29. package/src/Metric/v2/styles.ts +77 -0
  30. package/src/MetricGroup/{index.tsx → v1/index.tsx} +1 -1
  31. package/src/MetricGroup/v2/README.md +16 -0
  32. package/src/MetricGroup/v2/index.tsx +70 -0
  33. package/src/MetricGroup/v2/props.ts +46 -0
  34. package/src/MetricGroup/v2/styles.ts +47 -0
  35. package/src/MetricGroup/v2/theme.ts +45 -0
  36. package/src/{index.ts → exports/a.ts} +4 -4
  37. package/src/exports/b.ts +29 -0
  38. package/tsconfig.build.tsbuildinfo +1 -1
  39. package/types/Metric/v1/index.d.ts.map +1 -0
  40. package/types/Metric/v1/props.d.ts.map +1 -0
  41. package/types/Metric/v1/styles.d.ts.map +1 -0
  42. package/types/Metric/v1/theme.d.ts.map +1 -0
  43. package/types/Metric/v2/index.d.ts +33 -0
  44. package/types/Metric/v2/index.d.ts.map +1 -0
  45. package/types/Metric/v2/props.d.ts +23 -0
  46. package/types/Metric/v2/props.d.ts.map +1 -0
  47. package/types/Metric/v2/styles.d.ts +17 -0
  48. package/types/Metric/v2/styles.d.ts.map +1 -0
  49. package/types/MetricGroup/v1/index.d.ts.map +1 -0
  50. package/types/MetricGroup/v1/props.d.ts.map +1 -0
  51. package/types/MetricGroup/v1/styles.d.ts.map +1 -0
  52. package/types/MetricGroup/v1/theme.d.ts.map +1 -0
  53. package/types/MetricGroup/v2/index.d.ts +15 -0
  54. package/types/MetricGroup/v2/index.d.ts.map +1 -0
  55. package/types/MetricGroup/v2/props.d.ts +16 -0
  56. package/types/MetricGroup/v2/props.d.ts.map +1 -0
  57. package/types/MetricGroup/v2/styles.d.ts +11 -0
  58. package/types/MetricGroup/v2/styles.d.ts.map +1 -0
  59. package/types/MetricGroup/v2/theme.d.ts +10 -0
  60. package/types/MetricGroup/v2/theme.d.ts.map +1 -0
  61. package/types/exports/a.d.ts +5 -0
  62. package/types/exports/a.d.ts.map +1 -0
  63. package/types/exports/b.d.ts +5 -0
  64. package/types/exports/b.d.ts.map +1 -0
  65. package/types/Metric/index.d.ts.map +0 -1
  66. package/types/Metric/props.d.ts.map +0 -1
  67. package/types/Metric/styles.d.ts.map +0 -1
  68. package/types/Metric/theme.d.ts.map +0 -1
  69. package/types/MetricGroup/index.d.ts.map +0 -1
  70. package/types/MetricGroup/props.d.ts.map +0 -1
  71. package/types/MetricGroup/styles.d.ts.map +0 -1
  72. package/types/MetricGroup/theme.d.ts.map +0 -1
  73. package/types/index.d.ts +0 -5
  74. package/types/index.d.ts.map +0 -1
  75. /package/es/Metric/{props.js → v1/props.js} +0 -0
  76. /package/es/Metric/{styles.js → v1/styles.js} +0 -0
  77. /package/es/Metric/{theme.js → v1/theme.js} +0 -0
  78. /package/es/MetricGroup/{props.js → v1/props.js} +0 -0
  79. /package/es/MetricGroup/{styles.js → v1/styles.js} +0 -0
  80. /package/es/MetricGroup/{theme.js → v1/theme.js} +0 -0
  81. /package/lib/Metric/{props.js → v1/props.js} +0 -0
  82. /package/lib/Metric/{styles.js → v1/styles.js} +0 -0
  83. /package/lib/Metric/{theme.js → v1/theme.js} +0 -0
  84. /package/lib/MetricGroup/{props.js → v1/props.js} +0 -0
  85. /package/lib/MetricGroup/{styles.js → v1/styles.js} +0 -0
  86. /package/lib/MetricGroup/{theme.js → v1/theme.js} +0 -0
  87. /package/src/Metric/{README.md → v1/README.md} +0 -0
  88. /package/src/Metric/{props.ts → v1/props.ts} +0 -0
  89. /package/src/Metric/{styles.ts → v1/styles.ts} +0 -0
  90. /package/src/Metric/{theme.ts → v1/theme.ts} +0 -0
  91. /package/src/MetricGroup/{README.md → v1/README.md} +0 -0
  92. /package/src/MetricGroup/{props.ts → v1/props.ts} +0 -0
  93. /package/src/MetricGroup/{styles.ts → v1/styles.ts} +0 -0
  94. /package/src/MetricGroup/{theme.ts → v1/theme.ts} +0 -0
  95. /package/types/Metric/{index.d.ts → v1/index.d.ts} +0 -0
  96. /package/types/Metric/{props.d.ts → v1/props.d.ts} +0 -0
  97. /package/types/Metric/{styles.d.ts → v1/styles.d.ts} +0 -0
  98. /package/types/Metric/{theme.d.ts → v1/theme.d.ts} +0 -0
  99. /package/types/MetricGroup/{index.d.ts → v1/index.d.ts} +0 -0
  100. /package/types/MetricGroup/{props.d.ts → v1/props.d.ts} +0 -0
  101. /package/types/MetricGroup/{styles.d.ts → v1/styles.d.ts} +0 -0
  102. /package/types/MetricGroup/{theme.d.ts → v1/theme.d.ts} +0 -0
@@ -0,0 +1,65 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ /**
26
+ * ---
27
+ * private: true
28
+ * ---
29
+ * Generates the style object from the theme and provided additional information
30
+ * @param {Object} componentTheme The theme variable object.
31
+ * @param {Object} params the props of the component, the style is applied to
32
+ * @return {Object} The final style object, which will be used in the component
33
+ */
34
+ const generateStyle = (componentTheme, params) => {
35
+ const textAlign = params.textAlign;
36
+ return {
37
+ metric: {
38
+ label: 'metric',
39
+ display: 'flex',
40
+ flexDirection: 'column-reverse',
41
+ boxSizing: 'border-box',
42
+ paddingLeft: componentTheme.paddingHorizontal,
43
+ paddingRight: componentTheme.paddingHorizontal,
44
+ textAlign,
45
+ gap: componentTheme.gapTexts
46
+ },
47
+ label: {
48
+ label: 'metric__label',
49
+ fontWeight: componentTheme.labelFontWeight,
50
+ fontSize: componentTheme.labelFontSize,
51
+ color: componentTheme.labelColor,
52
+ fontFamily: componentTheme.labelFontFamily,
53
+ lineHeight: componentTheme.labelLineHeight
54
+ },
55
+ value: {
56
+ label: 'metric__value',
57
+ fontWeight: componentTheme.valueFontWeight,
58
+ fontSize: componentTheme.valueFontSize,
59
+ color: componentTheme.valueColor,
60
+ fontFamily: componentTheme.valueFontFamily,
61
+ lineHeight: componentTheme.valueLineHeight
62
+ }
63
+ };
64
+ };
65
+ export default generateStyle;
@@ -24,7 +24,7 @@ var _dec, _class, _MetricGroup;
24
24
  */
25
25
 
26
26
  import { Children, Component } from 'react';
27
- import { withStyle } from '@instructure/emotion';
27
+ import { withStyleLegacy as withStyle } from '@instructure/emotion';
28
28
  import { passthroughProps, safeCloneElement } from '@instructure/ui-react-utils';
29
29
  import generateStyle from "./styles.js";
30
30
  import generateComponentTheme from "./theme.js";
@@ -0,0 +1,60 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ const _excluded = ["children"];
3
+ /*
4
+ * The MIT License (MIT)
5
+ *
6
+ * Copyright (c) 2015 - present Instructure, Inc.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ */
26
+
27
+ import { Children, forwardRef } from 'react';
28
+ import { passthroughProps, safeCloneElement } from '@instructure/ui-react-utils';
29
+ import generateStyle from "./styles.js";
30
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
31
+ /**
32
+ ---
33
+ category: components
34
+ ---
35
+ **/
36
+ const MetricGroup = /*#__PURE__*/forwardRef((props, ref) => {
37
+ const _props$children = props.children,
38
+ children = _props$children === void 0 ? null : _props$children,
39
+ rest = _objectWithoutProperties(props, _excluded);
40
+ const styles = generateStyle();
41
+ const renderChildren = () => {
42
+ return Children.map(children, child => {
43
+ return safeCloneElement(child, {
44
+ isGroupChild: true
45
+ });
46
+ });
47
+ };
48
+ return _jsx("div", {
49
+ ...passthroughProps(rest),
50
+ css: styles === null || styles === void 0 ? void 0 : styles.metricGroup,
51
+ role: "grid",
52
+ "aria-readonly": "true",
53
+ ref: ref,
54
+ "data-cid": "MetricGroup",
55
+ children: renderChildren()
56
+ });
57
+ });
58
+ MetricGroup.displayName = 'MetricGroup';
59
+ export default MetricGroup;
60
+ export { MetricGroup };
@@ -21,5 +21,6 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
- export { Metric } from "./Metric/index.js";
25
- export { MetricGroup } from "./MetricGroup/index.js";
24
+
25
+ const allowedProps = ['children'];
26
+ export { allowedProps };
@@ -0,0 +1,44 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ /**
26
+ * ---
27
+ * private: true
28
+ * ---
29
+ * Generates the style object from the theme and provided additional information
30
+ * @return {Object} The final style object, which will be used in the component
31
+ */
32
+ const generateStyle = () => {
33
+ return {
34
+ metricGroup: {
35
+ label: 'metricGroup',
36
+ boxSizing: 'border-box',
37
+ display: 'flex',
38
+ flexWrap: 'wrap',
39
+ alignItems: 'flex-start',
40
+ justifyContent: 'space-around'
41
+ }
42
+ };
43
+ };
44
+ export default generateStyle;
@@ -0,0 +1,39 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ /**
26
+ * Generates the theme object for the component from the theme and provided additional information
27
+ * @param {Object} theme The actual theme object.
28
+ * @return {Object} The final theme object with the overrides and component variables
29
+ */
30
+ const generateComponentTheme = theme => {
31
+ const typography = theme.typography;
32
+ const componentVariables = {
33
+ lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeightCondensed
34
+ };
35
+ return {
36
+ ...componentVariables
37
+ };
38
+ };
39
+ export default generateComponentTheme;
@@ -0,0 +1,25 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ export { Metric } from "../Metric/v1/index.js";
25
+ export { MetricGroup } from "../MetricGroup/v1/index.js";
@@ -0,0 +1,25 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ export { Metric } from "../Metric/v2/index.js";
25
+ export { MetricGroup } from "../MetricGroup/v2/index.js";
@@ -44,7 +44,7 @@ var _dec, _class, _Metric;
44
44
  category: components
45
45
  ---
46
46
  **/
47
- let Metric = exports.Metric = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_Metric = class Metric extends _react.Component {
47
+ let Metric = exports.Metric = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = (_Metric = class Metric extends _react.Component {
48
48
  constructor(...args) {
49
49
  super(...args);
50
50
  this.ref = null;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = exports.Metric = void 0;
8
+ var _react = require("react");
9
+ var _emotion = require("@instructure/emotion");
10
+ var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
11
+ var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
12
+ var _styles = _interopRequireDefault(require("./styles"));
13
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
14
+ /*
15
+ * The MIT License (MIT)
16
+ *
17
+ * Copyright (c) 2015 - present Instructure, Inc.
18
+ *
19
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
20
+ * of this software and associated documentation files (the "Software"), to deal
21
+ * in the Software without restriction, including without limitation the rights
22
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23
+ * copies of the Software, and to permit persons to whom the Software is
24
+ * furnished to do so, subject to the following conditions:
25
+ *
26
+ * The above copyright notice and this permission notice shall be included in all
27
+ * copies or substantial portions of the Software.
28
+ *
29
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
+ * SOFTWARE.
36
+ */
37
+
38
+ /**
39
+ ---
40
+ category: components
41
+ ---
42
+ **/
43
+ const Metric = exports.Metric = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
44
+ const _props$textAlign = props.textAlign,
45
+ textAlign = _props$textAlign === void 0 ? 'center' : _props$textAlign,
46
+ renderLabel = props.renderLabel,
47
+ renderValue = props.renderValue,
48
+ _props$isGroupChild = props.isGroupChild,
49
+ isGroupChild = _props$isGroupChild === void 0 ? false : _props$isGroupChild,
50
+ themeOverride = props.themeOverride;
51
+ const styles = (0, _emotion.useStyle)({
52
+ generateStyle: _styles.default,
53
+ themeOverride,
54
+ params: {
55
+ textAlign
56
+ },
57
+ componentId: 'Metric',
58
+ displayName: 'Metric'
59
+ });
60
+ return (0, _jsxRuntime.jsxs)("div", {
61
+ ...(0, _passthroughProps.passthroughProps)(props),
62
+ role: isGroupChild ? 'row' : void 0,
63
+ css: styles === null || styles === void 0 ? void 0 : styles.metric,
64
+ ref: ref,
65
+ "data-cid": "Metric",
66
+ children: [(0, _jsxRuntime.jsx)("div", {
67
+ role: isGroupChild ? 'rowheader' : void 0,
68
+ css: styles === null || styles === void 0 ? void 0 : styles.label,
69
+ children: (0, _callRenderProp.callRenderProp)(renderLabel)
70
+ }), (0, _jsxRuntime.jsx)("div", {
71
+ role: isGroupChild ? 'gridcell' : void 0,
72
+ css: styles === null || styles === void 0 ? void 0 : styles.value,
73
+ children: (0, _callRenderProp.callRenderProp)(renderValue)
74
+ })]
75
+ });
76
+ });
77
+ Metric.displayName = 'Metric';
78
+ var _default = exports.default = Metric;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.allowedProps = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ const allowedProps = exports.allowedProps = ['textAlign', 'renderLabel', 'renderValue', 'isGroupChild'];
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ /**
32
+ * ---
33
+ * private: true
34
+ * ---
35
+ * Generates the style object from the theme and provided additional information
36
+ * @param {Object} componentTheme The theme variable object.
37
+ * @param {Object} params the props of the component, the style is applied to
38
+ * @return {Object} The final style object, which will be used in the component
39
+ */
40
+ const generateStyle = (componentTheme, params) => {
41
+ const textAlign = params.textAlign;
42
+ return {
43
+ metric: {
44
+ label: 'metric',
45
+ display: 'flex',
46
+ flexDirection: 'column-reverse',
47
+ boxSizing: 'border-box',
48
+ paddingLeft: componentTheme.paddingHorizontal,
49
+ paddingRight: componentTheme.paddingHorizontal,
50
+ textAlign,
51
+ gap: componentTheme.gapTexts
52
+ },
53
+ label: {
54
+ label: 'metric__label',
55
+ fontWeight: componentTheme.labelFontWeight,
56
+ fontSize: componentTheme.labelFontSize,
57
+ color: componentTheme.labelColor,
58
+ fontFamily: componentTheme.labelFontFamily,
59
+ lineHeight: componentTheme.labelLineHeight
60
+ },
61
+ value: {
62
+ label: 'metric__value',
63
+ fontWeight: componentTheme.valueFontWeight,
64
+ fontSize: componentTheme.valueFontSize,
65
+ color: componentTheme.valueColor,
66
+ fontFamily: componentTheme.valueFontFamily,
67
+ lineHeight: componentTheme.valueLineHeight
68
+ }
69
+ };
70
+ };
71
+ var _default = exports.default = generateStyle;
@@ -42,7 +42,7 @@ var _dec, _class, _MetricGroup;
42
42
  category: components
43
43
  ---
44
44
  **/
45
- let MetricGroup = exports.MetricGroup = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_MetricGroup = class MetricGroup extends _react.Component {
45
+ let MetricGroup = exports.MetricGroup = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = (_MetricGroup = class MetricGroup extends _react.Component {
46
46
  constructor(...args) {
47
47
  super(...args);
48
48
  this.ref = null;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = exports.MetricGroup = void 0;
8
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
+ var _react = require("react");
10
+ var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
11
+ var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
12
+ var _styles = _interopRequireDefault(require("./styles"));
13
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
14
+ const _excluded = ["children"];
15
+ /*
16
+ * The MIT License (MIT)
17
+ *
18
+ * Copyright (c) 2015 - present Instructure, Inc.
19
+ *
20
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
21
+ * of this software and associated documentation files (the "Software"), to deal
22
+ * in the Software without restriction, including without limitation the rights
23
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24
+ * copies of the Software, and to permit persons to whom the Software is
25
+ * furnished to do so, subject to the following conditions:
26
+ *
27
+ * The above copyright notice and this permission notice shall be included in all
28
+ * copies or substantial portions of the Software.
29
+ *
30
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36
+ * SOFTWARE.
37
+ */
38
+ /**
39
+ ---
40
+ category: components
41
+ ---
42
+ **/
43
+ const MetricGroup = exports.MetricGroup = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
44
+ const _props$children = props.children,
45
+ children = _props$children === void 0 ? null : _props$children,
46
+ rest = (0, _objectWithoutProperties2.default)(props, _excluded);
47
+ const styles = (0, _styles.default)();
48
+ const renderChildren = () => {
49
+ return _react.Children.map(children, child => {
50
+ return (0, _safeCloneElement.safeCloneElement)(child, {
51
+ isGroupChild: true
52
+ });
53
+ });
54
+ };
55
+ return (0, _jsxRuntime.jsx)("div", {
56
+ ...(0, _passthroughProps.passthroughProps)(rest),
57
+ css: styles === null || styles === void 0 ? void 0 : styles.metricGroup,
58
+ role: "grid",
59
+ "aria-readonly": "true",
60
+ ref: ref,
61
+ "data-cid": "MetricGroup",
62
+ children: renderChildren()
63
+ });
64
+ });
65
+ MetricGroup.displayName = 'MetricGroup';
66
+ var _default = exports.default = MetricGroup;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.allowedProps = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ const allowedProps = exports.allowedProps = ['children'];
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ /**
32
+ * ---
33
+ * private: true
34
+ * ---
35
+ * Generates the style object from the theme and provided additional information
36
+ * @return {Object} The final style object, which will be used in the component
37
+ */
38
+ const generateStyle = () => {
39
+ return {
40
+ metricGroup: {
41
+ label: 'metricGroup',
42
+ boxSizing: 'border-box',
43
+ display: 'flex',
44
+ flexWrap: 'wrap',
45
+ alignItems: 'flex-start',
46
+ justifyContent: 'space-around'
47
+ }
48
+ };
49
+ };
50
+ var _default = exports.default = generateStyle;