@elizaos/client 1.6.1-alpha.5 → 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.
- package/dist/assets/{main-Bbs84AcL.js → main-BM2lpId8.js} +60 -60
- package/dist/assets/main-BM2lpId8.js.map +1 -0
- package/dist/assets/{main-4tyUgNqd.js → main-CQAV8tyh.js} +4 -4
- package/dist/assets/main-CQAV8tyh.js.map +1 -0
- package/dist/assets/react-vendor-C1OK-nqm.js +611 -0
- package/dist/assets/react-vendor-C1OK-nqm.js.map +1 -0
- package/dist/index.html +1 -1
- package/package.json +25 -25
- package/src/components/agent-prism/Avatar.tsx +56 -68
- package/src/components/agent-prism/Badge.tsx +22 -29
- package/src/components/agent-prism/Button.tsx +39 -51
- package/src/components/agent-prism/CollapseAndExpandControls.tsx +9 -25
- package/src/components/agent-prism/CollapsibleSection.tsx +18 -18
- package/src/components/agent-prism/DetailsView/DetailsView.tsx +25 -30
- package/src/components/agent-prism/DetailsView/DetailsViewAttributesTab.tsx +6 -12
- package/src/components/agent-prism/DetailsView/DetailsViewHeader.tsx +9 -13
- package/src/components/agent-prism/DetailsView/DetailsViewHeaderActions.tsx +2 -2
- package/src/components/agent-prism/DetailsView/DetailsViewInputOutputTab.tsx +30 -60
- package/src/components/agent-prism/DetailsView/DetailsViewMetrics.tsx +10 -18
- package/src/components/agent-prism/DetailsView/DetailsViewRawDataTab.tsx +3 -3
- package/src/components/agent-prism/IconButton.tsx +25 -28
- package/src/components/agent-prism/PriceBadge.tsx +4 -4
- package/src/components/agent-prism/SearchInput.tsx +3 -9
- package/src/components/agent-prism/SpanCard/SpanCard.tsx +74 -104
- package/src/components/agent-prism/SpanCard/SpanCardBadges.tsx +7 -13
- package/src/components/agent-prism/SpanCard/SpanCardConnector.tsx +9 -9
- package/src/components/agent-prism/SpanCard/SpanCardTimeline.tsx +15 -20
- package/src/components/agent-prism/SpanCard/SpanCardToggle.tsx +5 -9
- package/src/components/agent-prism/SpanStatus.tsx +24 -30
- package/src/components/agent-prism/Tabs.tsx +16 -19
- package/src/components/agent-prism/TextInput.tsx +18 -21
- package/src/components/agent-prism/TimestampBadge.tsx +5 -9
- package/src/components/agent-prism/TokensBadge.tsx +6 -10
- package/src/components/agent-prism/TraceList/TraceList.tsx +11 -17
- package/src/components/agent-prism/TraceList/TraceListItem.tsx +18 -24
- package/src/components/agent-prism/TraceList/TraceListItemHeader.tsx +8 -20
- package/src/components/agent-prism/TraceViewer.tsx +36 -53
- package/src/components/agent-prism/TreeView.tsx +7 -7
- package/src/components/agent-prism/shared.ts +81 -93
- package/src/components/agent-runs/AgentRunTimeline.tsx +3 -5
- package/src/components/chat.tsx +7 -7
- package/src/lib/agent-prism-utils.ts +29 -32
- package/src/lib/eliza-span-adapter.ts +438 -440
- package/dist/assets/main-4tyUgNqd.js.map +0 -1
- package/dist/assets/main-Bbs84AcL.js.map +0 -1
- package/dist/assets/react-vendor-DxnAFk-d.js +0 -611
- package/dist/assets/react-vendor-DxnAFk-d.js.map +0 -1
package/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
7
7
|
<title>ElizaOS - Client</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/main-
|
|
8
|
+
<script type="module" crossorigin src="/assets/main-CQAV8tyh.js"></script>
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/client",
|
|
3
|
-
"version": "1.6.1-alpha.
|
|
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.
|
|
65
|
-
"@elizaos/core": "1.6.1-alpha.
|
|
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",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@radix-ui/react-tabs": "^1.1.3",
|
|
82
82
|
"@radix-ui/react-toast": "^1.2.6",
|
|
83
83
|
"@radix-ui/react-tooltip": "^1.1.8",
|
|
84
|
-
"@react-spring/web": "^
|
|
84
|
+
"@react-spring/web": "^10.0.3",
|
|
85
85
|
"@tanstack/react-query": "^5.67.2",
|
|
86
86
|
"@uidotdev/usehooks": "^2.4.1",
|
|
87
87
|
"buffer": "^6.0.3",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"date-fns": "^4.1.0",
|
|
93
93
|
"dayjs": "^1.11.13",
|
|
94
94
|
"evt": "^2.5.9",
|
|
95
|
-
"lucide-react": "^0.
|
|
95
|
+
"lucide-react": "^0.544.0",
|
|
96
96
|
"react": "^19.1.0",
|
|
97
97
|
"react-aiwriter": "^1.0.0",
|
|
98
98
|
"react-dom": "^19.1.0",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"react-joyride": "^2.9.3",
|
|
102
102
|
"react-json-pretty": "^2.2.0",
|
|
103
103
|
"react-markdown": "^10.1.0",
|
|
104
|
-
"react-resizable-panels": "^
|
|
104
|
+
"react-resizable-panels": "^3.0.6",
|
|
105
105
|
"react-router": "^7.3.0",
|
|
106
106
|
"react-router-dom": "^7.3.0",
|
|
107
107
|
"remark-breaks": "^4.0.0",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"semver": "^7.7.1",
|
|
110
110
|
"shiki": "^3.6.0",
|
|
111
111
|
"socket.io-client": "^4.8.1",
|
|
112
|
-
"tailwind-merge": "^
|
|
112
|
+
"tailwind-merge": "^3.3.1",
|
|
113
113
|
"tailwindcss-animate": "^1.0.7",
|
|
114
114
|
"use-stick-to-bottom": "^1.1.1",
|
|
115
115
|
"vis-data": "^8.0.3",
|
|
@@ -118,48 +118,48 @@
|
|
|
118
118
|
},
|
|
119
119
|
"devDependencies": {
|
|
120
120
|
"@cypress/react": "^9.0.1",
|
|
121
|
-
"@cypress/vite-dev-server": "^
|
|
121
|
+
"@cypress/vite-dev-server": "^7.0.0",
|
|
122
122
|
"@eslint/js": "^9.22.0",
|
|
123
|
-
"@happy-dom/global-registrator": "^
|
|
123
|
+
"@happy-dom/global-registrator": "^19.0.2",
|
|
124
124
|
"@playwright/test": "^1.40.0",
|
|
125
125
|
"@radix-ui/react-direction": "^1.1.1",
|
|
126
126
|
"@rollup/plugin-inject": "^5.0.5",
|
|
127
127
|
"@tailwindcss/vite": "^4.1.0",
|
|
128
128
|
"@testing-library/cypress": "^10.0.3",
|
|
129
129
|
"@testing-library/jest-dom": "^6.6.3",
|
|
130
|
-
"@testing-library/react": "^
|
|
130
|
+
"@testing-library/react": "^16.3.0",
|
|
131
131
|
"@testing-library/react-hooks": "^8.0.1",
|
|
132
132
|
"@types/cypress": "^1.1.6",
|
|
133
133
|
"@types/node": "^24.0.1",
|
|
134
|
-
"@types/react": "^19.
|
|
134
|
+
"@types/react": "^19.1.16",
|
|
135
135
|
"@types/react-dom": "^19.0.4",
|
|
136
136
|
"@types/semver": "^7.5.8",
|
|
137
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
138
|
-
"@typescript-eslint/parser": "8.
|
|
139
|
-
"@vitejs/plugin-react-swc": "^
|
|
137
|
+
"@typescript-eslint/eslint-plugin": "8.45.0",
|
|
138
|
+
"@typescript-eslint/parser": "8.45.0",
|
|
139
|
+
"@vitejs/plugin-react-swc": "^4.1.0",
|
|
140
140
|
"asn1.js": "^5.4.1",
|
|
141
|
-
"cypress": "^
|
|
141
|
+
"cypress": "^15.3.0",
|
|
142
142
|
"cypress-real-events": "^1.14.0",
|
|
143
143
|
"eslint": "^9.22.0",
|
|
144
|
-
"eslint-import-resolver-typescript": "^
|
|
144
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
145
145
|
"eslint-plugin-import": "^2.31.0",
|
|
146
146
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
147
147
|
"eslint-plugin-react": "^7.37.4",
|
|
148
148
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
149
149
|
"eslint-plugin-react-refresh": "^0.4.19",
|
|
150
150
|
"evp_bytestokey": "^1.0.3",
|
|
151
|
-
"globals": "^
|
|
152
|
-
"jsdom": "^
|
|
151
|
+
"globals": "^16.4.0",
|
|
152
|
+
"jsdom": "^27.0.0",
|
|
153
153
|
"postcss": "^8.5.3",
|
|
154
|
-
"prettier": "3.
|
|
154
|
+
"prettier": "3.6.2",
|
|
155
155
|
"process": "^0.11.10",
|
|
156
|
-
"rollup-plugin-visualizer": "^
|
|
156
|
+
"rollup-plugin-visualizer": "^6.0.3",
|
|
157
157
|
"tailwindcss": "^4.1.0",
|
|
158
|
-
"typescript": "5.
|
|
159
|
-
"typescript-eslint": "^8.
|
|
160
|
-
"vite": "
|
|
158
|
+
"typescript": "5.9.2",
|
|
159
|
+
"typescript-eslint": "^8.45.0",
|
|
160
|
+
"vite": "^7.1.7",
|
|
161
161
|
"vite-tsconfig-paths": "^5.1.4",
|
|
162
|
-
"wait-on": "^
|
|
162
|
+
"wait-on": "^9.0.1"
|
|
163
163
|
},
|
|
164
|
-
"gitHead": "
|
|
164
|
+
"gitHead": "de2adbe7a4492c8c015e77105bf87fa3570269c3"
|
|
165
165
|
}
|
|
@@ -1,65 +1,58 @@
|
|
|
1
|
-
import { cn } from
|
|
2
|
-
import { User } from
|
|
3
|
-
import { useState, type ComponentPropsWithRef, type ReactElement } from
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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:
|
|
51
|
-
red:
|
|
52
|
-
orange:
|
|
53
|
-
yellow:
|
|
54
|
-
teal:
|
|
55
|
-
indigo:
|
|
56
|
-
purple:
|
|
57
|
-
sky:
|
|
58
|
-
cyan:
|
|
59
|
-
emerald:
|
|
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<
|
|
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?:
|
|
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?:
|
|
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 =
|
|
105
|
-
size =
|
|
106
|
-
rounded =
|
|
107
|
-
bgColor =
|
|
108
|
-
textColor =
|
|
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 ===
|
|
110
|
+
const actualTextColor = textColor === 'white' ? 'text-white' : 'text-black';
|
|
118
111
|
|
|
119
112
|
return (
|
|
120
113
|
<div
|
|
121
114
|
className={cn(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
error &&
|
|
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
|
-
|
|
139
|
+
'flex h-full w-full items-center justify-center',
|
|
152
140
|
bgColorClasses[bgColor],
|
|
153
141
|
actualTextColor,
|
|
154
|
-
|
|
142
|
+
'font-medium'
|
|
155
143
|
)}
|
|
156
144
|
>
|
|
157
145
|
{displayLetter}
|
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
import type { ComponentPropsWithRef, ReactElement, ReactNode } from
|
|
1
|
+
import type { ComponentPropsWithRef, ReactElement, ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
import { cn } from
|
|
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,
|
|
7
|
+
type BadgeSize = Extract<ComponentSize, '4' | '5' | '6' | '7'>;
|
|
12
8
|
|
|
13
9
|
const sizeClasses: Record<BadgeSize, string> = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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<
|
|
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?:
|
|
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 =
|
|
71
|
-
variant =
|
|
72
|
-
size =
|
|
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 ===
|
|
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
|
-
|
|
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
|
|
1
|
+
import type { ComponentPropsWithRef, ReactElement } from 'react';
|
|
2
2
|
|
|
3
|
-
import { cn } from
|
|
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
|
-
|
|
10
|
+
'inline-flex items-center justify-center font-medium transition-all duration-200';
|
|
18
11
|
|
|
19
12
|
const sizeClasses = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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:
|
|
32
|
-
purple:
|
|
33
|
-
indigo:
|
|
34
|
-
orange:
|
|
35
|
-
teal:
|
|
36
|
-
cyan:
|
|
37
|
-
sky:
|
|
38
|
-
yellow:
|
|
39
|
-
emerald:
|
|
40
|
-
red:
|
|
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
|
-
|
|
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<
|
|
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?:
|
|
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?:
|
|
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 =
|
|
95
|
-
theme =
|
|
96
|
-
rounded =
|
|
97
|
-
variant =
|
|
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 =
|
|
94
|
+
type = 'button',
|
|
103
95
|
onClick,
|
|
104
|
-
className =
|
|
96
|
+
className = '',
|
|
105
97
|
...rest
|
|
106
98
|
}: ButtonProps) => {
|
|
107
|
-
const widthClass = fullWidth ?
|
|
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 ===
|
|
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
|
|
1
|
+
import type { ComponentPropsWithRef } from 'react';
|
|
2
2
|
|
|
3
|
-
import { ChevronsUpDown, ChevronsDownUp } from
|
|
3
|
+
import { ChevronsUpDown, ChevronsDownUp } from 'lucide-react';
|
|
4
4
|
|
|
5
|
-
import { IconButton } from
|
|
5
|
+
import { IconButton } from './IconButton.tsx';
|
|
6
6
|
|
|
7
|
-
export type SpanCardExpandAllButtonProps = ComponentPropsWithRef<
|
|
7
|
+
export type SpanCardExpandAllButtonProps = ComponentPropsWithRef<'button'> & {
|
|
8
8
|
onExpandAll: () => void;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
export type SpanCardCollapseAllButtonProps = ComponentPropsWithRef<
|
|
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
|
);
|