@agility/plenum-ui 2.1.20-rc8 → 2.1.21

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.
@@ -20,6 +20,7 @@ export interface IAvatarProps {
20
20
  * avatar img alt
21
21
  */
22
22
  alt?: string;
23
+ draggable?: boolean;
23
24
  }
24
25
  /**
25
26
  * Avatar component that shows profile image or name initials of the user
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agility/plenum-ui",
3
- "version": "2.1.20-rc8",
3
+ "version": "2.1.21",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -1,33 +1,41 @@
1
- import React, { FC, useMemo } from "react"
2
- import { default as cn } from "classnames"
1
+ import React, { FC, useMemo } from "react";
2
+ import { default as cn } from "classnames";
3
3
  // import Image from "next/image"
4
4
  export interface IAvatarProps {
5
5
  /**
6
6
  * source url for the avatar
7
7
  */
8
- src?: string
8
+ src?: string;
9
9
  /**
10
10
  * Initials we use as fallback if no src is passed
11
11
  */
12
- initials?: string
12
+ initials?: string;
13
13
  /**
14
14
  * optional status
15
15
  */
16
- status?: "offline" | "online" | "busy"
16
+ status?: "offline" | "online" | "busy";
17
17
  /**
18
18
  * avatar picture size (also affects status indicator)
19
19
  */
20
- size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl"
20
+ size?: "xxs" | "xs" | "sm" | "md" | "lg" | "xl";
21
21
  /**
22
22
  * avatar img alt
23
23
  */
24
- alt?: string
24
+ alt?: string;
25
+ draggable?: boolean;
25
26
  }
26
27
 
27
28
  /**
28
29
  * Avatar component that shows profile image or name initials of the user
29
30
  */
30
- const Avatar: FC<IAvatarProps> = ({ src, status, size = "md", alt = "Avatar image", initials }: IAvatarProps) => {
31
+ const Avatar: FC<IAvatarProps> = ({
32
+ src,
33
+ status,
34
+ size = "md",
35
+ alt = "Avatar image",
36
+ initials,
37
+ draggable = false
38
+ }: IAvatarProps) => {
31
39
  const imageStyles = cn("rounded-full", {
32
40
  "h-6 w-6": size === "xxs",
33
41
  "h-8 w-8": size === "xs",
@@ -35,7 +43,7 @@ const Avatar: FC<IAvatarProps> = ({ src, status, size = "md", alt = "Avatar imag
35
43
  "h-12 w-12": size === "md",
36
44
  "h-14 w-14": size === "lg",
37
45
  "h-16 w-16": size === "xl"
38
- })
46
+ });
39
47
  const initialsStyles = cn("inline-flex items-center justify-center rounded-full bg-gray-500", {
40
48
  "h-6 w-6": size === "xxs",
41
49
  "h-8 w-8": size === "xs",
@@ -43,14 +51,14 @@ const Avatar: FC<IAvatarProps> = ({ src, status, size = "md", alt = "Avatar imag
43
51
  "h-12 w-12": size === "md",
44
52
  "h-14 w-14": size === "lg",
45
53
  "h-16 w-16": size === "xl"
46
- })
54
+ });
47
55
  const fontStyles = cn(" leading-none text-white uppercase", {
48
56
  "text-xs": size === "xxs" || size === "xs",
49
57
  "text-sm": size === "sm",
50
58
  "text-base": size === "md",
51
59
  "text-lg": size === "lg",
52
60
  "text-xl": size === "xl"
53
- })
61
+ });
54
62
  const defaultAvatarStyles = cn("inline-block rounded-full overflow-hidden bg-gray-100", {
55
63
  "h-6 w-6": size === "xxs",
56
64
  "h-8 w-8": size === "xs",
@@ -58,7 +66,7 @@ const Avatar: FC<IAvatarProps> = ({ src, status, size = "md", alt = "Avatar imag
58
66
  "h-12 w-12": size === "md",
59
67
  "h-14 w-14": size === "lg",
60
68
  "h-16 w-16": size === "xl"
61
- })
69
+ });
62
70
 
63
71
  const statusStyles = cn("absolute top-0 right-0 block rounded-full ring-2 ring-white", {
64
72
  "h-1.5 w-1.5": size === "xxs",
@@ -70,40 +78,48 @@ const Avatar: FC<IAvatarProps> = ({ src, status, size = "md", alt = "Avatar imag
70
78
  "bg-gray-300": status === "offline",
71
79
  "bg-red-400": status === "busy",
72
80
  "bg-green-400": status === "online"
73
- })
81
+ });
74
82
  const imageSize: number = useMemo(() => {
75
- let imageSize: number = 0
83
+ let imageSize: number = 0;
76
84
  switch (size) {
77
85
  case "xxs":
78
- imageSize = 24
79
- break
86
+ imageSize = 24;
87
+ break;
80
88
  case "xs":
81
- imageSize = 32
82
- break
89
+ imageSize = 32;
90
+ break;
83
91
  case "sm":
84
- imageSize = 40
85
- break
92
+ imageSize = 40;
93
+ break;
86
94
  case "md":
87
- imageSize = 48
88
- break
95
+ imageSize = 48;
96
+ break;
89
97
  case "lg":
90
- imageSize = 56
91
- break
98
+ imageSize = 56;
99
+ break;
92
100
  case "xl":
93
- imageSize = 64
94
- break
101
+ imageSize = 64;
102
+ break;
95
103
  default:
96
- imageSize = 48
97
- break
104
+ imageSize = 48;
105
+ break;
98
106
  }
99
- return imageSize
100
- }, [size])
107
+ return imageSize;
108
+ }, [size]);
101
109
 
102
110
  return (
103
111
  <span className="inline-block relative">
104
112
  {src ? (
105
113
  // eslint-disable-next-line @next/next/no-img-element
106
- <img className={imageStyles} width={imageSize} height={imageSize} src={src} alt={alt} loading="eager" />
114
+ <img
115
+ className={imageStyles}
116
+ width={imageSize}
117
+ height={imageSize}
118
+ src={src}
119
+ alt={alt}
120
+ loading="eager"
121
+ draggable={draggable}
122
+ />
107
123
  ) : initials ? (
108
124
  <span className={initialsStyles}>
109
125
  <span className={fontStyles}>{initials}</span>
@@ -117,7 +133,7 @@ const Avatar: FC<IAvatarProps> = ({ src, status, size = "md", alt = "Avatar imag
117
133
  )}
118
134
  {status && <span className={statusStyles}></span>}
119
135
  </span>
120
- )
121
- }
136
+ );
137
+ };
122
138
 
123
- export default Avatar
139
+ export default Avatar;
@@ -41,10 +41,13 @@ const InputLabel: FC<IInputLabelProps> = ({
41
41
  { "inline-block transition-all text-sm text-gray-700 mb-1": !isPlaceholder },
42
42
  { "block w-full": fullWidthLabel }
43
43
  );
44
+
44
45
  if (!label) return null;
45
46
  return (
46
47
  <label htmlFor={id} className={labelStyles}>
47
- <div className={truncateLabel ? "break-all line-clamp-1" : ""}>{label}</div>
48
+ <div className={truncateLabel ? "break-all line-clamp-1" : ""} title={label}>
49
+ {label}
50
+ </div>
48
51
  {isRequired && <span className="text-red-500"> *</span>}
49
52
  </label>
50
53
  );