@sproutsocial/racine 7.4.2 → 7.6.0-beta-avatar.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.
- package/CHANGELOG.md +6 -0
- package/README.md +18 -1
- package/__flow__/Avatar/index.js +34 -5
- package/__flow__/Avatar/index.stories.js +29 -0
- package/__flow__/Link/index.js +3 -0
- package/__flow__/Link/index.stories.js +8 -0
- package/__flow__/Link/index.test.js +5 -0
- package/__flow__/Link/styles.js +1 -1
- package/commonjs/Avatar/index.js +37 -13
- package/commonjs/Link/index.js +3 -1
- package/commonjs/Link/styles.js +3 -1
- package/lib/Avatar/index.js +36 -13
- package/lib/Link/index.js +3 -1
- package/lib/Link/styles.js +3 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
## Installation
|
|
25
25
|
|
|
26
|
-
Install Racine
|
|
26
|
+
Install Racine using npm or yarn:
|
|
27
27
|
|
|
28
28
|
```sh
|
|
29
29
|
$ yarn add @sproutsocial/racine react styled-components
|
|
@@ -31,6 +31,23 @@ $ yarn add @sproutsocial/racine react styled-components
|
|
|
31
31
|
$ npm install @sproutsocial/racine react styled-components
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
You may also require specific peer dependencies when starting a new project or sandbox environment:
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
@sproutsocial/seeds-border
|
|
38
|
+
@sproutsocial/seeds-color
|
|
39
|
+
@sproutsocial/seeds-depth
|
|
40
|
+
@sproutsocial/seeds-motion
|
|
41
|
+
@sproutsocial/seeds-networkcolor
|
|
42
|
+
@sproutsocial/seeds-space
|
|
43
|
+
@sproutsocial/seeds-typography
|
|
44
|
+
moment
|
|
45
|
+
prop-types
|
|
46
|
+
react
|
|
47
|
+
react-dates
|
|
48
|
+
styled-components
|
|
49
|
+
```
|
|
50
|
+
|
|
34
51
|
Then, wrap your app's React root in Racine's `ThemeProvider` component:
|
|
35
52
|
|
|
36
53
|
```js
|
package/__flow__/Avatar/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { useState, useCallback, useMemo, memo } from "react";
|
|
4
|
-
import styled from "styled-components";
|
|
4
|
+
import styled, { css, type StyledComponent } from "styled-components";
|
|
5
|
+
import classnames from "classnames";
|
|
6
|
+
|
|
7
|
+
import type { TypeTheme } from "../types/theme.flow";
|
|
8
|
+
|
|
5
9
|
import Box from "../Box";
|
|
6
10
|
import Image from "../Image";
|
|
7
11
|
import Text from "../Text";
|
|
@@ -13,11 +17,24 @@ export type TypeProps = {
|
|
|
13
17
|
name: string,
|
|
14
18
|
/** URL of the avatar image. If a URL is not provided, the component will fall back to showing the user's initials */
|
|
15
19
|
src?: string,
|
|
20
|
+
type?: "neutral" | "purple" | "green" | "blue" | "yellow" | "red" | "orange",
|
|
21
|
+
variant?: "dark" | "light",
|
|
22
|
+
bg?: string,
|
|
23
|
+
color?: string,
|
|
16
24
|
size?: string,
|
|
17
25
|
};
|
|
18
26
|
|
|
19
27
|
const AvatarText = styled(({ fontSize, ...rest }) => <Text {...rest} />)`
|
|
20
28
|
font-size: ${(props) => props.fontSize}px;
|
|
29
|
+
color: ${(props) => props.color}px;
|
|
30
|
+
`;
|
|
31
|
+
const Container: StyledComponent<any, TypeTheme, *> = styled(Box)`
|
|
32
|
+
${({ theme, type, variant, bg }) => css`
|
|
33
|
+
color: ${theme.colors[type][variant === "dark" ? "200" : "900"]};
|
|
34
|
+
background: ${bg
|
|
35
|
+
? bg
|
|
36
|
+
: theme.colors[type][variant === "dark" ? "900" : "200"]};
|
|
37
|
+
`}
|
|
21
38
|
`;
|
|
22
39
|
|
|
23
40
|
const getInitials = (name: string, fallback: string = "?"): string => {
|
|
@@ -34,7 +51,11 @@ export const Avatar = ({
|
|
|
34
51
|
appearance = "circle",
|
|
35
52
|
name,
|
|
36
53
|
src,
|
|
54
|
+
variant = "light",
|
|
55
|
+
type = "neutral",
|
|
37
56
|
size = "40px",
|
|
57
|
+
bg,
|
|
58
|
+
color,
|
|
38
59
|
...rest
|
|
39
60
|
}: TypeProps) => {
|
|
40
61
|
const [imageFailedLoading, setImageFailedLoading] = useState(false);
|
|
@@ -48,7 +69,8 @@ export const Avatar = ({
|
|
|
48
69
|
const fontSize = Math.floor(Number(size.replace("px", "")) * 0.4);
|
|
49
70
|
|
|
50
71
|
return (
|
|
51
|
-
<
|
|
72
|
+
<Container
|
|
73
|
+
className={classnames(variant)}
|
|
52
74
|
size={size}
|
|
53
75
|
overflow="hidden"
|
|
54
76
|
borderRadius={appearance === "leaf" ? "40% 0 40% 0" : "50%"}
|
|
@@ -58,13 +80,20 @@ export const Avatar = ({
|
|
|
58
80
|
justifyContent="center"
|
|
59
81
|
alignItems="center"
|
|
60
82
|
title={name}
|
|
61
|
-
bg=
|
|
83
|
+
bg={bg}
|
|
84
|
+
variant={variant}
|
|
85
|
+
type={type}
|
|
62
86
|
data-qa-user-avatar={name}
|
|
63
87
|
// $FlowIssue - upgrade v0.112.0
|
|
64
88
|
{...rest}
|
|
65
89
|
>
|
|
66
90
|
{!src || imageFailedLoading ? (
|
|
67
|
-
<AvatarText
|
|
91
|
+
<AvatarText
|
|
92
|
+
lineHeight={size}
|
|
93
|
+
fontWeight="semibold"
|
|
94
|
+
fontSize={fontSize}
|
|
95
|
+
color={color}
|
|
96
|
+
>
|
|
68
97
|
{initials}
|
|
69
98
|
</AvatarText>
|
|
70
99
|
) : (
|
|
@@ -77,7 +106,7 @@ export const Avatar = ({
|
|
|
77
106
|
m={0}
|
|
78
107
|
/>
|
|
79
108
|
)}
|
|
80
|
-
</
|
|
109
|
+
</Container>
|
|
81
110
|
);
|
|
82
111
|
};
|
|
83
112
|
|
|
@@ -11,6 +11,35 @@ defaultStory.story = {
|
|
|
11
11
|
name: "Default",
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
export const customColors = () => (
|
|
15
|
+
<Avatar name="Joe Smith" bg="purple.500" color="red.200" />
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
customColors.story = {
|
|
19
|
+
name: "Override colors",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const withVariants = () => (
|
|
23
|
+
<div display="inline-block">
|
|
24
|
+
<Avatar mt={5} name="Kent C. Dodds" type="neutral" variant="dark" />
|
|
25
|
+
<Avatar mt={5} name="Kent C. Dodds" type="neutral" variant="light" />
|
|
26
|
+
<Avatar mt={5} name="Kent C. Dodds" type="green" variant="dark" />
|
|
27
|
+
<Avatar mt={5} name="Kent C. Dodds" type="green" variant="light" />
|
|
28
|
+
<Avatar mt={5} name="Kent C. Dodds" type="purple" variant="dark" />
|
|
29
|
+
<Avatar mt={5} name="Kent C. Dodds" type="purple" variant="light" />
|
|
30
|
+
<Avatar mt={5} name="Kent C. Dodds" type="red" variant="light" />
|
|
31
|
+
<Avatar mt={5} name="Kent C. Dodds" type="red" variant="dark" />
|
|
32
|
+
<Avatar mt={5} name="Kent C. Dodds" type="yellow" variant="light" />
|
|
33
|
+
<Avatar mt={5} name="Kent C. Dodds" type="yellow" variant="dark" />
|
|
34
|
+
<Avatar mt={5} name="Kent C. Dodds" type="blue" variant="light" />
|
|
35
|
+
<Avatar mt={5} name="Kent C. Dodds" type="blue" variant="dark" />
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
withVariants.story = {
|
|
40
|
+
name: "With color types",
|
|
41
|
+
};
|
|
42
|
+
|
|
14
43
|
export const withImage = () => (
|
|
15
44
|
<Avatar name="Kent C. Dodds" src="https://github.com/kentcdodds.png" />
|
|
16
45
|
);
|
package/__flow__/Link/index.js
CHANGED
|
@@ -14,6 +14,7 @@ type TypeProps = {
|
|
|
14
14
|
/** Setting this prop will cause the component to be rendered as a button instead of an anchor) */
|
|
15
15
|
onClick?: (e: SyntheticEvent<HTMLButtonElement>) => void,
|
|
16
16
|
as?: $PropertyType<TypeStyledComponentsCommonProps, "as">,
|
|
17
|
+
underline?: boolean,
|
|
17
18
|
qa?: Object,
|
|
18
19
|
};
|
|
19
20
|
|
|
@@ -24,6 +25,7 @@ const Link = ({
|
|
|
24
25
|
disabled,
|
|
25
26
|
onClick,
|
|
26
27
|
as,
|
|
28
|
+
underline,
|
|
27
29
|
qa = {},
|
|
28
30
|
...rest
|
|
29
31
|
}: TypeProps) => {
|
|
@@ -45,6 +47,7 @@ const Link = ({
|
|
|
45
47
|
aria-disabled={disabled ? disabled : undefined}
|
|
46
48
|
disabled={disabled}
|
|
47
49
|
onClick={onClick}
|
|
50
|
+
underline={underline}
|
|
48
51
|
data-qa-link={""}
|
|
49
52
|
data-qa-link-isdisabled={disabled === true}
|
|
50
53
|
{...qa}
|
|
@@ -145,3 +145,11 @@ export const differentFontSizes = () => (
|
|
|
145
145
|
differentFontSizes.story = {
|
|
146
146
|
name: "Different font sizes",
|
|
147
147
|
};
|
|
148
|
+
|
|
149
|
+
export const underlinedLink = () => (
|
|
150
|
+
<Link underline>{text("children", "Underlined Link")}</Link>
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
underlinedLink.story = {
|
|
154
|
+
name: "Underlined Link",
|
|
155
|
+
};
|
|
@@ -99,4 +99,9 @@ describe("Racine Link", () => {
|
|
|
99
99
|
expect(getByText("Link").type).toBeFalsy();
|
|
100
100
|
expect(getByText("Link").type).not.toEqual("button");
|
|
101
101
|
});
|
|
102
|
+
|
|
103
|
+
it("Can render with an underline", () => {
|
|
104
|
+
const { getByText } = render(<Link underline>Link</Link>);
|
|
105
|
+
expect(getByText("Link")).toHaveStyleRule("text-decoration", "underline");
|
|
106
|
+
});
|
|
102
107
|
});
|
package/__flow__/Link/styles.js
CHANGED
|
@@ -11,7 +11,7 @@ const Container = styled<typeof Text, TypeTheme, any>(Text)`
|
|
|
11
11
|
font-family: ${(props) => props.theme.fontFamily};
|
|
12
12
|
transition: all ${(props) => props.theme.duration.fast}
|
|
13
13
|
${(props) => props.theme.easing.ease_inout};
|
|
14
|
-
text-decoration: none;
|
|
14
|
+
text-decoration: ${(props) => (props.underline ? "underline" : "none")};
|
|
15
15
|
appearance: none;
|
|
16
16
|
cursor: pointer;
|
|
17
17
|
${(props) =>
|
package/commonjs/Avatar/index.js
CHANGED
|
@@ -5,7 +5,9 @@ exports.default = exports.Avatar = void 0;
|
|
|
5
5
|
|
|
6
6
|
var React = _interopRequireWildcard(require("react"));
|
|
7
7
|
|
|
8
|
-
var _styledComponents =
|
|
8
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
11
|
|
|
10
12
|
var _Box = _interopRequireDefault(require("../Box"));
|
|
11
13
|
|
|
@@ -31,8 +33,20 @@ var AvatarText = (0, _styledComponents.default)(function (_ref) {
|
|
|
31
33
|
}).withConfig({
|
|
32
34
|
displayName: "Avatar__AvatarText",
|
|
33
35
|
componentId: "yx873f-0"
|
|
34
|
-
})(["font-size:", "px;"], function (props) {
|
|
36
|
+
})(["font-size:", "px;color:", "px;"], function (props) {
|
|
35
37
|
return props.fontSize;
|
|
38
|
+
}, function (props) {
|
|
39
|
+
return props.color;
|
|
40
|
+
});
|
|
41
|
+
var Container = (0, _styledComponents.default)(_Box.default).withConfig({
|
|
42
|
+
displayName: "Avatar__Container",
|
|
43
|
+
componentId: "yx873f-1"
|
|
44
|
+
})(["", ""], function (_ref2) {
|
|
45
|
+
var theme = _ref2.theme,
|
|
46
|
+
type = _ref2.type,
|
|
47
|
+
variant = _ref2.variant,
|
|
48
|
+
bg = _ref2.bg;
|
|
49
|
+
return (0, _styledComponents.css)(["color:", ";background:", ";"], theme.colors[type][variant === "dark" ? "200" : "900"], bg ? bg : theme.colors[type][variant === "dark" ? "900" : "200"]);
|
|
36
50
|
});
|
|
37
51
|
|
|
38
52
|
var getInitials = function getInitials(name, fallback) {
|
|
@@ -48,14 +62,20 @@ var getInitials = function getInitials(name, fallback) {
|
|
|
48
62
|
.join("");
|
|
49
63
|
};
|
|
50
64
|
|
|
51
|
-
var Avatar = function Avatar(
|
|
52
|
-
var
|
|
53
|
-
appearance =
|
|
54
|
-
name =
|
|
55
|
-
src =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
var Avatar = function Avatar(_ref3) {
|
|
66
|
+
var _ref3$appearance = _ref3.appearance,
|
|
67
|
+
appearance = _ref3$appearance === void 0 ? "circle" : _ref3$appearance,
|
|
68
|
+
name = _ref3.name,
|
|
69
|
+
src = _ref3.src,
|
|
70
|
+
_ref3$variant = _ref3.variant,
|
|
71
|
+
variant = _ref3$variant === void 0 ? "light" : _ref3$variant,
|
|
72
|
+
_ref3$type = _ref3.type,
|
|
73
|
+
type = _ref3$type === void 0 ? "neutral" : _ref3$type,
|
|
74
|
+
_ref3$size = _ref3.size,
|
|
75
|
+
size = _ref3$size === void 0 ? "40px" : _ref3$size,
|
|
76
|
+
bg = _ref3.bg,
|
|
77
|
+
color = _ref3.color,
|
|
78
|
+
rest = _objectWithoutPropertiesLoose(_ref3, ["appearance", "name", "src", "variant", "type", "size", "bg", "color"]);
|
|
59
79
|
|
|
60
80
|
var _useState = (0, React.useState)(false),
|
|
61
81
|
imageFailedLoading = _useState[0],
|
|
@@ -69,7 +89,8 @@ var Avatar = function Avatar(_ref2) {
|
|
|
69
89
|
}, [setImageFailedLoading]); // Font size for initials is half the size of the avatar, rounded down.
|
|
70
90
|
|
|
71
91
|
var fontSize = Math.floor(Number(size.replace("px", "")) * 0.4);
|
|
72
|
-
return /*#__PURE__*/React.createElement(
|
|
92
|
+
return /*#__PURE__*/React.createElement(Container, _extends({
|
|
93
|
+
className: (0, _classnames.default)(variant),
|
|
73
94
|
size: size,
|
|
74
95
|
overflow: "hidden",
|
|
75
96
|
borderRadius: appearance === "leaf" ? "40% 0 40% 0" : "50%",
|
|
@@ -79,13 +100,16 @@ var Avatar = function Avatar(_ref2) {
|
|
|
79
100
|
justifyContent: "center",
|
|
80
101
|
alignItems: "center",
|
|
81
102
|
title: name,
|
|
82
|
-
bg:
|
|
103
|
+
bg: bg,
|
|
104
|
+
variant: variant,
|
|
105
|
+
type: type,
|
|
83
106
|
"data-qa-user-avatar": name // $FlowIssue - upgrade v0.112.0
|
|
84
107
|
|
|
85
108
|
}, rest), !src || imageFailedLoading ? /*#__PURE__*/React.createElement(AvatarText, {
|
|
86
109
|
lineHeight: size,
|
|
87
110
|
fontWeight: "semibold",
|
|
88
|
-
fontSize: fontSize
|
|
111
|
+
fontSize: fontSize,
|
|
112
|
+
color: color
|
|
89
113
|
}, initials) : /*#__PURE__*/React.createElement(_Image.default, {
|
|
90
114
|
alt: name,
|
|
91
115
|
width: "auto",
|
package/commonjs/Link/index.js
CHANGED
|
@@ -24,9 +24,10 @@ var Link = function Link(_ref) {
|
|
|
24
24
|
disabled = _ref.disabled,
|
|
25
25
|
onClick = _ref.onClick,
|
|
26
26
|
as = _ref.as,
|
|
27
|
+
underline = _ref.underline,
|
|
27
28
|
_ref$qa = _ref.qa,
|
|
28
29
|
qa = _ref$qa === void 0 ? {} : _ref$qa,
|
|
29
|
-
rest = _objectWithoutPropertiesLoose(_ref, ["href", "external", "children", "disabled", "onClick", "as", "qa"]);
|
|
30
|
+
rest = _objectWithoutPropertiesLoose(_ref, ["href", "external", "children", "disabled", "onClick", "as", "underline", "qa"]);
|
|
30
31
|
|
|
31
32
|
if (!href && external) {
|
|
32
33
|
console.warn("Warning: external prop cannot be set without a href declaration");
|
|
@@ -42,6 +43,7 @@ var Link = function Link(_ref) {
|
|
|
42
43
|
"aria-disabled": disabled ? disabled : undefined,
|
|
43
44
|
disabled: disabled,
|
|
44
45
|
onClick: onClick,
|
|
46
|
+
underline: underline,
|
|
45
47
|
"data-qa-link": "",
|
|
46
48
|
"data-qa-link-isdisabled": disabled === true
|
|
47
49
|
}, qa, rest), children);
|
package/commonjs/Link/styles.js
CHANGED
|
@@ -20,12 +20,14 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
20
20
|
var Container = (0, _styledComponents.default)(_Text.default).withConfig({
|
|
21
21
|
displayName: "styles__Container",
|
|
22
22
|
componentId: "adcw4a-0"
|
|
23
|
-
})(["border:0;font-family:", ";transition:all ", " ", ";text-decoration:
|
|
23
|
+
})(["border:0;font-family:", ";transition:all ", " ", ";text-decoration:", ";appearance:none;cursor:pointer;", " font-weight:", ";color:", ";&:hover{color:", ";text-decoration:underline;}&:active{color:", ";}&:focus{", "}&:focus:active{box-shadow:none;}", " ", " ", " ", ""], function (props) {
|
|
24
24
|
return props.theme.fontFamily;
|
|
25
25
|
}, function (props) {
|
|
26
26
|
return props.theme.duration.fast;
|
|
27
27
|
}, function (props) {
|
|
28
28
|
return props.theme.easing.ease_inout;
|
|
29
|
+
}, function (props) {
|
|
30
|
+
return props.underline ? "underline" : "none";
|
|
29
31
|
}, function (props) {
|
|
30
32
|
return props.disabled && (0, _styledComponents.css)(["opacity:0.4;cursor:not-allowed;"]);
|
|
31
33
|
}, function (props) {
|
package/lib/Avatar/index.js
CHANGED
|
@@ -4,7 +4,8 @@ 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 from "styled-components";
|
|
7
|
+
import styled, { css } from "styled-components";
|
|
8
|
+
import classnames from "classnames";
|
|
8
9
|
import Box from "../Box";
|
|
9
10
|
import Image from "../Image";
|
|
10
11
|
import Text from "../Text";
|
|
@@ -16,8 +17,20 @@ var AvatarText = styled(function (_ref) {
|
|
|
16
17
|
}).withConfig({
|
|
17
18
|
displayName: "Avatar__AvatarText",
|
|
18
19
|
componentId: "yx873f-0"
|
|
19
|
-
})(["font-size:", "px;"], function (props) {
|
|
20
|
+
})(["font-size:", "px;color:", "px;"], function (props) {
|
|
20
21
|
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"]);
|
|
21
34
|
});
|
|
22
35
|
|
|
23
36
|
var getInitials = function getInitials(name, fallback) {
|
|
@@ -33,14 +46,20 @@ var getInitials = function getInitials(name, fallback) {
|
|
|
33
46
|
.join("");
|
|
34
47
|
};
|
|
35
48
|
|
|
36
|
-
export var Avatar = function Avatar(
|
|
37
|
-
var
|
|
38
|
-
appearance =
|
|
39
|
-
name =
|
|
40
|
-
src =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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"]);
|
|
44
63
|
|
|
45
64
|
var _useState = useState(false),
|
|
46
65
|
imageFailedLoading = _useState[0],
|
|
@@ -54,7 +73,8 @@ export var Avatar = function Avatar(_ref2) {
|
|
|
54
73
|
}, [setImageFailedLoading]); // Font size for initials is half the size of the avatar, rounded down.
|
|
55
74
|
|
|
56
75
|
var fontSize = Math.floor(Number(size.replace("px", "")) * 0.4);
|
|
57
|
-
return /*#__PURE__*/React.createElement(
|
|
76
|
+
return /*#__PURE__*/React.createElement(Container, _extends({
|
|
77
|
+
className: classnames(variant),
|
|
58
78
|
size: size,
|
|
59
79
|
overflow: "hidden",
|
|
60
80
|
borderRadius: appearance === "leaf" ? "40% 0 40% 0" : "50%",
|
|
@@ -64,13 +84,16 @@ export var Avatar = function Avatar(_ref2) {
|
|
|
64
84
|
justifyContent: "center",
|
|
65
85
|
alignItems: "center",
|
|
66
86
|
title: name,
|
|
67
|
-
bg:
|
|
87
|
+
bg: bg,
|
|
88
|
+
variant: variant,
|
|
89
|
+
type: type,
|
|
68
90
|
"data-qa-user-avatar": name // $FlowIssue - upgrade v0.112.0
|
|
69
91
|
|
|
70
92
|
}, rest), !src || imageFailedLoading ? /*#__PURE__*/React.createElement(AvatarText, {
|
|
71
93
|
lineHeight: size,
|
|
72
94
|
fontWeight: "semibold",
|
|
73
|
-
fontSize: fontSize
|
|
95
|
+
fontSize: fontSize,
|
|
96
|
+
color: color
|
|
74
97
|
}, initials) : /*#__PURE__*/React.createElement(Image, {
|
|
75
98
|
alt: name,
|
|
76
99
|
width: "auto",
|
package/lib/Link/index.js
CHANGED
|
@@ -12,9 +12,10 @@ var Link = function Link(_ref) {
|
|
|
12
12
|
disabled = _ref.disabled,
|
|
13
13
|
onClick = _ref.onClick,
|
|
14
14
|
as = _ref.as,
|
|
15
|
+
underline = _ref.underline,
|
|
15
16
|
_ref$qa = _ref.qa,
|
|
16
17
|
qa = _ref$qa === void 0 ? {} : _ref$qa,
|
|
17
|
-
rest = _objectWithoutPropertiesLoose(_ref, ["href", "external", "children", "disabled", "onClick", "as", "qa"]);
|
|
18
|
+
rest = _objectWithoutPropertiesLoose(_ref, ["href", "external", "children", "disabled", "onClick", "as", "underline", "qa"]);
|
|
18
19
|
|
|
19
20
|
if (!href && external) {
|
|
20
21
|
console.warn("Warning: external prop cannot be set without a href declaration");
|
|
@@ -30,6 +31,7 @@ var Link = function Link(_ref) {
|
|
|
30
31
|
"aria-disabled": disabled ? disabled : undefined,
|
|
31
32
|
disabled: disabled,
|
|
32
33
|
onClick: onClick,
|
|
34
|
+
underline: underline,
|
|
33
35
|
"data-qa-link": "",
|
|
34
36
|
"data-qa-link-isdisabled": disabled === true
|
|
35
37
|
}, qa, rest), children);
|
package/lib/Link/styles.js
CHANGED
|
@@ -5,12 +5,14 @@ import { TYPOGRAPHY, COMMON } from "../utils/system-props";
|
|
|
5
5
|
var Container = styled(Text).withConfig({
|
|
6
6
|
displayName: "styles__Container",
|
|
7
7
|
componentId: "adcw4a-0"
|
|
8
|
-
})(["border:0;font-family:", ";transition:all ", " ", ";text-decoration:
|
|
8
|
+
})(["border:0;font-family:", ";transition:all ", " ", ";text-decoration:", ";appearance:none;cursor:pointer;", " font-weight:", ";color:", ";&:hover{color:", ";text-decoration:underline;}&:active{color:", ";}&:focus{", "}&:focus:active{box-shadow:none;}", " ", " ", " ", ""], function (props) {
|
|
9
9
|
return props.theme.fontFamily;
|
|
10
10
|
}, function (props) {
|
|
11
11
|
return props.theme.duration.fast;
|
|
12
12
|
}, function (props) {
|
|
13
13
|
return props.theme.easing.ease_inout;
|
|
14
|
+
}, function (props) {
|
|
15
|
+
return props.underline ? "underline" : "none";
|
|
14
16
|
}, function (props) {
|
|
15
17
|
return props.disabled && css(["opacity:0.4;cursor:not-allowed;"]);
|
|
16
18
|
}, function (props) {
|