@spaced-out/ui-design-system 0.1.56 → 0.1.58
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 +14 -0
- package/design-tokens/font/base-font.json +6 -0
- package/design-tokens/size/base-size.json +3 -0
- package/lib/components/Banner/Banner.js +6 -5
- package/lib/components/Banner/Banner.js.flow +2 -1
- package/lib/components/Icon/SemanticIcon.js +30 -0
- package/lib/components/Icon/SemanticIcon.js.flow +42 -0
- package/lib/components/Icon/SemanticIcon.module.css +47 -0
- package/lib/components/Icon/index.js +8 -1
- package/lib/components/Icon/index.js.flow +2 -0
- package/lib/components/InContextAlert/InContextAlert.js +13 -20
- package/lib/components/InContextAlert/InContextAlert.js.flow +2 -9
- package/lib/components/KPIBox/KPIBox.js +46 -0
- package/lib/components/KPIBox/KPIBox.js.flow +97 -0
- package/lib/components/KPIBox/KPIBox.module.css +47 -0
- package/lib/components/KPIBox/index.js +16 -0
- package/lib/components/KPIBox/index.js.flow +3 -0
- package/lib/components/Text/Text.js +191 -30
- package/lib/components/Text/Text.js.flow +272 -0
- package/lib/components/Text/index.js +42 -0
- package/lib/components/Text/index.js.flow +7 -0
- package/lib/components/Toggle/Toggle.js +5 -2
- package/lib/components/Toggle/Toggle.js.flow +8 -1
- package/lib/components/index.js +11 -0
- package/lib/components/index.js.flow +1 -0
- package/lib/styles/index.css +6 -0
- package/lib/styles/index.js +8 -2
- package/lib/styles/index.js.flow +6 -0
- package/lib/styles/typography.module.css +19 -1
- package/lib/styles/variables/_font.css +4 -0
- package/lib/styles/variables/_font.js +5 -1
- package/lib/styles/variables/_font.js.flow +4 -0
- package/lib/styles/variables/_size.css +2 -0
- package/lib/styles/variables/_size.js +3 -1
- package/lib/styles/variables/_size.js.flow +2 -0
- package/lib/types/common.js +15 -0
- package/lib/types/common.js.flow +10 -0
- package/lib/utils/array/are-arrays-equal.js +11 -0
- package/lib/utils/array/are-arrays-equal.js.flow +14 -0
- package/lib/utils/array/index.js +16 -0
- package/lib/utils/array/index.js.flow +3 -0
- package/lib/utils/index.js +11 -0
- package/lib/utils/index.js.flow +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.1.58](https://github.com/spaced-out/ui-design-system/compare/v0.1.57...v0.1.58) (2023-10-09)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* new typography components, added toggle label position prop ([869ed49](https://github.com/spaced-out/ui-design-system/commit/869ed49f8448b8a0630b2eebf0e2a65eb533160e))
|
|
11
|
+
|
|
12
|
+
### [0.1.57](https://github.com/spaced-out/ui-design-system/compare/v0.1.56...v0.1.57) (2023-10-04)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* new KPIBox component, new JumboSmall typography component and new SemanticIcon component ([#145](https://github.com/spaced-out/ui-design-system/issues/145)) ([c433c3d](https://github.com/spaced-out/ui-design-system/commit/c433c3d48409461aa06d69dfe2d2485c7dd8d9df))
|
|
18
|
+
|
|
5
19
|
### [0.1.56](https://github.com/spaced-out/ui-design-system/compare/v0.1.55...v0.1.56) (2023-09-27)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
"18": {
|
|
30
30
|
"value": "18px"
|
|
31
31
|
},
|
|
32
|
+
"24": {
|
|
33
|
+
"value": "24px"
|
|
34
|
+
},
|
|
32
35
|
"26": {
|
|
33
36
|
"value": "26px"
|
|
34
37
|
},
|
|
@@ -66,6 +69,9 @@
|
|
|
66
69
|
"120%": {
|
|
67
70
|
"value": "120%"
|
|
68
71
|
},
|
|
72
|
+
"125%": {
|
|
73
|
+
"value": "125%"
|
|
74
|
+
},
|
|
69
75
|
"130%": {
|
|
70
76
|
"value": "130%"
|
|
71
77
|
},
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Banner = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _common = require("../../types/common");
|
|
8
9
|
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
9
10
|
var _InContextAlert = require("../InContextAlert");
|
|
10
11
|
var _BannerModule = _interopRequireDefault(require("./Banner.module.css"));
|
|
@@ -26,11 +27,11 @@ const Banner = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
26
27
|
ref: ref,
|
|
27
28
|
classNames: {
|
|
28
29
|
wrapper: (0, _classify.default)(_BannerModule.default.bannerContainer, {
|
|
29
|
-
[_BannerModule.default.neutral]: semantic ===
|
|
30
|
-
[_BannerModule.default.success]: semantic ===
|
|
31
|
-
[_BannerModule.default.information]: semantic ===
|
|
32
|
-
[_BannerModule.default.warning]: semantic ===
|
|
33
|
-
[_BannerModule.default.danger]: semantic ===
|
|
30
|
+
[_BannerModule.default.neutral]: semantic === _common.ALERT_SEMANTIC.neutral,
|
|
31
|
+
[_BannerModule.default.success]: semantic === _common.ALERT_SEMANTIC.success,
|
|
32
|
+
[_BannerModule.default.information]: semantic === _common.ALERT_SEMANTIC.information,
|
|
33
|
+
[_BannerModule.default.warning]: semantic === _common.ALERT_SEMANTIC.warning,
|
|
34
|
+
[_BannerModule.default.danger]: semantic === _common.ALERT_SEMANTIC.danger,
|
|
34
35
|
[_BannerModule.default.topAligned]: alignment === 'top',
|
|
35
36
|
[_BannerModule.default.bottomAligned]: alignment === 'bottom'
|
|
36
37
|
}, classNames?.wrapper),
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
|
|
5
|
+
import {ALERT_SEMANTIC} from '../../types/common';
|
|
5
6
|
import classify from '../../utils/classify';
|
|
6
7
|
import type {InContextAlertProps} from '../InContextAlert';
|
|
7
|
-
import {
|
|
8
|
+
import {InContextAlert} from '../InContextAlert';
|
|
8
9
|
|
|
9
10
|
import css from './Banner.module.css';
|
|
10
11
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SemanticIcon = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _typography = require("../../types/typography");
|
|
9
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
10
|
+
var _Icon = require("./Icon");
|
|
11
|
+
var _SemanticIconModule = _interopRequireDefault(require("./SemanticIcon.module.css"));
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
|
+
const SemanticIcon = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
semantic = 'neutral',
|
|
19
|
+
type = 'solid',
|
|
20
|
+
classNames,
|
|
21
|
+
...iconProps
|
|
22
|
+
} = _ref;
|
|
23
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !!iconProps.name && /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
className: (0, _classify.default)(_SemanticIconModule.default.iconContainer, _SemanticIconModule.default[semantic], classNames?.wrapper)
|
|
25
|
+
}, /*#__PURE__*/React.createElement(_Icon.Icon, _extends({}, iconProps, {
|
|
26
|
+
color: _typography.TEXT_COLORS[semantic],
|
|
27
|
+
type: type
|
|
28
|
+
}))));
|
|
29
|
+
};
|
|
30
|
+
exports.SemanticIcon = SemanticIcon;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import type {AlertSemanticType} from '../../types/common';
|
|
6
|
+
import {TEXT_COLORS} from '../../types/typography';
|
|
7
|
+
import classify from '../../utils/classify';
|
|
8
|
+
|
|
9
|
+
import type {IconProps} from './Icon';
|
|
10
|
+
import {Icon} from './Icon';
|
|
11
|
+
|
|
12
|
+
import css from './SemanticIcon.module.css';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
type ClassNames = $ReadOnly<{wrapper?: string, icon?: string}>;
|
|
16
|
+
|
|
17
|
+
export type SemanticIconProps = {
|
|
18
|
+
...IconProps,
|
|
19
|
+
classNames?: ClassNames,
|
|
20
|
+
semantic?: AlertSemanticType,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const SemanticIcon = ({
|
|
24
|
+
semantic = 'neutral',
|
|
25
|
+
type = 'solid',
|
|
26
|
+
classNames,
|
|
27
|
+
...iconProps
|
|
28
|
+
}: SemanticIconProps): React.Node => (
|
|
29
|
+
<>
|
|
30
|
+
{!!iconProps.name && (
|
|
31
|
+
<div
|
|
32
|
+
className={classify(
|
|
33
|
+
css.iconContainer,
|
|
34
|
+
css[semantic],
|
|
35
|
+
classNames?.wrapper,
|
|
36
|
+
)}
|
|
37
|
+
>
|
|
38
|
+
<Icon {...iconProps} color={TEXT_COLORS[semantic]} type={type} />
|
|
39
|
+
</div>
|
|
40
|
+
)}
|
|
41
|
+
</>
|
|
42
|
+
);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@value (
|
|
2
|
+
colorNeutralLightest,
|
|
3
|
+
colorSuccessLightest,
|
|
4
|
+
colorInformationLightest,
|
|
5
|
+
colorWarningLightest,
|
|
6
|
+
colorDangerLightest
|
|
7
|
+
) from '../../styles/variables/_color.css';
|
|
8
|
+
|
|
9
|
+
@value (
|
|
10
|
+
size60,
|
|
11
|
+
size24
|
|
12
|
+
) from '../../styles/variables/_size.css';
|
|
13
|
+
|
|
14
|
+
@value (
|
|
15
|
+
borderRadiusMedium
|
|
16
|
+
) from '../../styles/variables/_border.css';
|
|
17
|
+
|
|
18
|
+
.iconContainer {
|
|
19
|
+
display: flex;
|
|
20
|
+
width: fit-content;
|
|
21
|
+
min-width: size60;
|
|
22
|
+
min-height: size60;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
align-items: center;
|
|
25
|
+
border-radius: borderRadiusMedium;
|
|
26
|
+
background-color: colorNeutralLightest;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.neutral {
|
|
30
|
+
background-color: colorNeutralLightest;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.success {
|
|
34
|
+
background-color: colorSuccessLightest;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.information {
|
|
38
|
+
background-color: colorInformationLightest;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.warning {
|
|
42
|
+
background-color: colorWarningLightest;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.danger {
|
|
46
|
+
background-color: colorDangerLightest;
|
|
47
|
+
}
|
|
@@ -21,5 +21,12 @@ Object.defineProperty(exports, "Icon", {
|
|
|
21
21
|
return _Icon.Icon;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "SemanticIcon", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _SemanticIcon.SemanticIcon;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
var _ClickableIcon = require("./ClickableIcon");
|
|
25
|
-
var _Icon = require("./Icon");
|
|
31
|
+
var _Icon = require("./Icon");
|
|
32
|
+
var _SemanticIcon = require("./SemanticIcon");
|
|
@@ -4,3 +4,5 @@ export type {CloseIconProps} from './ClickableIcon';
|
|
|
4
4
|
export {ClickableIcon, CloseIcon} from './ClickableIcon';
|
|
5
5
|
export type {IconProps, IconSize, IconType} from './Icon';
|
|
6
6
|
export {Icon} from './Icon';
|
|
7
|
+
export type {SemanticIconProps} from './SemanticIcon';
|
|
8
|
+
export {SemanticIcon} from './SemanticIcon';
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.InContextAlert =
|
|
6
|
+
exports.InContextAlert = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _common = require("../../types/common");
|
|
8
9
|
var _typography = require("../../types/typography");
|
|
9
10
|
var _classify = require("../../utils/classify");
|
|
10
11
|
var _Icon = require("../Icon");
|
|
@@ -16,14 +17,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
16
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
19
|
|
|
19
|
-
const ALERT_SEMANTIC = Object.freeze({
|
|
20
|
-
neutral: 'neutral',
|
|
21
|
-
success: 'success',
|
|
22
|
-
information: 'information',
|
|
23
|
-
warning: 'warning',
|
|
24
|
-
danger: 'danger'
|
|
25
|
-
});
|
|
26
|
-
exports.ALERT_SEMANTIC = ALERT_SEMANTIC;
|
|
27
20
|
const AlertIcon = _ref => {
|
|
28
21
|
let {
|
|
29
22
|
semantic,
|
|
@@ -31,35 +24,35 @@ const AlertIcon = _ref => {
|
|
|
31
24
|
leftIconType
|
|
32
25
|
} = _ref;
|
|
33
26
|
switch (semantic) {
|
|
34
|
-
case ALERT_SEMANTIC.neutral:
|
|
27
|
+
case _common.ALERT_SEMANTIC.neutral:
|
|
35
28
|
return /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
36
29
|
color: _typography.TEXT_COLORS.neutral,
|
|
37
30
|
name: leftIconName ? leftIconName : 'face-smile',
|
|
38
31
|
size: "small",
|
|
39
32
|
type: leftIconType
|
|
40
33
|
});
|
|
41
|
-
case ALERT_SEMANTIC.success:
|
|
34
|
+
case _common.ALERT_SEMANTIC.success:
|
|
42
35
|
return /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
43
36
|
name: leftIconName ? leftIconName : 'circle-check',
|
|
44
37
|
size: "small",
|
|
45
38
|
color: _typography.TEXT_COLORS.success,
|
|
46
39
|
type: leftIconType
|
|
47
40
|
});
|
|
48
|
-
case ALERT_SEMANTIC.information:
|
|
41
|
+
case _common.ALERT_SEMANTIC.information:
|
|
49
42
|
return /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
50
43
|
name: leftIconName ? leftIconName : 'circle-info',
|
|
51
44
|
size: "small",
|
|
52
45
|
color: _typography.TEXT_COLORS.information,
|
|
53
46
|
type: leftIconType
|
|
54
47
|
});
|
|
55
|
-
case ALERT_SEMANTIC.warning:
|
|
48
|
+
case _common.ALERT_SEMANTIC.warning:
|
|
56
49
|
return /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
57
50
|
name: leftIconName ? leftIconName : 'circle-exclamation',
|
|
58
51
|
size: "small",
|
|
59
52
|
color: _typography.TEXT_COLORS.warning,
|
|
60
53
|
type: leftIconType
|
|
61
54
|
});
|
|
62
|
-
case ALERT_SEMANTIC.danger:
|
|
55
|
+
case _common.ALERT_SEMANTIC.danger:
|
|
63
56
|
return /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
64
57
|
name: leftIconName ? leftIconName : 'shield-exclamation',
|
|
65
58
|
size: "small",
|
|
@@ -78,7 +71,7 @@ const AlertIcon = _ref => {
|
|
|
78
71
|
const InContextAlert = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
79
72
|
const {
|
|
80
73
|
classNames,
|
|
81
|
-
semantic = ALERT_SEMANTIC.neutral,
|
|
74
|
+
semantic = _common.ALERT_SEMANTIC.neutral,
|
|
82
75
|
dismissable,
|
|
83
76
|
children,
|
|
84
77
|
selfDismiss = false,
|
|
@@ -95,11 +88,11 @@ const InContextAlert = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
95
88
|
};
|
|
96
89
|
return /*#__PURE__*/React.createElement(React.Fragment, null, !dismissed && /*#__PURE__*/React.createElement("div", {
|
|
97
90
|
className: (0, _classify.classify)(_InContextAlertModule.default.alertContainer, {
|
|
98
|
-
[_InContextAlertModule.default.neutral]: semantic === ALERT_SEMANTIC.neutral,
|
|
99
|
-
[_InContextAlertModule.default.success]: semantic === ALERT_SEMANTIC.success,
|
|
100
|
-
[_InContextAlertModule.default.information]: semantic === ALERT_SEMANTIC.information,
|
|
101
|
-
[_InContextAlertModule.default.warning]: semantic === ALERT_SEMANTIC.warning,
|
|
102
|
-
[_InContextAlertModule.default.danger]: semantic === ALERT_SEMANTIC.danger
|
|
91
|
+
[_InContextAlertModule.default.neutral]: semantic === _common.ALERT_SEMANTIC.neutral,
|
|
92
|
+
[_InContextAlertModule.default.success]: semantic === _common.ALERT_SEMANTIC.success,
|
|
93
|
+
[_InContextAlertModule.default.information]: semantic === _common.ALERT_SEMANTIC.information,
|
|
94
|
+
[_InContextAlertModule.default.warning]: semantic === _common.ALERT_SEMANTIC.warning,
|
|
95
|
+
[_InContextAlertModule.default.danger]: semantic === _common.ALERT_SEMANTIC.danger
|
|
103
96
|
}, classNames?.wrapper),
|
|
104
97
|
ref: ref
|
|
105
98
|
}, /*#__PURE__*/React.createElement(AlertIcon, {
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
|
|
5
|
+
import type {AlertSemanticType} from '../../types/common';
|
|
6
|
+
import {ALERT_SEMANTIC} from '../../types/common';
|
|
5
7
|
import {TEXT_COLORS} from '../../types/typography';
|
|
6
8
|
import {classify} from '../../utils/classify';
|
|
7
9
|
import type {IconType} from '../Icon';
|
|
@@ -13,20 +15,11 @@ import {Truncate} from '../Truncate';
|
|
|
13
15
|
import css from './InContextAlert.module.css';
|
|
14
16
|
|
|
15
17
|
|
|
16
|
-
export const ALERT_SEMANTIC = Object.freeze({
|
|
17
|
-
neutral: 'neutral',
|
|
18
|
-
success: 'success',
|
|
19
|
-
information: 'information',
|
|
20
|
-
warning: 'warning',
|
|
21
|
-
danger: 'danger',
|
|
22
|
-
});
|
|
23
|
-
|
|
24
18
|
type ClassNames = $ReadOnly<{
|
|
25
19
|
wrapper?: string,
|
|
26
20
|
alertText?: string,
|
|
27
21
|
actionContainer?: string,
|
|
28
22
|
}>;
|
|
29
|
-
export type AlertSemanticType = $Values<typeof ALERT_SEMANTIC>;
|
|
30
23
|
|
|
31
24
|
type InContextAlertBaseProps = {
|
|
32
25
|
classNames?: ClassNames,
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.KPIBox = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
9
|
+
var _Icon = require("../Icon");
|
|
10
|
+
var _KPIBoxModule = _interopRequireDefault(require("./KPIBox.module.css"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
+
const KPIBox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
16
|
+
let {
|
|
17
|
+
classNames,
|
|
18
|
+
semantic = 'neutral',
|
|
19
|
+
topContent,
|
|
20
|
+
middleContent,
|
|
21
|
+
bottomContent,
|
|
22
|
+
iconName,
|
|
23
|
+
iconSize,
|
|
24
|
+
iconType = 'solid',
|
|
25
|
+
...props
|
|
26
|
+
} = _ref;
|
|
27
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
28
|
+
ref: ref,
|
|
29
|
+
"data-testid": "KPIBox",
|
|
30
|
+
className: (0, _classify.default)(_KPIBoxModule.default.wrapper, classNames?.wrapper)
|
|
31
|
+
}), !!iconName && /*#__PURE__*/React.createElement(_Icon.SemanticIcon, {
|
|
32
|
+
semantic: semantic,
|
|
33
|
+
name: iconName,
|
|
34
|
+
size: iconSize,
|
|
35
|
+
type: iconType
|
|
36
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
className: _KPIBoxModule.default.textContainer
|
|
38
|
+
}, !!topContent && /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
className: (0, _classify.default)(_KPIBoxModule.default.topFoldContent, classNames?.topFoldContent)
|
|
40
|
+
}, topContent), !!middleContent && /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
className: (0, _classify.default)(_KPIBoxModule.default.middleFoldContent, classNames?.middleFoldContent)
|
|
42
|
+
}, middleContent), !!bottomContent && /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
className: (0, _classify.default)(_KPIBoxModule.default.bottomFoldContent, classNames?.bottomFoldContent)
|
|
44
|
+
}, bottomContent)));
|
|
45
|
+
});
|
|
46
|
+
exports.KPIBox = KPIBox;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import type {AlertSemanticType} from '../../types/common';
|
|
6
|
+
import classify from '../../utils/classify';
|
|
7
|
+
import type {IconSize, IconType} from '../Icon';
|
|
8
|
+
import {SemanticIcon} from '../Icon';
|
|
9
|
+
|
|
10
|
+
import css from './KPIBox.module.css';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
type ClassNames = $ReadOnly<{
|
|
14
|
+
wrapper?: string,
|
|
15
|
+
topFoldContent?: string,
|
|
16
|
+
middleFoldContent?: string,
|
|
17
|
+
bottomFoldContent?: string,
|
|
18
|
+
}>;
|
|
19
|
+
|
|
20
|
+
export type KPIBoxProps = {
|
|
21
|
+
classNames?: ClassNames,
|
|
22
|
+
semantic: AlertSemanticType,
|
|
23
|
+
topContent?: React.Node,
|
|
24
|
+
middleContent?: React.Node,
|
|
25
|
+
bottomContent?: React.Node,
|
|
26
|
+
iconName?: string,
|
|
27
|
+
iconSize?: IconSize,
|
|
28
|
+
iconType?: IconType,
|
|
29
|
+
...
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const KPIBox: React$AbstractComponent<KPIBoxProps, HTMLDivElement> =
|
|
33
|
+
React.forwardRef<KPIBoxProps, HTMLDivElement>(
|
|
34
|
+
(
|
|
35
|
+
{
|
|
36
|
+
classNames,
|
|
37
|
+
semantic = 'neutral',
|
|
38
|
+
topContent,
|
|
39
|
+
middleContent,
|
|
40
|
+
bottomContent,
|
|
41
|
+
iconName,
|
|
42
|
+
iconSize,
|
|
43
|
+
iconType = 'solid',
|
|
44
|
+
...props
|
|
45
|
+
}: KPIBoxProps,
|
|
46
|
+
ref,
|
|
47
|
+
) => (
|
|
48
|
+
<div
|
|
49
|
+
{...props}
|
|
50
|
+
ref={ref}
|
|
51
|
+
data-testid="KPIBox"
|
|
52
|
+
className={classify(css.wrapper, classNames?.wrapper)}
|
|
53
|
+
>
|
|
54
|
+
{!!iconName && (
|
|
55
|
+
<SemanticIcon
|
|
56
|
+
semantic={semantic}
|
|
57
|
+
name={iconName}
|
|
58
|
+
size={iconSize}
|
|
59
|
+
type={iconType}
|
|
60
|
+
/>
|
|
61
|
+
)}
|
|
62
|
+
|
|
63
|
+
<div className={css.textContainer}>
|
|
64
|
+
{!!topContent && (
|
|
65
|
+
<div
|
|
66
|
+
className={classify(
|
|
67
|
+
css.topFoldContent,
|
|
68
|
+
classNames?.topFoldContent,
|
|
69
|
+
)}
|
|
70
|
+
>
|
|
71
|
+
{topContent}
|
|
72
|
+
</div>
|
|
73
|
+
)}
|
|
74
|
+
{!!middleContent && (
|
|
75
|
+
<div
|
|
76
|
+
className={classify(
|
|
77
|
+
css.middleFoldContent,
|
|
78
|
+
classNames?.middleFoldContent,
|
|
79
|
+
)}
|
|
80
|
+
>
|
|
81
|
+
{middleContent}
|
|
82
|
+
</div>
|
|
83
|
+
)}
|
|
84
|
+
{!!bottomContent && (
|
|
85
|
+
<div
|
|
86
|
+
className={classify(
|
|
87
|
+
css.bottomFoldContent,
|
|
88
|
+
classNames?.bottomFoldContent,
|
|
89
|
+
)}
|
|
90
|
+
>
|
|
91
|
+
{bottomContent}
|
|
92
|
+
</div>
|
|
93
|
+
)}
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
),
|
|
97
|
+
);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@value (
|
|
2
|
+
colorBackgroundTertiary,
|
|
3
|
+
colorTextSecondary,
|
|
4
|
+
colorTextPrimary
|
|
5
|
+
) from '../../styles/variables/_color.css';
|
|
6
|
+
@value (spaceXXSmall, spaceSmall, spaceLarge, spaceMedium) from '../../styles/variables/_space.css';
|
|
7
|
+
@value (borderRadiusMedium) from '../../styles/variables/_border.css';
|
|
8
|
+
@value (size60, size140, size252) from '../../styles/variables/_size.css';
|
|
9
|
+
|
|
10
|
+
.wrapper {
|
|
11
|
+
display: flex;
|
|
12
|
+
composes: borderPrimary from '../../styles/border.module.css';
|
|
13
|
+
min-width: size252;
|
|
14
|
+
height: fit-content;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: spaceSmall;
|
|
17
|
+
background-color: colorBackgroundTertiary;
|
|
18
|
+
border-radius: borderRadiusMedium;
|
|
19
|
+
padding: spaceLarge spaceMedium;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.textContainer {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
gap: spaceXXSmall;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.topFoldContent,
|
|
29
|
+
.middleFoldContent,
|
|
30
|
+
.bottomFoldContent {
|
|
31
|
+
display: flex;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.topFoldContent {
|
|
35
|
+
composes: formLabelSmall from '../../styles/typography.module.css';
|
|
36
|
+
color: colorTextSecondary;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.middleFoldContent {
|
|
40
|
+
composes: jumboSmall from '../../styles/typography.module.css';
|
|
41
|
+
color: colorTextPrimary;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.bottomFoldContent {
|
|
45
|
+
composes: bodySmall from '../../styles/typography.module.css';
|
|
46
|
+
color: colorTextSecondary;
|
|
47
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _KPIBox = require("./KPIBox");
|
|
7
|
+
Object.keys(_KPIBox).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _KPIBox[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _KPIBox[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|