@neasg/design-system 0.4.2 → 0.4.3

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/dist/avatar.d.ts CHANGED
@@ -7,29 +7,35 @@ export type AvatarSize = "sm" | "md";
7
7
  interface AvatarProps extends Omit<React.ComponentPropsWithoutRef<typeof AvatarRoot>, "children"> {
8
8
  src?: string | null;
9
9
  alt?: string;
10
- fallback: React.ReactNode;
10
+ fallback?: React.ReactNode;
11
11
  size?: AvatarSize;
12
+ loading?: boolean;
12
13
  imageClassName?: string;
13
14
  fallbackClassName?: string;
14
15
  }
15
16
  interface AvatarProfileProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "role"> {
16
17
  src?: string | null;
17
18
  alt?: string;
18
- fallback: React.ReactNode;
19
+ fallback?: React.ReactNode;
19
20
  size?: AvatarSize;
21
+ loading?: boolean;
20
22
  name?: React.ReactNode;
21
23
  role?: React.ReactNode;
22
24
  rolePlacement?: "above" | "below";
25
+ topInfo?: React.ReactNode;
26
+ bottomInfo?: React.ReactNode;
23
27
  avatarClassName?: string;
24
28
  imageClassName?: string;
25
29
  fallbackClassName?: string;
26
30
  contentClassName?: string;
27
31
  nameClassName?: string;
28
32
  roleClassName?: string;
33
+ topInfoClassName?: string;
34
+ bottomInfoClassName?: string;
29
35
  avatarOverlay?: React.ReactNode;
30
36
  }
31
- declare function Avatar({ src, alt, fallback, size, className, imageClassName, fallbackClassName, ...props }: AvatarProps): import("react/jsx-runtime").JSX.Element;
32
- declare function AvatarProfile({ src, alt, fallback, size, name, role, rolePlacement, className, avatarClassName, imageClassName, fallbackClassName, contentClassName, nameClassName, roleClassName, avatarOverlay, ...props }: AvatarProfileProps): import("react/jsx-runtime").JSX.Element;
37
+ declare function Avatar({ src, alt, fallback, size, loading, className, imageClassName, fallbackClassName, ...props }: AvatarProps): import("react/jsx-runtime").JSX.Element;
38
+ declare function AvatarProfile({ src, alt, fallback, size, loading, name, role, rolePlacement, topInfo, bottomInfo, className, avatarClassName, imageClassName, fallbackClassName, contentClassName, nameClassName, roleClassName, topInfoClassName, bottomInfoClassName, avatarOverlay, ...props }: AvatarProfileProps): import("react/jsx-runtime").JSX.Element;
33
39
  export { Avatar, AvatarProfile, AvatarRoot, AvatarImage, AvatarFallback };
34
40
  export type AvatarRootProps = React.ComponentPropsWithoutRef<typeof AvatarRoot>;
35
41
  export type { AvatarProps, AvatarProfileProps };
package/dist/avatar.js CHANGED
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
5
5
  import { cn } from "./lib/utils";
6
+ import { Skeleton } from "./skeleton";
6
7
  const AvatarRoot = React.forwardRef(({ className, ...props }, ref) => (_jsx(AvatarPrimitive.Root, { ref: ref, className: cn("relative flex shrink-0 overflow-hidden rounded-full", className), ...props })));
7
8
  AvatarRoot.displayName = "AvatarRoot";
8
9
  const AvatarImage = React.forwardRef(({ className, ...props }, ref) => (_jsx(AvatarPrimitive.Image, { ref: ref, className: cn("aspect-square size-full", className), ...props })));
@@ -13,13 +14,25 @@ const avatarSizeClasses = {
13
14
  sm: "h-8 w-8 text-xs",
14
15
  md: "h-10 w-10 text-sm",
15
16
  };
16
- function Avatar({ src, alt = "", fallback, size = "sm", className, imageClassName, fallbackClassName, ...props }) {
17
+ function Avatar({ src, alt = "", fallback, size = "sm", loading = false, className, imageClassName, fallbackClassName, ...props }) {
18
+ if (loading) {
19
+ return (_jsx(Skeleton, { className: cn("shrink-0 rounded-full", avatarSizeClasses[size], className), ...props }));
20
+ }
17
21
  return (_jsxs(AvatarRoot, { className: cn(avatarSizeClasses[size], className), ...props, children: [src ? (_jsx(AvatarImage, { src: src, alt: alt, className: imageClassName })) : null, _jsx(AvatarFallback, { className: cn("bg-green-100 font-medium text-green-800", fallbackClassName), children: fallback })] }));
18
22
  }
19
- function AvatarProfile({ src, alt = "", fallback, size = "sm", name, role, rolePlacement = "above", className, avatarClassName, imageClassName, fallbackClassName, contentClassName, nameClassName, roleClassName, avatarOverlay, ...props }) {
20
- const hasMeta = name !== undefined || role !== undefined;
21
- const roleNode = role ? (_jsx("span", { className: cn("text-[10px] font-medium uppercase tracking-wide text-muted-foreground", roleClassName), children: role })) : null;
22
- const nameNode = name ? (_jsx("span", { className: cn("truncate text-sm font-medium text-foreground", nameClassName), children: name })) : null;
23
- return (_jsxs("div", { className: cn("flex items-center gap-2", className), ...props, children: [_jsxs("div", { className: "relative shrink-0", children: [_jsx(Avatar, { src: src, alt: alt, fallback: fallback, size: size, className: avatarClassName, imageClassName: imageClassName, fallbackClassName: fallbackClassName }), avatarOverlay] }), hasMeta ? (_jsxs("div", { className: cn("flex min-w-0 flex-1 flex-col", contentClassName), children: [rolePlacement === "above" ? roleNode : null, nameNode, rolePlacement === "below" ? roleNode : null] })) : null] }));
23
+ function AvatarProfile({ src, alt = "", fallback, size = "sm", loading = false, name, role, rolePlacement = "above", topInfo, bottomInfo, className, avatarClassName, imageClassName, fallbackClassName, contentClassName, nameClassName, roleClassName, topInfoClassName, bottomInfoClassName, avatarOverlay, ...props }) {
24
+ const resolvedTop = topInfo !== null && topInfo !== void 0 ? topInfo : (rolePlacement === "above" ? role : undefined);
25
+ const resolvedBottom = bottomInfo !== null && bottomInfo !== void 0 ? bottomInfo : (rolePlacement === "below" ? role : undefined);
26
+ if (loading) {
27
+ return (_jsxs("div", { className: cn("flex items-center gap-2", className), "aria-busy": "true", ...props, children: [_jsx(Skeleton, { className: cn("shrink-0 rounded-full", avatarSizeClasses[size], avatarClassName) }), _jsxs("div", { className: cn("flex min-w-0 flex-1 flex-col gap-1.5", contentClassName), children: [resolvedTop !== undefined ? (_jsx(Skeleton, { className: "h-3 w-20" })) : null, _jsx(Skeleton, { className: "h-4 w-32" }), resolvedBottom !== undefined ? (_jsx(Skeleton, { className: "h-3 w-20" })) : null] })] }));
28
+ }
29
+ const hasMeta = name !== undefined ||
30
+ resolvedTop !== undefined ||
31
+ resolvedBottom !== undefined;
32
+ const infoBaseClass = "truncate text-[10px] leading-tight font-medium uppercase tracking-wide text-muted-foreground";
33
+ const topNode = resolvedTop !== undefined && resolvedTop !== null ? (_jsx("span", { className: cn(infoBaseClass, topInfo !== undefined ? topInfoClassName : roleClassName), children: resolvedTop })) : null;
34
+ const bottomNode = resolvedBottom !== undefined && resolvedBottom !== null ? (_jsx("span", { className: cn(infoBaseClass, bottomInfo !== undefined ? bottomInfoClassName : roleClassName), children: resolvedBottom })) : null;
35
+ const nameNode = name ? (_jsx("span", { className: cn("truncate text-sm leading-tight font-medium text-foreground", nameClassName), children: name })) : null;
36
+ return (_jsxs("div", { className: cn("flex items-center gap-2", className), ...props, children: [_jsxs("div", { className: "relative shrink-0", children: [_jsx(Avatar, { src: src, alt: alt, fallback: fallback, size: size, className: avatarClassName, imageClassName: imageClassName, fallbackClassName: fallbackClassName }), avatarOverlay] }), hasMeta ? (_jsxs("div", { className: cn("flex min-w-0 flex-1 flex-col", contentClassName), children: [topNode, nameNode, bottomNode] })) : null] }));
24
37
  }
25
38
  export { Avatar, AvatarProfile, AvatarRoot, AvatarImage, AvatarFallback };
package/dist/command.d.ts CHANGED
@@ -45,7 +45,7 @@ declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
45
45
  ref?: React.Ref<HTMLDivElement>;
46
46
  } & {
47
47
  asChild?: boolean;
48
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
48
+ }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "heading" | "value"> & {
49
49
  heading?: React.ReactNode;
50
50
  value?: string;
51
51
  forceMount?: boolean;
@@ -16,6 +16,6 @@ function LabelValue({ label, value, className, labelClassName, hideIfEmpty = fal
16
16
  if (!loading && hideIfEmpty && empty) {
17
17
  return null;
18
18
  }
19
- return (_jsxs("div", { className: cn("min-w-0 h-full space-y-1", className), children: [!hideLabel && (loading ? (_jsx(Skeleton, { className: "h-3.5 w-20" })) : (_jsxs(Typography, { as: "p", variant: "label", className: labelClassName, children: [label, required ? (_jsx("span", { "aria-hidden": "true", className: "ml-0.5 text-destructive", children: "*" })) : null] }))), loading ? (_jsx(Skeleton, { className: "h-4 w-32" })) : (_jsx("div", { className: cn("min-w-0 break-words text-sm text-foreground", empty && "italic text-muted-foreground/60"), children: empty ? "-" : value }))] }));
19
+ return (_jsxs("div", { className: cn("min-w-0 h-full space-y-1", className), children: [!hideLabel && (loading ? (_jsx(Skeleton, { className: "h-3.5 w-20" })) : (_jsxs(Typography, { as: "p", variant: "label", className: cn("leading-tight", labelClassName), children: [label, required ? (_jsx("span", { "aria-hidden": "true", className: "ml-0.5 text-destructive", children: "*" })) : null] }))), loading ? (_jsx(Skeleton, { className: "h-4 w-32" })) : (_jsx("div", { className: cn("min-w-0 break-words text-sm text-foreground", empty && "italic text-muted-foreground/60"), children: empty ? "-" : value }))] }));
20
20
  }
21
21
  export { LabelValue };
package/dist/link.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  declare const linkVariants: (props?: ({
4
- variant?: "default" | "inherit" | "subtle" | null | undefined;
4
+ variant?: "inherit" | "default" | "subtle" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement>, VariantProps<typeof linkVariants> {
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  declare const typographyVariants: (props?: ({
4
- variant?: "label" | "body" | "caption" | "title" | "heading" | "subheading" | "bodySm" | "eyebrow" | null | undefined;
4
+ variant?: "title" | "heading" | "label" | "body" | "caption" | "subheading" | "bodySm" | "eyebrow" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  export interface TypographyProps extends React.HTMLAttributes<HTMLElement>, VariantProps<typeof typographyVariants> {
7
7
  as?: keyof React.JSX.IntrinsicElements;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neasg/design-system",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "NEA shared design system primitives, theme tokens, and Storybook docs.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",