@gntik-ai/blocks 0.12.0 → 0.13.0
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/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/ai/EvaluationScorecard/EvaluationScorecard.test.tsx +10 -0
- package/src/ai/EvaluationScorecard/EvaluationScorecard.tsx +2 -1
- package/src/ai/TokenCostCard/TokenCostCard.test.tsx +10 -0
- package/src/ai/TokenCostCard/TokenCostCard.tsx +2 -1
- package/src/builders/CodePanel/CodePanel.test.tsx +11 -0
- package/src/builders/CodePanel/CodePanel.tsx +2 -1
- package/src/page-chrome/PageToolbar/PageToolbar.test.tsx +3 -1
- package/src/page-chrome/PageToolbar/PageToolbar.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gntik-ai/blocks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "gntik-ui blocks: page chrome, data display, tables, forms, feedback, billing, team and builder sections composed from @gntik-ai/ui.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@gntik-ai/flow": "0.12.0",
|
|
41
41
|
"@gntik-ai/icons": "0.5.0",
|
|
42
42
|
"@gntik-ai/tokens": "0.4.0",
|
|
43
|
-
"@gntik-ai/ui": "0.
|
|
43
|
+
"@gntik-ai/ui": "0.13.0",
|
|
44
44
|
"lucide-react": "^1.48.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
@@ -30,6 +30,16 @@ describe('EvaluationScorecard', () => {
|
|
|
30
30
|
]);
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
+
it('pressing the active filter keeps it active', async () => {
|
|
34
|
+
const user = userEvent.setup();
|
|
35
|
+
render(<EvaluationScorecard />);
|
|
36
|
+
const regressions = screen.getByRole('button', { name: /Regressions/ });
|
|
37
|
+
await user.click(regressions);
|
|
38
|
+
await user.click(regressions);
|
|
39
|
+
expect(regressions).toHaveAttribute('aria-pressed', 'true');
|
|
40
|
+
expect(bodyRows()).toHaveLength(2);
|
|
41
|
+
});
|
|
42
|
+
|
|
33
43
|
it('shows an empty row when nothing regressed', async () => {
|
|
34
44
|
const user = userEvent.setup();
|
|
35
45
|
render(<EvaluationScorecard rows={[]} />);
|
|
@@ -145,8 +145,9 @@ export function EvaluationScorecard({
|
|
|
145
145
|
<ToggleGroup
|
|
146
146
|
aria-label="Show datasets"
|
|
147
147
|
size="sm"
|
|
148
|
+
disallowEmptySelection
|
|
148
149
|
value={[filter]}
|
|
149
|
-
onValueChange={(v) =>
|
|
150
|
+
onValueChange={(v) => setFilter(v[0] as 'all' | 'regressions')}
|
|
150
151
|
>
|
|
151
152
|
<Toggle value="all">
|
|
152
153
|
All <span className="font-mono text-[10.5px] opacity-70">{rows.length}</span>
|
|
@@ -23,6 +23,16 @@ describe('TokenCostCard', () => {
|
|
|
23
23
|
expect(screen.getByRole('meter', { name: 'Budget' })).toHaveAttribute('aria-valuetext', '$431.75 of $500.00');
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
+
it('pressing the active period keeps it active', async () => {
|
|
27
|
+
const user = userEvent.setup();
|
|
28
|
+
render(<TokenCostCard />);
|
|
29
|
+
const d30 = screen.getByRole('button', { name: '30d' });
|
|
30
|
+
await user.click(d30);
|
|
31
|
+
await user.click(d30);
|
|
32
|
+
expect(d30).toHaveAttribute('aria-pressed', 'true');
|
|
33
|
+
expect(screen.getByText('$431.75')).toBeInTheDocument();
|
|
34
|
+
});
|
|
35
|
+
|
|
26
36
|
it('reports overspend and hides the switch for a single period', () => {
|
|
27
37
|
render(
|
|
28
38
|
<TokenCostCard
|
|
@@ -68,8 +68,9 @@ export function TokenCostCard({
|
|
|
68
68
|
<ToggleGroup
|
|
69
69
|
aria-label="Period"
|
|
70
70
|
size="sm"
|
|
71
|
+
disallowEmptySelection
|
|
71
72
|
value={[period.id]}
|
|
72
|
-
onValueChange={(v) => v[0]
|
|
73
|
+
onValueChange={(v) => setPeriodId(v[0] as string)}
|
|
73
74
|
>
|
|
74
75
|
{periods.map((p) => (
|
|
75
76
|
<Toggle key={p.id} value={p.id}>
|
|
@@ -127,6 +127,17 @@ describe('CodePanel', () => {
|
|
|
127
127
|
await waitFor(() => expect(m.created.at(-1)?.revealLineInCenter).toHaveBeenCalledWith(5));
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
+
it('pressing the active editor view keeps it active', async () => {
|
|
131
|
+
const user = userEvent.setup();
|
|
132
|
+
const m = mockMonaco();
|
|
133
|
+
render(<CodePanel loader={m.loader} />);
|
|
134
|
+
await waitFor(() => expect(m.editor.create).toHaveBeenCalledTimes(1));
|
|
135
|
+
const edit = screen.getByRole('button', { name: 'Edit' });
|
|
136
|
+
await user.click(edit);
|
|
137
|
+
expect(edit).toHaveAttribute('aria-pressed', 'true');
|
|
138
|
+
expect(screen.getByRole('button', { name: 'Diff' })).toHaveAttribute('aria-pressed', 'false');
|
|
139
|
+
});
|
|
140
|
+
|
|
130
141
|
it('supports a controlled active file', async () => {
|
|
131
142
|
const user = userEvent.setup();
|
|
132
143
|
const m = mockMonaco();
|
|
@@ -152,8 +152,9 @@ export function CodePanel({
|
|
|
152
152
|
<ToggleGroup
|
|
153
153
|
aria-label="Editor view"
|
|
154
154
|
size="sm"
|
|
155
|
+
disallowEmptySelection
|
|
155
156
|
value={[effectiveView]}
|
|
156
|
-
onValueChange={(v) =>
|
|
157
|
+
onValueChange={(v) => setView(v[0] as View)}
|
|
157
158
|
className="mb-2 self-start sm:self-auto"
|
|
158
159
|
>
|
|
159
160
|
<Toggle value="code">Edit</Toggle>
|
|
@@ -29,8 +29,10 @@ describe('PageToolbar', () => {
|
|
|
29
29
|
await user.click(screen.getByRole('button', { name: 'Grid view' }));
|
|
30
30
|
expect(onViewChange).toHaveBeenCalledWith('grid');
|
|
31
31
|
expect(screen.getByRole('button', { name: 'Grid view' })).toHaveAttribute('aria-pressed', 'true');
|
|
32
|
-
// Clicking the active view keeps it selected.
|
|
32
|
+
// Clicking the active view keeps it selected and reports nothing.
|
|
33
|
+
onViewChange.mockClear();
|
|
33
34
|
await user.click(screen.getByRole('button', { name: 'Grid view' }));
|
|
35
|
+
expect(onViewChange).not.toHaveBeenCalled();
|
|
34
36
|
expect(screen.getByRole('button', { name: 'Grid view' })).toHaveAttribute('aria-pressed', 'true');
|
|
35
37
|
await user.click(screen.getByRole('button', { name: 'Create' }));
|
|
36
38
|
expect(onCreate).toHaveBeenCalledTimes(1);
|
|
@@ -101,10 +101,10 @@ export function PageToolbar({
|
|
|
101
101
|
<ToggleGroup
|
|
102
102
|
aria-label={t('toolbar.view')}
|
|
103
103
|
size="sm"
|
|
104
|
+
disallowEmptySelection
|
|
104
105
|
value={[currentView]}
|
|
105
106
|
onValueChange={(next) => {
|
|
106
|
-
const picked = next[0];
|
|
107
|
-
if (!picked) return; // keep one view selected
|
|
107
|
+
const picked = next[0] as string;
|
|
108
108
|
setInnerView(picked);
|
|
109
109
|
onViewChange?.(picked);
|
|
110
110
|
}}
|