@connectycube/react-ui-kit 0.0.14 → 0.0.16
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.
- package/configs/dependencies.json +8 -3
- package/configs/imports.json +3 -0
- package/dist/index.cjs +27 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -1
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/components/alert-dialog.d.ts +28 -0
- package/dist/types/components/alert-dialog.d.ts.map +1 -0
- package/dist/types/components/animated-loader.d.ts +10 -0
- package/dist/types/components/animated-loader.d.ts.map +1 -0
- package/dist/types/components/avatar.d.ts +16 -0
- package/dist/types/components/avatar.d.ts.map +1 -0
- package/dist/types/components/button.d.ts +14 -0
- package/dist/types/components/button.d.ts.map +1 -0
- package/dist/types/components/dismiss-layer.d.ts +11 -0
- package/dist/types/components/dismiss-layer.d.ts.map +1 -0
- package/dist/types/components/placeholder-text.d.ts +9 -0
- package/dist/types/components/placeholder-text.d.ts.map +1 -0
- package/dist/types/components/presence.d.ts +22 -0
- package/dist/types/components/presence.d.ts.map +1 -0
- package/dist/types/components/status-indicator.d.ts +20 -0
- package/dist/types/components/status-indicator.d.ts.map +1 -0
- package/dist/types/components/stream-view.d.ts +28 -23
- package/dist/types/components/stream-view.d.ts.map +1 -1
- package/dist/types/components/utils.d.ts +2 -0
- package/dist/types/components/utils.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/index.d.ts.map +1 -1
- package/gen/components/alert-dialog.jsx +92 -0
- package/gen/components/avatar.jsx +8 -8
- package/gen/components/button.jsx +60 -0
- package/gen/components/dismiss-layer.jsx +3 -3
- package/gen/components/placeholder-text.jsx +3 -2
- package/gen/components/presence.jsx +49 -14
- package/gen/components/status-indicator.jsx +14 -21
- package/package.json +21 -16
- package/src/components/alert-dialog.tsx +116 -0
- package/src/components/animated-loader.tsx +1 -2
- package/src/components/avatar.tsx +12 -15
- package/src/components/button.tsx +60 -0
- package/src/components/dismiss-layer.tsx +4 -4
- package/src/components/placeholder-text.tsx +3 -3
- package/src/components/presence.tsx +50 -16
- package/src/components/status-indicator.tsx +22 -37
- package/src/components/stream-view.tsx +1 -2
- package/dist/types/components/connectycube-ui/stream-view.d.ts +0 -26
- package/dist/types/components/connectycube-ui/stream-view.d.ts.map +0 -1
- package/dist/types/components/connectycube-ui/utils.d.ts +0 -4
- package/dist/types/components/connectycube-ui/utils.d.ts.map +0 -1
- package/dist/types/lib/constants.d.ts +0 -5
- package/dist/types/lib/constants.d.ts.map +0 -1
- package/dist/types/lib/utils.d.ts +0 -4
- package/dist/types/lib/utils.d.ts.map +0 -1
- package/dist/types/templates/local-stream.d.ts +0 -22
- package/dist/types/templates/local-stream.d.ts.map +0 -1
- package/dist/types/templates/remote-stream.d.ts +0 -18
- package/dist/types/templates/remote-stream.d.ts.map +0 -1
- package/src/components/connectycube-ui/animated-loader.jsx +0 -10
- package/src/components/connectycube-ui/animated-loader.tsx +0 -15
- package/src/components/connectycube-ui/avatar.jsx +0 -34
- package/src/components/connectycube-ui/avatar.tsx +0 -45
- package/src/components/connectycube-ui/dismiss-layer.jsx +0 -57
- package/src/components/connectycube-ui/dismiss-layer.tsx +0 -74
- package/src/components/connectycube-ui/placeholder-text.jsx +0 -22
- package/src/components/connectycube-ui/placeholder-text.tsx +0 -28
- package/src/components/connectycube-ui/presence.jsx +0 -41
- package/src/components/connectycube-ui/presence.tsx +0 -55
- package/src/components/connectycube-ui/status-indicator.tsx +0 -100
- package/src/components/connectycube-ui/stream-view.jsx +0 -201
- package/src/components/connectycube-ui/stream-view.tsx +0 -246
- package/src/components/connectycube-ui/utils.js +0 -30
- package/src/components/connectycube-ui/utils.ts +0 -28
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import * as SlotPrimitive from '@radix-ui/react-slot';
|
|
4
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
5
|
+
import { cn } from './utils';
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva(
|
|
8
|
+
'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*=size-])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',
|
|
13
|
+
destructive:
|
|
14
|
+
'bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
|
15
|
+
outline:
|
|
16
|
+
'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
|
17
|
+
secondary: 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',
|
|
18
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
|
19
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
default: 'h-9 px-4 py-2 has-[>svg]:px-3',
|
|
23
|
+
sm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',
|
|
24
|
+
lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',
|
|
25
|
+
icon: 'size-9',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
variant: 'default',
|
|
30
|
+
size: 'default',
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
interface ButtonProps extends React.ComponentProps<'button'>, VariantProps<typeof buttonVariants> {
|
|
36
|
+
asChild?: boolean;
|
|
37
|
+
leftElement?: React.ReactElement;
|
|
38
|
+
rightElement?: React.ReactElement;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function ButtonBase(
|
|
42
|
+
{ asChild = false, variant, size, className, leftElement, rightElement, children, ...props }: ButtonProps,
|
|
43
|
+
ref?: React.ForwardedRef<HTMLButtonElement>
|
|
44
|
+
) {
|
|
45
|
+
const Comp = asChild ? SlotPrimitive.Root : 'button';
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Comp ref={ref} {...props} className={cn(buttonVariants({ variant, size, className }))}>
|
|
49
|
+
{leftElement}
|
|
50
|
+
<SlotPrimitive.Slottable>{children}</SlotPrimitive.Slottable>
|
|
51
|
+
{rightElement}
|
|
52
|
+
</Comp>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const Button = forwardRef<HTMLButtonElement, ButtonProps>(ButtonBase);
|
|
57
|
+
|
|
58
|
+
Button.displayName = 'Button';
|
|
59
|
+
|
|
60
|
+
export { Button, type ButtonProps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import { useCallback, useEffect, useRef, useImperativeHandle,
|
|
2
|
+
import { useCallback, useEffect, useRef, useImperativeHandle, forwardRef } from 'react';
|
|
3
3
|
import { cn } from './utils';
|
|
4
4
|
|
|
5
5
|
interface DismissLayerProps extends React.ComponentProps<'div'> {
|
|
@@ -12,7 +12,7 @@ interface DismissLayerProps extends React.ComponentProps<'div'> {
|
|
|
12
12
|
|
|
13
13
|
function DismissLayerBase(
|
|
14
14
|
{ active, onDismiss, disableClickOutside = false, disableEscKeyPress = false, disabled, ...props }: DismissLayerProps,
|
|
15
|
-
ref: React.
|
|
15
|
+
ref: React.ForwardedRef<HTMLDivElement>
|
|
16
16
|
) {
|
|
17
17
|
const innerRef = useRef<HTMLDivElement>(null);
|
|
18
18
|
|
|
@@ -54,12 +54,12 @@ function DismissLayerBase(
|
|
|
54
54
|
{...props}
|
|
55
55
|
onClick={handleClickOrTouch}
|
|
56
56
|
onTouchStart={handleClickOrTouch}
|
|
57
|
-
className={cn('fixed top-0 left-0
|
|
57
|
+
className={cn('fixed top-0 left-0 size-full bg-black/20', props?.className)}
|
|
58
58
|
/>
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
const DismissLayer =
|
|
62
|
+
const DismissLayer = forwardRef<HTMLDivElement, DismissLayerProps>(DismissLayerBase);
|
|
63
63
|
|
|
64
64
|
DismissLayer.displayName = 'DismissLayer';
|
|
65
65
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { forwardRef
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
3
|
import { cn } from './utils';
|
|
4
4
|
|
|
5
5
|
interface PlaceholderTextProps extends React.ComponentProps<'div'> {
|
|
@@ -29,7 +29,7 @@ function PlaceholderTextBase(
|
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const PlaceholderText =
|
|
32
|
+
const PlaceholderText = forwardRef(PlaceholderTextBase);
|
|
33
33
|
|
|
34
34
|
PlaceholderText.displayName = 'PlaceholderText';
|
|
35
35
|
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { LucideProps } from 'lucide-react';
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
import { CircleCheck, CircleMinus, CircleQuestionMark, Clock } from 'lucide-react';
|
|
5
2
|
import { capitalize, cn } from './utils';
|
|
6
3
|
|
|
7
4
|
type PresenceStatus = 'available' | 'busy' | 'away' | 'unknown' | undefined;
|
|
@@ -14,37 +11,76 @@ interface PresenceProps extends React.ComponentProps<'div'> {
|
|
|
14
11
|
labelProps?: React.ComponentProps<'span'>;
|
|
15
12
|
}
|
|
16
13
|
|
|
17
|
-
interface PresenceBadgeProps extends
|
|
14
|
+
interface PresenceBadgeProps extends React.ComponentProps<'svg'> {
|
|
18
15
|
status?: PresenceStatus;
|
|
19
16
|
}
|
|
20
17
|
|
|
21
|
-
function
|
|
18
|
+
function PresenceBadge({ status, ...props }: PresenceBadgeProps) {
|
|
22
19
|
switch (status) {
|
|
23
20
|
case 'available':
|
|
24
21
|
return (
|
|
25
|
-
<
|
|
22
|
+
<svg
|
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
24
|
+
width="16"
|
|
25
|
+
height="16"
|
|
26
|
+
fill="currentColor"
|
|
27
|
+
viewBox="0 0 16 16"
|
|
28
|
+
{...props}
|
|
29
|
+
className={cn('rounded-full size-4.5 text-green-600 bg-white', props?.className)}
|
|
30
|
+
>
|
|
31
|
+
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z" />
|
|
32
|
+
</svg>
|
|
26
33
|
);
|
|
27
34
|
case 'busy':
|
|
28
|
-
return
|
|
35
|
+
return (
|
|
36
|
+
<svg
|
|
37
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
38
|
+
width="16"
|
|
39
|
+
height="16"
|
|
40
|
+
fill="currentColor"
|
|
41
|
+
viewBox="0 0 16 16"
|
|
42
|
+
{...props}
|
|
43
|
+
className={cn('rounded-full size-4.5 text-red-600 bg-white', props?.className)}
|
|
44
|
+
>
|
|
45
|
+
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M4.5 7.5a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1z" />
|
|
46
|
+
</svg>
|
|
47
|
+
);
|
|
29
48
|
case 'away':
|
|
30
|
-
return
|
|
49
|
+
return (
|
|
50
|
+
<svg
|
|
51
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
52
|
+
width="16"
|
|
53
|
+
height="16"
|
|
54
|
+
fill="currentColor"
|
|
55
|
+
viewBox="0 0 16 16"
|
|
56
|
+
{...props}
|
|
57
|
+
className={cn('rounded-full size-4.5 text-yellow-500 bg-white', props?.className)}
|
|
58
|
+
>
|
|
59
|
+
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M8 3.5a.5.5 0 0 0-1 0V9a.5.5 0 0 0 .252.434l3.5 2a.5.5 0 0 0 .496-.868L8 8.71z" />
|
|
60
|
+
</svg>
|
|
61
|
+
);
|
|
31
62
|
case 'unknown':
|
|
32
63
|
return (
|
|
33
|
-
<
|
|
64
|
+
<svg
|
|
65
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
66
|
+
width="16"
|
|
67
|
+
height="16"
|
|
68
|
+
fill="currentColor"
|
|
69
|
+
viewBox="0 0 16 16"
|
|
34
70
|
{...props}
|
|
35
|
-
className={cn('rounded-full
|
|
36
|
-
|
|
71
|
+
className={cn('rounded-full size-4.5 text-gray-500 bg-white', props?.className)}
|
|
72
|
+
>
|
|
73
|
+
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M5.496 6.033h.825c.138 0 .248-.113.266-.25.09-.656.54-1.134 1.342-1.134.686 0 1.314.343 1.314 1.168 0 .635-.374.927-.965 1.371-.673.489-1.206 1.06-1.168 1.987l.003.217a.25.25 0 0 0 .25.246h.811a.25.25 0 0 0 .25-.25v-.105c0-.718.273-.927 1.01-1.486.609-.463 1.244-.977 1.244-2.056 0-1.511-1.276-2.241-2.673-2.241-1.267 0-2.655.59-2.75 2.286a.237.237 0 0 0 .241.247m2.325 6.443c.61 0 1.029-.394 1.029-.927 0-.552-.42-.94-1.029-.94-.584 0-1.009.388-1.009.94 0 .533.425.927 1.01.927z" />
|
|
74
|
+
</svg>
|
|
37
75
|
);
|
|
38
76
|
default:
|
|
39
77
|
return null;
|
|
40
78
|
}
|
|
41
79
|
}
|
|
42
80
|
|
|
43
|
-
const PresenceBadge = memo(PresenceBadgeBase);
|
|
44
|
-
|
|
45
81
|
PresenceBadge.displayName = 'PresenceBadge';
|
|
46
82
|
|
|
47
|
-
function
|
|
83
|
+
function Presence({ badge = true, status, label, badgeProps, labelProps, ...props }: PresenceProps) {
|
|
48
84
|
const presence = capitalize(label || status);
|
|
49
85
|
|
|
50
86
|
return (
|
|
@@ -55,8 +91,6 @@ function PresenceBase({ badge = true, status, label, badgeProps, labelProps, ...
|
|
|
55
91
|
);
|
|
56
92
|
}
|
|
57
93
|
|
|
58
|
-
const Presence = memo(PresenceBase);
|
|
59
|
-
|
|
60
94
|
Presence.displayName = 'Presence';
|
|
61
95
|
|
|
62
96
|
export { Presence, PresenceBadge, type PresenceStatus, type PresenceProps, type PresenceBadgeProps };
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
TooltipProps,
|
|
5
|
-
TooltipTriggerProps,
|
|
6
|
-
TooltipPortalProps,
|
|
7
|
-
TooltipContentProps,
|
|
8
|
-
TooltipArrowProps,
|
|
9
|
-
} from '@radix-ui/react-tooltip';
|
|
10
|
-
import { forwardRef, memo } from 'react';
|
|
11
|
-
import {
|
|
12
|
-
Provider as TooltipProvider,
|
|
13
|
-
Root as TooltipRoot,
|
|
14
|
-
Trigger as TooltipTrigger,
|
|
15
|
-
Portal as TooltipPortal,
|
|
16
|
-
Content as TooltipContent,
|
|
17
|
-
Arrow as TooltipArrow,
|
|
18
|
-
} from '@radix-ui/react-tooltip';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
19
4
|
import { cn } from './utils';
|
|
20
5
|
|
|
21
6
|
type StatusName = string | 'unknown';
|
|
@@ -24,12 +9,12 @@ interface StatusIndicatorProps extends React.ComponentProps<'div'> {
|
|
|
24
9
|
status?: StatusName;
|
|
25
10
|
statusColorConfig?: Record<StatusName, string>;
|
|
26
11
|
statusProps?: React.ComponentProps<'div'>;
|
|
27
|
-
tooltipProviderProps?: TooltipProviderProps;
|
|
28
|
-
tooltipProps?: TooltipProps;
|
|
29
|
-
tooltipTriggerProps?: TooltipTriggerProps;
|
|
30
|
-
tooltipPortalProps?: TooltipPortalProps;
|
|
31
|
-
tooltipContentProps?: TooltipContentProps;
|
|
32
|
-
tooltipArrowProps?: TooltipArrowProps;
|
|
12
|
+
tooltipProviderProps?: TooltipPrimitive.TooltipProviderProps;
|
|
13
|
+
tooltipProps?: TooltipPrimitive.TooltipProps;
|
|
14
|
+
tooltipTriggerProps?: TooltipPrimitive.TooltipTriggerProps;
|
|
15
|
+
tooltipPortalProps?: TooltipPrimitive.TooltipPortalProps;
|
|
16
|
+
tooltipContentProps?: TooltipPrimitive.TooltipContentProps;
|
|
17
|
+
tooltipArrowProps?: TooltipPrimitive.TooltipArrowProps;
|
|
33
18
|
tooltip?: string;
|
|
34
19
|
disabled?: boolean;
|
|
35
20
|
className?: string;
|
|
@@ -51,15 +36,15 @@ function StatusIndicatorBase(
|
|
|
51
36
|
className,
|
|
52
37
|
...props
|
|
53
38
|
}: StatusIndicatorProps,
|
|
54
|
-
ref: React.
|
|
39
|
+
ref: React.ForwardedRef<HTMLDivElement>
|
|
55
40
|
) {
|
|
56
41
|
if (disabled) return null;
|
|
57
42
|
|
|
58
43
|
return (
|
|
59
44
|
<div ref={ref} {...props} className={cn('absolute top-0 left-0', className)}>
|
|
60
|
-
<
|
|
61
|
-
<
|
|
62
|
-
<
|
|
45
|
+
<TooltipPrimitive.Provider {...tooltipProviderProps}>
|
|
46
|
+
<TooltipPrimitive.Root {...tooltipProps}>
|
|
47
|
+
<TooltipPrimitive.Trigger asChild {...tooltipTriggerProps}>
|
|
63
48
|
<div
|
|
64
49
|
{...statusProps}
|
|
65
50
|
className={cn(
|
|
@@ -68,9 +53,9 @@ function StatusIndicatorBase(
|
|
|
68
53
|
statusProps?.className
|
|
69
54
|
)}
|
|
70
55
|
/>
|
|
71
|
-
</
|
|
72
|
-
<
|
|
73
|
-
<
|
|
56
|
+
</TooltipPrimitive.Trigger>
|
|
57
|
+
<TooltipPrimitive.Portal {...tooltipPortalProps}>
|
|
58
|
+
<TooltipPrimitive.Content
|
|
74
59
|
{...tooltipContentProps}
|
|
75
60
|
className={cn(
|
|
76
61
|
'bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance',
|
|
@@ -78,23 +63,23 @@ function StatusIndicatorBase(
|
|
|
78
63
|
)}
|
|
79
64
|
>
|
|
80
65
|
<span>{tooltip || status || 'unknown'}</span>
|
|
81
|
-
<
|
|
66
|
+
<TooltipPrimitive.Arrow
|
|
82
67
|
{...tooltipArrowProps}
|
|
83
68
|
className={cn(
|
|
84
69
|
'bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px]',
|
|
85
70
|
tooltipArrowProps?.className
|
|
86
71
|
)}
|
|
87
72
|
/>
|
|
88
|
-
</
|
|
89
|
-
</
|
|
90
|
-
</
|
|
91
|
-
</
|
|
73
|
+
</TooltipPrimitive.Content>
|
|
74
|
+
</TooltipPrimitive.Portal>
|
|
75
|
+
</TooltipPrimitive.Root>
|
|
76
|
+
</TooltipPrimitive.Provider>
|
|
92
77
|
</div>
|
|
93
78
|
);
|
|
94
79
|
}
|
|
95
80
|
|
|
96
|
-
const StatusIndicator =
|
|
81
|
+
const StatusIndicator = forwardRef(StatusIndicatorBase);
|
|
97
82
|
|
|
98
83
|
StatusIndicator.displayName = 'StatusIndicator';
|
|
99
84
|
|
|
100
|
-
export { StatusIndicator, type StatusIndicatorProps };
|
|
85
|
+
export { StatusIndicator, type StatusName, type StatusIndicatorProps };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { LucideProps } from 'lucide-react';
|
|
3
2
|
import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
4
|
-
import { Maximize, Minimize, PictureInPicture2 } from 'lucide-react';
|
|
3
|
+
import { Maximize, Minimize, PictureInPicture2, type LucideProps } from 'lucide-react';
|
|
5
4
|
import { cn, getRandomString } from './utils';
|
|
6
5
|
|
|
7
6
|
interface StreamViewProps extends React.ComponentProps<'video'> {
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
export type StreamViewProps = {
|
|
3
|
-
id?: string;
|
|
4
|
-
stream?: MediaStream;
|
|
5
|
-
mirror?: boolean;
|
|
6
|
-
} & React.VideoHTMLAttributes<HTMLVideoElement>;
|
|
7
|
-
export type StreamViewRef = {
|
|
8
|
-
id: string;
|
|
9
|
-
element: HTMLVideoElement | null;
|
|
10
|
-
};
|
|
11
|
-
export declare const StreamView: React.ForwardRefExoticComponent<{
|
|
12
|
-
id?: string;
|
|
13
|
-
stream?: MediaStream;
|
|
14
|
-
mirror?: boolean;
|
|
15
|
-
} & React.VideoHTMLAttributes<HTMLVideoElement> & React.RefAttributes<StreamViewRef>>;
|
|
16
|
-
export declare const LocalStreamView: React.ForwardRefExoticComponent<{
|
|
17
|
-
id?: string;
|
|
18
|
-
stream?: MediaStream;
|
|
19
|
-
mirror?: boolean;
|
|
20
|
-
} & React.VideoHTMLAttributes<HTMLVideoElement> & React.RefAttributes<StreamViewRef>>;
|
|
21
|
-
export declare const RemoteStreamView: React.ForwardRefExoticComponent<{
|
|
22
|
-
id?: string;
|
|
23
|
-
stream?: MediaStream;
|
|
24
|
-
mirror?: boolean;
|
|
25
|
-
} & React.VideoHTMLAttributes<HTMLVideoElement> & React.RefAttributes<StreamViewRef>>;
|
|
26
|
-
//# sourceMappingURL=stream-view.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stream-view.d.ts","sourceRoot":"","sources":["../../../../src/components/connectycube-ui/stream-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,GAAG,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,UAAU;SAVhB,MAAM;aACF,WAAW;aACX,OAAO;qFAuDjB,CAAC;AAEF,eAAO,MAAM,eAAe;SA3DrB,MAAM;aACF,WAAW;aACX,OAAO;qFA8DhB,CAAC;AAEH,eAAO,MAAM,gBAAgB;SAlEtB,MAAM;aACF,WAAW;aACX,OAAO;qFAqEhB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/connectycube-ui/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,wBAAgB,eAAe,CAAC,MAAM,SAAI,GAAG,MAAM,CAElD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,IAAI,IAAI;IACR,OAAO,IAAI;CACZ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,wBAAgB,eAAe,CAAC,MAAM,SAAI,GAAG,MAAM,CAElD"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import { type ClassValue } from 'clsx';
|
|
3
|
-
import { ActiveMedia } from '../lib/constants';
|
|
4
|
-
export type LocalStreamProps = {
|
|
5
|
-
id?: string;
|
|
6
|
-
stream?: MediaStream;
|
|
7
|
-
activeMedia?: ActiveMedia | 'user' | 'display';
|
|
8
|
-
mirror?: boolean;
|
|
9
|
-
className?: ClassValue;
|
|
10
|
-
} & React.VideoHTMLAttributes<HTMLVideoElement>;
|
|
11
|
-
export type LocalStreamRef = {
|
|
12
|
-
id: string;
|
|
13
|
-
element: HTMLVideoElement | null;
|
|
14
|
-
};
|
|
15
|
-
export declare const LocalStream: React.ForwardRefExoticComponent<{
|
|
16
|
-
id?: string;
|
|
17
|
-
stream?: MediaStream;
|
|
18
|
-
activeMedia?: ActiveMedia | "user" | "display";
|
|
19
|
-
mirror?: boolean;
|
|
20
|
-
className?: ClassValue;
|
|
21
|
-
} & React.VideoHTMLAttributes<HTMLVideoElement> & React.RefAttributes<LocalStreamRef>>;
|
|
22
|
-
//# sourceMappingURL=local-stream.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"local-stream.d.ts","sourceRoot":"","sources":["../../../src/templates/local-stream.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,WAAW,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;IAC/C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,UAAU,CAAC;CACxB,GAAG,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,WAAW;SAZjB,MAAM;aACF,WAAW;kBACN,WAAW,GAAG,MAAM,GAAG,SAAS;aACrC,OAAO;gBACJ,UAAU;sFAyDvB,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { type ClassValue } from 'clsx';
|
|
2
|
-
export type RemoteStreamProps = {
|
|
3
|
-
id?: string;
|
|
4
|
-
stream?: MediaStream;
|
|
5
|
-
mirror?: boolean;
|
|
6
|
-
className?: ClassValue;
|
|
7
|
-
} & React.VideoHTMLAttributes<HTMLVideoElement>;
|
|
8
|
-
export type RemoteStreamRef = {
|
|
9
|
-
id: string;
|
|
10
|
-
element: HTMLVideoElement | null;
|
|
11
|
-
};
|
|
12
|
-
export declare const RemoteStream: import("react").ForwardRefExoticComponent<{
|
|
13
|
-
id?: string;
|
|
14
|
-
stream?: MediaStream;
|
|
15
|
-
mirror?: boolean;
|
|
16
|
-
className?: ClassValue;
|
|
17
|
-
} & import("react").VideoHTMLAttributes<HTMLVideoElement> & import("react").RefAttributes<RemoteStreamRef>>;
|
|
18
|
-
//# sourceMappingURL=remote-stream.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remote-stream.d.ts","sourceRoot":"","sources":["../../../src/templates/remote-stream.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAGvC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,UAAU,CAAC;CACxB,GAAG,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AAEhD,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,YAAY;SAXlB,MAAM;aACF,WAAW;aACX,OAAO;gBACJ,UAAU;2GAuDvB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { LoaderCircle } from 'lucide-react';
|
|
2
|
-
import { cn } from './utils';
|
|
3
|
-
|
|
4
|
-
function AnimatedLoader({ loading = true, className }) {
|
|
5
|
-
return loading ? <LoaderCircle className={cn('animate-spin mx-auto', className)} /> : null;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
AnimatedLoader.displayName = 'AnimatedLoader';
|
|
9
|
-
|
|
10
|
-
export { AnimatedLoader };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { LucideProps } from 'lucide-react';
|
|
2
|
-
import { LoaderCircle } from 'lucide-react';
|
|
3
|
-
import { cn } from './utils';
|
|
4
|
-
|
|
5
|
-
interface AnimatedLoaderProps extends LucideProps {
|
|
6
|
-
loading?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function AnimatedLoader({ loading = true, className }: AnimatedLoaderProps) {
|
|
10
|
-
return loading ? <LoaderCircle className={cn('animate-spin mx-auto', className)} /> : null;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
AnimatedLoader.displayName = 'AnimatedLoader';
|
|
14
|
-
|
|
15
|
-
export { AnimatedLoader, type AnimatedLoaderProps };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { forwardRef, memo } from 'react';
|
|
2
|
-
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
3
|
-
import { PresenceBadge } from './presence';
|
|
4
|
-
import { cn, getInitialsFromName } from './utils';
|
|
5
|
-
|
|
6
|
-
function AvatarBase(
|
|
7
|
-
{ src, name = 'NA', online, presence, className, onlineClassName, presenceClassName, ...props },
|
|
8
|
-
ref
|
|
9
|
-
) {
|
|
10
|
-
const initials = getInitialsFromName(name);
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<AvatarPrimitive.Root
|
|
14
|
-
ref={ref}
|
|
15
|
-
className={cn('relative flex size-8 shrink-0 overflow-hidden rounded-full', className)}
|
|
16
|
-
{...props}
|
|
17
|
-
>
|
|
18
|
-
<AvatarPrimitive.Image src={src} className={cn('aspect-square size-full object-cover')} />
|
|
19
|
-
<AvatarPrimitive.Fallback className={cn('bg-muted flex size-full items-center justify-center')}>
|
|
20
|
-
{initials}
|
|
21
|
-
</AvatarPrimitive.Fallback>
|
|
22
|
-
{online && (
|
|
23
|
-
<div className={cn('rounded-full border-2 bg-green-600 border-green-200 size-3.5', onlineClassName)} />
|
|
24
|
-
)}
|
|
25
|
-
<PresenceBadge presence={presence} className={cn('absolute -bottom-0.5 -right-1', presenceClassName)} />
|
|
26
|
-
</AvatarPrimitive.Root>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const Avatar = memo(forwardRef(AvatarBase));
|
|
31
|
-
|
|
32
|
-
Avatar.displayName = 'Avatar';
|
|
33
|
-
|
|
34
|
-
export { Avatar };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { PresenceStatus } from './presence';
|
|
3
|
-
import { forwardRef, memo } from 'react';
|
|
4
|
-
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
5
|
-
import { PresenceBadge } from './presence';
|
|
6
|
-
import { cn, getInitialsFromName } from './utils';
|
|
7
|
-
|
|
8
|
-
interface AvatarProps extends React.ComponentProps<typeof AvatarPrimitive.Root> {
|
|
9
|
-
src?: string;
|
|
10
|
-
name?: string;
|
|
11
|
-
online?: boolean;
|
|
12
|
-
presence?: PresenceStatus;
|
|
13
|
-
onlineClassName?: string;
|
|
14
|
-
presenceClassName?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function AvatarBase(
|
|
18
|
-
{ src, name = 'NA', online, presence, className, onlineClassName, presenceClassName, ...props }: AvatarProps,
|
|
19
|
-
ref: React.Ref<HTMLDivElement>
|
|
20
|
-
) {
|
|
21
|
-
const initials = getInitialsFromName(name);
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<AvatarPrimitive.Root
|
|
25
|
-
ref={ref}
|
|
26
|
-
className={cn('relative flex size-8 shrink-0 overflow-hidden rounded-full', className)}
|
|
27
|
-
{...props}
|
|
28
|
-
>
|
|
29
|
-
<AvatarPrimitive.Image src={src} className={cn('aspect-square size-full object-cover')} />
|
|
30
|
-
<AvatarPrimitive.Fallback className={cn('bg-muted flex size-full items-center justify-center')}>
|
|
31
|
-
{initials}
|
|
32
|
-
</AvatarPrimitive.Fallback>
|
|
33
|
-
{online && (
|
|
34
|
-
<div className={cn('rounded-full border-2 bg-green-600 border-green-200 size-3.5', onlineClassName)} />
|
|
35
|
-
)}
|
|
36
|
-
<PresenceBadge presence={presence} className={cn('absolute -bottom-0.5 -right-1', presenceClassName)} />
|
|
37
|
-
</AvatarPrimitive.Root>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const Avatar = memo(forwardRef<HTMLDivElement, AvatarProps>(AvatarBase));
|
|
42
|
-
|
|
43
|
-
Avatar.displayName = 'Avatar';
|
|
44
|
-
|
|
45
|
-
export { Avatar, type AvatarProps };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useRef, useImperativeHandle, memo, forwardRef } from 'react';
|
|
2
|
-
import { cn } from './utils';
|
|
3
|
-
|
|
4
|
-
function DismissLayerBase(
|
|
5
|
-
{ active, onDismiss, disableClickOutside = false, disableEscKeyPress = false, disabled, className, ...props },
|
|
6
|
-
ref
|
|
7
|
-
) {
|
|
8
|
-
const innerRef = useRef(null);
|
|
9
|
-
|
|
10
|
-
useImperativeHandle(ref, () => innerRef.current);
|
|
11
|
-
|
|
12
|
-
const handleClickOrTouch = useCallback(
|
|
13
|
-
(e) => {
|
|
14
|
-
if (!disableClickOutside && active && e.target === innerRef.current) {
|
|
15
|
-
onDismiss();
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
[disableClickOutside, active, onDismiss]
|
|
19
|
-
);
|
|
20
|
-
const handleKeyEvent = useCallback(
|
|
21
|
-
(ev) => {
|
|
22
|
-
if (!disableEscKeyPress && active && ev.key === 'Escape') {
|
|
23
|
-
onDismiss();
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
[disableEscKeyPress, active, onDismiss]
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (!disableEscKeyPress && active) {
|
|
31
|
-
document.addEventListener('keydown', handleKeyEvent);
|
|
32
|
-
|
|
33
|
-
return () => document.removeEventListener('keydown', handleKeyEvent);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return;
|
|
37
|
-
}, [disableEscKeyPress, active, handleKeyEvent]);
|
|
38
|
-
|
|
39
|
-
if (disabled || !active) return null;
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<div
|
|
43
|
-
ref={innerRef}
|
|
44
|
-
onClick={handleClickOrTouch}
|
|
45
|
-
onTouchStart={handleClickOrTouch}
|
|
46
|
-
className={cn('fixed top-0 left-0 z-40 size-full bg-black/20', className)}
|
|
47
|
-
aria-hidden
|
|
48
|
-
{...props}
|
|
49
|
-
/>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const DismissLayer = memo(forwardRef(DismissLayerBase));
|
|
54
|
-
|
|
55
|
-
DismissLayer.displayName = 'DismissLayer';
|
|
56
|
-
|
|
57
|
-
export { DismissLayer };
|