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.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
feat(ui): standardize interaction styling
joshistoast3efa75f92cc5
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/ResizableTextareaIntegration.browser.test.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/ResizableTextareaIntegration.browser.test.tsxindex c71d4c552d..044eb78eec 100644--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/ResizableTextareaIntegration.browser.test.tsx+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/ResizableTextareaIntegration.browser.test.tsx@@ -9,6 +9,7 @@ import { system } from '@theme/system';import { act, useCallback, useState, type ChangeEvent } from 'react';import { createRoot, type Root } from 'react-dom/client';import { afterEach, describe, expect, it, vi } from 'vitest';+import { userEvent } from 'vitest/browser';let host: HTMLDivElement | null = null;let root: Root | null = null;@@ -50,6 +51,35 @@ afterEach(async () => {});describe('ResizableTextarea', () => {+ it('keeps its focus border while hovered', async () => {+ const { textarea } = await renderTextarea();++ await act(async () => {+ await userEvent.hover(textarea);+ await userEvent.tab();+ await new Promise((resolve) => {+ globalThis.setTimeout(resolve, 200);+ });+ });+ expect(document.activeElement).toBe(textarea);+ const hoveredFocusBorderColor = getComputedStyle(textarea).borderTopColor;+ const accentProbe = document.createElement('div');+ accentProbe.style.border = '1px solid var(--chakra-colors-accent-solid)';+ document.body.append(accentProbe);+ const accentBorderColor = getComputedStyle(accentProbe).borderTopColor;+ accentProbe.remove();+ expect(getComputedStyle(textarea).outlineStyle).toBe('none');+ expect(hoveredFocusBorderColor).toBe(accentBorderColor);++ await act(async () => {+ await userEvent.unhover(textarea);+ await new Promise((resolve) => {+ globalThis.setTimeout(resolve, 200);+ });+ });+ expect(getComputedStyle(textarea).borderTopColor).toBe(accentBorderColor);+ });+it('allows unbounded pointer and keyboard growth while keeping Home at the minimum', async () => {const { handle, onResizeEnd, textarea } = await renderTextarea();diff --git a/invokeai/frontend/webv2/src/platform/ui/DropZone.tsx b/invokeai/frontend/webv2/src/platform/ui/DropZone.tsxnew file mode 100644index 0000000000..6f36e4e85f--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/ui/DropZone.tsx@@ -0,0 +1,43 @@+import type { BoxProps } from '@chakra-ui/react';+import type { Ref } from 'react';++import { Box } from '@chakra-ui/react';++const DROP_ZONE_TRANSITION =+ 'background var(--wb-motion-duration-fast) ease, border-color var(--wb-motion-duration-fast) ease, opacity var(--wb-motion-duration-fast) ease, box-shadow var(--wb-motion-duration-fast) ease';++export interface DropZoneProps extends BoxProps {+ /** A compatible drag is hovering the zone. */+ isOver?: boolean;+ /** Forwarded to the underlying element (e.g. dnd-kit's `setNodeRef`). */+ ref?: Ref<HTMLDivElement>;+ /**+ * `inline` — a persistent, usually clickable upload box inside a form.+ * `overlay` — a drag-time overlay floated above existing content; heavier+ * border and a surface tint so it reads against arbitrary backdrops.+ */+ variant?: 'inline' | 'overlay';+}++/**+ * The workbench drop-target look: dashed `border.emphasized` at rest,+ * `accent.solid` border over an `accent.muted` tint while a compatible drag+ * hovers. Every drop zone and upload area composes this so drag affordances+ * stay identical across the app; callers add their own icon/hint content,+ * interaction handlers, and layout props.+ */+export const DropZone = ({ children, isOver, variant = 'inline', ...boxProps }: DropZoneProps) => (+ <Box+ bg={isOver ? 'accent.muted' : variant === 'overlay' ? 'bg.muted/80' : undefined}+ borderColor={isOver ? 'accent.solid' : 'border.emphasized'}+ borderStyle="dashed"+ borderWidth={variant === 'overlay' ? '2px' : '1px'}+ boxShadow={isOver && variant === 'overlay' ? '0 0 0 1px {colors.accent.solid}' : undefined}+ color={isOver ? 'fg' : 'fg.muted'}+ rounded="md"+ transition={DROP_ZONE_TRANSITION}+ {...boxProps}+ >+ {children}+ </Box>+);diff --git a/invokeai/frontend/webv2/src/platform/ui/FormControlInteraction.browser.test.tsx b/invokeai/frontend/webv2/src/platform/ui/FormControlInteraction.browser.test.tsxnew file mode 100644index 0000000000..3c2f768f61--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/ui/FormControlInteraction.browser.test.tsx@@ -0,0 +1,87 @@+import { ChakraProvider, createListCollection, Input, Stack } 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';+import { userEvent } from 'vitest/browser';++import { Select } from './Select';++const collection = createListCollection({+ items: [{ label: 'Euler', value: 'euler' }],+});++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;+});++describe('form control interaction styles', () => {+ it('keeps the select focus border while hovered', async () => {+ host = document.createElement('div');+ document.body.append(host);+ root = createRoot(host);++ await act(() => {+ root?.render(+ <ChakraProvider value={system}>+ <Stack>+ <Input aria-label="Input baseline" />+ <Select aria-label="Sampler" collection={collection} />+ </Stack>+ </ChakraProvider>+ );+ });++ const trigger = host.querySelector<HTMLButtonElement>('[data-part="trigger"]')!;+ const input = host.querySelector<HTMLInputElement>('input[aria-label="Input baseline"]')!;+ const accentProbe = document.createElement('div');+ accentProbe.style.border = '1px solid var(--chakra-colors-accent-solid)';+ document.body.append(accentProbe);+ const accentBorderColor = getComputedStyle(accentProbe).borderTopColor;+ accentProbe.remove();++ await act(async () => {+ await userEvent.tab();+ await new Promise((resolve) => {+ globalThis.setTimeout(resolve, 200);+ });+ });+ expect(getComputedStyle(input).outlineStyle).toBe('none');+ expect(getComputedStyle(input).borderTopColor).toBe(accentBorderColor);+ await act(async () => {+ await userEvent.tab();+ await new Promise((resolve) => {+ globalThis.setTimeout(resolve, 200);+ });+ });+ expect(document.activeElement).toBe(trigger);+ expect(getComputedStyle(trigger).outlineStyle).toBe('none');+ expect(getComputedStyle(trigger).borderTopColor).toBe(accentBorderColor);++ await act(async () => {+ await userEvent.hover(trigger);+ trigger.click();+ await new Promise((resolve) => {+ globalThis.setTimeout(resolve, 200);+ });+ });+ expect(trigger.getAttribute('data-state')).toBe('open');+ const hoveredFocusBorderColor = getComputedStyle(trigger).borderTopColor;+ expect(hoveredFocusBorderColor).toBe(accentBorderColor);++ await act(async () => {+ await userEvent.unhover(trigger);+ await new Promise((resolve) => {+ globalThis.setTimeout(resolve, 200);+ });+ });+ expect(hoveredFocusBorderColor).toBe(getComputedStyle(trigger).borderTopColor);+ });+});diff --git a/invokeai/frontend/webv2/src/platform/ui/Tabs.browser.test.tsx b/invokeai/frontend/webv2/src/platform/ui/Tabs.browser.test.tsxnew file mode 100644index 0000000000..c14b035e92--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/ui/Tabs.browser.test.tsx@@ -0,0 +1,150 @@+import { Box, ChakraProvider, Stack, Tabs } 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';+import { userEvent } from 'vitest/browser';++const variants = ['line', 'subtle', 'enclosed', 'outline', 'plain'] as const;++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;+});++describe('tab hover styles', () => {+ it('gives every variant restrained hover feedback without changing selected or disabled tabs', async () => {+ host = document.createElement('div');+ document.body.append(host);+ root = createRoot(host);++ await act(async () => {+ root?.render(+ <ChakraProvider value={system}>+ <Stack>+ <Box aria-label="muted background probe" bg="bg.muted" />+ <Box aria-label="faint muted background probe" bg="bg.muted/60" />+ <Box aria-label="light muted background probe" bg="bg.muted/40" />+ <Box aria-label="emphasized background probe" bg="bg.emphasized" />+ <Box aria-label="emphasized border probe" borderColor="border.emphasized" borderWidth="1px" />+ {variants.map((variant) => (+ <Tabs.Root key={variant} value="selected" variant={variant}>+ <Tabs.List>+ <Tabs.Trigger aria-label={`${variant} idle`} value="idle">+ Idle+ </Tabs.Trigger>+ <Tabs.Trigger aria-label={`${variant} selected`} value="selected">+ Selected+ </Tabs.Trigger>+ <Tabs.Trigger aria-label={`${variant} disabled`} value="disabled" disabled>+ Disabled+ </Tabs.Trigger>+ </Tabs.List>+ </Tabs.Root>+ ))}+ </Stack>+ </ChakraProvider>+ );+ await new Promise<void>((resolve) => {+ globalThis.setTimeout(resolve, 0);+ });+ });++ const mutedBackground = getProbeStyle(host, 'muted background probe').backgroundColor;+ const faintMutedBackground = getProbeStyle(host, 'faint muted background probe').backgroundColor;+ const lightMutedBackground = getProbeStyle(host, 'light muted background probe').backgroundColor;+ const emphasizedBackground = getProbeStyle(host, 'emphasized background probe').backgroundColor;+ const emphasizedBorder = getProbeStyle(host, 'emphasized border probe').borderColor;+ const expectedHoverBackgrounds = {+ enclosed: emphasizedBackground,+ line: faintMutedBackground,+ outline: mutedBackground,+ plain: lightMutedBackground,+ subtle: mutedBackground,+ };++ for (const variant of variants) {+ const idle = host.querySelector<HTMLButtonElement>(`[aria-label="${variant} idle"]`)!;+ const selected = host.querySelector<HTMLButtonElement>(`[aria-label="${variant} selected"]`)!;+ const disabled = host.querySelector<HTMLButtonElement>(`[aria-label="${variant} disabled"]`)!;+ const idleBefore = getInteractionStyles(idle);+ const selectedBefore = getInteractionStyles(selected);+ const disabledBefore = getInteractionStyles(disabled);++ await act(async () => {+ await userEvent.hover(idle);+ await waitForTransition();+ });+ const idleHovered = getInteractionStyles(idle);+ expect(idleHovered.transitionDuration).toBe('0.1s');+ expect(idleHovered.transitionProperty).toBe('background, border-color, color');+ expect(idleHovered.backgroundColor).toBe(expectedHoverBackgrounds[variant]);+ if (variant === 'line' || variant === 'plain') {+ expect(idleHovered.color).not.toBe(idleBefore.color);+ } else {+ expect(idleHovered.color).toBe(idleBefore.color);+ }+ if (variant === 'outline') {+ expect(idleHovered.borderColor).toBe(emphasizedBorder);+ }++ await act(async () => {+ await userEvent.unhover(idle);+ await userEvent.hover(selected);+ await waitForTransition();+ });+ expect(getInteractionStyles(selected)).toEqual(selectedBefore);++ await act(async () => {+ await userEvent.unhover(selected);+ await userEvent.hover(disabled);+ await waitForTransition();+ });+ expect(getInteractionStyles(disabled)).toEqual(disabledBefore);+ await act(() => userEvent.unhover(disabled));+ }++ const lineIdle = host.querySelector<HTMLButtonElement>('[aria-label="line idle"]')!;+ const lineSelected = host.querySelector<HTMLButtonElement>('[aria-label="line selected"]')!;+ await act(async () => {+ await userEvent.tab();+ await userEvent.keyboard('{ArrowLeft}');+ });+ expect(document.activeElement).toBe(lineIdle);+ const focusOutline = getComputedStyle(lineIdle).outline;+ expect(focusOutline).not.toBe('none');++ await act(async () => {+ await userEvent.hover(lineIdle);+ await waitForTransition();+ });+ expect(getComputedStyle(lineIdle).outline).toBe(focusOutline);+ expect(lineSelected.dataset.selected).toBe('');+ });+});++const getInteractionStyles = (element: HTMLElement) => {+ const styles = getComputedStyle(element);++ return {+ backgroundColor: styles.backgroundColor,+ borderColor: styles.borderColor,+ color: styles.color,+ transitionDuration: styles.transitionDuration,+ transitionProperty: styles.transitionProperty,+ };+};++const waitForTransition = () =>+ new Promise<void>((resolve) => {+ globalThis.setTimeout(resolve, 200);+ });++const getProbeStyle = (container: HTMLElement, label: string) =>+ getComputedStyle(container.querySelector<HTMLElement>(`[aria-label="${label}"]`)!);diff --git a/invokeai/frontend/webv2/src/platform/ui/Toolbar.tsx b/invokeai/frontend/webv2/src/platform/ui/Toolbar.tsxindex e81d4959c9..de8cd6b8eb 100644--- a/invokeai/frontend/webv2/src/platform/ui/Toolbar.tsx+++ b/invokeai/frontend/webv2/src/platform/ui/Toolbar.tsx@@ -5,15 +5,7 @@ import { Icon, Separator, Stack, type StackProps } from '@chakra-ui/react';import { IconButton } from './Button';import { Tooltip } from './Tooltip';-const toolbarButtonTooltipPositioning = { placement: 'right-start' } as const;--/**- * The workbench's floating tool strip, shared by canvas-like surfaces (the- * workflow editor today, the canvas later). Vertical by default — designed to- * dock against a surface edge. Compose from `ToolbarButton`s (sticky tools via- * `isActive`, one-shot actions without) and `ToolbarSeparator`s between- * groups.- */+const TOOLBAR_TOOLTIP_POSITIONING = { placement: 'right' } as const;export const Toolbar = ({ children, direction = 'column', ...stackProps }: StackProps) => (<Stack@@ -42,7 +34,7 @@ export const ToolbarButton = ({isActive?: boolean;label: string;} & Omit<ComponentProps<typeof IconButton>, 'aria-label'>) => (- <Tooltip content={label} positioning={toolbarButtonTooltipPositioning}>+ <Tooltip content={label} positioning={TOOLBAR_TOOLTIP_POSITIONING}><IconButtonaria-label={label}aria-pressed={isActive}diff --git a/invokeai/frontend/webv2/src/platform/ui/Tooltip.tsx b/invokeai/frontend/webv2/src/platform/ui/Tooltip.tsxindex 02bf2fa4df..71eb86b877 100644--- a/invokeai/frontend/webv2/src/platform/ui/Tooltip.tsx+++ b/invokeai/frontend/webv2/src/platform/ui/Tooltip.tsx@@ -68,6 +68,8 @@ const composeRefs =type TooltipChildProps = Record<string, unknown> & { ref?: Ref<HTMLButtonElement> };+type TooltipPlacement = NonNullable<NonNullable<ChakraTooltip.RootProps['positioning']>['placement']>;+export interface TooltipProps extends ChakraTooltip.RootProps {showArrow?: boolean;portalled?: boolean;@@ -75,6 +77,13 @@ export interface TooltipProps extends ChakraTooltip.RootProps {content: ReactNode;contentRef?: Ref<HTMLDivElement>;contentProps?: ChakraTooltip.ContentProps;+ /**+ * Which trigger edge the tooltip sits on, centered against it — `top`/+ * `bottom` center horizontally, `left`/`right` center vertically; `-start`/+ * `-end` suffixes align to an edge instead. Shorthand for+ * `positioning.placement` (an explicit `positioning.placement` wins).+ */+ placement?: TooltipPlacement;ref?: Ref<HTMLButtonElement>;triggerProps?: TooltipTriggerProps;}@@ -93,12 +102,17 @@ export const Tooltip = (props: TooltipProps) => {content,contentProps,contentRef,+ placement,portalRef,ref,triggerProps,...rest} = props;const { rootProps, triggerProps: triggerPassthroughProps } = splitTooltipProps(rest);++ if (placement) {+ rootProps.positioning = { placement, ...(rootProps.positioning as object | undefined) };+ }const { ref: explicitTriggerRef, ...explicitTriggerProps } = triggerProps ?? {};const mergedTriggerProps = { ...triggerPassthroughProps, ...explicitTriggerProps };const hasTriggerPassthrough = ref || explicitTriggerRef || Object.keys(mergedTriggerProps).length > 0;diff --git a/invokeai/frontend/webv2/src/platform/ui/index.ts b/invokeai/frontend/webv2/src/platform/ui/index.tsindex 28d600a2f7..4dd7b61375 100644--- a/invokeai/frontend/webv2/src/platform/ui/index.ts+++ b/invokeai/frontend/webv2/src/platform/ui/index.ts@@ -2,6 +2,7 @@ export * from './Button';export * from './ColorPicker';export * from './Combobox';export * from './ConfirmDialog';+export * from './DropZone';export * from './Field';export * from './JsonPreview';export * from './Menu';diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/__fixtures__/legacyTokenBaseline.json b/invokeai/frontend/webv2/src/platform/ui/theme/__fixtures__/legacyTokenBaseline.jsonindex 906dba0ba1..ac4220f96c 100644--- a/invokeai/frontend/webv2/src/platform/ui/theme/__fixtures__/legacyTokenBaseline.json+++ b/invokeai/frontend/webv2/src/platform/ui/theme/__fixtures__/legacyTokenBaseline.json@@ -23,7 +23,7 @@"border.error": "oklch(70.61% 0.0841 19.38)","gray.contrast": "oklch(21.074% 0.0087 264.37)","gray.fg": "oklch(96.017% 0.0029 264.54)",- "gray.subtle": "oklch(31.237% 0.0157 264.32)",+ "gray.subtle": "oklch(38.5% 0.0203 264.29)","gray.muted": "oklch(36.004% 0.019 264.3)","gray.emphasized": "oklch(45.106% 0.0251 264.28)","gray.solid": "oklch(96.017% 0.0029 264.54)",diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts b/invokeai/frontend/webv2/src/platform/ui/theme/recipes.tsindex 373511b28e..b238e90318 100644--- a/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts+++ b/invokeai/frontend/webv2/src/platform/ui/theme/recipes.ts@@ -1,5 +1,5 @@import { defineRecipe, defineSlotRecipe } from '@chakra-ui/react';-import { slotRecipes as chakraSlotRecipes } from '@chakra-ui/react/theme';+import { recipes as chakraRecipes, slotRecipes as chakraSlotRecipes } from '@chakra-ui/react/theme';/*** Reusable, theme-aware recipes for the workbench design system.@@ -24,11 +24,18 @@ import { slotRecipes as chakraSlotRecipes } from '@chakra-ui/react/theme';* Built-in component overrides (registered in system.ts)* -------------------------------------------------------------------------- */-/** Tooltip chrome: raised surface with a hairline stroke instead of inverted fill. */+/**+ * Tooltip chrome: raised surface with a hairline stroke instead of inverted+ * fill. Extends Chakra's default recipe — replacing it wholesale would drop+ * the `arrow` slot's `--arrow-size`/`--arrow-background` vars, which renders+ * arrows at zero size (invisible).+ */export const tooltipSlotRecipe = defineSlotRecipe({- slots: ['content', 'arrowTip'],+ ...chakraSlotRecipes.tooltip,base: {+ ...chakraSlotRecipes.tooltip.base,content: {+ ...chakraSlotRecipes.tooltip.base?.content,'--tooltip-bg': 'colors.bg.muted',bg: 'var(--tooltip-bg)',borderColor: 'border.emphasized',@@ -37,22 +44,209 @@ export const tooltipSlotRecipe = defineSlotRecipe({color: 'fg',},arrowTip: {+ ...chakraSlotRecipes.tooltip.base?.arrowTip,borderColor: 'border.emphasized',},},});-const dropdownContent = {+/**+ * Tabs: quick neutral hover feedback, with accent reserved for selection.+ * Restricting hover styles to unselected triggers keeps active tabs visually+ * stable without relying on condition ordering in the generated CSS.+ */+export const tabsSlotRecipe = defineSlotRecipe({+ ...chakraSlotRecipes.tabs,+ base: {+ ...chakraSlotRecipes.tabs.base,+ trigger: {+ ...chakraSlotRecipes.tabs.base?.trigger,+ transitionDuration: 'faster',+ transitionProperty: 'background, border-color, color',+ },+ },+ variants: {+ ...chakraSlotRecipes.tabs.variants,+ variant: {+ ...chakraSlotRecipes.tabs.variants?.variant,+ line: {+ ...chakraSlotRecipes.tabs.variants?.variant?.line,+ trigger: {+ ...chakraSlotRecipes.tabs.variants?.variant?.line?.trigger,+ _hover: {+ '&:not([data-selected])': { bg: 'bg.muted/60', color: 'fg' },+ },+ },+ },+ subtle: {+ ...chakraSlotRecipes.tabs.variants?.variant?.subtle,+ trigger: {+ ...chakraSlotRecipes.tabs.variants?.variant?.subtle?.trigger,+ _hover: {+ '&:not([data-selected])': { bg: 'bg.muted' },+ },+ },+ },+ enclosed: {+ ...chakraSlotRecipes.tabs.variants?.variant?.enclosed,+ trigger: {+ ...chakraSlotRecipes.tabs.variants?.variant?.enclosed?.trigger,+ _hover: {+ '&:not([data-selected])': { bg: 'bg.emphasized' },+ },+ },+ },+ outline: {+ ...chakraSlotRecipes.tabs.variants?.variant?.outline,+ trigger: {+ ...chakraSlotRecipes.tabs.variants?.variant?.outline?.trigger,+ _hover: {+ '&:not([data-selected])': {+ bg: 'bg.muted',+ borderColor: 'border.emphasized',+ },+ },+ },+ },+ plain: {+ ...chakraSlotRecipes.tabs.variants?.variant?.plain,+ trigger: {+ ...chakraSlotRecipes.tabs.variants?.variant?.plain?.trigger,+ _hover: {+ '&:not([data-selected])': { bg: 'bg.muted/40', color: 'fg' },+ },+ },+ },+ },+ } as typeof chakraSlotRecipes.tabs.variants,+});++/**+ * Shared interactive states for every bordered form control — text inputs,+ * textareas, number inputs, select/combobox triggers, and hand-rolled trigger+ * buttons (ModelSelect). Idle border is `border`; hover steps to+ * `border.emphasized`; an open dropdown commits to `accent.solid` so hover and+ * open remain distinguishable. Focus uses the accent border without adding a+ * second ring around the control.+ */+const formControlFocused = {+ '--focus-ring-color': 'var(--focus-color) !important',+ borderColor: 'accent.solid',+ boxShadow: 'none !important',+ outline: 'none !important',+ _invalid: {+ '--focus-ring-color': 'var(--chakra-colors-border-error) !important',+ borderColor: 'border.error',+ },+};++const formControlNoFocusRing = {+ focusVisibleRing: undefined,+ _focusVisible: formControlFocused,+} as const;++export const formControlInteraction = {+ '--focus-color': 'var(--chakra-colors-accent-solid)',+ ...formControlNoFocusRing,+ transitionDuration: 'fast',+ transitionProperty: 'border-color, background',+ _focusVisible: formControlFocused,+ _invalid: { borderColor: 'border.error' },+ _hover: {+ borderColor: 'border.emphasized',+ _expanded: formControlFocused,+ _focusVisible: formControlFocused,+ },+};++const formControlOpen = { borderColor: 'accent.solid' };++/** Text input: Chakra default plus the shared hover/transition treatment. */+export const inputRecipe = defineRecipe({+ ...chakraRecipes.input,+ variants: {+ ...chakraRecipes.input.variants,+ variant: {+ ...chakraRecipes.input.variants?.variant,+ outline: { ...chakraRecipes.input.variants?.variant?.outline, ...formControlNoFocusRing },+ subtle: { ...chakraRecipes.input.variants?.variant?.subtle, ...formControlNoFocusRing },+ },+ } as unknown as typeof chakraRecipes.input.variants,+ base: {+ ...chakraRecipes.input.base,+ ...formControlInteraction,+ },+});++/** Textarea: Chakra default plus the shared hover/transition treatment. */+export const textareaRecipe = defineRecipe({+ ...chakraRecipes.textarea,+ variants: {+ ...chakraRecipes.textarea.variants,+ variant: {+ ...chakraRecipes.textarea.variants?.variant,+ outline: { ...chakraRecipes.textarea.variants?.variant?.outline, ...formControlNoFocusRing },+ subtle: { ...chakraRecipes.textarea.variants?.variant?.subtle, ...formControlNoFocusRing },+ },+ } as unknown as typeof chakraRecipes.textarea.variants,+ base: {+ ...chakraRecipes.textarea.base,+ ...formControlInteraction,+ },+});++/** Number input: the input slot gets the shared hover/transition treatment. */+export const numberInputSlotRecipe = defineSlotRecipe({+ ...chakraSlotRecipes.numberInput,+ variants: {+ ...chakraSlotRecipes.numberInput.variants,+ variant: {+ ...chakraSlotRecipes.numberInput.variants?.variant,+ outline: {+ ...chakraSlotRecipes.numberInput.variants?.variant?.outline,+ input: {+ ...chakraSlotRecipes.numberInput.variants?.variant?.outline?.input,+ ...formControlNoFocusRing,+ },+ },+ subtle: {+ ...chakraSlotRecipes.numberInput.variants?.variant?.subtle,+ input: {+ ...chakraSlotRecipes.numberInput.variants?.variant?.subtle?.input,+ ...formControlNoFocusRing,+ },+ },+ },+ } as unknown as typeof chakraSlotRecipes.numberInput.variants,+ base: {+ ...chakraSlotRecipes.numberInput.base,+ input: {+ ...chakraSlotRecipes.numberInput.base?.input,+ ...formControlInteraction,+ },+ },+});++/** Shared dropdown surface: one look for menu, select, combobox, and hand-rolled poppers (ModelSelect). */+export const dropdownContent = {bg: 'bg.muted',borderColor: 'border.emphasized',- borderRadius: 'lg',+ borderRadius: 'md',borderWidth: '1px',boxShadow: 'lg',color: 'fg',};-const dropdownItem = {- _highlighted: { bg: 'bg.subtle' },+/**+ * Shared dropdown item treatment. The highlight sits on `bg.emphasized`: the+ * content surface is `bg.muted`, and on the dark ramps `bg.subtle` is darker+ * than the surface, which made the old highlight nearly invisible (classic+ * theme especially). `bg.emphasized` is one step away from the surface in+ * every theme, so the highlight reads everywhere.+ */+export const dropdownItem = {+ _highlighted: { bg: 'bg.emphasized' },+ _hover: { bg: 'bg.emphasized' },_focusVisible: {outline: '2px solid',outlineColor: 'accent.solid',@@ -60,7 +254,7 @@ const dropdownItem = {},};-const dropdownGroupLabel = {+export const dropdownGroupLabel = {color: 'fg.subtle',fontSize: '2xs',fontWeight: '600',@@ -99,8 +293,38 @@ export const menuSlotRecipe = defineSlotRecipe({/** Select dropdown chrome: same surface and item treatment as menus. */export const selectSlotRecipe = defineSlotRecipe({...chakraSlotRecipes.select,+ // The outline variant carries its own `_expanded` (border.emphasized) which+ // would override a base-level open style, so the accent open state lives on+ // the variant too. The cast keeps defineSlotRecipe's variant inference+ // anchored to Chakra's own map, which the spread-with-override loses.+ variants: {+ ...chakraSlotRecipes.select.variants,+ variant: {+ ...chakraSlotRecipes.select.variants?.variant,+ outline: {+ ...chakraSlotRecipes.select.variants?.variant?.outline,+ trigger: {+ ...chakraSlotRecipes.select.variants?.variant?.outline?.trigger,+ ...formControlNoFocusRing,+ _expanded: formControlOpen,+ },+ },+ subtle: {+ ...chakraSlotRecipes.select.variants?.variant?.subtle,+ trigger: {+ ...chakraSlotRecipes.select.variants?.variant?.subtle?.trigger,+ ...formControlNoFocusRing,+ },+ },+ },+ } as typeof chakraSlotRecipes.select.variants,base: {...chakraSlotRecipes.select.base,+ trigger: {+ ...chakraSlotRecipes.select.base?.trigger,+ ...formControlInteraction,+ _expanded: formControlOpen,+ },content: {...chakraSlotRecipes.select.base?.content,...dropdownContent,@@ -119,6 +343,26 @@ export const selectSlotRecipe = defineSlotRecipe({/** Combobox chrome: kept aligned with Select for future searchable fields. */export const comboboxSlotRecipe = defineSlotRecipe({...chakraSlotRecipes.combobox,+ variants: {+ ...chakraSlotRecipes.combobox.variants,+ variant: {+ ...chakraSlotRecipes.combobox.variants?.variant,+ outline: {+ ...chakraSlotRecipes.combobox.variants?.variant?.outline,+ input: {+ ...chakraSlotRecipes.combobox.variants?.variant?.outline?.input,+ ...formControlNoFocusRing,+ },+ },+ subtle: {+ ...chakraSlotRecipes.combobox.variants?.variant?.subtle,+ input: {+ ...chakraSlotRecipes.combobox.variants?.variant?.subtle?.input,+ ...formControlNoFocusRing,+ },+ },+ },+ } as unknown as typeof chakraSlotRecipes.combobox.variants,base: {...chakraSlotRecipes.combobox.base,content: {@@ -127,7 +371,8 @@ export const comboboxSlotRecipe = defineSlotRecipe({},input: {...chakraSlotRecipes.combobox.base?.input,- _hover: { borderColor: 'border.emphasized' },+ ...formControlInteraction,+ _expanded: formControlOpen,},item: {...chakraSlotRecipes.combobox.base?.item,diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/system.ts b/invokeai/frontend/webv2/src/platform/ui/theme/system.tsindex 86a769dde0..4d78d644fc 100644--- a/invokeai/frontend/webv2/src/platform/ui/theme/system.ts+++ b/invokeai/frontend/webv2/src/platform/ui/theme/system.ts@@ -3,10 +3,14 @@ import { createSystem, defaultConfig, defineConfig } from '@chakra-ui/react';import {comboboxSlotRecipe,dialogSlotRecipe,+ inputRecipe,menuSlotRecipe,+ numberInputSlotRecipe,progressCircleSlotRecipe,selectSlotRecipe,sliderSlotRecipe,+ tabsSlotRecipe,+ textareaRecipe,tooltipSlotRecipe,} from './recipes';import { DEFAULT_THEME, DEFAULT_THEME_ID, type NeutralStep, THEMES, type ThemeDefinition } from './themes';@@ -271,13 +275,19 @@ const config = defineConfig({},// Chrome-level overrides for Chakra's built-in components, so popover and// dialog surfaces are consistent everywhere without per-instance props.+ recipes: {+ input: inputRecipe,+ textarea: textareaRecipe,+ },slotRecipes: {combobox: comboboxSlotRecipe,dialog: dialogSlotRecipe,menu: menuSlotRecipe,+ numberInput: numberInputSlotRecipe,progressCircle: progressCircleSlotRecipe,select: selectSlotRecipe,slider: sliderSlotRecipe,+ tabs: tabsSlotRecipe,tooltip: tooltipSlotRecipe,},},diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/themes.ts b/invokeai/frontend/webv2/src/platform/ui/theme/themes.tsindex 7231b494b1..2defd0a9fe 100644--- a/invokeai/frontend/webv2/src/platform/ui/theme/themes.ts+++ b/invokeai/frontend/webv2/src/platform/ui/theme/themes.ts@@ -77,7 +77,10 @@ const classic: ThemeColors = {success: 'oklch(79.8% 0.1132 141.63)',warning: 'oklch(76.62% 0.0612 62.9)',inset: 'oklch(21.074% 0.0087 264.37)',- fill: 'oklch(31.237% 0.0157 264.32)',+ // Sits ~7% L above the neutral.800 surface like every other dark theme's+ // fill; it previously matched neutral.800 exactly, making ghost hovers+ // invisible on muted surfaces.+ fill: 'oklch(38.5% 0.0203 264.29)',grid: 'oklch(40.619% 0.0221 264.29)',control: 'oklch(36.004% 0.019 264.3)',};