@jobber/components 9.10.3 → 9.10.4

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.
@@ -28,6 +28,10 @@ interface AvatarFoundationProps {
28
28
  * @default "base"
29
29
  */
30
30
  readonly size?: AvatarSize;
31
+ /**
32
+ * A reference to the element in the rendered output
33
+ */
34
+ readonly testID?: string;
31
35
  /**
32
36
  * **Use at your own risk:** Custom class names for specific elements. This should only be used as a
33
37
  * **last resort**. Using this may result in unexpected side effects.
@@ -52,7 +56,7 @@ interface AvatarWithInitialsProps extends AvatarFoundationProps {
52
56
  readonly initials: string;
53
57
  }
54
58
  export type AvatarProps = XOR<AvatarWithImageProps, AvatarWithInitialsProps>;
55
- export declare function Avatar({ imageUrl, name, initials, size, color, UNSAFE_className, UNSAFE_style, }: AvatarProps): React.JSX.Element;
59
+ export declare function Avatar({ imageUrl, name, initials, size, color, testID, UNSAFE_className, UNSAFE_style, }: AvatarProps): React.JSX.Element;
56
60
  interface InitialsUnsafeClassNameProps {
57
61
  initials?: string;
58
62
  fallbackIcon?: IconProps["UNSAFE_className"];
@@ -42,7 +42,7 @@ function deconstructCssCustomProperty(color) {
42
42
  }
43
43
 
44
44
  const MAX_VISIBLE_INITIALS = 3;
45
- function Avatar({ imageUrl, name, initials, size = "base", color, UNSAFE_className = {}, UNSAFE_style = {}, }) {
45
+ function Avatar({ imageUrl, name, initials, size = "base", color, testID, UNSAFE_className = {}, UNSAFE_style = {}, }) {
46
46
  const style = Object.assign({ backgroundColor: color, borderColor: color }, UNSAFE_style.container);
47
47
  if (imageUrl) {
48
48
  style.backgroundImage = `url(${imageUrl})`;
@@ -60,7 +60,7 @@ function Avatar({ imageUrl, name, initials, size = "base", color, UNSAFE_classNa
60
60
  : "text"
61
61
  : "textReverse";
62
62
  const containerClassNames = classnames(className, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.container);
63
- return (React.createElement("div", { className: containerClassNames, style: style, role: imageUrl && "img", "aria-label": name }, !imageUrl && (React.createElement(Initials, { initials: initials, iconColor: iconColor, iconSize: size, UNSAFE_className: {
63
+ return (React.createElement("div", { className: containerClassNames, style: style, role: imageUrl && "img", "aria-label": name, "data-testid": testID }, !imageUrl && (React.createElement(Initials, { initials: initials, iconColor: iconColor, iconSize: size, UNSAFE_className: {
64
64
  initials: UNSAFE_className.initials,
65
65
  fallbackIcon: UNSAFE_className.fallbackIcon,
66
66
  }, UNSAFE_style: {
package/dist/Avatar-es.js CHANGED
@@ -40,7 +40,7 @@ function deconstructCssCustomProperty(color) {
40
40
  }
41
41
 
42
42
  const MAX_VISIBLE_INITIALS = 3;
43
- function Avatar({ imageUrl, name, initials, size = "base", color, UNSAFE_className = {}, UNSAFE_style = {}, }) {
43
+ function Avatar({ imageUrl, name, initials, size = "base", color, testID, UNSAFE_className = {}, UNSAFE_style = {}, }) {
44
44
  const style = Object.assign({ backgroundColor: color, borderColor: color }, UNSAFE_style.container);
45
45
  if (imageUrl) {
46
46
  style.backgroundImage = `url(${imageUrl})`;
@@ -58,7 +58,7 @@ function Avatar({ imageUrl, name, initials, size = "base", color, UNSAFE_classNa
58
58
  : "text"
59
59
  : "textReverse";
60
60
  const containerClassNames = classnames(className, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.container);
61
- return (React__default.createElement("div", { className: containerClassNames, style: style, role: imageUrl && "img", "aria-label": name }, !imageUrl && (React__default.createElement(Initials, { initials: initials, iconColor: iconColor, iconSize: size, UNSAFE_className: {
61
+ return (React__default.createElement("div", { className: containerClassNames, style: style, role: imageUrl && "img", "aria-label": name, "data-testid": testID }, !imageUrl && (React__default.createElement(Initials, { initials: initials, iconColor: iconColor, iconSize: size, UNSAFE_className: {
62
62
  initials: UNSAFE_className.initials,
63
63
  fallbackIcon: UNSAFE_className.fallbackIcon,
64
64
  }, UNSAFE_style: {
@@ -143,5 +143,6 @@ Use `UNSAFE_style` to apply inline custom styles to the Avatar component.
143
143
  | `initials` | `string` | No | — | The initials that will be displayed if no image is set.\ |
144
144
  | `name` | `string` | No | — | A users name to be used for assistive technology |
145
145
  | `size` | `AvatarSize` | No | `base` | Change the size of the avatar @property "large" - Make avatar to be the focal point @property "small" - For higher-de... |
146
+ | `testID` | `string` | No | — | A reference to the element in the rendered output |
146
147
  | `UNSAFE_className` | `{ container?: string; } & InitialsUnsafeClassNameProps` | No | `{}` | **Use at your own risk:** Custom class names for specific elements. This should only be used as a **last resort**. Us... |
147
148
  | `UNSAFE_style` | `{ container?: CSSProperties; } & InitialsUnsafeStyleProps` | No | `{}` | **Use at your own risk:** Custom style for specific elements. This should only be used as a **last resort**. Using th... |
@@ -23,3 +23,4 @@ avatar. You can read more about `getUploadParams` in the
23
23
  | `name` | `string` | No | — | A users name to be used for assistive technology |
24
24
  | `onChange` | `(file?: FileUpload) => void` | No | — | Triggered when an image is changed. |
25
25
  | `onUploadComplete` | `(file?: FileUpload) => void` | No | — | Triggered when an image upload has completed. |
26
+ | `testID` | `string` | No | — | A reference to the element in the rendered output |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "9.10.3",
3
+ "version": "9.10.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -549,5 +549,5 @@
549
549
  "> 1%",
550
550
  "IE 10"
551
551
  ],
552
- "gitHead": "a39de5621289f06a4d21d021130ff191937cd851"
552
+ "gitHead": "de19112ccd7ce171f0ee64af0fa4043d040ace45"
553
553
  }