@atlaskit/smart-card 17.2.1 → 17.3.0
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 +10 -0
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/metadata-block/index.js +17 -3
- package/dist/cjs/view/FlexibleCard/components/elements/avatar-group/index.js +24 -2
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/metadata-block/index.js +17 -3
- package/dist/es2019/view/FlexibleCard/components/elements/avatar-group/index.js +28 -2
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/metadata-block/index.js +17 -3
- package/dist/esm/view/FlexibleCard/components/elements/avatar-group/index.js +24 -2
- package/dist/types/view/FlexibleCard/components/elements/avatar-group/index.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 17.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`dab29fc6697`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dab29fc6697) - [ux] Flexible UI: AvatarGroup sizing updated for small and medium size
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`25408fac413`](https://bitbucket.org/atlassian/atlassian-frontend/commits/25408fac413) - Flexible UI: Add MetadataBlock example
|
|
12
|
+
|
|
3
13
|
## 17.2.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/cjs/version.json
CHANGED
|
@@ -37,18 +37,32 @@ var getElementGroupStyles = function getElementGroupStyles(size, maxLines) {
|
|
|
37
37
|
// MetadataBlock allows metadata elements to be displayed in
|
|
38
38
|
// multiple lines, with maximum of 2 lines.
|
|
39
39
|
// a) We need the height of the line to be equal on both left and right
|
|
40
|
-
// sides so they line up nicely.
|
|
41
|
-
// all elements in specific size. This height belongs to AvatarGroup.
|
|
40
|
+
// sides so they line up nicely.
|
|
42
41
|
// b) There is no way to truncate non-text elements nicely. Here
|
|
43
42
|
// it's fix max height of the element group so that anything that is
|
|
44
43
|
// overflown will not be visible.
|
|
45
|
-
var lineHeight =
|
|
44
|
+
var lineHeight = getLineHeight(size);
|
|
46
45
|
var gap = (0, _utils.getGapSize)(size);
|
|
47
46
|
var gapHeight = gap * (maxLines - 1);
|
|
48
47
|
var height = lineHeight * maxLines + gapHeight;
|
|
49
48
|
return (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n flex-wrap: wrap;\n line-height: ", "rem;\n max-height: ", "rem;\n > span,\n > div {\n min-height: ", "rem;\n max-height: ", "rem;\n line-height: ", "rem;\n }\n "])), lineHeight, height, lineHeight, lineHeight, lineHeight);
|
|
50
49
|
};
|
|
51
50
|
|
|
51
|
+
var getLineHeight = function getLineHeight(size) {
|
|
52
|
+
// The maximum height of all elements in specific size.
|
|
53
|
+
// These heights belongs to AvatarGroup.
|
|
54
|
+
switch (size) {
|
|
55
|
+
case _constants.SmartLinkSize.XLarge:
|
|
56
|
+
case _constants.SmartLinkSize.Large:
|
|
57
|
+
return 1.75;
|
|
58
|
+
|
|
59
|
+
case _constants.SmartLinkSize.Medium:
|
|
60
|
+
case _constants.SmartLinkSize.Small:
|
|
61
|
+
default:
|
|
62
|
+
return 1.5;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
52
66
|
var getMaxLines = function getMaxLines(maxLines) {
|
|
53
67
|
if (maxLines > MAXIMUM_MAX_LINES) {
|
|
54
68
|
return DEFAULT_MAX_LINES;
|
|
@@ -7,14 +7,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
+
|
|
10
12
|
var _react = _interopRequireDefault(require("react"));
|
|
11
13
|
|
|
14
|
+
var _core = require("@emotion/core");
|
|
15
|
+
|
|
12
16
|
var _avatarGroup = _interopRequireDefault(require("@atlaskit/avatar-group"));
|
|
13
17
|
|
|
14
18
|
var _constants = require("../../../../../constants");
|
|
15
19
|
|
|
20
|
+
var _templateObject;
|
|
21
|
+
|
|
16
22
|
var MAX_COUNT = 4;
|
|
17
23
|
|
|
24
|
+
var getStyles = function getStyles(size) {
|
|
25
|
+
switch (size) {
|
|
26
|
+
case _constants.SmartLinkSize.XLarge:
|
|
27
|
+
case _constants.SmartLinkSize.Large:
|
|
28
|
+
// Default AK small size
|
|
29
|
+
return;
|
|
30
|
+
|
|
31
|
+
case _constants.SmartLinkSize.Medium:
|
|
32
|
+
case _constants.SmartLinkSize.Small:
|
|
33
|
+
default:
|
|
34
|
+
return (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n li {\n span,\n svg {\n max-height: 1.25rem;\n max-width: 1.25rem;\n }\n }\n "])));
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
18
38
|
var AvatarGroup = function AvatarGroup(_ref) {
|
|
19
39
|
var _ref$items = _ref.items,
|
|
20
40
|
items = _ref$items === void 0 ? [] : _ref$items,
|
|
@@ -29,13 +49,15 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
29
49
|
return null;
|
|
30
50
|
}
|
|
31
51
|
|
|
32
|
-
return
|
|
52
|
+
return (0, _core.jsx)("span", {
|
|
53
|
+
css: getStyles(size)
|
|
54
|
+
}, (0, _core.jsx)(_avatarGroup.default, {
|
|
33
55
|
maxCount: maxCount,
|
|
34
56
|
appearance: "stack",
|
|
35
57
|
size: "small",
|
|
36
58
|
data: items,
|
|
37
59
|
testId: testId
|
|
38
|
-
});
|
|
60
|
+
}));
|
|
39
61
|
};
|
|
40
62
|
|
|
41
63
|
var _default = AvatarGroup;
|
package/dist/es2019/version.json
CHANGED
|
@@ -13,12 +13,11 @@ const getElementGroupStyles = (size, maxLines) => {
|
|
|
13
13
|
// MetadataBlock allows metadata elements to be displayed in
|
|
14
14
|
// multiple lines, with maximum of 2 lines.
|
|
15
15
|
// a) We need the height of the line to be equal on both left and right
|
|
16
|
-
// sides so they line up nicely.
|
|
17
|
-
// all elements in specific size. This height belongs to AvatarGroup.
|
|
16
|
+
// sides so they line up nicely.
|
|
18
17
|
// b) There is no way to truncate non-text elements nicely. Here
|
|
19
18
|
// it's fix max height of the element group so that anything that is
|
|
20
19
|
// overflown will not be visible.
|
|
21
|
-
const lineHeight =
|
|
20
|
+
const lineHeight = getLineHeight(size);
|
|
22
21
|
const gap = getGapSize(size);
|
|
23
22
|
const gapHeight = gap * (maxLines - 1);
|
|
24
23
|
const height = lineHeight * maxLines + gapHeight;
|
|
@@ -35,6 +34,21 @@ const getElementGroupStyles = (size, maxLines) => {
|
|
|
35
34
|
`;
|
|
36
35
|
};
|
|
37
36
|
|
|
37
|
+
const getLineHeight = size => {
|
|
38
|
+
// The maximum height of all elements in specific size.
|
|
39
|
+
// These heights belongs to AvatarGroup.
|
|
40
|
+
switch (size) {
|
|
41
|
+
case SmartLinkSize.XLarge:
|
|
42
|
+
case SmartLinkSize.Large:
|
|
43
|
+
return 1.75;
|
|
44
|
+
|
|
45
|
+
case SmartLinkSize.Medium:
|
|
46
|
+
case SmartLinkSize.Small:
|
|
47
|
+
default:
|
|
48
|
+
return 1.5;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
38
52
|
const getMaxLines = maxLines => {
|
|
39
53
|
if (maxLines > MAXIMUM_MAX_LINES) {
|
|
40
54
|
return DEFAULT_MAX_LINES;
|
|
@@ -1,8 +1,32 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
1
2
|
import React from 'react';
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
2
4
|
import AtlaskitAvatarGroup from '@atlaskit/avatar-group';
|
|
3
5
|
import { SmartLinkSize } from '../../../../../constants';
|
|
4
6
|
const MAX_COUNT = 4;
|
|
5
7
|
|
|
8
|
+
const getStyles = size => {
|
|
9
|
+
switch (size) {
|
|
10
|
+
case SmartLinkSize.XLarge:
|
|
11
|
+
case SmartLinkSize.Large:
|
|
12
|
+
// Default AK small size
|
|
13
|
+
return;
|
|
14
|
+
|
|
15
|
+
case SmartLinkSize.Medium:
|
|
16
|
+
case SmartLinkSize.Small:
|
|
17
|
+
default:
|
|
18
|
+
return css`
|
|
19
|
+
li {
|
|
20
|
+
span,
|
|
21
|
+
svg {
|
|
22
|
+
max-height: 1.25rem;
|
|
23
|
+
max-width: 1.25rem;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
6
30
|
const AvatarGroup = ({
|
|
7
31
|
items = [],
|
|
8
32
|
maxCount = MAX_COUNT,
|
|
@@ -13,13 +37,15 @@ const AvatarGroup = ({
|
|
|
13
37
|
return null;
|
|
14
38
|
}
|
|
15
39
|
|
|
16
|
-
return
|
|
40
|
+
return jsx("span", {
|
|
41
|
+
css: getStyles(size)
|
|
42
|
+
}, jsx(AtlaskitAvatarGroup, {
|
|
17
43
|
maxCount: maxCount,
|
|
18
44
|
appearance: "stack",
|
|
19
45
|
size: "small",
|
|
20
46
|
data: items,
|
|
21
47
|
testId: testId
|
|
22
|
-
});
|
|
48
|
+
}));
|
|
23
49
|
};
|
|
24
50
|
|
|
25
51
|
export default AvatarGroup;
|
package/dist/esm/version.json
CHANGED
|
@@ -19,18 +19,32 @@ var getElementGroupStyles = function getElementGroupStyles(size, maxLines) {
|
|
|
19
19
|
// MetadataBlock allows metadata elements to be displayed in
|
|
20
20
|
// multiple lines, with maximum of 2 lines.
|
|
21
21
|
// a) We need the height of the line to be equal on both left and right
|
|
22
|
-
// sides so they line up nicely.
|
|
23
|
-
// all elements in specific size. This height belongs to AvatarGroup.
|
|
22
|
+
// sides so they line up nicely.
|
|
24
23
|
// b) There is no way to truncate non-text elements nicely. Here
|
|
25
24
|
// it's fix max height of the element group so that anything that is
|
|
26
25
|
// overflown will not be visible.
|
|
27
|
-
var lineHeight =
|
|
26
|
+
var lineHeight = getLineHeight(size);
|
|
28
27
|
var gap = getGapSize(size);
|
|
29
28
|
var gapHeight = gap * (maxLines - 1);
|
|
30
29
|
var height = lineHeight * maxLines + gapHeight;
|
|
31
30
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex-wrap: wrap;\n line-height: ", "rem;\n max-height: ", "rem;\n > span,\n > div {\n min-height: ", "rem;\n max-height: ", "rem;\n line-height: ", "rem;\n }\n "])), lineHeight, height, lineHeight, lineHeight, lineHeight);
|
|
32
31
|
};
|
|
33
32
|
|
|
33
|
+
var getLineHeight = function getLineHeight(size) {
|
|
34
|
+
// The maximum height of all elements in specific size.
|
|
35
|
+
// These heights belongs to AvatarGroup.
|
|
36
|
+
switch (size) {
|
|
37
|
+
case SmartLinkSize.XLarge:
|
|
38
|
+
case SmartLinkSize.Large:
|
|
39
|
+
return 1.75;
|
|
40
|
+
|
|
41
|
+
case SmartLinkSize.Medium:
|
|
42
|
+
case SmartLinkSize.Small:
|
|
43
|
+
default:
|
|
44
|
+
return 1.5;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
34
48
|
var getMaxLines = function getMaxLines(maxLines) {
|
|
35
49
|
if (maxLines > MAXIMUM_MAX_LINES) {
|
|
36
50
|
return DEFAULT_MAX_LINES;
|
|
@@ -1,8 +1,28 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
4
|
+
|
|
5
|
+
/** @jsx jsx */
|
|
1
6
|
import React from 'react';
|
|
7
|
+
import { css, jsx } from '@emotion/core';
|
|
2
8
|
import AtlaskitAvatarGroup from '@atlaskit/avatar-group';
|
|
3
9
|
import { SmartLinkSize } from '../../../../../constants';
|
|
4
10
|
var MAX_COUNT = 4;
|
|
5
11
|
|
|
12
|
+
var getStyles = function getStyles(size) {
|
|
13
|
+
switch (size) {
|
|
14
|
+
case SmartLinkSize.XLarge:
|
|
15
|
+
case SmartLinkSize.Large:
|
|
16
|
+
// Default AK small size
|
|
17
|
+
return;
|
|
18
|
+
|
|
19
|
+
case SmartLinkSize.Medium:
|
|
20
|
+
case SmartLinkSize.Small:
|
|
21
|
+
default:
|
|
22
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n li {\n span,\n svg {\n max-height: 1.25rem;\n max-width: 1.25rem;\n }\n }\n "])));
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
6
26
|
var AvatarGroup = function AvatarGroup(_ref) {
|
|
7
27
|
var _ref$items = _ref.items,
|
|
8
28
|
items = _ref$items === void 0 ? [] : _ref$items,
|
|
@@ -17,13 +37,15 @@ var AvatarGroup = function AvatarGroup(_ref) {
|
|
|
17
37
|
return null;
|
|
18
38
|
}
|
|
19
39
|
|
|
20
|
-
return
|
|
40
|
+
return jsx("span", {
|
|
41
|
+
css: getStyles(size)
|
|
42
|
+
}, jsx(AtlaskitAvatarGroup, {
|
|
21
43
|
maxCount: maxCount,
|
|
22
44
|
appearance: "stack",
|
|
23
45
|
size: "small",
|
|
24
46
|
data: items,
|
|
25
47
|
testId: testId
|
|
26
|
-
});
|
|
48
|
+
}));
|
|
27
49
|
};
|
|
28
50
|
|
|
29
51
|
export default AvatarGroup;
|