superdesk-ui-framework 3.0.52 → 3.0.53
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/app-typescript/components/avatar/avatar-image.tsx +8 -4
- package/app-typescript/components/avatar/avatar-placeholder.tsx +23 -3
- package/app-typescript/components/avatar/avatar.tsx +38 -11
- package/dist/examples.bundle.js +230 -209
- package/dist/superdesk-ui.bundle.js +210 -189
- package/package.json +1 -1
- package/react/components/avatar/avatar-image.d.ts +1 -0
- package/react/components/avatar/avatar-image.js +6 -4
- package/react/components/avatar/avatar-placeholder.d.ts +1 -1
- package/react/components/avatar/avatar-placeholder.js +13 -3
- package/react/components/avatar/avatar.d.ts +11 -0
- package/react/components/avatar/avatar.js +13 -4
package/package.json
CHANGED
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
2
2
|
import { IPropsBase } from './interfaces';
|
3
3
|
interface IPropsImageAvatar extends IPropsBase {
|
4
4
|
imageUrl?: string | null;
|
5
|
+
onClick?(): void;
|
5
6
|
}
|
6
7
|
export declare class AvatarContentImage extends React.PureComponent<IPropsImageAvatar> {
|
7
8
|
render(): JSX.Element;
|
@@ -46,15 +46,17 @@ var AvatarContentImage = /** @class */ (function (_super) {
|
|
46
46
|
return _super !== null && _super.apply(this, arguments) || this;
|
47
47
|
}
|
48
48
|
AvatarContentImage.prototype.render = function () {
|
49
|
-
|
50
|
-
|
49
|
+
var _a = this.props, imageUrl = _a.imageUrl, tooltipText = _a.tooltipText, onClick = _a.onClick;
|
50
|
+
var role = onClick == null ? undefined : 'button';
|
51
|
+
if (imageUrl == null) {
|
52
|
+
return (React.createElement("span", { className: "sd-avatar-content sd-avatar-content--dummy-img", title: tooltipText, role: role },
|
51
53
|
React.createElement("svg", { width: "200", height: "200", viewBox: "0 0 200 200", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
52
54
|
React.createElement("circle", { cx: "100", cy: "100", r: "100", fill: "white", "fill-opacity": "0.01" }),
|
53
55
|
React.createElement("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M40 153V145.384C40 141.557 41.16 137.981 43.16 135C49.14 126.057 66.24 119.711 77.14 118C82.74 117.115 90.16 116.538 100 116.538C109.84 116.538 117.26 117.115 122.86 118C133.76 119.711 150.86 126.057 156.84 135C158.84 137.981 160 141.557 160 145.384V153C150 165 130 180 100 180C70 180 50 165 40 153ZM100 30C122.08 30 140 47.2307 140 68.4614C140 89.6922 122.08 106.923 100 106.923C77.92 106.923 60 89.6922 60 68.4614C60 47.2307 77.92 30 100 30Z", fill: "var(--sd-colour-avatar-dummy)", "fill-opacity": "1" }))));
|
54
56
|
}
|
55
57
|
else {
|
56
|
-
return (React.createElement("span", { className: "sd-avatar-content", title:
|
57
|
-
React.createElement("img", { src:
|
58
|
+
return (React.createElement("span", { className: "sd-avatar-content", title: tooltipText, role: role },
|
59
|
+
React.createElement("img", { src: imageUrl })));
|
58
60
|
}
|
59
61
|
};
|
60
62
|
return AvatarContentImage;
|
@@ -42,15 +42,25 @@ exports.AvatarPlaceholder = void 0;
|
|
42
42
|
var React = __importStar(require("react"));
|
43
43
|
var avatar_wrapper_1 = require("./avatar-wrapper");
|
44
44
|
var avatar_action_add_1 = require("./avatar-action-add");
|
45
|
+
var avatar_image_1 = require("./avatar-image");
|
45
46
|
var AvatarPlaceholder = /** @class */ (function (_super) {
|
46
47
|
__extends(AvatarPlaceholder, _super);
|
47
48
|
function AvatarPlaceholder() {
|
48
49
|
return _super !== null && _super.apply(this, arguments) || this;
|
49
50
|
}
|
50
51
|
AvatarPlaceholder.prototype.render = function () {
|
51
|
-
var _a = this.props, size = _a.size, tooltip = _a.tooltip, icon = _a.icon;
|
52
|
-
return (React.createElement(avatar_wrapper_1.AvatarWrapper, { size: size, isEmpty: false, icon: icon },
|
53
|
-
|
52
|
+
var _a = this.props, size = _a.size, tooltip = _a.tooltip, icon = _a.icon, kind = _a.kind, onClick = _a.onClick;
|
53
|
+
return (React.createElement(avatar_wrapper_1.AvatarWrapper, { size: size, isEmpty: false, icon: icon }, (function () {
|
54
|
+
if (kind === 'plus-button') {
|
55
|
+
return (React.createElement(avatar_action_add_1.AvatarContentAdd, { tooltipText: tooltip !== null && tooltip !== void 0 ? tooltip : undefined, onClick: onClick }));
|
56
|
+
}
|
57
|
+
else if (kind === 'user-icon') {
|
58
|
+
return (React.createElement(avatar_image_1.AvatarContentImage, { imageUrl: null, tooltipText: tooltip !== null && tooltip !== void 0 ? tooltip : undefined, onClick: onClick }));
|
59
|
+
}
|
60
|
+
else {
|
61
|
+
return null;
|
62
|
+
}
|
63
|
+
})()));
|
54
64
|
};
|
55
65
|
return AvatarPlaceholder;
|
56
66
|
}(React.PureComponent));
|
@@ -11,6 +11,17 @@ export interface IPropsAvatar {
|
|
11
11
|
name: string;
|
12
12
|
color?: string;
|
13
13
|
};
|
14
|
+
/**
|
15
|
+
* displayName is shown as tooltip by default
|
16
|
+
* use this if you need to add additional information (it will be added on a new line)
|
17
|
+
*/
|
18
|
+
tooltip?: string;
|
19
|
+
/**
|
20
|
+
* JSX resulting from rendering of one of the following components:
|
21
|
+
* AvatarContentText
|
22
|
+
* AvatarContentImage
|
23
|
+
*/
|
24
|
+
customContent?: JSX.Element;
|
14
25
|
}
|
15
26
|
export declare class Avatar extends React.PureComponent<IPropsAvatar> {
|
16
27
|
render(): JSX.Element;
|
@@ -49,10 +49,19 @@ var Avatar = /** @class */ (function (_super) {
|
|
49
49
|
return _super !== null && _super.apply(this, arguments) || this;
|
50
50
|
}
|
51
51
|
Avatar.prototype.render = function () {
|
52
|
-
var _a = this.props, imageUrl = _a.imageUrl, initials = _a.initials, size = _a.size, statusIndicator = _a.statusIndicator, administratorIndicator = _a.administratorIndicator, icon = _a.icon, displayName = _a.displayName;
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
var _a = this.props, imageUrl = _a.imageUrl, initials = _a.initials, size = _a.size, statusIndicator = _a.statusIndicator, administratorIndicator = _a.administratorIndicator, icon = _a.icon, displayName = _a.displayName, customContent = _a.customContent;
|
53
|
+
var tooltipCombined = [displayName, this.props.tooltip].filter(function (str) { return (str !== null && str !== void 0 ? str : '').trim().length > 0; }).join('\n');
|
54
|
+
return (React.createElement(avatar_wrapper_1.AvatarWrapper, { size: size, statusIndicator: statusIndicator ? { status: statusIndicator, tooltipText: '' } : undefined, administratorIndicator: administratorIndicator ? { enabled: true, tooltipText: '' } : undefined, icon: icon, isEmpty: false }, (function () {
|
55
|
+
if (customContent != null) {
|
56
|
+
return customContent;
|
57
|
+
}
|
58
|
+
else if (imageUrl != null || initials == null) {
|
59
|
+
return (React.createElement(avatar_image_1.AvatarContentImage, { imageUrl: imageUrl, tooltipText: tooltipCombined }));
|
60
|
+
}
|
61
|
+
else {
|
62
|
+
return (React.createElement(avatar_text_1.AvatarContentText, { text: initials, tooltipText: tooltipCombined }));
|
63
|
+
}
|
64
|
+
})()));
|
56
65
|
};
|
57
66
|
return Avatar;
|
58
67
|
}(React.PureComponent));
|