carbon-react 110.1.1 → 110.2.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/esm/__internal__/form-field/form-field.component.d.ts +5 -1
- package/esm/__internal__/form-field/form-field.component.js +8 -5
- package/esm/__internal__/utils/helpers/tags/tags.d.ts +5 -2
- package/esm/__spec_helper__/mock-match-media.d.ts +3 -1
- package/esm/__spec_helper__/test-utils.d.ts +3 -2
- package/esm/__spec_helper__/test-utils.js +17 -1
- package/esm/components/box/box.component.d.ts +4 -2
- package/esm/components/box/box.component.js +2 -1
- package/esm/components/button-toggle/button-toggle-icon.component.d.ts +15 -0
- package/esm/components/button-toggle/button-toggle-icon.component.js +19 -16
- package/esm/components/button-toggle/button-toggle-input.component.d.ts +25 -0
- package/esm/components/button-toggle/button-toggle-input.component.js +13 -25
- package/esm/components/button-toggle/button-toggle.component.d.ts +24 -0
- package/esm/components/button-toggle/button-toggle.component.js +23 -59
- package/esm/components/button-toggle/button-toggle.style.d.ts +26 -0
- package/esm/components/button-toggle/button-toggle.style.js +3 -8
- package/esm/components/button-toggle/index.d.ts +2 -2
- package/esm/components/content/content.style.js +0 -1
- package/esm/components/date/__internal__/utils.js +1 -1
- package/esm/components/dismissible-box/dismissible-box.component.js +398 -0
- package/esm/components/loader/index.d.ts +2 -1
- package/esm/components/loader/loader-square.style.d.ts +9 -1
- package/esm/components/loader/loader-square.style.js +4 -11
- package/esm/components/loader/loader.component.d.ts +9 -0
- package/esm/components/loader/loader.component.js +162 -24
- package/esm/components/loader/loader.config.d.ts +1 -1
- package/esm/components/loader/loader.style.d.ts +2 -0
- package/esm/components/loader-bar/index.d.ts +2 -1
- package/esm/components/loader-bar/loader-bar.component.d.ts +7 -0
- package/esm/components/loader-bar/loader-bar.component.js +156 -7
- package/esm/components/loader-bar/loader-bar.config.d.ts +1 -0
- package/esm/components/loader-bar/loader-bar.style.d.ts +10 -0
- package/esm/components/loader-bar/loader-bar.style.js +14 -25
- package/esm/components/pod/pod.component.js +1 -0
- package/esm/components/pod/pod.style.js +8 -4
- package/esm/components/portal/portal.d.ts +15 -12
- package/esm/components/portal/portal.js +3 -13
- package/esm/components/portrait/index.d.ts +2 -1
- package/esm/components/portrait/portrait-gravatar.component.d.ts +16 -0
- package/esm/components/portrait/portrait-gravatar.component.js +9 -24
- package/esm/components/portrait/portrait-initials.component.d.ts +16 -0
- package/esm/components/portrait/portrait-initials.component.js +22 -33
- package/esm/components/portrait/portrait.component.d.ts +50 -0
- package/esm/components/portrait/portrait.component.js +178 -72
- package/esm/components/portrait/portrait.config.d.ts +32 -0
- package/esm/components/portrait/portrait.style.d.ts +28 -0
- package/esm/components/portrait/portrait.style.js +7 -55
- package/esm/components/profile/profile.style.d.ts +2 -2
- package/esm/components/show-edit-pod/show-edit-pod.style.js +1 -8
- package/esm/style/fonts.css +19 -12
- package/esm/style/utils/filter-out-position-props.d.ts +3 -0
- package/esm/style/utils/filter-out-position-props.js +5 -0
- package/lib/__internal__/form-field/form-field.component.d.ts +5 -1
- package/lib/__internal__/form-field/form-field.component.js +8 -5
- package/lib/__internal__/utils/helpers/tags/tags.d.ts +5 -2
- package/lib/__spec_helper__/mock-match-media.d.ts +3 -1
- package/lib/__spec_helper__/test-utils.d.ts +3 -2
- package/lib/__spec_helper__/test-utils.js +20 -2
- package/lib/components/box/box.component.d.ts +4 -2
- package/lib/components/box/box.component.js +1 -0
- package/lib/components/button-toggle/button-toggle-icon.component.d.ts +15 -0
- package/lib/components/button-toggle/button-toggle-icon.component.js +19 -16
- package/lib/components/button-toggle/button-toggle-input.component.d.ts +25 -0
- package/lib/components/button-toggle/button-toggle-input.component.js +13 -25
- package/lib/components/button-toggle/button-toggle.component.d.ts +24 -0
- package/lib/components/button-toggle/button-toggle.component.js +24 -60
- package/lib/components/button-toggle/button-toggle.style.d.ts +26 -0
- package/lib/components/button-toggle/button-toggle.style.js +6 -12
- package/lib/components/button-toggle/index.d.ts +2 -2
- package/lib/components/content/content.style.js +0 -1
- package/lib/components/date/__internal__/utils.js +1 -1
- package/lib/components/dismissible-box/dismissible-box.component.js +398 -0
- package/lib/components/loader/index.d.ts +2 -1
- package/lib/components/loader/loader-square.style.d.ts +9 -1
- package/lib/components/loader/loader-square.style.js +4 -15
- package/lib/components/loader/loader.component.d.ts +9 -0
- package/lib/components/loader/loader.component.js +163 -28
- package/lib/components/loader/loader.config.d.ts +1 -1
- package/lib/components/loader/loader.style.d.ts +2 -0
- package/lib/components/loader-bar/index.d.ts +2 -1
- package/lib/components/loader-bar/loader-bar.component.d.ts +7 -0
- package/lib/components/loader-bar/loader-bar.component.js +156 -10
- package/lib/components/loader-bar/loader-bar.config.d.ts +1 -0
- package/lib/components/loader-bar/loader-bar.style.d.ts +10 -0
- package/lib/components/loader-bar/loader-bar.style.js +13 -27
- package/lib/components/pod/pod.component.js +1 -0
- package/lib/components/pod/pod.style.js +8 -4
- package/lib/components/portal/portal.d.ts +15 -12
- package/lib/components/portal/portal.js +3 -14
- package/lib/components/portrait/index.d.ts +2 -1
- package/lib/components/portrait/portrait-gravatar.component.d.ts +16 -0
- package/lib/components/portrait/portrait-gravatar.component.js +9 -24
- package/lib/components/portrait/portrait-initials.component.d.ts +16 -0
- package/lib/components/portrait/portrait-initials.component.js +22 -33
- package/lib/components/portrait/portrait.component.d.ts +50 -0
- package/lib/components/portrait/portrait.component.js +179 -75
- package/lib/components/portrait/portrait.config.d.ts +32 -0
- package/lib/components/portrait/portrait.style.d.ts +28 -0
- package/lib/components/portrait/portrait.style.js +9 -59
- package/lib/components/profile/profile.style.d.ts +2 -2
- package/lib/components/show-edit-pod/show-edit-pod.style.js +1 -12
- package/lib/style/fonts.css +19 -12
- package/lib/style/utils/filter-out-position-props.d.ts +3 -0
- package/lib/style/utils/filter-out-position-props.js +18 -0
- package/package.json +4 -3
- package/esm/components/button-toggle/button-toggle-types.d.ts +0 -1
- package/esm/components/button-toggle/button-toggle.d.ts +0 -45
- package/esm/components/loader/loader.d.ts +0 -16
- package/esm/components/loader-bar/loader-bar.d.ts +0 -10
- package/esm/components/portrait/portrait-gravatar.d.ts +0 -18
- package/esm/components/portrait/portrait-initials.d.ts +0 -18
- package/esm/components/portrait/portrait.d.ts +0 -54
- package/lib/components/button-toggle/button-toggle-types.d.ts +0 -1
- package/lib/components/button-toggle/button-toggle.d.ts +0 -45
- package/lib/components/loader/loader.d.ts +0 -16
- package/lib/components/loader-bar/loader-bar.d.ts +0 -10
- package/lib/components/portrait/portrait-gravatar.d.ts +0 -18
- package/lib/components/portrait/portrait-initials.d.ts +0 -18
- package/lib/components/portrait/portrait.d.ts +0 -54
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
|
|
3
1
|
import React from "react";
|
|
4
2
|
import PropTypes from "prop-types";
|
|
5
3
|
import MD5 from "crypto-js/md5";
|
|
@@ -10,9 +8,8 @@ const PortraitGravatar = ({
|
|
|
10
8
|
gravatarEmail,
|
|
11
9
|
size,
|
|
12
10
|
alt,
|
|
13
|
-
shape,
|
|
14
|
-
errorCallback
|
|
15
|
-
...rest
|
|
11
|
+
shape = "square",
|
|
12
|
+
errorCallback
|
|
16
13
|
}) => {
|
|
17
14
|
const gravatarSrc = () => {
|
|
18
15
|
const {
|
|
@@ -27,33 +24,21 @@ const PortraitGravatar = ({
|
|
|
27
24
|
return `${base}${hash}?s=${dimensions}&d=${fallbackOption}`;
|
|
28
25
|
};
|
|
29
26
|
|
|
30
|
-
return /*#__PURE__*/React.createElement(StyledPortraitGravatar,
|
|
27
|
+
return /*#__PURE__*/React.createElement(StyledPortraitGravatar, {
|
|
31
28
|
src: gravatarSrc(),
|
|
32
29
|
alt: alt,
|
|
33
30
|
size: size,
|
|
34
31
|
shape: shape,
|
|
35
32
|
onError: errorCallback,
|
|
36
33
|
"data-element": "user-image"
|
|
37
|
-
}
|
|
34
|
+
});
|
|
38
35
|
};
|
|
39
36
|
|
|
40
37
|
PortraitGravatar.propTypes = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
size: PropTypes.oneOf(["
|
|
46
|
-
|
|
47
|
-
/** The shape of the Gravatar. */
|
|
48
|
-
shape: PropTypes.oneOf(["circle", "square"]),
|
|
49
|
-
|
|
50
|
-
/** The `alt` HTML string. */
|
|
51
|
-
alt: PropTypes.string,
|
|
52
|
-
|
|
53
|
-
/** A callback to execute if the Gravatar image fails to load. */
|
|
54
|
-
errorCallback: PropTypes.func
|
|
55
|
-
};
|
|
56
|
-
PortraitGravatar.defaultProps = {
|
|
57
|
-
shape: "square"
|
|
38
|
+
"alt": PropTypes.string,
|
|
39
|
+
"errorCallback": PropTypes.func,
|
|
40
|
+
"gravatarEmail": PropTypes.string.isRequired,
|
|
41
|
+
"shape": PropTypes.oneOf(["circle", "square"]),
|
|
42
|
+
"size": PropTypes.oneOf(["L", "M", "ML", "S", "XL", "XS", "XXL"]).isRequired
|
|
58
43
|
};
|
|
59
44
|
export default PortraitGravatar;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PortraitSizes, PortraitShapes } from "./portrait.component";
|
|
3
|
+
export interface PortraitInitialsProps {
|
|
4
|
+
/** The user's initials to render. */
|
|
5
|
+
initials: string;
|
|
6
|
+
/** The size of the initials image. */
|
|
7
|
+
size: PortraitSizes;
|
|
8
|
+
/** Use a dark background. */
|
|
9
|
+
darkBackground?: boolean;
|
|
10
|
+
/** The shape of the Portrait. */
|
|
11
|
+
shape?: PortraitShapes;
|
|
12
|
+
/** The `alt` HTML string. */
|
|
13
|
+
alt?: string;
|
|
14
|
+
}
|
|
15
|
+
declare const PortraitInitials: ({ initials, size, shape, darkBackground, alt, }: PortraitInitialsProps) => JSX.Element;
|
|
16
|
+
export default PortraitInitials;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
|
|
3
1
|
import React, { useEffect, useState } from "react";
|
|
4
2
|
import PropTypes from "prop-types";
|
|
5
3
|
import tokens from "@sage/design-tokens/js/base/common";
|
|
@@ -9,14 +7,13 @@ import { PORTRAIT_SIZE_PARAMS } from "./portrait.config";
|
|
|
9
7
|
const PortraitInitials = ({
|
|
10
8
|
initials,
|
|
11
9
|
size,
|
|
12
|
-
shape,
|
|
10
|
+
shape = "square",
|
|
13
11
|
darkBackground,
|
|
14
|
-
alt
|
|
15
|
-
...rest
|
|
12
|
+
alt
|
|
16
13
|
}) => {
|
|
17
14
|
const [cachedImageDataUrl, setCachedImageDataUrl] = useState();
|
|
18
15
|
useEffect(() => {
|
|
19
|
-
setCachedImageDataUrl(
|
|
16
|
+
setCachedImageDataUrl("");
|
|
20
17
|
}, [initials, size, darkBackground]);
|
|
21
18
|
|
|
22
19
|
const generateDataUrl = () => {
|
|
@@ -36,16 +33,20 @@ const PortraitInitials = ({
|
|
|
36
33
|
dimensions -= 2; // Set canvas with & height
|
|
37
34
|
|
|
38
35
|
canvas.width = dimensions;
|
|
39
|
-
canvas.height = dimensions; // Select a font family to support different language characters
|
|
40
|
-
|
|
36
|
+
canvas.height = dimensions; // Select a font family to support different language characters like Arial
|
|
37
|
+
|
|
38
|
+
/* istanbul ignore else */
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
if (context) {
|
|
41
|
+
context.font = `${Math.round(canvas.width / 2.4)}px "Sage UI", Arial`;
|
|
42
|
+
context.textAlign = "center"; // Setup background and front color
|
|
43
|
+
|
|
44
|
+
context.fillStyle = tokens[bgColor];
|
|
45
|
+
context.fillRect(0, 0, dimensions, dimensions);
|
|
46
|
+
context.fillStyle = tokens[textColor];
|
|
47
|
+
context.fillText(initials.slice(0, 3).toUpperCase(), dimensions / 2, dimensions / 1.5);
|
|
48
|
+
} // Set image representation in default format (png)
|
|
44
49
|
|
|
45
|
-
context.fillStyle = tokens[bgColor];
|
|
46
|
-
context.fillRect(0, 0, dimensions, dimensions);
|
|
47
|
-
context.fillStyle = tokens[textColor];
|
|
48
|
-
context.fillText(initials.slice(0, 3).toUpperCase(), dimensions / 2, dimensions / 1.5); // Set image representation in default format (png)
|
|
49
50
|
|
|
50
51
|
const dataURI = canvas.toDataURL(); // Dispose canvas element
|
|
51
52
|
|
|
@@ -54,34 +55,22 @@ const PortraitInitials = ({
|
|
|
54
55
|
return dataURI;
|
|
55
56
|
};
|
|
56
57
|
|
|
57
|
-
return /*#__PURE__*/React.createElement(StyledPortraitInitials,
|
|
58
|
+
return /*#__PURE__*/React.createElement(StyledPortraitInitials, {
|
|
58
59
|
"data-element": "initials",
|
|
59
60
|
size: size,
|
|
60
61
|
shape: shape,
|
|
61
62
|
initials: initials
|
|
62
|
-
},
|
|
63
|
+
}, /*#__PURE__*/React.createElement(StyledPortraitInitialsImg, {
|
|
63
64
|
src: generateDataUrl(),
|
|
64
65
|
alt: alt
|
|
65
66
|
}));
|
|
66
67
|
};
|
|
67
68
|
|
|
68
69
|
PortraitInitials.propTypes = {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
size: PropTypes.oneOf(["
|
|
74
|
-
|
|
75
|
-
/** Use a dark background. */
|
|
76
|
-
darkBackground: PropTypes.bool,
|
|
77
|
-
|
|
78
|
-
/** The shape of the Portrait. */
|
|
79
|
-
shape: PropTypes.oneOf(["circle", "square"]),
|
|
80
|
-
|
|
81
|
-
/** The `alt` HTML string. */
|
|
82
|
-
alt: PropTypes.string
|
|
83
|
-
};
|
|
84
|
-
PortraitInitials.defaultProps = {
|
|
85
|
-
shape: "square"
|
|
70
|
+
"alt": PropTypes.string,
|
|
71
|
+
"darkBackground": PropTypes.bool,
|
|
72
|
+
"initials": PropTypes.string.isRequired,
|
|
73
|
+
"shape": PropTypes.oneOf(["circle", "square"]),
|
|
74
|
+
"size": PropTypes.oneOf(["L", "M", "ML", "S", "XL", "XS", "XXL"]).isRequired
|
|
86
75
|
};
|
|
87
76
|
export default PortraitInitials;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
import { IconType } from "../icon";
|
|
4
|
+
export declare type PortraitShapes = "circle" | "square";
|
|
5
|
+
export declare type PortraitSizes = "XS" | "S" | "M" | "ML" | "L" | "XL" | "XXL";
|
|
6
|
+
export interface PortraitBaseProps extends MarginProps {
|
|
7
|
+
/** The size of the Portrait. */
|
|
8
|
+
size?: PortraitSizes;
|
|
9
|
+
/** The `alt` HTML string. */
|
|
10
|
+
alt?: string;
|
|
11
|
+
/** The shape of the Portrait. */
|
|
12
|
+
shape?: PortraitShapes;
|
|
13
|
+
/** Icon to be rendered as a fallback. */
|
|
14
|
+
iconType?: IconType;
|
|
15
|
+
/** The initials to render in the Portrait. */
|
|
16
|
+
initials?: string;
|
|
17
|
+
/** Use a dark background. */
|
|
18
|
+
darkBackground?: boolean;
|
|
19
|
+
/** Prop for `onClick` events. */
|
|
20
|
+
onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
|
|
21
|
+
/** The message to be displayed within the tooltip */
|
|
22
|
+
tooltipMessage?: React.ReactNode;
|
|
23
|
+
/** The id attribute to use for the tooltip */
|
|
24
|
+
tooltipId?: string;
|
|
25
|
+
/** Whether to to show the Tooltip */
|
|
26
|
+
tooltipIsVisible?: boolean;
|
|
27
|
+
/** Sets position of the tooltip */
|
|
28
|
+
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
29
|
+
/** Defines the message type */
|
|
30
|
+
tooltipType?: string;
|
|
31
|
+
/** Defines the size of the tooltip content */
|
|
32
|
+
tooltipSize?: "medium" | "large";
|
|
33
|
+
/** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
|
|
34
|
+
tooltipBgColor?: string;
|
|
35
|
+
/** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
|
|
36
|
+
tooltipFontColor?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface PortraitWithGravatar extends PortraitBaseProps {
|
|
39
|
+
/** An email address registered with Gravatar. */
|
|
40
|
+
gravatar?: string;
|
|
41
|
+
src?: never;
|
|
42
|
+
}
|
|
43
|
+
export interface PortraitWithSrc extends PortraitBaseProps {
|
|
44
|
+
/** A custom image URL. */
|
|
45
|
+
src?: string;
|
|
46
|
+
gravatar?: never;
|
|
47
|
+
}
|
|
48
|
+
export declare type PortraitProps = PortraitWithGravatar | PortraitWithSrc;
|
|
49
|
+
export declare const Portrait: ({ alt, darkBackground, gravatar, iconType, initials, shape, size, src, onClick, tooltipMessage, tooltipId, tooltipIsVisible, tooltipPosition, tooltipType, tooltipSize, tooltipBgColor, tooltipFontColor, ...rest }: PortraitProps) => JSX.Element;
|
|
50
|
+
export default Portrait;
|
|
@@ -2,23 +2,21 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
2
2
|
|
|
3
3
|
import React, { useEffect, useState } from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
-
import styledSystemPropTypes from "@styled-system/prop-types";
|
|
6
5
|
import Tooltip from "../tooltip";
|
|
7
6
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
8
7
|
import PortraitGravatar from "./portrait-gravatar.component";
|
|
9
8
|
import PortraitInitials from "./portrait-initials.component";
|
|
10
9
|
import { StyledCustomImg, StyledIcon, StyledPortraitContainer } from "./portrait.style";
|
|
11
10
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
12
|
-
const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
|
|
13
11
|
|
|
14
12
|
const Portrait = ({
|
|
15
|
-
alt,
|
|
16
|
-
darkBackground,
|
|
13
|
+
alt = "",
|
|
14
|
+
darkBackground = false,
|
|
17
15
|
gravatar,
|
|
18
|
-
iconType,
|
|
16
|
+
iconType = "individual",
|
|
19
17
|
initials,
|
|
20
|
-
shape,
|
|
21
|
-
size,
|
|
18
|
+
shape = "square",
|
|
19
|
+
size = "M",
|
|
22
20
|
src,
|
|
23
21
|
onClick,
|
|
24
22
|
tooltipMessage,
|
|
@@ -99,70 +97,178 @@ const Portrait = ({
|
|
|
99
97
|
return renderComponent();
|
|
100
98
|
};
|
|
101
99
|
|
|
102
|
-
Portrait.propTypes = {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
100
|
+
Portrait.propTypes = {
|
|
101
|
+
"alt": PropTypes.string,
|
|
102
|
+
"darkBackground": PropTypes.bool,
|
|
103
|
+
"gravatar": PropTypes.string,
|
|
104
|
+
"iconType": PropTypes.oneOf(["add", "admin", "alert", "analysis", "arrow_down", "arrow_left_boxed", "arrow_left_right_small", "arrow_left_small", "arrow_left", "arrow_right_small", "arrow_right", "arrow_up", "arrow", "attach", "bank", "basket_with_squares", "basket", "bin", "block_arrow_right", "blocked_square", "blocked", "bold", "boxed_shapes", "bulk_destroy", "bullet_list_dotted", "bullet_list_numbers", "bullet_list", "business", "calendar_today", "calendar", "call", "camera", "card_view", "caret_down", "caret_large_down", "caret_large_left", "caret_large_right", "caret_large_up", "caret_left", "caret_right", "caret_up", "cart", "chart_bar", "chart_line", "chart_pie", "chat_notes", "chat", "chevron_down_thick", "chevron_down", "chevron_left_thick", "chevron_left", "chevron_right_thick", "chevron_right", "chevron_up_thick", "chevron_up", "circle_with_dots", "circles_connection", "clock", "close", "coins", "collaborate", "computer_clock", "connect", "contacts", "copy", "create", "credit_card_slash", "credit_card", "cross_circle", "cross", "csv", "delete", "delivery", "disconnect", "disputed", "document_right_align", "document_tick", "document_vertical_lines", "download", "draft", "drag_vertical", "drag", "dropdown", "duplicate", "edit", "edited", "ellipsis_horizontal", "ellipsis_vertical", "email_switch", "email", "entry", "envelope_dollar", "envelope_euro", "error_square", "error", "euro", "expand", "factory", "favourite_lined", "favourite", "fax", "feedback", "file_excel", "file_generic", "file_image", "file_pdf", "file_word", "files_leaning", "filter_new", "filter", "fit_height", "fit_width", "flag", "folder", "gift", "go", "graph", "grid", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "italic", "key", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "link", "list_view", "location", "locked", "logout", "lookup", "marker", "message", "minus_large", "minus", "mobile", "money_bag", "none", "old_warning", "pause_circle", "pause", "pdf", "people_switch", "people", "person_info", "person_tick", "person", "phone", "piggy_bank", "play_circle", "play", "plus_large", "plus", "pound", "print", "progress", "progressed", "question_hollow", "question_mark", "question", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "services", "settings_old", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "sync", "tag", "talk", "three_boxes", "tick_circle", "tick", "true_tick", "undo", "unlocked", "upload", "uploaded", "video", "view", "warning"]),
|
|
105
|
+
"initials": PropTypes.string,
|
|
106
|
+
"m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
107
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
108
|
+
"description": PropTypes.string,
|
|
109
|
+
"toString": PropTypes.func.isRequired,
|
|
110
|
+
"valueOf": PropTypes.func.isRequired
|
|
111
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
112
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
113
|
+
"description": PropTypes.string,
|
|
114
|
+
"toString": PropTypes.func.isRequired,
|
|
115
|
+
"valueOf": PropTypes.func.isRequired
|
|
116
|
+
}), PropTypes.string]),
|
|
117
|
+
"margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
118
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
119
|
+
"description": PropTypes.string,
|
|
120
|
+
"toString": PropTypes.func.isRequired,
|
|
121
|
+
"valueOf": PropTypes.func.isRequired
|
|
122
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
123
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
124
|
+
"description": PropTypes.string,
|
|
125
|
+
"toString": PropTypes.func.isRequired,
|
|
126
|
+
"valueOf": PropTypes.func.isRequired
|
|
127
|
+
}), PropTypes.string]),
|
|
128
|
+
"marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
129
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
130
|
+
"description": PropTypes.string,
|
|
131
|
+
"toString": PropTypes.func.isRequired,
|
|
132
|
+
"valueOf": PropTypes.func.isRequired
|
|
133
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
134
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
135
|
+
"description": PropTypes.string,
|
|
136
|
+
"toString": PropTypes.func.isRequired,
|
|
137
|
+
"valueOf": PropTypes.func.isRequired
|
|
138
|
+
}), PropTypes.string]),
|
|
139
|
+
"marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
140
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
141
|
+
"description": PropTypes.string,
|
|
142
|
+
"toString": PropTypes.func.isRequired,
|
|
143
|
+
"valueOf": PropTypes.func.isRequired
|
|
144
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
145
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
146
|
+
"description": PropTypes.string,
|
|
147
|
+
"toString": PropTypes.func.isRequired,
|
|
148
|
+
"valueOf": PropTypes.func.isRequired
|
|
149
|
+
}), PropTypes.string]),
|
|
150
|
+
"marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
151
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
152
|
+
"description": PropTypes.string,
|
|
153
|
+
"toString": PropTypes.func.isRequired,
|
|
154
|
+
"valueOf": PropTypes.func.isRequired
|
|
155
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
156
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
157
|
+
"description": PropTypes.string,
|
|
158
|
+
"toString": PropTypes.func.isRequired,
|
|
159
|
+
"valueOf": PropTypes.func.isRequired
|
|
160
|
+
}), PropTypes.string]),
|
|
161
|
+
"marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
162
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
163
|
+
"description": PropTypes.string,
|
|
164
|
+
"toString": PropTypes.func.isRequired,
|
|
165
|
+
"valueOf": PropTypes.func.isRequired
|
|
166
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
167
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
168
|
+
"description": PropTypes.string,
|
|
169
|
+
"toString": PropTypes.func.isRequired,
|
|
170
|
+
"valueOf": PropTypes.func.isRequired
|
|
171
|
+
}), PropTypes.string]),
|
|
172
|
+
"marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
173
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
174
|
+
"description": PropTypes.string,
|
|
175
|
+
"toString": PropTypes.func.isRequired,
|
|
176
|
+
"valueOf": PropTypes.func.isRequired
|
|
177
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
178
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
179
|
+
"description": PropTypes.string,
|
|
180
|
+
"toString": PropTypes.func.isRequired,
|
|
181
|
+
"valueOf": PropTypes.func.isRequired
|
|
182
|
+
}), PropTypes.string]),
|
|
183
|
+
"marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
184
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
185
|
+
"description": PropTypes.string,
|
|
186
|
+
"toString": PropTypes.func.isRequired,
|
|
187
|
+
"valueOf": PropTypes.func.isRequired
|
|
188
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
189
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
190
|
+
"description": PropTypes.string,
|
|
191
|
+
"toString": PropTypes.func.isRequired,
|
|
192
|
+
"valueOf": PropTypes.func.isRequired
|
|
193
|
+
}), PropTypes.string]),
|
|
194
|
+
"mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
195
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
196
|
+
"description": PropTypes.string,
|
|
197
|
+
"toString": PropTypes.func.isRequired,
|
|
198
|
+
"valueOf": PropTypes.func.isRequired
|
|
199
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
200
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
201
|
+
"description": PropTypes.string,
|
|
202
|
+
"toString": PropTypes.func.isRequired,
|
|
203
|
+
"valueOf": PropTypes.func.isRequired
|
|
204
|
+
}), PropTypes.string]),
|
|
205
|
+
"ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
206
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
207
|
+
"description": PropTypes.string,
|
|
208
|
+
"toString": PropTypes.func.isRequired,
|
|
209
|
+
"valueOf": PropTypes.func.isRequired
|
|
210
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
211
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
212
|
+
"description": PropTypes.string,
|
|
213
|
+
"toString": PropTypes.func.isRequired,
|
|
214
|
+
"valueOf": PropTypes.func.isRequired
|
|
215
|
+
}), PropTypes.string]),
|
|
216
|
+
"mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
217
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
218
|
+
"description": PropTypes.string,
|
|
219
|
+
"toString": PropTypes.func.isRequired,
|
|
220
|
+
"valueOf": PropTypes.func.isRequired
|
|
221
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
222
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
223
|
+
"description": PropTypes.string,
|
|
224
|
+
"toString": PropTypes.func.isRequired,
|
|
225
|
+
"valueOf": PropTypes.func.isRequired
|
|
226
|
+
}), PropTypes.string]),
|
|
227
|
+
"mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
228
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
229
|
+
"description": PropTypes.string,
|
|
230
|
+
"toString": PropTypes.func.isRequired,
|
|
231
|
+
"valueOf": PropTypes.func.isRequired
|
|
232
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
233
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
234
|
+
"description": PropTypes.string,
|
|
235
|
+
"toString": PropTypes.func.isRequired,
|
|
236
|
+
"valueOf": PropTypes.func.isRequired
|
|
237
|
+
}), PropTypes.string]),
|
|
238
|
+
"mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
239
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
240
|
+
"description": PropTypes.string,
|
|
241
|
+
"toString": PropTypes.func.isRequired,
|
|
242
|
+
"valueOf": PropTypes.func.isRequired
|
|
243
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
244
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
245
|
+
"description": PropTypes.string,
|
|
246
|
+
"toString": PropTypes.func.isRequired,
|
|
247
|
+
"valueOf": PropTypes.func.isRequired
|
|
248
|
+
}), PropTypes.string]),
|
|
249
|
+
"my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
250
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
251
|
+
"description": PropTypes.string,
|
|
252
|
+
"toString": PropTypes.func.isRequired,
|
|
253
|
+
"valueOf": PropTypes.func.isRequired
|
|
254
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
255
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
256
|
+
"description": PropTypes.string,
|
|
257
|
+
"toString": PropTypes.func.isRequired,
|
|
258
|
+
"valueOf": PropTypes.func.isRequired
|
|
259
|
+
}), PropTypes.string]),
|
|
260
|
+
"onClick": PropTypes.func,
|
|
261
|
+
"shape": PropTypes.oneOf(["circle", "square"]),
|
|
262
|
+
"size": PropTypes.oneOf(["L", "M", "ML", "S", "XL", "XS", "XXL"]),
|
|
263
|
+
"src": PropTypes.string,
|
|
264
|
+
"tooltipBgColor": PropTypes.string,
|
|
265
|
+
"tooltipFontColor": PropTypes.string,
|
|
266
|
+
"tooltipId": PropTypes.string,
|
|
267
|
+
"tooltipIsVisible": PropTypes.bool,
|
|
268
|
+
"tooltipMessage": PropTypes.node,
|
|
269
|
+
"tooltipPosition": PropTypes.oneOf(["bottom", "left", "right", "top"]),
|
|
270
|
+
"tooltipSize": PropTypes.oneOf(["large", "medium"]),
|
|
271
|
+
"tooltipType": PropTypes.string
|
|
167
272
|
};
|
|
273
|
+
export { Portrait };
|
|
168
274
|
export default Portrait;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const PORTRAIT_SHAPES: string[];
|
|
2
|
+
export declare const PORTRAIT_SIZES: string[];
|
|
3
|
+
export declare const PORTRAIT_SIZE_PARAMS: {
|
|
4
|
+
XS: {
|
|
5
|
+
dimensions: number;
|
|
6
|
+
iconDimensions: number;
|
|
7
|
+
};
|
|
8
|
+
S: {
|
|
9
|
+
dimensions: number;
|
|
10
|
+
iconDimensions: number;
|
|
11
|
+
};
|
|
12
|
+
M: {
|
|
13
|
+
dimensions: number;
|
|
14
|
+
iconDimensions: number;
|
|
15
|
+
};
|
|
16
|
+
ML: {
|
|
17
|
+
dimensions: number;
|
|
18
|
+
iconDimensions: number;
|
|
19
|
+
};
|
|
20
|
+
L: {
|
|
21
|
+
dimensions: number;
|
|
22
|
+
iconDimensions: number;
|
|
23
|
+
};
|
|
24
|
+
XL: {
|
|
25
|
+
dimensions: number;
|
|
26
|
+
iconDimensions: number;
|
|
27
|
+
};
|
|
28
|
+
XXL: {
|
|
29
|
+
dimensions: number;
|
|
30
|
+
iconDimensions: number;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
import { IconType } from "../icon";
|
|
4
|
+
import { PortraitSizes, PortraitShapes } from "./portrait.component";
|
|
5
|
+
export declare function getColorsForInitials(darkBackground?: boolean): {
|
|
6
|
+
textColor: "colorsUtilityYang100" | "colorsUtilityYin055";
|
|
7
|
+
bgColor: "colorsUtilityMajor400" | "colorsUtilityMajor025";
|
|
8
|
+
};
|
|
9
|
+
declare type PortraitSizeAndShape = {
|
|
10
|
+
size: PortraitSizes;
|
|
11
|
+
shape?: PortraitShapes;
|
|
12
|
+
};
|
|
13
|
+
export declare const StyledPortraitInitials: import("styled-components").StyledComponent<"div", any, PortraitSizeAndShape & {
|
|
14
|
+
initials?: string | undefined;
|
|
15
|
+
}, never>;
|
|
16
|
+
export declare const StyledPortraitInitialsImg: import("styled-components").StyledComponent<"img", any, {}, never>;
|
|
17
|
+
export declare const StyledPortraitGravatar: import("styled-components").StyledComponent<"img", any, PortraitSizeAndShape, never>;
|
|
18
|
+
export declare const StyledCustomImg: import("styled-components").StyledComponent<"img", any, PortraitSizeAndShape, never>;
|
|
19
|
+
export declare const StyledIcon: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<import("../icon").IconProps & React.RefAttributes<HTMLSpanElement>>, any, {
|
|
20
|
+
size: PortraitSizes;
|
|
21
|
+
shape?: PortraitShapes | undefined;
|
|
22
|
+
darkBackground: boolean;
|
|
23
|
+
type: IconType;
|
|
24
|
+
}, never>;
|
|
25
|
+
export declare const StyledPortraitContainer: import("styled-components").StyledComponent<"div", any, MarginProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & {
|
|
26
|
+
onClick?: ((ev: React.MouseEvent<HTMLElement>) => void) | undefined;
|
|
27
|
+
}, never>;
|
|
28
|
+
export {};
|