@elizaos/client 1.6.1-alpha.6 → 1.6.1-alpha.7

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 (37) hide show
  1. package/dist/assets/main-BM2lpId8.js.map +1 -1
  2. package/package.json +4 -4
  3. package/src/components/agent-prism/Avatar.tsx +56 -68
  4. package/src/components/agent-prism/Badge.tsx +22 -29
  5. package/src/components/agent-prism/Button.tsx +39 -51
  6. package/src/components/agent-prism/CollapseAndExpandControls.tsx +9 -25
  7. package/src/components/agent-prism/CollapsibleSection.tsx +18 -18
  8. package/src/components/agent-prism/DetailsView/DetailsView.tsx +25 -30
  9. package/src/components/agent-prism/DetailsView/DetailsViewAttributesTab.tsx +6 -12
  10. package/src/components/agent-prism/DetailsView/DetailsViewHeader.tsx +9 -13
  11. package/src/components/agent-prism/DetailsView/DetailsViewHeaderActions.tsx +2 -2
  12. package/src/components/agent-prism/DetailsView/DetailsViewInputOutputTab.tsx +30 -60
  13. package/src/components/agent-prism/DetailsView/DetailsViewMetrics.tsx +10 -18
  14. package/src/components/agent-prism/DetailsView/DetailsViewRawDataTab.tsx +3 -3
  15. package/src/components/agent-prism/IconButton.tsx +25 -28
  16. package/src/components/agent-prism/PriceBadge.tsx +4 -4
  17. package/src/components/agent-prism/SearchInput.tsx +3 -9
  18. package/src/components/agent-prism/SpanCard/SpanCard.tsx +74 -104
  19. package/src/components/agent-prism/SpanCard/SpanCardBadges.tsx +7 -13
  20. package/src/components/agent-prism/SpanCard/SpanCardConnector.tsx +9 -9
  21. package/src/components/agent-prism/SpanCard/SpanCardTimeline.tsx +15 -20
  22. package/src/components/agent-prism/SpanCard/SpanCardToggle.tsx +5 -9
  23. package/src/components/agent-prism/SpanStatus.tsx +24 -30
  24. package/src/components/agent-prism/Tabs.tsx +16 -19
  25. package/src/components/agent-prism/TextInput.tsx +18 -21
  26. package/src/components/agent-prism/TimestampBadge.tsx +5 -9
  27. package/src/components/agent-prism/TokensBadge.tsx +6 -10
  28. package/src/components/agent-prism/TraceList/TraceList.tsx +11 -17
  29. package/src/components/agent-prism/TraceList/TraceListItem.tsx +18 -24
  30. package/src/components/agent-prism/TraceList/TraceListItemHeader.tsx +8 -20
  31. package/src/components/agent-prism/TraceViewer.tsx +36 -53
  32. package/src/components/agent-prism/TreeView.tsx +7 -7
  33. package/src/components/agent-prism/shared.ts +81 -93
  34. package/src/components/agent-runs/AgentRunTimeline.tsx +3 -5
  35. package/src/components/chat.tsx +7 -7
  36. package/src/lib/agent-prism-utils.ts +29 -32
  37. package/src/lib/eliza-span-adapter.ts +438 -440
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elizaos/client",
3
- "version": "1.6.1-alpha.6",
3
+ "version": "1.6.1-alpha.7",
4
4
  "description": "Web client interface for ElizaOS agents",
5
5
  "repository": {
6
6
  "type": "git",
@@ -61,8 +61,8 @@
61
61
  "access": "public"
62
62
  },
63
63
  "dependencies": {
64
- "@elizaos/api-client": "1.6.1-alpha.6",
65
- "@elizaos/core": "1.6.1-alpha.6",
64
+ "@elizaos/api-client": "1.6.1-alpha.7",
65
+ "@elizaos/core": "1.6.1-alpha.7",
66
66
  "@evilmartians/agent-prism-data": "^0.0.4",
67
67
  "@evilmartians/agent-prism-types": "^0.0.4",
68
68
  "@hookform/resolvers": "^5.1.1",
@@ -161,5 +161,5 @@
161
161
  "vite-tsconfig-paths": "^5.1.4",
162
162
  "wait-on": "^9.0.1"
163
163
  },
164
- "gitHead": "8a0b8d2bba9bc932188f8a4f7f06360f65748f04"
164
+ "gitHead": "de2adbe7a4492c8c015e77105bf87fa3570269c3"
165
165
  }
@@ -1,65 +1,58 @@
1
- import { cn } from "@/lib/utils";
2
- import { User } from "lucide-react";
3
- import { useState, type ComponentPropsWithRef, type ReactElement } from "react";
1
+ import { cn } from '@/lib/utils';
2
+ import { User } from 'lucide-react';
3
+ import { useState, type ComponentPropsWithRef, type ReactElement } from 'react';
4
4
 
5
- import {
6
- ROUNDED_CLASSES,
7
- type ColorVariant,
8
- type ComponentSize,
9
- } from "./shared.ts";
5
+ import { ROUNDED_CLASSES, type ColorVariant, type ComponentSize } from './shared.ts';
10
6
 
11
- export type AvatarSize = Extract<
12
- ComponentSize,
13
- "4" | "6" | "8" | "9" | "10" | "11" | "12" | "16"
14
- >;
7
+ export type AvatarSize = Extract<ComponentSize, '4' | '6' | '8' | '9' | '10' | '11' | '12' | '16'>;
15
8
 
16
9
  const sizeClasses: Record<AvatarSize, string> = {
17
- "4": "size-4 text-xs",
18
- "6": "size-6 text-xs",
19
- "8": "size-8 text-xs",
20
- "9": "size-9 text-sm",
21
- "10": "size-10 text-base",
22
- "11": "size-11 text-lg",
23
- "12": "size-12 text-xl",
24
- "16": "size-16 text-2xl",
10
+ '4': 'size-4 text-xs',
11
+ '6': 'size-6 text-xs',
12
+ '8': 'size-8 text-xs',
13
+ '9': 'size-9 text-sm',
14
+ '10': 'size-10 text-base',
15
+ '11': 'size-11 text-lg',
16
+ '12': 'size-12 text-xl',
17
+ '16': 'size-16 text-2xl',
25
18
  };
26
19
 
27
20
  const iconSizeClasses: Record<AvatarSize, string> = {
28
- "4": "size-3",
29
- "6": "size-4",
30
- "8": "size-6",
31
- "9": "size-7",
32
- "10": "size-8",
33
- "11": "size-9",
34
- "12": "size-10",
35
- "16": "size-12",
21
+ '4': 'size-3',
22
+ '6': 'size-4',
23
+ '8': 'size-6',
24
+ '9': 'size-7',
25
+ '10': 'size-8',
26
+ '11': 'size-9',
27
+ '12': 'size-10',
28
+ '16': 'size-12',
36
29
  };
37
30
 
38
31
  const textSizeClasses: Record<AvatarSize, string> = {
39
- "4": "text-xs",
40
- "6": "text-xs",
41
- "8": "text-xs",
42
- "9": "text-sm",
43
- "10": "text-base",
44
- "11": "text-lg",
45
- "12": "text-xl",
46
- "16": "text-2xl",
32
+ '4': 'text-xs',
33
+ '6': 'text-xs',
34
+ '8': 'text-xs',
35
+ '9': 'text-sm',
36
+ '10': 'text-base',
37
+ '11': 'text-lg',
38
+ '12': 'text-xl',
39
+ '16': 'text-2xl',
47
40
  };
48
41
 
49
42
  const bgColorClasses: Record<ColorVariant, string> = {
50
- gray: "bg-muted-foreground",
51
- red: "bg-destructive",
52
- orange: "bg-chart-1",
53
- yellow: "bg-chart-5",
54
- teal: "bg-chart-2",
55
- indigo: "bg-primary",
56
- purple: "bg-primary",
57
- sky: "bg-chart-4",
58
- cyan: "bg-chart-3",
59
- emerald: "bg-accent",
43
+ gray: 'bg-muted-foreground',
44
+ red: 'bg-destructive',
45
+ orange: 'bg-chart-1',
46
+ yellow: 'bg-chart-5',
47
+ teal: 'bg-chart-2',
48
+ indigo: 'bg-primary',
49
+ purple: 'bg-primary',
50
+ sky: 'bg-chart-4',
51
+ cyan: 'bg-chart-3',
52
+ emerald: 'bg-accent',
60
53
  };
61
54
 
62
- export type AvatarProps = ComponentPropsWithRef<"div"> & {
55
+ export type AvatarProps = ComponentPropsWithRef<'div'> & {
63
56
  /**
64
57
  * The image source for the avatar
65
58
  */
@@ -77,7 +70,7 @@ export type AvatarProps = ComponentPropsWithRef<"div"> & {
77
70
  * The border radius of the avatar
78
71
  * @default "full"
79
72
  */
80
- rounded?: "none" | "sm" | "md" | "lg" | "full";
73
+ rounded?: 'none' | 'sm' | 'md' | 'lg' | 'full';
81
74
  /**
82
75
  * Background color theme for the letter avatar
83
76
  * Uses the unified color theme system
@@ -88,7 +81,7 @@ export type AvatarProps = ComponentPropsWithRef<"div"> & {
88
81
  * Text color for the letter avatar
89
82
  * @default "white"
90
83
  */
91
- textColor?: "white" | "black";
84
+ textColor?: 'white' | 'black';
92
85
  /**
93
86
  * Custom letter to display (will use first letter of alt if not provided)
94
87
  */
@@ -101,41 +94,36 @@ export type AvatarProps = ComponentPropsWithRef<"div"> & {
101
94
 
102
95
  export const Avatar = ({
103
96
  src,
104
- alt = "Avatar",
105
- size = "10",
106
- rounded = "full",
107
- bgColor = "gray",
108
- textColor = "white",
97
+ alt = 'Avatar',
98
+ size = '10',
99
+ rounded = 'full',
100
+ bgColor = 'gray',
101
+ textColor = 'white',
109
102
  letter,
110
- className = "",
103
+ className = '',
111
104
  ...rest
112
105
  }: AvatarProps): ReactElement => {
113
106
  const [error, setError] = useState(false);
114
107
 
115
108
  const displayLetter = letter ? letter.charAt(0) : alt.charAt(0).toUpperCase();
116
109
 
117
- const actualTextColor = textColor === "white" ? "text-white" : "text-black";
110
+ const actualTextColor = textColor === 'white' ? 'text-white' : 'text-black';
118
111
 
119
112
  return (
120
113
  <div
121
114
  className={cn(
122
- "flex items-center justify-center overflow-hidden",
123
- "bg-muted",
124
- error && "border border-border",
115
+ 'flex items-center justify-center overflow-hidden',
116
+ 'bg-muted',
117
+ error && 'border border-border',
125
118
  sizeClasses[size],
126
119
  textSizeClasses[size],
127
120
  ROUNDED_CLASSES[rounded],
128
- className,
121
+ className
129
122
  )}
130
123
  {...rest}
131
124
  >
132
125
  {error ? (
133
- <User
134
- className={cn(
135
- iconSizeClasses[size],
136
- "text-muted-foreground",
137
- )}
138
- />
126
+ <User className={cn(iconSizeClasses[size], 'text-muted-foreground')} />
139
127
  ) : (
140
128
  <>
141
129
  {src ? (
@@ -148,10 +136,10 @@ export const Avatar = ({
148
136
  ) : (
149
137
  <div
150
138
  className={cn(
151
- "flex h-full w-full items-center justify-center",
139
+ 'flex h-full w-full items-center justify-center',
152
140
  bgColorClasses[bgColor],
153
141
  actualTextColor,
154
- "font-medium",
142
+ 'font-medium'
155
143
  )}
156
144
  >
157
145
  {displayLetter}
@@ -1,30 +1,26 @@
1
- import type { ComponentPropsWithRef, ReactElement, ReactNode } from "react";
1
+ import type { ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
2
2
 
3
- import { cn } from "@/lib/utils";
3
+ import { cn } from '@/lib/utils';
4
4
 
5
- import {
6
- COLOR_THEME_CLASSES,
7
- type ColorVariant,
8
- type ComponentSize,
9
- } from "./shared.ts";
5
+ import { COLOR_THEME_CLASSES, type ColorVariant, type ComponentSize } from './shared.ts';
10
6
 
11
- type BadgeSize = Extract<ComponentSize, "4" | "5" | "6" | "7">;
7
+ type BadgeSize = Extract<ComponentSize, '4' | '5' | '6' | '7'>;
12
8
 
13
9
  const sizeClasses: Record<BadgeSize, string> = {
14
- "4": "px-1 gap-1 h-4",
15
- "5": "px-1.5 gap-1 h-5",
16
- "6": "px-2 gap-1.5 h-6",
17
- "7": "px-2.5 gap-2 h-7",
10
+ '4': 'px-1 gap-1 h-4',
11
+ '5': 'px-1.5 gap-1 h-5',
12
+ '6': 'px-2 gap-1.5 h-6',
13
+ '7': 'px-2.5 gap-2 h-7',
18
14
  };
19
15
 
20
16
  const textSizes: Record<BadgeSize, string> = {
21
- "4": "text-xs font-normal leading-3",
22
- "5": "text-xs font-medium",
23
- "6": "text-sm font-medium",
24
- "7": "text-sm font-medium",
17
+ '4': 'text-xs font-normal leading-3',
18
+ '5': 'text-xs font-medium',
19
+ '6': 'text-sm font-medium',
20
+ '7': 'text-sm font-medium',
25
21
  };
26
22
 
27
- export type BadgeProps = ComponentPropsWithRef<"span"> & {
23
+ export type BadgeProps = ComponentPropsWithRef<'span'> & {
28
24
  /**
29
25
  * The content of the badge
30
26
  */
@@ -41,7 +37,7 @@ export type BadgeProps = ComponentPropsWithRef<"span"> & {
41
37
  * The visual variant of the badge
42
38
  * @default "solid"
43
39
  */
44
- variant?: "solid" | "outline";
40
+ variant?: 'solid' | 'outline';
45
41
 
46
42
  /**
47
43
  * The size of the badge
@@ -67,38 +63,35 @@ export type BadgeProps = ComponentPropsWithRef<"span"> & {
67
63
 
68
64
  export const Badge = ({
69
65
  label,
70
- theme = "gray",
71
- variant = "solid",
72
- size = "4",
66
+ theme = 'gray',
67
+ variant = 'solid',
68
+ size = '4',
73
69
  iconStart,
74
70
  iconEnd,
75
- className = "",
71
+ className = '',
76
72
  ...rest
77
73
  }: BadgeProps): ReactElement => {
78
74
  const { bg, darkBg, text, darkText } = COLOR_THEME_CLASSES[theme];
79
75
 
80
76
  const variantClasses =
81
- variant === "outline"
77
+ variant === 'outline'
82
78
  ? `border ${text} ${darkText} bg-transparent dark:bg-transparent border-current`
83
79
  : `${bg} ${text} ${darkBg} ${darkText}`;
84
80
 
85
81
  return (
86
82
  <span
87
83
  className={cn(
88
- "inline-flex min-w-0 items-center overflow-hidden rounded font-medium",
84
+ 'inline-flex min-w-0 items-center overflow-hidden rounded font-medium',
89
85
  variantClasses,
90
86
  sizeClasses[size],
91
- className,
87
+ className
92
88
  )}
93
89
  {...rest}
94
90
  >
95
91
  {iconStart && <span className="shrink-0">{iconStart}</span>}
96
92
 
97
93
  <span
98
- className={cn(
99
- textSizes[size],
100
- "min-w-0 max-w-full flex-shrink-0 truncate tracking-normal",
101
- )}
94
+ className={cn(textSizes[size], 'min-w-0 max-w-full flex-shrink-0 truncate tracking-normal')}
102
95
  >
103
96
  {label}
104
97
  </span>
@@ -1,53 +1,45 @@
1
- import type { ComponentPropsWithRef, ReactElement } from "react";
1
+ import type { ComponentPropsWithRef, ReactElement } from 'react';
2
2
 
3
- import { cn } from "@/lib/utils";
3
+ import { cn } from '@/lib/utils';
4
4
 
5
- import {
6
- ROUNDED_CLASSES,
7
- type ColorVariant,
8
- type ComponentSize,
9
- } from "./shared.ts";
5
+ import { ROUNDED_CLASSES, type ColorVariant, type ComponentSize } from './shared.ts';
10
6
 
11
- type ButtonSize = Extract<
12
- ComponentSize,
13
- "6" | "7" | "8" | "9" | "10" | "11" | "12" | "16"
14
- >;
7
+ type ButtonSize = Extract<ComponentSize, '6' | '7' | '8' | '9' | '10' | '11' | '12' | '16'>;
15
8
 
16
9
  const BASE_CLASSES =
17
- "inline-flex items-center justify-center font-medium transition-all duration-200";
10
+ 'inline-flex items-center justify-center font-medium transition-all duration-200';
18
11
 
19
12
  const sizeClasses = {
20
- "6": "h-6 px-2 gap-1 text-xs",
21
- "7": "h-7 px-2 gap-1 text-xs",
22
- "8": "h-8 px-2 gap-1 text-xs",
23
- "9": "h-9 px-2.5 gap-2 text-sm",
24
- "10": "h-10 px-4 gap-2 text-sm",
25
- "11": "h-11 px-5 gap-3 text-base",
26
- "12": "h-12 px-5 gap-2.5 text-base",
27
- "16": "h-16 px-7 gap-3 text-lg",
13
+ '6': 'h-6 px-2 gap-1 text-xs',
14
+ '7': 'h-7 px-2 gap-1 text-xs',
15
+ '8': 'h-8 px-2 gap-1 text-xs',
16
+ '9': 'h-9 px-2.5 gap-2 text-sm',
17
+ '10': 'h-10 px-4 gap-2 text-sm',
18
+ '11': 'h-11 px-5 gap-3 text-base',
19
+ '12': 'h-12 px-5 gap-2.5 text-base',
20
+ '16': 'h-16 px-7 gap-3 text-lg',
28
21
  };
29
22
 
30
23
  const filledThemeClasses: Record<ColorVariant, string> = {
31
- gray: "bg-muted text-muted-foreground",
32
- purple: "bg-primary text-primary-foreground",
33
- indigo: "bg-primary text-primary-foreground",
34
- orange: "bg-chart-1 text-primary-foreground",
35
- teal: "bg-chart-2 text-primary-foreground",
36
- cyan: "bg-chart-3 text-primary-foreground",
37
- sky: "bg-chart-4 text-primary-foreground",
38
- yellow: "bg-chart-5 text-primary-foreground",
39
- emerald: "bg-accent text-accent-foreground",
40
- red: "bg-destructive text-destructive-foreground",
24
+ gray: 'bg-muted text-muted-foreground',
25
+ purple: 'bg-primary text-primary-foreground',
26
+ indigo: 'bg-primary text-primary-foreground',
27
+ orange: 'bg-chart-1 text-primary-foreground',
28
+ teal: 'bg-chart-2 text-primary-foreground',
29
+ cyan: 'bg-chart-3 text-primary-foreground',
30
+ sky: 'bg-chart-4 text-primary-foreground',
31
+ yellow: 'bg-chart-5 text-primary-foreground',
32
+ emerald: 'bg-accent text-accent-foreground',
33
+ red: 'bg-destructive text-destructive-foreground',
41
34
  };
42
35
 
43
36
  const variantClasses = {
44
- filled: "",
45
- outlined:
46
- "border border-2 bg-transparent text-foreground border-border",
47
- ghost: "bg-transparent text-muted-foreground",
37
+ filled: '',
38
+ outlined: 'border border-2 bg-transparent text-foreground border-border',
39
+ ghost: 'bg-transparent text-muted-foreground',
48
40
  };
49
41
 
50
- export type ButtonProps = ComponentPropsWithRef<"button"> & {
42
+ export type ButtonProps = ComponentPropsWithRef<'button'> & {
51
43
  /**
52
44
  * The size of the button
53
45
  * @default "6"
@@ -64,13 +56,13 @@ export type ButtonProps = ComponentPropsWithRef<"button"> & {
64
56
  * The border radius of the button
65
57
  * @default "md"
66
58
  */
67
- rounded?: "none" | "sm" | "md" | "lg" | "full";
59
+ rounded?: 'none' | 'sm' | 'md' | 'lg' | 'full';
68
60
 
69
61
  /**
70
62
  * The visual variant of the button
71
63
  * @default "filled"
72
64
  */
73
- variant?: "filled" | "outlined" | "ghost";
65
+ variant?: 'filled' | 'outlined' | 'ghost';
74
66
 
75
67
  /**
76
68
  * Makes the button full width
@@ -91,27 +83,23 @@ export type ButtonProps = ComponentPropsWithRef<"button"> & {
91
83
 
92
84
  export const Button = ({
93
85
  children,
94
- size = "6",
95
- theme = "gray",
96
- rounded = "md",
97
- variant = "filled",
86
+ size = '6',
87
+ theme = 'gray',
88
+ rounded = 'md',
89
+ variant = 'filled',
98
90
  fullWidth = false,
99
91
  disabled = false,
100
92
  iconStart,
101
93
  iconEnd,
102
- type = "button",
94
+ type = 'button',
103
95
  onClick,
104
- className = "",
96
+ className = '',
105
97
  ...rest
106
98
  }: ButtonProps) => {
107
- const widthClass = fullWidth ? "w-full" : "";
108
- const stateClasses = disabled
109
- ? "cursor-not-allowed opacity-50"
110
- : "hover:opacity-70";
99
+ const widthClass = fullWidth ? 'w-full' : '';
100
+ const stateClasses = disabled ? 'cursor-not-allowed opacity-50' : 'hover:opacity-70';
111
101
  const filledThemeClass =
112
- variant === "filled"
113
- ? filledThemeClasses[theme] || filledThemeClasses.gray
114
- : "";
102
+ variant === 'filled' ? filledThemeClasses[theme] || filledThemeClasses.gray : '';
115
103
 
116
104
  return (
117
105
  <button
@@ -126,7 +114,7 @@ export const Button = ({
126
114
  filledThemeClass,
127
115
  widthClass,
128
116
  stateClasses,
129
- className,
117
+ className
130
118
  )}
131
119
  {...rest}
132
120
  >
@@ -1,44 +1,28 @@
1
- import type { ComponentPropsWithRef } from "react";
1
+ import type { ComponentPropsWithRef } from 'react';
2
2
 
3
- import { ChevronsUpDown, ChevronsDownUp } from "lucide-react";
3
+ import { ChevronsUpDown, ChevronsDownUp } from 'lucide-react';
4
4
 
5
- import { IconButton } from "./IconButton.tsx";
5
+ import { IconButton } from './IconButton.tsx';
6
6
 
7
- export type SpanCardExpandAllButtonProps = ComponentPropsWithRef<"button"> & {
7
+ export type SpanCardExpandAllButtonProps = ComponentPropsWithRef<'button'> & {
8
8
  onExpandAll: () => void;
9
9
  };
10
10
 
11
- export type SpanCardCollapseAllButtonProps = ComponentPropsWithRef<"button"> & {
11
+ export type SpanCardCollapseAllButtonProps = ComponentPropsWithRef<'button'> & {
12
12
  onCollapseAll: () => void;
13
13
  };
14
14
 
15
- export const ExpandAllButton = ({
16
- onExpandAll,
17
- ...rest
18
- }: SpanCardExpandAllButtonProps) => {
15
+ export const ExpandAllButton = ({ onExpandAll, ...rest }: SpanCardExpandAllButtonProps) => {
19
16
  return (
20
- <IconButton
21
- size="7"
22
- onClick={onExpandAll}
23
- aria-label="Expand all"
24
- {...rest}
25
- >
17
+ <IconButton size="7" onClick={onExpandAll} aria-label="Expand all" {...rest}>
26
18
  <ChevronsUpDown className="size-3.5" />
27
19
  </IconButton>
28
20
  );
29
21
  };
30
22
 
31
- export const CollapseAllButton = ({
32
- onCollapseAll,
33
- ...rest
34
- }: SpanCardCollapseAllButtonProps) => {
23
+ export const CollapseAllButton = ({ onCollapseAll, ...rest }: SpanCardCollapseAllButtonProps) => {
35
24
  return (
36
- <IconButton
37
- size="7"
38
- onClick={onCollapseAll}
39
- aria-label="Collapse all"
40
- {...rest}
41
- >
25
+ <IconButton size="7" onClick={onCollapseAll} aria-label="Collapse all" {...rest}>
42
26
  <ChevronsDownUp className="size-3.5" />
43
27
  </IconButton>
44
28
  );
@@ -1,7 +1,7 @@
1
- import * as Collapsible from "@radix-ui/react-collapsible";
2
- import { cn } from "@/lib/utils";
3
- import { ChevronDown } from "lucide-react";
4
- import * as React from "react";
1
+ import * as Collapsible from '@radix-ui/react-collapsible';
2
+ import { cn } from '@/lib/utils';
3
+ import { ChevronDown } from 'lucide-react';
4
+ import * as React from 'react';
5
5
 
6
6
  export interface CollapsibleSectionProps {
7
7
  /**
@@ -51,9 +51,9 @@ export const CollapsibleSection: React.FC<CollapsibleSectionProps> = ({
51
51
  rightContent,
52
52
  children,
53
53
  defaultOpen = false,
54
- className = "",
55
- triggerClassName = "",
56
- contentClassName = "",
54
+ className = '',
55
+ triggerClassName = '',
56
+ contentClassName = '',
57
57
  onOpenChange,
58
58
  }) => {
59
59
  const [open, setOpen] = React.useState(defaultOpen);
@@ -63,42 +63,42 @@ export const CollapsibleSection: React.FC<CollapsibleSectionProps> = ({
63
63
  setOpen(open);
64
64
  onOpenChange?.(open);
65
65
  },
66
- [onOpenChange],
66
+ [onOpenChange]
67
67
  );
68
68
 
69
69
  const handleKeyDown = React.useCallback(
70
70
  (e: React.KeyboardEvent<HTMLDivElement>): void => {
71
- if (e.key === "Enter" || e.key === " ") {
71
+ if (e.key === 'Enter' || e.key === ' ') {
72
72
  e.preventDefault();
73
73
  handleOpenChange(!open);
74
74
  }
75
75
  },
76
- [handleOpenChange, open],
76
+ [handleOpenChange, open]
77
77
  );
78
78
 
79
79
  return (
80
80
  <Collapsible.Root
81
81
  open={open}
82
82
  onOpenChange={handleOpenChange}
83
- className={cn("rounded-lg", className)}
83
+ className={cn('rounded-lg', className)}
84
84
  >
85
85
  <Collapsible.Trigger asChild>
86
86
  <div
87
87
  tabIndex={0}
88
88
  role="button"
89
89
  className={cn(
90
- "mb-1 flex w-full items-center justify-between gap-2 rounded-lg px-1 py-3 text-left text-sm font-medium text-foreground",
91
- triggerClassName,
90
+ 'mb-1 flex w-full items-center justify-between gap-2 rounded-lg px-1 py-3 text-left text-sm font-medium text-foreground',
91
+ triggerClassName
92
92
  )}
93
93
  onKeyDown={handleKeyDown}
94
94
  aria-expanded={open}
95
- aria-label={`${open ? "Collapse" : "Expand"} content of "${title}" section`}
95
+ aria-label={`${open ? 'Collapse' : 'Expand'} content of "${title}" section`}
96
96
  >
97
97
  <div className="flex w-full items-center gap-2">
98
98
  <ChevronDown
99
99
  className={cn(
100
- "h-3 w-3 text-muted-foreground transition-transform duration-200",
101
- open && "rotate-180",
100
+ 'h-3 w-3 text-muted-foreground transition-transform duration-200',
101
+ open && 'rotate-180'
102
102
  )}
103
103
  />
104
104
  <span className="truncate">{title}</span>
@@ -110,8 +110,8 @@ export const CollapsibleSection: React.FC<CollapsibleSectionProps> = ({
110
110
 
111
111
  <Collapsible.Content
112
112
  className={cn(
113
- "data-[state=closed]:animate-slideUp data-[state=open]:animate-slideDown",
114
- contentClassName,
113
+ 'data-[state=closed]:animate-slideUp data-[state=open]:animate-slideDown',
114
+ contentClassName
115
115
  )}
116
116
  >
117
117
  {children}