@connectycube/react-ui-kit 0.0.10 → 0.0.12
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.
|
@@ -2,7 +2,9 @@ import { LoaderCircle } from 'lucide-react';
|
|
|
2
2
|
import { cn } from './utils';
|
|
3
3
|
|
|
4
4
|
function AnimatedLoader({ loading = true, className }) {
|
|
5
|
-
return loading ?
|
|
5
|
+
return loading ? (
|
|
6
|
+
<LoaderCircle strokeWidth={3} className={cn('animate-spin mx-auto text-gray-600', className)} />
|
|
7
|
+
) : null;
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
AnimatedLoader.displayName = 'AnimatedLoader';
|
|
@@ -22,7 +22,7 @@ function AvatarBase(
|
|
|
22
22
|
{online && (
|
|
23
23
|
<div className={cn('rounded-full border-2 bg-green-600 border-green-200 size-3.5', onlineClassName)} />
|
|
24
24
|
)}
|
|
25
|
-
<PresenceBadge
|
|
25
|
+
<PresenceBadge status={presence} className={cn('absolute -bottom-0.5 -right-1', presenceClassName)} />
|
|
26
26
|
</AvatarPrimitive.Root>
|
|
27
27
|
);
|
|
28
28
|
}
|
|
@@ -2,8 +2,8 @@ import { memo } from 'react';
|
|
|
2
2
|
import { CircleCheck, CircleMinus, CircleQuestionMark, Clock } from 'lucide-react';
|
|
3
3
|
import { capitalize, cn, UserPresence } from './utils';
|
|
4
4
|
|
|
5
|
-
function PresenceBadgeBase({
|
|
6
|
-
switch (
|
|
5
|
+
function PresenceBadgeBase({ status, className, ...props }) {
|
|
6
|
+
switch (status) {
|
|
7
7
|
case UserPresence.AVAILABLE || 'available':
|
|
8
8
|
return <CircleCheck className={cn('rounded-full text-white bg-green-600 size-4.5', className)} {...props} />;
|
|
9
9
|
case UserPresence.BUSY || 'busy':
|
|
@@ -23,13 +23,13 @@ const PresenceBadge = memo(PresenceBadgeBase);
|
|
|
23
23
|
|
|
24
24
|
PresenceBadge.displayName = 'PresenceBadge';
|
|
25
25
|
|
|
26
|
-
function PresenceBase({ badge = true,
|
|
27
|
-
const
|
|
26
|
+
function PresenceBase({ badge = true, status, label, className, ...props }) {
|
|
27
|
+
const presence = capitalize(label || status);
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
30
|
<div className={cn('flex items-center gap-2', className)} {...props}>
|
|
31
|
-
{badge && <PresenceBadge
|
|
32
|
-
<span>{
|
|
31
|
+
{badge && <PresenceBadge status={status} />}
|
|
32
|
+
<span>{presence}</span>
|
|
33
33
|
</div>
|
|
34
34
|
);
|
|
35
35
|
}
|
package/package.json
CHANGED
|
@@ -7,7 +7,9 @@ interface AnimatedLoaderProps extends LucideProps {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function AnimatedLoader({ loading = true, className }: AnimatedLoaderProps) {
|
|
10
|
-
return loading ?
|
|
10
|
+
return loading ? (
|
|
11
|
+
<LoaderCircle strokeWidth={3} className={cn('animate-spin mx-auto text-gray-600', className)} />
|
|
12
|
+
) : null;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
AnimatedLoader.displayName = 'AnimatedLoader';
|
|
@@ -33,7 +33,7 @@ function AvatarBase(
|
|
|
33
33
|
{online && (
|
|
34
34
|
<div className={cn('rounded-full border-2 bg-green-600 border-green-200 size-3.5', onlineClassName)} />
|
|
35
35
|
)}
|
|
36
|
-
<PresenceBadge
|
|
36
|
+
<PresenceBadge status={presence} className={cn('absolute -bottom-0.5 -right-1', presenceClassName)} />
|
|
37
37
|
</AvatarPrimitive.Root>
|
|
38
38
|
);
|
|
39
39
|
}
|
|
@@ -7,17 +7,17 @@ import { capitalize, cn, UserPresence } from './utils';
|
|
|
7
7
|
type PresenceStatus = UserPresence | 'available' | 'busy' | 'away' | 'unknown' | undefined;
|
|
8
8
|
|
|
9
9
|
interface PresenceBadgeProps extends LucideProps {
|
|
10
|
-
|
|
10
|
+
status: PresenceStatus;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
interface PresenceProps extends React.ComponentProps<'div'> {
|
|
14
14
|
badge?: boolean;
|
|
15
|
-
|
|
15
|
+
status: PresenceStatus;
|
|
16
16
|
label: string;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
function PresenceBadgeBase({
|
|
20
|
-
switch (
|
|
19
|
+
function PresenceBadgeBase({ status, className, ...props }: PresenceBadgeProps) {
|
|
20
|
+
switch (status) {
|
|
21
21
|
case UserPresence.AVAILABLE || 'available':
|
|
22
22
|
return <CircleCheck className={cn('rounded-full text-white bg-green-600 size-4.5', className)} {...props} />;
|
|
23
23
|
case UserPresence.BUSY || 'busy':
|
|
@@ -37,13 +37,13 @@ const PresenceBadge = memo(PresenceBadgeBase);
|
|
|
37
37
|
|
|
38
38
|
PresenceBadge.displayName = 'PresenceBadge';
|
|
39
39
|
|
|
40
|
-
function PresenceBase({ badge = true,
|
|
41
|
-
const
|
|
40
|
+
function PresenceBase({ badge = true, status, label, className, ...props }: PresenceProps) {
|
|
41
|
+
const presence = capitalize(label || status);
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
44
|
<div className={cn('flex items-center gap-2', className)} {...props}>
|
|
45
|
-
{badge && <PresenceBadge
|
|
46
|
-
<span>{
|
|
45
|
+
{badge && <PresenceBadge status={status} />}
|
|
46
|
+
<span>{presence}</span>
|
|
47
47
|
</div>
|
|
48
48
|
);
|
|
49
49
|
}
|