@wallarm-org/design-system 2.9.0 → 3.0.0-rc-feat-code-connect.1

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.
@@ -0,0 +1,87 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import { cn } from "../../utils/cn.js";
4
+ import { useTestId } from "../../utils/testId.js";
5
+ import { OverflowTooltip, OverflowTooltipContent, OverflowTooltipTrigger } from "../OverflowTooltip/index.js";
6
+ import { useAvatarSize } from "./AvatarContext.js";
7
+ import { avatarNameVariants } from "./classes.js";
8
+ const AvatarName = (t0)=>{
9
+ const $ = c(21);
10
+ let children;
11
+ let className;
12
+ let props;
13
+ let ref;
14
+ if ($[0] !== t0) {
15
+ ({ ref, className, children, ...props } = t0);
16
+ $[0] = t0;
17
+ $[1] = children;
18
+ $[2] = className;
19
+ $[3] = props;
20
+ $[4] = ref;
21
+ } else {
22
+ children = $[1];
23
+ className = $[2];
24
+ props = $[3];
25
+ ref = $[4];
26
+ }
27
+ const testId = useTestId("name");
28
+ const size = useAvatarSize();
29
+ const t1 = ref;
30
+ let t2;
31
+ if ($[5] !== className || $[6] !== size) {
32
+ t2 = cn(avatarNameVariants({
33
+ size
34
+ }), className);
35
+ $[5] = className;
36
+ $[6] = size;
37
+ $[7] = t2;
38
+ } else t2 = $[7];
39
+ let t3;
40
+ if ($[8] !== children || $[9] !== props || $[10] !== t2 || $[11] !== testId) {
41
+ t3 = /*#__PURE__*/ jsx("span", {
42
+ ...props,
43
+ "data-slot": "avatar-name",
44
+ "data-testid": testId,
45
+ className: t2,
46
+ children: children
47
+ });
48
+ $[8] = children;
49
+ $[9] = props;
50
+ $[10] = t2;
51
+ $[11] = testId;
52
+ $[12] = t3;
53
+ } else t3 = $[12];
54
+ let t4;
55
+ if ($[13] !== t1 || $[14] !== t3) {
56
+ t4 = /*#__PURE__*/ jsx(OverflowTooltipTrigger, {
57
+ ref: t1,
58
+ children: t3
59
+ });
60
+ $[13] = t1;
61
+ $[14] = t3;
62
+ $[15] = t4;
63
+ } else t4 = $[15];
64
+ let t5;
65
+ if ($[16] !== children) {
66
+ t5 = /*#__PURE__*/ jsx(OverflowTooltipContent, {
67
+ children: children
68
+ });
69
+ $[16] = children;
70
+ $[17] = t5;
71
+ } else t5 = $[17];
72
+ let t6;
73
+ if ($[18] !== t4 || $[19] !== t5) {
74
+ t6 = /*#__PURE__*/ jsxs(OverflowTooltip, {
75
+ children: [
76
+ t4,
77
+ t5
78
+ ]
79
+ });
80
+ $[18] = t4;
81
+ $[19] = t5;
82
+ $[20] = t6;
83
+ } else t6 = $[20];
84
+ return t6;
85
+ };
86
+ AvatarName.displayName = "AvatarName";
87
+ export { AvatarName };
@@ -3,9 +3,10 @@ import { c } from "react/compiler-runtime";
3
3
  import { RefreshCcw } from "../../icons/index.js";
4
4
  import { cn } from "../../utils/cn.js";
5
5
  import { useTestId } from "../../utils/testId.js";
6
- import { avatarOverlayClassNames } from "./classes.js";
6
+ import { useAvatarSize } from "./AvatarContext.js";
7
+ import { avatarOverlayClassNames, avatarPlateVariants } from "./classes.js";
7
8
  const AvatarOverlay = (t0)=>{
8
- const $ = c(17);
9
+ const $ = c(18);
9
10
  let children;
10
11
  let className;
11
12
  let props;
@@ -28,23 +29,27 @@ const AvatarOverlay = (t0)=>{
28
29
  }
29
30
  const visible = void 0 === t1 ? false : t1;
30
31
  const testId = useTestId("overlay");
32
+ const size = useAvatarSize();
31
33
  const t2 = visible ? "" : void 0;
32
34
  let t3;
33
- if ($[6] !== className) {
34
- t3 = cn(avatarOverlayClassNames, className);
35
+ if ($[6] !== className || $[7] !== size) {
36
+ t3 = cn(avatarPlateVariants({
37
+ size
38
+ }), avatarOverlayClassNames, className);
35
39
  $[6] = className;
36
- $[7] = t3;
37
- } else t3 = $[7];
40
+ $[7] = size;
41
+ $[8] = t3;
42
+ } else t3 = $[8];
38
43
  let t4;
39
- if ($[8] !== children) {
44
+ if ($[9] !== children) {
40
45
  t4 = children ?? /*#__PURE__*/ jsx(RefreshCcw, {
41
46
  size: "md"
42
47
  });
43
- $[8] = children;
44
- $[9] = t4;
45
- } else t4 = $[9];
48
+ $[9] = children;
49
+ $[10] = t4;
50
+ } else t4 = $[10];
46
51
  let t5;
47
- if ($[10] !== props || $[11] !== ref || $[12] !== t2 || $[13] !== t3 || $[14] !== t4 || $[15] !== testId) {
52
+ if ($[11] !== props || $[12] !== ref || $[13] !== t2 || $[14] !== t3 || $[15] !== t4 || $[16] !== testId) {
48
53
  t5 = /*#__PURE__*/ jsx("span", {
49
54
  ...props,
50
55
  ref: ref,
@@ -55,14 +60,14 @@ const AvatarOverlay = (t0)=>{
55
60
  className: t3,
56
61
  children: t4
57
62
  });
58
- $[10] = props;
59
- $[11] = ref;
60
- $[12] = t2;
61
- $[13] = t3;
62
- $[14] = t4;
63
- $[15] = testId;
64
- $[16] = t5;
65
- } else t5 = $[16];
63
+ $[11] = props;
64
+ $[12] = ref;
65
+ $[13] = t2;
66
+ $[14] = t3;
67
+ $[15] = t4;
68
+ $[16] = testId;
69
+ $[17] = t5;
70
+ } else t5 = $[17];
66
71
  return t5;
67
72
  };
68
73
  AvatarOverlay.displayName = "AvatarOverlay";
@@ -1,6 +1,21 @@
1
+ import { type VariantProps } from 'class-variance-authority';
1
2
  export declare const avatarVariants: (props?: ({
2
- size?: "sm" | "xs" | null | undefined;
3
+ size?: "lg" | "md" | "sm" | null | undefined;
4
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
5
+ export type AvatarSize = NonNullable<VariantProps<typeof avatarVariants>['size']>;
6
+ /** Box shared by every plate layer: one grid cell, the plate size and radius, clipped. */
7
+ export declare const avatarPlateVariants: (props?: ({
8
+ size?: "lg" | "md" | "sm" | null | undefined;
3
9
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
4
10
  export declare const avatarImageClassNames: string;
5
- export declare const avatarFallbackClassNames: string;
11
+ export declare const avatarFallbackVariants: (props?: ({
12
+ initials?: boolean | null | undefined;
13
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
14
  export declare const avatarOverlayClassNames: string;
15
+ export declare const avatarContentClassNames: string;
16
+ export declare const avatarNameVariants: (props?: ({
17
+ size?: "lg" | "md" | "sm" | null | undefined;
18
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
19
+ export declare const avatarDescriptionVariants: (props?: ({
20
+ size?: "lg" | "md" | "sm" | null | undefined;
21
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -1,17 +1,65 @@
1
1
  import { cva } from "class-variance-authority";
2
2
  import { cn } from "../../utils/cn.js";
3
- const avatarVariants = cva(cn('group/avatar inline-grid shrink-0 place-items-center overflow-hidden align-middle *:col-start-1 *:row-start-1', 'border border-border-primary bg-states-primary-hover text-icon-primary font-sans font-medium', 'branded:border-border-brand branded:bg-states-brand-hover branded:text-icon-brand', 'has-[>img[data-state=visible]]:border-0', 'hover:not-disabled:[&:has(>[data-slot=avatar-overlay])>[data-slot=avatar-fallback]]:invisible', 'focus-visible:[&:has(>[data-slot=avatar-overlay])>[data-slot=avatar-fallback]]:invisible', '[&:has(>[data-slot=avatar-overlay][data-visible])>[data-slot=avatar-fallback]]:invisible', 'enabled:cursor-pointer disabled:cursor-not-allowed', 'focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-focus-primary'), {
3
+ const avatarVariants = cva(cn('group/avatar inline-grid shrink-0 items-center gap-x-6 align-middle font-sans', 'has-[>[data-slot=avatar-content]]:max-w-full', 'hover:not-disabled:[&:has(>[data-slot=avatar-overlay])>[data-slot=avatar-fallback]]:text-transparent', 'hover:not-disabled:[&:has(>[data-slot=avatar-overlay])>[data-slot=avatar-fallback]>*]:invisible', 'focus-visible:[&:has(>[data-slot=avatar-overlay])>[data-slot=avatar-fallback]]:text-transparent', 'focus-visible:[&:has(>[data-slot=avatar-overlay])>[data-slot=avatar-fallback]>*]:invisible', '[&:has(>[data-slot=avatar-overlay][data-visible])>[data-slot=avatar-fallback]]:text-transparent', '[&:has(>[data-slot=avatar-overlay][data-visible])>[data-slot=avatar-fallback]>*]:invisible', 'enabled:cursor-pointer disabled:cursor-not-allowed', 'focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-focus-primary'), {
4
4
  variants: {
5
5
  size: {
6
- xs: 'size-24 rounded-8 text-2xs',
7
- sm: 'size-32 rounded-12 text-xs'
6
+ sm: 'rounded-8',
7
+ md: 'rounded-8',
8
+ lg: 'rounded-12'
8
9
  }
9
10
  },
10
11
  defaultVariants: {
11
- size: 'sm'
12
+ size: 'lg'
12
13
  }
13
14
  });
14
- const avatarImageClassNames = cn('size-full object-cover data-[state=hidden]:hidden');
15
- const avatarFallbackClassNames = cn('inline-flex items-center justify-center select-none data-[state=hidden]:hidden');
16
- const avatarOverlayClassNames = cn('hidden size-full place-items-center text-icon-primary', 'group-hover/avatar:grid group-focus-visible/avatar:grid group-disabled/avatar:not-data-[visible]:hidden', 'data-[visible]:grid', 'group-has-[>img[data-state=visible]]/avatar:bg-component-avatar-overlay');
17
- export { avatarFallbackClassNames, avatarImageClassNames, avatarOverlayClassNames, avatarVariants };
15
+ const avatarPlateVariants = cva('col-start-1 row-start-1 overflow-hidden', {
16
+ variants: {
17
+ size: {
18
+ sm: 'size-20 rounded-8',
19
+ md: 'size-24 rounded-8',
20
+ lg: 'size-32 rounded-12'
21
+ }
22
+ },
23
+ defaultVariants: {
24
+ size: 'lg'
25
+ }
26
+ });
27
+ const avatarImageClassNames = cn('bg-states-primary-hover object-cover data-[state=hidden]:hidden');
28
+ const avatarFallbackVariants = cva(cn('inline-flex items-center justify-center select-none data-[state=hidden]:hidden', 'border border-border-primary bg-states-primary-hover font-medium text-xs', 'branded:border-border-brand branded:bg-states-brand-hover'), {
29
+ variants: {
30
+ initials: {
31
+ true: 'text-text-primary branded:text-text-brand',
32
+ false: 'text-icon-primary branded:text-icon-brand'
33
+ }
34
+ },
35
+ defaultVariants: {
36
+ initials: false
37
+ }
38
+ });
39
+ const avatarOverlayClassNames = cn('hidden place-items-center text-icon-primary', 'group-hover/avatar:grid group-focus-visible/avatar:grid group-disabled/avatar:not-data-[visible]:hidden', 'data-[visible]:grid', 'group-has-[>img[data-state=visible]]/avatar:bg-component-avatar-overlay');
40
+ const avatarContentClassNames = cn('col-start-2 row-start-1 flex min-w-0 flex-col text-left');
41
+ const avatarNameVariants = cva('truncate font-normal text-text-primary', {
42
+ variants: {
43
+ size: {
44
+ sm: 'text-sm',
45
+ md: 'text-sm',
46
+ lg: 'text-sm'
47
+ }
48
+ },
49
+ defaultVariants: {
50
+ size: 'lg'
51
+ }
52
+ });
53
+ const avatarDescriptionVariants = cva('truncate font-normal text-text-secondary', {
54
+ variants: {
55
+ size: {
56
+ sm: 'text-xs',
57
+ md: 'text-xs',
58
+ lg: 'text-xs'
59
+ }
60
+ },
61
+ defaultVariants: {
62
+ size: 'lg'
63
+ }
64
+ });
65
+ export { avatarContentClassNames, avatarDescriptionVariants, avatarFallbackVariants, avatarImageClassNames, avatarNameVariants, avatarOverlayClassNames, avatarPlateVariants, avatarVariants };
@@ -1,4 +1,7 @@
1
1
  export { Avatar, type AvatarProps, type AvatarStatusChangeDetails } from './Avatar.js';
2
+ export { AvatarContent, type AvatarContentProps } from './AvatarContent.js';
3
+ export { AvatarDescription, type AvatarDescriptionProps } from './AvatarDescription.js';
2
4
  export { AvatarFallback, type AvatarFallbackProps } from './AvatarFallback.js';
3
5
  export { AvatarImage, type AvatarImageProps } from './AvatarImage.js';
6
+ export { AvatarName, type AvatarNameProps } from './AvatarName.js';
4
7
  export { AvatarOverlay, type AvatarOverlayProps } from './AvatarOverlay.js';
@@ -1,4 +1,7 @@
1
1
  export { Avatar } from "./Avatar.js";
2
+ export { AvatarContent } from "./AvatarContent.js";
3
+ export { AvatarDescription } from "./AvatarDescription.js";
2
4
  export { AvatarFallback } from "./AvatarFallback.js";
3
5
  export { AvatarImage } from "./AvatarImage.js";
6
+ export { AvatarName } from "./AvatarName.js";
4
7
  export { AvatarOverlay } from "./AvatarOverlay.js";
@@ -93,7 +93,7 @@ const NavRailItem = (t0)=>{
93
93
  t8 = /*#__PURE__*/ jsx("span", {
94
94
  className: "flex shrink-0 items-center justify-center",
95
95
  children: hasPlate ? /*#__PURE__*/ jsxs(Avatar, {
96
- size: "xs",
96
+ size: "md",
97
97
  "data-slot": "nav-rail-item-avatar",
98
98
  className: "-m-4",
99
99
  children: [
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ export { Alert, AlertClose, type AlertCloseProps, type AlertColor, AlertContent,
17
17
  export { AnimatedBackground, type AnimatedBackgroundProps, } from './components/AnimatedBackground/index.js';
18
18
  export { AppShell, AppShellHeader, type AppShellHeaderProps, type AppShellProps, AppShellRail, type AppShellRailProps, AppShellRemote, type AppShellRemoteProps, } from './components/AppShell/index.js';
19
19
  export { Attribute, AttributeActions, AttributeActionsContent, type AttributeActionsContentProps, AttributeActionsItem, type AttributeActionsItemProps, type AttributeActionsProps, AttributeActionsTarget, type AttributeActionsTargetProps, AttributeLabel, AttributeLabelDescription, type AttributeLabelDescriptionProps, AttributeLabelInfo, type AttributeLabelInfoProps, type AttributeLabelProps, type AttributeProps, AttributeValue, type AttributeValueProps, } from './components/Attribute/index.js';
20
- export { Avatar, AvatarFallback, type AvatarFallbackProps, AvatarImage, type AvatarImageProps, AvatarOverlay, type AvatarOverlayProps, type AvatarProps, type AvatarStatusChangeDetails, } from './components/Avatar/index.js';
20
+ export { Avatar, AvatarContent, type AvatarContentProps, AvatarDescription, type AvatarDescriptionProps, AvatarFallback, type AvatarFallbackProps, AvatarImage, type AvatarImageProps, AvatarName, type AvatarNameProps, AvatarOverlay, type AvatarOverlayProps, type AvatarProps, type AvatarStatusChangeDetails, } from './components/Avatar/index.js';
21
21
  export { Badge, type BadgeProps } from './components/Badge/index.js';
22
22
  export { Banner, BannerClose, type BannerCloseProps, BannerContent, type BannerContentProps, BannerControls, type BannerControlsProps, BannerDescription, type BannerDescriptionProps, BannerIcon, type BannerIconProps, BannerLink, type BannerLinkProps, type BannerProps, BannerTitle, type BannerTitleProps, type BannerVariant, } from './components/Banner/index.js';
23
23
  export { Breadcrumbs, BreadcrumbsEllipsis, type BreadcrumbsEllipsisProps, BreadcrumbsItem, type BreadcrumbsItemProps, type BreadcrumbsProps, BreadcrumbsScopeSwitcher, type BreadcrumbsScopeSwitcherProps, BreadcrumbsSeparator, type BreadcrumbsSeparatorProps, type ScopeSwitcherItem, } from './components/Breadcrumbs/index.js';
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ export { Alert, AlertClose, AlertContent, AlertControls, AlertDescription, Alert
6
6
  export { AnimatedBackground } from "./components/AnimatedBackground/index.js";
7
7
  export { AppShell, AppShellHeader, AppShellRail, AppShellRemote } from "./components/AppShell/index.js";
8
8
  export { Attribute, AttributeActions, AttributeActionsContent, AttributeActionsItem, AttributeActionsTarget, AttributeLabel, AttributeLabelDescription, AttributeLabelInfo, AttributeValue } from "./components/Attribute/index.js";
9
- export { Avatar, AvatarFallback, AvatarImage, AvatarOverlay } from "./components/Avatar/index.js";
9
+ export { Avatar, AvatarContent, AvatarDescription, AvatarFallback, AvatarImage, AvatarName, AvatarOverlay } from "./components/Avatar/index.js";
10
10
  export { Badge } from "./components/Badge/index.js";
11
11
  export { Banner, BannerClose, BannerContent, BannerControls, BannerDescription, BannerIcon, BannerLink, BannerTitle } from "./components/Banner/index.js";
12
12
  export { Breadcrumbs, BreadcrumbsEllipsis, BreadcrumbsItem, BreadcrumbsScopeSwitcher, BreadcrumbsSeparator } from "./components/Breadcrumbs/index.js";