@jobber/components 6.34.0 → 6.35.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.
@@ -1,4 +1,6 @@
1
+ import { CSSProperties } from "react";
1
2
  import { XOR } from "ts-xor";
3
+ import { IconProps } from "../Icon";
2
4
  type AvatarSize = "base" | "large" | "small";
3
5
  interface AvatarFoundationProps {
4
6
  /**
@@ -25,6 +27,22 @@ interface AvatarFoundationProps {
25
27
  * @default "base"
26
28
  */
27
29
  readonly size?: AvatarSize;
30
+ /**
31
+ * **Use at your own risk:** Custom class names for specific elements. This should only be used as a
32
+ * **last resort**. Using this may result in unexpected side effects.
33
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
34
+ */
35
+ readonly UNSAFE_className?: {
36
+ container?: string;
37
+ } & InitialsUnsafeClassNameProps;
38
+ /**
39
+ * **Use at your own risk:** Custom style for specific elements. This should only be used as a
40
+ * **last resort**. Using this may result in unexpected side effects.
41
+ * More information in the [Customizing components Guide](https://atlantis.getjobber.com/guides/customizing-components).
42
+ */
43
+ readonly UNSAFE_style?: {
44
+ container?: CSSProperties;
45
+ } & InitialsUnsafeStyleProps;
28
46
  }
29
47
  interface AvatarWithImageProps extends AvatarFoundationProps {
30
48
  readonly imageUrl: string;
@@ -33,5 +51,13 @@ interface AvatarWithInitialsProps extends AvatarFoundationProps {
33
51
  readonly initials: string;
34
52
  }
35
53
  export type AvatarProps = XOR<AvatarWithImageProps, AvatarWithInitialsProps>;
36
- export declare function Avatar({ imageUrl, name, initials, size, color, }: AvatarProps): JSX.Element;
54
+ export declare function Avatar({ imageUrl, name, initials, size, color, UNSAFE_className, UNSAFE_style, }: AvatarProps): JSX.Element;
55
+ interface InitialsUnsafeClassNameProps {
56
+ initials?: string;
57
+ fallbackIcon?: IconProps["UNSAFE_className"];
58
+ }
59
+ interface InitialsUnsafeStyleProps {
60
+ initials?: CSSProperties;
61
+ fallbackIcon?: IconProps["UNSAFE_style"];
62
+ }
37
63
  export {};
@@ -41,11 +41,8 @@ function deconstructCssCustomProperty(color) {
41
41
  .trim();
42
42
  }
43
43
 
44
- function Avatar({ imageUrl, name, initials, size = "base", color, }) {
45
- const style = {
46
- backgroundColor: color,
47
- borderColor: color,
48
- };
44
+ function Avatar({ imageUrl, name, initials, size = "base", color, UNSAFE_className = {}, UNSAFE_style = {}, }) {
45
+ const style = Object.assign({ backgroundColor: color, borderColor: color }, UNSAFE_style.container);
49
46
  if (imageUrl) {
50
47
  style.backgroundImage = `url(${imageUrl})`;
51
48
  }
@@ -54,16 +51,23 @@ function Avatar({ imageUrl, name, initials, size = "base", color, }) {
54
51
  [styles.hasBorder]: imageUrl && color,
55
52
  [styles.isDark]: shouldBeDark,
56
53
  });
57
- return (React.createElement("div", { className: className, style: style, role: imageUrl && "img", "aria-label": name }, !imageUrl && (React.createElement(Initials, { initials: initials, dark: shouldBeDark, iconSize: size }))));
54
+ const containerClassNames = classnames(className, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.container);
55
+ return (React.createElement("div", { className: containerClassNames, style: style, role: imageUrl && "img", "aria-label": name }, !imageUrl && (React.createElement(Initials, { initials: initials, dark: shouldBeDark, iconSize: size, UNSAFE_className: {
56
+ initials: UNSAFE_className.initials,
57
+ fallbackIcon: UNSAFE_className.fallbackIcon,
58
+ }, UNSAFE_style: {
59
+ initials: UNSAFE_style.initials,
60
+ fallbackIcon: UNSAFE_style.fallbackIcon,
61
+ } }))));
58
62
  }
59
- function Initials({ initials, dark = false, iconSize = "base", }) {
63
+ function Initials({ initials, dark = false, iconSize = "base", UNSAFE_className, UNSAFE_style, }) {
60
64
  if (!initials) {
61
- return (React.createElement(Icon.Icon, { name: "person", color: dark ? "white" : "blue", size: iconSize }));
65
+ return (React.createElement(Icon.Icon, { name: "person", color: dark ? "white" : "blue", size: iconSize, UNSAFE_className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.fallbackIcon, UNSAFE_style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.fallbackIcon }));
62
66
  }
63
- const className = classnames(styles.initials, {
67
+ const className = classnames(styles.initials, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.initials, {
64
68
  [styles.smallInitials]: initials.length > 2,
65
69
  });
66
- return React.createElement("span", { className: className }, initials.substr(0, 3));
70
+ return (React.createElement("span", { className: className, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.initials }, initials.substr(0, 3)));
67
71
  }
68
72
 
69
73
  exports.Avatar = Avatar;
package/dist/Avatar-es.js CHANGED
@@ -39,11 +39,8 @@ function deconstructCssCustomProperty(color) {
39
39
  .trim();
40
40
  }
41
41
 
42
- function Avatar({ imageUrl, name, initials, size = "base", color, }) {
43
- const style = {
44
- backgroundColor: color,
45
- borderColor: color,
46
- };
42
+ function Avatar({ imageUrl, name, initials, size = "base", color, UNSAFE_className = {}, UNSAFE_style = {}, }) {
43
+ const style = Object.assign({ backgroundColor: color, borderColor: color }, UNSAFE_style.container);
47
44
  if (imageUrl) {
48
45
  style.backgroundImage = `url(${imageUrl})`;
49
46
  }
@@ -52,16 +49,23 @@ function Avatar({ imageUrl, name, initials, size = "base", color, }) {
52
49
  [styles.hasBorder]: imageUrl && color,
53
50
  [styles.isDark]: shouldBeDark,
54
51
  });
55
- return (React__default.createElement("div", { className: className, style: style, role: imageUrl && "img", "aria-label": name }, !imageUrl && (React__default.createElement(Initials, { initials: initials, dark: shouldBeDark, iconSize: size }))));
52
+ const containerClassNames = classnames(className, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.container);
53
+ return (React__default.createElement("div", { className: containerClassNames, style: style, role: imageUrl && "img", "aria-label": name }, !imageUrl && (React__default.createElement(Initials, { initials: initials, dark: shouldBeDark, iconSize: size, UNSAFE_className: {
54
+ initials: UNSAFE_className.initials,
55
+ fallbackIcon: UNSAFE_className.fallbackIcon,
56
+ }, UNSAFE_style: {
57
+ initials: UNSAFE_style.initials,
58
+ fallbackIcon: UNSAFE_style.fallbackIcon,
59
+ } }))));
56
60
  }
57
- function Initials({ initials, dark = false, iconSize = "base", }) {
61
+ function Initials({ initials, dark = false, iconSize = "base", UNSAFE_className, UNSAFE_style, }) {
58
62
  if (!initials) {
59
- return (React__default.createElement(Icon, { name: "person", color: dark ? "white" : "blue", size: iconSize }));
63
+ return (React__default.createElement(Icon, { name: "person", color: dark ? "white" : "blue", size: iconSize, UNSAFE_className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.fallbackIcon, UNSAFE_style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.fallbackIcon }));
60
64
  }
61
- const className = classnames(styles.initials, {
65
+ const className = classnames(styles.initials, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.initials, {
62
66
  [styles.smallInitials]: initials.length > 2,
63
67
  });
64
- return React__default.createElement("span", { className: className }, initials.substr(0, 3));
68
+ return (React__default.createElement("span", { className: className, style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.initials }, initials.substr(0, 3)));
65
69
  }
66
70
 
67
71
  export { Avatar as A };
@@ -1,6 +1,6 @@
1
1
  import { AvatarProps } from "../Avatar";
2
2
  import { FileUpload, UploadParams } from "../InputFile";
3
- interface InputAvatarProps extends Omit<AvatarProps, "size"> {
3
+ interface InputAvatarProps extends Omit<AvatarProps, "size" | "UNSAFE_className" | "UNSAFE_style"> {
4
4
  /**
5
5
  * A callback that receives a file object and returns a `UploadParams` needed
6
6
  * to upload the file.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "6.34.0",
3
+ "version": "6.35.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -489,5 +489,5 @@
489
489
  "> 1%",
490
490
  "IE 10"
491
491
  ],
492
- "gitHead": "bc019517098495d0b6e42b778b2add0eba541190"
492
+ "gitHead": "47a62437567448c46efe6d2e2ec653b985554c44"
493
493
  }