@rovula/ui 0.1.27 → 0.1.28

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.
@@ -22,7 +22,7 @@ type AvatarImageProps = {
22
22
  type: "image";
23
23
  } & BaseAvatarProps;
24
24
  type AvatarIconProps = {
25
- icon: string;
25
+ icon: React.ReactNode;
26
26
  type: "icon";
27
27
  } & BaseAvatarProps;
28
28
  export type AvatarProps = AvatarTextProps | AvatarImageProps | AvatarIconProps;
@@ -34,7 +34,7 @@ declare const meta: {
34
34
  fallbackClassName?: string | undefined;
35
35
  style?: React.CSSProperties | undefined;
36
36
  } | {
37
- icon: string & React.ReactNode;
37
+ icon: React.ReactNode;
38
38
  type: "icon";
39
39
  imageUrl?: string | undefined;
40
40
  text?: string | undefined;
@@ -1,4 +1,5 @@
1
1
  export declare const avatarVariants: (props?: ({
2
2
  size?: "sm" | "md" | "lg" | "xxs" | "xs" | null | undefined;
3
3
  rounded?: "none" | "normal" | "full" | null | undefined;
4
+ hasImage?: boolean | null | undefined;
4
5
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
package/dist/index.d.ts CHANGED
@@ -542,7 +542,7 @@ type AvatarImageProps = {
542
542
  type: "image";
543
543
  } & BaseAvatarProps;
544
544
  type AvatarIconProps = {
545
- icon: string;
545
+ icon: React.ReactNode;
546
546
  type: "icon";
547
547
  } & BaseAvatarProps;
548
548
  type AvatarProps = AvatarTextProps | AvatarImageProps | AvatarIconProps;
@@ -7055,6 +7055,11 @@ input[type=number] {
7055
7055
  background-color: color-mix(in srgb, var(--transparent-warning-8) calc(100% * var(--tw-bg-opacity, 1)), transparent);
7056
7056
  }
7057
7057
 
7058
+ .bg-white {
7059
+ --tw-bg-opacity: 1;
7060
+ background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
7061
+ }
7062
+
7058
7063
  .bg-white-transparent-12 {
7059
7064
  --tw-bg-opacity: 1;
7060
7065
  background-color: color-mix(in srgb, var(--transparent-white-12) calc(100% * var(--tw-bg-opacity, 1)), transparent);
@@ -7325,6 +7330,16 @@ input[type=number] {
7325
7330
  stroke: color-mix(in srgb, var(--state-primary-default) calc(100% * 1), transparent);
7326
7331
  }
7327
7332
 
7333
+ .object-cover {
7334
+ -o-object-fit: cover;
7335
+ object-fit: cover;
7336
+ }
7337
+
7338
+ .object-top {
7339
+ -o-object-position: top;
7340
+ object-position: top;
7341
+ }
7342
+
7328
7343
  .\!p-0 {
7329
7344
  padding: 0px !important;
7330
7345
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rovula/ui",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "main": "dist/cjs/bundle.js",
5
5
  "module": "dist/esm/bundle.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,11 +18,14 @@ export const avatarVariants = cva(
18
18
  full: "rounded-full",
19
19
  none: "rounded-none",
20
20
  },
21
+ hasImage: {
22
+ true: "bg-white",
23
+ },
21
24
  },
22
25
 
23
26
  defaultVariants: {
24
27
  size: "md",
25
28
  rounded: "normal",
26
29
  },
27
- }
30
+ },
28
31
  );
@@ -31,7 +31,7 @@ type AvatarImageProps = {
31
31
  } & BaseAvatarProps;
32
32
 
33
33
  type AvatarIconProps = {
34
- icon: string;
34
+ icon: React.ReactNode;
35
35
  type: "icon";
36
36
  } & BaseAvatarProps;
37
37
 
@@ -61,7 +61,8 @@ const Avatar: React.FC<AvatarProps> = ({
61
61
  children,
62
62
  style,
63
63
  }) => {
64
- const avatarClassname = avatarVariants({ size, rounded });
64
+ const hasImage = !!imageUrl;
65
+ const avatarClassname = avatarVariants({ size, rounded, hasImage });
65
66
 
66
67
  return (
67
68
  <AvatarBase className={cn(avatarClassname, className)} style={style}>
@@ -13,7 +13,7 @@ const AvatarBase = React.forwardRef<
13
13
  ref={ref}
14
14
  className={cn(
15
15
  "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
16
- className
16
+ className,
17
17
  )}
18
18
  {...props}
19
19
  />
@@ -26,7 +26,7 @@ const AvatarImage = React.forwardRef<
26
26
  >(({ className, ...props }, ref) => (
27
27
  <AvatarPrimitive.Image
28
28
  ref={ref}
29
- className={cn("aspect-square h-full w-full", className)}
29
+ className={cn("object-cover object-top h-full w-full", className)}
30
30
  {...props}
31
31
  />
32
32
  ));
@@ -40,7 +40,7 @@ const AvatarFallback = React.forwardRef<
40
40
  ref={ref}
41
41
  className={cn(
42
42
  "flex h-full w-full items-center justify-center rounded-full bg-inherit text-inherit",
43
- className
43
+ className,
44
44
  )}
45
45
  {...props}
46
46
  />