@spaced-out/ui-design-system 0.0.22 → 0.0.23
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 +22 -0
- package/design-tokens/color/app-color.json +7 -0
- package/design-tokens/size/base-size.json +6 -0
- package/lib/components/Avatar/Avatar.js +15 -5
- package/lib/components/Avatar/Avatar.js.flow +14 -0
- package/lib/components/Avatar/Avatar.module.css +21 -1
- package/lib/components/Chip/Chip.js +11 -3
- package/lib/components/Chip/Chip.js.flow +12 -2
- package/lib/components/Chip/Chip.module.css +31 -0
- package/lib/components/Icon/Icon.js.flow +1 -1
- package/lib/components/SideMenuLink/SideMenuLink.module.css +1 -0
- package/lib/components/StatusIndicator/StatusIndicator.js +36 -0
- package/lib/components/StatusIndicator/StatusIndicator.js.flow +47 -0
- package/lib/components/StatusIndicator/StatusIndicator.module.css +37 -0
- package/lib/components/StatusIndicator/index.js +16 -0
- package/lib/components/StatusIndicator/index.js.flow +3 -0
- package/lib/components/SubMenu/SubMenu.js +168 -0
- package/lib/components/SubMenu/SubMenu.js.flow +243 -0
- package/lib/components/SubMenu/SubMenu.module.css +119 -0
- package/lib/components/SubMenu/index.js +42 -0
- package/lib/components/SubMenu/index.js.flow +11 -0
- package/lib/components/Tabs/Tab/Tab.js +2 -2
- package/lib/components/Tabs/Tab/Tab.js.flow +24 -19
- package/lib/components/Tabs/Tab/Tab.module.css +5 -1
- package/lib/styles/variables/_color.css +2 -0
- package/lib/styles/variables/_color.js +3 -1
- package/lib/styles/variables/_color.js.flow +2 -0
- package/lib/styles/variables/_size.css +4 -0
- package/lib/styles/variables/_size.js +6 -2
- package/lib/styles/variables/_size.js.flow +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
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.0.23](https://github.com/spaced-out/ui-design-system/compare/v0.0.23-beta.0...v0.0.23) (2023-02-14)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* import fixes for avataar ([1880ed7](https://github.com/spaced-out/ui-design-system/commit/1880ed760283e48347b68c220a7ba11a54dfcd4f))
|
|
11
|
+
* status support for avataar ([e877b88](https://github.com/spaced-out/ui-design-system/commit/e877b88c326262f9738da89457bd417d4f684002))
|
|
12
|
+
|
|
13
|
+
### [0.0.23-beta.0](https://github.com/spaced-out/ui-design-system/compare/v0.0.22...v0.0.23-beta.0) (2023-02-14)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* [GDS-118] sub menu ([#61](https://github.com/spaced-out/ui-design-system/issues/61)) ([7e32aae](https://github.com/spaced-out/ui-design-system/commit/7e32aaebb5427188e8e3f35f5fcd7066557be579))
|
|
19
|
+
* status indicator component ([7f6b0bd](https://github.com/spaced-out/ui-design-system/commit/7f6b0bdcb0c5506f9f5c4c3fcc50206073f4eabe))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* chip states and chip truncate text fixes ([16573d2](https://github.com/spaced-out/ui-design-system/commit/16573d24ff201335c33a888aff3d7cf3dd36a133))
|
|
25
|
+
* tab onhover and icon only center ([#64](https://github.com/spaced-out/ui-design-system/issues/64)) ([148606a](https://github.com/spaced-out/ui-design-system/commit/148606af18fa7808612236bd0cb34a61908a2f49))
|
|
26
|
+
|
|
5
27
|
### [0.0.22](https://github.com/spaced-out/ui-design-system/compare/v0.0.21...v0.0.22) (2023-02-09)
|
|
6
28
|
|
|
7
29
|
|
|
@@ -69,6 +69,9 @@
|
|
|
69
69
|
"240": {
|
|
70
70
|
"value": "240px"
|
|
71
71
|
},
|
|
72
|
+
"260": {
|
|
73
|
+
"value": "260px"
|
|
74
|
+
},
|
|
72
75
|
"276": {
|
|
73
76
|
"value": "276px"
|
|
74
77
|
},
|
|
@@ -98,6 +101,9 @@
|
|
|
98
101
|
},
|
|
99
102
|
"fluid": {
|
|
100
103
|
"value": "100%"
|
|
104
|
+
},
|
|
105
|
+
"fullViewportHeight": {
|
|
106
|
+
"value": "100vh"
|
|
101
107
|
}
|
|
102
108
|
}
|
|
103
109
|
}
|
|
@@ -9,6 +9,7 @@ var _Text = require("../../components/Text");
|
|
|
9
9
|
var _color = require("../../styles/variables/_color");
|
|
10
10
|
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
11
11
|
var _Icon = require("../Icon");
|
|
12
|
+
var _StatusIndicator = require("../StatusIndicator");
|
|
12
13
|
var _AvatarModule = _interopRequireDefault(require("./Avatar.module.css"));
|
|
13
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
15
|
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); }
|
|
@@ -66,14 +67,20 @@ const AvatarConditionalContent = _ref2 => {
|
|
|
66
67
|
iconName,
|
|
67
68
|
size,
|
|
68
69
|
iconType,
|
|
69
|
-
color = 'blue'
|
|
70
|
+
color = 'blue',
|
|
71
|
+
status
|
|
70
72
|
} = _ref2;
|
|
71
73
|
return /*#__PURE__*/React.createElement("div", {
|
|
72
74
|
className: _AvatarModule.default.innerContainer,
|
|
73
75
|
style: {
|
|
74
76
|
background: AVATAR_COLOR[color]
|
|
75
77
|
}
|
|
76
|
-
},
|
|
78
|
+
}, !!status && /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
className: (0, _classify.default)(_AvatarModule.default.statusIndicatorWrapper, _AvatarModule.default[size])
|
|
80
|
+
}, /*#__PURE__*/React.createElement(_StatusIndicator.StatusIndicator, {
|
|
81
|
+
status: status,
|
|
82
|
+
withBorder: true
|
|
83
|
+
})), imageSrc ? /*#__PURE__*/React.createElement("img", {
|
|
77
84
|
src: imageSrc,
|
|
78
85
|
alt: "Avatar",
|
|
79
86
|
className: _AvatarModule.default.avatar
|
|
@@ -96,7 +103,8 @@ const Avatar = _ref3 => {
|
|
|
96
103
|
iconName,
|
|
97
104
|
iconType,
|
|
98
105
|
color,
|
|
99
|
-
ring = false
|
|
106
|
+
ring = false,
|
|
107
|
+
status
|
|
100
108
|
} = _ref3;
|
|
101
109
|
return /*#__PURE__*/React.createElement("div", {
|
|
102
110
|
className: (0, _classify.default)(_AvatarModule.default.container, {
|
|
@@ -115,14 +123,16 @@ const Avatar = _ref3 => {
|
|
|
115
123
|
iconName: iconName,
|
|
116
124
|
iconType: iconType,
|
|
117
125
|
color: color,
|
|
118
|
-
size: size
|
|
126
|
+
size: size,
|
|
127
|
+
status: status
|
|
119
128
|
}))) : /*#__PURE__*/React.createElement(AvatarConditionalContent, {
|
|
120
129
|
imageSrc: imageSrc,
|
|
121
130
|
text: text,
|
|
122
131
|
iconName: iconName,
|
|
123
132
|
iconType: iconType,
|
|
124
133
|
color: color,
|
|
125
|
-
size: size
|
|
134
|
+
size: size,
|
|
135
|
+
status: status
|
|
126
136
|
}));
|
|
127
137
|
};
|
|
128
138
|
exports.Avatar = Avatar;
|
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
import classify from '../../utils/classify';
|
|
19
19
|
import type {IconType} from '../Icon';
|
|
20
20
|
import {Icon} from '../Icon';
|
|
21
|
+
import type {StatusSemanticType} from '../StatusIndicator';
|
|
22
|
+
import {StatusIndicator} from '../StatusIndicator';
|
|
21
23
|
|
|
22
24
|
import css from './Avatar.module.css';
|
|
23
25
|
|
|
@@ -55,6 +57,7 @@ export type AvatarProps = {
|
|
|
55
57
|
iconName?: string,
|
|
56
58
|
iconType?: IconType,
|
|
57
59
|
ring?: boolean,
|
|
60
|
+
status?: StatusSemanticType,
|
|
58
61
|
};
|
|
59
62
|
|
|
60
63
|
const getAvatarText = (text = '') => {
|
|
@@ -96,6 +99,7 @@ export type AvatarContentProps = {
|
|
|
96
99
|
size: AvatarSize,
|
|
97
100
|
color?: AvatarColorType,
|
|
98
101
|
ring?: boolean,
|
|
102
|
+
status?: StatusSemanticType,
|
|
99
103
|
};
|
|
100
104
|
|
|
101
105
|
const AvatarConditionalContent = ({
|
|
@@ -105,8 +109,15 @@ const AvatarConditionalContent = ({
|
|
|
105
109
|
size,
|
|
106
110
|
iconType,
|
|
107
111
|
color = 'blue',
|
|
112
|
+
status,
|
|
108
113
|
}: AvatarContentProps) => (
|
|
109
114
|
<div className={css.innerContainer} style={{background: AVATAR_COLOR[color]}}>
|
|
115
|
+
{!!status && (
|
|
116
|
+
<div className={classify(css.statusIndicatorWrapper, css[size])}>
|
|
117
|
+
<StatusIndicator status={status} withBorder />
|
|
118
|
+
</div>
|
|
119
|
+
)}
|
|
120
|
+
|
|
110
121
|
{imageSrc ? (
|
|
111
122
|
<img src={imageSrc} alt="Avatar" className={css.avatar}></img>
|
|
112
123
|
) : iconName ? (
|
|
@@ -127,6 +138,7 @@ export const Avatar = ({
|
|
|
127
138
|
iconType,
|
|
128
139
|
color,
|
|
129
140
|
ring = false,
|
|
141
|
+
status,
|
|
130
142
|
}: AvatarProps): React.Node => (
|
|
131
143
|
<div
|
|
132
144
|
className={classify(
|
|
@@ -150,6 +162,7 @@ export const Avatar = ({
|
|
|
150
162
|
iconType={iconType}
|
|
151
163
|
color={color}
|
|
152
164
|
size={size}
|
|
165
|
+
status={status}
|
|
153
166
|
/>
|
|
154
167
|
</div>
|
|
155
168
|
</div>
|
|
@@ -161,6 +174,7 @@ export const Avatar = ({
|
|
|
161
174
|
iconType={iconType}
|
|
162
175
|
color={color}
|
|
163
176
|
size={size}
|
|
177
|
+
status={status}
|
|
164
178
|
/>
|
|
165
179
|
)}
|
|
166
180
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@value (colorFillPrimary, colorBackgroundTertiary, colorInformation) from '../../styles/variables/_color.css';
|
|
2
2
|
@value ( size34, size42, size60, sizeFluid) from '../../styles/variables/_size.css';
|
|
3
3
|
@value (borderRadiusCircle, borderRadiusLarge, borderRadiusXLarge, borderWidthSecondary) from '../../styles/variables/_border.css';
|
|
4
|
-
@value (spaceXXSmall, spaceXSmall) from '../../styles/variables/_space.css';
|
|
4
|
+
@value (spaceNone, spaceXXSmall, spaceXSmall) from '../../styles/variables/_space.css';
|
|
5
5
|
|
|
6
6
|
.container {
|
|
7
7
|
border-radius: borderRadiusCircle;
|
|
@@ -79,9 +79,29 @@
|
|
|
79
79
|
|
|
80
80
|
.innerContainer {
|
|
81
81
|
display: flex;
|
|
82
|
+
position: relative;
|
|
82
83
|
border-radius: borderRadiusCircle;
|
|
83
84
|
width: sizeFluid;
|
|
84
85
|
height: sizeFluid;
|
|
85
86
|
align-items: center;
|
|
86
87
|
justify-content: center;
|
|
87
88
|
}
|
|
89
|
+
|
|
90
|
+
.statusIndicatorWrapper {
|
|
91
|
+
position: absolute;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.statusIndicatorWrapper.large {
|
|
95
|
+
top: calc(spaceXXSmall / 2);
|
|
96
|
+
right: calc(spaceXXSmall / 2);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.statusIndicatorWrapper.medium {
|
|
100
|
+
top: spaceNone;
|
|
101
|
+
right: spaceNone;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.statusIndicatorWrapper.small {
|
|
105
|
+
top: calc((spaceXXSmall / 2) * -1);
|
|
106
|
+
right: calc((spaceXXSmall / 2) * -1);
|
|
107
|
+
}
|
|
@@ -7,6 +7,7 @@ exports.Chip = exports.CHIP_SEMANTIC = void 0;
|
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _classify = require("../../utils/classify");
|
|
9
9
|
var _Icon = require("../Icon");
|
|
10
|
+
var _Truncate = require("../Truncate");
|
|
10
11
|
var _ChipModule = _interopRequireDefault(require("./Chip.module.css"));
|
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
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); }
|
|
@@ -31,6 +32,7 @@ const Chip = _ref => {
|
|
|
31
32
|
iconType = 'regular',
|
|
32
33
|
dismissable = false,
|
|
33
34
|
onDismiss = () => null,
|
|
35
|
+
onClick,
|
|
34
36
|
disabled
|
|
35
37
|
} = _ref;
|
|
36
38
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -47,18 +49,24 @@ const Chip = _ref => {
|
|
|
47
49
|
[_ChipModule.default.dismissable]: dismissable,
|
|
48
50
|
[_ChipModule.default.withIcon]: !!iconName && size !== 'small',
|
|
49
51
|
[_ChipModule.default.disabled]: disabled
|
|
50
|
-
}, classNames?.wrapper)
|
|
52
|
+
}, classNames?.wrapper),
|
|
53
|
+
onClick: onClick
|
|
51
54
|
}, iconName && size !== 'small' && /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
52
55
|
className: _ChipModule.default.chipIcon,
|
|
53
56
|
name: iconName,
|
|
54
57
|
type: iconType,
|
|
55
58
|
size: "small"
|
|
56
|
-
}), children, dismissable && size !== 'small' && /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
59
|
+
}), /*#__PURE__*/React.createElement(_Truncate.Truncate, null, children), dismissable && size !== 'small' && /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
57
60
|
className: _ChipModule.default.dismissIcon,
|
|
58
61
|
name: "xmark",
|
|
59
62
|
type: iconType,
|
|
60
63
|
size: "small",
|
|
61
|
-
onClick: event =>
|
|
64
|
+
onClick: event => {
|
|
65
|
+
event.stopPropagation();
|
|
66
|
+
if (!disabled && onDismiss) {
|
|
67
|
+
onDismiss(event);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
62
70
|
}));
|
|
63
71
|
};
|
|
64
72
|
exports.Chip = Chip;
|
|
@@ -5,6 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import {classify} from '../../utils/classify';
|
|
6
6
|
import type {IconType} from '../Icon';
|
|
7
7
|
import {Icon} from '../Icon';
|
|
8
|
+
import {Truncate} from '../Truncate';
|
|
8
9
|
|
|
9
10
|
import css from './Chip.module.css';
|
|
10
11
|
|
|
@@ -27,6 +28,7 @@ export type BaseChipProps = {
|
|
|
27
28
|
semantic?: ChipSemanticType,
|
|
28
29
|
children: React.Node,
|
|
29
30
|
disabled?: boolean,
|
|
31
|
+
onClick?: ?(SyntheticEvent<HTMLElement>) => mixed,
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
export type MediumChipProps = {
|
|
@@ -53,6 +55,7 @@ export const Chip = ({
|
|
|
53
55
|
iconType = 'regular',
|
|
54
56
|
dismissable = false,
|
|
55
57
|
onDismiss = () => null,
|
|
58
|
+
onClick,
|
|
56
59
|
disabled,
|
|
57
60
|
}: ChipProps): React.Node => (
|
|
58
61
|
<div
|
|
@@ -74,6 +77,7 @@ export const Chip = ({
|
|
|
74
77
|
},
|
|
75
78
|
classNames?.wrapper,
|
|
76
79
|
)}
|
|
80
|
+
onClick={onClick}
|
|
77
81
|
>
|
|
78
82
|
{iconName && size !== 'small' && (
|
|
79
83
|
<Icon
|
|
@@ -83,14 +87,20 @@ export const Chip = ({
|
|
|
83
87
|
size="small"
|
|
84
88
|
/>
|
|
85
89
|
)}
|
|
86
|
-
{children}
|
|
90
|
+
<Truncate>{children}</Truncate>
|
|
91
|
+
|
|
87
92
|
{dismissable && size !== 'small' && (
|
|
88
93
|
<Icon
|
|
89
94
|
className={css.dismissIcon}
|
|
90
95
|
name="xmark"
|
|
91
96
|
type={iconType}
|
|
92
97
|
size="small"
|
|
93
|
-
onClick={(event) =>
|
|
98
|
+
onClick={(event) => {
|
|
99
|
+
event.stopPropagation();
|
|
100
|
+
if (!disabled && onDismiss) {
|
|
101
|
+
onDismiss(event);
|
|
102
|
+
}
|
|
103
|
+
}}
|
|
94
104
|
/>
|
|
95
105
|
)}
|
|
96
106
|
</div>
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
@value (
|
|
2
2
|
colorNeutralLightest,
|
|
3
|
+
colorNeutralLight,
|
|
3
4
|
colorInformationLightest,
|
|
5
|
+
colorInformationLight,
|
|
4
6
|
colorSuccessLightest,
|
|
7
|
+
colorSuccessLight,
|
|
5
8
|
colorWarningLightest,
|
|
9
|
+
colorWarningLight,
|
|
6
10
|
colorDangerLightest,
|
|
11
|
+
colorDangerLight,
|
|
12
|
+
colorGrayLightest,
|
|
7
13
|
colorBackgroundTertiary,
|
|
8
14
|
colorTextDisabled,
|
|
9
15
|
colorFillDisabled
|
|
@@ -28,33 +34,58 @@
|
|
|
28
34
|
padding: spaceXXSmall spaceSmall;
|
|
29
35
|
gap: spaceXXSmall;
|
|
30
36
|
border-radius: borderRadiusXSmall;
|
|
37
|
+
cursor: pointer;
|
|
31
38
|
}
|
|
32
39
|
|
|
33
40
|
.primary {
|
|
34
41
|
background-color: colorNeutralLightest;
|
|
35
42
|
}
|
|
36
43
|
|
|
44
|
+
.primary:hover {
|
|
45
|
+
background-color: colorNeutralLight;
|
|
46
|
+
}
|
|
47
|
+
|
|
37
48
|
.information {
|
|
38
49
|
background-color: colorInformationLightest;
|
|
39
50
|
}
|
|
40
51
|
|
|
52
|
+
.information:hover {
|
|
53
|
+
background-color: colorInformationLight;
|
|
54
|
+
}
|
|
55
|
+
|
|
41
56
|
.success {
|
|
42
57
|
background-color: colorSuccessLightest;
|
|
43
58
|
}
|
|
44
59
|
|
|
60
|
+
.success:hover {
|
|
61
|
+
background-color: colorSuccessLight;
|
|
62
|
+
}
|
|
63
|
+
|
|
45
64
|
.warning {
|
|
46
65
|
background-color: colorWarningLightest;
|
|
47
66
|
}
|
|
48
67
|
|
|
68
|
+
.warning:hover {
|
|
69
|
+
background-color: colorWarningLight;
|
|
70
|
+
}
|
|
71
|
+
|
|
49
72
|
.danger {
|
|
50
73
|
background-color: colorDangerLightest;
|
|
51
74
|
}
|
|
52
75
|
|
|
76
|
+
.danger:hover {
|
|
77
|
+
background-color: colorDangerLight;
|
|
78
|
+
}
|
|
79
|
+
|
|
53
80
|
.secondary {
|
|
54
81
|
composes: borderPrimary from '../../styles/border.module.css';
|
|
55
82
|
background-color: colorBackgroundTertiary;
|
|
56
83
|
}
|
|
57
84
|
|
|
85
|
+
.secondary:hover {
|
|
86
|
+
background-color: colorGrayLightest;
|
|
87
|
+
}
|
|
88
|
+
|
|
58
89
|
.withIcon {
|
|
59
90
|
padding: spaceXXSmall spaceSmall spaceXXSmall spaceXSmall;
|
|
60
91
|
}
|
|
@@ -12,7 +12,7 @@ import classify from '../../utils/classify';
|
|
|
12
12
|
import typographyStyle from '../../styles/typography.module.css';
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
export type IconType = 'regular' | 'solid' | 'duotone';
|
|
15
|
+
export type IconType = 'regular' | 'solid' | 'duotone' | 'brands';
|
|
16
16
|
|
|
17
17
|
export const ICON_SIZE = Object.freeze({
|
|
18
18
|
small: 'small',
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StatusIndicator = exports.STATUS_SEMANTIC = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
9
|
+
var _StatusIndicatorModule = _interopRequireDefault(require("./StatusIndicator.module.css"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
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); }
|
|
14
|
+
const STATUS_SEMANTIC = Object.freeze({
|
|
15
|
+
information: 'information',
|
|
16
|
+
success: 'success',
|
|
17
|
+
warning: 'warning',
|
|
18
|
+
danger: 'danger',
|
|
19
|
+
neutral: 'neutral'
|
|
20
|
+
});
|
|
21
|
+
exports.STATUS_SEMANTIC = STATUS_SEMANTIC;
|
|
22
|
+
const StatusIndicator = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
classNames,
|
|
25
|
+
status = 'information',
|
|
26
|
+
withBorder,
|
|
27
|
+
...props
|
|
28
|
+
} = _ref;
|
|
29
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
30
|
+
"data-testid": "StatusIndicator",
|
|
31
|
+
className: (0, _classify.default)(_StatusIndicatorModule.default.statusWrapper, _StatusIndicatorModule.default[status], {
|
|
32
|
+
[_StatusIndicatorModule.default.withBorder]: withBorder
|
|
33
|
+
}, classNames?.wrapper)
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
exports.StatusIndicator = StatusIndicator;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import classify from '../../utils/classify';
|
|
6
|
+
|
|
7
|
+
import css from './StatusIndicator.module.css';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
type ClassNames = $ReadOnly<{wrapper?: string}>;
|
|
11
|
+
|
|
12
|
+
export const STATUS_SEMANTIC = Object.freeze({
|
|
13
|
+
information: 'information',
|
|
14
|
+
success: 'success',
|
|
15
|
+
warning: 'warning',
|
|
16
|
+
danger: 'danger',
|
|
17
|
+
neutral: 'neutral',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type StatusSemanticType = $Values<typeof STATUS_SEMANTIC>;
|
|
21
|
+
|
|
22
|
+
export type StatusIndicatorProps = {
|
|
23
|
+
classNames?: ClassNames,
|
|
24
|
+
status?: StatusSemanticType,
|
|
25
|
+
withBorder?: boolean,
|
|
26
|
+
...
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const StatusIndicator = ({
|
|
30
|
+
classNames,
|
|
31
|
+
status = 'information',
|
|
32
|
+
withBorder,
|
|
33
|
+
...props
|
|
34
|
+
}: StatusIndicatorProps): React.Node => (
|
|
35
|
+
<div
|
|
36
|
+
{...props}
|
|
37
|
+
data-testid="StatusIndicator"
|
|
38
|
+
className={classify(
|
|
39
|
+
css.statusWrapper,
|
|
40
|
+
css[status],
|
|
41
|
+
{
|
|
42
|
+
[css.withBorder]: withBorder,
|
|
43
|
+
},
|
|
44
|
+
classNames?.wrapper,
|
|
45
|
+
)}
|
|
46
|
+
></div>
|
|
47
|
+
);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@value (colorInformation, colorSuccess, colorWarning, colorDanger, colorNeutral, colorBackgroundTertiary) from '../../styles/variables/_color.css';
|
|
2
|
+
@value (size8) from '../../styles/variables/_size.css';
|
|
3
|
+
@value (borderRadiusCircle, borderWidthTertiary) from '../../styles/variables/_border.css';
|
|
4
|
+
|
|
5
|
+
.statusWrapper {
|
|
6
|
+
display: flex;
|
|
7
|
+
color: colorFillPrimary;
|
|
8
|
+
width: size8;
|
|
9
|
+
height: size8;
|
|
10
|
+
border-radius: borderRadiusCircle;
|
|
11
|
+
background-color: colorInformation;
|
|
12
|
+
box-sizing: content-box;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.information {
|
|
16
|
+
background-color: colorInformation;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.success {
|
|
20
|
+
background-color: colorSuccess;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.warning {
|
|
24
|
+
background-color: colorWarning;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.danger {
|
|
28
|
+
background-color: colorDanger;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.neutral {
|
|
32
|
+
background-color: colorNeutral;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.withBorder {
|
|
36
|
+
border: borderWidthTertiary solid colorBackgroundTertiary;
|
|
37
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _StatusIndicator = require("./StatusIndicator");
|
|
7
|
+
Object.keys(_StatusIndicator).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _StatusIndicator[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _StatusIndicator[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|