@lobehub/ui 3.3.3 → 3.3.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/es/Avatar/Avatar.js +8 -12
- 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,
|
|
@@ -43,7 +44,8 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
|
|
|
43
44
|
loading = _ref.loading,
|
|
44
45
|
_ref$sliceText = _ref.sliceText,
|
|
45
46
|
sliceText = _ref$sliceText === void 0 ? true : _ref$sliceText,
|
|
46
|
-
|
|
47
|
+
_ref$emojiScaleWithBa = _ref.emojiScaleWithBackground,
|
|
48
|
+
emojiScaleWithBackground = _ref$emojiScaleWithBa === void 0 ? true : _ref$emojiScaleWithBa,
|
|
47
49
|
ref = _ref.ref,
|
|
48
50
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
49
51
|
var isStringAvatar = typeof avatar === 'string';
|
|
@@ -96,8 +98,8 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
|
|
|
96
98
|
size: emojiScaleWithBackground ? hasBackground ? size * 0.8 : size : size * 0.8,
|
|
97
99
|
type: animation ? 'anim' : '3d',
|
|
98
100
|
unoptimized: unoptimized
|
|
99
|
-
}) : sliceText ? text === null ||
|
|
100
|
-
|
|
101
|
+
}) : 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();
|
|
102
|
+
return /*#__PURE__*/_jsxs(AntAvatar, _objectSpread(_objectSpread({
|
|
101
103
|
alt: imgAlt,
|
|
102
104
|
className: cx(variants({
|
|
103
105
|
shadow: shadow,
|
|
@@ -109,7 +111,7 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
|
|
|
109
111
|
size: size,
|
|
110
112
|
src: isDefaultAntAvatar ? defualtAvatar : undefined,
|
|
111
113
|
style: _objectSpread({
|
|
112
|
-
background: isDefaultAntAvatar ? background : background || theme.colorBorder,
|
|
114
|
+
background: isDefaultAntAvatar && !emoji ? background : background || theme.colorBorder,
|
|
113
115
|
boxShadow: bordered ? "".concat(theme.colorBgLayout, " 0 0 0 2px, ").concat(borderedColor || theme.colorTextTertiary, " 0 0 0 4px") : undefined,
|
|
114
116
|
color: readableColor(background || theme.colorBorder),
|
|
115
117
|
cursor: rest !== null && rest !== void 0 && rest.onClick ? 'pointer' : undefined,
|
|
@@ -126,12 +128,6 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
|
|
|
126
128
|
})
|
|
127
129
|
}), !isDefaultAntAvatar && customAvatar]
|
|
128
130
|
}));
|
|
129
|
-
if (!title) return content;
|
|
130
|
-
return /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({
|
|
131
|
-
title: title
|
|
132
|
-
}, rest.tooltipProps), {}, {
|
|
133
|
-
children: content
|
|
134
|
-
}));
|
|
135
131
|
});
|
|
136
132
|
Avatar.displayName = 'Avatar';
|
|
137
133
|
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,
|