@spaced-out/ui-design-system 0.0.4 → 0.0.5
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 +7 -0
- package/design-tokens/border/app-border.json +3 -0
- package/design-tokens/border/base-border.json +3 -0
- package/design-tokens/color/app-color.json +8 -5
- package/design-tokens/size/base-size.json +6 -0
- package/lib/components/Avatar/Avatar.js +150 -0
- package/lib/components/Avatar/Avatar.js.flow +178 -0
- package/lib/components/Avatar/Avatar.module.css +87 -0
- package/lib/components/Avatar/index.js +16 -0
- package/lib/components/Avatar/index.js.flow +3 -0
- package/lib/components/AvatarGroup/AvatarGroup.js +110 -0
- package/lib/components/AvatarGroup/AvatarGroup.js.flow +137 -0
- package/lib/components/AvatarGroup/AvatarGroup.module.css +35 -0
- package/lib/components/AvatarGroup/index.js +16 -0
- package/lib/components/AvatarGroup/index.js.flow +3 -0
- package/lib/components/Badge/Badge.js +41 -0
- package/lib/components/Badge/Badge.js.flow +58 -0
- package/lib/components/Badge/Badge.module.css +17 -0
- package/lib/components/Badge/index.js +12 -0
- package/lib/components/Badge/index.js.flow +4 -0
- package/lib/components/Card/Card.js +46 -0
- package/lib/components/Card/Card.js.flow +56 -0
- package/lib/components/Card/Card.module.css +9 -0
- package/lib/components/Card/index.js +12 -0
- package/lib/components/Card/index.js.flow +4 -0
- package/lib/components/CircularLoader/CircularLoader.js +1 -1
- package/lib/components/CircularLoader/CircularLoader.js.flow +1 -1
- package/lib/components/Tooltip/Tooltip.js +6 -6
- package/lib/components/Tooltip/Tooltip.js.flow +23 -15
- package/lib/components/Tooltip/index.js.flow +1 -1
- package/lib/styles/variables/_border.css +2 -0
- package/lib/styles/variables/_border.js +3 -1
- package/lib/styles/variables/_border.js.flow +2 -0
- 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 +5 -1
- package/lib/styles/variables/_size.js.flow +4 -0
- package/lib/utils/click-away.js +1 -1
- package/lib/utils/click-away.js.flow +1 -1
- package/lib/utils/string.js +14 -0
- package/lib/utils/string.js.flow +10 -0
- package/package.json +9 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import {colorBackgroundTertiary} from '../../styles/variables/_color';
|
|
6
|
+
import {
|
|
7
|
+
spaceSmall,
|
|
8
|
+
spaceXSmall,
|
|
9
|
+
spaceXXSmall,
|
|
10
|
+
} from '../../styles/variables/_space';
|
|
11
|
+
import classify from '../../utils/classify';
|
|
12
|
+
import type {AvatarSize} from '../Avatar';
|
|
13
|
+
import {BaseAvatar} from '../Avatar';
|
|
14
|
+
import type {PlacementType} from '../Tooltip';
|
|
15
|
+
import {Tooltip} from '../Tooltip';
|
|
16
|
+
|
|
17
|
+
import css from './AvatarGroup.module.css';
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
const COLOR_SEQUENCE = ['blue', 'green', 'orange', 'red', 'gray'];
|
|
21
|
+
|
|
22
|
+
export type AvatarGroupProps = {
|
|
23
|
+
children?: React.Node,
|
|
24
|
+
size?: AvatarSize,
|
|
25
|
+
borderColor?: string,
|
|
26
|
+
maxTooltipLines?: number,
|
|
27
|
+
placement?: PlacementType,
|
|
28
|
+
maxAvatars?: number,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const AvatarGroup = ({
|
|
32
|
+
children,
|
|
33
|
+
size = 'medium',
|
|
34
|
+
borderColor = colorBackgroundTertiary,
|
|
35
|
+
maxTooltipLines = 7,
|
|
36
|
+
placement = 'top',
|
|
37
|
+
maxAvatars = 5,
|
|
38
|
+
}: AvatarGroupProps): React.Node => {
|
|
39
|
+
const childAvatarCount = React.Children.count(children);
|
|
40
|
+
|
|
41
|
+
const leftOverlap = {
|
|
42
|
+
small: spaceXXSmall,
|
|
43
|
+
medium: `${parseInt(spaceSmall) / 2}px`,
|
|
44
|
+
large: spaceXSmall,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
let colorIndex = -1;
|
|
48
|
+
|
|
49
|
+
const avatarInGroup = (child, index, color) =>
|
|
50
|
+
React.cloneElement(child, {
|
|
51
|
+
size,
|
|
52
|
+
classNames: {wrapper: css.avatarInGroup},
|
|
53
|
+
style: {
|
|
54
|
+
borderColor,
|
|
55
|
+
marginLeft: `-${index !== 0 ? leftOverlap[size] : 0}`,
|
|
56
|
+
},
|
|
57
|
+
color,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const childrenArray = React.Children.toArray(children);
|
|
61
|
+
const totalAvatarCount = childrenArray.length;
|
|
62
|
+
const plusAvatar = () => {
|
|
63
|
+
const nameList = [];
|
|
64
|
+
|
|
65
|
+
for (let i = maxAvatars - 1; i < totalAvatarCount; i++) {
|
|
66
|
+
const child = childrenArray[i];
|
|
67
|
+
const {text} = child.props;
|
|
68
|
+
if (text) {
|
|
69
|
+
nameList.push(text);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const NameListNode = () => (
|
|
74
|
+
<span>
|
|
75
|
+
{nameList.map((name) => (
|
|
76
|
+
<React.Fragment key={name}>
|
|
77
|
+
{name}
|
|
78
|
+
<br />
|
|
79
|
+
</React.Fragment>
|
|
80
|
+
))}
|
|
81
|
+
</span>
|
|
82
|
+
);
|
|
83
|
+
return (
|
|
84
|
+
<Tooltip
|
|
85
|
+
body={<NameListNode />}
|
|
86
|
+
bodyMaxLines={maxTooltipLines}
|
|
87
|
+
placement={placement}
|
|
88
|
+
>
|
|
89
|
+
<div className={css.plusAvatar}>
|
|
90
|
+
<BaseAvatar
|
|
91
|
+
size={size}
|
|
92
|
+
color="gray"
|
|
93
|
+
text={`+${childAvatarCount - maxAvatars + 1}`}
|
|
94
|
+
classNames={{wrapper: css.avatarInGroup}}
|
|
95
|
+
style={{
|
|
96
|
+
borderColor,
|
|
97
|
+
marginLeft: `-${leftOverlap[size]}`,
|
|
98
|
+
}}
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
</Tooltip>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const childrenWithProps = React.Children.map(children, (child, index) => {
|
|
106
|
+
const {imageSrc} = child.props;
|
|
107
|
+
if (!imageSrc) {
|
|
108
|
+
colorIndex++;
|
|
109
|
+
if (colorIndex === COLOR_SEQUENCE.length) {
|
|
110
|
+
colorIndex = 0;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const color = COLOR_SEQUENCE[colorIndex];
|
|
115
|
+
if (childAvatarCount <= maxAvatars) {
|
|
116
|
+
return avatarInGroup(child, index, color);
|
|
117
|
+
} else {
|
|
118
|
+
if (index < maxAvatars - 1) {
|
|
119
|
+
return avatarInGroup(child, index, color);
|
|
120
|
+
} else if (index === maxAvatars) {
|
|
121
|
+
return plusAvatar();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<div
|
|
128
|
+
className={classify(css.avatarGroupContainer, {
|
|
129
|
+
[css.largeSize]: size === 'large',
|
|
130
|
+
[css.mediumSize]: size === 'medium',
|
|
131
|
+
[css.smallSize]: size === 'small',
|
|
132
|
+
})}
|
|
133
|
+
>
|
|
134
|
+
{childrenWithProps}
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@value (colorFillPrimary, colorBackgroundTertiary) from '../../styles/variables/_color.css';
|
|
2
|
+
@value (borderWidthTertiary) from '../../styles/variables/_border.css';
|
|
3
|
+
@value ( size34, size42, size60) from '../../styles/variables/_size.css';
|
|
4
|
+
|
|
5
|
+
.avatarGroupContainer {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.avatarGroupContainer.largeSize {
|
|
11
|
+
height: size60;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.avatarGroupContainer.mediumSize {
|
|
15
|
+
height: size42;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.avatarGroupContainer.smallSize {
|
|
19
|
+
height: size34;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.avatarInGroup {
|
|
23
|
+
display: flex;
|
|
24
|
+
border: borderWidthTertiary solid colorBackgroundTertiary;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.nameList {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.plusAvatar {
|
|
33
|
+
display: flex;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _AvatarGroup = require("./AvatarGroup");
|
|
7
|
+
Object.keys(_AvatarGroup).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _AvatarGroup[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _AvatarGroup[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Badge = exports.BADGE_COLOR = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _color = require("../../styles/variables/_color");
|
|
9
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
10
|
+
var _Text = require("../Text/Text");
|
|
11
|
+
var _BadgeModule = _interopRequireDefault(require("./Badge.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
|
+
|
|
16
|
+
const BADGE_COLOR = Object.freeze({
|
|
17
|
+
gray: _color.colorGrayLightest,
|
|
18
|
+
red: _color.colorDangerLightest,
|
|
19
|
+
orange: _color.colorWarningLightest,
|
|
20
|
+
green: _color.colorSuccessLightest,
|
|
21
|
+
blue: _color.colorInformationLightest,
|
|
22
|
+
indigo: _color.colorNeutralLightest
|
|
23
|
+
});
|
|
24
|
+
exports.BADGE_COLOR = BADGE_COLOR;
|
|
25
|
+
const Badge = _ref => {
|
|
26
|
+
let {
|
|
27
|
+
classNames,
|
|
28
|
+
text,
|
|
29
|
+
fill = 'gray'
|
|
30
|
+
} = _ref;
|
|
31
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
"data-testid": "Badge",
|
|
33
|
+
className: (0, _classify.default)(_BadgeModule.default.badgeWrapper, {
|
|
34
|
+
[_BadgeModule.default.fixedWidth]: text.length <= 2
|
|
35
|
+
}, classNames?.wrapper),
|
|
36
|
+
style: {
|
|
37
|
+
backgroundColor: BADGE_COLOR[fill]
|
|
38
|
+
}
|
|
39
|
+
}, /*#__PURE__*/React.createElement(_Text.ButtonTextSmall, null, text));
|
|
40
|
+
};
|
|
41
|
+
exports.Badge = Badge;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
colorDangerLightest,
|
|
7
|
+
colorGrayLightest,
|
|
8
|
+
colorInformationLightest,
|
|
9
|
+
colorNeutralLightest,
|
|
10
|
+
colorSuccessLightest,
|
|
11
|
+
colorWarningLightest,
|
|
12
|
+
} from '../../styles/variables/_color';
|
|
13
|
+
import classify from '../../utils/classify';
|
|
14
|
+
import {ButtonTextSmall} from '../Text/Text';
|
|
15
|
+
|
|
16
|
+
import css from './Badge.module.css';
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
type ClassNames = $ReadOnly<{wrapper?: string}>;
|
|
20
|
+
|
|
21
|
+
export const BADGE_COLOR = Object.freeze({
|
|
22
|
+
gray: colorGrayLightest,
|
|
23
|
+
red: colorDangerLightest,
|
|
24
|
+
orange: colorWarningLightest,
|
|
25
|
+
green: colorSuccessLightest,
|
|
26
|
+
blue: colorInformationLightest,
|
|
27
|
+
indigo: colorNeutralLightest,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export type BadgeColorType = $Keys<typeof BADGE_COLOR>;
|
|
31
|
+
|
|
32
|
+
export type BadgeProps = {
|
|
33
|
+
classNames?: ClassNames,
|
|
34
|
+
text: string,
|
|
35
|
+
fill?: BadgeColorType,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Badge = ({
|
|
39
|
+
classNames,
|
|
40
|
+
text,
|
|
41
|
+
fill = 'gray',
|
|
42
|
+
}: BadgeProps): React.Node => (
|
|
43
|
+
<div
|
|
44
|
+
data-testid="Badge"
|
|
45
|
+
className={classify(
|
|
46
|
+
css.badgeWrapper,
|
|
47
|
+
{
|
|
48
|
+
[css.fixedWidth]: text.length <= 2,
|
|
49
|
+
},
|
|
50
|
+
classNames?.wrapper,
|
|
51
|
+
)}
|
|
52
|
+
style={{
|
|
53
|
+
backgroundColor: BADGE_COLOR[fill],
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
<ButtonTextSmall>{text}</ButtonTextSmall>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@value (size22, size100) from '../../styles/variables/_size.css';
|
|
2
|
+
@value (spaceXSmall, spaceNone) from '../../styles/variables/_space.css';
|
|
3
|
+
|
|
4
|
+
.badgeWrapper {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
border-radius: size100;
|
|
9
|
+
height: size22;
|
|
10
|
+
padding: spaceNone spaceXSmall;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.fixedWidth {
|
|
14
|
+
padding: initial;
|
|
15
|
+
width: size22;
|
|
16
|
+
height: size22;
|
|
17
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PADDING_SIZES = exports.Card = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var SPACES = _interopRequireWildcard(require("../../styles/variables/_space"));
|
|
9
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
10
|
+
var _string = require("../../utils/string");
|
|
11
|
+
var _CardModule = _interopRequireDefault(require("./Card.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
|
+
|
|
16
|
+
const PADDING_SIZES = Object.freeze({
|
|
17
|
+
small: 'small',
|
|
18
|
+
medium: 'medium',
|
|
19
|
+
large: 'large'
|
|
20
|
+
});
|
|
21
|
+
exports.PADDING_SIZES = PADDING_SIZES;
|
|
22
|
+
const getPaddingValue = size => {
|
|
23
|
+
const spaceKey = 'space' + (0, _string.capitalize)(size);
|
|
24
|
+
return SPACES[spaceKey] || SPACES['spaceNone'];
|
|
25
|
+
};
|
|
26
|
+
const Card = _ref => {
|
|
27
|
+
let {
|
|
28
|
+
children,
|
|
29
|
+
classNames,
|
|
30
|
+
paddingTop = 'medium',
|
|
31
|
+
paddingRight = 'medium',
|
|
32
|
+
paddingBottom = 'medium',
|
|
33
|
+
paddingLeft = 'medium'
|
|
34
|
+
} = _ref;
|
|
35
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
"data-testid": "Card",
|
|
37
|
+
className: (0, _classify.default)(_CardModule.default.cardWrapper, classNames?.wrapper),
|
|
38
|
+
style: {
|
|
39
|
+
paddingTop: getPaddingValue(paddingTop),
|
|
40
|
+
paddingRight: getPaddingValue(paddingRight),
|
|
41
|
+
paddingBottom: getPaddingValue(paddingBottom),
|
|
42
|
+
paddingLeft: getPaddingValue(paddingLeft)
|
|
43
|
+
}
|
|
44
|
+
}, children);
|
|
45
|
+
};
|
|
46
|
+
exports.Card = Card;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// @flow strict
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import * as SPACES from '../../styles/variables/_space';
|
|
6
|
+
import classify from '../../utils/classify';
|
|
7
|
+
import {capitalize} from '../../utils/string';
|
|
8
|
+
|
|
9
|
+
import css from './Card.module.css';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
type ClassNames = $ReadOnly<{wrapper?: string}>;
|
|
13
|
+
|
|
14
|
+
export const PADDING_SIZES = Object.freeze({
|
|
15
|
+
small: 'small',
|
|
16
|
+
medium: 'medium',
|
|
17
|
+
large: 'large',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type PaddingSizeType = $Values<typeof PADDING_SIZES>;
|
|
21
|
+
|
|
22
|
+
export type CardProps = {
|
|
23
|
+
classNames?: ClassNames,
|
|
24
|
+
children: React.Node,
|
|
25
|
+
paddingTop?: PaddingSizeType,
|
|
26
|
+
paddingRight?: PaddingSizeType,
|
|
27
|
+
paddingBottom?: PaddingSizeType,
|
|
28
|
+
paddingLeft?: PaddingSizeType,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const getPaddingValue = (size: PaddingSizeType): string => {
|
|
32
|
+
const spaceKey = 'space' + capitalize(size);
|
|
33
|
+
return SPACES[spaceKey] || SPACES['spaceNone'];
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const Card = ({
|
|
37
|
+
children,
|
|
38
|
+
classNames,
|
|
39
|
+
paddingTop = 'medium',
|
|
40
|
+
paddingRight = 'medium',
|
|
41
|
+
paddingBottom = 'medium',
|
|
42
|
+
paddingLeft = 'medium',
|
|
43
|
+
}: CardProps): React.Node => (
|
|
44
|
+
<div
|
|
45
|
+
data-testid="Card"
|
|
46
|
+
className={classify(css.cardWrapper, classNames?.wrapper)}
|
|
47
|
+
style={{
|
|
48
|
+
paddingTop: getPaddingValue(paddingTop),
|
|
49
|
+
paddingRight: getPaddingValue(paddingRight),
|
|
50
|
+
paddingBottom: getPaddingValue(paddingBottom),
|
|
51
|
+
paddingLeft: getPaddingValue(paddingLeft),
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
{children}
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
@value (colorBackgroundTertiary) from '../../styles/variables/_color.css';
|
|
2
|
+
@value (borderRadiusMedium) from '../../styles/variables/_border.css';
|
|
3
|
+
|
|
4
|
+
.cardWrapper {
|
|
5
|
+
display: flex;
|
|
6
|
+
composes: borderPrimary from '../../styles/border.module.css';
|
|
7
|
+
background-color: colorBackgroundTertiary;
|
|
8
|
+
border-radius: borderRadiusMedium;
|
|
9
|
+
}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.CircularLoader = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var COLORS = _interopRequireWildcard(require("../../styles/variables/_color
|
|
8
|
+
var COLORS = _interopRequireWildcard(require("../../styles/variables/_color"));
|
|
9
9
|
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
10
10
|
var _CircularLoaderModule = _interopRequireDefault(require("./CircularLoader.module.css"));
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -61,14 +61,14 @@ const Tooltip = _ref => {
|
|
|
61
61
|
top: y ?? _space.spaceNone,
|
|
62
62
|
left: x ?? _space.spaceNone
|
|
63
63
|
}
|
|
64
|
-
}, getFloatingProps()), !!title && /*#__PURE__*/React.createElement(
|
|
65
|
-
color: "inversePrimary"
|
|
66
|
-
}, /*#__PURE__*/React.createElement(_Truncate.Truncate, {
|
|
64
|
+
}, getFloatingProps()), !!title && /*#__PURE__*/React.createElement(_Truncate.Truncate, {
|
|
67
65
|
line: titleMaxLines
|
|
68
|
-
},
|
|
69
|
-
color:
|
|
70
|
-
}, /*#__PURE__*/React.createElement(_Truncate.Truncate, {
|
|
66
|
+
}, /*#__PURE__*/React.createElement(_Text.SubTitleExtraSmall, {
|
|
67
|
+
color: "inversePrimary"
|
|
68
|
+
}, title)), !!body && /*#__PURE__*/React.createElement(_Truncate.Truncate, {
|
|
71
69
|
line: bodyMaxLines
|
|
70
|
+
}, /*#__PURE__*/React.createElement(_Text.BodyMedium, {
|
|
71
|
+
color: !title ? 'inversePrimary' : 'inverseSecondary'
|
|
72
72
|
}, body))));
|
|
73
73
|
};
|
|
74
74
|
exports.Tooltip = Tooltip;
|
|
@@ -35,19 +35,21 @@ import css from './Tooltip.module.css';
|
|
|
35
35
|
|
|
36
36
|
type ClassNames = $ReadOnly<{tooltip?: string}>;
|
|
37
37
|
|
|
38
|
+
export type PlacementType =
|
|
39
|
+
| 'top'
|
|
40
|
+
| 'top-start'
|
|
41
|
+
| 'top-end'
|
|
42
|
+
| 'bottom'
|
|
43
|
+
| 'bottom-start'
|
|
44
|
+
| 'bottom-end'
|
|
45
|
+
| 'left'
|
|
46
|
+
| 'right';
|
|
47
|
+
|
|
38
48
|
export type TooltipProps = {
|
|
39
49
|
classNames?: ClassNames,
|
|
40
50
|
title?: string | React.Node,
|
|
41
51
|
body?: string | React.Node,
|
|
42
|
-
placement?:
|
|
43
|
-
| 'top'
|
|
44
|
-
| 'top-start'
|
|
45
|
-
| 'top-end'
|
|
46
|
-
| 'bottom'
|
|
47
|
-
| 'bottom-start'
|
|
48
|
-
| 'bottom-end'
|
|
49
|
-
| 'left'
|
|
50
|
-
| 'right',
|
|
52
|
+
placement?: PlacementType,
|
|
51
53
|
bodyMaxLines?: number,
|
|
52
54
|
titleMaxLines?: number,
|
|
53
55
|
// TODO(Nishant): Decide on a type to use
|
|
@@ -108,15 +110,21 @@ export const Tooltip = ({
|
|
|
108
110
|
{...getFloatingProps()}
|
|
109
111
|
>
|
|
110
112
|
{!!title && (
|
|
111
|
-
<
|
|
112
|
-
<
|
|
113
|
-
|
|
113
|
+
<Truncate line={titleMaxLines}>
|
|
114
|
+
<SubTitleExtraSmall color="inversePrimary">
|
|
115
|
+
{title}
|
|
116
|
+
</SubTitleExtraSmall>
|
|
117
|
+
</Truncate>
|
|
114
118
|
)}
|
|
115
119
|
|
|
116
120
|
{!!body && (
|
|
117
|
-
<
|
|
118
|
-
<
|
|
119
|
-
|
|
121
|
+
<Truncate line={bodyMaxLines}>
|
|
122
|
+
<BodyMedium
|
|
123
|
+
color={!title ? 'inversePrimary' : 'inverseSecondary'}
|
|
124
|
+
>
|
|
125
|
+
{body}
|
|
126
|
+
</BodyMedium>
|
|
127
|
+
</Truncate>
|
|
120
128
|
)}
|
|
121
129
|
</div>
|
|
122
130
|
)}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.borderWidthTertiary = exports.borderWidthSecondary = exports.borderWidthPrimary = exports.borderWidthNone = exports.borderRadiusXSmall = exports.borderRadiusSmall = exports.borderRadiusRadioButton = exports.borderRadiusNone = exports.borderRadiusMedium = exports.borderRadiusLarge = exports.borderRadiusCircle = void 0;
|
|
6
|
+
exports.borderWidthTertiary = exports.borderWidthSecondary = exports.borderWidthPrimary = exports.borderWidthNone = exports.borderRadiusXSmall = exports.borderRadiusXLarge = exports.borderRadiusSmall = exports.borderRadiusRadioButton = exports.borderRadiusNone = exports.borderRadiusMedium = exports.borderRadiusLarge = exports.borderRadiusCircle = void 0;
|
|
7
7
|
|
|
8
8
|
const borderWidthNone = '0px';
|
|
9
9
|
exports.borderWidthNone = borderWidthNone;
|
|
@@ -25,5 +25,7 @@ const borderRadiusMedium = '12px';
|
|
|
25
25
|
exports.borderRadiusMedium = borderRadiusMedium;
|
|
26
26
|
const borderRadiusLarge = '20px';
|
|
27
27
|
exports.borderRadiusLarge = borderRadiusLarge;
|
|
28
|
+
const borderRadiusXLarge = '30px';
|
|
29
|
+
exports.borderRadiusXLarge = borderRadiusXLarge;
|
|
28
30
|
const borderRadiusCircle = '50%';
|
|
29
31
|
exports.borderRadiusCircle = borderRadiusCircle;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.colorWarningLightest = exports.colorWarningLight = exports.colorWarningDarkest = exports.colorWarningDark = exports.colorWarning = exports.colorTooltipFill = exports.colorTextWarning = exports.colorTextTertiary = exports.colorTextSuccess = exports.colorTextSelected = exports.colorTextSecondary = exports.colorTextPrimary = exports.colorTextNeutral = exports.colorTextInverseSecondary = exports.colorTextInversePrimary = exports.colorTextInformation = exports.colorTextDisabled = exports.colorTextDanger = exports.colorSuccessLightest = exports.colorSuccessLight = exports.colorSuccessDarkest = exports.colorSuccessDark = exports.colorSuccess = exports.colorNeutralLightest = exports.colorNeutralLight = exports.colorNeutralDarkest = exports.colorNeutralDark = exports.colorNeutral = exports.colorInformationLightest = exports.colorInformationLight = exports.colorInformationDarkest = exports.colorInformationDark = exports.colorInformation = exports.colorFocusPrimary = exports.colorFocusDanger = exports.colorFillSecondary = exports.colorFillPrimary = exports.colorFillNone = exports.colorFillDisabled = exports.colorDangerLightest = exports.colorDangerLight = exports.colorDangerDarkest = exports.colorDangerDark = exports.colorDanger = exports.colorButtonFillTertiaryPressed = exports.colorButtonFillTertiaryHovered = exports.colorButtonFillTertiaryEnabled = exports.colorButtonFillSecondaryPressed = exports.colorButtonFillSecondaryHovered = exports.colorButtonFillSecondaryEnabled = exports.colorButtonFillPrimaryPressed = exports.colorButtonFillPrimaryHovered = exports.colorButtonFillPrimaryEnabled = exports.colorButtonFillGhostPressed = exports.colorButtonFillGhostHovered = exports.colorButtonFillGhostEnabled = exports.colorButtonFillDangerPressed = exports.colorButtonFillDangerHovered = exports.colorButtonFillDangerEnabled = exports.colorBorderSecondary = exports.colorBorderPrimary = exports.colorBorderDanger = exports.colorBackgroundTertiary = exports.colorBackgroundSecondary = exports.colorBackgroundPrimary = exports.colorBackdropFill = void 0;
|
|
6
|
+
exports.colorWarningLightest = exports.colorWarningLight = exports.colorWarningDarkest = exports.colorWarningDark = exports.colorWarning = exports.colorTooltipFill = exports.colorTextWarning = exports.colorTextTertiary = exports.colorTextSuccess = exports.colorTextSelected = exports.colorTextSecondary = exports.colorTextPrimary = exports.colorTextNeutral = exports.colorTextInverseSecondary = exports.colorTextInversePrimary = exports.colorTextInformation = exports.colorTextDisabled = exports.colorTextDanger = exports.colorSuccessLightest = exports.colorSuccessLight = exports.colorSuccessDarkest = exports.colorSuccessDark = exports.colorSuccess = exports.colorNeutralLightest = exports.colorNeutralLight = exports.colorNeutralDarkest = exports.colorNeutralDark = exports.colorNeutral = exports.colorInformationLightest = exports.colorInformationLight = exports.colorInformationDarkest = exports.colorInformationDark = exports.colorInformation = exports.colorGrayLightest = exports.colorFocusPrimary = exports.colorFocusDanger = exports.colorFillSecondary = exports.colorFillPrimary = exports.colorFillNone = exports.colorFillDisabled = exports.colorDangerLightest = exports.colorDangerLight = exports.colorDangerDarkest = exports.colorDangerDark = exports.colorDanger = exports.colorButtonFillTertiaryPressed = exports.colorButtonFillTertiaryHovered = exports.colorButtonFillTertiaryEnabled = exports.colorButtonFillSecondaryPressed = exports.colorButtonFillSecondaryHovered = exports.colorButtonFillSecondaryEnabled = exports.colorButtonFillPrimaryPressed = exports.colorButtonFillPrimaryHovered = exports.colorButtonFillPrimaryEnabled = exports.colorButtonFillGhostPressed = exports.colorButtonFillGhostHovered = exports.colorButtonFillGhostEnabled = exports.colorButtonFillDangerPressed = exports.colorButtonFillDangerHovered = exports.colorButtonFillDangerEnabled = exports.colorBorderSecondary = exports.colorBorderPrimary = exports.colorBorderDanger = exports.colorBackgroundTertiary = exports.colorBackgroundSecondary = exports.colorBackgroundPrimary = exports.colorBackdropFill = void 0;
|
|
7
7
|
|
|
8
8
|
const colorTextPrimary = '#17172A';
|
|
9
9
|
exports.colorTextPrimary = colorTextPrimary;
|
|
@@ -87,6 +87,8 @@ const colorButtonFillDangerHovered = '#cf1945';
|
|
|
87
87
|
exports.colorButtonFillDangerHovered = colorButtonFillDangerHovered;
|
|
88
88
|
const colorButtonFillDangerPressed = '#cf1945';
|
|
89
89
|
exports.colorButtonFillDangerPressed = colorButtonFillDangerPressed;
|
|
90
|
+
const colorGrayLightest = '#EBEBEB';
|
|
91
|
+
exports.colorGrayLightest = colorGrayLightest;
|
|
90
92
|
const colorNeutral = '#706f9b';
|
|
91
93
|
exports.colorNeutral = colorNeutral;
|
|
92
94
|
const colorNeutralLightest = '#f1f1f5';
|
|
@@ -82,6 +82,8 @@ export const colorButtonFillDangerHovered = '#cf1945';
|
|
|
82
82
|
|
|
83
83
|
export const colorButtonFillDangerPressed = '#cf1945';
|
|
84
84
|
|
|
85
|
+
export const colorGrayLightest = '#EBEBEB';
|
|
86
|
+
|
|
85
87
|
export const colorNeutral = '#706f9b';
|
|
86
88
|
|
|
87
89
|
export const colorNeutralLightest = '#f1f1f5';
|