@lobehub/ui 3.3.3 → 3.3.4
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/es/Avatar/Avatar.js +6 -11
- package/es/Skeleton/SkeletonAvatar.js +1 -1
- package/package.json +1 -1
package/es/Avatar/Avatar.js
CHANGED
|
@@ -19,11 +19,11 @@ import { Center } from "../Flex";
|
|
|
19
19
|
import FluentEmoji from "../FluentEmoji";
|
|
20
20
|
import Icon from "../Icon";
|
|
21
21
|
import Img from "../Img";
|
|
22
|
-
import Tooltip from "../Tooltip";
|
|
23
22
|
import { useStyles } from "./style";
|
|
24
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
24
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
25
|
var Avatar = /*#__PURE__*/memo(function (_ref) {
|
|
26
|
+
var _ref2, _ref3;
|
|
27
27
|
var bordered = _ref.bordered,
|
|
28
28
|
className = _ref.className,
|
|
29
29
|
avatar = _ref.avatar,
|
|
@@ -32,7 +32,8 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
|
|
|
32
32
|
borderedColor = _ref.borderedColor,
|
|
33
33
|
_ref$size = _ref.size,
|
|
34
34
|
size = _ref$size === void 0 ? 48 : _ref$size,
|
|
35
|
-
shape = _ref.shape,
|
|
35
|
+
_ref$shape = _ref.shape,
|
|
36
|
+
shape = _ref$shape === void 0 ? 'square' : _ref$shape,
|
|
36
37
|
background = _ref.background,
|
|
37
38
|
style = _ref.style,
|
|
38
39
|
unoptimized = _ref.unoptimized,
|
|
@@ -96,8 +97,8 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
|
|
|
96
97
|
size: emojiScaleWithBackground ? hasBackground ? size * 0.8 : size : size * 0.8,
|
|
97
98
|
type: animation ? 'anim' : '3d',
|
|
98
99
|
unoptimized: unoptimized
|
|
99
|
-
}) : sliceText ? text === null ||
|
|
100
|
-
|
|
100
|
+
}) : sliceText ? (_ref2 = text || title) === null || _ref2 === void 0 ? void 0 : _ref2.toUpperCase().slice(0, 2) : (_ref3 = text || title) === null || _ref3 === void 0 ? void 0 : _ref3.toUpperCase();
|
|
101
|
+
return /*#__PURE__*/_jsxs(AntAvatar, _objectSpread(_objectSpread({
|
|
101
102
|
alt: imgAlt,
|
|
102
103
|
className: cx(variants({
|
|
103
104
|
shadow: shadow,
|
|
@@ -109,7 +110,7 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
|
|
|
109
110
|
size: size,
|
|
110
111
|
src: isDefaultAntAvatar ? defualtAvatar : undefined,
|
|
111
112
|
style: _objectSpread({
|
|
112
|
-
background: isDefaultAntAvatar ? background : background || theme.colorBorder,
|
|
113
|
+
background: isDefaultAntAvatar && !emoji ? background : background || theme.colorBorder,
|
|
113
114
|
boxShadow: bordered ? "".concat(theme.colorBgLayout, " 0 0 0 2px, ").concat(borderedColor || theme.colorTextTertiary, " 0 0 0 4px") : undefined,
|
|
114
115
|
color: readableColor(background || theme.colorBorder),
|
|
115
116
|
cursor: rest !== null && rest !== void 0 && rest.onClick ? 'pointer' : undefined,
|
|
@@ -126,12 +127,6 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
|
|
|
126
127
|
})
|
|
127
128
|
}), !isDefaultAntAvatar && customAvatar]
|
|
128
129
|
}));
|
|
129
|
-
if (!title) return content;
|
|
130
|
-
return /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({
|
|
131
|
-
title: title
|
|
132
|
-
}, rest.tooltipProps), {}, {
|
|
133
|
-
children: content
|
|
134
|
-
}));
|
|
135
130
|
});
|
|
136
131
|
Avatar.displayName = 'Avatar';
|
|
137
132
|
export default Avatar;
|
|
@@ -16,7 +16,7 @@ var DEFAULT_SIZE = 40;
|
|
|
16
16
|
var SkeletonAvatar = function SkeletonAvatar(_ref) {
|
|
17
17
|
var active = _ref.active,
|
|
18
18
|
_ref$shape = _ref.shape,
|
|
19
|
-
shape = _ref$shape === void 0 ? '
|
|
19
|
+
shape = _ref$shape === void 0 ? 'square' : _ref$shape,
|
|
20
20
|
size = _ref.size,
|
|
21
21
|
width = _ref.width,
|
|
22
22
|
height = _ref.height,
|