carbon-react 106.4.1 → 106.4.2
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.
|
@@ -58,7 +58,8 @@ const PortraitInitials = ({
|
|
|
58
58
|
return /*#__PURE__*/React.createElement(StyledPortraitInitials, _extends({
|
|
59
59
|
"data-element": "initials",
|
|
60
60
|
size: size,
|
|
61
|
-
shape: shape
|
|
61
|
+
shape: shape,
|
|
62
|
+
initials: initials
|
|
62
63
|
}, rest), /*#__PURE__*/React.createElement(StyledPortraitInitialsImg, {
|
|
63
64
|
src: generateDataUrl(),
|
|
64
65
|
alt: alt
|
|
@@ -7,7 +7,8 @@ import Icon from "../icon";
|
|
|
7
7
|
import { PORTRAIT_SHAPES, PORTRAIT_SIZES, PORTRAIT_SIZE_PARAMS } from "./portrait.config";
|
|
8
8
|
|
|
9
9
|
function stylingForSize({
|
|
10
|
-
size
|
|
10
|
+
size,
|
|
11
|
+
initials
|
|
11
12
|
}) {
|
|
12
13
|
const params = PORTRAIT_SIZE_PARAMS[size];
|
|
13
14
|
|
|
@@ -15,6 +16,14 @@ function stylingForSize({
|
|
|
15
16
|
return css``;
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
if (initials) {
|
|
20
|
+
return css`
|
|
21
|
+
width: inherit;
|
|
22
|
+
height: inherit;
|
|
23
|
+
margin: 1px;
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
|
|
18
27
|
return css`
|
|
19
28
|
width: ${params.dimensions}px;
|
|
20
29
|
height: ${params.dimensions}px;
|
|
@@ -72,7 +81,16 @@ export const StyledPortraitInitials = styled.div`
|
|
|
72
81
|
box-sizing: border-box;
|
|
73
82
|
${stylingForSize}
|
|
74
83
|
${stylingForShape}
|
|
75
|
-
|
|
84
|
+
outline: 1px solid var(--colorsUtilityMajor200);
|
|
85
|
+
|
|
86
|
+
/* Styling for safari. This ensures that there is no outline on the component but that a border is still present
|
|
87
|
+
to achieve the same styling as Chrome and Firefox */
|
|
88
|
+
@media not all and (min-resolution: 0.001dpcm) {
|
|
89
|
+
@supports (-webkit-appearance: none) and (stroke-color: transparent) {
|
|
90
|
+
border: 1px solid var(--colorsUtilityMajor200);
|
|
91
|
+
outline: none;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
76
94
|
`;
|
|
77
95
|
StyledPortraitInitials.propTypes = {
|
|
78
96
|
size: PropTypes.oneOf(PORTRAIT_SIZES).isRequired,
|
|
@@ -78,7 +78,8 @@ const PortraitInitials = ({
|
|
|
78
78
|
return /*#__PURE__*/_react.default.createElement(_portrait.StyledPortraitInitials, _extends({
|
|
79
79
|
"data-element": "initials",
|
|
80
80
|
size: size,
|
|
81
|
-
shape: shape
|
|
81
|
+
shape: shape,
|
|
82
|
+
initials: initials
|
|
82
83
|
}, rest), /*#__PURE__*/_react.default.createElement(_portrait.StyledPortraitInitialsImg, {
|
|
83
84
|
src: generateDataUrl(),
|
|
84
85
|
alt: alt
|
|
@@ -27,7 +27,8 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
27
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
28
|
|
|
29
29
|
function stylingForSize({
|
|
30
|
-
size
|
|
30
|
+
size,
|
|
31
|
+
initials
|
|
31
32
|
}) {
|
|
32
33
|
const params = _portrait.PORTRAIT_SIZE_PARAMS[size];
|
|
33
34
|
|
|
@@ -35,6 +36,14 @@ function stylingForSize({
|
|
|
35
36
|
return (0, _styledComponents.css)``;
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
if (initials) {
|
|
40
|
+
return (0, _styledComponents.css)`
|
|
41
|
+
width: inherit;
|
|
42
|
+
height: inherit;
|
|
43
|
+
margin: 1px;
|
|
44
|
+
`;
|
|
45
|
+
}
|
|
46
|
+
|
|
38
47
|
return (0, _styledComponents.css)`
|
|
39
48
|
width: ${params.dimensions}px;
|
|
40
49
|
height: ${params.dimensions}px;
|
|
@@ -93,7 +102,16 @@ const StyledPortraitInitials = _styledComponents.default.div`
|
|
|
93
102
|
box-sizing: border-box;
|
|
94
103
|
${stylingForSize}
|
|
95
104
|
${stylingForShape}
|
|
96
|
-
|
|
105
|
+
outline: 1px solid var(--colorsUtilityMajor200);
|
|
106
|
+
|
|
107
|
+
/* Styling for safari. This ensures that there is no outline on the component but that a border is still present
|
|
108
|
+
to achieve the same styling as Chrome and Firefox */
|
|
109
|
+
@media not all and (min-resolution: 0.001dpcm) {
|
|
110
|
+
@supports (-webkit-appearance: none) and (stroke-color: transparent) {
|
|
111
|
+
border: 1px solid var(--colorsUtilityMajor200);
|
|
112
|
+
outline: none;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
97
115
|
`;
|
|
98
116
|
exports.StyledPortraitInitials = StyledPortraitInitials;
|
|
99
117
|
StyledPortraitInitials.propTypes = {
|