@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;
@@ -13,7 +13,8 @@ export const formatAvatarName = (text) => {
13
13
  return `${first}${last}`;
14
14
  };
15
15
  const Avatar = ({ text, imageUrl, icon, fallback, size, rounded, className, imageClassName, fallbackClassName, type = "text", children, style, }) => {
16
- const avatarClassname = avatarVariants({ size, rounded });
16
+ const hasImage = !!imageUrl;
17
+ const avatarClassname = avatarVariants({ size, rounded, hasImage });
17
18
  return (_jsx(AvatarBase, { className: cn(avatarClassname, className), style: style, children: children || (_jsxs(_Fragment, { children: [type === "image" && (_jsxs(_Fragment, { children: [_jsx(AvatarImage, { src: imageUrl, className: cn(imageClassName) }), _jsx(AvatarFallback, { className: cn(fallbackClassName), children: typeof fallback === "string"
18
19
  ? formatAvatarName(fallback)
19
20
  : fallback })] })), type === "text" && formatAvatarName(text !== null && text !== void 0 ? text : ""), type === "icon" && icon] })) }));
@@ -15,6 +15,9 @@ export const avatarVariants = cva([
15
15
  full: "rounded-full",
16
16
  none: "rounded-none",
17
17
  },
18
+ hasImage: {
19
+ true: "bg-white",
20
+ },
18
21
  },
19
22
  defaultVariants: {
20
23
  size: "md",
@@ -21,7 +21,7 @@ const AvatarBase = React.forwardRef((_a, ref) => {
21
21
  AvatarBase.displayName = AvatarPrimitive.Root.displayName;
22
22
  const AvatarImage = React.forwardRef((_a, ref) => {
23
23
  var { className } = _a, props = __rest(_a, ["className"]);
24
- return (_jsx(AvatarPrimitive.Image, Object.assign({ ref: ref, className: cn("aspect-square h-full w-full", className) }, props)));
24
+ return (_jsx(AvatarPrimitive.Image, Object.assign({ ref: ref, className: cn("object-cover object-top h-full w-full", className) }, props)));
25
25
  });
26
26
  AvatarImage.displayName = AvatarPrimitive.Image.displayName;
27
27
  const AvatarFallback = React.forwardRef((_a, ref) => {
@@ -3173,6 +3173,10 @@ input[type=number] {
3173
3173
  --tw-bg-opacity: 1;
3174
3174
  background-color: color-mix(in srgb, var(--transparent-warning-8) calc(100% * var(--tw-bg-opacity, 1)), transparent);
3175
3175
  }
3176
+ .bg-white{
3177
+ --tw-bg-opacity: 1;
3178
+ background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
3179
+ }
3176
3180
  .bg-white-transparent-12{
3177
3181
  --tw-bg-opacity: 1;
3178
3182
  background-color: color-mix(in srgb, var(--transparent-white-12) calc(100% * var(--tw-bg-opacity, 1)), transparent);
@@ -3378,6 +3382,14 @@ input[type=number] {
3378
3382
  .stroke-primary-default{
3379
3383
  stroke: color-mix(in srgb, var(--state-primary-default) calc(100% * 1), transparent);
3380
3384
  }
3385
+ .object-cover{
3386
+ -o-object-fit: cover;
3387
+ object-fit: cover;
3388
+ }
3389
+ .object-top{
3390
+ -o-object-position: top;
3391
+ object-position: top;
3392
+ }
3381
3393
  .\!p-0{
3382
3394
  padding: 0px !important;
3383
3395
  }