wrolpi/app/src/components/ui/Inputs.tsx

226 lines
9.1 KiB
TypeScript
Raw Normal View History

ui: PathInput, and the media directory stops printing over the value The five Special Directories fields on the Settings page were unreadable: the media directory printed straight through the value, so Archive Directory showed `a/media/wrolpi/hain_tag)s/%(domain)s`. Cause: `leftSectionWidth='auto'`. Mantine turns that prop into `--input-padding-inline-start`, and `padding-inline-start: auto` is not valid CSS -- it resolves to zero, so the input reserved no room for the section positioned on top of it. It fails only in CSS, only at runtime, and nothing warns. Fixed by expressing the field in the library instead of computing a width. PathInput puts the prefix and the input side by side in a flex row sharing one outline, so there is no width to get wrong and nothing to overlap -- the failure is structurally impossible rather than merely corrected. It also sizes to any prefix, which matters because the media directory is `/media/wrolpi` on a Pi and something else under Docker. Written test-first, and the tests need no mocks at all -- no context, no fetch, no router, just the provider test-utils already supplies. That is the point: Settings.js needs a pile of provider and API mocks, so its inputs were never covered, which is how five broken fields shipped. The tests assert the things that actually matter and can be checked without layout: the prefix is a sibling rather than a child, the value never contains it, onChange reports only what was typed, the prefix is the field's accessible description so a screen-reader user knows what the path is relative to, and disabled reaches the input rather than just the wrapper. Plus a source guard, since jsdom cannot see an overlap: nothing may pass `leftSectionWidth='auto'` or `rightSectionWidth='auto'`. It strips comments first -- PathInput documents the mistake by name, and prose about a mistake is not the mistake.
2026-07-30 15:12:18 -06:00
import React, {forwardRef, useId} from 'react';
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 {
Checkbox as MCheckbox,
MultiSelect,
NumberInput,
Radio,
Select as MSelect,
Switch as MSwitch,
Textarea as MTextarea,
TextInput as MTextInput,
} from '@mantine/core';
fix: break the import cycle that put useCalculators in the TDZ The dashboard threw on arrival from any other page: ReferenceError: Cannot access 'useCalculators' before initialization at Module.useCalculators at DashboardCalculators `Calculators.js` exports `useCalculators` as a `const` and imports the ten calculators it renders. Five of those reached back up to `Apps.js` for `ColoredInput`, and `Apps.js` imports `CalculatorsPage` from `Calculators.js` -- so the hub was in a cycle with its own leaves: Calculators.js -> calculators/ElectricalCalculators.js -> Apps.js -> Calculators.js Webpack compiles a `const` export to a live getter, and a getter read before the module body reaches the declaration THROWS rather than returning undefined. That is the whole mechanism behind this particular error, and it names the const it could not reach. `ColoredInput` is a text field with a Label welded to one edge -- the calculators' unit markers. It has no business in the module that ROUTES to the calculators, so it moved to `components/ui/Inputs.tsx`. Nothing in `components/ui` imports from `components/`, so a control kept there cannot close a loop like this again. Gallery entry added, per the standing rule. `src/import-cycles.test.js` is the guard: a small import-graph walker, scoped to hubs that export a `const` into their own subtree. It fails with the cycle printed, and it self-checks against a known cycle so it cannot pass by finding nothing. Verified red with the cycle planted back. HONEST LIMIT: the guard is static because I could not reproduce the RUNTIME error in a test. TDZ needs a module to be mid-evaluation when the getter is read, and by the time any spec body runs every module has finished; babel also papers over it, handing back undefined where webpack throws. I tried an e2e that navigates to the dashboard and collects window errors -- it passes with the cycle present, so it would have been a test that cannot fail for the reason it claims, and I deleted it rather than ship it. A react-refresh trigger did not reproduce it either. What is checkable, and what is genuinely the defect, is the cycle. 1080 jest / 60 suites, 158 in ui-layout.cy.js, clean build. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-02 12:23:10 -06:00
import {Label, LabelProps} from './Feedback';
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
/*
* Form controls.
*
* All of these are Mantine components, deliberately: every one renders its own
* markup rather than a native control. Native checkboxes, radios, and select
* arrows are drawn by the browser in white, which cannot be restyled and would
* put white pixels on screen in night mode. Mantine draws SVG we can color
* from tokens.
*/
// Mantine reads these per-component variables; pointing them at tokens keeps the
// controls correct in all four themes without any per-theme branching.
const checkboxStyles = {
'--checkbox-color': 'var(--blue)',
'--checkbox-icon-color': 'var(--btn-text)',
} as React.CSSProperties;
/*
* `--switch-color` is the *checked* track and comes from the `color` prop, so it is
* deliberately not set here. The thumb must be a token: Mantine's default follows
* `theme.white`, which is our `--btn-text` — near-black on the dark-based themes.
*
* The unchecked track is set in ui.css instead of here. Mantine writes `--switch-bg`
* onto the track element itself, so a variable on this root would never reach it.
*/
const switchStyles = {
'--switch-thumb-bg': 'var(--knob)',
'--switch-disabled-color': 'var(--head)',
} as React.CSSProperties;
export type CheckboxProps = React.ComponentProps<typeof MCheckbox>;
export function Checkbox({style, ...props}: CheckboxProps) {
return <MCheckbox style={{...checkboxStyles, ...style}} {...props}/>
}
export type ToggleProps = React.ComponentProps<typeof MSwitch>;
/** An on/off switch. Replaces Semantic's `Radio toggle`. */
export function Toggle({style, className, ...props}: ToggleProps) {
return <MSwitch
className={['wrolpi-switch', className].filter(Boolean).join(' ')}
style={{...switchStyles, ...style}}
color='blue'
{...props}
/>
}
ui: PathInput, and the media directory stops printing over the value The five Special Directories fields on the Settings page were unreadable: the media directory printed straight through the value, so Archive Directory showed `a/media/wrolpi/hain_tag)s/%(domain)s`. Cause: `leftSectionWidth='auto'`. Mantine turns that prop into `--input-padding-inline-start`, and `padding-inline-start: auto` is not valid CSS -- it resolves to zero, so the input reserved no room for the section positioned on top of it. It fails only in CSS, only at runtime, and nothing warns. Fixed by expressing the field in the library instead of computing a width. PathInput puts the prefix and the input side by side in a flex row sharing one outline, so there is no width to get wrong and nothing to overlap -- the failure is structurally impossible rather than merely corrected. It also sizes to any prefix, which matters because the media directory is `/media/wrolpi` on a Pi and something else under Docker. Written test-first, and the tests need no mocks at all -- no context, no fetch, no router, just the provider test-utils already supplies. That is the point: Settings.js needs a pile of provider and API mocks, so its inputs were never covered, which is how five broken fields shipped. The tests assert the things that actually matter and can be checked without layout: the prefix is a sibling rather than a child, the value never contains it, onChange reports only what was typed, the prefix is the field's accessible description so a screen-reader user knows what the path is relative to, and disabled reaches the input rather than just the wrapper. Plus a source guard, since jsdom cannot see an overlap: nothing may pass `leftSectionWidth='auto'` or `rightSectionWidth='auto'`. It strips comments first -- PathInput documents the mistake by name, and prose about a mistake is not the mistake.
2026-07-30 15:12:18 -06:00
export interface PathInputProps
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'prefix'> {
label?: React.ReactNode;
description?: React.ReactNode;
error?: React.ReactNode;
/**
* A fixed, non-editable path the value hangs off — the media directory, say. It is
* not part of the value, and typing never changes it.
*/
prefix: string;
}
/**
* A path input with a fixed prefix shown to the left of what the user types.
*
* The prefix is a *sibling* of the input rather than a section layered inside it, which is
* the point: Mantine positions `leftSection` absolutely and reserves room for it with
* `--input-padding-inline-start`, so a call site that gets that width wrong prints the
* prefix straight through the value. Passing `leftSectionWidth='auto'` did exactly that
* — `padding-inline-start: auto` is invalid, so it resolved to zero and every one of these
* fields rendered its path on top of its own contents.
*
* As two boxes in a flex row there is no width to compute and nothing to overlap. It also
* sizes itself to any prefix, which matters here: the media directory is `/media/wrolpi`
* on a Pi and something else entirely under Docker.
*/
export const PathInput = forwardRef<HTMLInputElement, PathInputProps>((
{prefix, label, description, error, required, disabled, className, id, ...props}, ref
) => {
const generated = useId();
const inputId = id ?? `${generated}-input`;
const prefixId = `${generated}-prefix`;
ui: name the directory fields, announce their help text, let long prefixes shrink Greptile's three findings on #590, all confirmed real before fixing, and each one verified red against the original code afterwards. P1, the directory fields had no accessible names. All five rendered their visible label as a bare <label> with no htmlFor while passing no label prop, so their inputs had a description ("/media/wrolpi/") and no name at all -- five fields in one grid, holding similar relative paths, indistinguishable to a screen reader. The labels now belong to the inputs, InfoPopup content and all. This predates PathInput; the old TextInput call sites had the same gap, and moving to a component that supports labels is what made it fixable. P1, description and error were rendered but never referenced. aria-describedby pointed only at the prefix, so the help text listing the variables a path accepts, and the reason a path was rejected, were both invisible to assistive technology. Both are now in the description, and an errored field reports aria-invalid. P2 was worse than reported: at `flex: none` a long prefix took the entire row and left the input eighteen pixels wide -- not "consumes the editable area" but a field nobody can type in. The media directory is whatever the API reports, so its length was never ours to assume. The prefix now shrinks and ellipsises at half the control, with the full path on `title` and in the accessible description. The naming fault could not have been caught where the others were. jsdom cannot see layout, and the Settings page needs enough mocking that it had no test at all -- which is why these five fields were uncovered when they broke. The new e2e spec intercepts the API and lets the real page render, so it measures the names and the geometry a user actually gets. Reverting one field to a bare label fails it; a long prefix fails the browser spec at 18px. 962 jest, 15 browser component, 46 e2e, clean cache-busted build, tsc clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 15:46:54 -06:00
const descriptionId = `${generated}-description`;
const errorId = `${generated}-error`;
/*
* Everything that explains the field, in reading order. Drawing the description and the
* error on screen does not announce them -- an unreferenced element is invisible to a
* screen reader, which would leave a user hearing the label and the prefix but never the
* variables the path accepts, nor the reason a path was just rejected.
*/
const describedBy = [
prefixId,
description ? descriptionId : null,
error ? errorId : null,
].filter(Boolean).join(' ');
ui: PathInput, and the media directory stops printing over the value The five Special Directories fields on the Settings page were unreadable: the media directory printed straight through the value, so Archive Directory showed `a/media/wrolpi/hain_tag)s/%(domain)s`. Cause: `leftSectionWidth='auto'`. Mantine turns that prop into `--input-padding-inline-start`, and `padding-inline-start: auto` is not valid CSS -- it resolves to zero, so the input reserved no room for the section positioned on top of it. It fails only in CSS, only at runtime, and nothing warns. Fixed by expressing the field in the library instead of computing a width. PathInput puts the prefix and the input side by side in a flex row sharing one outline, so there is no width to get wrong and nothing to overlap -- the failure is structurally impossible rather than merely corrected. It also sizes to any prefix, which matters because the media directory is `/media/wrolpi` on a Pi and something else under Docker. Written test-first, and the tests need no mocks at all -- no context, no fetch, no router, just the provider test-utils already supplies. That is the point: Settings.js needs a pile of provider and API mocks, so its inputs were never covered, which is how five broken fields shipped. The tests assert the things that actually matter and can be checked without layout: the prefix is a sibling rather than a child, the value never contains it, onChange reports only what was typed, the prefix is the field's accessible description so a screen-reader user knows what the path is relative to, and disabled reaches the input rather than just the wrapper. Plus a source guard, since jsdom cannot see an overlap: nothing may pass `leftSectionWidth='auto'` or `rightSectionWidth='auto'`. It strips comments first -- PathInput documents the mistake by name, and prose about a mistake is not the mistake.
2026-07-30 15:12:18 -06:00
return <div className={['wrolpi-path-input', className].filter(Boolean).join(' ')}>
{label && <label className='wrolpi-path-input-label' htmlFor={inputId}>
{label}{required && <span aria-hidden='true'> *</span>}
</label>}
<div className='wrolpi-path-input-control' data-disabled={disabled ? true : undefined}
data-error={error ? true : undefined}>
{/*
Described rather than hidden: a screen reader should hear which directory the
typed path is relative to, since that is the whole point of showing it.
ui: name the directory fields, announce their help text, let long prefixes shrink Greptile's three findings on #590, all confirmed real before fixing, and each one verified red against the original code afterwards. P1, the directory fields had no accessible names. All five rendered their visible label as a bare <label> with no htmlFor while passing no label prop, so their inputs had a description ("/media/wrolpi/") and no name at all -- five fields in one grid, holding similar relative paths, indistinguishable to a screen reader. The labels now belong to the inputs, InfoPopup content and all. This predates PathInput; the old TextInput call sites had the same gap, and moving to a component that supports labels is what made it fixable. P1, description and error were rendered but never referenced. aria-describedby pointed only at the prefix, so the help text listing the variables a path accepts, and the reason a path was rejected, were both invisible to assistive technology. Both are now in the description, and an errored field reports aria-invalid. P2 was worse than reported: at `flex: none` a long prefix took the entire row and left the input eighteen pixels wide -- not "consumes the editable area" but a field nobody can type in. The media directory is whatever the API reports, so its length was never ours to assume. The prefix now shrinks and ellipsises at half the control, with the full path on `title` and in the accessible description. The naming fault could not have been caught where the others were. jsdom cannot see layout, and the Settings page needs enough mocking that it had no test at all -- which is why these five fields were uncovered when they broke. The new e2e spec intercepts the API and lets the real page render, so it measures the names and the geometry a user actually gets. Reverting one field to a bare label fails it; a long prefix fails the browser spec at 18px. 962 jest, 15 browser component, 46 e2e, clean cache-busted build, tsc clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 15:46:54 -06:00
`title` carries the full path because the prefix truncates when it is long --
the media directory is whatever the API reports, and a prefix that refused to
shrink took the entire row and left the input 18px wide.
ui: PathInput, and the media directory stops printing over the value The five Special Directories fields on the Settings page were unreadable: the media directory printed straight through the value, so Archive Directory showed `a/media/wrolpi/hain_tag)s/%(domain)s`. Cause: `leftSectionWidth='auto'`. Mantine turns that prop into `--input-padding-inline-start`, and `padding-inline-start: auto` is not valid CSS -- it resolves to zero, so the input reserved no room for the section positioned on top of it. It fails only in CSS, only at runtime, and nothing warns. Fixed by expressing the field in the library instead of computing a width. PathInput puts the prefix and the input side by side in a flex row sharing one outline, so there is no width to get wrong and nothing to overlap -- the failure is structurally impossible rather than merely corrected. It also sizes to any prefix, which matters because the media directory is `/media/wrolpi` on a Pi and something else under Docker. Written test-first, and the tests need no mocks at all -- no context, no fetch, no router, just the provider test-utils already supplies. That is the point: Settings.js needs a pile of provider and API mocks, so its inputs were never covered, which is how five broken fields shipped. The tests assert the things that actually matter and can be checked without layout: the prefix is a sibling rather than a child, the value never contains it, onChange reports only what was typed, the prefix is the field's accessible description so a screen-reader user knows what the path is relative to, and disabled reaches the input rather than just the wrapper. Plus a source guard, since jsdom cannot see an overlap: nothing may pass `leftSectionWidth='auto'` or `rightSectionWidth='auto'`. It strips comments first -- PathInput documents the mistake by name, and prose about a mistake is not the mistake.
2026-07-30 15:12:18 -06:00
*/}
ui: name the directory fields, announce their help text, let long prefixes shrink Greptile's three findings on #590, all confirmed real before fixing, and each one verified red against the original code afterwards. P1, the directory fields had no accessible names. All five rendered their visible label as a bare <label> with no htmlFor while passing no label prop, so their inputs had a description ("/media/wrolpi/") and no name at all -- five fields in one grid, holding similar relative paths, indistinguishable to a screen reader. The labels now belong to the inputs, InfoPopup content and all. This predates PathInput; the old TextInput call sites had the same gap, and moving to a component that supports labels is what made it fixable. P1, description and error were rendered but never referenced. aria-describedby pointed only at the prefix, so the help text listing the variables a path accepts, and the reason a path was rejected, were both invisible to assistive technology. Both are now in the description, and an errored field reports aria-invalid. P2 was worse than reported: at `flex: none` a long prefix took the entire row and left the input eighteen pixels wide -- not "consumes the editable area" but a field nobody can type in. The media directory is whatever the API reports, so its length was never ours to assume. The prefix now shrinks and ellipsises at half the control, with the full path on `title` and in the accessible description. The naming fault could not have been caught where the others were. jsdom cannot see layout, and the Settings page needs enough mocking that it had no test at all -- which is why these five fields were uncovered when they broke. The new e2e spec intercepts the API and lets the real page render, so it measures the names and the geometry a user actually gets. Reverting one field to a bare label fails it; a long prefix fails the browser spec at 18px. 962 jest, 15 browser component, 46 e2e, clean cache-busted build, tsc clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 15:46:54 -06:00
<span className='wrolpi-path-input-prefix' id={prefixId} title={prefix}>{prefix}</span>
ui: PathInput, and the media directory stops printing over the value The five Special Directories fields on the Settings page were unreadable: the media directory printed straight through the value, so Archive Directory showed `a/media/wrolpi/hain_tag)s/%(domain)s`. Cause: `leftSectionWidth='auto'`. Mantine turns that prop into `--input-padding-inline-start`, and `padding-inline-start: auto` is not valid CSS -- it resolves to zero, so the input reserved no room for the section positioned on top of it. It fails only in CSS, only at runtime, and nothing warns. Fixed by expressing the field in the library instead of computing a width. PathInput puts the prefix and the input side by side in a flex row sharing one outline, so there is no width to get wrong and nothing to overlap -- the failure is structurally impossible rather than merely corrected. It also sizes to any prefix, which matters because the media directory is `/media/wrolpi` on a Pi and something else under Docker. Written test-first, and the tests need no mocks at all -- no context, no fetch, no router, just the provider test-utils already supplies. That is the point: Settings.js needs a pile of provider and API mocks, so its inputs were never covered, which is how five broken fields shipped. The tests assert the things that actually matter and can be checked without layout: the prefix is a sibling rather than a child, the value never contains it, onChange reports only what was typed, the prefix is the field's accessible description so a screen-reader user knows what the path is relative to, and disabled reaches the input rather than just the wrapper. Plus a source guard, since jsdom cannot see an overlap: nothing may pass `leftSectionWidth='auto'` or `rightSectionWidth='auto'`. It strips comments first -- PathInput documents the mistake by name, and prose about a mistake is not the mistake.
2026-07-30 15:12:18 -06:00
<input
ref={ref}
id={inputId}
type='text'
required={required}
disabled={disabled}
ui: name the directory fields, announce their help text, let long prefixes shrink Greptile's three findings on #590, all confirmed real before fixing, and each one verified red against the original code afterwards. P1, the directory fields had no accessible names. All five rendered their visible label as a bare <label> with no htmlFor while passing no label prop, so their inputs had a description ("/media/wrolpi/") and no name at all -- five fields in one grid, holding similar relative paths, indistinguishable to a screen reader. The labels now belong to the inputs, InfoPopup content and all. This predates PathInput; the old TextInput call sites had the same gap, and moving to a component that supports labels is what made it fixable. P1, description and error were rendered but never referenced. aria-describedby pointed only at the prefix, so the help text listing the variables a path accepts, and the reason a path was rejected, were both invisible to assistive technology. Both are now in the description, and an errored field reports aria-invalid. P2 was worse than reported: at `flex: none` a long prefix took the entire row and left the input eighteen pixels wide -- not "consumes the editable area" but a field nobody can type in. The media directory is whatever the API reports, so its length was never ours to assume. The prefix now shrinks and ellipsises at half the control, with the full path on `title` and in the accessible description. The naming fault could not have been caught where the others were. jsdom cannot see layout, and the Settings page needs enough mocking that it had no test at all -- which is why these five fields were uncovered when they broke. The new e2e spec intercepts the API and lets the real page render, so it measures the names and the geometry a user actually gets. Reverting one field to a bare label fails it; a long prefix fails the browser spec at 18px. 962 jest, 15 browser component, 46 e2e, clean cache-busted build, tsc clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 15:46:54 -06:00
aria-describedby={describedBy}
aria-invalid={error ? true : undefined}
ui: PathInput, and the media directory stops printing over the value The five Special Directories fields on the Settings page were unreadable: the media directory printed straight through the value, so Archive Directory showed `a/media/wrolpi/hain_tag)s/%(domain)s`. Cause: `leftSectionWidth='auto'`. Mantine turns that prop into `--input-padding-inline-start`, and `padding-inline-start: auto` is not valid CSS -- it resolves to zero, so the input reserved no room for the section positioned on top of it. It fails only in CSS, only at runtime, and nothing warns. Fixed by expressing the field in the library instead of computing a width. PathInput puts the prefix and the input side by side in a flex row sharing one outline, so there is no width to get wrong and nothing to overlap -- the failure is structurally impossible rather than merely corrected. It also sizes to any prefix, which matters because the media directory is `/media/wrolpi` on a Pi and something else under Docker. Written test-first, and the tests need no mocks at all -- no context, no fetch, no router, just the provider test-utils already supplies. That is the point: Settings.js needs a pile of provider and API mocks, so its inputs were never covered, which is how five broken fields shipped. The tests assert the things that actually matter and can be checked without layout: the prefix is a sibling rather than a child, the value never contains it, onChange reports only what was typed, the prefix is the field's accessible description so a screen-reader user knows what the path is relative to, and disabled reaches the input rather than just the wrapper. Plus a source guard, since jsdom cannot see an overlap: nothing may pass `leftSectionWidth='auto'` or `rightSectionWidth='auto'`. It strips comments first -- PathInput documents the mistake by name, and prose about a mistake is not the mistake.
2026-07-30 15:12:18 -06:00
{...props}
/>
</div>
ui: name the directory fields, announce their help text, let long prefixes shrink Greptile's three findings on #590, all confirmed real before fixing, and each one verified red against the original code afterwards. P1, the directory fields had no accessible names. All five rendered their visible label as a bare <label> with no htmlFor while passing no label prop, so their inputs had a description ("/media/wrolpi/") and no name at all -- five fields in one grid, holding similar relative paths, indistinguishable to a screen reader. The labels now belong to the inputs, InfoPopup content and all. This predates PathInput; the old TextInput call sites had the same gap, and moving to a component that supports labels is what made it fixable. P1, description and error were rendered but never referenced. aria-describedby pointed only at the prefix, so the help text listing the variables a path accepts, and the reason a path was rejected, were both invisible to assistive technology. Both are now in the description, and an errored field reports aria-invalid. P2 was worse than reported: at `flex: none` a long prefix took the entire row and left the input eighteen pixels wide -- not "consumes the editable area" but a field nobody can type in. The media directory is whatever the API reports, so its length was never ours to assume. The prefix now shrinks and ellipsises at half the control, with the full path on `title` and in the accessible description. The naming fault could not have been caught where the others were. jsdom cannot see layout, and the Settings page needs enough mocking that it had no test at all -- which is why these five fields were uncovered when they broke. The new e2e spec intercepts the API and lets the real page render, so it measures the names and the geometry a user actually gets. Reverting one field to a bare label fails it; a long prefix fails the browser spec at 18px. 962 jest, 15 browser component, 46 e2e, clean cache-busted build, tsc clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 15:46:54 -06:00
{description && <div className='wrolpi-path-input-description' id={descriptionId}>
{description}
</div>}
{error && <div className='wrolpi-path-input-error' id={errorId}>{error}</div>}
ui: PathInput, and the media directory stops printing over the value The five Special Directories fields on the Settings page were unreadable: the media directory printed straight through the value, so Archive Directory showed `a/media/wrolpi/hain_tag)s/%(domain)s`. Cause: `leftSectionWidth='auto'`. Mantine turns that prop into `--input-padding-inline-start`, and `padding-inline-start: auto` is not valid CSS -- it resolves to zero, so the input reserved no room for the section positioned on top of it. It fails only in CSS, only at runtime, and nothing warns. Fixed by expressing the field in the library instead of computing a width. PathInput puts the prefix and the input side by side in a flex row sharing one outline, so there is no width to get wrong and nothing to overlap -- the failure is structurally impossible rather than merely corrected. It also sizes to any prefix, which matters because the media directory is `/media/wrolpi` on a Pi and something else under Docker. Written test-first, and the tests need no mocks at all -- no context, no fetch, no router, just the provider test-utils already supplies. That is the point: Settings.js needs a pile of provider and API mocks, so its inputs were never covered, which is how five broken fields shipped. The tests assert the things that actually matter and can be checked without layout: the prefix is a sibling rather than a child, the value never contains it, onChange reports only what was typed, the prefix is the field's accessible description so a screen-reader user knows what the path is relative to, and disabled reaches the input rather than just the wrapper. Plus a source guard, since jsdom cannot see an overlap: nothing may pass `leftSectionWidth='auto'` or `rightSectionWidth='auto'`. It strips comments first -- PathInput documents the mistake by name, and prose about a mistake is not the mistake.
2026-07-30 15:12:18 -06:00
</div>
});
PathInput.displayName = 'PathInput';
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
export interface ActionInputProps extends React.ComponentProps<typeof MTextInput> {
/** Button (or buttons) attached to the input's trailing edge. */
action?: React.ReactNode;
}
/**
* A text input with a button joined to its right edge. Replaces Semantic's
* `<Input action={...}/>`.
*
* The two share one outline rather than sitting side by side, so the pair reads
* as a single control — the input's own right border is dropped and the button
* supplies the edge.
*/
ui: thirty-five files off Semantic, leaving fifteen Phase 2, part 4. Baseline 50 -> 15. Migrated: all eight calculators, the rest of inventory and collections, the Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage, DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings and Status, Download, and App. Also the three shared modules everything imports: api.js and customHooks.js swap the Semantic toast library for the library's shim (same call shape), and useForm.js renders the library's Message. useForm accepts both the old `{content, header, positive|negative}` shape and the new `{kind, title}`, because the pages building those objects migrate separately. Two library gaps closed, both found by call sites needing them: ActionInput is a forwardRef now. Its ref reaches the input rather than the wrapper, because callers use it to focus or select the field -- a ref to the surrounding div would do neither, which is why one call site had resorted to hand-copying the component's markup. Header takes a `color` token name. Three separate call sites had reached for an inline style to colour a heading that carries meaning ("3 items to add" against "2 to remove"), which is how a hex ends up in markup. Two files needed repair after being interrupted mid-edit: MapViewer had a Segment left in its error branch, and VideoPlayer had lost the useContext import its own code still used. Neither jest nor tsc noticed; only `npm run build` did, which is the whole reason that check exists. Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser, FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim, ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the unmigrated files still import its Semantic-backed wrappers, so it can only go once they have.
2026-07-30 12:21:30 -06:00
export const ActionInput = forwardRef<HTMLInputElement, ActionInputProps>((
{action, className, ...props}, ref
) => {
// The ref reaches the input, not the wrapper: callers use it to focus or select the
// field, and a ref to the surrounding div would do neither.
if (!action) return <MTextInput ref={ref} className={className} {...props}/>
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
return <div className={['wrolpi-action-input', className].filter(Boolean).join(' ')}>
ui: thirty-five files off Semantic, leaving fifteen Phase 2, part 4. Baseline 50 -> 15. Migrated: all eight calculators, the rest of inventory and collections, the Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage, DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings and Status, Download, and App. Also the three shared modules everything imports: api.js and customHooks.js swap the Semantic toast library for the library's shim (same call shape), and useForm.js renders the library's Message. useForm accepts both the old `{content, header, positive|negative}` shape and the new `{kind, title}`, because the pages building those objects migrate separately. Two library gaps closed, both found by call sites needing them: ActionInput is a forwardRef now. Its ref reaches the input rather than the wrapper, because callers use it to focus or select the field -- a ref to the surrounding div would do neither, which is why one call site had resorted to hand-copying the component's markup. Header takes a `color` token name. Three separate call sites had reached for an inline style to colour a heading that carries meaning ("3 items to add" against "2 to remove"), which is how a hex ends up in markup. Two files needed repair after being interrupted mid-edit: MapViewer had a Segment left in its error branch, and VideoPlayer had lost the useContext import its own code still used. Neither jest nor tsc noticed; only `npm run build` did, which is the whole reason that check exists. Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser, FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim, ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the unmigrated files still import its Semantic-backed wrappers, so it can only go once they have.
2026-07-30 12:21:30 -06:00
<MTextInput ref={ref} {...props}/>
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
{action}
</div>
ui: thirty-five files off Semantic, leaving fifteen Phase 2, part 4. Baseline 50 -> 15. Migrated: all eight calculators, the rest of inventory and collections, the Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage, DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings and Status, Download, and App. Also the three shared modules everything imports: api.js and customHooks.js swap the Semantic toast library for the library's shim (same call shape), and useForm.js renders the library's Message. useForm accepts both the old `{content, header, positive|negative}` shape and the new `{kind, title}`, because the pages building those objects migrate separately. Two library gaps closed, both found by call sites needing them: ActionInput is a forwardRef now. Its ref reaches the input rather than the wrapper, because callers use it to focus or select the field -- a ref to the surrounding div would do neither, which is why one call site had resorted to hand-copying the component's markup. Header takes a `color` token name. Three separate call sites had reached for an inline style to colour a heading that carries meaning ("3 items to add" against "2 to remove"), which is how a hex ends up in markup. Two files needed repair after being interrupted mid-edit: MapViewer had a Segment left in its error branch, and VideoPlayer had lost the useContext import its own code still used. Neither jest nor tsc noticed; only `npm run build` did, which is the whole reason that check exists. Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser, FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim, ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the unmigrated files still import its Semantic-backed wrappers, so it can only go once they have.
2026-07-30 12:21:30 -06:00
});
ActionInput.displayName = 'ActionInput';
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
fix: break the import cycle that put useCalculators in the TDZ The dashboard threw on arrival from any other page: ReferenceError: Cannot access 'useCalculators' before initialization at Module.useCalculators at DashboardCalculators `Calculators.js` exports `useCalculators` as a `const` and imports the ten calculators it renders. Five of those reached back up to `Apps.js` for `ColoredInput`, and `Apps.js` imports `CalculatorsPage` from `Calculators.js` -- so the hub was in a cycle with its own leaves: Calculators.js -> calculators/ElectricalCalculators.js -> Apps.js -> Calculators.js Webpack compiles a `const` export to a live getter, and a getter read before the module body reaches the declaration THROWS rather than returning undefined. That is the whole mechanism behind this particular error, and it names the const it could not reach. `ColoredInput` is a text field with a Label welded to one edge -- the calculators' unit markers. It has no business in the module that ROUTES to the calculators, so it moved to `components/ui/Inputs.tsx`. Nothing in `components/ui` imports from `components/`, so a control kept there cannot close a loop like this again. Gallery entry added, per the standing rule. `src/import-cycles.test.js` is the guard: a small import-graph walker, scoped to hubs that export a `const` into their own subtree. It fails with the cycle printed, and it self-checks against a known cycle so it cannot pass by finding nothing. Verified red with the cycle planted back. HONEST LIMIT: the guard is static because I could not reproduce the RUNTIME error in a test. TDZ needs a module to be mid-evaluation when the getter is read, and by the time any spec body runs every module has finished; babel also papers over it, handing back undefined where webpack throws. I tried an e2e that navigates to the dashboard and collects window errors -- it passes with the cycle present, so it would have been a test that cannot fail for the reason it claims, and I deleted it rather than ship it. A react-refresh trigger did not reproduce it either. What is checkable, and what is genuinely the defect, is the cycle. 1080 jest / 60 suites, 158 in ui-layout.cy.js, clean build. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-02 12:23:10 -06:00
export interface ColoredInputProps
extends Omit<React.ComponentProps<typeof MTextInput>, 'color' | 'style'> {
/** Shown as a Label beside the field. Omit it and this is a plain TextInput. */
label?: React.ReactNode;
/*
* Applied to the ROW, not the field — every call site uses it for width or margins
* around the pair. Narrowed from Mantine's own `style`, which is a union that also
* accepts a function and an array and so cannot be spread into an object literal.
*/
style?: React.CSSProperties;
/*
* A token color name for the label, and the SAME union Label accepts rather than a
fix: break the import cycle that put useCalculators in the TDZ The dashboard threw on arrival from any other page: ReferenceError: Cannot access 'useCalculators' before initialization at Module.useCalculators at DashboardCalculators `Calculators.js` exports `useCalculators` as a `const` and imports the ten calculators it renders. Five of those reached back up to `Apps.js` for `ColoredInput`, and `Apps.js` imports `CalculatorsPage` from `Calculators.js` -- so the hub was in a cycle with its own leaves: Calculators.js -> calculators/ElectricalCalculators.js -> Apps.js -> Calculators.js Webpack compiles a `const` export to a live getter, and a getter read before the module body reaches the declaration THROWS rather than returning undefined. That is the whole mechanism behind this particular error, and it names the const it could not reach. `ColoredInput` is a text field with a Label welded to one edge -- the calculators' unit markers. It has no business in the module that ROUTES to the calculators, so it moved to `components/ui/Inputs.tsx`. Nothing in `components/ui` imports from `components/`, so a control kept there cannot close a loop like this again. Gallery entry added, per the standing rule. `src/import-cycles.test.js` is the guard: a small import-graph walker, scoped to hubs that export a `const` into their own subtree. It fails with the cycle printed, and it self-checks against a known cycle so it cannot pass by finding nothing. Verified red with the cycle planted back. HONEST LIMIT: the guard is static because I could not reproduce the RUNTIME error in a test. TDZ needs a module to be mid-evaluation when the getter is read, and by the time any spec body runs every module has finished; babel also papers over it, handing back undefined where webpack throws. I tried an e2e that navigates to the dashboard and collects window errors -- it passes with the cycle present, so it would have been a test that cannot fail for the reason it claims, and I deleted it rather than ship it. A react-refresh trigger did not reproduce it either. What is checkable, and what is genuinely the defect, is the cycle. 1080 jest / 60 suites, 158 in ui-layout.cy.js, clean build. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-02 12:23:10 -06:00
* loose `string`: the point of the union is that a theme must have a token by that
* name, and widening it here would let a call site name a color that resolves to
fix: break the import cycle that put useCalculators in the TDZ The dashboard threw on arrival from any other page: ReferenceError: Cannot access 'useCalculators' before initialization at Module.useCalculators at DashboardCalculators `Calculators.js` exports `useCalculators` as a `const` and imports the ten calculators it renders. Five of those reached back up to `Apps.js` for `ColoredInput`, and `Apps.js` imports `CalculatorsPage` from `Calculators.js` -- so the hub was in a cycle with its own leaves: Calculators.js -> calculators/ElectricalCalculators.js -> Apps.js -> Calculators.js Webpack compiles a `const` export to a live getter, and a getter read before the module body reaches the declaration THROWS rather than returning undefined. That is the whole mechanism behind this particular error, and it names the const it could not reach. `ColoredInput` is a text field with a Label welded to one edge -- the calculators' unit markers. It has no business in the module that ROUTES to the calculators, so it moved to `components/ui/Inputs.tsx`. Nothing in `components/ui` imports from `components/`, so a control kept there cannot close a loop like this again. Gallery entry added, per the standing rule. `src/import-cycles.test.js` is the guard: a small import-graph walker, scoped to hubs that export a `const` into their own subtree. It fails with the cycle printed, and it self-checks against a known cycle so it cannot pass by finding nothing. Verified red with the cycle planted back. HONEST LIMIT: the guard is static because I could not reproduce the RUNTIME error in a test. TDZ needs a module to be mid-evaluation when the getter is read, and by the time any spec body runs every module has finished; babel also papers over it, handing back undefined where webpack throws. I tried an e2e that navigates to the dashboard and collects window errors -- it passes with the cycle present, so it would have been a test that cannot fail for the reason it claims, and I deleted it rather than ship it. A react-refresh trigger did not reproduce it either. What is checkable, and what is genuinely the defect, is the cycle. 1080 jest / 60 suites, 158 in ui-layout.cy.js, clean build. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-02 12:23:10 -06:00
* nothing in every theme.
*/
color?: LabelProps['color'];
labelPosition?: 'left' | 'right';
/** Fill the row rather than sizing to content. */
fluid?: boolean;
}
/**
* A text field with a Label welded to one side — the calculators' unit markers ("ft", "Ω",
* "gal"), which is where all ten of them get their shape.
*
* It lives here rather than beside the calculators because it used to live in `Apps.js`,
* the module that ROUTES to the calculators. Five calculators imported it, so
* `Calculators.js` -> a calculator -> `Apps.js` -> `Calculators.js` was a cycle around the
* hub, and `useCalculators` is a `const`: webpack compiles that to a getter that throws
* rather than returning undefined when read too early. The dashboard threw on arrival for
* a whole editing session. Nothing in `components/ui` imports from `components/`, so a
* control kept here cannot close a loop like that again.
*/
export function ColoredInput({
name, value, label, color, labelPosition = 'left', fluid, style, ...props
}: ColoredInputProps) {
const labelNode = label ? <Label color={color || 'grey'}>{label}</Label> : null;
return <div style={{
display: 'flex', alignItems: 'stretch', gap: 6,
width: fluid ? '100%' : undefined, ...style,
}}>
{labelNode && labelPosition === 'left' && labelNode}
<MTextInput name={name} value={value} style={{flex: fluid ? 1 : undefined}} {...props}/>
{labelNode && labelPosition !== 'left' && labelNode}
</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
export {
MTextInput as TextInput,
MTextarea as Textarea,
MSelect as Select,
MultiSelect,
NumberInput,
Radio,
};