Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
☑️ feat: Give the Checkbox Theme Roles for Its Fill and Corner (#16958)
Marco Beretta32d781e58a48
diff --git a/client/src/Providers/__tests__/themeCache.spec.ts b/client/src/Providers/__tests__/themeCache.spec.tsindex 6d3ce1c28b..14387ce1a8 100644--- a/client/src/Providers/__tests__/themeCache.spec.ts+++ b/client/src/Providers/__tests__/themeCache.spec.ts@@ -182,7 +182,7 @@ describe('theme cache storage', () => {* - definitions with one or both mode blocks absent.* A new role, or a new fallback, joins by construction.*/-const PIN = { fingerprint: '1.3.yila83', digest: '1lhfc04' };+const PIN = { fingerprint: '1.3.dxwdxg', digest: 'aepelz' };const digestOf = (text: string): string => {let hash = 5381;diff --git a/e2e/specs/mock/scenarios/clickhouse-checkbox.spec.ts b/e2e/specs/mock/scenarios/clickhouse-checkbox.spec.tsnew file mode 100644index 0000000000..e053f3ad05--- /dev/null+++ b/e2e/specs/mock/scenarios/clickhouse-checkbox.spec.ts@@ -0,0 +1,196 @@+import { expect, test } from '@playwright/test';+import { FileSources } from 'librechat-data-provider';+import type { TFile } from 'librechat-data-provider';+import type { Locator, Page } from '@playwright/test';+import { clickHouseTheme } from '../../../../packages/client/src/theme/themes/clickhouse';++/**+ * The shared checkbox reads its corner from `checkboxRadius` and, under `checkboxFillStyle:+ * 'fill'`, paints an unchecked box in `checkbox-fill`. Click UI fills the box with+ * `checkbox.color.background.default` and rounds it at `checkbox.radii.all` (0.125rem); LibreChat's+ * own checkbox stays clear on the `rounded-sm` corner without a theme. The My Files table's row+ * selection is a real consumer of the primitive, with a routed file list.+ */+test.describe.configure({ timeout: 120_000 });+test.use({ viewport: { width: 1280, height: 800 } });++type Mode = 'light' | 'dark';+type ThemeChoice = 'clickhouse' | 'default' | 'small-corner' | 'fill-canvas';++/** Names only the small corner, as a theme written before the checkbox had a role of its own. */+const smallCornerTheme = {+ version: 1,+ name: 'e2e-small-corner',+ modes: { light: { appearance: { radiusSm: '6px' } }, dark: { appearance: { radiusSm: '6px' } } },+};++/** Fills the checkbox without naming its fill, so the box takes the theme's own canvas. */+const fillCanvasTheme = {+ version: 1,+ name: 'e2e-checkbox-fill-canvas',+ modes: {+ light: {+ colors: { 'rgb-surface-primary': '10 20 30' },+ appearance: { checkboxFillStyle: 'fill' },+ },+ },+};++const files: TFile[] = Array.from({ length: 2 }, (_, index) => ({+ file_id: `checkbox-theme-file-${index}`,+ filename: `Checkbox theme fixture ${index}.txt`,+ filepath: `/files/checkbox-theme-file-${index}.txt`,+ user: 'checkbox-theme-user',+ bytes: 100,+ object: 'file',+ source: FileSources.local,+ type: 'text/plain',+ usage: 0,+ embedded: false,+ createdAt: '2026-09-01T00:00:00.000Z',+ updatedAt: '2026-09-01T00:00:00.000Z',+}));++/** One init script per page; the theme and mode each navigation wants ride in its URL. */+async function installThemeBridge(page: Page) {+ await page.addInitScript(+ (definitions) => {+ const params = new URL(location.href).searchParams;+ const theme = params.get('e2eTheme');+ const mode = params.get('e2eThemeMode');+ if (theme === null || mode === null) {+ return;+ }+ localStorage.setItem('color-theme', mode);+ localStorage.removeItem('theme-colors');+ localStorage.removeItem('theme-name');+ const definition = (definitions as Record<string, unknown>)[theme];+ if (definition) {+ localStorage.setItem('theme-definition', JSON.stringify(definition));+ localStorage.setItem('theme-source', 'definition');+ } else {+ localStorage.removeItem('theme-definition');+ localStorage.removeItem('theme-source');+ }+ },+ {+ clickhouse: clickHouseTheme,+ 'small-corner': smallCornerTheme,+ 'fill-canvas': fillCanvasTheme,+ },+ );+}++async function openFiles(page: Page, theme: ThemeChoice, mode: Mode) {+ await page.goto(`/c/new?e2eTheme=${theme}&e2eThemeMode=${mode}`, { timeout: 15000 });+ await expect(page.locator('html')).toHaveClass(mode === 'dark' ? /\bdark\b/ : /\blight\b/);+ await page.getByTestId('nav-user').click();+ await page.getByRole('menu').getByRole('menuitem', { name: 'My Files', exact: true }).click();+ const dialog = page.getByRole('dialog', { name: 'My Files' });+ await expect(dialog.getByText(files[0].filename)).toBeVisible();+ return dialog;+}++const paint = (box: Locator) =>+ box.evaluate((node) => {+ const style = getComputedStyle(node);+ return { fill: style.backgroundColor, corner: style.borderTopLeftRadius };+ });++/** The fill a probe painted with `bg-<role>` resolves to on this page. */+const roleFill = (page: Page, role: string) =>+ page.evaluate((name) => {+ const probe = document.createElement('div');+ probe.className = `bg-${name}`;+ document.body.append(probe);+ const fill = getComputedStyle(probe).backgroundColor;+ probe.remove();+ return fill;+ }, role);++async function attachShot(dialog: Locator, name: string) {+ const path = test.info().outputPath(`${name}.png`);+ await dialog.locator('table').screenshot({ path, animations: 'disabled' });+ await test.info().attach(name, { path, contentType: 'image/png' });+}++/** Titles are literal so each `@scenario` tag is findable in the source. */+const CASES: Array<{ mode: Mode; clickhouse: string; unchanged: string }> = [+ {+ mode: 'light',+ clickhouse:+ 'ClickHouse light checkboxes take the Click UI fill and corner @scenario:clickhouse-checkbox-light',+ unchanged:+ 'default light checkboxes stay clear on the small corner @scenario:default-checkbox-light-unchanged',+ },+ {+ mode: 'dark',+ clickhouse:+ 'ClickHouse dark checkboxes take the Click UI fill and corner @scenario:clickhouse-checkbox-dark',+ unchanged:+ 'default dark checkboxes stay clear on the small corner @scenario:default-checkbox-dark-unchanged',+ },+];++const rgb = (triplet: string | undefined) => `rgb(${(triplet ?? '').split(' ').join(', ')})`;++test.describe('theme checkbox', () => {+ test.beforeEach(async ({ page }) => {+ await page.route('**/api/files', (route) => route.fulfill({ json: files }));+ await installThemeBridge(page);+ });++ for (const { mode, clickhouse, unchanged } of CASES) {+ test(clickhouse, async ({ page }) => {+ const dialog = await openFiles(page, 'clickhouse', mode);+ await expect(page.locator('html')).toHaveAttribute('data-theme', 'clickhouse');+ const colors = clickHouseTheme.modes[mode]?.colors ?? {};+ const row = dialog.locator('tbody').getByRole('checkbox').first();++ expect(await paint(row)).toEqual({ fill: rgb(colors['rgb-checkbox-fill']), corner: '2px' });+ await attachShot(dialog, `clickhouse-${mode}-unchecked`);++ await row.click();+ await expect(row).toHaveAttribute('data-state', 'checked');+ expect(await paint(row)).toEqual({+ fill: rgb(colors['rgb-surface-inverted']),+ corner: '2px',+ });+ await attachShot(dialog, `clickhouse-${mode}-checked`);+ });++ test(unchanged, async ({ page }) => {+ const dialog = await openFiles(page, 'default', mode);+ const row = dialog.locator('tbody').getByRole('checkbox').first();++ expect(await paint(row)).toEqual({ fill: 'rgba(0, 0, 0, 0)', corner: '4px' });++ await row.click();+ await expect(row).toHaveAttribute('data-state', 'checked');+ expect((await paint(row)).fill).toBe(await roleFill(page, 'surface-inverted'));+ });+ }++ test('a theme that names only the small corner rounds the checkbox with it @scenario:checkbox-corner-follows-radius-sm', async ({+ page,+ }) => {+ const dialog = await openFiles(page, 'small-corner', 'light');+ await expect(page.locator('html')).toHaveAttribute('data-theme', smallCornerTheme.name);++ expect(await paint(dialog.locator('tbody').getByRole('checkbox').first())).toEqual({+ fill: 'rgba(0, 0, 0, 0)',+ corner: '6px',+ });+ });++ test('a filled theme that names no checkbox fill paints its own canvas @scenario:checkbox-fill-follows-canvas', async ({+ page,+ }) => {+ const dialog = await openFiles(page, 'fill-canvas', 'light');+ await expect(page.locator('html')).toHaveAttribute('data-theme', fillCanvasTheme.name);++ expect((await paint(dialog.locator('tbody').getByRole('checkbox').first())).fill).toBe(+ 'rgb(10, 20, 30)',+ );+ });+});diff --git a/packages/client/src/components/Checkbox.spec.tsx b/packages/client/src/components/Checkbox.spec.tsxnew file mode 100644index 0000000000..943d6398fc--- /dev/null+++ b/packages/client/src/components/Checkbox.spec.tsx@@ -0,0 +1,40 @@+import '@testing-library/jest-dom';+import { render, screen } from '@testing-library/react';+import { Checkbox, CheckboxGlyph } from './Checkbox';++describe('Checkbox', () => {+ it('reads its corner and unchecked fill from the checkbox roles', () => {+ render(<Checkbox aria-label="Probe" />);++ const box = screen.getByRole('checkbox', { name: 'Probe' });+ expect(box).toHaveClass(+ 'rounded-theme-checkbox',+ 'theme-checkbox-fill:bg-checkbox-fill',+ 'data-[state=checked]:bg-surface-inverted',+ );+ expect(box).not.toHaveClass('rounded-sm');+ });++ it("lets a caller's corner replace the checkbox role", () => {+ render(<Checkbox aria-label="Probe" className="rounded-full" />);++ const box = screen.getByRole('checkbox', { name: 'Probe' });+ expect(box).toHaveClass('rounded-full');+ expect(box).not.toHaveClass('rounded-theme-checkbox');+ });+});++describe('CheckboxGlyph', () => {+ it('paints the unchecked fill role only while unchecked', () => {+ const { container, rerender } = render(<CheckboxGlyph checked={false} />);+ const glyph = container.firstElementChild;++ expect(glyph).toHaveClass('rounded-theme-checkbox', 'theme-checkbox-fill:bg-checkbox-fill');+ expect(glyph).not.toHaveClass('bg-surface-inverted');++ rerender(<CheckboxGlyph checked />);++ expect(glyph).toHaveClass('rounded-theme-checkbox', 'bg-surface-inverted');+ expect(glyph).not.toHaveClass('theme-checkbox-fill:bg-checkbox-fill');+ });+});diff --git a/packages/client/src/components/Checkbox.tsx b/packages/client/src/components/Checkbox.tsxindex 53e080904a..e60c264c28 100644--- a/packages/client/src/components/Checkbox.tsx+++ b/packages/client/src/components/Checkbox.tsx@@ -27,7 +27,7 @@ const Checkbox: React.ForwardRefExoticComponent<<CheckboxPrimitive.Rootref={ref}className={cn(- 'peer border-border-xheavy ring-offset-surface-primary focus-visible:ring-focus-control data-[state=checked]:bg-surface-inverted data-[state=checked]:text-text-inverted size-theme-checkbox shrink-0 rounded-sm border focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50',+ 'peer border-border-xheavy ring-offset-surface-primary focus-visible:ring-focus-control theme-checkbox-fill:bg-checkbox-fill data-[state=checked]:bg-surface-inverted data-[state=checked]:text-text-inverted size-theme-checkbox rounded-theme-checkbox shrink-0 border focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50',disabledFillClasses,className,)}@@ -55,8 +55,8 @@ const CheckboxGlyph: React.FC<{ checked: boolean; className?: string }> = ({<spanaria-hidden="true"className={cn(- 'border-border-xheavy size-theme-checkbox flex shrink-0 items-center justify-center rounded-sm border',- checked && 'bg-surface-inverted text-text-inverted',+ 'border-border-xheavy size-theme-checkbox rounded-theme-checkbox flex shrink-0 items-center justify-center border',+ checked ? 'bg-surface-inverted text-text-inverted' : 'theme-checkbox-fill:bg-checkbox-fill',className,)}>diff --git a/packages/client/src/theme/README.md b/packages/client/src/theme/README.mdindex f46cd99305..98d3d62766 100644--- a/packages/client/src/theme/README.md+++ b/packages/client/src/theme/README.md@@ -70,6 +70,9 @@ panel `menuPanelRadius` (0.75rem, `rounded-theme-menu-panel`) and the send and sonto `menuRadius` or a square corner without moving the control or surface radii. An inline codechip in Markdown takes its weight from `inlineCodeWeight` (600).+The checkbox reads `checkboxRadius` (`rounded-theme-checkbox`), which follows `radiusSm`, the+`rounded-sm` it drew before, when a theme names that and not this.+The sign-in forms' floating-label field reads `authFieldHeight` (2.75rem, `h-theme-auth-field`), theirsubmit button `authButtonHeight` (3rem, the Button's `auth` size) and both the corner`authControlRadius` (1rem, the Button's `soft` shape), which follows `radius2xl` when a theme names@@ -401,6 +404,11 @@ Each status family has a foreground, a `-subtle` background, a `-border`, and anames those and not these. Fields stay clear unless the theme's`fieldFillStyle` appearance role is `fill` (the default is `transparent`),read from the nearest themed root through the `theme-field-fill:` variant.+- `bg-checkbox-fill` - An unchecked checkbox's fill. It follows `surface-primary`+ when a theme names that and not this. The box stays clear unless the theme's+ `checkboxFillStyle` appearance role is `fill` (the default is `transparent`),+ read through the `theme-checkbox-fill:` variant; a checked box keeps+ `surface-inverted`.- `bg-surface-tooltip` / `text-tooltip` - The tooltip chip and its label. They follow`surface-primary` and `text-primary` when a theme names those and not these. The padding andtext size are the `tooltipPaddingX`, `tooltipPaddingY` and `tooltipTextSize` appearance rolesdiff --git a/packages/client/src/theme/defaults.css b/packages/client/src/theme/defaults.cssindex 8f9ccb18fa..d056a6759c 100644--- a/packages/client/src/theme/defaults.css+++ b/packages/client/src/theme/defaults.css@@ -174,6 +174,7 @@ html {--focus-subtle: var(--border-heavy);--field-fill: var(--surface-primary);--field-text: var(--text-primary);+ --checkbox-fill: var(--surface-primary);--surface-tooltip: var(--surface-primary);--text-tooltip: var(--text-primary);--alert-error-fill: var(--status-error-subtle);@@ -307,6 +308,8 @@ html {--theme-switch-width: 2.75rem;--theme-switch-height: 1.5rem;--theme-checkbox-size: 1rem;+ --theme-checkbox-radius: var(--theme-radius-sm, calc(0.5rem - 4px));+ --theme-checkbox-fill-style: transparent;--theme-table-cell-space-y: 1rem;--theme-table-row-stroke: 0px;--theme-space-compact: 0.375rem;@@ -478,6 +481,7 @@ html {--border-field-focus: var(--focus-control);--field-fill: var(--surface-primary);--field-text: var(--text-primary);+ --checkbox-fill: var(--surface-primary);--surface-tooltip: var(--surface-primary);--text-tooltip: var(--text-primary);--alert-error-fill: var(--status-error-subtle);diff --git a/packages/client/src/theme/defaults.spec.ts b/packages/client/src/theme/defaults.spec.tsindex 8fcdcac255..52d60bad0b 100644--- a/packages/client/src/theme/defaults.spec.ts+++ b/packages/client/src/theme/defaults.spec.ts@@ -68,7 +68,7 @@ describe.each([const tokens = Object.keys(theme) as Array<keyof IThemeRGB>;it('covers every registry color', () => {- expect(tokens).toHaveLength(168);+ expect(tokens).toHaveLength(169);});it('resolves every registry color to the runtime theme value', () => {@@ -99,6 +99,7 @@ const stockAliases: Partial<authControlRadius: 'radius2xl',authActionHeight: 'buttonHeight',authActionRadius: 'radiusLg',+ checkboxRadius: 'radiusSm',};/** Color roles split out of a broader one read it in the stylesheet, in both modes, so a@@ -112,6 +113,7 @@ const colorAliases: Array<[string, string]> = [['--focus-subtle', '--border-heavy'],['--field-fill', '--surface-primary'],['--field-text', '--text-primary'],+ ['--checkbox-fill', '--surface-primary'],];describe('the stock color aliases', () => {diff --git a/packages/client/src/theme/registry.spec.ts b/packages/client/src/theme/registry.spec.tsindex 58dbeec372..e60031332d 100644--- a/packages/client/src/theme/registry.spec.ts+++ b/packages/client/src/theme/registry.spec.ts@@ -1308,6 +1308,69 @@ describe('theme registry', () => {});});+ describe('checkbox fill and corner', () => {+ const checkboxTheme = (modes: ThemeDefinition['modes']): ThemeDefinition => ({+ version: 1,+ name: 'checkbox-reference',+ modes,+ });++ it('keeps an unchecked checkbox clear and on the small corner by default', () => {+ for (const mode of ['light', 'dark'] as const) {+ const { colors, appearance } = resolveTheme(checkboxTheme({}), mode);+ const base = mode === 'dark' ? darkTheme : defaultTheme;+ expect(appearance.checkboxFillStyle).toBe('transparent');+ expect(appearance.checkboxRadius).toBe(appearance.radiusSm);+ expect(colors['rgb-checkbox-fill']).toBe(base['rgb-surface-primary']);+ }+ });++ it('keeps a theme that predates the roles on its own canvas and small corner', () => {+ const { colors, appearance } = resolveTheme(+ checkboxTheme({+ light: {+ colors: { 'rgb-surface-primary': '40 50 60' },+ appearance: { radiusSm: '3px' },+ },+ }),+ 'light',+ );+ expect(colors['rgb-checkbox-fill']).toBe('40 50 60');+ expect(appearance.checkboxRadius).toBe('3px');+ expect(appearance.checkboxFillStyle).toBe('transparent');+ });++ it('paints the checkbox from its own roles when a theme names them', () => {+ const { colors, appearance } = resolveTheme(+ checkboxTheme({+ light: {+ colors: { 'rgb-checkbox-fill': '246 247 250' },+ appearance: { checkboxFillStyle: 'fill', checkboxRadius: '0.125rem', radiusSm: '4px' },+ },+ }),+ 'light',+ );+ expect(colors['rgb-checkbox-fill']).toBe('246 247 250');+ expect(colors['rgb-surface-primary']).toBe(defaultTheme['rgb-surface-primary']);+ expect(appearance.checkboxFillStyle).toBe('fill');+ expect(appearance.checkboxRadius).toBe('0.125rem');+ expect(appearance.radiusSm).toBe('4px');+ });++ it('rejects a fill style it does not know, a translucent fill and a non-length corner', () => {+ const issues = (mode: ThemeDefinition['modes']['light']) =>+ validateThemeDefinition(checkboxTheme({ light: mode }));+ expect(issues({ appearance: { checkboxFillStyle: 'fill' } })).toEqual([]);+ expect(issues({ appearance: { checkboxFillStyle: 'glass' as 'fill' } })).toEqual([+ 'Invalid appearance value for checkboxFillStyle: glass',+ ]);+ expect(issues({ appearance: { checkboxRadius: 'round' } })).toEqual([+ 'Invalid appearance value for checkboxRadius: round',+ ]);+ expect(issues({ colors: { 'rgb-checkbox-fill': '1 2 3 / 0.5' } })).toHaveLength(1);+ });+ });+it('rejects field and label values the shared validators refuse', () => {const issues = (appearance: Record<string, string>) =>validateThemeDefinition({diff --git a/packages/client/src/theme/registry.ts b/packages/client/src/theme/registry.tsindex 08d4fb3135..6cbb24d1c1 100644--- a/packages/client/src/theme/registry.ts+++ b/packages/client/src/theme/registry.ts@@ -274,6 +274,8 @@ export const themeAppearanceProperties: Readonly<switchWidth: '--theme-switch-width',switchHeight: '--theme-switch-height',checkboxSize: '--theme-checkbox-size',+ checkboxRadius: '--theme-checkbox-radius',+ checkboxFillStyle: '--theme-checkbox-fill-style',tableCellSpaceY: '--theme-table-cell-space-y',tableRowStroke: '--theme-table-row-stroke',spaceCompact: '--theme-space-compact',@@ -384,6 +386,8 @@ export const defaultAppearance: IThemeAppearance = Object.freeze({labelFontWeight: 'inherit',...defaultSwitchSize,checkboxSize: '1rem',+ checkboxRadius: 'calc(0.5rem - 4px)',+ checkboxFillStyle: 'transparent',tableCellSpaceY: '1rem',tableRowStroke: '0px',spaceCompact: '0.375rem',@@ -606,7 +610,7 @@ function withComposableShadows(appearance: IThemeAppearance): IThemeAppearance {/*** Roles split out of a broader one, each paired with the role it read before. Headings drew the UI* family before the display role existed, theme-sized controls were padded by the shared spacing,- * and dialog titles were set in the `text-lg` step and the display family, the composer's popovers, the model selector and the send button drew `rounded-2xl`, `rounded-xl` and the round control corner, and the sign-in controls drew `rounded-2xl` and the other sign-in actions the default Button's height and corner, so a theme that names+ * and dialog titles were set in the `text-lg` step and the display family, the composer's popovers, the model selector and the send button drew `rounded-2xl`, `rounded-xl` and the round control corner, and the sign-in controls drew `rounded-2xl` and the other sign-in actions the default Button's height and corner, and the checkbox `rounded-sm`, so a theme that names* the broader role and not the split one keeps what it drew. Pairs resolve in order, so a role can* follow one that is itself inherited; the other sign-in actions resolve before the sign-in corner* is derived, so they follow only a corner the theme names and otherwise keep `radiusLg`.@@ -626,6 +630,7 @@ const inheritedAppearance: ReadonlyArray<[keyof IThemeAppearance, keyof IThemeAp['authControlRadius', 'radius2xl'],['authActionHeight', 'authButtonHeight'],['authActionHeight', 'buttonHeight'],+ ['checkboxRadius', 'radiusSm'],];/**@@ -798,6 +803,13 @@ export function resolveTheme(theme: ThemeDefinition, mode: ThemeMode): ResolvedTcustomColors?.['rgb-surface-primary'] !== undefined? { 'rgb-field-fill': customColors['rgb-surface-primary'] }: {};+ /** A checkbox fill only shows under `checkboxFillStyle: 'fill'`, on the theme's own canvas by+ * default. */+ const checkboxFillFallback: IThemeRGB =+ customColors?.['rgb-checkbox-fill'] === undefined &&+ customColors?.['rgb-surface-primary'] !== undefined+ ? { 'rgb-checkbox-fill': customColors['rgb-surface-primary'] }+ : {};/** Table column names were `text-secondary` before they had a role. */const tableHeaderTextFallback: IThemeRGB =customColors?.['rgb-table-header-text'] === undefined &&@@ -898,6 +910,7 @@ export function resolveTheme(theme: ThemeDefinition, mode: ThemeMode): ResolvedT...focusSubtleFallback,...switchThumbFallback,...fieldFillFallback,+ ...checkboxFillFallback,...overlayFallback,...layerFallback,...tableHeaderTextFallback,diff --git a/packages/client/src/theme/tailwind.spec.js b/packages/client/src/theme/tailwind.spec.jsindex 245b986006..1b7532222f 100644--- a/packages/client/src/theme/tailwind.spec.js+++ b/packages/client/src/theme/tailwind.spec.js@@ -160,6 +160,7 @@ describe('LibreChat Tailwind preset', () => {],['rounded-theme-tab', '--theme-tab-radius', defaultAppearance.tabRadius],['rounded-theme-popover', '--theme-popover-radius', defaultAppearance.popoverRadius],+ ['rounded-theme-checkbox', '--theme-checkbox-radius', defaultAppearance.checkboxRadius],['rounded-theme-menu-panel', '--theme-menu-panel-radius', defaultAppearance.menuPanelRadius],['rounded-theme-composer-action',@@ -316,6 +317,7 @@ describe('LibreChat Tailwind preset', () => {authControlRadius: 'radius2xl',authActionHeight: 'buttonHeight',authActionRadius: 'radiusLg',+ checkboxRadius: 'radiusSm',};Object.entries(themeAppearanceProperties).forEach(([key, property]) => {const value = aliases[key]diff --git a/packages/client/src/theme/themes/clickhouse.ts b/packages/client/src/theme/themes/clickhouse.tsindex 503518c2e5..0231518f9c 100644--- a/packages/client/src/theme/themes/clickhouse.ts+++ b/packages/client/src/theme/themes/clickhouse.ts@@ -218,6 +218,7 @@ export const clickHouseLightTheme: IThemeRGB = {// Switch'rgb-switch-unchecked': '204 207 211', // #cccfd3 (switch.color.background.default)'rgb-switch-thumb': '255 255 255', // #ffffff (switch.color.indicator.default)+ 'rgb-checkbox-fill': '246 247 250', // #f6f7fa (checkbox.color.background.default)// Table'rgb-table-header-text': '22 21 23', // #161517 (table.header.color.title.default)@@ -415,6 +416,7 @@ export const clickHouseDarkTheme: IThemeRGB = {// Switch'rgb-switch-unchecked': '96 96 96', // #606060 (switch.color.background.default)'rgb-switch-thumb': '21 21 21', // #151515 (switch.color.indicator.default)+ 'rgb-checkbox-fill': '45 45 45', // rgb(17.794% 17.794% 17.794%) (checkbox.color.background.default)// Table'rgb-table-header-text': '249 249 249', // #f9f9f9 (table.header.color.title.default, rgb(97.5% 97.5% 97.5%))@@ -560,6 +562,9 @@ const clickHouseShape = {switchWidth: '2rem', // switch.size.widthswitchHeight: '1rem', // switch.size.heightcheckboxSize: '1rem', // checkbox.size.all+ checkboxRadius: '0.125rem', // checkbox.radii.all+ /** Click UI fills an unchecked checkbox in `checkbox.color.background.default`. */+ checkboxFillStyle: 'fill' as const,/** Click UI's own sizes halve like LibreChat's: `md` is this full space, and the compact tables* every in-repo consumer draws land on `sm` (0.5rem), the size Click UI tables default to. *//** The shared spacing takes two steps of Click UI's `spaces` scale: its 0.5rem gap step, thediff --git a/packages/client/src/theme/themes/clickui.spec.ts b/packages/client/src/theme/themes/clickui.spec.tsindex 76499138b0..a1056826ae 100644--- a/packages/client/src/theme/themes/clickui.spec.ts+++ b/packages/client/src/theme/themes/clickui.spec.ts@@ -214,6 +214,7 @@ const colorSources: Record<ThemeMode, Partial<Record<keyof IThemeRGB, string>>>'rgb-category-icon-7': 'global.color.text.muted','rgb-switch-unchecked': 'click.switch.color.background.default','rgb-switch-thumb': 'click.switch.color.indicator.default',+ 'rgb-checkbox-fill': 'click.checkbox.color.background.default','rgb-table-header-text': 'click.table.header.color.title.default','rgb-table-header-fill': 'click.table.header.color.background.default','rgb-presentation': 'global.color.background.default',@@ -379,6 +380,7 @@ const colorSources: Record<ThemeMode, Partial<Record<keyof IThemeRGB, string>>>'rgb-category-icon-7': 'global.color.text.muted','rgb-switch-unchecked': 'click.switch.color.background.default','rgb-switch-thumb': 'click.switch.color.indicator.default',+ 'rgb-checkbox-fill': 'click.checkbox.color.background.default','rgb-table-header-text': 'click.table.header.color.title.default','rgb-table-header-fill': 'click.table.header.color.background.default','rgb-presentation': 'global.color.background.default',@@ -572,6 +574,12 @@ const appearanceDecisions: Partial<Record<keyof IThemeAppearance, AppearanceDecireason:'fill: Click UI InputWrapper paints every field in field.color.background.default; LibreChat fields stay clear by default',},+ checkboxFillStyle: {+ value: 'fill',+ status: 'match',+ reason:+ 'fill: Click UI paints an unchecked checkbox in checkbox.color.background.default; LibreChat checkboxes stay clear by default',+ },focusRingWidth: {value: '2px',status: 'match',@@ -660,6 +668,7 @@ const appearanceSources: Partial<Record<keyof IThemeAppearance, string>> = {switchWidth: 'click.switch.size.width',switchHeight: 'click.switch.size.height',checkboxSize: 'click.checkbox.size.all',+ checkboxRadius: 'click.checkbox.radii.all',iconSize: 'click.image.sm.size.width',iconSizeMd: 'click.image.md.size.width',iconSizeLg: 'click.image.lg.size.width',@@ -1301,6 +1310,7 @@ const parityProbes: Record<string, ParityProbe> = {token: 'click.checkbox.color.background.default',kind: 'color',utility: 'bg',+ variant: 'theme-checkbox-fill:',element: checkboxProbe(false),},'Checkbox check, checked': {@@ -1420,12 +1430,6 @@ interface NotExpressible {* they then measure.*/const notExpressible: Record<string, NotExpressible> = {- 'Checkbox unchecked fill': {- decisions: { light: ['Checkbox fill, unchecked'], dark: ['Checkbox fill, unchecked'] },- reason:- 'the checkbox paints no fill of its own and shows the surface behind it; no role carries checkbox.color.background.default',- issue: 'https://github.com/berry-13/LibreChat/issues/250',- },'Select list height': {decisions: {},appearance: ['listMaxHeight'],@@ -1433,12 +1437,6 @@ const notExpressible: Record<string, NotExpressible> = {"Click UI caps its select list only at var(--radix-popover-content-available-height), which a length role cannot express, so listMaxHeight keeps LibreChat's 24rem",issue: 'https://github.com/berry-13/LibreChat/issues/282',},- 'Checkbox corner': {- decisions: { light: ['Checkbox corner'], dark: ['Checkbox corner'] },- reason:- 'the checkbox corner reads radiusSm, which the theme sets to border.radii.1 for every small corner; checkbox.radii.all is 0.125rem',- issue: 'https://github.com/berry-13/LibreChat/issues/250',- },};type Verdict = 'match' | 'near' | 'deviation' | 'not expressible';@@ -1469,6 +1467,7 @@ const radiusRoles: Record<string, keyof IThemeAppearance> = {'theme-surface': 'surfaceRadius','theme-surface-lg': 'largeSurfaceRadius','theme-tab': 'tabRadius',+ 'theme-checkbox': 'checkboxRadius',};const fixedRadii: Record<string, string> = { full: '9999px', none: '0px' };diff --git a/packages/client/src/theme/themes/dark.ts b/packages/client/src/theme/themes/dark.tsindex ec9b84a1bb..5ffda1b4c7 100644--- a/packages/client/src/theme/themes/dark.ts+++ b/packages/client/src/theme/themes/dark.ts@@ -215,6 +215,7 @@ export const darkTheme: IThemeRGB = {* thumb, 5.74:1 against the checked `surface-inverted` track. */'rgb-switch-unchecked': '102 102 102', // #666666'rgb-switch-thumb': '13 13 13', // #0d0d0d (gray-900, matching surface-primary)+ 'rgb-checkbox-fill': '13 13 13', // #0d0d0d (gray-900, matching surface-primary)'rgb-table-header-text': '205 205 205', // #cdcdcd (gray-300, matching text-secondary)'rgb-table-header-fill': '18 18 18', // #121212 (matching surface-dialog)diff --git a/packages/client/src/theme/themes/default.ts b/packages/client/src/theme/themes/default.tsindex 60d2c2ce32..d7a13b9272 100644--- a/packages/client/src/theme/themes/default.ts+++ b/packages/client/src/theme/themes/default.ts@@ -200,6 +200,7 @@ export const defaultTheme: IThemeRGB = {* track, so the control reads in either state. */'rgb-switch-unchecked': '148 148 148', // #949494'rgb-switch-thumb': '255 255 255', // #fff (white, matching surface-primary)+ 'rgb-checkbox-fill': '255 255 255', // #fff (white, matching surface-primary)'rgb-table-header-text': '66 66 66', // #424242 (gray-600, matching text-secondary)'rgb-table-header-fill': '255 255 255', // #fff (white, matching surface-dialog)diff --git a/packages/client/src/theme/themes/highContrast.ts b/packages/client/src/theme/themes/highContrast.tsindex 1505b7437a..50dbb2eeb8 100644--- a/packages/client/src/theme/themes/highContrast.ts+++ b/packages/client/src/theme/themes/highContrast.ts@@ -239,6 +239,7 @@ export const highContrastLightTheme: IThemeRGB = {* `surface-inverted` track. */'rgb-switch-unchecked': '102 102 102', // #666666'rgb-switch-thumb': '255 255 255', // #ffffff (matching surface-primary)+ 'rgb-checkbox-fill': '255 255 255', // #ffffff (matching surface-primary)'rgb-table-header-text': '0 0 0', // #000000 (matching text-secondary)'rgb-table-header-fill': '255 255 255', // #ffffff (matching surface-dialog)@@ -453,6 +454,7 @@ export const highContrastDarkTheme: IThemeRGB = {* thumb, 3.95:1 against the checked `surface-inverted` track. */'rgb-switch-unchecked': '128 128 128', // #808080'rgb-switch-thumb': '0 0 0', // #000000 (matching surface-primary)+ 'rgb-checkbox-fill': '0 0 0', // #000000 (matching surface-primary)'rgb-table-header-text': '255 255 255', // #ffffff (matching text-secondary)'rgb-table-header-fill': '0 0 0', // #000000 (matching surface-dialog)diff --git a/packages/client/src/theme/tokens.css b/packages/client/src/theme/tokens.cssindex 0cd6d019b6..b91358f093 100644--- a/packages/client/src/theme/tokens.css+++ b/packages/client/src/theme/tokens.css@@ -148,6 +148,7 @@/* Follow the canvas and the primary ink, for a stylesheet that predates them. */--color-field-fill: rgb(var(--field-fill, var(--surface-primary)));--color-field-text: rgb(var(--field-text, var(--text-primary)));+ --color-checkbox-fill: rgb(var(--checkbox-fill, var(--surface-primary)));/* Follow the roles they were painted in before they had their own, for a stylesheet thatpredates them. */--color-surface-tooltip: rgb(var(--surface-tooltip, var(--surface-primary)));@@ -355,3 +356,13 @@@slot;}}++/* A theme whose `checkboxFillStyle` is `fill` paints an unchecked checkbox in `checkbox-fill`+ * instead of leaving it on the surface it sits on, read like the field fill from the nearest+ * themed root. The default `transparent` style, and a browser without style queries, keep the+ * box clear; the checked fill carries a state selector's weight, so it still paints over it. */+@custom-variant theme-checkbox-fill {+ @container style(--theme-checkbox-fill-style: fill) {+ @slot;+ }+}diff --git a/packages/client/src/theme/tokens.spec.ts b/packages/client/src/theme/tokens.spec.tsindex a9977ac932..fb296e0797 100644--- a/packages/client/src/theme/tokens.spec.ts+++ b/packages/client/src/theme/tokens.spec.ts@@ -97,6 +97,7 @@ describe('theme color tokens', () => {'bg-switch-thumb','text-table-header-text','bg-table-header-fill',+ 'bg-checkbox-fill',]);expect(css).toContain('rgb(var(--surface-primary))');@@ -105,6 +106,7 @@ describe('theme color tokens', () => {expect(css).toContain('rgb(var(--switch-thumb, var(--surface-primary)))');expect(css).toContain('rgb(var(--table-header-text, var(--text-secondary)))');expect(css).toContain('rgb(var(--table-header-fill, var(--surface-dialog)))');+ expect(css).toContain('rgb(var(--checkbox-fill, var(--surface-primary)))');});it('keeps a border token on its intrinsic alpha and still takes an opacity modifier', async () => {diff --git a/packages/client/src/theme/types/index.ts b/packages/client/src/theme/types/index.tsindex 685ab7d75d..af1180cfa8 100644--- a/packages/client/src/theme/types/index.ts+++ b/packages/client/src/theme/types/index.ts@@ -267,6 +267,9 @@ export interface IThemeRGB {'rgb-switch-unchecked'?: string;/** The switch's knob in both states, painted over the unchecked track and the checked fill. */'rgb-switch-thumb'?: string;+ /** An unchecked checkbox's fill, painted only under `checkboxFillStyle: 'fill'`; follows+ * `rgb-surface-primary` when a theme omits it. */+ 'rgb-checkbox-fill'?: string;/** Column names in a table header, over its `surface-secondary` fill. */'rgb-table-header-text'?: string;/** The opaque fill of a header whose cells stick on their own, the dialog surface by default. */@@ -452,6 +455,7 @@ export interface IThemeVariables {'--switch-unchecked': string;'--switch-thumb': string;+ '--checkbox-fill': string;'--table-header-text': string;'--table-header-fill': string;@@ -611,6 +615,7 @@ export interface IThemeColors {'series-7'?: string;'switch-unchecked'?: string;'switch-thumb'?: string;+ 'checkbox-fill'?: string;'table-header-text'?: string;'table-header-fill'?: string;'series-8'?: string;@@ -732,6 +737,11 @@ export interface IThemeAppearance {switchHeight: string;/** A checkbox's box and the check inside it, 1 to 1.5rem. */checkboxSize: string;+ /** The checkbox's corner; follows `radiusSm`, which it drew before, when a theme omits it. */+ checkboxRadius: string;+ /** `transparent` leaves an unchecked checkbox on the surface it sits on; `fill` paints it+ * `checkbox-fill`. */+ checkboxFillStyle: 'transparent' | 'fill';tableCellSpaceY: string;tableRowStroke: string;spaceCompact: string;diff --git a/packages/client/src/theme/utils/applyTheme.spec.ts b/packages/client/src/theme/utils/applyTheme.spec.tsindex bfb84ae3ca..dd8da12340 100644--- a/packages/client/src/theme/utils/applyTheme.spec.ts+++ b/packages/client/src/theme/utils/applyTheme.spec.ts@@ -564,6 +564,14 @@ describe('applyTheme', () => {expect(root.style.getPropertyValue('--field-text')).toBe('1 2 3');});+ it('maps a legacy theme canvas onto the checkbox fill', () => {+ const root = document.documentElement;++ applyTheme({ 'rgb-surface-primary': '20 21 22' }, root);++ expect(root.style.getPropertyValue('--checkbox-fill')).toBe('20 21 22');+ });+it('keeps the switch knob of a legacy theme on the surface it repainted', () => {const root = document.documentElement;diff --git a/packages/client/src/theme/utils/applyTheme.ts b/packages/client/src/theme/utils/applyTheme.tsindex 3fce3fcce5..93c8354393 100644--- a/packages/client/src/theme/utils/applyTheme.ts+++ b/packages/client/src/theme/utils/applyTheme.ts@@ -91,6 +91,11 @@ function mapColors(input: RenamedThemeRGB, base?: IThemeRGB): Array<[string, strvariables.push(['--field-fill', colors['rgb-surface-primary']]);}+ /** The checkbox fill follows the canvas, as in `resolveTheme`. */+ if (colors['rgb-checkbox-fill'] === undefined && colors['rgb-surface-primary'] !== undefined) {+ variables.push(['--checkbox-fill', colors['rgb-surface-primary']]);+ }+Object.entries(overlayFallbacks(colors)).forEach(([role, value]) => {variables.push([colorProperty(role as keyof IThemeRGB), value]);});diff --git a/packages/client/src/utils/utils.ts b/packages/client/src/utils/utils.tsindex 00c571ab53..94ffe57e04 100644--- a/packages/client/src/utils/utils.ts+++ b/packages/client/src/utils/utils.ts@@ -63,7 +63,7 @@ const twMerge = extendTailwindMerge({],px: [{ px: ['theme-button-x', 'theme-control-x', 'theme-dialog-x'] }],gap: [{ gap: ['theme-control-gap'] }],- rounded: [{ rounded: ['theme-auth-control', 'theme-auth-action'] }],+ rounded: [{ rounded: ['theme-auth-control', 'theme-auth-action', 'theme-checkbox'] }],'space-y': [{ 'space-y': ['theme-dialog-header'] }],'font-weight': [{ font: ['theme-control', 'theme-dialog-title-weight', 'theme-label'] }],'font-family': [{ font: ['theme-dialog-title'] }],diff --git a/packages/client/tailwind.preset.cjs b/packages/client/tailwind.preset.cjsindex a81e2ae63c..e416994d58 100644--- a/packages/client/tailwind.preset.cjs+++ b/packages/client/tailwind.preset.cjs@@ -158,6 +158,7 @@ module.exports = {'theme-auth-action': 'var(--theme-auth-action-radius, 0.5rem)','theme-surface-lg': 'var(--theme-large-surface-radius, 1.5rem)','theme-tab': 'var(--theme-tab-radius, 0.185rem)',+ 'theme-checkbox': 'var(--theme-checkbox-radius, calc(0.5rem - 4px))',},boxShadow: {'theme-surface':diff --git a/packages/data-provider/specs/theme.spec.ts b/packages/data-provider/specs/theme.spec.tsindex 411052bf7c..6758457b73 100644--- a/packages/data-provider/specs/theme.spec.ts+++ b/packages/data-provider/specs/theme.spec.ts@@ -48,6 +48,40 @@ describe('menu and tooltip shadow roles in a theme definition', () => {});});+describe('checkbox roles in a theme definition', () => {+ const theme = {+ version: 1,+ name: 'checkbox-reference',+ modes: {+ light: {+ colors: { 'rgb-checkbox-fill': '246 247 250' },+ appearance: { checkboxFillStyle: 'fill', checkboxRadius: '0.125rem' },+ },+ dark: { appearance: { checkboxFillStyle: 'transparent' } },+ },+ };++ it('accepts the fill style, the corner and an opaque fill', () => {+ expect(deploymentThemeSchema.safeParse(theme).success).toBe(true);+ expect(messages(theme)).toEqual([]);+ });++ it('rejects an unknown fill style, a non-length corner and a translucent fill', () => {+ const glass = { ...theme, modes: { light: { appearance: { checkboxFillStyle: 'glass' } } } };+ expect(messages(glass)).toEqual(['Invalid appearance value for checkboxFillStyle: glass']);++ const round = { ...theme, modes: { light: { appearance: { checkboxRadius: 'round' } } } };+ expect(messages(round)).toEqual(['Invalid appearance value for checkboxRadius: round']);++ const translucent = {+ ...theme,+ modes: { light: { colors: { 'rgb-checkbox-fill': '1 2 3 / 0.5' } } },+ };+ expect(deploymentThemeSchema.safeParse(translucent).success).toBe(false);+ expect(messages(translucent)).toHaveLength(1);+ });+});+describe('field fill roles in a theme definition', () => {const theme = {version: 1,diff --git a/packages/data-provider/src/theme.ts b/packages/data-provider/src/theme.tsindex ae1f3b545f..334130bf18 100644--- a/packages/data-provider/src/theme.ts+++ b/packages/data-provider/src/theme.ts@@ -179,6 +179,7 @@ export const themeColorTokens = Object.freeze(['rgb-category-icon-7','rgb-switch-unchecked','rgb-switch-thumb',+ 'rgb-checkbox-fill','rgb-table-header-text','rgb-table-header-fill','rgb-presentation',@@ -488,6 +489,10 @@ const appearanceValidators = {switchHeight: isSwitchLength,/** A checkbox's box and the check inside it, 1 to 1.5rem: never smaller than the box it was. */checkboxSize: lengthWithin(16, 24),+ /** The checkbox's corner, and whether an unchecked box stays transparent or paints+ * `checkbox-fill`. */+ checkboxRadius: isLength,+ checkboxFillStyle: (value: unknown) => value === 'transparent' || value === 'fill',tableCellSpaceY: isTableLength,tableRowStroke: isTableLength,spaceCompact: isLength,