fix(mobile): one form sheet for every dialog, opaque and placed beside the rail

Every sheet now stands on the opaque sheet surface: the frosting the
translucent one relied on is dropped while the scrim fades, so the page
read through the fields as sharp ghost text.

On a wide window a sheet is centred in the content beside the navigation
rail instead of on the whole window, so it never lies on the rail, and it
grows to the window's height instead of stopping at 880px. On a phone the
card stands between the status bar and the dock rather than across the
dock. A sheet marked as a form fills the height of a window as short as a
phone on its side, with Cancel and Save beside the title (new `short:`
variant, m-form-sheet grid in mobile.css).

The form chrome gains a scrolling body that fades at the edges with more
behind them (useEdgeFade on the vertical axis), a date field whose
keyboard entry moves into the picker, a field wrapper for amounts with a
currency, and two-line titles. The focused sheet no longer draws the
app-wide focus frame or loses its corners, and the desktop's dark field
paint stays out of the touch shell, which painted a dark box inside every
rounded field.
This commit is contained in:
Maurice
2026-11-07 23:19:40 +01:00
parent bb725ac8d8
commit b7a91fc84e
10 changed files with 618 additions and 133 deletions
+30
View File
@@ -0,0 +1,30 @@
import { type RefObject, useLayoutEffect } from 'react';
/**
* Grows a textarea with what is written in it, so its last line is never
* sliced through the glyphs at the bottom edge the way a fixed `rows` height
* cuts a fourth line. `rows` stays the least it shows. It measures again when
* the text changes and when the field's width does (a rotation, a fold), since
* both decide how many lines the text wraps to.
*/
export function useAutoGrow(ref: RefObject<HTMLTextAreaElement | null>, value: string): void {
useLayoutEffect(() => {
const el = ref.current;
if (!el) return;
let width = -1;
const fit = () => {
width = el.clientWidth;
el.style.height = 'auto';
// scrollHeight leaves the border out; the box is border-box.
const border = el.offsetHeight - el.clientHeight;
el.style.height = `${el.scrollHeight + border}px`;
};
fit();
if (typeof ResizeObserver === 'undefined') return;
const observer = new ResizeObserver(() => {
if (el.clientWidth !== width) fit();
});
observer.observe(el);
return () => observer.disconnect();
}, [ref, value]);
}