Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uiw/react-avatar

Package Overview
Dependencies
Maintainers
2
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uiw/react-avatar - npm Package Compare versions

Comparing version 5.0.0-bate-1 to 5.0.0-bate-10

58

cjs/index.js
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
Object.defineProperty(exports, "__esModule", {

@@ -12,15 +10,8 @@ value: true

exports["default"] = void 0;
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireWildcard(require("react"));
var _utils = require("@uiw/utils");
var _style = require("./style");
Object.keys(_style).forEach(function (key) {

@@ -37,29 +28,24 @@ if (key === "default" || key === "__esModule") return;

});
var _reactIcon = require("@uiw/react-icon");
var _jsxRuntime = require("react/jsx-runtime");
var _excluded = ["prefixCls", "shape", "size", "className", "src", "alt", "icon", "onError"];
var _default = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
var _props$prefixCls = props.prefixCls,
prefixCls = _props$prefixCls === void 0 ? 'w-avatar' : _props$prefixCls,
_props$shape = props.shape,
shape = _props$shape === void 0 ? 'circle' : _props$shape,
_props$size = props.size,
size = _props$size === void 0 ? 'default' : _props$size,
className = props.className,
src = props.src,
alt = props.alt,
icon = props.icon,
_props$onError = props.onError,
_onError = _props$onError === void 0 ? _utils.noop : _props$onError,
resetProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
prefixCls = _props$prefixCls === void 0 ? 'w-avatar' : _props$prefixCls,
_props$shape = props.shape,
shape = _props$shape === void 0 ? 'circle' : _props$shape,
_props$size = props.size,
size = _props$size === void 0 ? 'default' : _props$size,
className = props.className,
src = props.src,
alt = props.alt,
icon = props.icon,
_props$onError = props.onError,
_onError = _props$onError === void 0 ? _utils.noop : _props$onError,
resetProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
var children = props.children;
var _useState = (0, _react.useState)(true),
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
isImgExist = _useState2[0],
setIsImgExist = _useState2[1];
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
isImgExist = _useState2[0],
setIsImgExist = _useState2[1];
var cls = [prefixCls, className, size ? "".concat(prefixCls, "-").concat(size) : null, shape ? "".concat(prefixCls, "-").concat(shape) : null, src ? "".concat(prefixCls, "-image") : null].filter(Boolean).join(' ').trim();

@@ -69,3 +55,2 @@ (0, _react.useEffect)(function () {

}, [props.src]);
if (isImgExist && src) {

@@ -77,3 +62,2 @@ children = /*#__PURE__*/(0, _jsxRuntime.jsx)(_style.AvatarStyleImg, {

var errorFlag = _onError ? _onError(evn) : undefined;
if (errorFlag !== false) {

@@ -85,6 +69,7 @@ setIsImgExist(false);

} else if (icon) {
children = icon;
children = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIcon.IconStyleBase, {
children: icon
});
}
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_style.AvatarStyleWarp, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, resetProps), {}, {
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_style.AvatarStyleWarp, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, resetProps), {}, {
size: size,

@@ -94,7 +79,6 @@ shape: shape,

ref: ref,
children: [children, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {})]
children: children
}));
});
exports["default"] = _default;
//# sourceMappingURL=index.js.map
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
Object.defineProperty(exports, "__esModule", {

@@ -11,13 +9,7 @@ value: true

exports.AvatarStyleWarp = exports.AvatarStyleTheme = exports.AvatarStyleImg = void 0;
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _styledComponents = _interopRequireWildcard(require("styled-components"));
var _utils = require("@uiw/utils");
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
var AvatarStyleTheme = {

@@ -40,7 +32,4 @@ backgroundColorAvatar: '#ccc',

};
var AvatarStyleImg = _styledComponents["default"].img(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])([""])));
exports.AvatarStyleImg = AvatarStyleImg;
var AvatarStyleWarp = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-block;\n text-align: center;\n background: ", ";\n color: ", ";\n vertical-align: middle;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n font-size: ", ";\n width: ", ";\n height: ", ";\n border-radius: ", ";\n display: inline-flex;\n justify-content: center;\n align-items: center;\n & + & {\n margin-left: 5px;\n }\n ", "\n\n ", " \n &.w-avatar-circle {\n }\n & > ", " {\n width: 100%;\n height: 100%;\n display: block;\n }\n"])), function (props) {

@@ -60,13 +49,9 @@ return (0, _utils.getThemeVariantValue)((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), propsTheme), 'backgroundColorAvatar');

var size = props.size;
switch (size) {
case 'mini':
return (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n font-size: ", ";\n "])), (0, _utils.getThemeVariantValue)((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), propsTheme), 'widthAvatarMini'), (0, _utils.getThemeVariantValue)((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), propsTheme), 'widthAvatarMini'), (0, _utils.getThemeVariantValue)((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), propsTheme), 'fontSizeAvatarMini'));
case 'small':
return (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n font-size: ", ";\n "])), (0, _utils.getThemeVariantValue)((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), propsTheme), 'widthAvatarSmall'), (0, _utils.getThemeVariantValue)((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), propsTheme), 'widthAvatarSmall'), (0, _utils.getThemeVariantValue)((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), propsTheme), 'fontSizeAvatarSmall'));
case 'large':
return (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n font-size: ", ";\n "])), (0, _utils.getThemeVariantValue)((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), propsTheme), 'widthAvatarLarge'), (0, _utils.getThemeVariantValue)((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), propsTheme), 'widthAvatarLarge'), (0, _utils.getThemeVariantValue)((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), propsTheme), 'fontSizeAvatarLarge'));
default:

@@ -78,4 +63,3 @@ return (0, _styledComponents.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])([""])));

}, AvatarStyleImg);
exports.AvatarStyleWarp = AvatarStyleWarp;
//# sourceMappingURL=index.js.map

@@ -8,18 +8,17 @@ import _extends from "@babel/runtime/helpers/extends";

import { AvatarStyleWarp, AvatarStyleImg } from './style';
import { IconStyleBase } from '@uiw/react-icon';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
export * from './style';
export default /*#__PURE__*/React.forwardRef((props, ref) => {
var {
prefixCls = 'w-avatar',
shape = 'circle',
size = 'default',
className,
src,
alt,
icon,
onError: _onError = noop
} = props,
resetProps = _objectWithoutPropertiesLoose(props, _excluded);
prefixCls = 'w-avatar',
shape = 'circle',
size = 'default',
className,
src,
alt,
icon,
onError: _onError = noop
} = props,
resetProps = _objectWithoutPropertiesLoose(props, _excluded);
var children = props.children;

@@ -31,3 +30,2 @@ var [isImgExist, setIsImgExist] = useState(true);

}, [props.src]);
if (isImgExist && src) {

@@ -39,3 +37,2 @@ children = /*#__PURE__*/_jsx(AvatarStyleImg, {

var errorFlag = _onError ? _onError(evn) : undefined;
if (errorFlag !== false) {

@@ -47,6 +44,7 @@ setIsImgExist(false);

} else if (icon) {
children = icon;
children = /*#__PURE__*/_jsx(IconStyleBase, {
children: icon
});
}
return /*#__PURE__*/_jsxs(AvatarStyleWarp, _extends({}, resetProps, {
return /*#__PURE__*/_jsx(AvatarStyleWarp, _extends({}, resetProps, {
size: size,

@@ -56,5 +54,5 @@ shape: shape,

ref: ref,
children: [children, /*#__PURE__*/_jsx("span", {})]
children: children
}));
});
//# sourceMappingURL=index.js.map
import _taggedTemplateLiteralLoose from "@babel/runtime/helpers/taggedTemplateLiteralLoose";
import _extends from "@babel/runtime/helpers/extends";
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
import styled, { css } from 'styled-components';

@@ -29,13 +27,9 @@ import { getThemeVariantValue } from '@uiw/utils';

} = props;
switch (size) {
case 'mini':
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n height: ", ";\n width: ", ";\n font-size: ", ";\n "])), getThemeVariantValue(_extends({}, props, propsTheme), 'widthAvatarMini'), getThemeVariantValue(_extends({}, props, propsTheme), 'widthAvatarMini'), getThemeVariantValue(_extends({}, props, propsTheme), 'fontSizeAvatarMini'));
case 'small':
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n height: ", ";\n width: ", ";\n font-size: ", ";\n "])), getThemeVariantValue(_extends({}, props, propsTheme), 'widthAvatarSmall'), getThemeVariantValue(_extends({}, props, propsTheme), 'widthAvatarSmall'), getThemeVariantValue(_extends({}, props, propsTheme), 'fontSizeAvatarSmall'));
case 'large':
return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n height: ", ";\n width: ", ";\n font-size: ", ";\n "])), getThemeVariantValue(_extends({}, props, propsTheme), 'widthAvatarLarge'), getThemeVariantValue(_extends({}, props, propsTheme), 'widthAvatarLarge'), getThemeVariantValue(_extends({}, props, propsTheme), 'fontSizeAvatarLarge'));
default:

@@ -42,0 +36,0 @@ return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose([""])));

{
"name": "@uiw/react-avatar",
"version": "5.0.0-bate-1",
"version": "5.0.0-bate-10",
"description": "Avatar component",

@@ -48,4 +48,5 @@ "author": "Kenny Wong <wowohoo@qq.com>",

"dependencies": {
"@uiw/utils": "^5.0.0-bate-1"
"@uiw/react-icon": "^5.0.0-bate-10",
"@uiw/utils": "^5.0.0-bate-10"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc