Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

feat(webv2): divide data list rows with hairlines

joshistoast6a3525c1b920
diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/DataListDividers.browser.test.tsx b/invokeai/frontend/webv2/src/platform/ui/theme/DataListDividers.browser.test.tsx
new file mode 100644
index 0000000000..e369fab476
--- /dev/null
+++ b/invokeai/frontend/webv2/src/platform/ui/theme/DataListDividers.browser.test.tsx
@@ -0,0 +1,70 @@
+import { Box, ChakraProvider, DataList } from '@chakra-ui/react';
+import { system } from '@theme/system';
+import { act } from 'react';
+import { createRoot, type Root } from 'react-dom/client';
+import { afterEach, describe, expect, it } from 'vitest';
+
+let host: HTMLDivElement | null = null;
+let root: Root | null = null;
+(globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
+
+afterEach(async () => {
+ await act(() => root?.unmount());
+ host?.remove();
+ host = null;
+ root = null;
+});
+
+const renderDataList = async (): Promise<{ reference: HTMLElement; rows: HTMLElement[] }> => {
+ host = document.createElement('div');
+ document.body.append(host);
+ root = createRoot(host);
+
+ await act(() => {
+ root?.render(
+ <ChakraProvider value={system}>
+ <Box borderColor="border.subtle" borderWidth="1px" data-testid="reference" />
+ <DataList.Root gap="1.5" orientation="horizontal" size="sm">
+ {['Seed', 'Steps', 'Prompt'].map((label) => (
+ <DataList.Item key={label} data-testid="row">
+ <DataList.ItemLabel>{label}</DataList.ItemLabel>
+ <DataList.ItemValue>value</DataList.ItemValue>
+ </DataList.Item>
+ ))}
+ </DataList.Root>
+ </ChakraProvider>
+ );
+ });
+
+ return {
+ reference: host.querySelector<HTMLElement>('[data-testid="reference"]')!,
+ rows: [...host.querySelectorAll<HTMLElement>('[data-testid="row"]')],
+ };
+};
+
+describe('dataList slot recipe', () => {
+ it('draws a hairline divider above every row but the first', async () => {
+ const { rows } = await renderDataList();
+ const [first, second, third] = rows;
+
+ expect(getComputedStyle(first).borderTopWidth).toBe('0px');
+ expect(getComputedStyle(second).borderTopWidth).toBe('1px');
+ expect(getComputedStyle(third).borderTopWidth).toBe('1px');
+ });
+
+ it('uses the subtle border token, not the inherited text color', async () => {
+ const { reference, rows } = await renderDataList();
+
+ // A failed token lookup would fall back to `currentColor`; comparing
+ // against a border.subtle reference catches that regression.
+ expect(getComputedStyle(rows[1]).borderTopColor).toBe(getComputedStyle(reference).borderTopColor);
+ expect(getComputedStyle(rows[1]).borderTopColor).not.toBe(getComputedStyle(rows[1]).color);
+ });
+
+ it('pads divided rows so the line sits centered in the 1.5-unit row gap', async () => {
+ const { rows } = await renderDataList();
+
+ expect(getComputedStyle(rows[0]).paddingTop).toBe('0px');
+ expect(getComputedStyle(rows[1]).paddingTop).toBe('6px');
+ });
+});
diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts b/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts
index 119bc3bbdd..5fb18f9429 100644
--- a/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts
+++ b/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts
@@ -730,3 +730,27 @@ export const themeCardRecipe = defineSlotRecipe({
},
defaultVariants: { selected: false },
});
+
+/**
+ * Hairline dividers between rows. Metadata lists carry values of very
+ * different heights — a seed next to a wrapped prompt — and a bare row gap
+ * stops reading as separation once values grow tall; the rule keeps each
+ * label/value pair visually bound. `paddingTop` mirrors the 1.5-unit row gap
+ * the metadata lists use, so the line sits centered between rows.
+ */
+export const dataListSlotRecipe = defineSlotRecipe({
+ ...chakraSlotRecipes.dataList,
+ base: {
+ ...chakraSlotRecipes.dataList.base,
+ item: {
+ ...chakraSlotRecipes.dataList.base?.item,
+ '&:not(:first-child)': {
+ // `borderColor` + top-only width, like the chrome islands: the
+ // side-specific color property does not resolve the semantic token.
+ borderColor: 'border.subtle',
+ borderTopWidth: '1px',
+ paddingTop: '1.5',
+ },
+ },
+ },
+});
diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/system.ts b/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
index 5b39b6f29d..bdd2294f9a 100644
--- a/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
+++ b/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
@@ -4,6 +4,7 @@ import {
buttonRecipe,
colorPickerSlotRecipe,
comboboxSlotRecipe,
+ dataListSlotRecipe,
dialogSlotRecipe,
hoverCardSlotRecipe,
inputRecipe,
@@ -288,6 +289,7 @@ const config = defineConfig({
slotRecipes: {
colorPicker: colorPickerSlotRecipe,
combobox: comboboxSlotRecipe,
+ dataList: dataListSlotRecipe,
dialog: dialogSlotRecipe,
hoverCard: hoverCardSlotRecipe,
menu: menuSlotRecipe,