ai-design-system 0.1.67 → 0.1.68
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/components/blocks/SectionLayout/interfaces.ts +1 -0
- package/components/composites/AdjustableLayout/AdjustableLayout.tsx +13 -1
- package/components/features/EvalDashboardFeature/EvalDashboardFeature.tsx +12 -11
- package/dist/index.cjs +14 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +30 -28
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ export interface AdjustableLayoutSection {
|
|
|
10
10
|
maxSize?: number // maximum percentage
|
|
11
11
|
resizable?: boolean // default true for >1 sections
|
|
12
12
|
className?: string
|
|
13
|
+
variant?: "default" | "ghost"
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export interface AdjustableLayoutProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
@@ -66,6 +67,16 @@ export const AdjustableLayout = React.memo<AdjustableLayoutProps>(
|
|
|
66
67
|
|
|
67
68
|
const [sizes, setSizes] = React.useState<number[]>(defaultSizes)
|
|
68
69
|
|
|
70
|
+
// Sync sizes if the number of sections changes (e.g. data loads and new section appears)
|
|
71
|
+
React.useEffect(() => {
|
|
72
|
+
setSizes((prevSizes) => {
|
|
73
|
+
if (prevSizes.length !== sections.length) {
|
|
74
|
+
return defaultSizes;
|
|
75
|
+
}
|
|
76
|
+
return prevSizes;
|
|
77
|
+
});
|
|
78
|
+
}, [sections.length, defaultSizes])
|
|
79
|
+
|
|
69
80
|
// After hydration, overwrite with persisted sizes if available
|
|
70
81
|
React.useEffect(() => {
|
|
71
82
|
if (!storageKey) return
|
|
@@ -208,7 +219,8 @@ export const AdjustableLayout = React.memo<AdjustableLayoutProps>(
|
|
|
208
219
|
<React.Fragment key={section.id}>
|
|
209
220
|
<div
|
|
210
221
|
className={cn(
|
|
211
|
-
"min-h-0 overflow-hidden
|
|
222
|
+
"min-h-0 overflow-hidden",
|
|
223
|
+
(section.variant ?? "default") === "default" && "bg-card border border-border rounded-xl",
|
|
212
224
|
section.className
|
|
213
225
|
)}
|
|
214
226
|
style={{
|
|
@@ -5,9 +5,9 @@ import { DashboardChart } from "@/components/composites/DashboardChart"
|
|
|
5
5
|
import { EvalSessionDetailsPanel, EvalTriggerButton } from "@/components/composites/EvalSessionDetailsPanel"
|
|
6
6
|
import type { DashboardRow } from "@/components/composites/DataTable"
|
|
7
7
|
import { cn } from "@/lib/utils"
|
|
8
|
-
import type {
|
|
9
|
-
EvalDashboardFeatureInboxState,
|
|
10
|
-
EvalDashboardFeatureData,
|
|
8
|
+
import type {
|
|
9
|
+
EvalDashboardFeatureInboxState,
|
|
10
|
+
EvalDashboardFeatureData,
|
|
11
11
|
EvalDashboardFeatureActionHandlers,
|
|
12
12
|
} from "./useEvalDashboardFeature.d"
|
|
13
13
|
|
|
@@ -24,9 +24,9 @@ export const EvalDashboardFeature = React.memo<EvalDashboardFeatureProps>(
|
|
|
24
24
|
const [showInbox, setShowInbox] = React.useState(true)
|
|
25
25
|
const [activeTab, setActiveTab] = React.useState("golden-evals")
|
|
26
26
|
|
|
27
|
-
const selectedSession = React.useMemo(() =>
|
|
27
|
+
const selectedSession = React.useMemo(() =>
|
|
28
28
|
inbox.items.find(s => s.id === inbox.selectedItemId) || null
|
|
29
|
-
|
|
29
|
+
, [inbox.items, inbox.selectedItemId])
|
|
30
30
|
|
|
31
31
|
// Calculate average score for the trend section
|
|
32
32
|
const avgScore = React.useMemo(() => {
|
|
@@ -40,7 +40,6 @@ export const EvalDashboardFeature = React.memo<EvalDashboardFeatureProps>(
|
|
|
40
40
|
id: session.id,
|
|
41
41
|
title: session.id,
|
|
42
42
|
subtitle: `Score: ${session.score}/${session.total}`,
|
|
43
|
-
preview: `${session.latency} • ${session.tokens}t`,
|
|
44
43
|
timestamp: new Date(session.date).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })
|
|
45
44
|
}))
|
|
46
45
|
}, [inbox.items]);
|
|
@@ -50,7 +49,7 @@ export const EvalDashboardFeature = React.memo<EvalDashboardFeatureProps>(
|
|
|
50
49
|
const sortedItems = [...inbox.items].sort(
|
|
51
50
|
(a, b) => new Date(a.date).getTime() - new Date(b.date).getTime()
|
|
52
51
|
)
|
|
53
|
-
|
|
52
|
+
|
|
54
53
|
return sortedItems.map(session => ({
|
|
55
54
|
date: session.date,
|
|
56
55
|
// We map score to 'desktop' since DashboardChart is hardcoded for now
|
|
@@ -75,6 +74,7 @@ export const EvalDashboardFeature = React.memo<EvalDashboardFeatureProps>(
|
|
|
75
74
|
resizable={true}
|
|
76
75
|
padded={false}
|
|
77
76
|
className="h-full"
|
|
77
|
+
storageKey="eval-dashboard-outer"
|
|
78
78
|
sections={[
|
|
79
79
|
...(mockChartData.length > 0 ? [{
|
|
80
80
|
id: "graph",
|
|
@@ -104,8 +104,9 @@ export const EvalDashboardFeature = React.memo<EvalDashboardFeatureProps>(
|
|
|
104
104
|
}] : []),
|
|
105
105
|
{
|
|
106
106
|
id: "content",
|
|
107
|
-
defaultSize: mockChartData.length > 0 ?
|
|
107
|
+
defaultSize: mockChartData.length > 0 ? 80 : 100,
|
|
108
108
|
minSize: 40,
|
|
109
|
+
variant: "ghost",
|
|
109
110
|
content: (
|
|
110
111
|
<div className="h-full w-full min-h-0">
|
|
111
112
|
<SectionLayout
|
|
@@ -157,9 +158,9 @@ export const EvalDashboardFeature = React.memo<EvalDashboardFeatureProps>(
|
|
|
157
158
|
) : undefined
|
|
158
159
|
} : undefined,
|
|
159
160
|
content: sessionDetails ? (
|
|
160
|
-
<EvalSessionDetailsPanel
|
|
161
|
-
sessionDetails={sessionDetails}
|
|
162
|
-
activeTab={activeTab}
|
|
161
|
+
<EvalSessionDetailsPanel
|
|
162
|
+
sessionDetails={sessionDetails}
|
|
163
|
+
activeTab={activeTab}
|
|
163
164
|
/>
|
|
164
165
|
) : (
|
|
165
166
|
<div className="flex-1 flex items-center justify-center text-muted-foreground bg-background h-full">
|
package/dist/index.cjs
CHANGED
|
@@ -1734,6 +1734,14 @@ var AdjustableLayout = React3__namespace.memo(
|
|
|
1734
1734
|
return raw.map((size) => size / total * 100);
|
|
1735
1735
|
}, [sections]);
|
|
1736
1736
|
const [sizes, setSizes] = React3__namespace.useState(defaultSizes);
|
|
1737
|
+
React3__namespace.useEffect(() => {
|
|
1738
|
+
setSizes((prevSizes) => {
|
|
1739
|
+
if (prevSizes.length !== sections.length) {
|
|
1740
|
+
return defaultSizes;
|
|
1741
|
+
}
|
|
1742
|
+
return prevSizes;
|
|
1743
|
+
});
|
|
1744
|
+
}, [sections.length, defaultSizes]);
|
|
1737
1745
|
React3__namespace.useEffect(() => {
|
|
1738
1746
|
if (!storageKey) return;
|
|
1739
1747
|
const saved = localStorage.getItem(storageKey);
|
|
@@ -1830,6 +1838,7 @@ var AdjustableLayout = React3__namespace.memo(
|
|
|
1830
1838
|
}
|
|
1831
1839
|
}, [draggingIndex, handleMouseMove, handleMouseUp]);
|
|
1832
1840
|
const renderPanel = (section, size, index) => {
|
|
1841
|
+
var _a2;
|
|
1833
1842
|
const nextSection = sections[index + 1];
|
|
1834
1843
|
const isResizable = section.resizable !== false && sections.length > 1 && index < sections.length - 1 && !section.fixedSize && !(nextSection == null ? void 0 : nextSection.fixedSize);
|
|
1835
1844
|
const fixedStyle = section.fixedSize ? orientation === "horizontal" ? { flex: `0 0 ${section.fixedSize}`, width: section.fixedSize, minWidth: section.fixedSize } : { flex: `0 0 ${section.fixedSize}`, height: section.fixedSize, minHeight: section.fixedSize } : null;
|
|
@@ -1838,7 +1847,8 @@ var AdjustableLayout = React3__namespace.memo(
|
|
|
1838
1847
|
"div",
|
|
1839
1848
|
{
|
|
1840
1849
|
className: cn(
|
|
1841
|
-
"min-h-0 overflow-hidden
|
|
1850
|
+
"min-h-0 overflow-hidden",
|
|
1851
|
+
((_a2 = section.variant) != null ? _a2 : "default") === "default" && "bg-card border border-border rounded-xl",
|
|
1842
1852
|
section.className
|
|
1843
1853
|
),
|
|
1844
1854
|
style: __spreadProps(__spreadValues({}, fixedStyle != null ? fixedStyle : { flex: `${size} 1 0%` }), {
|
|
@@ -13067,7 +13077,6 @@ var EvalDashboardFeature = React3__namespace.memo(
|
|
|
13067
13077
|
id: session.id,
|
|
13068
13078
|
title: session.id,
|
|
13069
13079
|
subtitle: `Score: ${session.score}/${session.total}`,
|
|
13070
|
-
preview: `${session.latency} \u2022 ${session.tokens}t`,
|
|
13071
13080
|
timestamp: new Date(session.date).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })
|
|
13072
13081
|
}));
|
|
13073
13082
|
}, [inbox.items]);
|
|
@@ -13097,6 +13106,7 @@ var EvalDashboardFeature = React3__namespace.memo(
|
|
|
13097
13106
|
resizable: true,
|
|
13098
13107
|
padded: false,
|
|
13099
13108
|
className: "h-full",
|
|
13109
|
+
storageKey: "eval-dashboard-outer",
|
|
13100
13110
|
sections: [
|
|
13101
13111
|
...mockChartData.length > 0 ? [{
|
|
13102
13112
|
id: "graph",
|
|
@@ -13125,8 +13135,9 @@ var EvalDashboardFeature = React3__namespace.memo(
|
|
|
13125
13135
|
}] : [],
|
|
13126
13136
|
{
|
|
13127
13137
|
id: "content",
|
|
13128
|
-
defaultSize: mockChartData.length > 0 ?
|
|
13138
|
+
defaultSize: mockChartData.length > 0 ? 80 : 100,
|
|
13129
13139
|
minSize: 40,
|
|
13140
|
+
variant: "ghost",
|
|
13130
13141
|
content: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full min-h-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13131
13142
|
SectionLayout,
|
|
13132
13143
|
{
|