carbon-react 123.8.0 → 123.9.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.
Files changed (31) hide show
  1. package/esm/components/portrait/portrait.component.d.ts +3 -1
  2. package/esm/components/portrait/portrait.component.js +37 -26
  3. package/esm/components/portrait/portrait.config.d.ts +4 -4
  4. package/esm/components/portrait/portrait.style.d.ts +8 -21
  5. package/esm/components/portrait/portrait.style.js +42 -85
  6. package/esm/components/profile/profile.component.d.ts +9 -3
  7. package/esm/components/profile/profile.component.js +36 -19
  8. package/esm/components/profile/profile.config.d.ts +7 -7
  9. package/esm/components/profile/profile.config.js +14 -14
  10. package/esm/components/profile/profile.style.d.ts +10 -12
  11. package/esm/components/profile/profile.style.js +30 -13
  12. package/lib/components/portrait/portrait.component.d.ts +3 -1
  13. package/lib/components/portrait/portrait.component.js +41 -31
  14. package/lib/components/portrait/portrait.config.d.ts +4 -4
  15. package/lib/components/portrait/portrait.style.d.ts +8 -21
  16. package/lib/components/portrait/portrait.style.js +43 -90
  17. package/lib/components/profile/profile.component.d.ts +9 -3
  18. package/lib/components/profile/profile.component.js +35 -18
  19. package/lib/components/profile/profile.config.d.ts +7 -7
  20. package/lib/components/profile/profile.config.js +14 -14
  21. package/lib/components/profile/profile.style.d.ts +10 -12
  22. package/lib/components/profile/profile.style.js +32 -14
  23. package/package.json +1 -1
  24. package/esm/components/portrait/portrait-gravatar.component.d.ts +0 -16
  25. package/esm/components/portrait/portrait-gravatar.component.js +0 -33
  26. package/esm/components/portrait/portrait-initials.component.d.ts +0 -16
  27. package/esm/components/portrait/portrait-initials.component.js +0 -67
  28. package/lib/components/portrait/portrait-gravatar.component.d.ts +0 -16
  29. package/lib/components/portrait/portrait-gravatar.component.js +0 -41
  30. package/lib/components/portrait/portrait-initials.component.d.ts +0 -16
  31. package/lib/components/portrait/portrait-initials.component.js +0 -77
@@ -10,6 +10,8 @@ export interface PortraitProps extends MarginProps {
10
10
  src?: string;
11
11
  /** The size of the Portrait. */
12
12
  size?: PortraitSizes;
13
+ /** @private @ignore */
14
+ name?: string;
13
15
  /** The `alt` HTML string. */
14
16
  alt?: string;
15
17
  /** The shape of the Portrait. */
@@ -39,5 +41,5 @@ export interface PortraitProps extends MarginProps {
39
41
  /** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
40
42
  tooltipFontColor?: string;
41
43
  }
42
- export declare const Portrait: ({ alt, darkBackground, gravatar, iconType, initials, shape, size, src, onClick, tooltipMessage, tooltipId, tooltipIsVisible, tooltipPosition, tooltipType, tooltipSize, tooltipBgColor, tooltipFontColor, ...rest }: PortraitProps) => React.JSX.Element;
44
+ declare const Portrait: ({ alt, name, darkBackground, gravatar, iconType, initials, shape, size, src, onClick, tooltipMessage, tooltipId, tooltipIsVisible, tooltipPosition, tooltipType, tooltipSize, tooltipBgColor, tooltipFontColor, ...rest }: PortraitProps) => React.JSX.Element;
43
45
  export default Portrait;
@@ -1,18 +1,19 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
2
  import React, { useEffect, useState, useContext } from "react";
3
3
  import PropTypes from "prop-types";
4
+ import MD5 from "crypto-js/md5";
4
5
  import invariant from "invariant";
5
6
  import Tooltip from "../tooltip";
6
7
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
7
- import PortraitGravatar from "./portrait-gravatar.component";
8
- import PortraitInitials from "./portrait-initials.component";
9
- import { StyledCustomImg, StyledIcon, StyledPortraitContainer } from "./portrait.style";
8
+ import { PORTRAIT_SIZE_PARAMS } from "./portrait.config";
9
+ import { StyledCustomImg, StyledIcon, StyledPortraitContainer, StyledPortraitInitials, StyledPortraitGravatar } from "./portrait.style";
10
10
  import { filterStyledSystemMarginProps } from "../../style/utils";
11
11
  import { NewValidationContext as RoundedCornersOptOutContext } from "../carbon-provider/carbon-provider.component";
12
- export const Portrait = ({
13
- alt = "",
12
+ const Portrait = ({
13
+ alt,
14
+ name,
14
15
  darkBackground = false,
15
- gravatar,
16
+ gravatar = "",
16
17
  iconType = "individual",
17
18
  initials,
18
19
  shape,
@@ -39,39 +40,41 @@ export const Portrait = ({
39
40
  setExternalError(false);
40
41
  }, [gravatar, src]);
41
42
  const tagProps = tagComponent("portrait", rest);
43
+ const gravatarSrc = () => {
44
+ const {
45
+ dimensions
46
+ } = PORTRAIT_SIZE_PARAMS[size];
47
+ const base = "https://www.gravatar.com/avatar/";
48
+ const hash = MD5(gravatar.toLowerCase());
49
+ const fallbackOption = "404"; // "Return an HTTP 404 File Not Found response"
50
+
51
+ /** @see https://en.gravatar.com/site/implement/images/#default-image */
52
+ return `${base}${hash}?s=${dimensions}&d=${fallbackOption}`;
53
+ };
42
54
  const renderComponent = () => {
43
55
  let portrait = /*#__PURE__*/React.createElement(StyledIcon, {
44
56
  type: iconType,
45
- size: size,
46
- shape: shape || defaultShape,
47
- darkBackground: darkBackground
57
+ size: size
48
58
  });
49
59
  if (initials) {
50
- portrait = /*#__PURE__*/React.createElement(PortraitInitials, {
60
+ portrait = /*#__PURE__*/React.createElement(StyledPortraitInitials, {
51
61
  size: size,
52
- shape: shape || defaultShape,
53
- initials: initials,
54
- darkBackground: darkBackground,
55
- alt: alt
56
- });
62
+ "data-element": "initials"
63
+ }, initials.slice(0, 3).toUpperCase());
57
64
  }
58
65
  if (src && !externalError) {
59
66
  portrait = /*#__PURE__*/React.createElement(StyledCustomImg, {
60
67
  src: src,
61
- alt: alt,
62
- size: size,
63
- shape: shape || defaultShape,
68
+ alt: alt || name || "",
64
69
  "data-element": "user-image",
65
70
  onError: () => setExternalError(true)
66
71
  });
67
72
  }
68
73
  if (gravatar && !externalError) {
69
- portrait = /*#__PURE__*/React.createElement(PortraitGravatar, {
70
- gravatarEmail: gravatar,
71
- shape: shape || defaultShape,
72
- size: size,
73
- alt: alt,
74
- errorCallback: () => setExternalError(true)
74
+ portrait = /*#__PURE__*/React.createElement(StyledPortraitGravatar, {
75
+ src: gravatarSrc(),
76
+ alt: alt || name || "",
77
+ onError: () => setExternalError(true)
75
78
  });
76
79
  }
77
80
  if (tooltipMessage) {
@@ -86,11 +89,19 @@ export const Portrait = ({
86
89
  fontColor: tooltipFontColor
87
90
  }, /*#__PURE__*/React.createElement(StyledPortraitContainer, _extends({}, filterStyledSystemMarginProps(rest), {
88
91
  onClick: onClick
89
- }, tagProps), portrait));
92
+ }, tagProps, {
93
+ darkBackground: darkBackground,
94
+ size: size,
95
+ shape: shape || defaultShape
96
+ }), portrait));
90
97
  }
91
98
  return /*#__PURE__*/React.createElement(StyledPortraitContainer, _extends({}, filterStyledSystemMarginProps(rest), {
92
99
  onClick: onClick
93
- }, tagProps), portrait);
100
+ }, tagProps, {
101
+ darkBackground: darkBackground,
102
+ size: size,
103
+ shape: shape || defaultShape
104
+ }), portrait);
94
105
  };
95
106
  return renderComponent();
96
107
  };
@@ -1,7 +1,7 @@
1
- export declare const PORTRAIT_SHAPES: string[];
2
- declare type PortraitSize = "XS" | "S" | "M" | "ML" | "L" | "XL" | "XXL";
3
- export declare const PORTRAIT_SIZES: PortraitSize[];
4
- declare type PortraitSizeParams = Record<PortraitSize, {
1
+ import { PortraitShapes, PortraitSizes } from "./portrait.component";
2
+ export declare const PORTRAIT_SHAPES: PortraitShapes[];
3
+ export declare const PORTRAIT_SIZES: PortraitSizes[];
4
+ declare type PortraitSizeParams = Record<PortraitSizes, {
5
5
  dimensions: number;
6
6
  iconDimensions: number;
7
7
  }>;
@@ -1,28 +1,15 @@
1
1
  import React from "react";
2
2
  import { MarginProps } from "styled-system";
3
- import { IconType } from "../icon";
4
3
  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 = {
4
+ declare type StyledPortraitProps = {
5
+ darkBackground?: boolean;
10
6
  size: PortraitSizes;
11
7
  shape?: PortraitShapes;
8
+ onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
12
9
  };
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>;
10
+ export declare const StyledPortraitInitials: import("styled-components").StyledComponent<"div", any, Pick<StyledPortraitProps, "size">, never>;
11
+ export declare const StyledPortraitGravatar: import("styled-components").StyledComponent<"img", any, {}, never>;
12
+ export declare const StyledCustomImg: import("styled-components").StyledComponent<"img", any, {}, never>;
13
+ export declare const StyledIcon: import("styled-components").StyledComponent<React.ForwardRefExoticComponent<import("../icon").IconProps & React.RefAttributes<HTMLSpanElement>>, any, Pick<StyledPortraitProps, "size">, never>;
14
+ export declare const StyledPortraitContainer: import("styled-components").StyledComponent<"div", any, StyledPortraitProps & MarginProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>>, never>;
28
15
  export {};
@@ -1,106 +1,63 @@
1
- import styled, { css } from "styled-components";
1
+ import styled from "styled-components";
2
2
  import { margin } from "styled-system";
3
3
  import BaseTheme from "../../style/themes/base";
4
4
  import Icon from "../icon";
5
5
  import { PORTRAIT_SIZE_PARAMS } from "./portrait.config";
6
- function stylingForSize({
7
- size,
8
- initials
9
- }) {
10
- const params = PORTRAIT_SIZE_PARAMS[size];
11
- if (initials) {
12
- return css`
13
- width: inherit;
14
- height: inherit;
15
- margin: 1px;
16
- `;
17
- }
18
- return css`
19
- width: ${params?.dimensions}px;
20
- height: ${params?.dimensions}px;
21
- `;
22
- }
23
- function stylingForShape({
24
- shape
25
- }) {
26
- let cssString = "overflow: hidden;";
27
- if (shape === "square") cssString += "border-radius: 0px;";
28
- if (shape === "circle") cssString += "border-radius: var(--borderRadiusCircle);";
29
- return css`
30
- ${cssString}
31
- `;
32
- }
33
- function stylingForIcon({
34
- size,
35
- darkBackground
36
- }) {
37
- const params = PORTRAIT_SIZE_PARAMS[size];
38
- let color = "var(--colorsUtilityMajor200)";
39
- let backgroundColor = "var(--colorsUtilityMajor025)";
40
- if (darkBackground) {
41
- color = "var(--colorsUtilityMajor025)";
42
- backgroundColor = "var(--colorsUtilityMajor200)";
43
- }
44
- return css`
45
- background-color: ${backgroundColor};
46
- color: ${color};
47
- ::before {
48
- font-size: ${params?.iconDimensions}px;
49
- }
50
- `;
51
- }
52
- export function getColorsForInitials(darkBackground) {
53
- return {
54
- textColor: darkBackground ? "colorsUtilityYang100" : "colorsUtilityYin055",
55
- bgColor: darkBackground ? "colorsUtilityMajor400" : "colorsUtilityMajor025"
56
- };
57
- }
6
+ import profileConfigSizes from "../profile/profile.config";
58
7
  export const StyledPortraitInitials = styled.div`
59
- display: inline-block;
60
- vertical-align: middle;
61
- box-sizing: border-box;
62
- ${stylingForSize}
63
- ${stylingForShape}
64
- outline: 1px solid var(--colorsUtilityMajor200);
65
- /* Styling for safari. This ensures that there is no outline on the component but that a border is still present
66
- to achieve the same styling as Chrome and Firefox */
67
- @media not all and (min-resolution: 0.001dpcm) {
68
- @supports (-webkit-appearance: none) and (stroke-color: transparent) {
69
- border: 1px solid var(--colorsUtilityMajor200);
70
- outline: none;
71
- }
72
- }
73
- `;
74
- export const StyledPortraitInitialsImg = styled.img`
75
- display: block;
8
+ font-weight: bold;
9
+ font-size: ${({
10
+ size
11
+ }) => profileConfigSizes[size].initialSize};
12
+ display: flex;
13
+ white-space: nowrap;
14
+ align-items: center;
15
+ justify-content: center;
16
+ height: inherit;
17
+ width: inherit;
76
18
  `;
77
19
  export const StyledPortraitGravatar = styled.img`
78
- display: inline-block;
79
- vertical-align: middle;
80
- ${stylingForSize}
81
- ${stylingForShape}
20
+ height: inherit;
21
+ width: inherit;
82
22
  `;
83
23
  export const StyledCustomImg = styled.img`
84
- display: block;
85
- ${stylingForSize}
86
- ${stylingForShape}
24
+ height: inherit;
25
+ width: inherit;
87
26
  `;
88
27
 
89
28
  // && is used here to increase the specificity
90
29
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
91
30
  export const StyledIcon = styled(Icon)`
92
31
  && {
93
- box-sizing: border-box;
94
- line-height: 14px;
95
- ${stylingForSize}
96
- ${stylingForIcon}
97
- ${stylingForShape}
98
- border: 1px dashed ${({
99
- darkBackground
100
- }) => darkBackground ? "var(--colorsUtilityMajorTransparent)" : "var(--colorsUtilityMajor200)"};
32
+ color: inherit;
33
+ height: inherit;
34
+ width: inherit;
35
+
36
+ ::before {
37
+ font-size: ${({
38
+ size
39
+ }) => PORTRAIT_SIZE_PARAMS[size].iconDimensions}px;
40
+ }
101
41
  }
102
42
  `;
103
43
  export const StyledPortraitContainer = styled.div`
44
+ color: ${({
45
+ darkBackground
46
+ }) => darkBackground ? "var(--colorsUtilityReadOnly600)" : "var(--colorsUtilityYin090)"};
47
+ background-color: ${({
48
+ darkBackground
49
+ }) => darkBackground ? "var(--colorsUtilityYin090)" : "var(--colorsUtilityReadOnly400)"};
50
+ width: ${({
51
+ size
52
+ }) => PORTRAIT_SIZE_PARAMS[size].dimensions}px;
53
+ height: ${({
54
+ size
55
+ }) => PORTRAIT_SIZE_PARAMS[size].dimensions}px;
56
+ overflow: hidden;
57
+ border-radius: ${({
58
+ shape
59
+ }) => shape === "square" ? "0px" : "var(--borderRadiusCircle)"};
60
+ border: 1px solid var(--colorsUtilityReadOnly600);
104
61
  display: inline-block;
105
62
  ${({
106
63
  onClick
@@ -5,14 +5,20 @@ export interface ProfileProps {
5
5
  className?: string;
6
6
  /** Custom source URL */
7
7
  src?: string;
8
+ /** The `alt` HTML string. */
9
+ alt?: string;
8
10
  /** Define the name to display. */
9
- name: string;
11
+ name?: string;
10
12
  /** Define the email to use (will check Gravatar for image). */
11
- email: string;
13
+ email?: string;
14
+ /** Define read-only text to display. */
15
+ text?: string;
12
16
  /** Define initials to display if there is no Gravatar image. */
13
17
  initials?: string;
14
18
  /** Allow to setup size for the component */
15
19
  size?: ProfileSize;
20
+ /** Use a dark background. */
21
+ darkBackground?: boolean;
16
22
  }
17
- export declare const Profile: ({ src, className, initials, name, size, email, ...props }: ProfileProps) => React.JSX.Element;
23
+ export declare const Profile: ({ src, alt, className, initials, name, size, email, text, darkBackground, ...props }: ProfileProps) => React.JSX.Element;
18
24
  export default Profile;
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
2
2
  import React from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
5
- import { ProfileStyle, ProfileNameStyle, ProfileDetailsStyle, ProfileAvatarStyle, ProfileEmailStyle } from "./profile.style";
5
+ import { ProfileStyle, ProfileNameStyle, ProfileDetailsStyle, ProfileAvatarStyle, ProfileEmailStyle, ProfileTextStyle } from "./profile.style";
6
6
  import { filterStyledSystemMarginProps } from "../../style/utils";
7
7
  function acronymize(str) {
8
8
  if (!str) return "";
@@ -10,51 +10,68 @@ function acronymize(str) {
10
10
  if (!matches) return "";
11
11
  return matches.join("");
12
12
  }
13
+ let useOfNoNameWarnTriggered = false;
13
14
  export const Profile = ({
14
15
  src,
16
+ alt,
15
17
  className,
16
18
  initials,
17
19
  name,
18
20
  size,
19
21
  email,
22
+ text,
23
+ darkBackground,
20
24
  ...props
21
25
  }) => {
22
26
  const getInitials = () => {
23
27
  if (initials) return initials;
24
- return acronymize(name);
28
+ return acronymize(name).slice(0, 3).toUpperCase();
29
+ };
30
+ const commonAvatarProps = {
31
+ darkBackground,
32
+ alt,
33
+ name,
34
+ initials: getInitials(),
35
+ size
25
36
  };
26
37
  const avatar = () => {
27
38
  if (src) {
28
- return /*#__PURE__*/React.createElement(ProfileAvatarStyle, {
39
+ return /*#__PURE__*/React.createElement(ProfileAvatarStyle, _extends({
29
40
  src: src,
30
- alt: getInitials(),
31
- initials: getInitials(),
32
- size: size,
33
- shape: "circle",
34
41
  "data-element": "user-image"
35
- });
42
+ }, commonAvatarProps));
36
43
  }
37
- return /*#__PURE__*/React.createElement(ProfileAvatarStyle, {
38
- initials: getInitials(),
39
- gravatar: email,
40
- size: size
41
- });
44
+ return /*#__PURE__*/React.createElement(ProfileAvatarStyle, _extends({
45
+ gravatar: email
46
+ }, commonAvatarProps));
42
47
  };
43
- const text = () => {
44
- return /*#__PURE__*/React.createElement(ProfileDetailsStyle, {
48
+ if (!useOfNoNameWarnTriggered && !name && (email || text)) {
49
+ useOfNoNameWarnTriggered = true;
50
+ console.warn("[WARNING] The `email` or `text` prop should not be used without the `name` prop in `Profile`." + " Please use the `name` prop as well as `email` or `text`.");
51
+ }
52
+ const children = () => {
53
+ if (name) return /*#__PURE__*/React.createElement(ProfileDetailsStyle, {
45
54
  size: size,
46
- hasSrc: !!src
55
+ hasSrc: !!src,
56
+ "data-element": "details"
47
57
  }, /*#__PURE__*/React.createElement(ProfileNameStyle, {
48
58
  size: size,
49
59
  "data-element": "name"
50
60
  }, name), /*#__PURE__*/React.createElement(ProfileEmailStyle, {
61
+ href: `mailto: ${email}`,
51
62
  size: size,
63
+ darkBackground: darkBackground,
52
64
  "data-element": "email"
53
- }, email));
65
+ }, email), /*#__PURE__*/React.createElement(ProfileTextStyle, {
66
+ size: size,
67
+ "data-element": "text"
68
+ }, text));
69
+ return null;
54
70
  };
55
71
  return /*#__PURE__*/React.createElement(ProfileStyle, _extends({
56
72
  className: className,
57
- hasSrc: !!src
58
- }, tagComponent("profile", props), filterStyledSystemMarginProps(props)), avatar(), text());
73
+ hasSrc: !!src,
74
+ darkBackground: darkBackground
75
+ }, tagComponent("profile", props), filterStyledSystemMarginProps(props)), avatar(), children());
59
76
  };
60
77
  export default Profile;
@@ -3,53 +3,53 @@ declare type AllProfileSizes = typeof PROFILE_SIZES;
3
3
  export declare type ProfileSize = AllProfileSizes[number];
4
4
  declare const _default: {
5
5
  XS: {
6
+ initialSize: string;
6
7
  nameSize: string;
7
8
  emailSize: string;
8
9
  lineHeight: string;
9
10
  marginLeft: string;
10
- marginTop: string;
11
11
  };
12
12
  S: {
13
+ initialSize: string;
13
14
  nameSize: string;
14
15
  emailSize: string;
15
16
  lineHeight: string;
16
17
  marginLeft: string;
17
- marginTop: string;
18
18
  };
19
19
  M: {
20
+ initialSize: string;
20
21
  nameSize: string;
21
22
  emailSize: string;
22
23
  lineHeight: string;
23
24
  marginLeft: string;
24
- marginTop: string;
25
25
  };
26
26
  ML: {
27
+ initialSize: string;
27
28
  nameSize: string;
28
29
  emailSize: string;
29
30
  lineHeight: string;
30
31
  marginLeft: string;
31
- marginTop: string;
32
32
  };
33
33
  L: {
34
+ initialSize: string;
34
35
  nameSize: string;
35
36
  emailSize: string;
36
37
  lineHeight: string;
37
38
  marginLeft: string;
38
- marginTop: string;
39
39
  };
40
40
  XL: {
41
+ initialSize: string;
41
42
  nameSize: string;
42
43
  emailSize: string;
43
44
  lineHeight: string;
44
45
  marginLeft: string;
45
- marginTop: string;
46
46
  };
47
47
  XXL: {
48
+ initialSize: string;
48
49
  nameSize: string;
49
50
  emailSize: string;
50
51
  lineHeight: string;
51
52
  marginLeft: string;
52
- marginTop: string;
53
53
  };
54
54
  };
55
55
  export default _default;
@@ -1,52 +1,52 @@
1
1
  export const PROFILE_SIZES = ["XS", "S", "M", "ML", "L", "XL", "XXL"];
2
2
  export default {
3
3
  XS: {
4
+ initialSize: "var(--fontSizes050)",
4
5
  nameSize: "var(--fontSizes050)",
5
6
  emailSize: "var(--fontSizes025)",
6
7
  lineHeight: "12px",
7
- marginLeft: "16px",
8
- marginTop: "1px"
8
+ marginLeft: "16px"
9
9
  },
10
10
  S: {
11
+ initialSize: "var(--fontSizes100)",
11
12
  nameSize: "var(--fontSizes100)",
12
13
  emailSize: "var(--fontSizes100)",
13
14
  lineHeight: "16px",
14
- marginLeft: "16px",
15
- marginTop: "1px"
15
+ marginLeft: "16px"
16
16
  },
17
17
  M: {
18
+ initialSize: "var(--fontSizes300)",
18
19
  nameSize: "var(--fontSizes100)",
19
20
  emailSize: "var(--fontSizes100)",
20
21
  lineHeight: "16px",
21
- marginLeft: "16px",
22
- marginTop: "4px"
22
+ marginLeft: "16px"
23
23
  },
24
24
  ML: {
25
+ initialSize: "var(--fontSizes600)",
25
26
  nameSize: "var(--fontSizes200)",
26
27
  emailSize: "var(--fontSizes100)",
27
28
  lineHeight: "20px",
28
- marginLeft: "24px",
29
- marginTop: "8px"
29
+ marginLeft: "24px"
30
30
  },
31
31
  L: {
32
+ initialSize: "var(--fontSizes700)",
32
33
  nameSize: "var(--fontSizes400)",
33
34
  emailSize: "var(--fontSizes100)",
34
35
  lineHeight: "22px",
35
- marginLeft: "24px",
36
- marginTop: "14px"
36
+ marginLeft: "24px"
37
37
  },
38
38
  XL: {
39
+ initialSize: "var(--fontSizes900)",
39
40
  nameSize: "var(--fontSizes600)",
40
41
  emailSize: "var(--fontSizes300)",
41
42
  lineHeight: "26px",
42
- marginLeft: "32px",
43
- marginTop: "24px"
43
+ marginLeft: "32px"
44
44
  },
45
45
  XXL: {
46
+ initialSize: "var(--fontSizes1000)",
46
47
  nameSize: "var(--fontSizes700)",
47
48
  emailSize: "var(--fontSizes600)",
48
49
  lineHeight: "30px",
49
- marginLeft: "40px",
50
- marginTop: "32px"
50
+ marginLeft: "40px"
51
51
  }
52
52
  };
@@ -1,16 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  import { ProfileSize } from "./profile.config";
3
- interface ProfileSizeProps {
3
+ interface ProfileSProps {
4
4
  size?: ProfileSize;
5
+ hasSrc?: boolean;
6
+ darkBackground?: boolean;
5
7
  }
6
- interface ProfileHasSrcProps {
7
- hasSrc: boolean;
8
- }
9
- interface ProfileDetailsStyleProps extends ProfileSizeProps, ProfileHasSrcProps {
10
- }
11
- declare const ProfileNameStyle: import("styled-components").StyledComponent<"span", any, ProfileSizeProps, never>;
12
- declare const ProfileEmailStyle: import("styled-components").StyledComponent<"span", any, ProfileSizeProps, never>;
13
- declare const ProfileStyle: import("styled-components").StyledComponent<"div", any, ProfileHasSrcProps, never>;
14
- declare const ProfileDetailsStyle: import("styled-components").StyledComponent<"div", any, ProfileDetailsStyleProps, 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) => import("react").JSX.Element, any, {}, never>;
16
- export { ProfileStyle, ProfileNameStyle, ProfileDetailsStyle, ProfileAvatarStyle, ProfileEmailStyle, };
8
+ declare const ProfileNameStyle: import("styled-components").StyledComponent<"span", any, ProfileSProps, never>;
9
+ declare const ProfileEmailStyle: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../link").LinkProps & import("react").RefAttributes<HTMLButtonElement | HTMLLinkElement>>, any, Pick<ProfileSProps, "size" | "darkBackground">, never>;
10
+ declare const ProfileTextStyle: import("styled-components").StyledComponent<"span", any, ProfileSProps, never>;
11
+ declare const ProfileStyle: import("styled-components").StyledComponent<"div", any, Pick<ProfileSProps, "darkBackground" | "hasSrc">, never>;
12
+ declare const ProfileDetailsStyle: import("styled-components").StyledComponent<"div", any, Pick<ProfileSProps, "size" | "hasSrc">, never>;
13
+ declare const ProfileAvatarStyle: import("styled-components").StyledComponent<({ alt, name, darkBackground, gravatar, iconType, initials, shape, size, src, onClick, tooltipMessage, tooltipId, tooltipIsVisible, tooltipPosition, tooltipType, tooltipSize, tooltipBgColor, tooltipFontColor, ...rest }: import("../portrait").PortraitProps) => import("react").JSX.Element, any, {}, never>;
14
+ export { ProfileStyle, ProfileNameStyle, ProfileDetailsStyle, ProfileAvatarStyle, ProfileEmailStyle, ProfileTextStyle, };