@connectycube/react-ui-kit 0.0.15 → 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 +7 -0
- package/configs/imports.json +3 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- 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/avatar.d.ts +2 -1
- package/dist/types/components/avatar.d.ts.map +1 -1
- 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 +2 -1
- package/dist/types/components/dismiss-layer.d.ts.map +1 -1
- package/dist/types/components/placeholder-text.d.ts +2 -1
- package/dist/types/components/placeholder-text.d.ts.map +1 -1
- package/dist/types/components/presence.d.ts +9 -4
- package/dist/types/components/presence.d.ts.map +1 -1
- package/dist/types/components/status-indicator.d.ts +2 -1
- package/dist/types/components/status-indicator.d.ts.map +1 -1
- package/dist/types/components/stream-view.d.ts +5 -4
- package/dist/types/components/stream-view.d.ts.map +1 -1
- package/gen/components/alert-dialog.jsx +92 -0
- package/gen/components/avatar.jsx +2 -2
- package/gen/components/button.jsx +60 -0
- package/gen/components/dismiss-layer.jsx +2 -2
- package/gen/components/placeholder-text.jsx +3 -2
- package/gen/components/presence.jsx +2 -7
- package/gen/components/status-indicator.jsx +2 -2
- package/package.json +4 -1
- package/src/components/alert-dialog.tsx +116 -0
- package/src/components/avatar.tsx +3 -2
- package/src/components/button.tsx +60 -0
- package/src/components/dismiss-layer.tsx +4 -3
- package/src/components/placeholder-text.tsx +3 -2
- package/src/components/presence.tsx +3 -7
- package/src/components/status-indicator.tsx +4 -3
- package/src/components/stream-view.tsx +1 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import * as SlotPrimitive from '@radix-ui/react-slot';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { cn } from './utils';
|
|
5
|
+
|
|
6
|
+
const buttonVariants = cva(
|
|
7
|
+
'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',
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',
|
|
12
|
+
destructive:
|
|
13
|
+
'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',
|
|
14
|
+
outline:
|
|
15
|
+
'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
|
16
|
+
secondary: 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',
|
|
17
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
|
18
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
default: 'h-9 px-4 py-2 has-[>svg]:px-3',
|
|
22
|
+
sm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',
|
|
23
|
+
lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',
|
|
24
|
+
icon: 'size-9',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
variant: 'default',
|
|
29
|
+
size: 'default',
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
function ButtonBase({ asChild = false, variant, size, className, leftElement, rightElement, children, ...props }, ref) {
|
|
35
|
+
const Comp = asChild ? SlotPrimitive.Root : 'button';
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Comp
|
|
39
|
+
ref={ref}
|
|
40
|
+
{...props}
|
|
41
|
+
className={cn(
|
|
42
|
+
buttonVariants({
|
|
43
|
+
variant,
|
|
44
|
+
size,
|
|
45
|
+
className,
|
|
46
|
+
})
|
|
47
|
+
)}
|
|
48
|
+
>
|
|
49
|
+
{leftElement}
|
|
50
|
+
<SlotPrimitive.Slottable>{children}</SlotPrimitive.Slottable>
|
|
51
|
+
{rightElement}
|
|
52
|
+
</Comp>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const Button = forwardRef(ButtonBase);
|
|
57
|
+
|
|
58
|
+
Button.displayName = 'Button';
|
|
59
|
+
|
|
60
|
+
export { Button };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useEffect, useRef, useImperativeHandle,
|
|
1
|
+
import { useCallback, useEffect, useRef, useImperativeHandle, forwardRef } from 'react';
|
|
2
2
|
import { cn } from './utils';
|
|
3
3
|
|
|
4
4
|
function DismissLayerBase(
|
|
@@ -50,7 +50,7 @@ function DismissLayerBase(
|
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
const DismissLayer =
|
|
53
|
+
const DismissLayer = forwardRef(DismissLayerBase);
|
|
54
54
|
|
|
55
55
|
DismissLayer.displayName = 'DismissLayer';
|
|
56
56
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
2
3
|
import { cn } from './utils';
|
|
3
4
|
|
|
4
5
|
function PlaceholderTextBase({ title, titles = [], rowProps, ...props }, ref) {
|
|
@@ -19,7 +20,7 @@ function PlaceholderTextBase({ title, titles = [], rowProps, ...props }, ref) {
|
|
|
19
20
|
);
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
const PlaceholderText =
|
|
23
|
+
const PlaceholderText = forwardRef(PlaceholderTextBase);
|
|
23
24
|
|
|
24
25
|
PlaceholderText.displayName = 'PlaceholderText';
|
|
25
26
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { memo } from 'react';
|
|
2
1
|
import { capitalize, cn } from './utils';
|
|
3
2
|
|
|
4
|
-
function
|
|
3
|
+
function PresenceBadge({ status, ...props }) {
|
|
5
4
|
switch (status) {
|
|
6
5
|
case 'available':
|
|
7
6
|
return (
|
|
@@ -64,11 +63,9 @@ function PresenceBadgeBase({ status, ...props }) {
|
|
|
64
63
|
}
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
const PresenceBadge = memo(PresenceBadgeBase);
|
|
68
|
-
|
|
69
66
|
PresenceBadge.displayName = 'PresenceBadge';
|
|
70
67
|
|
|
71
|
-
function
|
|
68
|
+
function Presence({ badge = true, status, label, badgeProps, labelProps, ...props }) {
|
|
72
69
|
const presence = capitalize(label || status);
|
|
73
70
|
|
|
74
71
|
return (
|
|
@@ -79,8 +76,6 @@ function PresenceBase({ badge = true, status, label, badgeProps, labelProps, ...
|
|
|
79
76
|
);
|
|
80
77
|
}
|
|
81
78
|
|
|
82
|
-
const Presence = memo(PresenceBase);
|
|
83
|
-
|
|
84
79
|
Presence.displayName = 'Presence';
|
|
85
80
|
|
|
86
81
|
export { Presence, PresenceBadge };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { forwardRef
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
2
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
3
3
|
import { cn } from './utils';
|
|
4
4
|
|
|
@@ -62,7 +62,7 @@ function StatusIndicatorBase(
|
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
const StatusIndicator =
|
|
65
|
+
const StatusIndicator = forwardRef(StatusIndicatorBase);
|
|
66
66
|
|
|
67
67
|
StatusIndicator.displayName = 'StatusIndicator';
|
|
68
68
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@connectycube/react-ui-kit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "Simple React UI Kit generator with TSX/JSX",
|
|
5
5
|
"homepage": "https://github.com/ConnectyCube/react-ui-kit#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -62,8 +62,11 @@
|
|
|
62
62
|
"jsx"
|
|
63
63
|
],
|
|
64
64
|
"dependencies": {
|
|
65
|
+
"@radix-ui/react-alert-dialog": "^1.1.15",
|
|
65
66
|
"@radix-ui/react-avatar": "^1.1.11",
|
|
67
|
+
"@radix-ui/react-slot": "^1.2.4",
|
|
66
68
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
69
|
+
"class-variance-authority": "^0.7.1",
|
|
67
70
|
"clsx": "^2.1.1",
|
|
68
71
|
"execa": "^9.6.0",
|
|
69
72
|
"fs-extra": "^11.3.2",
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
4
|
+
import { Button, type ButtonProps } from './button';
|
|
5
|
+
import { cn } from './utils';
|
|
6
|
+
|
|
7
|
+
interface AlertDialogProps extends AlertDialogPrimitive.AlertDialogProps {
|
|
8
|
+
title?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
cancelTitle?: string;
|
|
11
|
+
actionTitle?: string;
|
|
12
|
+
onCancel?: () => void;
|
|
13
|
+
onConfirm?: () => void;
|
|
14
|
+
rootProps?: AlertDialogPrimitive.AlertDialogProps;
|
|
15
|
+
triggerElement: React.ReactElement;
|
|
16
|
+
triggerProps?: AlertDialogPrimitive.AlertDialogTriggerProps;
|
|
17
|
+
portalProps?: AlertDialogPrimitive.AlertDialogPortalProps;
|
|
18
|
+
overlayProps?: AlertDialogPrimitive.AlertDialogOverlayProps;
|
|
19
|
+
contentProps?: AlertDialogPrimitive.AlertDialogContentProps;
|
|
20
|
+
headerProps?: React.ComponentProps<'div'>;
|
|
21
|
+
titleProps?: AlertDialogPrimitive.AlertDialogTitleProps;
|
|
22
|
+
descriptionProps?: AlertDialogPrimitive.AlertDialogDescriptionProps;
|
|
23
|
+
footerProps?: React.ComponentProps<'div'>;
|
|
24
|
+
cancelProps?: AlertDialogPrimitive.AlertDialogCancelProps;
|
|
25
|
+
cancelButtonProps?: ButtonProps;
|
|
26
|
+
actionProps?: AlertDialogPrimitive.AlertDialogActionProps;
|
|
27
|
+
actionButtonProps?: ButtonProps;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function AlertDialogBase(
|
|
31
|
+
{
|
|
32
|
+
title = '',
|
|
33
|
+
description = '',
|
|
34
|
+
cancelTitle = 'Cancel',
|
|
35
|
+
actionTitle = 'Confirm',
|
|
36
|
+
onCancel = () => {},
|
|
37
|
+
onConfirm = () => {},
|
|
38
|
+
rootProps,
|
|
39
|
+
triggerElement,
|
|
40
|
+
triggerProps,
|
|
41
|
+
portalProps,
|
|
42
|
+
overlayProps,
|
|
43
|
+
contentProps,
|
|
44
|
+
headerProps,
|
|
45
|
+
titleProps,
|
|
46
|
+
descriptionProps,
|
|
47
|
+
footerProps,
|
|
48
|
+
cancelProps,
|
|
49
|
+
cancelButtonProps,
|
|
50
|
+
actionProps,
|
|
51
|
+
actionButtonProps,
|
|
52
|
+
...props
|
|
53
|
+
}: AlertDialogProps,
|
|
54
|
+
ref?: React.ForwardedRef<HTMLDivElement>
|
|
55
|
+
) {
|
|
56
|
+
return (
|
|
57
|
+
<div ref={ref} {...props}>
|
|
58
|
+
<AlertDialogPrimitive.Root {...rootProps}>
|
|
59
|
+
<AlertDialogPrimitive.Trigger asChild {...triggerProps}>
|
|
60
|
+
{triggerElement}
|
|
61
|
+
</AlertDialogPrimitive.Trigger>
|
|
62
|
+
<AlertDialogPrimitive.Portal {...portalProps}>
|
|
63
|
+
<AlertDialogPrimitive.Overlay
|
|
64
|
+
{...overlayProps}
|
|
65
|
+
className={cn(
|
|
66
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
|
|
67
|
+
overlayProps?.className
|
|
68
|
+
)}
|
|
69
|
+
/>
|
|
70
|
+
<AlertDialogPrimitive.Content
|
|
71
|
+
{...contentProps}
|
|
72
|
+
className={cn(
|
|
73
|
+
'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2em)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',
|
|
74
|
+
contentProps?.className
|
|
75
|
+
)}
|
|
76
|
+
>
|
|
77
|
+
<div
|
|
78
|
+
{...headerProps}
|
|
79
|
+
className={cn('flex flex-col gap-2 text-center sm:text-left', headerProps?.className)}
|
|
80
|
+
>
|
|
81
|
+
<AlertDialogPrimitive.Title
|
|
82
|
+
{...titleProps}
|
|
83
|
+
className={cn('text-lg font-semibold', titleProps?.className)}
|
|
84
|
+
>
|
|
85
|
+
{title}
|
|
86
|
+
</AlertDialogPrimitive.Title>
|
|
87
|
+
<AlertDialogPrimitive.Description
|
|
88
|
+
{...descriptionProps}
|
|
89
|
+
className={cn('text-muted-foreground text-sm', descriptionProps?.className)}
|
|
90
|
+
>
|
|
91
|
+
{description}
|
|
92
|
+
</AlertDialogPrimitive.Description>
|
|
93
|
+
</div>
|
|
94
|
+
<div
|
|
95
|
+
{...footerProps}
|
|
96
|
+
className={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', footerProps?.className)}
|
|
97
|
+
>
|
|
98
|
+
<AlertDialogPrimitive.Cancel {...cancelProps} onClick={onCancel}>
|
|
99
|
+
<Button {...cancelButtonProps}>{cancelTitle}</Button>
|
|
100
|
+
</AlertDialogPrimitive.Cancel>
|
|
101
|
+
<AlertDialogPrimitive.Action {...actionProps} onClick={onConfirm}>
|
|
102
|
+
<Button {...actionButtonProps}>{actionTitle}</Button>
|
|
103
|
+
</AlertDialogPrimitive.Action>
|
|
104
|
+
</div>
|
|
105
|
+
</AlertDialogPrimitive.Content>
|
|
106
|
+
</AlertDialogPrimitive.Portal>
|
|
107
|
+
</AlertDialogPrimitive.Root>
|
|
108
|
+
</div>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const AlertDialog = forwardRef<HTMLDivElement, AlertDialogProps>(AlertDialogBase);
|
|
113
|
+
|
|
114
|
+
AlertDialog.displayName = 'AlertDialog';
|
|
115
|
+
|
|
116
|
+
export { AlertDialog, type AlertDialogProps };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { memo, forwardRef } from 'react';
|
|
2
3
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
3
4
|
import { PresenceBadge, type PresenceStatus, type PresenceBadgeProps } from './presence';
|
|
4
5
|
import { cn, getInitialsFromName } from './utils';
|
|
@@ -40,7 +41,7 @@ function AvatarBase(
|
|
|
40
41
|
/>
|
|
41
42
|
<AvatarPrimitive.Fallback
|
|
42
43
|
{...fallbackProps}
|
|
43
|
-
className={cn('bg-muted
|
|
44
|
+
className={cn('bg-muted size-full rounded-full flex items-center justify-center', fallbackProps?.className)}
|
|
44
45
|
>
|
|
45
46
|
{initials}
|
|
46
47
|
</AvatarPrimitive.Fallback>
|
|
@@ -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,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { useCallback, useEffect, useRef, useImperativeHandle, forwardRef } from 'react';
|
|
2
3
|
import { cn } from './utils';
|
|
3
4
|
|
|
4
5
|
interface DismissLayerProps extends React.ComponentProps<'div'> {
|
|
@@ -11,7 +12,7 @@ interface DismissLayerProps extends React.ComponentProps<'div'> {
|
|
|
11
12
|
|
|
12
13
|
function DismissLayerBase(
|
|
13
14
|
{ active, onDismiss, disableClickOutside = false, disableEscKeyPress = false, disabled, ...props }: DismissLayerProps,
|
|
14
|
-
ref: React.
|
|
15
|
+
ref: React.ForwardedRef<HTMLDivElement>
|
|
15
16
|
) {
|
|
16
17
|
const innerRef = useRef<HTMLDivElement>(null);
|
|
17
18
|
|
|
@@ -58,7 +59,7 @@ function DismissLayerBase(
|
|
|
58
59
|
);
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
const DismissLayer =
|
|
62
|
+
const DismissLayer = forwardRef<HTMLDivElement, DismissLayerProps>(DismissLayerBase);
|
|
62
63
|
|
|
63
64
|
DismissLayer.displayName = 'DismissLayer';
|
|
64
65
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
2
3
|
import { cn } from './utils';
|
|
3
4
|
|
|
4
5
|
interface PlaceholderTextProps extends React.ComponentProps<'div'> {
|
|
@@ -28,7 +29,7 @@ function PlaceholderTextBase(
|
|
|
28
29
|
);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
const PlaceholderText =
|
|
32
|
+
const PlaceholderText = forwardRef(PlaceholderTextBase);
|
|
32
33
|
|
|
33
34
|
PlaceholderText.displayName = 'PlaceholderText';
|
|
34
35
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
import { capitalize, cn } from './utils';
|
|
3
3
|
|
|
4
4
|
type PresenceStatus = 'available' | 'busy' | 'away' | 'unknown' | undefined;
|
|
@@ -15,7 +15,7 @@ interface PresenceBadgeProps extends React.ComponentProps<'svg'> {
|
|
|
15
15
|
status?: PresenceStatus;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
function
|
|
18
|
+
function PresenceBadge({ status, ...props }: PresenceBadgeProps) {
|
|
19
19
|
switch (status) {
|
|
20
20
|
case 'available':
|
|
21
21
|
return (
|
|
@@ -78,11 +78,9 @@ function PresenceBadgeBase({ status, ...props }: PresenceBadgeProps) {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
const PresenceBadge = memo(PresenceBadgeBase);
|
|
82
|
-
|
|
83
81
|
PresenceBadge.displayName = 'PresenceBadge';
|
|
84
82
|
|
|
85
|
-
function
|
|
83
|
+
function Presence({ badge = true, status, label, badgeProps, labelProps, ...props }: PresenceProps) {
|
|
86
84
|
const presence = capitalize(label || status);
|
|
87
85
|
|
|
88
86
|
return (
|
|
@@ -93,8 +91,6 @@ function PresenceBase({ badge = true, status, label, badgeProps, labelProps, ...
|
|
|
93
91
|
);
|
|
94
92
|
}
|
|
95
93
|
|
|
96
|
-
const Presence = memo(PresenceBase);
|
|
97
|
-
|
|
98
94
|
Presence.displayName = 'Presence';
|
|
99
95
|
|
|
100
96
|
export { Presence, PresenceBadge, type PresenceStatus, type PresenceProps, type PresenceBadgeProps };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
2
3
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
3
4
|
import { cn } from './utils';
|
|
4
5
|
|
|
@@ -35,7 +36,7 @@ function StatusIndicatorBase(
|
|
|
35
36
|
className,
|
|
36
37
|
...props
|
|
37
38
|
}: StatusIndicatorProps,
|
|
38
|
-
ref: React.
|
|
39
|
+
ref: React.ForwardedRef<HTMLDivElement>
|
|
39
40
|
) {
|
|
40
41
|
if (disabled) return null;
|
|
41
42
|
|
|
@@ -77,7 +78,7 @@ function StatusIndicatorBase(
|
|
|
77
78
|
);
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
const StatusIndicator =
|
|
81
|
+
const StatusIndicator = forwardRef(StatusIndicatorBase);
|
|
81
82
|
|
|
82
83
|
StatusIndicator.displayName = 'StatusIndicator';
|
|
83
84
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type React from 'react';
|
|
1
2
|
import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
2
3
|
import { Maximize, Minimize, PictureInPicture2, type LucideProps } from 'lucide-react';
|
|
3
4
|
import { cn, getRandomString } from './utils';
|