@lobehub/ui 3.4.0 → 3.4.1
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 +10 -8
- package/package.json +1 -1
package/es/Avatar/Avatar.js
CHANGED
|
@@ -23,7 +23,6 @@ import { useStyles } from "./style";
|
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
24
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
25
|
var Avatar = /*#__PURE__*/memo(function (_ref) {
|
|
26
|
-
var _ref2, _ref3;
|
|
27
26
|
var bordered = _ref.bordered,
|
|
28
27
|
className = _ref.className,
|
|
29
28
|
avatar = _ref.avatar,
|
|
@@ -93,12 +92,15 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
|
|
|
93
92
|
width: size
|
|
94
93
|
}) : avatar;
|
|
95
94
|
var hasBackground = background && background !== 'transparent' && background !== 'rgba(0,0,0,0)' && background !== null;
|
|
96
|
-
var customAvatar =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
var customAvatar = useMemo(function () {
|
|
96
|
+
var _ref2, _ref3;
|
|
97
|
+
return emoji ? /*#__PURE__*/_jsx(FluentEmoji, {
|
|
98
|
+
emoji: emoji,
|
|
99
|
+
size: emojiScaleWithBackground ? hasBackground ? size * 0.85 : size : size * 0.85,
|
|
100
|
+
type: animation ? 'anim' : '3d',
|
|
101
|
+
unoptimized: unoptimized
|
|
102
|
+
}) : 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();
|
|
103
|
+
}, [animation, emoji, hasBackground, size, sliceText, text, title, unoptimized, emojiScaleWithBackground]);
|
|
102
104
|
return /*#__PURE__*/_jsxs(AntAvatar, _objectSpread(_objectSpread({
|
|
103
105
|
alt: imgAlt,
|
|
104
106
|
className: cx(variants({
|
|
@@ -111,7 +113,7 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
|
|
|
111
113
|
size: size,
|
|
112
114
|
src: isDefaultAntAvatar ? defualtAvatar : undefined,
|
|
113
115
|
style: _objectSpread({
|
|
114
|
-
background: isDefaultAntAvatar
|
|
116
|
+
background: isDefaultAntAvatar || !!emoji ? background : background || theme.colorBorder,
|
|
115
117
|
boxShadow: bordered ? "".concat(theme.colorBgLayout, " 0 0 0 2px, ").concat(borderedColor || theme.colorTextTertiary, " 0 0 0 4px") : undefined,
|
|
116
118
|
color: readableColor(background || theme.colorBorder),
|
|
117
119
|
cursor: rest !== null && rest !== void 0 && rest.onClick ? 'pointer' : undefined,
|