carbon-react 104.16.1 → 104.19.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/lib/__internal__/validations/validation-icon.style.js +9 -6
- package/lib/components/batch-selection/batch-selection.style.js +14 -16
- package/lib/components/date-range/date-range.component.js +3 -10
- package/lib/components/decimal/decimal.component.js +11 -17
- package/lib/components/drawer/drawer.component.js +3 -10
- package/lib/components/icon-button/icon-button.style.js +4 -1
- package/lib/components/portrait/portrait-gravatar.component.d.ts +0 -1
- package/lib/components/portrait/portrait-gravatar.component.js +0 -3
- package/lib/components/portrait/portrait-gravatar.d.ts +0 -2
- package/lib/components/portrait/portrait-initials.component.d.ts +22 -7
- package/lib/components/portrait/portrait-initials.component.js +8 -18
- package/lib/components/portrait/portrait-initials.d.ts +0 -2
- package/lib/components/portrait/portrait.config.js +2 -2
- package/lib/components/portrait/portrait.style.d.ts +4 -4
- package/lib/components/portrait/portrait.style.js +16 -32
- package/lib/components/profile/profile.config.d.ts +12 -24
- package/lib/components/profile/profile.config.js +14 -21
- package/lib/components/profile/profile.style.js +5 -17
- package/lib/components/tabs/__internal__/tab-title/tab-title.component.js +3 -3
- package/lib/components/tabs/__internal__/tab-title/tab-title.style.js +77 -92
- package/lib/components/tabs/__internal__/tabs-header/tabs-header.style.js +3 -9
- package/lib/components/tabs/tabs.style.js +1 -2
- package/lib/hooks/__internal__/usePrevious/index.d.ts +1 -0
- package/lib/hooks/__internal__/usePrevious/index.js +16 -0
- package/package.json +1 -1
|
@@ -19,6 +19,12 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
21
|
|
|
22
|
+
const validationIconTypes = {
|
|
23
|
+
error: "var(--colorsSemanticNegative500)",
|
|
24
|
+
info: "var(--colorsSemanticInfo500)",
|
|
25
|
+
success: "var(--colorsSemanticPositive500)",
|
|
26
|
+
warning: "var(--colorsSemanticCaution500)"
|
|
27
|
+
};
|
|
22
28
|
const ValidationIconStyle = _styledComponents.default.span`
|
|
23
29
|
background: none;
|
|
24
30
|
cursor: default;
|
|
@@ -37,15 +43,12 @@ const ValidationIconStyle = _styledComponents.default.span`
|
|
|
37
43
|
|
|
38
44
|
${_icon.default}:before {
|
|
39
45
|
color: ${({
|
|
40
|
-
validationType
|
|
41
|
-
|
|
42
|
-
}) => theme.colors[validationType]};
|
|
46
|
+
validationType
|
|
47
|
+
}) => validationIconTypes[validationType]};
|
|
43
48
|
}
|
|
44
49
|
|
|
45
50
|
${_icon.default}:focus {
|
|
46
|
-
outline: solid 2px
|
|
47
|
-
theme
|
|
48
|
-
}) => theme.colors.focus};
|
|
51
|
+
outline: solid 2px var(--colorsSemanticFocus500);
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
${_styledSystem.margin}
|
|
@@ -7,8 +7,6 @@ exports.StyledSelectionCount = exports.StyledBatchSelection = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
|
|
10
|
-
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
11
|
-
|
|
12
10
|
var _iconButton = _interopRequireDefault(require("../icon-button/icon-button.style"));
|
|
13
11
|
|
|
14
12
|
var _icon = _interopRequireDefault(require("../icon/icon.style"));
|
|
@@ -23,7 +21,6 @@ const StyledBatchSelection = _styledComponents.default.div`
|
|
|
23
21
|
${({
|
|
24
22
|
disabled,
|
|
25
23
|
colorTheme,
|
|
26
|
-
theme,
|
|
27
24
|
hidden
|
|
28
25
|
}) => (0, _styledComponents.css)`
|
|
29
26
|
align-items: center;
|
|
@@ -31,22 +28,26 @@ const StyledBatchSelection = _styledComponents.default.div`
|
|
|
31
28
|
|
|
32
29
|
${hidden && "opacity: 0;"}
|
|
33
30
|
|
|
31
|
+
${_icon.default} {
|
|
32
|
+
color: var(--colorsActionMajorYin065);
|
|
33
|
+
}
|
|
34
|
+
|
|
34
35
|
${colorTheme === "dark" && (0, _styledComponents.css)`
|
|
35
|
-
background-color:
|
|
36
|
-
color:
|
|
36
|
+
background-color: var(--colorsUtilityMajor500);
|
|
37
|
+
color: var(--colorsUtilityYang100);
|
|
37
38
|
|
|
38
39
|
${_icon.default} {
|
|
39
|
-
color:
|
|
40
|
+
color: var(--colorsActionMajorYang100);
|
|
40
41
|
}
|
|
41
42
|
`}
|
|
42
43
|
|
|
43
44
|
${colorTheme === "light" && (0, _styledComponents.css)`
|
|
44
|
-
background-color:
|
|
45
|
+
background-color: var(--colorsUtilityMajor150);
|
|
45
46
|
`}
|
|
46
47
|
|
|
47
48
|
${colorTheme === "white" && (0, _styledComponents.css)`
|
|
48
|
-
background-color:
|
|
49
|
-
box-shadow:
|
|
49
|
+
background-color: var(--colorsUtilityYang100);
|
|
50
|
+
box-shadow: var(--boxShadow100);
|
|
50
51
|
`}
|
|
51
52
|
|
|
52
53
|
${_iconButton.default} {
|
|
@@ -56,16 +57,16 @@ const StyledBatchSelection = _styledComponents.default.div`
|
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
${_iconButton.default}:hover {
|
|
59
|
-
background-color:
|
|
60
|
+
background-color: var(--colorsActionMajor500);
|
|
60
61
|
|
|
61
62
|
${_icon.default} {
|
|
62
|
-
color:
|
|
63
|
+
color: var(--colorsActionMajorYang100);
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
${disabled && (0, _styledComponents.css)`
|
|
67
68
|
background: transparent;
|
|
68
|
-
color:
|
|
69
|
+
color: var(--colorsUtilityYin030);
|
|
69
70
|
cursor: not-allowed;
|
|
70
71
|
|
|
71
72
|
${_iconButton.default} {
|
|
@@ -73,16 +74,13 @@ const StyledBatchSelection = _styledComponents.default.div`
|
|
|
73
74
|
pointer-events: none;
|
|
74
75
|
|
|
75
76
|
${_icon.default} {
|
|
76
|
-
color:
|
|
77
|
+
color: var(--colorsActionMajorYin030);
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
`}
|
|
80
81
|
`}
|
|
81
82
|
`;
|
|
82
83
|
exports.StyledBatchSelection = StyledBatchSelection;
|
|
83
|
-
StyledBatchSelection.defaultProps = {
|
|
84
|
-
theme: _base.default
|
|
85
|
-
};
|
|
86
84
|
const StyledSelectionCount = _styledComponents.default.span`
|
|
87
85
|
display: inline-block;
|
|
88
86
|
padding: 10px 15px;
|
|
@@ -25,6 +25,8 @@ var _events = _interopRequireDefault(require("../../__internal__/utils/helpers/e
|
|
|
25
25
|
|
|
26
26
|
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
27
27
|
|
|
28
|
+
var _usePrevious = _interopRequireDefault(require("../../hooks/__internal__/usePrevious"));
|
|
29
|
+
|
|
28
30
|
var _dateFormats = _interopRequireDefault(require("../date/__internal__/date-formats"));
|
|
29
31
|
|
|
30
32
|
var _dateRange2 = _interopRequireDefault(require("./date-range.context"));
|
|
@@ -107,16 +109,7 @@ const DateRange = ({
|
|
|
107
109
|
formattedValue: getEndDate(),
|
|
108
110
|
rawValue: isEmptyValue(endDateProps.allowEmptyValue, getEndDate()) ? "" : (0, _utils.formatToISO)(format, getEndDate())
|
|
109
111
|
});
|
|
110
|
-
|
|
111
|
-
function usePrevious(arg) {
|
|
112
|
-
const ref = (0, _react.useRef)();
|
|
113
|
-
(0, _react.useEffect)(() => {
|
|
114
|
-
ref.current = arg;
|
|
115
|
-
});
|
|
116
|
-
return ref.current;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const previousValue = usePrevious(value);
|
|
112
|
+
const previousValue = (0, _usePrevious.default)(value);
|
|
120
113
|
(0, _react.useEffect)(() => {
|
|
121
114
|
const updateValues = () => {
|
|
122
115
|
setStartDateValue({
|
|
@@ -19,6 +19,8 @@ var _utils = require("../../style/utils");
|
|
|
19
19
|
|
|
20
20
|
var _i18nContext = _interopRequireDefault(require("../../__internal__/i18n-context"));
|
|
21
21
|
|
|
22
|
+
var _usePrevious = _interopRequireDefault(require("../../hooks/__internal__/usePrevious"));
|
|
23
|
+
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
25
|
|
|
24
26
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -99,27 +101,18 @@ const Decimal = ({
|
|
|
99
101
|
}
|
|
100
102
|
|
|
101
103
|
return formattedNumber;
|
|
102
|
-
}, [getSeparator, isNaN, l, locale, precision]);
|
|
103
|
-
|
|
104
|
-
function usePrevious(arg) {
|
|
105
|
-
const ref = (0, _react.useRef)();
|
|
106
|
-
(0, _react.useEffect)(() => {
|
|
107
|
-
ref.current = arg;
|
|
108
|
-
});
|
|
109
|
-
return ref.current;
|
|
110
|
-
}
|
|
104
|
+
}, [getSeparator, isNaN, l, locale, precision]);
|
|
111
105
|
/**
|
|
112
106
|
* Determine if the precision value has changed from the previous ref value for precision
|
|
113
107
|
*/
|
|
114
108
|
|
|
115
|
-
|
|
116
|
-
const prevPrecisionValue = usePrevious(precision);
|
|
109
|
+
const prevPrecisionValue = (0, _usePrevious.default)(precision);
|
|
117
110
|
(0, _react.useEffect)(() => {
|
|
118
111
|
if (prevPrecisionValue && prevPrecisionValue !== precision) {
|
|
119
112
|
// eslint-disable-next-line no-console
|
|
120
113
|
console.error("Decimal `precision` prop has changed value. Changing the Decimal `precision` prop has no effect.");
|
|
121
114
|
}
|
|
122
|
-
}, [precision]);
|
|
115
|
+
}, [precision, prevPrecisionValue]);
|
|
123
116
|
const removeDelimiters = (0, _react.useCallback)(valueToFormat => {
|
|
124
117
|
const delimiterMatcher = new RegExp(`[\\${getSeparator("group")} ]*`, "g");
|
|
125
118
|
return valueToFormat.replace(delimiterMatcher, "");
|
|
@@ -190,16 +183,17 @@ const Decimal = ({
|
|
|
190
183
|
if (onBlur) onBlur(event);
|
|
191
184
|
};
|
|
192
185
|
|
|
193
|
-
const
|
|
194
|
-
const
|
|
186
|
+
const isControlled = value !== undefined;
|
|
187
|
+
const prevControlledRef = (0, _react.useRef)();
|
|
195
188
|
(0, _react.useEffect)(() => {
|
|
196
189
|
const message = "Input elements should not switch from uncontrolled to controlled (or vice versa). " + "Decide between using a controlled or uncontrolled input element for the lifetime of the component";
|
|
197
|
-
(0, _invariant.default)(
|
|
198
|
-
|
|
190
|
+
(0, _invariant.default)(prevControlledRef.current !== isControlled, message);
|
|
191
|
+
prevControlledRef.current = isControlled;
|
|
192
|
+
}, [isControlled]);
|
|
199
193
|
(0, _react.useEffect)(() => {
|
|
200
194
|
const unformattedValue = toStandardDecimal(stateValue);
|
|
201
195
|
|
|
202
|
-
if (
|
|
196
|
+
if (isControlled) {
|
|
203
197
|
const valueProp = getSafeValueProp(value);
|
|
204
198
|
|
|
205
199
|
if (unformattedValue !== valueProp) {
|
|
@@ -15,6 +15,8 @@ var _invariant = _interopRequireDefault(require("invariant"));
|
|
|
15
15
|
|
|
16
16
|
var _guid = _interopRequireDefault(require("../../__internal__/utils/helpers/guid"));
|
|
17
17
|
|
|
18
|
+
var _usePrevious = _interopRequireDefault(require("../../hooks/__internal__/usePrevious"));
|
|
19
|
+
|
|
18
20
|
var _icon = _interopRequireDefault(require("../icon"));
|
|
19
21
|
|
|
20
22
|
var _drawer = require("./drawer.style");
|
|
@@ -88,16 +90,7 @@ const Drawer = ({
|
|
|
88
90
|
}, timeout);
|
|
89
91
|
}
|
|
90
92
|
}, [getAnimationDuration, isExpanded]);
|
|
91
|
-
|
|
92
|
-
function usePrevious(arg) {
|
|
93
|
-
const ref = (0, _react.useRef)();
|
|
94
|
-
(0, _react.useEffect)(() => {
|
|
95
|
-
ref.current = arg;
|
|
96
|
-
});
|
|
97
|
-
return ref.current;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const previousValue = usePrevious(expanded);
|
|
93
|
+
const previousValue = (0, _usePrevious.default)(expanded);
|
|
101
94
|
(0, _react.useEffect)(() => {
|
|
102
95
|
const message = "Drawer should not switch from uncontrolled to controlled" + " (or vice versa). Decide between using a controlled or uncontrolled Drawer element" + " for the lifetime of the component";
|
|
103
96
|
(0, _invariant.default)(isControlled.current === (expanded !== undefined), message);
|
|
@@ -47,7 +47,10 @@ const StyledIconButton = _styledComponents.default.button.attrs({
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
${_icon.default} {
|
|
50
|
-
${disabled &&
|
|
50
|
+
${disabled && (0, _styledComponents.css)`
|
|
51
|
+
color: ${theme.icon.disabled};
|
|
52
|
+
background-color: transparent;
|
|
53
|
+
`};
|
|
51
54
|
position: relative;
|
|
52
55
|
|
|
53
56
|
&:focus {
|
|
@@ -9,7 +9,6 @@ declare function PortraitGravatar({ gravatarEmail, size, alt, shape, errorCallba
|
|
|
9
9
|
}): JSX.Element;
|
|
10
10
|
declare namespace PortraitGravatar {
|
|
11
11
|
namespace propTypes {
|
|
12
|
-
const theme: PropTypes.Requireable<object>;
|
|
13
12
|
const gravatarEmail: PropTypes.Validator<string>;
|
|
14
13
|
const size: PropTypes.Validator<string>;
|
|
15
14
|
const shape: PropTypes.Requireable<string>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { PortraitSizes, PortraitShapes } from "./portrait";
|
|
2
2
|
|
|
3
3
|
export interface PortraitGravatarProps {
|
|
4
|
-
/** The theme to use. */
|
|
5
|
-
theme?: Record<string, unknown>;
|
|
6
4
|
/** The user's email address for the Gravatar. */
|
|
7
5
|
gravatarEmail: string;
|
|
8
6
|
/** The size of the Gravatar. */
|
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
export default PortraitInitials;
|
|
2
|
+
declare function PortraitInitials({ initials, size, shape, darkBackground, alt, ...rest }: {
|
|
2
3
|
[x: string]: any;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
initials: any;
|
|
5
|
+
size: any;
|
|
6
|
+
shape: any;
|
|
7
|
+
darkBackground: any;
|
|
8
|
+
alt: any;
|
|
9
|
+
}): JSX.Element;
|
|
10
|
+
declare namespace PortraitInitials {
|
|
11
|
+
namespace propTypes {
|
|
12
|
+
const initials: PropTypes.Validator<string>;
|
|
13
|
+
const size: PropTypes.Validator<string>;
|
|
14
|
+
const darkBackground: PropTypes.Requireable<boolean>;
|
|
15
|
+
const shape: PropTypes.Requireable<string>;
|
|
16
|
+
const alt: PropTypes.Requireable<string>;
|
|
17
|
+
}
|
|
18
|
+
namespace defaultProps {
|
|
19
|
+
const shape_1: string;
|
|
20
|
+
export { shape_1 as shape };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
import PropTypes from "prop-types";
|
|
@@ -9,9 +9,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
12
|
+
var _common = _interopRequireDefault(require("@sage/design-tokens/js/base/common"));
|
|
15
13
|
|
|
16
14
|
var _browser = _interopRequireDefault(require("../../__internal__/utils/helpers/browser"));
|
|
17
15
|
|
|
@@ -28,7 +26,6 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
28
26
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
29
27
|
|
|
30
28
|
const PortraitInitials = ({
|
|
31
|
-
theme,
|
|
32
29
|
initials,
|
|
33
30
|
size,
|
|
34
31
|
shape,
|
|
@@ -39,7 +36,7 @@ const PortraitInitials = ({
|
|
|
39
36
|
const [cachedImageDataUrl, setCachedImageDataUrl] = (0, _react.useState)();
|
|
40
37
|
(0, _react.useEffect)(() => {
|
|
41
38
|
setCachedImageDataUrl(null);
|
|
42
|
-
}, [
|
|
39
|
+
}, [initials, size, darkBackground]);
|
|
43
40
|
|
|
44
41
|
const generateDataUrl = () => {
|
|
45
42
|
if (cachedImageDataUrl) {
|
|
@@ -49,7 +46,7 @@ const PortraitInitials = ({
|
|
|
49
46
|
const {
|
|
50
47
|
textColor,
|
|
51
48
|
bgColor
|
|
52
|
-
} = (0, _portrait.getColorsForInitials)(
|
|
49
|
+
} = (0, _portrait.getColorsForInitials)(darkBackground);
|
|
53
50
|
|
|
54
51
|
let canvas = _browser.default.getDocument().createElement("canvas");
|
|
55
52
|
|
|
@@ -66,9 +63,9 @@ const PortraitInitials = ({
|
|
|
66
63
|
context.font = `${Math.round(canvas.width / 2.4)}px Lato, Arial`;
|
|
67
64
|
context.textAlign = "center"; // Setup background and front color
|
|
68
65
|
|
|
69
|
-
context.fillStyle = bgColor;
|
|
66
|
+
context.fillStyle = _common.default[bgColor];
|
|
70
67
|
context.fillRect(0, 0, dimensions, dimensions);
|
|
71
|
-
context.fillStyle = textColor;
|
|
68
|
+
context.fillStyle = _common.default[textColor];
|
|
72
69
|
context.fillText(initials.slice(0, 3).toUpperCase(), dimensions / 2, dimensions / 1.5); // Set image representation in default format (png)
|
|
73
70
|
|
|
74
71
|
const dataURI = canvas.toDataURL(); // Dispose canvas element
|
|
@@ -81,8 +78,7 @@ const PortraitInitials = ({
|
|
|
81
78
|
return /*#__PURE__*/_react.default.createElement(_portrait.StyledPortraitInitials, _extends({
|
|
82
79
|
"data-element": "initials",
|
|
83
80
|
size: size,
|
|
84
|
-
shape: shape
|
|
85
|
-
theme: theme
|
|
81
|
+
shape: shape
|
|
86
82
|
}, rest), /*#__PURE__*/_react.default.createElement(_portrait.StyledPortraitInitialsImg, {
|
|
87
83
|
src: generateDataUrl(),
|
|
88
84
|
alt: alt
|
|
@@ -90,9 +86,6 @@ const PortraitInitials = ({
|
|
|
90
86
|
};
|
|
91
87
|
|
|
92
88
|
PortraitInitials.propTypes = {
|
|
93
|
-
/** The theme to use. */
|
|
94
|
-
theme: _propTypes.default.object,
|
|
95
|
-
|
|
96
89
|
/** The user's initials to render. */
|
|
97
90
|
initials: _propTypes.default.string.isRequired,
|
|
98
91
|
|
|
@@ -109,10 +102,7 @@ PortraitInitials.propTypes = {
|
|
|
109
102
|
alt: _propTypes.default.string
|
|
110
103
|
};
|
|
111
104
|
PortraitInitials.defaultProps = {
|
|
112
|
-
shape: "square"
|
|
113
|
-
theme: _base.default
|
|
105
|
+
shape: "square"
|
|
114
106
|
};
|
|
115
|
-
|
|
116
|
-
var _default = (0, _styledComponents.withTheme)(PortraitInitials);
|
|
117
|
-
|
|
107
|
+
var _default = PortraitInitials;
|
|
118
108
|
exports.default = _default;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { PortraitSizes, PortraitShapes } from "./portrait";
|
|
2
2
|
|
|
3
3
|
export interface PortraitInitialsProps {
|
|
4
|
-
/** The theme to use. */
|
|
5
|
-
theme?: Record<string, unknown>;
|
|
6
4
|
/** The user's initials to render. */
|
|
7
5
|
initials: string;
|
|
8
6
|
/** The size of the initials image. */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export function getColorsForInitials(
|
|
2
|
-
textColor:
|
|
3
|
-
bgColor:
|
|
1
|
+
export function getColorsForInitials(darkBackground: any): {
|
|
2
|
+
textColor: string;
|
|
3
|
+
bgColor: string;
|
|
4
4
|
};
|
|
5
5
|
export const StyledPortraitInitials: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
6
|
export const StyledPortraitInitialsImg: import("styled-components").StyledComponent<"img", any, {}, never>;
|
|
7
7
|
export const StyledPortraitGravatar: import("styled-components").StyledComponent<"img", any, {}, never>;
|
|
8
8
|
export const StyledCustomImg: import("styled-components").StyledComponent<"img", any, {}, never>;
|
|
9
|
-
export const StyledIcon: import("styled-components").StyledComponent<({ darkBackground, ...rest }: any) => JSX.Element, any, {}, never>;
|
|
9
|
+
export const StyledIcon: import("styled-components").StyledComponent<({ size, darkBackground, ...rest }: any) => JSX.Element, any, {}, never>;
|
|
10
10
|
export const StyledPortraitContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -54,7 +54,6 @@ function stylingForShape({
|
|
|
54
54
|
|
|
55
55
|
function stylingForIcon({
|
|
56
56
|
size,
|
|
57
|
-
theme,
|
|
58
57
|
darkBackground
|
|
59
58
|
}) {
|
|
60
59
|
const params = _portrait.PORTRAIT_SIZE_PARAMS[size];
|
|
@@ -63,31 +62,28 @@ function stylingForIcon({
|
|
|
63
62
|
return (0, _styledComponents.css)``;
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
let color =
|
|
67
|
-
let backgroundColor =
|
|
65
|
+
let color = "var(--colorsUtilityMajor200)";
|
|
66
|
+
let backgroundColor = "var(--colorsUtilityMajor025)";
|
|
68
67
|
|
|
69
68
|
if (darkBackground) {
|
|
70
|
-
color =
|
|
71
|
-
backgroundColor =
|
|
69
|
+
color = "var(--colorsUtilityMajor025)";
|
|
70
|
+
backgroundColor = "var(--colorsUtilityMajor200)";
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
return (0, _styledComponents.css)`
|
|
75
74
|
background-color: ${backgroundColor};
|
|
76
75
|
color: ${color};
|
|
77
76
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
height: ${params.iconDimensions}px;
|
|
82
|
-
}
|
|
83
|
-
`}
|
|
77
|
+
::before {
|
|
78
|
+
font-size: ${params.iconDimensions}px;
|
|
79
|
+
}
|
|
84
80
|
`;
|
|
85
81
|
}
|
|
86
82
|
|
|
87
|
-
function getColorsForInitials(
|
|
83
|
+
function getColorsForInitials(darkBackground) {
|
|
88
84
|
return {
|
|
89
|
-
textColor: darkBackground ?
|
|
90
|
-
bgColor: darkBackground ?
|
|
85
|
+
textColor: darkBackground ? "colorsUtilityYang100" : "colorsUtilityYin055",
|
|
86
|
+
bgColor: darkBackground ? "colorsUtilityMajor400" : "colorsUtilityMajor025"
|
|
91
87
|
};
|
|
92
88
|
}
|
|
93
89
|
|
|
@@ -97,20 +93,14 @@ const StyledPortraitInitials = _styledComponents.default.div`
|
|
|
97
93
|
box-sizing: border-box;
|
|
98
94
|
${stylingForSize}
|
|
99
95
|
${stylingForShape}
|
|
100
|
-
|
|
101
|
-
theme
|
|
102
|
-
}) => (0, _styledComponents.css)`
|
|
103
|
-
border: 1px solid ${theme.portrait.border};
|
|
104
|
-
`}
|
|
96
|
+
border: 1px solid var(--colorsUtilityMajor200);
|
|
105
97
|
`;
|
|
106
98
|
exports.StyledPortraitInitials = StyledPortraitInitials;
|
|
107
99
|
StyledPortraitInitials.propTypes = {
|
|
108
|
-
theme: _propTypes.default.object,
|
|
109
100
|
size: _propTypes.default.oneOf(_portrait.PORTRAIT_SIZES).isRequired,
|
|
110
101
|
shape: _propTypes.default.oneOf(_portrait.PORTRAIT_SHAPES)
|
|
111
102
|
};
|
|
112
103
|
StyledPortraitInitials.defaultProps = {
|
|
113
|
-
theme: _base.default,
|
|
114
104
|
shape: "square"
|
|
115
105
|
};
|
|
116
106
|
const StyledPortraitInitialsImg = _styledComponents.default.img`
|
|
@@ -134,9 +124,6 @@ StyledPortraitGravatar.propTypes = {
|
|
|
134
124
|
src: _propTypes.default.string.isRequired,
|
|
135
125
|
alt: _propTypes.default.string
|
|
136
126
|
};
|
|
137
|
-
StyledPortraitGravatar.defaultProps = {
|
|
138
|
-
theme: _base.default
|
|
139
|
-
};
|
|
140
127
|
const StyledCustomImg = _styledComponents.default.img`
|
|
141
128
|
display: block;
|
|
142
129
|
${stylingForSize}
|
|
@@ -151,6 +138,7 @@ StyledCustomImg.propTypes = {
|
|
|
151
138
|
}; // && is used here to increase the specificity
|
|
152
139
|
|
|
153
140
|
const StyledIcon = (0, _styledComponents.default)(({
|
|
141
|
+
size,
|
|
154
142
|
darkBackground,
|
|
155
143
|
...rest
|
|
156
144
|
}) => /*#__PURE__*/_react.default.createElement(_icon.default, rest))`
|
|
@@ -160,11 +148,9 @@ const StyledIcon = (0, _styledComponents.default)(({
|
|
|
160
148
|
${stylingForSize}
|
|
161
149
|
${stylingForIcon}
|
|
162
150
|
${stylingForShape}
|
|
163
|
-
${({
|
|
164
|
-
|
|
165
|
-
}) => (
|
|
166
|
-
border: 1px dashed ${theme.portrait.border};
|
|
167
|
-
`}
|
|
151
|
+
border: 1px dashed ${({
|
|
152
|
+
darkBackground
|
|
153
|
+
}) => darkBackground ? "var(--colorsUtilityMajorTransparent)" : "var(--colorsUtilityMajor200)"};
|
|
168
154
|
}
|
|
169
155
|
`;
|
|
170
156
|
exports.StyledIcon = StyledIcon;
|
|
@@ -172,14 +158,12 @@ StyledIcon.propTypes = {
|
|
|
172
158
|
darkBackground: _propTypes.default.bool,
|
|
173
159
|
size: _propTypes.default.oneOf(_portrait.PORTRAIT_SIZES),
|
|
174
160
|
shape: _propTypes.default.oneOf(_portrait.PORTRAIT_SHAPES),
|
|
175
|
-
theme: _propTypes.default.object,
|
|
176
161
|
type: _propTypes.default.string.isRequired
|
|
177
162
|
};
|
|
178
163
|
StyledIcon.defaultProps = {
|
|
179
164
|
darkBackground: false,
|
|
180
165
|
size: "M",
|
|
181
|
-
shape: "square"
|
|
182
|
-
theme: _base.default
|
|
166
|
+
shape: "square"
|
|
183
167
|
};
|
|
184
168
|
const StyledPortraitContainer = _styledComponents.default.div`
|
|
185
169
|
display: inline-block;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export const PROFILE_SIZES: string[];
|
|
2
2
|
declare namespace _default {
|
|
3
3
|
namespace XS {
|
|
4
|
-
const dimensions: number;
|
|
5
4
|
const nameSize: string;
|
|
6
5
|
const emailSize: string;
|
|
7
6
|
const lineHeight: string;
|
|
@@ -9,11 +8,10 @@ declare namespace _default {
|
|
|
9
8
|
const marginTop: string;
|
|
10
9
|
}
|
|
11
10
|
namespace S {
|
|
12
|
-
const dimensions_1: number;
|
|
13
|
-
export { dimensions_1 as dimensions };
|
|
14
11
|
const nameSize_1: string;
|
|
15
12
|
export { nameSize_1 as nameSize };
|
|
16
|
-
|
|
13
|
+
const emailSize_1: string;
|
|
14
|
+
export { emailSize_1 as emailSize };
|
|
17
15
|
const lineHeight_1: string;
|
|
18
16
|
export { lineHeight_1 as lineHeight };
|
|
19
17
|
const marginLeft_1: string;
|
|
@@ -22,12 +20,10 @@ declare namespace _default {
|
|
|
22
20
|
export { marginTop_1 as marginTop };
|
|
23
21
|
}
|
|
24
22
|
namespace M {
|
|
25
|
-
const dimensions_2: number;
|
|
26
|
-
export { dimensions_2 as dimensions };
|
|
27
23
|
const nameSize_2: string;
|
|
28
24
|
export { nameSize_2 as nameSize };
|
|
29
|
-
const
|
|
30
|
-
export {
|
|
25
|
+
const emailSize_2: string;
|
|
26
|
+
export { emailSize_2 as emailSize };
|
|
31
27
|
const lineHeight_2: string;
|
|
32
28
|
export { lineHeight_2 as lineHeight };
|
|
33
29
|
const marginLeft_2: string;
|
|
@@ -36,12 +32,10 @@ declare namespace _default {
|
|
|
36
32
|
export { marginTop_2 as marginTop };
|
|
37
33
|
}
|
|
38
34
|
namespace ML {
|
|
39
|
-
const dimensions_3: number;
|
|
40
|
-
export { dimensions_3 as dimensions };
|
|
41
35
|
const nameSize_3: string;
|
|
42
36
|
export { nameSize_3 as nameSize };
|
|
43
|
-
const
|
|
44
|
-
export {
|
|
37
|
+
const emailSize_3: string;
|
|
38
|
+
export { emailSize_3 as emailSize };
|
|
45
39
|
const lineHeight_3: string;
|
|
46
40
|
export { lineHeight_3 as lineHeight };
|
|
47
41
|
const marginLeft_3: string;
|
|
@@ -50,12 +44,10 @@ declare namespace _default {
|
|
|
50
44
|
export { marginTop_3 as marginTop };
|
|
51
45
|
}
|
|
52
46
|
namespace L {
|
|
53
|
-
const dimensions_4: number;
|
|
54
|
-
export { dimensions_4 as dimensions };
|
|
55
47
|
const nameSize_4: string;
|
|
56
48
|
export { nameSize_4 as nameSize };
|
|
57
|
-
const
|
|
58
|
-
export {
|
|
49
|
+
const emailSize_4: string;
|
|
50
|
+
export { emailSize_4 as emailSize };
|
|
59
51
|
const lineHeight_4: string;
|
|
60
52
|
export { lineHeight_4 as lineHeight };
|
|
61
53
|
const marginLeft_4: string;
|
|
@@ -64,12 +56,10 @@ declare namespace _default {
|
|
|
64
56
|
export { marginTop_4 as marginTop };
|
|
65
57
|
}
|
|
66
58
|
namespace XL {
|
|
67
|
-
const dimensions_5: number;
|
|
68
|
-
export { dimensions_5 as dimensions };
|
|
69
59
|
const nameSize_5: string;
|
|
70
60
|
export { nameSize_5 as nameSize };
|
|
71
|
-
const
|
|
72
|
-
export {
|
|
61
|
+
const emailSize_5: string;
|
|
62
|
+
export { emailSize_5 as emailSize };
|
|
73
63
|
const lineHeight_5: string;
|
|
74
64
|
export { lineHeight_5 as lineHeight };
|
|
75
65
|
const marginLeft_5: string;
|
|
@@ -78,12 +68,10 @@ declare namespace _default {
|
|
|
78
68
|
export { marginTop_5 as marginTop };
|
|
79
69
|
}
|
|
80
70
|
namespace XXL {
|
|
81
|
-
const dimensions_6: number;
|
|
82
|
-
export { dimensions_6 as dimensions };
|
|
83
71
|
const nameSize_6: string;
|
|
84
72
|
export { nameSize_6 as nameSize };
|
|
85
|
-
const
|
|
86
|
-
export {
|
|
73
|
+
const emailSize_6: string;
|
|
74
|
+
export { emailSize_6 as emailSize };
|
|
87
75
|
const lineHeight_6: string;
|
|
88
76
|
export { lineHeight_6 as lineHeight };
|
|
89
77
|
const marginLeft_6: string;
|