@connectycube/react-ui-kit 0.0.18 → 0.0.19

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.
Files changed (39) hide show
  1. package/configs/dependencies.json +6 -0
  2. package/configs/imports.json +3 -1
  3. package/dist/index.cjs +14 -5
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.js +14 -6
  6. package/dist/index.js.map +1 -1
  7. package/dist/types/components/attachment.d.ts +45 -0
  8. package/dist/types/components/attachment.d.ts.map +1 -0
  9. package/dist/types/components/avatar.d.ts +1 -1
  10. package/dist/types/components/avatar.d.ts.map +1 -1
  11. package/dist/types/components/badge.d.ts +1 -1
  12. package/dist/types/components/button.d.ts +2 -2
  13. package/dist/types/components/dialog-item.d.ts +4 -4
  14. package/dist/types/components/dialog-item.d.ts.map +1 -1
  15. package/dist/types/components/stream-view.d.ts.map +1 -1
  16. package/dist/types/components/switch.d.ts +6 -0
  17. package/dist/types/components/switch.d.ts.map +1 -0
  18. package/dist/types/components/utils.d.ts +1 -0
  19. package/dist/types/components/utils.d.ts.map +1 -1
  20. package/dist/types/index.d.ts +21 -4
  21. package/dist/types/index.d.ts.map +1 -1
  22. package/gen/components/attachment.jsx +214 -0
  23. package/gen/components/dialog-item.jsx +7 -7
  24. package/gen/components/dismiss-layer.jsx +1 -1
  25. package/gen/components/file-picker.jsx +2 -2
  26. package/gen/components/stream-view.jsx +1 -5
  27. package/gen/components/switch.jsx +25 -0
  28. package/gen/components/utils.js +4 -0
  29. package/gen/index.js +46 -0
  30. package/package.json +2 -1
  31. package/src/components/attachment.tsx +270 -0
  32. package/src/components/avatar.tsx +1 -1
  33. package/src/components/dialog-item.tsx +9 -9
  34. package/src/components/dismiss-layer.tsx +1 -1
  35. package/src/components/file-picker.tsx +2 -2
  36. package/src/components/stream-view.tsx +1 -5
  37. package/src/components/switch.tsx +27 -0
  38. package/src/components/utils.ts +4 -0
  39. package/src/index.ts +72 -4
@@ -0,0 +1,45 @@
1
+ import type React from 'react';
2
+ import { type LucideProps } from 'lucide-react';
3
+ interface AttachmentProps {
4
+ uid?: string;
5
+ url?: string;
6
+ mimeType?: string;
7
+ uploading?: boolean;
8
+ onReady?: (skipOnce?: boolean) => void;
9
+ linkProps?: AttachmentLinkProps;
10
+ containerProps?: React.ComponentProps<'div'>;
11
+ }
12
+ interface AttachmentLinkProps extends React.ComponentProps<'a'>, Omit<AttachmentProps, 'containerProps' & 'mimeType' & 'onReady'> {
13
+ children?: React.ReactNode;
14
+ }
15
+ interface AttachmentImageProps extends React.ComponentProps<'img'>, Omit<AttachmentProps, 'containerProps' & 'mimeType'> {
16
+ }
17
+ interface AttachmentAudioProps extends React.ComponentProps<'audio'>, Omit<AttachmentProps, 'linkProps' & 'mimeType' & 'onReady'> {
18
+ }
19
+ interface AttachmentVideoProps extends React.ComponentProps<'video'>, Omit<AttachmentProps, 'linkProps' & 'mimeType'> {
20
+ maxSize?: number;
21
+ }
22
+ interface AttachmentFileProps extends LucideProps, Omit<AttachmentProps, 'containerProps' & 'mimeType'> {
23
+ name?: string | undefined;
24
+ iconElement?: React.ReactNode;
25
+ }
26
+ interface AttachmentFailedProps extends LucideProps, Omit<AttachmentProps, 'linkProps' & 'mimeType'> {
27
+ name?: string | undefined;
28
+ iconElement?: React.ReactNode;
29
+ }
30
+ declare const AttachmentLink: React.ForwardRefExoticComponent<Omit<AttachmentLinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
31
+ declare const AttachmentAudio: React.ForwardRefExoticComponent<Omit<AttachmentAudioProps, "ref"> & React.RefAttributes<HTMLAudioElement>>;
32
+ declare const AttachmentVideo: React.ForwardRefExoticComponent<Omit<AttachmentVideoProps, "ref"> & React.RefAttributes<HTMLVideoElement>>;
33
+ declare const AttachmentImage: React.ForwardRefExoticComponent<Omit<AttachmentImageProps, "ref"> & React.RefAttributes<HTMLImageElement>>;
34
+ declare function AttachmentFile({ url, name, uploading, iconElement, linkProps, ...props }: AttachmentFileProps): import("react/jsx-runtime").JSX.Element;
35
+ declare namespace AttachmentFile {
36
+ var displayName: string;
37
+ }
38
+ declare function AttachmentFailed({ name, uploading, iconElement, containerProps, ...props }: AttachmentFailedProps): import("react/jsx-runtime").JSX.Element;
39
+ declare namespace AttachmentFailed {
40
+ var displayName: string;
41
+ }
42
+ declare function AttachmentBase({ mimeType, ...props }: AttachmentProps): import("react/jsx-runtime").JSX.Element;
43
+ declare const Attachment: React.MemoExoticComponent<typeof AttachmentBase>;
44
+ export { Attachment, AttachmentLink, AttachmentImage, AttachmentAudio, AttachmentVideo, AttachmentFile, AttachmentFailed, type AttachmentLinkProps, type AttachmentImageProps, type AttachmentAudioProps, type AttachmentVideoProps, type AttachmentFileProps, type AttachmentFailedProps, type AttachmentProps, };
45
+ //# sourceMappingURL=attachment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../../src/components/attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAInE,UAAU,eAAe;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,cAAc,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;CAC9C;AAED,UAAU,mBACR,SAAQ,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,EAC/B,IAAI,CAAC,eAAe,EAAE,gBAAgB,GAAG,UAAU,GAAG,SAAS,CAAC;IAClE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED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AkBvB;kBAxBQ,gBAAgB;;;AA4BzB,iBAAS,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAiB9D;AAED,QAAA,MAAM,UAAU,kDAAuB,CAAC;AAExC,OAAO,EACL,UAAU,EACV,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,GACrB,CAAC"}
@@ -4,7 +4,7 @@ import { type PresenceStatus, type PresenceBadgeProps } from './presence';
4
4
  interface AvatarProps extends AvatarPrimitive.AvatarProps {
5
5
  src?: string | undefined;
6
6
  name?: string | undefined;
7
- online?: boolean;
7
+ online?: boolean | undefined;
8
8
  presence?: PresenceStatus;
9
9
  onlineProps?: React.ComponentProps<'div'>;
10
10
  presenceProps?: PresenceBadgeProps;
@@ -1 +1 @@
1
- {"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../../src/components/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGzF,UAAU,WAAY,SAAQ,eAAe,CAAC,WAAW;IACvD,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC1C,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,UAAU,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC;IAC9C,aAAa,CAAC,EAAE,eAAe,CAAC,mBAAmB,CAAC;CACrD;AAyDD,QAAA,MAAM,MAAM,+EAA4D,CAAC;AAIzE,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../../src/components/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGzF,UAAU,WAAY,SAAQ,eAAe,CAAC,WAAW;IACvD,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC1C,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,UAAU,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC;IAC9C,aAAa,CAAC,EAAE,eAAe,CAAC,mBAAmB,CAAC;CACrD;AAyDD,QAAA,MAAM,MAAM,+EAA4D,CAAC;AAIzE,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,CAAC"}
@@ -4,7 +4,7 @@ interface BadgeProps extends React.HTMLAttributes<HTMLElement>, VariantProps<typ
4
4
  asChild?: boolean;
5
5
  }
6
6
  declare const badgeVariants: (props?: ({
7
- variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
7
+ variant?: "default" | "outline" | "secondary" | "destructive" | null | undefined;
8
8
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
9
9
  declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLElement>>;
10
10
  export { Badge, type BadgeProps };
@@ -4,8 +4,8 @@ interface ButtonProps extends React.ComponentProps<'button'>, VariantProps<typeo
4
4
  asChild?: boolean;
5
5
  }
6
6
  declare const buttonVariants: (props?: ({
7
- variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
8
- size?: "default" | "sm" | "lg" | "icon" | null | undefined;
7
+ variant?: "default" | "link" | "outline" | "secondary" | "destructive" | "ghost" | null | undefined;
8
+ size?: "default" | "icon" | "sm" | "lg" | null | undefined;
9
9
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
10
10
  declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
11
11
  export { Button, type ButtonProps };
@@ -1,9 +1,9 @@
1
1
  import type React from 'react';
2
- import { type LucideProps } from 'lucide-react';
3
2
  import { type AvatarProps } from './avatar';
4
- import { type PresenceStatus } from './presence';
5
- import { type StatusSentProps } from './status-sent';
3
+ import { type LucideProps } from 'lucide-react';
6
4
  import { type FormattedDateProps } from './formatted-date';
5
+ import { type StatusSentProps } from './status-sent';
6
+ import { type PresenceStatus } from './presence';
7
7
  import { type BadgeProps } from './badge';
8
8
  interface DialogItemProps extends React.ComponentProps<'div'> {
9
9
  index?: number;
@@ -42,5 +42,5 @@ interface DialogItemProps extends React.ComponentProps<'div'> {
42
42
  dividerProps?: React.ComponentProps<'div'>;
43
43
  }
44
44
  declare const DialogItem: React.NamedExoticComponent<Omit<DialogItemProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
45
- export { DialogItem };
45
+ export { DialogItem, type DialogItemProps };
46
46
  //# sourceMappingURL=dialog-item.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog-item.d.ts","sourceRoot":"","sources":["../../../src/components/dialog-item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAA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AAM,oBAAoB,wHAA2F,CAAC;AAItH,OAAO,EACL,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,GAC7B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import * as SwitchPrimitive from '@radix-ui/react-switch';
3
+ type SwitchProps = React.ComponentProps<typeof SwitchPrimitive.Root>;
4
+ declare function Switch(props: SwitchProps): import("react/jsx-runtime").JSX.Element;
5
+ export { Switch, type SwitchProps };
6
+ //# sourceMappingURL=switch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/components/switch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAG1D,KAAK,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;AAErE,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,2CAgBjC;AAED,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { type ClassValue } from 'clsx';
2
2
  export declare function cn(...inputs: ClassValue[]): string;
3
+ export declare function getRandomString(length?: number): string;
3
4
  export declare function capitalize(str?: string): string;
4
5
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/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,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/C"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/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;AAED,wBAAgB,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAE/C"}
@@ -1,5 +1,22 @@
1
- export { DismissLayer } from './components/dismiss-layer';
2
- export type { DismissLayerProps } from './components/dismiss-layer';
3
- export { StreamView, LocalStreamView, RemoteStreamView, FullscreenStreamView } from './components/stream-view';
4
- export type { StreamViewProps, FullscreenStreamViewProps, FullscreenStreamViewRef } from './components/stream-view';
1
+ export { Attachment, AttachmentLink, AttachmentImage, AttachmentAudio, AttachmentVideo, AttachmentFile, AttachmentFailed, type AttachmentProps, type AttachmentLinkProps, type AttachmentImageProps, type AttachmentAudioProps, type AttachmentVideoProps, type AttachmentFileProps, type AttachmentFailedProps, } from './components/attachment';
2
+ export { Avatar, type AvatarProps } from './components/avatar';
3
+ export { Badge, type BadgeProps } from './components/badge';
4
+ export { Button, type ButtonProps } from './components/button';
5
+ export { DialogItem, type DialogItemProps } from './components/dialog-item';
6
+ export { DismissLayer, type DismissLayerProps } from './components/dismiss-layer';
7
+ export { FilePickerInput, FilePickerDropzone, type FilePickerInputProps, type FilePickerDropzoneProps, } from './components/file-picker';
8
+ export { FormattedDate, type FormattedDateProps } from './components/formatted-date';
9
+ export { Input, type InputProps } from './components/input';
10
+ export { Label, type LabelProps } from './components/label';
11
+ export { LinkPreview, type LinkPreviewProps } from './components/link-preview';
12
+ export { LinkifyText, type LinkifyTextProps } from './components/linkify-text';
13
+ export { PlaceholderText, type PlaceholderTextProps } from './components/placeholder-text';
14
+ export { Presence, PresenceBadge, type PresenceStatus, type PresenceProps, type PresenceBadgeProps, } from './components/presence';
15
+ export { Search, type SearchProps } from './components/search';
16
+ export { Spinner, type SpinnerProps } from './components/spinner';
17
+ export { StatusIndicator, type StatusName, type StatusIndicatorProps } from './components/status-indicator';
18
+ export { StatusSent, type StatusSentProps } from './components/status-sent';
19
+ export { StreamView, LocalStreamView, RemoteStreamView, FullscreenStreamView, type StreamViewProps, type FullscreenStreamViewProps, type FullscreenStreamViewRef, } from './components/stream-view';
20
+ export { Switch, type SwitchProps } from './components/switch';
21
+ export * from './components/utils';
5
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,YAAY,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAE/G,YAAY,EAAE,eAAe,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,GAC3B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,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EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE/D,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,214 @@
1
+ import { forwardRef, memo, useImperativeHandle, useRef, useState } from 'react';
2
+ import { File, FileXCorner } from 'lucide-react';
3
+ import { Spinner } from './spinner';
4
+ import { cn, getRandomString } from './utils';
5
+
6
+ function AttachmentLinkBase({ url, uploading = false, children, ...props }, ref) {
7
+ return (
8
+ <a
9
+ ref={ref}
10
+ target="_blank"
11
+ rel="noopener noreferrer"
12
+ {...props}
13
+ href={url}
14
+ className={cn(
15
+ 'group relative min-h-12 min-w-12 w-full flex items-center justify-center rounded-md overflow-hidden bg-ring/10 hover:bg-ring/20 transition-color duration-300 ease-out cursor-pointer',
16
+ props?.className
17
+ )}
18
+ >
19
+ {children}
20
+ <Spinner loading={uploading} layout="overlay" />
21
+ </a>
22
+ );
23
+ }
24
+
25
+ const AttachmentLink = forwardRef(AttachmentLinkBase);
26
+
27
+ AttachmentLink.displayName = 'AttachmentLink';
28
+
29
+ function AttachmentAudioBase({ uid, url, uploading = false, containerProps, ...props }, ref) {
30
+ const audioId = `attachment_audio_${uid || getRandomString()}`;
31
+
32
+ return (
33
+ <div
34
+ {...containerProps}
35
+ className={cn('relative min-h-12 min-w-12 w-full rounded-md overflow-hidden', containerProps?.className)}
36
+ >
37
+ <audio ref={ref} src={url} id={audioId} controls {...props} />
38
+ <Spinner loading={uploading} layout="overlay" />
39
+ </div>
40
+ );
41
+ }
42
+
43
+ const AttachmentAudio = forwardRef(AttachmentAudioBase);
44
+
45
+ function AttachmentVideoBase(
46
+ { uid, url, maxSize = 360, uploading = false, onReady = () => {}, containerProps, ...props },
47
+ ref
48
+ ) {
49
+ const videoId = `attachment_video_${uid || getRandomString()}`;
50
+ const videoMaxSize = `${maxSize}px`;
51
+ const playerRef = useRef(null);
52
+ const [style, setStyle] = useState({
53
+ maxHeight: videoMaxSize,
54
+ maxWidth: videoMaxSize,
55
+ });
56
+ const handleCanPlay = (event) => {
57
+ const player = playerRef.current;
58
+
59
+ if (player) {
60
+ const { videoWidth, videoHeight } = player;
61
+ const ratio = videoWidth / videoHeight || 1;
62
+ const height = ratio < 1 ? videoMaxSize : `${Math.round(maxSize / ratio)}px`;
63
+ const width = ratio < 1 ? `${Math.round(maxSize * ratio)}px` : videoMaxSize;
64
+
65
+ setStyle({
66
+ height,
67
+ width,
68
+ maxHeight: height,
69
+ maxWidth: width,
70
+ });
71
+ props.onCanPlay?.(event);
72
+ onReady();
73
+ }
74
+ };
75
+
76
+ useImperativeHandle(ref, () => playerRef.current, []);
77
+
78
+ return (
79
+ <div
80
+ {...containerProps}
81
+ className={cn('relative min-h-20 w-full rounded-md overflow-hidden', containerProps?.className)}
82
+ >
83
+ <video
84
+ id={videoId}
85
+ ref={playerRef}
86
+ src={url}
87
+ controls
88
+ preload="metadata"
89
+ style={style}
90
+ {...props}
91
+ onCanPlay={handleCanPlay}
92
+ className={cn('size-full', props?.className)}
93
+ />
94
+ <Spinner loading={uploading} layout="overlay" />
95
+ </div>
96
+ );
97
+ }
98
+
99
+ const AttachmentVideo = forwardRef(AttachmentVideoBase);
100
+
101
+ AttachmentVideo.displayName = 'AttachmentVideo';
102
+
103
+ function AttachmentImageBase({ uid, url, uploading = false, onReady = () => {}, linkProps, ...props }, ref) {
104
+ const imageId = `attachment_image_${uid || getRandomString()}`;
105
+ const handleLoad = (event) => {
106
+ props.onLoad?.(event);
107
+ onReady();
108
+ };
109
+
110
+ return (
111
+ <AttachmentLink href={url} uploading={uploading} {...linkProps}>
112
+ <img
113
+ ref={ref}
114
+ src={url}
115
+ id={imageId}
116
+ alt="attachment"
117
+ {...props}
118
+ className={cn(
119
+ 'rounded-md object-cover min-h-12 min-w-12 max-h-[360px] group-hover:scale-103 transition-transform duration-300 ease-out',
120
+ props?.className
121
+ )}
122
+ onLoad={handleLoad}
123
+ />
124
+ </AttachmentLink>
125
+ );
126
+ }
127
+
128
+ const AttachmentImage = forwardRef(AttachmentImageBase);
129
+
130
+ AttachmentImage.displayName = 'AttachmentImage';
131
+
132
+ function AttachmentFile({ url, name, uploading = false, iconElement, linkProps, ...props }) {
133
+ const fileId = `attachment_file_${props.id || getRandomString()}`;
134
+
135
+ return (
136
+ <AttachmentLink
137
+ href={url}
138
+ uploading={uploading}
139
+ {...linkProps}
140
+ className={cn('flex-row gap-2 px-2', linkProps?.className)}
141
+ >
142
+ {iconElement || (
143
+ <File
144
+ id={fileId}
145
+ {...props}
146
+ className={cn(
147
+ 'size-6 shrink-0 text-foreground/85 group-hover:text-foreground duration-300 ease-out',
148
+ props?.className
149
+ )}
150
+ />
151
+ )}
152
+ {name && (
153
+ <span className="font-medium line-clamp-1 break-all text-foreground/85 group-hover:text-foreground duration-300 ease-out">
154
+ {name}
155
+ </span>
156
+ )}
157
+ </AttachmentLink>
158
+ );
159
+ }
160
+
161
+ AttachmentFile.displayName = 'AttachmentFile';
162
+
163
+ function AttachmentFailed({ name = 'Unknown file', uploading = false, iconElement, containerProps, ...props }) {
164
+ const failedId = `attachment_failed_${props.id || getRandomString()}`;
165
+
166
+ return (
167
+ <div
168
+ {...containerProps}
169
+ className={cn(
170
+ 'relative min-h-12 min-w-12 w-full flex flex-row items-center justify-center gap-2 px-2 bg-red-600/10 rounded-md overflow-hidden',
171
+ containerProps?.className
172
+ )}
173
+ >
174
+ {iconElement || (
175
+ <FileXCorner id={failedId} {...props} className={cn('size-6 shrink-0 text-red-600', props?.className)} />
176
+ )}
177
+ <span className="font-medium line-clamp-1 break-all text-red-600">{name}</span>
178
+ <Spinner loading={uploading} layout="overlay" />
179
+ </div>
180
+ );
181
+ }
182
+
183
+ AttachmentFailed.displayName = 'AttachmentFailed';
184
+
185
+ function AttachmentBase({ mimeType, ...props }) {
186
+ const [type = ''] = mimeType?.split('/') || [];
187
+
188
+ if (!props.url) {
189
+ return <AttachmentFailed {...props} />;
190
+ }
191
+
192
+ switch (type) {
193
+ case 'image':
194
+ return <AttachmentImage {...props} />;
195
+ case 'video':
196
+ return <AttachmentVideo {...props} />;
197
+ case 'audio':
198
+ return <AttachmentAudio {...props} />;
199
+ default:
200
+ return <AttachmentFile name={mimeType} {...props} />;
201
+ }
202
+ }
203
+
204
+ const Attachment = memo(AttachmentBase);
205
+
206
+ export {
207
+ Attachment,
208
+ AttachmentLink,
209
+ AttachmentImage,
210
+ AttachmentAudio,
211
+ AttachmentVideo,
212
+ AttachmentFile,
213
+ AttachmentFailed,
214
+ };
@@ -1,9 +1,9 @@
1
- import { forwardRef, memo } from 'react';
2
- import { Users } from 'lucide-react';
3
- import { cn } from './utils';
4
1
  import { Avatar } from './avatar';
5
- import { StatusSent } from './status-sent';
2
+ import { Users } from 'lucide-react';
3
+ import { forwardRef, memo } from 'react';
6
4
  import { FormattedDate } from './formatted-date';
5
+ import { StatusSent } from './status-sent';
6
+ import { cn } from './utils';
7
7
  import { Badge } from './badge';
8
8
 
9
9
  function DialogItemBase(
@@ -46,9 +46,9 @@ function DialogItemBase(
46
46
  },
47
47
  ref
48
48
  ) {
49
- const avatarSource = photo || avatarProps?.src || undefined;
50
- const avatarFallback = name || avatarProps?.name || undefined;
51
- const avatarOnline = isPrivateDialog ? userOnline || avatarProps?.online || false : false;
49
+ const avatarSource = photo || avatarProps?.src;
50
+ const avatarFallback = name || avatarProps?.name;
51
+ const avatarOnline = isPrivateDialog ? userOnline || avatarProps?.online : false;
52
52
  const avatarPresence = isPrivateDialog ? userPresence || avatarProps?.presence : undefined;
53
53
  const showTopDivider = divider === 'top' || (divider === 'both' && index === 0);
54
54
  const showBottomDivider = divider === 'bottom' || divider === 'both';
@@ -7,7 +7,7 @@ function DismissLayerBase(
7
7
  ) {
8
8
  const innerRef = useRef(null);
9
9
 
10
- useImperativeHandle(ref, () => innerRef.current);
10
+ useImperativeHandle(ref, () => innerRef.current, []);
11
11
 
12
12
  const handleClickOrTouch = useCallback(
13
13
  (e) => {
@@ -152,14 +152,14 @@ function FilePickerDropzoneBase(
152
152
  onDragLeave={handleDragLeave}
153
153
  onDragOver={handleDragEvent}
154
154
  {...props}
155
- className={cn('size-full relative', props?.className)}
155
+ className={cn('relative size-full min-h-0', props?.className)}
156
156
  >
157
157
  {children}
158
158
  <div
159
159
  onDrop={handleDrop}
160
160
  {...dropZoneProps}
161
161
  className={cn(
162
- 'group absolute top-0 left-0 size-full',
162
+ 'absolute top-0 left-0 size-full',
163
163
  'flex items-center justify-center',
164
164
  'transition-all duration-300 ease-out',
165
165
  'border-2 border-dashed border-ring bg-ring/25 rounded-md',
@@ -1,10 +1,6 @@
1
1
  import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
2
2
  import { Maximize, Minimize, PictureInPicture2 } from 'lucide-react';
3
- import { cn } from './utils';
4
-
5
- function getRandomString(length = 8) {
6
- return (Date.now() / Math.random()).toString(36).replace('.', '').slice(0, length);
7
- }
3
+ import { cn, getRandomString } from './utils';
8
4
 
9
5
  function StreamViewBase({ id, stream, mirror, className, muted, ...props }, ref) {
10
6
  const innerRef = useRef(null);
@@ -0,0 +1,25 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import * as SwitchPrimitive from '@radix-ui/react-switch';
5
+ import { cn } from './utils';
6
+
7
+ function Switch(props) {
8
+ return (
9
+ <SwitchPrimitive.Root
10
+ {...props}
11
+ className={cn(
12
+ 'peer data-[state=checked]:bg-ring data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15em] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring disabled:cursor-not-allowed disabled:opacity-50',
13
+ props?.className
14
+ )}
15
+ >
16
+ <SwitchPrimitive.Thumb
17
+ className={cn(
18
+ 'bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0'
19
+ )}
20
+ />
21
+ </SwitchPrimitive.Root>
22
+ );
23
+ }
24
+
25
+ export { Switch };
@@ -5,6 +5,10 @@ export function cn(...inputs) {
5
5
  return twMerge(clsx(inputs));
6
6
  }
7
7
 
8
+ export function getRandomString(length = 8) {
9
+ return (Date.now() / Math.random()).toString(36).replace('.', '').slice(0, length);
10
+ }
11
+
8
12
  export function capitalize(str) {
9
13
  return typeof str === 'string' && str.length > 0 ? `${str[0]?.toUpperCase()}${str.slice(1)}` : '';
10
14
  }
package/gen/index.js CHANGED
@@ -1,3 +1,49 @@
1
+ export {
2
+ Attachment,
3
+ AttachmentLink,
4
+ AttachmentImage,
5
+ AttachmentAudio,
6
+ AttachmentVideo,
7
+ AttachmentFile,
8
+ AttachmentFailed,
9
+ } from './components/attachment';
10
+
11
+ export { Avatar } from './components/avatar';
12
+
13
+ export { Badge } from './components/badge';
14
+
15
+ export { Button } from './components/button';
16
+
17
+ export { DialogItem } from './components/dialog-item';
18
+
1
19
  export { DismissLayer } from './components/dismiss-layer';
2
20
 
21
+ export { FilePickerInput, FilePickerDropzone } from './components/file-picker';
22
+
23
+ export { FormattedDate } from './components/formatted-date';
24
+
25
+ export { Input } from './components/input';
26
+
27
+ export { Label } from './components/label';
28
+
29
+ export { LinkPreview } from './components/link-preview';
30
+
31
+ export { LinkifyText } from './components/linkify-text';
32
+
33
+ export { PlaceholderText } from './components/placeholder-text';
34
+
35
+ export { Presence, PresenceBadge } from './components/presence';
36
+
37
+ export { Search } from './components/search';
38
+
39
+ export { Spinner } from './components/spinner';
40
+
41
+ export { StatusIndicator } from './components/status-indicator';
42
+
43
+ export { StatusSent } from './components/status-sent';
44
+
3
45
  export { StreamView, LocalStreamView, RemoteStreamView, FullscreenStreamView } from './components/stream-view';
46
+
47
+ export { Switch } from './components/switch';
48
+
49
+ export * from './components/utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connectycube/react-ui-kit",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
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": {
@@ -66,6 +66,7 @@
66
66
  "@radix-ui/react-avatar": "^1.1.11",
67
67
  "@radix-ui/react-label": "^2.1.8",
68
68
  "@radix-ui/react-slot": "^1.2.4",
69
+ "@radix-ui/react-switch": "^1.2.6",
69
70
  "@radix-ui/react-tooltip": "^1.2.8",
70
71
  "class-variance-authority": "^0.7.1",
71
72
  "clsx": "^2.1.1",