@sproutsocial/racine 7.6.0-beta-avatar.0 → 7.7.0

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.
@@ -4,8 +4,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
4
4
 
5
5
  import * as React from "react";
6
6
  import { useState, useCallback, useMemo, memo } from "react";
7
- import styled, { css } from "styled-components";
8
- import classnames from "classnames";
7
+ import styled from "styled-components";
9
8
  import Box from "../Box";
10
9
  import Image from "../Image";
11
10
  import Text from "../Text";
@@ -17,20 +16,8 @@ var AvatarText = styled(function (_ref) {
17
16
  }).withConfig({
18
17
  displayName: "Avatar__AvatarText",
19
18
  componentId: "yx873f-0"
20
- })(["font-size:", "px;color:", "px;"], function (props) {
19
+ })(["font-size:", "px;"], function (props) {
21
20
  return props.fontSize;
22
- }, function (props) {
23
- return props.color;
24
- });
25
- var Container = styled(Box).withConfig({
26
- displayName: "Avatar__Container",
27
- componentId: "yx873f-1"
28
- })(["", ""], function (_ref2) {
29
- var theme = _ref2.theme,
30
- type = _ref2.type,
31
- variant = _ref2.variant,
32
- bg = _ref2.bg;
33
- return css(["color:", ";background:", ";"], theme.colors[type][variant === "dark" ? "200" : "900"], bg ? bg : theme.colors[type][variant === "dark" ? "900" : "200"]);
34
21
  });
35
22
 
36
23
  var getInitials = function getInitials(name, fallback) {
@@ -46,20 +33,14 @@ var getInitials = function getInitials(name, fallback) {
46
33
  .join("");
47
34
  };
48
35
 
49
- export var Avatar = function Avatar(_ref3) {
50
- var _ref3$appearance = _ref3.appearance,
51
- appearance = _ref3$appearance === void 0 ? "circle" : _ref3$appearance,
52
- name = _ref3.name,
53
- src = _ref3.src,
54
- _ref3$variant = _ref3.variant,
55
- variant = _ref3$variant === void 0 ? "light" : _ref3$variant,
56
- _ref3$type = _ref3.type,
57
- type = _ref3$type === void 0 ? "neutral" : _ref3$type,
58
- _ref3$size = _ref3.size,
59
- size = _ref3$size === void 0 ? "40px" : _ref3$size,
60
- bg = _ref3.bg,
61
- color = _ref3.color,
62
- rest = _objectWithoutPropertiesLoose(_ref3, ["appearance", "name", "src", "variant", "type", "size", "bg", "color"]);
36
+ export var Avatar = function Avatar(_ref2) {
37
+ var _ref2$appearance = _ref2.appearance,
38
+ appearance = _ref2$appearance === void 0 ? "circle" : _ref2$appearance,
39
+ name = _ref2.name,
40
+ src = _ref2.src,
41
+ _ref2$size = _ref2.size,
42
+ size = _ref2$size === void 0 ? "40px" : _ref2$size,
43
+ rest = _objectWithoutPropertiesLoose(_ref2, ["appearance", "name", "src", "size"]);
63
44
 
64
45
  var _useState = useState(false),
65
46
  imageFailedLoading = _useState[0],
@@ -73,8 +54,7 @@ export var Avatar = function Avatar(_ref3) {
73
54
  }, [setImageFailedLoading]); // Font size for initials is half the size of the avatar, rounded down.
74
55
 
75
56
  var fontSize = Math.floor(Number(size.replace("px", "")) * 0.4);
76
- return /*#__PURE__*/React.createElement(Container, _extends({
77
- className: classnames(variant),
57
+ return /*#__PURE__*/React.createElement(Box, _extends({
78
58
  size: size,
79
59
  overflow: "hidden",
80
60
  borderRadius: appearance === "leaf" ? "40% 0 40% 0" : "50%",
@@ -84,16 +64,13 @@ export var Avatar = function Avatar(_ref3) {
84
64
  justifyContent: "center",
85
65
  alignItems: "center",
86
66
  title: name,
87
- bg: bg,
88
- variant: variant,
89
- type: type,
67
+ bg: "neutral.200",
90
68
  "data-qa-user-avatar": name // $FlowIssue - upgrade v0.112.0
91
69
 
92
70
  }, rest), !src || imageFailedLoading ? /*#__PURE__*/React.createElement(AvatarText, {
93
71
  lineHeight: size,
94
72
  fontWeight: "semibold",
95
- fontSize: fontSize,
96
- color: color
73
+ fontSize: fontSize
97
74
  }, initials) : /*#__PURE__*/React.createElement(Image, {
98
75
  alt: name,
99
76
  width: "auto",
@@ -3,6 +3,7 @@ module.exports = {
3
3
  "add-item": "0 0 16 16",
4
4
  "add-keyword": "0 0 16 16",
5
5
  "add-team-member": "0 0 18 13",
6
+ "add-variable": "0 0 18 14",
6
7
  "address-card-solid": "0 0 18 16",
7
8
  "adobe-experience-manager": "0 0 16 18",
8
9
  "ads": "0 0 9 16",
@@ -275,6 +276,7 @@ module.exports = {
275
276
  "sent-message": "0 0 16 14",
276
277
  "share": "0 0 16 14",
277
278
  "shopify": "0 0 16 18",
279
+ "show-navigation": "0 0 18 14",
278
280
  "slack": "0 0 16 16",
279
281
  "small-density": "0 0 16 16",
280
282
  "smiley": "0 0 16 16",
@@ -68,9 +68,8 @@ var ModalFooter = function ModalFooter(props) {
68
68
  ModalFooter.defaultProps = {
69
69
  bg: "background.container"
70
70
  };
71
-
72
- // $FlowIssue - upgrade v0.112.0
73
- var ModalContent = function ModalContent(_ref) {
71
+ var ModalContent = /*#__PURE__*/React.forwardRef( // $FlowIssue - upgrade v0.112.0
72
+ function (_ref, ref) {
74
73
  var children = _ref.children,
75
74
  rest = _objectWithoutPropertiesLoose(_ref, ["children"]);
76
75
 
@@ -79,9 +78,10 @@ var ModalContent = function ModalContent(_ref) {
79
78
 
80
79
  return /*#__PURE__*/React.createElement(Content, _extends({
81
80
  "data-qa-modal": true,
82
- "data-qa-label": label
81
+ "data-qa-label": label,
82
+ ref: ref
83
83
  }, rest), children);
84
- };
84
+ });
85
85
 
86
86
  /**
87
87
  * The modal you want
@@ -37,7 +37,7 @@ var Container = styled.button.withConfig({
37
37
  }, function (props) {
38
38
  return props.disabled && css(["opacity:0.4;cursor:not-allowed;"]);
39
39
  }, function (props) {
40
- return !props.valid && css(["color:", ";border-color:", ";background:", ";&:hover{color:", ";}"], function (props) {
40
+ return !props.valid && css(["color:", ";border-color:", ";background:", ";&:hover{color:", ";border-color:", ";background:", ";}"], function (props) {
41
41
  return props.theme.colors.text.inverse;
42
42
  }, function (props) {
43
43
  return props.theme.colors.error.color;
@@ -45,6 +45,10 @@ var Container = styled.button.withConfig({
45
45
  return props.theme.colors.error.color;
46
46
  }, function (props) {
47
47
  return props.theme.colors.text.inverse;
48
+ }, function (props) {
49
+ return props.theme.colors.red[900];
50
+ }, function (props) {
51
+ return props.theme.colors.red[900];
48
52
  });
49
53
  }, COMMON);
50
54
  export default Container;