ui: token-driven component library on Mantine
Adds src/components/ui: buttons, messages, labels, progress, status, tables,
form controls, panels, cards, statistics, modals, tooltips, tabs, and icons.
Everything resolves its colors through theme tokens, so no component branches
on the current theme, and Semantic UI keeps rendering the app meanwhile.
Mantine is bridged rather than restyled: its own CSS variables are pointed at
our tokens. Four details were not obvious, and each caused a visible defect
in night mode before being fixed:
- Structural colors must go in the resolver's light/dark blocks. Mantine
emits its values under [data-mantine-color-scheme], which outranks the
:root block that `variables` becomes, so its grays were winning.
- The dark and gray palettes are mapped shade by shade to tokens. Mantine
reads them directly for table borders, zebra stripes and input chrome;
they can be neither flattened nor left alone.
- Mantine writes --button-* as inline styles, which no stylesheet can
outrank, so the dashed danger treatment sets real properties instead.
- Switch colors are written onto inner elements, so they need scoped CSS
rather than a variable on the root. Adds a --knob token for control
handles, because Mantine's default thumb follows theme.white, which is
near-black in the dark-based themes.
An audit of every painted pixel in the /theme-sample gallery now finds no
non-red channel in night mode.
Icons come from @tabler/icons-react with the 102 Semantic names the app uses
mapped to components; they stroke with currentColor, so they follow the theme
without any rule of their own. Toasts keep the react-semantic-toasts-2
signature so those call sites migrate by changing an import.
TypeScript 5 is required: Mantine's declarations use `const` type parameters,
which 4.9 cannot parse (Mantine 7 is the same, so downgrading is no escape).
That needs two npm overrides to keep clean installs working, both verified
against a Docker build: react-scripts declares peerOptional typescript ^3||^4,
and fork-ts-checker 6.5.2 assigns typescript.performance.mark, which TS 5
made getter-only - crashing the dev server's type checker on every rebuild.
semantic-baseline.test.js ratchets the removal: it fails if a file not already
listed imports Semantic UI. An ESLint rule would have printed 75 warnings per
rebuild, and CI unsets CI= for its build step, so it would guard nothing there.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-29 19:22:03 -06:00
|
|
|
import React from 'react';
|
|
|
|
|
import {Card as MCard, Tabs as MTabs, Accordion as MAccordion, Breadcrumbs} from '@mantine/core';
|
ui: migrate the extension pages and Configs; five components they needed
Phase 2, part 1. Three files leave Semantic UI (baseline 75 -> 72), and the
components they needed join the library and the gallery:
Header Semantic's shape (as/icon/subheader/dividing). 47 files use
<Header>, and the level now picks the size, so the type scale
stays a scale instead of each call site choosing a font size.
Message gains an icon and a dismiss button.
ActionInput input and button sharing one outline, for <Input action={...}/>.
Loading centered loader with a caption, replacing the
<Loader active inline='centered'> + wrapper div in 19 places.
Modal becomes compound - Modal.Header/.Content/.Actions, plus
Semantic's open, closeIcon, and size names - because 34 files
are written against that shape.
test-utils mounts MantineProvider with ThemeProvider's exact configuration:
migrated components render Mantine internals and every one of their test files
would otherwise need its own provider.
One Semantic bleed found and fixed: semantic.min.css sets
`h1,h2,h3,h4,h5 { font-family: Lato }` and loads after Mantine's element rule,
so headings ignored the theme's body face. Only visible in amber, where the
body is mono and the headings were not. A class-level restatement outranks it;
the rule comes out when Semantic does.
Verified: 925 jest tests, clean production build, and a night-mode audit of
every painted pixel in the gallery (red-only, one known false positive). The
Configs backup and restore flow was exercised against the real API.
2026-07-29 20:25:34 -06:00
|
|
|
import {Icon} from './Icon';
|
ui: token-driven component library on Mantine
Adds src/components/ui: buttons, messages, labels, progress, status, tables,
form controls, panels, cards, statistics, modals, tooltips, tabs, and icons.
Everything resolves its colors through theme tokens, so no component branches
on the current theme, and Semantic UI keeps rendering the app meanwhile.
Mantine is bridged rather than restyled: its own CSS variables are pointed at
our tokens. Four details were not obvious, and each caused a visible defect
in night mode before being fixed:
- Structural colors must go in the resolver's light/dark blocks. Mantine
emits its values under [data-mantine-color-scheme], which outranks the
:root block that `variables` becomes, so its grays were winning.
- The dark and gray palettes are mapped shade by shade to tokens. Mantine
reads them directly for table borders, zebra stripes and input chrome;
they can be neither flattened nor left alone.
- Mantine writes --button-* as inline styles, which no stylesheet can
outrank, so the dashed danger treatment sets real properties instead.
- Switch colors are written onto inner elements, so they need scoped CSS
rather than a variable on the root. Adds a --knob token for control
handles, because Mantine's default thumb follows theme.white, which is
near-black in the dark-based themes.
An audit of every painted pixel in the /theme-sample gallery now finds no
non-red channel in night mode.
Icons come from @tabler/icons-react with the 102 Semantic names the app uses
mapped to components; they stroke with currentColor, so they follow the theme
without any rule of their own. Toasts keep the react-semantic-toasts-2
signature so those call sites migrate by changing an import.
TypeScript 5 is required: Mantine's declarations use `const` type parameters,
which 4.9 cannot parse (Mantine 7 is the same, so downgrading is no escape).
That needs two npm overrides to keep clean installs working, both verified
against a Docker build: react-scripts declares peerOptional typescript ^3||^4,
and fork-ts-checker 6.5.2 assigns typescript.performance.mark, which TS 5
made getter-only - crashing the dev server's type checker on every rebuild.
semantic-baseline.test.js ratchets the removal: it fails if a file not already
listed imports Semantic UI. An ESLint rule would have printed 75 warnings per
rebuild, and CI unsets CI= for its build step, so it would guard nothing there.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-29 19:22:03 -06:00
|
|
|
|
|
|
|
|
/*
|
ui: migrate the extension pages and Configs; five components they needed
Phase 2, part 1. Three files leave Semantic UI (baseline 75 -> 72), and the
components they needed join the library and the gallery:
Header Semantic's shape (as/icon/subheader/dividing). 47 files use
<Header>, and the level now picks the size, so the type scale
stays a scale instead of each call site choosing a font size.
Message gains an icon and a dismiss button.
ActionInput input and button sharing one outline, for <Input action={...}/>.
Loading centered loader with a caption, replacing the
<Loader active inline='centered'> + wrapper div in 19 places.
Modal becomes compound - Modal.Header/.Content/.Actions, plus
Semantic's open, closeIcon, and size names - because 34 files
are written against that shape.
test-utils mounts MantineProvider with ThemeProvider's exact configuration:
migrated components render Mantine internals and every one of their test files
would otherwise need its own provider.
One Semantic bleed found and fixed: semantic.min.css sets
`h1,h2,h3,h4,h5 { font-family: Lato }` and loads after Mantine's element rule,
so headings ignored the theme's body face. Only visible in amber, where the
body is mono and the headings were not. A class-level restatement outranks it;
the rule comes out when Semantic does.
Verified: 925 jest tests, clean production build, and a night-mode audit of
every painted pixel in the gallery (red-only, one known false positive). The
Configs backup and restore flow was exercised against the real API.
2026-07-29 20:25:34 -06:00
|
|
|
* Surfaces and structure: headers, panels, cards, statistics, tabs, accordions,
|
ui: token-driven component library on Mantine
Adds src/components/ui: buttons, messages, labels, progress, status, tables,
form controls, panels, cards, statistics, modals, tooltips, tabs, and icons.
Everything resolves its colors through theme tokens, so no component branches
on the current theme, and Semantic UI keeps rendering the app meanwhile.
Mantine is bridged rather than restyled: its own CSS variables are pointed at
our tokens. Four details were not obvious, and each caused a visible defect
in night mode before being fixed:
- Structural colors must go in the resolver's light/dark blocks. Mantine
emits its values under [data-mantine-color-scheme], which outranks the
:root block that `variables` becomes, so its grays were winning.
- The dark and gray palettes are mapped shade by shade to tokens. Mantine
reads them directly for table borders, zebra stripes and input chrome;
they can be neither flattened nor left alone.
- Mantine writes --button-* as inline styles, which no stylesheet can
outrank, so the dashed danger treatment sets real properties instead.
- Switch colors are written onto inner elements, so they need scoped CSS
rather than a variable on the root. Adds a --knob token for control
handles, because Mantine's default thumb follows theme.white, which is
near-black in the dark-based themes.
An audit of every painted pixel in the /theme-sample gallery now finds no
non-red channel in night mode.
Icons come from @tabler/icons-react with the 102 Semantic names the app uses
mapped to components; they stroke with currentColor, so they follow the theme
without any rule of their own. Toasts keep the react-semantic-toasts-2
signature so those call sites migrate by changing an import.
TypeScript 5 is required: Mantine's declarations use `const` type parameters,
which 4.9 cannot parse (Mantine 7 is the same, so downgrading is no escape).
That needs two npm overrides to keep clean installs working, both verified
against a Docker build: react-scripts declares peerOptional typescript ^3||^4,
and fork-ts-checker 6.5.2 assigns typescript.performance.mark, which TS 5
made getter-only - crashing the dev server's type checker on every rebuild.
semantic-baseline.test.js ratchets the removal: it fails if a file not already
listed imports Semantic UI. An ESLint rule would have printed 75 warnings per
rebuild, and CI unsets CI= for its build step, so it would guard nothing there.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-29 19:22:03 -06:00
|
|
|
* breadcrumbs. Elevation is expressed with borders and background steps —
|
|
|
|
|
* never a shadow (shadows are zeroed in the Mantine bridge).
|
|
|
|
|
*/
|
|
|
|
|
|
ui: migrate the extension pages and Configs; five components they needed
Phase 2, part 1. Three files leave Semantic UI (baseline 75 -> 72), and the
components they needed join the library and the gallery:
Header Semantic's shape (as/icon/subheader/dividing). 47 files use
<Header>, and the level now picks the size, so the type scale
stays a scale instead of each call site choosing a font size.
Message gains an icon and a dismiss button.
ActionInput input and button sharing one outline, for <Input action={...}/>.
Loading centered loader with a caption, replacing the
<Loader active inline='centered'> + wrapper div in 19 places.
Modal becomes compound - Modal.Header/.Content/.Actions, plus
Semantic's open, closeIcon, and size names - because 34 files
are written against that shape.
test-utils mounts MantineProvider with ThemeProvider's exact configuration:
migrated components render Mantine internals and every one of their test files
would otherwise need its own provider.
One Semantic bleed found and fixed: semantic.min.css sets
`h1,h2,h3,h4,h5 { font-family: Lato }` and loads after Mantine's element rule,
so headings ignored the theme's body face. Only visible in amber, where the
body is mono and the headings were not. A class-level restatement outranks it;
the rule comes out when Semantic does.
Verified: 925 jest tests, clean production build, and a night-mode audit of
every painted pixel in the gallery (red-only, one known false positive). The
Configs backup and restore flow was exercised against the real API.
2026-07-29 20:25:34 -06:00
|
|
|
// ------------------------------------------------------------------- Headers
|
|
|
|
|
|
|
|
|
|
export type HeaderLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5';
|
|
|
|
|
|
|
|
|
|
export interface HeaderProps extends Omit<React.HTMLAttributes<HTMLHeadingElement>, 'color'> {
|
|
|
|
|
/** Heading level. Also the visual size — pick it for the outline, not the look. */
|
|
|
|
|
as?: HeaderLevel;
|
|
|
|
|
/** Semantic icon name or a Tabler component, shown before the text. */
|
|
|
|
|
icon?: string | React.ComponentType<any>;
|
|
|
|
|
/** Secondary line below, in muted text. */
|
|
|
|
|
subheader?: React.ReactNode;
|
|
|
|
|
/** Hairline rule underneath, separating the section from what follows. */
|
|
|
|
|
dividing?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A section heading. Named and shaped like Semantic's Header (`as`, `icon`,
|
|
|
|
|
* `subheader`, `dividing`) so the app's 47 call sites migrate by import.
|
|
|
|
|
*
|
|
|
|
|
* Sizes come from ui.css, keyed on the level, rather than each call site
|
|
|
|
|
* choosing — that is what keeps the type scale a scale.
|
|
|
|
|
*/
|
|
|
|
|
export function Header({as = 'h3', icon, subheader, dividing, className, children, ...props}: HeaderProps) {
|
|
|
|
|
const Tag = as;
|
|
|
|
|
return <div className={['wrolpi-header', dividing ? 'wrolpi-header-dividing' : '', className]
|
|
|
|
|
.filter(Boolean).join(' ')}>
|
|
|
|
|
<Tag className={`wrolpi-header-text wrolpi-header-${as}`} {...props}>
|
|
|
|
|
{icon && (typeof icon === 'string'
|
|
|
|
|
? <Icon name={icon} size='medium'/>
|
|
|
|
|
: <Icon component={icon} size='medium'/>)}
|
|
|
|
|
<span>{children}</span>
|
|
|
|
|
</Tag>
|
|
|
|
|
{subheader && <div className='wrolpi-header-sub'>{subheader}</div>}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
ui: token-driven component library on Mantine
Adds src/components/ui: buttons, messages, labels, progress, status, tables,
form controls, panels, cards, statistics, modals, tooltips, tabs, and icons.
Everything resolves its colors through theme tokens, so no component branches
on the current theme, and Semantic UI keeps rendering the app meanwhile.
Mantine is bridged rather than restyled: its own CSS variables are pointed at
our tokens. Four details were not obvious, and each caused a visible defect
in night mode before being fixed:
- Structural colors must go in the resolver's light/dark blocks. Mantine
emits its values under [data-mantine-color-scheme], which outranks the
:root block that `variables` becomes, so its grays were winning.
- The dark and gray palettes are mapped shade by shade to tokens. Mantine
reads them directly for table borders, zebra stripes and input chrome;
they can be neither flattened nor left alone.
- Mantine writes --button-* as inline styles, which no stylesheet can
outrank, so the dashed danger treatment sets real properties instead.
- Switch colors are written onto inner elements, so they need scoped CSS
rather than a variable on the root. Adds a --knob token for control
handles, because Mantine's default thumb follows theme.white, which is
near-black in the dark-based themes.
An audit of every painted pixel in the /theme-sample gallery now finds no
non-red channel in night mode.
Icons come from @tabler/icons-react with the 102 Semantic names the app uses
mapped to components; they stroke with currentColor, so they follow the theme
without any rule of their own. Toasts keep the react-semantic-toasts-2
signature so those call sites migrate by changing an import.
TypeScript 5 is required: Mantine's declarations use `const` type parameters,
which 4.9 cannot parse (Mantine 7 is the same, so downgrading is no escape).
That needs two npm overrides to keep clean installs working, both verified
against a Docker build: react-scripts declares peerOptional typescript ^3||^4,
and fork-ts-checker 6.5.2 assigns typescript.performance.mark, which TS 5
made getter-only - crashing the dev server's type checker on every rebuild.
semantic-baseline.test.js ratchets the removal: it fails if a file not already
listed imports Semantic UI. An ESLint rule would have printed 75 warnings per
rebuild, and CI unsets CI= for its build step, so it would guard nothing there.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-29 19:22:03 -06:00
|
|
|
// -------------------------------------------------------------------- Panels
|
|
|
|
|
|
|
|
|
|
export interface PanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
|
|
/** A danger zone: dashed red border, for destructive groupings. */
|
|
|
|
|
danger?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** A bordered surface. Replaces Semantic's Segment. */
|
|
|
|
|
export function Panel({danger, className, children, ...props}: PanelProps) {
|
|
|
|
|
return <div
|
|
|
|
|
className={['wrolpi-panel', danger ? 'wrolpi-panel-danger' : '', className]
|
|
|
|
|
.filter(Boolean).join(' ')}
|
|
|
|
|
{...props}
|
|
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------- Statistics
|
|
|
|
|
|
|
|
|
|
export interface StatisticProps {
|
|
|
|
|
value: React.ReactNode;
|
|
|
|
|
label: React.ReactNode;
|
|
|
|
|
color?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function Statistic({value, label, color}: StatisticProps) {
|
|
|
|
|
return <div>
|
|
|
|
|
<div className='wrolpi-statistic-value' style={{color: color ? `var(--${color})` : undefined}}>
|
|
|
|
|
{value}
|
|
|
|
|
</div>
|
|
|
|
|
<div className='wrolpi-statistic-label'>{label}</div>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** A row of statistics separated by hairlines, sharing one outer border. */
|
|
|
|
|
export function StatisticGroup({children}: {children: React.ReactNode}) {
|
|
|
|
|
const items = React.Children.toArray(children);
|
|
|
|
|
return <div style={{
|
|
|
|
|
display: 'grid',
|
|
|
|
|
gridTemplateColumns: `repeat(auto-fit, minmax(150px, 1fr))`,
|
|
|
|
|
border: '1px solid var(--border)',
|
|
|
|
|
}}>
|
|
|
|
|
{items.map((child, index) => <div
|
|
|
|
|
key={index}
|
|
|
|
|
style={{
|
|
|
|
|
background: 'var(--panel)',
|
|
|
|
|
padding: '14px 16px',
|
|
|
|
|
borderRight: index === items.length - 1 ? undefined : '1px solid var(--border)',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{child}
|
|
|
|
|
</div>)}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------- Cards
|
|
|
|
|
|
|
|
|
|
export interface CardProps {
|
|
|
|
|
/** Image or poster area above the body. */
|
|
|
|
|
media?: React.ReactNode;
|
|
|
|
|
title?: React.ReactNode;
|
|
|
|
|
meta?: React.ReactNode;
|
|
|
|
|
children?: React.ReactNode;
|
|
|
|
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
|
|
|
className?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function Card({media, title, meta, children, onClick, className}: CardProps) {
|
|
|
|
|
return <MCard
|
|
|
|
|
withBorder
|
|
|
|
|
padding={0}
|
|
|
|
|
className={className}
|
|
|
|
|
onClick={onClick}
|
|
|
|
|
style={{
|
|
|
|
|
background: 'var(--panel)',
|
|
|
|
|
borderColor: 'var(--border)',
|
|
|
|
|
cursor: onClick ? 'pointer' : undefined,
|
|
|
|
|
display: 'flex',
|
|
|
|
|
flexDirection: 'column',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{media && <div style={{borderBottom: '1px solid var(--border)'}}>{media}</div>}
|
|
|
|
|
<div style={{padding: '10px 12px 12px', display: 'flex', flexDirection: 'column', gap: 4, flex: 1}}>
|
|
|
|
|
{title && <div style={{fontSize: 13, fontWeight: 600, lineHeight: 1.35}}>{title}</div>}
|
|
|
|
|
{children}
|
|
|
|
|
{meta && <div style={{fontSize: 12, color: 'var(--muted)', marginTop: 'auto'}}>{meta}</div>}
|
|
|
|
|
</div>
|
|
|
|
|
</MCard>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function CardGroup({children, minWidth = 200}: {children: React.ReactNode; minWidth?: number}) {
|
|
|
|
|
return <div style={{
|
|
|
|
|
display: 'grid',
|
|
|
|
|
gridTemplateColumns: `repeat(auto-fill, minmax(${minWidth}px, 1fr))`,
|
|
|
|
|
gap: 14,
|
|
|
|
|
}}>
|
|
|
|
|
{children}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export {MTabs as Tabs, MAccordion as Accordion, Breadcrumbs};
|