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

@hig/avatar

Package Overview
Dependencies
Maintainers
4
Versions
215
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hig/avatar - npm Package Compare versions

Comparing version 1.0.6 to 1.1.0

36

build/index.es.js

@@ -5,2 +5,3 @@ import React, { Component } from 'react';

import { ThemeContext } from '@hig/theme-context';
import { createCustomClassNames } from '@hig/utils';

@@ -1593,2 +1594,3 @@ /*

var _createEmotion = createEmotion(context),
cx = _createEmotion.cx,
css = _createEmotion.css;

@@ -1661,2 +1663,4 @@

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -1710,2 +1714,3 @@

onError = _ref.onError,
className = _ref.className,
resolvedRoles = _ref.resolvedRoles;

@@ -1716,7 +1721,12 @@

var imageWrapperClassName = createCustomClassNames(className, "image-wrapper");
var imageClassName = createCustomClassNames(className, "image");
return React.createElement(
"span",
{ className: css(styles.avatar.imageWrapper) },
{
className: cx(css(styles.avatar.imageWrapper), imageWrapperClassName)
},
React.createElement("img", {
className: css(styles.avatar.image),
className: cx(css(styles.avatar.image), imageClassName),
src: image,

@@ -1738,2 +1748,3 @@ alt: alt,

name = _ref2.name,
className = _ref2.className,
resolvedRoles = _ref2.resolvedRoles;

@@ -1743,6 +1754,10 @@

var initials = initialsFromName(name);
var initialsClassName = createCustomClassNames(className, "initials");
return React.createElement(
"span",
{ className: css(styles.avatar.initials), "aria-hidden": "true" },
{
className: cx(css(styles.avatar.initials), initialsClassName),
"aria-hidden": "true"
},
size === sizes.SMALL_16 ? initials[0] : initials

@@ -1803,3 +1818,6 @@ );

size = _props.size,
name = _props.name;
name = _props.name,
otherProps = _objectWithoutProperties(_props, ["size", "name"]);
var className = otherProps.className;
var _state = this.state,

@@ -1826,3 +1844,3 @@ imageUrl = _state.imageUrl,

"aria-label": label,
className: css(styles(resolvedRoles).avatar.container),
className: cx(css(styles(resolvedRoles).avatar.container), className),
role: "img"

@@ -1835,5 +1853,11 @@ },

name: name,
className: className,
onError: handleImageError
}),
React.createElement(Initials, { name: name, size: size, resolvedRoles: resolvedRoles })
React.createElement(Initials, {
name: name,
size: size,
resolvedRoles: resolvedRoles,
className: className
})
);

@@ -1840,0 +1864,0 @@ }

@@ -12,2 +12,3 @@ 'use strict';

var themeContext = require('@hig/theme-context');
var utils = require('@hig/utils');

@@ -1600,2 +1601,3 @@ /*

var _createEmotion = createEmotion(context),
cx = _createEmotion.cx,
css = _createEmotion.css;

@@ -1668,2 +1670,4 @@

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -1717,2 +1721,3 @@

onError = _ref.onError,
className = _ref.className,
resolvedRoles = _ref.resolvedRoles;

@@ -1723,7 +1728,12 @@

var imageWrapperClassName = utils.createCustomClassNames(className, "image-wrapper");
var imageClassName = utils.createCustomClassNames(className, "image");
return React__default.createElement(
"span",
{ className: css(styles.avatar.imageWrapper) },
{
className: cx(css(styles.avatar.imageWrapper), imageWrapperClassName)
},
React__default.createElement("img", {
className: css(styles.avatar.image),
className: cx(css(styles.avatar.image), imageClassName),
src: image,

@@ -1745,2 +1755,3 @@ alt: alt,

name = _ref2.name,
className = _ref2.className,
resolvedRoles = _ref2.resolvedRoles;

@@ -1750,6 +1761,10 @@

var initials = initialsFromName(name);
var initialsClassName = utils.createCustomClassNames(className, "initials");
return React__default.createElement(
"span",
{ className: css(styles.avatar.initials), "aria-hidden": "true" },
{
className: cx(css(styles.avatar.initials), initialsClassName),
"aria-hidden": "true"
},
size === sizes.SMALL_16 ? initials[0] : initials

@@ -1810,3 +1825,6 @@ );

size = _props.size,
name = _props.name;
name = _props.name,
otherProps = _objectWithoutProperties(_props, ["size", "name"]);
var className = otherProps.className;
var _state = this.state,

@@ -1833,3 +1851,3 @@ imageUrl = _state.imageUrl,

"aria-label": label,
className: css(styles(resolvedRoles).avatar.container),
className: cx(css(styles(resolvedRoles).avatar.container), className),
role: "img"

@@ -1842,5 +1860,11 @@ },

name: name,
className: className,
onError: handleImageError
}),
React__default.createElement(Initials, { name: name, size: size, resolvedRoles: resolvedRoles })
React__default.createElement(Initials, {
name: name,
size: size,
resolvedRoles: resolvedRoles,
className: className
})
);

@@ -1847,0 +1871,0 @@ }

@@ -0,1 +1,8 @@

# [@hig/avatar-v1.1.0](https://github.com/Autodesk/hig/compare/@hig/avatar@1.0.6...@hig/avatar@1.1.0) (2019-10-10)
### Features
* allow className to be passed down to Avatar ([6b7c894](https://github.com/Autodesk/hig/commit/6b7c894))
# [@hig/avatar-v1.0.6](https://github.com/Autodesk/hig/compare/@hig/avatar@1.0.5...@hig/avatar@1.0.6) (2019-03-20)

@@ -2,0 +9,0 @@

7

package.json
{
"name": "@hig/avatar",
"version": "1.0.6",
"version": "1.1.0",
"description": "HIG Avatar",

@@ -20,2 +20,3 @@ "author": "Autodesk Inc.",

"dependencies": {
"@hig/utils": "^0.4.0",
"prop-types": "^15.7.1",

@@ -25,4 +26,4 @@ "react-lifecycles-compat": "^3.0.4"

"peerDependencies": {
"@hig/theme-context": "^2.1.3",
"@hig/theme-data": "^2.3.3",
"@hig/theme-context": "^3.0.0",
"@hig/theme-data": "^2.12.0",
"react": "^15.4.1 || ^16.3.2"

@@ -29,0 +30,0 @@ },

@@ -31,1 +31,5 @@ # Avatar

```
## Custom CSS
Use the `className` prop to pass in a css class name to the outermost container of the component. The class name will also pass down to most of the other styled elements within the component.
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