carbon-react 110.0.4 → 110.1.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.
Files changed (103) hide show
  1. package/esm/__spec_helper__/mock-match-media.d.ts +3 -1
  2. package/esm/components/button-toggle/button-toggle-icon.component.d.ts +15 -0
  3. package/esm/components/button-toggle/button-toggle-icon.component.js +19 -16
  4. package/esm/components/button-toggle/button-toggle-input.component.d.ts +25 -0
  5. package/esm/components/button-toggle/button-toggle-input.component.js +13 -25
  6. package/esm/components/button-toggle/button-toggle.component.d.ts +24 -0
  7. package/esm/components/button-toggle/button-toggle.component.js +23 -59
  8. package/esm/components/button-toggle/button-toggle.style.d.ts +26 -0
  9. package/esm/components/button-toggle/button-toggle.style.js +3 -8
  10. package/esm/components/button-toggle/index.d.ts +2 -2
  11. package/esm/components/content/content.style.js +0 -1
  12. package/esm/components/date/__internal__/utils.js +1 -1
  13. package/esm/components/definition-list/definition-list.style.js +0 -9
  14. package/esm/components/loader/index.d.ts +2 -1
  15. package/esm/components/loader/loader-square.style.d.ts +9 -1
  16. package/esm/components/loader/loader-square.style.js +4 -11
  17. package/esm/components/loader/loader.component.d.ts +9 -0
  18. package/esm/components/loader/loader.component.js +162 -24
  19. package/esm/components/loader/loader.config.d.ts +1 -1
  20. package/esm/components/loader/loader.style.d.ts +2 -0
  21. package/esm/components/loader-bar/index.d.ts +2 -1
  22. package/esm/components/loader-bar/loader-bar.component.d.ts +7 -0
  23. package/esm/components/loader-bar/loader-bar.component.js +156 -7
  24. package/esm/components/loader-bar/loader-bar.config.d.ts +1 -0
  25. package/esm/components/loader-bar/loader-bar.style.d.ts +10 -0
  26. package/esm/components/loader-bar/loader-bar.style.js +14 -25
  27. package/esm/components/pod/pod.component.js +1 -0
  28. package/esm/components/pod/pod.style.js +8 -4
  29. package/esm/components/portrait/index.d.ts +2 -1
  30. package/esm/components/portrait/portrait-gravatar.component.d.ts +16 -0
  31. package/esm/components/portrait/portrait-gravatar.component.js +9 -24
  32. package/esm/components/portrait/portrait-initials.component.d.ts +16 -0
  33. package/esm/components/portrait/portrait-initials.component.js +22 -33
  34. package/esm/components/portrait/portrait.component.d.ts +50 -0
  35. package/esm/components/portrait/portrait.component.js +178 -72
  36. package/esm/components/portrait/portrait.config.d.ts +32 -0
  37. package/esm/components/portrait/portrait.style.d.ts +28 -0
  38. package/esm/components/portrait/portrait.style.js +7 -55
  39. package/esm/components/profile/profile.style.d.ts +2 -2
  40. package/esm/components/show-edit-pod/show-edit-pod.style.js +1 -8
  41. package/esm/components/sidebar/sidebar.component.js +20 -18
  42. package/esm/components/sidebar/sidebar.d.ts +2 -1
  43. package/esm/components/sidebar/sidebar.style.js +3 -3
  44. package/esm/style/fonts.css +19 -12
  45. package/lib/__spec_helper__/mock-match-media.d.ts +3 -1
  46. package/lib/components/button-toggle/button-toggle-icon.component.d.ts +15 -0
  47. package/lib/components/button-toggle/button-toggle-icon.component.js +19 -16
  48. package/lib/components/button-toggle/button-toggle-input.component.d.ts +25 -0
  49. package/lib/components/button-toggle/button-toggle-input.component.js +13 -25
  50. package/lib/components/button-toggle/button-toggle.component.d.ts +24 -0
  51. package/lib/components/button-toggle/button-toggle.component.js +24 -60
  52. package/lib/components/button-toggle/button-toggle.style.d.ts +26 -0
  53. package/lib/components/button-toggle/button-toggle.style.js +6 -12
  54. package/lib/components/button-toggle/index.d.ts +2 -2
  55. package/lib/components/content/content.style.js +0 -1
  56. package/lib/components/date/__internal__/utils.js +1 -1
  57. package/lib/components/definition-list/definition-list.style.js +0 -10
  58. package/lib/components/loader/index.d.ts +2 -1
  59. package/lib/components/loader/loader-square.style.d.ts +9 -1
  60. package/lib/components/loader/loader-square.style.js +4 -15
  61. package/lib/components/loader/loader.component.d.ts +9 -0
  62. package/lib/components/loader/loader.component.js +163 -28
  63. package/lib/components/loader/loader.config.d.ts +1 -1
  64. package/lib/components/loader/loader.style.d.ts +2 -0
  65. package/lib/components/loader-bar/index.d.ts +2 -1
  66. package/lib/components/loader-bar/loader-bar.component.d.ts +7 -0
  67. package/lib/components/loader-bar/loader-bar.component.js +156 -10
  68. package/lib/components/loader-bar/loader-bar.config.d.ts +1 -0
  69. package/lib/components/loader-bar/loader-bar.style.d.ts +10 -0
  70. package/lib/components/loader-bar/loader-bar.style.js +13 -27
  71. package/lib/components/pod/pod.component.js +1 -0
  72. package/lib/components/pod/pod.style.js +8 -4
  73. package/lib/components/portrait/index.d.ts +2 -1
  74. package/lib/components/portrait/portrait-gravatar.component.d.ts +16 -0
  75. package/lib/components/portrait/portrait-gravatar.component.js +9 -24
  76. package/lib/components/portrait/portrait-initials.component.d.ts +16 -0
  77. package/lib/components/portrait/portrait-initials.component.js +22 -33
  78. package/lib/components/portrait/portrait.component.d.ts +50 -0
  79. package/lib/components/portrait/portrait.component.js +179 -75
  80. package/lib/components/portrait/portrait.config.d.ts +32 -0
  81. package/lib/components/portrait/portrait.style.d.ts +28 -0
  82. package/lib/components/portrait/portrait.style.js +9 -59
  83. package/lib/components/profile/profile.style.d.ts +2 -2
  84. package/lib/components/show-edit-pod/show-edit-pod.style.js +1 -12
  85. package/lib/components/sidebar/sidebar.component.js +21 -17
  86. package/lib/components/sidebar/sidebar.d.ts +2 -1
  87. package/lib/components/sidebar/sidebar.style.js +3 -3
  88. package/lib/style/fonts.css +19 -12
  89. package/package.json +4 -3
  90. package/esm/components/button-toggle/button-toggle-types.d.ts +0 -1
  91. package/esm/components/button-toggle/button-toggle.d.ts +0 -45
  92. package/esm/components/loader/loader.d.ts +0 -16
  93. package/esm/components/loader-bar/loader-bar.d.ts +0 -10
  94. package/esm/components/portrait/portrait-gravatar.d.ts +0 -18
  95. package/esm/components/portrait/portrait-initials.d.ts +0 -18
  96. package/esm/components/portrait/portrait.d.ts +0 -54
  97. package/lib/components/button-toggle/button-toggle-types.d.ts +0 -1
  98. package/lib/components/button-toggle/button-toggle.d.ts +0 -45
  99. package/lib/components/loader/loader.d.ts +0 -16
  100. package/lib/components/loader-bar/loader-bar.d.ts +0 -10
  101. package/lib/components/portrait/portrait-gravatar.d.ts +0 -18
  102. package/lib/components/portrait/portrait-initials.d.ts +0 -18
  103. 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, { 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(null);
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
- // like Arial
36
+ canvas.height = dimensions; // Select a font family to support different language characters like Arial
37
+
38
+ /* istanbul ignore else */
41
39
 
42
- context.font = `${Math.round(canvas.width / 2.4)}px "Sage UI", Arial`;
43
- context.textAlign = "center"; // Setup background and front color
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, _extends({
58
+ return /*#__PURE__*/React.createElement(StyledPortraitInitials, {
58
59
  "data-element": "initials",
59
60
  size: size,
60
61
  shape: shape,
61
62
  initials: initials
62
- }, rest), /*#__PURE__*/React.createElement(StyledPortraitInitialsImg, {
63
+ }, /*#__PURE__*/React.createElement(StyledPortraitInitialsImg, {
63
64
  src: generateDataUrl(),
64
65
  alt: alt
65
66
  }));
66
67
  };
67
68
 
68
69
  PortraitInitials.propTypes = {
69
- /** The user's initials to render. */
70
- initials: PropTypes.string.isRequired,
71
-
72
- /** The size of the initials image. */
73
- size: PropTypes.oneOf(["XS", "S", "M", "ML", "L", "XL", "XXL"]).isRequired,
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 = { ...marginPropTypes,
103
-
104
- /** The size of the Portrait. */
105
- size: PropTypes.oneOf(["XS", "S", "M", "ML", "L", "XL", "XXL"]),
106
-
107
- /** A custom image URL. */
108
- src: props => {
109
- if (props.src && typeof props.src !== "string") {
110
- throw new Error(`Invalid prop \`src\` of type \`${typeof props.src}\` supplied to \`Portrait\`, expected \`string\`.`);
111
- } else if (props.gravatar && props.src) {
112
- throw new Error('Portrait requires a prop of "src" or "gravatar" but not both');
113
- }
114
- },
115
-
116
- /** An email address registered with Gravatar. */
117
- gravatar: PropTypes.string,
118
-
119
- /** The `alt` HTML string. */
120
- alt: PropTypes.string,
121
-
122
- /** The shape of the Portrait. */
123
- shape: PropTypes.oneOf(["circle", "square"]),
124
-
125
- /** The initials to render in the Portrait. */
126
- initials: PropTypes.string,
127
-
128
- /** Use a dark background. */
129
- darkBackground: PropTypes.bool,
130
-
131
- /** The icon to render as fallback */
132
- iconType: PropTypes.string,
133
-
134
- /** Prop for `onClick` events. */
135
- onClick: PropTypes.func,
136
-
137
- /** The message to be displayed within the tooltip */
138
- tooltipMessage: PropTypes.node,
139
-
140
- /** The id attribute to use for the tooltip */
141
- tooltipId: PropTypes.string,
142
-
143
- /** Whether to to show the Tooltip */
144
- tooltipIsVisible: PropTypes.bool,
145
-
146
- /** Sets position of the tooltip */
147
- tooltipPosition: PropTypes.oneOf(["top", "bottom", "left", "right"]),
148
-
149
- /** Defines the message type */
150
- tooltipType: PropTypes.string,
151
-
152
- /** Defines the size of the tooltip content */
153
- tooltipSize: PropTypes.oneOf(["medium", "large"]),
154
-
155
- /** Override background color of the Tooltip, provide design token, any color from palette or any valid css color value. */
156
- tooltipBgColor: PropTypes.string,
157
-
158
- /** Override font color of the Tooltip, provide design token, any color from palette or any valid css color value. */
159
- tooltipFontColor: PropTypes.string
160
- };
161
- Portrait.defaultProps = {
162
- size: "M",
163
- shape: "square",
164
- darkBackground: false,
165
- alt: "",
166
- iconType: "individual"
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 {};
@@ -1,10 +1,8 @@
1
- import React from "react";
2
1
  import styled, { css } from "styled-components";
3
- import PropTypes from "prop-types";
4
2
  import { margin } from "styled-system";
5
3
  import BaseTheme from "../../style/themes/base";
6
4
  import Icon from "../icon";
7
- import { PORTRAIT_SHAPES, PORTRAIT_SIZES, PORTRAIT_SIZE_PARAMS } from "./portrait.config";
5
+ import { PORTRAIT_SIZE_PARAMS } from "./portrait.config";
8
6
 
9
7
  function stylingForSize({
10
8
  size,
@@ -12,10 +10,6 @@ function stylingForSize({
12
10
  }) {
13
11
  const params = PORTRAIT_SIZE_PARAMS[size];
14
12
 
15
- if (!params) {
16
- return css``;
17
- }
18
-
19
13
  if (initials) {
20
14
  return css`
21
15
  width: inherit;
@@ -25,8 +19,8 @@ function stylingForSize({
25
19
  }
26
20
 
27
21
  return css`
28
- width: ${params.dimensions}px;
29
- height: ${params.dimensions}px;
22
+ width: ${params === null || params === void 0 ? void 0 : params.dimensions}px;
23
+ height: ${params === null || params === void 0 ? void 0 : params.dimensions}px;
30
24
  `;
31
25
  }
32
26
 
@@ -46,11 +40,6 @@ function stylingForIcon({
46
40
  darkBackground
47
41
  }) {
48
42
  const params = PORTRAIT_SIZE_PARAMS[size];
49
-
50
- if (!params) {
51
- return css``;
52
- }
53
-
54
43
  let color = "var(--colorsUtilityMajor200)";
55
44
  let backgroundColor = "var(--colorsUtilityMajor025)";
56
45
 
@@ -64,7 +53,7 @@ function stylingForIcon({
64
53
  color: ${color};
65
54
 
66
55
  ::before {
67
- font-size: ${params.iconDimensions}px;
56
+ font-size: ${params === null || params === void 0 ? void 0 : params.iconDimensions}px;
68
57
  }
69
58
  `;
70
59
  }
@@ -92,49 +81,23 @@ export const StyledPortraitInitials = styled.div`
92
81
  }
93
82
  }
94
83
  `;
95
- StyledPortraitInitials.propTypes = {
96
- size: PropTypes.oneOf(PORTRAIT_SIZES).isRequired,
97
- shape: PropTypes.oneOf(PORTRAIT_SHAPES)
98
- };
99
- StyledPortraitInitials.defaultProps = {
100
- shape: "square"
101
- };
102
84
  export const StyledPortraitInitialsImg = styled.img`
103
85
  display: block;
104
86
  `;
105
- StyledPortraitInitialsImg.propTypes = {
106
- src: PropTypes.string.isRequired,
107
- alt: PropTypes.string
108
- };
109
87
  export const StyledPortraitGravatar = styled.img`
110
88
  display: inline-block;
111
89
  vertical-align: middle;
112
90
  ${stylingForSize}
113
91
  ${stylingForShape}
114
92
  `;
115
- StyledPortraitGravatar.propTypes = {
116
- shape: PropTypes.oneOf(PORTRAIT_SHAPES),
117
- size: PropTypes.oneOf(PORTRAIT_SIZES).isRequired,
118
- src: PropTypes.string.isRequired,
119
- alt: PropTypes.string
120
- };
121
93
  export const StyledCustomImg = styled.img`
122
94
  display: block;
123
95
  ${stylingForSize}
124
96
  ${stylingForShape}
125
- `;
126
- StyledCustomImg.propTypes = {
127
- src: PropTypes.string.isRequired,
128
- alt: PropTypes.string,
129
- shape: PropTypes.oneOf(PORTRAIT_SHAPES),
130
- size: PropTypes.oneOf(PORTRAIT_SIZES).isRequired
131
- }; // && is used here to increase the specificity
97
+ `; // && is used here to increase the specificity
98
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
132
99
 
133
- export const StyledIcon = styled(({
134
- size,
135
- darkBackground,
136
- ...rest
137
- }) => /*#__PURE__*/React.createElement(Icon, rest))`
100
+ export const StyledIcon = styled(Icon)`
138
101
  && {
139
102
  box-sizing: border-box;
140
103
  line-height: 14px;
@@ -146,17 +109,6 @@ export const StyledIcon = styled(({
146
109
  }) => darkBackground ? "var(--colorsUtilityMajorTransparent)" : "var(--colorsUtilityMajor200)"};
147
110
  }
148
111
  `;
149
- StyledIcon.propTypes = {
150
- darkBackground: PropTypes.bool,
151
- size: PropTypes.oneOf(PORTRAIT_SIZES),
152
- shape: PropTypes.oneOf(PORTRAIT_SHAPES),
153
- type: PropTypes.string.isRequired
154
- };
155
- StyledIcon.defaultProps = {
156
- darkBackground: false,
157
- size: "M",
158
- shape: "square"
159
- };
160
112
  export const StyledPortraitContainer = styled.div`
161
113
  display: inline-block;
162
114
  ${({
@@ -1,4 +1,4 @@
1
- import Portrait from "../portrait";
1
+ /// <reference types="react" />
2
2
  import { ProfileSize } from "./profile.config";
3
3
  interface ProfileSizeProps {
4
4
  size?: ProfileSize;
@@ -12,5 +12,5 @@ declare const ProfileNameStyle: import("styled-components").StyledComponent<"spa
12
12
  declare const ProfileEmailStyle: import("styled-components").StyledComponent<"span", any, ProfileSizeProps, never>;
13
13
  declare const ProfileStyle: import("styled-components").StyledComponent<"div", any, ProfileHasSrcProps, never>;
14
14
  declare const ProfileDetailsStyle: import("styled-components").StyledComponent<"div", any, ProfileDetailsStyleProps, never>;
15
- declare const ProfileAvatarStyle: import("styled-components").StyledComponent<typeof Portrait, any, {}, never>;
15
+ declare const ProfileAvatarStyle: import("styled-components").StyledComponent<({ alt, darkBackground, gravatar, iconType, initials, shape, size, src, onClick, tooltipMessage, tooltipId, tooltipIsVisible, tooltipPosition, tooltipType, tooltipSize, tooltipBgColor, tooltipFontColor, ...rest }: import("../portrait").PortraitProps) => JSX.Element, any, {}, never>;
16
16
  export { ProfileStyle, ProfileNameStyle, ProfileDetailsStyle, ProfileAvatarStyle, ProfileEmailStyle, };
@@ -1,4 +1,4 @@
1
- import styled, { css } from "styled-components";
1
+ import styled from "styled-components";
2
2
  import { StyledFormFooter } from "../form/form.style.js";
3
3
  import { StyledContent } from "../pod/pod.style.js";
4
4
  import Pod from "../pod";
@@ -9,13 +9,6 @@ const StyledPod = styled(Pod)`
9
9
 
10
10
  ${StyledContent} {
11
11
  padding: 16px;
12
- ${({
13
- softDelete
14
- }) => softDelete && css`
15
- [data-element="content-title"] {
16
- color: var(--colorsUtilityYin030);
17
- }
18
- `}
19
12
  }
20
13
 
21
14
  .common-input__prefix {